diff options
author | David Robillard <d@drobilla.net> | 2007-02-11 01:26:07 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2007-02-11 01:26:07 +0000 |
commit | da3ac16cbfbf66edebe929f8d9bf7d76ab24dd74 (patch) | |
tree | 8371f2d2e46925df9337be9b578cfb74d671d285 /src/gui | |
parent | cee33ba4c0859b117be94df6ccbf3eb756a850af (diff) | |
download | machina-da3ac16cbfbf66edebe929f8d9bf7d76ab24dd74.tar.gz machina-da3ac16cbfbf66edebe929f8d9bf7d76ab24dd74.tar.bz2 machina-da3ac16cbfbf66edebe929f8d9bf7d76ab24dd74.zip |
Moved Maid from Ingen to Raul.
Working machina MIDI learn, fixes, etc, etc.
git-svn-id: http://svn.drobilla.net/lad/machina@302 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/MachinaCanvas.cpp | 21 | ||||
-rw-r--r-- | src/gui/MachinaCanvas.hpp | 8 | ||||
-rw-r--r-- | src/gui/MachinaGUI.cpp | 38 | ||||
-rw-r--r-- | src/gui/MachinaGUI.hpp | 7 | ||||
-rw-r--r-- | src/gui/main.cpp | 3 |
5 files changed, 32 insertions, 45 deletions
diff --git a/src/gui/MachinaCanvas.cpp b/src/gui/MachinaCanvas.cpp index 775ae28..d725253 100644 --- a/src/gui/MachinaCanvas.cpp +++ b/src/gui/MachinaCanvas.cpp @@ -21,6 +21,7 @@ #include "machina/Machine.hpp" #include "machina/Action.hpp" #include "machina/Edge.hpp" +#include "machina/LearnRequest.hpp" #include "NodeView.hpp" #include "MachinaCanvas.hpp" #include "MachinaGUI.hpp" @@ -47,15 +48,21 @@ void MachinaCanvas::node_clicked(SharedPtr<NodeView> item, GdkEventButton* event) { cerr << "CLICKED: " << item->name() << endl; - + SharedPtr<NodeView> node = PtrCast<NodeView>(item); if (!node) return; + // Middle click, learn + if (event->button == 2) { + _app->machine()->learn(Machina::LearnRequest::create(_app->maid(), node->node())); + return; + } + SharedPtr<NodeView> last = _last_clicked.lock(); if (last) { - connect(last, node); + connect_node(last, node); _last_clicked.reset(); } else { _last_clicked = node; @@ -79,7 +86,7 @@ MachinaCanvas::canvas_event(GdkEvent* event) string name = string("Note")+(char)(last++ +'0'); SharedPtr<Machina::Node> node(new Machina::Node(1024*10, false)); - node->add_enter_action(new Machina::PrintAction(name)); + //node->add_enter_action(SharedPtr<Machina::Action>(new Machina::PrintAction(name))); SharedPtr<NodeView> view(new NodeView(node, shared_from_this(), name, x, y)); @@ -100,8 +107,8 @@ MachinaCanvas::canvas_event(GdkEvent* event) void -MachinaCanvas::connect(boost::shared_ptr<NodeView> src, - boost::shared_ptr<NodeView> dst) +MachinaCanvas::connect_node(boost::shared_ptr<NodeView> src, + boost::shared_ptr<NodeView> dst) { boost::shared_ptr<Connection> c(new Connection(shared_from_this(), src, dst, 0x9999AAFF, true)); @@ -115,8 +122,8 @@ MachinaCanvas::connect(boost::shared_ptr<NodeView> src, void -MachinaCanvas::disconnect(boost::shared_ptr<NodeView>,// item1, - boost::shared_ptr<NodeView>)// item2) +MachinaCanvas::disconnect_node(boost::shared_ptr<NodeView>,// item1, + boost::shared_ptr<NodeView>)// item2) { #if 0 boost::shared_ptr<MachinaPort> input diff --git a/src/gui/MachinaCanvas.hpp b/src/gui/MachinaCanvas.hpp index 6cd5ea0..361e154 100644 --- a/src/gui/MachinaCanvas.hpp +++ b/src/gui/MachinaCanvas.hpp @@ -34,11 +34,11 @@ class MachinaCanvas : public FlowCanvas public: MachinaCanvas(MachinaGUI* app, int width, int height); - void connect(SharedPtr<NodeView> port1, - SharedPtr<NodeView> port2); + void connect_node(SharedPtr<NodeView> port1, + SharedPtr<NodeView> port2); - void disconnect(SharedPtr<NodeView> port1, - SharedPtr<NodeView> port2); + void disconnect_node(SharedPtr<NodeView> port1, + SharedPtr<NodeView> port2); void status_message(const string& msg); diff --git a/src/gui/MachinaGUI.cpp b/src/gui/MachinaGUI.cpp index 09a3649..f091e60 100644 --- a/src/gui/MachinaGUI.cpp +++ b/src/gui/MachinaGUI.cpp @@ -65,12 +65,13 @@ gtkmm_set_width_for_given_text (Gtk::Widget &w, const gchar *text, -MachinaGUI::MachinaGUI(SharedPtr<Machina::Machine> m/*int argc, char** argv*/) +MachinaGUI::MachinaGUI(SharedPtr<Machina::Machine> machine) : _pane_closed(false), _update_pane_position(true), _user_pane_position(0), _refresh(false), - _machine(m) + _machine(machine), + _maid(new Raul::Maid(32)) { /*_settings_filename = getenv("HOME"); _settings_filename += "/.machinarc";*/ @@ -154,8 +155,8 @@ MachinaGUI::MachinaGUI(SharedPtr<Machina::Machine> m/*int argc, char** argv*/) _update_pane_position = true; _pane_closed = true; - // Idle callback, check if we need to refresh - Glib::signal_timeout().connect(sigc::mem_fun(this, &MachinaGUI::idle_callback), 100); + // Idle callback to drive the maid (collect garbage) + Glib::signal_timeout().connect(sigc::mem_fun(this, &MachinaGUI::idle_callback), 1000); // Faster idle callback to update DSP load progress bar //Glib::signal_timeout().connect(sigc::mem_fun(this, &MachinaGUI::update_load), 50); @@ -185,34 +186,7 @@ MachinaGUI::attach() bool MachinaGUI::idle_callback() { -#if 0 - if (_jack_driver) { - while (!_jack_driver->events().empty()) { - MachinaEvent& ev = _jack_driver->events().front(); - _jack_driver->events().pop(); - ev.execute(); - } - } - - - bool refresh = _refresh; - - refresh = refresh || (_jack_driver && _jack_driver->is_dirty()); - - if (refresh) { - - _canvas->flag_all_connections(); - - _jack_driver->refresh(); - } - - if (refresh) { - _canvas->destroy_all_flagged_connections(); - _refresh = false; - } - - update_load(); -#endif + _maid->cleanup(); return true; } diff --git a/src/gui/MachinaGUI.hpp b/src/gui/MachinaGUI.hpp index 4bcca5a..23b9dba 100644 --- a/src/gui/MachinaGUI.hpp +++ b/src/gui/MachinaGUI.hpp @@ -21,6 +21,7 @@ //#include "config.h" #include <string> #include <raul/SharedPtr.h> +#include <raul/Maid.h> #include <libgnomecanvasmm.h> using namespace std; @@ -32,12 +33,14 @@ class MachinaCanvas; class MachinaGUI { public: - MachinaGUI(SharedPtr<Machina::Machine> machine/*int argc, char** argv*/); + MachinaGUI(SharedPtr<Machina::Machine> machine); ~MachinaGUI(); boost::shared_ptr<MachinaCanvas> canvas() { return _canvas; } boost::shared_ptr<Machina::Machine> machine() { return _machine; } + SharedPtr<Raul::Maid> maid() { return _maid; } + Gtk::Window* window() { return _main_window; } void attach(); @@ -71,6 +74,8 @@ protected: boost::shared_ptr<MachinaCanvas> _canvas; boost::shared_ptr<Machina::Machine> _machine; + + SharedPtr<Raul::Maid> _maid; Gtk::Main* _gtk_main; diff --git a/src/gui/main.cpp b/src/gui/main.cpp index 4e55e58..364fe17 100644 --- a/src/gui/main.cpp +++ b/src/gui/main.cpp @@ -40,12 +40,13 @@ main(int argc, char** argv) SharedPtr<Machina::Machine> m(new Machine()); m->activate(); + + MidiAction::set_driver(driver); driver->set_machine(m); driver->attach("machina"); - // Launch GUI try { |