summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2014-03-16 00:55:18 +0000
committerDavid Robillard <d@drobilla.net>2014-03-16 00:55:18 +0000
commit612186c6dd6549bfd3a44ba61181ce1b6ac49733 (patch)
treec4d6ab490bc77a920acec8f1a86da1c1c0ac449d /src/gui
parentddbce4eab17e23636e2ce9ffee5b4f1c16f3722a (diff)
downloadingen-612186c6dd6549bfd3a44ba61181ce1b6ac49733.tar.gz
ingen-612186c6dd6549bfd3a44ba61181ce1b6ac49733.tar.bz2
ingen-612186c6dd6549bfd3a44ba61181ce1b6ac49733.zip
Allow user to enable or disable sprung layout.
This setting is saved with the patch so sprung patches remain sprung when loaded again, but manually arranged patches won't be mangled. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@5340 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/GraphBox.cpp46
-rw-r--r--src/gui/GraphBox.hpp7
-rw-r--r--src/gui/GraphView.cpp4
-rw-r--r--src/gui/ingen_gui.ui15
4 files changed, 63 insertions, 9 deletions
diff --git a/src/gui/GraphBox.cpp b/src/gui/GraphBox.cpp
index ad9aea56..99debec3 100644
--- a/src/gui/GraphBox.cpp
+++ b/src/gui/GraphBox.cpp
@@ -88,7 +88,8 @@ GraphBox::GraphBox(BaseObjectType* cobject,
xml->get_widget("graph_view_engine_window_menuitem", _menu_view_engine_window);
xml->get_widget("graph_properties_menuitem", _menu_view_graph_properties);
xml->get_widget("graph_fullscreen_menuitem", _menu_fullscreen);
- xml->get_widget("graph_animate_canvas_menuitem", _menu_animate_canvas);
+ xml->get_widget("graph_animate_signals_menuitem", _menu_animate_signals);
+ xml->get_widget("graph_sprung_layout_menuitem", _menu_sprung_layout);
xml->get_widget("graph_human_names_menuitem", _menu_human_names);
xml->get_widget("graph_show_port_names_menuitem", _menu_show_port_names);
xml->get_widget("graph_zoom_in_menuitem", _menu_zoom_in);
@@ -126,8 +127,10 @@ GraphBox::GraphBox(BaseObjectType* cobject,
sigc::mem_fun(this, &GraphBox::event_quit));
_menu_fullscreen->signal_activate().connect(
sigc::mem_fun(this, &GraphBox::event_fullscreen_toggled));
- _menu_animate_canvas->signal_activate().connect(
- sigc::mem_fun(this, &GraphBox::event_animate_canvas_toggled));
+ _menu_animate_signals->signal_activate().connect(
+ sigc::mem_fun(this, &GraphBox::event_animate_signals_toggled));
+ _menu_sprung_layout->signal_activate().connect(
+ sigc::mem_fun(this, &GraphBox::event_sprung_layout_toggled));
_menu_human_names->signal_activate().connect(
sigc::mem_fun(this, &GraphBox::event_human_names_toggled));
_menu_show_doc_pane->signal_activate().connect(
@@ -246,6 +249,16 @@ GraphBox::set_graph(SPtr<const GraphModel> graph,
assert(_view);
+ graph->signal_property().connect(
+ sigc::mem_fun(this, &GraphBox::property_changed));
+
+ if (ganv_canvas_supports_sprung_layout(_view->canvas()->gobj())) {
+ _menu_sprung_layout->set_active(true);
+ } else {
+ _menu_sprung_layout->set_active(false);
+ _menu_sprung_layout->set_sensitive(false);
+ }
+
// Add view to our alignment
if (_view->get_parent())
_view->get_parent()->remove(*_view.get());
@@ -316,6 +329,16 @@ GraphBox::graph_port_removed(SPtr<const PortModel> port)
}
void
+GraphBox::property_changed(const Raul::URI& predicate, const Atom& value)
+{
+ if (predicate == _app->uris().ingen_sprungLayout) {
+ if (value.type() == _app->uris().forge.Bool) {
+ _menu_sprung_layout->set_active(value.get<int32_t>());
+ }
+ }
+}
+
+void
GraphBox::set_documentation(const std::string& doc, bool html)
{
_doc_scrolledwindow->remove();
@@ -702,12 +725,25 @@ GraphBox::event_status_bar_toggled()
}
void
-GraphBox::event_animate_canvas_toggled()
+GraphBox::event_animate_signals_toggled()
{
_app->interface()->set_property(
Raul::URI("ingen:/clients/this"),
_app->uris().ingen_broadcast,
- _app->forge().make((bool)_menu_animate_canvas->get_active()));
+ _app->forge().make((bool)_menu_animate_signals->get_active()));
+}
+
+void
+GraphBox::event_sprung_layout_toggled()
+{
+ const bool sprung = _menu_sprung_layout->get_active();
+
+ ganv_canvas_set_sprung_layout(_view->canvas()->gobj(), sprung);
+
+ Resource::Properties properties;
+ properties.insert(make_pair(_app->uris().ingen_sprungLayout,
+ _app->forge().make(sprung)));
+ _app->interface()->put(_graph->uri(), properties);
}
void
diff --git a/src/gui/GraphBox.hpp b/src/gui/GraphBox.hpp
index 45cfec94..e06a7c5a 100644
--- a/src/gui/GraphBox.hpp
+++ b/src/gui/GraphBox.hpp
@@ -94,6 +94,7 @@ public:
private:
void graph_port_added(SPtr<const Client::PortModel> port);
void graph_port_removed(SPtr<const Client::PortModel> port);
+ void property_changed(const Raul::URI& predicate, const Atom& value);
void show_status(const Client::ObjectModel* model);
int message_dialog(const Glib::ustring& message,
@@ -114,7 +115,8 @@ private:
void event_fullscreen_toggled();
void event_doc_pane_toggled();
void event_status_bar_toggled();
- void event_animate_canvas_toggled();
+ void event_animate_signals_toggled();
+ void event_sprung_layout_toggled();
void event_human_names_toggled();
void event_port_names_toggled();
void event_zoom_in();
@@ -145,7 +147,8 @@ private:
Gtk::MenuItem* _menu_select_all;
Gtk::MenuItem* _menu_close;
Gtk::MenuItem* _menu_quit;
- Gtk::CheckMenuItem* _menu_animate_canvas;
+ Gtk::CheckMenuItem* _menu_animate_signals;
+ Gtk::CheckMenuItem* _menu_sprung_layout;
Gtk::CheckMenuItem* _menu_human_names;
Gtk::CheckMenuItem* _menu_show_port_names;
Gtk::CheckMenuItem* _menu_show_doc_pane;
diff --git a/src/gui/GraphView.cpp b/src/gui/GraphView.cpp
index 414f21f9..444075b9 100644
--- a/src/gui/GraphView.cpp
+++ b/src/gui/GraphView.cpp
@@ -81,6 +81,10 @@ GraphView::set_graph(SPtr<const GraphModel> graph)
_poly_spin->set_increments(1, 4);
_poly_spin->set_value(graph->internal_poly());
+ if (ganv_canvas_supports_sprung_layout(_canvas->gobj())) {
+ ganv_canvas_set_sprung_layout(_canvas->gobj(), TRUE);
+ }
+
for (const auto& p : graph->properties())
property_changed(p.first, p.second);
diff --git a/src/gui/ingen_gui.ui b/src/gui/ingen_gui.ui
index 774127d4..8463b435 100644
--- a/src/gui/ingen_gui.ui
+++ b/src/gui/ingen_gui.ui
@@ -1004,17 +1004,28 @@ Contributors:
<object class="GtkMenu" id="graph_graph_menu_menu">
<property name="can_focus">False</property>
<child>
- <object class="GtkCheckMenuItem" id="graph_animate_canvas_menuitem">
+ <object class="GtkCheckMenuItem" id="graph_animate_signals_menuitem">
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Update control ports as values change.</property>
- <property name="label" translatable="yes">_Animate Canvas</property>
+ <property name="label" translatable="yes">Animate Signa_ls</property>
<property name="use_underline">True</property>
<accelerator key="l" signal="activate" modifiers="GDK_CONTROL_MASK"/>
</object>
</child>
<child>
+ <object class="GtkCheckMenuItem" id="graph_sprung_layout_menuitem">
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Sprung Layou_t</property>
+ <property name="use_underline">True</property>
+ <property name="active">True</property>
+ <accelerator key="t" signal="activate" modifiers="GDK_CONTROL_MASK"/>
+ </object>
+ </child>
+ <child>
<object class="GtkSeparatorMenuItem" id="menuitem5">
<property name="use_action_appearance">False</property>
<property name="visible">True</property>