3 #include <glibmm/i18n.h>
23 else if (n < 0.099999)
25 else if (n < 0.999999)
33 buf << fixed << setprecision(
precision(step)) << value;
38 if (event->button == 2) {
53 dynamic_cast<Gtk::Container*>(top())->add(*w);
57 dynamic_cast<Gtk::Box*>(top())->pack_start(*w, expand, fill, padding);
61 dynamic_cast<Gtk::Notebook*>(top())->append_page(*w, *label);
66 Gtk::Widget *t = top();
67 Gtk::Notebook *n = dynamic_cast<Gtk::Notebook*>(t);
69 n->append_page(*w, *manage(
new Gtk::Label(label)));
72 Gtk::Box *b = dynamic_cast<Gtk::Box*>(t);
74 b->pack_start(*w,
true,
true, 0);
77 Gtk::Container *c = dynamic_cast<Gtk::Container*>(t);
92 Gtk::Label &convolver_mono_filename_label_, Glib::RefPtr<Gdk::Pixbuf> window_icon_)
93 : fBox(), machine(machine_),
94 fWaveView(fWaveView_), convolver_filename_label(convolver_filename_label_),
95 convolver_mono_filename_label(convolver_mono_filename_label_),
96 widget(), accels(), window_icon(window_icon_), next_flags(0) {
102 void StackBoxBuilder::openVerticalMidiBox(
const char* label) {
103 openVerticalBox(label);
107 widget =
new Gtk::HBox();
109 fBox.
push(manage(widget));
113 void wnotify(gpointer data, GObject *where_the_object_was) {
114 printf(
"WN %p %p\n", where_the_object_was, data);
119 g_object_weak_ref(o->gobj(),
wnotify, GINT_TO_POINTER(n));
125 assert(fBox.
empty());
127 Glib::ListHandle<Gtk::Widget*> l = widget->get_children();
129 Glib::ListHandle<Gtk::Widget*>::iterator i = l.begin();
130 minibox =
new Gtk::VBox();
133 (*i)->reparent(*minibox);
152 mainbox = minibox = 0;
153 for (
unsigned int i = 0; i <
sizeof(mapping) /
sizeof(mapping[0]); ++i) {
154 if (name == mapping[i].name) {
156 (this->*mapping[i].func)();
157 fetch(mainbox, minibox);
162 void StackBoxBuilder::loadRackFromBuilder(
const Glib::RefPtr<GxBuilder>& bld) {
163 if (!bld->has_object(
"rackbox")) {
168 if (bld->has_object(
"minibox")) {
169 bld->find_widget(
"minibox", w);
172 bld->find_widget(
"rackbox", w);
178 for (
int i = 1; i<12;++i) {
180 if (bld->has_object(fm)) {
182 bld->find_widget(fm, fastmeter);
183 fastmeter->get_property(
"var_id",
id);
184 fastmeter->set_name(
"simplemeter");
186 Glib::signal_timeout().connect(sigc::bind<Gxw::FastMeter*>(sigc::bind<const std::string>(
187 sigc::mem_fun(*
this, &StackBoxBuilder::set_simple),
id), fastmeter), 60);
193 for (
int i = 1; i<12;++i) {
195 if (bld->has_object(fm)) {
197 bld->find_widget(fm, fastmeter);
198 fastmeter->get_property(
"var_id",
id);
201 Glib::signal_timeout().connect(sigc::bind<Gxw::FastMeter*>(sigc::bind<const std::string>(
202 sigc::mem_fun(*
this, &StackBoxBuilder::set_simple),
id), fastmeter), 60);
208 for (
int i = 1; i<12;++i) {
210 if (bld->has_object(fm)) {
212 bld->find_widget(fm, fastmeter);
213 fastmeter->get_property(
"var_id",
id);
214 fastmeter->set_name(
"simplemeter");
216 Glib::signal_timeout().connect(sigc::bind<Gxw::FastMeter*>(sigc::bind<const std::string>(
217 sigc::mem_fun(*
this, &StackBoxBuilder::set_compressor_level),
id), fastmeter), 60);
223 for (
int i = 1; i<12;++i) {
225 if (bld->has_object(fm)) {
227 bld->find_widget(fm, regler);
228 regler->get_property(
"var_id",
id);
230 Glib::signal_timeout().connect(sigc::bind<const std::string>(
231 sigc::mem_fun(*
this, &StackBoxBuilder::set_engine_value),
id), 60);
238 for (
int i = 1; i<12;++i) {
240 if (bld->has_object(fm)) {
242 bld->find_widget(fm, sw);
243 sw->get_property(
"var_id",
id);
244 sw->set_name(
"effect_on_off");
246 Glib::signal_timeout().connect(sigc::bind<Gxw::Switch*>(sigc::bind<const std::string>(
247 sigc::mem_fun(*
this, &StackBoxBuilder::set_engine_cp_value),
id),sw), 60);
255 for (
int i = 1; i<12;++i) {
257 if (bld->has_object(fm)) {
259 bld->find_widget(fm, regler);
260 regler->get_property(
"var_id",
id);
262 Glib::signal_timeout().connect(sigc::bind<Gxw::Regler*>(sigc::bind<const std::string>(
263 sigc::mem_fun(*
this, &StackBoxBuilder::set_regler_cp_value),
id),regler), 60);
270 static const char *rackbox_ids[] = {
"rackbox",
"minibox", 0 };
272 void StackBoxBuilder::loadRackFromGladeFile(
const char *fname) {
274 GxBuilder::create_from_file(
278 void StackBoxBuilder::loadRackFromGladeData(
const char *xmldesc) {
279 loadRackFromBuilder(GxBuilder::create_from_string(xmldesc, &machine, rackbox_ids));
282 void StackBoxBuilder::addwidget(Gtk::Widget *widget) {
289 void StackBoxBuilder::addSmallJConvFavButton(
const char* label,
gx_jconv::IRWindow *irw) {
290 Gtk::Button *button =
new Gtk::Button();
291 button->set_name(
"smallbutton");
292 Gtk::Label *lab =
new Gtk::Label(label);
293 Pango::FontDescription font = lab->get_style()->get_font();
294 font.set_size(7*Pango::SCALE);
295 font.set_weight(Pango::WEIGHT_NORMAL);
296 lab->modify_font(font);
297 button->add(*manage(lab));
299 lab->set_padding(5,0);
300 fBox.
add(manage(button), label);
302 button->signal_clicked().connect(
307 convolver_filename_label.set_label(jcs->
getIRFile());
311 convolver_mono_filename_label.set_label(jcs->
getIRFile());
314 void StackBoxBuilder::openSetLabelBox() {
315 Gtk::VBox *box =
new Gtk::VBox();
316 box->set_homogeneous(
false);
318 box->set_border_width(0);
319 convolver_filename_label.set_name(
"rack_label");
320 Pango::FontDescription font = convolver_filename_label.get_style()->get_font();
321 font.set_size(8*Pango::SCALE);
322 font.set_weight(Pango::WEIGHT_BOLD);
323 convolver_filename_label.modify_font(font);
324 box->pack_start(convolver_filename_label,
false,
false, 0);
330 sigc::mem_fun(*
this, &StackBoxBuilder::set_convolver_filename));
335 void StackBoxBuilder::openSetMonoLabelBox() {
336 Gtk::VBox *box =
new Gtk::VBox();
337 box->set_homogeneous(
false);
339 box->set_border_width(0);
340 convolver_mono_filename_label.set_name(
"rack_label");
341 Pango::FontDescription font = convolver_mono_filename_label.get_style()->get_font();
342 font.set_size(8*Pango::SCALE);
343 font.set_weight(Pango::WEIGHT_BOLD);
344 convolver_mono_filename_label.modify_font(font);
345 box->pack_start(convolver_mono_filename_label,
true,
false, 0);
351 sigc::mem_fun(*
this, &StackBoxBuilder::set_convolver_mono_filename));
357 Gtk::Button *button =
new Gtk::Button();
358 button->set_can_default(
false);
359 button->set_can_focus(
false);
360 Gtk::Label *lab =
new Gtk::Label(label);
365 button->add(*manage(lab));
367 Gtk::Alignment *al =
new Gtk::Alignment(0.0, 0.5, 0.0, 0.0);
368 al->add(*manage(button));
371 button->signal_clicked().connect(
375 void StackBoxBuilder::addSmallSeqButton(
const char* label,
gx_seq::SEQWindow *seqw) {
376 Gtk::Button *button =
new Gtk::Button();
377 button->set_name(
"smallbutton");
378 Gtk::Label *lab =
new Gtk::Label(label);
379 Pango::FontDescription font = lab->get_style()->get_font();
380 font.set_size(7*Pango::SCALE);
381 font.set_weight(Pango::WEIGHT_NORMAL);
382 lab->modify_font(font);
383 button->add(*manage(lab));
385 lab->set_padding(5,0);
386 fBox.
add(manage(button), label);
388 button->signal_clicked().connect(
393 Gtk::Button *button =
new Gtk::Button();
394 button->set_can_default(
false);
395 button->set_can_focus(
false);
396 Gtk::Label *lab =
new Gtk::Label(label);
401 button->add(*manage(lab));
403 Gtk::Alignment *al =
new Gtk::Alignment(0.0, 0.5, 0.0, 0.0);
404 al->add(*manage(button));
407 button->signal_clicked().connect(
411 void StackBoxBuilder::set_next_flags(
int flags) {
415 bool StackBoxBuilder::set_simple(
Gxw::FastMeter *fastmeter,
const std::string
id) {
427 bool StackBoxBuilder::set_compressor_level(
Gxw::FastMeter *fastmeter,
const std::string
id) {
439 void StackBoxBuilder::create_simple_meter(
const std::string&
id) {
442 fastmeter->set_property(
"dimen",2);
443 fastmeter->set_property(
"type",0);
444 Glib::signal_timeout().connect(sigc::bind<Gxw::FastMeter*>(sigc::bind<const std::string>(
445 sigc::mem_fun(*
this, &StackBoxBuilder::set_simple),
id), fastmeter), 60);
447 Gtk::HBox *box =
new Gtk::HBox();
448 box->set_border_width(2);
449 box->pack_start(*Gtk::manage(static_cast<Gtk::Widget*>(fastmeter)),Gtk::PACK_SHRINK);
454 void StackBoxBuilder::create_simple_c_meter(
const std::string&
id,
const std::string& idm,
const char *label) {
457 fastmeter->set_property(
"dimen",2);
458 fastmeter->set_property(
"type",0);
459 fastmeter->set_name(
"simplemeter");
460 Glib::signal_timeout().connect(sigc::bind<Gxw::FastMeter*>(sigc::bind<const std::string>(
461 sigc::mem_fun(*
this, &StackBoxBuilder::set_simple),
id), fastmeter), 60);
466 box->set_border_width(2);
467 box->pack_start(*Gtk::manage(static_cast<Gtk::Widget*>(fastmeter)),Gtk::PACK_SHRINK);
468 box->add(*Gtk::manage(static_cast<Gtk::Widget*>(w)));
469 if (label && label[0]) {
470 Gtk::VBox *boxv =
new Gtk::VBox();
472 boxv->set_homogeneous(
false);
473 boxv->set_spacing(0);
475 Gtk::Label *lab =
new Gtk::Label(label);
476 Pango::FontDescription font = lab->get_style()->get_font();
477 font.set_size(6*Pango::SCALE);
478 font.set_weight(Pango::WEIGHT_NORMAL);
479 lab->modify_font(font);
480 lab->set_name(
"beffekt_label");
481 boxv->add(*manage(lab));
482 boxv->add(*manage(box));
491 bool StackBoxBuilder::set_regler_cp_value(
Gxw::Regler * regler,
const std::string
id) {
501 bool StackBoxBuilder::set_engine_cp_value(
Gxw::Switch * sw,
const std::string
id) {
511 bool StackBoxBuilder::set_engine_value(
const std::string
id) {
521 void StackBoxBuilder::create_port_display(
const std::string&
id,
const char *label) {
523 UiReglerWithCaption<Gxw::PortDisplay> *w =
new UiReglerWithCaption<Gxw::PortDisplay>(machine,
id);
524 Glib::signal_timeout().connect(sigc::bind<const std::string>(
525 sigc::mem_fun(*
this, &StackBoxBuilder::set_engine_value),
id), 60);
527 w->set_rack_label_inverse(label);
529 w->set_rack_label(label);
535 bool StackBoxBuilder::set_pd_value(
Gxw::PortDisplay *w,
const std::string
id,
const std::string& idl,
const std::string& idh) {
541 float set = (low + high)*0.001;
550 void StackBoxBuilder::create_p_display(
const std::string&
id,
const std::string& idl,
const std::string& idh) {
552 w->set_name(
"playhead");
553 Gtk::EventBox* e_box =
new Gtk::EventBox();
554 e_box->set_size_request(-1, -1);
555 e_box->set_border_width(0);
556 e_box->set_visible_window(
true);
557 e_box->set_above_child(
true);
558 e_box->add(*manage(static_cast<Gtk::Widget*>(w)));
562 Glib::signal_timeout().connect(sigc::bind<Gxw::PortDisplay*>(sigc::bind<const std::string>(
563 sigc::bind<const std::string>(sigc::bind<const std::string>(
564 sigc::mem_fun(*
this, &StackBoxBuilder::set_pd_value),idh),idl),
id),w ), 60);
566 Glib::signal_timeout().connect(sigc::bind<Gxw::PortDisplay*>(sigc::bind<const std::string>(
567 sigc::bind<const std::string>(sigc::bind<const std::string>(
568 sigc::mem_fun(*
this, &StackBoxBuilder::set_pd_value),idh),idl),
id),w ), 2000);
572 void StackBoxBuilder::create_feedback_switch(
const char *sw_type,
const std::string&
id) {
574 Gxw::Switch *regler = static_cast<Gxw::Switch*>(sw);
576 regler->set_name(
"effect_on_off");
579 Glib::signal_timeout().connect(sigc::bind<const std::string>(
580 sigc::mem_fun(*
this, &StackBoxBuilder::set_engine_value),
id), 60);
582 Glib::signal_timeout().connect(sigc::bind<const std::string>(
583 sigc::mem_fun(*
this, &StackBoxBuilder::set_engine_value),
id), 2000);
587 void StackBoxBuilder::load_file(
const std::string&
id,
const std::string& idf) {
588 static Glib::ustring recent_filename =
"";
589 static Glib::ustring hostname =
"localhost";
591 hostname = Gio::Resolver::get_default()->lookup_by_address
598 Glib::ustring title = hostname +
": Select loop file";
599 Gtk::FileChooserDialog d( title);
600 d.set_local_only(
false);
601 d.property_destroy_with_parent().set_value(
true);
602 d.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
603 d.add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK);
605 d.add_shortcut_folder_uri(Glib::filename_to_uri(loop_dir, hostname));
607 wav.set_name(
"WAV Files");
608 wav.add_mime_type(
"audio/x-vorbis+ogg");
609 wav.add_mime_type(
"audio/x-wav");
610 wav.add_pattern(
"*.ogg");
611 wav.add_pattern(
"*.wav");
612 wav.add_pattern(
"*.WAV");
613 wav.add_pattern(
"*.Wav");
615 Gtk::FileFilter audio;
616 audio.set_name(
"Audio Files");
617 audio.add_mime_type(
"audio/*");
620 all.add_pattern(
"*");
621 all.set_name(
"All Files");
623 if (!recent_filename.empty()) {
624 d.set_uri(Glib::filename_to_uri (recent_filename, hostname));
625 }
else if ((filename.find(
"tape") != Glib::ustring::npos) && (!filename.empty())) {
626 d.set_uri(Glib::filename_to_uri (loop_dir + filename +
string(
".wav"), hostname));
628 d.set_current_folder_uri(Glib::filename_to_uri (loop_dir, hostname));
630 d.signal_response().connect(sigc::bind<Gtk::FileChooserDialog*>(sigc::bind<const std::string>(
631 sigc::bind<const std::string>(sigc::mem_fun(*
this, &StackBoxBuilder::on_file_chooser_response),idf),
id), &d) );
635 if (Gtk::Main::iteration(
false)) {
662 void StackBoxBuilder::on_file_chooser_response(
int response_id, Gtk::FileChooserDialog *d,
const std::string&
id,
const std::string& idf)
664 if( response_id == Gtk::RESPONSE_OK) {
665 static Glib::ustring hostname =
"localhost";
667 hostname = Gio::Resolver::get_default()->lookup_by_address
670 Glib::ustring filename = Glib::filename_from_uri(d->get_uri(), hostname);
671 Glib::ustring recent_filename = filename;
672 Gtk::RecentManager::Data data;
673 bool result_uncertain;
674 data.mime_type = Gio::content_type_guess(filename,
"", result_uncertain);
675 data.app_name =
"guitarix";
676 data.groups.push_back(
"loopfiles");
677 Gtk::RecentManager::get_default()->add_item(d->get_uri(), data);
689 void StackBoxBuilder::load_file_f(
const std::string&
id,
const std::string& idf) {
690 Glib::signal_timeout().connect_once(
691 sigc::bind<const std::string>(sigc::bind<const std::string>(sigc::mem_fun(
this, &StackBoxBuilder::load_file), idf),
id),100);
694 void StackBoxBuilder::create_fload_switch(
const char *sw_type,
const std::string&
id,
const std::string& idf) {
697 Gxw::Switch *regler = static_cast<Gxw::Switch*>(sw);
699 regler->set_name(
"effect_on_off");
703 sigc::bind<const std::string>(sigc::bind<const std::string>(sigc::mem_fun(
this, &StackBoxBuilder::load_file_f), idf),
id)));
707 void StackBoxBuilder::create_h_switch(
const char *sw_type,
const std::string&
id,
const char *label) {
709 UiHSwitchWithCaption *w = static_cast<UiHSwitchWithCaption*>(sw);
711 w->get_regler()->set_name(
"effect_on_off");
713 w->set_rack_label_inverse();
718 void StackBoxBuilder::create_v_switch(
const char *sw_type,
const std::string&
id,
const char *label) {
720 UiVSwitchWithCaption *w = static_cast<UiVSwitchWithCaption*>(sw);
722 w->get_regler()->set_name(
"effect_on_off");
724 w->set_rack_label_inverse();
729 void StackBoxBuilder::create_feedback_slider(
const std::string&
id,
const char *label) {
730 UiMasterReglerWithCaption<Gxw::HSlider> *w =
new UiMasterReglerWithCaption<Gxw::HSlider>(machine,
id);
732 Glib::signal_timeout().connect(sigc::bind<const std::string>(
733 sigc::mem_fun(*
this, &StackBoxBuilder::set_engine_value),
id), 60);
735 Glib::signal_timeout().connect(sigc::bind<const std::string>(
736 sigc::mem_fun(*
this, &StackBoxBuilder::set_engine_value),
id), 2000);
742 void StackBoxBuilder::create_selector(
const std::string&
id,
const char *widget_name) {
746 s =
new UiSelector<float>(machine,
id);
748 s =
new UiSelector<int>(machine,
id);
751 s->set_name(widget_name);
756 void StackBoxBuilder::create_selector_with_caption(
const std::string&
id,
const char *label) {
760 UiSelectorWithCaption<float> *sel;
761 s =
new UiSelectorWithCaption<float>(machine,
id, label);
762 sel =
static_cast<UiSelectorWithCaption<float>*
>(s);
764 sel->set_rack_label_inverse();
767 UiSelectorWithCaption<int> *sel;
768 s =
new UiSelectorWithCaption<int>(machine,
id, label);
769 sel =
static_cast<UiSelectorWithCaption<int>*
>(s);
771 sel->set_rack_label_inverse();
777 void StackBoxBuilder::openSpaceBox(
const char* label) {
778 GxVBox * box =
new GxVBox();
779 box->set_homogeneous(
true);
781 box->set_border_width(4);
787 fBox.
push(fBox.
add(manage(box), label));
791 void StackBoxBuilder::check_set_flags(
Gxw::Regler *r) {
793 r->set_name(
"show_always");
796 Gtk::PositionType pos = Gtk::POS_BOTTOM;
806 void StackBoxBuilder::create_mid_rackknob(
const std::string&
id,
const char *label) {
807 UiReglerWithCaption<Gxw::MidKnob> *w =
new UiReglerWithCaption<Gxw::MidKnob>(machine,
id);
809 w->set_rack_label_inverse(label);
811 w->set_rack_label(label);
813 check_set_flags(w->get_regler());
817 void StackBoxBuilder::create_small_rackknob(
const std::string&
id,
const char *label) {
818 UiReglerWithCaption<Gxw::SmallKnob> *w =
new UiReglerWithCaption<Gxw::SmallKnob>(machine,
id);
820 w->set_rack_label_inverse(label);
822 w->set_rack_label(label);
824 check_set_flags(w->get_regler());
828 void StackBoxBuilder::create_small_rackknobr(
const std::string&
id,
const char *label) {
829 UiReglerWithCaption<Gxw::SmallKnobR> *w =
new UiReglerWithCaption<Gxw::SmallKnobR>(machine,
id);
831 w->set_rack_label_inverse(label);
833 w->set_rack_label(label);
835 check_set_flags(w->get_regler());
839 void StackBoxBuilder::create_big_rackknob(
const std::string&
id,
const char *label) {
840 UiReglerWithCaption<Gxw::BigKnob> *w =
new UiReglerWithCaption<Gxw::BigKnob>(machine,
id);
842 w->set_rack_label_inverse(label);
844 w->set_rack_label(label);
846 check_set_flags(w->get_regler());
850 void StackBoxBuilder::addLiveWaveDisplay(
const char* label) {
851 Gtk::HBox * box =
new Gtk::HBox(
false, 4);
852 Gtk::VBox * box1 =
new Gtk::VBox(
false, 0);
853 Gtk::VBox * box2 =
new Gtk::VBox(
false, 0);
854 Gtk::EventBox* e_box =
new Gtk::EventBox();
857 e_box->set_size_request(284, 84);
859 e_box->add(fWaveView);
860 box->pack_start(*manage(box1),
true,
true, 0);
861 box->pack_start(*manage(e_box),
false,
false, 0);
862 box->pack_start(*manage(box2),
true,
true, 0);
863 fBox.
add(manage(box), label);
865 fWaveView.property_text_pos_left() = 1.5;
866 fWaveView.property_text_pos_right() = 77;
871 void StackBoxBuilder::openVerticalBox1(
const char* label) {
872 GxVBox * box =
new GxVBox();
873 box->set_homogeneous(
false);
875 box->set_border_width(0);
878 box->m_label.set_text(label);
879 box->m_label.set_name(
"effekt_label");
880 box->pack_start(box->m_label,
false,
false, 0 );
886 fBox.
push(fBox.
add(manage(box), label));
890 void StackBoxBuilder::openVerticalBox2(
const char* label) {
891 Gtk::VPaned * box =
new Gtk::VPaned();
892 box->set_border_width(0);
893 GxHBox * pbox =
new GxHBox();
895 pbox->m_label.set_text(label);
896 pbox->m_label.set_name(
"rack_label");
897 pbox->pack_start(pbox->m_label,
false,
false, 0 );
899 pbox->set_border_width(0);
900 box->pack1(*Gtk::manage(static_cast<Gtk::Widget*>(pbox)),
true,
true);
901 GxHBox * hbox =
new GxHBox();
902 hbox->set_homogeneous(
false);
903 hbox->set_spacing(1);
904 hbox->set_border_width(0);
905 box->pack2(*Gtk::manage(static_cast<Gtk::Widget*>(hbox)),
true,
true);
906 box->set_position(200);
912 void StackBoxBuilder::openFlipLabelBox(
const char* label) {
913 GxVBox * box =
new GxVBox();
914 box->set_homogeneous(
false);
916 box->set_border_width(0);
919 GxVBox * vbox =
new GxVBox();
920 vbox->set_homogeneous(
false);
921 vbox->set_spacing(0);
922 vbox->set_border_width(0);
924 GxHBox * hbox =
new GxHBox();
925 hbox->set_homogeneous(
false);
926 hbox->set_spacing(0);
927 hbox->set_border_width(0);
929 hbox->m_label.set_text(label);
930 hbox->m_label.set_name(
"effekt_label");
931 hbox->m_label.set_angle(90);
932 hbox->m_label.set_size_request(15, -1);
934 Pango::FontDescription font = hbox->m_label.get_style()->get_font();
935 font.set_size(8*Pango::SCALE);
936 font.set_weight(Pango::WEIGHT_BOLD);
937 hbox->m_label.modify_font(font);
939 hbox->add(hbox->m_label);
940 hbox->add(*manage(vbox));
941 box->add(*manage(hbox));
946 fBox.
push(fBox.
add(manage(box), label));
950 class uiSpinner:
public Gtk::SpinButton {
955 : Gtk::SpinButton(step,
precision(step)), adj(machine, id, get_adjustment()) {
956 get_adjustment()->signal_value_changed().connect(
961 void StackBoxBuilder::addNumEntry(
const std::string&
id,
const char* label_) {
962 Glib::ustring label(label_);
971 uiSpinner* spinner =
new uiSpinner(step, machine,
id);
972 spinner->get_adjustment()->configure(
975 Gtk::HBox *box =
new Gtk::HBox(homogene, 0);
976 Gtk::Label *lab =
new Gtk::Label(label);
977 box->add(*manage(lab));
978 lab->set_name(
"rack_label");
979 fBox.
add(manage(box), label);
980 fBox.
add(manage(spinner), label);
986 const std::string id;
994 : Gtk::ToggleButton(), machine(machine_), id(id_) {
996 sigc::mem_fun(
this, &Gtk::ToggleButton::set_active));
997 signal_toggled().connect(
1005 void StackBoxBuilder::addMToggleButton(
const std::string&
id,
const char* label_) {
1006 Glib::ustring label(label_);
1011 if (label.empty()) {
1014 Gdk::Color colorRed(
"#58b45e");
1015 Gdk::Color colorOwn(
"#7f7f7f");
1016 Gdk::Color colorwn(
"#000000");
1017 uiToggleButton* button =
new uiToggleButton(machine,
id);
1018 Gtk::Label* lab =
new Gtk::Label(label);
1019 Pango::FontDescription font = lab->get_style()->get_font();
1020 font.set_weight(Pango::WEIGHT_BOLD);
1021 lab->modify_font(font);
1022 button->add(*manage(lab));
1023 button->set_size_request(70, 20);
1024 Gtk::Box* box =
new Gtk::HBox(homogene, 4);
1025 Gtk::Box* box1 =
new Gtk::VBox(homogene, 4);
1026 box->set_border_width(0);
1027 box1->set_border_width(0);
1028 box->add(*manage(box1));
1029 Gtk::Box* box2 =
new Gtk::VBox(homogene, 4);
1030 box2->set_border_width(0);
1031 box2->set_size_request(6, 20);
1032 box->add(*manage(button));
1033 box->add(*manage(box2));
1034 box1->set_size_request(6, 20);
1041 button->modify_bg(Gtk::STATE_NORMAL, colorOwn);
1042 button->modify_bg(Gtk::STATE_ACTIVE, colorRed);
1043 lab->set_name(
"rack_label");
1050 const std::string& id;
1053 : Gtk::CheckButton(), machine(machine_), id(id_) {
1056 signal_toggled().connect(
1064 void StackBoxBuilder::addCheckButton(
const std::string&
id,
const char* label_) {
1068 Glib::ustring label;
1069 if (label_ && label_[0]) {
1074 Gdk::Color colorRed(
"#000000");
1075 Gdk::Color colorOwn(
"#4c5159");
1076 Gdk::Color colorba(
"#c4c0c0");
1077 Gtk::Label *lab =
new Gtk::Label(label);
1078 uiCheckButton *button =
new uiCheckButton(machine,
id);
1079 button->add(*manage(lab));
1080 fBox.
add(manage(button), label);
1081 button->modify_bg(Gtk::STATE_PRELIGHT, colorOwn);
1082 button->modify_fg(Gtk::STATE_PRELIGHT, colorRed);
1083 button->modify_text(Gtk::STATE_NORMAL, colorRed);
1084 button->modify_base(Gtk::STATE_NORMAL, colorba);
1085 Glib::RefPtr<Gtk::Style> style = lab->get_style();
1086 style->get_font().set_size(8*Pango::SCALE);
1087 style->get_font().set_weight(Pango::WEIGHT_NORMAL);
1088 lab->modify_font(style->get_font());
1093 void StackBoxBuilder::openHorizontalhideBox(
const char* label) {
1094 GxHBox * box =
new GxHBox();
1095 box->set_homogeneous(
false);
1096 box->set_spacing(0);
1097 box->set_border_width(0);
1101 if (label[0] != 0) {
1106 void StackBoxBuilder::openHorizontalTableBox(
const char* label) {
1109 GxHFrame *frame =
new GxHFrame();
1110 frame->set_label(label);
1111 frame->set_shadow_type(Gtk::SHADOW_NONE);
1112 frame->add(frame->m_hbox);
1114 frame->m_hbox.show();
1116 box = &frame->m_hbox;
1119 box =
new Gtk::HBox();
1120 fBox.
push(fBox.
add(manage(box), label));
1122 box->set_homogeneous(
false);
1123 box->set_spacing(1);
1124 box->set_border_width(0);
1127 void StackBoxBuilder::openPaintBox2(
const char* label) {
1128 GxEventBox *box =
new GxEventBox();
1129 box->m_eventbox.set_name(label);
1130 box->set_homogeneous(
false);
1131 box->set_spacing(0);
1132 box->set_border_width(0);
1135 fBox.
push(&box->m_hbox);
1138 void StackBoxBuilder::openTabBox(
const char* label) {
1139 GxNotebookBox * box =
new GxNotebookBox();
1140 fBox.
push(fBox.
add(manage(box), label));
1143 void StackBoxBuilder::openpaintampBox(
const char* label) {
1145 box->m_hbox.set_border_width(4);
1146 box->set_name(label);
1147 box->set_tooltip_text(label);
1150 fBox.
push(&box->m_hbox);
1153 void StackBoxBuilder::closeBox() {
1154 assert(!fBox.
empty());
1158 void StackBoxBuilder::openHorizontalBox(
const char* label) {
1161 GxHFrame *frame =
new GxHFrame();
1162 frame->set_label(label);
1163 frame->set_shadow_type(Gtk::SHADOW_NONE);
1164 frame->add(frame->m_hbox);
1166 frame->m_hbox.show();
1168 box = &frame->m_hbox;
1171 box =
new Gtk::HBox();
1172 fBox.
push(fBox.
add(manage(box), label));
1174 box->set_homogeneous(
false);
1175 box->set_spacing(1);
1176 box->set_border_width(0);
1179 void StackBoxBuilder::openVerticalBox(
const char* label) {
1180 GxVBox * box =
new GxVBox();
1181 box->set_homogeneous(
false);
1182 box->set_spacing(1);
1183 box->set_border_width(0);
1186 box->m_label.set_text(label);
1187 box->m_label.set_name(
"rack_effect_label");
1188 Glib::RefPtr<Gtk::Style> style = box->m_label.get_style();
1189 style->get_font().set_size(8*Pango::SCALE);
1190 style->get_font().set_weight(Pango::WEIGHT_BOLD);
1191 box->m_label.modify_font(style->get_font());
1192 box->pack_start(box->m_label,
false,
false, 0 );
1195 box->m_label.show();
1198 fBox.
push(fBox.
add(manage(box), label));
1202 void StackBoxBuilder::openFrameBox(
const char* label) {
1206 GxHFrame *frame =
new GxHFrame();
1207 frame->set_label(label);
1208 frame->set_shadow_type(Gtk::SHADOW_NONE);
1209 frame->add(frame->m_hbox);
1211 frame->m_hbox.show();
1213 box = &frame->m_hbox;
1216 box =
new Gtk::HBox();
1217 fBox.
push(fBox.
add(manage(box), label));
1219 box->set_homogeneous(
false);
1220 box->set_spacing(1);
1221 box->set_border_width(2);