diff options
author | David Robillard <d@drobilla.net> | 2010-12-15 05:36:37 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2010-12-15 05:36:37 +0000 |
commit | 58e54bb6a0f70499dce46ec931c8803dea375270 (patch) | |
tree | bc9c84108176835b3934a7ccddb14a12cc73bbab /src | |
parent | 84c939f117894f32f4ad6c220c43bdd6b993e712 (diff) | |
download | patchage-58e54bb6a0f70499dce46ec931c8803dea375270.tar.gz patchage-58e54bb6a0f70499dce46ec931c8803dea375270.tar.bz2 patchage-58e54bb6a0f70499dce46ec931c8803dea375270.zip |
Split PatchageModule code into PatchageModule.cpp.
git-svn-id: http://svn.drobilla.net/lad/trunk/patchage@2699 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r-- | src/PatchageModule.hpp | 81 |
1 files changed, 10 insertions, 71 deletions
diff --git a/src/PatchageModule.hpp b/src/PatchageModule.hpp index 99c23f6..fcab207 100644 --- a/src/PatchageModule.hpp +++ b/src/PatchageModule.hpp @@ -20,20 +20,8 @@ #include <string> -#include <libgnomecanvasmm.h> - -#include "patchage-config.h" - -#ifdef HAVE_ALSA - #include <alsa/asoundlib.h> -#endif - -#include "flowcanvas/Canvas.hpp" #include "flowcanvas/Module.hpp" -#include "Patchage.hpp" -#include "PatchageCanvas.hpp" -#include "PatchagePort.hpp" #include "StateManager.hpp" using namespace FlowCanvas; @@ -41,68 +29,19 @@ using namespace FlowCanvas; class PatchageModule : public Module { public: - PatchageModule(Patchage* app, const std::string& title, ModuleType type, double x=0, double y=0) - : Module(app->canvas(), title, x, y) - , _app(app) - , _type(type) - { - } - - virtual ~PatchageModule() { delete _menu; _menu = NULL; } - - void create_menu() { - _menu = new Gtk::Menu(); - Gtk::Menu::MenuList& items = _menu->items(); - if (_type == InputOutput) { - items.push_back(Gtk::Menu_Helpers::MenuElem("Split", - sigc::mem_fun(this, &PatchageModule::split))); - } else { - items.push_back(Gtk::Menu_Helpers::MenuElem("Join", - sigc::mem_fun(this, &PatchageModule::join))); - } - items.push_back(Gtk::Menu_Helpers::MenuElem("Disconnect All", - sigc::mem_fun(this, &PatchageModule::menu_disconnect_all))); - } - - void load_location() { - boost::shared_ptr<Canvas> canvas = _canvas.lock(); - if (!canvas) - return; - - Coord loc; - - if (_app->state_manager()->get_module_location(_name, _type, loc)) - move_to(loc.x, loc.y); - else - move_to((canvas->width()/2) - 100 + rand() % 400, - (canvas->height()/2) - 100 + rand() % 400); - } - - virtual void store_location() { - Coord loc(property_x().get_value(), property_y().get_value()); - _app->state_manager()->set_module_location(_name, _type, loc); - } - - void split() { - assert(_type == InputOutput); - _app->state_manager()->set_module_split(_name, true); - _app->refresh(); - } - - void join() { - assert(_type != InputOutput); - _app->state_manager()->set_module_split(_name, false); - _app->refresh(); - } + PatchageModule(Patchage* app, const std::string& name, ModuleType type, double x=0, double y=0); + ~PatchageModule(); - virtual void show_dialog() {} + void split(); + void join(); - virtual void menu_disconnect_all() { - for (PortVector::iterator p = _ports.begin(); p != _ports.end(); ++p) - (*p)->disconnect_all(); - } + void create_menu(); + void load_location(); + void menu_disconnect_all(); + void show_dialog() {} + void store_location(); - ModuleType type() { return _type; } + ModuleType type() const { return _type; } protected: Patchage* _app; |