diff --git a/src/apps/cortex/DiagramView/DiagramBox.cpp b/src/apps/cortex/DiagramView/DiagramBox.cpp index 7b3de92f52..9f1c328203 100644 --- a/src/apps/cortex/DiagramView/DiagramBox.cpp +++ b/src/apps/cortex/DiagramView/DiagramBox.cpp @@ -1,5 +1,11 @@ // DiagramBox.cpp +/*! \class DiagramBox + DiagramItem subclass providing a basic framework for + boxes in diagrams, i.e. objects that can contain various + endpoints +*/ + #include "DiagramBox.h" #include "DiagramDefs.h" #include "DiagramEndPoint.h" @@ -23,8 +29,8 @@ __USE_CORTEX_NAMESPACE DiagramBox::DiagramBox(BRect frame, uint32 flags) : DiagramItem(DiagramItem::M_BOX), DiagramItemGroup(DiagramItem::M_ENDPOINT), - m_frame(frame), - m_flags(flags) + fFrame(frame), + fFlags(flags) { D_METHOD(("DiagramBox::DiagramBox()\n")); makeDraggable(true); @@ -37,7 +43,13 @@ DiagramBox::~DiagramBox() } -// derived from DiagramItemGroup (public) +// #pragma mark - derived from DiagramItemGroup (public) + + +/*! Extends the DiagramItemGroup implementation by setting + the items owner and calling the attachedToDiagram() hook + on it +*/ bool DiagramBox::AddItem(DiagramItem *item) { @@ -45,7 +57,7 @@ DiagramBox::AddItem(DiagramItem *item) if (item) { if (DiagramItemGroup::AddItem(item)) { if (m_view) { - item->_setOwner(m_view); + item->_SetOwner(m_view); item->attachedToDiagram(); } return true; @@ -55,6 +67,9 @@ DiagramBox::AddItem(DiagramItem *item) } +/*! Extends the DiagramItemGroup implementation by calling + the detachedToDiagram() hook on the \a item +*/ bool DiagramBox::RemoveItem(DiagramItem *item) { @@ -62,7 +77,7 @@ DiagramBox::RemoveItem(DiagramItem *item) if (item) { item->detachedFromDiagram(); if (DiagramItemGroup::RemoveItem(item)) { - item->_setOwner(0); + item->_SetOwner(0); return true; } } @@ -70,41 +85,46 @@ DiagramBox::RemoveItem(DiagramItem *item) } -// derived from DiagramItem (public) +// #pragma mark - derived from DiagramItem (public) + + +/*! Prepares the drawing stack and clipping region, then + calls drawBox +*/ void -DiagramBox::draw(BRect updateRect) +DiagramBox::Draw(BRect updateRect) { - D_DRAW(("DiagramBox::draw()\n")); + D_DRAW(("DiagramBox::Draw()\n")); if (view()) { view()->PushState(); { - if (m_flags & M_DRAW_UNDER_ENDPOINTS) { + if (fFlags & M_DRAW_UNDER_ENDPOINTS) { BRegion region, clipping; - region.Include(frame()); + region.Include(Frame()); if (group()->GetClippingAbove(this, &clipping)) region.Exclude(&clipping); view()->ConstrainClippingRegion(®ion); - drawBox(); + DrawBox(); for (uint32 i = 0; i < CountItems(); i++) { DiagramItem *item = ItemAt(i); - if (region.Intersects(item->frame())) - item->draw(item->frame()); + if (region.Intersects(item->Frame())) + item->Draw(item->Frame()); } } else { BRegion region, clipping; - region.Include(frame()); + region.Include(Frame()); if (view()->GetClippingAbove(this, &clipping)) region.Exclude(&clipping); for (uint32 i = 0; i < CountItems(); i++) { DiagramItem *item = ItemAt(i); BRect r; - if (region.Intersects(r = item->frame())) { - item->draw(r); + if (region.Intersects(r = item->Frame())) { + item->Draw(r); region.Exclude(r); } } view()->ConstrainClippingRegion(®ion); - drawBox(); + DrawBox(); } } view()->PopState(); @@ -112,13 +132,16 @@ DiagramBox::draw(BRect updateRect) } +/*! Is called from the parent DiagramViews MouseDown() implementation + if the Box was hit; this version initiates selection and dragging +*/ void -DiagramBox::mouseDown(BPoint point, uint32 buttons, uint32 clicks) +DiagramBox::MouseDown(BPoint point, uint32 buttons, uint32 clicks) { - D_MOUSE(("DiagramBox::mouseDown()\n")); + D_MOUSE(("DiagramBox::MouseDown()\n")); DiagramItem *item = ItemUnder(point); if (item) - item->mouseDown(point, buttons, clicks); + item->MouseDown(point, buttons, clicks); else if (clicks == 1) { if (isSelectable()) { BMessage selectMsg(M_SELECTION_CHANGED); @@ -133,119 +156,138 @@ DiagramBox::mouseDown(BPoint point, uint32 buttons, uint32 clicks) if (isDraggable() && (buttons == B_PRIMARY_MOUSE_BUTTON)) { BMessage dragMsg(M_BOX_DRAGGED); dragMsg.AddPointer("item", static_cast(this)); - dragMsg.AddPoint("offset", point - frame().LeftTop()); + dragMsg.AddPoint("offset", point - Frame().LeftTop()); view()->DragMessage(&dragMsg, BRect(0.0, 0.0, -1.0, -1.0), view()); } } } + +/*! Is called from the DiagramViews MouseMoved() when no message is being + dragged, but the mouse has moved above the box +*/ void -DiagramBox::mouseOver(BPoint point, uint32 transit) +DiagramBox::MouseOver(BPoint point, uint32 transit) { - D_MOUSE(("DiagramBox::mouseOver()\n")); + D_MOUSE(("DiagramBox::MouseOver()\n")); DiagramItem *last = _LastItemUnder(); if (last && (transit == B_EXITED_VIEW)) { - last->mouseOver(point, 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); + last->MouseOver(point, B_EXITED_VIEW); + item->MouseOver(point, B_ENTERED_VIEW); } else - item->mouseOver(point, B_INSIDE_VIEW); + item->MouseOver(point, B_INSIDE_VIEW); } else if (last) - last->mouseOver(point, B_EXITED_VIEW); + last->MouseOver(point, B_EXITED_VIEW); } } +/*! Is called from the DiagramViews MouseMoved() when a message is being + dragged over the DiagramBox +*/ void -DiagramBox::messageDragged(BPoint point, uint32 transit, const BMessage *message) +DiagramBox::MessageDragged(BPoint point, uint32 transit, const BMessage *message) { - D_MOUSE(("DiagramBox::messageDragged()\n")); + D_MOUSE(("DiagramBox::MessageDragged()\n")); DiagramItem *last = _LastItemUnder(); if (last && (transit == B_EXITED_VIEW)) { - last->messageDragged(point, B_EXITED_VIEW, message); + 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); + last->MessageDragged(point, B_EXITED_VIEW, message); + item->MessageDragged(point, B_ENTERED_VIEW, message); } else - item->messageDragged(point, B_INSIDE_VIEW, message); + item->MessageDragged(point, B_INSIDE_VIEW, message); return; } else if (last) - last->messageDragged(point, B_EXITED_VIEW, message); + last->MessageDragged(point, B_EXITED_VIEW, message); if (message->what == M_WIRE_DRAGGED) view()->trackWire(point); } } +/*! Is called from the DiagramViews MessageReceived() function when a + message has been dropped on the DiagramBox +*/ void -DiagramBox::messageDropped(BPoint point, BMessage *message) +DiagramBox::MessageDropped(BPoint point, BMessage *message) { - D_METHOD(("DiagramBox::messageDropped()\n")); + D_METHOD(("DiagramBox::MessageDropped()\n")); DiagramItem *item = ItemUnder(point); if (item) { - item->messageDropped(point, message); + item->MessageDropped(point, message); return; } } -// operations (public) +// #pragma mark - operations (public) + + +/*! Moves the box by a given amount, and returns in updateRegion the + frames of wires impacted by the move +*/ void -DiagramBox::moveBy(float x, float y, BRegion *wireRegion) +DiagramBox::MoveBy(float x, float y, BRegion *wireRegion) { - D_METHOD(("DiagramBox::moveBy()\n")); + D_METHOD(("DiagramBox::MoveBy()\n")); if (view()) { view()->PushState(); { for (uint32 i = 0; i < CountItems(); i++) { DiagramEndPoint *endPoint = dynamic_cast(ItemAt(i)); if (endPoint) - endPoint->moveBy(x, y, wireRegion); + endPoint->MoveBy(x, y, wireRegion); } if (wireRegion) { - wireRegion->Include(m_frame); - m_frame.OffsetBy(x, y); - wireRegion->Include(m_frame); + wireRegion->Include(fFrame); + fFrame.OffsetBy(x, y); + wireRegion->Include(fFrame); } else - m_frame.OffsetBy(x, y); + fFrame.OffsetBy(x, y); } view()->PopState(); } } +//! Resizes the boxes frame without doing any updating void -DiagramBox::resizeBy(float horizontal, float vertical) +DiagramBox::ResizeBy(float horizontal, float vertical) { - D_METHOD(("DiagramBox::resizeBy()\n")); - m_frame.right += horizontal; - m_frame.bottom += vertical; + D_METHOD(("DiagramBox::ResizeBy()\n")); + fFrame.right += horizontal; + fFrame.bottom += vertical; } -// internal operations (private) +// #pragma mark - internal operations (private) + + +//! Is called by the DiagramView when added void -DiagramBox::_setOwner(DiagramView *owner) +DiagramBox::_SetOwner(DiagramView *owner) { - D_METHOD(("DiagramBox::_setOwner()\n")); + D_METHOD(("DiagramBox::_SetOwner()\n")); m_view = owner; for (uint32 i = 0; i < CountItems(DiagramItem::M_ENDPOINT); i++) { DiagramItem *item = ItemAt(i); - item->_setOwner(m_view); + item->_SetOwner(m_view); if (m_view) item->attachedToDiagram(); } diff --git a/src/apps/cortex/DiagramView/DiagramBox.h b/src/apps/cortex/DiagramView/DiagramBox.h index e8701ee515..b550fc5d9e 100644 --- a/src/apps/cortex/DiagramView/DiagramBox.h +++ b/src/apps/cortex/DiagramView/DiagramBox.h @@ -1,10 +1,5 @@ // DiagramBox.h (Cortex/DiagramView.h) // -// * PURPOSE -// DiagramItem subclass providing a basic framework for -// boxes in diagrams, i.e. objects that can contain various -// endpoints -// // * HISTORY // c.lenz 25sep99 Begun // @@ -23,80 +18,55 @@ __BEGIN_CORTEX_NAMESPACE class DiagramBox : public DiagramItem, public DiagramItemGroup { - public: // flags - - enum flag_t { - M_DRAW_UNDER_ENDPOINTS = 0x1 - }; - public: DiagramBox(BRect frame, uint32 flags = 0); virtual ~DiagramBox(); - public: // hook functions - // is called from draw() to do the actual drawing - virtual void drawBox() = 0; + virtual void DrawBox() = 0; + // a hook functions that + // is called from Draw() to do the actual drawing - public: // derived from DiagramItemGroup + // derived from DiagramItemGroup - // extends the DiagramItemGroup implementation by setting - // the items owner and calling the attachedToDiagram() hook - // on it virtual bool AddItem(DiagramItem *item); - - // extends the DiagramItemGroup implementation by calling - // the detachedToDiagram() hook on the item virtual bool RemoveItem(DiagramItem *item); - public: // derived from DiagramItem + // derived from DiagramItem // returns the Boxes frame rectangle - BRect frame() const { return m_frame; } + BRect Frame() const + { + return fFrame; + } - // prepares the drawing stack and clipping region, then - // calls drawBox - void draw(BRect updateRect); + void Draw(BRect updateRect); - // is called from the parent DiagramViews MouseDown() implementation - // if the Box was hit; this version initiates selection and dragging - virtual void mouseDown(BPoint point, uint32 buttons, uint32 clicks); - - // is called from the DiagramViews MouseMoved() when no message is being - // dragged, but the mouse has moved above the box - virtual void mouseOver(BPoint point, uint32 transit); + virtual void MouseDown(BPoint point, uint32 buttons, uint32 clicks); + virtual void MouseOver(BPoint point, uint32 transit); - // is called from the DiagramViews MouseMoved() when a message is being - // dragged over the DiagramBox - virtual void messageDragged(BPoint point, uint32 transit, const BMessage *message); + virtual void MessageDragged(BPoint point, uint32 transit, const BMessage *message); + virtual void MessageDropped(BPoint point, BMessage *message); - // is called from the DiagramViews MessageReceived() function when a - // message has been dropped on the DiagramBox - virtual void messageDropped(BPoint point, BMessage *message); - - public: // operations - - // moves the box by a given amount, and returns in updateRegion the - // frames of wires impacted by the move - void moveBy(float x, float y, BRegion *updateRegion); - - // resizes the boxes frame without doing any updating - virtual void resizeBy(float horizontal, float vertical); - - private:// internal methods - - // is called by the DiagramView when added - void _setOwner(DiagramView *owner); + void MoveBy(float x, float y, BRegion *updateRegion); + virtual void ResizeBy(float horizontal, float vertical); + + enum flag_t { + M_DRAW_UNDER_ENDPOINTS = 0x1 + }; private: - - // the boxes' frame rectangle - BRect m_frame; + void _SetOwner(DiagramView *owner); + + private: + BRect fFrame; + // the boxes' frame rectangle // flags: // M_DRAW_UNDER_ENDPOINTS - don't remove EndPoint frames from // the clipping region - uint32 m_flags; + uint32 fFlags; }; __END_CORTEX_NAMESPACE + #endif // DIAGRAM_BOX_H diff --git a/src/apps/cortex/DiagramView/DiagramEndPoint.cpp b/src/apps/cortex/DiagramView/DiagramEndPoint.cpp index 859375f038..2b561f6da6 100644 --- a/src/apps/cortex/DiagramView/DiagramEndPoint.cpp +++ b/src/apps/cortex/DiagramView/DiagramEndPoint.cpp @@ -42,7 +42,7 @@ DiagramEndPoint::~DiagramEndPoint() BPoint DiagramEndPoint::connectionPoint() const { D_METHOD(("DiagramEndPoint::connectionPoint()\n")); - return BPoint(frame().left + frame().Height() / 2.0, frame().top + frame().Width() / 2.0); + return BPoint(Frame().left + Frame().Height() / 2.0, Frame().top + Frame().Width() / 2.0); } bool DiagramEndPoint::connectionRequested( @@ -60,16 +60,16 @@ bool DiagramEndPoint::connectionRequested( // *** derived from DiagramItem // -------------------------------------------------------- // -void DiagramEndPoint::draw( +void DiagramEndPoint::Draw( BRect updateRect) { - D_METHOD(("DiagramEndPoint::draw()\n")); + D_METHOD(("DiagramEndPoint::Draw()\n")); if (view()) { view()->PushState(); { BRegion region; - region.Include(frame() & updateRect); + region.Include(Frame() & updateRect); view()->ConstrainClippingRegion(®ion); drawEndPoint(); } @@ -77,12 +77,12 @@ void DiagramEndPoint::draw( } } -void DiagramEndPoint::mouseDown( +void DiagramEndPoint::MouseDown( BPoint point, uint32 buttons, uint32 clicks) { - D_MOUSE(("DiagramEndPoint::mouseDown()\n")); + D_MOUSE(("DiagramEndPoint::MouseDown()\n")); if (clicks == 1) { if (isSelectable()) @@ -105,22 +105,22 @@ void DiagramEndPoint::mouseDown( BMessage dragMsg(M_WIRE_DRAGGED); dragMsg.AddPointer("from", static_cast(this)); view()->DragMessage(&dragMsg, BRect(0.0, 0.0, -1.0, -1.0), view()); - view()->messageDragged(point, B_INSIDE_VIEW, &dragMsg); + view()->MessageDragged(point, B_INSIDE_VIEW, &dragMsg); } } } -void DiagramEndPoint::messageDragged( +void DiagramEndPoint::MessageDragged( BPoint point, uint32 transit, const BMessage *message) { - D_MOUSE(("DiagramEndPoint::messageDragged()\n")); + D_MOUSE(("DiagramEndPoint::MessageDragged()\n")); switch (message->what) { case M_WIRE_DRAGGED: { - D_MESSAGE(("DiagramEndPoint::messageDragged(M_WIRE_DRAGGED)\n")); + D_MESSAGE(("DiagramEndPoint::MessageDragged(M_WIRE_DRAGGED)\n")); switch (transit) { case B_INSIDE_VIEW: @@ -186,21 +186,21 @@ void DiagramEndPoint::messageDragged( } default: { - DiagramItem::messageDragged(point, transit, message); + DiagramItem::MessageDragged(point, transit, message); } } } -void DiagramEndPoint::messageDropped( +void DiagramEndPoint::MessageDropped( BPoint point, BMessage *message) { - D_MESSAGE(("DiagramEndPoint::messageDropped()\n")); + D_MESSAGE(("DiagramEndPoint::MessageDropped()\n")); switch (message->what) { case M_WIRE_DRAGGED: { - D_MESSAGE(("DiagramEndPoint::messageDropped(M_WIRE_DRAGGED)\n")); + D_MESSAGE(("DiagramEndPoint::MessageDropped(M_WIRE_DRAGGED)\n")); DiagramEndPoint *endPoint; if ((message->FindPointer("from", reinterpret_cast(&endPoint)) == B_OK) && (endPoint != this)) @@ -222,7 +222,7 @@ void DiagramEndPoint::messageDropped( } default: { - DiagramItem::messageDropped(point, message); + DiagramItem::MessageDropped(point, message); } } } @@ -231,18 +231,18 @@ void DiagramEndPoint::messageDropped( // *** frame related operations // -------------------------------------------------------- // -void DiagramEndPoint::moveBy( +void DiagramEndPoint::MoveBy( float x, float y, BRegion *updateRegion) { - D_METHOD(("DiagramEndPoint::moveBy()\n")); + D_METHOD(("DiagramEndPoint::MoveBy()\n")); if (isConnected() && m_wire && updateRegion) { - updateRegion->Include(m_wire->frame()); + updateRegion->Include(m_wire->Frame()); m_frame.OffsetBy(x, y); m_wire->endPointMoved(this); - updateRegion->Include(m_wire->frame()); + updateRegion->Include(m_wire->Frame()); } else { @@ -254,11 +254,11 @@ void DiagramEndPoint::moveBy( } } -void DiagramEndPoint::resizeBy( +void DiagramEndPoint::ResizeBy( float horizontal, float vertical) { - D_METHOD(("DiagramEndPoint::resizeBy()\n")); + D_METHOD(("DiagramEndPoint::ResizeBy()\n")); m_frame.right += horizontal; m_frame.bottom += vertical; } diff --git a/src/apps/cortex/DiagramView/DiagramEndPoint.h b/src/apps/cortex/DiagramView/DiagramEndPoint.h index dc4f0d9adb..12ed8f61fd 100644 --- a/src/apps/cortex/DiagramView/DiagramEndPoint.h +++ b/src/apps/cortex/DiagramView/DiagramEndPoint.h @@ -38,7 +38,7 @@ public: // *** accessors public: // *** hook functions - // is called from draw() to do the actual drawing + // is called from Draw() to do the actual drawing virtual void drawEndPoint() = 0; // should return the BPoint that a connected wire uses as @@ -46,7 +46,7 @@ public: // *** hook functions // point of the EndPoint virtual BPoint connectionPoint() const; - // is called from messageDragged() and messageDropped() to + // is called from MessageDragged() and MessageDropped() to // let you verify that a connection is okay virtual bool connectionRequested( DiagramEndPoint *fromWhich); @@ -64,42 +64,42 @@ public: // *** hook functions public: // *** derived from DiagramItem // returns the EndPoints frame rectangle - BRect frame() const + BRect Frame() const { return m_frame; } // prepares the drawing stack and clipping region, then // calls drawEndPoint - void draw( + void Draw( BRect updateRect); - // is called from the parent DiagramBox's mouseDown() + // is called from the parent DiagramBox's MouseDown() // implementation if the EndPoint was hit; this version // initiates selection and dragging (i.e. connecting) - virtual void mouseDown( + virtual void MouseDown( BPoint point, uint32 buttons, uint32 clicks); - // is called from the parent DiagramBox's mouseOver() + // is called from the parent DiagramBox's MouseOver() // implementation if the mouse is over the EndPoint - virtual void mouseOver( + virtual void MouseOver( BPoint point, uint32 transit) { /* does nothing */ } - // is called from the parent DiagramBox's messageDragged() + // is called from the parent DiagramBox's MessageDragged() // implementation of a message is being dragged of the // EndPoint; this implementation handles only wire drags // (i.e. M_WIRE_DRAGGED messages) - virtual void messageDragged( + virtual void MessageDragged( BPoint point, uint32 transit, const BMessage *message); - // is called from the parent DiagramBox's messageDropped() + // is called from the parent DiagramBox's MessageDropped() // implementation if the message was dropped on the EndPoint; // this version handles wire dropping (connecting) - virtual void messageDropped( + virtual void MessageDropped( BPoint point, BMessage *message); @@ -107,13 +107,13 @@ public: // *** derived from DiagramItem // updateRegion the frames of connected wires if there are any // NOTE: no drawing/refreshing is done in this method, that's // up to the parent - void moveBy( + void MoveBy( float x, float y, BRegion *updateRegion); // resize the EndPoints frame rectangle without redraw - virtual void resizeBy( + virtual void ResizeBy( float horizontal, float vertical); diff --git a/src/apps/cortex/DiagramView/DiagramItem.cpp b/src/apps/cortex/DiagramView/DiagramItem.cpp index 66582b5da4..b6daf6a297 100644 --- a/src/apps/cortex/DiagramView/DiagramItem.cpp +++ b/src/apps/cortex/DiagramView/DiagramItem.cpp @@ -50,7 +50,7 @@ void DiagramItem::select() m_lastSelectionTime = m_selectionTime = system_time(); m_countSelected = 1; selected(); - view()->Invalidate(frame()); + view()->Invalidate(Frame()); } } @@ -62,7 +62,7 @@ void DiagramItem::selectAdding() m_selected = true; m_selectionTime = m_lastSelectionTime - m_countSelected++; selected(); - view()->Invalidate(frame()); + view()->Invalidate(Frame()); } } @@ -73,7 +73,7 @@ void DiagramItem::deselect() { m_selected = false; deselected(); - view()->Invalidate(frame()); + view()->Invalidate(Frame()); } } @@ -85,7 +85,7 @@ float DiagramItem::howCloseTo( BPoint point) const { D_METHOD(("DiagramItem::howCloseTo()\n")); - if (frame().Contains(point)) + if (Frame().Contains(point)) { return 1.0; } diff --git a/src/apps/cortex/DiagramView/DiagramItem.h b/src/apps/cortex/DiagramView/DiagramItem.h index 6a08b85fb6..d9d126f9fe 100644 --- a/src/apps/cortex/DiagramView/DiagramItem.h +++ b/src/apps/cortex/DiagramView/DiagramItem.h @@ -89,19 +89,19 @@ public: // *** operations // state has actually changed void deselect(); - // moves the items frame to a given point by calling moveBy with the + // moves the items frame to a given point by calling MoveBy with the // absolute coords translated into relative shift amount void moveTo( BPoint point, BRegion *updateRegion = 0) - { moveBy(point.x - frame().left, point.y - frame().top, updateRegion); } + { MoveBy(point.x - Frame().left, point.y - Frame().top, updateRegion); } - // resizes the items frame to given dimensions; simply calls the resizeBy + // resizes the items frame to given dimensions; simply calls the ResizeBy // implementation void resizeTo( float width, float height) - { resizeBy(width - frame().Width(), height - frame().Height()); } + { ResizeBy(width - Frame().Width(), height - Frame().Height()); } public: // *** hook functions @@ -117,7 +117,7 @@ public: // *** hook functions // is called from the DiagramViews MouseDown() function after // finding out the mouse buttons and clicks quantity. - virtual void mouseDown( + virtual void MouseDown( BPoint point, uint32 buttons, uint32 clicks) @@ -125,14 +125,14 @@ public: // *** hook functions // is called from the DiagramViews MouseMoved() when *no* message is being // dragged, i.e. the mouse is simply floating above the item - virtual void mouseOver( + virtual void MouseOver( BPoint point, uint32 transit) {/* does nothing */} // is called from the DiagramViews MouseMoved() when a message is being // dragged; always call the base class version when overriding! - virtual void messageDragged( + virtual void MessageDragged( BPoint point, uint32 transit, const BMessage *message) @@ -141,7 +141,7 @@ public: // *** hook functions // is called from the DiagramViews MessageReceived() function when an // message has been received through Drag&Drop; always call the base // class version when overriding! - virtual void messageDropped( + virtual void MessageDropped( BPoint point, BMessage *message) {/* does nothing */} @@ -156,7 +156,7 @@ public: // *** interface definition // this function must be implemented by derived classes to return the // items frame rectangle in the DiagramViews coordinates - virtual BRect frame() const = 0; + virtual BRect Frame() const = 0; // this function should be implemented for non-rectangular subclasses // (like wires) to estimate how close a given point is to the object; @@ -166,8 +166,8 @@ public: // *** interface definition BPoint point) const; // this is the hook function called by DiagramView when it's time to - // draw the object - virtual void draw( + // Draw the object + virtual void Draw( BRect updateRect) = 0; // should move the items frame by the specified amount and do the @@ -175,14 +175,14 @@ public: // *** interface definition // caller supplied a BRegion pointer in updateRegion, this method // should add other areas affected by the move to it (e.g. wire // frames) - virtual void moveBy( + virtual void MoveBy( float x, float y, BRegion *updateRegion = 0) { /* does nothing */ } // should resize the items frame by the specified amount - virtual void resizeBy( + virtual void ResizeBy( float horizontal, float vertical) { /* does nothing */ } @@ -215,7 +215,7 @@ protected: // *** internal methods // called only by DiagramItemGroup objects in the method // addItem() - virtual void _setOwner( + virtual void _SetOwner( DiagramView *owner) { m_view = owner; } diff --git a/src/apps/cortex/DiagramView/DiagramItemGroup.cpp b/src/apps/cortex/DiagramView/DiagramItemGroup.cpp index d2ea303b41..8a6879d127 100644 --- a/src/apps/cortex/DiagramView/DiagramItemGroup.cpp +++ b/src/apps/cortex/DiagramView/DiagramItemGroup.cpp @@ -20,7 +20,7 @@ __USE_CORTEX_NAMESPACE DiagramItemGroup::DiagramItemGroup(uint32 acceptedTypes, bool multiSelection) - : fBoxes(0), + :fBoxes(0), fWires(0), fEndPoints(0), fSelection(0), @@ -74,8 +74,9 @@ DiagramItemGroup::~DiagramItemGroup() // #pragma mark - item accessors -//! Returns the number of items in the group (optionally only those -// of the given type \param whichType) +/*! Returns the number of items in the group (optionally only those + of the given type \param whichType) +*/ uint32 DiagramItemGroup::CountItems(uint32 whichType) const { @@ -149,7 +150,7 @@ DiagramItemGroup::ItemUnder(BPoint point) if (fTypes & DiagramItem::M_BOX) { for (uint32 i = 0; i < CountItems(DiagramItem::M_BOX); i++) { DiagramItem *item = ItemAt(i, DiagramItem::M_BOX); - if (item->frame().Contains(point) && (item->howCloseTo(point) == 1.0)) { + if (item->Frame().Contains(point) && (item->howCloseTo(point) == 1.0)) { // DiagramItemGroup *group = dynamic_cast(item); return (fLastItemUnder = item); } @@ -161,7 +162,7 @@ DiagramItemGroup::ItemUnder(BPoint point) DiagramItem *closestItem = 0; for (uint32 i = 0; i < CountItems(DiagramItem::M_WIRE); i++) { DiagramItem *item = ItemAt(i, DiagramItem::M_WIRE); - if (item->frame().Contains(point)) { + if (item->Frame().Contains(point)) { float howClose = item->howCloseTo(point); if (howClose > closest) { closestItem = item; @@ -179,7 +180,7 @@ DiagramItemGroup::ItemUnder(BPoint point) if (fTypes & DiagramItem::M_ENDPOINT) { for (uint32 i = 0; i < CountItems(DiagramItem::M_ENDPOINT); i++) { DiagramItem *item = ItemAt(i, DiagramItem::M_ENDPOINT); - if (item->frame().Contains(point) && (item->howCloseTo(point) == 1.0)) + if (item->Frame().Contains(point) && (item->howCloseTo(point) == 1.0)) return (fLastItemUnder = item); } } @@ -295,7 +296,7 @@ DiagramItemGroup::SortItems(uint32 whichType, } -/*! Fires a draw() command at all items of a specific type that +/*! Fires a Draw() command at all items of a specific type that intersect with the \param updateRect; items are drawn in reverse order; they should be sorted by selection time before this function gets called, so that @@ -308,18 +309,18 @@ DiagramItemGroup::DrawItems(BRect updateRect, uint32 whichType, BRegion* updateR if (whichType & DiagramItem::M_WIRE) { for (int32 i = CountItems(DiagramItem::M_WIRE) - 1; i >= 0; i--) { DiagramItem *item = ItemAt(i, DiagramItem::M_WIRE); - if (item->frame().Intersects(updateRect)) - item->draw(updateRect); + if (item->Frame().Intersects(updateRect)) + item->Draw(updateRect); } } if (whichType & DiagramItem::M_BOX) { for (int32 i = CountItems(DiagramItem::M_BOX) - 1; i >= 0; i--) { DiagramItem *item = ItemAt(i, DiagramItem::M_BOX); - if (item && item->frame().Intersects(updateRect)) { - item->draw(updateRect); + if (item && item->Frame().Intersects(updateRect)) { + item->Draw(updateRect); if (updateRegion) - updateRegion->Exclude(item->frame()); + updateRegion->Exclude(item->Frame()); } } } @@ -327,8 +328,8 @@ DiagramItemGroup::DrawItems(BRect updateRect, uint32 whichType, BRegion* updateR if (whichType & DiagramItem::M_ENDPOINT) { for (int32 i = CountItems(DiagramItem::M_ENDPOINT) - 1; i >= 0; i--) { DiagramItem *item = ItemAt(i, DiagramItem::M_ENDPOINT); - if (item && item->frame().Intersects(updateRect)) - item->draw(updateRect); + if (item && item->Frame().Intersects(updateRect)) + item->Draw(updateRect); } } } @@ -349,11 +350,11 @@ DiagramItemGroup::GetClippingAbove(DiagramItem *which, BRegion *region) { int32 index = fBoxes->IndexOf(which); if (index >= 0) { // the item was found - BRect r = which->frame(); + BRect r = which->Frame(); for (int32 i = 0; i < index; i++) { DiagramItem *item = ItemAt(i, DiagramItem::M_BOX); - if (item && item->frame().Intersects(r)) { - region->Include(item->frame() & r); + if (item && item->Frame().Intersects(r)) { + region->Include(item->Frame() & r); found = true; } } @@ -363,11 +364,11 @@ DiagramItemGroup::GetClippingAbove(DiagramItem *which, BRegion *region) case DiagramItem::M_WIRE: { - BRect r = which->frame(); + BRect r = which->Frame(); for (uint32 i = 0; i < CountItems(DiagramItem::M_BOX); i++) { DiagramItem *item = ItemAt(i, DiagramItem::M_BOX); - if (item && item->frame().Intersects(r)) { - region->Include(item->frame() & r); + if (item && item->Frame().Intersects(r)) { + region->Include(item->Frame() & r); found = true; } } @@ -549,7 +550,7 @@ DiagramItemGroup::DragSelectionBy(float x, float y, BRegion* updateRegion) for (int32 i = CountSelectedItems() - 1; i >= 0; i--) { DiagramItem *item = dynamic_cast(SelectedItemAt(i)); if (item->isDraggable()) - item->moveBy(x, y, updateRegion); + item->MoveBy(x, y, updateRegion); } } } diff --git a/src/apps/cortex/DiagramView/DiagramItemGroup.h b/src/apps/cortex/DiagramView/DiagramItemGroup.h index b358b21888..ce76088968 100644 --- a/src/apps/cortex/DiagramView/DiagramItemGroup.h +++ b/src/apps/cortex/DiagramView/DiagramItemGroup.h @@ -24,19 +24,21 @@ class DiagramItemGroup { DiagramItemGroup(uint32 acceptedTypes, bool multiSelection = true); virtual ~DiagramItemGroup(); - public: // hook functions + // hook function // is called whenever the current selection has changed virtual void SelectionChanged() { } - public: // item accessors + // item accessors + uint32 CountItems(uint32 whichType = DiagramItem::M_ANY) const; DiagramItem* ItemAt(uint32 index, uint32 whichType = DiagramItem::M_ANY) const; DiagramItem* ItemUnder(BPoint point); - public: // item operations + // item operations + virtual bool AddItem(DiagramItem* item); bool RemoveItem(DiagramItem* item); void SortItems(uint32 itemType, @@ -45,7 +47,8 @@ class DiagramItemGroup { BRegion *updateRegion = 0); bool GetClippingAbove(DiagramItem* which, BRegion* outRegion); - public: // selection accessors + // selection accessors + uint32 SelectedType() const; uint32 CountSelectedItems() const; DiagramItem* SelectedItemAt(uint32 index) const; @@ -57,7 +60,8 @@ class DiagramItemGroup { return fMultiSelection; } - public: // selection related operations + // selection related operations + bool SelectItem(DiagramItem* which, bool deselectOthers = true); bool DeselectItem(DiagramItem *which); void SortSelectedItems(int (*compareFunc)(const void *, const void *)); @@ -66,7 +70,7 @@ class DiagramItemGroup { void DragSelectionBy(float x, float y, BRegion *updateRegion); void RemoveSelection(); - public: // alignment related + // alignment related // set/get the 'item alignment' grid size; this is used when // items are being dragged and inserted diff --git a/src/apps/cortex/DiagramView/DiagramView.cpp b/src/apps/cortex/DiagramView/DiagramView.cpp index 040cc31359..b885757065 100644 --- a/src/apps/cortex/DiagramView/DiagramView.cpp +++ b/src/apps/cortex/DiagramView/DiagramView.cpp @@ -53,17 +53,17 @@ DiagramView::~DiagramView() // *** hook functions // -------------------------------------------------------- // -void DiagramView::messageDragged( +void DiagramView::MessageDragged( BPoint point, uint32 transit, const BMessage *message) { - D_METHOD(("DiagramView::messageDragged()\n")); + D_METHOD(("DiagramView::MessageDragged()\n")); switch (message->what) { case M_WIRE_DRAGGED: { - D_MESSAGE(("DiagramView::messageDragged(M_WIRE_DROPPED)\n")); + D_MESSAGE(("DiagramView::MessageDragged(M_WIRE_DROPPED)\n")); if (!m_draggedWire) { DiagramEndPoint *fromEndPoint; @@ -78,16 +78,16 @@ void DiagramView::messageDragged( } } -void DiagramView::messageDropped( +void DiagramView::MessageDropped( BPoint point, BMessage *message) { - D_METHOD(("DiagramView::messageDropped()\n")); + D_METHOD(("DiagramView::MessageDropped()\n")); switch (message->what) { case M_WIRE_DRAGGED: { - D_MESSAGE(("DiagramView::messageDropped(M_WIRE_DROPPED)\n")); + D_MESSAGE(("DiagramView::MessageDropped(M_WIRE_DROPPED)\n")); DiagramEndPoint *fromWhich = 0; if (message->FindPointer("from", reinterpret_cast(&fromWhich)) == B_OK) { @@ -198,12 +198,12 @@ void DiagramView::MessageReceived( DiagramItem *item = ItemUnder(point); if (item) { - item->messageDropped(point, message); + item->MessageDropped(point, message); return; } else { - messageDropped(point, message); + MessageDropped(point, message); } } else @@ -308,7 +308,7 @@ void DiagramView::MouseDown( DiagramItem *item = ItemUnder(point); if (item) { - item->mouseDown(point, m_lastButton, m_clickCount); + item->MouseDown(point, m_lastButton, m_clickCount); } else // no, the background was clicked { @@ -316,7 +316,7 @@ void DiagramView::MouseDown( SelectionChanged(); if (MultipleSelection() && (m_lastButton == B_PRIMARY_MOUSE_BUTTON) && !(modifiers() & B_CONTROL_KEY)) _beginRectTracking(point); - mouseDown(point, m_lastButton, m_clickCount); + BackgroundMouseDown(point, m_lastButton, m_clickCount); } } @@ -395,8 +395,8 @@ void DiagramView::MouseMoved( if (box) { BRegion updateRegion; - DragSelectionBy(point.x - box->frame().left - offset.x, - point.y - box->frame().top - offset.y, + DragSelectionBy(point.x - box->Frame().left - offset.x, + point.y - box->Frame().top - offset.y, &updateRegion); updateDataRect(); for (int32 i = 0; i < updateRegion.CountRects(); i++) @@ -407,15 +407,15 @@ void DiagramView::MouseMoved( } break; } - default: // unkwown message -> redirect to messageDragged() + default: // unkwown message -> redirect to MessageDragged() { DiagramItem *last = _LastItemUnder(); if (transit == B_EXITED_VIEW) { if (last) { - last->messageDragged(point, B_EXITED_VIEW, message); - messageDragged(point, B_EXITED_VIEW, message); + last->MessageDragged(point, B_EXITED_VIEW, message); + MessageDragged(point, B_EXITED_VIEW, message); } } else @@ -426,38 +426,38 @@ void DiagramView::MouseMoved( if (item != last) { if (last) - last->messageDragged(point, B_EXITED_VIEW, message); - item->messageDragged(point, B_ENTERED_VIEW, message); + last->MessageDragged(point, B_EXITED_VIEW, message); + item->MessageDragged(point, B_ENTERED_VIEW, message); } else { - item->messageDragged(point, B_INSIDE_VIEW, message); + item->MessageDragged(point, B_INSIDE_VIEW, message); } } else if (last) { - last->messageDragged(point, B_EXITED_VIEW, message); - messageDragged(point, B_ENTERED_VIEW, message); + last->MessageDragged(point, B_EXITED_VIEW, message); + MessageDragged(point, B_ENTERED_VIEW, message); } else { - messageDragged(point, transit, message); + MessageDragged(point, transit, message); } } break; } } } - else // no message at all -> redirect to mouseOver() + else // no message at all -> redirect to MouseOver() { DiagramItem *last = _LastItemUnder(); if ((transit == B_EXITED_VIEW) || (transit == B_OUTSIDE_VIEW)) { if (last) { - last->mouseOver(point, B_EXITED_VIEW); + last->MouseOver(point, B_EXITED_VIEW); _ResetItemUnder(); - mouseOver(point, B_EXITED_VIEW); + MouseOver(point, B_EXITED_VIEW); } } else @@ -468,18 +468,18 @@ void DiagramView::MouseMoved( if (item != last) { if (last) - last->mouseOver(point, B_EXITED_VIEW); - item->mouseOver(point, B_ENTERED_VIEW); + last->MouseOver(point, B_EXITED_VIEW); + item->MouseOver(point, B_ENTERED_VIEW); } else { - item->mouseOver(point, B_INSIDE_VIEW); + item->MouseOver(point, B_INSIDE_VIEW); } } else if (last) { - last->mouseOver(point, B_EXITED_VIEW); - mouseOver(point, B_ENTERED_VIEW); + last->MouseOver(point, B_EXITED_VIEW); + MouseOver(point, B_ENTERED_VIEW); } } } @@ -509,7 +509,7 @@ bool DiagramView::AddItem( { if (DiagramItemGroup::AddItem(item)) { - item->_setOwner(this); + item->_SetOwner(this); item->attachedToDiagram(); if (item->type() == DiagramItem::M_BOX) { @@ -530,7 +530,7 @@ bool DiagramView::RemoveItem( item->detachedFromDiagram(); if (DiagramItemGroup::RemoveItem(item)) { - item->_setOwner(0); + item->_SetOwner(0); if (item->type() == DiagramItem::M_BOX) { updateDataRect(); @@ -552,10 +552,10 @@ void DiagramView::trackWire( if (m_draggedWire) { BRegion region; - region.Include(m_draggedWire->frame()); + region.Include(m_draggedWire->Frame()); m_draggedWire->m_dragEndPoint = point; m_draggedWire->endPointMoved(); - region.Include(m_draggedWire->frame()); + region.Include(m_draggedWire->Frame()); region.Exclude(&m_boxRegion); for (int32 i = 0; i < region.CountRects(); i++) { @@ -633,7 +633,7 @@ DiagramView::updateDataRect() // calculate the area in which boxes display m_boxRegion.MakeEmpty(); for (uint32 i = 0; i < CountItems(DiagramItem::M_BOX); i++) { - m_boxRegion.Include(ItemAt(i, DiagramItem::M_BOX)->frame()); + m_boxRegion.Include(ItemAt(i, DiagramItem::M_BOX)->Frame()); } // adapt the data rect to the new region of boxes BRect boxRect = m_boxRegion.Frame(); @@ -654,7 +654,7 @@ DiagramView::_beginWireTracking(DiagramEndPoint *startPoint) m_draggedWire = createWire(startPoint); AddItem(m_draggedWire); SelectItem(m_draggedWire, true); - Invalidate(startPoint->frame()); + Invalidate(startPoint->Frame()); } void DiagramView::_endWireTracking() @@ -663,7 +663,7 @@ void DiagramView::_endWireTracking() if (m_draggedWire) { RemoveItem(m_draggedWire); - Invalidate(m_draggedWire->frame()); + Invalidate(m_draggedWire->Frame()); DiagramEndPoint *endPoint = m_draggedWire->startPoint(); if (!endPoint) { @@ -671,7 +671,7 @@ void DiagramView::_endWireTracking() } if (endPoint) { - Invalidate(endPoint->frame()); + Invalidate(endPoint->Frame()); } delete m_draggedWire; m_draggedWire = 0; @@ -702,7 +702,7 @@ DiagramView::_trackRect(BPoint origin, BPoint current) for (uint32 i = 0; i < CountItems(DiagramItem::M_BOX); i++) { DiagramBox *box = dynamic_cast(ItemAt(i, DiagramItem::M_BOX)); if (box) { - if (rect.Intersects(box->frame())) + if (rect.Intersects(box->Frame())) changed |= SelectItem(box, false); else changed |= DeselectItem(box); diff --git a/src/apps/cortex/DiagramView/DiagramView.h b/src/apps/cortex/DiagramView/DiagramView.h index aa3d200830..570c8b9ac5 100644 --- a/src/apps/cortex/DiagramView/DiagramView.h +++ b/src/apps/cortex/DiagramView/DiagramView.h @@ -68,8 +68,8 @@ public: // *** hook functions virtual DiagramWire *createWire( DiagramEndPoint *fromWhich) = 0; - // hook called from MouseDown() if the background was hit - virtual void mouseDown( + // hook called from BackgroundMouseDown() if the background was hit + virtual void BackgroundMouseDown( BPoint point, uint32 buttons, uint32 clicks) @@ -77,21 +77,21 @@ public: // *** hook functions // hook called from MouseMoved() if the mouse is floating over // the background (i.e. with no message attached) - virtual void mouseOver( + virtual void MouseOver( BPoint point, uint32 transit) { /* does nothing */ } // hook called from MouseMoved() if a message is being dragged // over the background - virtual void messageDragged( + virtual void MessageDragged( BPoint point, uint32 transit, const BMessage *message); // hook called from MessageReceived() if a message has been // dropped over the background - virtual void messageDropped( + virtual void MessageDropped( BPoint point, BMessage *message); @@ -125,14 +125,14 @@ public: // derived from BView int32 numBytes); // if an item is located at the click point, this function calls - // that items mouseDown() method; else a deselectAll() command is + // that items MouseDown() method; else a deselectAll() command is // made and rect-tracking is initiated virtual void MouseDown( BPoint point); // if an item is located under the given point, this function - // calls that items messageDragged() hook if a message is being - // dragged, and mouseOver() if not + // calls that items MessageDragged() hook if a message is being + // dragged, and MouseOver() if not virtual void MouseMoved( BPoint point, uint32 transit, diff --git a/src/apps/cortex/DiagramView/DiagramWire.cpp b/src/apps/cortex/DiagramView/DiagramWire.cpp index b8457a7800..4dcb769f96 100644 --- a/src/apps/cortex/DiagramView/DiagramWire.cpp +++ b/src/apps/cortex/DiagramView/DiagramWire.cpp @@ -118,16 +118,16 @@ float DiagramWire::howCloseTo( return result; } -void DiagramWire::draw( +void DiagramWire::Draw( BRect updateRect) { - D_METHOD(("DiagramWire::draw()\n")); + D_METHOD(("DiagramWire::Draw()\n")); if (view()) { view()->PushState(); { BRegion region, clipping; - region.Include(frame() & updateRect); + region.Include(Frame() & updateRect); if (view()->GetClippingAbove(this, &clipping)) region.Exclude(&clipping); view()->ConstrainClippingRegion(®ion); @@ -137,12 +137,12 @@ void DiagramWire::draw( } } -void DiagramWire::mouseDown( +void DiagramWire::MouseDown( BPoint point, uint32 buttons, uint32 clicks) { - D_METHOD(("DiagramWire::mouseDown()\n")); + D_METHOD(("DiagramWire::MouseDown()\n")); if (clicks == 1) { if (isSelectable()) @@ -163,12 +163,12 @@ void DiagramWire::mouseDown( } } -void DiagramWire::messageDragged( +void DiagramWire::MessageDragged( BPoint point, uint32 transit, const BMessage *message) { - D_METHOD(("DiagramWire::messageDragged()\n")); + D_METHOD(("DiagramWire::MessageDragged()\n")); switch (message->what) { case M_WIRE_DRAGGED: @@ -178,7 +178,7 @@ void DiagramWire::messageDragged( } default: { - DiagramItem::messageDragged(point, transit, message); + DiagramItem::MessageDragged(point, transit, message); } } } diff --git a/src/apps/cortex/DiagramView/DiagramWire.h b/src/apps/cortex/DiagramView/DiagramWire.h index 332d025023..388a7c78de 100644 --- a/src/apps/cortex/DiagramView/DiagramWire.h +++ b/src/apps/cortex/DiagramView/DiagramWire.h @@ -65,7 +65,7 @@ public: // *** accessors public: // *** hook functions - // is called from draw() to do the actual drawing + // is called from Draw() to do the actual drawing virtual void drawWire() = 0; // is called by the connected diagramEndPoints whenever one is moved @@ -77,7 +77,7 @@ public: // *** hook functions public: // *** derived from DiagramItem // returns the area in which the wire displays - virtual BRect frame() const + virtual BRect Frame() const { return BRect(startConnectionPoint(), endConnectionPoint()); } // returns how close a given point is to the wire; the current @@ -88,19 +88,19 @@ public: // *** derived from DiagramItem // prepares the drawing stack and clipping region, then // calls drawWire - void draw( + void Draw( BRect updateRect); // is called from the parent DiagramViews MouseDown() implementation // if the Wire was hit; this version initiates selection and dragging - virtual void mouseDown( + virtual void MouseDown( BPoint point, uint32 buttons, uint32 clicks); // is called from the DiagramViews MouseMoved() when no message is being // dragged, but the mouse has moved above the wire - virtual void mouseOver( + virtual void MouseOver( BPoint point, uint32 transit) { /* does nothing */ } @@ -108,14 +108,14 @@ public: // *** derived from DiagramItem // is called from the DiagramViews MouseMoved() when a message is being // dragged over the DiagramWire - virtual void messageDragged( + virtual void MessageDragged( BPoint point, uint32 transit, const BMessage *message); // is called from the DiagramViews MessageReceived() function when a // message has been dropped on the DiagramWire - virtual void messageDropped( + virtual void MessageDropped( BPoint point, BMessage *message) { /* does nothing */ } diff --git a/src/apps/cortex/DormantNodeView/DormantNodeListItem.cpp b/src/apps/cortex/DormantNodeView/DormantNodeListItem.cpp index 74aaf3cd4d..dd35f1cb65 100644 --- a/src/apps/cortex/DormantNodeView/DormantNodeListItem.cpp +++ b/src/apps/cortex/DormantNodeView/DormantNodeListItem.cpp @@ -135,11 +135,11 @@ void DormantNodeListItem::Update( // BListItem impl. // -------------------------------------------------------- // -void DormantNodeListItem::mouseOver( +void DormantNodeListItem::MouseOver( BView *owner, BPoint point, uint32 transit) { - D_OPERATION(("DormantNodeListItem::mouseOver()\n")); + D_OPERATION(("DormantNodeListItem::MouseOver()\n")); switch (transit) { case B_ENTERED_VIEW: { diff --git a/src/apps/cortex/DormantNodeView/DormantNodeListItem.h b/src/apps/cortex/DormantNodeView/DormantNodeListItem.h index 32a0b4490a..fdc0da5766 100644 --- a/src/apps/cortex/DormantNodeView/DormantNodeListItem.h +++ b/src/apps/cortex/DormantNodeView/DormantNodeListItem.h @@ -54,7 +54,7 @@ public: // *** accessors public: // *** operations - void mouseOver( + void MouseOver( BView *owner, BPoint point, uint32 transit); diff --git a/src/apps/cortex/DormantNodeView/DormantNodeView.cpp b/src/apps/cortex/DormantNodeView/DormantNodeView.cpp index b122b0fe13..42a22f7d06 100644 --- a/src/apps/cortex/DormantNodeView/DormantNodeView.cpp +++ b/src/apps/cortex/DormantNodeView/DormantNodeView.cpp @@ -171,16 +171,16 @@ void DormantNodeView::MouseMoved( if (item && r.Contains(point)) { if (item != last) { if (last) - last->mouseOver(this, point, B_EXITED_VIEW); - item->mouseOver(this, point, B_ENTERED_VIEW); + last->MouseOver(this, point, B_EXITED_VIEW); + item->MouseOver(this, point, B_ENTERED_VIEW); m_lastItemUnder = item; } else { - item->mouseOver(this, point, B_INSIDE_VIEW); + item->MouseOver(this, point, B_INSIDE_VIEW); } } else if (last) { - last->mouseOver(this, point, B_EXITED_VIEW); + last->MouseOver(this, point, B_EXITED_VIEW); } } diff --git a/src/apps/cortex/MediaRoutingView/MediaJack.cpp b/src/apps/cortex/MediaRoutingView/MediaJack.cpp index 22e6cc75b7..b0cfed22ea 100644 --- a/src/apps/cortex/MediaRoutingView/MediaJack.cpp +++ b/src/apps/cortex/MediaRoutingView/MediaJack.cpp @@ -139,7 +139,7 @@ void MediaJack::detachedFromDiagram() // make sure we're no longer displaying a tooltip TipManager *tips = TipManager::Instance(); - tips->hideTip(view()->ConvertToScreen(frame())); + tips->hideTip(view()->ConvertToScreen(Frame())); } void MediaJack::drawEndPoint() @@ -148,7 +148,7 @@ void MediaJack::drawEndPoint() if (m_bitmap) { - view()->DrawBitmap(m_bitmap, frame().LeftTop()); + view()->DrawBitmap(m_bitmap, Frame().LeftTop()); } } @@ -162,11 +162,11 @@ BPoint MediaJack::connectionPoint() const { if (isInput()) { - return BPoint(frame().left - 1.0, frame().top + frame().Height() / 2.0); + return BPoint(Frame().left - 1.0, Frame().top + Frame().Height() / 2.0); } else if (isOutput()) { - return BPoint(frame().right + 1.0, frame().top + frame().Height() / 2.0); + return BPoint(Frame().right + 1.0, Frame().top + Frame().Height() / 2.0); } break; } @@ -174,11 +174,11 @@ BPoint MediaJack::connectionPoint() const { if (isInput()) { - return BPoint(frame().left + frame().Width() / 2.0, frame().top - 1.0); + return BPoint(Frame().left + Frame().Width() / 2.0, Frame().top - 1.0); } else if (isOutput()) { - return BPoint(frame().left + frame().Width() / 2.0, frame().bottom + 1.0); + return BPoint(Frame().left + Frame().Width() / 2.0, Frame().bottom + 1.0); } break; } @@ -199,17 +199,17 @@ bool MediaJack::connectionRequested( return false; } -void MediaJack::mouseDown( +void MediaJack::MouseDown( BPoint point, uint32 buttons, uint32 clicks) { - D_MOUSE(("MediaJack::mouseOver()\n")); + D_MOUSE(("MediaJack::MouseOver()\n")); // if connected, redirect to the wire if (isConnected()) { - dynamic_cast(wire())->mouseDown(point, buttons, clicks); + dynamic_cast(wire())->MouseDown(point, buttons, clicks); return; } @@ -223,16 +223,16 @@ void MediaJack::mouseDown( } default: { - DiagramEndPoint::mouseDown(point, buttons, clicks); + DiagramEndPoint::MouseDown(point, buttons, clicks); } } } -void MediaJack::mouseOver( +void MediaJack::MouseOver( BPoint point, uint32 transit) { - D_MOUSE(("MediaJack::mouseOver()\n")); + D_MOUSE(("MediaJack::MouseOver()\n")); switch (transit) { case B_ENTERED_VIEW: @@ -241,7 +241,7 @@ void MediaJack::mouseOver( TipManager *tips = TipManager::Instance(); BString tipText = m_label.String(); tipText << " (" << MediaString::getStringFor(m_format.type) << ")"; - tips->showTip(tipText.String(),view()->ConvertToScreen(frame()), + tips->showTip(tipText.String(),view()->ConvertToScreen(Frame()), TipManager::LEFT_OFFSET_FROM_POINTER, BPoint(12.0, 8.0)); break; } @@ -256,12 +256,12 @@ void MediaJack::mouseOver( } } -void MediaJack::messageDragged( +void MediaJack::MessageDragged( BPoint point, uint32 transit, const BMessage *message) { - D_MOUSE(("MediaJack::messageDragged()\n")); + D_MOUSE(("MediaJack::MessageDragged()\n")); switch (transit) { case B_ENTERED_VIEW: @@ -278,35 +278,35 @@ void MediaJack::messageDragged( break; } } - DiagramEndPoint::messageDragged(point, transit, message); + DiagramEndPoint::MessageDragged(point, transit, message); } void MediaJack::selected() { D_METHOD(("MediaJack::selected()\n")); _updateBitmap(); - view()->Invalidate(frame()); + view()->Invalidate(Frame()); } void MediaJack::deselected() { D_METHOD(("MediaJack::deselected()\n")); _updateBitmap(); - view()->Invalidate(frame()); + view()->Invalidate(Frame()); } void MediaJack::connected() { D_METHOD(("MediaJack::connected()\n")); _updateBitmap(); - view()->Invalidate(frame()); + view()->Invalidate(Frame()); } void MediaJack::disconnected() { D_METHOD(("MediaJack::disconnected()\n")); _updateBitmap(); - view()->Invalidate(frame()); + view()->Invalidate(Frame()); } // -------------------------------------------------------- // @@ -338,7 +338,7 @@ void MediaJack::setPosition( } else if (isOutput()) { - moveTo(BPoint(rightBottomBoundary - frame().Width(), offset), updateRegion); + moveTo(BPoint(rightBottomBoundary - Frame().Width(), offset), updateRegion); } break; } @@ -350,7 +350,7 @@ void MediaJack::setPosition( } else if (isOutput()) { - moveTo(BPoint(offset, rightBottomBoundary - frame().Height()), updateRegion); + moveTo(BPoint(offset, rightBottomBoundary - Frame().Height()), updateRegion); } break; } @@ -369,7 +369,7 @@ void MediaJack::_updateBitmap() { delete m_bitmap; } - BBitmap *tempBitmap = new BBitmap(frame().OffsetToCopy(0.0, 0.0), B_CMAP8, true); + BBitmap *tempBitmap = new BBitmap(Frame().OffsetToCopy(0.0, 0.0), B_CMAP8, true); tempBitmap->Lock(); { BView *tempView = new BView(tempBitmap->Bounds(), "", B_FOLLOW_NONE, 0); @@ -413,7 +413,7 @@ void MediaJack::_drawInto( // draw connection point r = targetRect; - p.Set(0.0, frame().Height() / 2.0 - 2.0); + p.Set(0.0, Frame().Height() / 2.0 - 2.0); target->BeginLineArray(4); { target->AddLine(r.LeftTop(), @@ -470,7 +470,7 @@ void MediaJack::_drawInto( font.SetSize(font.Size() - 2.0); font.GetHeight(&fh); p.x += 7.0; - p.y = (frame().Height() / 2.0) + (fh.ascent / 2.0); + p.y = (Frame().Height() / 2.0) + (fh.ascent / 2.0); target->SetFont(&font); target->SetDrawingMode(B_OP_OVER); target->SetHighColor((isConnected() || isConnecting()) ? @@ -491,7 +491,7 @@ void MediaJack::_drawInto( // draw connection point r = targetRect; - p.Set(targetRect.right - 4.0, frame().Height() / 2.0 - 2.0); + p.Set(targetRect.right - 4.0, Frame().Height() / 2.0 - 2.0); target->BeginLineArray(4); { target->AddLine(r.RightTop(), @@ -544,7 +544,7 @@ void MediaJack::_drawInto( font.SetSize(font.Size() - 2.0); font.GetHeight(&fh); p.x -= font.StringWidth(m_abbreviation.String()) + 2.0; - p.y = (frame().Height() / 2.0) + (fh.ascent / 2.0); + p.y = (Frame().Height() / 2.0) + (fh.ascent / 2.0); target->SetFont(&font); target->SetDrawingMode(B_OP_OVER); target->SetHighColor((isConnected() || isConnecting()) ? @@ -569,7 +569,7 @@ void MediaJack::_drawInto( // draw connection point r = targetRect; - p.Set(frame().Width() / 2.0 - 2.0, 0.0); + p.Set(Frame().Width() / 2.0 - 2.0, 0.0); target->BeginLineArray(4); { target->AddLine(r.LeftTop(), @@ -628,7 +628,7 @@ void MediaJack::_drawInto( // draw connection point r = targetRect; - p.Set(frame().Width() / 2.0 - 2.0, targetRect.bottom - 4.0); + p.Set(Frame().Width() / 2.0 - 2.0, targetRect.bottom - 4.0); target->BeginLineArray(4); { target->AddLine(r.LeftBottom(), diff --git a/src/apps/cortex/MediaRoutingView/MediaJack.h b/src/apps/cortex/MediaRoutingView/MediaJack.h index 2c29ac4528..0eeadf4ec4 100644 --- a/src/apps/cortex/MediaRoutingView/MediaJack.h +++ b/src/apps/cortex/MediaRoutingView/MediaJack.h @@ -103,18 +103,18 @@ public: // *** derived from DiagramEndPoint/Item DiagramEndPoint *which); // displays the context menu for right-clicks - virtual void mouseDown( + virtual void MouseDown( BPoint point, uint32 buttons, uint32 clicks); // changes the mouse cursor and prepares a tooltip - virtual void mouseOver( + virtual void MouseOver( BPoint point, uint32 transit); // changes the mouse cursor - virtual void messageDragged( + virtual void MessageDragged( BPoint point, uint32 transit, const BMessage *message); diff --git a/src/apps/cortex/MediaRoutingView/MediaNodePanel.cpp b/src/apps/cortex/MediaRoutingView/MediaNodePanel.cpp index f98ae03475..e8497a946b 100644 --- a/src/apps/cortex/MediaRoutingView/MediaNodePanel.cpp +++ b/src/apps/cortex/MediaRoutingView/MediaNodePanel.cpp @@ -107,7 +107,7 @@ void MediaNodePanel::detachedFromDiagram() { D_METHOD(("MediaNodePanel::detachedFromDiagram()\n")); - BRect labelRect = m_labelRect.OffsetByCopy(frame().LeftTop()); + BRect labelRect = m_labelRect.OffsetByCopy(Frame().LeftTop()); if (m_mouseOverLabel && m_labelTruncated) { TipManager *tips = TipManager::Instance(); @@ -117,27 +117,27 @@ void MediaNodePanel::detachedFromDiagram() view()->Looper()->RemoveHandler(this); } -void MediaNodePanel::drawBox() +void MediaNodePanel::DrawBox() { - D_DRAW(("MediaNodePanel::drawBox()\n")); + D_DRAW(("MediaNodePanel::DrawBox()\n")); if (m_bitmap) { - view()->DrawBitmap(m_bitmap, frame().LeftTop()); + view()->DrawBitmap(m_bitmap, Frame().LeftTop()); } } -void MediaNodePanel::mouseDown( +void MediaNodePanel::MouseDown( BPoint point, uint32 buttons, uint32 clicks) { - D_METHOD(("MediaNodePanel::mouseDown()\n")); + D_METHOD(("MediaNodePanel::MouseDown()\n")); - _inherited::mouseDown(point, buttons, clicks); + _inherited::MouseDown(point, buttons, clicks); // +++ REALLY BAD WORKAROUND MediaJack *jack = dynamic_cast(_LastItemUnder()); - if (jack && jack->frame().Contains(point)) + if (jack && jack->Frame().Contains(point)) { return; } @@ -164,12 +164,12 @@ void MediaNodePanel::mouseDown( } } -void MediaNodePanel::mouseOver( +void MediaNodePanel::MouseOver( BPoint point, uint32 transit) { - D_METHOD(("MediaNodePanel::mouseOver()\n")); - _inherited::mouseOver(point, transit); + D_METHOD(("MediaNodePanel::MouseOver()\n")); + _inherited::MouseOver(point, transit); switch (transit) { @@ -179,7 +179,7 @@ void MediaNodePanel::mouseOver( } case B_INSIDE_VIEW: { - BRect labelRect = m_labelRect.OffsetByCopy(frame().LeftTop()); + BRect labelRect = m_labelRect.OffsetByCopy(Frame().LeftTop()); if (labelRect.Contains(point)) { if (!m_mouseOverLabel && m_labelTruncated) @@ -203,17 +203,17 @@ void MediaNodePanel::mouseOver( } } -void MediaNodePanel::messageDropped( +void MediaNodePanel::MessageDropped( BPoint point, BMessage *message) { - D_METHOD(("MediaNodePanel::messageDropped()\n")); + D_METHOD(("MediaNodePanel::MessageDropped()\n")); // +++ REALLY BAD WORKAROUND MediaJack *jack = dynamic_cast(ItemUnder(point)); if (jack) { - jack->messageDropped(point, message); + jack->MessageDropped(point, message); return; } else @@ -243,7 +243,7 @@ void MediaNodePanel::layoutChanged( { D_METHOD(("MediaNodePanel::layoutChanged()\n")); - BPoint p = frame().LeftTop(); + BPoint p = Frame().LeftTop(); if (m_alternatePosition == s_invalidPosition) { m_alternatePosition = dynamic_cast @@ -367,13 +367,13 @@ void MediaNodePanel::arrangeIOJacks() minHeight += m_labelRect.Height(); minHeight += 2 * MediaJack::M_DEFAULT_GAP; minHeight = ((int)minHeight / (int)align) * align + align; - if ((frame().Height() < minHeight) - || ((frame().Height() > minHeight) + if ((Frame().Height() < minHeight) + || ((Frame().Height() > minHeight) && (minHeight >= MediaNodePanel::M_DEFAULT_HEIGHT))) { - updateRegion.Include(frame()); - resizeTo(frame().Width(), minHeight); - updateRegion.Include(frame()); + updateRegion.Include(Frame()); + resizeTo(Frame().Width(), minHeight); + updateRegion.Include(Frame()); _prepareLabel(); } @@ -381,7 +381,7 @@ void MediaNodePanel::arrangeIOJacks() BRect r = m_bodyRect; r.bottom -= M_BODY_V_MARGIN; float inputOffset = 0.0, outputOffset = 0.0; - float center = frame().top + r.top + (r.Height() / 2.0); + float center = Frame().top + r.top + (r.Height() / 2.0); center += MediaJack::M_DEFAULT_GAP - (MediaJack::M_DEFAULT_HEIGHT / 2.0); center = ((int)center / (int)align) * align; if (numInputs) @@ -413,13 +413,13 @@ void MediaNodePanel::arrangeIOJacks() { if (jack->isInput()) { - jack->setPosition(inputOffset, frame().left, frame().right, &updateRegion); - inputOffset += jack->frame().Height() + MediaJack::M_DEFAULT_GAP; + jack->setPosition(inputOffset, Frame().left, Frame().right, &updateRegion); + inputOffset += jack->Frame().Height() + MediaJack::M_DEFAULT_GAP; } if (jack->isOutput()) { - jack->setPosition(outputOffset, frame().left, frame().right, &updateRegion); - outputOffset += jack->frame().Height() + MediaJack::M_DEFAULT_GAP; + jack->setPosition(outputOffset, Frame().left, Frame().right, &updateRegion); + outputOffset += jack->Frame().Height() + MediaJack::M_DEFAULT_GAP; } } } @@ -457,18 +457,18 @@ void MediaNodePanel::arrangeIOJacks() minWidth += m_bodyRect.Width(); minWidth += 2 * MediaJack::M_DEFAULT_GAP; minWidth = ((int)minWidth / (int)align) * align + align; - if ((frame().Width() < minWidth) - || ((frame().Width() > minWidth) + if ((Frame().Width() < minWidth) + || ((Frame().Width() > minWidth) && (minWidth >= MediaNodePanel::M_DEFAULT_WIDTH))) { - updateRegion.Include(frame()); - resizeTo(minWidth, frame().Height()); - updateRegion.Include(frame()); + updateRegion.Include(Frame()); + resizeTo(minWidth, Frame().Height()); + updateRegion.Include(Frame()); _prepareLabel(); } // adjust the placement of the jacks float inputOffset = 0.0, outputOffset = 0.0; - float center = frame().left + m_labelRect.left + (m_labelRect.Width() / 2.0); + float center = Frame().left + m_labelRect.left + (m_labelRect.Width() / 2.0); center += MediaJack::M_DEFAULT_GAP - (MediaJack::M_DEFAULT_WIDTH / 2.0); center = ((int)center / (int)align) * align; if (numInputs) @@ -500,13 +500,13 @@ void MediaNodePanel::arrangeIOJacks() { if (jack->isInput()) { - jack->setPosition(inputOffset, frame().top, frame().bottom, &updateRegion); - inputOffset += jack->frame().Width() + MediaJack::M_DEFAULT_GAP; + jack->setPosition(inputOffset, Frame().top, Frame().bottom, &updateRegion); + inputOffset += jack->Frame().Width() + MediaJack::M_DEFAULT_GAP; } if (jack->isOutput()) { - jack->setPosition(outputOffset, frame().top, frame().bottom, &updateRegion); - outputOffset += jack->frame().Width() + MediaJack::M_DEFAULT_GAP; + jack->setPosition(outputOffset, Frame().top, Frame().bottom, &updateRegion); + outputOffset += jack->Frame().Width() + MediaJack::M_DEFAULT_GAP; } } } @@ -719,12 +719,12 @@ status_t MediaNodePanel::exportState( MediaRoutingView::layout_t layoutMode = v->getLayout(); switch(layoutMode) { case MediaRoutingView::M_ICON_VIEW: - iconPos = frame().LeftTop(); + iconPos = Frame().LeftTop(); miniIconPos = m_alternatePosition; break; case MediaRoutingView::M_MINI_ICON_VIEW: - miniIconPos = frame().LeftTop(); + miniIconPos = Frame().LeftTop(); iconPos = m_alternatePosition; break; } @@ -793,14 +793,14 @@ void MediaNodePanel::_prepareLabel() { case MediaRoutingView::M_ICON_VIEW: { - m_labelRect = frame(); + m_labelRect = Frame(); m_labelRect.OffsetTo(0.0, 0.0); m_labelRect.bottom = 2 * M_LABEL_V_MARGIN + (fh.ascent + fh.descent + fh.leading) + 1.0; break; } case MediaRoutingView::M_MINI_ICON_VIEW: { - m_labelRect = frame(); + m_labelRect = Frame(); m_labelRect.OffsetTo(0.0, 0.0); m_labelRect.left = M_BODY_H_MARGIN + B_MINI_ICON; m_labelRect.top += MediaJack::M_DEFAULT_HEIGHT; @@ -840,14 +840,14 @@ void MediaNodePanel::_prepareLabel() { case MediaRoutingView::M_ICON_VIEW: { - m_bodyRect = frame(); + m_bodyRect = Frame(); m_bodyRect.OffsetTo(0.0, 0.0); m_bodyRect.top = m_labelRect.bottom; break; } case MediaRoutingView::M_MINI_ICON_VIEW: { - m_bodyRect = frame(); + m_bodyRect = Frame(); m_bodyRect.OffsetTo(0.0, 0.0); m_bodyRect.right = m_labelRect.left; break; @@ -861,7 +861,7 @@ void MediaNodePanel::_updateBitmap() { delete m_bitmap; } - BBitmap *tempBitmap = new BBitmap(frame().OffsetToCopy(0.0, 0.0), B_CMAP8, true); + BBitmap *tempBitmap = new BBitmap(Frame().OffsetToCopy(0.0, 0.0), B_CMAP8, true); tempBitmap->Lock(); { BView *tempView = new BView(tempBitmap->Bounds(), "", B_FOLLOW_NONE, 0); diff --git a/src/apps/cortex/MediaRoutingView/MediaNodePanel.h b/src/apps/cortex/MediaRoutingView/MediaNodePanel.h index 5964d9cab9..bac5d92766 100644 --- a/src/apps/cortex/MediaRoutingView/MediaNodePanel.h +++ b/src/apps/cortex/MediaRoutingView/MediaNodePanel.h @@ -61,18 +61,18 @@ public: // *** derived from DiagramItem virtual void detachedFromDiagram(); - virtual void drawBox(); + virtual void DrawBox(); - virtual void mouseDown( + virtual void MouseDown( BPoint point, uint32 buttons, uint32 clicks); - virtual void mouseOver( + virtual void MouseOver( BPoint point, uint32 transit); - virtual void messageDropped( + virtual void MessageDropped( BPoint point, BMessage *message); diff --git a/src/apps/cortex/MediaRoutingView/MediaRoutingView.cpp b/src/apps/cortex/MediaRoutingView/MediaRoutingView.cpp index fd06b8008f..9682cb0e65 100644 --- a/src/apps/cortex/MediaRoutingView/MediaRoutingView.cpp +++ b/src/apps/cortex/MediaRoutingView/MediaRoutingView.cpp @@ -194,56 +194,48 @@ DiagramWire *MediaRoutingView::createWire( return 0; } -void MediaRoutingView::mouseDown( - BPoint point, - uint32 buttons, + +void +MediaRoutingView::BackgroundMouseDown(BPoint point, uint32 buttons, uint32 clicks) { - D_MOUSE(("MediaRoutingView::mouseDown()\n")); + D_MOUSE(("MediaRoutingView::BackgroundMouseDown()\n")); if ((buttons == B_SECONDARY_MOUSE_BUTTON) - || (modifiers() & B_CONTROL_KEY)) - { + || (modifiers() & B_CONTROL_KEY)) { EndRectTracking(); showContextMenu(point); } } -void MediaRoutingView::messageDropped( - BPoint point, - BMessage *message) -{ - D_METHOD(("MediaRoutingView::messageDropped()\n")); - switch (message->what) - { +void +MediaRoutingView::MessageDropped(BPoint point, BMessage *message) +{ + D_METHOD(("MediaRoutingView::MessageDropped()\n")); + + switch (message->what) { case DormantNodeView::M_INSTANTIATE_NODE: { - D_MESSAGE(("MediaRoutingView::messageDropped(DormantNodeView::M_INSTANTIATE_NODE)\n")); + D_MESSAGE(("MediaRoutingView::MessageDropped(DormantNodeView::M_INSTANTIATE_NODE)\n")); type_code type; int32 count; - if (message->GetInfo("which", &type, &count) == B_OK) - { - for (int32 n = 0; n < count; n++) - { + if (message->GetInfo("which", &type, &count) == B_OK) { + for (int32 n = 0; n < count; n++) { dormant_node_info info; const void *data; ssize_t dataSize; - if (message->FindData("which", B_RAW_TYPE, &data, &dataSize) == B_OK) - { + if (message->FindData("which", B_RAW_TYPE, &data, &dataSize) == B_OK) { memcpy(reinterpret_cast(&info), data, dataSize); NodeRef* droppedNode; status_t error; error = manager->instantiate(info, &droppedNode); - if (!error) - { + if (!error) { m_lastDroppedNode = droppedNode->id(); BPoint dropPoint, dropOffset; dropPoint = message->DropPoint(&dropOffset); m_lastDropPoint = Align(ConvertFromScreen(dropPoint - dropOffset)); - } - else - { + } else { BString s; s << "Could not instantiate '" << info.name << "'"; showErrorMessage(s, error); @@ -253,36 +245,36 @@ void MediaRoutingView::messageDropped( } break; } + case B_SIMPLE_DATA: { - D_MESSAGE(("MediaRoutingView::messageDropped(B_SIMPLE_DATA)\n")); + D_MESSAGE(("MediaRoutingView::MessageDropped(B_SIMPLE_DATA)\n")); entry_ref fileRef; if (message->FindRef("refs", &fileRef) == B_OK) - { _checkDroppedFile(&fileRef, ConvertFromScreen(message->DropPoint())); - } break; } + case B_PASTE: { - D_MESSAGE(("MediaRoutingView::messageDropped(B_PASTE)\n")); + D_MESSAGE(("MediaRoutingView::MessageDropped(B_PASTE)\n")); ssize_t size; const rgb_color *color; // [e.moon 21nov99] fixed const error - if (message->FindData("RGBColor", B_RGB_COLOR_TYPE, reinterpret_cast(&color), &size) == B_OK) - { + if (message->FindData("RGBColor", B_RGB_COLOR_TYPE, + reinterpret_cast(&color), &size) == B_OK) _changeBackground(*color); - } break; } + default: - { - DiagramView::messageDropped(point, message); - } + DiagramView::MessageDropped(point, message); } } -void MediaRoutingView::selectionChanged() { +void +MediaRoutingView::selectionChanged() +{ D_METHOD(("MediaRoutingView::selectionChanged()\n")); _broadcastSelection(); } @@ -723,7 +715,7 @@ BPoint MediaRoutingView::findFreePositionFor( float bottom = 0.0; for (uint32 i = 0; i < CountItems(DiagramItem::M_BOX); i++) { - BRect r = ItemAt(i, DiagramItem::M_BOX)->frame(); + BRect r = ItemAt(i, DiagramItem::M_BOX)->Frame(); if ((r.left >= p.x) && (r.left <= p.x + MediaNodePanel::M_DEFAULT_WIDTH)) { @@ -752,7 +744,7 @@ BPoint MediaRoutingView::findFreePositionFor( float right = 0.0; for (uint32 i = 0; i < CountItems(DiagramItem::M_BOX); i++) { - BRect r = ItemAt(i, DiagramItem::M_BOX)->frame(); + BRect r = ItemAt(i, DiagramItem::M_BOX)->Frame(); if ((r.top >= p.y) && (r.top <= p.y + MediaNodePanel::M_DEFAULT_HEIGHT)) { @@ -1244,7 +1236,7 @@ status_t MediaRoutingView::_addPanelFor( BPoint p = findFreePositionFor(panel); panel->moveTo(p); } - Invalidate(panel->frame()); + Invalidate(panel->Frame()); } } updateDataRect(); @@ -1283,7 +1275,7 @@ status_t MediaRoutingView::_removePanelFor( if (RemoveItem(panel)) { remove_observer(this, panel->ref); - Invalidate(panel->frame()); + Invalidate(panel->Frame()); delete panel; return B_OK; } @@ -1331,9 +1323,9 @@ status_t MediaRoutingView::_addWireFor( // [e.moon 21nov99] group creation/merging now performed by // RouteAppNodeManager - Invalidate(source->frame()); - Invalidate(destination->frame()); - Invalidate(wire->frame()); + Invalidate(source->Frame()); + Invalidate(destination->Frame()); + Invalidate(wire->Frame()); return B_OK; } else @@ -1372,19 +1364,19 @@ status_t MediaRoutingView::_removeWireFor( _findPanelFor(wire->connection.sourceNode(), &source); _findPanelFor(wire->connection.destinationNode(), &destination); RemoveItem(wire); - Invalidate(wire->frame()); + Invalidate(wire->Frame()); delete wire; if (source) { source->updateIOJacks(); source->arrangeIOJacks(); - Invalidate(source->frame()); + Invalidate(source->Frame()); } if (destination) { destination->updateIOJacks(); destination->arrangeIOJacks(); - Invalidate(destination->frame()); + Invalidate(destination->Frame()); } // [e.moon 21nov99] group split/remove now performed by diff --git a/src/apps/cortex/MediaRoutingView/MediaRoutingView.h b/src/apps/cortex/MediaRoutingView/MediaRoutingView.h index 5589637485..29851e46aa 100644 --- a/src/apps/cortex/MediaRoutingView/MediaRoutingView.h +++ b/src/apps/cortex/MediaRoutingView/MediaRoutingView.h @@ -172,12 +172,12 @@ public: // *** DiagramView impl DiagramWire *createWire( DiagramEndPoint *fromWhich); - virtual void mouseDown( + virtual void BackgroundMouseDown( BPoint point, uint32 buttons, uint32 clicks); - virtual void messageDropped( + virtual void MessageDropped( BPoint point, BMessage *message); diff --git a/src/apps/cortex/MediaRoutingView/MediaWire.cpp b/src/apps/cortex/MediaRoutingView/MediaWire.cpp index b720f6e4a4..b9aad693de 100644 --- a/src/apps/cortex/MediaRoutingView/MediaWire.cpp +++ b/src/apps/cortex/MediaRoutingView/MediaWire.cpp @@ -79,12 +79,12 @@ void MediaWire::detachedFromDiagram() // make sure we're no longer displaying a tooltip TipManager *tips = TipManager::Instance(); - tips->hideTip(view()->ConvertToScreen(frame())); + tips->hideTip(view()->ConvertToScreen(Frame())); } -BRect MediaWire::frame() const +BRect MediaWire::Frame() const { - D_DRAW(("MediaWire::frame()\n")); + D_DRAW(("MediaWire::Frame()\n")); return m_frame; } @@ -92,7 +92,7 @@ float MediaWire::howCloseTo( BPoint point) const { D_MOUSE(("MediaWire::howCloseTo()\n")); - if (frame().Contains(point)) + if (Frame().Contains(point)) { BPoint sp = m_startPoint; BPoint ep = m_endPoint; @@ -144,13 +144,13 @@ void MediaWire::drawWire() view()->EndLineArray(); } -void MediaWire::mouseDown( +void MediaWire::MouseDown( BPoint point, uint32 buttons, uint32 clicks) { - D_MOUSE(("MediaWire::mouseDown()\n")); - _inherited::mouseDown(point, buttons, clicks); + D_MOUSE(("MediaWire::MouseDown()\n")); + _inherited::MouseDown(point, buttons, clicks); switch (buttons) { @@ -164,11 +164,11 @@ void MediaWire::mouseDown( } } -void MediaWire::mouseOver( +void MediaWire::MouseOver( BPoint point, uint32 transit) { - D_MOUSE(("MediaWire::mouseOver()\n")); + D_MOUSE(("MediaWire::MouseOver()\n")); if (isDragging()) { @@ -180,7 +180,7 @@ void MediaWire::mouseOver( { TipManager *tips = TipManager::Instance(); BString tipText = MediaString::getStringFor(connection.format(), false); - tips->showTip(tipText.String(), view()->ConvertToScreen(frame()), + tips->showTip(tipText.String(), view()->ConvertToScreen(Frame()), TipManager::LEFT_OFFSET_FROM_POINTER, BPoint(12.0, 8.0)); be_app->SetCursor(M_CABLE_CURSOR); break; @@ -189,7 +189,7 @@ void MediaWire::mouseOver( { be_app->SetCursor(B_HAND_CURSOR); TipManager *tips = TipManager::Instance(); - tips->hideTip(view()->ConvertToScreen(frame())); + tips->hideTip(view()->ConvertToScreen(Frame())); break; } } diff --git a/src/apps/cortex/MediaRoutingView/MediaWire.h b/src/apps/cortex/MediaRoutingView/MediaWire.h index f3645489d1..7ff4337880 100644 --- a/src/apps/cortex/MediaRoutingView/MediaWire.h +++ b/src/apps/cortex/MediaRoutingView/MediaWire.h @@ -59,7 +59,7 @@ public: // *** derived from DiagramWire/Item virtual void detachedFromDiagram(); // calculates and returns the frame rectangle of the wire - virtual BRect frame() const; + virtual BRect Frame() const; // returns a value > 0.5 for points pretty much close to the // wire @@ -70,13 +70,13 @@ public: // *** derived from DiagramWire/Item virtual void drawWire(); // displays the context-menu for right-clicks - virtual void mouseDown( + virtual void MouseDown( BPoint point, uint32 buttons, uint32 clicks); // changes the mouse cursor and starts a tooltip - virtual void mouseOver( + virtual void MouseOver( BPoint point, uint32 transit); diff --git a/src/apps/cortex/TipManager/TipManagerImpl.cpp b/src/apps/cortex/TipManager/TipManagerImpl.cpp index e84881c0f6..c3f78615a2 100644 --- a/src/apps/cortex/TipManager/TipManagerImpl.cpp +++ b/src/apps/cortex/TipManager/TipManagerImpl.cpp @@ -227,7 +227,7 @@ pair _ViewEntry::match( BPoint point, BPoint screenPoint) { // fetch this view's current frame rect - BRect f = frame(); + BRect f = Frame(); // check for a full-frame tip: @@ -277,7 +277,7 @@ pair _ViewEntry::match( } // get frame rect (in parent view's coordinates) -BRect _ViewEntry::frame() { +BRect _ViewEntry::Frame() { ASSERT(m_target); // ASSERT(m_target->Parent()); diff --git a/src/apps/cortex/TipManager/TipManagerImpl.h b/src/apps/cortex/TipManager/TipManagerImpl.h index 16f6ae6084..38228cd900 100644 --- a/src/apps/cortex/TipManager/TipManagerImpl.h +++ b/src/apps/cortex/TipManager/TipManagerImpl.h @@ -149,7 +149,7 @@ public: // *** interface BPoint screenPoint); // retrieve current frame rect (in parent view's coordinates) - BRect frame(); + BRect Frame(); BView* target() const { return m_target; } _ViewEntry* parent() const { return m_parent; }