summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/PatchCanvas.cpp31
-rw-r--r--src/gui/PatchCanvas.hpp35
-rw-r--r--src/gui/ingen_gui.glade19
3 files changed, 59 insertions, 26 deletions
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>