fix wire DnD (for thru connections)

This commit is contained in:
Robin Gareus 2016-04-07 19:40:54 +02:00
parent 01251e7e14
commit 2e38195e5c
2 changed files with 13 additions and 9 deletions

View file

@ -848,16 +848,19 @@ PluginPinDialog::darea_size_allocate (Gtk::Allocation&)
}
bool
PluginPinDialog::drag_type_matches (CtrlType ct) {
PluginPinDialog::drag_type_matches (const CtrlElem& e) {
if (!_dragging || !_selection) {
return true;
}
if (_selection->ct == Input && ct == Sink) { return true; }
if (_selection->ct == Sink && ct == Input) { return true; }
if (_selection->ct == Output && ct == Source) { return true; }
if (_selection->ct == Source && ct == Output) { return true; }
if (_selection->ct == Input && ct == Output) { return true; }
if (_selection->ct == Output && ct == Input) { return true; }
if (_selection->dt != e->dt) {
return false;
}
if (_selection->ct == Input && e->ct == Sink) { return true; }
if (_selection->ct == Sink && e->ct == Input) { return true; }
if (_selection->ct == Output && e->ct == Source) { return true; }
if (_selection->ct == Source && e->ct == Output) { return true; }
if (_selection->ct == Input && e->ct == Output) { return true; }
if (_selection->ct == Output && e->ct == Input) { return true; }
return false;
}
@ -868,7 +871,8 @@ PluginPinDialog::darea_motion_notify_event (GdkEventMotion* ev)
_hover.reset ();
for (CtrlElemList::iterator i = _elements.begin (); i != _elements.end (); ++i) {
if (ev->x >= i->x && ev->x <= i->x + i->w
&& ev->y >= i->y && ev->y <= i->y + i->h && drag_type_matches (i->e->ct))
&& ev->y >= i->y && ev->y <= i->y + i->h
&& drag_type_matches (i->e))
{
if (!i->prelight) changed = true;
i->prelight = true;

View file

@ -104,7 +104,7 @@ private:
bool darea_motion_notify_event (GdkEventMotion*);
bool darea_button_press_event (GdkEventButton*);
bool darea_button_release_event (GdkEventButton*);
bool drag_type_matches (CtrlType ct);
bool drag_type_matches (const CtrlElem& ct);
void draw_io_pin (cairo_t*, const CtrlWidget&);
void draw_plugin_pin (cairo_t*, const CtrlWidget&);