aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-02-23 23:53:37 +0000
committerDavid Robillard <d@drobilla.net>2007-02-23 23:53:37 +0000
commit64314961f83810d6b93e128013ed94deb0c7772a (patch)
tree47901f080f64cf4f0d9f2a52f8a0f990fc3be517 /src
parent2d050bbc47e57e4361e0625c0c2ee30649252820 (diff)
downloadmachina-64314961f83810d6b93e128013ed94deb0c7772a.tar.gz
machina-64314961f83810d6b93e128013ed94deb0c7772a.tar.bz2
machina-64314961f83810d6b93e128013ed94deb0c7772a.zip
Removable edges.
GUI touchups. git-svn-id: http://svn.drobilla.net/lad/machina@332 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/engine/Node.cpp15
-rw-r--r--src/engine/machina/Node.hpp1
-rw-r--r--src/gui/MachinaCanvas.cpp12
-rw-r--r--src/gui/MachinaGUI.cpp28
-rw-r--r--src/gui/MachinaGUI.hpp6
-rw-r--r--src/gui/machina.glade39
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
@@ -101,6 +101,21 @@ Node::remove_outgoing_edge(SharedPtr<Edge> edge)
void
+Node::remove_outgoing_edges_to(SharedPtr<Node> 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)
{
using Raul::RdfId;
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> edge);
void remove_outgoing_edge(SharedPtr<Edge> edge);
+ void remove_outgoing_edges_to(SharedPtr<Node> 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<NodeView> 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<NodeView> src,
void
-MachinaCanvas::disconnect_node(boost::shared_ptr<NodeView>,// item1,
- boost::shared_ptr<NodeView>)// item2)
+MachinaCanvas::disconnect_node(boost::shared_ptr<NodeView> src,
+ boost::shared_ptr<NodeView> dst)
{
+ src->node()->remove_outgoing_edges_to(dst->node());
+ remove_connection(src, dst);
+
#if 0
boost::shared_ptr<MachinaPort> input
= boost::dynamic_pointer_cast<MachinaPort>(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<Machina::Engine> 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<Machina::Engine> 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 @@
<accelerator key="T" modifiers="GDK_CONTROL_MASK" signal="activate"/>
</widget>
</child>
-
- <child>
- <widget class="GtkCheckMenuItem" id="view_messages_menuitem">
- <property name="visible">True</property>
- <property name="tooltip" translatable="yes">View &quot;console&quot; messages</property>
- <property name="label" translatable="yes">_Messages</property>
- <property name="use_underline">True</property>
- <property name="active">False</property>
- <signal name="activate" handler="on_messages1_activate" last_modification_time="Sat, 14 Oct 2006 15:43:59 GMT"/>
- <accelerator key="M" modifiers="GDK_CONTROL_MASK" signal="activate"/>
- </widget>
- </child>
-
- <child>
- <widget class="GtkImageMenuItem" id="view_refresh_menuitem">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Refresh</property>
- <property name="use_underline">True</property>
- <signal name="activate" handler="on_refresh2_activate" last_modification_time="Sat, 11 Sep 2004 20:05:50 GMT"/>
- <accelerator key="R" modifiers="GDK_CONTROL_MASK" signal="activate"/>
-
- <child internal-child="image">
- <widget class="GtkImage" id="image677">
- <property name="visible">True</property>
- <property name="stock">gtk-refresh</property>
- <property name="icon_size">1</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
- </widget>
- </child>
</widget>
</child>
</widget>
@@ -532,10 +498,11 @@ along with Machina; if not, write to the Free Software Foundation, Inc.,
<property name="border_width">8</property>
<property name="title" translatable="yes">Machina Help</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
- <property name="window_position">GTK_WIN_POS_NONE</property>
+ <property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
<property name="modal">False</property>
- <property name="resizable">True</property>
+ <property name="resizable">False</property>
<property name="destroy_with_parent">False</property>
+ <property name="icon_name">gtk-help</property>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property>