summaryrefslogtreecommitdiffstats
path: root/src/libs/gui/PatchView.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs/gui/PatchView.cpp')
-rw-r--r--src/libs/gui/PatchView.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/libs/gui/PatchView.cpp b/src/libs/gui/PatchView.cpp
index 0246b98c..0a624dc0 100644
--- a/src/libs/gui/PatchView.cpp
+++ b/src/libs/gui/PatchView.cpp
@@ -51,6 +51,7 @@ PatchView::PatchView(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::X
xml->get_widget("patch_view_save_but", _save_but);
xml->get_widget("patch_view_zoom_full_but", _zoom_full_but);
xml->get_widget("patch_view_zoom_normal_but", _zoom_normal_but);
+ xml->get_widget("patch_view_edit_mode_but", _edit_mode_but);
xml->get_widget("patch_view_scrolledwindow", _canvas_scrolledwindow);
}
@@ -88,6 +89,15 @@ PatchView::set_patch(SharedPtr<PatchModel> patch)
_zoom_full_but->signal_clicked().connect(
sigc::mem_fun(_canvas.get(), &PatchCanvas::zoom_full));
+
+ patch->editable_sig.connect(sigc::mem_fun(
+ *this, &PatchView::on_editable_sig));
+
+ _edit_mode_but->signal_toggled().connect(sigc::mem_fun(
+ *this, &PatchView::editable_toggled));
+
+
+ _canvas->grab_focus();
}
@@ -111,6 +121,23 @@ PatchView::create(SharedPtr<PatchModel> patch)
void
+PatchView::on_editable_sig(bool editable)
+{
+ _edit_mode_but->set_active(editable);
+ _canvas->lock(!editable);
+}
+
+
+void
+PatchView::editable_toggled()
+{
+ const bool editable = _edit_mode_but->get_active();
+ _patch->set_editable(editable);
+ _canvas->lock(!editable);
+}
+
+
+void
PatchView::process_toggled()
{
if (!_enable_signal)