Guitarix
rack.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2009, 2010 Hermann Meyer, James Warden
3  * Copyright (C) 2011 Pete Shorthose
4  * Copyright (C) 2012 Andreas Degert
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19  * ---------------------------------------------------------------------------
20  *
21  * ----------------------------------------------------------------------------
22  */
23 
24 #include <guitarix.h>
25 
26 /****************************************************************
27  ** class PluginUI
28  **
29  ** This class represents a rack unit. It refers to an engine
30  ** plugin. The user interface in the rack is loaded on demand.
31  **
32  ** It is responsible for reflecting any changes done to display
33  ** parameter variables (box_visible, flat/expanded format, ordering).
34  **
35  ** Registering with an GxUI is done in PluginDict.
36  **
37  ** When a preset load is in progress re-ordering is blocked.
38  ** MainWindow connects RackContainer::check_order() to
39  ** GxSettings::signal_selection_changed so that ordering will be done
40  ** when the load is finished.
41  **
42  */
43 
44 PluginUI::PluginUI(MainWindow& main_, const char *name,
45  const Glib::ustring& tooltip_)
46  : merge_id(0),
47  action(),
48  plugin(main_.get_machine().pluginlist_lookup_plugin(name)),
49  tooltip(tooltip_),
50  shortname(),
51  icon(),
52  group(),
53  toolitem(),
54  main(main_),
55  rackbox(),
56  hidden(false),
57  hidden_by_move(false) {
58  if (plugin->get_pdef()->description && tooltip.empty()) {
60  }
62 }
63 
65  delete rackbox;
66  if (toolitem) {
67  if (group) {
68  group->remove(*toolitem);
69  }
70  delete toolitem;
71  }
73 }
74 
75 void PluginUI::unset_ui_merge_id(Glib::RefPtr<Gtk::UIManager> uimanager) {
76  if (merge_id) {
77  uimanager->remove_ui(merge_id);
78  merge_id = 0;
79  }
80 }
81 
84 }
85 
88 }
89 
90 void PluginUI::compress(bool state) {
91  plugin->set_plug_visible(state);
92  if (rackbox) {
93  if (rackbox->can_compress()) {
94  rackbox->swtch(state);
95  }
96  }
97 }
98 
99 void PluginUI::set_action(Glib::RefPtr<Gtk::ToggleAction>& act)
100 {
101  action = act;
102  action->signal_toggled().connect(sigc::mem_fun(*this, &PluginUI::on_action_toggled));
103 }
104 
105 void PluginUI::on_action_toggled() {
106  if (rackbox && action->get_active() == rackbox->get_box_visible()) {
107  return;
108  }
109  if (action->get_active()) {
110  display_new();
111  } else {
112  display(false, true);
113  }
114 }
115 
116 void PluginUI::hide(bool animate) {
117  plugin->set_on_off(false);
118  if (rackbox) {
119  rackbox->display(false, animate);
120  main.add_icon(get_id());
121  }
122 }
123 
124 void PluginUI::show(bool animate) {
125  if (!rackbox) {
126  rackbox = main.add_rackbox(*this, plugin->get_plug_visible(), -1, animate);
127  set_active(true);
128  } else {
129  rackbox->display(true, animate);
130  }
131  if (hidden) {
132  rackbox->hide();
133  }
135 }
136 
137 void PluginUI::display(bool v, bool animate) {
138  // this function hides the rackbox. It could also destroy it (or
139  // some other function could do it, e.g. when unloading a module),
140  // but currently there are too many memory leaks in the stack based
141  // builder.
143  if (v) {
145  hidden = false;
146  show(animate);
147  } else {
149  hide(animate);
150  }
151 }
152 
153 void PluginUI::display_new(bool unordered) {
154  plugin->set_plug_visible(false);
155  if (rackbox) {
156  rackbox->swtch(false);
157  }
158  display(true, true);
159  if (!unordered) {
160  rackbox->get_parent()->reorder(get_id(), -1);
161  }
162 }
163 
165  if (!rackbox) {
166  return;
167  }
168  if (plugin->get_box_visible()) {
170  int n = 0;
171  for (RackContainer::rackbox_list::iterator i = l.begin(); i != l.end(); ++i, ++n)
172  if (*i == rackbox) {
173  break;
174  }
175  display(false,false);
176  delete rackbox;
177  rackbox = 0;
178  display(true,false);
179  rackbox->get_parent()->reorder(get_id(), n);
180  //rackbox = main.add_rackbox(*this, plugin->get_plug_visible(), n, false);
181  } else {
182  delete rackbox;
183  rackbox = 0;
184  }
185 }
186 
188  int res = a->get_type() - b->get_type();
189  if (res == 0) {
190  gchar *an = g_utf8_casefold(a->get_shortname(), 1);
191  gchar *bn = g_utf8_casefold(b->get_shortname(), 1);
192  res = g_utf8_collate(an, bn);
193  g_free(an);
194  g_free(bn);
195  }
196  return res < 0;
197 }
198 
199 
200 /****************************************************************
201  ** class PluginDict
202  */
203 
205  insert(pair<std::string, PluginUI*>(p->get_id(), p));
206 }
207 
209  std::map<std::string, PluginUI*>::iterator i = find(p->get_id());
210  assert(i != end());
211  erase(i);
212 }
213 
215  for (std::map<std::string, PluginUI*>::iterator i = begin(); i != end(); ++i) {
216  delete i->second;
217  }
218  clear();
219 }
220 
222  cleanup();
223 }
224 
225 void PluginDict::compress(bool state) {
226  for (std::map<std::string, PluginUI*>::iterator i = begin(); i != end(); ++i) {
227  i->second->compress(state);
228  }
229 }
230 
231 
232 /****************************************************************
233  ** class DragIcon
234  */
235 
236 inline guint8 convert_color_channel (guint8 src, guint8 alpha) {
237  return alpha ? ((guint (src) << 8) - src) / alpha : 0;
238 }
239 
240 void convert_bgra_to_rgba (guint8 const* src, guint8* dst, int width, int height) {
241  guint8 const* src_pixel = src;
242  guint8* dst_pixel = dst;
243 
244  for (int i = 0; i < height*width; ++i) {
245  dst_pixel[0] = convert_color_channel(src_pixel[2], src_pixel[3]);
246  dst_pixel[1] = convert_color_channel(src_pixel[1], src_pixel[3]);
247  dst_pixel[2] = convert_color_channel(src_pixel[0], src_pixel[3]);
248  dst_pixel[3] = src_pixel[3];
249 
250  dst_pixel += 4;
251  src_pixel += 4;
252  }
253 }
254 
255 DragIcon::DragIcon(const PluginUI& plugin, Glib::RefPtr<Gdk::DragContext> context, gx_system::CmdlineOptions& options, int xoff)
256  : window(), drag_icon_pixbuf() {
257  Glib::RefPtr<Gdk::Screen> screen = context->get_source_window()->get_screen();
258  Glib::RefPtr<Gdk::Colormap> rgba = screen->get_rgba_colormap();
259  if (screen->is_composited()) {
260  window = new Gtk::Window(Gtk::WINDOW_POPUP);
261  if (rgba) { // else will look ugly..
262  window->set_colormap(rgba);
263  }
264  }
265  create_drag_icon_pixbuf(plugin, rgba, options);
266  int w = drag_icon_pixbuf->get_width();
267  int h = drag_icon_pixbuf->get_height();
268  int h2 = (h/2)-2;
269  int w2 = std::min(std::max(0, xoff), w-gradient_length/2) - 4;
270  if (window) {
271  window->set_size_request(w, h);
272  window->signal_expose_event().connect(sigc::mem_fun(*this, &DragIcon::icon_expose_event));
273  //context->set_icon_widget(window, w2, h2);
274  gtk_drag_set_icon_widget(context->gobj(), GTK_WIDGET(window->gobj()), w2, h2);
275  } else {
276  context->set_icon(drag_icon_pixbuf, w2, h2);
277  }
278 }
279 
281  delete window;
282 }
283 
284 bool DragIcon::icon_expose_event(GdkEventExpose *ev) {
285  Cairo::RefPtr<Cairo::Context> cr = Glib::wrap(ev->window, true)->create_cairo_context();
286  gdk_cairo_region(cr->cobj(), ev->region);
287  cr->set_operator(Cairo::OPERATOR_SOURCE);
288  cr->clip();
289  Gdk::Cairo::set_source_pixbuf(cr, drag_icon_pixbuf, 0, 0);
290  cr->paint();
291  return true;
292 }
293 
294 void DragIcon::create_drag_icon_pixbuf(const PluginUI& plugin, Glib::RefPtr<Gdk::Colormap> rgba, gx_system::CmdlineOptions& options) {
295  Gtk::OffscreenWindow w;
296  w.signal_expose_event().connect(sigc::bind(sigc::mem_fun(*this, &DragIcon::window_expose_event), sigc::ref(w)));
297  if (rgba) {
298  w.set_colormap(rgba);
299  }
300  Gtk::Widget *r = RackBox::create_drag_widget(plugin, options);
301  w.add(*r);
302  w.show_all();
303  w.get_window()->process_updates(true);
304 }
305 
306 static void destroy_data(const guint8 *data) {
307  delete[] data;
308 }
309 
310 bool DragIcon::window_expose_event(GdkEventExpose *event, Gtk::OffscreenWindow& widget) {
311  Cairo::RefPtr<Cairo::Context> cr = widget.get_window()->create_cairo_context();
312  cr->set_operator(Cairo::OPERATOR_SOURCE);
313  cr->set_source_rgba(0,0,0,0);
314  cr->paint();
315  Gtk::Widget *child = widget.get_child();
316  if (child) {
317  widget.propagate_expose(*child, event);
318  }
319  Cairo::RefPtr<Cairo::Surface> x_surf = cr->get_target();
320  int w = gdk_window_get_width(event->window);
321  int h = gdk_window_get_height(event->window);
322  Cairo::RefPtr<Cairo::LinearGradient> grad = Cairo::LinearGradient::create(w, 0, w-gradient_length, 0);
323  grad->add_color_stop_rgba(0, 1, 1, 1, 1);
324  grad->add_color_stop_rgba(1, 1, 1, 1, 0);
325  cr->rectangle(w-gradient_length, 0, gradient_length, h);
326  cr->mask(grad);
327  Cairo::RefPtr<Cairo::ImageSurface> i_surf = Cairo::ImageSurface::create(Cairo::FORMAT_ARGB32, w, h);
328  Cairo::RefPtr<Cairo::Context> crt = Cairo::Context::create(i_surf);
329  crt->set_operator(Cairo::OPERATOR_SOURCE);
330  crt->set_source(x_surf, 0, 0);
331  crt->paint();
332  guint8 *data = new guint8[w*h*4];
333  convert_bgra_to_rgba(i_surf->get_data(), data, w, h);
334  drag_icon_pixbuf = Gdk::Pixbuf::create_from_data(data, Gdk::COLORSPACE_RGB, true, 8, w, h, i_surf->get_stride(), sigc::ptr_fun(destroy_data));
335  return true;
336 }
337 
338 
339 /****************************************************************
340  ** class MiniRackBox
341  */
342 
343 Glib::RefPtr<Gtk::SizeGroup> MiniRackBox::szg_label;
344 
345 Gtk::Widget *MiniRackBox::make_delete_button(RackBox& rb) {
346  Gtk::Widget *w;
347  if (rb.has_delete()) {
348  Gtk::Label *l = new Gtk::Label("\u2a2f");
349  l->show();
350  Gtk::Button *b = new Gtk::Button();
351  b->set_focus_on_click(false);
352  b->add(*manage(l));
353  b->signal_clicked().connect(sigc::bind(sigc::mem_fun(rb.plugin, &PluginUI::display), false, true));
354  w = b;
355  } else {
356  w = new Gtk::Alignment();
357  }
358  w->set_size_request(20, 15);
359  return w;
360 }
361 
362 bool MiniRackBox::on_my_leave_out(GdkEventCrossing *focus) {
363  if (!mconbox.get_visible()) {
364  Glib::RefPtr<Gdk::Window> window = this->get_window();
365  window->set_cursor();
366  }
367  return true;
368 }
369 
370 bool MiniRackBox::on_my_enter_in(GdkEventCrossing *focus) {
371  if (!mconbox.get_visible()) {
372  Glib::RefPtr<Gdk::Window> window = this->get_window();
373  Gdk::Cursor cursor(Gdk::HAND1);
374  window->set_cursor(cursor);
375  }
376  return true;
377 }
378 
380  : Gtk::HBox(),
381  evbox(),
382  mconbox(false, 4),
383  mb_expand_button(),
384  mb_delete_button(),
385  preset_button(),
386  on_off_switch("switchit"),
387  toggle_on_off(rb.main.get_machine(), &on_off_switch, rb.plugin.plugin->id_on_off()) {
388  if (strcmp(rb.plugin.get_id(), "ampstack") != 0) { // FIXME
389  gx_gui::connect_midi_controller(&on_off_switch, rb.plugin.plugin->id_on_off().c_str(), rb.main.get_machine());
390 
391  if (!szg_label) {
392  szg_label = Gtk::SizeGroup::create(Gtk::SIZE_GROUP_HORIZONTAL);
393  }
394  evbox.set_visible_window(false);
395  evbox.signal_leave_notify_event().connect(sigc::mem_fun(*this, &MiniRackBox::on_my_leave_out));
396  evbox.signal_enter_notify_event().connect(sigc::mem_fun(*this, &MiniRackBox::on_my_enter_in));
397  add(evbox);
398 
399  Gtk::Alignment *al = new Gtk::Alignment();
400  al->set_padding(0, 4, 0, 0);
401  al->set_border_width(0);
402 
403  evbox.add(*manage(al));
404 
405  Gtk::HBox *box = new Gtk::HBox();
406  Gtk::HBox *top = new Gtk::HBox();
407  al->add(*manage(box));
408 
409  this->set_spacing(0);
410  this->set_border_width(0);
411 
412  box->set_spacing(0);
413  box->set_border_width(0);
414 
415  top->set_spacing(4);
416  top->set_border_width(0);
417  top->set_name("rack_unit_title_bar");
418 
419  box->pack_start(*manage(rb.wrap_bar()), Gtk::PACK_SHRINK);
420  box->pack_start(*manage(top));
421  box->pack_start(*manage(rb.wrap_bar()), Gtk::PACK_SHRINK);
422 
423  top->pack_start(on_off_switch, Gtk::PACK_SHRINK);
424  on_off_switch.set_name("effect_on_off");
425  Gtk::Widget *effect_label = RackBox::make_label(rb.plugin, options);
426  szg_label->add_widget(*manage(effect_label));
427  top->pack_start(*manage(effect_label), Gtk::PACK_SHRINK);
428 
429  top->pack_start(mconbox, Gtk::PACK_EXPAND_WIDGET);
430 
431  mb_expand_button = rb.make_expand_button(true);
432  top->pack_end(*manage(mb_expand_button), Gtk::PACK_SHRINK);
433  if (!(rb.plugin.plugin->get_pdef()->flags & PGN_NO_PRESETS)) {
434  preset_button = rb.make_preset_button();
435  top->pack_end(*manage(preset_button), Gtk::PACK_SHRINK);
436  }
437  mb_delete_button = make_delete_button(rb);
438  mb_delete_button->set_no_show_all(true);
439  top->pack_end(*manage(mb_delete_button), Gtk::PACK_SHRINK);
440 #ifdef USE_SZG
441  RackBox::szg->add_widget(*al);
442 #else
443  al->set_size_request(32, -1);
444 #endif
445  } else { // special minibox for main amp in config mode
446  if (!szg_label) {
447  szg_label = Gtk::SizeGroup::create(Gtk::SIZE_GROUP_HORIZONTAL);
448  }
449  evbox.set_visible_window(false);
450  evbox.signal_leave_notify_event().connect(sigc::mem_fun(*this, &MiniRackBox::on_my_leave_out));
451  evbox.signal_enter_notify_event().connect(sigc::mem_fun(*this, &MiniRackBox::on_my_enter_in));
452  add(evbox);
453 
454  Gtk::Alignment *al = new Gtk::Alignment();
455  al->set_padding(0, 4, 0, 0);
456  al->set_border_width(0);
457 
458  Gtk::HBox *box = new Gtk::HBox();
459  Gtk::HBox *top = new Gtk::HBox();
460  evbox.add(*manage(box));
461 
462  top->set_name("rack_unit_title_bar");
463  Gtk::Widget *effect_label = RackBox::make_label(rb.plugin, options);
464  szg_label->add_widget(*manage(effect_label));
465  top->pack_start(*manage(effect_label), Gtk::PACK_SHRINK);
466  top->pack_start(mconbox, Gtk::PACK_EXPAND_WIDGET);
467  box->pack_start(*manage(al), Gtk::PACK_SHRINK);
468  box->pack_start(*manage(top));
469 #ifdef USE_SZG
470  RackBox::szg->add_widget(*al);
471 #else
472  al->set_size_request(64, 32);
473 #endif
474  }
475  show_all();
476 }
477 
478 void MiniRackBox::pack(Gtk::Widget *w) {
479  if (w) {
480  mconbox.pack_start(*manage(w), Gtk::PACK_SHRINK, 4);
481  }
482 }
483 
485  evbox.set_above_child(mode);
486  if (mode) {
487  mconbox.hide();
488  if (preset_button) {
489  preset_button->hide();
490  }
491  if (mb_expand_button) {
492  mb_expand_button->hide();
493  }
494  if (mb_delete_button) {
495  mb_delete_button->show();
496  }
497  } else {
498  mconbox.show();
499  if (preset_button) {
500  preset_button->show();
501  }
502  if (mb_expand_button) {
503  mb_expand_button->show();
504  }
505  if (mb_delete_button) {
506  mb_delete_button->hide();
507  }
508  }
509 }
510 
511 
512 /****************************************************************
513  ** class PluginPresetPopup
514  */
515 
516 /*
517 ** InputWindow
518 */
519 
520 class InputWindow: public Gtk::Window {
521 private:
522  Glib::ustring name;
523  void on_cancel();
524  void on_ok(Gtk::Entry *e);
525  virtual bool on_key_press_event(GdkEventKey *event);
526  static InputWindow* create_from_builder(
527  BaseObjectType* cobject, Glib::RefPtr<gx_gui::GxBuilder> bld, const Glib::ustring& save_name_default);
528  InputWindow(BaseObjectType* cobject, Glib::RefPtr<gx_gui::GxBuilder> bld, const Glib::ustring& save_name_default);
529 public:
530  ~InputWindow();
531  static InputWindow *create(const gx_system::CmdlineOptions& options, const Glib::ustring& save_name_default);
532  void run();
533  Glib::ustring& get_name() { return name; }
534 };
535 
536 InputWindow *InputWindow::create_from_builder(BaseObjectType* cobject, Glib::RefPtr<gx_gui::GxBuilder> bld,
537  const Glib::ustring& save_name_default) {
538  return new InputWindow(cobject, bld, save_name_default);
539 }
540 
542 }
543 
544 InputWindow *InputWindow::create(const gx_system::CmdlineOptions& options, const Glib::ustring& save_name_default) {
545  Glib::RefPtr<gx_gui::GxBuilder> bld = gx_gui::GxBuilder::create_from_file(options.get_builder_filepath("pluginpreset_inputwindow.glade"));
546  InputWindow *w;
547  bld->get_toplevel_derived(
548  "PluginPresetInputWindow", w,
549  sigc::bind(sigc::ptr_fun(InputWindow::create_from_builder), bld, save_name_default));
550  return w;
551 }
552 
553 bool InputWindow::on_key_press_event(GdkEventKey *event) {
554  if (event->keyval == GDK_KEY_Escape && (event->state & Gtk::AccelGroup::get_default_mod_mask()) == 0) {
555  hide();
556  return true;
557  }
558  return Gtk::Window::on_key_press_event(event);
559 }
560 
561 void InputWindow::on_ok(Gtk::Entry *e) {
562  name = e->get_text();
563  hide();
564 }
565 
566 InputWindow::InputWindow(BaseObjectType* cobject, Glib::RefPtr<gx_gui::GxBuilder> bld,
567  const Glib::ustring& save_name_default)
568  : Gtk::Window(cobject), name() {
569  Gtk::Button *b;
570  bld->find_widget("cancelbutton", b);
571  b->signal_clicked().connect(
572  sigc::mem_fun(*this, &InputWindow::hide));
573  bld->find_widget("okbutton", b);
574  Gtk::Entry *e;
575  bld->find_widget("entry", e);
576  e->set_text(save_name_default);
577  e->select_region(0, -1);
578  b->signal_clicked().connect(
579  sigc::bind(sigc::mem_fun(*this, &InputWindow::on_ok), e));
580 }
581 
583  Gtk::Main::run(*this);
584 }
585 
586 /*
587 ** PluginPresetListWindow
588 */
589 
590 class TextListStore: public Gtk::ListStore {
591 public:
592  class TextListColumns : public Gtk::TreeModel::ColumnRecord {
593  public:
594  Gtk::TreeModelColumn<Glib::ustring> name;
595  TextListColumns() { add(name); }
596  } col;
597 private:
598  TextListStore(): Gtk::ListStore(), col() {
599  set_column_types(col);
600  }
601 public:
602  static Glib::RefPtr<TextListStore> create() { return Glib::RefPtr<TextListStore>(new TextListStore); }
603 };
604 
605 class PluginPresetListWindow: public Gtk::Window {
606 private:
607  Glib::RefPtr<TextListStore> textliststore;
608  PluginPresetPopup& presetlist;
609  //
610  Gtk::TreeView *treeview;
611  Gtk::Button *removebutton;
612  using Gtk::Window::on_remove;
613  void on_remove();
614  void on_selection_changed();
615  virtual bool on_key_press_event(GdkEventKey *event);
616  static PluginPresetListWindow* create_from_builder(
617  BaseObjectType* cobject, Glib::RefPtr<gx_gui::GxBuilder> bld, PluginPresetPopup& p);
618  PluginPresetListWindow(BaseObjectType* cobject, Glib::RefPtr<gx_gui::GxBuilder> bld, PluginPresetPopup& p);
619 public:
622  void run();
623 };
624 
625 PluginPresetListWindow *PluginPresetListWindow::create_from_builder(
626  BaseObjectType* cobject, Glib::RefPtr<gx_gui::GxBuilder> bld, PluginPresetPopup& p) {
627  return new PluginPresetListWindow(cobject, bld, p);
628 }
629 
631 }
632 
634  const gx_system::CmdlineOptions& options, PluginPresetPopup& p) {
635  Glib::RefPtr<gx_gui::GxBuilder> bld = gx_gui::GxBuilder::create_from_file(
636  options.get_builder_filepath("pluginpreset_listwindow.glade"));
638  bld->get_toplevel_derived(
639  "PluginPresetListWindow", w,
640  sigc::bind(sigc::ptr_fun(PluginPresetListWindow::create_from_builder), bld, sigc::ref(p)));
641  return w;
642 }
643 
644 bool PluginPresetListWindow::on_key_press_event(GdkEventKey *event) {
645  if (event->keyval == GDK_KEY_Escape && (event->state & Gtk::AccelGroup::get_default_mod_mask()) == 0) {
646  hide();
647  return true;
648  }
649  return Gtk::Window::on_key_press_event(event);
650 }
651 
652 void PluginPresetListWindow::on_remove() {
653  Gtk::TreeIter it = treeview->get_selection()->get_selected();
654  if (it) {
656  presetlist.get_pdef(), it->get_value(textliststore->col.name));
657  textliststore->erase(it);
658  }
659 }
660 
661 PluginPresetListWindow::PluginPresetListWindow(
662  BaseObjectType* cobject, Glib::RefPtr<gx_gui::GxBuilder> bld, PluginPresetPopup& p)
663  : Gtk::Window(cobject),
664  textliststore(TextListStore::create()),
665  presetlist(p) {
666  Gtk::Button *b;
667  bld->find_widget("closebutton", b);
668  b->signal_clicked().connect(
669  sigc::mem_fun(*this, &PluginPresetListWindow::hide));
670  bld->find_widget("removebutton", removebutton);
671  removebutton->signal_clicked().connect(
672  sigc::mem_fun0(*this, &PluginPresetListWindow::on_remove));
673  bld->find_widget("treeview", treeview);
674  for (gx_preset::UnitPresetList::const_iterator i = presetlist.begin(); i != presetlist.end(); ++i) {
675  if (i->name.empty()) {
676  break;
677  }
678  textliststore->append()->set_value(textliststore->col.name, i->name);
679  }
680  treeview->set_model(textliststore);
681  removebutton->set_sensitive(false);
682  Glib::RefPtr<Gtk::TreeSelection> sel = treeview->get_selection();
683  sel->signal_changed().connect(
684  sigc::mem_fun(*this, &PluginPresetListWindow::on_selection_changed));
685 }
686 
687 void PluginPresetListWindow::on_selection_changed() {
688  removebutton->set_sensitive(treeview->get_selection()->get_selected());
689 }
690 
692  Gtk::Main::run(*this);
693 }
694 
695 /*
696 ** PluginPresetPopup
697 */
698 
699 void PluginPresetPopup::set_plugin_preset(bool factory, const Glib::ustring& name) {
700  if(strcmp(pdef->id,"seq")==0) {
701  machine.plugin_preset_list_sync_set(pdef, factory, name);
702  } else {
703  machine.plugin_preset_list_set(pdef, factory, name);
704  }
705 }
706 
707 void PluginPresetPopup::set_plugin_std_preset() {
708  machine.reset_unit(pdef);
709 }
710 
711 void PluginPresetPopup::save_plugin_preset() {
712  InputWindow *w = InputWindow::create(machine.get_options(), save_name_default);
713  w->run();
714  if (!w->get_name().empty()) {
715  // save loop file to plugin preset name
716  if(strcmp(pdef->id,"dubber")==0) {
717  Glib::ustring name = "";
718  machine.set_parameter_value("dubber.filename", name);
719  machine.set_parameter_value("dubber.savefile", true);
720  machine.set_parameter_value("dubber.filename", w->get_name());
721  }
722  machine.plugin_preset_list_save(pdef, w->get_name());
723  if(strcmp(pdef->id,"seq")==0) {
724  Glib::ustring id = "seq." + w->get_name();
725  if (!machine.parameter_hasId(id)) {
726  machine.insert_param("seq", w->get_name());
727  }
728  }
729  }
730  delete w;
731 }
732 
733 void PluginPresetPopup::remove_plugin_preset() {
735  w->run();
736  delete w;
737 }
738 
739 bool PluginPresetPopup::add_plugin_preset_list(bool *found) {
740  *found = false;
741  bool found_presets = false;
742  bool factory = false;
743  for (gx_preset::UnitPresetList::iterator i = presetnames.begin(); i != presetnames.end(); ++i) {
744  if (i->name.empty()) {
745  factory = true;
746  if (found_presets) {
747  append(*manage(new Gtk::SeparatorMenuItem()));
748  *found = true;
749  found_presets = false;
750  }
751  continue;
752  } else {
753  found_presets = true;
754  }
755  Gtk::CheckMenuItem *c = new Gtk::CheckMenuItem(i->name);
756  if (i->is_set) {
757  c->set_active(true);
758  }
759  c->signal_activate().connect(
760  sigc::bind(sigc::mem_fun(this, &PluginPresetPopup::set_plugin_preset), factory, i->name));
761  append(*manage(c));
762  }
763  return found_presets;
764 }
765 
766 static bool delete_plugin_preset_popup(PluginPresetPopup *p) {
767  delete p;
768  return false;
769 }
770 
772  Glib::signal_idle().connect(
773  sigc::bind(
774  sigc::ptr_fun(delete_plugin_preset_popup),
775  this));
776 }
777 
779  const Glib::ustring& save_name_default_)
780  : Gtk::Menu(),
781  pdef(pdef_),
782  machine(machine_),
783  save_name_default(save_name_default_),
784  presetnames() {
785  machine.plugin_preset_list_load(pdef, presetnames);
786  bool found_presets;
787  if (!add_plugin_preset_list(&found_presets)) {
788  Gtk::CheckMenuItem *c = new Gtk::CheckMenuItem(_("standard"));
789  if (machine.parameter_unit_has_std_values(pdef)) {
790  c->set_active(true);
791  }
792  c->signal_activate().connect(
793  sigc::mem_fun(this, &PluginPresetPopup::set_plugin_std_preset));
794  append(*manage(c));
795  }
796  append(*manage(new Gtk::SeparatorMenuItem()));
797  Gtk::MenuItem *mi = new Gtk::MenuItem(_("save..."));
798  append(*manage(mi));
799  mi->signal_activate().connect(
800  sigc::mem_fun(this, &PluginPresetPopup::save_plugin_preset));
801  if (found_presets) {
802  mi = new Gtk::MenuItem(_("remove..."));
803  append(*manage(mi));
804  mi->signal_activate().connect(
805  sigc::mem_fun(this, &PluginPresetPopup::remove_plugin_preset));
806  }
807  show_all();
808  popup(1, gtk_get_current_event_time());
809 }
810 
811 
812 /****************************************************************
813  ** class RackBox
814  */
815 
816 #ifdef USE_SZG
817 Glib::RefPtr<Gtk::SizeGroup> RackBox::szg;
818 #endif
819 
820 void RackBox::set_paintbox_unit_shrink(Gxw::PaintBox& pb, PluginType tp) {
821  pb.set_name("rackbox");
822  pb.property_paint_func().set_value("gx_rack_unit_shrink_expose");
823  pb.set_border_width(4);
824 }
825 
826 void RackBox::set_paintbox_unit(Gxw::PaintBox& pb, const PluginUI& plugin) {
827  pb.set_name("rackbox");
828  pb.property_paint_func().set_value("gx_rack_unit_expose");
829  pb.set_border_width(4);
830  // FIXME set special background for LV2 plugins
831  // if (plugin.plugin->get_pdef()->flags & gx_engine::PGNI_IS_LV2)
832  // fprintf(stderr,"LV2 Plugin Load for %s %i\n",plugin.plugin->get_pdef()->name, plugin.plugin->get_pdef()->flags & gx_engine::PGNI_IS_LV2);
833  // else if (plugin.plugin->get_pdef()->flags & gx_engine::PGNI_IS_LADSPA)
834  // fprintf(stderr,"LADSPA Plugin Load for %s %i\n",plugin.plugin->get_pdef()->name, plugin.plugin->get_pdef()->flags & gx_engine::PGNI_IS_LV2);
835 
836 }
837 
838 void RackBox::set_paintbox(Gxw::PaintBox& pb, PluginType tp) {
839  pb.set_name("rackbox");
840  // pb.property_paint_func().set_value("rectangle_skin_color_expose");
841  pb.set_border_width(4);
842 }
843 
844 Gtk::Widget *RackBox::make_label(const PluginUI& plugin, gx_system::CmdlineOptions& options, bool useshort) {
845  const char *effect_name = useshort ? plugin.get_shortname() : plugin.get_name();
846  Gtk::Label *effect_label = new Gtk::Label(effect_name);
847  effect_label->set_alignment(0.0, 0.5);
848  effect_label->set_name("effect_title");
849  if (plugin.get_type() == PLUGIN_TYPE_STEREO) {
850  effect_label->set_markup("◗◖ " + effect_label->get_label()); //♾⚮⦅◗◖⦆⚭ ⧓ Ꝏꝏ ⦅◉⦆● ▷◁ ▶◀
851  }
852  return effect_label;
853 }
854 
855 Gtk::Widget *RackBox::make_bar(int left, int right, bool sens) {
856  Gtk::Alignment *al = new Gtk::Alignment(0, 0, 1.0, 1.0);
857  //al->set_padding(4, 4, left, right);
858  Gtk::Button *button = new Gtk::Button();
859  button->set_size_request(32,-1);
860  //button->set_name("effect_reset");
861  button->set_tooltip_text(_("Drag'n' Drop Handle"));
862  button->set_relief(Gtk::RELIEF_NONE);
863  button->set_sensitive(sens);
864  al->add(*manage(button));
865  return al;
866 }
867 
868 bool RackBox::on_my_leave_out(GdkEventCrossing *focus) {
869  Glib::RefPtr<Gdk::Window> window = this->get_window();
870  window->set_cursor();
871  return true;
872 }
873 
874 bool RackBox::on_my_enter_in(GdkEventCrossing *focus) {
875  Glib::RefPtr<Gdk::Window> window = this->get_window();
876  Gdk::Cursor cursor(Gdk::HAND1);
877  window->set_cursor(cursor);
878  return true;
879 }
880 
881 bool RackBox::on_my_button_press(GdkEventButton* ev) {
882  if (ev->type == GDK_2BUTTON_PRESS && ev->button == 1) {
883  plugin.display(false, true);
884  }
885  return true;
886 }
887 
888 
889 Gtk::Widget *RackBox::wrap_bar(int left, int right, bool sens) {
890  Gtk::EventBox *ev = new Gtk::EventBox;
891  ev->set_visible_window(false);
892  ev->set_above_child(true);
893  ev->add(*manage(make_bar(left, right, sens)));
894  ev->signal_leave_notify_event().connect(sigc::mem_fun(*this, &RackBox::on_my_leave_out));
895  ev->signal_enter_notify_event().connect(sigc::mem_fun(*this, &RackBox::on_my_enter_in));
896  ev->signal_button_press_event().connect(sigc::mem_fun(*this, &RackBox::on_my_button_press));
897  ev->signal_drag_begin().connect(sigc::mem_fun(*this, &RackBox::on_my_drag_begin));
898  ev->signal_drag_end().connect(sigc::mem_fun(*this, &RackBox::on_my_drag_end));
899  ev->signal_drag_data_get().connect(sigc::mem_fun(*this, &RackBox::on_my_drag_data_get));
900  std::vector<Gtk::TargetEntry> listTargets;
901  listTargets.push_back(Gtk::TargetEntry(target, Gtk::TARGET_SAME_APP, 0));
902  ev->drag_source_set(listTargets, Gdk::BUTTON1_MASK, Gdk::ACTION_MOVE);
903  return ev;
904 }
905 
906 Gtk::Widget *RackBox::create_icon_widget(const PluginUI& plugin, gx_system::CmdlineOptions& options) {
907  Gxw::PaintBox *pb = new Gxw::PaintBox(Gtk::ORIENTATION_HORIZONTAL);
908  RackBox::set_paintbox(*pb, plugin.get_type());
909  Gtk::Widget *effect_label = RackBox::make_label(plugin, options);
910  Gtk::Alignment *al = new Gtk::Alignment(0.0, 0.0, 1.0, 1.0);
911  al->set_padding(0,2,2,0);
912  al->add(*manage(effect_label));
913  pb->pack_start(*manage(al), Gtk::PACK_SHRINK);
914  pb->show_all();
915  return pb;
916 }
917 
918 Gtk::Widget *RackBox::create_drag_widget(const PluginUI& plugin, gx_system::CmdlineOptions& options) {
919  Gxw::PaintBox *pb = new Gxw::PaintBox(Gtk::ORIENTATION_HORIZONTAL);
920  RackBox::set_paintbox_unit_shrink(*pb, plugin.get_type());
921  pb->set_name("drag_widget");
922  if (strcmp(plugin.get_id(), "ampstack") == 0) { // FIXME
923  pb->property_paint_func().set_value("gx_rack_amp_expose");
924  }
925  //Gxw::Switch *swtch = new Gxw::Switch("switchit");
926  //swtch->set_active(plugin.plugin->get_on_off());
927 #ifdef USE_SZG
928  //RackBox::szg->add_widget(*swtch);
929 #else
930  //swtch->set_size_request(35, -1);
931 #endif
932  Gtk::Widget *effect_label = RackBox::make_label(plugin, options);
933  Gtk::Alignment *al = new Gtk::Alignment(0.0, 0.0, 0.0, 0.0);
934  al->set_padding(0,0,4,20);
935  al->add(*manage(RackBox::make_bar(4, 4, true))); // FIXME: fix style and remove sens parameter
936  pb->pack_start(*manage(al), Gtk::PACK_SHRINK);
937  //pb->pack_start(*manage(swtch), Gtk::PACK_SHRINK);
938  pb->pack_start(*manage(effect_label), Gtk::PACK_SHRINK);
939  al = new Gtk::Alignment(0.0, 0.0, 0.0, 0.0);
940  al->set_size_request(70,30);
941  pb->pack_start(*manage(al), Gtk::PACK_SHRINK);
942  pb->show_all();
943  return pb;
944 }
945 
946 void RackBox::display(bool v, bool animate) {
947  assert(box_visible != v);
948  box_visible = v;
949  plugin.set_active(v);
950  if (v) {
951  if (animate) {
952  animate_insert();
953  } else {
954  show();
955  }
956  get_parent()->increment();
957  plugin.hidden_by_move = false;
958  plugin.toolitem->hide();
959  } else {
960  if (animate) {
961  animate_remove();
962  } else {
963  hide();
964  }
965  get_parent()->decrement();
966  plugin.hidden_by_move = true;
967  }
968 }
969 
970 RackBox::RackBox(PluginUI& plugin_, MainWindow& tl, Gtk::Widget* bare)
971  : Gtk::VBox(), plugin(plugin_), main(tl), config_mode(false), anim_tag(),
972  compress(true), delete_button(true), mbox(Gtk::ORIENTATION_HORIZONTAL), minibox(0),
973  fbox(0), target(), anim_height(0), anim_step(), drag_icon(), target_height(0),
974  box(Gtk::ORIENTATION_HORIZONTAL, 2), box_visible(true), on_off_switch("switchit"),
975  toggle_on_off(tl.get_machine(), &on_off_switch, plugin.plugin->id_on_off()) {
976  if (strcmp(plugin.get_id(), "ampstack") != 0) { // FIXME
977  gx_gui::connect_midi_controller(&on_off_switch, plugin.plugin->id_on_off().c_str(), main.get_machine());
978  }
979 #ifdef USE_SZG
980  if (!szg) {
981  szg = Gtk::SizeGroup::create(Gtk::SIZE_GROUP_HORIZONTAL);
982  }
983 #endif
984  if (bare) {
985  compress = false;
986  delete_button = false;
987  }
988  set_paintbox_unit_shrink(mbox, plugin.get_type());
989  init_dnd();
990  minibox = new MiniRackBox(*this, tl.get_options());
991  mbox.pack_start(*manage(minibox));
992  pack_start(mbox, Gtk::PACK_SHRINK);
993  if (bare) {
994  add(*manage(bare));
995  fbox = bare;
996  mbox.property_paint_func().set_value("gx_rack_amp_expose");
997  } else {
998  Gxw::PaintBox *pb = new Gxw::PaintBox(Gtk::ORIENTATION_HORIZONTAL);
999  pb->show();
1000  set_paintbox_unit(*pb, plugin);
1001  pb->pack_start(*manage(make_full_box(tl.get_options())));
1002  pack_start(*manage(pb), Gtk::PACK_SHRINK);
1003  fbox = pb;
1004  }
1005  show();
1006 }
1007 
1008 void RackBox::init_dnd() {
1009  target = "application/x-guitarix-";
1010  if (plugin.get_type() == PLUGIN_TYPE_MONO) {
1011  target += "mono";
1012  } else {
1013  target += "stereo";
1014  }
1015  if (!delete_button) {
1016  target += "-s";
1017  }
1018  mbox.signal_drag_begin().connect(sigc::mem_fun(*this, &RackBox::on_my_drag_begin));
1019  mbox.signal_drag_end().connect(sigc::mem_fun(*this, &RackBox::on_my_drag_end));
1020  mbox.signal_drag_data_get().connect(sigc::mem_fun(*this, &RackBox::on_my_drag_data_get));
1021 }
1022 
1023 void RackBox::enable_drag(bool v) {
1024  if (v) {
1025  std::vector<Gtk::TargetEntry> listTargets;
1026  listTargets.push_back(Gtk::TargetEntry(target, Gtk::TARGET_SAME_APP, 0));
1027  mbox.drag_source_set(listTargets, Gdk::BUTTON1_MASK, Gdk::ACTION_MOVE);
1028  } else {
1029  mbox.drag_source_unset();
1030  }
1031 }
1032 
1033 bool RackBox::animate_vanish() {
1034  anim_height -= anim_step;
1035  if (anim_height <= 0) {
1036  hide();
1037  set_visibility(true);
1038  set_size_request(-1,-1);
1040  return false;
1041  } else {
1042  set_size_request(-1, anim_height);
1043  return true;
1044  }
1045 }
1046 
1047 void RackBox::animate_remove() {
1048  if (!get_parent()->check_if_animate(*this)) {
1049  hide();
1050  } else {
1051  if (anim_tag.connected()) {
1052  //Glib::source_remove(anim_tag);
1053  anim_tag.disconnect();
1054  set_size_request(-1,-1);
1055  show();
1056  }
1057  anim_height = size_request().height;
1058  set_size_request(-1, anim_height);
1059  set_visibility(false);
1060  anim_step = anim_height / 5;
1061  anim_tag = Glib::signal_timeout().connect(sigc::mem_fun(*this, &RackBox::animate_vanish), 20);
1062  }
1063 }
1064 
1066  return dynamic_cast<RackContainer*>(Gtk::VBox::get_parent());
1067 }
1068 
1069 void RackBox::on_my_drag_begin(const Glib::RefPtr<Gdk::DragContext>& context) {
1070  int x, y;
1071  get_pointer(x, y);
1072  drag_icon = new DragIcon(plugin, context, main.get_options(), x);
1073  animate_remove();
1074 }
1075 
1076 bool RackBox::animate_create() {
1077  bool ret = true;
1078  anim_height += anim_step;
1079  if (anim_height >= target_height) {
1080  set_visibility(true);
1081  set_size_request(-1,-1);
1082  ret = false;
1083  } else {
1084  set_size_request(-1, anim_height);
1085  }
1086  get_parent()->ensure_visible(*this);
1087  return ret;
1088 }
1089 
1091  if (!get_parent()->check_if_animate(*this)) {
1092  show();
1093  get_parent()->ensure_visible(*this);
1094  } else {
1095  if (anim_tag.connected()) {
1096  hide();
1097  anim_tag.disconnect();
1098  set_size_request(-1,-1);
1099  }
1100  target_height = size_request().height;
1101  set_size_request(-1,0);
1102  set_visibility(false);
1103  show();
1104  anim_height = 0;
1105  anim_step = target_height / 5;
1106  anim_tag = Glib::signal_timeout().connect(mem_fun(*this, &RackBox::animate_create), 20);
1107  }
1108 }
1109 
1110 void RackBox::on_my_drag_end(const Glib::RefPtr<Gdk::DragContext>& context) {
1111  if (drag_icon) {
1112  delete drag_icon;
1113  drag_icon = 0;
1114  }
1115  if (plugin.plugin->get_box_visible()) {
1116  animate_insert();
1117  }
1118 }
1119 
1120 void RackBox::on_my_drag_data_get(const Glib::RefPtr<Gdk::DragContext>& context, Gtk::SelectionData& selection, int info, int timestamp) {
1121  selection.set(target, plugin.get_id());
1122 }
1123 
1124 void RackBox::vis_switch(Gtk::Widget& a, Gtk::Widget& b) {
1125  a.hide();
1126  b.show();
1127 }
1128 
1129 void RackBox::set_visibility(bool v) {
1130  if (config_mode || get_plug_visible()) {
1131  minibox->set_config_mode(false);
1132  mbox.set_visible(v);
1133  minibox->set_config_mode(config_mode);
1134  } else {
1135  fbox->set_visible(v);
1136  }
1137 }
1138 
1139 void RackBox::swtch(bool mini) {
1140  plugin.plugin->set_plug_visible(mini);
1141  if (!config_mode) {
1142  if (mini) {
1143  vis_switch(*fbox, mbox);
1144  } else {
1145  vis_switch(mbox, *fbox);
1146  }
1147  }
1148 }
1149 
1150 void RackBox::set_config_mode(bool mode) {
1151  config_mode = mode;
1152  if (!can_compress() || !get_plug_visible()) {
1153  if (mode) {
1154  vis_switch(*fbox, mbox);
1155  if (strcmp(plugin.get_id(), "ampstack") == 0) { // FIXME
1156  return;
1157  }
1158  } else {
1159  vis_switch(mbox, *fbox);
1160  }
1161  }
1162  minibox->set_config_mode(mode);
1163  enable_drag(mode);
1164 }
1165 
1166 void RackBox::setOrder(int pos, int post_pre) {
1167  plugin.plugin->set_position(pos);
1168  if (plugin.get_type() == PLUGIN_TYPE_MONO) {
1169  plugin.plugin->set_effect_post_pre(post_pre);
1170  }
1171 }
1172 
1173 void RackBox::do_expand() {
1174  swtch(false);
1175  Glib::signal_idle().connect_once(
1176  sigc::bind(
1177  sigc::mem_fun(get_parent(), &RackContainer::ensure_visible),
1178  sigc::ref(*this)));
1179 }
1180 
1181 Gtk::Button *RackBox::make_expand_button(bool expand) {
1182  const gchar *t;
1183  Gtk::Button *b = new Gtk::Button();
1184  //b->set_relief(Gtk::RELIEF_NONE);
1185  if (expand) {
1186  t = "rack_expand";
1187  b->set_tooltip_text(_("expand effect unit"));
1188  } else {
1189  t = "rack_shrink";
1190  b->set_tooltip_text(_("shrink effect unit"));
1191  }
1192  GtkWidget *l = gtk_image_new_from_stock(t, (GtkIconSize)-1);
1193  b->set_focus_on_click(false);
1194  b->add(*manage(Glib::wrap(l)));
1195  b->set_name("effect_on_off");
1196  if (expand) {
1197  b->signal_clicked().connect(
1198  sigc::mem_fun(*this, &RackBox::do_expand));
1199  } else {
1200  b->signal_clicked().connect(
1201  sigc::bind(sigc::mem_fun(*this, &RackBox::swtch), true));
1202  }
1203  return b;
1204 }
1205 
1206 Gtk::Button *RackBox::make_preset_button() {
1207  Gtk::Button *p = new Gtk::Button();
1208  //p->set_relief(Gtk::RELIEF_NONE);
1209  GtkWidget *l = gtk_image_new_from_stock("rack_preset", (GtkIconSize)-1);
1210  p->add(*manage(Glib::wrap(l)));
1211  p->set_can_default(false);
1212  p->set_can_focus(false);
1213  p->set_tooltip_text(_("manage effect unit presets"));
1214  p->set_name("effect_on_off");
1215  p->signal_clicked().connect(
1216  sigc::mem_fun(plugin, &PluginUI::on_plugin_preset_popup));
1217  return p;
1218 }
1219 
1220 void RackBox::pack(Gtk::Widget *main, Gtk::Widget *mini, const Glib::RefPtr<Gtk::SizeGroup>& szg) {
1221  if (!main) {
1222  return;
1223  }
1224  box.pack_start(*manage(main));
1225  minibox->pack(mini);
1226  szg->add_widget(*fbox);
1227  szg->add_widget(mbox);
1228 }
1229 
1230 Gtk::HBox *RackBox::make_full_box(gx_system::CmdlineOptions& options) {
1231  Gtk::HBox *bx = new Gtk::HBox();
1232  Gtk::Widget *effect_label = make_label(plugin, options, false);
1233 
1234  // overall hbox: drag-button - center vbox - drag button
1235  Gtk::HBox *main = new Gtk::HBox();
1236  // center vbox containing title bar and widgets
1237  Gtk::VBox *center = new Gtk::VBox();
1238  // title vbox on top
1239  Gtk::HBox *top = new Gtk::HBox();
1240 
1241  // spacing for bottom shadow
1242  Gtk::Alignment *al = new Gtk::Alignment();
1243  al->set_padding(0, 4, 0, 0);
1244  al->add(*manage(main));
1245 
1246  main->set_spacing(0);
1247 
1248  center->set_name("rack_unit_center");
1249  center->set_border_width(0);
1250  center->set_spacing(4);
1251  center->pack_start(*manage(top), Gtk::PACK_SHRINK);
1252  center->pack_start(box, Gtk::PACK_EXPAND_WIDGET);
1253 
1254  top->set_spacing(4);
1255  top->set_name("rack_unit_title_bar");
1256 
1257  top->pack_start(on_off_switch, Gtk::PACK_SHRINK);
1258  on_off_switch.set_name("effect_on_off");
1259  top->pack_start(*manage(effect_label), Gtk::PACK_SHRINK);
1260  top->pack_end(*manage(make_expand_button(false)), Gtk::PACK_SHRINK);
1261  if (!(plugin.plugin->get_pdef()->flags & PGN_NO_PRESETS))
1262  top->pack_end(*manage(make_preset_button()), Gtk::PACK_SHRINK);
1263 
1264  main->pack_start(*manage(wrap_bar()), Gtk::PACK_SHRINK);
1265  main->pack_start(*manage(center), Gtk::PACK_EXPAND_WIDGET);
1266  main->pack_end(*manage(wrap_bar()), Gtk::PACK_SHRINK);
1267 
1268  main->set_name(plugin.get_id());
1269  bx->pack_start(*manage(al), Gtk::PACK_EXPAND_WIDGET);
1270  //al->show_all();
1271  bx->show_all();
1272  return bx;
1273 }
1274 
1275 Gtk::VBox *RackBox::switcher_vbox(gx_system::CmdlineOptions& options) {
1276  Gtk::VBox *vbox = new Gtk::VBox();
1277 
1278  Gtk::HBox *hbox = new Gtk::HBox();
1279  vbox->pack_start(*manage(hbox));
1280  Gtk::HBox *hbox2 = new Gtk::HBox();
1281  hbox->pack_start(*manage(hbox2), Gtk::PACK_SHRINK);
1282  Gtk::VBox *vbox2 = new Gtk::VBox();
1283  hbox2->pack_start(*manage(vbox2));
1284  hbox2->pack_start(*manage(wrap_bar(4,4)), Gtk::PACK_SHRINK);
1285 #ifdef USE_SZG
1286  szg->add_widget(&on_off_switch);
1287 #endif
1288  Gtk::Alignment *al = new Gtk::Alignment(0.5, 0.5, 0.0, 0.0);
1289  al->add(on_off_switch);
1290  vbox2->pack_start(*manage(al));
1291  return vbox;
1292 }
1293 
1294 
1295 /****************************************************************
1296  ** class RackContainer
1297  */
1298 
1299 static const int min_containersize = 40;
1300 
1302  : Gtk::VBox(),
1303  tp(tp_),
1304  main(main_),
1305  config_mode(false),
1306  in_drag(-2),
1307  child_count(0),
1308  targets(),
1309  othertargets(),
1310  highlight_connection(),
1311  autoscroll_connection() {
1312  std::vector<std::string> *pm, *ps;
1313  if (tp == PLUGIN_TYPE_MONO) {
1314  pm = &targets;
1315  ps = &othertargets;
1316  } else {
1317  ps = &targets;
1318  pm = &othertargets;
1319  }
1320  pm->push_back("application/x-guitarix-mono");
1321  pm->push_back("application/x-guitarix-mono-s");
1322  pm->push_back("application/x-gtk-tool-palette-item-mono");
1323  ps->push_back("application/x-guitarix-stereo");
1324  ps->push_back("application/x-guitarix-stereo-s");
1325  ps->push_back("application/x-gtk-tool-palette-item-stereo");
1326  std::vector<Gtk::TargetEntry> listTargets;
1327  listTargets.push_back(Gtk::TargetEntry("application/x-guitarix-mono", Gtk::TARGET_SAME_APP, 0));
1328  listTargets.push_back(Gtk::TargetEntry("application/x-guitarix-mono-s", Gtk::TARGET_SAME_APP, 1));
1329  listTargets.push_back(Gtk::TargetEntry("application/x-gtk-tool-palette-item-mono", Gtk::TARGET_SAME_APP, 2));
1330  listTargets.push_back(Gtk::TargetEntry("application/x-guitarix-stereo", Gtk::TARGET_SAME_APP, 3));
1331  listTargets.push_back(Gtk::TargetEntry("application/x-guitarix-stereo-s", Gtk::TARGET_SAME_APP, 4));
1332  listTargets.push_back(Gtk::TargetEntry("application/x-gtk-tool-palette-item-stereo", Gtk::TARGET_SAME_APP, 5));
1333  drag_dest_set(listTargets, Gtk::DEST_DEFAULT_DROP, Gdk::ACTION_MOVE);
1334  main.get_machine().signal_rack_unit_order_changed().connect(
1335  sigc::mem_fun(this, &RackContainer::unit_order_changed));
1336  signal_remove().connect(sigc::mem_fun(*this, &RackContainer::on_my_remove));
1337  set_size_request(-1, min_containersize);
1338  show_all();
1339 }
1340 
1341 void RackContainer::unit_order_changed(bool stereo) {
1342  if (stereo == (tp == PLUGIN_TYPE_STEREO)) {
1343  check_order();
1344  }
1345 }
1346 
1347 bool RackContainer::drag_highlight_expose(GdkEventExpose *event, int y0) {
1348  if (!is_drawable()) {
1349  return false;
1350  }
1351  Cairo::RefPtr<Cairo::Context> cr = Glib::wrap(event->window, true)->create_cairo_context();
1352  int x, y, width, height;
1353  if (!get_has_window()) {
1354  Gtk::Allocation a = get_allocation();
1355  x = a.get_x();
1356  y = a.get_y();
1357  width = a.get_width();
1358  height = a.get_height();
1359  } else {
1360  int depth;
1361  get_window()->get_geometry(x, y, width, height, depth);
1362  x = 0;
1363  y = 0;
1364  }
1365  GdkPixbuf * pb_ = gtk_widget_render_icon(GTK_WIDGET(this->gobj()), "insert", (GtkIconSize)-1, NULL);
1366  if (pb_) {
1367  cairo_t *cr_ = gdk_cairo_create(unwrap(get_window()));
1368  gdk_cairo_set_source_pixbuf(cr_, pb_, x, y);
1369  cairo_pattern_set_extend(cairo_get_source(cr_), CAIRO_EXTEND_REPEAT);
1370  if (y0 < 0) {
1371  cairo_set_line_width(cr_, 4.0);
1372  cairo_rectangle(cr_, x, max(0, y), width, height);
1373  cairo_stroke(cr_);
1374  } else {
1375  cairo_rectangle(cr_, x, max(y, y0 - 3), width, 2);
1376  cairo_fill(cr_);
1377  }
1378  cairo_destroy(cr_);
1379  g_object_unref(pb_);
1380  }
1381  return false;
1382 }
1383 
1384 struct childpos {
1385  int y0, y1, pos;
1386  childpos(int y0_, int y1_, int pos_): y0(y0_), y1(y1_), pos(pos_) {}
1387  bool operator<(const childpos& p) { return y0 < p.y0; }
1388 };
1389 
1390 void RackContainer::find_index(int x, int y, int* len, int *ypos) {
1391  std::list<childpos> l;
1392  std::vector<RackBox*> children = get_children();
1393  int mpos = -1;
1394  for (std::vector<RackBox*>::iterator ch = children.begin(); ch != children.end(); ++ch) {
1395  ++mpos;
1396  if (!(*ch)->get_visible()) {
1397  continue;
1398  }
1399  Gtk::Allocation a = (*ch)->get_allocation();
1400  l.push_back(childpos(a.get_y(), a.get_y()+a.get_height(), mpos));
1401  }
1402  if (l.empty()) {
1403  *len = -1;
1404  *ypos = -1;
1405  return;
1406  }
1407  Gtk::Allocation a0 = get_allocation();
1408  y += a0.get_y();
1409  int sy = l.begin()->y0;
1410  for (std::list<childpos>::iterator cp = l.begin(); cp != l.end(); ++cp) {
1411  if (y < (cp->y0 + cp->y1) / 2) {
1412  *len = cp->pos;
1413  *ypos = (cp->y0+sy)/2;
1414  return;
1415  }
1416  sy = cp->y1;
1417  }
1418  *len = mpos+1;
1419  *ypos = sy;
1420 }
1421 
1422 void RackContainer::on_my_remove(Gtk::Widget *ch) {
1423  decrement();
1424  renumber();
1425 }
1426 
1427 bool RackContainer::check_targets(const std::vector<std::string>& tgts1, const std::vector<std::string>& tgts2) {
1428  for (std::vector<std::string>::const_iterator t1 = tgts1.begin(); t1 != tgts1.end(); ++t1) {
1429  for (std::vector<std::string>::const_iterator t2 = tgts2.begin(); t2 != tgts2.end(); ++t2) {
1430  if (*t1 == *t2) {
1431  return true;
1432  }
1433  }
1434  }
1435  return false;
1436 }
1437 
1438 bool RackContainer::on_drag_motion(const Glib::RefPtr<Gdk::DragContext>& context, int x, int y, guint timestamp) {
1439  const std::vector<std::string>& tg = context->get_targets();
1440  if (!check_targets(tg, targets)) {
1441  if (check_targets(tg, othertargets)) {
1442  if (!autoscroll_connection.connected()) {
1443  autoscroll_connection = Glib::signal_timeout().connect(
1444  sigc::mem_fun(*this, &RackContainer::scrollother_timeout), 50);
1445  }
1446  context->drag_status(Gdk::DragAction(0), timestamp);
1447  return true;
1448  }
1449  return false;
1450  }
1451  context->drag_status(Gdk::ACTION_MOVE, timestamp);
1452  int i, ind;
1453  find_index(x, y, &i, &ind);
1454  if (in_drag == ind) {
1455  return true;
1456  }
1457  if (in_drag > -2) {
1458  highlight_connection.disconnect();
1459  }
1460  highlight_connection = signal_expose_event().connect(sigc::bind(sigc::mem_fun(*this, &RackContainer::drag_highlight_expose), ind), true);
1461  queue_draw();
1462  in_drag = ind;
1463  if (!autoscroll_connection.connected()) {
1464  autoscroll_connection = Glib::signal_timeout().connect(sigc::mem_fun(*this, &RackContainer::scroll_timeout), 50);
1465  }
1466  return true;
1467 }
1468 
1470  Gtk::Allocation alloc = child.get_allocation();
1471  Gtk::Viewport *p = dynamic_cast<Gtk::Viewport*>(get_ancestor(GTK_TYPE_VIEWPORT));
1472  p->get_vadjustment()->clamp_page(alloc.get_y(), alloc.get_y()+alloc.get_height());
1473 }
1474 
1475 static const double scroll_edge_size = 60.0;
1476 static const int step_size = 20;
1477 
1478 bool RackContainer::scrollother_timeout() {
1479  Gtk::Viewport *p = dynamic_cast<Gtk::Viewport*>(get_ancestor(GTK_TYPE_VIEWPORT));
1480  Gtk::Adjustment *a = p->get_vadjustment();
1481  double off = a->get_value();
1482  Gtk::Allocation alloc = get_allocation();
1483  int x, y;
1484  get_pointer(x, y);
1485  y -= alloc.get_height();
1486  double step;
1487  if (y < -scroll_edge_size) {
1488  step = step_size;
1489  } else {
1490  step = step_size * exp(-(y+scroll_edge_size)/(1.0*scroll_edge_size));
1491  if (step < 1.5) {
1492  return false;
1493  }
1494  }
1495  if (tp == PLUGIN_TYPE_MONO) {
1496  off = main.stop_at_stereo_bottom(off, step_size, a->get_page_size());
1497  } else {
1498  off = main.stop_at_mono_top(off, step_size);
1499  }
1500  if (off < a->get_lower()) {
1501  off = a->get_lower();
1502  }
1503  if (off > a->get_upper() - a->get_page_size()) {
1504  off = a->get_upper() - a->get_page_size();
1505  }
1506  a->set_value(off);
1507  return true;
1508 }
1509 
1510 bool RackContainer::scroll_timeout() {
1511  Gtk::Viewport *p = dynamic_cast<Gtk::Viewport*>(get_ancestor(GTK_TYPE_VIEWPORT));
1512  Gtk::Adjustment *a = p->get_vadjustment();
1513  double off = a->get_value();
1514  Gtk::Allocation alloc = get_allocation();
1515  int x, y;
1516  get_pointer(x, y);
1517  double sez = scroll_edge_size;
1518  if (sez > a->get_page_size() / 3) {
1519  sez = a->get_page_size() / 3;
1520  }
1521  double yw = y + alloc.get_y() - off;
1522  double step;
1523  if (yw <= sez) {
1524  step = step_size * (sez-yw) / sez;
1525  off = max(double(alloc.get_y()), off-step);
1526  } else {
1527  yw = a->get_page_size() - yw;
1528  if (yw <= sez) {
1529  step = step_size * (sez-yw) / sez;
1530  off = min(alloc.get_y()+alloc.get_height()-a->get_page_size(), off+step);
1531  } else {
1532  return true;
1533  }
1534  }
1535  if (off < a->get_lower()) {
1536  off = a->get_lower();
1537  }
1538  if (off > a->get_upper() - a->get_page_size()) {
1539  off = a->get_upper() - a->get_page_size();
1540  }
1541  a->set_value(off);
1542  return true;
1543 }
1544 
1545 void RackContainer::on_drag_leave(const Glib::RefPtr<Gdk::DragContext>& context, guint timestamp) {
1546  if (in_drag > -2) {
1547  highlight_connection.disconnect();
1548  queue_draw();
1549  in_drag = -2;
1550  }
1551  autoscroll_connection.disconnect();
1552 }
1553 
1554 void RackContainer::on_drag_data_received(const Glib::RefPtr<Gdk::DragContext>& context, int x, int y, const Gtk::SelectionData& data, guint info, guint timestamp) {
1555  int i, ind;
1556  find_index(x, y, &i, &ind);
1557  std::string dtype = data.get_data_type();
1558  if (dtype == "application/x-gtk-tool-palette-item-mono" || dtype == "application/x-gtk-tool-palette-item-stereo") {
1559  main.get_plugin(data.get_data_as_string())->display_new(true);
1560  }
1561  reorder(data.get_data_as_string(), i);
1562 }
1563 
1565  for (PluginDict::iterator i = main.plugins_begin(); i != main.plugins_end(); ++i) {
1566  i->second->hidden = false;
1567  if (!i->second->hidden_by_move) {
1568  RackBox *r = i->second->rackbox;
1569  if (r) {
1570  r->show();
1571  }
1572  }
1573  }
1574 }
1575 
1577  for (PluginDict::iterator i = main.plugins_begin(); i != main.plugins_end(); ++i) {
1578  i->second->hidden = true;
1579  RackBox *r = i->second->rackbox;
1580  if (r) {
1581  if (r->can_compress()) {
1582  r->hide();
1583  }
1584  }
1585  }
1586 }
1587 
1588 void RackContainer::reorder(const std::string& name, unsigned int pos) {
1589  std::vector<RackBox*> l = get_children();
1590  main.get_machine().insert_rack_unit(name, ((pos >= l.size()) ? "" : l[pos]->get_id()), tp);
1591  check_order();
1592 }
1593 
1594 void RackContainer::on_add(Widget *ch) {
1595  add(*dynamic_cast<RackBox*>(ch));
1596 }
1597 
1598 void RackContainer::add(RackBox& r, int pos) {
1599  pack_start(r, Gtk::PACK_SHRINK);
1600  increment();
1601  if (config_mode) {
1602  r.set_config_mode(true);
1603  }
1604  reorder_child(r, pos);
1605  renumber();
1606 }
1607 
1609  ++child_count;
1610  if (child_count == 1) {
1611  set_size_request(-1, -1);
1612  }
1613 }
1614 
1616  --child_count;
1617  assert(child_count >= 0);
1618  if (child_count == 0) {
1619  set_size_request(-1, min_containersize);
1620  }
1621 }
1622 
1624  config_mode = mode;
1625  std::vector<RackBox*> l = get_children();
1626  for (std::vector<RackBox*>::iterator c = l.begin(); c != l.end(); ++c) {
1627  (*c)->set_config_mode(mode);
1628  }
1629 }
1630 
1632  const std::vector<std::string>& ol = main.get_machine().get_rack_unit_order(tp);
1633  bool in_order = true;
1634  std::set<std::string> unit_set(ol.begin(), ol.end());
1635  rackbox_list l = get_children();
1636  std::vector<std::string>::const_iterator oi = ol.begin();
1637  for (rackbox_list::iterator c = l.begin(); c != l.end(); ++c) {
1638  if (!(*c)->get_box_visible()) {
1639  continue;
1640  }
1641  if (unit_set.find((*c)->get_id()) == unit_set.end()) {
1642  main.get_plugin((*c)->get_id())->hide(false);
1643  continue;
1644  }
1645  if (!in_order) {
1646  continue;
1647  }
1648  if (oi == ol.end()) {
1649  in_order = false;
1650  continue;
1651  }
1652  if (*oi != (*c)->get_id()) {
1653  in_order = false;
1654  }
1655  ++oi;
1656  }
1657  if (oi != ol.end()) {
1658  in_order = false;
1659  }
1660  if (in_order) {
1661  return;
1662  }
1663  int n = 0;
1664  for (std::vector<std::string>::const_iterator oi = ol.begin(); oi != ol.end(); ++oi) {
1665  PluginUI *p = main.get_plugin(*oi);
1666  if (!p->rackbox) {
1667  p->show(false);
1668  } else {
1669  if (!p->rackbox->get_box_visible()) {
1670  p->rackbox->display(true, false);
1671  if (p->hidden) {
1672  p->rackbox->hide();
1673  }
1674  }
1675  }
1676  reorder_child(*p->rackbox, n++);
1677  }
1678  renumber();
1679 }
1680 
1681 void RackContainer::renumber() {
1682  rackbox_list l = get_children();
1683  int pos = 0;
1684  unsigned int post_pre = 1;
1685  for (rackbox_list::iterator c = l.begin(); c != l.end(); ++c, ++pos) {
1686  if (strcmp((*c)->get_id(), "ampstack") == 0) { // FIXME
1687  pos = 0;
1688  post_pre = 0;
1689  continue;
1690  }
1691  (*c)->setOrder(pos, post_pre);
1692  }
1693 }
gx_engine::Plugin::get_box_visible
bool get_box_visible() const
Definition: gx_pluginloader.h:61
DragIcon::~DragIcon
~DragIcon()
Definition: rack.cpp:280
RackContainer::resize_finished
void resize_finished()
Definition: gx_main_window.h:850
TextListStore
Definition: rack.cpp:590
gx_engine::GxMachineBase::parameter_hasId
virtual bool parameter_hasId(const char *p)=0
MainWindow::add_icon
void add_icon(const std::string &name)
Definition: gx_main_window.cpp:1009
RackBox::swtch
void swtch(bool mini)
Definition: rack.cpp:1139
MainWindow::plugin_preset_popup
void plugin_preset_popup(const PluginDef *pdef)
Definition: gx_main_window.cpp:1835
gx_engine::Plugin::set_plug_visible
void set_plug_visible(bool v) const
Definition: gx_pluginloader.h:67
PluginUI::tooltip
Glib::ustring tooltip
Definition: gx_main_window.h:159
PluginUI::get_shortname
const char * get_shortname() const
Definition: gx_main_window.h:193
childpos::y1
int y1
Definition: rack.cpp:1385
PluginPresetPopup::begin
gx_preset::UnitPresetList::const_iterator begin()
Definition: gx_main_window.h:486
gx_engine::GxMachineBase::get_options
virtual gx_system::CmdlineOptions & get_options() const =0
gx_engine::GxMachineBase::insert_rack_unit
virtual void insert_rack_unit(const std::string &unit, const std::string &before, PluginType type)=0
gx_engine::GxMachineBase
Definition: machine.h:53
gx_engine::Plugin::set_box_visible
void set_box_visible(bool v) const
Definition: gx_pluginloader.h:66
gx_engine::GxMachineBase::plugin_preset_list_set
virtual void plugin_preset_list_set(const PluginDef *pdef, bool factory, const Glib::ustring &name)=0
RackBox::set_config_mode
void set_config_mode(bool mode)
Definition: rack.cpp:1150
Gxw::PaintBox
Definition: paintbox.h:42
gx_engine::GxMachineBase::plugin_preset_list_save
virtual void plugin_preset_list_save(const PluginDef *pdef, const Glib::ustring &name)=0
MiniRackBox::MiniRackBox
MiniRackBox(RackBox &rb, gx_system::CmdlineOptions &options)
Definition: rack.cpp:379
PluginUI::on_plugin_preset_popup
virtual void on_plugin_preset_popup()
Definition: rack.cpp:82
PluginPresetPopup::PluginPresetPopup
PluginPresetPopup(const PluginDef *pdef, gx_engine::GxMachineBase &machine, const Glib::ustring &save_name_default="")
Definition: rack.cpp:778
PluginPresetPopup::end
gx_preset::UnitPresetList::const_iterator end()
Definition: gx_main_window.h:487
RackContainer
Definition: gx_main_window.h:350
PluginUI::display
void display(bool v, bool animate)
Definition: rack.cpp:137
PluginType
PluginType
Definition: machine.h:34
RackContainer::rackbox_list
Glib::ListHandle< RackBox * > rackbox_list
Definition: gx_main_window.h:379
TextListStore::col
TextListStore::TextListColumns col
plugins_by_name_less
bool plugins_by_name_less(PluginUI *a, PluginUI *b)
Definition: rack.cpp:187
PluginPresetPopup::get_pdef
const PluginDef * get_pdef()
Definition: gx_main_window.h:488
RackBox::get_plug_visible
bool get_plug_visible()
Definition: gx_main_window.h:322
PluginDict::~PluginDict
~PluginDict()
Definition: rack.cpp:221
gx_engine::GxMachineBase::pluginlist_lookup_plugin
virtual Plugin * pluginlist_lookup_plugin(const std::string &id) const =0
RackBox::setOrder
void setOrder(int pos, int post_pre)
Definition: rack.cpp:1166
gx_engine::Plugin::get_plug_visible
bool get_plug_visible() const
Definition: gx_pluginloader.h:62
gx_engine::GxMachineBase::set_parameter_value
virtual void set_parameter_value(const std::string &id, int value)=0
PluginUI
Definition: gx_main_window.h:152
min
#define min(x, y)
Definition: gx_faust_support.h:6
RackBox::can_compress
bool can_compress()
Definition: gx_main_window.h:312
PluginPresetListWindow::~PluginPresetListWindow
~PluginPresetListWindow()
Definition: rack.cpp:630
PluginUI::hidden
bool hidden
Definition: gx_main_window.h:169
RackContainer::check_order
void check_order()
Definition: rack.cpp:1631
PluginDef
Definition: gx_plugin.h:183
InputWindow::run
void run()
Definition: rack.cpp:582
PluginUI::hide
void hide(bool animate)
Definition: rack.cpp:116
childpos::childpos
childpos(int y0_, int y1_, int pos_)
Definition: rack.cpp:1386
RackContainer::increment
void increment()
Definition: rack.cpp:1608
RackContainer::show_entries
void show_entries()
Definition: rack.cpp:1564
max
#define max(x, y)
Definition: gx_faust_support.h:5
gx_engine::Plugin::set_position
void set_position(int v) const
Definition: gx_pluginloader.h:69
RackBox::MiniRackBox
friend class MiniRackBox
Definition: gx_main_window.h:313
InputWindow::get_name
Glib::ustring & get_name()
Definition: rack.cpp:535
PluginUI::is_registered
static bool is_registered(gx_engine::GxMachineBase &m, const char *name)
Definition: rack.cpp:86
MainWindow::get_machine
gx_engine::GxMachineBase & get_machine()
Definition: gx_main_window.h:838
MainWindow::get_options
gx_system::CmdlineOptions & get_options()
Definition: gx_main_window.h:835
RackContainer::ensure_visible
void ensure_visible(RackBox &child)
Definition: rack.cpp:1469
MiniRackBox::pack
void pack(Gtk::Widget *w)
Definition: rack.cpp:478
MainWindow::hide_effect
void hide_effect(const std::string &name)
Definition: gx_main_window.cpp:1117
PluginUI::hidden_by_move
bool hidden_by_move
Definition: gx_main_window.h:170
gx_engine::GxMachineBase::plugin_preset_list_load
virtual void plugin_preset_list_load(const PluginDef *pdef, gx_preset::UnitPresetList &presetnames)=0
PluginUI::set_action
void set_action(Glib::RefPtr< Gtk::ToggleAction > &act)
Definition: rack.cpp:99
RackContainer::reorder
void reorder(const std::string &name, unsigned int pos)
Definition: rack.cpp:1588
PluginUI::show
void show(bool animate)
Definition: rack.cpp:124
RackBox::pack
void pack(Gtk::Widget *mainbox, Gtk::Widget *minibox, const Glib::RefPtr< Gtk::SizeGroup > &szg)
Definition: rack.cpp:1220
gx_engine::GxMachineBase::remove_rack_unit
virtual void remove_rack_unit(const std::string &unit, PluginType type)=0
Glib::wrap
Gxw::BigKnob * wrap(GxBigKnob *object, bool take_copy)
Definition: bigknob.cc:44
gx_engine::Plugin::id_on_off
const std::string & id_on_off() const
Definition: gx_pluginloader.h:73
PluginUI::plugin
gx_engine::Plugin * plugin
Definition: gx_main_window.h:158
RackBox::create_icon_widget
static Gtk::Widget * create_icon_widget(const PluginUI &plugin, gx_system::CmdlineOptions &options)
Definition: rack.cpp:906
PluginUI::toolitem
Gtk::ToolItem * toolitem
Definition: gx_main_window.h:165
PluginUI::get_type
PluginType get_type() const
Definition: gx_main_window.h:175
gx_engine
Definition: gx_convolver.h:33
gx_engine::Plugin::set_on_off
void set_on_off(bool v) const
Definition: gx_pluginloader.h:68
RackContainer::RackContainer
RackContainer(PluginType tp, MainWindow &main)
Definition: rack.cpp:1301
PluginPresetPopup
Definition: gx_main_window.h:468
gx_engine::Plugin::get_pdef
PluginDef * get_pdef()
Definition: gx_pluginloader.h:55
PluginUI::unset_ui_merge_id
void unset_ui_merge_id(Glib::RefPtr< Gtk::UIManager > uimanager)
Definition: rack.cpp:75
PluginUI::set_active
void set_active(bool v)
Definition: gx_main_window.h:185
gx_engine::GxMachineBase::parameter_unit_has_std_values
virtual bool parameter_unit_has_std_values(const PluginDef *pdef) const =0
DragIcon
Definition: gx_main_window.h:235
PluginPresetListWindow::run
void run()
Definition: rack.cpp:691
PluginUI::main
MainWindow & main
Definition: gx_main_window.h:167
PluginUI::group
Gtk::ToolItemGroup * group
Definition: gx_main_window.h:164
PluginUI::get_id
const char * get_id() const
Definition: gx_main_window.h:178
PluginDict::remove
void remove(PluginUI *p)
Definition: rack.cpp:208
gx_engine::GxMachineBase::plugin_preset_list_sync_set
virtual void plugin_preset_list_sync_set(const PluginDef *pdef, bool factory, const Glib::ustring &name)=0
InputWindow::create
static InputWindow * create(const gx_system::CmdlineOptions &options, const Glib::ustring &save_name_default)
Definition: rack.cpp:544
gx_engine::Plugin::set_effect_post_pre
void set_effect_post_pre(int v) const
Definition: gx_pluginloader.h:70
PluginDef::description
const char * description
Definition: gx_plugin.h:191
gx_engine::PGNI_UI_REG
@ PGNI_UI_REG
Definition: gx_pluginloader.h:44
RackBox::animate_insert
void animate_insert()
Definition: rack.cpp:1090
RackBox::RackBox
RackBox(PluginUI &plugin, MainWindow &main, Gtk::Widget *bare=0)
Definition: rack.cpp:970
MiniRackBox::set_config_mode
void set_config_mode(bool mode)
Definition: rack.cpp:484
gx_engine::GxMachineBase::reset_unit
virtual void reset_unit(const PluginDef *pdef) const =0
TextListStore::TextListColumns::TextListColumns
TextListColumns()
Definition: rack.cpp:595
PluginUI::update_rackbox
void update_rackbox()
Definition: rack.cpp:164
PluginDict::compress
void compress(bool state)
Definition: rack.cpp:225
childpos::pos
int pos
Definition: rack.cpp:1385
gx_system::BasicOptions::get_builder_filepath
std::string get_builder_filepath(const std::string &basename) const
Definition: gx_system.h:373
childpos
Definition: rack.cpp:1384
PluginDef::id
const char * id
Definition: gx_plugin.h:187
PluginPresetPopup::get_machine
gx_engine::GxMachineBase & get_machine()
Definition: gx_main_window.h:489
RackContainer::decrement
void decrement()
Definition: rack.cpp:1615
PluginUI::compress
void compress(bool state)
Definition: rack.cpp:90
MainWindow::add_rackbox
RackBox * add_rackbox(PluginUI &pl, bool mini=false, int pos=-1, bool animate=false)
Definition: gx_main_window.cpp:995
RackContainer::hide_entries
void hide_entries()
Definition: rack.cpp:1576
PluginDef::flags
int flags
Definition: gx_plugin.h:185
TextListStore::create
static Glib::RefPtr< TextListStore > create()
Definition: rack.cpp:602
PluginUI::display_new
void display_new(bool unordered=false)
Definition: rack.cpp:153
InputWindow::~InputWindow
~InputWindow()
Definition: rack.cpp:541
gx_system::CmdlineOptions
Definition: gx_system.h:381
convert_color_channel
guint8 convert_color_channel(guint8 src, guint8 alpha)
Definition: rack.cpp:236
PLUGIN_TYPE_STEREO
@ PLUGIN_TYPE_STEREO
Definition: machine.h:36
PluginUI::rackbox
RackBox * rackbox
Definition: gx_main_window.h:168
RackBox
Definition: gx_main_window.h:259
PluginPresetListWindow::create
static PluginPresetListWindow * create(const gx_system::CmdlineOptions &options, PluginPresetPopup &p)
Definition: rack.cpp:633
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:276
PLUGIN_TYPE_MONO
@ PLUGIN_TYPE_MONO
Definition: machine.h:35
InputWindow
Definition: rack.cpp:520
PluginUI::PluginUI
PluginUI(MainWindow &main, const char *id_, const Glib::ustring &tooltip_="")
Definition: rack.cpp:44
PluginPresetListWindow
Definition: rack.cpp:605
end
CmdConnection::msg_type end
Definition: jsonrpc.cpp:258
RackBox::create_drag_widget
static Gtk::Widget * create_drag_widget(const PluginUI &plugin, gx_system::CmdlineOptions &options)
Definition: rack.cpp:918
convert_bgra_to_rgba
void convert_bgra_to_rgba(guint8 const *src, guint8 *dst, int width, int height)
Definition: rack.cpp:240
TextListStore::TextListColumns::name
Gtk::TreeModelColumn< Glib::ustring > name
Definition: rack.cpp:594
PGN_NO_PRESETS
@ PGN_NO_PRESETS
Definition: gx_plugin.h:175
RackBox::get_box_visible
bool get_box_visible()
Definition: gx_main_window.h:323
PluginDict::cleanup
void cleanup()
Definition: rack.cpp:214
PluginDict::add
void add(PluginUI *p)
Definition: rack.cpp:204
RackContainer::set_config_mode
void set_config_mode(bool mode)
Definition: rack.cpp:1623
childpos::y0
int y0
Definition: rack.cpp:1385
MainWindow
Definition: gx_main_window.h:585
RackContainer::add
void add(RackBox &r, int pos=-1)
Definition: rack.cpp:1598
PluginPresetPopup::on_selection_done
virtual void on_selection_done()
Definition: rack.cpp:771
PluginDict::iterator
std::map< std::string, PluginUI * >::iterator iterator
Definition: gx_main_window.h:220
guitarix.h
PluginUI::~PluginUI
virtual ~PluginUI()
Definition: rack.cpp:64
gx_engine::GxMachineBase::insert_param
virtual void insert_param(Glib::ustring group, Glib::ustring name)=0
GDK_KEY_Escape
#define GDK_KEY_Escape
Definition: guitarix.h:53
gx_engine::GxMachineBase::plugin_preset_list_remove
virtual void plugin_preset_list_remove(const PluginDef *pdef, const Glib::ustring &name)=0
RackContainer::get_children
rackbox_list get_children()
Definition: gx_main_window.h:381
main
int main(int argc, char *argv[])
Definition: gxw_demo.cc:67
childpos::operator<
bool operator<(const childpos &p)
Definition: rack.cpp:1387
DragIcon::DragIcon
DragIcon(const PluginUI &plugin, Glib::RefPtr< Gdk::DragContext > context, gx_system::CmdlineOptions &options, int xoff=0)
Definition: rack.cpp:255
PluginUI::get_name
const char * get_name() const
Definition: gx_main_window.h:179
TextListStore::TextListColumns
Definition: rack.cpp:592
RackBox::display
void display(bool v, bool animate)
Definition: rack.cpp:946
RackBox::get_parent
RackContainer * get_parent()
Definition: rack.cpp:1065