26 #include <gxw/GxLevelSlider.h>
27 #include <gtkmm/accelmap.h>
35 TextLoggingBox::tab_table TextLoggingBox::tagdefs[] = {
36 {
"colinfo",
"#cccccc"},
37 {
"colwarn",
"#77994f"},
38 {
"colerr",
"#ff8800"},
43 ok_button(Gtk::Stock::OK),
47 highest_unseen_msg_level(-1),
50 set_default_size(640, 320);
53 set_gravity(Gdk::GRAVITY_SOUTH);
54 set_keep_below(
false);
55 set_title(_(
"Logging Window"));
56 set_type_hint(Gdk::WINDOW_TYPE_HINT_UTILITY);
59 box.set_border_width(0);
60 scrollbox.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
64 tbox.set_wrap_mode(Gtk::WRAP_WORD_CHAR);
65 tbox.set_border_width(0);
66 tbox.set_editable(
false);
67 tbox.set_cursor_visible(
false);
68 tbox.set_pixels_above_lines(0);
69 tbox.set_pixels_below_lines(2);
70 tbox.set_justification(Gtk::JUSTIFY_LEFT);
71 tbox.set_left_margin(5);
74 Glib::RefPtr<Gtk::TextBuffer> buffer = tbox.get_buffer();
76 tags[i] = buffer->create_tag(tagdefs[i].tagname);
77 tags[i]->property_foreground() = tagdefs[i].tag_color;
81 box.pack_end(buttonbox, Gtk::PACK_SHRINK);
82 buttonbox.set_layout(Gtk::BUTTONBOX_END);
83 buttonbox.add(ok_button);
84 buttonbox.set_border_width(4);
85 ok_button.set_can_default();
86 ok_button.grab_default();
87 ok_button.signal_clicked().connect(sigc::mem_fun(
this, &TextLoggingBox::hide));
90 tbox.set_size_request(-1, 50);
93 sigc::mem_fun(*
this, &TextLoggingBox::show_msg));
100 bool TextLoggingBox::on_key_press_event(GdkEventKey *event) {
101 if (event->keyval ==
GDK_KEY_Escape && (event->state & Gtk::AccelGroup::get_default_mod_mask()) == 0) {
105 return Gtk::Window::on_key_press_event(event);
108 void TextLoggingBox::on_show() {
110 Gtk::Window::on_show();
113 void TextLoggingBox::on_hide() {
114 highest_unseen_msg_level = -1;
115 Gtk::Window::on_hide();
121 highest_unseen_msg_level = -1;
124 void TextLoggingBox::show_msg(
string msgbuf,
GxLogger::MsgType msgtype,
bool plugged) {
128 Glib::RefPtr<Gtk::TextBuffer> buffer = tbox.get_buffer();
131 const int nlines = 50;
134 int linecount = buffer->get_line_count();
135 if (linecount >= nlines) {
136 Gtk::TextIter iter1 = buffer->get_iter_at_line(0);
137 Gtk::TextIter iter2 = buffer->get_iter_at_line(1);
138 buffer->erase(iter1, iter2);
141 Gtk::TextIter iter = buffer->end();
142 if (buffer->get_char_count() > 0) {
143 iter = buffer->insert(iter,
"\n");
146 buffer->insert_with_tag(iter, msgbuf, tags[msgtype]);
147 scrollbox.get_vadjustment()->set_value(10000);
151 if (msgtype > highest_unseen_msg_level) {
152 highest_unseen_msg_level = msgtype;
163 SelectMidiChannel::SelectMidiChannel(BaseObjectType* cobject, Glib::RefPtr<gx_gui::GxBuilder> bld,
gx_engine::GxMachineBase& m)
164 : Gtk::Window(cobject),
169 signal_delete_event().connect(sigc::mem_fun(*
this, &SelectMidiChannel::on_delete_event));
170 bld->find_widget(
"description", description);
171 bld->find_widget(
"channelcombo", channelcombo);
172 const char *v_id = machine.get_parameter(
"system.midi_channel").getValueNames()[machine.get_parameter_value<
int>(
"system.midi_channel")].value_id;
174 Glib::RefPtr<Gtk::TreeModel> model = channelcombo->get_model();
175 for (Gtk::TreeIter i = model->children().begin(); i; ++i, ++n) {
179 channelcombo->set_active(n);
183 bld->find_widget(
"ok_button", button);
184 button->signal_clicked().connect(
185 sigc::mem_fun(*
this, &SelectMidiChannel::on_ok_button));
186 bld->find_widget(
"cancel_button", button);
187 button->signal_clicked().connect(
188 sigc::mem_fun(*
this, &SelectMidiChannel::on_cancel_button));
196 Glib::RefPtr<gx_gui::GxBuilder> bld = gx_gui::GxBuilder::create_from_file(opt.
get_builder_filepath(
"midi_channel.glade"), &m);
198 bld->get_toplevel_derived(
"selectmidichannel", w,
199 sigc::bind(sigc::ptr_fun(SelectMidiChannel::create_from_builder), bld, sigc::ref(m)));
203 bool SelectMidiChannel::on_key_press_event(GdkEventKey *event) {
204 if (event->keyval ==
GDK_KEY_Escape && (event->state & Gtk::AccelGroup::get_default_mod_mask()) == 0) {
208 return Gtk::Window::on_key_press_event(event);
211 bool SelectMidiChannel::on_delete_event(GdkEventAny* event) {
216 void SelectMidiChannel::on_ok_button() {
218 channelcombo->get_active()->get_value(1, s);
228 void SelectMidiChannel::on_cancel_button() {
242 typedef list<GtkAccelKey> accel_list;
243 unsigned int next_key;
245 static gboolean add_keys_to_list(GtkAccelKey *key, GClosure *cl, gpointer data);
247 KeyFinder(Glib::RefPtr<Gtk::AccelGroup> group);
252 KeyFinder::KeyFinder(Glib::RefPtr<Gtk::AccelGroup> group) {
254 gtk_accel_group_find(group->gobj(), add_keys_to_list, static_cast<gpointer>(&l));
257 KeyFinder::~KeyFinder() {
260 gboolean KeyFinder::add_keys_to_list(GtkAccelKey *key, GClosure *cl, gpointer data) {
261 accel_list* l = (accel_list*)data;
262 if (key->accel_mods == GDK_SHIFT_MASK) {
268 int KeyFinder::operator()() {
269 while (next_key <= GDK_z) {
271 for (accel_list::iterator i = l.begin(); i != l.end(); ++i) {
272 if (next_key == i->accel_key) {
294 static unsigned int keysep[];
301 unsigned int TubeKeys::keysep[] = {
302 GDK_a, GDK_b, GDK_c, GDK_d, GDK_e, 0,
304 GDK_g, GDK_h, GDK_i, GDK_j, 0,
305 GDK_k, GDK_l, GDK_m, GDK_n, 0,
306 GDK_o, GDK_p, GDK_q, GDK_r
310 if (ks <
sizeof(keysep)/
sizeof(keysep[0])) {
320 sigc::mem_fun(
this, &GxUiRadioMenu::set_value));
324 Glib::RefPtr<Gtk::UIManager>& uimanager, Glib::RefPtr<Gtk::ActionGroup>& actiongroup) {
328 Glib::ustring s = prefix;
329 Gtk::RadioButtonGroup group;
337 Glib::ustring actname = Glib::ustring::compose(
"Enum_%1.%2", param.
id(), p->
value_id);
338 s += Glib::ustring::compose(
"<menuitem action=\"%1\"/>", actname);
339 Glib::RefPtr<Gtk::RadioAction> act = Gtk::RadioAction::create(group, actname, param.
value_label(*p));
340 act->property_value().set_value(static_cast<int>(param.
getLowerAsFloat())+i);
342 actiongroup->add(act, Gtk::AccelKey(Glib::ustring::compose(
"<shift>%1", (
char)c)));
344 actiongroup->add(act);
347 act->signal_changed().connect(
348 sigc::mem_fun(*
this, &GxUiRadioMenu::on_changed));
354 uimanager->add_ui_from_string(s);
357 void GxUiRadioMenu::set_value(
unsigned int v) {
358 action->set_current_value(v);
361 void GxUiRadioMenu::on_changed(Glib::RefPtr<Gtk::RadioAction> act) {
371 : window(0), tag(), need_thaw(false), size_x(-1), size_y(-1) {
378 void Freezer::freeze(Gtk::Window *w,
int width,
int height) {
385 Glib::RefPtr<Gdk::Window> win = window->get_window();
388 win->freeze_updates();
406 freeze(w, width, -1);
412 if (wd >= width && ht == height) {
415 freeze(w, width, height);
416 w->set_size_request(width, height);
419 bool Freezer::thaw_timeout() {
426 window->set_size_request(-1,-1);
432 void Freezer::do_thaw() {
433 size_x = size_y = -1;
434 Glib::RefPtr<Gdk::Window> win = window->get_window();
440 Glib::signal_idle().connect_once(work);
448 void Freezer::thaw() {
459 Glib::RefPtr<Gdk::Window> win = window->get_window();
460 if (win && win->get_state()) {
465 if (size_x == width) {
466 window->set_size_request(-1,-1);
471 if (size_x <= width && size_y == height) {
472 window->set_size_request(-1,-1);
476 if (!tag.connected()) {
477 tag = Glib::signal_timeout().connect(sigc::mem_fun(*
this, &Freezer::thaw_timeout), 500);
489 gx_engine::GxMachineBase& machine_,
const std::string& id_,
const Glib::ustring& name,
const Glib::ustring& icon_name,
490 const Glib::ustring& label,
const Glib::ustring& tooltip,
492 : Gtk::ToggleAction(name, icon_name, label, tooltip, is_active),
497 sigc::mem_fun(
this, &UiToggleAction::set_active));
506 machine.set_parameter_value(
id, get_active());
510 Gtk::PolicyType hp, vp;
511 w.get_policy(hp, vp);
512 w.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
513 w.set_policy(hp, vp);
520 void MainWindow::maybe_shrink_horizontally(
bool preset_no_rack) {
521 Glib::RefPtr<Gdk::Window> w = window->get_window();
525 int state = w->get_state();
526 if (state & (Gdk::WINDOW_STATE_MAXIMIZED | Gdk::WINDOW_STATE_FULLSCREEN)) {
529 Gtk::Requisition req;
530 window->size_request(req);
532 window->get_position(x, y);
534 geom.min_width = req.width;
535 geom.min_height = req.height;
536 w->set_geometry_hints(geom, Gdk::HINT_MIN_SIZE);
537 if (preset_no_rack) {
542 w->move_resize(x, y, req.width, req.height);
548 void MainWindow::on_move_tuner() {
549 bool v = actions.
tuner->get_active();
550 if(tunerbox->get_parent() == upper_rackbox) {
551 tunerbox->set_visible(
false);
552 upper_rackbox->remove(*tunerbox);
553 tuner_box_no_rack->pack_start(*tunerbox,
false,
false);
554 }
else if(tunerbox->get_parent() == tuner_box_no_rack) {
555 tunerbox->set_visible(
false);
556 tuner_box_no_rack->remove(*tunerbox);
557 upper_rackbox->add(*tunerbox);
559 on_livetuner_toggled();
560 tunerbox->set_visible(v);
564 void MainWindow::on_show_tuner() {
565 bool v = actions.
tuner->get_active();
566 on_livetuner_toggled();
567 tunerbox->set_visible(v);
571 void MainWindow::load_widget_pointers() {
572 bld->get_toplevel(
"MainWindow", window);
573 bld->find_widget(
"tunerbox", tunerbox);
574 bld->find_widget(
"tuner_box_no_rack", tuner_box_no_rack);
575 bld->find_widget(
"vrack_scrolledbox", vrack_scrolledbox);
576 bld->find_widget(
"stereorackcontainerH", stereorackcontainerH);
577 bld->find_widget(
"stereorackcontainerV", stereorackcontainerV);
578 bld->find_widget(
"rackcontainer", rackcontainer);
579 bld->find_widget(
"stereorackbox", stereorackbox);
580 bld->find_widget(
"monorackcontainer", monocontainer);
581 bld->find_widget(
"monoampcontainer:ampdetails", monoampcontainer);
582 bld->find_widget(
"main_vpaned", main_vpaned);
583 bld->find_widget(
"amp_toplevel_box", amp_toplevel_box);
584 bld->find_widget(
"monobox", monobox);
585 bld->find_widget(
"upper_rackbox", upper_rackbox);
586 bld->find_widget(
"preset_scrolledbox", preset_scrolledbox);
587 bld->find_widget(
"preset_box_no_rack", preset_box_no_rack);
588 bld->find_widget(
"effects_frame_paintbox", effects_frame_paintbox);
589 bld->find_widget(
"insert_image", insert_image);
590 bld->find_widget(
"status_image", status_image);
591 bld->find_widget(
"jackd_image", jackd_image);
592 bld->find_widget(
"logstate_image", logstate_image);
593 bld->find_widget(
"menubox", menubox);
594 bld->find_widget(
"show_rack:barbutton", show_rack_button);
595 bld->find_widget(
"rack_order_h:barbutton", rack_order_h_button);
596 bld->find_widget(
"config_mode:barbutton", config_mode_button);
597 bld->find_widget(
"liveplay:barbutton", liveplay_button);
598 bld->find_widget(
"tuner:barbutton", tuner_button);
599 bld->find_widget(
"effects:barbutton", effects_button);
600 bld->find_widget(
"presets:barbutton", presets_button);
601 bld->find_widget(
"compress:barbutton", compress_button);
602 bld->find_widget(
"expand:barbutton", expand_button);
603 bld->find_widget(
"effects_toolpalette", effects_toolpalette);
604 bld->find_widget(
"amp_background:ampbox", amp_background);
605 bld->find_widget(
"tuner_on_off", tuner_on_off);
606 bld->find_widget(
"tuner_mode", tuner_mode);
607 bld->find_widget(
"tuner_reference_pitch", tuner_reference_pitch);
608 bld->find_widget(
"tuner_tuning", tuner_tuning);
609 bld->find_widget(
"tuner_temperament", tuner_temperament);
610 bld->find_widget(
"racktuner", racktuner);
611 bld->find_widget(
"ampdetail_compress:effect_reset", ampdetail_compress);
612 bld->find_widget(
"ampdetail_expand:effect_reset", ampdetail_expand);
613 bld->find_widget(
"ampdetail_mini", ampdetail_mini);
614 bld->find_widget(
"ampdetail_normal", ampdetail_normal);
615 bld->find_widget(
"fastmeterL", fastmeter[0]);
616 bld->find_widget(
"fastmeterR", fastmeter[1]);
617 bld->find_widget(
"preset_status", preset_status);
618 bld->find_widget(
"midi_out_box", midi_out_box);
619 bld->find_widget(
"midi_out_normal", midi_out_normal);
620 bld->find_widget(
"midi_out_mini", midi_out_mini);
621 bld->find_widget(
"midi_out_compress:effect_reset", midi_out_compress);
622 bld->find_widget(
"midi_out_expand:effect_reset", midi_out_expand);
623 bld->find_widget(
"midi_out_presets_mini", midi_out_presets_mini);
624 bld->find_widget(
"midi_out_presets_normal", midi_out_presets_normal);
625 bld->find_widget(
"channel1_button", channel1_button);
626 bld->find_widget(
"channel1_box", channel1_box);
627 bld->find_widget(
"channel2_button", channel2_button);
628 bld->find_widget(
"channel2_box", channel2_box);
629 bld->find_widget(
"channel3_button", channel3_button);
630 bld->find_widget(
"channel3_box", channel3_box);
634 void MainWindow::set_next_preset_controller() {
640 void MainWindow::set_previus_preset_controller() {
646 void MainWindow::on_select_preset(
int idx) {
650 void MainWindow::on_next_preset() {
656 void MainWindow::on_previus_preset() {
662 void MainWindow::rebuild_preset_menu() {
663 if (preset_list_merge_id) {
664 uimanager->remove_ui(preset_list_merge_id);
665 uimanager->remove_action_group(preset_list_actiongroup);
666 preset_list_menu_bank.clear();
667 preset_list_merge_id = 0;
668 preset_list_actiongroup.reset();
669 uimanager->ensure_update();
678 preset_list_actiongroup = Gtk::ActionGroup::create(
"PresetList");
680 Glib::ustring s =
"<menubar><menu action=\"PresetsMenu\"><menu action=\"PresetListMenu\">";
683 Glib::ustring actname =
"PresetList_" + i->name;
684 Glib::RefPtr<Gtk::Action> action = Gtk::Action::create(actname, i->name);
685 preset_list_actiongroup->add(
686 action, sigc::bind(sigc::mem_fun(*
this, &MainWindow::on_select_preset), idx));
689 Gtk::AccelMap::change_entry(action->get_accel_path(), c, Gdk::ModifierType(0),
true);
691 s += Glib::ustring::compose(
"<menuitem action=\"%1\"/>", actname);
693 s +=
"</menu></menu></menubar>";
694 uimanager->insert_action_group(preset_list_actiongroup);
695 preset_list_merge_id = uimanager->add_ui_from_string(s);
696 dynamic_cast<Gtk::MenuItem*>(uimanager->get_widget(
"/menubar/PresetsMenu/PresetListMenu"))->set_label(_(
"_Bank: ")+preset_list_menu_bank);
699 void MainWindow::show_selected_preset() {
705 rebuild_preset_menu();
708 preset_status->set_text(t);
711 bool MainWindow::is_variable_size() {
715 void MainWindow::maybe_change_resizable() {
716 Glib::RefPtr<Gdk::Window> w = window->get_window();
717 if (w && w->get_state() != 0) {
720 if (!is_variable_size() && window->get_resizable()) {
721 window->set_resizable(
false);
722 }
else if (!window->get_resizable()) {
723 window->set_resizable(
true);
727 void MainWindow::set_vpaned_handle() {
729 main_vpaned->get_handle_window()->get_size(w, h);
731 main_vpaned->set_position(pos);
734 void MainWindow::on_show_rack() {
736 if (rackbox_stacked_vertical()) {
737 w = stereorackcontainerV;
742 actions.
rackh->set_sensitive(v);
743 stereorackcontainer.set_visible(v);
744 rack_order_h_button->set_visible(v);
747 compress_button->set_visible(!c);
748 expand_button->set_visible(c);
750 compress_button->set_visible(v);
751 expand_button->set_visible(v);
753 if (actions.
presets->get_active() && preset_scrolledbox->get_mapped()) {
757 midi_out_box->set_visible(actions.
midi_out->get_active());
762 main_vpaned->set_position(oldpos);
764 monoampcontainer->show();
766 vrack_scrolledbox->set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_ALWAYS);
767 vrack_scrolledbox->set_size_request(scrl_size_x, scrl_size_y);
768 if (preset_scrolledbox->get_parent() != main_vpaned) {
769 preset_box_no_rack->remove(*preset_scrolledbox);
770 main_vpaned->add(*preset_scrolledbox);
771 change_expand(*preset_box_no_rack,
false);
772 change_expand(*main_vpaned,
true);
775 Glib::RefPtr<Gdk::Window> win = window->get_window();
776 if (!win || win->get_state() == 0) {
777 Gtk::Requisition req;
778 window->size_request(req);
781 if (win && actions.
presets->get_active()) {
782 freezer.
set_slot(sigc::mem_fun(
this, &MainWindow::set_vpaned_handle));
786 if (actions.
midi_out->get_active()) {
787 midi_out_box->set_visible(
false);
793 oldpos = main_vpaned->get_position();
795 monoampcontainer->hide();
797 if (preset_scrolledbox->get_parent() == main_vpaned) {
798 main_vpaned->remove(*preset_scrolledbox);
799 preset_box_no_rack->add(*preset_scrolledbox);
800 change_expand(*main_vpaned,
false);
801 change_expand(*preset_box_no_rack,
true);
803 preset_box_no_rack->set_visible(actions.
presets->get_active());
804 vrack_scrolledbox->set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_NEVER);
805 vrack_scrolledbox->get_size_request(scrl_size_x, scrl_size_y);
806 vrack_scrolledbox->set_size_request(-1,-1);
807 if (actions.
presets->get_active()) {
808 maybe_shrink_horizontally(
true);
810 maybe_shrink_horizontally();
813 maybe_change_resizable();
816 void MainWindow::on_compress_all() {
818 on_ampdetail_switch(
true,
true);
821 compress_button->set_visible(
false);
822 expand_button->set_visible(
true);
825 void MainWindow::on_expand_all() {
827 on_ampdetail_switch(
false,
true);
830 compress_button->set_visible(
true);
831 expand_button->set_visible(
false);
834 void MainWindow::on_rack_configuration() {
838 actions.
tuner->set_sensitive(!v);
839 actions.
compress->set_sensitive(!v);
840 actions.
expand->set_sensitive(!v);
842 Gtk::Requisition req;
843 monobox->size_request(req);
846 szg_rack_units->set_ignore_hidden(v);
849 pre_act = actions.
presets->get_active();
851 actions.
presets->set_active(
false);
854 effects_frame_paintbox->show();
855 upper_rackbox->hide();
856 Gtk::Requisition req2;
857 effects_frame_paintbox->size_request(req2);
858 int width = req.width;
860 if (rackbox_stacked_vertical()) {
863 if (req2.width & 1) {
866 width -= req2.width/2;
869 effects_frame_paintbox->set_size_request(req2.width, -1);
870 monobox->set_size_request(width,-1);
873 effects_frame_paintbox->hide();
875 upper_rackbox->show();
876 effects_frame_paintbox->set_size_request(-1,-1);
877 monobox->set_size_request(-1,-1);
879 actions.
presets->set_active(
true);
884 maybe_shrink_horizontally();
888 void MainWindow::on_show_plugin_bar() {
893 effects_frame_paintbox->set_visible(v);
897 maybe_shrink_horizontally();
901 void MainWindow::move_widget(Gtk::Widget& w, Gtk::Box& b1, Gtk::Box& b2) {
911 int MainWindow::rackbox_stacked_vertical()
const {
912 return !actions.
rackh->get_active();
915 void MainWindow::change_expand(Gtk::Widget& w,
bool value) {
916 Gtk::Box *p = dynamic_cast<Gtk::Box*>(w.get_parent());
918 unsigned int padding;
919 GtkPackType pack_type;
920 gtk_box_query_child_packing(p->gobj(), w.gobj(), &expand, &fill, &padding, &pack_type);
921 gtk_box_set_child_packing(p->gobj(), w.gobj(), value, value, padding, pack_type);
925 Gtk::Allocation alloc = stereorackcontainer.get_allocation();
926 double lim = alloc.get_y() + alloc.get_height() - pagesize;
930 return min(off+step_size, lim);
934 Gtk::Allocation alloc = monorackcontainer.get_allocation();
935 if (off < alloc.get_y()) {
938 return max(off-step_size,
double(alloc.get_y()));
941 void MainWindow::on_dir_changed() {
945 move_widget(stereorackcontainer, *stereorackcontainerV, *stereorackcontainerH);
946 change_expand(*monobox,
true);
947 stereorackbox->show();
949 move_widget(stereorackcontainer, *stereorackcontainerH, *stereorackcontainerV);
950 change_expand(*monobox,
false);
951 stereorackbox->hide();
952 maybe_shrink_horizontally();
956 void MainWindow::on_configure_event(GdkEventConfigure *ev) {
957 if (freezer.
check_thaw(ev->width, ev->height)) {
966 if (ch == &monorackcontainer && !actions.
rackh->get_active()) {
967 stereorackcontainer.queue_draw();
976 RackBox *MainWindow::add_rackbox_internal(
PluginUI& plugin, Gtk::Widget *mainwidget, Gtk::Widget *miniwidget,
977 bool mini,
int pos,
bool animate, Gtk::Widget *bare) {
982 r->
pack(mainwidget, miniwidget, szg_rack_units);
985 monorackcontainer.
add(*manage(r), pos);
987 stereorackcontainer.
add(*manage(r), pos);
996 Gtk::Widget *mainwidget = 0;
997 Gtk::Widget *miniwidget = 0;
1003 boxbuilder.
fetch(mainwidget, miniwidget);
1006 return add_rackbox_internal(pl, mainwidget, miniwidget, mini, pos, animate);
1014 void MainWindow::on_show_values() {
1017 "style \"ShowValue\" {\n"
1020 "class \"*GxRegler*\" style:highest \"ShowValue\"\n";
1021 gtk_rc_parse_string(s.c_str());
1022 gtk_rc_reset_styles(gtk_settings_get_default());
1025 void MainWindow::on_preset_action() {
1027 if (!v && preset_scrolledbox->get_mapped()) {
1030 maybe_change_resizable();
1031 if (v && !actions.
show_rack->get_active()) {
1032 Glib::RefPtr<Gdk::Window> win = window->get_window();
1033 if (!win || win->get_state() == 0) {
1034 Gtk::Requisition req;
1035 window->size_request(req);
1039 preset_box_no_rack->set_visible(v);
1047 bool MainWindow::on_my_leave_out(GdkEventCrossing *focus) {
1048 Glib::RefPtr<Gdk::Window> wind = window->get_window();
1053 bool MainWindow::on_my_enter_in(GdkEventCrossing *focus) {
1054 Glib::RefPtr<Gdk::Window> wind = window->get_window();
1055 Gdk::Cursor cursor(Gdk::HAND1);
1056 wind->set_cursor(cursor);
1060 void MainWindow::add_toolitem(
PluginUI& pl, Gtk::ToolItemGroup *gw) {
1061 Gtk::ToolItem *tb =
new Gtk::ToolItem();
1062 tb->set_use_drag_window(
true);
1063 tb->signal_drag_begin().connect(sigc::bind(sigc::mem_fun(*
this, &MainWindow::on_ti_drag_begin), sigc::ref(pl)));
1064 tb->signal_drag_end().connect(sigc::mem_fun(*
this, &MainWindow::on_ti_drag_end));
1065 tb->signal_drag_data_delete().connect(sigc::bind(sigc::mem_fun(*
this, &MainWindow::on_ti_drag_data_delete), pl.
get_id()));
1066 tb->signal_button_press_event().connect(sigc::bind(sigc::mem_fun(*
this, &MainWindow::on_ti_button_press), pl.
get_id()));
1067 tb->add_events(Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK);
1068 tb->signal_leave_notify_event().connect(sigc::mem_fun(*
this, &MainWindow::on_my_leave_out));
1069 tb->signal_enter_notify_event().connect(sigc::mem_fun(*
this, &MainWindow::on_my_enter_in));
1070 std::vector<Gtk::TargetEntry> listTargets;
1072 listTargets.push_back(Gtk::TargetEntry(
"application/x-gtk-tool-palette-item-mono", Gtk::TARGET_SAME_APP, 0));
1074 listTargets.push_back(Gtk::TargetEntry(
"application/x-gtk-tool-palette-item-stereo", Gtk::TARGET_SAME_APP, 0));
1076 tb->drag_source_set(listTargets, Gdk::BUTTON1_MASK, Gdk::ACTION_MOVE);
1077 tb->signal_drag_data_get().connect(sigc::bind(sigc::mem_fun(*
this, &MainWindow::on_ti_drag_data_get), pl.
get_id()));
1078 Gtk::Image *img =
new Gtk::Image(pl.
icon);
1080 img->set_tooltip_text(pl.
tooltip);
1082 tb->add(*manage(img));
1085 gw->add(*manage(tb));
1089 bool MainWindow::on_visibility_notify(GdkEventVisibility *ev) {
1090 bool v = ev->state != GDK_VISIBILITY_FULLY_OBSCURED;
1091 if (v == is_visible) {
1098 void MainWindow::on_live_play() {
1102 void MainWindow::on_ti_drag_begin(
const Glib::RefPtr<Gdk::DragContext>& context,
const PluginUI& plugin) {
1103 drag_icon =
new DragIcon(plugin, context, options);
1106 void MainWindow::on_ti_drag_end(
const Glib::RefPtr<Gdk::DragContext>& context) {
1113 void MainWindow::on_ti_drag_data_get(
const Glib::RefPtr<Gdk::DragContext>& context, Gtk::SelectionData& selection,
int info,
int timestamp,
const char *effect_id) {
1114 selection.set(*context->get_targets().begin(), effect_id);
1118 Gtk::ToolItem *toolitem = plugin_dict[name]->toolitem;
1124 void MainWindow::on_ti_drag_data_delete(
const Glib::RefPtr<Gdk::DragContext>& context,
const char *effect_id) {
1128 bool MainWindow::on_ti_button_press(GdkEventButton *ev,
const char *effect_id) {
1129 if (ev->type == GDK_2BUTTON_PRESS) {
1136 void MainWindow::on_tp_drag_data_received(
const Glib::RefPtr<Gdk::DragContext>& context,
int x,
int y,
const Gtk::SelectionData& data,
int info,
int timestamp) {
1137 Glib::ustring
id = data.get_data_as_string();
1141 p->
group->set_collapsed(
false);
1144 void MainWindow::jack_connection() {
1146 if (!connect_jack(v)) {
1151 void MainWindow::on_portmap_response(
int) {
1155 void MainWindow::on_portmap_activate() {
1161 if (portmap_window) {
1166 sigc::mem_fun(*
this, &MainWindow::on_portmap_response));
1168 if (!portmap_window) {
1171 delete portmap_window;
1176 void MainWindow::on_miditable_toggle() {
1180 void MainWindow::change_skin(Glib::RefPtr<Gtk::RadioAction> action) {
1181 set_new_skin(options.
skin[action->get_current_value()]);
1184 void MainWindow::set_new_skin(
const Glib::ustring& skin_name) {
1185 if (!skin_name.empty()) {
1188 "gx_head_" + skin_name +
".rc");
1189 gtk_rc_parse(rcfile.c_str());
1190 gtk_rc_reset_styles(gtk_settings_get_default());
1195 void MainWindow::add_skin_menu() {
1196 Glib::ustring s =
"<menubar><menu action=\"OptionsMenu\"><menu action=\"SkinMenu\">";
1198 Gtk::RadioButtonGroup sg;
1199 for (vector<Glib::ustring>::iterator i = options.
skin.
skin_list.begin();
1202 Glib::ustring name = *i;
1203 Glib::ustring actname = Glib::ustring::compose(
"ChangeSkin_%1", name);
1204 s += Glib::ustring::compose(
"<menuitem action=\"%1\"/>", actname);
1205 Glib::RefPtr<Gtk::RadioAction> action = Gtk::RadioAction::create(sg, actname, name);
1207 action->set_active(
true);
1209 actions.
group->add(action);
1211 actions.
skin = action;
1213 action->property_value().set_value(idx++);
1215 actions.
skin->signal_changed().connect(
1216 sigc::mem_fun(*
this, &MainWindow::change_skin));
1217 s.append(
"</menu></menu></menubar>");
1218 uimanager->add_ui_from_string(s);
1227 void MainWindow::user_disable_latency_warn(Gtk::CheckButton* disable_warn) {
1231 int MainWindow::gx_wait_latency_warn() {
1232 Gtk::Dialog warn_dialog;
1234 warn_dialog.property_destroy_with_parent().set_value(
true);
1236 Gtk::VBox box(0, 4);
1237 Gtk::Label labelt(_(
"\nWARNING\n"));
1239 _(
"CHANGING THE JACK_BUFFER_SIZE ON THE FLY \n"
1240 "MAY CAUSE UNPREDICTABLE EFFECTS \n"
1241 "TO OTHER RUNNING JACK APPLICATIONS. \n"
1242 "DO YOU WANT TO PROCEED ?"));
1243 Gdk::Color colorGreen(
"#969292");
1244 labelt1.modify_fg(Gtk::STATE_NORMAL, colorGreen);
1245 Pango::FontDescription font = labelt1.get_style()->get_font();
1246 font.set_size(10*Pango::SCALE);
1247 font.set_weight(Pango::WEIGHT_BOLD);
1248 labelt1.modify_font(font);
1250 Gdk::Color colorWhite(
"#ffffff");
1251 labelt.modify_fg(Gtk::STATE_NORMAL, colorWhite);
1252 font = labelt.get_style()->get_font();
1253 font.set_size(14*Pango::SCALE);
1254 font.set_weight(Pango::WEIGHT_BOLD);
1255 labelt.modify_font(font);
1260 Gtk::HBox box1(0, 4);
1261 Gtk::HBox box2(0, 4);
1263 Gtk::CheckButton disable_warn;
1264 disable_warn.signal_clicked().connect(
1266 sigc::mem_fun(*
this, &MainWindow::user_disable_latency_warn),
1270 _(
"Don't bother me again with such a question, "
1271 "I know what I am doing"));
1277 box1.add(disable_warn);
1279 warn_dialog.get_vbox()->add(box);
1281 labelt2.modify_fg(Gtk::STATE_NORMAL, colorWhite);
1283 font = labelt2.get_style()->get_font();
1284 font.set_size(8*Pango::SCALE);
1285 font.set_weight(Pango::WEIGHT_NORMAL);
1286 labelt2.modify_font(font);
1290 return warn_dialog.run();
1293 void MainWindow::change_latency(Glib::RefPtr<Gtk::RadioAction> action) {
1301 _(
"Jack Buffer Size setting"),
1302 _(
"we are not a jack gxjack.client, server may be down")
1306 jack_nframes_t buf_size = action->get_current_value();
1311 Glib::signal_idle().connect_once(
1313 sigc::mem_fun(action.operator->(), &Gtk::RadioAction::set_current_value), jack->
get_jack_bs()));
1315 if (jack_set_buffer_size(jack->
client, buf_size) != 0)
1317 _(
"Could not change latency"));
1320 _(
"Jack Buffer Size"),
1321 boost::format(_(
"latency is %1%")) % jack_get_buffer_size(jack->
client));
1324 void MainWindow::add_latency_menu() {
1325 Glib::ustring s =
"<menubar><menu action=\"EngineMenu\"><menu action=\"JackLatency\">";
1326 Gtk::RadioButtonGroup group;
1327 const int min_pow = 4;
1328 const int max_pow = 13;
1329 int jack_buffer_size = 16;
1330 for (
int i = 0; i <= max_pow-min_pow; ++i) {
1332 Glib::ustring actname = Glib::ustring::compose(
"Latency_%1", name);
1333 s += Glib::ustring::compose(
"<menuitem action=\"%1\"/>", actname);
1334 Glib::RefPtr<Gtk::RadioAction> action = Gtk::RadioAction::create(group, actname, name);
1335 actions.
group->add(action);
1337 action->signal_changed().connect(
1338 sigc::mem_fun(*
this, &MainWindow::change_latency));
1341 action->property_value().set_value(jack_buffer_size);
1342 jack_buffer_size *= 2;
1344 s.append(
"</menu></menu></menubar>");
1345 uimanager->add_ui_from_string(s);
1348 void MainWindow::set_latency() {
1355 actions.
latency->set_current_value(n);
1362 GError *error = NULL;
1363 gtk_show_uri(gdk_screen_get_default(),
"https://sourceforge.net/p/guitarix/discussion/general/",
1364 gtk_get_current_event_time(), &error);
1368 _(
"failed to load online help "));
1369 g_error_free(error);
1379 static string about;
1380 if (about.empty()) {
1381 about +=_(
"<b>Guitarix:gx_head</b> (");
1382 about += GX_VERSION;
1384 _(
")\n\nThis Application is to a large extent provided"
1385 "\nwith the marvelous faust compiler.Yann Orlary"
1386 "\n(http://faust.grame.fr/)"
1387 "\n\nA large part is based on the work of Julius Orion Smith"
1388 "\n(htttp://ccrma.stanford.edu/realsimple/faust/)"
1389 "\nand Albert Graef\n(http://q-lang.sourceforge.net/examples.html#Faust)"
1394 _(
"for impulse response it use zita-convolver"
1395 "\nby Fons Adriaensen"
1396 "\n(http://www.kokkinizita.net/linuxaudio/index.html)"
1397 "\n\nThe included IR-files are contributed by"
1398 "\nDavid Fau Casquel (BESTPLUGINS)"
1399 "\nhome: http://www.youtube.com/bestplugins"
1400 "\n\nauthors: Hermann Meyer <brummer-@web.de>"
1401 "\nauthors: James Warden <warjamy@yahoo.com>"
1402 "\nauthors: Andreas Degert <andreas.degert@googlemail.com>"
1403 "\nauthors: Pete Shorthose <pshorthose@gmail.com>"
1404 "\nauthors: Markus Schmidt <schmidt@boomshop.net>"
1405 "\n\nwebsite: http://guitarix.org/\n");
1411 void MainWindow::set_tooltips() {
1413 gtk_settings_set_long_property(
1415 "gx_head menu-option");
1418 void MainWindow::set_animations() {
1422 void MainWindow::on_select_jack_control() {
1423 if (select_jack_control) {
1424 select_jack_control->present();
1428 sigc::mem_fun(*
this, &MainWindow::delete_select_jack_control));
1429 select_jack_control->set_transient_for(*window);
1430 select_jack_control->show();
1434 void MainWindow::delete_select_jack_control() {
1435 delete select_jack_control;
1436 select_jack_control = 0;
1439 void MainWindow::on_select_midi_channel() {
1440 if (select_midi_channel) {
1441 select_midi_channel->present();
1445 sigc::mem_fun(*
this, &MainWindow::delete_select_midi_channel));
1446 select_midi_channel->set_transient_for(*window);
1447 select_midi_channel->show();
1451 void MainWindow::delete_select_midi_channel() {
1452 delete select_midi_channel;
1453 select_midi_channel = 0;
1457 void MainWindow::on_log_activate() {
1460 window->get_position(rxorg, ryorg);
1461 fLoggingWindow.move(rxorg+5, ryorg+272);
1462 fLoggingWindow.show_all();
1463 on_msg_level_changed();
1465 fLoggingWindow.hide();
1469 bool MainWindow::on_log_activated(GdkEventButton* ev) {
1470 if (ev->type == GDK_BUTTON_PRESS && ev->button == 1) {
1474 window->get_position(rxorg, ryorg);
1475 fLoggingWindow.move(rxorg+5, ryorg+272);
1476 fLoggingWindow.show_all();
1477 on_msg_level_changed();
1479 fLoggingWindow.hide();
1482 }
else if (ev->type == GDK_BUTTON_PRESS && ev->button == 2) {
1488 bool MainWindow::on_log_scrolled(GdkEventScroll* ev) {
1492 window->get_position(rxorg, ryorg);
1493 fLoggingWindow.move(rxorg+5, ryorg+272);
1494 fLoggingWindow.show_all();
1495 on_msg_level_changed();
1497 fLoggingWindow.hide();
1503 void MainWindow::on_engine_toggled() {
1515 void MainWindow::set_switcher_controller() {
1521 void MainWindow::set_bypass_controller() {
1527 void MainWindow::on_show_midi_out() {
1529 if (actions.
midi_out->get_active()) {
1531 midi_out_box->set_visible(
true);
1533 midi_out_box->set_visible(
false);
1539 void MainWindow::on_show_midi_out_plug() {
1541 midi_out_normal->hide();
1542 midi_out_mini->show();
1544 midi_out_mini->hide();
1545 midi_out_normal->show();
1549 void MainWindow::on_midi_out_channel_toggled(Gtk::RadioButton *rb, Gtk::Container *c) {
1550 c->set_visible(rb->get_active());
1553 void MainWindow::on_livetuner_toggled() {
1557 racktuner->set_sensitive(
false);
1561 if (actions.
tuner->get_active()) {
1562 racktuner->set_sensitive(
true);
1570 racktuner->set_sensitive(
false);
1575 void MainWindow::create_actions() {
1577 actions.
group = Gtk::ActionGroup::create(
"Main");
1581 actions.
group->add(Gtk::Action::create(
"EngineMenu",_(
"_Engine")));
1584 actions.
osc_buffer_menu = Gtk::Action::create(
"OscBuffer",_(
"Osc. Buffer-size"));
1587 actions.
group->add(Gtk::Action::create(
"PresetsMenu",_(
"_Presets")));
1588 actions.
group->add(Gtk::Action::create(
"NextPreset",_(
"Next Preset")),
1589 sigc::mem_fun(*
this, &MainWindow::on_next_preset));
1590 actions.
group->add(Gtk::Action::create(
"PreviusPreset",_(
"Previous Preset")),
1591 sigc::mem_fun(*
this, &MainWindow::on_previus_preset));
1593 actions.
group->add(Gtk::Action::create(
"SetNextPresetSwitcher", _(
"Next Preset Midi Switch")),
1594 sigc::mem_fun(
this, &MainWindow::set_next_preset_controller));
1596 actions.
group->add(Gtk::Action::create(
"SetPreviusPresetSwitcher", _(
"Previous Preset Midi Switch")),
1597 sigc::mem_fun(
this, &MainWindow::set_previus_preset_controller));
1599 actions.
group->add(Gtk::Action::create(
"PresetListMenu",
"--"));
1600 actions.
group->add(Gtk::Action::create(
"PluginsMenu",_(
"P_lugins")));
1601 actions.
group->add(Gtk::Action::create(
"MonoPlugins",_(
"_Mono Plugins")));
1602 actions.
group->add(Gtk::Action::create(
"StereoPlugins",_(
"_Stereo Plugins")));
1603 actions.
group->add(Gtk::Action::create(
"TubeMenu",_(
"_Tube")));
1604 actions.
group->add(Gtk::Action::create(
"OptionsMenu",_(
"_Options")));
1605 actions.
group->add(Gtk::Action::create(
"SkinMenu", _(
"_Skin...")));
1606 actions.
group->add(Gtk::Action::create(
"AboutMenu",_(
"_About")));
1611 actions.
jackserverconnection = Gtk::ToggleAction::create(
"JackServerConnection", _(
"Jack Server _Connection"));
1614 sigc::mem_fun(*
this, &MainWindow::jack_connection));
1616 actions.
jackports = Gtk::ToggleAction::create(
"JackPorts", _(
"Jack _Ports"));
1619 sigc::mem_fun(*
this, &MainWindow::on_portmap_activate));
1621 actions.
midicontroller = Gtk::ToggleAction::create(
"MidiController", _(
"M_idi Controller"));
1624 sigc::mem_fun(*
this, &MainWindow::on_miditable_toggle));
1626 actions.
engine_mute = Gtk::ToggleAction::create(
"EngineMute", _(
"Engine _Mute"));
1629 sigc::mem_fun(*
this, &MainWindow::on_engine_toggled));
1631 actions.
engine_bypass = Gtk::ToggleAction::create(
"EngineBypass", _(
"Engine _Bypass"));
1634 sigc::mem_fun(*
this, &MainWindow::on_engine_toggled));
1637 actions.
quit = Gtk::Action::create(
"Quit",_(
"Hide"));
1639 actions.
quit = Gtk::Action::create(
"Quit",_(
"_Quit"));
1643 sigc::hide_return(sigc::mem_fun(
this, &MainWindow::on_quit)));
1648 actions.
presets = Gtk::ToggleAction::create(
1649 "Presets",_(
"_Preset Selection"));
1651 sigc::mem_fun(*
this, &MainWindow::on_preset_action));
1654 "ShowPluginBar",_(
"Show Plugin _Bar"));
1656 sigc::mem_fun(*
this, &MainWindow::on_show_plugin_bar));
1658 actions.
show_rack = Gtk::ToggleAction::create(
1659 "ShowRack",_(
"Show _Rack"),
"",
true);
1661 sigc::mem_fun(*
this, &MainWindow::on_show_rack));
1663 actions.
loggingbox = Gtk::ToggleAction::create(
"LoggingBox", _(
"Show _Logging Box"));
1666 sigc::mem_fun(*
this, &MainWindow::on_log_activate));
1668 actions.
live_play = Gtk::ToggleAction::create(
"Liveplay",_(
"Live _Display"));
1670 sigc::mem_fun(*
this, &MainWindow::on_live_play));
1672 actions.
meterbridge = Gtk::ToggleAction::create(
"Meterbridge", _(
"_Meterbridge"));
1677 sigc::ref(actions.
meterbridge), sigc::ref(*jack)));
1683 machine,
"ui.racktuner",
"LiveTuner",
"??");
1685 actions.
livetuner->signal_toggled().connect(
1686 sigc::mem_fun(
this, &MainWindow::on_livetuner_toggled));
1689 machine,
"ui.midi_out",
"MidiOut", _(
"M_idi Out"));
1692 sigc::mem_fun(
this, &MainWindow::on_show_midi_out));
1695 machine,
"midi_out.s_h",
"MidiOutSH",
"??");
1698 sigc::mem_fun(
this, &MainWindow::on_show_midi_out_plug));
1704 machine,
"system.show_tuner",
"Tuner",_(
"_Tuner show"));
1706 sigc::mem_fun(*
this, &MainWindow::on_show_tuner));
1708 machine,
"system.stick_tuner",
"Tunermove",_(
"Tuner stic_k "));
1710 sigc::mem_fun(*
this, &MainWindow::on_move_tuner));
1712 actions.
rack_config = Gtk::ToggleAction::create(
"RackConfig", _(
"R_ack Configuration"));
1714 sigc::mem_fun(*
this, &MainWindow::on_rack_configuration));
1716 actions.
compress = Gtk::Action::create(
"Compress",_(
"C_ompress all"));
1718 sigc::mem_fun(*
this, &MainWindow::on_compress_all));
1720 actions.
expand = Gtk::Action::create(
"Expand",_(
"E_xpand all"));
1722 sigc::mem_fun(*
this, &MainWindow::on_expand_all));
1724 actions.
rackh = Gtk::ToggleAction::create(
1725 "RackH", _(
"Order Rack _Horizontally"));
1727 sigc::mem_fun(*
this, &MainWindow::on_dir_changed));
1733 "ShowValues",_(
"_Show _Values"),
"",
true);
1735 sigc::mem_fun(*
this, &MainWindow::on_show_values));
1737 actions.
tooltips = Gtk::ToggleAction::create(
1738 "ShowTooltips", _(
"Show _Tooltips"),
"",
true);
1741 sigc::mem_fun(
this, &MainWindow::set_tooltips));
1744 machine,
"system.midi_in_preset",
"MidiInPresets", _(
"Include MIDI in _presets"));
1747 actions.
jackstartup = Gtk::Action::create(
"JackStartup", _(
"_Jack Startup Control"));
1750 sigc::mem_fun(*
this, &MainWindow::on_select_jack_control));
1752 actions.
loadladspa = Gtk::Action::create(
"LoadLADSPA", _(
"LADSPA/LV2 Pl_ugins"));
1755 sigc::mem_fun(
this, &MainWindow::on_load_ladspa));
1757 actions.
group->add(Gtk::Action::create(
"ResetAll", _(
"Reset _All Parameters")),
1760 actions.
animations = Gtk::ToggleAction::create(
1761 "Animations", _(
"_Use Animations"),
"",
true);
1763 sigc::mem_fun(
this, &MainWindow::set_animations));
1765 actions.
group->add(Gtk::Action::create(
"SetPresetSwitcher", _(
"L_iveplay Midi Switch")),
1766 sigc::mem_fun(
this, &MainWindow::set_switcher_controller));
1768 actions.
group->add(Gtk::Action::create(
"SetBypassSwitcher", _(
"B_ypass Midi Switch")),
1769 sigc::mem_fun(
this, &MainWindow::set_bypass_controller));
1771 actions.
group->add(Gtk::Action::create(
"SetMidiChannel", _(
"Set Midi Channel")),
1772 sigc::mem_fun(
this, &MainWindow::on_select_midi_channel));
1777 actions.
group->add(Gtk::Action::create(
"Help", _(
"_Help")),
1779 actions.
group->add(Gtk::Action::create(
"About", _(
"_About")),
1791 int get_current_workarea_height_from_desktop(GdkWindow *root) {
1793 GdkAtom actual_type, atom_cardinal;
1798 atom_cardinal = gdk_atom_intern(
"CARDINAL",
false);
1799 if (!gdk_property_get(
1800 root, gdk_atom_intern(
"_NET_CURRENT_DESKTOP",
false), atom_cardinal,
1801 0, 1,
false, &actual_type, &actual_format, &num_items,
1802 (guchar**)&ret_data_ptr)) {
1805 idx = *ret_data_ptr * 4 + 3;
1806 g_free(ret_data_ptr);
1807 if (!gdk_property_get(
1808 root, gdk_atom_intern(
"_NET_WORKAREA",
false), atom_cardinal,
1809 idx, 1,
false, &actual_type, &actual_format, &num_items,
1810 (guchar**)&ret_data_ptr)) {
1813 if (idx >= num_items) {
1817 int height = *ret_data_ptr;
1818 g_free(ret_data_ptr);
1822 int get_current_workarea_height() {
1824 GdkWindow *root = gdk_get_default_root_window();
1825 int height = get_current_workarea_height_from_desktop(root);
1829 int x, y, width, depth;
1830 gdk_window_get_geometry(root, &x, &y, &width, &height, &depth);
1843 void MainWindow::clear_box(Gtk::Container& box) {
1844 std::vector<Gtk::Widget*> l = box.get_children();
1845 for (std::vector<Gtk::Widget*>::iterator p = l.begin(); p != l.end(); ++p) {
1850 void MainWindow::make_icons(
bool force) {
1851 Gtk::OffscreenWindow w;
1852 w.set_type_hint(Gdk::WINDOW_TYPE_HINT_DOCK);
1853 Glib::RefPtr<Gdk::Screen> screen = w.get_screen();
1854 Glib::RefPtr<Gdk::Colormap> rgba = screen->get_rgba_colormap();
1856 w.set_colormap(rgba);
1860 Glib::RefPtr<Gtk::SizeGroup> sz = Gtk::SizeGroup::create(Gtk::SIZE_GROUP_BOTH);
1861 std::vector<std::pair<PluginUI*,Gtk::Widget*> > l;
1862 for (std::map<std::string, PluginUI*>::iterator i = plugin_dict.begin(); i != plugin_dict.end(); ++i) {
1863 if (!force && i->second->icon) {
1868 r->set_no_show_all(
true);
1871 l.push_back(std::pair<PluginUI*,Gtk::Widget*>(i->second, r));
1874 l.begin()->second->show();
1875 if (vb.size_request().width < 110) {
1876 vb.set_size_request(110, -1);
1879 for (std::vector<std::pair<PluginUI*,Gtk::Widget*> >::iterator i = l.begin(); i != l.end(); ++i) {
1882 w.get_window()->process_updates(
true);
1883 i->first->icon = w.get_pixbuf();
1884 if (i->first->toolitem) {
1885 dynamic_cast<Gtk::Image*>(i->first->toolitem->get_child())->set(i->first->icon);
1892 hanl = gtk_widget_render_icon(GTK_WIDGET(window->gobj()),
"handle_left", (GtkIconSize)-1, NULL);
1893 hanr = gtk_widget_render_icon(GTK_WIDGET(window->gobj()),
"handle_right", (GtkIconSize)-1, NULL);
1894 gint wl = gdk_pixbuf_get_width(hanl);
1895 gint wr = gdk_pixbuf_get_width(hanr);
1896 g_object_unref(hanl);
1897 g_object_unref(hanr);
1898 bld->find_widget(
"amp_padding", vbam);
1899 vbam->set_padding(0, 4, wl, wr);
1900 bld->find_widget(
"tuner_padding", vbam);
1901 vbam->set_padding(0, 4, wl, wr);
1902 bld->find_widget(
"details_padding", vbam);
1903 vbam->set_padding(0, 4, wl, wr);
1908 virtual void on_plugin_preset_popup();
1911 const Glib::ustring&
tooltip=
"")
1916 void JConvPluginUI::on_plugin_preset_popup() {
1921 Glib::ustring::size_type n = name.find_last_of(
'.');
1922 if (n != Glib::ustring::npos) {
1938 uimanager->ensure_update();
1943 Gtk::ToolItemGroup * group = groupmap[group_id];
1944 if (group->get_n_items() == 0) {
1945 Glib::ustring groupname = Glib::ustring::compose(
"PluginCategory_%1", group_id);
1946 Glib::RefPtr<Gtk::Action> act = actions.
group->get_action(groupname);
1947 actions.
group->remove(actions.
group->get_action(groupname));
1948 groupmap.erase(group_id);
1961 add_plugin_menu_entry(pui);
1967 void MainWindow::on_ladspa_finished(
bool reload,
bool quit) {
1972 Glib::signal_idle().connect(sigc::mem_fun(
this, &MainWindow::delete_ladspalist_window));
1976 bool MainWindow::delete_ladspalist_window() {
1977 if (ladspalist_window) {
1979 delete ladspalist_window;
1980 ladspalist_window = 0;
1985 void MainWindow::on_load_ladspa() {
1986 if (ladspalist_window) {
1989 ladspalist_window =
new ladspa::PluginDisplay(machine, gx_head_icon, sigc::mem_fun(
this, &MainWindow::on_ladspa_finished));
1997 p.push_back(
new PluginUI(*
this,
id, tooltip));
2000 #ifdef accel_keys_for_plugins
2001 struct accel_search {
2006 static void accel_search_callback(gpointer data,
const gchar *accel_path, guint accel_key, GdkModifierType accel_mods, gboolean changed) {
2007 accel_search *s = static_cast<accel_search*>(data);
2008 if (accel_key == s->key && accel_mods == 0) {
2013 static bool accel_map_has_key(
unsigned int accel_key) {
2017 gtk_accel_map_foreach_unfiltered(gpointer(&s), accel_search_callback);
2021 static bool accel_map_next_key(
unsigned int *accel_key) {
2022 while (*accel_key <= GDK_z) {
2023 if (!accel_map_has_key(*accel_key)) {
2033 Glib::ustring
group;
2034 std::vector<PluginUI*> *
plugins;
2035 PluginDesc(
const Glib::ustring& g, std::vector<PluginUI*> *p)
2039 Gtk::ToolItemGroup *MainWindow::add_plugin_category(
const char *group,
bool collapse) {
2040 std::map<Glib::ustring, Gtk::ToolItemGroup*>::iterator it = groupmap.find(group);
2041 if (it != groupmap.end()) {
2044 Glib::ustring ui_template =
2045 "<menubar><menu action=\"PluginsMenu\"><menu action=\"%1Plugins\"><menu action=\"%2\">"
2046 "</menu></menu></menu></menubar>";
2047 Glib::ustring groupname = Glib::ustring::compose(
"PluginCategory_%1", group);
2048 uimanager->add_ui_from_string(Glib::ustring::compose(ui_template,
"Mono", groupname));
2049 uimanager->add_ui_from_string(Glib::ustring::compose(ui_template,
"Stereo", groupname));
2050 actions.
group->add(Gtk::Action::create(groupname, gettext(group)));
2051 Gtk::ToolItemGroup *gw =
new Gtk::ToolItemGroup(gettext(group));
2052 groupmap[group] = gw;
2053 gw->set_collapsed(collapse);
2054 effects_toolpalette->add(*manage(gw));
2055 effects_toolpalette->set_exclusive(*gw,
true);
2056 effects_toolpalette->set_expand(*gw,
true);
2060 Glib::ustring MainWindow::add_plugin_menu_entry(
PluginUI *pui) {
2061 Glib::ustring ui_template =
2062 "<menubar><menu action=\"PluginsMenu\"><menu action=\"%1Plugins\"><menu action=\"%2\">"
2063 "<menuitem action=\"%3\"/>"
2064 "</menu></menu></menu></menubar>";
2066 Glib::ustring groupname = Glib::ustring::compose(
"PluginCategory_%1", group);
2067 Glib::ustring actionname = Glib::ustring::compose(
"Plugin_%1", pui->
get_id());
2069 pui->
set_ui_merge_id(uimanager->add_ui_from_string(Glib::ustring::compose(ui_template, tp, groupname, actionname)));
2074 void MainWindow::register_plugin(
PluginUI *pui) {
2075 plugin_dict.
add(pui);
2076 Gtk::ToolItemGroup *gw = add_plugin_category(pui->
get_category());
2077 Glib::ustring actionname = add_plugin_menu_entry(pui);
2078 add_toolitem(*pui, gw);
2079 Glib::RefPtr<Gtk::ToggleAction> act = Gtk::ToggleAction::create(actionname, pui->
get_name());
2080 actions.
group->add(act);
2081 #ifdef accel_keys_for_plugins
2082 unsigned int key = GDK_a;
2083 if (accel_map_next_key(&key)) {
2084 Gtk::AccelMap::add_entry(act->get_accel_path(), key, Gdk::ModifierType(0));
2089 act->set_active(
true);
2094 void MainWindow::fill_pluginlist() {
2097 add_plugin_category(
N_(
"Tone Control"),
false);
2098 add_plugin_category(
N_(
"Distortion"));
2099 add_plugin_category(
N_(
"Fuzz"));
2100 add_plugin_category(
N_(
"Reverb"));
2101 add_plugin_category(
N_(
"Echo / Delay"));
2102 add_plugin_category(
N_(
"Modulation"));
2103 add_plugin_category(
N_(
"Guitar Effects"));
2104 add_plugin_category(
N_(
"Misc"));
2106 std::vector<PluginUI*> p;
2114 for (std::vector<PluginUI*>::iterator v = p.begin(); v != p.end(); ++v) {
2115 register_plugin(*v);
2124 int MainWindow::start_jack() {
2129 int wait_after_connect = 0;
2132 if (v_id ==
"autostart") {
2136 if (v_id ==
"other") {
2141 }
else if (v_id ==
"qjackctl") {
2142 wait_after_connect = 500000;
2143 cmd =
"qjackctl --start";
2148 for (
int i = 0; i < 10; i++) {
2156 string(_(
"I really tried to get jack up and running, sorry ... ")));
2160 bool MainWindow::connect_jack(
bool v, Gtk::Window *splash) {
2174 switch (start_jack()) {
2175 case 1:
return true;
2176 case -1:
return false;
2187 return start_jack() == 1;
2190 void MainWindow::on_jack_client_changed() {
2198 bool v = (jack->
client != 0);
2203 Glib::ustring s =
"Guitarix: ";
2209 window->set_title(s);
2213 status_image->set_sensitive(v);
2215 jackd_image->set(pixbuf_jack_disconnected);
2217 jackd_image->set(pixbuf_jack_connected);
2227 status_image->set(pixbuf_off);
2237 status_image->set(pixbuf_on);
2247 status_image->set(pixbuf_bypass);
2253 static struct TuningTab {
2259 {
"Standard",
"E",
false, {40, 45, 50, 55, 59, 64}},
2260 {
"Standard/Es",
"Es",
true, {39, 44, 49, 54, 58, 63}},
2261 {
"Open E",
"E",
false, {40, 47, 52, 56, 59, 64}},
2262 {
"Drop D",
"D",
false, {38, 45, 50, 55, 59, 64}},
2263 {
"Half Step Down",
"E",
false, {39, 44, 49, 54, 58, 63}},
2264 {
"Full Step Down",
"D",
false, {38, 43, 48, 53, 57, 62}},
2265 {
"1 and 1/2 Steps Down",
"E",
false, {37, 42, 47, 52, 56, 61}},
2266 {
"Double Drop D",
"D",
false, {38, 45, 50, 55, 59, 62}},
2267 {
"Drop C",
"C",
false, {36, 43, 48, 53, 57, 62}},
2268 {
"Drop C#",
"C#",
false, {37, 44, 49, 54, 58, 63}},
2269 {
"Drop B",
"B",
false, {35, 42, 47, 52, 56, 61}},
2270 {
"Drop A#",
"A#",
false, {34, 41, 46, 51, 55, 60}},
2271 {
"Drop A",
"A",
false, {33, 40, 45, 50, 54, 59}},
2272 {
"Open D",
"D",
false, {38, 45, 50, 54, 57, 62}},
2273 {
"Open D Minor",
"D",
false, {38, 45, 50, 53, 57, 62}},
2274 {
"Open G",
"G",
false, {38, 43, 50, 55, 59, 62}},
2275 {
"Open G Minor",
"G",
false, {38, 43, 50, 55, 58, 62}},
2276 {
"Open C",
"C",
false, {36, 43, 48, 55, 60, 64}},
2277 {
"Open C#",
"C#",
false, {37, 42, 59, 52, 56, 61}},
2278 {
"Open C Minor",
"C",
false, {36, 43, 48, 55, 60, 63}},
2279 {
"Open E7",
"E7",
false, {40, 44, 50, 52, 59, 64}},
2280 {
"Open E Minor7",
"E",
false, {40, 47, 50, 55, 59, 64}},
2281 {
"Open G Major7",
"G",
false, {38, 43, 50, 54, 59, 62}},
2282 {
"Open A Minor",
"A",
false, {40, 45, 52, 57, 60, 64}},
2283 {
"Open A Minor7",
"A",
false, {40, 45, 52, 55, 60, 64}},
2284 {
"Open A",
"A",
false, {40, 45, 49, 52, 57, 64}},
2285 {
"C Tuning",
"C",
false, {36, 41, 46, 51, 55, 60}},
2286 {
"C# Tuning",
"C#",
false, {37, 42, 47, 52, 56, 61}},
2287 {
"Bb Tuning",
"Bb",
false, {34, 39, 44, 49, 53, 58}},
2288 {
"A to A (Baritone)",
"A",
false, {33, 38, 43, 48, 52, 57}},
2289 {
"Open Dsus2",
"D",
false, {38, 45, 50, 55, 57, 62}},
2290 {
"Open Gsus2",
"G",
false, {38, 43, 50, 55, 60, 62}},
2291 {
"G6",
"G6",
false, {38, 43, 50, 55, 59, 64}},
2292 {
"Modal G",
"G",
false, {38, 43, 50, 55, 60, 62}},
2293 {
"Overtone",
"E",
false, {48, 52, 55, 58, 60, 62}},
2294 {
"Pentatonic",
"E",
false, {45, 48, 50, 52, 55, 69}},
2295 {
"Minor Third",
"E",
false, {48, 51, 54, 57, 60, 63}},
2296 {
"Major Third",
"E",
false, {48, 52, 56, 60, 64, 68}},
2297 {
"All Fourths",
"E",
false, {40, 45, 50, 55, 60, 65}},
2298 {
"Augmented Fourths",
"E",
false, {36, 42, 48, 54, 60, 66}},
2299 {
"Slow Motion",
"E",
false, {38, 43, 50, 53, 60, 62}},
2300 {
"Admiral",
"E",
false, {36, 43, 50, 55, 59, 60}},
2301 {
"Buzzard",
"E",
false, {36, 41, 48, 55, 58, 65}},
2302 {
"Face",
"E",
false, {36, 43, 50, 55, 57, 62}},
2303 {
"Four and Twenty",
"E",
false, {38, 45, 50, 50, 57, 62}},
2304 {
"Ostrich",
"E",
false, {38, 50, 50, 50, 62, 62}},
2305 {
"Capo 200",
"E",
false, {36, 43, 50, 51, 62, 63}},
2306 {
"Balalaika",
"E",
false, {40, 45, 50, 52, 52, 57}},
2307 {
"Cittern One",
"E",
false, {36, 41, 48, 55, 60, 62}},
2308 {
"Cittern Two",
"E",
false, {36, 43, 48, 55, 60, 67}},
2309 {
"Dobro",
"E",
false, {43, 47, 50, 55, 59, 62}},
2310 {
"Lefty",
"E",
false, {64, 59, 55, 50, 45, 40}},
2311 {
"Mandoguitar",
"E",
false, {36, 43, 50, 57, 64, 71}},
2312 {
"Rusty Cage",
"E",
false, {35, 45, 50, 55, 59, 64}},
2313 {
"Hardcore",
"C",
false, {36, 43, 48, 53, 57, 58}},
2315 int mode = tuner_tuning->get_value();
2319 for (
int i = 0; i < 6; ++i) {
2320 tuner.
push_note(tuning_tab[mode-1].notes[i], 69, 12);
2330 if (tet.find(
"12") !=Glib::ustring::npos) t=0;
2331 else if (tet.find(
"19") !=Glib::ustring::npos) t=1;
2332 else if (tet.find(
"24") !=Glib::ustring::npos) t=2;
2333 else if (tet.find(
"31") !=Glib::ustring::npos) t=3;
2334 else if (tet.find(
"53") !=Glib::ustring::npos) t=4;
2335 else t = tuner_temperament->get_value();
2343 float t = atof(ref.c_str());
2349 void MainWindow::setup_tuner_temperament(
Gxw::RackTuner& tuner) {
2359 tuner_mode->signal_value_changed().connect(
2362 sigc::mem_fun(*tuner_mode, &Gxw::Selector::get_value)));
2363 tuner_reference_pitch->signal_value_changed().connect(
2366 sigc::mem_fun(*tuner_reference_pitch, &Gxw::ValueDisplay::get_value)));
2367 tuner_tuning->signal_value_changed().connect(
2368 sigc::bind(sigc::mem_fun(*
this, &MainWindow::set_tuning), sigc::ref(tuner)));
2369 tuner_temperament->signal_value_changed().connect(
2370 sigc::bind(sigc::mem_fun(*
this, &MainWindow::setup_tuner_temperament), sigc::ref(tuner)));
2374 bool MainWindow::on_toggle_mute(GdkEventButton* ev) {
2375 if (ev->type == GDK_BUTTON_PRESS && ev->button == 1) {
2385 bool MainWindow::on_scroll_toggle(GdkEventScroll* ev) {
2386 if (ev->direction == GDK_SCROLL_UP) {
2394 }
else if (ev->direction == GDK_SCROLL_DOWN) {
2407 bool MainWindow::on_toggle_insert(GdkEventButton* ev) {
2408 if (ev->type == GDK_BUTTON_PRESS && ev->button == 1) {
2418 bool MainWindow::on_scroll_toggle_insert(GdkEventScroll* ev) {
2427 void MainWindow::on_insert_jack_changed(
bool s) {
2429 insert_image->set(pixbuf_insert_off);
2431 insert_image->set(pixbuf_insert_on);
2435 bool MainWindow::on_jackserverconnection(GdkEventButton* ev) {
2436 if (ev->type == GDK_BUTTON_PRESS && ev->button == 1) {
2443 bool MainWindow::on_jackserverconnection_scroll(GdkEventScroll* ev) {
2449 void MainWindow::on_msg_level_changed() {
2453 default: logstate_image->set(pixbuf_log_grey);
break;
2461 void MainWindow::on_ampdetail_switch(
bool compress,
bool setparam) {
2463 ampdetail_normal->hide();
2464 ampdetail_mini->show();
2466 ampdetail_mini->hide();
2467 ampdetail_normal->show();
2478 void MainWindow::set_osc_size() {
2485 void MainWindow::change_osc_buffer(Glib::RefPtr<Gtk::RadioAction> action) {
2487 if (!jack || jack->
client) {
2488 options.
mul_buffer = action->get_current_value();
2489 on_oscilloscope_activate(
false);
2491 on_oscilloscope_activate(
true);
2497 void MainWindow::add_osc_size_menu() {
2498 Glib::ustring s =
"<menubar><menu action=\"OptionsMenu\"><menu action=\"OscBuffer\">";
2499 Gtk::RadioButtonGroup group;
2500 int osc_buffer_size = 1;
2501 for (
int i = 1; i <= 6; ++i) {
2503 Glib::ustring actname = Glib::ustring::compose(
"buffer size %1", name);
2504 s += Glib::ustring::compose(
"<menuitem action=\"%1\"/>", actname);
2505 Glib::RefPtr<Gtk::RadioAction> action = Gtk::RadioAction::create(group, actname, name);
2506 actions.
group->add(action);
2508 action->signal_changed().connect(
2509 sigc::mem_fun(*
this, &MainWindow::change_osc_buffer));
2512 action->property_value().set_value(osc_buffer_size);
2515 s.append(
"</menu></menu></menubar>");
2516 uimanager->add_ui_from_string(s);
2519 void MainWindow::on_show_oscilloscope(
bool v) {
2522 Glib::signal_timeout().connect(
2523 sigc::mem_fun(*
this, &MainWindow::on_refresh_oscilloscope), 60);
2527 void MainWindow::set_waveview_buffer(
unsigned int size) {
2531 void MainWindow::on_oscilloscope_post_pre(
int post_pre) {
2539 int MainWindow::on_oscilloscope_activate(
bool start) {
2542 fWaveView.queue_draw();
2547 bool MainWindow::on_refresh_oscilloscope() {
2550 jack_nframes_t bsize;
2554 jack_nframes_t bsize;
2557 if (!oc.bsize || oc.load != load) {
2560 (boost::format(_(
"DSP Load %1% %%")) % oc.load).str().c_str(),
2561 Gtk::CORNER_TOP_LEFT);
2563 if (!oc.bsize || oc.frames != frames) {
2566 (boost::format(_(
"HT Frames %1%")) % oc.frames).str().c_str(),
2567 Gtk::CORNER_BOTTOM_LEFT);
2569 if (!oc.bsize || oc.rt != is_rt) {
2572 oc.rt ? _(
"RT Mode YES ") : _(
"RT mode <span color=\"#cc1a1a\">NO</span>"),
2573 Gtk::CORNER_BOTTOM_RIGHT);
2575 if (!oc.bsize || oc.bsize != bsize) {
2578 (boost::format(_(
"Latency %1%")) % oc.bsize).str().c_str(),
2579 Gtk::CORNER_TOP_RIGHT);
2581 fWaveView.queue_draw();
2587 inline float power2db(
float power) {
2588 return 20.*log10(power);
2591 bool MainWindow::refresh_meter_level(
float falloff) {
2592 const unsigned int channels =
sizeof(fastmeter)/
sizeof(fastmeter[0]);
2594 if (jack && !jack->
client) {
2599 static float old_peak_db[channels] = {-INFINITY, -INFINITY};
2602 float level[channels];
2604 for (
unsigned int c = 0; c < channels; c++) {
2607 float peak_db = -INFINITY;
2612 if (peak_db < old_peak_db[c]) {
2613 peak_db =
max(peak_db, old_peak_db[c] - falloff);
2615 fastmeter[c]->
set(log_meter(peak_db));
2616 old_peak_db[c] = peak_db;
2621 bool MainWindow::survive_jack_shutdown() {
2634 _(
"jack has bumped us out!! "));
2644 _(
"jack has bumped us out!! "));
2650 void MainWindow::gx_jack_is_down() {
2652 Glib::signal_timeout().connect(
2653 sigc::mem_fun(*
this, &MainWindow::survive_jack_shutdown),
2654 200, Glib::PRIORITY_LOW);
2657 #ifdef HAVE_JACK_SESSION
2658 void MainWindow::jack_session_event() {
2663 const char *statefile =
"gx_head.state";
2664 jack_session_event_t *
event = jack->get_last_session_event();
2672 string cmd(
"guitarix");
2675 cmd +=
event->client_uuid;
2677 cmd += jack->get_uuid_insert();
2678 cmd +=
" -f ${SESSION_DIR}";
2680 event->command_line = strdup(cmd.c_str());
2682 JackSessionEventType tp =
event->type;
2683 if (jack->return_last_session_event() == 0) {
2684 if (tp == JackSessionSaveAndQuit) {
2690 void MainWindow::jack_session_event_ins() {
2695 jack_session_event_t *
event = jack->get_last_session_event_ins();
2697 event->command_line = strdup(
"true ${SESSION_DIR}");
2698 JackSessionEventType tp =
event->type;
2699 if (jack->return_last_session_event_ins() == 0) {
2700 if (tp == JackSessionSaveAndQuit) {
2707 void MainWindow::set_in_session() {
2717 void MainWindow::systray_menu(guint button, guint32 activate_time) {
2718 Gtk::Menu *menu = dynamic_cast<Gtk::MenuItem*>(uimanager->get_widget(
"/menubar/EngineMenu"))->get_submenu();
2719 menu->popup(2, gtk_get_current_event_time());
2725 status_icon->set(gx_head_midi);
2729 status_icon->set(gx_head_icon);
2732 status_icon->set(gx_head_warn);
2739 bool MainWindow::on_window_state_changed(GdkEventWindowState* event) {
2740 if (event->changed_mask & event->new_window_state & (Gdk::WINDOW_STATE_ICONIFIED|Gdk::WINDOW_STATE_WITHDRAWN)) {
2746 void MainWindow::hide_extended_settings() {
2748 (window->get_window()->get_state()
2749 & (Gdk::WINDOW_STATE_ICONIFIED|Gdk::WINDOW_STATE_WITHDRAWN))) {
2752 window->deiconify();
2780 bool MainWindow::on_meter_button_release(GdkEventButton* ev) {
2781 if (ev->button == 1) {
2782 for (
unsigned int i = 0; i <
sizeof(fastmeter)/
sizeof(fastmeter[0]); i++) {
2783 fastmeter[i]->
clear();
2790 void MainWindow::display_preset_msg(
const Glib::ustring& bank,
const Glib::ustring& preset) {
2791 preset_status->set_text(bank +
" / " + preset);
2794 bool MainWindow::on_key_press_event(GdkEventKey *event) {
2795 if ((event->state & Gtk::AccelGroup::get_default_mod_mask()) != 0) {
2813 bool MainWindow::on_quit() {
2818 hide_extended_settings();
2821 if (ladspalist_window && !ladspalist_window->
check_exit()) {
2829 void MainWindow::amp_controls_visible(Gtk::Range *rr) {
2832 const char *knobs1[] = {
"gxmediumknobpregain",
"gxmediumknobdrive",
"gxmediumknobdist",
"gxmediumknobgain",
"labelpregain:effekt_label",
"labeldrive:effekt_label",
"labeldist:effekt_label",
"labelgain:effekt_label"};
2833 const char *knobs2[] = {
"gxbigknobgain",
"labelgain2:effekt_label"};
2834 for (
unsigned int i = 0; i <
sizeof(knobs1)/
sizeof(knobs1[1]); ++i) {
2836 bld->find_widget(knobs1[i], w);
2839 for (
unsigned int i = 0; i <
sizeof(knobs2)/
sizeof(knobs2[1]); ++i) {
2841 bld->find_widget(knobs2[i], w);
2847 Gtk::Window *splash,
const Glib::ustring& title)
2848 : sigc::trackable(),
2862 preset_list_menu_bank(),
2863 preset_list_merge_id(0),
2864 preset_list_actiongroup(),
2869 convolver_filename_label(),
2870 convolver_mono_filename_label(),
2871 gx_head_icon(Gdk::Pixbuf::create_from_file(options.get_pixmap_filepath(
"gx_head.png"))),
2872 boxbuilder(machine_, fWaveView, convolver_filename_label, convolver_mono_filename_label, gx_head_icon),
2874 select_jack_control(0),
2875 select_midi_channel(0),
2877 amp_radio_menu(machine_,
"tube.select"),
2878 pixbuf_insert_on(Gdk::Pixbuf::create_from_file(options.get_pixmap_filepath(
"insert_on.png"))),
2879 pixbuf_insert_off(Gdk::Pixbuf::create_from_file(options.get_pixmap_filepath(
"insert_off.png"))),
2880 pixbuf_on(Gdk::Pixbuf::create_from_file(options.get_pixmap_filepath(
"gx_on.png"))),
2881 pixbuf_off(Gdk::Pixbuf::create_from_file(options.get_pixmap_filepath(
"gx_off.png"))),
2882 pixbuf_bypass(Gdk::Pixbuf::create_from_file(options.get_pixmap_filepath(
"gx_bypass.png"))),
2883 pixbuf_jack_connected(Gdk::Pixbuf::create_from_file(options.get_pixmap_filepath(
"jackd_on.png"))),
2884 pixbuf_jack_disconnected(Gdk::Pixbuf::create_from_file(options.get_pixmap_filepath(
"jackd_off.png"))),
2885 pixbuf_log_grey(Gdk::Pixbuf::create_from_file(options.get_pixmap_filepath(
"gx_log_grey.png"))),
2886 pixbuf_log_yellow(Gdk::Pixbuf::create_from_file(options.get_pixmap_filepath(
"gx_log_yellow.png"))),
2887 pixbuf_log_red(Gdk::Pixbuf::create_from_file(options.get_pixmap_filepath(
"gx_log_red.png"))),
2889 status_icon(Gtk::StatusIcon::create(gx_head_icon)),
2890 gx_head_midi(Gdk::Pixbuf::create_from_file(options.get_pixmap_filepath(
"gx_head-midi.png"))),
2891 gx_head_warn(Gdk::Pixbuf::create_from_file(options.get_pixmap_filepath(
"gx_head-warn.png"))),
2893 keyswitch(machine, sigc::mem_fun(this, &
MainWindow::display_preset_msg)),
2895 ladspalist_window(),
2896 szg_rack_units(Gtk::SizeGroup::create(Gtk::SIZE_GROUP_HORIZONTAL)) {
2898 convolver_filename_label.set_ellipsize(Pango::ELLIPSIZE_END);
2899 convolver_mono_filename_label.set_ellipsize(Pango::ELLIPSIZE_END);
2913 const char *id_list[] = {
"MainWindow",
"amp_background:ampbox",
"bank_liststore",
"target_liststore",
2914 "bank_combo_liststore", 0 };
2915 bld = gx_gui::GxBuilder::create_from_file(options_.
get_builder_filepath(
"mainpanel.glade"), &machine, id_list);
2916 load_widget_pointers();
2917 rackcontainer->set_homogeneous(
true);
2918 szg_rack_units->add_widget(*ampdetail_mini);
2919 szg_rack_units->add_widget(*ampdetail_normal);
2922 clear_box(*monocontainer);
2923 clear_box(*stereorackcontainerH);
2924 clear_box(*stereorackcontainerV);
2925 clear_box(*preset_box_no_rack);
2928 left_column = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
2929 Gtk::ScrolledWindow *swe;
2930 bld->find_widget(
"scrolledwindow_effects", swe);
2931 gtk_size_group_add_widget(
left_column, GTK_WIDGET(swe->gobj()));
2933 bld->find_widget(
"presets:barbutton", pb);
2934 gtk_size_group_add_widget(
left_column, GTK_WIDGET(pb->gobj()));
2940 uimanager = Gtk::UIManager::create();
2941 uimanager->insert_action_group(actions.
group);
2949 add_osc_size_menu();
2950 amp_radio_menu.
setup(
"<menubar><menu action=\"TubeMenu\">",
"</menu></menubar>",uimanager,actions.
group);
2953 Gtk::Widget *menubar = uimanager->get_widget(
"/menubar");
2954 actions.
accels = uimanager->get_accel_group();
2955 menubox->pack_start(*menubar);
2956 window->add_accel_group(actions.
accels);
2957 window->set_icon(gx_head_icon);
2963 window->signal_window_state_event().connect(
2964 sigc::mem_fun(*
this, &MainWindow::on_window_state_changed));
2965 window->signal_delete_event().connect(
2966 sigc::hide(sigc::mem_fun(
this, &MainWindow::on_quit)));
2967 window->signal_configure_event().connect_notify(
2968 sigc::mem_fun(*
this, &MainWindow::on_configure_event));
2969 window->signal_visibility_notify_event().connect(
2970 sigc::mem_fun(*
this, &MainWindow::on_visibility_notify));
2971 window->signal_key_press_event().connect(
2972 sigc::mem_fun(*
this, &MainWindow::on_key_press_event));
2978 status_icon->signal_activate().connect(
2979 sigc::mem_fun(*
this, &MainWindow::hide_extended_settings));
2980 status_icon->signal_popup_menu().connect(
2981 sigc::mem_fun(*
this, &MainWindow::systray_menu));
2985 stereorackcontainerV->pack_start(stereorackcontainer, Gtk::PACK_EXPAND_WIDGET);
2986 monocontainer->pack_start(monorackcontainer, Gtk::PACK_EXPAND_WIDGET);
2994 jack->
shutdown.connect(sigc::mem_fun(*
this, &MainWindow::gx_jack_is_down));
2995 jack->signal_buffersize_change().connect(
2996 sigc::mem_fun(*
this, &MainWindow::set_latency));
2997 jack->signal_client_change().connect(
2998 sigc::mem_fun(*
this, &MainWindow::on_jack_client_changed));
2999 #ifdef HAVE_JACK_SESSION
3000 jack->session.connect(sigc::mem_fun(*
this, &MainWindow::jack_session_event));
3001 jack->session_ins.connect(sigc::mem_fun(*
this, &MainWindow::jack_session_event_ins));
3009 sigc::mem_fun(*
this, &MainWindow::on_engine_state_change));
3011 sigc::mem_fun(*
this, &MainWindow::overload_status_changed));
3013 sigc::mem_fun(
this, &MainWindow::on_plugin_changed));
3018 sigc::mem_fun(*
this, &MainWindow::rebuild_preset_menu));
3020 sigc::mem_fun(*
this, &MainWindow::show_selected_preset));
3029 std::vector<Gtk::TargetEntry> listTargets;
3030 listTargets.push_back(Gtk::TargetEntry(
"application/x-guitarix-mono", Gtk::TARGET_SAME_APP, 1));
3031 listTargets.push_back(Gtk::TargetEntry(
"application/x-guitarix-stereo", Gtk::TARGET_SAME_APP, 2));
3032 effects_toolpalette->drag_dest_set(listTargets, Gtk::DEST_DEFAULT_ALL, Gdk::ACTION_MOVE);
3033 effects_toolpalette->signal_drag_data_received().connect(sigc::mem_fun(*
this, &MainWindow::on_tp_drag_data_received));
3039 jackd_image->set(pixbuf_jack_disconnected);
3040 jackd_image->get_parent()->add_events(Gdk::SCROLL_MASK);
3041 jackd_image->get_parent()->signal_button_press_event().connect(
3042 sigc::mem_fun(*
this, &MainWindow::on_jackserverconnection));
3043 jackd_image->get_parent()->signal_scroll_event().connect(
3044 sigc::mem_fun(*
this, &MainWindow::on_jackserverconnection_scroll));
3052 jackd_image->hide();
3058 setup_tuner(*racktuner);
3059 tuner_on_off->set_name(
"effect_on_off");
3060 tuner_on_off->signal_toggled().connect(
3062 sigc::mem_fun(*racktuner, &Gxw::RackTuner::set_sensitive),
3063 sigc::mem_fun(*tuner_on_off, &Gxw::Switch::get_active)));
3071 sigc::mem_fun(*
this, &MainWindow::on_oscilloscope_post_pre));
3073 sigc::mem_fun(*
this, &MainWindow::on_show_oscilloscope));
3075 sigc::mem_fun(*
this, &MainWindow::on_oscilloscope_activate));
3077 sigc::mem_fun(*
this, &MainWindow::set_waveview_buffer));
3082 for (
unsigned int i = 0; i <
sizeof(fastmeter)/
sizeof(fastmeter[0]); ++i) {
3083 fastmeter[i]->signal_button_release_event().connect(
3084 sigc::mem_fun(*
this, &MainWindow::on_meter_button_release));
3085 fastmeter[i]->set_tooltip_text(_(
"Overall Rack output"));
3087 const float meter_falloff = 27;
3088 const float meter_display_timeout = 60;
3089 const float falloff = meter_falloff * meter_display_timeout * 0.001;
3090 Glib::signal_timeout().connect(
3091 sigc::bind(sigc::mem_fun(
this, &MainWindow::refresh_meter_level), falloff),
3092 meter_display_timeout);
3097 ampdetail_compress->signal_clicked().connect(
3098 sigc::bind(sigc::mem_fun(*
this, &MainWindow::on_ampdetail_switch),
true,
true));
3099 ampdetail_expand->signal_clicked().connect(
3100 sigc::bind(sigc::mem_fun(*
this, &MainWindow::on_ampdetail_switch),
false,
true));
3102 sigc::bind(sigc::mem_fun(*
this, &MainWindow::on_ampdetail_switch),
false));
3107 midi_out_compress->signal_clicked().connect(
3109 sigc::mem_fun(actions.
midi_out_plug.operator->(), &Gtk::ToggleAction::set_active),
3111 midi_out_expand->signal_clicked().connect(
3113 sigc::mem_fun(actions.
midi_out_plug.operator->(), &Gtk::ToggleAction::set_active),
3115 midi_out_presets_mini->signal_clicked().connect(
3119 midi_out_presets_normal->signal_clicked().connect(
3123 channel1_button->signal_toggled().connect(
3125 sigc::mem_fun(
this, &MainWindow::on_midi_out_channel_toggled),
3126 channel1_button, channel1_box));
3127 channel2_button->signal_toggled().connect(
3129 sigc::mem_fun(
this, &MainWindow::on_midi_out_channel_toggled),
3130 channel2_button, channel2_box));
3131 channel3_button->signal_toggled().connect(
3133 sigc::mem_fun(
this, &MainWindow::on_midi_out_channel_toggled),
3134 channel3_button, channel3_box));
3139 status_image->set(pixbuf_on);
3140 status_image->get_parent()->add_events(Gdk::SCROLL_MASK);
3142 status_image->get_parent()->signal_button_press_event().connect(
3143 sigc::mem_fun(*
this, &MainWindow::on_toggle_mute));
3144 status_image->get_parent()->signal_scroll_event().connect(
3145 sigc::mem_fun(*
this, &MainWindow::on_scroll_toggle));
3146 on_engine_state_change(machine.
get_state());
3151 insert_image->set(pixbuf_insert_on);
3152 insert_image->get_parent()->add_events(Gdk::SCROLL_MASK);
3154 insert_image->get_parent()->signal_button_press_event().connect(
3155 sigc::mem_fun(*
this, &MainWindow::on_toggle_insert));
3156 insert_image->get_parent()->signal_scroll_event().connect(
3157 sigc::mem_fun(*
this, &MainWindow::on_scroll_toggle_insert));
3159 ip.
signal_changed().connect(sigc::mem_fun(*
this, &MainWindow::on_insert_jack_changed));
3164 gtk_activatable_set_related_action(GTK_ACTIVATABLE(show_rack_button->gobj()), GTK_ACTION(actions.
show_rack->gobj()));
3165 gtk_activatable_set_related_action(GTK_ACTIVATABLE(rack_order_h_button->gobj()), GTK_ACTION(actions.
rackh->gobj()));
3166 gtk_activatable_set_related_action(GTK_ACTIVATABLE(config_mode_button->gobj()), GTK_ACTION(actions.
rack_config->gobj()));
3167 gtk_activatable_set_related_action(GTK_ACTIVATABLE(liveplay_button->gobj()),GTK_ACTION(actions.
live_play->gobj()));
3168 gtk_activatable_set_related_action(GTK_ACTIVATABLE(tuner_button->gobj()),GTK_ACTION(actions.
tuner->gobj()));
3169 gtk_activatable_set_related_action(GTK_ACTIVATABLE(effects_button->gobj()), GTK_ACTION(actions.
show_plugin_bar->gobj()));
3170 gtk_activatable_set_related_action(GTK_ACTIVATABLE(presets_button->gobj()), GTK_ACTION(actions.
presets->gobj()));
3171 gtk_activatable_set_related_action(GTK_ACTIVATABLE(compress_button->gobj()), GTK_ACTION(actions.
compress->gobj()));
3172 gtk_activatable_set_related_action(GTK_ACTIVATABLE(expand_button->gobj()), GTK_ACTION(actions.
expand->gobj()));
3192 fLoggingWindow.set_transient_for(*window);
3193 fLoggingWindow.set_icon(gx_head_icon);
3195 sigc::mem_fun(*
this, &MainWindow::on_msg_level_changed));
3196 fLoggingWindow.signal_hide().connect(
3198 sigc::mem_fun(actions.
loggingbox.operator->(), &Gtk::ToggleAction::set_active),
3200 on_msg_level_changed();
3201 logstate_image->get_parent()->add_events(Gdk::SCROLL_MASK);
3202 logstate_image->get_parent()->signal_button_press_event().connect(
3203 sigc::mem_fun(*
this, &MainWindow::on_log_activated));
3204 logstate_image->get_parent()->signal_scroll_event().connect(
3205 sigc::mem_fun(*
this, &MainWindow::on_log_scrolled));
3222 plugin_dict.
add(mainamp_plugin);
3223 mainamp_plugin->
rackbox = add_rackbox_internal(*mainamp_plugin, 0, 0,
false, -1,
false, amp_background);
3225 effects_toolpalette->show();
3245 if (!title.empty()) {
3246 window->set_title(title);
3262 if (!connect_jack(
true, splash)) {
3265 jack->signal_client_change()();
3281 bld->find_widget(
"gxselector1:amp_selector", rr);
3282 rr->signal_value_changed().connect(
3284 sigc::mem_fun(
this, &MainWindow::amp_controls_visible),
3286 amp_controls_visible(rr);
3290 insert_image->set(pixbuf_insert_off);
3293 insert_image->set(pixbuf_insert_on);
3297 compress_button->set_visible(!c);
3298 expand_button->set_visible(c);
3299 if (!options.
get_tuner_tet().empty()) set_tuner_tet(*racktuner);
3300 if (!machine.
get_jack()) on_move_tuner();
3305 #if false // set true to generate a new keyboard accel file
3306 gtk_accel_map_add_filter(
"<Actions>/Main/ChangeSkin_*");
3307 gtk_accel_map_add_filter(
"<Actions>/Main/Enum_tube.select.*");
3308 gtk_accel_map_add_filter(
"<Actions>/Main/Latency_*");
3309 gtk_accel_map_add_filter(
"<Actions>/Main/Plugin_*");
3310 gtk_accel_map_add_filter(
"<Actions>/PresetList/PresetList_*");
3316 Glib::RefPtr<Gdk::Window> win = window->get_window();
3320 if (actions.
presets->get_active()) {
3325 delete preset_window;