diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2016-05-18 14:15:39 -0400 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2016-05-31 15:30:43 -0400 |
commit | 0b4d9c9d63858a8b7dccd9bd88879e0cd0391881 (patch) | |
tree | 5cb26a73759bf7f8e2bbbafecc90f6a41751a139 | |
parent | 2886b9659b21ffa95c96cad71390842a34804507 (diff) |
code consolidation
-rw-r--r-- | gtk2_ardour/vca_master_strip.cc | 34 | ||||
-rw-r--r-- | gtk2_ardour/vca_master_strip.h | 1 |
2 files changed, 30 insertions, 5 deletions
diff --git a/gtk2_ardour/vca_master_strip.cc b/gtk2_ardour/vca_master_strip.cc index 7468b1b0d4..5ceb016275 100644 --- a/gtk2_ardour/vca_master_strip.cc +++ b/gtk2_ardour/vca_master_strip.cc @@ -425,17 +425,31 @@ VCAMasterStrip::vca_button_release (GdkEventButton* ev) bool VCAMasterStrip::vertical_box_press (GdkEventButton* ev) { - return name_button_press (ev); + if (ev->button == 1 && ev->type == GDK_2BUTTON_PRESS) { + start_name_edit (); + return true; + } + + if (Keyboard::is_context_menu_event (ev)) { + if (!context_menu) { + build_context_menu (); + } + context_menu->popup (1, ev->time); + return true; + } + + if (ev->button == 1) { + // spill (); + } + + return true; } bool VCAMasterStrip::name_button_press (GdkEventButton* ev) { if (ev->button == 1 && ev->type == GDK_2BUTTON_PRESS) { - Gtk::Window* win = dynamic_cast<Gtk::Window*>(get_toplevel()); - FloatingTextEntry* fte = new FloatingTextEntry (win, _vca->name()); - fte->use_text.connect (sigc::mem_fun (*this, &VCAMasterStrip::finish_name_edit)); - fte->present (); + start_name_edit (); return true; } @@ -451,6 +465,15 @@ VCAMasterStrip::name_button_press (GdkEventButton* ev) } void +VCAMasterStrip::start_name_edit () +{ + Gtk::Window* win = dynamic_cast<Gtk::Window*>(get_toplevel()); + FloatingTextEntry* fte = new FloatingTextEntry (win, _vca->name()); + fte->use_text.connect (sigc::mem_fun (*this, &VCAMasterStrip::finish_name_edit)); + fte->present (); +} + +void VCAMasterStrip::finish_name_edit (std::string str) { _vca->set_name (str); @@ -476,5 +499,6 @@ VCAMasterStrip::build_context_menu () using namespace Gtk::Menu_Helpers; context_menu = new Menu; MenuList& items = context_menu->items(); + items.push_back (MenuElem (_("Rename"), sigc::mem_fun (*this, &VCAMasterStrip::start_name_edit))); items.push_back (MenuElem (_("Remove"))); } diff --git a/gtk2_ardour/vca_master_strip.h b/gtk2_ardour/vca_master_strip.h index a79c648b8a..70591fbc8c 100644 --- a/gtk2_ardour/vca_master_strip.h +++ b/gtk2_ardour/vca_master_strip.h @@ -85,6 +85,7 @@ class VCAMasterStrip : public AxisView, public Gtk::EventBox void unassign (); bool vca_button_release (GdkEventButton*); void update_vca_display (); + void start_name_edit (); void finish_name_edit (std::string); bool name_button_press (GdkEventButton*); bool vertical_box_press (GdkEventButton*); |