diff options
author | David Robillard <d@drobilla.net> | 2012-11-21 18:45:38 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-11-21 18:45:38 +0000 |
commit | 3b257a6a2f81c677cab83111051a79c5c3d5307f (patch) | |
tree | c771b0cd89528d51897db11b84601999281c734c /src/gui | |
parent | 716e1e839790be24ebfa56c5fe8b688a3def60d2 (diff) | |
download | ingen-3b257a6a2f81c677cab83111051a79c5c3d5307f.tar.gz ingen-3b257a6a2f81c677cab83111051a79c5c3d5307f.tar.bz2 ingen-3b257a6a2f81c677cab83111051a79c5c3d5307f.zip |
Move human name and port label options to main configuration.
This makes it possible to persistently set the desired style in
configuration files.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4843 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/Configuration.cpp | 1 | ||||
-rw-r--r-- | src/gui/Configuration.hpp | 7 | ||||
-rw-r--r-- | src/gui/GraphBox.cpp | 20 | ||||
-rw-r--r-- | src/gui/GraphCanvas.cpp | 8 | ||||
-rw-r--r-- | src/gui/GraphPortModule.cpp | 9 | ||||
-rw-r--r-- | src/gui/NodeModule.cpp | 8 | ||||
-rw-r--r-- | src/gui/Port.cpp | 30 |
7 files changed, 50 insertions, 33 deletions
diff --git a/src/gui/Configuration.cpp b/src/gui/Configuration.cpp index 42344893..0932c2ee 100644 --- a/src/gui/Configuration.cpp +++ b/src/gui/Configuration.cpp @@ -40,7 +40,6 @@ using namespace Ingen::Client; Configuration::Configuration(App& app) // Colours from the Tango palette with modified V : _app(app) - , _name_style(HUMAN) , _audio_port_color(0x4A8A0EFF) // Green , _control_port_color(0x244678FF) // Blue , _cv_port_color(0x248780FF) // Teal (between audio and control) diff --git a/src/gui/Configuration.hpp b/src/gui/Configuration.hpp index 6e2afaf2..0a9a81f7 100644 --- a/src/gui/Configuration.hpp +++ b/src/gui/Configuration.hpp @@ -54,19 +54,12 @@ public: uint32_t get_port_color(const Client::PortModel* p); - enum NameStyle { PATH, HUMAN, NONE }; - - NameStyle name_style() const { return _name_style; } - void set_name_style(NameStyle s) { _name_style = s; } - private: App& _app; /** Most recent graph folder shown in open dialog */ std::string _graph_folder; - NameStyle _name_style; - uint32_t _audio_port_color; uint32_t _control_port_color; uint32_t _cv_port_color; diff --git a/src/gui/GraphBox.cpp b/src/gui/GraphBox.cpp index b0847f4a..2fd796d8 100644 --- a/src/gui/GraphBox.cpp +++ b/src/gui/GraphBox.cpp @@ -24,6 +24,7 @@ #include <gtkmm/stock.h> #include "ingen/Interface.hpp" +#include "ingen/Configuration.hpp" #include "ingen/client/ClientStore.hpp" #include "ingen/client/GraphModel.hpp" @@ -183,8 +184,8 @@ GraphBox::init_box(App& app) _menu_view_graph_tree_window->signal_activate().connect( sigc::mem_fun<void>(_app->graph_tree(), &GraphTreeWindow::present)); - _menu_help_about->signal_activate().connect(sigc::hide_return( - sigc::mem_fun(_app, &App::show_about))); + _menu_help_about->signal_activate().connect( + sigc::hide_return(sigc::mem_fun(_app, &App::show_about))); _breadcrumbs = new BreadCrumbs(*_app); _breadcrumbs->signal_graph_selected.connect( @@ -279,6 +280,11 @@ GraphBox::set_graph(SharedPtr<const GraphModel> graph, _view->signal_object_left.connect( sigc::mem_fun(this, &GraphBox::object_left)); + _menu_human_names->set_active( + _app->world()->conf().option("human-names").get_bool()); + _menu_show_port_names->set_active( + _app->world()->conf().option("port-labels").get_bool()); + _enable_signal = true; } @@ -684,15 +690,17 @@ void GraphBox::event_human_names_toggled() { _view->canvas()->show_human_names(_menu_human_names->get_active()); - if (_menu_human_names->get_active()) - _app->configuration()->set_name_style(Configuration::HUMAN); - else - _app->configuration()->set_name_style(Configuration::PATH); + _app->world()->conf().set( + "human-names", + _app->world()->forge().make(_menu_human_names->get_active())); } void GraphBox::event_port_names_toggled() { + _app->world()->conf().set( + "port-labels", + _app->world()->forge().make(_menu_show_port_names->get_active())); if (_menu_show_port_names->get_active()) { _view->canvas()->set_direction(GANV_DIRECTION_RIGHT); _view->canvas()->show_port_names(true); diff --git a/src/gui/GraphCanvas.cpp b/src/gui/GraphCanvas.cpp index 6dfb9175..4405cbb6 100644 --- a/src/gui/GraphCanvas.cpp +++ b/src/gui/GraphCanvas.cpp @@ -26,11 +26,12 @@ #include "ganv/Circle.hpp" #include "ingen/Builder.hpp" #include "ingen/ClashAvoider.hpp" +#include "ingen/Configuration.hpp" #include "ingen/Interface.hpp" #include "ingen/Log.hpp" #include "ingen/World.hpp" -#include "ingen/client/ClientStore.hpp" #include "ingen/client/BlockModel.hpp" +#include "ingen/client/ClientStore.hpp" #include "ingen/client/GraphModel.hpp" #include "ingen/client/PluginModel.hpp" #include "ingen/serialisation/Serialiser.hpp" @@ -78,6 +79,7 @@ GraphCanvas::GraphCanvas(App& app, , _classless_menu(NULL) , _plugin_menu(NULL) , _human_names(true) + , _show_port_names(true) { Glib::RefPtr<Gtk::Builder> xml = WidgetFactory::create("canvas_menu"); xml->get_widget("canvas_menu", _menu); @@ -146,6 +148,9 @@ GraphCanvas::GraphCanvas(App& app, sigc::mem_fun(this, &GraphCanvas::menu_load_graph)); _menu_new_graph->signal_activate().connect( sigc::mem_fun(this, &GraphCanvas::menu_new_graph)); + + show_human_names(app.world()->conf().option("human-names").get_bool()); + show_port_names(app.world()->conf().option("port-labels").get_bool()); } void @@ -327,6 +332,7 @@ show_module_human_names(GanvNode* node, void* data) pmod->show_human_names(b); } } + void GraphCanvas::show_human_names(bool b) { diff --git a/src/gui/GraphPortModule.cpp b/src/gui/GraphPortModule.cpp index 443626dc..c3c3bda3 100644 --- a/src/gui/GraphPortModule.cpp +++ b/src/gui/GraphPortModule.cpp @@ -18,6 +18,7 @@ #include <string> #include <utility> +#include "ingen/Configuration.hpp" #include "ingen/Interface.hpp" #include "ingen/client/BlockModel.hpp" #include "ingen/client/GraphModel.hpp" @@ -140,11 +141,11 @@ GraphPortModule::property_changed(const Raul::URI& key, const Raul::Atom& value) move_to(get_x(), value.get_float()); } } else if (value.type() == uris.forge.String) { - if (key == uris.lv2_name - && app().configuration()->name_style() == Configuration::HUMAN) { + if (key == uris.lv2_name && + app().world()->conf().option("human-names").get_bool()) { set_name(value.get_string()); - } else if (key == uris.lv2_symbol - && app().configuration()->name_style() == Configuration::PATH) { + } else if (key == uris.lv2_symbol && + !app().world()->conf().option("human-names").get_bool()) { set_name(value.get_string()); } } else if (value.type() == uris.forge.Bool) { diff --git a/src/gui/NodeModule.cpp b/src/gui/NodeModule.cpp index 462ac94b..144bd1be 100644 --- a/src/gui/NodeModule.cpp +++ b/src/gui/NodeModule.cpp @@ -21,6 +21,7 @@ #include "lv2/lv2plug.in/ns/ext/atom/util.h" +#include "ingen/Configuration.hpp" #include "ingen/Interface.hpp" #include "ingen/Log.hpp" #include "ingen/client/BlockModel.hpp" @@ -252,7 +253,8 @@ NodeModule::embed_gui(bool embed) void NodeModule::rename() { - if (app().configuration()->name_style() == Configuration::PATH) { + if (app().world()->conf().option("port-labels").get_bool() && + !app().world()->conf().option("human-names").get_bool()) { set_label(_block->path().symbol()); } } @@ -261,7 +263,7 @@ void NodeModule::new_port_view(SharedPtr<const PortModel> port) { Port::create(app(), *this, port, - app().configuration()->name_style() == Configuration::HUMAN); + app().world()->conf().option("human-names").get_bool()); port->signal_value_changed().connect( sigc::bind<0>(sigc::mem_fun(this, &NodeModule::value_changed), @@ -419,7 +421,7 @@ NodeModule::property_changed(const Raul::URI& key, const Raul::Atom& value) } } else if (value.type() == uris.forge.String) { if (key == uris.lv2_name - && app().configuration()->name_style() == Configuration::HUMAN) { + && app().world()->conf().option("human-names").get_bool()) { set_label(value.get_string()); } } diff --git a/src/gui/Port.cpp b/src/gui/Port.cpp index f747234a..843f0816 100644 --- a/src/gui/Port.cpp +++ b/src/gui/Port.cpp @@ -18,6 +18,7 @@ #include <string> #include "ganv/Module.hpp" +#include "ingen/Configuration.hpp" #include "ingen/Interface.hpp" #include "ingen/Log.hpp" #include "ingen/client/GraphModel.hpp" @@ -44,15 +45,19 @@ Port::create(App& app, bool human_name, bool flip) { - Glib::ustring label(human_name ? "" : pm->path().symbol()); - if (human_name) { - const Raul::Atom& name = pm->get_property(app.uris().lv2_name); - if (name.type() == app.forge().String) { - label = name.get_string(); + Glib::ustring label; + if (app.world()->conf().option("port-labels").get_bool()) { + if (human_name) { + const Raul::Atom& name = pm->get_property(app.uris().lv2_name); + if (name.type() == app.forge().String) { + label = name.get_string(); + } else { + const SharedPtr<const BlockModel> parent(PtrCast<const BlockModel>(pm->parent())); + if (parent && parent->plugin_model()) + label = parent->plugin_model()->port_human_name(pm->index()); + } } else { - const SharedPtr<const BlockModel> parent(PtrCast<const BlockModel>(pm->parent())); - if (parent && parent->plugin_model()) - label = parent->plugin_model()->port_human_name(pm->index()); + label = pm->path().symbol(); } } return new Port(app, module, pm, label, flip); @@ -135,8 +140,10 @@ Port::show_menu(GdkEventButton* ev) void Port::moved() { - if (_app.configuration()->name_style() == Configuration::PATH) + if (_app.world()->conf().option("port-labels").get_bool() && + !_app.world()->conf().option("human-names").get_bool()) { set_label(model()->symbol().c_str()); + } } void @@ -340,8 +347,9 @@ Port::property_changed(const Raul::URI& key, const Raul::Atom& value) if (value == uris.lv2_toggled) set_control_is_toggle(true); } else if (key == uris.lv2_name) { - if (value.type() == uris.forge.String - && _app.configuration()->name_style() == Configuration::HUMAN) { + if (value.type() == uris.forge.String && + _app.world()->conf().option("port-labels").get_bool() && + _app.world()->conf().option("human-names").get_bool()) { set_label(value.get_string()); } } |