diff options
author | David Robillard <d@drobilla.net> | 2014-03-16 00:55:18 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2014-03-16 00:55:18 +0000 |
commit | 612186c6dd6549bfd3a44ba61181ce1b6ac49733 (patch) | |
tree | c4d6ab490bc77a920acec8f1a86da1c1c0ac449d /src/gui/GraphBox.cpp | |
parent | ddbce4eab17e23636e2ce9ffee5b4f1c16f3722a (diff) | |
download | ingen-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/GraphBox.cpp')
-rw-r--r-- | src/gui/GraphBox.cpp | 46 |
1 files changed, 41 insertions, 5 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 |