diff options
author | David Robillard <d@drobilla.net> | 2007-03-26 05:27:56 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2007-03-26 05:27:56 +0000 |
commit | 2124952b855e093d6253bfd763cd9ebfe69e9def (patch) | |
tree | 51c9913a3630676d97c2c2e0e84d990e5108560b /src/gui | |
parent | 3dee4f8a64548dbb2aa11521e258865e5b93e9e3 (diff) | |
download | machina-2124952b855e093d6253bfd763cd9ebfe69e9def.tar.gz machina-2124952b855e093d6253bfd763cd9ebfe69e9def.tar.bz2 machina-2124952b855e093d6253bfd763cd9ebfe69e9def.zip |
Deleting selected states with delete key.
Fixed loading all states as initial.
git-svn-id: http://svn.drobilla.net/lad/machina@378 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/MachinaCanvas.cpp | 1 | ||||
-rw-r--r-- | src/gui/MachinaGUI.cpp | 29 | ||||
-rw-r--r-- | src/gui/MachinaGUI.hpp | 1 | ||||
-rw-r--r-- | src/gui/NodeView.cpp | 14 | ||||
-rw-r--r-- | src/gui/machina.glade | 1 |
5 files changed, 40 insertions, 6 deletions
diff --git a/src/gui/MachinaCanvas.cpp b/src/gui/MachinaCanvas.cpp index e11532e..a6a565e 100644 --- a/src/gui/MachinaCanvas.cpp +++ b/src/gui/MachinaCanvas.cpp @@ -15,7 +15,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -//#include "config.h" #include <map> #include <raul/SharedPtr.h> #include "machina/Node.hpp" diff --git a/src/gui/MachinaGUI.cpp b/src/gui/MachinaGUI.cpp index 381d8f4..ffbfb5a 100644 --- a/src/gui/MachinaGUI.cpp +++ b/src/gui/MachinaGUI.cpp @@ -75,7 +75,8 @@ MachinaGUI::MachinaGUI(SharedPtr<Machina::Engine> engine) xml->get_widget("arrange_but", _arrange_button); _canvas_scrolledwindow->add(*_canvas); - //m_canvas_scrolledwindow->signal_event().connect(sigc::mem_fun(_canvas, &FlowCanvas::scroll_event_handler)); + _canvas_scrolledwindow->signal_event().connect(sigc::mem_fun(this, + &MachinaGUI::scrolled_window_event)); _canvas->scroll_to(static_cast<int>(_canvas->width()/2 - 320), static_cast<int>(_canvas->height()/2 - 240)); // FIXME: hardcoded @@ -195,6 +196,32 @@ MachinaGUI::idle_callback() } +bool +MachinaGUI::scrolled_window_event(GdkEvent* event) +{ + if (event->type == GDK_KEY_PRESS) { + if (event->key.keyval == GDK_Delete) { + + ItemList selection = _canvas->selected_items(); + _canvas->clear_selection(); + + for (ItemList::iterator i = selection.begin(); + i != selection.end(); ++i) { + SharedPtr<NodeView> view = PtrCast<NodeView>(*i); + if (view) { + machine()->remove_node(view->node()); + _canvas->remove_item(view); + } + } + + return true; + } + } + + return false; +} + + void MachinaGUI::update_toolbar() { diff --git a/src/gui/MachinaGUI.hpp b/src/gui/MachinaGUI.hpp index 3c16f86..5dd943f 100644 --- a/src/gui/MachinaGUI.hpp +++ b/src/gui/MachinaGUI.hpp @@ -71,6 +71,7 @@ protected: void zoom_changed(); bool idle_callback(); void update_toolbar(); + bool scrolled_window_event(GdkEvent* ev); void on_pane_position_changed(); void on_messages_expander_changed(); diff --git a/src/gui/NodeView.cpp b/src/gui/NodeView.cpp index be40047..6ff21ee 100644 --- a/src/gui/NodeView.cpp +++ b/src/gui/NodeView.cpp @@ -43,10 +43,16 @@ NodeView::on_double_click(GdkEventButton*) void NodeView::on_click(GdkEventButton* event) { - if (event->button == 3) { - bool is_initial = _node->is_initial(); - _node->set_initial( ! is_initial ); - set_border_width(is_initial ? 1.0 : 2.0); + if (event->state & GDK_CONTROL_MASK) { + if (event->button == 1) { + bool is_initial = _node->is_initial(); + _node->set_initial( ! is_initial ); + set_border_width(is_initial ? 1.0 : 6.0); + } else if (event->button == 3) { + bool is_selector = _node->is_selector(); + _node->set_selector( ! is_selector ); + set_border_width(is_selector ? 1.0 : 3.0); + } } } diff --git a/src/gui/machina.glade b/src/gui/machina.glade index df73a85..5b12fa1 100644 --- a/src/gui/machina.glade +++ b/src/gui/machina.glade @@ -468,6 +468,7 @@ <property name="can_default">True</property> <property name="has_default">True</property> <property name="can_focus">True</property> + <property name="has_focus">True</property> <property name="hscrollbar_policy">GTK_POLICY_ALWAYS</property> <property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property> <property name="shadow_type">GTK_SHADOW_IN</property> |