summaryrefslogtreecommitdiffstats
path: root/src/libs
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs')
-rw-r--r--src/libs/client/NodeModel.cpp16
-rw-r--r--src/libs/client/NodeModel.hpp3
-rw-r--r--src/libs/client/PatchModel.cpp78
-rw-r--r--src/libs/client/PatchModel.hpp17
-rw-r--r--src/libs/gui/PatchCanvas.cpp24
-rw-r--r--src/libs/gui/PatchView.cpp27
-rw-r--r--src/libs/gui/PatchView.hpp3
-rw-r--r--src/libs/gui/ingen_gui.glade29
8 files changed, 92 insertions, 105 deletions
diff --git a/src/libs/client/NodeModel.cpp b/src/libs/client/NodeModel.cpp
index 58ddb56b..4e3a0a11 100644
--- a/src/libs/client/NodeModel.cpp
+++ b/src/libs/client/NodeModel.cpp
@@ -74,22 +74,6 @@ NodeModel::clear()
void
-NodeModel::set_path(const Path& p)
-{
- const string old_path = _path;
-
- ObjectModel::set_path(p);
-
- // FIXME: rename
-// for (PortModelList::iterator i = _ports.begin(); i != _ports.end(); ++i)
-// (*i)->set_path(_path + "/" + (*i)->path().name());
-
- //if (_parent && old_path.length() > 0)
- // parent_patch()->rename_node(old_path, p);
-}
-
-
-void
NodeModel::add_child(SharedPtr<ObjectModel> c)
{
assert(c->parent().get() == this);
diff --git a/src/libs/client/NodeModel.hpp b/src/libs/client/NodeModel.hpp
index ccf2f1fb..fcaacd0e 100644
--- a/src/libs/client/NodeModel.hpp
+++ b/src/libs/client/NodeModel.hpp
@@ -79,9 +79,6 @@ protected:
virtual void clear();
- friend class PatchModel;
- void set_path(const Path& p);
-
bool _polyphonic;
PortModelList _ports; ///< List of ports (not a Table to preserve order)
string _plugin_uri; ///< Plugin URI (if PluginModel is unknown)
diff --git a/src/libs/client/PatchModel.cpp b/src/libs/client/PatchModel.cpp
index f67c7706..3702a41a 100644
--- a/src/libs/client/PatchModel.cpp
+++ b/src/libs/client/PatchModel.cpp
@@ -28,33 +28,6 @@ namespace Client {
void
-PatchModel::set_path(const Path& new_path)
-{
- ObjectModel::set_path(new_path);
-#if 0
- // FIXME: haack
- if (new_path == "") {
- _path = "";
- return;
- }
-
- NodeModel::set_path(new_path);
- for (Children::iterator i = _children.begin(); i != _children.end(); ++i)
- (*i).second->set_path(_path +"/"+ (*i).second->path().name());
-
-#ifdef DEBUG
- // Be sure connection paths are updated and sane
- for (list<SharedPtr<ConnectionModel> >::iterator j = _connections.begin();
- j != _connections.end(); ++j) {
- assert((*j)->src_port_path().parent().parent() == new_path);
- assert((*j)->src_port_path().parent().parent() == new_path);
- }
-#endif
-#endif
-}
-
-
-void
PatchModel::add_child(SharedPtr<ObjectModel> c)
{
assert(c->parent().get() == this);
@@ -120,23 +93,6 @@ PatchModel::remove_child(SharedPtr<ObjectModel> o)
}
}
-#if 0
-void
-PatchModel::remove_node(const string& name)
-{
- assert(name.find("/") == string::npos);
- NodeModelMap::iterator i = _children.find(name);
- if (i != _children.end()) {
- //delete i->second;
- _children.erase(i);
- removed_node_sig.emit(name);
- i->second->parent().reset();
- return;
- }
-
- cerr << "[PatchModel::remove_node] " << _path << ": failed to find node " << name << endl;
-}
-#endif
void
PatchModel::clear()
@@ -160,40 +116,6 @@ PatchModel::clear()
}
-/** Updated the map key of the given node.
- *
- * The NodeModel must already have it's new path set to @a new_path, or this will
- * abort with a fatal error.
- */
-void
-PatchModel::rename_node(const Path& old_path, const Path& new_path)
-{
- cerr << "FIXME: node rename" << endl;
-#if 0
- assert(old_path.parent() == path());
- assert(new_path.parent() == path());
-
- NodeModelMap::iterator i = _children.find(old_path.name());
-
- if (i != _children.end()) {
- SharedPtr<NodeModel> nm = (*i).second;
- for (list<SharedPtr<ConnectionModel> >::iterator j = _connections.begin(); j != _connections.end(); ++j) {
- if ((*j)->src_port_path().parent() == old_path)
- (*j)->src_port_path(new_path.base() + (*j)->src_port_path().name());
- if ((*j)->dst_port_path().parent() == old_path)
- (*j)->dst_port_path(new_path.base() + (*j)->dst_port_path().name());
- }
- _children.erase(i);
- assert(nm->path() == new_path);
- _children[new_path.name()] = nm;
- return;
- }
-
- cerr << "[PatchModel::rename_node] " << _path << ": failed to find node " << old_path << endl;
-#endif
-}
-
-
SharedPtr<ConnectionModel>
PatchModel::get_connection(const string& src_port_path, const string& dst_port_path) const
{
diff --git a/src/libs/client/PatchModel.hpp b/src/libs/client/PatchModel.hpp
index af1ef101..16e145e9 100644
--- a/src/libs/client/PatchModel.hpp
+++ b/src/libs/client/PatchModel.hpp
@@ -52,6 +52,15 @@ public:
const string& filename() const { return _filename; }
bool enabled() const { return _enabled; }
bool polyphonic() const;
+
+ /** "editable" = arranging,connecting,adding,deleting,etc
+ * 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;
+ editable_sig.emit(e);
+ } }
// Signals
sigc::signal<void, SharedPtr<NodeModel> > new_node_sig;
@@ -60,6 +69,7 @@ public:
sigc::signal<void, SharedPtr<ConnectionModel> > removed_connection_sig;
sigc::signal<void> enabled_sig;
sigc::signal<void> disabled_sig;
+ sigc::signal<void, bool> editable_sig;
private:
friend class Store;
@@ -67,7 +77,8 @@ private:
PatchModel(const Path& patch_path, size_t internal_poly)
: NodeModel("ingen:patch", patch_path, false), // FIXME
_enabled(false),
- _poly(internal_poly)
+ _poly(internal_poly),
+ _editable(true)
{
}
@@ -76,9 +87,6 @@ private:
void enable();
void disable();
void clear();
- void set_path(const Path& path);
- //void add_node(SharedPtr<NodeModel> nm);
- //void remove_node(SharedPtr<NodeModel> nm);
void add_child(SharedPtr<ObjectModel> c);
bool remove_child(SharedPtr<ObjectModel> c);
@@ -92,6 +100,7 @@ private:
string _filename;
bool _enabled;
size_t _poly;
+ bool _editable;
};
typedef Table<string, SharedPtr<PatchModel> > PatchModelMap;
diff --git a/src/libs/gui/PatchCanvas.cpp b/src/libs/gui/PatchCanvas.cpp
index e209a43f..cbe931ab 100644
--- a/src/libs/gui/PatchCanvas.cpp
+++ b/src/libs/gui/PatchCanvas.cpp
@@ -393,6 +393,8 @@ PatchCanvas::canvas_event(GdkEvent* event)
{
assert(event);
+ static bool control_modded = false;
+
switch (event->type) {
case GDK_BUTTON_PRESS:
@@ -403,11 +405,25 @@ PatchCanvas::canvas_event(GdkEvent* event)
}
break;
- /*case GDK_KEY_PRESS:
- if (event->key.keyval == GDK_Delete)
- destroy_selected();
+ case GDK_KEY_PRESS:
+ if (event->key.keyval == GDK_Delete) {
+ destroy_selection();
+ } else if (event->key.keyval == GDK_Control_L || event->key.keyval == GDK_Control_R) {
+ if (_patch->get_editable() == true) {
+ control_modded = true;
+ _patch->set_editable(false);
+ }
+ }
+ break;
+
+ case GDK_KEY_RELEASE:
+ if (event->key.keyval == GDK_Control_L || event->key.keyval == GDK_Control_R) {
+ if (_patch->get_editable() == false &&control_modded) {
+ control_modded = false;
+ _patch->set_editable(true);
+ }
+ }
break;
- */
default:
break;
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)
diff --git a/src/libs/gui/PatchView.hpp b/src/libs/gui/PatchView.hpp
index c3d0fc8a..dcc2ffcc 100644
--- a/src/libs/gui/PatchView.hpp
+++ b/src/libs/gui/PatchView.hpp
@@ -71,6 +71,8 @@ private:
void process_toggled();
void clear_clicked();
void refresh_clicked();
+ void on_editable_sig(bool locked);
+ void editable_toggled();
void enable();
void disable();
@@ -90,6 +92,7 @@ private:
Gtk::ToolButton* _save_but;
Gtk::ToolButton* _zoom_normal_but;
Gtk::ToolButton* _zoom_full_but;
+ Gtk::ToggleToolButton* _edit_mode_but;
Gtk::Viewport* _breadcrumb_container;
bool _enable_signal;
diff --git a/src/libs/gui/ingen_gui.glade b/src/libs/gui/ingen_gui.glade
index a4609be7..44ffc699 100644
--- a/src/libs/gui/ingen_gui.glade
+++ b/src/libs/gui/ingen_gui.glade
@@ -1491,6 +1491,30 @@
<property name="expand">False</property>
</packing>
</child>
+ <child>
+ <widget class="GtkSeparatorToolItem" id="toolbutton1">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkToggleToolButton" id="patch_view_edit_mode_but">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="tooltip" translatable="yes">Enable edit mode to move objects.
+Disable edit mode to play controls.
+Hold &lt;Ctrl&gt; to play controls in either mode.</property>
+ <property name="label" translatable="yes">Edit</property>
+ <property name="stock_id">gtk-edit</property>
+ <property name="active">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
@@ -1507,6 +1531,11 @@
<widget class="GtkScrolledWindow" id="patch_view_scrolledwindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="has_focus">True</property>
+ <property name="is_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="has_default">True</property>
+ <property name="events">GDK_EXPOSURE_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_MOTION_MASK | GDK_BUTTON1_MOTION_MASK | GDK_BUTTON2_MOTION_MASK | GDK_BUTTON3_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_FOCUS_CHANGE_MASK | GDK_STRUCTURE_MASK | GDK_PROPERTY_CHANGE_MASK | GDK_VISIBILITY_NOTIFY_MASK | GDK_PROXIMITY_IN_MASK | GDK_PROXIMITY_OUT_MASK | GDK_SUBSTRUCTURE_MASK | GDK_SCROLL_MASK</property>
<property name="border_width">1</property>
<property name="shadow_type">GTK_SHADOW_IN</property>
<child>