summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2009-11-16 04:57:33 +0000
committerDavid Robillard <d@drobilla.net>2009-11-16 04:57:33 +0000
commit1a725c0811fd15900464e1eff429c6ead90805d4 (patch)
treef8609772c7833da664b6621cccf32e3dc9d16d0b
parentb1a0a1b76ee1c9ae469c3d73543998662adc05ee (diff)
downloadingen-1a725c0811fd15900464e1eff429c6ead90805d4.tar.gz
ingen-1a725c0811fd15900464e1eff429c6ead90805d4.tar.bz2
ingen-1a725c0811fd15900464e1eff429c6ead90805d4.zip
Add edit checkbutton to canvas menu for fast mouse based control.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2271 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--src/client/PatchModel.hpp10
-rw-r--r--src/gui/PatchCanvas.cpp31
-rw-r--r--src/gui/PatchCanvas.hpp35
-rw-r--r--src/gui/ingen_gui.glade19
4 files changed, 65 insertions, 30 deletions
diff --git a/src/client/PatchModel.hpp b/src/client/PatchModel.hpp
index 6b8398ae..8245ee5a 100644
--- a/src/client/PatchModel.hpp
+++ b/src/client/PatchModel.hpp
@@ -55,10 +55,12 @@ public:
* not editable (control mode) you can just change controllers (performing)
*/
bool get_editable() const { return _editable; }
- void set_editable(bool e) { if (_editable != e) {
- _editable = e;
- signal_editable.emit(e);
- } }
+ void set_editable(bool e) {
+ if (_editable != e) {
+ _editable = e;
+ signal_editable.emit(e);
+ }
+ }
virtual Raul::Atom& set_meta_property(const Raul::URI& key, const Raul::Atom& value);
diff --git a/src/gui/PatchCanvas.cpp b/src/gui/PatchCanvas.cpp
index 0f071334..46a1c003 100644
--- a/src/gui/PatchCanvas.cpp
+++ b/src/gui/PatchCanvas.cpp
@@ -72,8 +72,6 @@ PatchCanvas::PatchCanvas(SharedPtr<PatchModel> patch, int width, int height)
Glib::RefPtr<Gnome::Glade::Xml> xml = GladeFactory::new_glade_reference();
xml->get_widget("canvas_menu", _menu);
- /*xml->get_widget("canvas_menu_add_number_control", _menu_add_number_control);
- xml->get_widget("canvas_menu_add_button_control", _menu_add_button_control);*/
xml->get_widget("canvas_menu_add_audio_input", _menu_add_audio_input);
xml->get_widget("canvas_menu_add_audio_output", _menu_add_audio_output);
xml->get_widget("canvas_menu_add_control_input", _menu_add_control_input);
@@ -83,6 +81,7 @@ PatchCanvas::PatchCanvas(SharedPtr<PatchModel> patch, int width, int height)
xml->get_widget("canvas_menu_load_plugin", _menu_load_plugin);
xml->get_widget("canvas_menu_load_patch", _menu_load_patch);
xml->get_widget("canvas_menu_new_patch", _menu_new_patch);
+ xml->get_widget("canvas_menu_edit", _menu_edit);
// Add port menu items
_menu_add_audio_input->signal_activate().connect(
@@ -118,6 +117,9 @@ PatchCanvas::PatchCanvas(SharedPtr<PatchModel> patch, int width, int height)
_menu_load_plugin->signal_activate().connect(sigc::mem_fun(this, &PatchCanvas::menu_load_plugin));
_menu_load_patch->signal_activate().connect(sigc::mem_fun(this, &PatchCanvas::menu_load_patch));
_menu_new_patch->signal_activate().connect(sigc::mem_fun(this, &PatchCanvas::menu_new_patch));
+ _menu_edit->signal_activate().connect(sigc::mem_fun(this, &PatchCanvas::menu_edit_toggled));
+
+ _patch->signal_editable.connect(sigc::mem_fun(this, &PatchCanvas::patch_editable_changed));
}
@@ -143,7 +145,7 @@ PatchCanvas::build_menus()
Gtk::MenuItem* internal_menu_item = &(_menu->items().back());
_internal_menu = Gtk::manage(new Gtk::Menu());
internal_menu_item->set_submenu(*_internal_menu);
- _menu->reorder_child(*internal_menu_item, 2);
+ _menu->reorder_child(*internal_menu_item, 4);
}
// Build skeleton LV2 plugin class heirarchy for 'Plugin' menu
@@ -225,7 +227,7 @@ PatchCanvas::build_plugin_menu()
Gtk::MenuItem* plugin_menu_item = &(_menu->items().back());
_plugin_menu = Gtk::manage(new Gtk::Menu());
plugin_menu_item->set_submenu(*_plugin_menu);
- _menu->reorder_child(*plugin_menu_item, 3);
+ _menu->reorder_child(*plugin_menu_item, 5);
}
Glib::Mutex::Lock lock(PluginModel::rdf_world()->mutex());
@@ -527,7 +529,6 @@ PatchCanvas::canvas_event(GdkEvent* event)
bool ret = false;
switch (event->type) {
-
case GDK_BUTTON_PRESS:
if (event->button.button == 3) {
_last_click_x = (int)event->button.x;
@@ -560,10 +561,7 @@ PatchCanvas::canvas_key_event(GdkEventKey* event)
return true;
case GDK_e:
if (event->state == 0) {
- if (_patch->get_editable() == true)
- _patch->set_editable(false);
- else
- _patch->set_editable(true);
+ _patch->set_editable(!_patch->get_editable());
return true;
} else {
return false;
@@ -829,5 +827,20 @@ PatchCanvas::menu_new_patch()
}
+void
+PatchCanvas::menu_edit_toggled()
+{
+ _patch->set_editable(_menu_edit->get_active());
+}
+
+
+void
+PatchCanvas::patch_editable_changed(bool editable)
+{
+ if (_menu_edit->get_active() != editable)
+ _menu_edit->set_active(editable);
+}
+
+
} // namespace GUI
} // namespace Ingen
diff --git a/src/gui/PatchCanvas.hpp b/src/gui/PatchCanvas.hpp
index d8a1cbe7..41787929 100644
--- a/src/gui/PatchCanvas.hpp
+++ b/src/gui/PatchCanvas.hpp
@@ -98,6 +98,8 @@ private:
void menu_load_plugin();
void menu_new_patch();
void menu_load_patch();
+ void menu_edit_toggled();
+ void patch_editable_changed(bool editable);
void load_plugin(WeakPtr<PluginModel> plugin);
void build_menus();
@@ -146,23 +148,22 @@ private:
ClassMenus _class_menus;
- bool _human_names;
- bool _show_port_names;
- Gtk::Menu* _menu;
- Gtk::Menu* _internal_menu;
- Gtk::Menu* _classless_menu;
- Gtk::Menu* _plugin_menu;
- /*Gtk::MenuItem* _menu_add_number_control;
- Gtk::MenuItem* _menu_add_button_control;*/
- Gtk::MenuItem* _menu_add_audio_input;
- Gtk::MenuItem* _menu_add_audio_output;
- Gtk::MenuItem* _menu_add_control_input;
- Gtk::MenuItem* _menu_add_control_output;
- Gtk::MenuItem* _menu_add_event_input;
- Gtk::MenuItem* _menu_add_event_output;
- Gtk::MenuItem* _menu_load_plugin;
- Gtk::MenuItem* _menu_load_patch;
- Gtk::MenuItem* _menu_new_patch;
+ bool _human_names;
+ bool _show_port_names;
+ Gtk::Menu* _menu;
+ Gtk::Menu* _internal_menu;
+ Gtk::Menu* _classless_menu;
+ Gtk::Menu* _plugin_menu;
+ Gtk::MenuItem* _menu_add_audio_input;
+ Gtk::MenuItem* _menu_add_audio_output;
+ Gtk::MenuItem* _menu_add_control_input;
+ Gtk::MenuItem* _menu_add_control_output;
+ Gtk::MenuItem* _menu_add_event_input;
+ Gtk::MenuItem* _menu_add_event_output;
+ Gtk::MenuItem* _menu_load_plugin;
+ Gtk::MenuItem* _menu_load_patch;
+ Gtk::MenuItem* _menu_new_patch;
+ Gtk::CheckMenuItem* _menu_edit;
};
diff --git a/src/gui/ingen_gui.glade b/src/gui/ingen_gui.glade
index e2ab7354..462b3273 100644
--- a/src/gui/ingen_gui.glade
+++ b/src/gui/ingen_gui.glade
@@ -2861,6 +2861,20 @@ Contributors:
<widget class="GtkMenu" id="canvas_menu">
<property name="visible">True</property>
<child>
+ <widget class="GtkCheckMenuItem" id="canvas_menu_edit">
+ <property name="visible">True</property>
+ <property name="tooltip" translatable="yes">Toggle edit mode</property>
+ <property name="label" translatable="yes">_Edit</property>
+ <property name="use_underline">True</property>
+ <property name="active">True</property>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkSeparatorMenuItem" id="menuitem1">
+ <property name="visible">True</property>
+ </widget>
+ </child>
+ <child>
<widget class="GtkImageMenuItem" id="input1">
<property name="label">_Input</property>
<property name="visible">True</property>
@@ -2949,6 +2963,11 @@ Contributors:
</widget>
</child>
<child>
+ <widget class="GtkSeparatorMenuItem" id="menuitem2">
+ <property name="visible">True</property>
+ </widget>
+ </child>
+ <child>
<widget class="GtkImageMenuItem" id="canvas_menu_load_patch">
<property name="label">_Load Patch...</property>
<property name="visible">True</property>