From 93850c202de8b073a1ce1dd8bd246d407bce4e2f Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 30 Sep 2008 16:50:21 +0000 Subject: Flatten ingen source directory heirarchy a bit. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@1551 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/gui/App.cpp | 440 ----- src/libs/gui/App.hpp | 173 -- src/libs/gui/BreadCrumb.hpp | 81 - src/libs/gui/BreadCrumbBox.cpp | 210 -- src/libs/gui/BreadCrumbBox.hpp | 70 - src/libs/gui/Configuration.cpp | 109 -- src/libs/gui/Configuration.hpp | 80 - src/libs/gui/ConnectWindow.cpp | 458 ----- src/libs/gui/ConnectWindow.hpp | 105 - src/libs/gui/Connection.hpp | 60 - src/libs/gui/ControlPanel.cpp | 269 --- src/libs/gui/ControlPanel.hpp | 91 - src/libs/gui/Controls.cpp | 467 ----- src/libs/gui/Controls.hpp | 164 -- src/libs/gui/GladeFactory.cpp | 76 - src/libs/gui/GladeFactory.hpp | 47 - src/libs/gui/LoadPatchWindow.cpp | 153 -- src/libs/gui/LoadPatchWindow.hpp | 82 - src/libs/gui/LoadPluginWindow.cpp | 464 ----- src/libs/gui/LoadPluginWindow.hpp | 155 -- src/libs/gui/LoadRemotePatchWindow.cpp | 164 -- src/libs/gui/LoadRemotePatchWindow.hpp | 94 - src/libs/gui/LoadSubpatchWindow.cpp | 187 -- src/libs/gui/LoadSubpatchWindow.hpp | 80 - src/libs/gui/Makefile.am | 125 -- src/libs/gui/MessagesWindow.cpp | 67 - src/libs/gui/MessagesWindow.hpp | 58 - src/libs/gui/NewSubpatchWindow.cpp | 113 -- src/libs/gui/NewSubpatchWindow.hpp | 68 - src/libs/gui/NodeControlWindow.cpp | 139 -- src/libs/gui/NodeControlWindow.hpp | 76 - src/libs/gui/NodeMenu.cpp | 169 -- src/libs/gui/NodeMenu.hpp | 72 - src/libs/gui/NodeModule.cpp | 386 ---- src/libs/gui/NodeModule.hpp | 102 - src/libs/gui/NodePropertiesWindow.cpp | 66 - src/libs/gui/NodePropertiesWindow.hpp | 58 - src/libs/gui/ObjectMenu.cpp | 112 -- src/libs/gui/ObjectMenu.hpp | 69 - src/libs/gui/PatchCanvas.cpp | 773 -------- src/libs/gui/PatchCanvas.hpp | 155 -- src/libs/gui/PatchPortModule.cpp | 158 -- src/libs/gui/PatchPortModule.hpp | 79 - src/libs/gui/PatchPropertiesWindow.cpp | 92 - src/libs/gui/PatchPropertiesWindow.hpp | 64 - src/libs/gui/PatchTreeWindow.cpp | 243 --- src/libs/gui/PatchTreeWindow.hpp | 111 -- src/libs/gui/PatchView.cpp | 194 -- src/libs/gui/PatchView.hpp | 105 - src/libs/gui/PatchWindow.cpp | 556 ------ src/libs/gui/PatchWindow.hpp | 155 -- src/libs/gui/Port.cpp | 151 -- src/libs/gui/Port.hpp | 70 - src/libs/gui/PortMenu.cpp | 69 - src/libs/gui/PortMenu.hpp | 55 - src/libs/gui/PortPropertiesWindow.cpp | 156 -- src/libs/gui/PortPropertiesWindow.hpp | 68 - src/libs/gui/RenameWindow.cpp | 119 -- src/libs/gui/RenameWindow.hpp | 60 - src/libs/gui/SubpatchModule.cpp | 95 - src/libs/gui/SubpatchModule.hpp | 71 - src/libs/gui/ThreadedLoader.cpp | 155 -- src/libs/gui/ThreadedLoader.hpp | 92 - src/libs/gui/UploadPatchWindow.cpp | 282 --- src/libs/gui/UploadPatchWindow.hpp | 104 - src/libs/gui/WindowFactory.cpp | 381 ---- src/libs/gui/WindowFactory.hpp | 109 -- src/libs/gui/cmdline.h | 86 - src/libs/gui/gui.cpp | 35 - src/libs/gui/gui.hpp | 45 - src/libs/gui/ingen-icon.svg | 54 - src/libs/gui/ingen.svg | 54 - src/libs/gui/ingen_gui.glade | 3337 -------------------------------- src/libs/gui/ingen_gui.gladep | 9 - src/libs/gui/wscript | 65 - 75 files changed, 14366 deletions(-) delete mode 100644 src/libs/gui/App.cpp delete mode 100644 src/libs/gui/App.hpp delete mode 100644 src/libs/gui/BreadCrumb.hpp delete mode 100644 src/libs/gui/BreadCrumbBox.cpp delete mode 100644 src/libs/gui/BreadCrumbBox.hpp delete mode 100644 src/libs/gui/Configuration.cpp delete mode 100644 src/libs/gui/Configuration.hpp delete mode 100644 src/libs/gui/ConnectWindow.cpp delete mode 100644 src/libs/gui/ConnectWindow.hpp delete mode 100644 src/libs/gui/Connection.hpp delete mode 100644 src/libs/gui/ControlPanel.cpp delete mode 100644 src/libs/gui/ControlPanel.hpp delete mode 100644 src/libs/gui/Controls.cpp delete mode 100644 src/libs/gui/Controls.hpp delete mode 100644 src/libs/gui/GladeFactory.cpp delete mode 100644 src/libs/gui/GladeFactory.hpp delete mode 100644 src/libs/gui/LoadPatchWindow.cpp delete mode 100644 src/libs/gui/LoadPatchWindow.hpp delete mode 100644 src/libs/gui/LoadPluginWindow.cpp delete mode 100644 src/libs/gui/LoadPluginWindow.hpp delete mode 100644 src/libs/gui/LoadRemotePatchWindow.cpp delete mode 100644 src/libs/gui/LoadRemotePatchWindow.hpp delete mode 100644 src/libs/gui/LoadSubpatchWindow.cpp delete mode 100644 src/libs/gui/LoadSubpatchWindow.hpp delete mode 100644 src/libs/gui/Makefile.am delete mode 100644 src/libs/gui/MessagesWindow.cpp delete mode 100644 src/libs/gui/MessagesWindow.hpp delete mode 100644 src/libs/gui/NewSubpatchWindow.cpp delete mode 100644 src/libs/gui/NewSubpatchWindow.hpp delete mode 100644 src/libs/gui/NodeControlWindow.cpp delete mode 100644 src/libs/gui/NodeControlWindow.hpp delete mode 100644 src/libs/gui/NodeMenu.cpp delete mode 100644 src/libs/gui/NodeMenu.hpp delete mode 100644 src/libs/gui/NodeModule.cpp delete mode 100644 src/libs/gui/NodeModule.hpp delete mode 100644 src/libs/gui/NodePropertiesWindow.cpp delete mode 100644 src/libs/gui/NodePropertiesWindow.hpp delete mode 100644 src/libs/gui/ObjectMenu.cpp delete mode 100644 src/libs/gui/ObjectMenu.hpp delete mode 100644 src/libs/gui/PatchCanvas.cpp delete mode 100644 src/libs/gui/PatchCanvas.hpp delete mode 100644 src/libs/gui/PatchPortModule.cpp delete mode 100644 src/libs/gui/PatchPortModule.hpp delete mode 100644 src/libs/gui/PatchPropertiesWindow.cpp delete mode 100644 src/libs/gui/PatchPropertiesWindow.hpp delete mode 100644 src/libs/gui/PatchTreeWindow.cpp delete mode 100644 src/libs/gui/PatchTreeWindow.hpp delete mode 100644 src/libs/gui/PatchView.cpp delete mode 100644 src/libs/gui/PatchView.hpp delete mode 100644 src/libs/gui/PatchWindow.cpp delete mode 100644 src/libs/gui/PatchWindow.hpp delete mode 100644 src/libs/gui/Port.cpp delete mode 100644 src/libs/gui/Port.hpp delete mode 100644 src/libs/gui/PortMenu.cpp delete mode 100644 src/libs/gui/PortMenu.hpp delete mode 100644 src/libs/gui/PortPropertiesWindow.cpp delete mode 100644 src/libs/gui/PortPropertiesWindow.hpp delete mode 100644 src/libs/gui/RenameWindow.cpp delete mode 100644 src/libs/gui/RenameWindow.hpp delete mode 100644 src/libs/gui/SubpatchModule.cpp delete mode 100644 src/libs/gui/SubpatchModule.hpp delete mode 100644 src/libs/gui/ThreadedLoader.cpp delete mode 100644 src/libs/gui/ThreadedLoader.hpp delete mode 100644 src/libs/gui/UploadPatchWindow.cpp delete mode 100644 src/libs/gui/UploadPatchWindow.hpp delete mode 100644 src/libs/gui/WindowFactory.cpp delete mode 100644 src/libs/gui/WindowFactory.hpp delete mode 100644 src/libs/gui/cmdline.h delete mode 100644 src/libs/gui/gui.cpp delete mode 100644 src/libs/gui/gui.hpp delete mode 100644 src/libs/gui/ingen-icon.svg delete mode 100644 src/libs/gui/ingen.svg delete mode 100644 src/libs/gui/ingen_gui.glade delete mode 100644 src/libs/gui/ingen_gui.gladep delete mode 100644 src/libs/gui/wscript (limited to 'src/libs/gui') diff --git a/src/libs/gui/App.cpp b/src/libs/gui/App.cpp deleted file mode 100644 index f49d394c..00000000 --- a/src/libs/gui/App.cpp +++ /dev/null @@ -1,440 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include CONFIG_H_PATH -#include "App.hpp" -#include -#include -#include -#include -#include -#include -#include -#include -#include "module/global.hpp" -#include "module/Module.hpp" -#include "module/World.hpp" -#include "interface/EngineInterface.hpp" -#include "serialisation/serialisation.hpp" -#include "client/ObjectModel.hpp" -#include "client/PatchModel.hpp" -#include "client/ClientStore.hpp" -#include "engine/Engine.hpp" -#include "NodeModule.hpp" -#include "ControlPanel.hpp" -#include "SubpatchModule.hpp" -#include "LoadPluginWindow.hpp" -#include "PatchWindow.hpp" -#include "MessagesWindow.hpp" -#include "GladeFactory.hpp" -#include "PatchTreeWindow.hpp" -#include "Configuration.hpp" -#include "ConnectWindow.hpp" -#include "ThreadedLoader.hpp" -#include "WindowFactory.hpp" -#include "Port.hpp" -#ifdef HAVE_SLV2 -#include -#endif - -using namespace std; -using namespace Ingen::Client; - -namespace Ingen { namespace Client { class PluginModel; } } - -namespace Ingen { -namespace GUI { - -class Port; - - -/// Singleton instance -App* App::_instance = 0; - - -App::App(Ingen::Shared::World* world) - : _configuration(new Configuration()) - , _about_dialog(NULL) - , _window_factory(new WindowFactory()) - , _world(world) - , _enable_signal(true) -{ - Glib::RefPtr glade_xml = GladeFactory::new_glade_reference(); - - glade_xml->get_widget_derived("connect_win", _connect_window); - glade_xml->get_widget_derived("messages_win", _messages_window); - glade_xml->get_widget_derived("patch_tree_win", _patch_tree_window); - glade_xml->get_widget("about_win", _about_dialog); - _about_dialog->property_program_name() = "Ingen"; - - PluginModel::set_rdf_world(*world->rdf_world); - -#ifdef HAVE_SLV2 - PluginModel::set_slv2_world(world->slv2_world); -#endif -} - - -App::~App() -{ -} - -void -App::run(int argc, char** argv, Ingen::Shared::World* world) -{ - Gnome::Canvas::init(); - Gtk::Main main(argc, argv); - - if (!_instance) - _instance = new App(world); - - // Load configuration settings - _instance->configuration()->load_settings(); - _instance->configuration()->apply_settings(); - - // Set default window icon - const Glib::ustring icon_path = INGEN_DATA_DIR "/ingen.svg"; - try { - if (Glib::file_test(icon_path, Glib::FILE_TEST_EXISTS)) - Gtk::Window::set_default_icon_from_file(icon_path); - } catch (Gdk::PixbufError err) { - cerr << "Unable to load window icon " << icon_path << ": " << err.what() << endl; - } - - // Set style for embedded node GUIs - const string rc_style = - "style \"ingen_embedded_node_gui_style\" {" - " bg[NORMAL] = \"#212222\"" - " bg[ACTIVE] = \"#505050\"" - " bg[PRELIGHT] = \"#525454\"" - " bg[SELECTED] = \"#99A0A0\"" - " bg[INSENSITIVE] = \"#F03030\"" - " fg[NORMAL] = \"#FFFFFF\"" - " fg[ACTIVE] = \"#FFFFFF\"" - " fg[PRELIGHT] = \"#FFFFFF\"" - " fg[SELECTED] = \"#FFFFFF\"" - " fg[INSENSITIVE] = \"#FFFFFF\"" - "}\n" - "widget \"*ingen_embedded_node_gui_container*\" style \"ingen_embedded_node_gui_style\"\n"; - - Gtk::RC::parse_string(rc_style); - - App::instance().connect_window()->start(world); - - main.run(); - - cout << "Gtk exiting." << endl; -} - - -void -App::attach(SharedPtr client, - SharedPtr handle) -{ - assert( ! _client); - assert( ! _store); - assert( ! _loader); - - _world->engine->register_client(client.get()); - - _client = client; - _handle = handle; - _store = SharedPtr(new ClientStore(_world->engine, client)); - _loader = SharedPtr(new ThreadedLoader(_world->engine)); - - _patch_tree_window->init(*_store); - - _client->signal_response_error.connect(sigc::mem_fun(this, &App::error_response)); - _client->signal_error.connect(sigc::mem_fun(this, &App::error_message)); -} - - -void -App::detach() -{ - if (_world->engine) { - _window_factory->clear(); - _store->clear(); - - _loader.reset(); - _store.reset(); - _client.reset(); - _handle.reset(); - _world->engine.reset(); - } -} - - -const SharedPtr& -App::serialiser() -{ - if (!_serialiser) { - if (!_world->serialisation_module) - _world->serialisation_module = Ingen::Shared::load_module("ingen_serialisation"); - - if (_world->serialisation_module) - _serialiser = SharedPtr(Ingen::Serialisation::new_serialiser(_world, _store)); - - if (!_serialiser) - cerr << "WARNING: Failed to load ingen_serialisation module, save disabled." << endl; - } - return _serialiser; -} - - -void -App::error_response(int32_t id, const string& str) -{ - error_message(str); -} - - -void -App::error_message(const string& str) -{ - _messages_window->post(str); - - if (!_messages_window->is_visible()) - _messages_window->present(); - - _messages_window->set_urgency_hint(true); -} - - -void -App::port_activity(Port* port) -{ - std::pair inserted = _activity_ports.insert(make_pair(port, false)); - if (inserted.second) - inserted.first->second = false; - - if (port->is_output()) { - for (Port::Connections::const_iterator i = port->connections().begin(); i != port->connections().end(); ++i) { - const SharedPtr dst = PtrCast(i->lock()->dest().lock()); - if (dst) - port_activity(dst.get()); - } - } - - port->set_highlighted(true, false, true, false); -} - - -void -App::activity_port_destroyed(Port* port) -{ - ActivityPorts::iterator i = _activity_ports.find(port); - if (i != _activity_ports.end()) - _activity_ports.erase(i); - - return; -} - - -bool -App::animate() -{ - for (ActivityPorts::iterator i = _activity_ports.begin(); i != _activity_ports.end() ; ) { - ActivityPorts::iterator next = i; - ++next; - - if ((*i).second) { // saw it last time, unhighlight and pop - (*i).first->set_highlighted(false, false, true, false); - _activity_ports.erase(i); - } else { - (*i).second = true; - } - - i = next; - } - - return true; -} - - - -/******** Event Handlers ************/ - - -#if 0 -App::event_load_session() -{ - Gtk::FileChooserDialog* dialog - = new Gtk::FileChooserDialog(*_main_window, "Load Session", Gtk::FILE_CHOOSER_ACTION_OPEN); - - dialog->add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); - dialog->add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_OK); - int result = dialog->run(); - string filename = dialog->get_filename(); - delete dialog; - - cout << result << endl; - - assert(result == Gtk::RESPONSE_OK || result == Gtk::RESPONSE_CANCEL || result == Gtk::RESPONSE_NONE); - - if (result == Gtk::RESPONSE_OK) - //configuration->load_session(filename); - _controller->load_session(filename); -} - - -void -App::event_save_session_as() -{ - Gtk::FileChooserDialog dialog(*_main_window, "Save Session", Gtk::FILE_CHOOSER_ACTION_SAVE); - - /* - Gtk::VBox* box = dialog.get_vbox(); - Gtk::Label warning("Warning: Recursively saving will overwrite any subpatch files \ - without confirmation."); - box->pack_start(warning, false, false, 2); - Gtk::CheckButton recursive_checkbutton("Recursively save all subpatches"); - box->pack_start(recursive_checkbutton, false, false, 0); - recursive_checkbutton.show(); - */ - dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); - dialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_OK); - - int result = dialog.run(); - //bool recursive = recursive_checkbutton.get_active(); - - assert(result == Gtk::RESPONSE_OK || result == Gtk::RESPONSE_CANCEL || result == Gtk::RESPONSE_NONE); - - if (result == Gtk::RESPONSE_OK) { - string filename = dialog.get_filename(); - if (filename.length() < 11 || filename.substr(filename.length()-10) != ".omsession") - filename += ".omsession"; - - bool confirm = false; - std::fstream fin; - fin.open(filename.c_str(), std::ios::in); - if (fin.is_open()) { // File exists - string msg = "File already exists! Are you sure you want to overwrite "; - msg += filename + "?"; - Gtk::MessageDialog confir_dialog(*_main_window, - msg, false, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_YES_NO, true); - if (confir_dialog.run() == Gtk::RESPONSE_YES) - confirm = true; - else - confirm = false; - } else { // File doesn't exist - confirm = true; - } - fin.close(); - - if (confirm) { - _controller->save_session(filename); - } - } -} -#endif - - -void -App::register_callbacks() -{ - Glib::signal_timeout().connect( - sigc::mem_fun(App::instance(), &App::gtk_main_iteration), 25, G_PRIORITY_DEFAULT); - - Glib::signal_timeout().connect( - sigc::mem_fun(App::instance(), &App::animate), 50, G_PRIORITY_DEFAULT); -} - - -bool -App::gtk_main_iteration() -{ - if (!_client) - return false; - - if (_world->local_engine) { - _world->local_engine->main_iteration(); - } else { - _enable_signal = false; - _client->emit_signals(); - _enable_signal = true; - } - - return true; -} - - -void -App::show_about() -{ - _about_dialog->run(); - _about_dialog->hide(); -} - - -void -App::quit() -{ - Gtk::Main::quit(); -} - - -Glib::RefPtr -App::icon_from_path(const string& path, int size) -{ - /* If weak references to Glib::Objects are needed somewhere else it will - probably be a good idea to create a proper WeakPtr class instead of - using raw pointers, but for a single use this will do. */ - - Glib::RefPtr buf; - if (path.length() == 0) - return buf; - - Icons::iterator iter = _icons.find(make_pair(path, size)); - - if (iter != _icons.end()) { - // we need to reference manually since the RefPtr constructor doesn't do it - iter->second->reference(); - return Glib::RefPtr(iter->second); - } - - try { - buf = Gdk::Pixbuf::create_from_file(path, size, size); - _icons.insert(make_pair(make_pair(path, size), buf.operator->())); - buf->add_destroy_notify_callback(new pair(path, size), - &App::icon_destroyed); - cerr << "Loaded icon " << path << " with size " << size << endl; - } catch (Glib::Error e) { - cerr << "Error loading icon: " << e.what() << endl; - } - return buf; -} - - -void* -App::icon_destroyed(void* data) -{ - pair* p = static_cast*>(data); - cerr << "Destroyed icon " << p->first << " with size " << p->second << endl; - Icons::iterator iter = instance()._icons.find(*p); - if (iter != instance()._icons.end()) - instance()._icons.erase(iter); - - delete p; // allocated in App::icon_from_path - - return NULL; -} - - -} // namespace GUI -} // namespace Ingen - diff --git a/src/libs/gui/App.hpp b/src/libs/gui/App.hpp deleted file mode 100644 index 4a4b6580..00000000 --- a/src/libs/gui/App.hpp +++ /dev/null @@ -1,173 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef INGEN_APP_HPP -#define INGEN_APP_HPP - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace Ingen { - class Engine; - namespace Shared { - class EngineInterface; - class ClientInterface; - class World; - } - namespace Client { - class PatchModel; - class PluginModel; - class ClientStore; - class SigClientInterface; - } - namespace Serialisation { - class Serialiser; - } -} - -/** \defgroup GUI GTK GUI - */ - -namespace Ingen { -namespace GUI { - -class MessagesWindow; -class PatchCanvas; -class PatchTreeView; -class PatchTreeWindow; -class ConnectWindow; -class Configuration; -class ThreadedLoader; -class WindowFactory; -class Port; - - -/** Singleton master class most everything is contained within. - * - * This is a horrible god-object, but it's shrinking in size as things are - * moved out. Hopefully it will go away entirely some day.. - * - * \ingroup GUI - */ -class App -{ -public: - ~App(); - - void error_message(const std::string& msg); - - void attach(SharedPtr client, - SharedPtr handle=SharedPtr()); - - void detach(); - - void register_callbacks(); - bool gtk_main_iteration(); - - void show_about(); - void quit(); - - void port_activity(Port* port); - void activity_port_destroyed(Port* port); - - bool signal() const { return _enable_signal; } - bool disable_signals() { bool old = _enable_signal; _enable_signal = false; return old; } - void enable_signals(bool b) { _enable_signal = b; } - - ConnectWindow* connect_window() const { return _connect_window; } - MessagesWindow* messages_dialog() const { return _messages_window; } - PatchTreeWindow* patch_tree() const { return _patch_tree_window; } - Configuration* configuration() const { return _configuration; } - WindowFactory* window_factory() const { return _window_factory; } - - Glib::RefPtr icon_from_path(const std::string& path, int size); - - const SharedPtr& engine() const { return _world->engine; } - const SharedPtr& client() const { return _client; } - const SharedPtr& store() const { return _store; } - const SharedPtr& loader() const { return _loader; } - - const SharedPtr& serialiser(); - - static inline App& instance() { assert(_instance); return *_instance; } - - static void run(int argc, char** argv, Ingen::Shared::World* world); - - Ingen::Shared::World* world() { return _world; } - -protected: - - /** This is needed for the icon map. */ - template - struct LexicalCompare { - bool operator()(const std::pair& p1, const std::pair& p2) { - return (p1.first < p2.first) || - ((p1.first == p2.first) && (p1.second < p2.second)); - } - }; - - typedef std::map< std::pair, - Gdk::Pixbuf*, - LexicalCompare > Icons; - Icons _icons; - - App(Ingen::Shared::World* world); - - bool animate(); - void error_response(int32_t id, const std::string& str); - - static void* icon_destroyed(void* data); - - static App* _instance; - - SharedPtr _client; - SharedPtr _handle; - SharedPtr _store; - SharedPtr _serialiser; - SharedPtr _loader; - - Configuration* _configuration; - - ConnectWindow* _connect_window; - MessagesWindow* _messages_window; - PatchTreeWindow* _patch_tree_window; - Gtk::AboutDialog* _about_dialog; - WindowFactory* _window_factory; - - Ingen::Shared::World* _world; - - typedef std::map ActivityPorts; - ActivityPorts _activity_ports; - - bool _enable_signal; -}; - - -} // namespace GUI -} // namespace Ingen - -#endif // INGEN_APP_HPP - diff --git a/src/libs/gui/BreadCrumb.hpp b/src/libs/gui/BreadCrumb.hpp deleted file mode 100644 index c3b05e01..00000000 --- a/src/libs/gui/BreadCrumb.hpp +++ /dev/null @@ -1,81 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef BREADCRUMB_H -#define BREADCRUMB_H - -#include -#include -#include -#include "PatchView.hpp" - -namespace Ingen { -namespace GUI { - - -/** Breadcrumb button in a PatchWindow. - * - * Each Breadcrumb stores a reference to a PatchView for quick switching. - * So, the amount of allocated PatchViews at a given time is equal to the - * number of visible breadcrumbs (which is the perfect cache for GUI - * responsiveness balanced with mem consumption). - * - * \ingroup GUI - */ -class BreadCrumb : public Gtk::ToggleButton -{ -public: - BreadCrumb(const Path& path, SharedPtr view = SharedPtr()) - : _path(path) - , _view(view) - { - assert( !view || view->patch()->path() == path); - set_border_width(0); - set_path(path); - show_all(); - } - - void set_view(SharedPtr view) { - assert( !view || view->patch()->path() == _path); - _view = view; - } - - const Path& path() const { return _path; } - SharedPtr view() const { return _view; } - - void set_path(const Path& path) - { - remove(); - const string text = (path == "/") ? "/" : path.name().c_str(); - Gtk::Label* lab = manage(new Gtk::Label(text)); - lab->set_padding(0, 0); - lab->show(); - add(*lab); - - if (_view && _view->patch()->path() != path) - _view.reset(); - } - -private: - Path _path; - SharedPtr _view; -}; - -} // namespace GUI -} // namespace Ingen - -#endif // BREADCRUMB_H diff --git a/src/libs/gui/BreadCrumbBox.cpp b/src/libs/gui/BreadCrumbBox.cpp deleted file mode 100644 index 7edaed9f..00000000 --- a/src/libs/gui/BreadCrumbBox.cpp +++ /dev/null @@ -1,210 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "BreadCrumbBox.hpp" -#include "BreadCrumb.hpp" -#include "App.hpp" -#include "client/SigClientInterface.hpp" -namespace Ingen { -namespace GUI { - - -BreadCrumbBox::BreadCrumbBox() - : Gtk::HBox() - , _active_path("/") - , _full_path("/") - , _enable_signal(true) -{ - App::instance().client()->signal_object_destroyed.connect( - sigc::mem_fun(this, &BreadCrumbBox::object_destroyed)); -} - - -SharedPtr -BreadCrumbBox::view(const Path& path) -{ - for (std::list::const_iterator i = _breadcrumbs.begin(); i != _breadcrumbs.end(); ++i) - if ((*i)->path() == path) - return (*i)->view(); - - return SharedPtr(); -} - - -/** Sets up the crumbs to display @a path. - * - * If @a path is already part of the shown path, it will be selected and the - * children preserved. - */ -void -BreadCrumbBox::build(Path path, SharedPtr view) -{ - bool old_enable_signal = _enable_signal; - _enable_signal = false; - - // Moving to a path we already contain, just switch the active button - if (_breadcrumbs.size() > 0 && (path.is_parent_of(_full_path) || path == _full_path)) { - - for (std::list::iterator i = _breadcrumbs.begin(); i != _breadcrumbs.end(); ++i) { - if ((*i)->path() == path) { - (*i)->set_active(true); - if (!(*i)->view()) - (*i)->set_view(view); - - // views are expensive, having two around for the same patch is a bug - assert((*i)->view() == view); - - } else { - (*i)->set_active(false); - } - } - - _active_path = path; - _enable_signal = old_enable_signal; - - - // Moving to a child of the full path, just append crumbs (preserve view cache) - } else if (_breadcrumbs.size() > 0 && (path.is_child_of(_full_path))) { - - string suffix = path.substr(_full_path.length()); - while (suffix.length() > 0) { - if (suffix[0] == '/') - suffix = suffix.substr(1); - const string name = suffix.substr(0, suffix.find("/")); - _full_path = _full_path.base() + name; - BreadCrumb* but = create_crumb(_full_path, view); - pack_start(*but, false, false, 1); - _breadcrumbs.push_back(but); - but->show(); - if (suffix.find("/") == string::npos) - break; - else - suffix = suffix.substr(suffix.find("/")+1); - } - - for (std::list::iterator i = _breadcrumbs.begin(); i != _breadcrumbs.end(); ++i) - (*i)->set_active(false); - _breadcrumbs.back()->set_active(true); - - - // Rebuild from scratch - // Getting here is bad unless absolutely necessary, since the PatchView cache is lost - } else { - - _full_path = path; - _active_path = path; - - // Empty existing breadcrumbs - for (std::list::iterator i = _breadcrumbs.begin(); i != _breadcrumbs.end(); ++i) - remove(**i); - _breadcrumbs.clear(); - - // Add root - BreadCrumb* root_but = create_crumb("/", view); - pack_start(*root_but, false, false, 1); - _breadcrumbs.push_front(root_but); - root_but->set_active(root_but->path() == _active_path); - - Path working_path = "/"; - string suffix = path.substr(1); - while (suffix.length() > 0) { - if (suffix[0] == '/') - suffix = suffix.substr(1); - const string name = suffix.substr(0, suffix.find("/")); - working_path = working_path.base() + name; - BreadCrumb* but = create_crumb(working_path, view); - pack_start(*but, false, false, 1); - _breadcrumbs.push_back(but); - but->set_active(working_path == _active_path); - but->show(); - if (suffix.find("/") == string::npos) - break; - else - suffix = suffix.substr(suffix.find("/")+1); - } - } - - _enable_signal = old_enable_signal; -} - - -/** Create a new crumb, assigning it a reference to @a view if their paths - * match, otherwise ignoring @a view. - */ -BreadCrumb* -BreadCrumbBox::create_crumb(const Path& path, - SharedPtr view) -{ - BreadCrumb* but = manage(new BreadCrumb(path, - (view && path == view->patch()->path()) ? view : SharedPtr())); - - but->signal_toggled().connect(sigc::bind(sigc::mem_fun( - this, &BreadCrumbBox::breadcrumb_clicked), but)); - - return but; -} - - -void -BreadCrumbBox::breadcrumb_clicked(BreadCrumb* crumb) -{ - if (_enable_signal) { - _enable_signal = false; - - if (!crumb->get_active()) { - // Tried to turn off the current active button, bad user, no cookie - crumb->set_active(true); - } else { - signal_patch_selected.emit(crumb->path(), crumb->view()); - if (crumb->path() != _active_path) - crumb->set_active(false); - } - _enable_signal = true; - } -} - - -void -BreadCrumbBox::object_destroyed(const Path& path) -{ - for (std::list::iterator i = _breadcrumbs.begin(); i != _breadcrumbs.end(); ++i) { - if ((*i)->path() == path) { - // Remove all crumbs after the removed one (inclusive) - for (std::list::iterator j = i; j != _breadcrumbs.end(); ) { - BreadCrumb* bc = *j; - j = _breadcrumbs.erase(j); - remove(*bc); - } - break; - } - } -} - - -void -BreadCrumbBox::object_renamed(const Path& old_path, const Path& new_path) -{ - for (std::list::iterator i = _breadcrumbs.begin(); i != _breadcrumbs.end(); ++i) { - if ((*i)->path() == old_path) - (*i)->set_path(new_path); - } -} - - -} // namespace GUI -} // namespace Ingen - diff --git a/src/libs/gui/BreadCrumbBox.hpp b/src/libs/gui/BreadCrumbBox.hpp deleted file mode 100644 index b5650252..00000000 --- a/src/libs/gui/BreadCrumbBox.hpp +++ /dev/null @@ -1,70 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef BREADCRUMBBOX_H -#define BREADCRUMBBOX_H - -#include -#include -#include -#include -#include -#include -#include "PatchView.hpp" - -namespace Ingen { -namespace GUI { - -class BreadCrumb; - - -/** Collection of breadcrumb buttons forming a path. - * - * This doubles as a cache for PatchViews. - * - * \ingroup GUI - */ -class BreadCrumbBox : public Gtk::HBox -{ -public: - BreadCrumbBox(); - - SharedPtr view(const Path& path); - - void build(Path path, SharedPtr view); - - sigc::signal > signal_patch_selected; - -private: - BreadCrumb* create_crumb(const Path& path, - SharedPtr view = SharedPtr()); - - void breadcrumb_clicked(BreadCrumb* crumb); - - void object_destroyed(const Path& path); - void object_renamed(const Path& old_path, const Path& new_path); - - Path _active_path; - Path _full_path; - bool _enable_signal; - std::list _breadcrumbs; -}; - -} // namespace GUI -} // namespace Ingen - -#endif // BREADCRUMBBOX_H diff --git a/src/libs/gui/Configuration.cpp b/src/libs/gui/Configuration.cpp deleted file mode 100644 index 758dc744..00000000 --- a/src/libs/gui/Configuration.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "Configuration.hpp" -#include -#include -#include -#include -#include -#include "client/PortModel.hpp" -#include "client/PluginModel.hpp" -#include "serialisation/Parser.hpp" -#include "App.hpp" - -using namespace std; - -namespace Ingen { -namespace GUI { - -using namespace Ingen::Client; - - -Configuration::Configuration() - // Colours from the Tango palette with modified V and alpha - : _name_style(HUMAN) - , _audio_port_color( 0x244678C0) - , _control_port_color(0x4A8A0EC0) - , _event_port_color( 0x960909C0) -// , _midi_port_color( 0x960909C0) -// , _osc_port_color( 0x5C3566C0) -{ -} - - -Configuration::~Configuration() -{ -} - - -/** Loads settings from the rc file. Passing no parameter will load from - * the default location. - */ -void -Configuration::load_settings(string filename) -{ - /* ... */ -} - - -/** Saves settings to rc file. Passing no parameter will save to the - * default location. - */ -void -Configuration::save_settings(string filename) -{ - /* ... */ -} - - -/** Applies the current loaded settings to whichever parts of the app - * need updating. - */ -void -Configuration::apply_settings() -{ - /* ... */ -} - - -uint32_t -Configuration::get_port_color(const PortModel* p) -{ - assert(p != NULL); - - if (p->type().is_control()) { - return _control_port_color; - } else if (p->type().is_audio()) { - return _audio_port_color; - } else if (p->type().is_event()) { - return _event_port_color; - }/* else if (p->type().is_midi()) { - return _midi_port_color; - } else if (p->type().is_osc()) { - return _osc_port_color; - }*/ - - cerr << "[Configuration] Unknown port type " << p->type().uri() - << ", port will appear black." << endl; - - return 0x000000FF; -} - - -} // namespace GUI -} // namespace Ingen diff --git a/src/libs/gui/Configuration.hpp b/src/libs/gui/Configuration.hpp deleted file mode 100644 index 124b41c8..00000000 --- a/src/libs/gui/Configuration.hpp +++ /dev/null @@ -1,80 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef CONFIG_H -#define CONFIG_H - -#include - -namespace Ingen { namespace Client { class PortModel; } } -using Ingen::Client::PortModel; -using std::string; - -struct Coord { double x; double y; }; - -namespace Ingen { -namespace GUI { - - -/** Singleton state manager for the entire app. - * - * Stores settings like color preferences, search paths, etc. - * (ie any user-defined preferences to be stoed in the rc file). - * - * \ingroup GUI - */ -class Configuration -{ -public: - Configuration(); - ~Configuration(); - - void load_settings(string filename = ""); - void save_settings(string filename = ""); - - void apply_settings(); - - const string& patch_folder() { return _patch_folder; } - void set_patch_folder(const string& f) { _patch_folder = f; } - - uint32_t get_port_color(const PortModel* pi); - - enum NameStyle { PATH, HUMAN }; - - NameStyle name_style() const { return _name_style; } - void set_name_style(NameStyle s) { _name_style = s; } - -private: - /** Most recent patch folder shown in open dialog */ - string _patch_folder; - - NameStyle _name_style; - - uint32_t _audio_port_color; - uint32_t _control_port_color; - uint32_t _event_port_color; - //uint32_t _midi_port_color; - //uint32_t _osc_port_color; -}; - - -} // namespace GUI -} // namespace Ingen - -#endif // CONFIG_H - - diff --git a/src/libs/gui/ConnectWindow.cpp b/src/libs/gui/ConnectWindow.cpp deleted file mode 100644 index 5600a0b2..00000000 --- a/src/libs/gui/ConnectWindow.cpp +++ /dev/null @@ -1,458 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include -#include -#include -#include -#include -#include -#include CONFIG_H_PATH -#include "interface/EngineInterface.hpp" -#include "module/World.hpp" -#include "engine/tuning.hpp" -#include "engine/Engine.hpp" -#include "engine/QueuedEngineInterface.hpp" -#include "client/OSCClientReceiver.hpp" -#include "client/HTTPClientReceiver.hpp" -#include "client/OSCEngineSender.hpp" -#include "client/ThreadedSigClientInterface.hpp" -#include "client/ClientStore.hpp" -#include "client/PatchModel.hpp" -#include "module/Module.hpp" -#include "App.hpp" -#include "WindowFactory.hpp" -#include "ConnectWindow.hpp" -using Ingen::QueuedEngineInterface; -using Ingen::Client::ThreadedSigClientInterface; -using namespace std; - -namespace Ingen { -namespace GUI { - - -// ConnectWindow - - -ConnectWindow::ConnectWindow(BaseObjectType* cobject, const Glib::RefPtr& xml) - : Gtk::Dialog(cobject) - , _xml(xml) - , _mode(CONNECT_REMOTE) - , _ping_id(-1) - , _attached(false) - , _widgets_loaded(false) - , _connect_stage(0) - , _new_engine(NULL) -{ -} - - -void -ConnectWindow::start(Ingen::Shared::World* world) -{ - if (world->local_engine) { - _mode = INTERNAL; - if (_widgets_loaded) - _internal_radio->set_active(true); - } - - set_connected_to(world->engine); - - connect(true); -} - - -void -ConnectWindow::set_connected_to(SharedPtr engine) -{ - App::instance().world()->engine = engine; - - if (!_widgets_loaded) - return; - - if (engine) { - _icon->set(Gtk::Stock::CONNECT, Gtk::ICON_SIZE_LARGE_TOOLBAR); - _progress_bar->set_fraction(1.0); - _progress_label->set_text("Connected to engine"); - _url_entry->set_sensitive(false); - _connect_button->set_sensitive(false); - _disconnect_button->set_label("gtk-disconnect"); - _disconnect_button->set_sensitive(true); - _port_spinbutton->set_sensitive(false); - _launch_radio->set_sensitive(false); - _internal_radio->set_sensitive(false); - } else { - _icon->set(Gtk::Stock::DISCONNECT, Gtk::ICON_SIZE_LARGE_TOOLBAR); - _progress_bar->set_fraction(0.0); - _connect_button->set_sensitive(true); - _disconnect_button->set_sensitive(false); - - if (_new_engine) - _internal_radio->set_sensitive(true); - else - _internal_radio->set_sensitive(false); - - _server_radio->set_sensitive(true); - _launch_radio->set_sensitive(true); - - if (_mode == CONNECT_REMOTE ) - _url_entry->set_sensitive(true); - else if (_mode == LAUNCH_REMOTE ) - _port_spinbutton->set_sensitive(true); - - _progress_label->set_text(string("Disconnected")); - } -} - - -void -ConnectWindow::set_connecting_widget_states() -{ - if (!_widgets_loaded) - return; - - _connect_button->set_sensitive(false); - _disconnect_button->set_label("gtk-cancel"); - _disconnect_button->set_sensitive(true); - _server_radio->set_sensitive(false); - _launch_radio->set_sensitive(false); - _internal_radio->set_sensitive(false); - _url_entry->set_sensitive(false); - _port_spinbutton->set_sensitive(false); -} - - -/** Launch (if applicable) and connect to the Engine. - * - * This will create the EngineInterface and ClientInterface and initialize - * the App with them. - */ -void -ConnectWindow::connect(bool existing) -{ - if (_attached) - _attached = false; - - assert(!App::instance().client()); - - _connect_stage = 0; - set_connecting_widget_states(); - - Ingen::Shared::World* world = App::instance().world(); - - if (_mode == CONNECT_REMOTE) { - if (!existing) { - const string url = (_widgets_loaded ? (string)_url_entry->get_text() : world->engine->uri()); - world->engine = SharedPtr(new OSCEngineSender(url)); - } - - SharedPtr tsci(new ThreadedSigClientInterface(1024)); - SharedPtr client; - - const string& uri = world->engine->uri(); - const string& scheme = uri.substr(0, uri.find(":")); - if (scheme == "osc.udp" || scheme == "osc.tcp") - client = SharedPtr(new OSCClientReceiver(16181, tsci)); // FIXME: port - else if (scheme == "http") - client = SharedPtr(new HTTPClientReceiver(world, uri, tsci)); - - App::instance().attach(tsci, client); - App::instance().register_callbacks(); - - Glib::signal_timeout().connect( - sigc::mem_fun(this, &ConnectWindow::gtk_callback), 40); - - } else if (_mode == LAUNCH_REMOTE) { - - int port = _port_spinbutton->get_value_as_int(); - char port_str[6]; - snprintf(port_str, 6, "%u", port); - const string cmd = string("ingen -e --engine-port=").append(port_str); - - if (Raul::Process::launch(cmd)) { - world->engine = SharedPtr( - new OSCEngineSender(string("osc.udp://localhost:").append(port_str))); - - // FIXME: static args - SharedPtr tsci(new ThreadedSigClientInterface(1024)); - SharedPtr client(new OSCClientReceiver(16181, tsci)); - - App::instance().attach(tsci, client); - App::instance().register_callbacks(); - - Glib::signal_timeout().connect( - sigc::mem_fun(this, &ConnectWindow::gtk_callback), 40); - - } else { - cerr << "Failed to launch ingen process." << endl; - } - - } else if (_mode == INTERNAL) { - Ingen::Shared::World* world = App::instance().world(); - if ( ! world->local_engine) { - assert(_new_engine); - world->local_engine = SharedPtr(_new_engine(world)); - } - - if ( ! world->engine) - world->engine = world->local_engine->new_queued_interface(); - - SharedPtr client(new SigClientInterface()); - - world->local_engine->start_jack_driver(); - world->local_engine->activate(1); // FIXME: parallelism - - App::instance().attach(client); - App::instance().register_callbacks(); - - Glib::signal_timeout().connect( - sigc::mem_fun(this, &ConnectWindow::gtk_callback), 10); - } -} - - -void -ConnectWindow::disconnect() -{ - _connect_stage = -1; - _attached = false; - - App::instance().detach(); - set_connected_to(SharedPtr()); - - if (!_widgets_loaded) - return; - - _progress_bar->set_fraction(0.0); - _connect_button->set_sensitive(false); - _disconnect_button->set_sensitive(false); - - _connect_button->set_sensitive(true); - _disconnect_button->set_sensitive(false); -} - - -void -ConnectWindow::on_show() -{ - if (!_widgets_loaded) { - load_widgets(); - if (_attached) - set_connected_to(App::instance().engine()); - } - - Gtk::Dialog::on_show(); -} - - -void -ConnectWindow::load_widgets() -{ - _xml->get_widget("connect_icon", _icon); - _xml->get_widget("connect_progress_bar", _progress_bar); - _xml->get_widget("connect_progress_label", _progress_label); - _xml->get_widget("connect_server_radiobutton", _server_radio); - _xml->get_widget("connect_url_entry", _url_entry); - _xml->get_widget("connect_launch_radiobutton", _launch_radio); - _xml->get_widget("connect_port_spinbutton", _port_spinbutton); - _xml->get_widget("connect_internal_radiobutton", _internal_radio); - _xml->get_widget("connect_disconnect_button", _disconnect_button); - _xml->get_widget("connect_connect_button", _connect_button); - _xml->get_widget("connect_quit_button", _quit_button); - - _server_radio->signal_toggled().connect(sigc::mem_fun(this, &ConnectWindow::server_toggled)); - _launch_radio->signal_toggled().connect(sigc::mem_fun(this, &ConnectWindow::launch_toggled)); - _internal_radio->signal_clicked().connect(sigc::mem_fun(this, &ConnectWindow::internal_toggled)); - _disconnect_button->signal_clicked().connect(sigc::mem_fun(this, &ConnectWindow::disconnect)); - _connect_button->signal_clicked().connect(sigc::bind( - sigc::mem_fun(this, &ConnectWindow::connect), false)); - _quit_button->signal_clicked().connect(sigc::mem_fun(this, &ConnectWindow::quit)); - - _progress_bar->set_pulse_step(0.01); - _widgets_loaded = true; - - _engine_module = Ingen::Shared::load_module("ingen_engine"); - if (!_engine_module) - cerr << "Unable to load ingen_engine module, internal engine unavailable." << endl; - bool found = _engine_module->get_symbol("new_engine", (void*&)_new_engine); - if (!found) { - cerr << "Unable to find module entry point, internal engine unavailable." << endl; - _engine_module.reset(); - } - - server_toggled(); -} - - -void -ConnectWindow::on_hide() -{ - Gtk::Dialog::on_hide(); - if (!_attached) - Gtk::Main::quit(); -} - - -void -ConnectWindow::quit() -{ - if (_attached) { - Gtk::MessageDialog d(*this, "This will exit the GUI, but the engine will " - "remain running (if it is remote).\n\nAre you sure you want to quit?", - true, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_NONE, true); - d.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); - d.add_button(Gtk::Stock::QUIT, Gtk::RESPONSE_CLOSE); - int ret = d.run(); - if (ret == Gtk::RESPONSE_CLOSE) - Gtk::Main::quit(); - } else { - Gtk::Main::quit(); - } -} - - -void -ConnectWindow::server_toggled() -{ - _url_entry->set_sensitive(true); - _port_spinbutton->set_sensitive(false); - _mode = CONNECT_REMOTE; -} - - -void -ConnectWindow::launch_toggled() -{ - _url_entry->set_sensitive(false); - _port_spinbutton->set_sensitive(true); - _mode = LAUNCH_REMOTE; -} - - -void -ConnectWindow::internal_toggled() -{ - _url_entry->set_sensitive(false); - _port_spinbutton->set_sensitive(false); - _mode = INTERNAL; -} - - -bool -ConnectWindow::gtk_callback() -{ - /* If I call this a "state machine" it's not ugly code any more */ - - // Timing stuff for repeated attach attempts - timeval now; - gettimeofday(&now, NULL); - static const timeval start = now; - static timeval last = now; - - // Show if attempted connection goes on for a noticeable amount of time - if (!is_visible()) { - const float ms_since_start = (now.tv_sec - start.tv_sec) * 1000.0f + - (now.tv_usec - start.tv_usec) * 0.001f; - if (ms_since_start > 500) { - present(); - set_connecting_widget_states(); - } - } - - /* Connecting to engine */ - if (_connect_stage == 0) { - - _attached = false; - - assert(App::instance().engine()); - assert(App::instance().client()); - - App::instance().client()->signal_response_ok.connect( - sigc::mem_fun(this, &ConnectWindow::on_response)); - - _ping_id = abs(rand()) / 2 * 2; // avoid -1 - App::instance().engine()->set_next_response_id(_ping_id); - App::instance().engine()->ping(); - - if (_widgets_loaded) { - _progress_label->set_text("Connecting to engine..."); - _progress_bar->set_pulse_step(0.01); - } - - ++_connect_stage; - - } else if (_connect_stage == 1) { - if (_attached || App::instance().client()->enabled()) { - App::instance().engine()->activate(); - ++_connect_stage; - } else { - const float ms_since_last = (now.tv_sec - last.tv_sec) * 1000.0f + - (now.tv_usec - last.tv_usec) * 0.001f; - if (ms_since_last > 1000) { - App::instance().engine()->set_next_response_id(_ping_id); - App::instance().engine()->ping(); - last = now; - } - } - } else if (_connect_stage == 2) { - App::instance().engine()->request_all_objects(); - if (_widgets_loaded) - _progress_label->set_text(string("Requesting root patch...")); - ++_connect_stage; - } else if (_connect_stage == 3) { - if (App::instance().store()->size() > 0) { - SharedPtr root = PtrCast(App::instance().store()->object("/")); - if (root) { - set_connected_to(App::instance().engine()); - App::instance().window_factory()->present_patch(root); - App::instance().engine()->load_plugins(); - if (_widgets_loaded) - _progress_label->set_text(string("Loading plugins...")); - ++_connect_stage; - } - } - } else if (_connect_stage == 4) { - App::instance().engine()->request_plugins(); - hide(); - if (_widgets_loaded) - _progress_label->set_text("Connected to engine"); - _connect_stage = 0; // set ourselves up for next time (if there is one) - return false; // deregister this callback - } - - if (_widgets_loaded) - _progress_bar->pulse(); - - if (_connect_stage == -1) { // we were cancelled - if (_widgets_loaded) { - _icon->set(Gtk::Stock::DISCONNECT, Gtk::ICON_SIZE_LARGE_TOOLBAR); - _progress_bar->set_fraction(0.0); - _connect_button->set_sensitive(true); - _disconnect_button->set_sensitive(false); - _disconnect_button->set_label("gtk-disconnect"); - _progress_label->set_text(string("Disconnected")); - } - return false; - } else { - return true; - } -} - - -} // namespace GUI -} // namespace Ingen diff --git a/src/libs/gui/ConnectWindow.hpp b/src/libs/gui/ConnectWindow.hpp deleted file mode 100644 index fb75d4b2..00000000 --- a/src/libs/gui/ConnectWindow.hpp +++ /dev/null @@ -1,105 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef CONNECT_WINDOW_H -#define CONNECT_WINDOW_H - -#include CONFIG_H_PATH - -#ifdef HAVE_SLV2 -#include -#endif - -#include -#include -#include -#include -#include "client/ThreadedSigClientInterface.hpp" -using Ingen::Client::SigClientInterface; - -namespace Ingen { class Engine; class QueuedEngineInterface; } - -namespace Ingen { -namespace GUI { - -class App; - - -/** The initially visible "Connect to engine" window. - * - * This handles actually connecting to the engine and making sure everything - * is ready before really launching the app (eg wait for the root patch). - * - * \ingroup GUI - */ -class ConnectWindow : public Gtk::Dialog -{ -public: - ConnectWindow(BaseObjectType* cobject, const Glib::RefPtr& xml); - - void set_connected_to(SharedPtr engine); - void start(Ingen::Shared::World* world); - void on_response(int32_t id) { _attached = true; } - -private: - enum Mode { CONNECT_REMOTE, LAUNCH_REMOTE, INTERNAL }; - - void server_toggled(); - void launch_toggled(); - void internal_toggled(); - - void disconnect(); - void connect(bool existing); - void quit(); - void on_show(); - void on_hide(); - - void load_widgets(); - void set_connecting_widget_states(); - - bool gtk_callback(); - - const Glib::RefPtr _xml; - - Mode _mode; - int32_t _ping_id; - bool _attached; - - bool _widgets_loaded; - int _connect_stage; - - SharedPtr _engine_module; - Ingen::Engine* (*_new_engine)(Ingen::Shared::World* world); - - Gtk::Image* _icon; - Gtk::ProgressBar* _progress_bar; - Gtk::Label* _progress_label; - Gtk::Entry* _url_entry; - Gtk::RadioButton* _server_radio; - Gtk::SpinButton* _port_spinbutton; - Gtk::RadioButton* _launch_radio; - Gtk::RadioButton* _internal_radio; - Gtk::Button* _disconnect_button; - Gtk::Button* _connect_button; - Gtk::Button* _quit_button; -}; - - -} // namespace GUI -} // namespace Ingen - -#endif // CONNECT_WINDOW_H diff --git a/src/libs/gui/Connection.hpp b/src/libs/gui/Connection.hpp deleted file mode 100644 index 55378891..00000000 --- a/src/libs/gui/Connection.hpp +++ /dev/null @@ -1,60 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef GUI_CONNECTION_H -#define GUI_CONNECTION_H - -#include -#include -#include -#include -#include "client/ConnectionModel.hpp" -using Ingen::Client::ConnectionModel; - -namespace Ingen { -namespace GUI { - - -/** A Connection in a Patch. - * - * \ingroup GUI - */ -class Connection : public FlowCanvas::Connection -{ -public: - Connection(boost::shared_ptr canvas, - boost::shared_ptr model, - boost::shared_ptr src, - boost::shared_ptr dst, - uint32_t color) - : FlowCanvas::Connection(canvas, src, dst, color) - , _connection_model(model) - {} - - virtual ~Connection() {} - - SharedPtr model() const { return _connection_model; } - -private: - SharedPtr _connection_model; -}; - - -} // namespace GUI -} // namespace Ingen - -#endif // GUI_CONNECTION_H diff --git a/src/libs/gui/ControlPanel.cpp b/src/libs/gui/ControlPanel.cpp deleted file mode 100644 index 7da07dbb..00000000 --- a/src/libs/gui/ControlPanel.cpp +++ /dev/null @@ -1,269 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License alongCont - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "interface/EngineInterface.hpp" -#include "client/PatchModel.hpp" -#include "client/NodeModel.hpp" -#include "client/PortModel.hpp" -#include "client/PluginModel.hpp" -#include "App.hpp" -#include "ControlPanel.hpp" -#include "Controls.hpp" -#include "GladeFactory.hpp" - -using namespace std; - -namespace Ingen { -namespace GUI { - - -ControlPanel::ControlPanel(BaseObjectType* cobject, const Glib::RefPtr& xml) - : Gtk::HBox(cobject) - , _callback_enabled(true) -{ - xml->get_widget("control_panel_controls_box", _control_box); - xml->get_widget("control_panel_voice_controls_box", _voice_control_box); - xml->get_widget("control_panel_all_voices_radio", _all_voices_radio); - xml->get_widget("control_panel_specific_voice_radio", _specific_voice_radio); - xml->get_widget("control_panel_voice_spinbutton", _voice_spinbutton); - - _all_voices_radio->signal_toggled().connect( - sigc::mem_fun(this, &ControlPanel::all_voices_selected)); - - _specific_voice_radio->signal_toggled().connect( - sigc::mem_fun(this, &ControlPanel::specific_voice_selected)); - - show_all(); -} - - -ControlPanel::~ControlPanel() -{ - for (vector::iterator i = _controls.begin(); i != _controls.end(); ++i) - delete (*i); -} - - -void -ControlPanel::init(SharedPtr node, uint32_t poly) -{ - assert(node != NULL); - assert(poly > 0); - - if (node->polyphonic()) { - _voice_spinbutton->set_range(0, poly - 1); - _voice_control_box->show(); - } else { - _voice_control_box->hide(); - } - - for (NodeModel::Ports::const_iterator i = node->ports().begin(); i != node->ports().end(); ++i) { - add_port(*i); - } - - node->signal_property.connect(bind( - sigc::mem_fun(this, &ControlPanel::property_changed), false)); - - if (node->parent()) { - node->signal_property.connect(bind( - sigc::mem_fun(this, &ControlPanel::property_changed), true)); - } else { - cerr << "[ControlPanel] No parent, polyphonic controls disabled" << endl; - } - - _callback_enabled = true; -} - - -Control* -ControlPanel::find_port(const Path& path) const -{ - for (vector::const_iterator cg = _controls.begin(); cg != _controls.end(); ++cg) - if ((*cg)->port_model()->path() == path) - return (*cg); - - return NULL; -} - - -/** Add a control to the panel for the given port. - */ -void -ControlPanel::add_port(SharedPtr pm) -{ - assert(pm); - - // Already have port, don't add another - if (find_port(pm->path()) != NULL) - return; - - // Add port - if (pm->type().is_control() && pm->is_input()) { - Control* control = NULL; - - if (pm->is_toggle()) { - ToggleControl* tc; - Glib::RefPtr xml = GladeFactory::new_glade_reference("toggle_control"); - xml->get_widget_derived("toggle_control", tc); - control = tc; - } else { - SliderControl* sc; - Glib::RefPtr xml = GladeFactory::new_glade_reference("control_strip"); - xml->get_widget_derived("control_strip", sc); - control = sc; - } - - control->init(this, pm); - - if (_controls.size() > 0) - _control_box->pack_start(*Gtk::manage(new Gtk::HSeparator()), false, false, 4); - - _controls.push_back(control); - _control_box->pack_start(*control, false, false, 0); - - control->enable(); - control->show(); - } - - Gtk::Requisition controls_size; - _control_box->size_request(controls_size); - _ideal_size.first = controls_size.width; - _ideal_size.second = controls_size.height; - - Gtk::Requisition voice_size; - _voice_control_box->size_request(voice_size); - _ideal_size.first += voice_size.width; - _ideal_size.second += voice_size.height; - - //cerr << "Setting ideal size to " << _ideal_size.first - // << " x " << _ideal_size.second << endl; -} - - -/** Remove the control for the given port. - */ -void -ControlPanel::remove_port(const Path& path) -{ - bool was_first = false; - for (vector::iterator cg = _controls.begin(); cg != _controls.end(); ++cg) { - if ((*cg)->port_model()->path() == path) { - _control_box->remove(**cg); - if (cg == _controls.begin()) - was_first = true; - _controls.erase(cg); - break; - } - } -} - - -/** Rename the control for the given port. - */ -/* -void -ControlPanel::rename_port(const Path& old_path, const Path& new_path) -{ - for (vector::iterator cg = _controls.begin(); cg != _controls.end(); ++cg) { - if ((*cg)->port_model()->path() == old_path) { - (*cg)->set_name(new_path.name()); - return; - } - } -} -*/ - -#if 0 -/** Enable the control for the given port. - * - * Used when all connections to port are un-made. - */ -void -ControlPanel::enable_port(const Path& path) -{ - for (vector::iterator i = _controls.begin(); i != _controls.end(); ++i) { - if ((*i)->port_model()->path() == path) { - (*i)->enable(); - return; - } - } -} - - -/** Disable the control for the given port. - * - * Used when port is connected. - */ -void -ControlPanel::disable_port(const Path& path) -{ - for (vector::iterator i = _controls.begin(); i != _controls.end(); ++i) { - if ((*i)->port_model()->path() == path) { - (*i)->disable(); - return; - } - } -} -#endif - -/** Callback for Controls to notify this of a change. - */ -void -ControlPanel::value_changed(SharedPtr port, float val) -{ - if (_callback_enabled) { - if (_all_voices_radio->get_active()) { - App::instance().engine()->set_port_value(port->path(), Atom(val)); - port->value(val); - } else { - int voice = _voice_spinbutton->get_value_as_int() - 1; - App::instance().engine()->set_voice_value(port->path(), voice, Atom(val)); - port->value(val); - } - } -} - -void -ControlPanel::all_voices_selected() -{ - _voice_spinbutton->property_sensitive() = false; -} - - -void -ControlPanel::specific_voice_selected() -{ - _voice_spinbutton->property_sensitive() = true; -} - - -void -ControlPanel::property_changed(const std::string& predicate, const Raul::Atom& value, bool parent) -{ - if (!parent && predicate == "ingen:polyphonic" && value.type() == Atom::BOOL) { - if (value.get_bool()) - _voice_control_box->show(); - else - _voice_control_box->hide(); - } else if (parent && predicate == "ingen:polyphony" && value.type() == Atom::INT) { - _voice_spinbutton->set_range(0, value.get_int32() - 1); - } -} - - -} // namespace GUI -} // namespace Ingen diff --git a/src/libs/gui/ControlPanel.hpp b/src/libs/gui/ControlPanel.hpp deleted file mode 100644 index 8af5a728..00000000 --- a/src/libs/gui/ControlPanel.hpp +++ /dev/null @@ -1,91 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef CONTROLPANEL_H -#define CONTROLPANEL_H - -#include -#include -#include -#include // for pair<> -#include -#include -#include -#include -#include -#include "Controls.hpp" - -namespace Ingen { namespace Client { - class PortModel; - class NodeModel; -} } -using namespace Ingen::Client; - -namespace Ingen { -namespace GUI { - - -/** A group of controls for a node (or patch). - * - * Used by both NodeControlWindow and the main window (for patch controls). - * - * \ingroup GUI - */ -class ControlPanel : public Gtk::HBox { -public: - ControlPanel(BaseObjectType* cobject, const Glib::RefPtr& glade_xml); - virtual ~ControlPanel(); - - void init(SharedPtr node, uint32_t poly); - - Control* find_port(const Path& path) const; - - void add_port(SharedPtr port); - void remove_port(const Path& path); - - void enable_port(const Path& path); - void disable_port(const Path& path); - - size_t num_controls() const { return _controls.size(); } - std::pair ideal_size() const { return _ideal_size; } - - // Callback for Control - void value_changed(SharedPtr port_path, float val); - -private: - void all_voices_selected(); - void specific_voice_selected(); - - void property_changed(const std::string& predicate, const Raul::Atom& value, bool parent); - - bool _callback_enabled; - - std::pair _ideal_size; - - std::vector _controls; - Gtk::VBox* _control_box; - Gtk::Box* _voice_control_box; - Gtk::RadioButton* _all_voices_radio; - Gtk::RadioButton* _specific_voice_radio; - Gtk::SpinButton* _voice_spinbutton; -}; - - -} // namespace GUI -} // namespace Ingen - -#endif // CONTROLPANEL_H diff --git a/src/libs/gui/Controls.cpp b/src/libs/gui/Controls.cpp deleted file mode 100644 index cc5383a8..00000000 --- a/src/libs/gui/Controls.cpp +++ /dev/null @@ -1,467 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include CONFIG_H_PATH - -#include -#include -#include -#include "interface/EngineInterface.hpp" -#include "client/PluginModel.hpp" -#include "client/NodeModel.hpp" -#include "client/PortModel.hpp" -#include "Controls.hpp" -#include "ControlPanel.hpp" -#include "PortPropertiesWindow.hpp" -#include "GladeFactory.hpp" -#include "App.hpp" - -using namespace std; -using namespace Ingen::Client; - -namespace Ingen { -namespace GUI { - - -// ////////////////////// Control ///////////////////////////////// // - -Control::Control(BaseObjectType* cobject, const Glib::RefPtr& glade_xml) - : Gtk::VBox(cobject) - , _control_panel(NULL) - , _enable_signal(false) -{ - Glib::RefPtr menu_xml = GladeFactory::new_glade_reference("port_control_menu"); - menu_xml->get_widget("port_control_menu", _menu); - menu_xml->get_widget("port_control_menu_properties", _menu_properties); - - _menu_properties->signal_activate().connect( - sigc::mem_fun(this, &SliderControl::menu_properties)); -} - - -Control::~Control() -{ - _enable_signal = false; - _control_connection.disconnect(); - _port_model.reset(); -} - - -void -Control::init(ControlPanel* panel, SharedPtr pm) -{ - _control_panel = panel; - _port_model = pm, - - assert(_port_model); - assert(panel); - - _control_connection = pm->signal_value_changed.connect(sigc::mem_fun(this, &Control::set_value)); -} - - -void -Control::menu_properties() -{ - Glib::RefPtr xml = GladeFactory::new_glade_reference(); - - PortPropertiesWindow* window; - xml->get_widget_derived("port_properties_win", window); - window->present(_port_model); -} - - -// ////////////////// SliderControl ////////////////////// // - - -SliderControl::SliderControl(BaseObjectType* cobject, const Glib::RefPtr& xml) - : Control(cobject, xml) - , _enabled(true) -{ - xml->get_widget("control_strip_name_label", _name_label); - xml->get_widget("control_strip_slider", _slider); - xml->get_widget("control_strip_spinner", _value_spinner); -} - - -void -SliderControl::init(ControlPanel* panel, SharedPtr pm) -{ - _enable_signal = false; - _enabled = true; - - Control::init(panel, pm); - - assert(_name_label); - assert(_slider); - - set_name(pm->path().name()); - - _slider->set_draw_value(false); - - signal_button_press_event().connect(sigc::mem_fun(*this, &SliderControl::clicked)); - _slider->signal_button_press_event().connect(sigc::mem_fun(*this, &SliderControl::clicked)); - - _slider->signal_event().connect( - sigc::mem_fun(*this, &SliderControl::slider_pressed)); - - _slider->signal_value_changed().connect( - sigc::mem_fun(*this, &SliderControl::update_value_from_slider)); - - _value_spinner->signal_value_changed().connect( - sigc::mem_fun(*this, &SliderControl::update_value_from_spinner)); - - float min = 0.0f, max = 1.0f; - - boost::shared_ptr parent = PtrCast(_port_model->parent()); - if (parent) - parent->port_value_range(_port_model, min, max); - - if (pm->is_integer() || pm->is_toggle()) { - _slider->set_increments(1, 10); - _value_spinner->set_digits(0); - } else { - _slider->set_increments(0, 0); - } - - pm->signal_variable.connect(sigc::mem_fun(this, &SliderControl::port_variable_change)); - - _slider->set_range(std::min(min, pm->value().get_float()), std::max(max, pm->value().get_float())); - //_value_spinner->set_range(min, max); - - set_value(pm->value()); - - _enable_signal = true; - - show_all(); -} - - -bool -SliderControl::clicked(GdkEventButton* ev) -{ - if (ev->button == 3) { - _menu->popup(ev->button, ev->time); - return true; - } else { - return false; - } -} - - -void -SliderControl::set_value(const Atom& atom) -{ - float val = atom.get_float(); - - if (_port_model->is_integer()) - val = lrintf(val); - - _enable_signal = false; - if (_enabled) { - if (_slider->get_value() != val) { - const Gtk::Adjustment* range = _slider->get_adjustment(); - const float lower = range->get_lower(); - const float upper = range->get_upper(); - if (val < lower || val > upper) - set_range(min(lower, val), max(lower, val)); - _slider->set_value(val); - } - if (_value_spinner->get_value() != val) - _value_spinner->set_value(val); - } - _enable_signal = true; -} - - -void -SliderControl::port_variable_change(const string& key, const Atom& value) -{ - if ( (key == "ingen:minimum") && value.type() == Atom::FLOAT) - set_range(value.get_float(), _slider->get_adjustment()->get_upper()); - else if ( (key == "ingen:maximum") && value.type() == Atom::FLOAT) - set_range(_slider->get_adjustment()->get_lower(), value.get_float()); -} - - -void -SliderControl::set_range(float min, float max) -{ - _slider->set_range(min, max); - //_value_spinner->set_range(min, max); -} - - -void -SliderControl::set_name(const string& name) -{ - string name_label = ""; - name_label += name + ""; - _name_label->set_markup(name_label); -} - - -void -SliderControl::enable() -{ - _slider->property_sensitive() = true; - //_min_spinner->property_sensitive() = true; - //_max_spinner->property_sensitive() = true; - _value_spinner->property_sensitive() = true; - _name_label->property_sensitive() = true; -} - - -void -SliderControl::disable() -{ - _slider->property_sensitive() = false; - //_min_spinner->property_sensitive() = false; - //_max_spinner->property_sensitive() = false; - _value_spinner->property_sensitive() = false; - _name_label->property_sensitive() = false; -} - - -void -SliderControl::update_value_from_slider() -{ - if (_enable_signal) { - float value = _slider->get_value(); - bool change = true; - - _enable_signal = false; - - if (_port_model->is_integer()) { - value = lrintf(value); - if (value == lrintf(_port_model->value().get_float())) - change = false; - } - - if (change) { - _value_spinner->set_value(value); - _control_panel->value_changed(_port_model, value); - } - - _enable_signal = true; - } -} - - -void -SliderControl::update_value_from_spinner() -{ - if (_enable_signal) { - _enable_signal = false; - const float value = _value_spinner->get_value(); - - set_value(value); - - _control_panel->value_changed(_port_model, value); - - //m_port_model->value(value); - _enable_signal = true; - } -} - - -/** Callback for when slider is grabbed so we can ignore set_control - * events for this port (and avoid nasty feedback issues). - */ -bool -SliderControl::slider_pressed(GdkEvent* ev) -{ - //cerr << "Pressed: " << ev->type << endl; - if (ev->type == GDK_BUTTON_PRESS) { - _enabled = false; - //GtkClientInterface::instance()->set_ignore_port(_port_model->path()); - } else if (ev->type == GDK_BUTTON_RELEASE) { - _enabled = true; - //GtkClientInterface::instance()->clear_ignore_port(); - } - - return false; -} - - -// ///////////// IntegerControl ////////////// // - -#if 0 -IntegerControl::IntegerControl(ControlPanel* panel, SharedPtr pm) -: Control(panel, pm), - _enable_signal(false), - _alignment(0.5, 0.5, 0.0, 0.0), - _name_label(pm->path().name()), - _spinner(1.0, 0) -{ - set_name(pm->path().name()); - - _spinner.set_range(-99999, 99999); - _spinner.set_value(_port_model->value()); - _spinner.signal_value_changed().connect( - sigc::mem_fun(*this, &IntegerControl::update_value)); - _spinner.set_increments(1, 10); - - _alignment.add(_spinner); - pack_start(_name_label); - pack_start(_alignment); - - _enable_signal = true; - - show_all(); -} - - -void -IntegerControl::set_name(const string& name) -{ - string name_label = ""; - name_label += name + ""; - _name_label->set_markup(name_label); -} - - -void -IntegerControl::set_value(float val) -{ - //cerr << "[IntegerControl] Setting value to " << val << endl; - _enable_signal = false; - _spinner.set_value(val); - _enable_signal = true; -} - - -void -IntegerControl::enable() -{ - _spinner.property_sensitive() = true; - _name_label->property_sensitive() = true; -} - - -void -IntegerControl::disable() -{ - _spinner.property_sensitive() = false; - _name_label->property_sensitive() = false; -} - - -void -IntegerControl::update_value() -{ - if (_enable_signal) { - float value = _spinner.get_value(); - _control_panel->value_changed(_port_model, value); - //m_port_model->value(value); - } -} -#endif - - -// ///////////// ToggleControl ////////////// // - - -ToggleControl::ToggleControl(BaseObjectType* cobject, const Glib::RefPtr& xml) - : Control(cobject, xml) -{ - xml->get_widget("toggle_control_name_label", _name_label); - xml->get_widget("toggle_control_check", _checkbutton); -} - - -void -ToggleControl::init(ControlPanel* panel, SharedPtr pm) -{ - _enable_signal = false; - - Control::init(panel, pm); - - assert(_name_label); - assert(_checkbutton); - - set_name(pm->path().name()); - - _checkbutton->signal_toggled().connect(sigc::mem_fun(*this, &ToggleControl::toggled)); - set_value(pm->value()); - - _enable_signal = true; - show_all(); -} - - -void -ToggleControl::set_name(const string& name) -{ - string name_label = ""; - name_label += name + ""; - _name_label->set_markup(name_label); -} - - -void -ToggleControl::set_value(const Atom& val) -{ - bool enable = false; - switch (val.type()) { - case Atom::FLOAT: - enable = (val.get_float() != 0.0f); - break; - case Atom::INT: - enable = (val.get_int32() != 0); - break; - case Atom::BOOL: - enable = (val.get_bool()); - default: - cerr << "Unsupported value type for toggle control" << endl; - } - - _enable_signal = false; - _checkbutton->set_active(enable); - _enable_signal = true; -} - - -void -ToggleControl::enable() -{ - _checkbutton->property_sensitive() = true; - _name_label->property_sensitive() = true; -} - - -void -ToggleControl::disable() -{ - _checkbutton->property_sensitive() = false; - _name_label->property_sensitive() = false; -} - - -void -ToggleControl::toggled() -{ - if (_enable_signal) { - float value = _checkbutton->get_active() ? 1.0f : 0.0f; - _control_panel->value_changed(_port_model, value); - //m_port_model->value(value); - } -} - - -} // namespace GUI -} // namespace Ingen diff --git a/src/libs/gui/Controls.hpp b/src/libs/gui/Controls.hpp deleted file mode 100644 index 8a9c4064..00000000 --- a/src/libs/gui/Controls.hpp +++ /dev/null @@ -1,164 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef CONTROLGROUPS_H -#define CONTROLGROUPS_H - -#include -#include -#include -#include -#include "client/PortModel.hpp" -#include - -namespace Ingen { namespace Client { class PortModel; } } -using namespace Ingen::Client; - -namespace Ingen { -namespace GUI { - -class ControlPanel; - - -/** A group of controls (for a single Port) in a ControlPanel. - * - * \ingroup GUI - */ -class Control : public Gtk::VBox -{ -public: - Control(BaseObjectType* cobject, const Glib::RefPtr& glade_xml); - virtual ~Control(); - - virtual void init(ControlPanel* panel, SharedPtr pm); - - virtual void enable() = 0; - virtual void disable() = 0; - - inline const SharedPtr port_model() const { return _port_model; } - -protected: - virtual void set_value(const Atom& value) = 0; - virtual void set_range(float min, float max) {} - - void menu_properties(); - - ControlPanel* _control_panel; - SharedPtr _port_model; - sigc::connection _control_connection; - bool _enable_signal; - - Gtk::Menu* _menu; - Gtk::MenuItem* _menu_properties; -}; - - -/** A slider for a continuous control. - * - * \ingroup GUI - */ -class SliderControl : public Control -{ -public: - SliderControl(BaseObjectType* cobject, const Glib::RefPtr& glade_xml); - void init(ControlPanel* panel, SharedPtr pm); - - void enable(); - void disable(); - - void set_min(float val); - void set_max(float val); - -private: - void set_name(const string& name); - void set_value(const Atom& value); - void set_range(float min, float max); - - void port_variable_change(const string& key, const Raul::Atom& value); - - void update_range(); - void update_value_from_slider(); - void update_value_from_spinner(); - - bool slider_pressed(GdkEvent* ev); - bool clicked(GdkEventButton* ev); - - bool _enabled; - - Gtk::Label* _name_label; - Gtk::SpinButton* _value_spinner; - Gtk::HScale* _slider; -}; - - -#if 0 - -/** A spinbutton for integer controls. - * - * \ingroup GUI - */ -class IntegerControl : public Control -{ -public: - IntegerControl(ControlPanel* panel, SharedPtr pm); - - void enable(); - void disable(); - -private: - void set_name(const string& name); - void set_value(float val); - - void update_value(); - - bool _enable_signal; - Gtk::Alignment _alignment; - Gtk::Label _name_label; - Gtk::SpinButton _spinner; -}; -#endif - - -/** A radio button for toggle controls. - * - * \ingroup GUI - */ -class ToggleControl : public Control -{ -public: - ToggleControl(BaseObjectType* cobject, const Glib::RefPtr& xml); - - void init(ControlPanel* panel, SharedPtr pm); - - void enable(); - void disable(); - -private: - void set_name(const string& name); - void set_value(const Atom& value); - - void toggled(); - - Gtk::Label* _name_label; - Gtk::CheckButton* _checkbutton; -}; - - -} // namespace GUI -} // namespace Ingen - -#endif // CONTROLGROUPS_H diff --git a/src/libs/gui/GladeFactory.cpp b/src/libs/gui/GladeFactory.cpp deleted file mode 100644 index 2b4d3ec9..00000000 --- a/src/libs/gui/GladeFactory.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "GladeFactory.hpp" -#include -#include - -using namespace std; - -namespace Ingen { -namespace GUI { - - -Glib::ustring GladeFactory::glade_filename = ""; - - -void -GladeFactory::find_glade_file() -{ - char* env_path = getenv("INGEN_GLADE_PATH"); - if (env_path) - glade_filename = env_path; - else - glade_filename = "./ingen_gui.glade"; - - ifstream fs(glade_filename.c_str()); - if (fs.fail()) { // didn't find it, check INGEN_DATA_DIR - fs.clear(); - glade_filename = INGEN_DATA_DIR; - glade_filename += "/ingen_gui.glade"; - - fs.open(glade_filename.c_str()); - if (fs.fail()) { - cerr << "[GladeFactory] Unable to find ingen_gui.glade in current directory or " << INGEN_DATA_DIR << "." << endl; - throw; - } - fs.close(); - } - cerr << "[GladeFactory] Loading widgets from " << glade_filename.c_str() << endl; -} - - -Glib::RefPtr -GladeFactory::new_glade_reference(const string& toplevel_widget) -{ - if (glade_filename == "") - find_glade_file(); - - try { - if (toplevel_widget == "") - return Gnome::Glade::Xml::create(glade_filename); - else - return Gnome::Glade::Xml::create(glade_filename, toplevel_widget.c_str()); - } catch (const Gnome::Glade::XmlError& ex) { - cerr << ex.what() << endl; - throw ex; - } -} - - -} // namespace GUI -} // namespace Ingen diff --git a/src/libs/gui/GladeFactory.hpp b/src/libs/gui/GladeFactory.hpp deleted file mode 100644 index 6da2da5f..00000000 --- a/src/libs/gui/GladeFactory.hpp +++ /dev/null @@ -1,47 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef GLADEFACTORY_H -#define GLADEFACTORY_H - -#include -#include - -namespace Ingen { -namespace GUI { - - -/** Creates glade references, so various objects can create widgets. - * Purely static. - * - * \ingroup GUI - */ -class GladeFactory { -public: - static Glib::RefPtr - new_glade_reference(const std::string& toplevel_widget = ""); - -private: - static void find_glade_file(); - static Glib::ustring glade_filename; -}; - - -} // namespace GUI -} // namespace Ingen - -#endif // GLADEFACTORY_H diff --git a/src/libs/gui/LoadPatchWindow.cpp b/src/libs/gui/LoadPatchWindow.cpp deleted file mode 100644 index 70d3ec5b..00000000 --- a/src/libs/gui/LoadPatchWindow.cpp +++ /dev/null @@ -1,153 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include -#include -#include "LoadPatchWindow.hpp" -#include "interface/EngineInterface.hpp" -#include "client/PatchModel.hpp" -#include "App.hpp" -#include "Configuration.hpp" -#include "ThreadedLoader.hpp" - -using namespace Ingen::Serialisation; -using boost::optional; -using namespace std; - -namespace Ingen { -namespace GUI { - - -LoadPatchWindow::LoadPatchWindow(BaseObjectType* cobject, const Glib::RefPtr& xml) -: Gtk::FileChooserDialog(cobject), - _replace(true) -{ - xml->get_widget("load_patch_poly_from_current_radio", _poly_from_current_radio); - xml->get_widget("load_patch_poly_from_file_radio", _poly_from_file_radio); - xml->get_widget("load_patch_poly_from_user_radio", _poly_from_user_radio); - xml->get_widget("load_patch_poly_spinbutton", _poly_spinbutton); - xml->get_widget("load_patch_ok_button", _ok_button); - xml->get_widget("load_patch_cancel_button", _cancel_button); - - _poly_from_current_radio->signal_toggled().connect(sigc::mem_fun(this, &LoadPatchWindow::poly_from_file_selected)); - _poly_from_file_radio->signal_toggled().connect(sigc::mem_fun(this, &LoadPatchWindow::poly_from_file_selected)); - _poly_from_user_radio->signal_toggled().connect(sigc::mem_fun(this, &LoadPatchWindow::poly_from_user_selected)); - _ok_button->signal_clicked().connect(sigc::mem_fun(this, &LoadPatchWindow::ok_clicked)); - _cancel_button->signal_clicked().connect(sigc::mem_fun(this, &LoadPatchWindow::cancel_clicked)); - - _poly_from_current_radio->set_active(true); - - Gtk::FileFilter filt; - filt.add_pattern("*.om"); - filt.set_name("Om patch files (XML, DEPRECATED) (*.om)"); - filt.add_pattern("*.ingen.ttl"); - filt.set_name("Ingen patch files (RDF, *.ingen.ttl)"); - set_filter(filt); - - // Add global examples directory to "shortcut folders" (bookmarks) - string examples_dir = INGEN_DATA_DIR; - examples_dir.append("/patches"); - DIR* d = opendir(examples_dir.c_str()); - if (d != NULL) - add_shortcut_folder(examples_dir); -} - - -void -LoadPatchWindow::present(SharedPtr patch, GraphObject::Variables data) -{ - set_patch(patch); - _initial_data = data; - Gtk::Window::present(); -} - - -/** Sets the patch controller for this window and initializes everything. - * - * This function MUST be called before using the window in any way! - */ -void -LoadPatchWindow::set_patch(SharedPtr patch) -{ - _patch = patch; -} - - -void -LoadPatchWindow::on_show() -{ - if (App::instance().configuration()->patch_folder().length() > 0) - set_current_folder(App::instance().configuration()->patch_folder()); - Gtk::FileChooserDialog::on_show(); -} - - -///// Event Handlers ////// - - -void -LoadPatchWindow::poly_from_file_selected() -{ - _poly_spinbutton->property_sensitive() = false; -} - - -void -LoadPatchWindow::poly_from_user_selected() -{ - _poly_spinbutton->property_sensitive() = true; -} - - -void -LoadPatchWindow::ok_clicked() -{ - if (!_patch) - return; - - // If unset load_patch will load value - optional parent; - optional symbol; - - if (_poly_from_user_radio->get_active()) - _initial_data.insert(make_pair("ingen:polyphony", _poly_spinbutton->get_value_as_int())); - - if (_replace) - App::instance().engine()->clear_patch(_patch->path()); - - //if (_patch->path() != "/") - // parent = _patch->path().parent(); - parent = _patch->path(); - - _patch.reset(); - hide(); - - App::instance().loader()->load_patch(true, get_uri(), "/", - _initial_data, parent, symbol); -} - - -void -LoadPatchWindow::cancel_clicked() -{ - hide(); -} - - -} // namespace GUI -} // namespace Ingen diff --git a/src/libs/gui/LoadPatchWindow.hpp b/src/libs/gui/LoadPatchWindow.hpp deleted file mode 100644 index 4f3521e5..00000000 --- a/src/libs/gui/LoadPatchWindow.hpp +++ /dev/null @@ -1,82 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef LOADPATCHWINDOW_H -#define LOADPATCHWINDOW_H - -#include -#include -#include -#include "interface/GraphObject.hpp" -#include "client/PluginModel.hpp" -#include "client/PatchModel.hpp" -using Ingen::Client::PatchModel; -using namespace Ingen::Shared; - -namespace Ingen { -namespace GUI { - - -/** 'Load Patch' window. - * - * Loaded by glade as a derived object. Used for both "Import" and "Load" - * (e.g. Replace, clear-then-import) operations (the radio button state - * should be changed with the provided methods before presenting). - * - * This is not for loading subpatches. See @a LoadSubpatchWindow for that. - * - * \ingroup GUI - */ -class LoadPatchWindow : public Gtk::FileChooserDialog -{ -public: - LoadPatchWindow(BaseObjectType* cobject, const Glib::RefPtr& xml); - - void set_patch(SharedPtr patch); - - void set_replace() { _replace = true; } - void set_merge() { _replace = false; } - - void present(SharedPtr patch, GraphObject::Variables data); - -protected: - void on_show(); - -private: - void poly_from_file_selected(); - void poly_from_user_selected(); - void ok_clicked(); - void cancel_clicked(); - - GraphObject::Variables _initial_data; - - SharedPtr _patch; - bool _replace; - - Gtk::RadioButton* _poly_from_current_radio; - Gtk::RadioButton* _poly_from_file_radio; - Gtk::RadioButton* _poly_from_user_radio; - Gtk::SpinButton* _poly_spinbutton; - Gtk::Button* _ok_button; - Gtk::Button* _cancel_button; -}; - - -} // namespace GUI -} // namespace Ingen - -#endif // LOADPATCHWINDOW_H diff --git a/src/libs/gui/LoadPluginWindow.cpp b/src/libs/gui/LoadPluginWindow.cpp deleted file mode 100644 index 28815ba9..00000000 --- a/src/libs/gui/LoadPluginWindow.cpp +++ /dev/null @@ -1,464 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include -#include -#include -#include "interface/EngineInterface.hpp" -#include "client/NodeModel.hpp" -#include "client/PatchModel.hpp" -#include "client/ClientStore.hpp" -#include "App.hpp" -#include "LoadPluginWindow.hpp" -#include "PatchWindow.hpp" -#include "PatchView.hpp" -#include "PatchCanvas.hpp" - -using namespace std; - - -namespace Ingen { -namespace GUI { - -LoadPluginWindow::LoadPluginWindow(BaseObjectType* cobject, const Glib::RefPtr& xml) - : Gtk::Window(cobject) - , _plugin_name_offset(0) - , _has_shown(false) - , _refresh_list(true) -{ - xml->get_widget("load_plugin_plugins_treeview", _plugins_treeview); - xml->get_widget("load_plugin_polyphonic_checkbutton", _polyphonic_checkbutton); - xml->get_widget("load_plugin_name_entry", _node_name_entry); - xml->get_widget("load_plugin_clear_button", _clear_button); - xml->get_widget("load_plugin_add_button", _add_button); - //xml->get_widget("load_plugin_close_button", _close_button); - //xml->get_widget("load_plugin_ok_button", _add_button); - - xml->get_widget("load_plugin_filter_combo", _filter_combo); - xml->get_widget("load_plugin_search_entry", _search_entry); - - // Set up the plugins list - _plugins_liststore = Gtk::ListStore::create(_plugins_columns); - _plugins_treeview->set_model(_plugins_liststore); - _plugins_treeview->append_column("", _plugins_columns._col_icon); - _plugins_treeview->append_column("Name", _plugins_columns._col_name); - _plugins_treeview->append_column("Type", _plugins_columns._col_type); - _plugins_treeview->append_column("URI", _plugins_columns._col_uri); - //m_plugins_treeview->append_column("Library", _plugins_columns._col_library); - //m_plugins_treeview->append_column("Label", _plugins_columns._col_label); - - // This could be nicer.. store the TreeViewColumns locally maybe? - _plugins_treeview->get_column(1)->set_sort_column(_plugins_columns._col_name); - _plugins_treeview->get_column(2)->set_sort_column(_plugins_columns._col_type); - _plugins_treeview->get_column(3)->set_sort_column(_plugins_columns._col_uri); - //m_plugins_treeview->get_column(3)->set_sort_column(_plugins_columns._col_library); - //m_plugins_treeview->get_column(4)->set_sort_column(_plugins_columns._col_label); - for (int i=0; i < 3; ++i) - _plugins_treeview->get_column(i)->set_resizable(true); - - _plugins_liststore->set_default_sort_func(sigc::mem_fun(this, &LoadPluginWindow::plugin_compare)); - - // Set up the search criteria combobox - _criteria_liststore = Gtk::ListStore::create(_criteria_columns); - _filter_combo->set_model(_criteria_liststore); - 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; - _filter_combo->set_active(iter); - iter = _criteria_liststore->append(); row = *iter; - row[_criteria_columns._col_label] = "Type contains"; - row[_criteria_columns._col_criteria] = CriteriaColumns::TYPE; - iter = _criteria_liststore->append(); row = *iter; - row[_criteria_columns._col_label] = "URI contains"; - row[_criteria_columns._col_criteria] = CriteriaColumns::URI; - /*iter = _criteria_liststore->append(); row = *iter; - row[_criteria_columns._col_label] = "Library contains: "; - row[_criteria_columns._col_criteria] = CriteriaColumns::LIBRARY; - iter = _criteria_liststore->append(); row = *iter; - row[_criteria_columns._col_label] = "Label contains: "; - row[_criteria_columns._col_criteria] = CriteriaColumns::LABEL;*/ - - _clear_button->signal_clicked().connect( sigc::mem_fun(this, &LoadPluginWindow::clear_clicked)); - _add_button->signal_clicked().connect( sigc::mem_fun(this, &LoadPluginWindow::add_clicked)); - //m_close_button->signal_clicked().connect( sigc::mem_fun(this, &LoadPluginWindow::close_clicked)); - //m_add_button->signal_clicked().connect( sigc::mem_fun(this, &LoadPluginWindow::ok_clicked)); - _plugins_treeview->signal_row_activated().connect(sigc::mem_fun(this, &LoadPluginWindow::plugin_activated)); - _search_entry->signal_activate().connect( sigc::mem_fun(this, &LoadPluginWindow::add_clicked)); - _search_entry->signal_changed().connect( sigc::mem_fun(this, &LoadPluginWindow::filter_changed)); - _node_name_entry->signal_changed().connect( sigc::mem_fun(this, &LoadPluginWindow::name_changed)); - - _selection = _plugins_treeview->get_selection(); - _selection->signal_changed().connect(sigc::mem_fun(this, &LoadPluginWindow::plugin_selection_changed)); - - //m_add_button->grab_default(); -} - - -void -LoadPluginWindow::present(SharedPtr patch, GraphObject::Variables data) -{ - set_patch(patch); - _initial_data = data; - Gtk::Window::present(); -} - - -/** Called every time the user types into the name input box. - * Used to display warning messages, and enable/disable the OK button. - */ -void -LoadPluginWindow::name_changed() -{ - string name = _node_name_entry->get_text(); - if (!Path::is_valid_name(name)) { - //m_message_label->set_text("Name contains invalid characters."); - _add_button->property_sensitive() = false; - } else if (App::instance().store()->find_child(_patch, name)) { - //m_message_label->set_text("An object already exists with that name."); - _add_button->property_sensitive() = false; - } else if (name.length() == 0) { - //m_message_label->set_text(""); - _add_button->property_sensitive() = false; - } else { - //m_message_label->set_text(""); - _add_button->property_sensitive() = true; - } -} - - -/** Sets the patch controller for this window and initializes everything. - * - * This function MUST be called before using the window in any way! - */ -void -LoadPluginWindow::set_patch(SharedPtr patch) -{ - if (_patch) { - _patch = patch; - plugin_selection_changed(); - } else { - _patch = patch; - } - - /*if (patch->poly() <= 1) - _polyphonic_checkbutton->property_sensitive() = false; - else - _polyphonic_checkbutton->property_sensitive() = true;*/ -} - - -/** Populates the plugin list on the first show. - * - * This is done here instead of construction time as the list population is - * really expensive and bogs down creation of a patch. This is especially - * important when many patch notifications are sent at one time from the - * engine. - */ -void -LoadPluginWindow::on_show() -{ - if (!_has_shown) { - App::instance().store()->signal_new_plugin.connect( - sigc::mem_fun(this, &LoadPluginWindow::add_plugin)); - _has_shown = true; - } - - if (_refresh_list) { - set_plugins(App::instance().store()->plugins()); - _refresh_list = false; - } - - Gtk::Window::on_show(); -} - - -int -LoadPluginWindow::plugin_compare(const Gtk::TreeModel::iterator& a_i, - const Gtk::TreeModel::iterator& b_i) -{ - SharedPtr a = a_i->get_value(_plugins_columns._col_plugin_model); - SharedPtr b = b_i->get_value(_plugins_columns._col_plugin_model); - - // FIXME: haaack - if (!a && !b) - return 0; - else if (!a) - return 1; - else if (!b) - return -1; - - if (a->type() == b->type()) - return strcmp(a->name().c_str(), b->name().c_str()); - else - return ((int)a->type() < (int)b->type()) ? -1 : 1; -} - - -void -LoadPluginWindow::set_plugins(SharedPtr m) -{ - _plugins_liststore->clear(); - - for (ClientStore::Plugins::const_iterator i = m->begin(); i != m->end(); ++i) { - SharedPtr plugin = (*i).second; - - Gtk::TreeModel::iterator iter = _plugins_liststore->append(); - Gtk::TreeModel::Row row = *iter; - - row[_plugins_columns._col_icon] = App::instance().icon_from_path(plugin->icon_path(), 20); - row[_plugins_columns._col_name] = plugin->name(); - //row[_plugins_columns._col_label] = plugin->plug_label(); - if (!strcmp(plugin->type_uri(), "ingen:Internal")) - row[_plugins_columns._col_type] = "Internal"; - else if (!strcmp(plugin->type_uri(), "ingen:LV2")) - row[_plugins_columns._col_type] = "LV2"; - else if (!strcmp(plugin->type_uri(), "ingen:LADSPA")) - row[_plugins_columns._col_type] = "LADSPA"; - else - row[_plugins_columns._col_type] = plugin->type_uri(); - row[_plugins_columns._col_uri] = plugin->uri(); - row[_plugins_columns._col_label] = plugin->name(); - //row[_plugins_columns._col_library] = plugin->lib_name(); - row[_plugins_columns._col_plugin_model] = plugin; - } - - _plugins_liststore->set_sort_column(Gtk::TreeSortable::DEFAULT_SORT_COLUMN_ID, Gtk::SORT_ASCENDING); - - _plugins_treeview->columns_autosize(); -} - - -void -LoadPluginWindow::new_plugin(SharedPtr pm) -{ - if (is_visible()) - add_plugin(pm); - else - _refresh_list = true; -} - - -void -LoadPluginWindow::add_plugin(SharedPtr plugin) -{ - Gtk::TreeModel::iterator iter = _plugins_liststore->append(); - Gtk::TreeModel::Row row = *iter; - - row[_plugins_columns._col_name] = plugin->name(); - //row[_plugins_columns._col_label] = plugin->plug_label(); - row[_plugins_columns._col_type] = plugin->type_uri(); - row[_plugins_columns._col_uri] = plugin->uri(); - row[_plugins_columns._col_label] = plugin->name(); - //row[_plugins_columns._col_library] = plugin->lib_name(); - row[_plugins_columns._col_plugin_model] = plugin; -} - - - -///// Event Handlers ////// - - -void -LoadPluginWindow::plugin_activated(const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* col) -{ - add_clicked(); -} - - -void -LoadPluginWindow::plugin_selection_changed() -{ - Gtk::TreeModel::iterator iter = _selection->get_selected(); - if (iter) { - Gtk::TreeModel::Row row = *iter; - boost::shared_ptr p = row.get_value(_plugins_columns._col_plugin_model); - _plugin_name_offset = App::instance().store()->child_name_offset( - _patch->path(), p->default_node_symbol()); - _node_name_entry->set_text(generate_module_name(_plugin_name_offset)); - } else { - _plugin_name_offset = 0; - _node_name_entry->set_text(""); - } -} - - -/** Generate an automatic name for this Node. - * - * Offset is an offset of the number that will be appended to the plugin's - * label, needed if the user adds multiple plugins faster than the engine - * sends the notification back. - */ -string -LoadPluginWindow::generate_module_name(int offset) -{ - string name = ""; - - Gtk::TreeModel::iterator iter = _selection->get_selected(); - - if (iter) { - Gtk::TreeModel::Row row = *iter; - SharedPtr plugin = row.get_value(_plugins_columns._col_plugin_model); - std::stringstream ss; - ss << plugin->default_node_symbol(); - if (offset != 0) - ss << "_" << offset + 1; - name = ss.str(); - } - - return name; -} - - -void -LoadPluginWindow::add_clicked() -{ - Gtk::TreeModel::iterator iter = _selection->get_selected(); - bool polyphonic = _polyphonic_checkbutton->get_active(); - - if (iter) { // If anything is selected - Gtk::TreeModel::Row row = *iter; - SharedPtr plugin = row.get_value(_plugins_columns._col_plugin_model); - string name = _node_name_entry->get_text(); - if (name == "") { - name = generate_module_name(); - } - if (name == "") { - Gtk::MessageDialog dialog(*this, - "Unable to chose a default name for this node. Please enter a name.", - false, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true); - - dialog.run(); - } else { - Path path = _patch->path().base() + Path::nameify(name); - App::instance().engine()->new_node(path, plugin->uri()); - App::instance().engine()->set_property(path, "ingen:polyphonic", polyphonic); - for (GraphObject::Variables::const_iterator i = _initial_data.begin(); i != _initial_data.end(); ++i) - App::instance().engine()->set_variable(path, i->first, i->second); - _node_name_entry->set_text(generate_module_name(++_plugin_name_offset)); - - // Cascade - Atom& x = _initial_data["ingenuity:canvas-x"]; - x = Atom(x.get_float() + 20.0f); - Atom& y = _initial_data["ingenuity:canvas-y"]; - y = Atom(y.get_float() + 20.0f); - } - } -} - - -/* -void -LoadPluginWindow::close_clicked() -{ - hide(); -} - - -void -LoadPluginWindow::ok_clicked() -{ - add_clicked(); - close_clicked(); -} -*/ - -void -LoadPluginWindow::filter_changed() -{ - _plugins_liststore->clear(); - - string search = _search_entry->get_text(); - transform(search.begin(), search.end(), search.begin(), ::toupper); - - // Get selected criteria - const Gtk::TreeModel::Row row = *(_filter_combo->get_active()); - CriteriaColumns::Criteria criteria = row[_criteria_columns._col_criteria]; - - string field; - - Gtk::TreeModel::Row model_row; - Gtk::TreeModel::iterator model_iter; - size_t num_visible = 0; - - - for (ClientStore::Plugins::const_iterator i = App::instance().store()->plugins()->begin(); - i != App::instance().store()->plugins()->end(); ++i) { - - const SharedPtr plugin = (*i).second; - - switch (criteria) { - case CriteriaColumns::NAME: - field = plugin->name(); break; - case CriteriaColumns::TYPE: - field = plugin->type_uri(); break; - case CriteriaColumns::URI: - field = plugin->uri(); break; - /*case CriteriaColumns::LIBRARY: - field = plugin->lib_name(); break; - case CriteriaColumns::LABEL: - field = plugin->plug_label(); break;*/ - default: - throw; - } - - transform(field.begin(), field.end(), field.begin(), ::toupper); - - if (field.find(search) != string::npos) { - model_iter = _plugins_liststore->append(); - model_row = *model_iter; - - model_row[_plugins_columns._col_name] = plugin->name(); - //model_row[_plugins_columns._col_label] = plugin->plug_label(); - model_row[_plugins_columns._col_type] = plugin->type_uri(); - model_row[_plugins_columns._col_uri] = plugin->uri(); - model_row[_plugins_columns._col_plugin_model] = plugin; - - ++num_visible; - } - } - - if (num_visible == 1) { - _selection->unselect_all(); - _selection->select(model_iter); - } -} - - -void -LoadPluginWindow::clear_clicked() -{ - _search_entry->set_text(""); - set_plugins(App::instance().store()->plugins()); -} - - -bool -LoadPluginWindow::on_key_press_event(GdkEventKey* event) -{ - if (event->keyval == GDK_w && event->state & GDK_CONTROL_MASK) { - hide(); - return true; - } else { - return Gtk::Window::on_key_press_event(event); - } -} - - -} // namespace GUI -} // namespace Ingen diff --git a/src/libs/gui/LoadPluginWindow.hpp b/src/libs/gui/LoadPluginWindow.hpp deleted file mode 100644 index 98644dde..00000000 --- a/src/libs/gui/LoadPluginWindow.hpp +++ /dev/null @@ -1,155 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef LOADPLUGINWINDOW_H -#define LOADPLUGINWINDOW_H - -#include -#include -#include -#include -#include -#include "interface/GraphObject.hpp" -#include "client/PatchModel.hpp" -#include "client/PluginModel.hpp" -#include "client/ClientStore.hpp" -using Ingen::Client::PluginModel; -using Ingen::Client::PatchModel; -using namespace Ingen::Shared; - -namespace Ingen { -namespace GUI { - - -// Gtkmm _really_ needs to add some helper to abstract away this stupid nonsense - -/** Columns for the plugin list in the load plugin window. - * - * \ingroup GUI - */ -class ModelColumns : public Gtk::TreeModel::ColumnRecord -{ -public: - ModelColumns() { - add(_col_icon); - add(_col_name); - add(_col_type); - add(_col_uri); - add(_col_label); - //add(_col_library); - //add(_col_label); - add(_col_plugin_model); - } - - Gtk::TreeModelColumn > _col_icon; - Gtk::TreeModelColumn _col_name; - Gtk::TreeModelColumn _col_type; - Gtk::TreeModelColumn _col_uri; - - // Not displayed: - Gtk::TreeModelColumn _col_label; - Gtk::TreeModelColumn > _col_plugin_model; -}; - - -/** Column for the criteria combo box in the load plugin window. - * - * \ingroup GUI - */ -class CriteriaColumns : public Gtk::TreeModel::ColumnRecord -{ -public: - enum Criteria { NAME, TYPE, URI, }; - - CriteriaColumns() { add(_col_label); add(_col_criteria); } - - Gtk::TreeModelColumn _col_label; - Gtk::TreeModelColumn _col_criteria; -}; - - -/** 'Load Plugin' window. - * - * Loaded by glade as a derived object. - * - * \ingroup GUI - */ -class LoadPluginWindow : public Gtk::Window -{ -public: - LoadPluginWindow(BaseObjectType* cobject, const Glib::RefPtr& xml); - - void set_patch(SharedPtr patch); - void set_plugins(SharedPtr plugins); - - void add_plugin(SharedPtr plugin); - - void present(SharedPtr patch, GraphObject::Variables data); - -protected: - void on_show(); - bool on_key_press_event(GdkEventKey* event); - -private: - void add_clicked(); - //void close_clicked(); - //void ok_clicked(); - void filter_changed(); - void clear_clicked(); - void name_changed(); - - void new_plugin(SharedPtr plugin); - - int plugin_compare(const Gtk::TreeModel::iterator& a, - const Gtk::TreeModel::iterator& b); - - void plugin_activated(const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* col); - void plugin_selection_changed(); - string generate_module_name(int offset = 0); - - GraphObject::Variables _initial_data; - - SharedPtr _patch; - - Glib::RefPtr _plugins_liststore; - ModelColumns _plugins_columns; - - Glib::RefPtr _criteria_liststore; - CriteriaColumns _criteria_columns; - - Glib::RefPtr _selection; - - int _plugin_name_offset; // see comments for generate_plugin_name - - bool _has_shown; - bool _refresh_list; - Gtk::TreeView* _plugins_treeview; - Gtk::CheckButton* _polyphonic_checkbutton; - Gtk::Entry* _node_name_entry; - Gtk::Button* _clear_button; - Gtk::Button* _add_button; - //Gtk::Button* _close_button; - //Gtk::Button* _ok_button; - Gtk::ComboBox* _filter_combo; - Gtk::Entry* _search_entry; -}; - - -} // namespace GUI -} // namespace Ingen - -#endif // LOADPLUGINWINDOW_H diff --git a/src/libs/gui/LoadRemotePatchWindow.cpp b/src/libs/gui/LoadRemotePatchWindow.cpp deleted file mode 100644 index 5567d67b..00000000 --- a/src/libs/gui/LoadRemotePatchWindow.cpp +++ /dev/null @@ -1,164 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include -#include -#include -#include "client/PatchModel.hpp" -#include "interface/EngineInterface.hpp" -#include "module/World.hpp" -#include "module/global.hpp" -#include "App.hpp" -#include "Configuration.hpp" -#include "LoadRemotePatchWindow.hpp" -#include "ThreadedLoader.hpp" - -using boost::optional; -using namespace Raul; -using namespace std; - -namespace Ingen { -namespace GUI { - - -LoadRemotePatchWindow::LoadRemotePatchWindow(BaseObjectType* cobject, const Glib::RefPtr& xml) -: Gtk::Dialog(cobject), - _replace(true) -{ - xml->get_widget("load_remote_patch_treeview", _treeview); - xml->get_widget("load_remote_patch_uri_entry", _uri_entry); - xml->get_widget("load_remote_patch_cancel_button", _cancel_button); - xml->get_widget("load_remote_patch_open_button", _open_button); - - _liststore = Gtk::ListStore::create(_columns); - _treeview->set_model(_liststore); - _treeview->append_column("Name", _columns._col_name); - _treeview->append_column("URI", _columns._col_uri); - - _selection = _treeview->get_selection(); - _selection->signal_changed().connect(sigc::mem_fun(this, &LoadRemotePatchWindow::patch_selected)); - _treeview->signal_row_activated().connect(sigc::mem_fun(this, &LoadRemotePatchWindow::patch_activated)); - - _open_button->signal_clicked().connect(sigc::mem_fun(this, &LoadRemotePatchWindow::open_clicked)); - _cancel_button->signal_clicked().connect(sigc::mem_fun(this, &LoadRemotePatchWindow::cancel_clicked)); - _uri_entry->signal_changed().connect(sigc::mem_fun(this, &LoadRemotePatchWindow::uri_changed)); -} - - -void -LoadRemotePatchWindow::present(SharedPtr patch, GraphObject::Variables data) -{ - _liststore->clear(); - - set_patch(patch); - _initial_data = data; - - Redland::Model model(*App::instance().world()->rdf_world, - "http://rdf.drobilla.net/ingen_patches/index.ttl", - "http://rdf.drobilla.net/ingen_patches/"); - - Redland::Query query(*App::instance().world()->rdf_world, Glib::ustring( - "SELECT DISTINCT ?name ?uri WHERE {" - " ?uri a ingen:Patch ;" - " doap:name ?name ." - "}")); - - Redland::Query::Results results = query.run(*App::instance().world()->rdf_world, model); - - for (Redland::Query::Results::iterator i = results.begin(); i != results.end(); ++i) { - Gtk::TreeModel::iterator iter = _liststore->append(); - (*iter)[_columns._col_name] = (*i)["name"].to_string(); - (*iter)[_columns._col_uri] = (*i)["uri"].to_string(); - } - - _treeview->columns_autosize(); - - Gtk::Window::present(); -} - - -/** Sets the patch controller for this window and initializes everything. - * - * This function MUST be called before using the window in any way! - */ -void -LoadRemotePatchWindow::set_patch(SharedPtr patch) -{ - _patch = patch; -} - - -void -LoadRemotePatchWindow::uri_changed() -{ - _open_button->property_sensitive() = (_uri_entry->get_text().length() > 0); -} - - -void -LoadRemotePatchWindow::patch_activated(const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* col) -{ - open_clicked(); -} - - -void -LoadRemotePatchWindow::patch_selected() -{ - Gtk::TreeModel::iterator selected_i = _selection->get_selected(); - - if (selected_i) { // If anything is selected - const Glib::ustring uri = selected_i->get_value(_columns._col_uri); - _uri_entry->set_text(uri); - } -} - - -void -LoadRemotePatchWindow::open_clicked() -{ - Glib::ustring uri = _uri_entry->get_text(); - - cerr << "OPEN URI: " << uri << endl; - - // If unset load_patch will load values - optional parent; - optional symbol; - - if (_replace) - App::instance().engine()->clear_patch(_patch->path()); - - if (_patch->path() != "/") - parent = _patch->path().parent(); - - App::instance().loader()->load_patch(true, uri, "/", - _initial_data, parent, symbol); - - hide(); -} - - -void -LoadRemotePatchWindow::cancel_clicked() -{ - hide(); -} - - -} // namespace GUI -} // namespace Ingen diff --git a/src/libs/gui/LoadRemotePatchWindow.hpp b/src/libs/gui/LoadRemotePatchWindow.hpp deleted file mode 100644 index ca0ca814..00000000 --- a/src/libs/gui/LoadRemotePatchWindow.hpp +++ /dev/null @@ -1,94 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef LOADREMOTEPATCHWINDOW_H -#define LOADREMOTEPATCHWINDOW_H - -#include -#include -#include -#include "interface/GraphObject.hpp" -#include "client/PatchModel.hpp" -#include "client/PluginModel.hpp" -using namespace Ingen::Shared; -using Ingen::Client::PatchModel; - -namespace Ingen { -namespace GUI { - - -/** Columns for the remote patch list. - * - * \ingroup GUI - */ -class PatchColumns : public Gtk::TreeModel::ColumnRecord -{ -public: - PatchColumns() { - add(_col_name); - add(_col_uri); - } - - Gtk::TreeModelColumn _col_name; - Gtk::TreeModelColumn _col_uri; -}; - - - -/* Load remote patch ("import location") dialog. - * - * \ingroup GUI - */ -class LoadRemotePatchWindow : public Gtk::Dialog -{ -public: - LoadRemotePatchWindow(BaseObjectType* cobject, const Glib::RefPtr& xml); - - void set_patch(SharedPtr patch); - - void set_replace() { _replace = true; } - void set_merge() { _replace = false; } - - void present(SharedPtr patch, GraphObject::Variables data); - -private: - void patch_activated(const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* col); - void patch_selected(); - void uri_changed(); - void open_clicked(); - void cancel_clicked(); - - GraphObject::Variables _initial_data; - - SharedPtr _patch; - bool _replace; - - Glib::RefPtr _selection; - Glib::RefPtr _liststore; - PatchColumns _columns; - - Gtk::TreeView* _treeview; - Gtk::Entry* _uri_entry; - Gtk::Button* _open_button; - Gtk::Button* _cancel_button; -}; - - -} // namespace GUI -} // namespace Ingen - -#endif // LOADREMOTEPATCHWINDOW_H diff --git a/src/libs/gui/LoadSubpatchWindow.cpp b/src/libs/gui/LoadSubpatchWindow.cpp deleted file mode 100644 index 71dbfb36..00000000 --- a/src/libs/gui/LoadSubpatchWindow.cpp +++ /dev/null @@ -1,187 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include -#include -#include -#include "interface/EngineInterface.hpp" -#include "client/NodeModel.hpp" -#include "client/PatchModel.hpp" -#include "App.hpp" -#include "LoadSubpatchWindow.hpp" -#include "PatchView.hpp" -#include "Configuration.hpp" -#include "ThreadedLoader.hpp" -using boost::optional; -using namespace std; - -namespace Ingen { -namespace GUI { - - -LoadSubpatchWindow::LoadSubpatchWindow(BaseObjectType* cobject, const Glib::RefPtr& xml) -: Gtk::FileChooserDialog(cobject) -{ - xml->get_widget("load_subpatch_name_from_file_radio", _name_from_file_radio); - xml->get_widget("load_subpatch_name_from_user_radio", _name_from_user_radio); - xml->get_widget("load_subpatch_name_entry", _name_entry); - xml->get_widget("load_subpatch_poly_from_file_radio", _poly_from_file_radio); - xml->get_widget("load_subpatch_poly_from_parent_radio", _poly_from_parent_radio); - xml->get_widget("load_subpatch_poly_from_user_radio", _poly_from_user_radio); - xml->get_widget("load_subpatch_poly_spinbutton", _poly_spinbutton); - xml->get_widget("load_subpatch_ok_button", _ok_button); - xml->get_widget("load_subpatch_cancel_button", _cancel_button); - - _name_from_file_radio->signal_toggled().connect(sigc::mem_fun(this, &LoadSubpatchWindow::disable_name_entry)); - _name_from_user_radio->signal_toggled().connect(sigc::mem_fun(this, &LoadSubpatchWindow::enable_name_entry)); - _poly_from_file_radio->signal_toggled().connect(sigc::mem_fun(this, &LoadSubpatchWindow::disable_poly_spinner)); - _poly_from_parent_radio->signal_toggled().connect(sigc::mem_fun(this, &LoadSubpatchWindow::disable_poly_spinner)); - _poly_from_user_radio->signal_toggled().connect(sigc::mem_fun(this, &LoadSubpatchWindow::enable_poly_spinner)); - _ok_button->signal_clicked().connect(sigc::mem_fun(this, &LoadSubpatchWindow::ok_clicked)); - _cancel_button->signal_clicked().connect(sigc::mem_fun(this, &LoadSubpatchWindow::cancel_clicked)); - - Gtk::FileFilter filt; - filt.add_pattern("*.om"); - filt.set_name("Om patch files (XML, DEPRECATED) (*.om)"); - filt.add_pattern("*.ingen.ttl"); - filt.set_name("Ingen patch files (RDF, *.ingen.ttl)"); - set_filter(filt); - - property_select_multiple() = true; - - // Add global examples directory to "shortcut folders" (bookmarks) - string examples_dir = INGEN_DATA_DIR; - examples_dir.append("/patches"); - DIR* d = opendir(examples_dir.c_str()); - if (d != NULL) - add_shortcut_folder(examples_dir); -} - - -void -LoadSubpatchWindow::present(SharedPtr patch, GraphObject::Variables data) -{ - set_patch(patch); - _initial_data = data; - Gtk::Window::present(); -} - - -/** Sets the patch controller for this window and initializes everything. - * - * This function MUST be called before using the window in any way! - */ -void -LoadSubpatchWindow::set_patch(SharedPtr patch) -{ - _patch = patch; - - char temp_buf[4]; - snprintf(temp_buf, 4, "%u", patch->poly()); - Glib::ustring txt = "Same as parent ("; - txt.append(temp_buf).append(")"); - _poly_from_parent_radio->set_label(txt); -} - - -void -LoadSubpatchWindow::on_show() -{ - if (App::instance().configuration()->patch_folder().length() > 0) - set_current_folder(App::instance().configuration()->patch_folder()); - Gtk::FileChooserDialog::on_show(); -} - - -///// Event Handlers ////// - - - -void -LoadSubpatchWindow::disable_name_entry() -{ - _name_entry->property_sensitive() = false; -} - - -void -LoadSubpatchWindow::enable_name_entry() -{ - _name_entry->property_sensitive() = true; -} - - -void -LoadSubpatchWindow::disable_poly_spinner() -{ - _poly_spinbutton->property_sensitive() = false; -} - - -void -LoadSubpatchWindow::enable_poly_spinner() -{ - _poly_spinbutton->property_sensitive() = true; -} - - -void -LoadSubpatchWindow::ok_clicked() -{ - assert(_patch); - - // If unset load_patch will load values - optional symbol; - string name_str = ""; - - if (_name_from_user_radio->get_active()) { - name_str = _name_entry->get_text(); - symbol = Symbol::symbolify(name_str); - } - - if (_poly_from_user_radio->get_active()) { - cerr << "Overriding poly: " << _poly_spinbutton->get_value_as_int() << endl; - _initial_data.insert(make_pair("ingen:polyphony", (int)_poly_spinbutton->get_value_as_int())); - } else if (_poly_from_parent_radio->get_active()) { - _initial_data.insert(make_pair("ingen:polyphony", (int)_patch->poly())); - } - - std::list uris = get_uris(); - for (std::list::iterator i = uris.begin(); i != uris.end(); ++i) { - // Cascade - Atom& x = _initial_data["ingenuity:canvas-x"]; - x = Atom(x.get_float() + 20.0f); - Atom& y = _initial_data["ingenuity:canvas-y"]; - y = Atom(y.get_float() + 20.0f); - - App::instance().loader()->load_patch(false, *i, "/", _initial_data, _patch->path(), symbol); - } - - hide(); -} - - -void -LoadSubpatchWindow::cancel_clicked() -{ - hide(); -} - - -} // namespace GUI -} // namespace Ingen diff --git a/src/libs/gui/LoadSubpatchWindow.hpp b/src/libs/gui/LoadSubpatchWindow.hpp deleted file mode 100644 index ee8a5a16..00000000 --- a/src/libs/gui/LoadSubpatchWindow.hpp +++ /dev/null @@ -1,80 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef LOADSUBPATCHWINDOW_H -#define LOADSUBPATCHWINDOW_H - -#include -#include -#include -#include "client/PatchModel.hpp" -#include "client/PluginModel.hpp" -#include "interface/GraphObject.hpp" -using namespace Ingen::Shared; -using Ingen::Client::PatchModel; - -namespace Ingen { -namespace GUI { - - -/** 'Add Subpatch' window. - * - * Loaded by glade as a derived object. - * - * \ingroup GUI - */ -class LoadSubpatchWindow : public Gtk::FileChooserDialog -{ -public: - LoadSubpatchWindow(BaseObjectType* cobject, const Glib::RefPtr& xml); - - void set_patch(SharedPtr patch); - - void present(SharedPtr patch, GraphObject::Variables data); - -protected: - void on_show(); - -private: - void disable_name_entry(); - void enable_name_entry(); - void disable_poly_spinner(); - void enable_poly_spinner(); - - void ok_clicked(); - void cancel_clicked(); - - GraphObject::Variables _initial_data; - - SharedPtr _patch; - - Gtk::RadioButton* _name_from_file_radio; - Gtk::RadioButton* _name_from_user_radio; - Gtk::Entry* _name_entry; - Gtk::RadioButton* _poly_from_file_radio; - Gtk::RadioButton* _poly_from_parent_radio; - Gtk::RadioButton* _poly_from_user_radio; - Gtk::SpinButton* _poly_spinbutton; - Gtk::Button* _ok_button; - Gtk::Button* _cancel_button; -}; - - -} // namespace GUI -} // namespace Ingen - -#endif // LOADSUBPATCHWINDOW_H diff --git a/src/libs/gui/Makefile.am b/src/libs/gui/Makefile.am deleted file mode 100644 index 41458812..00000000 --- a/src/libs/gui/Makefile.am +++ /dev/null @@ -1,125 +0,0 @@ -MAINTAINERCLEANFILES = Makefile.in -EXTRA_DIST = ingen_gui.gladep - -if BUILD_GTK_CLIENT - -globalpixmapsdir = $(datadir)/pixmaps -dist_globalpixmaps_DATA = ingen.svg ingen-icon.svg - -sharefilesdir = $(pkgdatadir) -dist_sharefiles_DATA = ingen_gui.glade ingen.svg ingen-icon.svg - -moduledir = $(libdir)/ingen - -module_LTLIBRARIES = libingen_gui.la - -libingen_gui_la_CXXFLAGS = \ - -DINGEN_MODULE_DIR=\"$(libdir)/ingen\" \ - -DINGEN_DATA_DIR=\"$(pkgdatadir)\" \ - @CURL_CFLAGS@ \ - @FLOWCANVAS_CFLAGS@ \ - @GNOMECANVASMM_CFLAGS@ \ - @GTKMM_CFLAGS@ \ - @INGEN_CFLAGS@ \ - @LIBGLADEMM_CFLAGS@ \ - @LIBLO_CFLAGS@ \ - @REDLANDMM_CFLAGS@ \ - @RAUL_CFLAGS@ \ - @SLV2_CFLAGS@ \ - @SOUP_CFLAGS@ - - -libingen_gui_la_LDFLAGS = -no-undefined -module -avoid-version - -libingen_gui_la_LIBADD = \ - ../module/libingen_module.la \ - ../shared/libingen_shared.la \ - ../client/libingen_client.la \ - @CURL_LIBS@ \ - @FLOWCANVAS_LIBS@ \ - @GNOMECANVASMM_LIBS@ \ - @GTKMM_LIBS@ \ - @LIBGLADEMM_LIBS@ \ - @LIBLO_LIBS@ \ - @REDLANDMM_LIBS@ \ - @RAUL_LIBS@ \ - @SLV2_LIBS@ \ - @SOUP_LIBS@ - -libingen_gui_la_SOURCES = \ - gui.hpp \ - gui.cpp \ - App.cpp \ - App.hpp \ - BreadCrumb.hpp \ - BreadCrumbBox.cpp \ - BreadCrumbBox.hpp \ - Configuration.cpp \ - Configuration.hpp \ - ConnectWindow.cpp \ - ConnectWindow.hpp \ - Connection.hpp \ - ControlPanel.cpp \ - ControlPanel.hpp \ - Controls.cpp \ - Controls.hpp \ - GladeFactory.cpp \ - GladeFactory.hpp \ - LoadPatchWindow.cpp \ - LoadPatchWindow.hpp \ - LoadPluginWindow.cpp \ - LoadPluginWindow.hpp \ - LoadRemotePatchWindow.cpp \ - LoadRemotePatchWindow.hpp \ - LoadSubpatchWindow.cpp \ - LoadSubpatchWindow.hpp \ - MessagesWindow.cpp \ - MessagesWindow.hpp \ - NewSubpatchWindow.cpp \ - NewSubpatchWindow.hpp \ - NodeControlWindow.cpp \ - NodeControlWindow.hpp \ - ObjectMenu.hpp \ - ObjectMenu.cpp \ - NodeMenu.hpp \ - NodeMenu.cpp \ - PortMenu.hpp \ - PortMenu.cpp \ - NodeModule.cpp \ - NodeModule.hpp \ - NodePropertiesWindow.cpp \ - NodePropertiesWindow.hpp \ - PatchCanvas.cpp \ - PatchCanvas.hpp \ - PatchPortModule.cpp \ - PatchPortModule.hpp \ - PatchPropertiesWindow.cpp \ - PatchPropertiesWindow.hpp \ - PatchTreeWindow.cpp \ - PatchTreeWindow.hpp \ - PatchView.cpp \ - PatchView.hpp \ - PatchWindow.cpp \ - PatchWindow.hpp \ - Port.cpp \ - Port.hpp \ - PortPropertiesWindow.cpp \ - PortPropertiesWindow.hpp \ - RenameWindow.cpp \ - RenameWindow.hpp \ - SubpatchModule.cpp \ - SubpatchModule.hpp \ - ThreadedLoader.cpp \ - ThreadedLoader.hpp \ - WindowFactory.cpp \ - WindowFactory.hpp - -if WITH_CURL -libingen_gui_la_SOURCES += \ - UploadPatchWindow.cpp \ - UploadPatchWindow.hpp -endif - -endif - - diff --git a/src/libs/gui/MessagesWindow.cpp b/src/libs/gui/MessagesWindow.cpp deleted file mode 100644 index 3da810f6..00000000 --- a/src/libs/gui/MessagesWindow.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "MessagesWindow.hpp" -#include - -namespace Ingen { -namespace GUI { -using std::string; - - -MessagesWindow::MessagesWindow(BaseObjectType* cobject, const Glib::RefPtr& glade_xml) -: Gtk::Window(cobject) -{ - glade_xml->get_widget("messages_textview", _textview); - glade_xml->get_widget("messages_clear_button", _clear_button); - glade_xml->get_widget("messages_close_button", _close_button); - - _clear_button->signal_clicked().connect(sigc::mem_fun(this, &MessagesWindow::clear_clicked)); - _close_button->signal_clicked().connect(sigc::mem_fun(this, &MessagesWindow::close_clicked)); -} - - -void -MessagesWindow::post(const string& msg) -{ - Glib::RefPtr text_buf = _textview->get_buffer(); - text_buf->insert(text_buf->end(), msg); - text_buf->insert(text_buf->end(), "\n"); - - if (!_clear_button->is_sensitive()) - _clear_button->set_sensitive(true); -} - - -void -MessagesWindow::close_clicked() -{ - hide(); -} - - -void -MessagesWindow::clear_clicked() -{ - Glib::RefPtr text_buf = _textview->get_buffer(); - text_buf->erase(text_buf->begin(), text_buf->end()); - _clear_button->set_sensitive(false); -} - - -} // namespace GUI -} // namespace Ingen diff --git a/src/libs/gui/MessagesWindow.hpp b/src/libs/gui/MessagesWindow.hpp deleted file mode 100644 index dea0fdd4..00000000 --- a/src/libs/gui/MessagesWindow.hpp +++ /dev/null @@ -1,58 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef MESSAGESWINDOW_H -#define MESSAGESWINDOW_H - -#include -#include -#include -using std::string; - - -namespace Ingen { -namespace GUI { - - -/** Messages Window. - * - * Loaded by libglade as a derived object. - * This is shown when errors occur (ie during patch loading). - * - * \ingroup GUI - */ -class MessagesWindow : public Gtk::Window -{ -public: - MessagesWindow(BaseObjectType* cobject, const Glib::RefPtr& refGlade); - - void post(const string& str); - -private: - void clear_clicked(); - void close_clicked(); - - Gtk::TextView* _textview; - Gtk::Button* _clear_button; - Gtk::Button* _close_button; -}; - - -} // namespace GUI -} // namespace Ingen - -#endif // MESSAGESWINDOW_H diff --git a/src/libs/gui/NewSubpatchWindow.cpp b/src/libs/gui/NewSubpatchWindow.cpp deleted file mode 100644 index 580ebb51..00000000 --- a/src/libs/gui/NewSubpatchWindow.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "App.hpp" -#include "interface/EngineInterface.hpp" -#include "client/NodeModel.hpp" -#include "client/PatchModel.hpp" -#include "client/ClientStore.hpp" -#include "NewSubpatchWindow.hpp" -#include "PatchView.hpp" - -namespace Ingen { -namespace GUI { - - -NewSubpatchWindow::NewSubpatchWindow(BaseObjectType* cobject, const Glib::RefPtr& xml) -: Gtk::Window(cobject) -{ - xml->get_widget("new_subpatch_name_entry", _name_entry); - xml->get_widget("new_subpatch_message_label", _message_label); - xml->get_widget("new_subpatch_polyphony_spinbutton", _poly_spinbutton); - xml->get_widget("new_subpatch_ok_button", _ok_button); - xml->get_widget("new_subpatch_cancel_button", _cancel_button); - - _name_entry->signal_changed().connect(sigc::mem_fun(this, &NewSubpatchWindow::name_changed)); - _ok_button->signal_clicked().connect(sigc::mem_fun(this, &NewSubpatchWindow::ok_clicked)); - _cancel_button->signal_clicked().connect(sigc::mem_fun(this, &NewSubpatchWindow::cancel_clicked)); - - _ok_button->property_sensitive() = false; -} - -void -NewSubpatchWindow::present(SharedPtr patch, GraphObject::Variables data) -{ - set_patch(patch); - _initial_data = data; - Gtk::Window::present(); -} - -/** Sets the patch controller for this window and initializes everything. - * - * This function MUST be called before using the window in any way! - */ -void -NewSubpatchWindow::set_patch(SharedPtr patch) -{ - _patch = patch; -} - - -/** Called every time the user types into the name input box. - * Used to display warning messages, and enable/disable the OK button. - */ -void -NewSubpatchWindow::name_changed() -{ - string name = _name_entry->get_text(); - if (!Path::is_valid_name(name)) { - _message_label->set_text("Name contains invalid characters."); - _ok_button->property_sensitive() = false; - } else if (App::instance().store()->find(_patch->path().base() + name) - != App::instance().store()->end()) { - _message_label->set_text("An object already exists with that name."); - _ok_button->property_sensitive() = false; - } else if (name.length() == 0) { - _message_label->set_text(""); - _ok_button->property_sensitive() = false; - } else { - _message_label->set_text(""); - _ok_button->property_sensitive() = true; - } -} - - -void -NewSubpatchWindow::ok_clicked() -{ - const Path path = _patch->path().base() + Path::nameify(_name_entry->get_text()); - const uint32_t poly = _poly_spinbutton->get_value_as_int(); - - App::instance().engine()->new_patch(path, poly); - for (GraphObject::Variables::const_iterator i = _initial_data.begin(); i != _initial_data.end(); ++i) - App::instance().engine()->set_variable(path, i->first, i->second); - - App::instance().engine()->set_property(_patch->path(), "ingen:enabled", (bool)true); - - hide(); -} - - -void -NewSubpatchWindow::cancel_clicked() -{ - hide(); -} - - -} // namespace GUI -} // namespace Ingen diff --git a/src/libs/gui/NewSubpatchWindow.hpp b/src/libs/gui/NewSubpatchWindow.hpp deleted file mode 100644 index 00fb6a3b..00000000 --- a/src/libs/gui/NewSubpatchWindow.hpp +++ /dev/null @@ -1,68 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef NEWSUBPATCHWINDOW_H -#define NEWSUBPATCHWINDOW_H - -#include -#include -#include -#include "interface/GraphObject.hpp" -#include "client/PatchModel.hpp" -#include "client/PluginModel.hpp" -using namespace Ingen::Shared; -using Ingen::Client::PatchModel; - -namespace Ingen { -namespace GUI { - - -/** 'New Subpatch' window. - * - * Loaded by glade as a derived object. - * - * \ingroup GUI - */ -class NewSubpatchWindow : public Gtk::Window -{ -public: - NewSubpatchWindow(BaseObjectType* cobject, const Glib::RefPtr& xml); - - void set_patch(SharedPtr patch); - - void present(SharedPtr patch, GraphObject::Variables data); - -private: - void name_changed(); - void ok_clicked(); - void cancel_clicked(); - - GraphObject::Variables _initial_data; - SharedPtr _patch; - - Gtk::Entry* _name_entry; - Gtk::Label* _message_label; - Gtk::SpinButton* _poly_spinbutton; - Gtk::Button* _ok_button; - Gtk::Button* _cancel_button; -}; - - -} // namespace GUI -} // namespace Ingen - -#endif // NEWSUBPATCHWINDOW_H diff --git a/src/libs/gui/NodeControlWindow.cpp b/src/libs/gui/NodeControlWindow.cpp deleted file mode 100644 index 293d28f5..00000000 --- a/src/libs/gui/NodeControlWindow.cpp +++ /dev/null @@ -1,139 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License alongCont - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include -#include "interface/EngineInterface.hpp" -#include "client/NodeModel.hpp" -#include "App.hpp" -#include "NodeControlWindow.hpp" -#include "GladeFactory.hpp" -#include "Controls.hpp" -#include "ControlPanel.hpp" -#include "PatchWindow.hpp" - -using namespace std; - -namespace Ingen { -namespace GUI { - - -/** Create a node control window and load a new ControlPanel for it. - */ -NodeControlWindow::NodeControlWindow(SharedPtr node, uint32_t poly) - : _node(node) - , _position_stored(false) - , _x(0) - , _y(0) -{ - assert(_node != NULL); - - property_resizable() = true; - set_border_width(5); - - set_title(_node->path() + " Controls"); - - Glib::RefPtr xml = GladeFactory::new_glade_reference("warehouse_win"); - xml->get_widget_derived("control_panel_vbox", _control_panel); - - show_all_children(); - - _control_panel->reparent(*this); - _control_panel->init(_node, poly); - _control_panel->show(); - - resize(); - - _callback_enabled = true; -} - - -/** Create a node control window and with an existing ControlPanel. - */ -NodeControlWindow::NodeControlWindow(SharedPtr node, ControlPanel* panel) - : _node(node) - , _control_panel(panel) -{ - assert(_node); - - property_resizable() = true; - set_border_width(5); - - set_title(_node->path() + " Controls"); - - _control_panel->reparent(*this); - - show_all_children(); - resize(); - - _callback_enabled = true; -} - - -NodeControlWindow::~NodeControlWindow() -{ - delete _control_panel; -} - - -void -NodeControlWindow::resize() -{ - pair controls_size = _control_panel->ideal_size(); - /*int width = 400; - int height = controls_size.second - + ((_node->polyphonic()) ? 4 : 40);*/ - int width = controls_size.first; - int height = controls_size.second; - - if (height > property_screen().get_value()->get_height() - 64) - height = property_screen().get_value()->get_height() - 64; - if (width > property_screen().get_value()->get_width() - 64) - width = property_screen().get_value()->get_width() - 64; - - //cerr << "Resizing to: " << width << " x " << height << endl; - - Gtk::Window::resize(width, height); -} - - -void -NodeControlWindow::on_show() -{ - for (NodeModel::Ports::const_iterator i = _node->ports().begin(); - i != _node->ports().end(); ++i) - if ((*i)->type().is_control() && (*i)->is_input()) - App::instance().engine()->request_port_value((*i)->path()); - - if (_position_stored) - move(_x, _y); - - Gtk::Window::on_show(); -} - - -void -NodeControlWindow::on_hide() -{ - _position_stored = true; - get_position(_x, _y); - Gtk::Window::on_hide(); -} - - -} // namespace GUI -} // namespace Ingen diff --git a/src/libs/gui/NodeControlWindow.hpp b/src/libs/gui/NodeControlWindow.hpp deleted file mode 100644 index 84e462c5..00000000 --- a/src/libs/gui/NodeControlWindow.hpp +++ /dev/null @@ -1,76 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef NODECONTROLWINDOW_H -#define NODECONTROLWINDOW_H - -#include -#include -#include -#include -#include -#include -using std::string; using std::vector; - -namespace Ingen { namespace Client { - class NodeModel; -} } -using Ingen::Client::NodeModel; - -namespace Ingen { -namespace GUI { - -class ControlGroup; -class ControlPanel; - - -/** Window with controls (sliders) for all control-rate ports on a Node. - * - * \ingroup GUI - */ -class NodeControlWindow : public Gtk::Window -{ -public: - NodeControlWindow(SharedPtr node, uint32_t poly); - NodeControlWindow(SharedPtr node, ControlPanel* panel); - virtual ~NodeControlWindow(); - - SharedPtr node() { return _node; } - - ControlPanel* control_panel() const { return _control_panel; } - - void resize(); - -protected: - void on_show(); - void on_hide(); - -private: - SharedPtr _node; - ControlPanel* _control_panel; - bool _callback_enabled; - - bool _position_stored; - int _x; - int _y; -}; - - -} // namespace GUI -} // namespace Ingen - -#endif // NODECONTROLWINDOW_H diff --git a/src/libs/gui/NodeMenu.cpp b/src/libs/gui/NodeMenu.cpp deleted file mode 100644 index 529eb52c..00000000 --- a/src/libs/gui/NodeMenu.cpp +++ /dev/null @@ -1,169 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include -#include "interface/EngineInterface.hpp" -#include "client/NodeModel.hpp" -#include "App.hpp" -#include "NodeMenu.hpp" -#include "WindowFactory.hpp" - -using namespace std; -using std::cerr; using std::endl; - -namespace Ingen { -namespace GUI { - - -NodeMenu::NodeMenu(BaseObjectType* cobject, const Glib::RefPtr& xml) - : ObjectMenu(cobject, xml) - , _controls_menuitem(NULL) -{ - Gtk::Menu* node_menu = NULL; - xml->get_widget("node_menu", node_menu); - xml->get_widget("node_controls_menuitem", _controls_menuitem); - xml->get_widget("node_popup_gui_menuitem", _popup_gui_menuitem); - xml->get_widget("node_embed_gui_menuitem", _embed_gui_menuitem); - - node_menu->remove(*_controls_menuitem); - node_menu->remove(*_popup_gui_menuitem); - node_menu->remove(*_embed_gui_menuitem); - items().push_front(Gtk::Menu_Helpers::SeparatorElem()); - insert(*_controls_menuitem, 0); - insert(*_popup_gui_menuitem, 0); - insert(*_embed_gui_menuitem, 0); -} - - -void -NodeMenu::init(SharedPtr node) -{ - ObjectMenu::init(node); - - _controls_menuitem->signal_activate().connect(sigc::bind( - sigc::mem_fun(App::instance().window_factory(), &WindowFactory::present_controls), - node)); - - _popup_gui_menuitem->signal_activate().connect(sigc::mem_fun(signal_popup_gui, - &sigc::signal::emit)); - _embed_gui_menuitem->signal_toggled().connect(sigc::mem_fun(this, - &NodeMenu::on_menu_embed_gui)); - - const PluginModel* plugin = dynamic_cast(node->plugin()); - if (plugin && plugin->type() == PluginModel::LV2 && plugin->has_ui()) { - _popup_gui_menuitem->show(); - _embed_gui_menuitem->show(); - } else { - _popup_gui_menuitem->hide(); - _embed_gui_menuitem->hide(); - } - - _enable_signal = true; -} - - -void -NodeMenu::on_menu_embed_gui() -{ - signal_embed_gui.emit(_embed_gui_menuitem->get_active()); -} - - -void -NodeMenu::on_menu_clone() -{ - cerr << "[NodeMenu] FIXME: clone broken\n"; - /* - assert(_node); - //assert(_parent != NULL); - //assert(_parent->model() != NULL); - - string clone_name = _node->name(); - int i = 2; // postfix number (ie oldname_2) - - // Check if name already has a number postfix - if (clone_name.find_last_of("_") != string::npos) { - string name_postfix = clone_name.substr(clone_name.find_last_of("_")+1); - clone_name = clone_name.substr(0, clone_name.find_last_of("_")); - if (sscanf(name_postfix.c_str(), "%d", &i)) - ++i; - } - - char clone_postfix[4]; - for ( ; i < 100; ++i) { - snprintf(clone_postfix, 4, "_%d", i); - if (_node->parent_patch()->get_node(clone_name + clone_postfix) == NULL) - break; - } - - clone_name = clone_name + clone_postfix; - - const string path = _node->parent_patch()->base() + clone_name; - NodeModel* nm = new NodeModel(_node->plugin(), path); - nm->polyphonic(_node->polyphonic()); - nm->x(_node->x() + 20); - nm->y(_node->y() + 20); - App::instance().engine()->create_node_from_model(nm); - */ -} - - -void -NodeMenu::on_menu_learn() -{ - App::instance().engine()->midi_learn(_object->path()); -} - - -void -NodeMenu::on_menu_disconnect() -{ - App::instance().engine()->disconnect_all(_object->parent()->path(), _object->path()); -} - - -bool -NodeMenu::has_control_inputs() -{ - const NodeModel* const nm = (NodeModel*)_object.get(); - for (NodeModel::Ports::const_iterator i = nm->ports().begin(); i != nm->ports().end(); ++i) - if ((*i)->is_input() && (*i)->type().is_control()) - return true; - - return false; -} - - -void -NodeMenu::enable_controls_menuitem() -{ - _controls_menuitem->property_sensitive() = true; -} - - -void -NodeMenu::disable_controls_menuitem() -{ - _controls_menuitem->property_sensitive() = false; -} - - - -} // namespace GUI -} // namespace Ingen - diff --git a/src/libs/gui/NodeMenu.hpp b/src/libs/gui/NodeMenu.hpp deleted file mode 100644 index 2a10e473..00000000 --- a/src/libs/gui/NodeMenu.hpp +++ /dev/null @@ -1,72 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef NODEMENU_H -#define NODEMENU_H - -#include -#include -#include -#include -#include "client/NodeModel.hpp" -#include "ObjectMenu.hpp" - -using Ingen::Client::NodeModel; - -namespace Ingen { -namespace GUI { - - -/** Menu for a Node. - * - * \ingroup GUI - */ -class NodeMenu : public ObjectMenu -{ -public: - NodeMenu(BaseObjectType* cobject, const Glib::RefPtr& xml); - - virtual void program_add(int bank, int program, const std::string& name) {} - virtual void program_remove(int bank, int program) {} - - void init(SharedPtr node); - - bool has_control_inputs(); - - sigc::signal signal_popup_gui; - sigc::signal signal_embed_gui; - -protected: - - virtual void enable_controls_menuitem(); - virtual void disable_controls_menuitem(); - - void on_menu_disconnect(); - void on_menu_clone(); - void on_menu_learn(); - void on_menu_embed_gui(); - - Gtk::MenuItem* _controls_menuitem; - Gtk::MenuItem* _popup_gui_menuitem; - Gtk::CheckMenuItem* _embed_gui_menuitem; -}; - - -} // namespace GUI -} // namespace Ingen - -#endif // NODEMENU_H diff --git a/src/libs/gui/NodeModule.cpp b/src/libs/gui/NodeModule.cpp deleted file mode 100644 index 97edaa84..00000000 --- a/src/libs/gui/NodeModule.cpp +++ /dev/null @@ -1,386 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include -#include "interface/EngineInterface.hpp" -#include "client/NodeModel.hpp" -#include "client/PatchModel.hpp" -#include "client/PluginUI.hpp" -#include "App.hpp" -#include "GladeFactory.hpp" -#include "NodeControlWindow.hpp" -#include "NodeModule.hpp" -#include "PatchCanvas.hpp" -#include "PatchWindow.hpp" -#include "Port.hpp" -#include "RenameWindow.hpp" -#include "SubpatchModule.hpp" -#include "WindowFactory.hpp" -#include "Configuration.hpp" - -using namespace std; - -namespace Ingen { -namespace GUI { - - -NodeModule::NodeModule(boost::shared_ptr canvas, SharedPtr node) - : FlowCanvas::Module(canvas, node->path().name()) - , _node(node) - , _gui_widget(NULL) - , _gui_window(NULL) -{ - assert(_node); - - node->signal_new_port.connect(sigc::bind(sigc::mem_fun(this, &NodeModule::add_port), true)); - node->signal_removed_port.connect(sigc::mem_fun(this, &NodeModule::remove_port)); - node->signal_variable.connect(sigc::mem_fun(this, &NodeModule::set_variable)); - node->signal_property.connect(sigc::mem_fun(this, &NodeModule::set_property)); - node->signal_renamed.connect(sigc::mem_fun(this, &NodeModule::rename)); -} - - -NodeModule::~NodeModule() -{ - NodeControlWindow* win = App::instance().window_factory()->control_window(_node); - - if (win) { - // Should remove from window factory via signal - delete win; - } -} - - -void -NodeModule::create_menu() -{ - Glib::RefPtr xml = GladeFactory::new_glade_reference(); - xml->get_widget_derived("object_menu", _menu); - _menu->init(_node); - _menu->signal_embed_gui.connect(sigc::mem_fun(this, &NodeModule::embed_gui)); - _menu->signal_popup_gui.connect(sigc::hide_return(sigc::mem_fun(this, &NodeModule::popup_gui))); - - set_menu(_menu); -} - - -boost::shared_ptr -NodeModule::create(boost::shared_ptr canvas, SharedPtr node, bool human) -{ - boost::shared_ptr ret; - - SharedPtr patch = PtrCast(node); - if (patch) - ret = boost::shared_ptr(new SubpatchModule(canvas, patch)); - else - ret = boost::shared_ptr(new NodeModule(canvas, node)); - - for (GraphObject::Variables::const_iterator m = node->variables().begin(); m != node->variables().end(); ++m) - ret->set_variable(m->first, m->second); - - for (NodeModel::Ports::const_iterator p = node->ports().begin(); p != node->ports().end(); ++p) { - ret->add_port(*p, false); - } - - if (human) - ret->show_human_names(human); - - ret->resize(); - ret->set_stacked_border(node->polyphonic()); - - return ret; -} - - -void -NodeModule::show_human_names(bool b) -{ - if (b && node()->plugin()) - set_name(((PluginModel*)node()->plugin())->human_name()); - else - b = false; - - if (!b) - set_name(node()->symbol()); - - uint32_t index = 0; - for (PortVector::const_iterator i = ports().begin(); i != ports().end(); ++i) { - if (b) { - string hn = ((PluginModel*)node()->plugin())->port_human_name(index); - if (hn != "") - (*i)->set_name(hn); - } else { - (*i)->set_name(node()->port(index)->symbol()); - } - ++index; - } - - resize(); -} - - -void -NodeModule::value_changed(uint32_t index, const Atom& value) -{ - float control = 0.0f; - switch (value.type()) { - case Atom::FLOAT: - control = value.get_float(); - if (_plugin_ui) { - SLV2UIInstance inst = _plugin_ui->instance(); - const LV2UI_Descriptor* ui_descriptor = slv2_ui_instance_get_descriptor(inst); - LV2UI_Handle ui_handle = slv2_ui_instance_get_handle(inst); - if (ui_descriptor->port_event) - ui_descriptor->port_event(ui_handle, index, 4, 0, &control); - } - break; - case Atom::STRING: - cout << "Port value type is a string? (\"" << value.get_string() << "\")" << endl; - break; - default: - break; - } -} - - -void -NodeModule::embed_gui(bool embed) -{ - if (embed) { - - if (_gui_window) { - cerr << "LV2 GUI already popped up, cannot embed" << endl; - return; - } - - if (!_plugin_ui) { - const PluginModel* const pm = dynamic_cast(_node->plugin()); - assert(pm); - _plugin_ui = pm->ui(App::instance().world(), _node); - } - - if (_plugin_ui) { - GtkWidget* c_widget = (GtkWidget*)slv2_ui_instance_get_widget(_plugin_ui->instance()); - _gui_widget = Glib::wrap(c_widget); - assert(_gui_widget); - - Gtk::Container* container = new Gtk::EventBox(); - container->set_name("ingen_embedded_node_gui_container"); - container->add(*_gui_widget); - FlowCanvas::Module::embed(container); - } else { - cerr << "ERROR: Failed to create LV2 UI" << endl; - } - - if (_gui_widget) { - _gui_widget->show_all(); - - for (NodeModel::Ports::const_iterator p = _node->ports().begin(); - p != _node->ports().end(); ++p) - if ((*p)->type().is_control() && (*p)->is_output()) - App::instance().engine()->set_property((*p)->path(), "ingen:broadcast", true); - } - - } else { // un-embed - - FlowCanvas::Module::embed(NULL); - _plugin_ui.reset(); - - for (NodeModel::Ports::const_iterator p = _node->ports().begin(); p != _node->ports().end(); ++p) - if ((*p)->type().is_control() && (*p)->is_output()) - App::instance().engine()->set_property((*p)->path(), "ingen:broadcast", false); - } - - if (embed && _embed_item) { - initialise_gui_values(); - set_base_color(0x212222FF); - } else { - set_default_base_color(); - } - - resize(); -} - - -void -NodeModule::rename() -{ - set_name(_node->path().name()); - resize(); -} - - -void -NodeModule::add_port(SharedPtr port, bool resize_to_fit) -{ - uint32_t index = _ports.size(); // FIXME: kludge, engine needs to tell us this - - string name = port->path().name(); - if (App::instance().configuration()->name_style() == Configuration::HUMAN && node()->plugin()) - name = ((PluginModel*)node()->plugin())->port_human_name(index); - - Module::add_port(boost::shared_ptr( - new Port(PtrCast(shared_from_this()), port, name))); - - port->signal_value_changed.connect(sigc::bind<0>( - sigc::mem_fun(this, &NodeModule::value_changed), index)); - - if (resize_to_fit) - resize(); -} - - -void -NodeModule::remove_port(SharedPtr port) -{ - SharedPtr p = Module::remove_port(port->path().name()); - p.reset(); -} - - -bool -NodeModule::popup_gui() -{ -#ifdef HAVE_SLV2 - if (_node->plugin() && _node->plugin()->type() == PluginModel::LV2) { - if (_plugin_ui) { - cerr << "LV2 GUI already embedded, cannot pop up" << endl; - return false; - } - - const PluginModel* const plugin = dynamic_cast(_node->plugin()); - assert(plugin); - - _plugin_ui = plugin->ui(App::instance().world(), _node); - - if (_plugin_ui) { - GtkWidget* c_widget = (GtkWidget*)slv2_ui_instance_get_widget(_plugin_ui->instance()); - _gui_widget = Glib::wrap(c_widget); - - _gui_window = new Gtk::Window(); - _gui_window->add(*_gui_widget); - _gui_widget->show_all(); - initialise_gui_values(); - - _gui_window->signal_unmap().connect( - sigc::mem_fun(this, &NodeModule::on_gui_window_close)); - _gui_window->present(); - - return true; - } else { - cerr << "No LV2 GUI" << endl; - } - } -#endif - return false; -} - - -void -NodeModule::on_gui_window_close() -{ - delete _gui_window; - _gui_window = NULL; - _plugin_ui.reset(); - _gui_widget = NULL; -} - - -void -NodeModule::initialise_gui_values() -{ - uint32_t index=0; - for (NodeModel::Ports::const_iterator p = _node->ports().begin(); p != _node->ports().end(); ++p) { - if ((*p)->type().is_control()) - value_changed(index, (*p)->value()); - ++index; - } -} - - -void -NodeModule::show_control_window() -{ - App::instance().window_factory()->present_controls(_node); -} - - -void -NodeModule::on_double_click(GdkEventButton* ev) -{ - if ( ! popup_gui() ) - show_control_window(); -} - - -void -NodeModule::store_location() -{ - const float x = static_cast(property_x()); - const float y = static_cast(property_y()); - - const Atom& existing_x = _node->get_variable("ingenuity:canvas-x"); - const Atom& existing_y = _node->get_variable("ingenuity:canvas-y"); - - if (existing_x.type() != Atom::FLOAT || existing_y.type() != Atom::FLOAT - || existing_x.get_float() != x || existing_y.get_float() != y) { - App::instance().engine()->set_variable(_node->path(), "ingenuity:canvas-x", Atom(x)); - App::instance().engine()->set_variable(_node->path(), "ingenuity:canvas-y", Atom(y)); - } -} - - -void -NodeModule::set_variable(const string& key, const Atom& value) -{ - if (key == "ingenuity:canvas-x" && value.type() == Atom::FLOAT) - move_to(value.get_float(), property_y()); - else if (key == "ingenuity:canvas-y" && value.type() == Atom::FLOAT) - move_to(property_x(), value.get_float()); -} - - -void -NodeModule::set_property(const string& key, const Atom& value) -{ - if (key == "ingen:polyphonic" && value.type() == Atom::BOOL) { - set_stacked_border(value.get_bool()); - } else if (key == "ingen:selected" && value.type() == Atom::BOOL) { - if (value.get_bool() != selected()) { - if (value.get_bool()) - _canvas.lock()->select_item(shared_from_this()); - else - _canvas.lock()->unselect_item(shared_from_this()); - } - } -} - - -void -NodeModule::set_selected(bool b) -{ - if (b != selected()) { - Module::set_selected(b); - if (App::instance().signal()) - App::instance().engine()->set_property(_node->path(), "ingen:selected", b); - } -} - - -} // namespace GUI -} // namespace Ingen diff --git a/src/libs/gui/NodeModule.hpp b/src/libs/gui/NodeModule.hpp deleted file mode 100644 index de9556fd..00000000 --- a/src/libs/gui/NodeModule.hpp +++ /dev/null @@ -1,102 +0,0 @@ -/* This file is part of In* Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef NODEMODULE_H -#define NODEMODULE_H - -#include -#include -#include -#include -#include "Port.hpp" -#include "NodeMenu.hpp" - -class Atom; - -namespace Ingen { namespace Client { - class PortModel; - class NodeModel; -} } -using namespace Ingen::Client; - -namespace Ingen { -namespace GUI { - -class PatchCanvas; -class Port; - - -/** A module in a patch. - * - * This base class is extended for various types of modules. - * - * \ingroup GUI - */ -class NodeModule : public FlowCanvas::Module -{ -public: - static boost::shared_ptr create ( - boost::shared_ptr canvas, - SharedPtr node, - bool human_names); - - virtual ~NodeModule(); - - boost::shared_ptr port(const std::string& port_name) { - return boost::dynamic_pointer_cast( - Module::get_port(port_name)); - } - - virtual void store_location(); - void show_human_names(bool b); - - SharedPtr node() const { return _node; } - -protected: - NodeModule(boost::shared_ptr canvas, SharedPtr node); - - void on_double_click(GdkEventButton* ev); - - void show_control_window(); - void embed_gui(bool embed); - bool popup_gui(); - void on_gui_window_close(); - void set_selected(bool b); - - void rename(); - void set_variable(const std::string& key, const Atom& value); - void set_property(const std::string& predicate, const Raul::Atom& value); - - void add_port(SharedPtr port, bool resize=true); - void remove_port(SharedPtr port); - - void value_changed(uint32_t index, const Atom& value); - void initialise_gui_values(); - - void create_menu(); - - SharedPtr _node; - NodeMenu* _menu; - SharedPtr _plugin_ui; - Gtk::Widget* _gui_widget; - Gtk::Window* _gui_window; ///< iff popped up -}; - - -} // namespace GUI -} // namespace Ingen - -#endif // NODEMODULE_H diff --git a/src/libs/gui/NodePropertiesWindow.cpp b/src/libs/gui/NodePropertiesWindow.cpp deleted file mode 100644 index ae2c23b5..00000000 --- a/src/libs/gui/NodePropertiesWindow.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include -#include "client/NodeModel.hpp" -#include "client/PluginModel.hpp" -#include "NodePropertiesWindow.hpp" - -namespace Ingen { -namespace GUI { -using std::string; - - -NodePropertiesWindow::NodePropertiesWindow(BaseObjectType* cobject, const Glib::RefPtr& glade_xml) -: Gtk::Window(cobject) -{ - glade_xml->get_widget("node_properties_path_label", _node_path_label); - glade_xml->get_widget("node_properties_polyphonic_checkbutton", _node_polyphonic_toggle); - glade_xml->get_widget("node_properties_plugin_type_label", _plugin_type_label); - glade_xml->get_widget("node_properties_plugin_uri_label", _plugin_uri_label); - glade_xml->get_widget("node_properties_plugin_name_label", _plugin_name_label); -} - - -/** Set the node this window is associated with. - * This function MUST be called before using this object in any way. - */ -void -NodePropertiesWindow::set_node(SharedPtr node_model) -{ - assert(node_model); - - _node_model = node_model; - - set_title(node_model->path() + " Properties"); - - _node_path_label->set_text(node_model->path()); - _node_polyphonic_toggle->set_active(node_model->polyphonic()); - - const PluginModel* pm = dynamic_cast(node_model->plugin()); - if (pm) { - _plugin_type_label->set_text(pm->type_uri()); - _plugin_uri_label->set_text(pm->uri()); - _plugin_name_label->set_text(pm->name()); - } -} - - -} // namespace GUI -} // namespace Ingen - diff --git a/src/libs/gui/NodePropertiesWindow.hpp b/src/libs/gui/NodePropertiesWindow.hpp deleted file mode 100644 index 248c8b42..00000000 --- a/src/libs/gui/NodePropertiesWindow.hpp +++ /dev/null @@ -1,58 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef NODEPROPERTIESWINDOW_H -#define NODEPROPERTIESWINDOW_H - -#include -#include -#include -#include "client/NodeModel.hpp" -using namespace Ingen::Client; - -namespace Ingen { -namespace GUI { - - -/** Node properties window. - * - * Loaded by libglade as a derived object. - * - * \ingroup GUI - */ -class NodePropertiesWindow : public Gtk::Window -{ -public: - NodePropertiesWindow(BaseObjectType* cobject, const Glib::RefPtr& refGlade); - - void present(SharedPtr node_model) { set_node(node_model); Gtk::Window::present(); } - void set_node(SharedPtr node_model); - -private: - - SharedPtr _node_model; - Gtk::Label* _node_path_label; - Gtk::CheckButton* _node_polyphonic_toggle; - Gtk::Label* _plugin_type_label; - Gtk::Label* _plugin_uri_label; - Gtk::Label* _plugin_name_label; -}; - -} // namespace GUI -} // namespace Ingen - -#endif // NODEPROPERTIESWINDOW_H diff --git a/src/libs/gui/ObjectMenu.cpp b/src/libs/gui/ObjectMenu.cpp deleted file mode 100644 index becbf964..00000000 --- a/src/libs/gui/ObjectMenu.cpp +++ /dev/null @@ -1,112 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include "interface/EngineInterface.hpp" -#include "client/ObjectModel.hpp" -#include "App.hpp" -#include "ObjectMenu.hpp" -#include "WindowFactory.hpp" - -namespace Ingen { -namespace GUI { - - -ObjectMenu::ObjectMenu(BaseObjectType* cobject, const Glib::RefPtr& xml) - : Gtk::Menu(cobject) - , _enable_signal(false) - , _polyphonic_menuitem(NULL) - , _disconnect_menuitem(NULL) - , _rename_menuitem(NULL) - , _destroy_menuitem(NULL) - , _properties_menuitem(NULL) -{ - xml->get_widget("object_polyphonic_menuitem", _polyphonic_menuitem); - xml->get_widget("object_disconnect_menuitem", _disconnect_menuitem); - xml->get_widget("object_rename_menuitem", _rename_menuitem); - xml->get_widget("object_destroy_menuitem", _destroy_menuitem); - xml->get_widget("object_properties_menuitem", _properties_menuitem); -} - - -void -ObjectMenu::init(SharedPtr object) -{ - _object = object; - - App& app = App::instance(); - - _polyphonic_menuitem->signal_toggled().connect( - sigc::mem_fun(this, &ObjectMenu::on_menu_polyphonic)); - - _polyphonic_menuitem->set_active(object->polyphonic()); - - _disconnect_menuitem->signal_activate().connect( - sigc::mem_fun(this, &ObjectMenu::on_menu_disconnect)); - - _rename_menuitem->signal_activate().connect(sigc::bind( - sigc::mem_fun(app.window_factory(), &WindowFactory::present_rename), - object)); - - _destroy_menuitem->signal_activate().connect( - sigc::mem_fun(this, &ObjectMenu::on_menu_destroy)); - - _properties_menuitem->signal_activate().connect( - sigc::mem_fun(this, &ObjectMenu::on_menu_properties)); - - object->signal_property.connect(sigc::mem_fun(this, &ObjectMenu::property_changed)); - - _enable_signal = true; -} - - -void -ObjectMenu::on_menu_polyphonic() -{ - if (_enable_signal) - App::instance().engine()->set_property( - _object->path(), "ingen:polyphonic", _polyphonic_menuitem->get_active()); -} - - -void -ObjectMenu::property_changed(const std::string& predicate, const Raul::Atom& value) -{ - _enable_signal = false; - if (predicate == "ingen:polyphonic" && value.type() == Atom::BOOL) - _polyphonic_menuitem->set_active(value.get_bool()); - _enable_signal = true; -} - - -void -ObjectMenu::on_menu_destroy() -{ - App::instance().engine()->destroy(_object->path()); -} - - -void -ObjectMenu::on_menu_properties() -{ - App::instance().window_factory()->present_properties(_object); -} - - -} // namespace GUI -} // namespace Ingen - diff --git a/src/libs/gui/ObjectMenu.hpp b/src/libs/gui/ObjectMenu.hpp deleted file mode 100644 index b5c5bf49..00000000 --- a/src/libs/gui/ObjectMenu.hpp +++ /dev/null @@ -1,69 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef OBJECTMENU_H -#define OBJECTMENU_H - -#include -#include -#include -#include -#include -#include "client/ObjectModel.hpp" -using Ingen::Client::ObjectModel; - -namespace Ingen { -namespace GUI { - -class ObjectControlWindow; -class ObjectPropertiesWindow; -class PatchCanvas; - -/** Menu for a Object. - * - * \ingroup GUI - */ -class ObjectMenu : public Gtk::Menu -{ -public: - ObjectMenu(BaseObjectType* cobject, const Glib::RefPtr& xml); - - void init(SharedPtr object); - -protected: - - virtual void on_menu_disconnect() = 0; - void on_menu_polyphonic(); - void on_menu_destroy(); - void on_menu_properties(); - - void property_changed(const std::string& predicate, const Raul::Atom& value); - - bool _enable_signal; - SharedPtr _object; - Gtk::CheckMenuItem* _polyphonic_menuitem; - Gtk::MenuItem* _disconnect_menuitem; - Gtk::MenuItem* _rename_menuitem; - Gtk::MenuItem* _destroy_menuitem; - Gtk::MenuItem* _properties_menuitem; -}; - - -} // namespace GUI -} // namespace Ingen - -#endif // OBJECTMENU_H diff --git a/src/libs/gui/PatchCanvas.cpp b/src/libs/gui/PatchCanvas.cpp deleted file mode 100644 index 4f01a7f7..00000000 --- a/src/libs/gui/PatchCanvas.cpp +++ /dev/null @@ -1,773 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include CONFIG_H_PATH -#include "module/global.hpp" -#include "module/World.hpp" - -#include -#include -#include -#include "interface/EngineInterface.hpp" -#include "shared/Builder.hpp" -#include "shared/ClashAvoider.hpp" -#include "serialisation/Serialiser.hpp" -#include "client/PluginModel.hpp" -#include "client/PatchModel.hpp" -#include "client/NodeModel.hpp" -#include "client/ClientStore.hpp" -#include "App.hpp" -#include "PatchCanvas.hpp" -#include "PatchWindow.hpp" -#include "PatchPortModule.hpp" -#include "LoadPluginWindow.hpp" -#include "LoadSubpatchWindow.hpp" -#include "NewSubpatchWindow.hpp" -#include "Port.hpp" -#include "Connection.hpp" -#include "NodeModule.hpp" -#include "SubpatchModule.hpp" -#include "GladeFactory.hpp" -#include "WindowFactory.hpp" -#include "ThreadedLoader.hpp" -using Ingen::Client::ClientStore; -using Ingen::Serialisation::Serialiser; -using Ingen::Client::PluginModel; -using namespace std; - -namespace Ingen { -namespace GUI { - - -PatchCanvas::PatchCanvas(SharedPtr patch, int width, int height) - : Canvas(width, height) - , _patch(patch) - , _last_click_x(0) - , _last_click_y(0) - , _refresh_menu(false) - , _human_names(true) - , _menu(NULL) - , _internal_menu(NULL) - , _plugin_menu(NULL) -{ - Glib::RefPtr xml = GladeFactory::new_glade_reference(); - xml->get_widget("canvas_menu", _menu); - - /*xml->get_widget("canvas_menu_add_number_control", _menu_add_number_control); - xml->get_widget("canvas_menu_add_button_control", _menu_add_button_control);*/ - xml->get_widget("canvas_menu_add_audio_input", _menu_add_audio_input); - xml->get_widget("canvas_menu_add_audio_output", _menu_add_audio_output); - xml->get_widget("canvas_menu_add_control_input", _menu_add_control_input); - xml->get_widget("canvas_menu_add_control_output", _menu_add_control_output); - xml->get_widget("canvas_menu_add_midi_input", _menu_add_midi_input); - xml->get_widget("canvas_menu_add_midi_output", _menu_add_midi_output); - xml->get_widget("canvas_menu_add_osc_input", _menu_add_osc_input); - xml->get_widget("canvas_menu_add_osc_output", _menu_add_osc_output); - xml->get_widget("canvas_menu_add_event_input", _menu_add_event_input); - xml->get_widget("canvas_menu_add_event_output", _menu_add_event_output); - xml->get_widget("canvas_menu_load_plugin", _menu_load_plugin); - xml->get_widget("canvas_menu_load_patch", _menu_load_patch); - xml->get_widget("canvas_menu_new_patch", _menu_new_patch); - - // Add port menu items - _menu_add_audio_input->signal_activate().connect( - sigc::bind(sigc::mem_fun(this, &PatchCanvas::menu_add_port), - "audio_input", "ingen:AudioPort", false)); - _menu_add_audio_output->signal_activate().connect( - sigc::bind(sigc::mem_fun(this, &PatchCanvas::menu_add_port), - "audio_output", "ingen:AudioPort", true)); - _menu_add_control_input->signal_activate().connect( - sigc::bind(sigc::mem_fun(this, &PatchCanvas::menu_add_port), - "control_input", "ingen:ControlPort", false)); - _menu_add_control_output->signal_activate().connect( - sigc::bind(sigc::mem_fun(this, &PatchCanvas::menu_add_port), - "control_output", "ingen:ControlPort", true)); - _menu_add_midi_input->signal_activate().connect( - sigc::bind(sigc::mem_fun(this, &PatchCanvas::menu_add_port), - "midi_input", "ingen:MIDIPort", false)); - _menu_add_midi_output->signal_activate().connect( - sigc::bind(sigc::mem_fun(this, &PatchCanvas::menu_add_port), - "midi_output", "ingen:MIDIPort", true)); - _menu_add_osc_input->signal_activate().connect( - sigc::bind(sigc::mem_fun(this, &PatchCanvas::menu_add_port), - "osc_input", "ingen:OSCPort", false)); - _menu_add_osc_output->signal_activate().connect( - sigc::bind(sigc::mem_fun(this, &PatchCanvas::menu_add_port), - "osc_output", "ingen:OSCPort", true)); - _menu_add_event_input->signal_activate().connect( - sigc::bind(sigc::mem_fun(this, &PatchCanvas::menu_add_port), - "event_input", "ingen:EventPort", false)); - _menu_add_event_output->signal_activate().connect( - sigc::bind(sigc::mem_fun(this, &PatchCanvas::menu_add_port), - "event_output", "ingen:EventPort", true)); - - // Add control menu items - /*_menu_add_number_control->signal_activate().connect( - sigc::bind(sigc::mem_fun(this, &PatchCanvas::menu_add_control), NUMBER)); - _menu_add_button_control->signal_activate().connect( - sigc::bind(sigc::mem_fun(this, &PatchCanvas::menu_add_control), BUTTON));*/ - - // Connect to model signals to track state - _patch->signal_new_node.connect(sigc::mem_fun(this, &PatchCanvas::add_node)); - _patch->signal_removed_node.connect(sigc::mem_fun(this, &PatchCanvas::remove_node)); - _patch->signal_new_port.connect(sigc::mem_fun(this, &PatchCanvas::add_port)); - _patch->signal_removed_port.connect(sigc::mem_fun(this, &PatchCanvas::remove_port)); - _patch->signal_new_connection.connect(sigc::mem_fun(this, &PatchCanvas::connection)); - _patch->signal_removed_connection.connect(sigc::mem_fun(this, &PatchCanvas::disconnection)); - - App::instance().store()->signal_new_plugin.connect(sigc::mem_fun(this, &PatchCanvas::add_plugin)); - - // Connect widget signals to do things - _menu_load_plugin->signal_activate().connect(sigc::mem_fun(this, &PatchCanvas::menu_load_plugin)); - _menu_load_patch->signal_activate().connect(sigc::mem_fun(this, &PatchCanvas::menu_load_patch)); - _menu_new_patch->signal_activate().connect(sigc::mem_fun(this, &PatchCanvas::menu_new_patch)); -} - - -void -PatchCanvas::show_menu(GdkEvent* event) -{ - if (!_internal_menu || !_plugin_menu || _refresh_menu) { - build_internal_menu(); -#ifdef HAVE_SLV2 - build_plugin_menu(); -#endif - _refresh_menu = false; - } - _menu->popup(event->button.button, event->button.time); -} - - -void -PatchCanvas::build_internal_menu() -{ - if (_internal_menu) { - _internal_menu->items().clear(); - } else { - _menu->items().push_back(Gtk::Menu_Helpers::ImageMenuElem("Internal", - *(manage(new Gtk::Image(Gtk::Stock::EXECUTE, Gtk::ICON_SIZE_MENU))))); - Gtk::MenuItem* internal_menu_item = &(_menu->items().back()); - _internal_menu = Gtk::manage(new Gtk::Menu()); - internal_menu_item->set_submenu(*_internal_menu); - _menu->reorder_child(*internal_menu_item, 2); - } - - SharedPtr plugins = App::instance().store()->plugins(); - - // Add Internal plugins - for (ClientStore::Plugins::const_iterator i = plugins->begin(); i != plugins->end(); ++i) { - SharedPtr p = i->second; - if (p->type() == Plugin::Internal) { - _internal_menu->items().push_back(Gtk::Menu_Helpers::MenuElem(p->name(), - sigc::bind(sigc::mem_fun(this, &PatchCanvas::load_plugin), p))); - } - } -} - - -#ifdef HAVE_SLV2 -size_t -PatchCanvas::build_plugin_class_menu(Gtk::Menu* menu, - SLV2PluginClass plugin_class, SLV2PluginClasses classes) -{ - size_t num_items = 0; - - // Add submenus - for (unsigned i=0; i < slv2_plugin_classes_size(classes); ++i) { - SLV2PluginClass c = slv2_plugin_classes_get_at(classes, i); - SLV2Value parent = slv2_plugin_class_get_parent_uri(c); - - if (parent && slv2_value_equals(parent, slv2_plugin_class_get_uri(plugin_class))) { - Gtk::Menu_Helpers::MenuElem menu_elem = Gtk::Menu_Helpers::MenuElem( - slv2_value_as_string(slv2_plugin_class_get_label(c))); - - Gtk::Menu* submenu = Gtk::manage(new Gtk::Menu()); - size_t sub_num_items = build_plugin_class_menu(submenu, c, classes); - - if (sub_num_items > 0) { - menu->items().push_back(menu_elem); - Gtk::MenuItem* menu_item = &(menu->items().back()); - menu_item->set_submenu(*submenu); - ++num_items; - } - } - } - - SharedPtr plugins = App::instance().store()->plugins(); - - // Add LV2 plugins - for (ClientStore::Plugins::const_iterator i = plugins->begin(); i != plugins->end(); ++i) { - SLV2Plugin p = i->second->slv2_plugin(); - - if (p && slv2_plugin_get_class(p) == plugin_class) { - Glib::RefPtr icon - = App::instance().icon_from_path(PluginModel::get_lv2_icon_path(p), 16); - if (icon) { - Gtk::Image* image = new Gtk::Image(icon); - menu->items().push_back(Gtk::Menu_Helpers::ImageMenuElem(i->second->name(), - *image, - sigc::bind(sigc::mem_fun(this, &PatchCanvas::load_plugin), i->second))); - } else { - menu->items().push_back(Gtk::Menu_Helpers::MenuElem(i->second->name(), - sigc::bind(sigc::mem_fun(this, &PatchCanvas::load_plugin), i->second))); - ++num_items; - } - } - } - - return num_items; -} - - -void -PatchCanvas::build_plugin_menu() -{ - if (_plugin_menu) { - _plugin_menu->items().clear(); - } else { - _menu->items().push_back(Gtk::Menu_Helpers::ImageMenuElem("Plugin", - *(manage(new Gtk::Image(Gtk::Stock::EXECUTE, Gtk::ICON_SIZE_MENU))))); - Gtk::MenuItem* plugin_menu_item = &(_menu->items().back()); - _plugin_menu = Gtk::manage(new Gtk::Menu()); - plugin_menu_item->set_submenu(*_plugin_menu); - _menu->reorder_child(*plugin_menu_item, 3); - } - - Glib::Mutex::Lock lock(PluginModel::rdf_world()->mutex()); - SLV2PluginClass lv2_plugin = slv2_world_get_plugin_class(PluginModel::slv2_world()); - SLV2PluginClasses classes = slv2_world_get_plugin_classes(PluginModel::slv2_world()); - - build_plugin_class_menu(_plugin_menu, lv2_plugin, classes); -} -#endif - - -void -PatchCanvas::build() -{ - boost::shared_ptr shared_this = - boost::dynamic_pointer_cast(shared_from_this()); - - // Create modules for nodes - for (ObjectModel::const_iterator i = App::instance().store()->children_begin(_patch); - i != App::instance().store()->children_end(_patch); ++i) { - SharedPtr node = PtrCast(i->second); - if (node && node->parent() == _patch) - add_node(node); - } - - // Create pseudo modules for ports (ports on this canvas, not on our module) - for (NodeModel::Ports::const_iterator i = _patch->ports().begin(); - i != _patch->ports().end(); ++i) { - add_port(*i); - } - - // Create connections - for (PatchModel::Connections::const_iterator i = _patch->connections().begin(); - i != _patch->connections().end(); ++i) { - connection(PtrCast(*i)); - } -} - - -void -PatchCanvas::arrange(bool ingen_doesnt_use_length_hints) -{ - FlowCanvas::Canvas::arrange(false); - - for (list >::iterator i = _items.begin(); i != _items.end(); ++i) - (*i)->store_location(); -} - - -void -PatchCanvas::show_human_names(bool b) -{ - _human_names = b; - for (ItemList::iterator m = _items.begin(); m != _items.end(); ++m) { - boost::shared_ptr mod = boost::dynamic_pointer_cast(*m); - if (mod) - mod->show_human_names(b); - } -} - - -void -PatchCanvas::add_plugin(SharedPtr pm) -{ - _refresh_menu = true; -} - - -void -PatchCanvas::add_node(SharedPtr nm) -{ - boost::shared_ptr shared_this = - boost::dynamic_pointer_cast(shared_from_this()); - - SharedPtr pm = PtrCast(nm); - SharedPtr module; - if (pm) { - module = SubpatchModule::create(shared_this, pm, _human_names); - } else { - module = NodeModule::create(shared_this, nm, _human_names); - const PluginModel* plugm = dynamic_cast(nm->plugin()); - if (plugm && plugm->icon_path() != "") - module->set_icon(App::instance().icon_from_path(plugm->icon_path(), 100)); - } - - add_item(module); - module->show(); - _views.insert(std::make_pair(nm, module)); -} - - -void -PatchCanvas::remove_node(SharedPtr nm) -{ - Views::iterator i = _views.find(nm); - - if (i != _views.end()) { - remove_item(i->second); - _views.erase(i); - } -} - - -void -PatchCanvas::add_port(SharedPtr pm) -{ - boost::shared_ptr shared_this = - boost::dynamic_pointer_cast(shared_from_this()); - - SharedPtr view = PatchPortModule::create(shared_this, pm); - _views.insert(std::make_pair(pm, view)); - add_item(view); - view->show(); -} - - -void -PatchCanvas::remove_port(SharedPtr pm) -{ - Views::iterator i = _views.find(pm); - - if (i != _views.end()) { - remove_item(i->second); - _views.erase(i); - } -} - - -SharedPtr -PatchCanvas::get_port_view(SharedPtr port) -{ - SharedPtr module = _views[port]; - - // Port on this patch - if (module) { - return (PtrCast(module)) - ? *(PtrCast(module)->ports().begin()) - : PtrCast(module); - } else { - module = PtrCast(_views[port->parent()]); - if (module) { - for (PortVector::const_iterator p = module->ports().begin(); - p != module->ports().end(); ++p) { - boost::shared_ptr pv = boost::dynamic_pointer_cast(*p); - if (pv && pv->model() == port) - return pv; - } - } - } - - return SharedPtr(); -} - - -void -PatchCanvas::connection(SharedPtr cm) -{ - assert(cm); - - const SharedPtr src = get_port_view(cm->src_port()); - const SharedPtr dst = get_port_view(cm->dst_port()); - - if (src && dst) { - add_connection(boost::shared_ptr(new GUI::Connection(shared_from_this(), - cm, src, dst, src->color() + 0x22222200))); - } else { - cerr << "[PatchCanvas] ERROR: Unable to find ports to connect " - << cm->src_port_path() << " -> " << cm->dst_port_path() << endl; - } -} - - -void -PatchCanvas::disconnection(SharedPtr cm) -{ - const SharedPtr src = get_port_view(cm->src_port()); - const SharedPtr dst = get_port_view(cm->dst_port()); - - if (src && dst) - remove_connection(src, dst); - else - cerr << "[PatchCanvas] ERROR: Unable to find ports to disconnect " - << cm->src_port_path() << " -> " << cm->dst_port_path() << endl; -} - - -void -PatchCanvas::connect(boost::shared_ptr src_port, - boost::shared_ptr dst_port) -{ - const boost::shared_ptr src - = boost::dynamic_pointer_cast(src_port); - - const boost::shared_ptr dst - = boost::dynamic_pointer_cast(dst_port); - - if (!src || !dst) - return; - - // Midi binding/learn shortcut - if (src->model()->type().is_event() && dst->model()->type().is_control()) { - cerr << "[PatchCanvas] FIXME: MIDI binding shortcut" << endl; -#if 0 - SharedPtr pm(new PluginModel(PluginModel::Internal, "", "midi_control_in", "")); - SharedPtr nm(new NodeModel(pm, _patch->path().base() - + src->name() + "-" + dst->name(), false)); - nm->set_variable("canvas-x", Atom((float) - (dst->module()->property_x() - dst->module()->width() - 20))); - nm->set_variable("canvas-y", Atom((float) - (dst->module()->property_y()))); - App::instance().engine()->create_node_from_model(nm.get()); - App::instance().engine()->connect(src->model()->path(), nm->path() + "/MIDI_In"); - App::instance().engine()->connect(nm->path() + "/Out_(CR)", dst->model()->path()); - App::instance().engine()->midi_learn(nm->path()); - - // Set control node range to port's user range - - App::instance().engine()->set_port_value_queued(nm->path().base() + "Min", - dst->model()->get_variable("user-min").get_float()); - App::instance().engine()->set_port_value_queued(nm->path().base() + "Max", - dst->model()->get_variable("user-max").get_float()); -#endif - } else { - App::instance().engine()->connect(src->model()->path(), dst->model()->path()); - } -} - - -void -PatchCanvas::disconnect(boost::shared_ptr src_port, - boost::shared_ptr dst_port) -{ - const boost::shared_ptr src - = boost::dynamic_pointer_cast(src_port); - - const boost::shared_ptr dst - = boost::dynamic_pointer_cast(dst_port); - - App::instance().engine()->disconnect(src->model()->path(), - dst->model()->path()); -} - - -bool -PatchCanvas::canvas_event(GdkEvent* event) -{ - assert(event); - - bool ret = false; - - switch (event->type) { - - case GDK_BUTTON_PRESS: - if (event->button.button == 3) { - _last_click_x = (int)event->button.x; - _last_click_y = (int)event->button.y; - show_menu(event); - ret = true; - } - break; - - case GDK_KEY_PRESS: - case GDK_KEY_RELEASE: - ret = canvas_key_event(&event->key); - - default: - break; - } - - return (ret ? true : Canvas::canvas_event(event)); -} - - -bool -PatchCanvas::canvas_key_event(GdkEventKey* event) -{ - switch (event->type) { - case GDK_KEY_PRESS: - switch (event->keyval) { - case GDK_Delete: - destroy_selection(); - return true; - case GDK_e: - if (event->state == 0) { - if (_patch->get_editable() == true) - _patch->set_editable(false); - else - _patch->set_editable(true); - return true; - } else { - return false; - } - default: - return false; - } - default: - return false; - } -} - - -void -PatchCanvas::destroy_selection() -{ - for (list >::iterator m = _selected_items.begin(); m != _selected_items.end(); ++m) { - boost::shared_ptr module = boost::dynamic_pointer_cast(*m); - if (module) { - App::instance().engine()->destroy(module->node()->path()); - } else { - boost::shared_ptr port_module = boost::dynamic_pointer_cast(*m); - if (port_module) - App::instance().engine()->destroy(port_module->port()->path()); - } - } -} - -void -PatchCanvas::select_all() -{ - unselect_ports(); - for (list >::iterator m = _items.begin(); m != _items.end(); ++m) - if (boost::dynamic_pointer_cast(*m)) - if (!(*m)->selected()) - select_item(*m); -} - -void -PatchCanvas::copy_selection() -{ - Serialiser serialiser(*App::instance().world(), App::instance().store()); - serialiser.start_to_string(_patch->path(), "http://example.org/"); - - for (list >::iterator m = _selected_items.begin(); m != _selected_items.end(); ++m) { - boost::shared_ptr module = boost::dynamic_pointer_cast(*m); - if (module) { - serialiser.serialise(module->node()); - } else { - boost::shared_ptr port_module = boost::dynamic_pointer_cast(*m); - if (port_module) - serialiser.serialise(port_module->port()); - } - } - - for (list >::iterator c = _selected_connections.begin(); - c != _selected_connections.end(); ++c) { - boost::shared_ptr connection = boost::dynamic_pointer_cast(*c); - if (connection) - serialiser.serialise_connection(_patch, connection->model()); - } - - string result = serialiser.finish(); - - Glib::RefPtr clipboard = Gtk::Clipboard::get(); - clipboard->set_text(result); -} - - -void -PatchCanvas::paste() -{ - Glib::ustring str = Gtk::Clipboard::get()->wait_for_text(); - SharedPtr parser = App::instance().loader()->parser(); - if (!parser) { - cerr << "Unable to load parser, paste unavailable" << endl; - return; - } - - clear_selection(); - - Builder builder(*App::instance().engine()); - ClientStore clipboard; - clipboard.set_plugins(App::instance().store()->plugins()); - clipboard.new_patch("/", _patch->poly()); - - ClashAvoider avoider(*App::instance().store().get(), _patch->path(), clipboard, &clipboard); - parser->parse_string(App::instance().world(), &avoider, str, "/", _patch->path()); - - for (Store::iterator i = clipboard.begin(); i != clipboard.end(); ++i) { - cout << "************ OBJECT: " << i->first << endl; - if (_patch->path() == "/" && i->first == "/") { - //cout << "SKIPPING ROOT " << _patch->path() << " :: " << i->first << endl; - continue; - } else if (i->first.parent() != "/") { - //cout << "SKIPPING NON ROOTED OBJECT " << i->first << endl; - continue; - } - GraphObject::Variables::iterator x = i->second->variables().find("ingenuity:canvas-x"); - if (x != i->second->variables().end()) - x->second = x->second.get_float() + 20.0f; - GraphObject::Variables::iterator y = i->second->variables().find("ingenuity:canvas-y"); - if (y != i->second->variables().end()) - y->second = y->second.get_float() + 20.0f; - if (i->first.parent() == "/") { - GraphObject::Properties::iterator s = i->second->properties().find("ingen:selected"); - if (s != i->second->properties().end()) - s->second = true; - else - i->second->properties().insert(make_pair("ingen:selected", true)); - } - builder.build(_patch->path(), i->second); - } - - //avoider.set_target(*App::instance().engine()); - - for (ClientStore::ConnectionRecords::const_iterator i = clipboard.connection_records().begin(); - i != clipboard.connection_records().end(); ++i) { - cout << "CONNECTING " << i->first << " -> " << i->second << endl; - App::instance().engine()->connect(i->first, i->second); - } -} - - -string -PatchCanvas::generate_port_name(const string& base) -{ - string name = base; - - char num_buf[5]; - for (uint i=1; i < 9999; ++i) { - snprintf(num_buf, 5, "%u", i); - name = base + "_"; - name += num_buf; - if (!_patch->get_port(name)) - break; - } - - assert(Path::is_valid(string("/") + name)); - - return name; -} - -void -PatchCanvas::menu_add_control(ControlType type) -{ - // FIXME: bundleify - - GraphObject::Variables data = get_initial_data(); - float x = data["ingenuity:canvas-x"].get_float(); - float y = data["ingenuity:canvas-y"].get_float(); - - cerr << "ADD CONTROL: " << (unsigned)type << " @ " << x << ", " << y << endl; - - add_item(boost::shared_ptr( - new FlowCanvas::Ellipse(shared_from_this(), "control", x, y, 20, 20, true))); -} - -void -PatchCanvas::menu_add_port(const string& name, const string& type, bool is_output) -{ - const Path& path = _patch->path().base() + generate_port_name(name); - App::instance().engine()->bundle_begin(); - App::instance().engine()->new_port(path, _patch->num_ports(), type, is_output); - GraphObject::Variables data = get_initial_data(); - for (GraphObject::Variables::const_iterator i = data.begin(); i != data.end(); ++i) - App::instance().engine()->set_variable(path, i->first, i->second); - App::instance().engine()->bundle_end(); -} - - -void -PatchCanvas::load_plugin(SharedPtr plugin) -{ - string name = plugin->default_node_symbol(); - unsigned offset = App::instance().store()->child_name_offset(_patch->path(), name); - if (offset != 0) { - std::stringstream ss; - ss << name << "_" << offset; - name = ss.str(); - } - - const Path path = _patch->path().base() + name; - // FIXME: polyphony? - App::instance().engine()->new_node(path, plugin->uri()); - GraphObject::Variables data = get_initial_data(); - for (GraphObject::Variables::const_iterator i = data.begin(); i != data.end(); ++i) - App::instance().engine()->set_variable(path, i->first, i->second); -} - - -/** Try to guess a suitable location for a new module. - */ -void -PatchCanvas::get_new_module_location(double& x, double& y) -{ - int scroll_x; - int scroll_y; - get_scroll_offsets(scroll_x, scroll_y); - x = scroll_x + 20; - y = scroll_y + 20; -} - - -GraphObject::Variables -PatchCanvas::get_initial_data() -{ - GraphObject::Variables result; - - result["ingenuity:canvas-x"] = Atom((float)_last_click_x); - result["ingenuity:canvas-y"] = Atom((float)_last_click_y); - - return result; -} - -void -PatchCanvas::menu_load_plugin() -{ - App::instance().window_factory()->present_load_plugin(_patch, get_initial_data()); -} - - -void -PatchCanvas::menu_load_patch() -{ - App::instance().window_factory()->present_load_subpatch(_patch, get_initial_data()); -} - - -void -PatchCanvas::menu_new_patch() -{ - App::instance().window_factory()->present_new_subpatch(_patch, get_initial_data()); -} - - -} // namespace GUI -} // namespace Ingen diff --git a/src/libs/gui/PatchCanvas.hpp b/src/libs/gui/PatchCanvas.hpp deleted file mode 100644 index fcf68e76..00000000 --- a/src/libs/gui/PatchCanvas.hpp +++ /dev/null @@ -1,155 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef PATCHCANVAS_H -#define PATCHCANVAS_H - -#include CONFIG_H_PATH - -#include -#include -#include -#include -#include -#include -#include -#include "client/ConnectionModel.hpp" -#include "client/PatchModel.hpp" -#include "interface/GraphObject.hpp" -#include "NodeModule.hpp" - -using namespace FlowCanvas; -using namespace Ingen::Shared; - -using std::string; -using FlowCanvas::Port; -using Ingen::Client::ConnectionModel; -using Ingen::Client::PatchModel; -using Ingen::Client::NodeModel; -using Ingen::Client::PortModel; - -namespace Ingen { -namespace GUI { - -class NodeModule; - - -/** Patch canvas widget. - * - * \ingroup GUI - */ -class PatchCanvas : public FlowCanvas::Canvas -{ -public: - PatchCanvas(SharedPtr patch, int width, int height); - - virtual ~PatchCanvas() {} - - /*boost::shared_ptr find_module(const string& name) { - return boost::dynamic_pointer_cast( - Canvas::get_item(name)); - }*/ - - void build(); - void arrange(bool use_length_hints); - void show_human_names(bool show); - - void add_plugin(SharedPtr pm); - void add_node(SharedPtr nm); - void remove_node(SharedPtr nm); - void add_port(SharedPtr pm); - void remove_port(SharedPtr pm); - void connection(SharedPtr cm); - void disconnection(SharedPtr cm); - - void get_new_module_location(double& x, double& y); - - void destroy_selection(); - void copy_selection(); - void paste(); - void select_all(); - - void show_menu(GdkEvent* event); - - bool canvas_key_event(GdkEventKey* event); - -private: - enum ControlType { NUMBER, BUTTON }; - void menu_add_control(ControlType type); - - string generate_port_name(const string& base); - void menu_add_port(const string& name, const string& type, bool is_output); - - void menu_load_plugin(); - void menu_new_patch(); - void menu_load_patch(); - void load_plugin(SharedPtr plugin); - - void build_internal_menu(); -#ifdef HAVE_SLV2 - void build_plugin_menu(); - size_t build_plugin_class_menu(Gtk::Menu* menu, - SLV2PluginClass plugin_class, SLV2PluginClasses classes); -#endif - - GraphObject::Variables get_initial_data(); - - bool canvas_event(GdkEvent* event); - - SharedPtr get_port_view(SharedPtr port); - - void connect(boost::shared_ptr src, - boost::shared_ptr dst); - - void disconnect(boost::shared_ptr src, - boost::shared_ptr dst); - - SharedPtr _patch; - - typedef std::map, SharedPtr > Views; - Views _views; - - int _last_click_x; - int _last_click_y; - - bool _refresh_menu; - bool _human_names; - Gtk::Menu* _menu; - Gtk::Menu* _internal_menu; - Gtk::Menu* _plugin_menu; - /*Gtk::MenuItem* _menu_add_number_control; - Gtk::MenuItem* _menu_add_button_control;*/ - Gtk::MenuItem* _menu_add_audio_input; - Gtk::MenuItem* _menu_add_audio_output; - Gtk::MenuItem* _menu_add_control_input; - Gtk::MenuItem* _menu_add_control_output; - Gtk::MenuItem* _menu_add_event_input; - Gtk::MenuItem* _menu_add_event_output; - Gtk::MenuItem* _menu_add_midi_input; - Gtk::MenuItem* _menu_add_midi_output; - Gtk::MenuItem* _menu_add_osc_input; - Gtk::MenuItem* _menu_add_osc_output; - Gtk::MenuItem* _menu_load_plugin; - Gtk::MenuItem* _menu_load_patch; - Gtk::MenuItem* _menu_new_patch; -}; - - -} // namespace GUI -} // namespace Ingen - -#endif // PATCHCANVAS_H diff --git a/src/libs/gui/PatchPortModule.cpp b/src/libs/gui/PatchPortModule.cpp deleted file mode 100644 index d8aaa91d..00000000 --- a/src/libs/gui/PatchPortModule.cpp +++ /dev/null @@ -1,158 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include "PatchPortModule.hpp" -#include "interface/EngineInterface.hpp" -#include "client/PatchModel.hpp" -#include "client/NodeModel.hpp" -#include "App.hpp" -#include "PatchCanvas.hpp" -#include "Port.hpp" -#include "GladeFactory.hpp" -#include "RenameWindow.hpp" -#include "PatchWindow.hpp" -#include "WindowFactory.hpp" -#include "PortMenu.hpp" - -namespace Ingen { -namespace GUI { - - -PatchPortModule::PatchPortModule(boost::shared_ptr canvas, SharedPtr port) -: FlowCanvas::Module(canvas, port->path().name(), 0, 0, false), // FIXME: coords? - _port(port) -{ - assert(canvas); - assert(port); - - assert(PtrCast(port->parent())); - - /*resize(); - - const Atom& x_atom = port->get_variable("ingenuity:canvas-x"); - const Atom& y_atom = port->get_variable("ingenuity:canvas-y"); - - if (x_atom && y_atom && x_atom.type() == Atom::FLOAT && y_atom.type() == Atom::FLOAT) { - move_to(x_atom.get_float(), y_atom.get_float()); - } else { - double default_x; - double default_y; - canvas->get_new_module_location(default_x, default_y); - move_to(default_x, default_y); - }*/ - - set_stacked_border(port->polyphonic()); - - port->signal_variable.connect(sigc::mem_fun(this, &PatchPortModule::set_variable)); - port->signal_property.connect(sigc::mem_fun(this, &PatchPortModule::set_property)); -} - - -boost::shared_ptr -PatchPortModule::create(boost::shared_ptr canvas, SharedPtr port) -{ - boost::shared_ptr ret = boost::shared_ptr( - new PatchPortModule(canvas, port)); - assert(ret); - - ret->_patch_port = boost::shared_ptr(new Port(ret, port, port->symbol(), true)); - - ret->add_port(ret->_patch_port); - - ret->set_menu(ret->_patch_port->menu()); - - for (GraphObject::Variables::const_iterator m = port->variables().begin(); m != port->variables().end(); ++m) - ret->set_variable(m->first, m->second); - - for (GraphObject::Properties::const_iterator m = port->properties().begin(); m != port->properties().end(); ++m) - ret->set_property(m->first, m->second); - - ret->resize(); - - return ret; -} - - -void -PatchPortModule::create_menu() -{ - Glib::RefPtr xml = GladeFactory::new_glade_reference(); - xml->get_widget_derived("object_menu", _menu); - _menu->init(_port, true); - - set_menu(_menu); -} - - -void -PatchPortModule::store_location() -{ - const float x = static_cast(property_x()); - const float y = static_cast(property_y()); - - const Atom& existing_x = _port->get_variable("ingenuity:canvas-x"); - const Atom& existing_y = _port->get_variable("ingenuity:canvas-y"); - - if (existing_x.type() != Atom::FLOAT || existing_y.type() != Atom::FLOAT - || existing_x.get_float() != x || existing_y.get_float() != y) { - App::instance().engine()->set_variable(_port->path(), "ingenuity:canvas-x", Atom(x)); - App::instance().engine()->set_variable(_port->path(), "ingenuity:canvas-y", Atom(y)); - } -} - - -void -PatchPortModule::set_variable(const string& key, const Atom& value) -{ - if (key == "ingenuity:canvas-x" && value.type() == Atom::FLOAT) - move_to(value.get_float(), property_y()); - else if (key == "ingenuity:canvas-y" && value.type() == Atom::FLOAT) - move_to(property_x(), value.get_float()); -} - - -void -PatchPortModule::set_property(const string& key, const Atom& value) -{ - if (key == "ingen:polyphonic" && value.type() == Atom::BOOL) { - set_stacked_border(value.get_bool()); - } else if (key == "ingen:selected" && value.type() == Atom::BOOL) { - if (value.get_bool() != selected()) { - if (value.get_bool()) - _canvas.lock()->select_item(shared_from_this()); - else - _canvas.lock()->unselect_item(shared_from_this()); - } - } -} - - -void -PatchPortModule::set_selected(bool b) -{ - if (b != selected()) { - Module::set_selected(b); - if (App::instance().signal()) - App::instance().engine()->set_property(_port->path(), "ingen:selected", b); - } -} - - - -} // namespace GUI -} // namespace Ingen diff --git a/src/libs/gui/PatchPortModule.hpp b/src/libs/gui/PatchPortModule.hpp deleted file mode 100644 index d6715834..00000000 --- a/src/libs/gui/PatchPortModule.hpp +++ /dev/null @@ -1,79 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef PATCHPORTMODULE_H -#define PATCHPORTMODULE_H - -#include -#include -#include -#include -#include -#include "Port.hpp" -using std::string; - -namespace Ingen { namespace Client { - class PortModel; - class NodeModel; -} } -using namespace Ingen::Client; - -namespace Ingen { -namespace GUI { - -class PatchCanvas; -class Port; -class PortMenu; - - -/** A "module" to represent a patch's port on it's own canvas. - * - * Translation: This is the nameless single port pseudo module thingy. - * - * \ingroup GUI - */ -class PatchPortModule : public FlowCanvas::Module -{ -public: - static boost::shared_ptr create(boost::shared_ptr canvas, - SharedPtr port); - - virtual ~PatchPortModule() {} - - virtual void store_location(); - - SharedPtr port() const { return _port; } - -protected: - PatchPortModule(boost::shared_ptr canvas, SharedPtr port); - - void create_menu(); - void set_selected(bool b); - - void set_variable(const std::string& predicate, const Raul::Atom& value); - void set_property(const std::string& predicate, const Raul::Atom& value); - - SharedPtr _port; - PortMenu* _menu; - SharedPtr _patch_port; ///< Port on this 'anonymous' module -}; - - -} // namespace GUI -} // namespace Ingen - -#endif // PATCHPORTMODULE_H diff --git a/src/libs/gui/PatchPropertiesWindow.cpp b/src/libs/gui/PatchPropertiesWindow.cpp deleted file mode 100644 index f4003d31..00000000 --- a/src/libs/gui/PatchPropertiesWindow.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include -#include "client/PatchModel.hpp" -#include "PatchPropertiesWindow.hpp" -#include "App.hpp" - -using namespace std; - -namespace Ingen { -namespace GUI { - - -PatchPropertiesWindow::PatchPropertiesWindow(BaseObjectType* cobject, const Glib::RefPtr& glade_xml) -: Gtk::Window(cobject) -{ - glade_xml->get_widget("properties_author_entry", _author_entry); - glade_xml->get_widget("properties_description_textview", _textview); - glade_xml->get_widget("properties_cancel_button", _cancel_button); - glade_xml->get_widget("properties_ok_button", _ok_button); - - _cancel_button->signal_clicked().connect(sigc::mem_fun(this, &PatchPropertiesWindow::cancel_clicked)); - _ok_button->signal_clicked().connect(sigc::mem_fun(this, &PatchPropertiesWindow::ok_clicked)); -} - - -/** Set the patch model this description is for. - * - * This function is a "post-constructor" - it MUST be called before using - * the window in any way. - */ -void -PatchPropertiesWindow::set_patch(SharedPtr patch_model) -{ - property_title() = patch_model->path() + " Properties"; - _patch_model = patch_model; - - const Atom& author_atom = _patch_model->get_variable("dc:creator"); - _author_entry->set_text( - (author_atom.type() == Atom::STRING) ? author_atom.get_string() : "" ); - - const Atom& desc_atom = _patch_model->get_variable("dc:description"); - _textview->get_buffer()->set_text( - (desc_atom.type() == Atom::STRING) ? desc_atom.get_string() : "" ); -} - - -void -PatchPropertiesWindow::cancel_clicked() -{ - const Atom& author_atom = _patch_model->get_variable("dc:creator"); - _author_entry->set_text( - (author_atom.type() == Atom::STRING) ? author_atom.get_string() : "" ); - - const Atom& desc_atom = _patch_model->get_variable("dc:description"); - _textview->get_buffer()->set_text( - (desc_atom.type() == Atom::STRING) ? desc_atom.get_string() : "" ); - - hide(); -} - - -void -PatchPropertiesWindow::ok_clicked() -{ - App::instance().engine()->set_variable(_patch_model->path(), "dc:creator", - Atom(_author_entry->get_text())); - App::instance().engine()->set_variable(_patch_model->path(), "dc:description", - Atom(_textview->get_buffer()->get_text())); - hide(); -} - - - -} // namespace GUI -} // namespace Ingen diff --git a/src/libs/gui/PatchPropertiesWindow.hpp b/src/libs/gui/PatchPropertiesWindow.hpp deleted file mode 100644 index 0f60b147..00000000 --- a/src/libs/gui/PatchPropertiesWindow.hpp +++ /dev/null @@ -1,64 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef PATCHPROPERTIESWINDOW_H -#define PATCHPROPERTIESWINDOW_H - -#include -#include -#include -#include -using std::string; - -namespace Ingen { namespace Client { class PatchModel; } } -using Ingen::Client::PatchModel; - -namespace Ingen { -namespace GUI { - - -/** Patch Properties Window. - * - * Loaded by libglade as a derived object. - * - * \ingroup GUI - */ -class PatchPropertiesWindow : public Gtk::Window -{ -public: - PatchPropertiesWindow(BaseObjectType* cobject, const Glib::RefPtr& refGlade); - - void present(SharedPtr patch_model) { set_patch(patch_model); Gtk::Window::present(); } - void set_patch(SharedPtr patch_model); - - void cancel_clicked(); - void ok_clicked(); - -private: - SharedPtr _patch_model; - - Gtk::Entry* _author_entry; - Gtk::TextView* _textview; - Gtk::Button* _cancel_button; - Gtk::Button* _ok_button; -}; - - -} // namespace GUI -} // namespace Ingen - -#endif // PATCHPROPERTIESWINDOW_H diff --git a/src/libs/gui/PatchTreeWindow.cpp b/src/libs/gui/PatchTreeWindow.cpp deleted file mode 100644 index 4730da2b..00000000 --- a/src/libs/gui/PatchTreeWindow.cpp +++ /dev/null @@ -1,243 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include "interface/EngineInterface.hpp" -#include "client/OSCEngineSender.hpp" -#include "client/ClientStore.hpp" -#include "client/PatchModel.hpp" -#include "App.hpp" -#include "PatchTreeWindow.hpp" -#include "SubpatchModule.hpp" -#include "WindowFactory.hpp" - -using namespace std; - -namespace Ingen { -namespace GUI { - - -PatchTreeWindow::PatchTreeWindow(BaseObjectType* cobject, - const Glib::RefPtr& xml) - : Gtk::Window(cobject) - , _enable_signal(true) -{ - xml->get_widget_derived("patches_treeview", _patches_treeview); - - _patch_treestore = Gtk::TreeStore::create(_patch_tree_columns); - _patches_treeview->set_window(this); - _patches_treeview->set_model(_patch_treestore); - Gtk::TreeViewColumn* name_col = Gtk::manage(new Gtk::TreeViewColumn( - "Patch", _patch_tree_columns.name_col)); - Gtk::TreeViewColumn* enabled_col = Gtk::manage(new Gtk::TreeViewColumn( - "Run", _patch_tree_columns.enabled_col)); - name_col->set_resizable(true); - name_col->set_expand(true); - - _patches_treeview->append_column(*name_col); - _patches_treeview->append_column(*enabled_col); - Gtk::CellRendererToggle* enabled_renderer = dynamic_cast( - _patches_treeview->get_column_cell_renderer(1)); - enabled_renderer->property_activatable() = true; - - _patch_tree_selection = _patches_treeview->get_selection(); - - //m_patch_tree_selection->signal_changed().connect( - // sigc::mem_fun(this, &PatchTreeWindow::event_patch_selected)); - _patches_treeview->signal_row_activated().connect( - sigc::mem_fun(this, &PatchTreeWindow::event_patch_activated)); - enabled_renderer->signal_toggled().connect( - sigc::mem_fun(this, &PatchTreeWindow::event_patch_enabled_toggled)); - - _patches_treeview->columns_autosize(); -} - - -void -PatchTreeWindow::init(ClientStore& store) -{ - store.signal_new_object.connect(sigc::mem_fun(this, &PatchTreeWindow::new_object)); -} - - -void -PatchTreeWindow::new_object(SharedPtr object) -{ - SharedPtr patch = PtrCast(object); - if (patch) - add_patch(patch); -} - - -void -PatchTreeWindow::add_patch(SharedPtr pm) -{ - if (!pm->parent()) { - Gtk::TreeModel::iterator iter = _patch_treestore->append(); - Gtk::TreeModel::Row row = *iter; - if (pm->path() == "/") { - SharedPtr osc_sender = PtrCast(App::instance().engine()); - string root_name = osc_sender ? osc_sender->uri() : "Internal"; - // Hack off trailing '/' if it's there (ugly) - //if (root_name.substr(root_name.length()-1,1) == "/") - // root_name = root_name.substr(0, root_name.length()-1); - //root_name.append(":/"); - row[_patch_tree_columns.name_col] = root_name; - } else { - row[_patch_tree_columns.name_col] = pm->path().name(); - } - row[_patch_tree_columns.enabled_col] = false; - row[_patch_tree_columns.patch_model_col] = pm; - _patches_treeview->expand_row(_patch_treestore->get_path(iter), true); - } else { - Gtk::TreeModel::Children children = _patch_treestore->children(); - Gtk::TreeModel::iterator c = find_patch(children, pm->parent()->path()); - - if (c != children.end()) { - Gtk::TreeModel::iterator iter = _patch_treestore->append(c->children()); - Gtk::TreeModel::Row row = *iter; - row[_patch_tree_columns.name_col] = pm->path().name(); - row[_patch_tree_columns.enabled_col] = false; - row[_patch_tree_columns.patch_model_col] = pm; - _patches_treeview->expand_row(_patch_treestore->get_path(iter), true); - } - } - - pm->signal_property.connect(sigc::bind(sigc::mem_fun(this, &PatchTreeWindow::patch_property_changed), pm->path())); -} - - -void -PatchTreeWindow::remove_patch(const Path& path) -{ - Gtk::TreeModel::iterator i = find_patch(_patch_treestore->children(), path); - if (i != _patch_treestore->children().end()) - _patch_treestore->erase(i); -} - - -Gtk::TreeModel::iterator -PatchTreeWindow::find_patch(Gtk::TreeModel::Children root, const Path& path) -{ - for (Gtk::TreeModel::iterator c = root.begin(); c != root.end(); ++c) { - SharedPtr pm = (*c)[_patch_tree_columns.patch_model_col]; - if (pm->path() == path) { - return c; - } else if ((*c)->children().size() > 0) { - Gtk::TreeModel::iterator ret = find_patch(c->children(), path); - if (ret != c->children().end()) - return ret; - } - } - return root.end(); -} - -/* -void -PatchTreeWindow::event_patch_selected() -{ - Gtk::TreeModel::iterator active = _patch_tree_selection->get_selected(); - if (active) { - Gtk::TreeModel::Row row = *active; - SharedPtr pm = row[_patch_tree_columns.patch_model_col]; - } -} -*/ - - -/** Show the context menu for the selected patch in the patches treeview. - */ -void -PatchTreeWindow::show_patch_menu(GdkEventButton* ev) -{ - Gtk::TreeModel::iterator active = _patch_tree_selection->get_selected(); - if (active) { - Gtk::TreeModel::Row row = *active; - SharedPtr pm = row[_patch_tree_columns.patch_model_col]; - if (pm) - cerr << "FIXME: patch menu\n"; - //pm->show_menu(ev); - } -} - - -void -PatchTreeWindow::event_patch_activated(const Gtk::TreeModel::Path& path, Gtk::TreeView::Column* col) -{ - Gtk::TreeModel::iterator active = _patch_treestore->get_iter(path); - Gtk::TreeModel::Row row = *active; - SharedPtr pm = row[_patch_tree_columns.patch_model_col]; - - App::instance().window_factory()->present_patch(pm); -} - - -void -PatchTreeWindow::event_patch_enabled_toggled(const Glib::ustring& path_str) -{ - Gtk::TreeModel::Path path(path_str); - Gtk::TreeModel::iterator active = _patch_treestore->get_iter(path); - Gtk::TreeModel::Row row = *active; - - SharedPtr pm = row[_patch_tree_columns.patch_model_col]; - Glib::ustring patch_path = pm->path(); - - assert(pm); - - if (_enable_signal) - App::instance().engine()->set_property(patch_path, "ingen:enabled", (bool)!pm->enabled()); -} - - -void -PatchTreeWindow::patch_property_changed(const string& key, const Raul::Atom& value, const Path& path) -{ - _enable_signal = false; - if (key == "ingen:enabled" && value.type() == Atom::BOOL) { - Gtk::TreeModel::iterator i = find_patch(_patch_treestore->children(), path); - if (i != _patch_treestore->children().end()) { - Gtk::TreeModel::Row row = *i; - row[_patch_tree_columns.enabled_col] = value.get_bool(); - } else { - cerr << "[PatchTreeWindow] Unable to find patch " << path << endl; - } - } - _enable_signal = true; -} - - -void -PatchTreeWindow::patch_renamed(const Path& old_path, const Path& new_path) -{ - _enable_signal = false; - - Gtk::TreeModel::iterator i - = find_patch(_patch_treestore->children(), old_path); - - if (i != _patch_treestore->children().end()) { - Gtk::TreeModel::Row row = *i; - row[_patch_tree_columns.name_col] = new_path.name(); - } else { - cerr << "[PatchTreeWindow] Unable to find patch " << old_path << endl; - } - - _enable_signal = true; -} - - -} // namespace GUI -} // namespace Ingen diff --git a/src/libs/gui/PatchTreeWindow.hpp b/src/libs/gui/PatchTreeWindow.hpp deleted file mode 100644 index f549a322..00000000 --- a/src/libs/gui/PatchTreeWindow.hpp +++ /dev/null @@ -1,111 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef PATCHTREEWINDOW_H -#define PATCHTREEWINDOW_H - -#include -#include -#include - -namespace Ingen { namespace Client { - class ClientStore; -} } -using Ingen::Client::ClientStore; - -namespace Ingen { -namespace GUI { - -class PatchWindow; -class PatchTreeView; - - -/** Window with a TreeView of all loaded patches. - * - * \ingroup GUI - */ -class PatchTreeWindow : public Gtk::Window -{ -public: - PatchTreeWindow(BaseObjectType* cobject, const Glib::RefPtr& refGlade); - - void init(ClientStore& store); - - void new_object(SharedPtr object); - - void patch_property_changed(const string& key, const Raul::Atom& value, const Path& path); - void patch_renamed(const Path& old_path, const Path& new_path); - - void add_patch(SharedPtr pm); - void remove_patch(const Path& path); - void show_patch_menu(GdkEventButton* ev); - -protected: - //void event_patch_selected(); - void event_patch_activated(const Gtk::TreeModel::Path& path, Gtk::TreeView::Column* col); - void event_patch_enabled_toggled(const Glib::ustring& path_str); - - Gtk::TreeModel::iterator find_patch(Gtk::TreeModel::Children root, const Path& path); - - PatchTreeView* _patches_treeview; - - struct PatchTreeModelColumns : public Gtk::TreeModel::ColumnRecord - { - PatchTreeModelColumns() - { add(name_col); add(enabled_col); add(patch_model_col); } - - Gtk::TreeModelColumn name_col; - Gtk::TreeModelColumn enabled_col; - Gtk::TreeModelColumn > patch_model_col; - }; - - bool _enable_signal; - PatchTreeModelColumns _patch_tree_columns; - Glib::RefPtr _patch_treestore; - Glib::RefPtr _patch_tree_selection; -}; - - -/** Derived TreeView class to support context menus for patches */ -class PatchTreeView : public Gtk::TreeView -{ -public: - PatchTreeView(BaseObjectType* cobject, const Glib::RefPtr& xml) - : Gtk::TreeView(cobject) - {} - - void set_window(PatchTreeWindow* win) { _window = win; } - - bool on_button_press_event(GdkEventButton* ev) { - bool ret = Gtk::TreeView::on_button_press_event(ev); - - if ((ev->type == GDK_BUTTON_PRESS) && (ev->button == 3)) - _window->show_patch_menu(ev); - - return ret; - } - -private: - PatchTreeWindow* _window; - -}; // struct PatchTreeView - - -} // namespace GUI -} // namespace Ingen - -#endif // PATCHTREEWINDOW_H diff --git a/src/libs/gui/PatchView.cpp b/src/libs/gui/PatchView.cpp deleted file mode 100644 index 13689806..00000000 --- a/src/libs/gui/PatchView.cpp +++ /dev/null @@ -1,194 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include -#include -#include "interface/EngineInterface.hpp" -#include "client/PatchModel.hpp" -#include "App.hpp" -#include "PatchView.hpp" -#include "PatchCanvas.hpp" -#include "LoadPluginWindow.hpp" -#include "NewSubpatchWindow.hpp" -#include "LoadSubpatchWindow.hpp" -#include "NodeControlWindow.hpp" -#include "PatchPropertiesWindow.hpp" -#include "PatchTreeWindow.hpp" -#include "GladeFactory.hpp" - -namespace Ingen { -namespace GUI { - - -PatchView::PatchView(BaseObjectType* cobject, const Glib::RefPtr& xml) -: Gtk::Box(cobject), - _breadcrumb_container(NULL), - _enable_signal(true) -{ - property_visible() = false; - - xml->get_widget("patch_view_breadcrumb_container", _breadcrumb_container); - xml->get_widget("patch_view_toolbar", _toolbar); - xml->get_widget("patch_view_process_but", _process_but); - xml->get_widget("patch_view_poly_spin", _poly_spin); - xml->get_widget("patch_view_clear_but", _clear_but); - xml->get_widget("patch_view_destroy_but", _destroy_but); - xml->get_widget("patch_view_refresh_but", _refresh_but); - xml->get_widget("patch_view_save_but", _save_but); - xml->get_widget("patch_view_zoom_full_but", _zoom_full_but); - xml->get_widget("patch_view_zoom_normal_but", _zoom_normal_but); - xml->get_widget("patch_view_edit_mode_but", _edit_mode_but); - xml->get_widget("patch_view_scrolledwindow", _canvas_scrolledwindow); - - _toolbar->set_toolbar_style(Gtk::TOOLBAR_ICONS); - _canvas_scrolledwindow->property_hadjustment().get_value()->set_step_increment(10); - _canvas_scrolledwindow->property_vadjustment().get_value()->set_step_increment(10); - -} - - -void -PatchView::set_patch(SharedPtr patch) -{ - assert(!_canvas); // FIXME: remove - - //cerr << "Creating view for " << patch->path() << endl; - - assert(_breadcrumb_container); // ensure created - - _patch = patch; - _canvas = SharedPtr(new PatchCanvas(patch, 1600*2, 1200*2)); - _canvas->build(); - - _canvas_scrolledwindow->add(*_canvas); - - _poly_spin->set_value(patch->poly()); - _destroy_but->set_sensitive(patch->path() != "/"); - - for (GraphObject::Properties::const_iterator i = patch->properties().begin(); - i != patch->properties().end(); ++i) - property_changed(i->first, i->second); - - // Connect model signals to track state - patch->signal_property.connect(sigc::mem_fun(this, &PatchView::property_changed)); - - // Connect widget signals to do things - _process_but->signal_toggled().connect(sigc::mem_fun(this, &PatchView::process_toggled)); - _clear_but->signal_clicked().connect(sigc::mem_fun(this, &PatchView::clear_clicked)); - _refresh_but->signal_clicked().connect(sigc::mem_fun(this, &PatchView::refresh_clicked)); - - _zoom_normal_but->signal_clicked().connect(sigc::bind(sigc::mem_fun( - _canvas.get(), &PatchCanvas::set_zoom), 1.0)); - - _zoom_full_but->signal_clicked().connect( - sigc::mem_fun(_canvas.get(), &PatchCanvas::zoom_full)); - - patch->signal_editable.connect(sigc::mem_fun( - *this, &PatchView::on_editable_sig)); - - _edit_mode_but->signal_toggled().connect(sigc::mem_fun( - *this, &PatchView::editable_toggled)); - - _poly_spin->signal_value_changed().connect( - sigc::mem_fun(*this, &PatchView::poly_changed)); - - _canvas->grab_focus(); -} - - -PatchView::~PatchView() -{ - //cerr << "Destroying view for " << _patch->path() << endl; -} - - -SharedPtr -PatchView::create(SharedPtr patch) - -{ - const Glib::RefPtr& xml = GladeFactory::new_glade_reference("patch_view_box"); - PatchView* result = NULL; - xml->get_widget_derived("patch_view_box", result); - assert(result); - result->set_patch(patch); - return SharedPtr(result); -} - - -void -PatchView::on_editable_sig(bool editable) -{ - _edit_mode_but->set_active(editable); - _canvas->lock(!editable); -} - - -void -PatchView::editable_toggled() -{ - const bool editable = _edit_mode_but->get_active(); - _patch->set_editable(editable); - _canvas->lock(!editable); -} - - -void -PatchView::process_toggled() -{ - if (!_enable_signal) - return; - - App::instance().engine()->set_property(_patch->path(), "ingen:enabled", - (bool)_process_but->get_active()); -} - - -void -PatchView::poly_changed() -{ - App::instance().engine()->set_property(_patch->path(), "ingen:polyphony", - _poly_spin->get_value_as_int()); -} - - -void -PatchView::clear_clicked() -{ - App::instance().engine()->clear_patch(_patch->path()); -} - - -void -PatchView::refresh_clicked() -{ - App::instance().engine()->request_object(_patch->path()); -} - - -void -PatchView::property_changed(const std::string& predicate, const Raul::Atom& value) -{ - _enable_signal = false; - if (predicate == "ingen:enabled" && value.type() == Atom::BOOL) - _process_but->set_active(value.get_bool()); - _enable_signal = true; -} - - -} // namespace GUI -} // namespace Ingen diff --git a/src/libs/gui/PatchView.hpp b/src/libs/gui/PatchView.hpp deleted file mode 100644 index 2c0570bd..00000000 --- a/src/libs/gui/PatchView.hpp +++ /dev/null @@ -1,105 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef PATCHVIEW_H -#define PATCHVIEW_H - -#include -#include -#include -#include -#include -#include "client/PatchModel.hpp" - -using std::string; - -namespace Ingen { namespace Client { - class PortModel; - class MetadataModel; -} } -using namespace Ingen::Client; - - -namespace Ingen { -namespace GUI { - -class PatchCanvas; -class LoadPluginWindow; -class NewSubpatchWindow; -class LoadSubpatchWindow; -class NewSubpatchWindow; -class NodeControlWindow; -class PatchDescriptionWindow; -class SubpatchModule; -class OmPort; - - -/** The patch specific contents of a PatchWindow (ie the canvas and whatever else). - * - * \ingroup GUI - */ -class PatchView : public Gtk::Box -{ -public: - PatchView(BaseObjectType* cobject, const Glib::RefPtr& glade_xml); - ~PatchView(); - - SharedPtr canvas() const { return _canvas; } - SharedPtr patch() const { return _patch; } - Gtk::Viewport* breadcrumb_container() const { return _breadcrumb_container; } - - static SharedPtr create(SharedPtr patch); - -private: - void set_patch(SharedPtr patch); - - void process_toggled(); - void poly_changed(); - void clear_clicked(); - void refresh_clicked(); - void on_editable_sig(bool locked); - void editable_toggled(); - - void property_changed(const std::string& predicate, const Raul::Atom& value); - - void zoom_full(); - - SharedPtr _patch; - SharedPtr _canvas; - - Gtk::ScrolledWindow* _canvas_scrolledwindow; - - Gtk::Toolbar* _toolbar; - Gtk::ToggleToolButton* _process_but; - Gtk::SpinButton* _poly_spin; - Gtk::ToolButton* _clear_but; - Gtk::ToolButton* _destroy_but; - Gtk::ToolButton* _refresh_but; - Gtk::ToolButton* _save_but; - Gtk::ToolButton* _zoom_normal_but; - Gtk::ToolButton* _zoom_full_but; - Gtk::ToggleToolButton* _edit_mode_but; - Gtk::Viewport* _breadcrumb_container; - - bool _enable_signal; -}; - - -} // namespace GUI -} // namespace Ingen - -#endif // PATCHVIEW_H diff --git a/src/libs/gui/PatchWindow.cpp b/src/libs/gui/PatchWindow.cpp deleted file mode 100644 index d7499bfb..00000000 --- a/src/libs/gui/PatchWindow.cpp +++ /dev/null @@ -1,556 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "PatchWindow.hpp" -#include -#include -#include -#include "interface/EngineInterface.hpp" -#include "client/PatchModel.hpp" -#include "client/ClientStore.hpp" -#include "App.hpp" -#include "PatchCanvas.hpp" -#include "LoadPluginWindow.hpp" -#include "NewSubpatchWindow.hpp" -#include "LoadPatchWindow.hpp" -#include "LoadSubpatchWindow.hpp" -#include "NodeControlWindow.hpp" -#include "PatchPropertiesWindow.hpp" -#include "Configuration.hpp" -#include "MessagesWindow.hpp" -#include "PatchTreeWindow.hpp" -#include "BreadCrumbBox.hpp" -#include "ConnectWindow.hpp" -#include "ThreadedLoader.hpp" -#include "WindowFactory.hpp" -#include "PatchView.hpp" - -namespace Ingen { -namespace GUI { - - -PatchWindow::PatchWindow(BaseObjectType* cobject, const Glib::RefPtr& xml) - : Gtk::Window(cobject) - , _enable_signal(true) - , _position_stored(false) - , _x(0) - , _y(0) - , _breadcrumb_box(NULL) -{ - property_visible() = false; - - xml->get_widget("patch_win_vbox", _vbox); - xml->get_widget("patch_win_viewport", _viewport); - //xml->get_widget("patch_win_status_bar", _status_bar); - //xml->get_widget("patch_open_menuitem", _menu_open); - xml->get_widget("patch_import_menuitem", _menu_import); - xml->get_widget("patch_import_location_menuitem", _menu_import_location); - //xml->get_widget("patch_open_into_menuitem", _menu_open_into); - xml->get_widget("patch_save_menuitem", _menu_save); - xml->get_widget("patch_save_as_menuitem", _menu_save_as); - xml->get_widget("patch_upload_menuitem", _menu_upload); - xml->get_widget("patch_cut_menuitem", _menu_cut); - xml->get_widget("patch_copy_menuitem", _menu_copy); - xml->get_widget("patch_paste_menuitem", _menu_paste); - xml->get_widget("patch_delete_menuitem", _menu_delete); - xml->get_widget("patch_select_all_menuitem", _menu_select_all); - xml->get_widget("patch_close_menuitem", _menu_close); - xml->get_widget("patch_quit_menuitem", _menu_quit); - xml->get_widget("patch_view_control_window_menuitem", _menu_view_control_window); - xml->get_widget("patch_view_engine_window_menuitem", _menu_view_engine_window); - xml->get_widget("patch_properties_menuitem", _menu_view_patch_properties); - xml->get_widget("patch_fullscreen_menuitem", _menu_fullscreen); - xml->get_widget("patch_human_names_menuitem", _menu_human_names); - xml->get_widget("patch_arrange_menuitem", _menu_arrange); - xml->get_widget("patch_clear_menuitem", _menu_clear); - xml->get_widget("patch_destroy_menuitem", _menu_destroy_patch); - xml->get_widget("patch_view_messages_window_menuitem", _menu_view_messages_window); - xml->get_widget("patch_view_patch_tree_window_menuitem", _menu_view_patch_tree_window); - xml->get_widget("patch_help_about_menuitem", _menu_help_about); - - _menu_view_control_window->property_sensitive() = false; - //m_status_bar->push(App::instance().engine()->engine_url()); - //m_status_bar->pack_start(*Gtk::manage(new Gtk::Image(Gtk::Stock::CONNECT, Gtk::ICON_SIZE_MENU)), false, false); - - /*_menu_open->signal_activate().connect( - sigc::mem_fun(this, &PatchWindow::event_open));*/ - _menu_import->signal_activate().connect( - sigc::mem_fun(this, &PatchWindow::event_import)); - _menu_import_location->signal_activate().connect( - sigc::mem_fun(this, &PatchWindow::event_import_location)); - _menu_save->signal_activate().connect( - sigc::mem_fun(this, &PatchWindow::event_save)); - _menu_save_as->signal_activate().connect( - sigc::mem_fun(this, &PatchWindow::event_save_as)); - _menu_upload->signal_activate().connect( - sigc::mem_fun(this, &PatchWindow::event_upload)); - _menu_copy->signal_activate().connect( - sigc::mem_fun(this, &PatchWindow::event_copy)); - _menu_paste->signal_activate().connect( - sigc::mem_fun(this, &PatchWindow::event_paste)); - _menu_delete->signal_activate().connect( - sigc::mem_fun(this, &PatchWindow::event_delete)); - _menu_select_all->signal_activate().connect( - sigc::mem_fun(this, &PatchWindow::event_select_all)); - _menu_quit->signal_activate().connect( - sigc::mem_fun(this, &PatchWindow::event_quit)); - _menu_fullscreen->signal_activate().connect( - sigc::mem_fun(this, &PatchWindow::event_fullscreen_toggled)); - _menu_human_names->signal_activate().connect( - sigc::mem_fun(this, &PatchWindow::event_human_names_toggled)); - _menu_arrange->signal_activate().connect( - sigc::mem_fun(this, &PatchWindow::event_arrange)); - _menu_view_engine_window->signal_activate().connect( - sigc::mem_fun(this, &PatchWindow::event_show_engine)); - _menu_view_control_window->signal_activate().connect( - sigc::mem_fun(this, &PatchWindow::event_show_controls)); - _menu_view_patch_properties->signal_activate().connect( - sigc::mem_fun(this, &PatchWindow::event_show_properties)); - _menu_destroy_patch->signal_activate().connect( - sigc::mem_fun(this, &PatchWindow::event_destroy)); - _menu_clear->signal_activate().connect( - sigc::mem_fun(this, &PatchWindow::event_clear)); - _menu_view_messages_window->signal_activate().connect( - sigc::mem_fun(App::instance().messages_dialog(), &MessagesWindow::present)); - _menu_view_patch_tree_window->signal_activate().connect( - sigc::mem_fun(App::instance().patch_tree(), &PatchTreeWindow::present)); - - _menu_help_about->signal_activate().connect(sigc::hide_return( - sigc::mem_fun(App::instance(), &App::show_about))); - - _breadcrumb_box = new BreadCrumbBox(); - _breadcrumb_box->signal_patch_selected.connect(sigc::mem_fun(this, &PatchWindow::set_patch_from_path)); - -#ifndef HAVE_CURL - _menu_upload->hide(); -#endif - - Glib::RefPtr clipboard = Gtk::Clipboard::get(); - clipboard->signal_owner_change().connect(sigc::mem_fun(this, &PatchWindow::event_clipboard_changed)); -} - - -PatchWindow::~PatchWindow() -{ - // Prevents deletion - //m_patch->claim_patch_view(); - - delete _breadcrumb_box; -} - - -/** Set the patch controller from a Path (for use by eg. BreadCrumbBox) - */ -void -PatchWindow::set_patch_from_path(const Path& path, SharedPtr view) -{ - if (view) { - assert(view->patch()->path() == path); - App::instance().window_factory()->present_patch(view->patch(), this, view); - } else { - SharedPtr model = PtrCast(App::instance().store()->object(path)); - if (model) - App::instance().window_factory()->present_patch(model, this); - } -} - - -/** Sets the patch controller for this window and initializes everything. - * - * If @a view is NULL, a new view will be created. - */ -void -PatchWindow::set_patch(SharedPtr patch, SharedPtr view) -{ - if (!patch || patch == _patch) - return; - - _enable_signal = false; - - new_port_connection.disconnect(); - removed_port_connection.disconnect(); - - _patch = patch; - - _view = view; - - if (!_view) - _view = _breadcrumb_box->view(patch->path()); - - if (!_view) - _view = PatchView::create(patch); - - assert(_view); - - // Add view to our viewport - if (_view->get_parent()) - _view->get_parent()->remove(*_view.get()); - - _viewport->remove(); - _viewport->add(*_view.get()); - - - if (_breadcrumb_box->get_parent()) - _breadcrumb_box->get_parent()->remove(*_breadcrumb_box); - - _view->breadcrumb_container()->remove(); - _view->breadcrumb_container()->add(*_breadcrumb_box); - _view->breadcrumb_container()->show(); - - _breadcrumb_box->build(patch->path(), _view); - _breadcrumb_box->show(); - - _menu_view_control_window->property_sensitive() = false; - - for (NodeModel::Ports::const_iterator p = patch->ports().begin(); - p != patch->ports().end(); ++p) { - if ((*p)->type().is_control() && (*p)->is_input()) { - _menu_view_control_window->property_sensitive() = true; - break; - } - } - - int width, height; - get_size(width, height); - _view->canvas()->scroll_to( - ((int)_view->canvas()->width() - width)/2, - ((int)_view->canvas()->height() - height)/2); - - set_title(_patch->path() + " - Ingen"); - - //m_properties_window->patch_model(pc->patch_model()); - - if (patch->path() == "/") - _menu_destroy_patch->set_sensitive(false); - else - _menu_destroy_patch->set_sensitive(true); - - new_port_connection = patch->signal_new_port.connect(sigc::mem_fun(this, &PatchWindow::patch_port_added)); - removed_port_connection = patch->signal_removed_port.connect(sigc::mem_fun(this, &PatchWindow::patch_port_removed)); - show_all(); - - _enable_signal = true; -} - - -void -PatchWindow::patch_port_added(SharedPtr port) -{ - if (port->type().is_control() && port->is_input()) { - _menu_view_control_window->property_sensitive() = true; - } -} - - -void -PatchWindow::patch_port_removed(SharedPtr port) -{ - if (port->type().is_control() && port->is_input()) { - - bool found_control = false; - - for (NodeModel::Ports::const_iterator i = _patch->ports().begin(); i != _patch->ports().end(); ++i) { - if ((*i)->type().is_control() && (*i)->is_input()) { - found_control = true; - break; - } - } - - _menu_view_control_window->property_sensitive() = found_control; - } -} - - - -void -PatchWindow::event_show_engine() -{ - if (_patch) - App::instance().connect_window()->show(); -} - - -void -PatchWindow::event_clipboard_changed(GdkEventOwnerChange* ev) -{ - Glib::RefPtr clipboard = Gtk::Clipboard::get(); - _menu_paste->set_sensitive(clipboard->wait_is_text_available()); -} - - -void -PatchWindow::event_show_controls() -{ - App::instance().window_factory()->present_controls(_patch); -} - - -void -PatchWindow::event_show_properties() -{ - App::instance().window_factory()->present_properties(_patch); -} - - -void -PatchWindow::event_import() -{ - App::instance().window_factory()->present_load_patch(_patch); -} - - -void -PatchWindow::event_import_location() -{ - App::instance().window_factory()->present_load_remote_patch(_patch); -} - - -void -PatchWindow::event_save() -{ - GraphObject::Variables::const_iterator doc = _patch->variables().find("ingen:document"); - if (doc == _patch->variables().end()) - event_save_as(); - else - App::instance().loader()->save_patch(_patch, doc->second.get_string()); -} - - -void -PatchWindow::event_save_as() -{ - Gtk::FileChooserDialog dialog(*this, "Save Patch", Gtk::FILE_CHOOSER_ACTION_SAVE); - - /*Gtk::VBox* box = dialog.get_vbox(); - Gtk::Label warning("Warning: Recursively saving will overwrite any subpatch files \ - without confirmation."); - box->pack_start(warning, false, false, 2); - Gtk::CheckButton recursive_checkbutton("Recursively save all subpatches"); - box->pack_start(recursive_checkbutton, false, false, 0); - recursive_checkbutton.show(); - */ - - dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); - Gtk::Button* save_button = dialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_OK); - save_button->property_has_default() = true; - - // Set current folder to most sensible default - GraphObject::Variables::const_iterator doc = _patch->variables().find("ingen:document"); - if (doc != _patch->variables().end()) - dialog.set_uri(doc->second.get_string()); - else if (App::instance().configuration()->patch_folder().length() > 0) - dialog.set_current_folder(App::instance().configuration()->patch_folder()); - - int result = dialog.run(); - //bool recursive = recursive_checkbutton.get_active(); - - if (result == Gtk::RESPONSE_OK) { - string filename = dialog.get_filename(); - if (filename.length() < 11 || filename.substr(filename.length()-10) != ".ingen.ttl") - filename += ".ingen.ttl"; - - bool confirm = false; - std::fstream fin; - fin.open(filename.c_str(), std::ios::in); - if (fin.is_open()) { // File exists - string msg = "File already exists! Are you sure you want to overwrite "; - msg += filename + "?"; - Gtk::MessageDialog confirm_dialog(*this, - msg, false, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_YES_NO, true); - if (confirm_dialog.run() == Gtk::RESPONSE_YES) - confirm = true; - else - confirm = false; - } else { // File doesn't exist - confirm = true; - } - fin.close(); - - if (confirm) { - App::instance().loader()->save_patch(_patch, filename); - } - } - App::instance().configuration()->set_patch_folder(dialog.get_current_folder()); -} - - -void -PatchWindow::event_upload() -{ - App::instance().window_factory()->present_upload_patch(_patch); -} - - -void -PatchWindow::event_copy() -{ - if (_view) - _view->canvas()->copy_selection(); -} - - -void -PatchWindow::event_paste() -{ - if (_view) - _view->canvas()->paste(); -} - - -void -PatchWindow::event_delete() -{ - if (_view) - _view->canvas()->destroy_selection(); -} - - -void -PatchWindow::event_select_all() -{ - if (_view) - _view->canvas()->select_all(); -} - - -void -PatchWindow::on_show() -{ - if (_position_stored) - move(_x, _y); - - Gtk::Window::on_show(); -} - - -void -PatchWindow::on_hide() -{ - _position_stored = true; - get_position(_x, _y); - Gtk::Window::on_hide(); -} - - -bool -PatchWindow::on_key_press_event(GdkEventKey* event) -{ - bool ret = false; - - ret = _view->canvas()->canvas_key_event(event); - - if (!ret) - ret = Gtk::Window::on_key_press_event(event); - - return ret; -} - - -bool -PatchWindow::on_key_release_event(GdkEventKey* event) -{ - bool ret = false; - - ret = _view->canvas()->canvas_key_event(event); - - if (!ret) - ret = Gtk::Window::on_key_release_event(event); - - return ret; -} - - -void -PatchWindow::event_quit() -{ - Gtk::MessageDialog d(*this, "Would you like to quit just this GUI\nor kill the engine as well?", - true, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_NONE, true); - d.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); - - Gtk::Button* b = d.add_button(Gtk::Stock::REMOVE, 2); // kill - b->set_label("_Kill Engine"); - Gtk::Widget* kill_img = Gtk::manage(new Gtk::Image(Gtk::Stock::CLOSE, Gtk::ICON_SIZE_BUTTON)); - b->set_image(*kill_img); - - b = d.add_button(Gtk::Stock::QUIT, 1); // just exit - b->set_label("_Quit"); - Gtk::Widget* close_img = Gtk::manage(new Gtk::Image(Gtk::Stock::QUIT, Gtk::ICON_SIZE_BUTTON)); - b->set_image(*close_img); - b->grab_default(); - - int ret = d.run(); - if (ret == 1) { - App::instance().quit(); - } else if (ret == 2) { - App::instance().engine()->quit(); - App::instance().quit(); - } - // Otherwise cancelled, do nothing -} - - -void -PatchWindow::event_destroy() -{ - App::instance().engine()->destroy(_patch->path()); -} - - -void -PatchWindow::event_clear() -{ - App::instance().engine()->clear_patch(_patch->path()); -} - - -void -PatchWindow::event_arrange() -{ - _view->canvas()->arrange(false); -} - - -void -PatchWindow::event_fullscreen_toggled() -{ - // FIXME: ugh, use GTK signals to track state and know for sure - static bool is_fullscreen = false; - - if (!is_fullscreen) { - fullscreen(); - is_fullscreen = true; - } else { - unfullscreen(); - is_fullscreen = false; - } -} - - -void -PatchWindow::event_human_names_toggled() -{ - _view->canvas()->show_human_names(_menu_human_names->get_active()); - if (_menu_human_names->get_active()) - App::instance().configuration()->set_name_style(Configuration::HUMAN); - else - App::instance().configuration()->set_name_style(Configuration::PATH); -} - - -} // namespace GUI -} // namespace Ingen diff --git a/src/libs/gui/PatchWindow.hpp b/src/libs/gui/PatchWindow.hpp deleted file mode 100644 index 4d4f0f1e..00000000 --- a/src/libs/gui/PatchWindow.hpp +++ /dev/null @@ -1,155 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef PATCHWINDOW_H -#define PATCHWINDOW_H - -#include -#include -#include -#include -#include -#include -#include -#include "client/PatchModel.hpp" -#include "PatchView.hpp" -using Ingen::Client::PatchModel; - -using std::string; using std::list; - - -namespace Ingen { namespace Client { - class PatchModel; - class PortModel; - class MetadataModel; -} } -using namespace Ingen::Client; - - -namespace Ingen { -namespace GUI { - -class LoadPluginWindow; -class LoadPatchWindow; -class NewSubpatchWindow; -class LoadSubpatchWindow; -class NewSubpatchWindow; -class NodeControlWindow; -class PatchDescriptionWindow; -class SubpatchModule; -class OmPort; -class BreadCrumbBox; - - -/** A window for a patch. - * - * \ingroup GUI - */ -class PatchWindow : public Gtk::Window -{ -public: - PatchWindow(BaseObjectType* cobject, const Glib::RefPtr& glade_xml); - ~PatchWindow(); - - void set_patch_from_path(const Path& path, SharedPtr view); - void set_patch(SharedPtr pc, SharedPtr view); - - SharedPtr patch() const { return _patch; } - - Gtk::MenuItem* menu_view_control_window() { return _menu_view_control_window; } - -protected: - void on_show(); - void on_hide(); - bool on_key_press_event(GdkEventKey* event); - bool on_key_release_event(GdkEventKey* event); - -private: - - void patch_port_added(SharedPtr port); - void patch_port_removed(SharedPtr port); - - void event_import(); - void event_import_location(); - void event_save(); - void event_save_as(); - void event_upload(); - void event_copy(); - void event_paste(); - void event_delete(); - void event_select_all(); - void event_quit(); - void event_destroy(); - void event_clear(); - void event_fullscreen_toggled(); - void event_human_names_toggled(); - void event_arrange(); - void event_show_properties(); - void event_show_controls(); - void event_show_engine(); - void event_clipboard_changed(GdkEventOwnerChange* ev); - - SharedPtr _patch; - SharedPtr _view; - - sigc::connection new_port_connection; - sigc::connection removed_port_connection; - - bool _enable_signal; - bool _position_stored; - int _x; - int _y; - - Gtk::MenuItem* _menu_import; - Gtk::MenuItem* _menu_import_location; - Gtk::MenuItem* _menu_save; - Gtk::MenuItem* _menu_save_as; - Gtk::MenuItem* _menu_upload; - Gtk::MenuItem* _menu_cut; - Gtk::MenuItem* _menu_copy; - Gtk::MenuItem* _menu_paste; - Gtk::MenuItem* _menu_delete; - Gtk::MenuItem* _menu_select_all; - Gtk::MenuItem* _menu_close; - Gtk::MenuItem* _menu_quit; - Gtk::CheckMenuItem* _menu_human_names; - Gtk::MenuItem* _menu_fullscreen; - Gtk::MenuItem* _menu_clear; - Gtk::MenuItem* _menu_destroy_patch; - Gtk::MenuItem* _menu_arrange; - Gtk::MenuItem* _menu_view_engine_window; - Gtk::MenuItem* _menu_view_control_window; - Gtk::MenuItem* _menu_view_patch_properties; - Gtk::MenuItem* _menu_view_messages_window; - Gtk::MenuItem* _menu_view_patch_tree_window; - Gtk::MenuItem* _menu_help_about; - - Gtk::VBox* _vbox; - Gtk::Viewport* _viewport; - BreadCrumbBox* _breadcrumb_box; - - //Gtk::Statusbar* _status_bar; - - /** Invisible bin used to store breadcrumbs when not shown by a view */ - Gtk::Alignment _breadcrumb_bin; -}; - - -} // namespace GUI -} // namespace Ingen - -#endif // PATCHWINDOW_H diff --git a/src/libs/gui/Port.cpp b/src/libs/gui/Port.cpp deleted file mode 100644 index 031c74c5..00000000 --- a/src/libs/gui/Port.cpp +++ /dev/null @@ -1,151 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include -#include "interface/EngineInterface.hpp" -#include "flowcanvas/Module.hpp" -#include "client/PatchModel.hpp" -#include "client/PortModel.hpp" -#include "Configuration.hpp" -#include "App.hpp" -#include "Port.hpp" -#include "PortMenu.hpp" -#include "GladeFactory.hpp" - -using namespace Ingen::Client; -using namespace std; - -namespace Ingen { -namespace GUI { - - -/** @param flip Make an input port appear as an output port, and vice versa. - */ -Port::Port( - boost::shared_ptr module, - SharedPtr pm, - const string& name, - bool flip) - : FlowCanvas::Port(module, name, - flip ? (!pm->is_input()) : pm->is_input(), - App::instance().configuration()->get_port_color(pm.get())) - , _port_model(pm) - , _flipped(flip) -{ - assert(module); - assert(_port_model); - - delete _menu; - _menu = NULL; - - _port_model->signal_renamed.connect(sigc::mem_fun(this, &Port::renamed)); - - if (pm->type().is_control()) { - set_toggled(pm->is_toggle()); - show_control(); - - float min = 0.0f, max = 1.0f; - boost::shared_ptr parent = PtrCast(_port_model->parent()); - if (parent) - parent->port_value_range(_port_model, min, max); - - set_control_min(min); - set_control_max(max); - - pm->signal_variable.connect(sigc::mem_fun(this, &Port::variable_changed)); - _port_model->signal_value_changed.connect(sigc::mem_fun(this, &Port::value_changed)); - } - - _port_model->signal_activity.connect(sigc::mem_fun(this, &Port::activity)); - - value_changed(_port_model->value()); -} - - -Port::~Port() -{ - App::instance().activity_port_destroyed(this); -} - - -void -Port::create_menu() -{ - PortMenu* menu = NULL; - Glib::RefPtr xml = GladeFactory::new_glade_reference(); - xml->get_widget_derived("object_menu", menu); - menu->init(_port_model, _flipped); - set_menu(menu); -} - - -void -Port::renamed() -{ - set_name(_port_model->path().name()); - module().lock()->resize(); -} - - -void -Port::value_changed(const Atom& value) -{ - if (value.type() == Atom::FLOAT) - FlowCanvas::Port::set_control(value.get_float()); - else - cerr << "WARNING: Unknown port value type " << (unsigned)value.type() << endl; -} - - -void -Port::activity() -{ - App::instance().port_activity(this); -} - - -void -Port::set_control(float value, bool signal) -{ - if (signal) { - if (_port_model->type() == DataType::CONTROL) { - App::instance().engine()->set_port_value(_port_model->path(), Atom(value)); - } else if (_port_model->type() == DataType::EVENT) { - App::instance().engine()->set_port_value(_port_model->path(), - Atom("", 0, NULL)); - } - } - - FlowCanvas::Port::set_control(value); -} - - -void -Port::variable_changed(const string& key, const Atom& value) -{ - if ( (key == "ingen:minimum") && value.type() == Atom::FLOAT) - set_control_min(value.get_float()); - else if ( (key == "ingen:maximum") && value.type() == Atom::FLOAT) - set_control_max(value.get_float()); - else if ( (key == "ingen:toggled") && value.type() == Atom::BOOL) - set_toggled(value.get_bool()); -} - - -} // namespace GUI -} // namespace Ingen diff --git a/src/libs/gui/Port.hpp b/src/libs/gui/Port.hpp deleted file mode 100644 index 7b347194..00000000 --- a/src/libs/gui/Port.hpp +++ /dev/null @@ -1,70 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef GUI_PORT_H -#define GUI_PORT_H - -#include -#include -#include -#include -#include - -namespace Ingen { namespace Client { class PortModel; } } -using Ingen::Client::PortModel; - -namespace Ingen { -namespace GUI { - - -/** A Port on an Module. - * - * \ingroup GUI - */ -class Port : public FlowCanvas::Port -{ -public: - Port(boost::shared_ptr module, - SharedPtr pm, - const std::string& name, - bool flip=false); - - ~Port(); - - SharedPtr model() const { return _port_model; } - - void create_menu(); - - virtual void set_control(float value, bool signal); - void value_changed(const Raul::Atom& value); - void activity(); - -private: - - void variable_changed(const std::string& key, const Raul::Atom& value); - - void renamed(); - - SharedPtr _port_model; - bool _flipped; -}; - - -} // namespace GUI -} // namespace Ingen - -#endif // GUI_PORT_H diff --git a/src/libs/gui/PortMenu.cpp b/src/libs/gui/PortMenu.cpp deleted file mode 100644 index 45b216b6..00000000 --- a/src/libs/gui/PortMenu.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include -#include -#include "interface/EngineInterface.hpp" -#include "client/PortModel.hpp" -#include "App.hpp" -#include "PortMenu.hpp" -#include "WindowFactory.hpp" - -namespace Ingen { -namespace GUI { - - -PortMenu::PortMenu(BaseObjectType* cobject, const Glib::RefPtr& xml) - : ObjectMenu(cobject, xml) - , _patch_port(NULL) -{ -} - - -void -PortMenu::init(SharedPtr port, bool patch_port) -{ - ObjectMenu::init(port); - _patch_port = patch_port; - - if ( ! PtrCast(port->parent()) ) { - _polyphonic_menuitem->set_sensitive(false); - _rename_menuitem->hide(); - _destroy_menuitem->hide(); - } - - _enable_signal = true; -} - - -void -PortMenu::on_menu_disconnect() -{ - if (_patch_port) { - App::instance().engine()->disconnect_all( - _object->parent()->path(), _object->path()); - } else { - App::instance().engine()->disconnect_all( - _object->parent()->path().parent(), _object->path()); - } -} - - -} // namespace GUI -} // namespace Ingen - diff --git a/src/libs/gui/PortMenu.hpp b/src/libs/gui/PortMenu.hpp deleted file mode 100644 index 520c5809..00000000 --- a/src/libs/gui/PortMenu.hpp +++ /dev/null @@ -1,55 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef PORTMENU_H -#define PORTMENU_H - -#include -#include -#include -#include -#include "client/PortModel.hpp" -#include "ObjectMenu.hpp" - -using Ingen::Client::PortModel; - -namespace Ingen { -namespace GUI { - - -/** Menu for a Port. - * - * \ingroup GUI - */ -class PortMenu : public ObjectMenu -{ -public: - PortMenu(BaseObjectType* cobject, const Glib::RefPtr& xml); - - void init(SharedPtr port, bool patch_port = false); - -private: - void on_menu_disconnect(); - - bool _patch_port; -}; - - -} // namespace GUI -} // namespace Ingen - -#endif // PORTMENU_H diff --git a/src/libs/gui/PortPropertiesWindow.cpp b/src/libs/gui/PortPropertiesWindow.cpp deleted file mode 100644 index ddab5715..00000000 --- a/src/libs/gui/PortPropertiesWindow.cpp +++ /dev/null @@ -1,156 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include -#include "interface/EngineInterface.hpp" -#include "client/NodeModel.hpp" -#include "client/PluginModel.hpp" -#include "App.hpp" -#include "Controls.hpp" -#include "PortPropertiesWindow.hpp" - -using namespace std; - -namespace Ingen { -namespace GUI { - - -PortPropertiesWindow::PortPropertiesWindow(BaseObjectType* cobject, const Glib::RefPtr& xml) - : Gtk::Window(cobject) - , _enable_signal(false) -{ - xml->get_widget("port_properties_min_spinner", _min_spinner); - xml->get_widget("port_properties_max_spinner", _max_spinner); - xml->get_widget("port_properties_cancel_button", _cancel_button); - xml->get_widget("port_properties_ok_button", _ok_button); - - _cancel_button->signal_clicked().connect(sigc::mem_fun(this, - &PortPropertiesWindow::cancel)); - - _ok_button->signal_clicked().connect(sigc::mem_fun(this, - &PortPropertiesWindow::ok)); -} - - -/** Set the port this window is associated with. - * This function MUST be called before using this object in any way. - */ -void -PortPropertiesWindow::present(SharedPtr pm) -{ - assert(pm); - - for (list::iterator i = _connections.begin(); i != _connections.end(); ++i) - (*i).disconnect(); - - _connections.clear(); - - _port_model = pm; - - set_title(pm->path() + " Properties"); - - float min = 0.0f, max = 1.0f; - boost::shared_ptr parent = PtrCast(_port_model->parent()); - if (parent) - parent->port_value_range(_port_model, min, max); - - _initial_min = min; - _initial_max = max; - - _min_spinner->set_value(min); - _connections.push_back(_min_spinner->signal_value_changed().connect( - sigc::mem_fun(*this, &PortPropertiesWindow::min_changed))); - - _max_spinner->set_value(max); - _connections.push_back(_max_spinner->signal_value_changed().connect( - sigc::mem_fun(*this, &PortPropertiesWindow::max_changed))); - - _connections.push_back(pm->signal_variable.connect( - sigc::mem_fun(this, &PortPropertiesWindow::variable_change))); - - _enable_signal = true; - - Gtk::Window::present(); -} - - -void -PortPropertiesWindow::variable_change(const string& key, const Atom& value) -{ - _enable_signal = false; - - if ( (key == "ingen:minimum") && value.type() == Atom::FLOAT) - _min_spinner->set_value(value.get_float()); - else if ( (key == "ingen:maximum") && value.type() == Atom::FLOAT) - _max_spinner->set_value(value.get_float()); - - _enable_signal = true; -} - - -void -PortPropertiesWindow::min_changed() -{ - const float min = _min_spinner->get_value(); - float max = _max_spinner->get_value(); - - if (max <= min) { - max = min + 1.0; - _max_spinner->set_value(max); - } - - if (_enable_signal) - App::instance().engine()->set_variable(_port_model->path(), "ingen:minimum", min); -} - - -void -PortPropertiesWindow::max_changed() -{ - float min = _min_spinner->get_value(); - const float max = _max_spinner->get_value(); - - if (min >= max) { - min = max - 1.0; - _min_spinner->set_value(min); - } - - if (_enable_signal) - App::instance().engine()->set_variable(_port_model->path(), "ingen:maximum", max); -} - - -void -PortPropertiesWindow::cancel() -{ - App::instance().engine()->set_variable(_port_model->path(), "ingen:minimum", _initial_min); - App::instance().engine()->set_variable(_port_model->path(), "ingen:maximum", _initial_max); - hide(); -} - - -void -PortPropertiesWindow::ok() -{ - hide(); -} - - -} // namespace GUI -} // namespace Ingen - diff --git a/src/libs/gui/PortPropertiesWindow.hpp b/src/libs/gui/PortPropertiesWindow.hpp deleted file mode 100644 index 4580c7c6..00000000 --- a/src/libs/gui/PortPropertiesWindow.hpp +++ /dev/null @@ -1,68 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef PORTPROPERTIESWINDOW_H -#define PORTPROPERTIESWINDOW_H - -#include -#include -#include -#include "client/PortModel.hpp" -using namespace Ingen::Client; - -namespace Ingen { -namespace GUI { - - -/** Port properties window. - * - * Loaded by libglade as a derived object. - * - * \ingroup GUI - */ -class PortPropertiesWindow : public Gtk::Window -{ -public: - PortPropertiesWindow(BaseObjectType* cobject, const Glib::RefPtr& refGlade); - - void present(SharedPtr port_model); - -private: - void variable_change(const string& key, const Atom& value); - void min_changed(); - void max_changed(); - - void ok(); - void cancel(); - - bool _enable_signal; - - float _initial_min; - float _initial_max; - - SharedPtr _port_model; - Gtk::SpinButton* _min_spinner; - Gtk::SpinButton* _max_spinner; - Gtk::Button* _cancel_button; - Gtk::Button* _ok_button; - std::list _connections; -}; - -} // namespace GUI -} // namespace Ingen - -#endif // PORTPROPERTIESWINDOW_H diff --git a/src/libs/gui/RenameWindow.cpp b/src/libs/gui/RenameWindow.cpp deleted file mode 100644 index b9c252d0..00000000 --- a/src/libs/gui/RenameWindow.cpp +++ /dev/null @@ -1,119 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include -#include "interface/EngineInterface.hpp" -#include "client/ObjectModel.hpp" -#include "client/ClientStore.hpp" -#include "App.hpp" -#include "RenameWindow.hpp" - -using std::string; - -namespace Ingen { -namespace GUI { - - -RenameWindow::RenameWindow(BaseObjectType* cobject, const Glib::RefPtr& glade_xml) -: Gtk::Window(cobject) -{ - glade_xml->get_widget("rename_name_entry", _name_entry); - glade_xml->get_widget("rename_message_label", _message_label); - glade_xml->get_widget("rename_cancel_button", _cancel_button); - glade_xml->get_widget("rename_ok_button", _ok_button); - - _name_entry->signal_changed().connect(sigc::mem_fun(this, &RenameWindow::name_changed)); - _cancel_button->signal_clicked().connect(sigc::mem_fun(this, &RenameWindow::cancel_clicked)); - _ok_button->signal_clicked().connect(sigc::mem_fun(this, &RenameWindow::ok_clicked)); - - _ok_button->property_sensitive() = false; -} - - -/** Set the object this window is renaming. - * This function MUST be called before using this object in any way. - */ -void -RenameWindow::set_object(SharedPtr object) -{ - _object = object; - _name_entry->set_text(object->path().name()); -} - - -/** Called every time the user types into the name input box. - * Used to display warning messages, and enable/disable the rename button. - */ -void -RenameWindow::name_changed() -{ - assert(_name_entry); - assert(_message_label); - assert(_object); - assert(_object->parent()); - - string name = _name_entry->get_text(); - if (name.find("/") != string::npos) { - _message_label->set_text("Name may not contain '/'"); - _ok_button->property_sensitive() = false; - } else if (!Path::is_valid_name(name)) { - _message_label->set_text("Name contains invalid characters"); - _ok_button->property_sensitive() = false; - } else if ((App::instance().store()->object(_object->parent()->path().base() + name)) && - (name != _object->path().name())) { - _message_label->set_text("An object already exists with that name."); - _ok_button->property_sensitive() = false; - } else if (name.length() == 0) { - _message_label->set_text(""); - _ok_button->property_sensitive() = false; - } else { - _message_label->set_text(""); - _ok_button->property_sensitive() = true; - } -} - - -void -RenameWindow::cancel_clicked() -{ - _name_entry->set_text(""); - hide(); -} - - -/** Rename the object. - * - * It shouldn't be possible for this to be called with an invalid name set - * (since the Rename button should be deactivated). This is just shinification - * though - the engine will handle invalid names gracefully. - */ -void -RenameWindow::ok_clicked() -{ - string name = _name_entry->get_text(); - assert(name.length() > 0); - assert(name.find("/") == string::npos); - - App::instance().engine()->rename(_object->path(), name); - - hide(); -} - - -} // namespace GUI -} // namespace Ingen diff --git a/src/libs/gui/RenameWindow.hpp b/src/libs/gui/RenameWindow.hpp deleted file mode 100644 index 3cf37f7c..00000000 --- a/src/libs/gui/RenameWindow.hpp +++ /dev/null @@ -1,60 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef RENAMEWINDOW_H -#define RENAMEWINDOW_H - -#include -#include -#include -#include "client/ObjectModel.hpp" -using Ingen::Client::ObjectModel; - -namespace Ingen { -namespace GUI { - - -/** Rename window. Handles renaming of any (Ingen) object. - * - * \ingroup GUI - */ -class RenameWindow : public Gtk::Window -{ -public: - RenameWindow(BaseObjectType* cobject, const Glib::RefPtr& refGlade); - - void present(SharedPtr object) { set_object(object); Gtk::Window::present(); } - -private: - void set_object(SharedPtr object); - - void name_changed(); - void cancel_clicked(); - void ok_clicked(); - - SharedPtr _object; - - Gtk::Entry* _name_entry; - Gtk::Label* _message_label; - Gtk::Button* _cancel_button; - Gtk::Button* _ok_button; -}; - -} // namespace GUI -} // namespace Ingen - -#endif // RENAMEWINDOW_H diff --git a/src/libs/gui/SubpatchModule.cpp b/src/libs/gui/SubpatchModule.cpp deleted file mode 100644 index b2a4d43f..00000000 --- a/src/libs/gui/SubpatchModule.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "SubpatchModule.hpp" -#include -#include -#include "interface/EngineInterface.hpp" -#include "client/PatchModel.hpp" -#include "App.hpp" -#include "NodeModule.hpp" -#include "NodeControlWindow.hpp" -#include "PatchWindow.hpp" -#include "PatchCanvas.hpp" -#include "Port.hpp" -#include "WindowFactory.hpp" -using std::cerr; using std::cout; using std::endl; - -namespace Ingen { -namespace GUI { - - -SubpatchModule::SubpatchModule(boost::shared_ptr canvas, SharedPtr patch) -: NodeModule(canvas, patch), - _patch(patch) -{ - assert(canvas); - assert(patch); -} - - -void -SubpatchModule::on_double_click(GdkEventButton* event) -{ - assert(_patch); - - SharedPtr parent = PtrCast(_patch->parent()); - - PatchWindow* const preferred = ( (parent && (event->state & GDK_SHIFT_MASK)) - ? NULL - : App::instance().window_factory()->patch_window(parent) ); - - App::instance().window_factory()->present_patch(_patch, preferred); -} - - - -/** Browse to this patch in current (parent's) window - * (unless an existing window is displaying it) - */ -void -SubpatchModule::browse_to_patch() -{ - assert(_patch->parent()); - - SharedPtr parent = PtrCast(_patch->parent()); - - PatchWindow* const preferred = ( (parent) - ? App::instance().window_factory()->patch_window(parent) - : NULL ); - - App::instance().window_factory()->present_patch(_patch, preferred); -} - - - -void -SubpatchModule::show_dialog() -{ - cerr << "FIXME: dialog\n"; - //m_patch->show_control_window(); -} - - -void -SubpatchModule::menu_remove() -{ - App::instance().engine()->destroy(_patch->path()); -} - -} // namespace GUI -} // namespace Ingen diff --git a/src/libs/gui/SubpatchModule.hpp b/src/libs/gui/SubpatchModule.hpp deleted file mode 100644 index 44e37e62..00000000 --- a/src/libs/gui/SubpatchModule.hpp +++ /dev/null @@ -1,71 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - - -#ifndef SUBPATCHMODULE_H -#define SUBPATCHMODULE_H - -#include -#include -#include -#include "client/PatchModel.hpp" -#include "PatchPortModule.hpp" -#include "NodeModule.hpp" -using std::string; using std::list; - -namespace Ingen { namespace Client { - class PatchModel; - class NodeModel; - class PortModel; - class PatchWindow; -} } -using namespace Ingen::Client; - -namespace Ingen { -namespace GUI { - -class PatchCanvas; -class NodeControlWindow; - - -/** A module to represent a subpatch - * - * \ingroup GUI - */ -class SubpatchModule : public NodeModule -{ -public: - SubpatchModule(boost::shared_ptr canvas, SharedPtr controller); - virtual ~SubpatchModule() {} - - void on_double_click(GdkEventButton* ev); - - void show_dialog(); - void browse_to_patch(); - void menu_remove(); - - SharedPtr patch() { return _patch; } - -protected: - SharedPtr _patch; -}; - - -} // namespace GUI -} // namespace Ingen - -#endif // SUBPATCHMODULE_H diff --git a/src/libs/gui/ThreadedLoader.cpp b/src/libs/gui/ThreadedLoader.cpp deleted file mode 100644 index 008b14c4..00000000 --- a/src/libs/gui/ThreadedLoader.cpp +++ /dev/null @@ -1,155 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include -#include "module/global.hpp" -#include "module/World.hpp" -#include "module/Module.hpp" -#include "client/PatchModel.hpp" -#include "App.hpp" -#include "ThreadedLoader.hpp" - -using namespace std; - -namespace Ingen { -namespace GUI { - - -ThreadedLoader::ThreadedLoader(SharedPtr engine) - : _engine(engine) - , _deprecated_loader(engine) -{ - set_name("Loader"); - - if (parser()) - start(); - else - cerr << "WARNING: Failed to load ingen_serialisation module, load disabled." << endl; -} - - -SharedPtr -ThreadedLoader::parser() -{ - if (_parser) - return _parser; - - World* world = App::instance().world(); - if (!world->serialisation_module) - world->serialisation_module = Ingen::Shared::load_module("ingen_serialisation"); - - if (world->serialisation_module) { - Parser* (*new_parser)() = NULL; - - bool found = App::instance().world()->serialisation_module->get_symbol( - "new_parser", (void*&)new_parser); - - if (found) - _parser = SharedPtr(new_parser()); - } - - return _parser; -} - - -void -ThreadedLoader::_whipped() -{ - _mutex.lock(); - - while ( ! _events.empty() ) { - _events.front()(); - _events.pop_front(); - } - - _mutex.unlock(); -} - -void -ThreadedLoader::load_patch(bool merge, - const Glib::ustring& data_base_uri, - const Path& data_path, - GraphObject::Variables engine_data, - optional engine_parent, - optional engine_symbol) -{ - _mutex.lock(); - - // FIXME: Filthy hack to load deprecated patches based on file extension - if (data_base_uri.substr(data_base_uri.length()-3) == ".om") { - _events.push_back(sigc::hide_return(sigc::bind( - sigc::mem_fun(_deprecated_loader, &DeprecatedLoader::load_patch), - data_base_uri, - engine_parent, - (engine_symbol) ? engine_symbol.get() : "", - engine_data, - false))); - } else { - Glib::ustring engine_base = ""; - if (engine_parent) { - if (merge) - engine_base = engine_parent.get(); - else - engine_base = engine_parent.get().base(); - } - - if (merge && (!engine_parent || engine_parent.get() == "/")) - engine_base = engine_base.substr(0, engine_base.find_last_of("/")); - - _events.push_back(sigc::hide_return(sigc::bind( - sigc::mem_fun(_parser.get(), &Ingen::Serialisation::Parser::parse_document), - App::instance().world(), - App::instance().world()->engine.get(), - data_base_uri, // document - data_base_uri + data_path.substr(1), // object URI document - engine_base, - engine_symbol, - engine_data))); - } - - whip(); - - _mutex.unlock(); -} - - -void -ThreadedLoader::save_patch(SharedPtr model, const string& filename) -{ - _mutex.lock(); - - _events.push_back(sigc::hide_return(sigc::bind( - sigc::mem_fun(this, &ThreadedLoader::save_patch_event), - model, filename))); - - _mutex.unlock(); - - whip(); -} - - -void -ThreadedLoader::save_patch_event(SharedPtr model, const string& filename) -{ - if (App::instance().serialiser()) - App::instance().serialiser()->to_file(model, filename); -} - - -} // namespace GUI -} // namespace Ingen diff --git a/src/libs/gui/ThreadedLoader.hpp b/src/libs/gui/ThreadedLoader.hpp deleted file mode 100644 index 3cf88cf9..00000000 --- a/src/libs/gui/ThreadedLoader.hpp +++ /dev/null @@ -1,92 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef THREADEDLOADER_H -#define THREADEDLOADER_H - -#include -#include -#include -#include -#include -#include -#include -#include "interface/EngineInterface.hpp" -#include "client/PatchModel.hpp" -#include "client/DeprecatedLoader.hpp" -#include "serialisation/Serialiser.hpp" -#include "serialisation/Parser.hpp" -using std::string; -using std::list; -using boost::optional; - -using namespace Ingen::Client; -using namespace Ingen::Serialisation; - -namespace Ingen { -namespace GUI { - - -/** Thread for loading patch files. - * - * This is a seperate thread so it can send all the loading message without - * blocking everything else, so the app can respond to the incoming events - * caused as a result of the patch loading, while the patch loads. - * - * Implemented as a slave with a list of closures (events) which processes - * all events in the (mutex protected) list each time it's whipped. - * - * \ingroup GUI - */ -class ThreadedLoader : public Raul::Slave -{ -public: - ThreadedLoader(SharedPtr engine); - - void load_patch(bool merge, - const Glib::ustring& data_base_uri, - const Path& data_path, - GraphObject::Variables engine_data, - optional engine_parent = optional(), - optional engine_symbol = optional()); - - void save_patch(SharedPtr model, const string& filename); - - SharedPtr parser(); - -private: - - void save_patch_event(SharedPtr model, const string& filename); - - /** Returns nothing and takes no parameters (because they have all been bound) */ - typedef sigc::slot Closure; - - void _whipped(); - - SharedPtr _engine; - SharedPtr _parser; - - DeprecatedLoader _deprecated_loader; - Glib::Mutex _mutex; - list _events; -}; - - -} // namespace GUI -} // namespace Ingen - -#endif // LOADERRTHREAD_H diff --git a/src/libs/gui/UploadPatchWindow.cpp b/src/libs/gui/UploadPatchWindow.cpp deleted file mode 100644 index 2ca54f3c..00000000 --- a/src/libs/gui/UploadPatchWindow.cpp +++ /dev/null @@ -1,282 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include -#include -#include -#include -#include -#include -#include "module/global.hpp" -#include "module/World.hpp" -#include "client/ClientStore.hpp" -#include "interface/EngineInterface.hpp" -#include "serialisation/Serialiser.hpp" -#include "client/PatchModel.hpp" -#include "UploadPatchWindow.hpp" -#include "App.hpp" -#include "Configuration.hpp" -#include "ThreadedLoader.hpp" - -using boost::optional; -using namespace Raul; -using namespace std; - -namespace Ingen { -namespace GUI { - - -UploadPatchWindow::UploadPatchWindow(BaseObjectType* cobject, const Glib::RefPtr& xml) - : Gtk::Dialog(cobject) - , _thread(NULL) - , _progress_pct(0) - , _response(0) -{ - xml->get_widget("upload_patch_symbol_entry", _symbol_entry); - xml->get_widget("upload_patch_short_name_entry", _short_name_entry); - xml->get_widget("upload_patch_progress", _upload_progress); - xml->get_widget("upload_patch_cancel_button", _cancel_button); - xml->get_widget("upload_patch_upload_button", _upload_button); - - - _symbol_entry->signal_changed().connect(sigc::mem_fun(this, &UploadPatchWindow::symbol_changed)); - _short_name_entry->signal_changed().connect(sigc::mem_fun(this, &UploadPatchWindow::short_name_changed)); - _cancel_button->signal_clicked().connect(sigc::mem_fun(this, &UploadPatchWindow::cancel_clicked)); - _upload_button->signal_clicked().connect(sigc::mem_fun(this, &UploadPatchWindow::upload_clicked)); -} - - -void -UploadPatchWindow::present(SharedPtr patch) -{ - _patch = patch; - - Gtk::Window::present(); -} - - -void -UploadPatchWindow::on_show() -{ - Gtk::Dialog::on_show(); - - Raul::Atom atom = _patch->get_variable("lv2:symbol"); - if (atom.is_valid()) - _symbol_entry->set_text(atom.get_string()); - - atom = _patch->get_variable("doap:name"); - if (atom.is_valid()) - _short_name_entry->set_text(atom.get_string()); -} - - -void -UploadPatchWindow::on_hide() -{ - Gtk::Dialog::on_hide(); - - delete _thread; - _thread = NULL; -} - - -bool -UploadPatchWindow::is_symbol(const Glib::ustring& s) -{ - if (s.length() == 0) - return false; - - for (unsigned i=0; i < s.length(); ++i) - if ( !( (s[i] >= 'a' && s[i] <= 'z') - || (s[i] >= 'A' && s[i] <= 'Z') - || (s[i] == '_') - || (i > 0 && s[i] >= '0' && s[i] <= '9') ) ) - return false; - - return true; -} - - -void -UploadPatchWindow::symbol_changed() -{ - _upload_button->property_sensitive() = ( - is_symbol(_symbol_entry->get_text()) - && _short_name_entry->get_text().length() > 0); -} - - -void -UploadPatchWindow::short_name_changed() -{ - _upload_button->property_sensitive() = ( - is_symbol(_symbol_entry->get_text()) - && _short_name_entry->get_text().length() > 0); -} - - -size_t -UploadThread::curl_read_cb(void *ptr, size_t size, size_t nmemb, void *data) -{ - assert(size == 1); - - istringstream* ss = (istringstream*)data; - - return ss->readsome((char*)ptr, nmemb); -} - - -int -UploadThread::curl_progress_cb(void *thread, - double dltotal, - double dlnow, - double ultotal, - double ulnow) -{ - UploadThread* me = (UploadThread*)thread; - me->_win->set_progress(min( - (int)(min(ulnow, (double)me->_length) / me->_length * 100.0), - 99)); - return 0; -} - - -UploadThread::UploadThread(UploadPatchWindow* win, const string& str, const string& url) - : Thread("Upload") - , _curl(NULL) - , _headers(NULL) - , _win(win) - , _length(str.length()) - , _stream(str) - , _url(url) -{ - _curl = curl_easy_init(); - _headers = curl_slist_append(NULL, "Content-type: application/x-turtle"); - - curl_easy_setopt(_curl, CURLOPT_URL, url.c_str()); - curl_easy_setopt(_curl, CURLOPT_HTTPHEADER, _headers); - curl_easy_setopt(_curl, CURLOPT_UPLOAD, 1); - curl_easy_setopt(_curl, CURLOPT_READDATA, &_stream); - curl_easy_setopt(_curl, CURLOPT_READFUNCTION, &UploadThread::curl_read_cb); - curl_easy_setopt(_curl, CURLOPT_INFILESIZE, sizeof(char) * str.length()); - curl_easy_setopt(_curl, CURLOPT_NOPROGRESS, FALSE); - curl_easy_setopt(_curl, CURLOPT_PROGRESSFUNCTION, &UploadThread::curl_progress_cb); - curl_easy_setopt(_curl, CURLOPT_PROGRESSDATA, this); -} - - -void -UploadThread::_run() -{ - curl_easy_perform(_curl); - - long response; - curl_easy_getinfo(_curl, CURLINFO_RESPONSE_CODE, &response); - - printf("Server returned %ld\n", response); - - _win->set_response(response); - _win->set_progress(100); - - curl_slist_free_all(_headers); - curl_easy_cleanup(_curl); - - _headers = NULL; - _curl = NULL; -} - - -bool -UploadPatchWindow::progress_callback() -{ - const int progress = _progress_pct.get(); - const int response = _response.get(); - - _upload_progress->set_fraction(progress / 100.0); - - if (progress == 100) { - if (response == 200) { - _upload_progress->set_text("Transfer completed"); - } else { - _upload_progress->set_fraction(0.0); - char status[4]; - snprintf(status, 4, "%d", (unsigned)response); - string msg = "Transfer failed: Server returned "; - msg.append(status); - _upload_progress->set_text(msg); - } - delete _thread; - _thread = NULL; - _upload_button->set_sensitive(true); - return false; - } else { - return true; - } -} - - -void -UploadPatchWindow::upload_clicked() -{ - assert(!_thread); - - Glib::ustring symbol = _symbol_entry->get_text(); - Glib::ustring short_name = _short_name_entry->get_text(); - - GraphObject::Variables extra_rdf; - extra_rdf["lv2:symbol"] = Atom(symbol); - extra_rdf["doap:name"] = Atom(short_name); - - _response = 0; - _progress_pct = 0; - - _upload_progress->set_fraction(0.0); - _upload_progress->set_text(""); - - Serialiser s(*App::instance().world(), App::instance().store()); - - const string uri = string("http://rdf.drobilla.net/ingen_patches/") - .append(symbol).append(".ingen.ttl"); - - const string str = s.to_string(_patch, uri, extra_rdf); - - _thread = new UploadThread(this, str, uri); - - _thread->start(); - - _upload_button->set_sensitive(false); - - Glib::signal_timeout().connect( - sigc::mem_fun(this, &UploadPatchWindow::progress_callback), 100); -} - - -void -UploadPatchWindow::cancel_clicked() -{ - if (_thread) { - delete _thread; - _thread = NULL; - } - - hide(); -} - - -} // namespace GUI -} // namespace Ingen diff --git a/src/libs/gui/UploadPatchWindow.hpp b/src/libs/gui/UploadPatchWindow.hpp deleted file mode 100644 index af064bdb..00000000 --- a/src/libs/gui/UploadPatchWindow.hpp +++ /dev/null @@ -1,104 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef UPLOADPATCHWINDOW_H -#define UPLOADPATCHWINDOW_H - -#include -#include -#include -#include -#include -#include -#include -#include "client/PatchModel.hpp" -#include "client/PluginModel.hpp" -using Ingen::Client::PatchModel; - -namespace Ingen { -namespace GUI { - -class UploadPatchWindow; - - -class UploadThread : public Raul::Thread { -public: - UploadThread(UploadPatchWindow* win, - const string& str, - const string& url); - -private: - static size_t curl_read_cb(void* ptr, size_t size, size_t nmemb, void *stream); - static int curl_progress_cb(void* thread, double dltotal, double dlnow, double ultotal, double ulnow); - - void _run(); - - CURL* _curl; - curl_slist* _headers; - UploadPatchWindow* _win; - size_t _length; - std::istringstream _stream; - std::string _url; -}; - - -/* Upload patch dialog. - * - * \ingroup GUI - */ -class UploadPatchWindow : public Gtk::Dialog -{ -public: - UploadPatchWindow(BaseObjectType* cobject, const Glib::RefPtr& xml); - - void present(SharedPtr patch); - - Gtk::ProgressBar* progress_bar() { return _upload_progress; } - - void set_response(int response) { _response = response; } - void set_progress(int pct) { _progress_pct = pct; } - -private: - bool is_symbol(const Glib::ustring& str); - void symbol_changed(); - void short_name_changed(); - void cancel_clicked(); - void upload_clicked(); - void on_show(); - void on_hide(); - bool progress_callback(); - - UploadThread* _thread; - - SharedPtr _patch; - - Raul::AtomicInt _progress_pct; - Raul::AtomicInt _response; - - Gtk::Entry* _symbol_entry; - Gtk::Entry* _short_name_entry; - Gtk::ProgressBar* _upload_progress; - Gtk::Button* _cancel_button; - Gtk::Button* _upload_button; - -}; - - -} // namespace GUI -} // namespace Ingen - -#endif // UPLOADPATCHWINDOW_H diff --git a/src/libs/gui/WindowFactory.cpp b/src/libs/gui/WindowFactory.cpp deleted file mode 100644 index 125a242b..00000000 --- a/src/libs/gui/WindowFactory.cpp +++ /dev/null @@ -1,381 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include CONFIG_H_PATH -#include "WindowFactory.hpp" -#include "App.hpp" -#include "PatchWindow.hpp" -#include "GladeFactory.hpp" -#include "PatchPropertiesWindow.hpp" -#include "NodePropertiesWindow.hpp" -#include "PortPropertiesWindow.hpp" -#include "NodeControlWindow.hpp" -#include "LoadPluginWindow.hpp" -#include "LoadPatchWindow.hpp" -#include "LoadRemotePatchWindow.hpp" -#include "LoadSubpatchWindow.hpp" -#include "RenameWindow.hpp" -#include "NewSubpatchWindow.hpp" -#ifdef HAVE_CURL -#include "UploadPatchWindow.hpp" -#endif - -namespace Ingen { -namespace GUI { - - -WindowFactory::WindowFactory() - : _load_plugin_win(NULL) - , _load_patch_win(NULL) - , _load_remote_patch_win(NULL) - , _upload_patch_win(NULL) - , _new_subpatch_win(NULL) - , _load_subpatch_win(NULL) - , _patch_properties_win(NULL) - , _node_properties_win(NULL) - , _port_properties_win(NULL) -{ - Glib::RefPtr xml = GladeFactory::new_glade_reference(); - - xml->get_widget_derived("load_plugin_win", _load_plugin_win); - xml->get_widget_derived("load_patch_win", _load_patch_win); - xml->get_widget_derived("load_remote_patch_win", _load_remote_patch_win); - xml->get_widget_derived("new_subpatch_win", _new_subpatch_win); - xml->get_widget_derived("load_subpatch_win", _load_subpatch_win); - xml->get_widget_derived("patch_properties_win", _patch_properties_win); - xml->get_widget_derived("node_properties_win", _node_properties_win); - xml->get_widget_derived("port_properties_win", _port_properties_win); - xml->get_widget_derived("rename_win", _rename_win); - -#ifdef HAVE_CURL - xml->get_widget_derived("upload_patch_win", _upload_patch_win); -#endif -} - - -WindowFactory::~WindowFactory() -{ - for (PatchWindowMap::iterator i = _patch_windows.begin(); i != _patch_windows.end(); ++i) - delete i->second; - - for (ControlWindowMap::iterator i = _control_windows.begin(); i != _control_windows.end(); ++i) - delete i->second; - -} - - -void -WindowFactory::clear() -{ - for (PatchWindowMap::iterator i = _patch_windows.begin(); i != _patch_windows.end(); ++i) - delete i->second; - - _patch_windows.clear(); - - for (ControlWindowMap::iterator i = _control_windows.begin(); i != _control_windows.end(); ++i) - delete i->second; - - _control_windows.clear(); -} - - -/** Returns the number of Patch windows currently visible. - */ -size_t -WindowFactory::num_open_patch_windows() -{ - size_t ret = 0; - for (PatchWindowMap::iterator i = _patch_windows.begin(); i != _patch_windows.end(); ++i) - if (i->second->is_visible()) - ++ret; - - return ret; -} - - - -PatchWindow* -WindowFactory::patch_window(SharedPtr patch) -{ - PatchWindowMap::iterator w = _patch_windows.find(patch->path()); - - return (w == _patch_windows.end()) ? NULL : w->second; -} - - -NodeControlWindow* -WindowFactory::control_window(SharedPtr node) -{ - ControlWindowMap::iterator w = _control_windows.find(node->path()); - - return (w == _control_windows.end()) ? NULL : w->second; -} - - -/** Present a PatchWindow for a Patch. - * - * If @a preferred is not NULL, it will be set to display @a patch if the patch - * does not already have a visible window, otherwise that window will be presented and - * @a preferred left unmodified. - */ -void -WindowFactory::present_patch(SharedPtr patch, PatchWindow* preferred, SharedPtr view) -{ - assert( !view || view->patch() == patch); - - PatchWindowMap::iterator w = _patch_windows.find(patch->path()); - - if (w != _patch_windows.end()) { - (*w).second->present(); - } else if (preferred) { - w = _patch_windows.find(preferred->patch()->path()); - assert((*w).second == preferred); - - preferred->set_patch(patch, view); - _patch_windows.erase(w); - _patch_windows[patch->path()] = preferred; - preferred->present(); - - } else { - PatchWindow* win = new_patch_window(patch, view); - win->present(); - } -} - - -PatchWindow* -WindowFactory::new_patch_window(SharedPtr patch, SharedPtr view) -{ - assert( !view || view->patch() == patch); - - Glib::RefPtr xml = GladeFactory::new_glade_reference("patch_win"); - - PatchWindow* win = NULL; - xml->get_widget_derived("patch_win", win); - assert(win); - - win->set_patch(patch, view); - _patch_windows[patch->path()] = win; - - win->signal_delete_event().connect(sigc::bind<0>( - sigc::mem_fun(this, &WindowFactory::remove_patch_window), win)); - - return win; -} - - -bool -WindowFactory::remove_patch_window(PatchWindow* win, GdkEventAny* ignored) -{ - if (_patch_windows.size() <= 1) { - Gtk::MessageDialog d(*win, "This is the last remaining open patch " - "window. Closing this window will exit the GUI (the engine will " - "remain running).\n\nAre you sure you want to quit?", - true, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_NONE, true); - d.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); - d.add_button(Gtk::Stock::QUIT, Gtk::RESPONSE_CLOSE); - int ret = d.run(); - if (ret == Gtk::RESPONSE_CLOSE) - App::instance().quit(); - else - return true; - } - - PatchWindowMap::iterator w = _patch_windows.find(win->patch()->path()); - - assert((*w).second == win); - _patch_windows.erase(w); - - delete win; - - return false; -} - - -void -WindowFactory::present_controls(SharedPtr node) -{ - NodeControlWindow* win = control_window(node); - - if (win) { - win->present(); - } else { - win = new_control_window(node); - win->present(); - } -} - - -NodeControlWindow* -WindowFactory::new_control_window(SharedPtr node) -{ - uint32_t poly = 1; - if (node->polyphonic() && node->parent()) - poly = ((PatchModel*)node->parent().get())->internal_polyphony(); - - NodeControlWindow* win = new NodeControlWindow(node, poly); - - _control_windows[node->path()] = win; - - win->signal_delete_event().connect(sigc::bind<0>( - sigc::mem_fun(this, &WindowFactory::remove_control_window), win)); - - return win; -} - - -bool -WindowFactory::remove_control_window(NodeControlWindow* win, GdkEventAny* ignored) -{ - ControlWindowMap::iterator w = _control_windows.find(win->node()->path()); - - assert((*w).second == win); - _control_windows.erase(w); - - delete win; - - return true; -} - - -void -WindowFactory::present_load_plugin(SharedPtr patch, GraphObject::Variables data) -{ - PatchWindowMap::iterator w = _patch_windows.find(patch->path()); - - if (w != _patch_windows.end()) - _load_plugin_win->set_transient_for(*w->second); - - _load_plugin_win->set_modal(false); - _load_plugin_win->present(patch, data); -} - - -void -WindowFactory::present_load_patch(SharedPtr patch, GraphObject::Variables data) -{ - PatchWindowMap::iterator w = _patch_windows.find(patch->path()); - - if (w != _patch_windows.end()) - _load_patch_win->set_transient_for(*w->second); - - _load_patch_win->set_merge(); // Import is the only choice - - _load_patch_win->present(patch, data); -} - - -void -WindowFactory::present_load_remote_patch(SharedPtr patch, GraphObject::Variables data) -{ - PatchWindowMap::iterator w = _patch_windows.find(patch->path()); - - if (w != _patch_windows.end()) - _load_remote_patch_win->set_transient_for(*w->second); - - _load_remote_patch_win->set_merge(); // Import is the only choice - - _load_remote_patch_win->present(patch, data); -} - - -void -WindowFactory::present_upload_patch(SharedPtr patch) -{ -#ifdef HAVE_CURL - PatchWindowMap::iterator w = _patch_windows.find(patch->path()); - - if (w != _patch_windows.end()) - _upload_patch_win->set_transient_for(*w->second); - - _upload_patch_win->present(patch); -#endif -} - -void -WindowFactory::present_new_subpatch(SharedPtr patch, GraphObject::Variables data) -{ - PatchWindowMap::iterator w = _patch_windows.find(patch->path()); - - if (w != _patch_windows.end()) - _new_subpatch_win->set_transient_for(*w->second); - - _new_subpatch_win->present(patch, data); -} - - -void -WindowFactory::present_load_subpatch(SharedPtr patch, GraphObject::Variables data) -{ - PatchWindowMap::iterator w = _patch_windows.find(patch->path()); - - if (w != _patch_windows.end()) - _load_subpatch_win->set_transient_for(*w->second); - - _load_subpatch_win->present(patch, data); -} - - -void -WindowFactory::present_rename(SharedPtr object) -{ - PatchWindowMap::iterator w = _patch_windows.find(object->path()); - - if (w != _patch_windows.end()) - _rename_win->set_transient_for(*w->second); - - _rename_win->present(object); -} - - -void -WindowFactory::present_properties(SharedPtr object) -{ - SharedPtr patch = PtrCast(object); - if (patch) { - PatchWindowMap::iterator w = _patch_windows.find(patch->path()); - if (w != _patch_windows.end()) - _patch_properties_win->set_transient_for(*w->second); - - _patch_properties_win->present(patch); - return; - } - - SharedPtr node = PtrCast(object); - if (node) { - PatchWindowMap::iterator w = _patch_windows.find(node->path().parent()); - if (w != _patch_windows.end()) - _node_properties_win->set_transient_for(*w->second); - - _node_properties_win->present(node); - return; - } - - SharedPtr port = PtrCast(object); - if (port) { - PatchWindowMap::iterator w = _patch_windows.find(port->path().parent().parent()); - if (w != _patch_windows.end()) - _patch_properties_win->set_transient_for(*w->second); - - _port_properties_win->present(port); - return; - } -} - - -} // namespace GUI -} // namespace Ingen diff --git a/src/libs/gui/WindowFactory.hpp b/src/libs/gui/WindowFactory.hpp deleted file mode 100644 index 618b027c..00000000 --- a/src/libs/gui/WindowFactory.hpp +++ /dev/null @@ -1,109 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef WINDOW_FACTORY_H -#define WINDOW_FACTORY_H - -#include -#include -#include -#include "interface/GraphObject.hpp" -#include "client/PatchModel.hpp" -#include "PatchView.hpp" - -using Ingen::Client::PatchModel; -using namespace Ingen::Shared; - -namespace Ingen { -namespace GUI { - -class PatchWindow; -class NodeControlWindow; -class PatchPropertiesWindow; -class NodePropertiesWindow; -class PortPropertiesWindow; -class LoadPatchWindow; -class LoadRemotePatchWindow; -class UploadPatchWindow; -class RenameWindow; - - -/** Manager/Factory for all windows. - * - * This serves as a nice centralized spot for all window management issues, - * as well as an enumeration of all windows (the goal being to reduce that - * number as much as possible). - */ -class WindowFactory { -public: - WindowFactory(); - ~WindowFactory(); - - size_t num_open_patch_windows(); - - PatchWindow* patch_window(SharedPtr patch); - NodeControlWindow* control_window(SharedPtr node); - - void present_patch(SharedPtr model, - PatchWindow* preferred = NULL, - SharedPtr view = SharedPtr()); - - void present_controls(SharedPtr node); - - void present_load_plugin(SharedPtr patch, GraphObject::Variables data=GraphObject::Variables()); - void present_load_patch(SharedPtr patch, GraphObject::Variables data=GraphObject::Variables()); - void present_load_remote_patch(SharedPtr patch, GraphObject::Variables data=GraphObject::Variables()); - void present_upload_patch(SharedPtr patch); - void present_new_subpatch(SharedPtr patch, GraphObject::Variables data=GraphObject::Variables()); - void present_load_subpatch(SharedPtr patch, GraphObject::Variables data=GraphObject::Variables()); - void present_rename(SharedPtr object); - void present_properties(SharedPtr object); - - bool remove_patch_window(PatchWindow* win, GdkEventAny* ignored = NULL); - - void clear(); - -private: - typedef std::map PatchWindowMap; - typedef std::map ControlWindowMap; - - PatchWindow* new_patch_window(SharedPtr patch, SharedPtr view); - - - NodeControlWindow* new_control_window(SharedPtr node); - bool remove_control_window(NodeControlWindow* win, GdkEventAny* ignored); - - PatchWindowMap _patch_windows; - ControlWindowMap _control_windows; - - LoadPluginWindow* _load_plugin_win; - LoadPatchWindow* _load_patch_win; - LoadRemotePatchWindow* _load_remote_patch_win; - UploadPatchWindow* _upload_patch_win; - NewSubpatchWindow* _new_subpatch_win; - LoadSubpatchWindow* _load_subpatch_win; - PatchPropertiesWindow* _patch_properties_win; - NodePropertiesWindow* _node_properties_win; - PortPropertiesWindow* _port_properties_win; - RenameWindow* _rename_win; -}; - - -} // namespace GUI -} // namespace Ingen - -#endif // WINDOW_FACTORY_H diff --git a/src/libs/gui/cmdline.h b/src/libs/gui/cmdline.h deleted file mode 100644 index 6f1f9259..00000000 --- a/src/libs/gui/cmdline.h +++ /dev/null @@ -1,86 +0,0 @@ -/* cmdline.h */ - -/* File autogenerated by gengetopt version 2.19.1 */ - -#ifndef CMDLINE_H -#define CMDLINE_H - -/* If we use autoconf. */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#ifndef CMDLINE_PARSER_PACKAGE -#define CMDLINE_PARSER_PACKAGE "ingen" -#endif - -#ifndef CMDLINE_PARSER_VERSION -#define CMDLINE_PARSER_VERSION VERSION -#endif - -struct gengetopt_args_info -{ - const char *help_help; /* Print help and exit help description. */ - const char *version_help; /* Print version and exit help description. */ - int engine_flag; /* Run (JACK) engine (default=off). */ - const char *engine_help; /* Run (JACK) engine help description. */ - int engine_port_arg; /* Engine OSC port (default='16180'). */ - char * engine_port_orig; /* Engine OSC port original value given at command line. */ - const char *engine_port_help; /* Engine OSC port help description. */ - char * connect_arg; /* Connect to existing engine at OSC URI (default='osc.udp://localhost:16180'). */ - char * connect_orig; /* Connect to existing engine at OSC URI original value given at command line. */ - const char *connect_help; /* Connect to existing engine at OSC URI help description. */ - int gui_flag; /* Launch the GTK graphical interface (default=on). */ - const char *gui_help; /* Launch the GTK graphical interface help description. */ - int client_port_arg; /* Client OSC port. */ - char * client_port_orig; /* Client OSC port original value given at command line. */ - const char *client_port_help; /* Client OSC port help description. */ - char * load_arg; /* Load patch. */ - char * load_orig; /* Load patch original value given at command line. */ - const char *load_help; /* Load patch help description. */ - char * path_arg; /* Target path for loaded patch. */ - char * path_orig; /* Target path for loaded patch original value given at command line. */ - const char *path_help; /* Target path for loaded patch help description. */ - - int help_given ; /* Whether help was given. */ - int version_given ; /* Whether version was given. */ - int engine_given ; /* Whether engine was given. */ - int engine_port_given ; /* Whether engine-port was given. */ - int connect_given ; /* Whether connect was given. */ - int gui_given ; /* Whether gui was given. */ - int client_port_given ; /* Whether client-port was given. */ - int load_given ; /* Whether load was given. */ - int path_given ; /* Whether path was given. */ - -} ; - -extern const char *gengetopt_args_info_purpose; -extern const char *gengetopt_args_info_usage; -extern const char *gengetopt_args_info_help[]; - -int cmdline_parser (int argc, char * const *argv, - struct gengetopt_args_info *args_info); -int cmdline_parser2 (int argc, char * const *argv, - struct gengetopt_args_info *args_info, - int override, int initialize, int check_required); -int cmdline_parser_file_save(const char *filename, - struct gengetopt_args_info *args_info); - -void cmdline_parser_print_help(void); -void cmdline_parser_print_version(void); - -void cmdline_parser_init (struct gengetopt_args_info *args_info); -void cmdline_parser_free (struct gengetopt_args_info *args_info); - -int cmdline_parser_required (struct gengetopt_args_info *args_info, - const char *prog_name); - - -#ifdef __cplusplus -} -#endif /* __cplusplus */ -#endif /* CMDLINE_H */ diff --git a/src/libs/gui/gui.cpp b/src/libs/gui/gui.cpp deleted file mode 100644 index 10af6d9b..00000000 --- a/src/libs/gui/gui.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "gui.hpp" -#include "ConnectWindow.hpp" -#include "App.hpp" -#include "Configuration.hpp" - -namespace Ingen { -namespace GUI { - - -void run(int argc, char** argv, Ingen::Shared::World* world) -{ - App::run(argc, argv, world); -} - - -} // namespace GUI -} // namespace Ingen - diff --git a/src/libs/gui/gui.hpp b/src/libs/gui/gui.hpp deleted file mode 100644 index a959f17a..00000000 --- a/src/libs/gui/gui.hpp +++ /dev/null @@ -1,45 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef INGEN_GUI_H -#define INGEN_GUI_H - -#include CONFIG_H_PATH -#include "module/global.hpp" -#include - -namespace Ingen { - -class Engine; - -namespace Shared { class EngineInterface; } - -namespace GUI { - - -extern "C" { - - void run(int argc, char** argv, Ingen::Shared::World* world); - -} - - -} // namesace GUI -} // namespace Ingen - -#endif // INGEN_GUI_H - diff --git a/src/libs/gui/ingen-icon.svg b/src/libs/gui/ingen-icon.svg deleted file mode 100644 index a15ed7e7..00000000 --- a/src/libs/gui/ingen-icon.svg +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - image/svg+xml - - - - - - - - diff --git a/src/libs/gui/ingen.svg b/src/libs/gui/ingen.svg deleted file mode 100644 index a15ed7e7..00000000 --- a/src/libs/gui/ingen.svg +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - image/svg+xml - - - - - - - - diff --git a/src/libs/gui/ingen_gui.glade b/src/libs/gui/ingen_gui.glade deleted file mode 100644 index aa0680ea..00000000 --- a/src/libs/gui/ingen_gui.glade +++ /dev/null @@ -1,3337 +0,0 @@ - - - - - - Ingen - 640 - 480 - ingen.svg - - - True - - - True - - - True - _File - True - - - - - True - Load a patch into the current patch (merge with existing contents). - _Import... - True - - - - - True - gtk-open - 1 - - - - - - - True - Import a patch from a URI - Import _Location... - True - - - - - True - gtk-open - 1 - - - - - - - True - - - - - True - Save this patch - gtk-save - True - True - - - - - - True - Save this patch to a specific file name - Save _As... - True - - - - - True - gtk-save-as - 1 - - - - - - - True - _Upload... - True - - - - - True - gtk-network - 1 - - - - - - - True - - - - - True - Close this window (patch will not be destroyed) - gtk-close - True - True - - - - - - True - - - - - True - Quit GUI (engine may continue running) - gtk-quit - True - True - - - - - - - - - - True - _Edit - True - - - - - True - False - gtk-cut - True - True - - - - - - True - gtk-copy - True - True - - - - - - True - False - gtk-paste - True - True - - - - - - True - Delete the selected object(s) - gtk-delete - True - True - - - - - - - True - Select all objects in a patch - gtk-select-all - True - True - - - - - - - True - - - - - True - Automatically arrange canvas - _Arrange - True - - - - True - gtk-sort-ascending - 1 - - - - - - - True - Remove all objects from patch - gtk-clear - True - True - - - - - - True - Destoy this patch (remove it from the engine) - _Destroy Patch - True - - - - True - gtk-delete - 1 - - - - - - - True - - - - - True - View/Edit controls for this patch - C_ontrols... - True - - - - - True - gtk-preferences - 1 - - - - - - - True - View/Edit properties for this patch - _Properties... - True - - - - - True - gtk-properties - 1 - - - - - - - - - - - True - _View - True - - - - - True - gtk-fullscreen - True - True - - - - - - - True - Show human readable names instead of identifiers - _Human names - True - True - - - - - - - - - - True - _Windows - True - - - - - - True - Connect to, Disconnect from, or Launch Engine - _Engine... - True - - - - - True - gtk-execute - 1 - - - - - - - True - View all patches in the engine as a heirarchial list - _Patch Tree... - True - - - - - True - gtk-index - 1 - - - - - - - True - View error messages from the engine - _Messages... - True - - - - - True - gtk-info - 1 - - - - - - - - - - - True - _Help - True - - - - - - True - Right-click the canvas to add objects - True - - - True - gtk-info - 1 - - - - - - - True - Press 'e' to toggle edit mode - True - - - True - gtk-info - 1 - - - - - - - True - - - - - True - gtk-about - True - True - - - - - - - - - - False - False - - - - - True - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - - - True - GTK_SHADOW_NONE - - - - - - - - 1 - - - - - - - 8 - Load Plugin - GTK_WIN_POS_CENTER_ON_PARENT - 640 - 480 - ingen.svg - - - True - 1 - - - True - True - 2 - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - - - True - True - 2 - True - True - - - - - - - True - 3 - 3 - 12 - - - True - True - Clear filter text (show all plugins) - gtk-clear - True - 0 - - - 2 - 3 - GTK_FILL - - - - - - True - Name contains: - - - GTK_FILL - - - - - - True - True - True - Search string to filter plugin list - * - - - 1 - 2 - 6 - - - - - True - False - True - Add selected plugin to patch - gtk-add - True - 0 - - - 2 - 3 - 2 - 3 - GTK_FILL - - - - - - True - - - True - True - Name of new Module - * - - - - - True - True - Polyphonic - True - 0 - True - True - - - False - False - 8 - 1 - - - - - 1 - 2 - 2 - 3 - GTK_FILL - GTK_FILL - 6 - - - - - True - - - 2 - 3 - 1 - 2 - GTK_FILL - GTK_FILL - - - - - True - - - 1 - 2 - GTK_FILL - GTK_FILL - - - - - True - - - 1 - 2 - 1 - 2 - GTK_FILL - - - - - True - 1 - Node Name: - True - - - 2 - 3 - GTK_FILL - - - - - - False - False - 1 - - - - - - - 320 - 8 - Create Subpatch - GTK_WIN_POS_CENTER_ON_PARENT - ingen.svg - GDK_WINDOW_TYPE_HINT_DIALOG - - - True - - - True - 2 - 2 - - - True - True - True - * - True - - - 1 - 2 - - 4 - - - - - True - True - 1 0 100 1 10 10 - 1 - - - 1 - 2 - 1 - 2 - GTK_FILL - - 4 - - - - - True - 0 - Polyphony: - - - 1 - 2 - GTK_FILL - GTK_EXPAND - 5 - - - - - True - 0 - Name: - - - GTK_FILL - GTK_EXPAND - 5 - - - - - - - True - True - - - False - False - 1 - - - - - True - 4 - GTK_BUTTONBOX_END - - - True - True - gtk-cancel - True - 0 - - - - - True - True - True - True - 0 - - - True - 0 - 0 - - - True - 2 - - - True - gtk-ok - - - False - False - - - - - True - Create - True - - - False - False - 1 - - - - - - - - - 1 - - - - - 2 - - - - - - - Load Subpatch - GTK_WIN_POS_CENTER_ON_PARENT - ingen.svg - GDK_WINDOW_TYPE_HINT_DIALOG - - - True - 24 - - - True - 2 - 4 - 12 - 4 - - - True - - - True - True - Specify the name for the new patch - Specify: - True - 0 - True - load_subpatch_name_from_file_radio - - - False - False - - - - - True - False - True - Specify the name for the new patch - * - True - - - False - 1 - - - - - 3 - 4 - GTK_FILL - - - - - True - 0 - - - 2 - 3 - GTK_FILL - - - - - - True - True - Set polyphony to the same value as the parent (containing) patch - Same as parent (?) - True - 0 - True - load_subpatch_poly_from_file_radio - - - 2 - 3 - 1 - 2 - GTK_FILL - - - - - - True - - - True - True - Specify a custom polyphony value for new patch - Specify: - True - 0 - True - load_subpatch_poly_from_file_radio - - - False - False - - - - - True - False - True - Specify a custom polyphony value for new patch - 1 0 1000 1 10 10 - 1 - - - False - 1 - - - - - 3 - 4 - 1 - 2 - GTK_FILL - GTK_FILL - - - - - True - True - Use the polyphony value stored in the patch file - Load from file - True - 0 - True - True - - - 1 - 2 - 1 - 2 - GTK_FILL - - - - - - True - True - Use the name stored in the patch file - Load from file - True - 0 - True - True - - - 1 - 2 - GTK_FILL - - - - - - True - 0 - <b>Polyphony: </b> - True - - - 1 - 2 - GTK_FILL - - - - - - True - 0 - <b>Name: </b> - True - - - GTK_FILL - - - - - - False - 2 - - - - - True - GTK_BUTTONBOX_END - - - True - True - True - gtk-cancel - True - -6 - - - - - True - True - True - True - gtk-open - True - -5 - - - 1 - - - - - False - GTK_PACK_END - - - - - - - Load Patch - GTK_WIN_POS_CENTER_ON_PARENT - ingen.svg - GDK_WINDOW_TYPE_HINT_DIALOG - - - 24 - - - True - 1 - 4 - 12 - 4 - - - True - - - True - True - Specify: - True - 0 - True - load_patch_poly_from_current_radio - - - False - False - - - - - True - False - True - Specify a custom polyphony value for new patch - 1 0 100 1 10 10 - 1 - - - False - 1 - - - - - 3 - 4 - GTK_FILL - GTK_FILL - - - - - True - True - Use the polyphony value stored in the patch file - Load from file - True - 0 - True - load_patch_poly_from_current_radio - - - 2 - 3 - GTK_FILL - - - - - - True - True - Use the same polyphony as the current patch - Keep current - True - 0 - True - True - - - 1 - 2 - GTK_FILL - - - - - - True - 0 - <b>Polyphony: </b> - True - - - GTK_FILL - - - - - - False - 2 - - - - - True - GTK_BUTTONBOX_END - - - True - True - True - gtk-cancel - True - -6 - - - - - True - True - True - True - gtk-open - True - -5 - - - 1 - - - - - False - GTK_PACK_END - - - - - - - window1 - - - True - 5 - 2 - - - - - - - - - - - - - - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - True - 0 - 1 - 4 - <b>Name</b> - True - True - - - False - False - - - - - True - 1 - 0 - 1 - 1 - 4 - - - True - - - - - 1 - - - - - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 12 - 0 -9.9999999999999999e+45 1.0000000000000001e+63 1 10 10 - 4 - True - - - False - 2 - - - - - False - False - - - - - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 9.0923076923076922e+136 -1e+113 1e+137 0 0 0 - 63 - False - - - False - 1 - - - - - 3 - 4 - 8 - - - - - True - - - 1 - 2 - GTK_FILL - - - - - True - - - True - - - True - GTK_TOOLBAR_BOTH_HORIZ - - - True - - - True - - - True - GTK_SHADOW_NONE - - - - - - - - - - False - False - - - - - True - - - True - - - - - - False - False - - - - - - - True - False - - - True - - - False - False - - - - - True - Enable DSP processing - True - gtk-execute - True - - - False - - - - - True - - - True - 4 - gtk-copy - - - - - False - False - - - - - True - - - True - True - 1 1 512 1 10 10 - 1 - True - - - - - False - False - - - - - True - - - False - False - - - - - True - Save patch to a file - gtk-save - - - False - - - - - True - - - False - False - - - - - True - Clear (Destroy all children) - True - gtk-clear - - - False - - - - - True - Destroy this patch - gtk-delete - - - False - - - - - True - - - False - False - - - - - True - Refresh view - gtk-refresh - - - False - - - - - True - Zoom to normal size - True - gtk-zoom-100 - - - False - - - - - True - Fit patch to window - True - gtk-zoom-fit - - - False - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - False - False - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Enable edit mode to move objects and make connections, disable to play controls ('e' to toggle) - Edit - gtk-edit - True - - - False - - - - - False - 1 - - - - - False - False - - - - - True - True - True - True - True - True - GDK_EXPOSURE_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_MOTION_MASK | GDK_BUTTON1_MOTION_MASK | GDK_BUTTON2_MOTION_MASK | GDK_BUTTON3_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_FOCUS_CHANGE_MASK | GDK_STRUCTURE_MASK | GDK_PROPERTY_CHANGE_MASK | GDK_VISIBILITY_NOTIFY_MASK | GDK_PROXIMITY_IN_MASK | GDK_PROXIMITY_OUT_MASK | GDK_SUBSTRUCTURE_MASK | GDK_SCROLL_MASK - 1 - GTK_SHADOW_IN - - - - - - 1 - - - - - 2 - 3 - GTK_FILL - - - - - True - - - True - 0 - - - True - True - GTK_POLICY_NEVER - GTK_POLICY_AUTOMATIC - - - True - GTK_SHADOW_NONE - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - - - - - - - - - True - True - - - True - True - Apply changed controls to all voices - All Voices - True - 0 - True - - - False - False - - - - - True - 5 - - - True - True - Apply changed controls to one voice only - Specific Voice: - True - 0 - True - control_panel_all_voices_radio - - - False - False - - - - - True - False - True - Voice control changes are applied to - 1 1 100 1 10 10 - 1 - True - - - 1 - - - - - False - False - 1 - - - - - False - 5 - 1 - - - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - True - 0 - 1 - 4 - <b>Name</b> - True - True - - - False - False - - - - - True - 1 - 0 - 1 - 1 - 4 - - - True - - - - - 1 - - - - - True - True - 0 - True - - - False - 2 - - - - - False - False - - - - - 4 - 5 - 8 - - - - - - - 400 - 180 - 8 - Messages - Ingen - ingen.svg - - - True - 6 - - - True - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_IN - - - True - True - Error messages from the engine since the last time "Clear" was pressed - 5 - 5 - False - GTK_WRAP_WORD - 5 - 5 - False - False - - - - - - - True - 6 - GTK_BUTTONBOX_END - - - True - False - True - True - gtk-clear - True - 0 - - - - - True - True - gtk-close - True - 0 - - - 1 - - - - - False - 1 - - - - - - - 8 - Configuration - Ingen - ingen.svg - - - True - 6 - - - True - 2 - 2 - - - True - 0 - - - 1 - 2 - GTK_FILL - - - - - - True - <i>Example: /foo/bar:/home/john/patches:/usr/share/om/patches</i> - True - - - 1 - 2 - 1 - 2 - GTK_FILL - - - - - - True - True - * - - - 1 - 2 - - - - - - True - <b>Patch Search Path: </b> - True - - - GTK_FILL - - - - - - False - - - - - True - 6 - GTK_BUTTONBOX_END - - - True - True - Save these settings for future sessions - gtk-save - True - 0 - - - - - True - True - gtk-cancel - True - 0 - - - 1 - - - - - True - True - Apply these settings to this session only - gtk-ok - True - 0 - - - 2 - - - - - False - 1 - - - - - - - 400 - 200 - 8 - Patch Description - GTK_WIN_POS_CENTER_ON_PARENT - ingen.svg - - - True - 6 - - - True - 5 - - - True - Author: - - - False - False - - - - - True - True - * - - - 1 - - - - - False - False - - - - - True - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_IN - - - True - True - A short description of the patch to be included in the patch file - GTK_WRAP_WORD - - - - - 1 - - - - - True - 5 - GTK_BUTTONBOX_END - - - True - True - True - gtk-cancel - True - 0 - - - - - True - True - True - Apply these changes to be saved the next time the patch is saved - gtk-ok - True - 0 - - - 1 - - - - - False - False - 2 - - - - - - - 250 - Rename - GTK_WIN_POS_CENTER_ON_PARENT - ingen.svg - - - True - 5 - - - True - - - True - New name: - - - False - False - - - - - True - True - * - True - - - 1 - - - - - - - True - True - - - False - 6 - 1 - - - - - True - 5 - GTK_BUTTONBOX_END - - - True - True - True - gtk-cancel - True - 0 - - - - - True - True - True - True - 0 - - - True - 0 - 0 - - - True - 2 - - - True - gtk-ok - - - False - False - - - - - True - Rename - True - - - False - False - 1 - - - - - - - - - 1 - - - - - False - 2 - - - - - - - 8 - Node Properties - Ingen - GTK_WIN_POS_MOUSE - ingen.svg - - - True - - - True - 0 - <b>Node</b> - True - - - False - False - - - - - True - 12 - 6 - - - True - 4 - - - True - Path: - - - False - False - - - - - True - - - - - False - False - 1 - - - - - False - False - - - - - True - False - True - Polyphonic - True - 0 - True - - - False - False - 1 - - - - - 6 - 1 - - - - - 240 - True - 0 - <b>Plugin</b> - True - - - False - False - 2 - - - - - True - 12 - 3 - 2 - 10 - 6 - - - True - 0 - - - - - 1 - 2 - 2 - 3 - GTK_FILL - - - - - - True - 0 - Name: - - - 2 - 3 - GTK_FILL - - - - - - True - 0 - - - - - 1 - 2 - 1 - 2 - GTK_FILL - - - - - - True - 0 - URI: - - - 1 - 2 - GTK_FILL - - - - - - True - 0 - Type: - - - GTK_FILL - - - - - - True - 0 - - - - - 1 - 2 - GTK_FILL - - - - - - 3 - - - - - - - True - GDK_WINDOW_TYPE_HINT_NORMAL - Copyright (C) 2005-2007 Dave Robillard <http://drobilla.net> - http://drobilla.net/software/ingen - Licensed under the GNU GPL, Version 2. - -See COPYING file included with this distribution, or http://www.gnu.org/licenses/gpl.txt for more information - Author: - Dave Robillard <dave@drobilla.net> - -Contributors: - Lars Luthman - DSSI enhancements, bugfixes - Mario Lang - SuperCollider bindings, bugfixes - Leonard Ritter - Python bindings - - translator-credits - Usability / UI Design: - Thorsten Wilms - ingen.svg - True - - - - - - - False - GTK_PACK_END - - - - - - - 320 - 340 - 8 - Patches - Ingen - ingen.svg - - - True - True - 3 - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_IN - - - True - True - All patches loaded in the engine - True - - - - - - - 6 - Engine - Ingen - False - ingen.svg - GDK_WINDOW_TYPE_HINT_DIALOG - - - True - 6 - - - True - - - True - - - True - 12 - gtk-disconnect - 3 - - - False - - - - - True - 5 - True - - - True - 0.10000000149 - - - - False - False - - - - - True - 0 - Not Connected - - - False - 1 - - - - - 1 - - - - - False - - - - - True - - - False - 4 - 1 - - - - - True - 3 - 2 - 8 - - - True - 0 - - - 1 - 2 - 2 - 3 - GTK_FILL - - - - - - True - False - True - Use internal engine - True - 0 - True - connect_server_radiobutton - - - 2 - 3 - GTK_FILL - - - - - - True - True - Launch and connect to server on port: - True - 0 - True - connect_server_radiobutton - - - 1 - 2 - GTK_FILL - - - - - - True - True - Connect to running server at: - True - 0 - True - - - GTK_FILL - - - - - - True - - - True - True - * - True - 28 - osc.udp://localhost:16180 - - - - - 1 - 2 - GTK_FILL - GTK_FILL - 8 - - - - - True - - - True - False - True - 16180 1 65535 1 10 10 - 1 - True - - - False - False - - - - - 1 - 2 - 1 - 2 - GTK_FILL - 8 - - - - - 2 - - - - - 2 - - - - - True - GTK_BUTTONBOX_END - - - True - True - True - gtk-quit - True - 0 - - - - - True - False - True - True - gtk-disconnect - True - -6 - - - 1 - - - - - True - True - True - True - gtk-connect - True - -6 - - - 2 - - - - - False - False - GTK_PACK_END - - - - - - - True - - - True - Input - True - - - - - True - Add an audio input to this patch - Audio - True - - - - - - True - Add a control input (and a control slider for it) to this patch - Control - True - - - - - - True - Add a MIDI input to this patch - MIDI - True - - - - - - True - Add a generic event input to this patch - Event - True - - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Add an OSC input to this patch - OSC - True - - - - - - - True - gtk-connect - 1 - - - - - - - True - Output - True - - - - - True - Add an audio output to this patch - Audio - True - - - - - - True - Add a control output to this patch - Control - True - - - - - - True - Add a MIDI output to this patch - MIDI - True - - - - - - True - Add a generic event output to this patch - Event - True - - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Add an OSC output to this patch - OSC - True - - - - - - - True - gtk-connect - 1 - - - - - - - True - Load a plugin as a child of this patch - _Plugin... - True - - - - True - gtk-execute - 1 - - - - - - - True - Load a patch as a child of this patch - _Load Patch... - True - - - - True - gtk-open - 1 - - - - - - - True - Create a new (empty) patch as a child of this patch - _New Patch... - True - - - - True - gtk-new - 1 - - - - - - - 8 - Load Remote Patch - GDK_WINDOW_TYPE_HINT_DIALOG - - - True - 8 - - - True - 8 - - - True - True - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_IN - - - True - True - - - - - - - True - - - True - URI: - - - False - False - - - - - True - True - * - 78 - - - 1 - - - - - False - 1 - - - - - 2 - - - - - True - GTK_BUTTONBOX_END - - - True - True - True - gtk-cancel - True - -6 - - - - - True - False - True - True - True - gtk-open - True - -5 - - - 1 - - - - - False - GTK_PACK_END - - - - - - - 8 - Upload Patch - False - GDK_WINDOW_TYPE_HINT_DIALOG - - - True - 9 - - - True - 2 - 2 - 8 - - - True - 0 - Short Name: - - - 1 - 2 - GTK_FILL - - - - - - True - 0 - Symbol: - - - GTK_FILL - - - - - - True - True - Enter a short name for this patch, e.g. "Mega Synth" - * - True - - - 1 - 2 - 1 - 2 - - - - - - True - True - Enter a short name suitable for use as an identifier or filename. - -The first character must be one of _, a-z or A-Z and subsequenct characters can be from _, a-z, A-Z or 0-9. - - * - True - - - 1 - 2 - - - - - - 2 - - - - - True - 4 - Succesfully uploaded patches will be available immediately in the remote patch browser. - -By uploading patches, you agree to license them under the Creative Commons Attribution-Share Alike 3.0 License. - -Thank you for contributing. - True - - - False - False - 3 - - - - - True - Upload progress - 0.10000000149 - - - False - False - 4 - - - - - True - GTK_BUTTONBOX_END - - - True - True - True - gtk-close - True - -7 - - - - - True - False - True - True - True - -5 - - - True - 0 - 0 - - - True - 2 - - - True - gtk-ok - - - False - False - - - - - True - Upload - True - - - False - False - 1 - - - - - - - - - 1 - - - - - False - GTK_PACK_END - - - - - - - - - True - _Properties... - True - - - - True - gtk-properties - 1 - - - - - - - 8 - Port Properties - Ingen - False - GTK_WIN_POS_MOUSE - - - True - 8 - - - True - 2 - 2 - 2 - 4 - - - True - 0 - Maximum Value: - - - 1 - 2 - GTK_FILL - - - - - - True - 0 - Minimum Value: - - - GTK_FILL - - - - - - True - True - 1 -99999 99999 1 10 10 - 1 - 5 - True - - - 1 - 2 - 1 - 2 - - - - - - True - True - 0 -100000000 100000000 1 10 10 - 1 - 5 - True - - - 1 - 2 - - - - - - 2 - - - - - True - GTK_BUTTONBOX_END - - - True - True - True - gtk-cancel - True - -6 - - - - - True - True - True - True - gtk-ok - True - -5 - - - 1 - - - - - False - GTK_PACK_END - - - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Expose individual voices - Polyphonic - True - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Disconnect all connections - gtk-disconnect - True - True - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Rename this object - Rename... - True - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - gtk-find-and-replace - - - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Destroy this object - gtk-delete - True - True - - - - - True - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - View and edit properties - gtk-properties - True - True - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Manipulate controls in a separate window - Controls... - True - - - gtk-edit - - - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Show this node's custom graphical interface in a separate window - GUI... - True - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - gtk-edit - - - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Embed the custom GUI for this plugin in the patch canvas - Embed GUI - True - - - - diff --git a/src/libs/gui/ingen_gui.gladep b/src/libs/gui/ingen_gui.gladep deleted file mode 100644 index 7cd9c6ce..00000000 --- a/src/libs/gui/ingen_gui.gladep +++ /dev/null @@ -1,9 +0,0 @@ - - - - - Ingenuity - ingenuity - C++ - FALSE - diff --git a/src/libs/gui/wscript b/src/libs/gui/wscript deleted file mode 100644 index 8895c7bc..00000000 --- a/src/libs/gui/wscript +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env python -import Params - -def build(bld): - obj = bld.create_obj('cpp', 'shlib') - obj.source = ''' - App.cpp - BreadCrumbBox.cpp - Configuration.cpp - ConnectWindow.cpp - ControlPanel.cpp - Controls.cpp - GladeFactory.cpp - LoadPatchWindow.cpp - LoadPluginWindow.cpp - LoadRemotePatchWindow.cpp - LoadSubpatchWindow.cpp - MessagesWindow.cpp - NewSubpatchWindow.cpp - NodeControlWindow.cpp - NodeMenu.cpp - NodeModule.cpp - NodePropertiesWindow.cpp - ObjectMenu.cpp - PatchCanvas.cpp - PatchPortModule.cpp - PatchPropertiesWindow.cpp - PatchTreeWindow.cpp - PatchView.cpp - PatchWindow.cpp - Port.cpp - PortMenu.cpp - PortPropertiesWindow.cpp - RenameWindow.cpp - SubpatchModule.cpp - ThreadedLoader.cpp - WindowFactory.cpp - gui.cpp - ''' - - if bld.env()['HAVE_CURL']: - obj.source += 'UploadPatchWindow.cpp' - - dir = Params.g_options.moduledir or bld.env()['PREFIX'] + 'lib/ingen' - - obj.includes = ['..', '../../common', '../..'] - obj.defines = 'INGEN_DATA_DIR=\\\"' + dir + '\\\"' - obj.name = 'libingen_gui' - obj.target = 'ingen_gui' - obj.vnum = '0.0.0' - obj.uselib_local = 'libingen_client libingen_shared' - obj.uselib = ''' - CURL - FLOWCANVAS - GLADEMM - GLIBMM - GNOMECANVASMM - GTKMM - RAUL - REDLANDMM - SIGCPP - SLV2 - SOUP - XML2 - ''' -- cgit v1.2.1