From 374f7e8f35e0205b056184c889b2caf5cdac08ec Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 10 Feb 2007 01:11:44 +0000 Subject: Made Raul::List read/write thread safe. Uh.. kinda, a bit. :) Reorganized machina into libraries. git-svn-id: http://svn.drobilla.net/lad/machina@295 a436a847-0d15-0410-975c-d299462d15a1 --- src/Makefile.am | 25 ++++--------------------- src/gui/MachinaGUI.cpp | 5 +++-- src/gui/MachinaGUI.hpp | 18 ++++++++++-------- src/gui/Makefile.am | 4 ++-- src/gui/main.cpp | 26 +++++++++++++++++++++++++- src/main.cpp | 14 +++++++------- 6 files changed, 51 insertions(+), 41 deletions(-) (limited to 'src') diff --git a/src/Makefile.am b/src/Makefile.am index f6c047d..23a14da 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,28 +1,11 @@ #globalpixmapsdir = $(datadir)/pixmaps #dist_globalpixmaps_DATA = machina-icon.svg -SUBDIRS = gui +SUBDIRS = engine gui bin_PROGRAMS = machina -machina_CXXFLAGS = @RAUL_CFLAGS@ @JACK_CFLAGS@ @GLIBMM_CFLAGS@ -machina_LDADD = @RAUL_LIBS@ @JACK_LIBS@ @GLIBMM_LIBS@ +machina_CXXFLAGS = @RAUL_CFLAGS@ @JACK_CFLAGS@ @GLIBMM_CFLAGS@ -I$(top_srcdir)/src/engine +machina_LDADD = @RAUL_LIBS@ @JACK_LIBS@ @GLIBMM_LIBS@ engine/libmachina.la -machina_SOURCES = \ - types.hpp \ - Message.hpp \ - Node.hpp \ - Node.cpp \ - Edge.hpp \ - Machine.hpp \ - Machine.cpp \ - Loader.h \ - Loader.cpp \ - JackDriver.h \ - JackDriver.cpp \ - JackActions.hpp \ - JackActions.cpp \ - NodeFactory.hpp \ - JackNodeFactory.hpp \ - JackNodeFactory.cpp \ - main.cpp +machina_SOURCES = main.cpp diff --git a/src/gui/MachinaGUI.cpp b/src/gui/MachinaGUI.cpp index a7602c1..09a3649 100644 --- a/src/gui/MachinaGUI.cpp +++ b/src/gui/MachinaGUI.cpp @@ -65,11 +65,12 @@ gtkmm_set_width_for_given_text (Gtk::Widget &w, const gchar *text, -MachinaGUI::MachinaGUI(/*int argc, char** argv*/) +MachinaGUI::MachinaGUI(SharedPtr m/*int argc, char** argv*/) : _pane_closed(false), _update_pane_position(true), _user_pane_position(0), - _refresh(false) + _refresh(false), + _machine(m) { /*_settings_filename = getenv("HOME"); _settings_filename += "/.machinarc";*/ diff --git a/src/gui/MachinaGUI.hpp b/src/gui/MachinaGUI.hpp index 27b7f4f..804bf41 100644 --- a/src/gui/MachinaGUI.hpp +++ b/src/gui/MachinaGUI.hpp @@ -20,23 +20,24 @@ //#include "config.h" #include -#include +#include #include using namespace std; -class MachinaCanvas; +namespace Machina { class Machine; } +class MachinaCanvas; class MachinaGUI { public: - MachinaGUI(/*int argc, char** argv*/); + MachinaGUI(SharedPtr machine/*int argc, char** argv*/); ~MachinaGUI(); boost::shared_ptr canvas() { return _canvas; } - Gtk::Window* window() { return _main_window; } + Gtk::Window* window() { return _main_window; } void attach(); void quit() { _main_window->hide(); } @@ -64,12 +65,13 @@ protected: bool _pane_closed; bool _update_pane_position; int _user_pane_position; + + bool _refresh; boost::shared_ptr _canvas; + boost::shared_ptr _machine; Gtk::Main* _gtk_main; - - bool _refresh; Gtk::Window* _main_window; Gtk::AboutDialog* _about_window; @@ -81,8 +83,8 @@ protected: Gtk::TextView* _status_text; Gtk::Paned* _main_paned; Gtk::Expander* _messages_expander; - Gtk::ToolButton* _zoom_normal_button; - Gtk::ToolButton* _zoom_full_button; + Gtk::ToolButton* _zoom_normal_button; + Gtk::ToolButton* _zoom_full_button; }; #endif // MACHINA_GUI_H diff --git a/src/gui/Makefile.am b/src/gui/Makefile.am index e7a88b7..1bdb381 100644 --- a/src/gui/Makefile.am +++ b/src/gui/Makefile.am @@ -1,5 +1,5 @@ -AM_CXXFLAGS = -DPKGDATADIR=\"$(pkgdatadir)\" @LIBGLADEMM_CFLAGS@ @GNOMECANVASMM_CFLAGS@ @JACK_CFLAGS@ @FLOWCANVAS_CFLAGS@ @RAUL_CFLAGS@ -machina_gui_LDADD = @LIBGLADEMM_LIBS@ @GNOMECANVASMM_LIBS@ @JACK_LIBS@ @FLOWCANVAS_LIBS@ @RAUL_CFLAGS@ +AM_CXXFLAGS = -DPKGDATADIR=\"$(pkgdatadir)\" @LIBGLADEMM_CFLAGS@ @GNOMECANVASMM_CFLAGS@ @JACK_CFLAGS@ @FLOWCANVAS_CFLAGS@ @RAUL_CFLAGS@ -I$(top_srcdir)/src/engine +machina_gui_LDADD = @LIBGLADEMM_LIBS@ @GNOMECANVASMM_LIBS@ @JACK_LIBS@ @FLOWCANVAS_LIBS@ @RAUL_CFLAGS@ ../engine/libmachina.la EXTRA_DIST = machina.gladep diff --git a/src/gui/main.cpp b/src/gui/main.cpp index 7250cb1..4e55e58 100644 --- a/src/gui/main.cpp +++ b/src/gui/main.cpp @@ -17,26 +17,50 @@ //#include "../../config.h" +#include #include #include +#include "machina/Loader.hpp" +#include "machina/JackDriver.hpp" +#include "machina/JackNodeFactory.hpp" + #include "MachinaGUI.hpp" +using namespace Machina; + + int main(int argc, char** argv) { + // Build engine + + SharedPtr driver(new JackDriver()); + + SharedPtr m(new Machine()); + + m->activate(); + + driver->set_machine(m); + driver->attach("machina"); + + + + // Launch GUI try { Gnome::Canvas::init(); Gtk::Main app(argc, argv); - MachinaGUI gui; + MachinaGUI gui(m); app.run(*gui.window()); } catch (std::string msg) { std::cerr << "Caught exception, aborting. Error message was: " << msg << std::endl; return 1; } + + driver->detach(); return 0; } diff --git a/src/main.cpp b/src/main.cpp index 3831f97..e4dcbf2 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -17,13 +17,13 @@ #include #include -#include "Machine.hpp" -#include "Node.hpp" -#include "Action.hpp" -#include "Edge.hpp" -#include "Loader.hpp" -#include "JackDriver.hpp" -#include "JackNodeFactory.hpp" +#include "machina/Machine.hpp" +#include "machina/Node.hpp" +#include "machina/Action.hpp" +#include "machina/Edge.hpp" +#include "machina/Loader.hpp" +#include "machina/JackDriver.hpp" +#include "machina/JackNodeFactory.hpp" using namespace std; using namespace Machina; -- cgit v1.2.1