Guitarix
gx_stackbox_builder.cpp
Go to the documentation of this file.
1 #include "guitarix.h" // NOLINT
2 
3 #include <glibmm/i18n.h> // NOLINT
4 
5 // -------- the gx_head user interface build instruktions
6 
7 namespace gx_gui {
8 
9 // Paint Functions for Gxw::PaintBox
10 
11 const char *pb_gx_rack_amp_expose = "gx_rack_amp_expose";
12 const char *pb_rectangle_skin_color_expose = "rectangle_skin_color_expose";
13 const char *pb_zac_expose = "zac_expose";
14 const char *pb_gxhead_expose = "gxhead_expose";
15 const char *pb_RackBox_expose = "RackBox_expose";
16 const char *pb_gxrack_expose = "gxrack_expose";
17 const char *pb_level_meter_expose = "level_meter_expose";
18 
19 
20 int precision(double n) {
21  if (n < 0.009999)
22  return 3;
23  else if (n < 0.099999)
24  return 2;
25  else if (n < 0.999999)
26  return 1;
27  else
28  return 0;
29 }
30 
31 string fformat(float value, float step) {
32  ostringstream buf;
33  buf << fixed << setprecision(precision(step)) << value;
34  return buf.str();
35 }
36 
37 bool button_press_cb(GdkEventButton *event, gx_engine::GxMachineBase& machine, const std::string& id) {
38  if (event->button == 2) {
39  if (!machine.midi_get_config_mode()) {
40  new gx_main_midi::MidiConnect(event, machine.get_parameter(id), machine);
41  }
42  return true;
43  }
44  return false;
45 }
46 
47 
48 /****************************************************************
49  ** class WidgetStack
50  */
51 
52 void WidgetStack::container_add(Gtk::Widget *w) {
53  dynamic_cast<Gtk::Container*>(top())->add(*w);
54 }
55 
56 void WidgetStack::box_pack_start(Gtk::Widget *w, bool expand, bool fill, int padding) {
57  dynamic_cast<Gtk::Box*>(top())->pack_start(*w, expand, fill, padding);
58 }
59 
60 void WidgetStack::notebook_append_page(Gtk::Widget *w, Gtk::Widget *label) {
61  dynamic_cast<Gtk::Notebook*>(top())->append_page(*w, *label);
62 }
63 
64 Gtk::Widget *WidgetStack::add(Gtk::Widget *w, const Glib::ustring& label) {
65  w->show();
66  Gtk::Widget *t = top();
67  Gtk::Notebook *n = dynamic_cast<Gtk::Notebook*>(t);
68  if (n) {
69  n->append_page(*w, *manage(new Gtk::Label(label)));
70  return w;
71  }
72  Gtk::Box *b = dynamic_cast<Gtk::Box*>(t);
73  if (b) {
74  b->pack_start(*w, true, true, 0);
75  return w;
76  }
77  Gtk::Container *c = dynamic_cast<Gtk::Container*>(t);
78  if (c) {
79  c->add(*w);
80  return w;
81  }
82  assert(false);
83  return w;
84 }
85 
86 /****************************************************************
87  ** class StackBoxBuilder
88  */
89 
91  gx_engine::GxMachineBase& machine_, Gxw::WaveView &fWaveView_, Gtk::Label &convolver_filename_label_,
92  Gtk::Label &convolver_mono_filename_label_, Glib::RefPtr<Gdk::Pixbuf> window_icon_)
93  : fBox(), machine(machine_),
94  fWaveView(fWaveView_), convolver_filename_label(convolver_filename_label_),
95  convolver_mono_filename_label(convolver_mono_filename_label_),
96  widget(), accels(), window_icon(window_icon_), next_flags(0) {
97 }
98 
100 }
101 
102 void StackBoxBuilder::openVerticalMidiBox(const char* label) {
103  openVerticalBox(label);
104 }
105 
107  widget = new Gtk::HBox();
108  widget->show();
109  fBox.push(manage(widget));
110 }
111 
112 #ifndef NDEBUG
113 void wnotify(gpointer data, GObject *where_the_object_was) {
114  printf("WN %p %p\n", where_the_object_was, data);
115 }
116 
117 // check if object will be finalized
118 void trace_finalize(Glib::Object *o, int n) {
119  g_object_weak_ref(o->gobj(), wnotify, GINT_TO_POINTER(n));
120 }
121 #endif
122 
123 void StackBoxBuilder::fetch(Gtk::Widget*& mainbox, Gtk::Widget*& minibox) {
124  fBox.pop();
125  assert(fBox.empty());
126  mainbox = widget;
127  Glib::ListHandle<Gtk::Widget*> l = widget->get_children();
128  if (l.size() == 2) {
129  Glib::ListHandle<Gtk::Widget*>::iterator i = l.begin();
130  minibox = new Gtk::VBox();
131  minibox->show();
132  (*i)->show();
133  (*i)->reparent(*minibox);
134  } else {
135  minibox = 0;
136  }
137 }
138 
139 void StackBoxBuilder::get_box(const std::string& name, Gtk::Widget*& mainbox, Gtk::Widget*& minibox) {
140  struct {
141  const char *name;
142  void (StackBoxBuilder::*func)();
143  } mapping[] = {
144  // mono
145  { "oscilloscope", &StackBoxBuilder::make_rackbox_oscilloscope },
146  { "jconv_mono", &StackBoxBuilder::make_rackbox_jconv_mono },
149  // stereo
151  };
152  mainbox = minibox = 0;
153  for (unsigned int i = 0; i < sizeof(mapping) / sizeof(mapping[0]); ++i) {
154  if (name == mapping[i].name) {
155  prepare();
156  (this->*mapping[i].func)();
157  fetch(mainbox, minibox);
158  }
159  }
160 }
161 
162 void StackBoxBuilder::loadRackFromBuilder(const Glib::RefPtr<GxBuilder>& bld) {
163  if (!bld->has_object("rackbox")) {
164  gx_print_error("load_ui Error", "can't find widget 'rackbox'");
165  return;
166  }
167  Gtk::Widget* w;
168  if (bld->has_object("minibox")) {
169  bld->find_widget("minibox", w);
170  fBox.add(w);
171  }
172  bld->find_widget("rackbox", w);
173  fBox.add(w);
174 
175  // find fastmeters in glade UI's and add a timeout callback to set the levels
176  // fastmeters must have id=gxfastmeterN were N starts with 1
177  std::string id;
178  for (int i = 1; i<12;++i) {
179  Glib::ustring fm = "gxfastmeter" + gx_system::to_string(i);
180  if (bld->has_object(fm)) {
181  Gxw::FastMeter *fastmeter;
182  bld->find_widget(fm, fastmeter);
183  fastmeter->get_property("var_id",id);
184  fastmeter->set_name("simplemeter");
185  if (!id.empty())
186  Glib::signal_timeout().connect(sigc::bind<Gxw::FastMeter*>(sigc::bind<const std::string>(
187  sigc::mem_fun(*this, &StackBoxBuilder::set_simple),id), fastmeter), 60);
188  fastmeter->set_by_power(0.0001);
189  } else {
190  break;
191  }
192  }
193  for (int i = 1; i<12;++i) {
194  Glib::ustring fm = "gxfastmeter" + gx_system::to_string(i)+ ":meterframe";
195  if (bld->has_object(fm)) {
196  Gxw::FastMeter *fastmeter;
197  bld->find_widget(fm, fastmeter);
198  fastmeter->get_property("var_id",id);
199  //fastmeter->set_name("meterframe");
200  if (!id.empty())
201  Glib::signal_timeout().connect(sigc::bind<Gxw::FastMeter*>(sigc::bind<const std::string>(
202  sigc::mem_fun(*this, &StackBoxBuilder::set_simple),id), fastmeter), 60);
203  fastmeter->set_by_power(0.0001);
204  } else {
205  break;
206  }
207  }
208  for (int i = 1; i<12;++i) {
209  Glib::ustring fm = "gxcompressormeter" + gx_system::to_string(i);
210  if (bld->has_object(fm)) {
211  Gxw::FastMeter *fastmeter;
212  bld->find_widget(fm, fastmeter);
213  fastmeter->get_property("var_id",id);
214  fastmeter->set_name("simplemeter");
215  if (!id.empty())
216  Glib::signal_timeout().connect(sigc::bind<Gxw::FastMeter*>(sigc::bind<const std::string>(
217  sigc::mem_fun(*this, &StackBoxBuilder::set_compressor_level),id), fastmeter), 60);
218  fastmeter->set_c_level(0.0);
219  } else {
220  break;
221  }
222  }
223  for (int i = 1; i<12;++i) {
224  Glib::ustring fm = "gxportdisplay" + gx_system::to_string(i);
225  if (bld->has_object(fm)) {
226  Gxw::PortDisplay *regler;
227  bld->find_widget(fm, regler);
228  regler->get_property("var_id",id);
229  if (!id.empty())
230  Glib::signal_timeout().connect(sigc::bind<const std::string>(
231  sigc::mem_fun(*this, &StackBoxBuilder::set_engine_value),id), 60);
232  } else {
233  break;
234  }
235  }
236  // find feedback switches and connect a timeout callback to update the UI elements.
237  // feedback switches must have the id gxfswitchN were N starts with 1
238  for (int i = 1; i<12;++i) {
239  Glib::ustring fm = "gxfswitch" + gx_system::to_string(i);
240  if (bld->has_object(fm)) {
241  Gxw::Switch *sw;
242  bld->find_widget(fm, sw);
243  sw->get_property("var_id",id);
244  sw->set_name("effect_on_off");
245  if (!id.empty())
246  Glib::signal_timeout().connect(sigc::bind<Gxw::Switch*>(sigc::bind<const std::string>(
247  sigc::mem_fun(*this, &StackBoxBuilder::set_engine_cp_value),id),sw), 60);
248  } else {
249  break;
250  }
251  }
252  // find feedback Regler and connect a timeout callback to update the UI elements.
253  // were Regler could be GxKnob's or GxSlider's
254  // feedback Regler must have the id gxfreglerN were N starts with 1
255  for (int i = 1; i<12;++i) {
256  Glib::ustring fm = "gxfregler" + gx_system::to_string(i);
257  if (bld->has_object(fm)) {
258  Gxw::Regler *regler;
259  bld->find_widget(fm, regler);
260  regler->get_property("var_id",id);
261  if (!id.empty())
262  Glib::signal_timeout().connect(sigc::bind<Gxw::Regler*>(sigc::bind<const std::string>(
263  sigc::mem_fun(*this, &StackBoxBuilder::set_regler_cp_value),id),regler), 60);
264  } else {
265  break;
266  }
267  }
268 }
269 
270 static const char *rackbox_ids[] = { "rackbox", "minibox", 0 };
271 
272 void StackBoxBuilder::loadRackFromGladeFile(const char *fname) {
273  loadRackFromBuilder(
274  GxBuilder::create_from_file(
275  machine.get_options().get_builder_filepath(fname), &machine, rackbox_ids));
276 }
277 
278 void StackBoxBuilder::loadRackFromGladeData(const char *xmldesc) {
279  loadRackFromBuilder(GxBuilder::create_from_string(xmldesc, &machine, rackbox_ids));
280 }
281 
282 void StackBoxBuilder::addwidget(Gtk::Widget *widget) {
283  if (widget) {
284  fBox.container_add(manage(widget));
285  }
286  next_flags = 0;
287 }
288 
289 void StackBoxBuilder::addSmallJConvFavButton(const char* label, gx_jconv::IRWindow *irw) {
290  Gtk::Button *button = new Gtk::Button();
291  button->set_name("smallbutton");
292  Gtk::Label *lab = new Gtk::Label(label);
293  Pango::FontDescription font = lab->get_style()->get_font();
294  font.set_size(7*Pango::SCALE);
295  font.set_weight(Pango::WEIGHT_NORMAL);
296  lab->modify_font(font);
297  button->add(*manage(lab));
298  //lab->set_name("rack_label_inverse");
299  lab->set_padding(5,0);
300  fBox.add(manage(button), label);
301  lab->show();
302  button->signal_clicked().connect(
303  sigc::mem_fun(*irw, &gx_jconv::IRWindow::reload_and_show));
304 }
305 
306 void StackBoxBuilder::set_convolver_filename(const gx_engine::GxJConvSettings *jcs) {
307  convolver_filename_label.set_label(jcs->getIRFile());
308 }
309 
310 void StackBoxBuilder::set_convolver_mono_filename(const gx_engine::GxJConvSettings *jcs) {
311  convolver_mono_filename_label.set_label(jcs->getIRFile());
312 }
313 
314 void StackBoxBuilder::openSetLabelBox() {
315  Gtk::VBox *box = new Gtk::VBox();
316  box->set_homogeneous(false);
317  box->set_spacing(0);
318  box->set_border_width(0);
319  convolver_filename_label.set_name("rack_label");
320  Pango::FontDescription font = convolver_filename_label.get_style()->get_font();
321  font.set_size(8*Pango::SCALE);
322  font.set_weight(Pango::WEIGHT_BOLD);
323  convolver_filename_label.modify_font(font);
324  box->pack_start(convolver_filename_label, false, false, 0);
325  box->show_all();
326  gx_engine::JConvParameter *jcp = dynamic_cast<gx_engine::JConvParameter*>(&machine.get_parameter("jconv.convolver"));
327  assert(jcp);
328  convolver_filename_label.set_label(jcp->get_value().getIRFile());
329  jcp->signal_changed().connect(
330  sigc::mem_fun(*this, &StackBoxBuilder::set_convolver_filename));
331  fBox.box_pack_start(manage(box), false);
332  fBox.push(box);
333 }
334 
335 void StackBoxBuilder::openSetMonoLabelBox() {
336  Gtk::VBox *box = new Gtk::VBox();
337  box->set_homogeneous(false);
338  box->set_spacing(0);
339  box->set_border_width(0);
340  convolver_mono_filename_label.set_name("rack_label");
341  Pango::FontDescription font = convolver_mono_filename_label.get_style()->get_font();
342  font.set_size(8*Pango::SCALE);
343  font.set_weight(Pango::WEIGHT_BOLD);
344  convolver_mono_filename_label.modify_font(font);
345  box->pack_start(convolver_mono_filename_label, true, false, 0);
346  box->show_all();
347  gx_engine::JConvParameter *jcp = dynamic_cast<gx_engine::JConvParameter*>(&machine.get_parameter("jconv_mono.convolver"));
348  assert(jcp);
349  convolver_mono_filename_label.set_label(jcp->get_value().getIRFile());
350  jcp->signal_changed().connect(
351  sigc::mem_fun(*this, &StackBoxBuilder::set_convolver_mono_filename));
352  fBox.box_pack_start(manage(box));
353  fBox.push(box);
354 }
355 
356 void StackBoxBuilder::addJConvButton(const char* label, gx_jconv::IRWindow *irw) {
357  Gtk::Button *button = new Gtk::Button();
358  button->set_can_default(false);
359  button->set_can_focus(false);
360  Gtk::Label *lab = new Gtk::Label(label);
361  //Pango::FontDescription font = lab->get_style()->get_font();
362  //font.set_size(10*Pango::SCALE);
363  //font.set_weight(Pango::WEIGHT_NORMAL);
364  //lab->modify_font(font);
365  button->add(*manage(lab));
366  //lab->set_name("rack_label_inverse");
367  Gtk::Alignment *al = new Gtk::Alignment(0.0, 0.5, 0.0, 0.0);
368  al->add(*manage(button));
369  al->show_all();
370  fBox.box_pack_start(manage(al), false);
371  button->signal_clicked().connect(
372  sigc::mem_fun(*irw, &gx_jconv::IRWindow::reload_and_show));
373 }
374 void StackBoxBuilder::addSeqButton(const char* label, gx_seq::SEQWindow *seqw) {
375  Gtk::Button *button = new Gtk::Button();
376  button->set_can_default(false);
377  button->set_can_focus(false);
378  Gtk::Label *lab = new Gtk::Label(label);
379  //Pango::FontDescription font = lab->get_style()->get_font();
380  //font.set_size(10*Pango::SCALE);
381  //font.set_weight(Pango::WEIGHT_NORMAL);
382  //lab->modify_font(font);
383  button->add(*manage(lab));
384  //lab->set_name("rack_label_inverse");
385  Gtk::Alignment *al = new Gtk::Alignment(0.0, 0.5, 0.0, 0.0);
386  al->add(*manage(button));
387  al->show_all();
388  fBox.box_pack_start(manage(al), false);
389  button->signal_clicked().connect(
390  sigc::mem_fun(*seqw, &gx_seq::SEQWindow::reload_and_show));
391 }
392 
393 void StackBoxBuilder::set_next_flags(int flags) {
394  next_flags = flags;
395 }
396 
397 bool StackBoxBuilder::set_simple(Gxw::FastMeter *fastmeter,const std::string id) {
398  if (machine.parameter_hasId(id)) {
399  if (machine.get_parameter_value<bool>(id.substr(0,id.find_last_of(".")+1)+"on_off"))
400  fastmeter->set_by_power(machine.get_parameter_value<float>(id));
401  else
402  fastmeter->set_by_power(0.0001);
403  return true;
404  } else {
405  return false;
406  }
407 }
408 
409 bool StackBoxBuilder::set_compressor_level(Gxw::FastMeter *fastmeter,const std::string id) {
410  if (machine.parameter_hasId(id)) {
411  if (machine.get_parameter_value<bool>(id.substr(0,id.find_last_of(".")+1)+"on_off"))
412  fastmeter->set_c_level(machine.get_parameter_value<float>(id));
413  else
414  fastmeter->set_c_level(0.0);
415  return true;
416  } else {
417  return false;
418  }
419 }
420 
421 void StackBoxBuilder::create_simple_meter(const std::string& id) {
422  Gxw::FastMeter *fastmeter = new Gxw::FastMeter();
423  fastmeter->set_hold_count(5);
424  fastmeter->set_property("dimen",2);
425  fastmeter->set_property("type",0);
426  Glib::signal_timeout().connect(sigc::bind<Gxw::FastMeter*>(sigc::bind<const std::string>(
427  sigc::mem_fun(*this, &StackBoxBuilder::set_simple),id), fastmeter), 60);
428  fastmeter->set_by_power(0.0001);
429  Gtk::HBox *box = new Gtk::HBox();
430  box->set_border_width(2);
431  box->pack_start(*Gtk::manage(static_cast<Gtk::Widget*>(fastmeter)),Gtk::PACK_SHRINK);
432  box->show_all();
433  fBox.box_pack_start(manage(box),false);
434 }
435 
436 void StackBoxBuilder::create_simple_c_meter(const std::string& id, const std::string& idm, const char *label) {
437  Gxw::FastMeter *fastmeter = new Gxw::FastMeter();
438  fastmeter->set_hold_count(5);
439  fastmeter->set_property("dimen",2);
440  fastmeter->set_property("type",0);
441  fastmeter->set_name("simplemeter");
442  Glib::signal_timeout().connect(sigc::bind<Gxw::FastMeter*>(sigc::bind<const std::string>(
443  sigc::mem_fun(*this, &StackBoxBuilder::set_simple),id), fastmeter), 60);
444  fastmeter->set_by_power(0.0001);
445  Gxw::LevelSlider *w = new UiRegler<Gxw::LevelSlider>(machine, idm);
446  w->set_name("lmw");
447  GxPaintBox *box = new GxPaintBox("simple_level_meter_expose");
448  box->set_border_width(2);
449  box->pack_start(*Gtk::manage(static_cast<Gtk::Widget*>(fastmeter)),Gtk::PACK_SHRINK);
450  box->add(*Gtk::manage(static_cast<Gtk::Widget*>(w)));
451  if (label && label[0]) {
452  Gtk::VBox *boxv = new Gtk::VBox();
453  //boxv->set_property("orientation",Gtk::ORIENTATION_VERTICAL);
454  boxv->set_homogeneous(false);
455  boxv->set_spacing(0);
456  // boxv->set_border_width(4);
457  Gtk::Label *lab = new Gtk::Label(label);
458  Pango::FontDescription font = lab->get_style()->get_font();
459  font.set_size(6*Pango::SCALE);
460  font.set_weight(Pango::WEIGHT_NORMAL);
461  lab->modify_font(font);
462  lab->set_name("beffekt_label");
463  boxv->add(*manage(lab));
464  boxv->add(*manage(box));
465  boxv->show_all();
466  fBox.box_pack_start(manage(boxv),false);
467  } else {
468  box->show_all();
469  fBox.box_pack_start(manage(box),false);
470  }
471 }
472 
473 bool StackBoxBuilder::set_regler_cp_value(Gxw::Regler * regler, const std::string id) {
474  if (machine.parameter_hasId(id)) {
475  if (machine.get_parameter_value<bool>(id.substr(0,id.find_last_of(".")+1)+"on_off"))
476  regler->cp_set_value(machine.get_parameter_value<float>(id));
477  return true;
478  } else {
479  return false;
480  }
481 }
482 
483 bool StackBoxBuilder::set_engine_cp_value(Gxw::Switch * sw, const std::string id) {
484  if (machine.parameter_hasId(id)) {
485  if (machine.get_parameter_value<bool>(id.substr(0,id.find_last_of(".")+1)+"on_off"))
486  sw->cp_set_value(machine.get_parameter_value<float>(id));
487  return true;
488  } else {
489  return false;
490  }
491 }
492 
493 bool StackBoxBuilder::set_engine_value(const std::string id) {
494  if (machine.parameter_hasId(id)) {
495  if (machine.get_parameter_value<bool>(id.substr(0,id.find_last_of(".")+1)+"on_off"))
496  machine.signal_parameter_value<float>(id)(machine.get_parameter_value<float>(id));
497  return true;
498  } else {
499  return false;
500  }
501 }
502 
503 void StackBoxBuilder::create_port_display(const std::string& id, const char *label) {
505  Glib::signal_timeout().connect(sigc::bind<const std::string>(
506  sigc::mem_fun(*this, &StackBoxBuilder::set_engine_value),id), 60);
507  if (next_flags & UI_LABEL_INVERSE) {
508  w->set_rack_label_inverse(label);
509  } else {
510  w->set_rack_label(label);
511  }
512  addwidget(w);
513 }
514 
515 bool StackBoxBuilder::set_pd_value(Gxw::PortDisplay *w, const std::string id, const std::string& idl, const std::string& idh) {
516  if (machine.parameter_hasId(id)) {
517  if (machine.get_parameter_value<bool>(id.substr(0,id.find_last_of(".")+1)+"on_off")) {
518  float low = machine.get_parameter_value<float>(idl);
519  float high = 100-machine.get_parameter_value<float>(idh);
520  w->set_state(int(low),int(high));
521  float set = (low + high)*0.001;
522  machine.signal_parameter_value<float>(id)(machine.get_parameter_value<float>(id)+set);
523  }
524  return true;
525  } else {
526  return false;
527  }
528 }
529 
530 void StackBoxBuilder::create_p_display(const std::string& id, const std::string& idl, const std::string& idh) {
531  Gxw::PortDisplay *w = new UiRegler<Gxw::PortDisplay>(machine, id);
532  w->set_name("playhead");
533  Gtk::EventBox* e_box = new Gtk::EventBox();
534  e_box->set_size_request(-1, -1);
535  e_box->set_border_width(0);
536  e_box->set_visible_window(true);
537  e_box->set_above_child(true);
538  e_box->add(*manage(static_cast<Gtk::Widget*>(w)));
539  addwidget(e_box);
540  e_box->show_all();
541  Glib::signal_timeout().connect(sigc::bind<Gxw::PortDisplay*>(sigc::bind<const std::string>(
542  sigc::bind<const std::string>(sigc::bind<const std::string>(
543  sigc::mem_fun(*this, &StackBoxBuilder::set_pd_value),idh),idl),id),w ), 60);
544 }
545 
546 void StackBoxBuilder::create_feedback_switch(const char *sw_type, const std::string& id) {
547  Gtk::Widget *sw = UiSwitch::create(machine, sw_type, id);
548  Gxw::Switch *regler = static_cast<Gxw::Switch*>(sw);
549  //regler->set_relief(Gtk::RELIEF_NONE);
550  regler->set_name("effect_on_off");
551  addwidget(sw);
552  Glib::signal_timeout().connect(sigc::bind<const std::string>(
553  sigc::mem_fun(*this, &StackBoxBuilder::set_engine_value),id), 60);
554 }
555 
556 void StackBoxBuilder::load_file(const std::string& id, const std::string& idf) {
557  static Glib::ustring recent_filename = "";
558  static Glib::ustring hostname = "localhost";
559  if (! machine.get_jack()) {
560  hostname = Gio::Resolver::get_default()->lookup_by_address
561  (Gio::InetAddress::create( machine.get_options().get_rpcaddress()));
562  }
563  if (machine.parameter_hasId(id)) {
564  if (machine.get_parameter_value<bool>(id.substr(0,id.find_last_of(".")+1)+"on_off")) {
565  if (machine.get_parameter_value<float>(id)>0) {
566  Glib::ustring filename = machine.get_parameter_value<string>(idf);
567  Glib::ustring title = hostname + ": Select loop file";
568  Gtk::FileChooserDialog d( title);
569  d.set_local_only(false);
570  d.property_destroy_with_parent().set_value(true);
571  d.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
572  d.add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK);
573  Glib::ustring loop_dir = machine.get_options().get_loop_dir();
574  d.add_shortcut_folder_uri(Glib::filename_to_uri(loop_dir, hostname));
575  Gtk::FileFilter wav;
576  wav.set_name("WAV Files");
577  wav.add_mime_type("audio/x-vorbis+ogg");
578  wav.add_mime_type("audio/x-wav");
579  wav.add_pattern("*.ogg");
580  wav.add_pattern("*.wav");
581  wav.add_pattern("*.WAV");
582  wav.add_pattern("*.Wav");
583  d.add_filter(wav);
584  Gtk::FileFilter audio;
585  audio.set_name("Audio Files");
586  audio.add_mime_type("audio/*");
587  d.add_filter(audio);
588  Gtk::FileFilter all;
589  all.add_pattern("*");
590  all.set_name("All Files");
591  d.add_filter(all);
592  if (!recent_filename.empty()) {
593  d.set_uri(Glib::filename_to_uri (recent_filename, hostname));
594  } else if ((filename.find("tape") != Glib::ustring::npos) && (!filename.empty())) {
595  d.set_uri(Glib::filename_to_uri (loop_dir + filename + string(".wav"), hostname));
596  } else {
597  d.set_current_folder_uri(Glib::filename_to_uri (loop_dir, hostname));
598  }
599  d.signal_response().connect(sigc::bind<Gtk::FileChooserDialog*>(sigc::bind<const std::string>(
600  sigc::bind<const std::string>(sigc::mem_fun(*this, &StackBoxBuilder::on_file_chooser_response),idf),id), &d) );
601  d.show();
602  while(machine.get_parameter_value<float>(id)>0) {
603  //g_main_context_iteration (NULL, true);
604  if (Gtk::Main::iteration(false)) {
605  machine.set_parameter_value(id,0.0);
606  machine.signal_parameter_value<float>(id)(0.0);
607  }
608  }
609 
610  // if (d.run() != Gtk::RESPONSE_OK) {
611  // machine.set_parameter_value(id,0.0);
612  // machine.signal_parameter_value<float>(id)(0.0);
613  // return;
614  // }
615  // filename = Glib::filename_from_uri(d.get_uri(), hostname);
616  // recent_filename = filename;
617  // Gtk::RecentManager::Data data;
618  // bool result_uncertain;
619  // data.mime_type = Gio::content_type_guess(filename, "", result_uncertain);
620  // data.app_name = "guitarix";
621  // data.groups.push_back("loopfiles");
622  // Gtk::RecentManager::get_default()->add_item(d.get_uri(), data);
623  // machine.set_parameter_value(idf,filename);
624  // machine.set_parameter_value(id,0.0);
625  // machine.signal_parameter_value<float>(id)(0.0);
626  }
627  }
628  }
629 }
630 
631 void StackBoxBuilder::on_file_chooser_response(int response_id, Gtk::FileChooserDialog *d, const std::string& id, const std::string& idf)
632 {
633  if( response_id == Gtk::RESPONSE_OK) {
634  static Glib::ustring hostname = "localhost";
635  if (! machine.get_jack()) {
636  hostname = Gio::Resolver::get_default()->lookup_by_address
637  (Gio::InetAddress::create( machine.get_options().get_rpcaddress()));
638  }
639  Glib::ustring filename = Glib::filename_from_uri(d->get_uri(), hostname);
640  Glib::ustring recent_filename = filename;
641  Gtk::RecentManager::Data data;
642  bool result_uncertain;
643  data.mime_type = Gio::content_type_guess(filename, "", result_uncertain);
644  data.app_name = "guitarix";
645  data.groups.push_back("loopfiles");
646  Gtk::RecentManager::get_default()->add_item(d->get_uri(), data);
647  d->hide();
648  machine.set_parameter_value(idf,filename);
649  machine.set_parameter_value(id,0.0);
650  machine.signal_parameter_value<float>(id)(0.0);
651  } else {
652  d->hide();
653  machine.set_parameter_value(id,0.0);
654  machine.signal_parameter_value<float>(id)(0.0);
655  }
656  }
657 
658 void StackBoxBuilder::load_file_f(const std::string& id, const std::string& idf) {
659  Glib::signal_timeout().connect_once(
660  sigc::bind<const std::string>(sigc::bind<const std::string>(sigc::mem_fun(this, &StackBoxBuilder::load_file), idf), id),100);
661 }
662 
663 void StackBoxBuilder::create_fload_switch(const char *sw_type, const std::string& id, const std::string& idf) {
664  //if (machine.get_jack()) {
665  Gtk::Widget *sw = UiSwitch::create(machine, sw_type, id);
666  Gxw::Switch *regler = static_cast<Gxw::Switch*>(sw);
667  //regler->set_relief(Gtk::RELIEF_NONE);
668  regler->set_name("effect_on_off");
669  addwidget(sw);
670  gx_engine::Parameter& p = machine.get_parameter(id);
671  p.signal_changed_float().connect(sigc::hide(
672  sigc::bind<const std::string>(sigc::bind<const std::string>(sigc::mem_fun(this, &StackBoxBuilder::load_file_f), idf), id)));
673  //}
674 }
675 
676 void StackBoxBuilder::create_h_switch(const char *sw_type, const std::string& id, const char *label) {
677  Gtk::Widget* sw = UiHSwitchWithCaption::create(machine, sw_type, id, label);
678  UiHSwitchWithCaption *w = static_cast<UiHSwitchWithCaption*>(sw);
679  //w->get_regler()->set_relief(Gtk::RELIEF_NONE);
680  w->get_regler()->set_name("effect_on_off");
681  if (next_flags & UI_LABEL_INVERSE) {
683  }
684  addwidget(sw);
685 }
686 
687 void StackBoxBuilder::create_v_switch(const char *sw_type, const std::string& id, const char *label) {
688  Gtk::Widget* sw = UiVSwitchWithCaption::create(machine, sw_type, id, label);
689  UiVSwitchWithCaption *w = static_cast<UiVSwitchWithCaption*>(sw);
690  //w->get_regler()->set_relief(Gtk::RELIEF_NONE);
691  w->get_regler()->set_name("effect_on_off");
692  if (next_flags & UI_LABEL_INVERSE) {
694  }
695  addwidget(sw);
696 }
697 
698 void StackBoxBuilder::create_feedback_slider(const std::string& id, const char *label) {
700  Glib::signal_timeout().connect(sigc::bind<const std::string>(
701  sigc::mem_fun(*this, &StackBoxBuilder::set_engine_value),id), 60);
702  w->set_label(label);
703  addwidget(w);
704  }
705 
706 void StackBoxBuilder::create_selector(const std::string& id, const char *widget_name) {
707  gx_engine::Parameter& p = machine.get_parameter(id);
708  Gxw::Selector *s;
709  if (p.isFloat()) {
710  s = new UiSelector<float>(machine, id);
711  } else {
712  s = new UiSelector<int>(machine, id);
713  }
714  if (widget_name) {
715  s->set_name(widget_name);
716  }
717  addwidget(s);
718 }
719 
720 void StackBoxBuilder::create_selector_with_caption(const std::string& id, const char *label) {
721  gx_engine::Parameter& p = machine.get_parameter(id);
722  Gtk::VBox *s;
723  if (p.isFloat()) {
725  s = new UiSelectorWithCaption<float>(machine, id, label);
726  sel = static_cast<UiSelectorWithCaption<float>*>(s);
727  if (next_flags & UI_LABEL_INVERSE) {
728  sel->set_rack_label_inverse();
729  }
730  } else {
732  s = new UiSelectorWithCaption<int>(machine, id, label);
733  sel = static_cast<UiSelectorWithCaption<int>*>(s);
734  if (next_flags & UI_LABEL_INVERSE) {
735  sel->set_rack_label_inverse();
736  }
737  }
738  addwidget(s);
739 }
740 
741 void StackBoxBuilder::openSpaceBox(const char* label) {
742  GxVBox * box = new GxVBox();
743  box->set_homogeneous(true);
744  box->set_spacing(1);
745  box->set_border_width(4);
746  box->show_all();
747  if (!fBox.top_is_notebook() && label && label[0]) {
748  fBox.box_pack_start(manage(box));
749  fBox.push(box);
750  } else {
751  fBox.push(fBox.add(manage(box), label));
752  }
753 }
754 
755 void StackBoxBuilder::check_set_flags(Gxw::Regler *r) {
756  if (next_flags & UI_NUM_SHOW_ALWAYS) {
757  r->set_name("show_always");
758  }
759  if ((next_flags & UI_NUM_POSITION_MASK)) {
760  Gtk::PositionType pos = Gtk::POS_BOTTOM;
761  switch (next_flags & UI_NUM_POSITION_MASK) {
762  case UI_NUM_TOP: pos = Gtk::POS_TOP; break;
763  case UI_NUM_LEFT: pos = Gtk::POS_LEFT; break;
764  case UI_NUM_RIGHT: pos = Gtk::POS_RIGHT; break;
765  }
766  r->set_value_position(pos);
767  }
768 }
769 
770 void StackBoxBuilder::create_mid_rackknob(const std::string& id, const char *label) {
772  if (next_flags & UI_LABEL_INVERSE) {
773  w->set_rack_label_inverse(label);
774  } else {
775  w->set_rack_label(label);
776  }
777  check_set_flags(w->get_regler());
778  addwidget(w);
779 }
780 
781 void StackBoxBuilder::create_small_rackknob(const std::string& id, const char *label) {
783  if (next_flags & UI_LABEL_INVERSE) {
784  w->set_rack_label_inverse(label);
785  } else {
786  w->set_rack_label(label);
787  }
788  check_set_flags(w->get_regler());
789  addwidget(w);
790 }
791 
792 void StackBoxBuilder::create_small_rackknobr(const std::string& id, const char *label) {
794  if (next_flags & UI_LABEL_INVERSE) {
795  w->set_rack_label_inverse(label);
796  } else {
797  w->set_rack_label(label);
798  }
799  check_set_flags(w->get_regler());
800  addwidget(w);
801 }
802 
803 void StackBoxBuilder::create_big_rackknob(const std::string& id, const char *label) {
805  if (next_flags & UI_LABEL_INVERSE) {
806  w->set_rack_label_inverse(label);
807  } else {
808  w->set_rack_label(label);
809  }
810  check_set_flags(w->get_regler());
811  addwidget(w);
812 }
813 
814 void StackBoxBuilder::addLiveWaveDisplay(const char* label) {
815  Gtk::HBox * box = new Gtk::HBox(false, 4);
816  Gtk::VBox * box1 = new Gtk::VBox(false, 0);
817  Gtk::VBox * box2 = new Gtk::VBox(false, 0);
818  Gtk::EventBox* e_box = new Gtk::EventBox();
819  //g_signal_connect(box->gobj(), "expose-event", G_CALLBACK(gx_cairo::conv_widget_expose), NULL);
820  //box->set_size_request(303, 82);
821  e_box->set_size_request(284, 84);
822  //box->set_border_width(12);
823  e_box->add(fWaveView);
824  box->pack_start(*manage(box1), true, true, 0);
825  box->pack_start(*manage(e_box), false, false, 0);
826  box->pack_start(*manage(box2), true, true, 0);
827  fBox.add(manage(box), label);
828  fWaveView.hide(); // was show()'n by addWidget
829  fWaveView.property_text_pos_left() = 1.5;
830  fWaveView.property_text_pos_right() = 77;
831  // multiplicator is already set by signal handler
832  box->show_all();
833 }
834 
835 void StackBoxBuilder::openVerticalBox1(const char* label) {
836  GxVBox * box = new GxVBox();
837  box->set_homogeneous(false);
838  box->set_spacing(1);
839  box->set_border_width(0);
840 
841  if (!fBox.top_is_notebook() && label && label[0]) {
842  box->m_label.set_text(label);
843  box->m_label.set_name("effekt_label");
844  box->pack_start(box->m_label, false, false, 0 );
845  fBox.box_pack_start(manage(box));
846  box->show();
847  box->m_label.show();
848  fBox.push(box);
849  } else {
850  fBox.push(fBox.add(manage(box), label));
851  }
852 }
853 
854 void StackBoxBuilder::openVerticalBox2(const char* label) {
855  Gtk::VPaned * box = new Gtk::VPaned();
856  box->set_border_width(0);
857  GxHBox * pbox = new GxHBox();
858  if (!fBox.top_is_notebook() && label && label[0]) {
859  pbox->m_label.set_text(label);
860  pbox->m_label.set_name("rack_label");
861  pbox->pack_start(pbox->m_label, false, false, 0 );
862  }
863  pbox->set_border_width(0);
864  box->pack1(*Gtk::manage(static_cast<Gtk::Widget*>(pbox)),true,true);
865  GxHBox * hbox = new GxHBox();
866  hbox->set_homogeneous(false);
867  hbox->set_spacing(1);
868  hbox->set_border_width(0);
869  box->pack2(*Gtk::manage(static_cast<Gtk::Widget*>(hbox)),true,true);
870  box->set_position(200);
871  fBox.box_pack_start(manage(box), false, false, 0);
872  box->show_all();
873  fBox.push(hbox);
874 }
875 
876 void StackBoxBuilder::openFlipLabelBox(const char* label) {
877  GxVBox * box = new GxVBox();
878  box->set_homogeneous(false);
879  box->set_spacing(0);
880  box->set_border_width(0);
881 
882  if (!fBox.top_is_notebook() && label && label[0]) {
883  GxVBox * vbox = new GxVBox();
884  vbox->set_homogeneous(false);
885  vbox->set_spacing(0);
886  vbox->set_border_width(0);
887 
888  GxHBox * hbox = new GxHBox();
889  hbox->set_homogeneous(false);
890  hbox->set_spacing(0);
891  hbox->set_border_width(0);
892 
893  hbox->m_label.set_text(label);
894  hbox->m_label.set_name("effekt_label");
895  hbox->m_label.set_angle(90);
896  hbox->m_label.set_size_request(15, -1);
897 
898  Pango::FontDescription font = hbox->m_label.get_style()->get_font();
899  font.set_size(8*Pango::SCALE);
900  font.set_weight(Pango::WEIGHT_BOLD);
901  hbox->m_label.modify_font(font);
902 
903  hbox->add(hbox->m_label);
904  hbox->add(*manage(vbox));
905  box->add(*manage(hbox));
906  fBox.box_pack_start(manage(box), false);
907  box->show_all();
908  fBox.push(vbox);
909  } else {
910  fBox.push(fBox.add(manage(box), label));
911  }
912 }
913 
914 class uiSpinner: public Gtk::SpinButton {
915 private:
916  uiAdjustment adj;
917 public:
918  uiSpinner(float step, gx_engine::GxMachineBase& machine, const std::string& id)
919  : Gtk::SpinButton(step, precision(step)), adj(machine, id, get_adjustment()) {
920  get_adjustment()->signal_value_changed().connect(
921  sigc::mem_fun(adj, &uiAdjustment::changed));
922  }
923 };
924 
925 void StackBoxBuilder::addNumEntry(const std::string& id, const char* label_) {
926  Glib::ustring label(label_);
927  if (!machine.parameter_hasId(id)) {
928  return;
929  }
930  const gx_engine::FloatParameter &p = machine.get_parameter(id).getFloat();
931  if (label.empty()) {
932  label = p.l_name();
933  }
934  float step = p.getStepAsFloat();
935  uiSpinner* spinner = new uiSpinner(step, machine, id);
936  spinner->get_adjustment()->configure(
937  machine.get_parameter_value<float>(id), p.getLowerAsFloat(), p.getUpperAsFloat(), step, 10*step, 0);
938  connect_midi_controller(spinner, id, machine);
939  Gtk::HBox *box = new Gtk::HBox(homogene, 0);
940  Gtk::Label *lab = new Gtk::Label(label);
941  box->add(*manage(lab));
942  lab->set_name("rack_label");
943  fBox.add(manage(box), label);
944  fBox.add(manage(spinner), label);
945 }
946 
947 class uiToggleButton: public Gtk::ToggleButton {
948 private:
949  gx_engine::GxMachineBase& machine;
950  const std::string id;
951 public:
952  uiToggleButton(gx_engine::GxMachineBase& machine_, const std::string& id_);
953  void toggled();
954  void set_value(bool v);
955 };
956 
958  : Gtk::ToggleButton(), machine(machine_), id(id_) {
959  machine.signal_parameter_value<bool>(id).connect(
960  sigc::mem_fun(this, &Gtk::ToggleButton::set_active));
961  signal_toggled().connect(
962  sigc::mem_fun(this, &uiToggleButton::toggled));
963 }
964 
966  machine.set_parameter_value(id, get_active());
967 }
968 
969 void StackBoxBuilder::addMToggleButton(const std::string& id, const char* label_) {
970  Glib::ustring label(label_);
971  if (!machine.parameter_hasId(id)) {
972  return;
973  }
974  const gx_engine::BoolParameter &p = machine.get_parameter(id).getBool();
975  if (label.empty()) {
976  label = p.l_name();
977  }
978  Gdk::Color colorRed("#58b45e");
979  Gdk::Color colorOwn("#7f7f7f");
980  Gdk::Color colorwn("#000000");
981  uiToggleButton* button = new uiToggleButton(machine, id);
982  Gtk::Label* lab = new Gtk::Label(label);
983  Pango::FontDescription font = lab->get_style()->get_font();
984  font.set_weight(Pango::WEIGHT_BOLD);
985  lab->modify_font(font);
986  button->add(*manage(lab));
987  button->set_size_request(70, 20);
988  Gtk::Box* box = new Gtk::HBox(homogene, 4);
989  Gtk::Box* box1 = new Gtk::VBox(homogene, 4);
990  box->set_border_width(0);
991  box1->set_border_width(0);
992  box->add(*manage(box1));
993  Gtk::Box* box2 = new Gtk::VBox(homogene, 4);
994  box2->set_border_width(0);
995  box2->set_size_request(6, 20);
996  box->add(*manage(button));
997  box->add(*manage(box2));
998  box1->set_size_request(6, 20);
999  button->show();
1000  box1->show();
1001  box2->show();
1002  lab->show();
1003  box->show();
1004  fBox.container_add(manage(box));
1005  button->modify_bg(Gtk::STATE_NORMAL, colorOwn);
1006  button->modify_bg(Gtk::STATE_ACTIVE, colorRed);
1007  lab->set_name("rack_label");
1008  connect_midi_controller(button, id, machine);
1009 }
1010 
1011 class uiCheckButton: public Gtk::CheckButton {
1012 private:
1013  gx_engine::GxMachineBase& machine;
1014  const std::string& id;
1015 public:
1016  uiCheckButton(gx_engine::GxMachineBase& machine_, const std::string& id_)
1017  : Gtk::CheckButton(), machine(machine_), id(id_) {
1018  set_active(machine.get_parameter_value<bool>(id));
1019  machine.signal_parameter_value<bool>(id).connect(sigc::mem_fun(this, &Gtk::CheckButton::set_active));
1020  signal_toggled().connect(
1021  sigc::mem_fun(this, &uiCheckButton::toggled));
1022  }
1023  void toggled() {
1024  machine.set_parameter_value(id, get_active());
1025  }
1026 };
1027 
1028 void StackBoxBuilder::addCheckButton(const std::string& id, const char* label_) {
1029  if (!machine.parameter_hasId(id)) {
1030  return;
1031  }
1032  Glib::ustring label;
1033  if (label_ && label_[0]) {
1034  label = label_;
1035  } else {
1036  label = machine.get_parameter(id).getBool().l_name();
1037  }
1038  Gdk::Color colorRed("#000000");
1039  Gdk::Color colorOwn("#4c5159");
1040  Gdk::Color colorba("#c4c0c0");
1041  Gtk::Label *lab = new Gtk::Label(label);
1042  uiCheckButton *button = new uiCheckButton(machine, id);
1043  button->add(*manage(lab));
1044  fBox.add(manage(button), label);
1045  button->modify_bg(Gtk::STATE_PRELIGHT, colorOwn);
1046  button->modify_fg(Gtk::STATE_PRELIGHT, colorRed);
1047  button->modify_text(Gtk::STATE_NORMAL, colorRed);
1048  button->modify_base(Gtk::STATE_NORMAL, colorba);
1049  Glib::RefPtr<Gtk::Style> style = lab->get_style();
1050  style->get_font().set_size(8*Pango::SCALE);
1051  style->get_font().set_weight(Pango::WEIGHT_NORMAL);
1052  lab->modify_font(style->get_font());
1053  connect_midi_controller(button, id, machine);
1054  lab->show();
1055 }
1056 
1057 void StackBoxBuilder::openHorizontalhideBox(const char* label) {
1058  GxHBox * box = new GxHBox();
1059  box->set_homogeneous(false);
1060  box->set_spacing(0);
1061  box->set_border_width(0);
1062  fBox.box_pack_start(manage(box) , false, false, 5);
1063  fBox.push(box);
1064  box->hide();
1065  if (label[0] != 0) {
1066  box->show();
1067  }
1068 }
1069 
1070 void StackBoxBuilder::openHorizontalTableBox(const char* label) {
1071  Gtk::HBox *box;
1072  if (!fBox.top_is_notebook() && label && label[0]) {
1073  GxHFrame *frame = new GxHFrame();
1074  frame->set_label(label);
1075  frame->set_shadow_type(Gtk::SHADOW_NONE);
1076  frame->add(frame->m_hbox);
1077  fBox.box_pack_start(manage(frame), false);
1078  frame->m_hbox.show();
1079  frame->show();
1080  box = &frame->m_hbox;
1081  fBox.push(box);
1082  } else {
1083  box = new Gtk::HBox();
1084  fBox.push(fBox.add(manage(box), label));
1085  }
1086  box->set_homogeneous(false);
1087  box->set_spacing(1);
1088  box->set_border_width(0);
1089 }
1090 
1091 void StackBoxBuilder::openPaintBox2(const char* label) {
1092  GxEventBox *box = new GxEventBox();
1093  box->m_eventbox.set_name(label);
1094  box->set_homogeneous(false);
1095  box->set_spacing(0);
1096  box->set_border_width(0);
1097  fBox.box_pack_start(manage(box), false, false);
1098  box->show_all();
1099  fBox.push(&box->m_hbox);
1100 }
1101 
1102 void StackBoxBuilder::openTabBox(const char* label) {
1103  GxNotebookBox * box = new GxNotebookBox();
1104  fBox.push(fBox.add(manage(box), label));
1105 }
1106 
1107 void StackBoxBuilder::openpaintampBox(const char* label) {
1108  GxPaintBox *box = new GxPaintBox("rectangle_skin_color_expose");
1109  box->m_hbox.set_border_width(4);
1110  box->set_name(label);
1111  box->set_tooltip_text(label);
1112  fBox.box_pack_start(manage(box));
1113  box->show_all();
1114  fBox.push(&box->m_hbox);
1115 }
1116 
1117 void StackBoxBuilder::closeBox() {
1118  assert(!fBox.empty());
1119  fBox.pop();
1120 }
1121 
1122 void StackBoxBuilder::openHorizontalBox(const char* label) {
1123  Gtk::HBox *box;
1124  if (!fBox.top_is_notebook() && label && label[0]) {
1125  GxHFrame *frame = new GxHFrame();
1126  frame->set_label(label);
1127  frame->set_shadow_type(Gtk::SHADOW_NONE);
1128  frame->add(frame->m_hbox);
1129  fBox.box_pack_start(manage(frame), false);
1130  frame->m_hbox.show();
1131  frame->show();
1132  box = &frame->m_hbox;
1133  fBox.push(box);
1134  } else {
1135  box = new Gtk::HBox();
1136  fBox.push(fBox.add(manage(box), label));
1137  }
1138  box->set_homogeneous(false);
1139  box->set_spacing(1);
1140  box->set_border_width(0);
1141 }
1142 
1143 void StackBoxBuilder::openVerticalBox(const char* label) {
1144  GxVBox * box = new GxVBox();
1145  box->set_homogeneous(false);
1146  box->set_spacing(1);
1147  box->set_border_width(0);
1148 
1149  if (!fBox.top_is_notebook() && label && label[0]) {
1150  box->m_label.set_text(label);
1151  box->m_label.set_name("rack_effect_label");
1152  Glib::RefPtr<Gtk::Style> style = box->m_label.get_style();
1153  style->get_font().set_size(8*Pango::SCALE);
1154  style->get_font().set_weight(Pango::WEIGHT_BOLD);
1155  box->m_label.modify_font(style->get_font());
1156  box->pack_start(box->m_label, false, false, 0 );
1157  fBox.box_pack_start(manage(box), false);
1158  box->show();
1159  box->m_label.show();
1160  fBox.push(box);
1161  } else {
1162  fBox.push(fBox.add(manage(box), label));
1163  }
1164 }
1165 
1166 void StackBoxBuilder::openFrameBox(const char* label) {
1167  Gtk::HBox *box;
1168 
1169  if (!fBox.top_is_notebook() && label && label[0]) {
1170  GxHFrame *frame = new GxHFrame();
1171  frame->set_label(label);
1172  frame->set_shadow_type(Gtk::SHADOW_NONE);
1173  frame->add(frame->m_hbox);
1174  fBox.box_pack_start(manage(frame), false);
1175  frame->m_hbox.show();
1176  frame->show();
1177  box = &frame->m_hbox;
1178  fBox.push(box);
1179  } else {
1180  box = new Gtk::HBox();
1181  fBox.push(fBox.add(manage(box), label));
1182  }
1183  box->set_homogeneous(false);
1184  box->set_spacing(1);
1185  box->set_border_width(2);
1186 }
1187 
1188 } // end namespace gx_gui
static Gtk::Widget * create(gx_engine::GxMachineBase &machine, const char *sw_type, const std::string &id, const char *label)
static Gtk::Widget * create(gx_engine::GxMachineBase &machine, const char *sw_type, const std::string &id, const char *label)
virtual float getUpperAsFloat() const
StackBoxBuilder(gx_engine::GxMachineBase &machine_, Gxw::WaveView &fWaveView_, Gtk::Label &convolver_filename_label_, Gtk::Label &convolver_mono_filename_label_, Glib::RefPtr< Gdk::Pixbuf > window_icon)
const char * pb_gxhead_expose
void notebook_append_page(Gtk::Widget *w, Gtk::Widget *label)
void wnotify(gpointer data, GObject *where_the_object_was)
std::string get_builder_filepath(const std::string &basename) const
Definition: gx_system.h:373
const char * pb_zac_expose
void get_box(const std::string &name, Gtk::Widget *&mainbox, Gtk::Widget *&minibox)
void container_add(Gtk::Widget *w)
virtual Parameter & get_parameter(const std::string &id)=0
static UiSwitch * create(gx_engine::GxMachineBase &machine, const char *sw_type, gx_engine::Parameter &param)
#define UI_NUM_POSITION_MASK
Definition: gx_plugin.h:43
#define UI_LABEL_INVERSE
Definition: gx_plugin.h:45
virtual gx_jack::GxJack * get_jack()=0
void set_c_level(double lvl)
Definition: fastmeter.cc:142
virtual float getLowerAsFloat() const
const char * pb_gx_rack_amp_expose
int precision(double n)
const std::string & get_loop_dir() const
Definition: gx_system.h:476
void set_label(const char *label)
sigc::signal< void, const GxJConvSettings * > & signal_changed()
Gtk::EventBox m_eventbox
#define UI_NUM_TOP
Definition: gx_plugin.h:39
const Glib::ustring & get_rpcaddress()
Definition: gx_system.h:492
void gx_print_error(const char *, const std::string &)
Definition: gx_logging.cpp:166
sigc::signal< void, float > & signal_changed_float()
Definition: gx_parameter.h:483
void cp_set_value(double value)
Gtk::Widget * add(Gtk::Widget *w, const Glib::ustring &label=Glib::ustring())
void set_rack_label(const char *label)
T get_parameter_value(const std::string &id)
bool isFloat() const
Definition: gx_parameter.h:162
const char * pb_RackBox_expose
#define UI_NUM_LEFT
Definition: gx_plugin.h:41
string l_name() const
Definition: gx_parameter.h:176
virtual bool parameter_hasId(const char *p)=0
uiToggleButton(gx_engine::GxMachineBase &machine_, const std::string &id_)
const std::string & getIRFile() const
virtual void set_parameter_value(const std::string &id, int value)=0
const char * pb_level_meter_expose
void set_state(int cutoff_low, int cutoff_high)
Definition: portdisplay.cc:54
std::string to_string(const T &t)
Definition: gx_system.h:525
void connect_midi_controller(Gtk::Widget *w, const std::string &id, gx_engine::GxMachineBase &machine)
void push(Gtk::Widget *w)
void set_rack_label_inverse(const char *label)
void set_value_position(Gtk::PositionType p1)
Definition: regler.cc:477
void set_hold_count(int val)
Definition: fastmeter.cc:152
FloatParameter & getFloat()
Definition: gx_parameter.h:452
virtual gx_system::CmdlineOptions & get_options() const =0
virtual float getStepAsFloat() const
struct _GxPaintBox GxPaintBox
Definition: paintbox.h:32
const GxJConvSettings & get_value() const
bool button_press_cb(GdkEventButton *event, gx_engine::GxMachineBase &machine, const std::string &id)
Gtk::Label m_label
uiCheckButton(gx_engine::GxMachineBase &machine_, const std::string &id_)
void set_by_power(double lvl)
Definition: fastmeter.cc:137
const char * pb_rectangle_skin_color_expose
uiSpinner(float step, gx_engine::GxMachineBase &machine, const std::string &id)
void box_pack_start(Gtk::Widget *w, bool expand=true, bool fill=true, int padding=0)
void trace_finalize(Glib::Object *o, int n)
Gtk::Label m_label
#define UI_NUM_RIGHT
Definition: gx_plugin.h:42
const char * pb_gxrack_expose
void fetch(Gtk::Widget *&mainbox, Gtk::Widget *&minibox)
virtual bool midi_get_config_mode(int *ctl=0)=0
sigc::signal< void, T > & signal_parameter_value(const std::string &id)
BoolParameter & getBool()
Definition: gx_parameter.h:468
std::string fformat(float value, float step)
#define UI_NUM_SHOW_ALWAYS
Definition: gx_plugin.h:44