aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-02-09 19:19:31 +0000
committerDavid Robillard <d@drobilla.net>2007-02-09 19:19:31 +0000
commitc5d5b612f91a45fb0f462fe554e4132d1af1db01 (patch)
treea9fe502939921e93fc75711f7294fbc7da0f0b9a /src
parent4543288514e1b0a83c6ed003dfb22e175e07bfaa (diff)
downloadmachina-c5d5b612f91a45fb0f462fe554e4132d1af1db01.tar.gz
machina-c5d5b612f91a45fb0f462fe554e4132d1af1db01.tar.bz2
machina-c5d5b612f91a45fb0f462fe554e4132d1af1db01.zip
Removed data type stuff from SLV2.
Reworked event system in FlowCanvas to use signals. Added straight connections and arrowheads to FlowCanvas, Ellipse fixes. git-svn-id: http://svn.drobilla.net/lad/machina@293 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/gui/MachinaCanvas.cpp37
-rw-r--r--src/gui/MachinaCanvas.hpp1
2 files changed, 25 insertions, 13 deletions
diff --git a/src/gui/MachinaCanvas.cpp b/src/gui/MachinaCanvas.cpp
index 2309a5c..303774f 100644
--- a/src/gui/MachinaCanvas.cpp
+++ b/src/gui/MachinaCanvas.cpp
@@ -25,6 +25,7 @@ MachinaCanvas::MachinaCanvas(MachinaGUI* app, int width, int height)
: FlowCanvas(width, height),
_app(app)
{
+
}
@@ -99,11 +100,11 @@ MachinaCanvas::status_message(const string& msg)
void
MachinaCanvas::item_selected(SharedPtr<Item> i)
{
+ cerr << "SELECTED: " << i->name() << endl;
+
SharedPtr<Connectable> item = PtrCast<Connectable>(i);
if (!item)
return;
-
- cerr << "SELECTED: " << i->name() << endl;
SharedPtr<Connectable> last = _last_selected.lock();
@@ -121,6 +122,15 @@ MachinaCanvas::item_selected(SharedPtr<Item> i)
}
+void
+MachinaCanvas::item_clicked(SharedPtr<Item> i, GdkEventButton* event)
+{
+ cerr << "CLICKED " << event->button << ": " << i->name() << endl;
+
+ //return false;
+}
+
+
bool
MachinaCanvas::canvas_event(GdkEvent* event)
{
@@ -133,25 +143,26 @@ MachinaCanvas::canvas_event(GdkEvent* event)
const double x = event->button.x;
const double y = event->button.y;
+ SharedPtr<Item> item;
+
if (event->button.button == 1) {
- SharedPtr<Ellipse> item(new Ellipse(shared_from_this(),
+ item = SharedPtr<Item>(new Ellipse(shared_from_this(),
string("Note")+(char)(last++ +'0'), x, y, 30, 30, true));
+ } else if (event->button.button == 2) {
+ item = SharedPtr<Item>(new Module(shared_from_this(),
+ string("Note")+(char)(last++ +'0'), x, y, true));
+ }
+
+ if (item) {
item->signal_selected.connect(sigc::bind(sigc::mem_fun(this,
&MachinaCanvas::item_selected), item));
+ item->signal_clicked.connect(sigc::bind<0>(sigc::mem_fun(this,
+ &MachinaCanvas::item_clicked), item));
add_item(item);
- item->raise_to_top();
- } else if (event->button.button == 2) {
- SharedPtr<Module> item(new Module(shared_from_this(),
- string("Note")+(char)(last++ +'0'), x, y, true));
item->resize();
- add_item(item);
- } else if (event->button.button == 3) {
- //_last_click_x = (int)event->button.x;
- //_last_click_y = (int)event->button.y;
- //show_menu(event);
+ item->raise_to_top();
}
}
return FlowCanvas::canvas_event(event);
}
-
diff --git a/src/gui/MachinaCanvas.hpp b/src/gui/MachinaCanvas.hpp
index 85ae550..b06a5d8 100644
--- a/src/gui/MachinaCanvas.hpp
+++ b/src/gui/MachinaCanvas.hpp
@@ -44,6 +44,7 @@ protected:
bool canvas_event(GdkEvent* event);
void item_selected(SharedPtr<Item> item);
+ void item_clicked(SharedPtr<Item> item, GdkEventButton* ev);
private:
MachinaGUI* _app;