summaryrefslogtreecommitdiffstats
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
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
-rw-r--r--bundles/ingen.lv2/ingen.ttl9
-rw-r--r--ingen/URIs.hpp1
-rw-r--r--ingen/ingen.h1
-rw-r--r--src/URIs.cpp1
-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
-rw-r--r--wscript2
9 files changed, 76 insertions, 10 deletions
diff --git a/bundles/ingen.lv2/ingen.ttl b/bundles/ingen.lv2/ingen.ttl
index 42055471..e3a06bf5 100644
--- a/bundles/ingen.lv2/ingen.ttl
+++ b/bundles/ingen.lv2/ingen.ttl
@@ -80,6 +80,15 @@ of the Graph's children, and :polyphonic specifies whether the graph is
seen as polyphonic to the Graph's parent.
""" .
+ingen:sprungLayout
+ a owl:DatatypeProperty ;
+ rdfs:domain ingen:Graph ;
+ rdfs:range xsd:boolean ;
+ rdfs:label "sprung layout" ;
+ rdfs:comment """
+Whether or not the graph has a "sprung" force-directed layout.
+""" .
+
ingen:value
a owl:DatatypeProperty ;
rdfs:domain lv2:Port ;
diff --git a/ingen/URIs.hpp b/ingen/URIs.hpp
index ba822947..4c31ccdc 100644
--- a/ingen/URIs.hpp
+++ b/ingen/URIs.hpp
@@ -90,6 +90,7 @@ public:
const Quark ingen_polyphonic;
const Quark ingen_polyphony;
const Quark ingen_prototype;
+ const Quark ingen_sprungLayout;
const Quark ingen_tail;
const Quark ingen_uiEmbedded;
const Quark ingen_value;
diff --git a/ingen/ingen.h b/ingen/ingen.h
index c3662c18..ba873c75 100644
--- a/ingen/ingen.h
+++ b/ingen/ingen.h
@@ -39,6 +39,7 @@
#define INGEN__polyphonic INGEN_NS "polyphonic"
#define INGEN__polyphony INGEN_NS "polyphony"
#define INGEN__prototype INGEN_NS "prototype"
+#define INGEN__sprungLayout INGEN_NS "sprungLayout"
#define INGEN__tail INGEN_NS "tail"
#define INGEN__uiEmbedded INGEN_NS "uiEmbedded"
#define INGEN__value INGEN_NS "value"
diff --git a/src/URIs.cpp b/src/URIs.cpp
index b6bf7ad8..6d41482d 100644
--- a/src/URIs.cpp
+++ b/src/URIs.cpp
@@ -80,6 +80,7 @@ URIs::URIs(Forge& f, URIMap* map)
, ingen_polyphonic (forge, map, INGEN__polyphonic)
, ingen_polyphony (forge, map, INGEN__polyphony)
, ingen_prototype (forge, map, INGEN__prototype)
+ , ingen_sprungLayout (forge, map, INGEN__sprungLayout)
, ingen_tail (forge, map, INGEN__tail)
, ingen_uiEmbedded (forge, map, INGEN__uiEmbedded)
, ingen_value (forge, map, INGEN__value)
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>
diff --git a/wscript b/wscript
index dfed65d8..3b31541f 100644
--- a/wscript
+++ b/wscript
@@ -75,7 +75,7 @@ def configure(conf):
autowaf.check_pkg(conf, 'gtkmm-2.4', uselib_store='NEW_GTKMM',
atleast_version='2.14.0', mandatory=False)
autowaf.check_pkg(conf, 'ganv-1', uselib_store='GANV',
- atleast_version='1.2.1', mandatory=False)
+ atleast_version='1.2.3', mandatory=False)
if not Options.options.no_webkit:
autowaf.check_pkg(conf, 'webkit-1.0', uselib_store='WEBKIT',
atleast_version='1.4.0', mandatory=False)