diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/MachinaGUI.cpp | 42 | ||||
-rw-r--r-- | src/gui/MachinaGUI.hpp | 9 | ||||
-rw-r--r-- | src/gui/machina.glade | 8 |
3 files changed, 50 insertions, 9 deletions
diff --git a/src/gui/MachinaGUI.cpp b/src/gui/MachinaGUI.cpp index dab150f..546bf7d 100644 --- a/src/gui/MachinaGUI.cpp +++ b/src/gui/MachinaGUI.cpp @@ -21,6 +21,8 @@ #include <libglademm/xml.h> #include <fstream> #include <pthread.h> +#include <raul/RDFWriter.h> +#include <machina/Machine.hpp> #include "MachinaGUI.hpp" #include "MachinaCanvas.hpp" #include "NodeView.hpp" @@ -107,7 +109,10 @@ MachinaGUI::MachinaGUI(SharedPtr<Machina::Machine> machine) xml->get_widget("machina_win", _main_window); xml->get_widget("about_win", _about_window); xml->get_widget("help_dialog", _help_dialog); - xml->get_widget("file_quit_menuitem", _menu_file_quit); + xml->get_widget("open_menuitem", _menu_file_open); + xml->get_widget("save_menuitem", _menu_file_save); + xml->get_widget("save_as_menuitem", _menu_file_save_as); + xml->get_widget("quit_menuitem", _menu_file_quit); xml->get_widget("view_refresh_menuitem", _menu_view_refresh); xml->get_widget("view_messages_menuitem", _menu_view_messages); xml->get_widget("help_about_menuitem", _menu_help_about); @@ -131,14 +136,17 @@ MachinaGUI::MachinaGUI(SharedPtr<Machina::Machine> machine) _zoom_full_button->signal_clicked().connect(sigc::mem_fun(_canvas.get(), &MachinaCanvas::zoom_full)); + _menu_file_open->signal_activate().connect( sigc::mem_fun(this, &MachinaGUI::menu_file_open)); + _menu_file_save->signal_activate().connect( sigc::mem_fun(this, &MachinaGUI::menu_file_save)); + _menu_file_save_as->signal_activate().connect( sigc::mem_fun(this, &MachinaGUI::menu_file_save_as)); _menu_file_quit->signal_activate().connect( sigc::mem_fun(this, &MachinaGUI::menu_file_quit)); _menu_view_refresh->signal_activate().connect( sigc::mem_fun(this, &MachinaGUI::menu_view_refresh)); _menu_view_messages->signal_toggled().connect( sigc::mem_fun(this, &MachinaGUI::show_messages_toggled)); _menu_help_about->signal_activate().connect( sigc::mem_fun(this, &MachinaGUI::menu_help_about)); - _menu_help_help->signal_activate().connect( sigc::mem_fun(this, &MachinaGUI::menu_help_help)); + _menu_help_help->signal_activate().connect( sigc::mem_fun(this, &MachinaGUI::menu_help_help)); connect_widgets(); - + //update_state(); _canvas->show(); @@ -275,6 +283,8 @@ MachinaGUI::connect_widgets() } +using namespace std; + void MachinaGUI::menu_file_quit() @@ -284,6 +294,31 @@ MachinaGUI::menu_file_quit() void +MachinaGUI::menu_file_open() +{ + cerr << "open\n"; + +} + + +void +MachinaGUI::menu_file_save() +{ + cerr << "save\n"; + + Raul::RDFWriter writer; + writer.start_to_filename("test.machina.ttl"); + _machine->write_state(writer); + writer.finish();} + + +void +MachinaGUI::menu_file_save_as() +{ +} + + +void MachinaGUI::on_pane_position_changed() { // avoid infinite recursion... @@ -365,3 +400,4 @@ MachinaGUI::menu_help_help() _help_dialog->run(); _help_dialog->hide(); } + diff --git a/src/gui/MachinaGUI.hpp b/src/gui/MachinaGUI.hpp index 147a506..a9ae5e5 100644 --- a/src/gui/MachinaGUI.hpp +++ b/src/gui/MachinaGUI.hpp @@ -18,7 +18,6 @@ #ifndef MACHINA_GUI_H #define MACHINA_GUI_H -//#include "config.h" #include <string> #include <raul/SharedPtr.h> #include <raul/Maid.h> @@ -56,6 +55,9 @@ protected: void connect_widgets(); void menu_file_quit(); + void menu_file_open(); + void menu_file_save(); + void menu_file_save_as(); void show_messages_toggled(); void menu_view_refresh(); void menu_help_about(); @@ -71,7 +73,7 @@ protected: bool _update_pane_position; int _user_pane_position; - bool _refresh; + bool _refresh; boost::shared_ptr<MachinaCanvas> _canvas; boost::shared_ptr<Machina::Machine> _machine; @@ -83,6 +85,9 @@ protected: Gtk::Window* _main_window; Gtk::Dialog* _help_dialog; Gtk::AboutDialog* _about_window; + Gtk::MenuItem* _menu_file_open; + Gtk::MenuItem* _menu_file_save; + Gtk::MenuItem* _menu_file_save_as; Gtk::MenuItem* _menu_file_quit; Gtk::MenuItem* _menu_help_about; Gtk::CheckMenuItem* _menu_view_messages; diff --git a/src/gui/machina.glade b/src/gui/machina.glade index 3216b96..06241a6 100644 --- a/src/gui/machina.glade +++ b/src/gui/machina.glade @@ -44,7 +44,7 @@ <widget class="GtkMenu" id="file_menu_menu"> <child> - <widget class="GtkImageMenuItem" id="open_session_menuitem"> + <widget class="GtkImageMenuItem" id="open_menuitem"> <property name="visible">True</property> <property name="label">gtk-open</property> <property name="use_stock">True</property> @@ -53,7 +53,7 @@ </child> <child> - <widget class="GtkImageMenuItem" id="save_session_menuitem"> + <widget class="GtkImageMenuItem" id="save_menuitem"> <property name="visible">True</property> <property name="label">gtk-save</property> <property name="use_stock">True</property> @@ -62,7 +62,7 @@ </child> <child> - <widget class="GtkImageMenuItem" id="save_session_as_menuitem"> + <widget class="GtkImageMenuItem" id="save_as_menuitem"> <property name="visible">True</property> <property name="label">gtk-save-as</property> <property name="use_stock">True</property> @@ -77,7 +77,7 @@ </child> <child> - <widget class="GtkImageMenuItem" id="file_quit_menuitem"> + <widget class="GtkImageMenuItem" id="quit_menuitem"> <property name="visible">True</property> <property name="label">gtk-quit</property> <property name="use_stock">True</property> |