start adding a context menu for VCA strips

This commit is contained in:
Paul Davis 2016-03-08 22:08:51 -05:00
parent 567fb50aad
commit 9f66fe1ebb
2 changed files with 23 additions and 2 deletions

View File

@ -23,6 +23,8 @@
#include "ardour/vca.h"
#include "ardour/vca_manager.h"
#include "gtkmm2ext/keyboard.h"
#include "gui_thread.h"
#include "floating_text_entry.h"
#include "tooltips.h"
@ -41,6 +43,7 @@ VCAMasterStrip::VCAMasterStrip (Session* s, boost::shared_ptr<VCA> v)
: AxisView (s)
, _vca (v)
, gain_meter (s, 250)
, context_menu (0)
{
gain_meter.set_controls (boost::shared_ptr<Route>(),
boost::shared_ptr<PeakMeter>(),
@ -318,7 +321,7 @@ VCAMasterStrip::vca_button_release (GdkEventButton* ev)
bool
VCAMasterStrip::name_button_press (GdkEventButton* ev)
{
if (ev->type == GDK_2BUTTON_PRESS) {
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));
@ -326,6 +329,14 @@ VCAMasterStrip::name_button_press (GdkEventButton* ev)
return true;
}
if (Keyboard::is_context_menu_event (ev)) {
if (!context_menu) {
build_context_menu ();
}
context_menu->popup (1, ev->time);
return true;
}
return false;
}
@ -348,3 +359,12 @@ VCAMasterStrip::update_vca_name ()
{
name_button.set_text (short_version (_vca->name(), 8));
}
void
VCAMasterStrip::build_context_menu ()
{
using namespace Gtk::Menu_Helpers;
context_menu = new Menu;
MenuList& items = context_menu->items();
items.push_back (MenuElem (_("Remove")));
}

View File

@ -63,7 +63,7 @@ class VCAMasterStrip : public AxisView, public Gtk::EventBox
ArdourButton solo_button;
ArdourButton mute_button;
ArdourButton assign_button;
bool wide;
Gtk::Menu* context_menu;
PBD::ScopedConnectionList vca_connections;
void hide_clicked();
@ -83,6 +83,7 @@ class VCAMasterStrip : public AxisView, public Gtk::EventBox
bool name_button_press (GdkEventButton*);
void vca_property_changed (PBD::PropertyChange const & what_changed);
void update_vca_name ();
void build_context_menu ();
};