aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am25
-rw-r--r--src/gui/MachinaGUI.cpp5
-rw-r--r--src/gui/MachinaGUI.hpp18
-rw-r--r--src/gui/Makefile.am4
-rw-r--r--src/gui/main.cpp26
-rw-r--r--src/main.cpp14
6 files changed, 51 insertions, 41 deletions
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<Machina::Machine> 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 <string>
-#include <boost/shared_ptr.hpp>
+#include <raul/SharedPtr.h>
#include <libgnomecanvasmm.h>
using namespace std;
-class MachinaCanvas;
+namespace Machina { class Machine; }
+class MachinaCanvas;
class MachinaGUI
{
public:
- MachinaGUI(/*int argc, char** argv*/);
+ MachinaGUI(SharedPtr<Machina::Machine> machine/*int argc, char** argv*/);
~MachinaGUI();
boost::shared_ptr<MachinaCanvas> 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<MachinaCanvas> _canvas;
+ boost::shared_ptr<Machina::Machine> _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 <signal.h>
#include <iostream>
#include <libgnomecanvasmm.h>
+#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<JackDriver> driver(new JackDriver());
+
+ SharedPtr<Machina::Machine> 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 <iostream>
#include <signal.h>
-#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;