OILRuler Class Reference

This is the base class for Horizontal and Vertical rulers, It looks after the basic's - creating windows etc.. and handles all mouse events fo the rulers. More...

#include <oilruler.h>

Inheritance diagram for OILRuler:

OILHorizontalRuler OILVerticalRuler List of all members.

Public Member Functions

 OILRuler ()
 Creates an OILRuler object.
virtual ~OILRuler ()
 Destroys an OILRuler object.
virtual BOOL PostCreate ()
BOOL Create (CCamView *pOwnerView, INT32 id)
 Creates the ruler window.
void LinkToKernel (RulerBase *pKRuler)
wxPoint ClientToOtherClient (wxWindow *pOtherCWnd, wxPoint point)
 Convert coord relative to this window to coord relative to another window Note: Nice if this was in a parent CCWnd class.
WinRect ClientToOtherClient (wxWindow *pOtherCWnd, WinRect WR)
 Convert rect relative to this window to rect relative to another window Note: Nice if this was in a parent CCWnd class.
OilCoord ClientToOil (DocView *pDocView, wxPoint point)
 Convert a (client) coord relative to this window to a document Oil coord Note: Nice if this was in CWnd class but this is MFC, could do with a CCWnd class.
OilRect ClientToOil (DocView *pDocView, WinRect WR)
 Convert a (client) rect relative to this window to a document Oil rect Note: Nice if this was in CWnd class but this is MFC, could do with a CCWnd class.
virtual BOOL DrawMajorGraticule (OilCoord GratOilPos, LPCTSTR str)
virtual BOOL DrawMinorGraticule (OilCoord GratOilPos, INT32 ExtraSize=0)
 Draw a minor graticule on the horizontal/vertical ruler Also see: DrawMajorGraticule().
BOOL HighlightSection (OilCoord Lo, OilCoord Hi)
 Highlight a rectangular section of the ruler.
BOOL DrawBitmap (OilCoord Pos, ResourceID BitmapID)
 Display a bitmap at a specific ruler position, centered around the requested position in the ruler direction, aligned with the ruler edge in the other direction.
BOOL StartToolDrag (ClickModifiers Mods, OilCoord point, String_256 *OpToken, OpParam *Param)
 StartDrag function for tool drags.
BOOL PaintMouseFollower (OilCoord OilPos, DocView *pDocView, MouseFollowerRenderType RenderType)
 interface to DrawMouseFollower()
BOOL DrawMouseFollower (OilCoord OilPos, DocView *pDocView, MouseFollowerRenderType RenderType, wxDC *pDC)
 Draw an horizontal or vetical mouse follower.
BOOL GetStatusLineText (String_256 *pText, WinCoord MousePos, CWindowID hWnd)
 if over a ruler return status line help
virtual void ShowRuler (BOOL show)
 Shows or hides this ruler.
void UpdateRuler ()
 Redraw the whole ruler.

Static Public Member Functions

static BOOL GetMinGraticuleSpacing (OilRect *pSpacing, DocView *pDocView)
static BOOL GetTextSize (OilRect *pTextSize, LPCTSTR str, DocView *pDocView)
static BOOL GetTextSize (WinRect *pTextSize, LPCTSTR str)
static void PatB (wxDC *pDC, INT32 x, INT32 y, INT32 dx, INT32 dy, wxColour rgb)
 Paints a rectangle in the given (dithered) colour.
static BOOL Init ()
 read the font name and size for the ruler from config and use this to determine the size of the rulers
static void Deinit ()
 return memory 'new'd by the Init function
static INT32 GetRenderWidth ()
static UINT32 GetWidth ()
static wxFont GetRulerFont ()
 Get a stock font for use in rulers.

Static Public Attributes

static String_256FontName = NULL
static INT32 FontSize = 7

Protected Member Functions

virtual BOOL IsHorizontal ()
virtual BOOL StartDrag (UINT32 nFlags, wxPoint point)
 base StartDrag function - don't call
virtual BOOL HandleRulerDragEvent (UINT32 Button, UINT32 nFlags, WinCoord point, ClickType t)
 Gathers together Windows information about a mouse event and passes it on to the kernel, by calling DocView::OnClick() HandleDragEvent needs to be called from OnTimer code so rather than synthesizing a wxMouseEvent object this function has been left taking non-wx params.
virtual BOOL HandleRulerUpEvent (UINT32 Button, WinCoord point)
 Finishes the current drag, if there is one, by elucidating the state of the buttons etc and calling DragDFinished() in the kernel (DocView). Called whenever a mouse button is released.
CRenderWndGetRenderWindow ()
void SetCurrentStates ()
 Set the View and Document current.
void DoPaint (wxDC *pDC)
 Paints the client area of the Ruler which isn't covered by child windows, in response to a WM_PAINT message.
void OnPaint (wxPaintEvent &event)
 Redraws the colour bar.
void OnMouseMove (wxMouseEvent &event)
 handle mouse moves over the ruler
void OnLButtonDown (wxMouseEvent &event)
 Handle mouse event.
void OnLButtonDblClk (wxMouseEvent &event)
 handle left button double clicks
void OnLButtonUp (wxMouseEvent &event)
 Handle mouse event.
void OnMButtonDown (wxMouseEvent &event)
 Handle mouse event.
void OnMButtonDblClk (wxMouseEvent &event)
 Handle mouse event.
void OnMButtonUp (wxMouseEvent &event)
 Handle mouse event.
void OnRButtonDown (wxMouseEvent &event)
 Handle mouse event.
void OnRButtonDblClk (wxMouseEvent &event)
 Handle mouse event.
void OnRButtonUp (wxMouseEvent &event)
 Handle left button up events - pop-up context sensitive menu.
void OnFocus (wxFocusEvent &event)
 The rulers shouldn't get focues (unless they ever decided to handle arrow movement...).

Protected Attributes

CCamViewm_pOwnerView
RulerBasepKernelRuler
ClickType m_LastClickType
UINT32 m_LastClickButton
wxPoint m_LastClickPoint
ClickModifiers m_LastClickMods
UINT32 m_FirstClickButton
BOOL InDrag

Static Protected Attributes

static INT32 RenderWidth = 0
static UINT32 RulerWidth = 0
static INT32 CharHeight = 0
static INT32 CharWidth = 0
static wxDC * pPaintDC = NULL
static DocViewpPaintDocView = NULL
static wxSize RulerToDocOffset = wxSize(0,0)
static OpGuidelineParam NewGuidelineParam

Detailed Description

This is the base class for Horizontal and Vertical rulers, It looks after the basic's - creating windows etc.. and handles all mouse events fo the rulers.

Author:
Chris_Parks (Xara Group Ltd) <camelotdev@xara.com>
Date:
4/3/94

Definition at line 183 of file oilruler.h.


Constructor & Destructor Documentation

OILRuler::OILRuler  ) 
 

Creates an OILRuler object.

Author:
Chris_Parks (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/8/95

Definition at line 295 of file oilruler.cpp.

00296 { 
00297     InDrag       = FALSE;
00298     pKernelRuler = NULL;
00299 
00300     // if ruler has a border, the ruler has a one pixel black border,
00301     // one side of this border overlaps with the adjacent bar etc
00302     // so the offset to the next bar etc must only account for 1 of the 2 border pixels
00303     ERROR3IF(RenderWidth==0,"OILRuler::OILRuler() - RenderWidth==0 (not initialised!)");
00304 
00305     RulerWidth = RenderWidth;
00306 }

OILRuler::~OILRuler  )  [virtual]
 

Destroys an OILRuler object.

Author:
Chris_Parks (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/8/95

Definition at line 462 of file oilruler.cpp.

00463 {
00464 }


Member Function Documentation

OilRect OILRuler::ClientToOil DocView pDocView,
WinRect  WR
 

Convert a (client) rect relative to this window to a document Oil rect Note: Nice if this was in CWnd class but this is MFC, could do with a CCWnd class.

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
7/10/95
Parameters:
pDocView - associated doc view [INPUTS] WR - win rect to convert
Returns:
OilRect - converted win rect

Definition at line 1341 of file oilruler.cpp.

01342 {
01343     wxWindow* pRenderWnd = pDocView->GetRenderWindow();
01344     ERROR2IF(pRenderWnd==NULL,OilRect(OilCoord(0,0),OilCoord(0,0)),"OILRuler::ClientToOil() - pRenderWnd==NULL");
01345     return ClientToOtherClient(pRenderWnd,WR).ToOil(pDocView);
01346 }

OilCoord OILRuler::ClientToOil DocView pDocView,
wxPoint  point
 

Convert a (client) coord relative to this window to a document Oil coord Note: Nice if this was in CWnd class but this is MFC, could do with a CCWnd class.

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
7/10/95
Parameters:
pDocView - associated doc view [INPUTS] point - win coord to convert
Returns:
OilCoord - converted win coord

Definition at line 1361 of file oilruler.cpp.

01362 {
01363     wxWindow* pRenderWnd = pDocView->GetRenderWindow();
01364     ERROR2IF(pRenderWnd==NULL,OilCoord(0,0),"OILRuler::ClientToOil() - pRenderWnd==NULL");
01365     wxPoint DocPoint = ClientToOtherClient(pRenderWnd,point);
01366     return WinCoord(DocPoint.x,DocPoint.y).ToOil(pDocView);
01367 }

WinRect OILRuler::ClientToOtherClient wxWindow *  pOtherCWnd,
WinRect  WR
 

Convert rect relative to this window to rect relative to another window Note: Nice if this was in a parent CCWnd class.

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
7/10/95
Parameters:
pOtherCWnd - window to which to make rect relative to [INPUTS] WR - win rect to convert
Returns:
WinRect - converted win rect

Definition at line 1292 of file oilruler.cpp.

01293 {
01294     wxPoint tl = WR.GetTopLeft();
01295     wxPoint br = WR.GetBottomRightEx();
01296 
01297     ClientToScreen(tl);
01298     ClientToScreen(br);
01299     pOtherCWnd->ScreenToClient(tl);
01300     pOtherCWnd->ScreenToClient(br);
01301 
01302     WR.SetTopLeft(tl);
01303     WR.SetBottomRightEx(br);
01304 
01305     return WR;
01306 }

wxPoint OILRuler::ClientToOtherClient wxWindow *  pOtherCWnd,
wxPoint  point
 

Convert coord relative to this window to coord relative to another window Note: Nice if this was in a parent CCWnd class.

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
7/10/95
Parameters:
pOtherCWnd - window to which to make rect relative to [INPUTS] point - win coord to convert
Returns:
WinCoord - converted win coord

Definition at line 1321 of file oilruler.cpp.

01322 {
01323     ClientToScreen(point);
01324     pOtherCWnd->ScreenToClient(point);
01325     return point;
01326 }

BOOL OILRuler::Create CCamView pOwnerView,
INT32  id
 

Creates the ruler window.

Author:
Chris_Parks (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/3/94
Parameters:
pParentWindow - [INPUTS]
Returns:
FALSE if fails

Definition at line 319 of file oilruler.cpp.

00320 { 
00321     ERROR2IF(pOwnerView==NULL, FALSE, "DockingBar must have a Parent");
00322     
00323     m_pOwnerView = pOwnerView;
00324 
00325     if (!wxWindow::Create(pOwnerView->GetParentFrame(), id, wxDefaultPosition, wxSize(RulerWidth, RulerWidth), wxNO_BORDER))
00326         return(FALSE);
00327 
00328     PostCreate();
00329 
00330     return TRUE;
00331 }

void OILRuler::Deinit void   )  [static]
 

return memory 'new'd by the Init function

Author:
Richard_Millican (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/11/95

Definition at line 224 of file oilruler.cpp.

00225 {
00226     if(FontName != NULL)
00227     {
00228         delete FontName;
00229         FontName = NULL;
00230     }
00231 }

void OILRuler::DoPaint wxDC *  pDC  )  [protected]
 

Paints the client area of the Ruler which isn't covered by child windows, in response to a WM_PAINT message.

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/8/95

Definition at line 501 of file oilruler.cpp.

00502 {
00503     // get and validate a few pointers before we start
00504     DocView* pDocView = m_pOwnerView->GetDocViewPtr();
00505     if (pDocView==NULL)
00506     {
00507         ERROR2RAW("OILRuler::OnPaint() - pDocView==NULL");
00508         return;
00509     }
00510     wxWindow* pRenderWnd=pDocView->GetRenderWindow();
00511     if (pRenderWnd==NULL)
00512     {
00513         ERROR2RAW("OILRuler::OnPaint() - pRenderWnd==NULL");
00514         return;
00515     }
00516 
00517     // get the update region in docview OilCoords
00518     WinRect RulerUpdateRect;
00519     pDC->GetClippingBox(&RulerUpdateRect.x, &RulerUpdateRect.y, &RulerUpdateRect.width, &RulerUpdateRect.height);
00520     if (RulerUpdateRect.IsEmpty())
00521         RulerUpdateRect = GetClientRect();
00522     OilRect UpdateOilRect = ClientToOil(pDocView,RulerUpdateRect);
00523 
00524     // cache the offsets from ruler to doc window relative coords
00525     // note only x valid when painting horizontal ruler and only y valid for painting vertical ruler
00526     WinRect UpdateRect = ClientToOtherClient(pRenderWnd,RulerUpdateRect);
00527     ERROR3IF(UpdateRect.GetWidth()!=RulerUpdateRect.GetWidth() || UpdateRect.GetHeight()!=RulerUpdateRect.GetHeight(),"OILRuler::OnPaint() - ruler and doc window have incompatible coordinate spaces");
00528     RulerToDocOffset = wxSize(UpdateRect.x-RulerUpdateRect.x, UpdateRect.GetBottomEx()-RulerUpdateRect.GetBottomEx());
00529 
00530 
00531     // read the necessary colours
00532     wxColour BackCol  = wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE);
00533     wxColour TopLeft  = wxSystemSettings::GetColour(wxSYS_COLOUR_BTNHIGHLIGHT);
00534     wxColour BotRight = wxSystemSettings::GetColour(wxSYS_COLOUR_BTNSHADOW);
00535     wxColour TextCol  = wxSystemSettings::GetColour(wxSYS_COLOUR_BTNTEXT);
00536 
00537     // get info about client rect
00538     wxRect ClientRect = GetClientRect();
00539     INT32 left   = ClientRect.x;
00540     INT32 top    = ClientRect.y;
00541     INT32 width  = ClientRect.GetWidth();
00542     INT32 height = ClientRect.GetHeight();
00543     INT32 right  = left + width;
00544     INT32 bottom = top  + height;
00545 //  if (IsHorizontal() && height!=RenderWidth || !IsHorizontal() && width!=RenderWidth)
00546 //      ERROR3_PF(("OILRuler::OnPaint() - ruler client size (%d,%d) and RenderWidth (%d) incompatible!",width,height,RenderWidth));
00547 
00548     // render the background
00549     wxPen penNoOutline(BackCol, 0, wxTRANSPARENT);
00550     pDC->SetPen(penNoOutline);
00551 //  PatB(pDC, left,top, width,height, BackCol);     // Unneeded?
00552     
00553     // paint borders to be over written by graticules
00554     if (IsHorizontal())
00555     {
00556         PatB(pDC, left,top,  width,1,  TopLeft);    // horizontal ruler top    hi-light
00557         PatB(pDC, left,bottom-1, width,1, BotRight);    // horizontal ruler bottom lo-light
00558     }
00559     else
00560     {
00561         PatB(pDC, left,top,  1,height, TopLeft);    // vertical ruler left  hi-light
00562         PatB(pDC,  right-1,top, 1,height, BotRight);    // vertical ruler right lo-light
00563     }
00564 
00565     pDC->SetPen(wxPen(*wxBLACK, 1, wxSOLID));       // Restore previous Pen
00566 
00567     // get the kernel to render the ruler
00568     if (pKernelRuler)
00569     {
00570         // store pointers to CDC and DocView required for redraw
00571         pPaintDC      = pDC;
00572         pPaintDocView = pDocView;
00573 
00574         // set up DC objects required to draw the ruler
00575         pDC->SetTextForeground(TextCol);
00576         pDC->SetBackgroundMode(wxTRANSPARENT);
00577         pDC->SetFont(GetRulerFont());
00578 
00579         // draw the ruler
00580         pKernelRuler->Redraw(&UpdateOilRect);
00581 
00582         pPaintDC = NULL;
00583         pPaintDocView = NULL;
00584     }
00585 
00586     pDC->SetPen(penNoOutline);
00587 
00588     // paint the bits of the border that need to cover the ruler rendering
00589 PORTNOTE("rulers", "Removed attempt to draw ruler ends because ScrollWindow seems to ignore specified area (WXGTK)")
00590 #if !defined(EXCLUDE_FROM_XARALX)
00591     if (IsHorizontal())
00592     {
00593         PatB(pDC,   left,top,    1,height,   BackCol);  // horizontal ruler light grey left edge
00594         PatB(pDC, left+1,top+1,  1,height-2, TopLeft);  // horizontal ruler left  hi-light
00595         PatB(pDC,  right,top+1, -1,height-1, BotRight); // horizontal ruler right lo-light
00596     }
00597     else
00598     {
00599         PatB(pDC,   left,top,    width-1,1,  BackCol);  // vertical ruler top light grey top edge
00600         PatB(pDC, left+1,top+1,  width-2,1,  TopLeft);  // vertical ruler top    hi-light
00601         PatB(pDC, left+1,bottom, width-1,-1, BotRight); // vertical ruler bottom lo-light
00602     }
00603 #endif
00604 
00605     pDC->SetPen(wxPen(*wxBLACK, 1, wxSOLID));       // Restore previous Pen
00606 
00607 }

BOOL OILRuler::DrawBitmap OilCoord  Pos,
ResourceID  BitmapID
 

Display a bitmap at a specific ruler position, centered around the requested position in the ruler direction, aligned with the ruler edge in the other direction.

Author:
Martin Wuerthner <xara@mw-software.com>
Date:
07/07/06
Parameters:
Pos - the position on the ruler (only ordinate in ruler direction is significant) [INPUTS] BitmapID - the resource id of the bitmap
Returns:
FALSE if fails

Definition at line 1494 of file oilruler.cpp.

01495 {
01496     ERROR2IF(pPaintDC==NULL,FALSE,"OILRuler::DrawBitmap() - pPaintDC==NULL");
01497 
01498     wxBitmap* pBitmap = CamArtProvider::Get()->FindBitmap(BitmapID);
01499     ERROR2IF(pBitmap==NULL,FALSE,"OILRuler::DrawBitmap - could not find bitmap");
01500 
01501     INT32 BitmapWidth = pBitmap->GetWidth();
01502     INT32 BitmapHeight = pBitmap->GetHeight();
01503 
01504     // convert to ruler relative win coords
01505     WinCoord WinPos = Pos.ToWin(pPaintDocView);
01506     WinPos -= RulerToDocOffset;
01507 
01508     if (IsHorizontal())
01509     {
01510         // centered around requested position, aligned with bottom of ruler
01511         WinPos.x -= BitmapWidth / 2;
01512         WinPos.y = RenderWidth - BitmapHeight;
01513     }
01514     else
01515     {
01516         // centered around requested position, aligned with right hand side of ruler
01517         WinPos.x = RenderWidth - BitmapWidth;
01518         WinPos.y -= BitmapHeight / 2;
01519     }
01520     pPaintDC->DrawBitmap(*pBitmap, WinPos.x, WinPos.y, true);
01521     return TRUE;
01522 }

virtual BOOL OILRuler::DrawMajorGraticule OilCoord  GratOilPos,
LPCTSTR  str
[inline, virtual]
 

Reimplemented in OILHorizontalRuler, and OILVerticalRuler.

Definition at line 205 of file oilruler.h.

00205 {return FALSE;}

BOOL OILRuler::DrawMinorGraticule OilCoord  GratOilPos,
INT32  ExtraSize = 0
[virtual]
 

Draw a minor graticule on the horizontal/vertical ruler Also see: DrawMajorGraticule().

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/9/95
Parameters:
GratOilPos - position of graticule on ruler in OilCoords [INPUTS] only x used for horizontal ruler (and y for vrtical) ExtraSize - 0,1,2 extra number of pixels to add onto graticule size
Returns:
FALSE if fails

Definition at line 623 of file oilruler.cpp.

00624 {
00625     ERROR2IF(pPaintDC     ==NULL,FALSE,"OILRuler::DrawMinorGraticule() - pPaintDC==NULL");
00626     ERROR2IF(pPaintDocView==NULL,FALSE,"OILRuler::DrawMinorGraticule() - pPaintDocView==NULL");
00627 
00628     // convert to ruler relative win coords
00629     WinCoord GratWinPos=GratOilPos.ToWin(pPaintDocView);
00630     GratWinPos -= RulerToDocOffset;
00631 
00632     // determine the size and orientation of the graticule
00633     INT32 MinorGratLen = RenderWidth/6 + ExtraSize;
00634     WinRect GratWinRect;
00635     if (IsHorizontal())
00636         GratWinRect = WinRect(GratWinPos.x, RenderWidth-MinorGratLen, GratWinPos.x+1, RenderWidth);
00637     else
00638         GratWinRect = WinRect(RenderWidth-MinorGratLen, GratWinPos.y-1, RenderWidth, GratWinPos.y);
00639 
00640     // draw the graticule
00641     pPaintDC->DrawRectangle(GratWinRect);
00642 
00643     return TRUE;
00644 }

BOOL OILRuler::DrawMouseFollower OilCoord  OilPos,
DocView pDocView,
MouseFollowerRenderType  RenderType,
wxDC *  pDC
 

Draw an horizontal or vetical mouse follower.

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/9/95
Parameters:
OilPos - position of mouse for which to draw x/y follower [INPUTS] pDocView - RenderType - RenderOn/RenderOff (not yet used - just inverts previous state) pDC -
Returns:
FALSE if fails

Definition at line 1414 of file oilruler.cpp.

01416 {
01417     ERROR2IF(pDocView==NULL,FALSE,"OILRuler::DrawMouseFollower() - pDocView==NULL");
01418     ERROR2IF(     pDC==NULL,FALSE,"OILRuler::DrawMouseFollower() - pDC==NULL");
01419 
01420     // convert follower position to a rectangle to render
01421     WinCoord WinPos = OilPos.ToWin(pDocView);
01422     WinRect FollowerWinRect;
01423     if(IsHorizontal())
01424         FollowerWinRect = WinRect(WinPos.x,0,WinPos.x,RenderWidth);
01425     else
01426         FollowerWinRect = WinRect(0,WinPos.y-1,RenderWidth,WinPos.y-1);
01427 
01428     // set up dc and draw
01429     wxPen pen(*wxGREEN, 1, wxSOLID);
01430     pDC->SetPen(pen);
01431     pDC->SetLogicalFunction(wxINVERT);
01432     pDC->DrawLine(FollowerWinRect.GetLeft(), FollowerWinRect.GetTop(), FollowerWinRect.GetRightEx(), FollowerWinRect.GetBottomEx());
01433     pDC->SetLogicalFunction(wxCOPY);
01434 
01435     return TRUE;
01436 }

BOOL OILRuler::GetMinGraticuleSpacing OilRect pSpacing,
DocView pDocView
[static]
 

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
4/9/95
Parameters:
pDocView - [INPUTS]
pSpacing - [OUTPUTS]
Returns:
minimum graticule spacing in OilCords

Definition at line 1201 of file oilruler.cpp.

01202 {
01203     ERROR2IF(pSpacing==NULL,FALSE,"OILRuler::GetMinGraticuleSpacing() - pSpacing==NULL");
01204     ERROR2IF(pDocView==NULL,FALSE,"OILRuler::GetMinGraticuleSpacing() - pDocView==NULL");
01205 
01206     WinCoord WinSpacing(MIN_PIXEL_GRATICULE_SPACING_X,-MIN_PIXEL_GRATICULE_SPACING_Y);
01207     pSpacing->lo=OilCoord(0,0);
01208     pSpacing->hi=WinSpacing.ToOil(pDocView);
01209     return TRUE;
01210 }

static INT32 OILRuler::GetRenderWidth  )  [inline, static]
 

Definition at line 221 of file oilruler.h.

00221 { return RenderWidth; }

CRenderWnd* OILRuler::GetRenderWindow  )  [inline, protected]
 

Definition at line 231 of file oilruler.h.

wxFont OILRuler::GetRulerFont  )  [static]
 

Get a stock font for use in rulers.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/Jun/2006

Definition at line 244 of file oilruler.cpp.

00245 {
00246 PORTNOTE("ruler", "Temporarilly replace font factory with direct wxFont access")
00247 #if !defined(EXCLUDE_FROM_XARALX)
00248         wxFont font = FontFactory::GetFont(STOCKFONT_RULERS);
00249 #else
00250     wxFont FixedFont = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
00251     FixedFont.SetPointSize(OILRuler::FontSize);     // 6 is too small, 7 is too big, really...
00252 
00253     return FixedFont;
00254 #endif
00255 }

BOOL OILRuler::GetStatusLineText String_256 pText,
WinCoord  MousePos,
CWindowID  hWnd
 

if over a ruler return status line help

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
8/10/95
Parameters:
MousePos - position in window [INPUTS] hWnd - handle of window
pText - [OUTPUTS]
Returns:
TRUE if ptext hold valid text, else FALSE if not over a pane

Definition at line 1173 of file oilruler.cpp.

01174 {
01175     ERROR2IF(pText==NULL,FALSE,"OILRuler::GetStatusLineText() - pText==NULL");
01176 
01177     if (this!=hWnd)
01178         return FALSE;
01179 
01180     // allow the current tool to set the status line if it claims the ruler
01181     DocView* pDocView = m_pOwnerView->GetDocViewPtr();
01182     OilCoord ocoord = ClientToOil(pDocView, MousePos);
01183     if (pKernelRuler->GetStatusLineText(pText, ocoord))
01184         return TRUE;
01185 
01186     UINT32 StatusHelpID = IsHorizontal() ? _R(IDS_HRULER_SH) : _R(IDS_VRULER_SH);
01187     return (pText->Load(StatusHelpID)!=0);
01188 }

BOOL OILRuler::GetTextSize WinRect pTextSize,
LPCTSTR  str
[static]
 

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
4/9/95
Parameters:
pText - [INPUTS]
pTextSize - x,y size of text in WinCoords [OUTPUTS]
Returns:
FALSE if fails

Definition at line 1249 of file oilruler.cpp.

01250 {
01251     ERROR2IF(pTextSize==NULL,FALSE,"OILRuler::GetTextSize() - pTextSize==NULL");
01252     ERROR2IF(      str==NULL,FALSE,"OILRuler::GetTextSize() - pText==NULL");
01253 
01254     try
01255     {
01256         // create a screen compatible DC to find the size of the text
01257         wxScreenDC dc;
01258 
01259         wxFont font = GetRulerFont();
01260         dc.SetFont(font);
01261 
01262         wxSize TextSize(0,0);
01263         wxString Text(str);
01264         dc.GetTextExtent(Text, &TextSize.x, &TextSize.y);
01265         pTextSize->x   = 0;
01266         pTextSize->y    = 0;
01267         pTextSize->SetRightEx(TextSize.x);
01268         pTextSize->SetBottomEx(TextSize.y);
01269 
01270     }
01271     catch (...)
01272     {
01273         ERROR2(FALSE, "OILRuler::GetTextSize() - failed to create dc");
01274     }
01275 
01276     return TRUE;
01277 }

BOOL OILRuler::GetTextSize OilRect pTextSize,
LPCTSTR  str,
DocView pDocView
[static]
 

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
4/9/95
Parameters:
pText - [INPUTS] pDocView -
pTextSize - x,y size of text in OilCoords [OUTPUTS]
Returns:
FALSE if fails

Definition at line 1224 of file oilruler.cpp.

01225 {
01226     ERROR2IF(pTextSize==NULL,FALSE,"OILRuler::GetTextSize() - pTextSize==NULL");
01227     ERROR2IF( pDocView==NULL,FALSE,"OILRuler::GetTextSize() - pDocView==NULL");
01228 
01229     WinRect WinTextSize;
01230     BOOL ok=GetTextSize(&WinTextSize, str);
01231     if (!ok)
01232         return FALSE;
01233 
01234     *pTextSize = WinTextSize.ToOil(pDocView);
01235     return TRUE;
01236 }

static UINT32 OILRuler::GetWidth void   )  [inline, static]
 

Definition at line 222 of file oilruler.h.

00222 { return RulerWidth; }

BOOL OILRuler::HandleRulerDragEvent UINT32  Button,
UINT32  nFlags,
WinCoord  point,
ClickType  t
[protected, virtual]
 

Gathers together Windows information about a mouse event and passes it on to the kernel, by calling DocView::OnClick() HandleDragEvent needs to be called from OnTimer code so rather than synthesizing a wxMouseEvent object this function has been left taking non-wx params.

Technical notes (by Tim):

The Button is parameter is necessary, because sometimes when we get the *first* button down event, nFlags has more than one mouse button bit set. This only happens when you rampantly click buttons very quickly but nevertheless we *do* need to know which button was pressed, otherwise we never release the drag event and we end up with button-up-drag city.

I assume this is due to some latency in Windows, e.g., it gets a button down event, and while preparing it goes and reads the mouse button state and meanwhile another button has been pressed so we get a button down event with nFlags indicating more than one button is down.

Definition at line 950 of file oilruler.cpp.

00951 {
00952     if (pKernelRuler==NULL)
00953         return FALSE;
00954 
00955     DocView* pDocView = m_pOwnerView->GetDocViewPtr();
00956 
00957     if (DocView::GetSelected() != pDocView)
00958     {
00959         // If selected doc is null, let's select it anyway.
00960         if (DocView::GetSelected() == NULL)
00961         {
00962             // We're in a weird state that should never happen but does - a document
00963             // has the focus, but isn't selected
00964             Document* pKDoc =NULL;
00965             if(pDocView)
00966                 pKDoc = pDocView->GetDoc();
00967 
00968             if (pKDoc)
00969             {
00970                 Document::SetSelectedViewAndSpread(pKDoc, pDocView, NULL);
00971             }
00972             
00973         }
00974         return FALSE;
00975     }
00976 
00977     SetCurrentStates();
00978 
00979     // Find out which buttons etc are down.
00980     m_LastClickMods = ClickModifiers::GetClickModifiers(nFlags);
00981 
00982     // If it's the first single click, then reset the drag delay timer, and ask for a 
00983     // Windows timer.
00984     if (((t == CLICKTYPE_SINGLE) || (t == CLICKTYPE_DOUBLE)) && 
00985         (m_FirstClickButton == 0))
00986     {
00987         // Remember this event.
00988         m_LastClickPoint = point;
00989         m_LastClickType = t;
00990         m_LastClickButton = Button;
00991         m_FirstClickButton = Button;
00992 //      m_DragTimer.Sample();
00993 
00994         // Ask the system for a timer.
00995         // The timer is used to generate DragPointerIdle events, which are not directly
00996         // supported by Windows.
00997 //      UINT32 rate = 100;
00998 PORTNOTE("other","Removed reading of keyboard autorepeat rate")
00999 #ifndef EXCLUDE_FROM_XARALX
01000         ::SystemParametersInfo(SPI_GETKEYBOARDSPEED, 0, &rate, 0);
01001 #endif
01002 
01003 //      m_DragIdleTimer.Start(rate);
01004     }
01005 
01006     // Convert the click position to OIL coordinates before passing to the kernel.
01007     OilCoord ocoord = ClientToOil(pDocView, point);
01008     // Only the ordinate in the main ruler direction should be converted, the coordinate
01009     // translation does not make any sense in the other direction. Instead, we keep the
01010     // window-relative coordinate but we change it in such a way that the paper side of
01011     // the ruler is coordinate 0 because the Kernel does not know the RenderWidth of the
01012     // ruler and the paper side is the significant side where the blobs are drawn.
01013     if (IsHorizontal())
01014         ocoord.y = RenderWidth - point.y;
01015     else
01016         ocoord.x = RenderWidth - point.x;
01017     // pass only left clicks to the ruler
01018     if (Button == MK_LBUTTON)
01019         return pKernelRuler->OnRulerClick(ocoord, t, m_LastClickMods);
01020     return FALSE;
01021 }

BOOL OILRuler::HandleRulerUpEvent UINT32  Button,
WinCoord  point
[protected, virtual]
 

Finishes the current drag, if there is one, by elucidating the state of the buttons etc and calling DragDFinished() in the kernel (DocView). Called whenever a mouse button is released.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
9th Sept 1993
Parameters:
Button - which mouse button has been released. [INPUTS] nFlags - The mouse button flags. point - the coordinate of the mouse cursor.
- [OUTPUTS]
Returns:
-

Errors: - Scope: Private

See also:
CCamView::GetClickMods(); CCamView::OnLButtonDown(); CCamView::OnRButtonDown() DocView::OnClick()

Definition at line 1045 of file oilruler.cpp.

01046 {
01047     if (pKernelRuler==NULL)
01048         return FALSE;
01049 
01050     DocView* pDocView = m_pOwnerView->GetDocViewPtr();
01051 
01052     if (DocView::GetSelected() != pDocView)
01053     {
01054 //      ENSURE(pCurrentDragOp == NULL, "Drag operation in a view that isn't 'selected' !!");
01055         return FALSE;
01056     }
01057 
01058     // Set Current states...
01059     SetCurrentStates();
01060 
01061     // Convert WinCoord click point to OilCoord AND take any ruler offsets into account
01062     OilCoord ocoord = ClientToOil(pDocView, point);
01063 
01064     // Was the button that went up the first one that went down?
01065     if (Button==m_FirstClickButton)
01066     {
01067         //Yes it was.
01068         //Is there a drag currently running?
01069 /*      if (m_pCurrentDragOp != NULL)
01070         {
01071             // Yes there is.
01072             // Release the capture and terminate the drag.  Note that we try to release
01073             // the mouse capture as soon as possible after a drag has finished, in case the
01074             // DragFinished method below brings up a dialog box or something.
01075             if (GetRenderWindow() && GetRenderWindow()->GetCapture()==GetRenderWindow())
01076                 GetRenderWindow()->ReleaseMouse();
01077             return pKernelRuler->DragFinished(m_pCurrentDragOp, ocoord, m_LastClickMods, TRUE);
01078 
01079         }
01080         else
01081 */      {
01082             // No drag is currently running
01083             // Kill the timer started in HandleDragEvent(), 
01084             // as we don't want to wait for a drag anymore.
01085 //          m_DragIdleTimer.Stop();
01086 
01087             m_FirstClickButton = 0;
01088 
01089             //Then pass the Up-Click message to CCamView::OnClick
01090             return pKernelRuler->OnRulerClick(ocoord, CLICKTYPE_UP, m_LastClickMods);
01091         }
01092     }
01093     else
01094     {
01095         //No, the button that went up was not the first one to go down.
01096         //In that case, we expect the first button that went down is still down and
01097         //hence there is a drag running.
01098         //Is there a drag running?
01099 /*      if (m_pCurrentDragOp != NULL)
01100         {
01101             //Yes, as expected.
01102             //Pass the Up-Click message to CCamView::OnClick
01103             return pKernelRuler->OnRulerClick(ocoord, CLICKTYPE_UP, m_LastClickMods);
01104         }
01105 */
01106     }
01107 
01108     return FALSE;
01109 }

BOOL OILRuler::HighlightSection OilCoord  Lo,
OilCoord  Hi
 

Highlight a rectangular section of the ruler.

Author:
Martin Wuerthner <xara@mw-software.com>
Date:
07/07/06
Parameters:
Lo,Hi - determines the ruler section to be redrawn [INPUTS]
Returns:
FALSE if fails

Definition at line 1449 of file oilruler.cpp.

01450 {
01451     ERROR2IF(pPaintDC==NULL,FALSE,"OILRuler::HighlightSection - pPaintDC==NULL");
01452 
01453     // convert to ruler relative win coords
01454     WinCoord RectLoWinPos = Lo.ToWin(pPaintDocView);
01455     WinCoord RectHiWinPos = Hi.ToWin(pPaintDocView);
01456 
01457     RectLoWinPos -= RulerToDocOffset;
01458     RectHiWinPos -= RulerToDocOffset;
01459 
01460     if (IsHorizontal())
01461     {
01462         RectLoWinPos.y = 0;
01463         Hi.y = RenderWidth;
01464     }
01465     else
01466     {
01467         Lo.x = 0;
01468         Hi.x = RenderWidth;
01469     }
01470 
01471     WinRect HighlightWinRect(RectLoWinPos.x, RectLoWinPos.y, RectHiWinPos.x, RectHiWinPos.y);
01472 
01473     pPaintDC->SetBrush(wxBrush(wxColour(*wxWHITE)));
01474     pPaintDC->SetPen(*wxTRANSPARENT_PEN);
01475     pPaintDC->DrawRectangle(HighlightWinRect);
01476     pPaintDC->SetPen(wxPen(*wxBLACK, 1, wxSOLID));      // Restore previous pen (as expected by further drawing)
01477     return TRUE;
01478 }

BOOL OILRuler::Init void   )  [static]
 

read the font name and size for the ruler from config and use this to determine the size of the rulers

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/9/95
Returns:
FALSE if fails

Definition at line 188 of file oilruler.cpp.

00189 {
00190     if (FontName == NULL)
00191         FontName = new String_256(_R(IDS_OILRULER_SMALL_FONTS));
00192 
00193     BOOL ok=GetApplication()->DeclareSection(_T("Rulers"), 2);
00194     if (ok && FontName != NULL) ok=GetApplication()->DeclarePref(_T("Rulers"), _T("FontName"), FontName);
00195     if (ok) ok=GetApplication()->DeclarePref(_T("Rulers"), _T("FontSize"), &FontSize, 2,72);
00196     if (!ok)
00197         return FALSE;
00198     ERROR2IF(FontName == NULL,FALSE,"OILRuler::SetRenderWidth() - couldn't create a string_256 - eek !");
00199     if (FontName->Length()==0)
00200         FontName->Load(_R(IDS_OILRULER_SMALL_FONTS));
00201     ERROR2IF(FontName->Length()==0,FALSE,"OILRuler::SetRenderWidth() - invalid FontName in config");
00202 
00203     WinRect WinTextSize;
00204     ok=GetTextSize(&WinTextSize, _T("8"));
00205     if (!ok)
00206         return FALSE;
00207 
00208     CharHeight  = WinTextSize.GetHeight();
00209     CharWidth   = WinTextSize.GetWidth();
00210     RenderWidth = CharWidth*3 + 4;
00211 
00212     return TRUE;
00213 }

virtual BOOL OILRuler::IsHorizontal  )  [inline, protected, virtual]
 

Reimplemented in OILHorizontalRuler, and OILVerticalRuler.

Definition at line 226 of file oilruler.h.

00226 {return FALSE;}

void OILRuler::LinkToKernel RulerBase pKRuler  )  [inline]
 

Definition at line 192 of file oilruler.h.

00192 { pKernelRuler=pKRuler; }

void OILRuler::OnFocus wxFocusEvent &  event  )  [protected]
 

The rulers shouldn't get focues (unless they ever decided to handle arrow movement...).

Author:
Luke_Hart (Xara Group Ltd) <lukeh@xara.com>
Date:
17/07/06
Parameters:
- [INPUTS]
See also:

Definition at line 1560 of file oilruler.cpp.

01561 {
01562     // Put the focus back into active view
01563     TRACEUSER( "jlh92", _T("NO, that control is not allowed focus") );
01564     AfxGetApp().GiveActiveCanvasFocus();
01565 }

void OILRuler::OnLButtonDblClk wxMouseEvent &  event  )  [protected]
 

handle left button double clicks

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
7/10/95
Parameters:
nFlags - [INPUTS] point -

Definition at line 679 of file oilruler.cpp.

00680 {
00681     wxPoint point = event.GetPosition();
00682     UINT32 nFlags = ClickModifiers::SynthesizeMouseEventFlags(event);
00683     BOOL bHandled = HandleRulerDragEvent(MK_LBUTTON, nFlags, (WinCoord)point, CLICKTYPE_DOUBLE);
00684 
00685     if (!bHandled)
00686     {
00687         // get a few pointers
00688         DocView* pDocView = m_pOwnerView->GetDocViewPtr();
00689         Spread*  pSpread  = pKernelRuler->GetpRulerPair()->GetpSpread();
00690         if (pDocView==NULL || pSpread==NULL)
00691         {
00692             ERROR3("OILRuler::OnLButtonDblClk() - pDocView==NULL || pSpread==NULL");
00693             return;
00694         }
00695     
00696         OilCoord MouseOilPos    = ClientToOil(pDocView,point);
00697         DocCoord MouseSpreadPos = MouseOilPos.ToDoc(pSpread,pDocView).ToSpread(pSpread,pDocView);
00698         CSnap SnapObject(pDocView,pSpread);
00699         SnapObject.Snap(&MouseSpreadPos,FALSE);
00700     
00701         if (IsHorizontal())
00702             OpNewGuideline::SetNewGuidelineParam(GUIDELINE_VERT, MouseSpreadPos.x);
00703         else
00704             OpNewGuideline::SetNewGuidelineParam(GUIDELINE_HORZ, MouseSpreadPos.y);
00705     
00706         OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NEWGUIDELINE2);
00707         if (pOpDesc!=NULL)
00708             pOpDesc->Invoke();
00709         else
00710             ERROR3("OILRuler::OnLButtonDblClk() - FindOpDescriptor(OPTOKEN_NEWGUIDELINE) failed");
00711     }
00712 }

void OILRuler::OnLButtonDown wxMouseEvent &  event  )  [protected]
 

Handle mouse event.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/Jun/2006
Parameters:
event - wxMouseEvent object [INPUTS]
- [OUTPUTS]
Returns:
-

Definition at line 659 of file oilruler.cpp.

00660 {
00661     UINT32 nFlags = ClickModifiers::SynthesizeMouseEventFlags(event);
00662     BOOL bHandled = HandleRulerDragEvent(MK_LBUTTON, nFlags, (WinCoord)event.GetPosition(), CLICKTYPE_SINGLE);
00663 
00664     if (!bHandled)
00665         StartDrag(nFlags, event.GetPosition());
00666 }

void OILRuler::OnLButtonUp wxMouseEvent &  event  )  [protected]
 

Handle mouse event.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/Jun/2006
Parameters:
event - wxMouseEvent object [INPUTS]
- [OUTPUTS]
Returns:
-

Definition at line 727 of file oilruler.cpp.

00728 {
00729     BOOL bHandled = HandleRulerUpEvent(MK_LBUTTON, (WinCoord)event.GetPosition());
00730 
00731     if (!bHandled)
00732     {
00733         // We do nothing in this case
00734     }
00735 }

void OILRuler::OnMButtonDblClk wxMouseEvent &  event  )  [protected]
 

Handle mouse event.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/Jun/2006
Parameters:
event - wxMouseEvent object [INPUTS]
- [OUTPUTS]
Returns:
-

Definition at line 774 of file oilruler.cpp.

00775 {
00776     UINT32 nFlags = ClickModifiers::SynthesizeMouseEventFlags(event);
00777     BOOL bHandled = HandleRulerDragEvent(MK_MBUTTON, nFlags, event.GetPosition(), CLICKTYPE_DOUBLE);
00778 
00779     if (!bHandled)
00780     {
00781         // We do nothing in this case
00782     }
00783 }

void OILRuler::OnMButtonDown wxMouseEvent &  event  )  [protected]
 

Handle mouse event.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/Jun/2006
Parameters:
event - wxMouseEvent object [INPUTS]
- [OUTPUTS]
Returns:
-

Definition at line 750 of file oilruler.cpp.

00751 {
00752     UINT32 nFlags = ClickModifiers::SynthesizeMouseEventFlags(event);
00753     BOOL bHandled = HandleRulerDragEvent(MK_MBUTTON, nFlags, (WinCoord)event.GetPosition(), CLICKTYPE_SINGLE);
00754 
00755     if (!bHandled)
00756     {
00757         // We do nothing in this case
00758     }
00759 }

void OILRuler::OnMButtonUp wxMouseEvent &  event  )  [protected]
 

Handle mouse event.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/Jun/2006
Parameters:
event - wxMouseEvent object [INPUTS]
- [OUTPUTS]
Returns:
-

Definition at line 798 of file oilruler.cpp.

00799 {
00800     BOOL bHandled = HandleRulerUpEvent(MK_MBUTTON, event.GetPosition());
00801 
00802     if (!bHandled)
00803     {
00804         // We do nothing in this case
00805     }
00806 }

void OILRuler::OnMouseMove wxMouseEvent &  event  )  [protected]
 

handle mouse moves over the ruler

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
8/10/95
Parameters:
nFlags - [INPUTS] point -

Definition at line 1124 of file oilruler.cpp.

01125 {
01126 //  UINT32 nFlags = ClickModifiers::SynthesizeMouseEventFlags(event);
01127     wxPoint MousePos = event.GetPosition();
01128 
01129     static wxPoint OldMousePos = wxPoint(0,0);
01130     if (MousePos==OldMousePos)
01131         return;
01132 
01133     StatusLine* pStatusLine=GetApplication()->GetpStatusLine();
01134     if (pStatusLine)
01135     {
01136         String_256 Text("");
01137         GetStatusLineText(&Text, WinCoord(MousePos.x, MousePos.y), this);
01138         pStatusLine->UpdateText(&Text, STATUSLINE_SELDESC_STATBAR);
01139     }
01140 
01141 /*  Attempt to update mouse followers when pointer over ruler
01142     Doesn't work...
01143     DocView* pView = m_pOwnerView->GetDocViewPtr();
01144     if (pView!=NULL)
01145     {
01146         wxWindow* pRenderWnd=pView->GetRenderWindow();
01147         wxPoint wcoord = ClientToOtherClient(pRenderWnd, MousePos);
01148         OilCoord ocoord = ( (WinCoord *)&wcoord )->ToOil(pView, TRUE);
01149         Spread* pSpread = Document::GetSelectedSpread();
01150         DocCoord dcoord = ocoord.ToDoc(pSpread, pView);
01151         RulerPair* pRulerPair = pView->GetpRulerPair();
01152         if (pRulerPair!=NULL)
01153             pRulerPair->UpdateMouseFollowers(&dcoord);
01154     }
01155 */
01156 
01157     OldMousePos = MousePos;
01158 }

void OILRuler::OnPaint wxPaintEvent &  evnt  )  [protected]
 

Redraws the colour bar.

Author:
Gerry_Iles (Xara Group Ltd) <camelotdev@xara.com>
Date:
ages ago
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

Definition at line 479 of file oilruler.cpp.

00480 {
00481     // Always create this so that the area is validated
00482     wxPaintDC dc(this);
00483 
00484     if (!CCamApp::IsDisabled())
00485     {
00486         DoPaint(&dc);
00487     }
00488 }

void OILRuler::OnRButtonDblClk wxMouseEvent &  event  )  [protected]
 

Handle mouse event.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/Jun/2006
Parameters:
event - wxMouseEvent object [INPUTS]
- [OUTPUTS]
Returns:
-

Definition at line 845 of file oilruler.cpp.

00846 {
00847     UINT32 nFlags = ClickModifiers::SynthesizeMouseEventFlags(event);
00848     BOOL bHandled = HandleRulerDragEvent(MK_RBUTTON, nFlags, event.GetPosition(), CLICKTYPE_DOUBLE);
00849 
00850     if (!bHandled)
00851     {
00852         // We do nothing in this case
00853     }
00854 }

void OILRuler::OnRButtonDown wxMouseEvent &  event  )  [protected]
 

Handle mouse event.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/Jun/2006
Parameters:
event - wxMouseEvent object [INPUTS]
- [OUTPUTS]
Returns:
-

Definition at line 821 of file oilruler.cpp.

00822 {
00823     UINT32 nFlags = ClickModifiers::SynthesizeMouseEventFlags(event);
00824     BOOL bHandled = HandleRulerDragEvent(MK_RBUTTON, nFlags, event.GetPosition(), CLICKTYPE_SINGLE);
00825 
00826     if (!bHandled)
00827     {
00828         // We do nothing in this case
00829     }
00830 }

void OILRuler::OnRButtonUp wxMouseEvent &  event  )  [protected]
 

Handle left button up events - pop-up context sensitive menu.

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/10/95
Parameters:
nFlags - [INPUTS] point -

Definition at line 867 of file oilruler.cpp.

00868 {
00869     wxPoint point = event.GetPosition();
00870     BOOL bHandled = HandleRulerUpEvent(MK_RBUTTON, point);
00871 
00872     if (!bHandled)
00873     {
00874         // get a few pointers - no error checking yet!
00875         DocView* pDocView = m_pOwnerView->GetDocViewPtr();
00876         Spread*  pSpread  = pKernelRuler->GetpRulerPair()->GetpSpread();
00877         if (pDocView==NULL || pSpread==NULL)
00878         {
00879             ERROR3("OILRuler::OnLButtonUp() - pDocView==NULL || pSpread==NULL");
00880             return;
00881         }
00882     
00883         // convert to spread coords
00884         OilCoord MouseOilPos    = ClientToOil(pDocView,point);
00885         DocCoord MouseSpreadPos = MouseOilPos.ToDoc(pSpread,pDocView).ToSpread(pSpread,pDocView);
00886         CSnap SnapObject(pDocView,pSpread);
00887         SnapObject.Snap(&MouseSpreadPos,FALSE);
00888     
00889         // precharge static buffer with all the info to insert a new guide
00890         // at the click point on the off chance this is the option the user chooses from
00891         // the menu - as it is not poosible to pass params via the pop-up menu system
00892         if (IsHorizontal())
00893             GuidelinePropDlg::SetNewGuidelineParams(GUIDELINE_VERT, MouseSpreadPos.x);
00894         else
00895             GuidelinePropDlg::SetNewGuidelineParams(GUIDELINE_HORZ, MouseSpreadPos.y);
00896     //  // insert immediate (witout dialog)
00897     //  if (IsHorizontal())
00898     //      OpNewGuideline::SetNewGuidelineParam(GUIDELINE_VERT, MouseSpreadPos.x);
00899     //  else
00900     //      OpNewGuideline::SetNewGuidelineParam(GUIDELINE_HORZ, MouseSpreadPos.y);
00901     
00902         RulerContextMenu* pRulerMenu = new RulerContextMenu;
00903         pRulerMenu->Show();
00904     }
00905 }

BOOL OILRuler::PaintMouseFollower OilCoord  OilPos,
DocView pDocView,
MouseFollowerRenderType  RenderType
 

interface to DrawMouseFollower()

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/9/95
Parameters:
OilPos - position of mouse for which to draw x/y follower [INPUTS] pDocView - RenderType - RenderOn/RenderOff (not yet used - just inverts previous state)
Returns:
FALSE if fails

Definition at line 1383 of file oilruler.cpp.

01385 {
01386     // get hold of a dc (if in middle of OnPaint(), pPaintDC should be valid)
01387     wxDC* pDC = pPaintDC;
01388     if (pDC)
01389     {
01390         BOOL ok = DrawMouseFollower(OilPos, pDocView, RenderType, pDC);
01391         return ok;
01392     }
01393 
01394     wxPaintDC dc(this);
01395     BOOL ok = DrawMouseFollower(OilPos, pDocView, RenderType, &dc);
01396 
01397     return ok;
01398 }

void OILRuler::PatB wxDC *  pDC,
INT32  x,
INT32  y,
INT32  dx,
INT32  dy,
wxColour  rgb
[static]
 

Paints a rectangle in the given (dithered) colour.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/3/94
Parameters:
hDC - destination DC [INPUTS] x,y,dx,dy - rectangle to fill rgb - colour to fill with

Definition at line 271 of file oilruler.cpp.

00272 {
00273     wxRect rect;
00274     rect.x  = x;
00275     rect.y  = y;
00276     rect.width  = dx;
00277     rect.height = dy;
00278 
00279     wxBrush brush(rgb);
00280     pDC->SetBrush(brush);
00281     pDC->DrawRectangle(rect);
00282 }

virtual BOOL OILRuler::PostCreate void   )  [inline, virtual]
 

Reimplemented in OILHorizontalRuler, and OILVerticalRuler.

Definition at line 190 of file oilruler.h.

00190 {return FALSE;}

void OILRuler::SetCurrentStates  )  [protected]
 

Set the View and Document current.

Author:
Chris_Parks (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/6/96
Parameters:
- [INPUTS]
See also:

Definition at line 1534 of file oilruler.cpp.

01535 {
01536     if (m_pOwnerView)
01537     {
01538         DocView* pDocView = m_pOwnerView->GetDocViewPtr();
01539         if (pDocView)
01540         {
01541             pDocView->SetCurrent();
01542             Document* pKernelDoc = pDocView->GetDoc();
01543             if (pKernelDoc)
01544                 pKernelDoc->SetCurrent();
01545         }
01546     }
01547 }

void OILRuler::ShowRuler BOOL  show  )  [virtual]
 

Shows or hides this ruler.

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/8/95
Parameters:
show - FALSE to hide the ruler [INPUTS]

Reimplemented in OILHorizontalRuler.

Definition at line 383 of file oilruler.cpp.

00384 {
00385     Show(show);
00386     
00387     BROADCAST_TO_ALL(ScreenChangeMsg());
00388 
00389     if (show)
00390     {
00391         // we need to take into account camelots new floating toolbar ....
00392 
00393 PORTNOTE("ruler", "Removed code to move floating toolbars")
00394 #if !defined(EXCLUDE_FROM_XARALX)
00395         DockBarType DockBarType;// = DOCKBAR_FLOAT;
00396         KernelBarPos * pKernelBarPos;
00397 
00398         // find out where the toolbar is docked
00399         GetMainFrame()->GetBarPosInfo(&(String_32 ("Toolbar")), &DockBarType, &pKernelBarPos);
00400 
00401         if (DockBarType == DOCKBAR_FLOAT)
00402         {
00403             RECT MainFrameWindowRect;
00404             ::GetWindowRect (GetSafeHwnd (), &MainFrameWindowRect);
00405 
00406             POINT ToolbarTL;
00407             ToolbarTL.x = pKernelBarPos->x;
00408             ToolbarTL.y = pKernelBarPos->y;
00409 
00410             if (PtInRect (&MainFrameWindowRect, ToolbarTL))
00411             {
00412                 KernelBarPos NewToolBarPos = *pKernelBarPos;
00413                 BaseBar* PtrToToolBar = BaseBar::GetPtrToToolBar ();
00414                 
00415                 // then we need to move the toolbar ....
00416                 if (IsHorizontal ())
00417                 {
00418                     INT32 dy = MainFrameWindowRect.bottom - ToolbarTL.y;
00419                     NewToolBarPos.y += dy;
00420                 }
00421                 else // its the vertical ruler
00422                 {
00423                     INT32 dx = MainFrameWindowRect.right - ToolbarTL.x;
00424                     NewToolBarPos.x += dx;
00425                 }
00426 
00427                 if (PtrToToolBar)
00428                 {
00429                     PtrToToolBar->MoveBar ((WPARAM) DOCKBAR_FLOAT, (LPARAM) &NewToolBarPos);
00430                 }
00431             }
00432         }
00433 #endif
00434     }
00435 } 

BOOL OILRuler::StartDrag UINT32  nFlags,
wxPoint  point
[protected, virtual]
 

base StartDrag function - don't call

Author:
Chris_Parks (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/3/94
Returns:
FALSE if fails

Reimplemented in OILHorizontalRuler, and OILVerticalRuler.

Definition at line 343 of file oilruler.cpp.

00344 { 
00345     return TRUE;
00346 }

BOOL OILRuler::StartToolDrag ClickModifiers  Mods,
OilCoord  point,
String_256 pOpToken,
OpParam pParam
 

StartDrag function for tool drags.

Author:
Martin Wuerthner <xara@mw-software.com>
Date:
12/07/06 Input: Mods - the click modifiers (as passed to OnRulerClick) point - the pointer position (as passed to OnRulerClick) OpToken - name of the operation to invoke Params - an opaque pointer to the parameters for the operation
Returns:
FALSE if fails

Definition at line 361 of file oilruler.cpp.

00362 {
00363     if (m_pOwnerView != NULL)
00364     {
00365         DocView* pDocView = m_pOwnerView->GetDocViewPtr();
00366         wxPoint ClientPoint = point.ToWin(pDocView);
00367         m_pOwnerView->InvokeDragOp(pOpToken, pParam, Mods, ClientPoint);
00368         return TRUE;
00369     }
00370 
00371     return FALSE;
00372 }

void OILRuler::UpdateRuler  ) 
 

Redraw the whole ruler.

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/8/95
Parameters:
- [INPUTS]

Definition at line 447 of file oilruler.cpp.

00448 {
00449     Refresh();
00450     Update();
00451 } 


Member Data Documentation

INT32 OILRuler::CharHeight = 0 [static, protected]
 

Definition at line 264 of file oilruler.h.

INT32 OILRuler::CharWidth = 0 [static, protected]
 

Definition at line 265 of file oilruler.h.

String_256 * OILRuler::FontName = NULL [static]
 

Definition at line 258 of file oilruler.h.

INT32 OILRuler::FontSize = 7 [static]
 

Definition at line 259 of file oilruler.h.

BOOL OILRuler::InDrag [protected]
 

Definition at line 284 of file oilruler.h.

UINT32 OILRuler::m_FirstClickButton [protected]
 

Definition at line 282 of file oilruler.h.

UINT32 OILRuler::m_LastClickButton [protected]
 

Definition at line 279 of file oilruler.h.

ClickModifiers OILRuler::m_LastClickMods [protected]
 

Definition at line 281 of file oilruler.h.

wxPoint OILRuler::m_LastClickPoint [protected]
 

Definition at line 280 of file oilruler.h.

ClickType OILRuler::m_LastClickType [protected]
 

Definition at line 278 of file oilruler.h.

CCamView* OILRuler::m_pOwnerView [protected]
 

Definition at line 275 of file oilruler.h.

OpGuidelineParam OILRuler::NewGuidelineParam [static, protected]
 

Definition at line 273 of file oilruler.h.

RulerBase* OILRuler::pKernelRuler [protected]
 

Definition at line 276 of file oilruler.h.

wxDC * OILRuler::pPaintDC = NULL [static, protected]
 

Definition at line 269 of file oilruler.h.

DocView * OILRuler::pPaintDocView = NULL [static, protected]
 

Definition at line 270 of file oilruler.h.

INT32 OILRuler::RenderWidth = 0 [static, protected]
 

Definition at line 262 of file oilruler.h.

wxSize OILRuler::RulerToDocOffset = wxSize(0,0) [static, protected]
 

Definition at line 271 of file oilruler.h.

UINT32 OILRuler::RulerWidth = 0 [static, protected]
 

Definition at line 263 of file oilruler.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 03:57:22 2007 for Camelot by  doxygen 1.4.4