diff options
author | David Robillard <d@drobilla.net> | 2013-01-11 04:47:21 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2013-01-11 04:47:21 +0000 |
commit | 10e9a3a800a35916872abf9e354be4c554338e4e (patch) | |
tree | d6be3ce7993f5d8efd525629fd321b32a6341633 /src/gui | |
parent | 684eaf6b58e41f6758b160b882a6313faf0cff18 (diff) | |
download | ingen-10e9a3a800a35916872abf9e354be4c554338e4e.tar.gz ingen-10e9a3a800a35916872abf9e354be4c554338e4e.tar.bz2 ingen-10e9a3a800a35916872abf9e354be4c554338e4e.zip |
Use type safe enumerations.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4918 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/App.cpp | 2 | ||||
-rw-r--r-- | src/gui/ConnectWindow.cpp | 20 | ||||
-rw-r--r-- | src/gui/ConnectWindow.hpp | 2 | ||||
-rw-r--r-- | src/gui/GraphBox.cpp | 2 | ||||
-rw-r--r-- | src/gui/GraphCanvas.cpp | 4 | ||||
-rw-r--r-- | src/gui/GraphCanvas.hpp | 4 | ||||
-rw-r--r-- | src/gui/GraphPortModule.cpp | 4 | ||||
-rw-r--r-- | src/gui/LoadPluginWindow.cpp | 28 | ||||
-rw-r--r-- | src/gui/LoadPluginWindow.hpp | 2 | ||||
-rw-r--r-- | src/gui/NewSubgraphWindow.cpp | 6 | ||||
-rw-r--r-- | src/gui/SubgraphModule.cpp | 4 |
11 files changed, 39 insertions, 39 deletions
diff --git a/src/gui/App.cpp b/src/gui/App.cpp index d23cdc38..11da12f0 100644 --- a/src/gui/App.cpp +++ b/src/gui/App.cpp @@ -214,7 +214,7 @@ App::serialiser() void App::response(int32_t id, Status status, const std::string& subject) { - if (status) { + if (status != Status::SUCCESS) { std::string msg = ingen_status_string(status); if (!subject.empty()) { msg += ": " + subject; diff --git a/src/gui/ConnectWindow.cpp b/src/gui/ConnectWindow.cpp index 36827489..ab889461 100644 --- a/src/gui/ConnectWindow.cpp +++ b/src/gui/ConnectWindow.cpp @@ -59,7 +59,7 @@ ConnectWindow::ConnectWindow(BaseObjectType* cobject, , _disconnect_button(NULL) , _connect_button(NULL) , _quit_button(NULL) - , _mode(CONNECT_REMOTE) + , _mode(Mode::CONNECT_REMOTE) , _ping_id(-1) , _attached(false) , _finished_connecting(false) @@ -75,7 +75,7 @@ ConnectWindow::start(App& app, Ingen::World* world) _app = &app; if (world->engine()) { - _mode = INTERNAL; + _mode = Mode::INTERNAL; if (_widgets_loaded) { _internal_radio->set_active(true); } @@ -118,9 +118,9 @@ ConnectWindow::set_connected_to(SharedPtr<Ingen::Interface> engine) _server_radio->set_sensitive(true); _launch_radio->set_sensitive(true); - if (_mode == CONNECT_REMOTE ) + if (_mode == Mode::CONNECT_REMOTE) _url_entry->set_sensitive(true); - else if (_mode == LAUNCH_REMOTE ) + else if (_mode == Mode::LAUNCH_REMOTE) _port_spinbutton->set_sensitive(true); _progress_label->set_text(string("Disconnected")); @@ -161,7 +161,7 @@ ConnectWindow::connect(bool existing) Ingen::World* world = _app->world(); #ifdef HAVE_SOCKET - if (_mode == CONNECT_REMOTE) { + if (_mode == Mode::CONNECT_REMOTE) { Raul::URI uri("unix:///tmp/ingen.sock"); if (_widgets_loaded) { const std::string& user_uri = _url_entry->get_text(); @@ -190,7 +190,7 @@ ConnectWindow::connect(bool existing) Glib::signal_timeout().connect( sigc::mem_fun(this, &ConnectWindow::gtk_callback), 40); return; - } else if (_mode == LAUNCH_REMOTE) { + } else if (_mode == Mode::LAUNCH_REMOTE) { int port = _port_spinbutton->get_value_as_int(); std::stringstream ss; ss << port; @@ -214,7 +214,7 @@ ConnectWindow::connect(bool existing) return; } #endif - if (_mode == INTERNAL) { + if (_mode == Mode::INTERNAL) { if (!world->engine()) { world->load_module("server"); world->load_module("jack"); @@ -340,7 +340,7 @@ ConnectWindow::server_toggled() { _url_entry->set_sensitive(true); _port_spinbutton->set_sensitive(false); - _mode = CONNECT_REMOTE; + _mode = Mode::CONNECT_REMOTE; } void @@ -348,7 +348,7 @@ ConnectWindow::launch_toggled() { _url_entry->set_sensitive(false); _port_spinbutton->set_sensitive(true); - _mode = LAUNCH_REMOTE; + _mode = Mode::LAUNCH_REMOTE; } void @@ -356,7 +356,7 @@ ConnectWindow::internal_toggled() { _url_entry->set_sensitive(false); _port_spinbutton->set_sensitive(false); - _mode = INTERNAL; + _mode = Mode::INTERNAL; } bool diff --git a/src/gui/ConnectWindow.hpp b/src/gui/ConnectWindow.hpp index 2f7a43e7..ade0f3b1 100644 --- a/src/gui/ConnectWindow.hpp +++ b/src/gui/ConnectWindow.hpp @@ -59,7 +59,7 @@ public: bool quit_flag() const { return _quit_flag; } private: - enum Mode { CONNECT_REMOTE, LAUNCH_REMOTE, INTERNAL }; + enum class Mode { CONNECT_REMOTE, LAUNCH_REMOTE, INTERNAL }; void server_toggled(); void launch_toggled(); diff --git a/src/gui/GraphBox.cpp b/src/gui/GraphBox.cpp index ef3b3c8c..1440bc1a 100644 --- a/src/gui/GraphBox.cpp +++ b/src/gui/GraphBox.cpp @@ -535,7 +535,7 @@ GraphBox::event_save_as() const_cast<GraphModel*>(_graph.get())->set_property( uris.ingen_document, _app->forge().alloc_uri(uri.c_str()), - Resource::EXTERNAL); + Resource::Graph::EXTERNAL); _status_bar->push( (boost::format("Saved %1% to %2%") % _graph->path().c_str() % filename).str(), diff --git a/src/gui/GraphCanvas.cpp b/src/gui/GraphCanvas.cpp index 216d0cab..d8ba7b2e 100644 --- a/src/gui/GraphCanvas.cpp +++ b/src/gui/GraphCanvas.cpp @@ -909,14 +909,14 @@ void GraphCanvas::menu_load_graph() { _app.window_factory()->present_load_subgraph( - _graph, get_initial_data(Resource::EXTERNAL)); + _graph, get_initial_data(Resource::Graph::EXTERNAL)); } void GraphCanvas::menu_new_graph() { _app.window_factory()->present_new_subgraph( - _graph, get_initial_data(Resource::EXTERNAL)); + _graph, get_initial_data(Resource::Graph::EXTERNAL)); } void diff --git a/src/gui/GraphCanvas.hpp b/src/gui/GraphCanvas.hpp index 1d04e582..6d4bbc87 100644 --- a/src/gui/GraphCanvas.hpp +++ b/src/gui/GraphCanvas.hpp @@ -83,7 +83,7 @@ public: bool on_event(GdkEvent* event); private: - enum ControlType { NUMBER, BUTTON }; + enum class ControlType { NUMBER, BUTTON }; void generate_port_name( const std::string& sym_base, std::string& sym, const std::string& name_base, std::string& name); @@ -114,7 +114,7 @@ private: const LV2Children& children, std::set<const char*>& ancestors); - Node::Properties get_initial_data(Resource::Graph ctx=Resource::DEFAULT); + Node::Properties get_initial_data(Resource::Graph ctx=Resource::Graph::DEFAULT); Ganv::Port* get_port_view(SharedPtr<Client::PortModel> port); diff --git a/src/gui/GraphPortModule.cpp b/src/gui/GraphPortModule.cpp index 6c5f91b4..6d8ac465 100644 --- a/src/gui/GraphPortModule.cpp +++ b/src/gui/GraphPortModule.cpp @@ -112,9 +112,9 @@ GraphPortModule::store_location(double ax, double ay) Resource::Property(uris.wildcard))); Resource::Properties add; add.insert(make_pair(uris.ingen_canvasX, - Resource::Property(x, Resource::INTERNAL))); + Resource::Property(x, Resource::Graph::INTERNAL))); add.insert(make_pair(uris.ingen_canvasY, - Resource::Property(y, Resource::INTERNAL))); + Resource::Property(y, Resource::Graph::INTERNAL))); app().interface()->delta(_model->uri(), remove, add); } } diff --git a/src/gui/LoadPluginWindow.cpp b/src/gui/LoadPluginWindow.cpp index b21a33fc..b7e12281 100644 --- a/src/gui/LoadPluginWindow.cpp +++ b/src/gui/LoadPluginWindow.cpp @@ -82,24 +82,24 @@ LoadPluginWindow::LoadPluginWindow(BaseObjectType* cobject, Gtk::TreeModel::iterator iter = _criteria_liststore->append(); Gtk::TreeModel::Row row = *iter; row[_criteria_columns._col_label] = "Name contains"; - row[_criteria_columns._col_criteria] = CriteriaColumns::NAME; + row[_criteria_columns._col_criteria] = CriteriaColumns::Criteria::NAME; _filter_combo->set_active(iter); row = *(iter = _criteria_liststore->append()); row[_criteria_columns._col_label] = "Type contains"; - row[_criteria_columns._col_criteria] = CriteriaColumns::TYPE; + row[_criteria_columns._col_criteria] = CriteriaColumns::Criteria::TYPE; row = *(iter = _criteria_liststore->append()); row[_criteria_columns._col_label] = "Project contains"; - row[_criteria_columns._col_criteria] = CriteriaColumns::PROJECT; + row[_criteria_columns._col_criteria] = CriteriaColumns::Criteria::PROJECT; row = *(iter = _criteria_liststore->append()); row[_criteria_columns._col_label] = "Author contains"; - row[_criteria_columns._col_criteria] = CriteriaColumns::AUTHOR; + row[_criteria_columns._col_criteria] = CriteriaColumns::Criteria::AUTHOR; row = *(iter = _criteria_liststore->append()); row[_criteria_columns._col_label] = "URI contains"; - row[_criteria_columns._col_criteria] = CriteriaColumns::URI; + row[_criteria_columns._col_criteria] = CriteriaColumns::Criteria::URI; _filter_combo->pack_start(_criteria_columns._col_label); _add_button->signal_clicked().connect( @@ -277,6 +277,9 @@ LoadPluginWindow::set_row(Gtk::TreeModel::Row& row, row[_plugins_columns._col_name] = name.get_string(); switch (plugin->type()) { + case Plugin::NIL: + row[_plugins_columns._col_type] = ""; + break; case Plugin::LV2: row[_plugins_columns._col_type] = lilv_node_as_string( lilv_plugin_class_get_label( @@ -293,9 +296,6 @@ LoadPluginWindow::set_row(Gtk::TreeModel::Row& row, case Plugin::Graph: row[_plugins_columns._col_type] = "Graph"; break; - default: - row[_plugins_columns._col_type] = ""; - break; } row[_plugins_columns._col_uri] = plugin->uri(); @@ -452,24 +452,22 @@ LoadPluginWindow::filter_changed() const Raul::Atom& name = plugin->get_property(uris.doap_name); switch (criteria) { - case CriteriaColumns::NAME: + case CriteriaColumns::Criteria::NAME: if (name.is_valid() && name.type() == uris.forge.String) field = name.get_string(); break; - case CriteriaColumns::TYPE: + case CriteriaColumns::Criteria::TYPE: field = plugin->type_uri(); break; - case CriteriaColumns::PROJECT: + case CriteriaColumns::Criteria::PROJECT: field = get_project_name(plugin); break; - case CriteriaColumns::AUTHOR: + case CriteriaColumns::Criteria::AUTHOR: field = get_author_name(plugin); break; - case CriteriaColumns::URI: + case CriteriaColumns::Criteria::URI: field = plugin->uri(); break; - default: - throw; } transform(field.begin(), field.end(), field.begin(), ::toupper); diff --git a/src/gui/LoadPluginWindow.hpp b/src/gui/LoadPluginWindow.hpp index 0cf8bc55..ed2e979c 100644 --- a/src/gui/LoadPluginWindow.hpp +++ b/src/gui/LoadPluginWindow.hpp @@ -93,7 +93,7 @@ private: /** Column for the filter criteria combo box. */ class CriteriaColumns : public Gtk::TreeModel::ColumnRecord { public: - enum Criteria { NAME, TYPE, PROJECT, AUTHOR, URI, }; + enum class Criteria { NAME, TYPE, PROJECT, AUTHOR, URI, }; CriteriaColumns() { add(_col_label); diff --git a/src/gui/NewSubgraphWindow.cpp b/src/gui/NewSubgraphWindow.cpp index a748de8d..f2457843 100644 --- a/src/gui/NewSubgraphWindow.cpp +++ b/src/gui/NewSubgraphWindow.cpp @@ -98,13 +98,15 @@ NewSubgraphWindow::ok_clicked() props.insert(make_pair(_app->uris().rdf_type, Resource::Property(_app->uris().ingen_Graph))); props.insert(make_pair(_app->uris().ingen_polyphony, _app->forge().make(int32_t(poly)))); props.insert(make_pair(_app->uris().ingen_enabled, _app->forge().make(bool(true)))); - _app->interface()->put(Node::path_to_uri(path), props, Resource::INTERNAL); + _app->interface()->put( + Node::path_to_uri(path), props, Resource::Graph::INTERNAL); // Set external (block perspective) properties props = _initial_data; props.insert(make_pair(_app->uris().rdf_type, Resource::Property(_app->uris().ingen_Graph))); - _app->interface()->put(Node::path_to_uri(path), _initial_data, Resource::EXTERNAL); + _app->interface()->put( + Node::path_to_uri(path), _initial_data, Resource::Graph::EXTERNAL); hide(); } diff --git a/src/gui/SubgraphModule.cpp b/src/gui/SubgraphModule.cpp index 215521da..88dbc81b 100644 --- a/src/gui/SubgraphModule.cpp +++ b/src/gui/SubgraphModule.cpp @@ -77,9 +77,9 @@ SubgraphModule::store_location(double ax, double ay) Resource::Property(uris.wildcard))); Resource::Properties add; add.insert(make_pair(uris.ingen_canvasX, - Resource::Property(x, Resource::EXTERNAL))); + Resource::Property(x, Resource::Graph::EXTERNAL))); add.insert(make_pair(uris.ingen_canvasY, - Resource::Property(y, Resource::EXTERNAL))); + Resource::Property(y, Resource::Graph::EXTERNAL))); app().interface()->delta(_block->uri(), remove, add); } } |