void MediaJack::MouseOver( BPoint point, uint32 transit) { D_MOUSE(("MediaJack::MouseOver()\n")); switch (transit) { case B_ENTERED_VIEW: { be_app->SetCursor(M_CABLE_CURSOR); TipManager *tips = TipManager::Instance(); BString tipText = m_label.String(); tipText << " (" << MediaString::getStringFor(m_format.type) << ")"; tips->showTip(tipText.String(),view()->ConvertToScreen(Frame()), TipManager::LEFT_OFFSET_FROM_POINTER, BPoint(12.0, 8.0)); break; } case B_EXITED_VIEW: { if (!view()->isWireTracking()) { be_app->SetCursor(B_HAND_CURSOR); } break; } } }
void DiagramEndPoint::mouseDown( BPoint point, uint32 buttons, uint32 clicks) { D_MOUSE(("DiagramEndPoint::mouseDown()\n")); if (clicks == 1) { if (isSelectable()) { BMessage selectMsg(M_SELECTION_CHANGED); if (modifiers() & B_SHIFT_KEY) { selectMsg.AddBool("replace", false); } else { selectMsg.AddBool("replace", true); } selectMsg.AddPointer("item", reinterpret_cast<void *>(this)); DiagramView* v = view(); BMessenger(v).SendMessage(&selectMsg); } if (isDraggable() && (buttons == B_PRIMARY_MOUSE_BUTTON)) { BMessage dragMsg(M_WIRE_DRAGGED); dragMsg.AddPointer("from", static_cast<void *>(this)); view()->DragMessage(&dragMsg, BRect(0.0, 0.0, -1.0, -1.0), view()); view()->messageDragged(point, B_INSIDE_VIEW, &dragMsg); } } }
void MediaJack::MouseDown( BPoint point, uint32 buttons, uint32 clicks) { D_MOUSE(("MediaJack::MouseOver()\n")); // if connected, redirect to the wire if (isConnected()) { dynamic_cast<MediaWire *>(wire())->MouseDown(point, buttons, clicks); return; } // else we handle the mouse event ourselves switch (buttons) { case B_SECONDARY_MOUSE_BUTTON: { showContextMenu(point); break; } default: { DiagramEndPoint::MouseDown(point, buttons, clicks); } } }
void DiagramBox::mouseOver( BPoint point, uint32 transit) { D_MOUSE(("DiagramBox::mouseOver()\n")); DiagramItem *last = lastItemUnder(); if (last && (transit == B_EXITED_VIEW)) { last->mouseOver(point, B_EXITED_VIEW); resetItemUnder(); } else { DiagramItem *item = itemUnder(point); if (item) { if (item != last) { if (last) last->mouseOver(point, B_EXITED_VIEW); item->mouseOver(point, B_ENTERED_VIEW); } else { item->mouseOver(point, B_INSIDE_VIEW); } } else if (last) { last->mouseOver(point, B_EXITED_VIEW); } } }
void MediaRoutingView::BackgroundMouseDown(BPoint point, uint32 buttons, uint32 clicks) { D_MOUSE(("MediaRoutingView::BackgroundMouseDown()\n")); if ((buttons == B_SECONDARY_MOUSE_BUTTON) || (modifiers() & B_CONTROL_KEY)) { EndRectTracking(); showContextMenu(point); } }
void DiagramBox::messageDragged( BPoint point, uint32 transit, const BMessage *message) { D_MOUSE(("DiagramBox::messageDragged()\n")); DiagramItem *last = lastItemUnder(); if (last && (transit == B_EXITED_VIEW)) { last->messageDragged(point, B_EXITED_VIEW, message); resetItemUnder(); } else { DiagramItem *item = itemUnder(point); if (item) { if (item != last) { if (last) { last->messageDragged(point, B_EXITED_VIEW, message); } item->messageDragged(point, B_ENTERED_VIEW, message); } else { item->messageDragged(point, B_INSIDE_VIEW, message); } return; } else if (last) { last->messageDragged(point, B_EXITED_VIEW, message); } if (message->what == M_WIRE_DRAGGED) { view()->trackWire(point); } } }
void DiagramBox::mouseDown( BPoint point, uint32 buttons, uint32 clicks) { D_MOUSE(("DiagramBox::mouseDown()\n")); DiagramItem *item = itemUnder(point); if (item) { item->mouseDown(point, buttons, clicks); } else if (clicks == 1) { if (isSelectable()) { BMessage selectMsg(M_SELECTION_CHANGED); if (modifiers() & B_SHIFT_KEY) { selectMsg.AddBool("replace", false); } else { selectMsg.AddBool("replace", true); } selectMsg.AddPointer("item", reinterpret_cast<void *>(this)); DiagramView* v = view(); BMessenger(v).SendMessage(&selectMsg); } if (isDraggable() && (buttons == B_PRIMARY_MOUSE_BUTTON)) { BMessage dragMsg(M_BOX_DRAGGED); dragMsg.AddPointer("item", static_cast<void *>(this)); dragMsg.AddPoint("offset", point - frame().LeftTop()); view()->DragMessage(&dragMsg, BRect(0.0, 0.0, -1.0, -1.0), view()); } } }
void MediaJack::MessageDragged( BPoint point, uint32 transit, const BMessage *message) { D_MOUSE(("MediaJack::MessageDragged()\n")); switch (transit) { case B_ENTERED_VIEW: { be_app->SetCursor(M_CABLE_CURSOR); break; } case B_EXITED_VIEW: { if (!view()->isWireTracking()) { be_app->SetCursor(B_HAND_CURSOR); } break; } } DiagramEndPoint::MessageDragged(point, transit, message); }
void DiagramEndPoint::messageDragged( BPoint point, uint32 transit, const BMessage *message) { D_MOUSE(("DiagramEndPoint::messageDragged()\n")); switch (message->what) { case M_WIRE_DRAGGED: { D_MESSAGE(("DiagramEndPoint::messageDragged(M_WIRE_DRAGGED)\n")); switch (transit) { case B_INSIDE_VIEW: { //PRINT((" -> transit: B_INSIDE_VIEW\n")); // this is a WORK-AROUND caused by the unreliability // of BViews DragMessage() routine !! if (isConnecting()) { break; } else if (isConnected()) { view()->trackWire(point); } /* this should be enough in theory: if (!isConnecting()) { view()->trackWire(point); } //break;*/ } case B_ENTERED_VIEW: { //PRINT((" -> transit: B_ENTERED_VIEW\n")); DiagramEndPoint *endPoint; if ((message->FindPointer("from", reinterpret_cast<void **>(&endPoint)) == B_OK) && (endPoint != this)) { if (connectionRequested(endPoint)) { view()->trackWire(connectionPoint()); if (!isConnecting()) { m_connecting = true; connected(); } } else { view()->trackWire(point); if (isConnecting()) { m_connecting = false; disconnected(); } } } break; } case B_EXITED_VIEW: { //PRINT((" -> transit: B_EXITED_VIEW\n")); if (isConnecting()) { m_connecting = false; disconnected(); } break; } } break; } default: { DiagramItem::messageDragged(point, transit, message); } } }