Guitarix
gx_main_window.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2009, 2010 Hermann Meyer, James Warden, Andreas Degert
3  * Copyright (C) 2011 Pete Shorthose
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  * ---------------------------------------------------------------------------
19  *
20  * This is the gx_head GUI main class
21  *
22  * ----------------------------------------------------------------------------
23  */
24 
25 #include <guitarix.h>
26 #include <gxw/GxLevelSlider.h>
27 #include <gtkmm/accelmap.h>
28 #include "jsonrpc.h"
29 
30 /****************************************************************
31  ** class TextLoggingBox
32  */
33 
34 // color depending on msg type
35 TextLoggingBox::tab_table TextLoggingBox::tagdefs[] = {
36  {"colinfo", "#cccccc"},
37  {"colwarn", "#77994f"},
38  {"colerr", "#ff8800"},
39 };
40 
42  : box(),
43  ok_button(Gtk::Stock::OK),
44  buttonbox(),
45  scrollbox(),
46  tbox(),
47  highest_unseen_msg_level(-1),
48  msg_level_changed() {
49 
50  set_default_size(640, 320);
51  set_decorated(true);
52  set_resizable(true);
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);
57  set_border_width(4);
58 
59  box.set_border_width(0);
60  scrollbox.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
61 
62  add(box);
63 
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);
72  tbox.set_indent(0);
73 
74  Glib::RefPtr<Gtk::TextBuffer> buffer = tbox.get_buffer();
75  for (int i = 0; i < GxLogger::kMessageTypeCount; i++) {
76  tags[i] = buffer->create_tag(tagdefs[i].tagname);
77  tags[i]->property_foreground() = tagdefs[i].tag_color;
78  }
79 
80  box.add(scrollbox);
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));
88  //signal_activate().connect(sigc::mem_fun(this, &TextLoggingBox::hide));
89  scrollbox.add(tbox);
90  tbox.set_size_request(-1, 50);
91  box.show_all();
93  sigc::mem_fun(*this, &TextLoggingBox::show_msg));
95 }
96 
98 }
99 
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) {
102  hide();
103  return true;
104  }
105  return Gtk::Window::on_key_press_event(event);
106 }
107 
108 void TextLoggingBox::on_show() {
109  highest_unseen_msg_level = GxLogger::kMessageTypeCount;
110  Gtk::Window::on_show();
111 }
112 
113 void TextLoggingBox::on_hide() {
114  highest_unseen_msg_level = -1;
115  Gtk::Window::on_hide();
116 }
117 
119  highest_unseen_msg_level = GxLogger::kMessageTypeCount;
120  msg_level_changed();
121  highest_unseen_msg_level = -1;
122 }
123 
124 void TextLoggingBox::show_msg(string msgbuf, GxLogger::MsgType msgtype, bool plugged) {
125  assert(0 <= msgtype && msgtype < GxLogger::kMessageTypeCount);
126 
127  // retrieve gtk text buffer
128  Glib::RefPtr<Gtk::TextBuffer> buffer = tbox.get_buffer();
129 
130  // how many lines to keep
131  const int nlines = 50;
132 
133  // delete first line when window filled up
134  int linecount = buffer->get_line_count(); // empty buffer == 1 line
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);
139  }
140 
141  Gtk::TextIter iter = buffer->end();
142  if (buffer->get_char_count() > 0) {
143  iter = buffer->insert(iter, "\n");
144  }
145 
146  buffer->insert_with_tag(iter, msgbuf, tags[msgtype]);
147  scrollbox.get_vadjustment()->set_value(10000);
148  // scroll to end (big value, gets clamped to max)
149 
150  // modify expander bg color is closed
151  if (msgtype > highest_unseen_msg_level) {
152  highest_unseen_msg_level = msgtype;
153  msg_level_changed();
154  }
155 }
156 
157 /****************************************************************
158  ** SelectMidiChannel
159  ** select a midi channel to use exclusive only
160  */
161 
162 
163 SelectMidiChannel::SelectMidiChannel(BaseObjectType* cobject, Glib::RefPtr<gx_gui::GxBuilder> bld, gx_engine::GxMachineBase& m)
164  : Gtk::Window(cobject),
165  description(),
166  channelcombo(),
167  machine(m),
168  close() {
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;
173  int n = 0;
174  Glib::RefPtr<Gtk::TreeModel> model = channelcombo->get_model();
175  for (Gtk::TreeIter i = model->children().begin(); i; ++i, ++n) {
176  Glib::ustring s;
177  i->get_value(1, s);
178  if (s == v_id) {
179  channelcombo->set_active(n);
180  }
181  }
182  Gtk::Button *button;
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));
189 }
190 
192 }
193 
194 //static
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)));
200  return w;
201 }
202 
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) {
205  close();
206  return true;
207  }
208  return Gtk::Window::on_key_press_event(event);
209 }
210 
211 bool SelectMidiChannel::on_delete_event(GdkEventAny* event) {
212  close();
213  return true;
214 }
215 
216 void SelectMidiChannel::on_ok_button() {
217  Glib::ustring s;
218  channelcombo->get_active()->get_value(1, s);
219  int n = machine.get_parameter("system.midi_channel").getInt().idx_from_id(s);
220  if (n >= 0) {
221  machine.set_parameter_value("system.midi_channel", n);
222  } else {
223  gx_print_error("SelectMidiChannel", "Midi Channel out of range");
224  }
225  close();
226 }
227 
228 void SelectMidiChannel::on_cancel_button() {
229  close();
230 }
231 
232 
233 
234 #if false // unused
235 /****************************************************************
236  ** KeyFinder
237  ** finds next unused Key in a GtkAccelGroup
238  */
239 
240 class KeyFinder {
241 private:
242  typedef list<GtkAccelKey> accel_list;
243  unsigned int next_key;
244  accel_list l;
245  static gboolean add_keys_to_list(GtkAccelKey *key, GClosure *cl, gpointer data);
246 public:
247  KeyFinder(Glib::RefPtr<Gtk::AccelGroup> group);
248  ~KeyFinder();
249  int operator()();
250 };
251 
252 KeyFinder::KeyFinder(Glib::RefPtr<Gtk::AccelGroup> group) {
253  next_key = GDK_a;
254  gtk_accel_group_find(group->gobj(), add_keys_to_list, static_cast<gpointer>(&l));
255 }
256 
257 KeyFinder::~KeyFinder() {
258 }
259 
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) {
263  l->push_back(*key);
264  }
265  return false;
266 }
267 
268 int KeyFinder::operator()() {
269  while (next_key <= GDK_z) {
270  bool found = false;
271  for (accel_list::iterator i = l.begin(); i != l.end(); ++i) {
272  if (next_key == i->accel_key) {
273  found = true;
274  break;
275  }
276  }
277  if (!found) {
278  return next_key++;
279  }
280  next_key++;
281  }
282  return -1;
283 }
284 #endif
285 
286 /****************************************************************
287  ** GxUiRadioMenu
288  ** adds the values of an EnumParameter as Gtk::RadioMenuItem's
289  ** to a Gtk::MenuShell
290  */
291 
292 class TubeKeys {
293 private:
294  static unsigned int keysep[];
295  unsigned int ks;
296 public:
297  TubeKeys(): ks(0) {};
298  int operator()();
299 };
300 
301 unsigned int TubeKeys::keysep[] = {
302  GDK_a, GDK_b, GDK_c, GDK_d, GDK_e, 0,
303  GDK_f, 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
307 };
308 
309 inline int TubeKeys::operator()() {
310  if (ks < sizeof(keysep)/sizeof(keysep[0])) {
311  return keysep[ks++];
312  }
313  return -1;
314 }
315 
316 GxUiRadioMenu::GxUiRadioMenu(gx_engine::GxMachineBase& machine_, const std::string& id_)
317  : machine(machine_),
318  id(id_) {
319  machine.signal_parameter_value<int>(id).connect(
320  sigc::mem_fun(this, &GxUiRadioMenu::set_value));
321 }
322 
323 void GxUiRadioMenu::setup(const Glib::ustring& prefix, const Glib::ustring& postfix,
324  Glib::RefPtr<Gtk::UIManager>& uimanager, Glib::RefPtr<Gtk::ActionGroup>& actiongroup) {
325  int i, c;
326  const value_pair *p;
327  TubeKeys next_key;
328  Glib::ustring s = prefix;
329  Gtk::RadioButtonGroup group;
330  gx_engine::IntParameter& param = machine.get_parameter(id).getInt();
331  for (p = param.getValueNames(), i = 0; p->value_id; p++, i++) {
332  c = next_key();
333  if (c == 0) {
334  s += "<separator/>";
335  c = next_key();
336  }
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);
341  if (c > 0) {
342  actiongroup->add(act, Gtk::AccelKey(Glib::ustring::compose("<shift>%1", (char)c)));
343  } else {
344  actiongroup->add(act);
345  }
346  if (i == 0) {
347  act->signal_changed().connect(
348  sigc::mem_fun(*this, &GxUiRadioMenu::on_changed));
349  action = act;
350  }
351  //fprintf(stderr, "%s \n", p->value_id);
352  }
353  s.append(postfix);
354  uimanager->add_ui_from_string(s);
355 }
356 
357 void GxUiRadioMenu::set_value(unsigned int v) {
358  action->set_current_value(v);
359 }
360 
361 void GxUiRadioMenu::on_changed(Glib::RefPtr<Gtk::RadioAction> act) {
362  machine.set_parameter_value(id, act->get_current_value());
363 }
364 
365 
366 /****************************************************************
367  ** class Freezer
368  */
369 
371  : window(0), tag(), need_thaw(false), size_x(-1), size_y(-1) {
372 }
373 
375  thaw();
376 }
377 
378 void Freezer::freeze(Gtk::Window *w, int width, int height) {
379  if (window) {
380  thaw();
381  }
382  size_x = width;
383  size_y = height;
384  window = w;
385  Glib::RefPtr<Gdk::Window> win = window->get_window();
386  if (win) {
387  need_thaw = true;
388  win->freeze_updates();
389  }
390 }
391 
392 void Freezer::set_slot(sigc::slot<void> w) {
393  if (size_x == -1) {
394  w();
395  } else {
396  work = w;
397  }
398 }
399 
400 void Freezer::freeze_until_width_update(Gtk::Window *w, int width) {
401  int wd, ht;
402  w->get_size(wd, ht);
403  if (wd == width) {
404  return;
405  }
406  freeze(w, width, -1);
407 }
408 
409 void Freezer::freeze_and_size_request(Gtk::Window *w, int width, int height) {
410  int wd, ht;
411  w->get_size(wd, ht);
412  if (wd >= width && ht == height) {
413  return;
414  }
415  freeze(w, width, height);
416  w->set_size_request(width, height);
417 }
418 
419 bool Freezer::thaw_timeout() {
420 #ifndef NDEBUG
421  gx_print_error("freezer", "timeout");
422 #else
423  gx_print_warning("freezer", "timeout");
424 #endif
425  if (size_y != -1) {
426  window->set_size_request(-1,-1);
427  }
428  do_thaw();
429  return false;
430 }
431 
432 void Freezer::do_thaw() {
433  size_x = size_y = -1;
434  Glib::RefPtr<Gdk::Window> win = window->get_window();
435  window = 0;
436  if (!win) {
437  return;
438  }
439  if (!work.empty()) {
440  Glib::signal_idle().connect_once(work);
441  work.disconnect();
442  }
443  if (need_thaw) {
444  win->thaw_updates();
445  }
446 }
447 
448 void Freezer::thaw() {
449  if (size_x != -1) {
450  tag.disconnect();
451  do_thaw();
452  }
453 }
454 
455 bool Freezer::check_thaw(int width, int height) {
456  if (size_x == -1) {
457  return true;
458  }
459  Glib::RefPtr<Gdk::Window> win = window->get_window();
460  if (win && win->get_state()) {
461  thaw();
462  return true;
463  }
464  if (size_y == -1) {
465  if (size_x == width) {
466  window->set_size_request(-1,-1);
467  thaw();
468  return true;
469  }
470  }
471  if (size_x <= width && size_y == height) {
472  window->set_size_request(-1,-1);
473  thaw();
474  return true;
475  }
476  if (!tag.connected()) {
477  tag = Glib::signal_timeout().connect(sigc::mem_fun(*this, &Freezer::thaw_timeout), 500);
478  }
479  return false;
480 }
481 
482 
483 /****************************************************************
484  ** class MainWindow
485  */
486 
487 template <class T>
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,
491  bool is_active)
492  : Gtk::ToggleAction(name, icon_name, label, tooltip, is_active),
493  machine(machine_),
494  id(id_) {
495  set_active(machine.get_parameter_value<T>(id));
496  machine.signal_parameter_value<T>(id).connect(
497  sigc::mem_fun(this, &UiToggleAction::set_active));
498 }
499 
500 template <class T>
502 }
503 
504 template <class T>
506  machine.set_parameter_value(id, get_active());
507 }
508 
509 void update_scrolled_window(Gtk::ScrolledWindow& w) {
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);
514 }
515 
516 /*
517 ** moving / hiding / showing parts of the UI
518 */
519 
520 void MainWindow::maybe_shrink_horizontally(bool preset_no_rack) {
521  Glib::RefPtr<Gdk::Window> w = window->get_window();
522  if (!w) {
523  return;
524  }
525  int state = w->get_state();
526  if (state & (Gdk::WINDOW_STATE_MAXIMIZED | Gdk::WINDOW_STATE_FULLSCREEN)) {
527  return;
528  }
529  Gtk::Requisition req;
530  window->size_request(req);
531  int x, y;
532  window->get_position(x, y);
533  Gdk::Geometry geom;
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) {
538  req.height += options.preset_window_height - preset_scrolledbox->size_request().height;
539  } else {
540  req.height = std::max(req.height, options.window_height);
541  }
542  w->move_resize(x, y, req.width, req.height);
543  if (!state) {
544  freezer.freeze_until_width_update(window, req.width);
545  }
546 }
547 
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);
558  }
559  on_livetuner_toggled();
560  tunerbox->set_visible(v);
561  update_scrolled_window(*vrack_scrolledbox);
562 }
563 
564 void MainWindow::on_show_tuner() {
565  bool v = actions.tuner->get_active();
566  on_livetuner_toggled();
567  tunerbox->set_visible(v);
568  update_scrolled_window(*vrack_scrolledbox);
569 }
570 
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);
631 }
632 
633 
634 void MainWindow::set_next_preset_controller() {
635  if (!machine.midi_get_config_mode()) {
636  new gx_main_midi::MidiConnect(0, machine.get_parameter("engine.next_preset"), machine);
637  }
638 }
639 
640 void MainWindow::set_previus_preset_controller() {
641  if (!machine.midi_get_config_mode()) {
642  new gx_main_midi::MidiConnect(0, machine.get_parameter("engine.previus_preset"), machine);
643  }
644 }
645 
646 void MainWindow::on_select_preset(int idx) {
647  keyswitch.process_preset_key(idx);
648 }
649 
650 void MainWindow::on_next_preset() {
651  if (machine.setting_is_preset()) {
652  machine.next_preset_switch();
653  }
654 }
655 
656 void MainWindow::on_previus_preset() {
657  if (machine.setting_is_preset()) {
658  machine.previus_preset_switch();
659  }
660 }
661 
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();
670  }
671  if (!machine.setting_is_preset()) {
672  return;
673  }
675  if (!pf) {
676  return;
677  }
678  preset_list_actiongroup = Gtk::ActionGroup::create("PresetList");
679  preset_list_menu_bank = machine.get_current_bank();
680  Glib::ustring s = "<menubar><menu action=\"PresetsMenu\"><menu action=\"PresetListMenu\">";
681  int idx = 0;
682  for (gx_system::PresetFile::iterator i = pf->begin(); i != pf->end(); ++i, ++idx) {
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));
687  if (idx <= 9) {
688  char c = '0' + idx;
689  Gtk::AccelMap::change_entry(action->get_accel_path(), c, Gdk::ModifierType(0), true);
690  }
691  s += Glib::ustring::compose("<menuitem action=\"%1\"/>", actname);
692  }
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);
697 }
698 
699 void MainWindow::show_selected_preset() {
700  keyswitch.deactivate();
701  Glib::ustring t;
702  if (machine.setting_is_preset()) {
703  t = machine.get_current_bank() + " / " + machine.get_current_name();
704  if (preset_list_menu_bank != machine.get_current_bank()) {
705  rebuild_preset_menu();
706  }
707  }
708  preset_status->set_text(t);
709 }
710 
711 bool MainWindow::is_variable_size() {
712  return actions.presets->get_active() || actions.show_rack->get_active();
713 }
714 
715 void MainWindow::maybe_change_resizable() {
716  Glib::RefPtr<Gdk::Window> w = window->get_window();
717  if (w && w->get_state() != 0) {
718  return;
719  }
720  if (!is_variable_size() && window->get_resizable()) {
721  window->set_resizable(false);
722  } else if (!window->get_resizable()) {
723  window->set_resizable(true);
724  }
725 }
726 
727 void MainWindow::set_vpaned_handle() {
728  int w, h;
729  main_vpaned->get_handle_window()->get_size(w, h);
730  int pos = main_vpaned->get_allocation().get_height() - options.preset_window_height - h;
731  main_vpaned->set_position(pos);
732 }
733 
734 void MainWindow::on_show_rack() {
735  Gtk::Widget *w;
736  if (rackbox_stacked_vertical()) {
737  w = stereorackcontainerV;
738  } else {
739  w = stereorackbox;
740  }
741  bool v = options.system_show_rack = actions.show_rack->get_active();
742  actions.rackh->set_sensitive(v);
743  stereorackcontainer.set_visible(v);
744  rack_order_h_button->set_visible(v);
745  if (v) {
746  bool c = machine.get_parameter_value<bool>("ui.all_s_h");
747  compress_button->set_visible(!c);
748  expand_button->set_visible(c);
749  } else {
750  compress_button->set_visible(v);
751  expand_button->set_visible(v);
752  }
753  if (actions.presets->get_active() && preset_scrolledbox->get_mapped()) {
754  options.preset_window_height = preset_scrolledbox->get_allocation().get_height();
755  }
756  if (v) {
757  midi_out_box->set_visible(actions.midi_out->get_active());
758  if (pool_act) {
759  actions.show_plugin_bar->set_active(true);
760  }
761  options.window_height = max(options.window_height, window->size_request().height);
762  main_vpaned->set_position(oldpos);
763  w->show();
764  monoampcontainer->show();
765  monorackcontainer.show_entries();
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);
773  gx_gui::child_set_property(*main_vpaned, *preset_scrolledbox, "shrink", false);
774  }
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);
779  req.height = max(req.height, options.window_height);
780  freezer.freeze_and_size_request(window, req.width, req.height);
781  if (win && actions.presets->get_active()) {
782  freezer.set_slot(sigc::mem_fun(this, &MainWindow::set_vpaned_handle));
783  }
784  }
785  } else {
786  if (actions.midi_out->get_active()) {
787  midi_out_box->set_visible(false);
788  }
789  pool_act = actions.show_plugin_bar->get_active();
790  if (pool_act) {
791  actions.show_plugin_bar->set_active(false);
792  }
793  oldpos = main_vpaned->get_position();
794  w->hide();
795  monoampcontainer->hide();
796  monorackcontainer.hide_entries();
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);
802  }
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);
809  } else {
810  maybe_shrink_horizontally();
811  }
812  }
813  maybe_change_resizable();
814 }
815 
816 void MainWindow::on_compress_all() {
817  plugin_dict.compress(true);
818  on_ampdetail_switch(true, true);
819  actions.midi_out_plug->set_active(true);
820  machine.set_parameter_value("ui.all_s_h", true);
821  compress_button->set_visible(false);
822  expand_button->set_visible(true);
823 }
824 
825 void MainWindow::on_expand_all() {
826  plugin_dict.compress(false);
827  on_ampdetail_switch(false, true);
828  actions.midi_out_plug->set_active(false);
829  machine.set_parameter_value("ui.all_s_h", false);
830  compress_button->set_visible(true);
831  expand_button->set_visible(false);
832 }
833 
834 void MainWindow::on_rack_configuration() {
835  bool v = actions.rack_config->get_active();
836  actions.show_plugin_bar->set_sensitive(!v);
837  actions.show_rack->set_sensitive(!v);
838  actions.tuner->set_sensitive(!v);
839  actions.compress->set_sensitive(!v);
840  actions.expand->set_sensitive(!v);
841  actions.live_play->set_sensitive(!v);
842  Gtk::Requisition req;
843  monobox->size_request(req);
844  stereorackcontainer.set_config_mode(v);
845  monorackcontainer.set_config_mode(v);
846  szg_rack_units->set_ignore_hidden(v);
847  bool plugin_bar = actions.show_plugin_bar->get_active();
848  if (v) {
849  pre_act = actions.presets->get_active();
850  if (pre_act) {
851  actions.presets->set_active(false);
852  }
853  actions.show_rack->set_active(true);
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;
859  if (!plugin_bar) {
860  if (rackbox_stacked_vertical()) {
861  width -= req2.width;
862  } else {
863  if (req2.width & 1) {
864  req2.width += 1;
865  }
866  width -= req2.width/2;
867  }
868  }
869  effects_frame_paintbox->set_size_request(req2.width, -1);
870  monobox->set_size_request(width,-1);
871  } else {
872  if (!plugin_bar) {
873  effects_frame_paintbox->hide();
874  }
875  upper_rackbox->show();
876  effects_frame_paintbox->set_size_request(-1,-1);
877  monobox->set_size_request(-1,-1);
878  if (pre_act) {
879  actions.presets->set_active(true);
880  }
881  }
882  if (!plugin_bar) {
883  update_width();
884  maybe_shrink_horizontally();
885  }
886 }
887 
888 void MainWindow::on_show_plugin_bar() {
889  bool v = options.system_show_toolbar = actions.show_plugin_bar->get_active();
890  if (v) {
891  actions.show_rack->set_active(true);
892  }
893  effects_frame_paintbox->set_visible(v);
894  if (!v) {
895  //update_scrolled_window(*vrack_scrolledbox);
896  //update_scrolled_window(*stereorackbox);
897  maybe_shrink_horizontally();
898  }
899 }
900 
901 void MainWindow::move_widget(Gtk::Widget& w, Gtk::Box& b1, Gtk::Box& b2) {
902  // reparent does not always work when child is hidden
903  // (sometimes wrong position when shown later),
904  // use remove / add
905  b1.remove(w);
906  b1.hide();
907  b2.pack_start(w);
908  b2.show();
909 }
910 
911 int MainWindow::rackbox_stacked_vertical() const {
912  return !actions.rackh->get_active();
913 }
914 
915 void MainWindow::change_expand(Gtk::Widget& w, bool value) {
916  Gtk::Box *p = dynamic_cast<Gtk::Box*>(w.get_parent());
917  int expand, fill;
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);
922 }
923 
924 double MainWindow::stop_at_stereo_bottom(double off, double step_size, double pagesize) {
925  Gtk::Allocation alloc = stereorackcontainer.get_allocation();
926  double lim = alloc.get_y() + alloc.get_height() - pagesize;
927  if (off >= lim) {
928  return off;
929  }
930  return min(off+step_size, lim);
931 }
932 
933 double MainWindow::stop_at_mono_top(double off, double step_size) {
934  Gtk::Allocation alloc = monorackcontainer.get_allocation();
935  if (off < alloc.get_y()) {
936  return off;
937  }
938  return max(off-step_size, double(alloc.get_y()));
939 }
940 
941 void MainWindow::on_dir_changed() {
942  bool v = options.system_order_rack_h = actions.rackh->get_active();
943  if (v) {
944  // horizontally
945  move_widget(stereorackcontainer, *stereorackcontainerV, *stereorackcontainerH);
946  change_expand(*monobox, true);
947  stereorackbox->show();
948  } else {
949  move_widget(stereorackcontainer, *stereorackcontainerH, *stereorackcontainerV);
950  change_expand(*monobox, false);
951  stereorackbox->hide();
952  maybe_shrink_horizontally();
953  }
954 }
955 
956 void MainWindow::on_configure_event(GdkEventConfigure *ev) {
957  if (freezer.check_thaw(ev->width, ev->height)) {
958  if (actions.show_rack->get_active()) {
959  options.window_height = ev->height;
960  }
961  }
962 }
963 
965 {
966  if (ch == &monorackcontainer && !actions.rackh->get_active()) {
967  stereorackcontainer.queue_draw();
968  }
969 }
970 
972  update_scrolled_window(*vrack_scrolledbox);
973  update_scrolled_window(*stereorackbox);
974 }
975 
976 RackBox *MainWindow::add_rackbox_internal(PluginUI& plugin, Gtk::Widget *mainwidget, Gtk::Widget *miniwidget,
977  bool mini, int pos, bool animate, Gtk::Widget *bare) {
978  RackBox *r = new RackBox(plugin, *this, bare);
979  if (mini) {
980  r->swtch(true);
981  }
982  r->pack(mainwidget, miniwidget, szg_rack_units);
983  update_width();
984  if (plugin.get_type() == PLUGIN_TYPE_MONO) {
985  monorackcontainer.add(*manage(r), pos);
986  } else {
987  stereorackcontainer.add(*manage(r), pos);
988  }
989  if (animate) {
991  }
992  return r;
993 }
994 
995 RackBox *MainWindow::add_rackbox(PluginUI& pl, bool mini, int pos, bool animate) {
996  Gtk::Widget *mainwidget = 0;
997  Gtk::Widget *miniwidget = 0;
998  boxbuilder.get_box(pl.get_id(), mainwidget, miniwidget);
999  if (!mainwidget) {
1000  gx_gui::UiBuilderImpl builder(this, &boxbuilder);
1001 
1002  if (machine.load_unit(builder, pl.plugin->get_pdef())) {
1003  boxbuilder.fetch(mainwidget, miniwidget);
1004  }
1005  }
1006  return add_rackbox_internal(pl, mainwidget, miniwidget, mini, pos, animate);
1007 }
1008 
1009 void MainWindow::add_icon(const std::string& name) {
1010  PluginUI *p = plugin_dict[name];
1011  p->toolitem->show();
1012 }
1013 
1014 void MainWindow::on_show_values() {
1015  options.system_show_value = actions.show_values->get_active();
1016  std::string s =
1017  "style \"ShowValue\" {\n"
1018  " GxRegler::show-value = " + gx_system::to_string(options.system_show_value) + "\n"
1019  "}\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());
1023 }
1024 
1025 void MainWindow::on_preset_action() {
1026  bool v = options.system_show_presets = actions.presets->get_active();
1027  if (!v && preset_scrolledbox->get_mapped()) {
1028  options.preset_window_height = preset_scrolledbox->get_allocation().get_height();
1029  }
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);
1036  freezer.freeze_and_size_request(window, req.width, req.height+options.preset_window_height);
1037  }
1038  }
1039  preset_box_no_rack->set_visible(v);
1040  preset_window->on_preset_select(v, use_animations() && actions.show_rack->get_active(), options.preset_window_height);
1041 }
1042 
1043 /*
1044 ** UI initialization
1045 */
1046 
1047 bool MainWindow::on_my_leave_out(GdkEventCrossing *focus) {
1048  Glib::RefPtr<Gdk::Window> wind = window->get_window();
1049  wind->set_cursor();
1050  return true;
1051 }
1052 
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);
1057  return true;
1058 }
1059 
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;
1071  if (pl.get_type() == PLUGIN_TYPE_MONO) {
1072  listTargets.push_back(Gtk::TargetEntry("application/x-gtk-tool-palette-item-mono", Gtk::TARGET_SAME_APP, 0));
1073  } else {
1074  listTargets.push_back(Gtk::TargetEntry("application/x-gtk-tool-palette-item-stereo", Gtk::TARGET_SAME_APP, 0));
1075  }
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);
1079  if (!pl.tooltip.empty()) {
1080  img->set_tooltip_text(pl.tooltip);
1081  }
1082  tb->add(*manage(img));
1083  tb->show_all();
1084  pl.toolitem = tb;
1085  gw->add(*manage(tb));
1086  pl.group = gw;
1087 }
1088 
1089 bool MainWindow::on_visibility_notify(GdkEventVisibility *ev) {
1090  bool v = ev->state != GDK_VISIBILITY_FULLY_OBSCURED;
1091  if (v == is_visible) {
1092  return false;
1093  }
1094  is_visible = v;
1095  return false;
1096 }
1097 
1098 void MainWindow::on_live_play() {
1099  live_play->on_live_play(actions.live_play);
1100 }
1101 
1102 void MainWindow::on_ti_drag_begin(const Glib::RefPtr<Gdk::DragContext>& context, const PluginUI& plugin) {
1103  drag_icon = new DragIcon(plugin, context, options);
1104 }
1105 
1106 void MainWindow::on_ti_drag_end(const Glib::RefPtr<Gdk::DragContext>& context) {
1107  if (drag_icon) {
1108  delete drag_icon;
1109  drag_icon = 0;
1110  }
1111 }
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);
1115 }
1116 
1117 void MainWindow::hide_effect(const std::string& name) {
1118  Gtk::ToolItem *toolitem = plugin_dict[name]->toolitem;
1119  if (toolitem) {
1120  toolitem->hide();
1121  }
1122 }
1123 
1124 void MainWindow::on_ti_drag_data_delete(const Glib::RefPtr<Gdk::DragContext>& context, const char *effect_id) {
1125  hide_effect(effect_id);
1126 }
1127 
1128 bool MainWindow::on_ti_button_press(GdkEventButton *ev, const char *effect_id) {
1129  if (ev->type == GDK_2BUTTON_PRESS) {
1130  get_plugin(effect_id)->display_new();
1131  return true;
1132  }
1133  return false;
1134 }
1135 
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();
1138  PluginUI *p = get_plugin(id);
1139  p->display(false, false);
1140  add_icon(id);
1141  p->group->set_collapsed(false);
1142 }
1143 
1144 void MainWindow::jack_connection() {
1145  bool v = actions.jackserverconnection->get_active();
1146  if (!connect_jack(v)) {
1147  actions.jackserverconnection->set_active(!v);
1148  }
1149 }
1150 
1151 void MainWindow::on_portmap_response(int) {
1152  actions.jackports->set_active(false);
1153 }
1154 
1155 void MainWindow::on_portmap_activate() {
1156  gx_jack::GxJack *jack = machine.get_jack();
1157  if (!jack) {
1158  return;
1159  }
1160  if (actions.jackports->get_active()) {
1161  if (portmap_window) {
1162  return;
1163  }
1164  portmap_window = gx_portmap::PortMapWindow::create(machine, actions.accels);
1165  portmap_window->signal_response().connect(
1166  sigc::mem_fun(*this, &MainWindow::on_portmap_response));
1167  } else {
1168  if (!portmap_window) {
1169  return;
1170  }
1171  delete portmap_window;
1172  portmap_window = 0;
1173  }
1174 }
1175 
1176 void MainWindow::on_miditable_toggle() {
1178 }
1179 
1180 void MainWindow::change_skin(Glib::RefPtr<Gtk::RadioAction> action) {
1181  set_new_skin(options.skin[action->get_current_value()]);
1182 }
1183 
1184 void MainWindow::set_new_skin(const Glib::ustring& skin_name) {
1185  if (!skin_name.empty()) {
1186  options.skin_name = skin_name;
1187  string rcfile = options.get_style_filepath(
1188  "gx_head_" + skin_name + ".rc");
1189  gtk_rc_parse(rcfile.c_str());
1190  gtk_rc_reset_styles(gtk_settings_get_default());
1191  make_icons();
1192  }
1193 }
1194 
1195 void MainWindow::add_skin_menu() {
1196  Glib::ustring s = "<menubar><menu action=\"OptionsMenu\"><menu action=\"SkinMenu\">";
1197  int idx = 0;
1198  Gtk::RadioButtonGroup sg;
1199  for (vector<Glib::ustring>::iterator i = options.skin.skin_list.begin();
1200  i != options.skin.skin_list.end();
1201  ++i) {
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);
1206  if (name == options.skin_name) {
1207  action->set_active(true);
1208  }
1209  actions.group->add(action);
1210  if (idx == 0) {
1211  actions.skin = action;
1212  }
1213  action->property_value().set_value(idx++);
1214  }
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);
1219 }
1220 
1221 enum GxJackLatencyChange {
1222  kChangeLatency = 1,
1223  kKeepLatency = 2
1224 };
1225 
1226 // check user's decision to turn off latency change warning
1227 void MainWindow::user_disable_latency_warn(Gtk::CheckButton* disable_warn) {
1228  options.no_warn_latency = disable_warn->get_active();
1229 }
1230 
1231 int MainWindow::gx_wait_latency_warn() {
1232  Gtk::Dialog warn_dialog;
1233  // no set_destroy_with_parent() ??
1234  warn_dialog.property_destroy_with_parent().set_value(true);
1235 
1236  Gtk::VBox box(0, 4);
1237  Gtk::Label labelt(_("\nWARNING\n"));
1238  Gtk::Label labelt1(
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);
1249 
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);
1256 
1257  warn_dialog.add_button(_("Yes"), kChangeLatency);
1258  warn_dialog.add_button(_("No"), kKeepLatency);
1259 
1260  Gtk::HBox box1(0, 4);
1261  Gtk::HBox box2(0, 4);
1262 
1263  Gtk::CheckButton disable_warn;
1264  disable_warn.signal_clicked().connect(
1265  sigc::bind(
1266  sigc::mem_fun(*this, &MainWindow::user_disable_latency_warn),
1267  &disable_warn));
1268 
1269  Gtk::Label labelt2(
1270  _("Don't bother me again with such a question, "
1271  "I know what I am doing"));
1272 
1273  box.add(labelt);
1274  box.add(labelt1);
1275  box.add(box2);
1276  box.add(box1);
1277  box1.add(disable_warn);
1278  box1.add(labelt2);
1279  warn_dialog.get_vbox()->add(box);
1280 
1281  labelt2.modify_fg(Gtk::STATE_NORMAL, colorWhite);
1282 
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);
1287 
1288  box.show_all();
1289 
1290  return warn_dialog.run();
1291 }
1292 
1293 void MainWindow::change_latency(Glib::RefPtr<Gtk::RadioAction> action) {
1294  // are we a proper jack gxjack.client ?
1295  gx_jack::GxJack *jack = machine.get_jack();
1296  if (!jack) {
1297  return;
1298  }
1299  if (!jack->client) {
1301  _("Jack Buffer Size setting"),
1302  _("we are not a jack gxjack.client, server may be down")
1303  );
1304  return;
1305  }
1306  jack_nframes_t buf_size = action->get_current_value();
1307  if (buf_size == jack->get_jack_bs()) {
1308  return;
1309  }
1310  if (!options.no_warn_latency && gx_wait_latency_warn() != kChangeLatency) {
1311  Glib::signal_idle().connect_once(
1312  sigc::bind(
1313  sigc::mem_fun(action.operator->(), &Gtk::RadioAction::set_current_value), jack->get_jack_bs()));
1314  } else {
1315  if (jack_set_buffer_size(jack->client, buf_size) != 0)
1316  gx_print_warning(_("Setting Jack Buffer Size"),
1317  _("Could not change latency"));
1318  }
1319  gx_print_info(
1320  _("Jack Buffer Size"),
1321  boost::format(_("latency is %1%")) % jack_get_buffer_size(jack->client));
1322 }
1323 
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; // 2**4 = 16
1328  const int max_pow = 13; // 2**13 = 8192
1329  int jack_buffer_size = 16;
1330  for (int i = 0; i <= max_pow-min_pow; ++i) {
1331  Glib::ustring name = gx_system::to_string(jack_buffer_size);
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);
1336  if (i == 0) {
1337  action->signal_changed().connect(
1338  sigc::mem_fun(*this, &MainWindow::change_latency));
1339  actions.latency = action;
1340  }
1341  action->property_value().set_value(jack_buffer_size);
1342  jack_buffer_size *= 2;
1343  }
1344  s.append("</menu></menu></menubar>");
1345  uimanager->add_ui_from_string(s);
1346 }
1347 
1348 void MainWindow::set_latency() {
1349  gx_jack::GxJack *jack = machine.get_jack();
1350  if (!jack) {
1351  return;
1352  }
1353  jack_nframes_t n = jack->get_jack_bs();
1354  if (n > 0) {
1355  actions.latency->set_current_value(n);
1356  }
1357  if (n > 1023) actions.osc_buffer_menu->set_sensitive(false);
1358  else actions.osc_buffer_menu->set_sensitive(true);
1359 }
1360 
1361 void show_forum_help() {
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);
1365  if (error)
1366  {
1367  gx_print_error("guitarix help",
1368  _("failed to load online help "));
1369  g_error_free(error);
1370  }
1371 }
1372 
1374  Glib::signal_idle().connect_once(sigc::ptr_fun( show_forum_help));
1375 }
1376 
1377 // ----menu funktion about
1378 void gx_show_about() {
1379  static string about;
1380  if (about.empty()) {
1381  about +=_("<b>Guitarix:gx_head</b> (");
1382  about += GX_VERSION;
1383  about +=
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)"
1390  "\n\n");
1391 
1392 
1393  about +=
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 &lt;brummer-@web.de&gt;"
1401  "\nauthors: James Warden &lt;warjamy@yahoo.com&gt;"
1402  "\nauthors: Andreas Degert &lt;andreas.degert@googlemail.com&gt;"
1403  "\nauthors: Pete Shorthose &lt;pshorthose@gmail.com&gt;"
1404  "\nauthors: Markus Schmidt &lt;schmidt@boomshop.net&gt;"
1405  "\n\nwebsite: http://guitarix.org/\n");
1406  }
1407 
1408  gx_gui::gx_message_popup(about.c_str());
1409 }
1410 
1411 void MainWindow::set_tooltips() {
1412  options.system_show_tooltips = actions.tooltips->get_active();
1413  gtk_settings_set_long_property(
1414  gtk_settings_get_default(), "gtk-enable-tooltips", options.system_show_tooltips,
1415  "gx_head menu-option");
1416 }
1417 
1418 void MainWindow::set_animations() {
1419  options.system_animations = actions.animations->get_active();
1420 }
1421 
1422 void MainWindow::on_select_jack_control() {
1423  if (select_jack_control) {
1424  select_jack_control->present();
1425  } else {
1426  select_jack_control = gx_gui::SelectJackControlPgm::create(options, machine);
1427  select_jack_control->signal_close().connect(
1428  sigc::mem_fun(*this, &MainWindow::delete_select_jack_control));
1429  select_jack_control->set_transient_for(*window);
1430  select_jack_control->show();
1431  }
1432 }
1433 
1434 void MainWindow::delete_select_jack_control() {
1435  delete select_jack_control;
1436  select_jack_control = 0;
1437 }
1438 
1439 void MainWindow::on_select_midi_channel() {
1440  if (select_midi_channel) {
1441  select_midi_channel->present();
1442  } else {
1443  select_midi_channel = SelectMidiChannel::create(options, machine);
1444  select_midi_channel->signal_close().connect(
1445  sigc::mem_fun(*this, &MainWindow::delete_select_midi_channel));
1446  select_midi_channel->set_transient_for(*window);
1447  select_midi_channel->show();
1448  }
1449 }
1450 
1451 void MainWindow::delete_select_midi_channel() {
1452  delete select_midi_channel;
1453  select_midi_channel = 0;
1454 }
1455 
1456 // show loggingbox
1457 void MainWindow::on_log_activate() {
1458  if (actions.loggingbox->get_active()) {
1459  gint rxorg, ryorg;
1460  window->get_position(rxorg, ryorg);
1461  fLoggingWindow.move(rxorg+5, ryorg+272);
1462  fLoggingWindow.show_all();
1463  on_msg_level_changed();
1464  } else {
1465  fLoggingWindow.hide();
1466  }
1467 }
1468 // show loggingbox
1469 bool MainWindow::on_log_activated(GdkEventButton* ev) {
1470  if (ev->type == GDK_BUTTON_PRESS && ev->button == 1) {
1471  if (!actions.loggingbox->get_active()) {
1472  actions.loggingbox->set_active(true);
1473  gint rxorg, ryorg;
1474  window->get_position(rxorg, ryorg);
1475  fLoggingWindow.move(rxorg+5, ryorg+272);
1476  fLoggingWindow.show_all();
1477  on_msg_level_changed();
1478  } else {
1479  fLoggingWindow.hide();
1480  actions.loggingbox->set_active(false);
1481  }
1482  }else if (ev->type == GDK_BUTTON_PRESS && ev->button == 2) {
1483  fLoggingWindow.reset_msg_level();
1484  }
1485  return true;
1486 }
1487 
1488 bool MainWindow::on_log_scrolled(GdkEventScroll* ev) {
1489  if (!actions.loggingbox->get_active()) {
1490  actions.loggingbox->set_active(true);
1491  gint rxorg, ryorg;
1492  window->get_position(rxorg, ryorg);
1493  fLoggingWindow.move(rxorg+5, ryorg+272);
1494  fLoggingWindow.show_all();
1495  on_msg_level_changed();
1496  } else {
1497  fLoggingWindow.hide();
1498  actions.loggingbox->set_active(false);
1499  }
1500  return true;
1501 }
1502 
1503 void MainWindow::on_engine_toggled() {
1505  if (actions.engine_mute->get_active()) {
1507  } else if (actions.engine_bypass->get_active()) {
1509  } else {
1511  }
1512  machine.set_state(s);
1513 }
1514 
1515 void MainWindow::set_switcher_controller() {
1516  if (!machine.midi_get_config_mode()) {
1517  new gx_main_midi::MidiConnect(0, machine.get_parameter("ui.live_play_switcher"), machine);
1518  }
1519 }
1520 
1521 void MainWindow::set_bypass_controller() {
1522  if (!machine.midi_get_config_mode()) {
1523  new gx_main_midi::MidiConnect(0, machine.get_parameter("engine.bypass"), machine);
1524  }
1525 }
1526 
1527 void MainWindow::on_show_midi_out() {
1528 #ifdef USE_MIDI_OUT
1529  if (actions.midi_out->get_active()) {
1530  actions.show_rack->set_active(true);
1531  midi_out_box->set_visible(true);
1532  } else {
1533  midi_out_box->set_visible(false);
1534  machine.pluginlist_lookup_plugin("midi_out")->set_on_off(false);
1535  }
1536 #endif
1537 }
1538 
1539 void MainWindow::on_show_midi_out_plug() {
1540  if (actions.midi_out_plug->get_active()) {
1541  midi_out_normal->hide();
1542  midi_out_mini->show();
1543  } else {
1544  midi_out_mini->hide();
1545  midi_out_normal->show();
1546  }
1547 }
1548 
1549 void MainWindow::on_midi_out_channel_toggled(Gtk::RadioButton *rb, Gtk::Container *c) {
1550  c->set_visible(rb->get_active());
1551 }
1552 
1553 void MainWindow::on_livetuner_toggled() {
1554  if (actions.livetuner->get_active()) {
1555  if (actions.live_play->get_active()) {
1556  live_play->display_tuner(true);
1557  racktuner->set_sensitive(false);
1558  machine.tuner_used_for_display(true);
1559  } else {
1560  live_play->display_tuner(false);
1561  if (actions.tuner->get_active()) {
1562  racktuner->set_sensitive(true);
1563  machine.tuner_used_for_display(true);
1564  } else {
1565  machine.tuner_used_for_display(false);
1566  }
1567  }
1568  } else {
1569  live_play->display_tuner(false);
1570  racktuner->set_sensitive(false);
1571  machine.tuner_used_for_display(false);
1572  }
1573 }
1574 
1575 void MainWindow::create_actions() {
1576  gx_jack::GxJack *jack = machine.get_jack();
1577  actions.group = Gtk::ActionGroup::create("Main");
1578  /*
1579  ** Menu actions
1580  */
1581  actions.group->add(Gtk::Action::create("EngineMenu",_("_Engine")));
1582  actions.jack_latency_menu = Gtk::Action::create("JackLatency",_("_Latency"));
1583  actions.group->add(actions.jack_latency_menu);
1584  actions.osc_buffer_menu = Gtk::Action::create("OscBuffer",_("Osc. Buffer-size"));
1585  actions.group->add(actions.osc_buffer_menu);
1586 
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));
1592 
1593  actions.group->add(Gtk::Action::create("SetNextPresetSwitcher", _("Next Preset Midi Switch")),
1594  sigc::mem_fun(this, &MainWindow::set_next_preset_controller));
1595 
1596  actions.group->add(Gtk::Action::create("SetPreviusPresetSwitcher", _("Previous Preset Midi Switch")),
1597  sigc::mem_fun(this, &MainWindow::set_previus_preset_controller));
1598 
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")));
1607 
1608  /*
1609  ** engine actions
1610  */
1611  actions.jackserverconnection = Gtk::ToggleAction::create("JackServerConnection", _("Jack Server _Connection"));
1612  actions.group->add(
1613  actions.jackserverconnection,
1614  sigc::mem_fun(*this, &MainWindow::jack_connection));
1615 
1616  actions.jackports = Gtk::ToggleAction::create("JackPorts", _("Jack _Ports"));
1617  actions.group->add(
1618  actions.jackports,
1619  sigc::mem_fun(*this, &MainWindow::on_portmap_activate));
1620 
1621  actions.midicontroller = Gtk::ToggleAction::create("MidiController", _("M_idi Controller"));
1622  actions.group->add(
1623  actions.midicontroller,
1624  sigc::mem_fun(*this, &MainWindow::on_miditable_toggle));
1625 
1626  actions.engine_mute = Gtk::ToggleAction::create("EngineMute", _("Engine _Mute"));
1627  actions.group->add(actions.engine_mute);
1628  actions.engine_mute_conn = actions.engine_mute->signal_toggled().connect(
1629  sigc::mem_fun(*this, &MainWindow::on_engine_toggled));
1630 
1631  actions.engine_bypass = Gtk::ToggleAction::create("EngineBypass", _("Engine _Bypass"));
1632  actions.group->add(actions.engine_bypass);
1633  actions.engine_bypass_conn = actions.engine_bypass->signal_toggled().connect(
1634  sigc::mem_fun(*this, &MainWindow::on_engine_toggled));
1635 
1636  if (options.get_hideonquit()) {
1637  actions.quit = Gtk::Action::create("Quit",_("Hide"));
1638  } else {
1639  actions.quit = Gtk::Action::create("Quit",_("_Quit"));
1640  }
1641  actions.group->add(
1642  actions.quit,
1643  sigc::hide_return(sigc::mem_fun(this, &MainWindow::on_quit)));
1644 
1645  /*
1646  ** actions to open other (sub)windows
1647  */
1648  actions.presets = Gtk::ToggleAction::create(
1649  "Presets",_("_Preset Selection"));
1650  actions.group->add(actions.presets,
1651  sigc::mem_fun(*this, &MainWindow::on_preset_action));
1652 
1653  actions.show_plugin_bar = Gtk::ToggleAction::create(
1654  "ShowPluginBar",_("Show Plugin _Bar"));
1655  actions.group->add(actions.show_plugin_bar,
1656  sigc::mem_fun(*this, &MainWindow::on_show_plugin_bar));
1657 
1658  actions.show_rack = Gtk::ToggleAction::create(
1659  "ShowRack",_("Show _Rack"), "", true);
1660  actions.group->add(actions.show_rack,
1661  sigc::mem_fun(*this, &MainWindow::on_show_rack));
1662 
1663  actions.loggingbox = Gtk::ToggleAction::create("LoggingBox", _("Show _Logging Box"));
1664  actions.group->add(
1665  actions.loggingbox,
1666  sigc::mem_fun(*this, &MainWindow::on_log_activate));
1667 
1668  actions.live_play = Gtk::ToggleAction::create("Liveplay",_("Live _Display"));
1669  actions.group->add(actions.live_play,
1670  sigc::mem_fun(*this, &MainWindow::on_live_play));
1671 
1672  actions.meterbridge = Gtk::ToggleAction::create("Meterbridge", _("_Meterbridge"));
1673  if (jack) {
1674  actions.group->add(
1675  actions.meterbridge,
1676  sigc::bind(sigc::ptr_fun(gx_child_process::Meterbridge::start_stop),
1677  sigc::ref(actions.meterbridge), sigc::ref(*jack)));
1678  } else {
1679  actions.group->add(actions.meterbridge);
1680  }
1681 
1683  machine, "ui.racktuner", "LiveTuner", "??");
1684  actions.group->add(actions.livetuner);
1685  actions.livetuner->signal_toggled().connect(
1686  sigc::mem_fun(this, &MainWindow::on_livetuner_toggled));
1687 
1689  machine, "ui.midi_out", "MidiOut", _("M_idi Out"));
1690  actions.group->add(
1691  actions.midi_out,
1692  sigc::mem_fun(this, &MainWindow::on_show_midi_out));
1693 
1695  machine, "midi_out.s_h", "MidiOutSH", "??");
1696  actions.group->add(
1697  actions.midi_out_plug,
1698  sigc::mem_fun(this, &MainWindow::on_show_midi_out_plug));
1699 
1700  /*
1701  ** rack actions
1702  */
1704  machine, "system.show_tuner", "Tuner",_("_Tuner show"));
1705  actions.group->add(actions.tuner,
1706  sigc::mem_fun(*this, &MainWindow::on_show_tuner));
1708  machine, "system.stick_tuner", "Tunermove",_("Tuner stic_k "));
1709  actions.group->add(actions.tunermove,
1710  sigc::mem_fun(*this, &MainWindow::on_move_tuner));
1711 
1712  actions.rack_config = Gtk::ToggleAction::create("RackConfig", _("R_ack Configuration"));
1713  actions.group->add(actions.rack_config,
1714  sigc::mem_fun(*this, &MainWindow::on_rack_configuration));
1715 
1716  actions.compress = Gtk::Action::create("Compress",_("C_ompress all"));
1717  actions.group->add(actions.compress,
1718  sigc::mem_fun(*this, &MainWindow::on_compress_all));
1719 
1720  actions.expand = Gtk::Action::create("Expand",_("E_xpand all"));
1721  actions.group->add(actions.expand,
1722  sigc::mem_fun(*this, &MainWindow::on_expand_all));
1723 
1724  actions.rackh = Gtk::ToggleAction::create(
1725  "RackH", _("Order Rack _Horizontally"));
1726  actions.group->add(actions.rackh,
1727  sigc::mem_fun(*this, &MainWindow::on_dir_changed));
1728 
1729  /*
1730  ** option actions
1731  */
1732  actions.show_values = Gtk::ToggleAction::create(
1733  "ShowValues",_("_Show _Values"), "", true);
1734  actions.group->add(actions.show_values,
1735  sigc::mem_fun(*this, &MainWindow::on_show_values));
1736 
1737  actions.tooltips = Gtk::ToggleAction::create(
1738  "ShowTooltips", _("Show _Tooltips"), "", true);
1739  actions.group->add(
1740  actions.tooltips,
1741  sigc::mem_fun(this, &MainWindow::set_tooltips));
1742 
1744  machine, "system.midi_in_preset", "MidiInPresets", _("Include MIDI in _presets"));
1745  actions.group->add(actions.midi_in_presets);
1746 
1747  actions.jackstartup = Gtk::Action::create("JackStartup", _("_Jack Startup Control"));
1748  actions.group->add(
1749  actions.jackstartup,
1750  sigc::mem_fun(*this, &MainWindow::on_select_jack_control));
1751 
1752  actions.loadladspa = Gtk::Action::create("LoadLADSPA", _("LADSPA/LV2 Pl_ugins"));
1753  actions.group->add(
1754  actions.loadladspa,
1755  sigc::mem_fun(this, &MainWindow::on_load_ladspa));
1756 
1757  actions.group->add(Gtk::Action::create("ResetAll", _("Reset _All Parameters")),
1758  sigc::mem_fun(machine, &gx_engine::GxMachineBase::set_init_values));
1759 
1760  actions.animations = Gtk::ToggleAction::create(
1761  "Animations", _("_Use Animations"),"",true);
1762  actions.group->add(actions.animations,
1763  sigc::mem_fun(this, &MainWindow::set_animations));
1764 
1765  actions.group->add(Gtk::Action::create("SetPresetSwitcher", _("L_iveplay Midi Switch")),
1766  sigc::mem_fun(this, &MainWindow::set_switcher_controller));
1767 
1768  actions.group->add(Gtk::Action::create("SetBypassSwitcher", _("B_ypass Midi Switch")),
1769  sigc::mem_fun(this, &MainWindow::set_bypass_controller));
1770 
1771  actions.group->add(Gtk::Action::create("SetMidiChannel", _("Set Midi Channel")),
1772  sigc::mem_fun(this, &MainWindow::on_select_midi_channel));
1773 
1774  /*
1775  ** Help and About
1776  */
1777  actions.group->add(Gtk::Action::create("Help", _("_Help")),
1778  sigc::ptr_fun(gx_show_help));
1779  actions.group->add(Gtk::Action::create("About", _("_About")),
1780  sigc::ptr_fun(gx_show_about));
1781 
1782  if (!jack) {
1783  actions.jack_latency_menu->set_visible(false);
1784  actions.jackserverconnection->set_visible(false);
1785  actions.jackports->set_visible(false);
1786  actions.meterbridge->set_visible(false);
1787  }
1788 }
1789 
1790 #if false // unused
1791 int get_current_workarea_height_from_desktop(GdkWindow *root) {
1792  // use "xprop -root" to view desktop properties
1793  GdkAtom actual_type, atom_cardinal;
1794  gint actual_format;
1795  gint num_items;
1796  int *ret_data_ptr;
1797  int idx;
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)) {
1803  return -1;
1804  }
1805  idx = *ret_data_ptr * 4 + 3; // [x, y, width, height] * desktop_count
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)) {
1811  return -1;
1812  }
1813  if (idx >= num_items) {
1814  //??
1815  return -1;
1816  }
1817  int height = *ret_data_ptr;
1818  g_free(ret_data_ptr);
1819  return height;
1820 }
1821 
1822 int get_current_workarea_height() {
1823  // Helper fetching the current workarea (i.e. usable space) size
1824  GdkWindow *root = gdk_get_default_root_window();
1825  int height = get_current_workarea_height_from_desktop(root);
1826  if (height > 0) {
1827  return height;
1828  }
1829  int x, y, width, depth;
1830  gdk_window_get_geometry(root, &x, &y, &width, &height, &depth);
1831  return height;
1832 }
1833 #endif
1835 void MainWindow::plugin_preset_popup(const PluginDef *pdef) {
1836  new PluginPresetPopup(pdef, machine);
1837 }
1838 
1839 void MainWindow::plugin_preset_popup(const PluginDef *pdef, const Glib::ustring& name) {
1840  new PluginPresetPopup(pdef, machine, name);
1841 }
1842 
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) {
1846  box.remove(**p);
1847  }
1848 }
1849 
1850 void MainWindow::make_icons(bool force) {
1851  Gtk::OffscreenWindow w;
1852  w.set_type_hint(Gdk::WINDOW_TYPE_HINT_DOCK); // circumvent canberra-gtk-module bug on AV Linux
1853  Glib::RefPtr<Gdk::Screen> screen = w.get_screen();
1854  Glib::RefPtr<Gdk::Colormap> rgba = screen->get_rgba_colormap();
1855  if (rgba) {
1856  w.set_colormap(rgba);
1857  }
1858  Gtk::VBox vb;
1859  w.add(vb);
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) {
1864  continue;
1865  }
1866  Gtk::Widget *r = RackBox::create_icon_widget(*i->second, options);
1867  r->hide();
1868  r->set_no_show_all(true);
1869  vb.add(*manage(r));
1870  sz->add_widget(*r);
1871  l.push_back(std::pair<PluginUI*,Gtk::Widget*>(i->second, r));
1872  }
1873  //FIXME hack to set a minimum size
1874  l.begin()->second->show();
1875  if (vb.size_request().width < 110) {
1876  vb.set_size_request(110, -1);
1877  }
1878  w.show_all();
1879  for (std::vector<std::pair<PluginUI*,Gtk::Widget*> >::iterator i = l.begin(); i != l.end(); ++i) {
1880  i->second->show();
1881  w.show();
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);
1886  }
1887  w.hide();
1888  i->second->hide();
1889  }
1890 
1891  // Amp padding
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);
1904 }
1906 class JConvPluginUI: public PluginUI {
1907 private:
1908  virtual void on_plugin_preset_popup();
1909 public:
1910  JConvPluginUI(MainWindow& main, const char* id,
1911  const Glib::ustring& tooltip="")
1912  : PluginUI(main, id, tooltip) {
1913  }
1914 };
1915 
1916 void JConvPluginUI::on_plugin_preset_popup() {
1917  gx_engine::JConvParameter *jcp = dynamic_cast<gx_engine::JConvParameter*>(
1918  &main.get_machine().get_parameter(std::string(get_id())+".convolver"));
1919  assert(jcp);
1920  Glib::ustring name = jcp->get_value().getIRFile();
1921  Glib::ustring::size_type n = name.find_last_of('.');
1922  if (n != Glib::ustring::npos) {
1923  name.erase(n);
1924  }
1926 }
1927 
1928 void MainWindow::on_plugin_changed(gx_engine::Plugin *pl, gx_engine::PluginChange::pc c) {
1929  if (!pl) { // end of update sequence
1930  make_icons(true); // re-create all icons, width might have changed
1931  } else if (c == gx_engine::PluginChange::add) {
1932  register_plugin(new PluginUI(*this, pl->get_pdef()->id, ""));
1933  } else {
1934  PluginUI *pui = plugin_dict[pl->get_pdef()->id];
1936  plugin_dict.remove(pui);
1937  pui->unset_ui_merge_id(uimanager);
1938  uimanager->ensure_update();
1939  actions.group->remove(pui->get_action());
1940  machine.remove_rack_unit(pui->get_id(), pui->get_type());
1941  std::string group_id = pui->get_category();
1942  delete pui;
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);
1949  delete group;
1950  }
1951  } else {
1953  //if (!pui->plugin->get_box_visible())
1954  bool state = pui->plugin->get_on_off();
1955  pui->update_rackbox();
1956  pui->plugin->set_on_off(state);
1958  pui->unset_ui_merge_id(uimanager);
1959  pui->group = add_plugin_category(pui->get_category());
1960  pui->toolitem->reparent(*pui->group);
1961  add_plugin_menu_entry(pui);
1962  }
1963  }
1964  }
1965 }
1966 
1967 void MainWindow::on_ladspa_finished(bool reload, bool quit) {
1968  if (reload) {
1969  machine.commit_ladspa_changes();
1970  }
1971  if (quit) {
1972  Glib::signal_idle().connect(sigc::mem_fun(this, &MainWindow::delete_ladspalist_window));
1973  }
1974 }
1975 
1976 bool MainWindow::delete_ladspalist_window() {
1977  if (ladspalist_window) {
1978  //ladspalist_window->hide();
1979  delete ladspalist_window;
1980  ladspalist_window = 0;
1981  }
1982  return false;
1983 }
1984 
1985 void MainWindow::on_load_ladspa() {
1986  if (ladspalist_window) {
1987  ladspalist_window->present();
1988  } else {
1989  ladspalist_window = new ladspa::PluginDisplay(machine, gx_head_icon, sigc::mem_fun(this, &MainWindow::on_ladspa_finished));
1990  }
1991 }
1992 
1993 void MainWindow::add_plugin(std::vector<PluginUI*>& p, const char *id, const Glib::ustring& tooltip) {
1994  if (PluginUI::is_registered(machine, id)) {
1995  return;
1996  }
1997  p.push_back(new PluginUI(*this, id, tooltip));
1998 }
1999 
2000 #ifdef accel_keys_for_plugins
2001 struct accel_search {
2002  unsigned int key;
2003  bool res;
2004 };
2005 
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) {
2009  s->res = true;
2010  }
2011 }
2012 
2013 static bool accel_map_has_key(unsigned int accel_key) {
2014  accel_search s;
2015  s.key = accel_key;
2016  s.res = false;
2017  gtk_accel_map_foreach_unfiltered(gpointer(&s), accel_search_callback);
2018  return s.res;
2019 }
2020 
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)) {
2024  return true;
2025  }
2026  *accel_key += 1;
2027  }
2028  return false;
2030 #endif
2031 
2032 struct PluginDesc {
2033  Glib::ustring group;
2034  std::vector<PluginUI*> *plugins;
2035  PluginDesc(const Glib::ustring& g, std::vector<PluginUI*> *p)
2036  : group(g), plugins(p) {}
2037 };
2038 
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()) {
2042  return it->second;
2043  }
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);
2057  return gw;
2058 }
2059 
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>";
2065  const char *group = pui->get_category();
2066  Glib::ustring groupname = Glib::ustring::compose("PluginCategory_%1", group);
2067  Glib::ustring actionname = Glib::ustring::compose("Plugin_%1", pui->get_id());
2068  const char *tp = (pui->get_type() == PLUGIN_TYPE_MONO ? "Mono" : "Stereo");
2069  pui->set_ui_merge_id(uimanager->add_ui_from_string(Glib::ustring::compose(ui_template, tp, groupname, actionname)));
2070  //fprintf(stderr, "%s : %s : %s \n", tp, group, pui->get_name());
2071  return actionname;
2072 }
2073 
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));
2085  ++key;
2086  }
2087 #endif
2088  if (pui->rackbox && pui->rackbox->get_box_visible()) {
2089  act->set_active(true);
2090  }
2091  pui->set_action(act);
2092 }
2093 
2094 void MainWindow::fill_pluginlist() {
2095  // define order of categories by registering
2096  // them first
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"));
2105 
2106  std::vector<PluginUI*> p;
2107  p.push_back(new JConvPluginUI(*this, "jconv"));
2108  p.push_back(new JConvPluginUI(*this, "jconv_mono"));
2109 
2110  gx_gui::UiBuilderImpl builder(this, &boxbuilder, &p);
2111  machine.pluginlist_append_rack(builder);
2112 
2113  std::sort(p.begin(), p.end(), plugins_by_name_less);
2114  for (std::vector<PluginUI*>::iterator v = p.begin(); v != p.end(); ++v) {
2115  register_plugin(*v);
2116  //fprintf(stderr, "%s\n",(*v)->get_name());
2117  }
2118 }
2119 
2120 // start_jack() returns:
2121 // 1: success
2122 // 0: fail
2123 // -1: no start command configured
2124 int MainWindow::start_jack() {
2125  gx_jack::GxJack *jack = machine.get_jack();
2126  if (!jack) {
2127  return -1;
2128  }
2129  int wait_after_connect = 0;
2130  gx_engine::EnumParameter& jack_starter = machine.get_parameter("ui.jack_starter_idx").getEnum();
2131  string v_id = jack_starter.get_pair().value_id;
2132  if (v_id == "autostart") {
2133  return jack->gx_jack_connection(true, true, wait_after_connect, options) ? 1 : 0;
2134  }
2135  string cmd;
2136  if (v_id == "other") {
2137  cmd = machine.get_parameter("ui.jack_starter").getString().get_value();
2138  if (cmd.empty()) {
2139  return -1;
2140  }
2141  } else if (v_id == "qjackctl") {
2142  wait_after_connect = 500000;
2143  cmd = "qjackctl --start";
2144  } else {
2145  assert(false);
2146  }
2147  gx_system::gx_system_call(cmd, true, true);
2148  for (int i = 0; i < 10; i++) {
2149  if (jack->gx_jack_connection(true,false,wait_after_connect, options)) {
2150  return 1;
2151  }
2152  usleep(500000);
2153  }
2155  _("main"),
2156  string(_("I really tried to get jack up and running, sorry ... ")));
2157  return 0;
2158 }
2159 
2160 bool MainWindow::connect_jack(bool v, Gtk::Window *splash) {
2161  gx_jack::GxJack *jack = machine.get_jack();
2162  if (!jack) {
2163  return false;
2164  }
2165  if (jack->gx_jack_connection(v, false, 0, options)) {
2166  return true;
2167  }
2168  if (!v) {
2169  gx_print_error(_("main"), _("can't disconnect jack"));
2170  return false;
2171  }
2172  bool ask = machine.get_parameter_value<bool>("ui.ask_for_jack_starter");
2173  if (!ask) {
2174  switch (start_jack()) {
2175  case 1: return true; // connected
2176  case -1: return false; // no starter, do nothing
2177  default: break; // failed, ask user
2178  }
2179  }
2180  if (splash) {
2181  splash->hide();
2182  }
2183  if (!gx_gui::gx_start_jack_dialog(gx_head_icon)) {
2184  gx_print_warning(_("main"), string(_("Ignoring jackd ...")));
2185  return false;
2186  }
2187  return start_jack() == 1;
2188 }
2189 
2190 void MainWindow::on_jack_client_changed() {
2191  if (!window) {
2192  return;
2193  }
2194  gx_jack::GxJack *jack = machine.get_jack();
2195  if (!jack) {
2196  return;
2197  }
2198  bool v = (jack->client != 0);
2199  if (!v) {
2201  }
2202  actions.jackserverconnection->set_active(v);
2203  Glib::ustring s = "Guitarix: ";
2204  if (v) {
2205  s += jack->get_instancename();
2206  } else {
2207  s += "("+jack->get_instancename()+")";
2208  }
2209  window->set_title(s);
2210  actions.jack_latency_menu->set_sensitive(v);
2211  actions.engine_mute->set_sensitive(v);
2212  actions.engine_bypass->set_sensitive(v);
2213  status_image->set_sensitive(v);
2214  if (!v) {
2215  jackd_image->set(pixbuf_jack_disconnected);
2216  } else {
2217  jackd_image->set(pixbuf_jack_connected);
2218  }
2219 }
2220 
2221 void MainWindow::on_engine_state_change(gx_engine::GxEngineState state) {
2222  switch (state) {
2223  case gx_engine::kEngineOff:
2224  actions.engine_mute_conn.block();
2225  actions.engine_mute->set_active(true);
2226  actions.engine_mute_conn.unblock();
2227  status_image->set(pixbuf_off);
2228  machine.msend_midi_cc(0xB0,120,127,3);
2229  break;
2230  case gx_engine::kEngineOn:
2231  actions.engine_mute_conn.block();
2232  actions.engine_bypass_conn.block();
2233  actions.engine_mute->set_active(false);
2234  actions.engine_bypass->set_active(false);
2235  actions.engine_mute_conn.unblock();
2236  actions.engine_bypass_conn.unblock();
2237  status_image->set(pixbuf_on);
2238  machine.msend_midi_cc(0xB0,120,0,3);
2239  break;
2241  actions.engine_mute_conn.block();
2242  actions.engine_bypass_conn.block();
2243  actions.engine_mute->set_active(false);
2244  actions.engine_bypass->set_active(true);
2245  actions.engine_mute_conn.unblock();
2246  actions.engine_bypass_conn.unblock();
2247  status_image->set(pixbuf_bypass);
2248  break;
2249  }
2250 }
2251 
2252 void MainWindow::set_tuning(Gxw::RackTuner& tuner) {
2253  static struct TuningTab {
2254  const char *name;
2255  const char* key;
2256  bool flat;
2257  int notes[6];
2258  } tuning_tab[] = {
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}},
2314  };
2315  int mode = tuner_tuning->get_value();
2316  tuner.clear_notes();
2317  if (mode > 0) {
2318  tuner.set_display_flat(tuning_tab[mode-1].flat);
2319  for (int i = 0; i < 6; ++i) {
2320  tuner.push_note(tuning_tab[mode-1].notes[i], 69, 12);
2321  }
2322  } else {
2323  tuner.set_display_flat(false);
2324  }
2325 }
2326 
2327 void MainWindow::set_tuner_tet(Gxw::RackTuner& tuner) {
2328  Glib::ustring tet = options.get_tuner_tet();
2329  int t = 0;
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();
2336  machine.set_parameter_value("racktuner.temperament", t);
2337  tuner.set_temperament(tuner_temperament->get_value());
2338  set_tuning(tuner);
2339 }
2340 
2341 void MainWindow::set_tuner_ref(Gxw::RackTuner& tuner) {
2342  Glib::ustring ref = options.get_tuner_ref();
2343  float t = atof(ref.c_str());
2344  machine.set_parameter_value("ui.tuner_reference_pitch", t);
2345  tuner.set_reference_pitch(tuner_reference_pitch->get_value());
2346  set_tuning(tuner);
2347 }
2348 
2349 void MainWindow::setup_tuner_temperament(Gxw::RackTuner& tuner) {
2350  tuner.set_temperament(tuner_temperament->get_value());
2351  set_tuning(tuner);
2352 }
2353 
2354 void MainWindow::setup_tuner(Gxw::RackTuner& tuner) {
2355  tuner.signal_frequency_poll().connect(
2356  sigc::compose(
2357  sigc::mem_fun(tuner, &Gxw::RackTuner::set_freq),
2358  sigc::mem_fun(machine, &gx_engine::GxMachineBase::get_tuner_freq)));
2359  tuner_mode->signal_value_changed().connect(
2360  sigc::compose(
2361  sigc::mem_fun(tuner, &Gxw::RackTuner::set_streaming),
2362  sigc::mem_fun(*tuner_mode, &Gxw::Selector::get_value)));
2363  tuner_reference_pitch->signal_value_changed().connect(
2364  sigc::compose(
2365  sigc::mem_fun(tuner, &Gxw::RackTuner::set_reference_pitch),
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)));
2371  tuner.set_temperament(tuner_temperament->get_value());
2372 }
2373 
2374 bool MainWindow::on_toggle_mute(GdkEventButton* ev) {
2375  if (ev->type == GDK_BUTTON_PRESS && ev->button == 1) {
2376  if (machine.get_state() == gx_engine::kEngineOff) {
2378  } else {
2380  }
2381  }
2382  return true;
2383 }
2384 
2385 bool MainWindow::on_scroll_toggle(GdkEventScroll* ev) {
2386  if (ev->direction == GDK_SCROLL_UP) {
2387  if (machine.get_state() == gx_engine::kEngineOff) {
2389  } else if (machine.get_state() == gx_engine::kEngineOn) {
2391  } else {
2393  }
2394  } else if (ev->direction == GDK_SCROLL_DOWN) {
2395  if (machine.get_state() == gx_engine::kEngineOff) {
2397  } else if (machine.get_state() == gx_engine::kEngineBypass) {
2399  } else {
2401  }
2402  }
2403 
2404  return true;
2405 }
2406 
2407 bool MainWindow::on_toggle_insert(GdkEventButton* ev) {
2408  if (ev->type == GDK_BUTTON_PRESS && ev->button == 1) {
2409  if (machine.get_parameter_value<bool>("engine.insert")) {
2410  machine.set_parameter_value("engine.insert",false);
2411  } else {
2412  machine.set_parameter_value("engine.insert",true);
2413  }
2414  }
2415  return true;
2416 }
2417 
2418 bool MainWindow::on_scroll_toggle_insert(GdkEventScroll* ev) {
2419  if (machine.get_parameter_value<bool>("engine.insert")) {
2420  machine.set_parameter_value("engine.insert",false);
2421  } else {
2422  machine.set_parameter_value("engine.insert",true);
2423  }
2424  return true;
2425 }
2426 
2427 void MainWindow::on_insert_jack_changed(bool s) {
2428  if (s) {
2429  insert_image->set(pixbuf_insert_off);
2430  } else {
2431  insert_image->set(pixbuf_insert_on);
2432  }
2433 }
2434 
2435 bool MainWindow::on_jackserverconnection(GdkEventButton* ev) {
2436  if (ev->type == GDK_BUTTON_PRESS && ev->button == 1) {
2437  bool v = actions.jackserverconnection->get_active();
2438  actions.jackserverconnection->set_active(!v);
2439  }
2440  return true;
2441 }
2442 
2443 bool MainWindow::on_jackserverconnection_scroll(GdkEventScroll* ev) {
2444  bool v = actions.jackserverconnection->get_active();
2445  actions.jackserverconnection->set_active(!v);
2446  return true;
2447 }
2448 
2449 void MainWindow::on_msg_level_changed() {
2450  switch (fLoggingWindow.get_unseen_msg_level()) {
2451  case GxLogger::kWarning: logstate_image->set(pixbuf_log_yellow); break;
2452  case GxLogger::kError: logstate_image->set(pixbuf_log_red); break;
2453  default: logstate_image->set(pixbuf_log_grey); break;
2454  }
2455 }
2456 
2457 //static void toggle_action(Glib::RefPtr<Gtk::ToggleAction> act) {
2458 // act->set_active(!act->get_active());
2459 //}
2460 
2461 void MainWindow::on_ampdetail_switch(bool compress, bool setparam) {
2462  if (compress) {
2463  ampdetail_normal->hide();
2464  ampdetail_mini->show();
2465  } else {
2466  ampdetail_mini->hide();
2467  ampdetail_normal->show();
2468  }
2469  if (setparam) {
2470  machine.set_parameter_value("ui.mp_s_h", compress);
2471  }
2472 }
2473 
2474 /****************************************************************
2475  ** oscilloscope handling
2476  */
2477 
2478 void MainWindow::set_osc_size() {
2479  //int osc_size = engine.oscilloscope.get_mul_buffer();
2480  if (options.mul_buffer > 0) {
2481  actions.osc_buffer_size->set_current_value(options.mul_buffer);
2482  }
2483 }
2484 
2485 void MainWindow::change_osc_buffer(Glib::RefPtr<Gtk::RadioAction> action) {
2486  gx_jack::GxJack *jack = machine.get_jack();
2487  if (!jack || jack->client) {
2488  options.mul_buffer = action->get_current_value();
2489  on_oscilloscope_activate(false);
2490  machine.set_oscilloscope_mul_buffer(options.mul_buffer);
2491  on_oscilloscope_activate(true);
2492  } else {
2493  set_osc_size();
2494  }
2495 }
2496 
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) {
2502  Glib::ustring name = "*" + gx_system::to_string(osc_buffer_size);
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);
2507  if (i == 1) {
2508  action->signal_changed().connect(
2509  sigc::mem_fun(*this, &MainWindow::change_osc_buffer));
2510  actions.osc_buffer_size = action;
2511  }
2512  action->property_value().set_value(osc_buffer_size);
2513  osc_buffer_size++;
2514  }
2515  s.append("</menu></menu></menubar>");
2516  uimanager->add_ui_from_string(s);
2517 }
2518 
2519 void MainWindow::on_show_oscilloscope(bool v) {
2520  if (v) {
2521  // FIXME G_PRIORITY_DEFAULT_IDLE??
2522  Glib::signal_timeout().connect(
2523  sigc::mem_fun(*this, &MainWindow::on_refresh_oscilloscope), 60);
2524  }
2525 }
2526 
2527 void MainWindow::set_waveview_buffer(unsigned int size) {
2528  fWaveView.set_frame(machine.get_oscilloscope_buffer(), size);
2529 }
2530 
2531 void MainWindow::on_oscilloscope_post_pre(int post_pre) {
2532  // if (post_pre) {
2533  // fWaveView.set_multiplicator(150.,250.);
2534  // } else {
2535  fWaveView.set_multiplicator(20.,60.);
2536  // }
2537 }
2538 
2539 int MainWindow::on_oscilloscope_activate(bool start) {
2540  if (!start) {
2541  machine.clear_oscilloscope_buffer();
2542  fWaveView.queue_draw();
2543  }
2544  return 0;
2545 }
2546 
2547 bool MainWindow::on_refresh_oscilloscope() {
2548  int load, frames;
2549  bool is_rt;
2550  jack_nframes_t bsize;
2551  machine.get_oscilloscope_info(load, frames, is_rt, bsize);
2552  static struct {
2553  int load, frames;
2554  jack_nframes_t bsize;
2555  bool rt;
2556  } oc;
2557  if (!oc.bsize || oc.load != load) {
2558  oc.load = load;
2559  fWaveView.set_text(
2560  (boost::format(_("DSP Load %1% %%")) % oc.load).str().c_str(),
2561  Gtk::CORNER_TOP_LEFT);
2562  }
2563  if (!oc.bsize || oc.frames != frames) {
2564  oc.frames = frames;
2565  fWaveView.set_text(
2566  (boost::format(_("HT Frames %1%")) % oc.frames).str().c_str(),
2567  Gtk::CORNER_BOTTOM_LEFT);
2568  }
2569  if (!oc.bsize || oc.rt != is_rt) {
2570  oc.rt = is_rt;
2571  fWaveView.set_text(
2572  oc.rt ? _("RT Mode YES ") : _("RT mode <span color=\"#cc1a1a\">NO</span>"),
2573  Gtk::CORNER_BOTTOM_RIGHT);
2574  }
2575  if (!oc.bsize || oc.bsize != bsize) {
2576  oc.bsize = bsize;
2577  fWaveView.set_text(
2578  (boost::format(_("Latency %1%")) % oc.bsize).str().c_str(),
2579  Gtk::CORNER_TOP_RIGHT);
2580  }
2581  fWaveView.queue_draw();
2582  return machine.oscilloscope_plugin_box_visible();
2583 }
2584 
2585 /* --------- calculate power (percent) to decibel -------- */
2586 // Note: could use fast_log10 (see ardour code) to make it faster
2587 inline float power2db(float power) {
2588  return 20.*log10(power);
2589 }
2590 
2591 bool MainWindow::refresh_meter_level(float falloff) {
2592  const unsigned int channels = sizeof(fastmeter)/sizeof(fastmeter[0]);
2593  gx_jack::GxJack *jack = machine.get_jack();
2594  if (jack && !jack->client) {
2595  return true;
2596  }
2597 
2598  // Note: removed RMS calculation, we will only focus on max peaks
2599  static float old_peak_db[channels] = {-INFINITY, -INFINITY};
2600 
2601  // fill up from engine buffers
2602  float level[channels];
2603  machine.maxlevel_get(channels, level);
2604  for (unsigned int c = 0; c < channels; c++) {
2605  // update meters (consider falloff as well)
2606  // calculate peak dB and translate into meter
2607  float peak_db = -INFINITY;
2608  if (level[c] > 0) {
2609  peak_db = power2db(level[c]);
2610  }
2611  // retrieve old meter value and consider falloff
2612  if (peak_db < old_peak_db[c]) {
2613  peak_db = max(peak_db, old_peak_db[c] - falloff);
2614  }
2615  fastmeter[c]->set(log_meter(peak_db));
2616  old_peak_db[c] = peak_db;
2617  }
2618  return true;
2619 }
2620 
2621 bool MainWindow::survive_jack_shutdown() {
2622  gx_jack::GxJack *jack = machine.get_jack();
2623  if (!jack) {
2624  return false;
2625  }
2626  // return if jack is not down
2627  if (gx_system::gx_system_call("pgrep jackd", true) == SYSTEM_OK) {
2628  if (jack->is_jack_down()) {
2629  sleep(2);
2630  jack->set_jack_down(false);
2631  }
2632  // let's make sure we get out of here
2633  gx_print_warning("Jack Shutdown",
2634  _("jack has bumped us out!! "));
2635  actions.jackserverconnection->set_active(true);
2636  // run only one time whem jackd is running
2637  return false;
2638  } else if (!jack->is_jack_down()) {
2639  // refresh some stuff. Note that it can be executed
2640  // more than once, no harm here
2641  actions.jackserverconnection->set_active(false);
2642  jack->set_jack_down(true);
2643  gx_print_error("Jack Shutdown",
2644  _("jack has bumped us out!! "));
2645  }
2646  // run as long jackd is down
2647  return true;
2648 }
2649 
2650 void MainWindow::gx_jack_is_down() {
2651  actions.jackserverconnection->set_active(false);
2652  Glib::signal_timeout().connect(
2653  sigc::mem_fun(*this, &MainWindow::survive_jack_shutdown),
2654  200, Glib::PRIORITY_LOW);
2655 }
2656 
2657 #ifdef HAVE_JACK_SESSION
2658 void MainWindow::jack_session_event() {
2659  gx_jack::GxJack *jack = machine.get_jack();
2660  if (!jack) {
2661  return;
2662  }
2663  const char *statefile = "gx_head.state";
2664  jack_session_event_t *event = jack->get_last_session_event();
2665  set_in_session();
2666  machine.set_statefilename(string(event->session_dir) + statefile);
2667  machine.save_to_state();
2668 
2669 #ifndef NDEBUG
2670  string cmd(options.get_path_to_program());
2671 #else
2672  string cmd("guitarix");
2673 #endif
2674  cmd += " -U ";
2675  cmd += event->client_uuid;
2676  cmd += " -A ";
2677  cmd += jack->get_uuid_insert();
2678  cmd += " -f ${SESSION_DIR}";
2679  cmd += statefile; // no space after SESSION_DIR
2680  event->command_line = strdup(cmd.c_str());
2681 
2682  JackSessionEventType tp = event->type;
2683  if (jack->return_last_session_event() == 0) {
2684  if (tp == JackSessionSaveAndQuit) {
2685  GxExit::get_instance().exit_program("** session exit **");
2686  }
2687  }
2688 }
2689 
2690 void MainWindow::jack_session_event_ins() {
2691  gx_jack::GxJack *jack = machine.get_jack();
2692  if (!jack) {
2693  return;
2694  }
2695  jack_session_event_t *event = jack->get_last_session_event_ins();
2696  set_in_session();
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) {
2701  GxExit::get_instance().exit_program("** session exit **");
2702  }
2703  }
2704 }
2705 #endif
2706 
2707 void MainWindow::set_in_session() {
2708  if (!in_session) {
2709  in_session = true;
2710  // it seems in a session we generally don't know
2711  // where to save and from where to recall data
2712  // it's all controlled by the session manager
2713  machine.disable_autosave(true);
2714  }
2715 }
2716 
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());
2720 }
2721 
2722 void MainWindow::overload_status_changed(gx_engine::MidiAudioBuffer::Load l) {
2723  switch (l) {
2725  status_icon->set(gx_head_midi);
2726  break;
2729  status_icon->set(gx_head_icon);
2730  break;
2732  status_icon->set(gx_head_warn);
2733  break;
2734  default:
2735  assert(false);
2736  }
2737 }
2738 
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)) {
2741  window->get_window()->get_root_origin(options.mainwin_x, options.mainwin_y);
2742  }
2743  return false;
2744 }
2745 
2746 void MainWindow::hide_extended_settings() {
2747  if (!is_visible ||
2748  (window->get_window()->get_state()
2749  & (Gdk::WINDOW_STATE_ICONIFIED|Gdk::WINDOW_STATE_WITHDRAWN))) {
2750  window->move(options.mainwin_x, options.mainwin_y);
2751  //window->present();
2752  window->deiconify();
2753  } else {
2754  //window->hide();
2755  window->iconify();
2756  }
2757 }
2758 
2759 //bool MainWindow::ui_sleep() {
2760 // usleep(1900);
2761  //cout<<"timeout"<<endl;
2762 // return true;
2763 //}
2764 
2765 void MainWindow::run() {
2766  int port = options.get_rpcport();
2767  if (machine.get_jack() && port != RPCPORT_DEFAULT && port != RPCPORT_NONE) {
2768  machine.start_socket(sigc::ptr_fun(Gtk::Main::quit), options.get_rpcaddress(), port);
2769  window->show();
2770  if (options.get_liveplaygui()) liveplay_button->set_active();
2771  Gtk::Main::run();
2772  } else {
2773  window->show();
2774  if (options.get_liveplaygui()) liveplay_button->set_active();
2775  // Glib::signal_timeout().connect (mem_fun (*this, &MainWindow::ui_sleep), 2);
2776  Gtk::Main::run();
2777  }
2778 }
2779 
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();
2784  }
2785  return true;
2786  }
2787  return false;
2788 }
2789 
2790 void MainWindow::display_preset_msg(const Glib::ustring& bank, const Glib::ustring& preset) {
2791  preset_status->set_text(bank + " / " + preset);
2792 }
2793 
2794 bool MainWindow::on_key_press_event(GdkEventKey *event) {
2795  if ((event->state & Gtk::AccelGroup::get_default_mod_mask()) != 0) {
2796  return false;
2797  }
2798  if (event->keyval >= GDK_KEY_0 && event->keyval <= GDK_KEY_9) {
2799  keyswitch.process_preset_key(event->keyval - GDK_KEY_0);
2800  return true;
2801  }
2802  if (event->keyval >= GDK_KEY_KP_0 && event->keyval <= GDK_KEY_KP_9) {
2803  keyswitch.process_preset_key(event->keyval - GDK_KEY_KP_0);
2804  return true;
2805  }
2806  if (event->keyval >= GDK_KEY_a && event->keyval <= GDK_KEY_z) {
2807  keyswitch.process_bank_key(event->keyval - GDK_KEY_a);
2808  return true;
2809  }
2810  return false;
2811 }
2812 
2813 bool MainWindow::on_quit() {
2814  if (options.get_hideonquit()) {
2815  machine.save_to_state();
2816  //hide_extended_settings();
2817  usleep(100000);
2818  hide_extended_settings();
2819  return true;
2820  }
2821  if (ladspalist_window && !ladspalist_window->check_exit()) {
2822  return true;
2823  }
2824  machine.stop_socket();
2825  Gtk::Main::quit();
2826  return false;
2827 }
2828 
2829 void MainWindow::amp_controls_visible(Gtk::Range *rr) {
2830  //FIXME
2831  bool v = std::abs(rr->get_value() - machine.get_parameter("tube.select").getUpperAsFloat()) < 0.5;
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) {
2835  Gtk::Widget *w;
2836  bld->find_widget(knobs1[i], w);
2837  w->set_visible(!v);
2838  }
2839  for (unsigned int i = 0; i < sizeof(knobs2)/sizeof(knobs2[1]); ++i) {
2840  Gtk::Widget *w;
2841  bld->find_widget(knobs2[i], w);
2842  w->set_visible(v);
2843  }
2844 }
2845 
2847  Gtk::Window *splash, const Glib::ustring& title)
2848  : sigc::trackable(),
2849  options(options_),
2850  machine(machine_),
2851  bld(),
2852  freezer(),
2853  plugin_dict(),
2854  oldpos(0),
2855  scrl_size_x(-1),
2856  scrl_size_y(-1),
2857  monorackcontainer(PLUGIN_TYPE_MONO, *this),
2858  stereorackcontainer(PLUGIN_TYPE_STEREO, *this),
2859  pre_act(false),
2860  is_visible(false),
2861  drag_icon(0),
2862  preset_list_menu_bank(),
2863  preset_list_merge_id(0),
2864  preset_list_actiongroup(),
2865  uimanager(),
2866  live_play(),
2867  preset_window(),
2868  fWaveView(),
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),
2873  portmap_window(0),
2874  select_jack_control(0),
2875  select_midi_channel(0),
2876  fLoggingWindow(),
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"))),
2888  in_session(false),
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"))),
2892  actions(),
2893  keyswitch(machine, sigc::mem_fun(this, &MainWindow::display_preset_msg)),
2894  groupmap(),
2895  ladspalist_window(),
2896  szg_rack_units(Gtk::SizeGroup::create(Gtk::SIZE_GROUP_HORIZONTAL)) {
2897 
2898  convolver_filename_label.set_ellipsize(Pango::ELLIPSIZE_END);
2899  convolver_mono_filename_label.set_ellipsize(Pango::ELLIPSIZE_END);
2900 
2901  /*
2902  ** create actions and some parameters
2903  */
2904  create_actions();
2905 
2906  /*
2907  ** load key accelerator table and glade window definition
2908  **
2909  ** at this point all parameters that are used in the main window glade file must be defined
2910  */
2911  Gtk::AccelMap::load(options.get_builder_filepath("accels_rc"));
2912 
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); // setting it in glade is awkward to use with glade tool
2918  szg_rack_units->add_widget(*ampdetail_mini);
2919  szg_rack_units->add_widget(*ampdetail_normal);
2920 
2921  // remove marker labels from boxes (used in glade to make display clearer)
2922  clear_box(*monocontainer);
2923  clear_box(*stereorackcontainerH);
2924  clear_box(*stereorackcontainerV);
2925  clear_box(*preset_box_no_rack);
2926 
2927  // create left column for equal width
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()));
2932  Gtk::Button *pb;
2933  bld->find_widget("presets:barbutton", pb);
2934  gtk_size_group_add_widget(left_column, GTK_WIDGET(pb->gobj()));
2935 
2936  // preset window also creates some actions
2937  preset_window = new PresetWindow(bld, machine, options, actions, left_column);
2938 
2939  // create uimanager and load menu
2940  uimanager = Gtk::UIManager::create();
2941  uimanager->insert_action_group(actions.group);
2942  uimanager->add_ui_from_file(options.get_builder_filepath("menudef.xml"));
2943 
2944  // add dynamic submenus
2945  if (!options.get_clear_rc()) {
2946  add_skin_menu();
2947  }
2948  add_latency_menu();
2949  add_osc_size_menu();
2950  amp_radio_menu.setup("<menubar><menu action=\"TubeMenu\">","</menu></menubar>",uimanager,actions.group);
2951 
2952  // add menubar, accelgroup and icon to main window
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);
2958  boxbuilder.set_accelgroup(actions.accels);
2959 
2960  /*
2961  ** connect main window signals
2962  */
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));
2973 
2974  /*
2975  ** status icon signal connections
2976  */
2977  if (!options.get_hideonquit()) {
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));
2982  }
2983 
2984  // add rack container
2985  stereorackcontainerV->pack_start(stereorackcontainer, Gtk::PACK_EXPAND_WIDGET);
2986  monocontainer->pack_start(monorackcontainer, Gtk::PACK_EXPAND_WIDGET);
2987 
2988  /*
2989  ** jack, engine, and controller_map signal connections and related settings
2990  */
2992  gx_jack::GxJack *jack = machine.get_jack();
2993  if (jack) {
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));
3002  if (!options.get_jack_uuid().empty()) {
3003  set_in_session();
3004  }
3005 #endif
3006  }
3007 
3008  machine.signal_state_change().connect(
3009  sigc::mem_fun(*this, &MainWindow::on_engine_state_change));
3010  machine.signal_jack_load_change().connect(
3011  sigc::mem_fun(*this, &MainWindow::overload_status_changed));
3012  machine.signal_plugin_changed().connect(
3013  sigc::mem_fun(this, &MainWindow::on_plugin_changed));
3014  /*
3015  ** GxSettings signal connections
3016  */
3017  machine.signal_presetlist_changed().connect(
3018  sigc::mem_fun(*this, &MainWindow::rebuild_preset_menu));
3019  machine.signal_selection_changed().connect(
3020  sigc::mem_fun(*this, &MainWindow::show_selected_preset));
3021  machine.signal_selection_changed().connect(
3022  sigc::mem_fun(monorackcontainer, &RackContainer::check_order));
3023  machine.signal_selection_changed().connect(
3024  sigc::mem_fun(stereorackcontainer, &RackContainer::check_order));
3025 
3026  /*
3027  ** DnD setup for effects toolpalette
3028  */
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));
3034 
3035  /*
3036  ** init jack connection image widget
3037  */
3038  if (jack) {
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));
3045  //jackd_image->get_parent()->signal_button_press_event().connect(
3046  // sigc::bind_return(
3047  // sigc::group(
3048  // sigc::ptr_fun(toggle_action),
3049  // actions.jackserverconnection),
3050  // true));
3051  } else {
3052  jackd_image->hide();
3053  }
3054 
3055  /*
3056  ** setup racktuner parameter and signals
3057  */
3058  setup_tuner(*racktuner);
3059  tuner_on_off->set_name("effect_on_off");
3060  tuner_on_off->signal_toggled().connect(
3061  sigc::compose(
3062  sigc::mem_fun(*racktuner, &Gxw::RackTuner::set_sensitive),
3063  sigc::mem_fun(*tuner_on_off, &Gxw::Switch::get_active)));
3064  racktuner->signal_poll_status_changed().connect(
3065  sigc::mem_fun(machine, &gx_engine::GxMachineBase::tuner_used_for_display));
3066 
3067  /*
3068  ** oscilloscope signal connections
3069  */
3070  machine.signal_oscilloscope_post_pre().connect(
3071  sigc::mem_fun(*this, &MainWindow::on_oscilloscope_post_pre));
3072  machine.signal_oscilloscope_visible().connect(
3073  sigc::mem_fun(*this, &MainWindow::on_show_oscilloscope));
3074  machine.signal_oscilloscope_activation().connect(
3075  sigc::mem_fun(*this, &MainWindow::on_oscilloscope_activate));
3076  machine.signal_oscilloscope_size_change().connect(
3077  sigc::mem_fun(*this, &MainWindow::set_waveview_buffer));
3078 
3079  /*
3080  ** fastmeter initialization and signal connections
3081  */
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"));
3086  }
3087  const float meter_falloff = 27; // in dB/sec.
3088  const float meter_display_timeout = 60; // in millisec
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);
3093 
3094  /*
3095  ** amp top box signal connections
3096  */
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));
3101  machine.signal_parameter_value<bool>("ui.mp_s_h").connect(
3102  sigc::bind(sigc::mem_fun(*this, &MainWindow::on_ampdetail_switch), false));
3103 
3104  /*
3105  ** midi out signal connections
3106  */
3107  midi_out_compress->signal_clicked().connect(
3108  sigc::bind(
3109  sigc::mem_fun(actions.midi_out_plug.operator->(), &Gtk::ToggleAction::set_active),
3110  true));
3111  midi_out_expand->signal_clicked().connect(
3112  sigc::bind(
3113  sigc::mem_fun(actions.midi_out_plug.operator->(), &Gtk::ToggleAction::set_active),
3114  false));
3115  midi_out_presets_mini->signal_clicked().connect(
3116  sigc::bind(
3117  sigc::mem_fun1(this, &MainWindow::plugin_preset_popup),
3118  machine.pluginlist_lookup_plugin("midi_out")->get_pdef()));
3119  midi_out_presets_normal->signal_clicked().connect(
3120  sigc::bind(
3121  sigc::mem_fun1(this, &MainWindow::plugin_preset_popup),
3122  machine.pluginlist_lookup_plugin("midi_out")->get_pdef()));
3123  channel1_button->signal_toggled().connect(
3124  sigc::bind(
3125  sigc::mem_fun(this, &MainWindow::on_midi_out_channel_toggled),
3126  channel1_button, channel1_box));
3127  channel2_button->signal_toggled().connect(
3128  sigc::bind(
3129  sigc::mem_fun(this, &MainWindow::on_midi_out_channel_toggled),
3130  channel2_button, channel2_box));
3131  channel3_button->signal_toggled().connect(
3132  sigc::bind(
3133  sigc::mem_fun(this, &MainWindow::on_midi_out_channel_toggled),
3134  channel3_button, channel3_box));
3135 
3136  /*
3137  ** init status image widget
3138  */
3139  status_image->set(pixbuf_on);
3140  status_image->get_parent()->add_events(Gdk::SCROLL_MASK);
3141  gx_gui::connect_midi_controller(status_image->get_parent(), "engine.mute", machine);
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());
3147 
3148  /*
3149  ** init insert image widget
3150  */
3151  insert_image->set(pixbuf_insert_on);
3152  insert_image->get_parent()->add_events(Gdk::SCROLL_MASK);
3153  gx_gui::connect_midi_controller(insert_image->get_parent(), "engine.insert", machine);
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));
3158  gx_engine::BoolParameter& ip = machine.get_parameter("engine.insert").getBool();
3159  ip.signal_changed().connect(sigc::mem_fun(*this, &MainWindow::on_insert_jack_changed));
3160 
3161  /*
3162  ** connect buttons with actions
3163  */
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()));
3173 
3174  /*
3175  ** setup window initial configuration
3176  */
3177  tunerbox->set_visible(machine.get_parameter_value<bool>("system.show_tuner"));
3178  racktuner->set_sensitive(machine.get_parameter_value<bool>("ui.racktuner"));
3179  actions.show_plugin_bar->set_active(false);
3180 
3181  /*
3182  ** create liveplay and setup liveplay racktuner
3183  */
3184  live_play = new Liveplay(options, machine, options.get_builder_filepath("mainpanel.glade"), actions);
3185  setup_tuner(live_play->get_tuner());
3186  live_play->get_tuner().signal_poll_status_changed().connect(
3187  sigc::mem_fun1(machine, &gx_engine::GxMachineBase::tuner_used_for_display));
3188 
3189  /*
3190  ** init logging window and logstate image widget
3191  */
3192  fLoggingWindow.set_transient_for(*window);
3193  fLoggingWindow.set_icon(gx_head_icon);
3194  fLoggingWindow.signal_msg_level_changed().connect(
3195  sigc::mem_fun(*this, &MainWindow::on_msg_level_changed));
3196  fLoggingWindow.signal_hide().connect(
3197  sigc::bind(
3198  sigc::mem_fun(actions.loggingbox.operator->(), &Gtk::ToggleAction::set_active),
3199  false));
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));
3206 
3207  //logstate_image->get_parent()->signal_button_press_event().connect(
3208  //sigc::bind_return(
3209  // sigc::group(
3210  // sigc::ptr_fun(toggle_action),
3211  // actions.loggingbox),
3212  // true));
3213 
3214  /*
3215  ** load plugin definitions into plugin_dict, add to effects_toolpalette
3216  **
3217  ** icons will be added after state loading when we know the skin
3218  ** UI definitions will be loaded on demand
3219  */
3220  fill_pluginlist();
3221  PluginUI *mainamp_plugin = new PluginUI(*this, "ampstack");
3222  plugin_dict.add(mainamp_plugin);
3223  mainamp_plugin->rackbox = add_rackbox_internal(*mainamp_plugin, 0, 0, false, -1, false, amp_background);
3224  //effects_toolpalette->set_name("effects_toolpalette");
3225  effects_toolpalette->show();
3226  if (!options.get_clear_rc()) {
3227  //g_object_set (gtk_settings_get_default (),"gtk-theme-name",NULL, NULL);
3228  set_new_skin(options.skin_name);
3229  } else {
3230  gtk_rc_parse(
3231  (options.get_style_filepath("clear.rc")).c_str());
3232  make_icons();
3233  }
3234 
3235  // call some action functions to sync state
3236  // with settings defined in create_actions()
3237  actions.rackh->set_active(options.system_order_rack_h);
3238  actions.presets->set_active(options.system_show_presets);
3239  actions.show_plugin_bar->set_active(options.system_show_toolbar);
3240  actions.show_rack->set_active(options.system_show_rack);
3241  actions.show_values->set_active(options.system_show_value);
3242  actions.tooltips->set_active(options.system_show_tooltips);
3243  actions.animations->set_active(options.system_animations);
3244 
3245  if (!title.empty()) {
3246  window->set_title(title);
3247  }
3248 
3249  /*
3250  ** Jack client connection and subsequent initalizations
3251  */
3252 
3253  // state must be loaded before starting jack because connect_jack() uses
3254  // some settings. If the jack client name changes (from the predefined value)
3255  // on connect the jack client-change signal will trigger the load of another
3256  // state file, which means that the jack starter options are read from the
3257  // standard state file (gx_head_rc or similar if -n is used)
3258  machine.loadstate();
3259  if (!in_session) {
3260  machine.disable_autosave(options.get_opt_save_on_exit());
3261  }
3262  if (!connect_jack(true, splash)) {
3263  // not connected, must synthesize signal for initialization
3264  if (jack) {
3265  jack->signal_client_change()();
3266  }
3267  }
3268  set_latency(); // make sure latency menu is updated
3269  set_osc_size();
3270 
3271  if (options.mainwin_height > 0) { // initially use the default set in mainpanel.glade
3272  window->set_default_size(-1, min(options.window_height, options.mainwin_height));
3273  }
3274 
3275  // set window position (make this optional??)
3276  if (options.mainwin_x > 0) {
3277  window->move(options.mainwin_x, options.mainwin_y);
3278  }
3279 
3280  Gtk::Range *rr;
3281  bld->find_widget("gxselector1:amp_selector", rr);
3282  rr->signal_value_changed().connect(
3283  sigc::bind(
3284  sigc::mem_fun(this, &MainWindow::amp_controls_visible),
3285  rr));
3286  amp_controls_visible(rr);
3287 
3288  // set insert_image state
3289  if (machine.get_parameter_value<bool>("engine.insert")) {
3290  insert_image->set(pixbuf_insert_off);
3291  machine.set_jack_insert(true);
3292  } else {
3293  insert_image->set(pixbuf_insert_on);
3294  machine.set_jack_insert(false);
3295  }
3296  bool c = machine.get_parameter_value<bool>("ui.all_s_h");
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();
3301 
3302  }
3303 
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_*");
3311  Gtk::AccelMap::save(options.get_user_filepath("accels_rc"));
3312 #endif
3313 
3314  int mainwin_width;
3315  window->get_size(mainwin_width, options.mainwin_height);
3316  Glib::RefPtr<Gdk::Window> win = window->get_window();
3317  if (win) {
3318  win->get_root_origin(options.mainwin_x, options.mainwin_y);
3319  }
3320  if (actions.presets->get_active()) {
3321  options.preset_window_height = preset_scrolledbox->get_allocation().get_height();
3322  }
3323  plugin_dict.cleanup();
3324  delete live_play;
3325  delete preset_window;
3326  delete window;
3327  window = 0;
3328  //if (ladspalist_window) {
3329  //delete ladspalist_window;
3330  //ladspalist_window = 0;
3331  //}
3332 }
gx_engine::PluginChange::update
Definition: gx_engine.h:64
Liveplay
Definition: gx_main_window.h:77
GxExit::get_instance
static GxExit & get_instance()
Definition: gx_logging.cpp:203
gx_gui::UiBuilderImpl
Definition: gx_ui_builder.h:199
gx_engine::GxMachineBase::load_unit
virtual bool load_unit(gx_gui::UiBuilderImpl &builder, PluginDef *pdef)=0
gx_engine::GxMachineBase::set_statefilename
virtual void set_statefilename(const std::string &fn)=0
SelectMidiChannel::~SelectMidiChannel
~SelectMidiChannel()
Definition: gx_main_window.cpp:189
gx_system::BasicOptions::get_user_filepath
std::string get_user_filepath(const std::string &basename) const
Definition: gx_system.h:367
MainWindow::add_icon
void add_icon(const std::string &name)
Definition: gx_main_window.cpp:1004
gx_engine::GxMachineBase::signal_oscilloscope_post_pre
virtual sigc::signal< void, int > & signal_oscilloscope_post_pre()=0
RackBox::swtch
void swtch(bool mini)
Definition: rack.cpp:1133
gx_system::CmdlineOptions::get_hideonquit
bool get_hideonquit() const
Definition: gx_system.h:484
MainWindow::plugin_preset_popup
void plugin_preset_popup(const PluginDef *pdef)
Definition: gx_main_window.cpp:1830
gx_gui::SelectJackControlPgm::signal_close
sigc::signal< void > & signal_close()
Definition: gx_jack_options.h:58
PluginUI::tooltip
Glib::ustring tooltip
Definition: gx_main_window.h:156
GxActions::quit
Glib::RefPtr< Gtk::Action > quit
Definition: gx_main_window.h:505
MainWindow::left_column
GtkSizeGroup * left_column
Definition: gx_main_window.h:812
gx_jack::GxJack::client
jack_client_t * client
Definition: gx_jack.h:169
JConvPluginUI
Definition: gx_main_window.cpp:1901
gx_engine::MidiAudioBuffer::load_off
Definition: gx_internal_plugins.h:176
gx_engine::MidiAudioBuffer::load_high
Definition: gx_internal_plugins.h:176
gx_engine::GxMachineBase::get_parameter_value
T get_parameter_value(const std::string &id)
gx_print_info
void gx_print_info(const char *, const std::string &)
Definition: gx_logging.cpp:182
gx_engine::Parameter::getUpperAsFloat
virtual float getUpperAsFloat() const
Definition: gx_paramtable.cpp:994
Gxw::FastMeter::set
void set(double lvl)
Definition: fastmeter.cc:132
gx_jack::GxJack::is_jack_down
bool is_jack_down()
Definition: gx_jack.h:206
gx_engine::GxMachineBase
Definition: machine.h:53
gx_engine::PluginChange::pc
pc
Definition: gx_engine.h:64
gx_system::CmdlineOptions::get_idle_thread_timeout
int get_idle_thread_timeout() const
Definition: gx_system.h:505
gx_engine::PluginChange::remove
Definition: gx_engine.h:64
gx_engine::GxMachineBase::get_current_name
virtual const Glib::ustring & get_current_name()=0
JConvPluginUI::JConvPluginUI
JConvPluginUI(MainWindow &main, const char *id, const Glib::ustring &tooltip="")
Definition: gx_main_window.cpp:1905
Gxw::RackTuner::signal_poll_status_changed
Glib::SignalProxy1< void, bool > signal_poll_status_changed()
Definition: racktuner.cc:357
gx_gui::StackBoxBuilder::get_box
void get_box(const std::string &name, Gtk::Widget *&mainbox, Gtk::Widget *&minibox)
Definition: gx_stackbox_builder.cpp:137
PluginUI::get_action
Glib::RefPtr< Gtk::ToggleAction > get_action()
Definition: gx_main_window.h:183
GxActions::skin
Glib::RefPtr< Gtk::RadioAction > skin
Definition: gx_main_window.h:539
GxActions::rack_config
Glib::RefPtr< Gtk::ToggleAction > rack_config
Definition: gx_main_window.h:513
TubeKeys
Definition: gx_main_window.cpp:289
value_pair
Definition: gx_plugin.h:117
PluginUI::set_ui_merge_id
void set_ui_merge_id(Gtk::UIManager::ui_merge_id id)
Definition: gx_main_window.h:179
kKeepLatency
Definition: gx_main_window.cpp:1218
gx_engine::Parameter::getString
StringParameter & getString()
Definition: gx_parameter.h:479
gx_system::CmdlineOptions::system_show_toolbar
bool system_show_toolbar
Definition: gx_system.h:450
gx_engine::GxMachineBase::clear_oscilloscope_buffer
virtual void clear_oscilloscope_buffer()=0
gx_engine::MidiAudioBuffer::load_over
Definition: gx_internal_plugins.h:176
gx_jack::GxJack::rt_watchdog_set_limit
static void rt_watchdog_set_limit(int limit)
Definition: gx_jack.cpp:144
MainWindow::stop_at_stereo_bottom
double stop_at_stereo_bottom(double off, double step_size, double pagesize)
Definition: gx_main_window.cpp:919
Freezer::check_thaw
bool check_thaw(int width, int height)
Definition: gx_main_window.cpp:451
GxActions::group
Glib::RefPtr< Gtk::ActionGroup > group
Definition: gx_main_window.h:502
gx_gui::gx_message_popup
int gx_message_popup(const char *)
Definition: gx_gui_helpers.cpp:126
gx_engine::GxMachineBase::signal_plugin_changed
virtual sigc::signal< void, Plugin *, PluginChange::pc > & signal_plugin_changed()=0
Freezer::freeze_until_width_update
void freeze_until_width_update(Gtk::Window *w, int width)
Definition: gx_main_window.cpp:396
RackContainer
Definition: gx_main_window.h:343
GxActions::midi_out
Glib::RefPtr< UiBoolToggleAction > midi_out
Definition: gx_main_window.h:532
PresetWindow
Definition: gx_preset_window.h:70
gx_engine::ParameterV< GxJConvSettings >
Definition: gx_internal_plugins.h:344
gx_engine::GxMachineBase::signal_jack_load_change
sigc::signal< void, MidiAudioBuffer::Load > & signal_jack_load_change()
Definition: machine.h:95
TubeKeys::TubeKeys
TubeKeys()
Definition: gx_main_window.cpp:297
Gxw::RackTuner::clear_notes
void clear_notes()
Definition: racktuner.cc:340
Liveplay::display_tuner
void display_tuner(bool v)
Definition: liveplay.cpp:470
gx_engine::Parameter::getValueNames
virtual const value_pair * getValueNames() const
Definition: gx_paramtable.cpp:998
MainWindow::stop_at_mono_top
double stop_at_mono_top(double off, double step_size)
Definition: gx_main_window.cpp:928
PluginUI::display
void display(bool v, bool animate)
Definition: rack.cpp:136
Liveplay::get_tuner
Gxw::RackTuner & get_tuner()
Definition: gx_main_window.h:140
gx_engine::MidiAudioBuffer::Load
Load
Definition: gx_internal_plugins.h:176
GDK_KEY_z
#define GDK_KEY_z
Definition: guitarix.h:63
gx_engine::GxMachineBase::signal_parameter_value
sigc::signal< void, T > & signal_parameter_value(const std::string &id)
ladspa::PluginDisplay::check_exit
bool check_exit()
Definition: ladspalist.cpp:516
MainWindow::resize_finished
void resize_finished(RackContainer *ch)
Definition: gx_main_window.cpp:959
MainWindow::get_plugin
PluginUI * get_plugin(const std::string &name)
Definition: gx_main_window.h:820
gx_engine::Parameter::getEnum
EnumParameter & getEnum()
Definition: gx_parameter.h:463
gx_system::CmdlineOptions::system_show_rack
bool system_show_rack
Definition: gx_system.h:451
GxLogger::signal_message
msg_signal & signal_message()
Definition: gx_logging.cpp:76
gx_engine::ParameterV< GxJConvSettings >::get_value
const GxJConvSettings & get_value() const
Definition: gx_internal_plugins.h:362
gx_engine::GxMachineBase::get_state
virtual GxEngineState get_state()=0
GxActions::jack_latency_menu
Glib::RefPtr< Gtk::Action > jack_latency_menu
Definition: gx_main_window.h:508
ladspa::PluginDisplay
Definition: ladspalist.h:84
gx_engine::ParameterV< bool >
Definition: gx_parameter.h:349
UiToggleAction
Definition: gx_main_window.h:26
UiToggleAction::UiToggleAction
UiToggleAction(gx_engine::GxMachineBase &machine_, const std::string &id, const Glib::ustring &name, const Glib::ustring &icon_name, const Glib::ustring &label=Glib::ustring(), const Glib::ustring &tooltip=Glib::ustring(), bool is_active=false)
Definition: gx_main_window.cpp:483
GxActions::livetuner
Glib::RefPtr< UiBoolToggleAction > livetuner
Definition: gx_main_window.h:531
gx_engine::GxMachineBase::disable_autosave
virtual void disable_autosave(bool v)=0
gx_print_warning
void gx_print_warning(const char *, const std::string &)
Definition: gx_logging.cpp:160
GxActions::jackserverconnection
Glib::RefPtr< Gtk::ToggleAction > jackserverconnection
Definition: gx_main_window.h:519
gx_engine::GxMachineBase::pluginlist_lookup_plugin
virtual Plugin * pluginlist_lookup_plugin(const std::string &id) const =0
GxActions::engine_mute_conn
sigc::connection engine_mute_conn
Definition: gx_main_window.h:516
gx_engine::GxMachineBase::loadstate
virtual void loadstate()=0
gx_system::CmdlineOptions::get_rpcport
int get_rpcport() const
Definition: gx_system.h:489
gx_engine::GxEngineState
GxEngineState
Definition: gx_modulesequencer.h:283
GxActions::jackports
Glib::RefPtr< Gtk::ToggleAction > jackports
Definition: gx_main_window.h:520
RPCPORT_DEFAULT
#define RPCPORT_DEFAULT
Definition: gx_system.h:346
gx_engine::GxMachineBase::oscilloscope_plugin_box_visible
virtual bool oscilloscope_plugin_box_visible()=0
gx_engine::GxMachineBase::set_parameter_value
virtual void set_parameter_value(const std::string &id, int value)=0
PluginUI
Definition: gx_main_window.h:149
SelectMidiChannel::signal_close
sigc::signal< void > & signal_close()
Definition: gx_main_window.h:569
min
#define min(x, y)
Definition: gx_faust_support.h:6
gx_system::PresetFile::iterator
std::vector< Position >::iterator iterator
Definition: gx_json.h:319
GxActions::meterbridge
Glib::RefPtr< Gtk::ToggleAction > meterbridge
Definition: gx_main_window.h:522
GxActions::accels
Glib::RefPtr< Gtk::AccelGroup > accels
Definition: gx_main_window.h:503
TextLoggingBox::TextLoggingBox
TextLoggingBox()
Definition: gx_main_window.cpp:40
RackContainer::check_order
void check_order()
Definition: rack.cpp:1624
TubeKeys::operator()
int operator()()
Definition: gx_main_window.cpp:306
gx_engine::GxMachineBase::previus_preset_switch
virtual void previus_preset_switch()=0
PluginDef
Definition: gx_plugin.h:183
GxActions::loadladspa
Glib::RefPtr< Gtk::Action > loadladspa
Definition: gx_main_window.h:511
Gxw::RackTuner::set_freq
void set_freq(double p1)
Definition: racktuner.cc:265
Gxw::RackTuner::push_note
void push_note(int p1, int p2, int p3)
Definition: racktuner.cc:345
gx_engine::GxMachineBase::get_current_bank_file
virtual gx_system::PresetFileGui * get_current_bank_file()=0
PluginDesc
Definition: gx_main_window.cpp:2027
gx_system::CmdlineOptions::mainwin_x
int mainwin_x
Definition: gx_system.h:437
RackContainer::show_entries
void show_entries()
Definition: rack.cpp:1557
gx_engine::GxMachineBase::get_tuner_freq
virtual float get_tuner_freq()=0
GxJackLatencyChange
GxJackLatencyChange
Definition: gx_main_window.cpp:1216
Gxw::RackTuner::set_display_flat
void set_display_flat(bool p1)
Definition: racktuner.cc:300
max
#define max(x, y)
Definition: gx_faust_support.h:5
Gxw::RackTuner::signal_frequency_poll
Glib::SignalProxy0< void > signal_frequency_poll()
Definition: racktuner.cc:351
gx_system::CmdlineOptions::get_path_to_program
const std::string & get_path_to_program() const
Definition: gx_system.h:458
gx_engine::ParameterV< int >::idx_from_id
virtual int idx_from_id(string v_id)
GxActions::midicontroller
Glib::RefPtr< Gtk::ToggleAction > midicontroller
Definition: gx_main_window.h:521
gx_system::to_string
std::string to_string(const T &t)
Definition: gx_system.h:524
GDK_KEY_KP_0
#define GDK_KEY_KP_0
Definition: guitarix.h:54
SYSTEM_OK
#define SYSTEM_OK
Definition: gx_system.h:81
PluginUI::is_registered
static bool is_registered(gx_engine::GxMachineBase &m, const char *name)
Definition: rack.cpp:85
gx_system::CmdlineOptions::system_order_rack_h
bool system_order_rack_h
Definition: gx_system.h:445
Gxw::RackTuner
Definition: racktuner.h:42
jsonrpc.h
MainWindow::get_machine
gx_engine::GxMachineBase & get_machine()
Definition: gx_main_window.h:827
gx_engine::MidiAudioBuffer::load_low
Definition: gx_internal_plugins.h:176
PluginUI::icon
Glib::RefPtr< Gdk::Pixbuf > icon
Definition: gx_main_window.h:160
GxLogger::unplug_queue
void unplug_queue()
Definition: gx_logging.cpp:81
Gxw::Tuner::set_reference_pitch
void set_reference_pitch(double p1)
Definition: tuner.cc:137
gx_engine::kEngineOff
Definition: gx_modulesequencer.h:285
GxUiRadioMenu::GxUiRadioMenu
GxUiRadioMenu(gx_engine::GxMachineBase &machine, const std::string &id)
Definition: gx_main_window.cpp:313
gx_show_about
void gx_show_about()
Definition: gx_main_window.cpp:1373
GxActions::rackh
Glib::RefPtr< Gtk::ToggleAction > rackh
Definition: gx_main_window.h:537
GDK_KEY_KP_9
#define GDK_KEY_KP_9
Definition: guitarix.h:56
GDK_KEY_0
#define GDK_KEY_0
Definition: guitarix.h:46
MainWindow::hide_effect
void hide_effect(const std::string &name)
Definition: gx_main_window.cpp:1112
gx_engine::GxMachineBase::signal_oscilloscope_visible
virtual sigc::signal< void, bool > & signal_oscilloscope_visible()=0
Freezer::set_slot
void set_slot(sigc::slot< void > w)
Definition: gx_main_window.cpp:388
gx_child_process::Meterbridge::start_stop
static void start_stop(Glib::RefPtr< Gtk::ToggleAction > &action, gx_jack::GxJack &jack)
Definition: gx_child_process.cpp:378
GxActions::tuner
Glib::RefPtr< UiBoolToggleAction > tuner
Definition: gx_main_window.h:529
gx_system::CmdlineOptions::mainwin_y
int mainwin_y
Definition: gx_system.h:438
GxActions::compress
Glib::RefPtr< Gtk::Action > compress
Definition: gx_main_window.h:506
gx_engine::GxMachineBase::next_preset_switch
virtual void next_preset_switch()=0
gx_jack::GxJack::shutdown
Glib::Dispatcher shutdown
Definition: gx_jack.h:205
TextLoggingBox::signal_msg_level_changed
sigc::signal< void > & signal_msg_level_changed()
Definition: gx_main_window.h:426
gx_gui::gx_start_jack_dialog
bool gx_start_jack_dialog(Glib::RefPtr< Gdk::Pixbuf > gw_ib)
Definition: gx_jack_options.cpp:137
N_
#define N_(String)
Definition: gx_faust_support.h:23
PluginUI::set_action
void set_action(Glib::RefPtr< Gtk::ToggleAction > &act)
Definition: rack.cpp:98
gx_engine::GxMachineBase::msend_midi_cc
virtual void msend_midi_cc(int cc, int pgn, int bgn, int num)=0
gx_jack::GxJack
Definition: gx_jack.h:109
power2db
float power2db(float power)
Definition: gx_main_window.cpp:2581
gx_engine::Parameter::getBool
BoolParameter & getBool()
Definition: gx_parameter.h:469
MainWindow::add_plugin
void add_plugin(std::vector< PluginUI * > &p, const char *id, const Glib::ustring &tooltip_="")
Definition: gx_main_window.cpp:1988
PluginDesc::PluginDesc
PluginDesc(const Glib::ustring &g, std::vector< PluginUI * > *p)
Definition: gx_main_window.cpp:2030
gx_engine::GxMachineBase::remove_rack_unit
virtual void remove_rack_unit(const std::string &unit, PluginType type)=0
RackBox::pack
void pack(Gtk::Widget *mainbox, Gtk::Widget *minibox, const Glib::RefPtr< Gtk::SizeGroup > &szg)
Definition: rack.cpp:1214
plugins_by_name_less
bool plugins_by_name_less(PluginUI *a, PluginUI *b)
Definition: rack.cpp:186
GxActions::tunermove
Glib::RefPtr< UiBoolToggleAction > tunermove
Definition: gx_main_window.h:530
GxExit::exit_program
void exit_program(std::string msg="", int errcode=1)
Definition: gx_logging.cpp:194
gx_system::CmdlineOptions::no_warn_latency
bool no_warn_latency
Definition: gx_system.h:444
gx_engine::GxMachineBase::pluginlist_append_rack
virtual void pluginlist_append_rack(UiBuilderBase &ui)=0
TextLoggingBox::~TextLoggingBox
~TextLoggingBox()
Definition: gx_main_window.cpp:96
PluginUI::plugin
gx_engine::Plugin * plugin
Definition: gx_main_window.h:155
GxActions::osc_buffer_menu
Glib::RefPtr< Gtk::Action > osc_buffer_menu
Definition: gx_main_window.h:509
gx_system::CmdlineOptions::get_style_filepath
std::string get_style_filepath(const std::string &basename) const
Definition: gx_system.h:459
RackBox::create_icon_widget
static Gtk::Widget * create_icon_widget(const PluginUI &plugin, gx_system::CmdlineOptions &options)
Definition: rack.cpp:900
RPCPORT_NONE
#define RPCPORT_NONE
Definition: gx_system.h:347
GxActions::latency
Glib::RefPtr< Gtk::RadioAction > latency
Definition: gx_main_window.h:540
gx_jack::GxJack::get_jack_bs
jack_nframes_t get_jack_bs()
Definition: gx_jack.h:177
PluginUI::toolitem
Gtk::ToolItem * toolitem
Definition: gx_main_window.h:162
gx_engine::ParameterV< int >
Definition: gx_parameter.h:293
PluginUI::get_type
PluginType get_type() const
Definition: gx_main_window.h:172
gx_engine::Plugin::set_on_off
void set_on_off(bool v) const
Definition: gx_pluginloader.h:67
Liveplay::on_live_play
void on_live_play(Glib::RefPtr< Gtk::ToggleAction > act)
Definition: liveplay.cpp:425
PluginPresetPopup
Definition: gx_main_window.h:458
KeySwitcher::deactivate
void deactivate()
Definition: liveplay.cpp:29
gx_system::CmdlineOptions::get_rpcaddress
const Glib::ustring & get_rpcaddress()
Definition: gx_system.h:491
GxActions::live_play
Glib::RefPtr< Gtk::ToggleAction > live_play
Definition: gx_main_window.h:514
gx_engine::Plugin::get_pdef
PluginDef * get_pdef()
Definition: gx_pluginloader.h:54
gx_engine::GxMachineBase::signal_oscilloscope_activation
virtual sigc::signal< int, bool > & signal_oscilloscope_activation()=0
gx_engine::ParameterV< int >::getLowerAsFloat
virtual float getLowerAsFloat() const
Definition: gx_paramtable.cpp:1462
PluginUI::unset_ui_merge_id
void unset_ui_merge_id(Glib::RefPtr< Gtk::UIManager > uimanager)
Definition: rack.cpp:74
gx_engine::GxMachineBase::get_parameter
virtual Parameter & get_parameter(const std::string &id)=0
gx_engine::GxMachineBase::get_current_bank
virtual const Glib::ustring & get_current_bank()=0
show_forum_help
void show_forum_help()
Definition: gx_main_window.cpp:1356
gx_engine::GxMachineBase::tuner_used_for_display
virtual void tuner_used_for_display(bool on)=0
gx_system::CmdlineOptions::skin
SkinHandling skin
Definition: gx_system.h:434
gx_engine::EnumParameter::get_pair
const value_pair & get_pair()
Definition: gx_parameter.h:340
DragIcon
Definition: gx_main_window.h:230
gx_portmap::PortMapWindow::create
static PortMapWindow * create(gx_engine::GxMachineBase &machine, Glib::RefPtr< Gtk::AccelGroup > ag)
Definition: gx_portmap.cpp:554
SelectMidiChannel::create
static SelectMidiChannel * create(gx_system::CmdlineOptions &opt, gx_engine::GxMachineBase &machine)
Definition: gx_main_window.cpp:193
GxActions::midi_out_plug
Glib::RefPtr< UiBoolToggleAction > midi_out_plug
Definition: gx_main_window.h:533
GxActions::animations
Glib::RefPtr< Gtk::ToggleAction > animations
Definition: gx_main_window.h:524
gx_system::PresetFileGui
Definition: gx_json.h:369
gx_engine::ParameterV< Glib::ustring >::get_value
const Glib::ustring & get_value() const
Definition: gx_parameter.h:433
PluginUI::main
MainWindow & main
Definition: gx_main_window.h:164
gx_show_help
void gx_show_help()
Definition: gx_main_window.cpp:1368
gx_engine::EnumParameter
Definition: gx_parameter.h:331
gx_engine::PluginChange::add
Definition: gx_engine.h:64
PluginUI::group
Gtk::ToolItemGroup * group
Definition: gx_main_window.h:161
PluginUI::get_id
const char * get_id() const
Definition: gx_main_window.h:175
PluginDict::remove
void remove(PluginUI *p)
Definition: rack.cpp:206
gx_print_error
void gx_print_error(const char *, const std::string &)
Definition: gx_logging.cpp:165
gx_engine::Plugin::get_on_off
bool get_on_off() const
Definition: gx_pluginloader.h:62
gx_engine::Parameter::value_label
static const char * value_label(const value_pair &vp)
Definition: gx_parameter.h:197
gx_system::PresetFileGui::end
iterator end()
Definition: gx_json.h:364
gx_system::CmdlineOptions::get_tuner_tet
const Glib::ustring & get_tuner_tet()
Definition: gx_system.h:487
GxActions::osc_buffer_size
Glib::RefPtr< Gtk::RadioAction > osc_buffer_size
Definition: gx_main_window.h:541
gx_jack::GxJack::set_jack_down
void set_jack_down(bool v)
Definition: gx_jack.h:186
gx_engine::GxMachineBase::set_jack_insert
virtual void set_jack_insert(bool v)=0
gx_engine::kEngineOn
Definition: gx_modulesequencer.h:286
GxActions::jackstartup
Glib::RefPtr< Gtk::Action > jackstartup
Definition: gx_main_window.h:510
RackBox::animate_insert
void animate_insert()
Definition: rack.cpp:1084
gx_engine::kEngineBypass
Definition: gx_modulesequencer.h:287
PluginUI::update_rackbox
void update_rackbox()
Definition: rack.cpp:163
PluginDict::compress
void compress(bool state)
Definition: rack.cpp:223
UiToggleAction::~UiToggleAction
~UiToggleAction()
Definition: gx_main_window.cpp:496
gx_child_process::Meterbridge::stop
static void stop()
Definition: gx_child_process.cpp:374
gx_engine::GxJConvSettings::getIRFile
const std::string & getIRFile() const
Definition: gx_internal_plugins.h:319
gx_system::BasicOptions::get_builder_filepath
std::string get_builder_filepath(const std::string &basename) const
Definition: gx_system.h:369
PluginDef::id
const char * id
Definition: gx_plugin.h:187
value_pair::value_id
const char * value_id
Definition: gx_plugin.h:118
gx_engine::GxMachineBase::midi_get_config_mode
virtual bool midi_get_config_mode(int *ctl=0)=0
gx_system::PresetFileGui::begin
iterator begin()
Definition: gx_json.cpp:1339
KeySwitcher::process_preset_key
bool process_preset_key(int idx)
Definition: liveplay.cpp:70
gx_jack::GxJack::get_instancename
const string & get_instancename()
Definition: gx_jack.h:200
gx_main_midi::MidiConnect
Definition: gx_main_midi.h:73
ladspa::PluginDisplay::present
void present()
Definition: ladspalist.h:199
gx_system::CmdlineOptions::skin_name
Glib::ustring skin_name
Definition: gx_system.h:443
GxLogger::kMessageTypeCount
Definition: gx_logging.h:42
gx_system::CmdlineOptions::system_show_tooltips
bool system_show_tooltips
Definition: gx_system.h:447
MainWindow::add_rackbox
RackBox * add_rackbox(PluginUI &pl, bool mini=false, int pos=-1, bool animate=false)
Definition: gx_main_window.cpp:990
Freezer::Freezer
Freezer()
Definition: gx_main_window.cpp:366
MainWindow::use_animations
bool use_animations()
Definition: gx_main_window.h:832
GxLogger::kWarning
Definition: gx_logging.h:40
GxActions::show_rack
Glib::RefPtr< Gtk::ToggleAction > show_rack
Definition: gx_main_window.h:528
TextLoggingBox::reset_msg_level
void reset_msg_level()
Definition: gx_main_window.cpp:117
gx_engine::GxMachineBase::signal_oscilloscope_size_change
virtual sigc::signal< void, unsigned int > & signal_oscilloscope_size_change()=0
RackContainer::hide_entries
void hide_entries()
Definition: rack.cpp:1569
GDK_KEY_9
#define GDK_KEY_9
Definition: guitarix.h:48
PluginUI::get_category
const char * get_category()
Definition: gx_main_window.h:186
PluginUI::display_new
void display_new(bool unordered=false)
Definition: rack.cpp:152
gx_engine::GxMachineBase::set_init_values
virtual void set_init_values()=0
gx_engine::GxMachineBase::maxlevel_get
virtual void maxlevel_get(int channels, float *values)=0
gx_gui::StackBoxBuilder::fetch
void fetch(Gtk::Widget *&mainbox, Gtk::Widget *&minibox)
Definition: gx_stackbox_builder.cpp:121
GxActions::midi_in_presets
Glib::RefPtr< UiSwitchToggleAction > midi_in_presets
Definition: gx_main_window.h:536
GxActions::engine_mute
Glib::RefPtr< Gtk::ToggleAction > engine_mute
Definition: gx_main_window.h:515
Gxw::WaveView::set_text
void set_text(const Glib::ustring &p1, Gtk::CornerType p2)
Definition: waveview.cc:142
gx_system::CmdlineOptions
Definition: gx_system.h:377
gx_engine::GxMachineBase::setting_is_preset
virtual bool setting_is_preset()=0
gx_system::CmdlineOptions::mul_buffer
int mul_buffer
Definition: gx_system.h:442
gx_engine::GxMachineBase::signal_presetlist_changed
virtual sigc::signal< void > & signal_presetlist_changed()=0
gx_engine::Parameter::id
const string & id() const
Definition: gx_parameter.h:171
gx_system::CmdlineOptions::get_tuner_ref
const Glib::ustring & get_tuner_ref()
Definition: gx_system.h:488
PLUGIN_TYPE_STEREO
Definition: machine.h:36
Freezer::freeze_and_size_request
void freeze_and_size_request(Gtk::Window *w, int width, int height)
Definition: gx_main_window.cpp:405
TextLoggingBox::get_unseen_msg_level
int get_unseen_msg_level()
Definition: gx_main_window.h:425
gx_engine::GxMachineBase::get_oscilloscope_info
virtual void get_oscilloscope_info(int &load, int &frames, bool &is_rt, jack_nframes_t &bsize)=0
PluginUI::rackbox
RackBox * rackbox
Definition: gx_main_window.h:165
gx_engine::GxMachineBase::start_socket
virtual void start_socket(sigc::slot< void > quit_mainloop, const Glib::ustring &host, int port)=0
RackBox
Definition: gx_main_window.h:253
Gxw::WaveView::set_multiplicator
void set_multiplicator(double p1, double p2)
Definition: waveview.cc:132
GxActions::tooltips
Glib::RefPtr< Gtk::ToggleAction > tooltips
Definition: gx_main_window.h:535
gx_gui::StackBoxBuilder::set_accelgroup
void set_accelgroup(Glib::RefPtr< Gtk::AccelGroup > accels_)
Definition: gx_stackbox_builder.h:159
gx_jack::GxJack::gx_jack_connection
bool gx_jack_connection(bool connect, bool startserver, int wait_after_connect, const gx_system::CmdlineOptions &opt)
Definition: gx_jack.cpp:456
gx_system::CmdlineOptions::mainwin_height
int mainwin_height
Definition: gx_system.h:439
GxLogger::get_logger
static GxLogger & get_logger()
Definition: gx_logging.cpp:49
gx_system::CmdlineOptions::window_height
int window_height
Definition: gx_system.h:440
kChangeLatency
Definition: gx_main_window.cpp:1217
gx_system::CmdlineOptions::system_show_value
bool system_show_value
Definition: gx_system.h:446
gx_engine::PluginChange::update_category
Definition: gx_engine.h:64
MainWindow::update_width
void update_width()
Definition: gx_main_window.cpp:966
gx_gui::connect_midi_controller
void connect_midi_controller(Gtk::Widget *w, const std::string &id, gx_engine::GxMachineBase &machine)
Definition: gx_main_interface.h:275
gx_engine::GxMachineBase::set_state
virtual void set_state(GxEngineState state)=0
KeySwitcher::process_bank_key
bool process_bank_key(int idx)
Definition: liveplay.cpp:90
gx_system::CmdlineOptions::get_liveplaygui
bool get_liveplaygui() const
Definition: gx_system.h:483
MainWindow::MainWindow
MainWindow(gx_engine::GxMachineBase &machine, gx_system::CmdlineOptions &options, Gtk::Window *splash, const Glib::ustring &title)
Definition: gx_main_window.cpp:2840
start
CmdConnection::msg_type start
Definition: jsonrpc.cpp:255
gx_system::CmdlineOptions::system_show_presets
bool system_show_presets
Definition: gx_system.h:449
PLUGIN_TYPE_MONO
Definition: machine.h:35
Freezer::~Freezer
~Freezer()
Definition: gx_main_window.cpp:370
Gxw::FastMeter::clear
void clear()
Definition: fastmeter.cc:147
PluginUI::PluginUI
PluginUI(MainWindow &main, const char *id_, const Glib::ustring &tooltip_="")
Definition: rack.cpp:43
PresetWindow::on_preset_select
void on_preset_select(bool v, bool animated, int preset_window_height)
Definition: gx_preset_window.cpp:1349
SelectMidiChannel
Definition: gx_main_window.h:552
gx_engine::GxMachineBase::get_jack
virtual gx_jack::GxJack * get_jack()=0
Gxw::RackTuner::set_temperament
void set_temperament(int p1)
Definition: racktuner.cc:330
GxLogger::kError
Definition: gx_logging.h:41
gx_system::SkinHandling::skin_list
std::vector< Glib::ustring > skin_list
Definition: gx_system.h:276
gx_engine::GxMachineBase::save_to_state
virtual void save_to_state(bool preserve_preset=false)=0
GxActions::engine_bypass_conn
sigc::connection engine_bypass_conn
Definition: gx_main_window.h:518
gx_engine::Plugin
Definition: gx_pluginloader.h:44
RackBox::get_box_visible
bool get_box_visible()
Definition: gx_main_window.h:317
gx_portmap::PortMapWindow::signal_response
Glib::SignalProxy1< void, int > signal_response()
Definition: gx_portmap.h:93
GxActions::presets
Glib::RefPtr< Gtk::ToggleAction > presets
Definition: gx_main_window.h:527
PluginDict::cleanup
void cleanup()
Definition: rack.cpp:212
PluginDict::add
void add(PluginUI *p)
Definition: rack.cpp:202
PluginDesc::plugins
std::vector< PluginUI * > * plugins
Definition: gx_main_window.cpp:2029
gx_system::CmdlineOptions::get_jack_uuid
const Glib::ustring & get_jack_uuid() const
Definition: gx_system.h:495
RackContainer::set_config_mode
void set_config_mode(bool mode)
Definition: rack.cpp:1616
gx_system::CmdlineOptions::preset_window_height
int preset_window_height
Definition: gx_system.h:441
Gxw::RackTuner::set_streaming
void set_streaming(bool p1)
Definition: racktuner.cc:290
GxActions::loggingbox
Glib::RefPtr< Gtk::ToggleAction > loggingbox
Definition: gx_main_window.h:523
MainWindow
Definition: gx_main_window.h:574
GxActions::show_plugin_bar
Glib::RefPtr< Gtk::ToggleAction > show_plugin_bar
Definition: gx_main_window.h:526
gx_engine::GxMachineBase::set_oscilloscope_mul_buffer
virtual void set_oscilloscope_mul_buffer(int a)=0
gx_engine::Parameter::getInt
IntParameter & getInt()
Definition: gx_parameter.h:458
gx_main_midi::MidiControllerTable::toggle
static void toggle(gx_engine::GxMachineBase &machine, Glib::RefPtr< Gtk::ToggleAction > item)
Definition: gx_main_midi.cpp:135
gx_gui::child_set_property
void child_set_property(Gtk::Container &container, Gtk::Widget &child, const char *property_name, bool value)
Definition: gx_gui_helpers.cpp:39
RackContainer::add
void add(RackBox &r, int pos=-1)
Definition: rack.cpp:1591
gx_engine::GxMachineBase::signal_selection_changed
virtual sigc::signal< void > & signal_selection_changed()=0
gx_gui::SelectJackControlPgm::create
static SelectJackControlPgm * create(gx_system::CmdlineOptions &opt, gx_engine::GxMachineBase &machine)
Definition: gx_jack_options.cpp:78
GxActions::expand
Glib::RefPtr< Gtk::Action > expand
Definition: gx_main_window.h:507
guitarix.h
gx_engine::GxMachineBase::commit_ladspa_changes
virtual void commit_ladspa_changes()=0
GDK_KEY_Escape
#define GDK_KEY_Escape
Definition: guitarix.h:53
gx_engine::GxMachineBase::signal_state_change
virtual sigc::signal< void, GxEngineState > & signal_state_change()=0
MainWindow::~MainWindow
~MainWindow()
Definition: gx_main_window.cpp:3298
gx_system::CmdlineOptions::get_clear_rc
bool get_clear_rc() const
Definition: gx_system.h:481
Gxw::WaveView::set_frame
void set_frame(const float *p1, int p2)
Definition: waveview.cc:137
GxLogger::MsgType
MsgType
Definition: gx_logging.h:37
UiToggleAction::create
static Glib::RefPtr< UiToggleAction > create(gx_engine::GxMachineBase &machine, const std::string &id, const Glib::ustring &name, const Glib::ustring &label=Glib::ustring(), const Glib::ustring &tooltip=Glib::ustring(), bool is_active=false)
Definition: gx_main_window.h:38
gx_engine::ParameterV< bool >::signal_changed
sigc::signal< void, bool > & signal_changed()
Definition: gx_parameter.h:377
update_scrolled_window
void update_scrolled_window(Gtk::ScrolledWindow &w)
Definition: gx_main_window.cpp:504
gx_engine::GxMachineBase::stop_socket
virtual void stop_socket()=0
gx_system::CmdlineOptions::system_animations
bool system_animations
Definition: gx_system.h:448
PluginDesc::group
Glib::ustring group
Definition: gx_main_window.cpp:2028
GxActions::engine_bypass
Glib::RefPtr< Gtk::ToggleAction > engine_bypass
Definition: gx_main_window.h:517
GxActions::show_values
Glib::RefPtr< Gtk::ToggleAction > show_values
Definition: gx_main_window.h:534
gx_engine::GxMachineBase::get_oscilloscope_buffer
virtual const float * get_oscilloscope_buffer()=0
GxUiRadioMenu::setup
void setup(const Glib::ustring &prefix, const Glib::ustring &postfix, Glib::RefPtr< Gtk::UIManager > &uimanager, Glib::RefPtr< Gtk::ActionGroup > &actiongroup)
Definition: gx_main_window.cpp:320
PluginUI::get_name
const char * get_name() const
Definition: gx_main_window.h:176
GDK_KEY_a
#define GDK_KEY_a
Definition: guitarix.h:49
gx_system::CmdlineOptions::get_opt_save_on_exit
bool get_opt_save_on_exit() const
Definition: gx_system.h:502
MainWindow::run
void run()
Definition: gx_main_window.cpp:2759
gx_system::gx_system_call
int gx_system_call(const std::string &, bool devnull=false, bool escape=false)
Definition: gx_system.cpp:954