[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]

Re: [XaraXtreme-dev] New Ruler functions

I've just checked in some new infrastructure to allow the current Tool to handle mouse events on Rulers and to modify the displayed origin.

There are two new Tool member functions (hence large rebuild):

BOOL OnRulerClick(DocCoord, ClickType, ClickModifiers, Spread*, RulerBase*)
Presents mouse events to the current tool using the same Kernel abstraction as used by Views
Override this to handle clicks on the rulers in preference to any other click handling.
PointerPos will be the position of the click on the document, as if the click has passed through the Ruler.
This function will eventually receive CLICKTYPE_DRAG events in the same way as normal View clicks but this needs some more work yet.
RulerBase refers to either the vertical or horizontal kernel Ruler on which the click occurred.
Call Document::SetSelectedViewAndSpread if you do handle the event and actively do something.
Return TRUE if you handle the event
All access to rulers should be done through member functions of the kernel classes RulerBase, RulerPair and (soon) RulerPairList.

GetRulerCoord(DocRect, UserRect*)
Override to make rulers show coordinates in any coordinate space of the tool's choosing by converting the supplied DocRect into the output UserRect. The UserRect is by default already filled in with the rectangle in standard UserCoords (simply SpreadCoords translated to UserOrigin).
If you override this you will need to repaint the rulers on entry and exit from your tool.

BTW: I modified the Tool_V1 class because we don't have to worry about backward compatible Tool API's... yet. OK?