aboutsummaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/MachinaCanvas.cpp1
-rw-r--r--src/gui/MachinaGUI.cpp29
-rw-r--r--src/gui/MachinaGUI.hpp1
-rw-r--r--src/gui/NodeView.cpp14
-rw-r--r--src/gui/machina.glade1
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>