From 64314961f83810d6b93e128013ed94deb0c7772a Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 23 Feb 2007 23:53:37 +0000 Subject: Removable edges. GUI touchups. git-svn-id: http://svn.drobilla.net/lad/machina@332 a436a847-0d15-0410-975c-d299462d15a1 --- src/engine/Node.cpp | 15 +++++++++++++++ src/engine/machina/Node.hpp | 1 + src/gui/MachinaCanvas.cpp | 12 +++++++++--- src/gui/MachinaGUI.cpp | 28 +++++++++++++++------------- src/gui/MachinaGUI.hpp | 6 +++--- src/gui/machina.glade | 39 +++------------------------------------ 6 files changed, 46 insertions(+), 55 deletions(-) diff --git a/src/engine/Node.cpp b/src/engine/Node.cpp index a7aa453..224718e 100644 --- a/src/engine/Node.cpp +++ b/src/engine/Node.cpp @@ -100,6 +100,21 @@ Node::remove_outgoing_edge(SharedPtr edge) } +void +Node::remove_outgoing_edges_to(SharedPtr node) +{ + for (EdgeList::iterator i = _outgoing_edges.begin(); i != _outgoing_edges.end() ; ) { + EdgeList::iterator next = i; + ++next; + + if ((*i)->dst() == node) + _outgoing_edges.erase(i); + + i = next; + } +} + + void Node::write_state(Raul::RDFWriter& writer) { diff --git a/src/engine/machina/Node.hpp b/src/engine/machina/Node.hpp index c4d9dee..7573e39 100644 --- a/src/engine/machina/Node.hpp +++ b/src/engine/machina/Node.hpp @@ -57,6 +57,7 @@ public: void add_outgoing_edge(SharedPtr edge); void remove_outgoing_edge(SharedPtr edge); + void remove_outgoing_edges_to(SharedPtr node); void write_state(Raul::RDFWriter& writer); diff --git a/src/gui/MachinaCanvas.cpp b/src/gui/MachinaCanvas.cpp index 26ce935..03a05bc 100644 --- a/src/gui/MachinaCanvas.cpp +++ b/src/gui/MachinaCanvas.cpp @@ -64,7 +64,10 @@ MachinaCanvas::node_clicked(SharedPtr item, GdkEventButton* event) if (last) { if (node != last) - connect_node(last, node); + if (get_connection(last, node)) + disconnect_node(last, node); + else + connect_node(last, node); last->set_default_base_color(); _last_clicked.reset(); @@ -130,9 +133,12 @@ MachinaCanvas::connect_node(boost::shared_ptr src, void -MachinaCanvas::disconnect_node(boost::shared_ptr,// item1, - boost::shared_ptr)// item2) +MachinaCanvas::disconnect_node(boost::shared_ptr src, + boost::shared_ptr dst) { + src->node()->remove_outgoing_edges_to(dst->node()); + remove_connection(src, dst); + #if 0 boost::shared_ptr input = boost::dynamic_pointer_cast(port1); diff --git a/src/gui/MachinaGUI.cpp b/src/gui/MachinaGUI.cpp index f1ec4f0..ee81979 100644 --- a/src/gui/MachinaGUI.cpp +++ b/src/gui/MachinaGUI.cpp @@ -115,8 +115,8 @@ MachinaGUI::MachinaGUI(SharedPtr engine) xml->get_widget("save_as_menuitem", _menu_file_save_as); xml->get_widget("quit_menuitem", _menu_file_quit); xml->get_widget("view_toolbar_menuitem", _menu_view_toolbar); - xml->get_widget("view_refresh_menuitem", _menu_view_refresh); - xml->get_widget("view_messages_menuitem", _menu_view_messages); + //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); xml->get_widget("help_help_menuitem", _menu_help_help); xml->get_widget("canvas_scrolledwindow", _canvas_scrolledwindow); @@ -151,12 +151,12 @@ MachinaGUI::MachinaGUI(SharedPtr engine) 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_refresh->signal_activate().connect( + // sigc::mem_fun(this, &MachinaGUI::menu_view_refresh)); _menu_view_toolbar->signal_toggled().connect( sigc::mem_fun(this, &MachinaGUI::show_toolbar_toggled)); - _menu_view_messages->signal_toggled().connect( - sigc::mem_fun(this, &MachinaGUI::show_messages_toggled)); + //_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( @@ -389,7 +389,7 @@ MachinaGUI::on_pane_position_changed() _user_pane_position = new_position; _messages_expander->set_expanded(true); _pane_closed = false; - _menu_view_messages->set_active(true); + //_menu_view_messages->set_active(true); } else if (new_position >= max_pane_position()) { // Auto close _pane_closed = true; @@ -397,7 +397,7 @@ MachinaGUI::on_pane_position_changed() _messages_expander->set_expanded(false); if (new_position > max_pane_position()) _main_paned->set_position(max_pane_position()); // ... here - _menu_view_messages->set_active(false); + //_menu_view_messages->set_active(false); _user_pane_position = max_pane_position() - _main_window->get_height()/8; } @@ -424,14 +424,14 @@ MachinaGUI::on_messages_expander_changed() } } - +/* void MachinaGUI::show_messages_toggled() { if (_update_pane_position) - _messages_expander->set_expanded(_menu_view_messages->get_active()); + //_messages_expander->set_expanded(_menu_view_messages->get_active()); } - +*/ void MachinaGUI::show_toolbar_toggled() @@ -442,7 +442,7 @@ MachinaGUI::show_toolbar_toggled() _toolbar->hide(); } - +/* void MachinaGUI::menu_view_refresh() { @@ -450,11 +450,12 @@ MachinaGUI::menu_view_refresh() //_canvas->destroy(); } - +*/ void MachinaGUI::menu_help_about() { + _about_window->set_transient_for(*_main_window); _about_window->show(); } @@ -462,6 +463,7 @@ MachinaGUI::menu_help_about() void MachinaGUI::menu_help_help() { + _help_dialog->set_transient_for(*_main_window); _help_dialog->run(); _help_dialog->hide(); } diff --git a/src/gui/MachinaGUI.hpp b/src/gui/MachinaGUI.hpp index ccf7557..46d4884 100644 --- a/src/gui/MachinaGUI.hpp +++ b/src/gui/MachinaGUI.hpp @@ -59,9 +59,9 @@ protected: void menu_file_open(); void menu_file_save(); void menu_file_save_as(); - void show_messages_toggled(); + //void show_messages_toggled(); void show_toolbar_toggled(); - void menu_view_refresh(); + //void menu_view_refresh(); void menu_help_about(); void menu_help_help(); void zoom(double z); @@ -98,7 +98,7 @@ protected: Gtk::MenuItem* _menu_file_quit; Gtk::MenuItem* _menu_help_about; Gtk::CheckMenuItem* _menu_view_toolbar; - Gtk::CheckMenuItem* _menu_view_messages; + //Gtk::CheckMenuItem* _menu_view_messages; Gtk::MenuItem* _menu_view_refresh; Gtk::MenuItem* _menu_help_help; Gtk::ScrolledWindow* _canvas_scrolledwindow; diff --git a/src/gui/machina.glade b/src/gui/machina.glade index bdea253..6e5d7e9 100644 --- a/src/gui/machina.glade +++ b/src/gui/machina.glade @@ -108,40 +108,6 @@ - - - - True - View "console" messages - _Messages - True - False - - - - - - - - True - _Refresh - True - - - - - - True - gtk-refresh - 1 - 0.5 - 0.5 - 0 - 0 - - - - @@ -532,10 +498,11 @@ along with Machina; if not, write to the Free Software Foundation, Inc., 8 Machina Help GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE + GTK_WIN_POS_CENTER_ON_PARENT False - True + False False + gtk-help True False False -- cgit v1.2.1