#include <guides.h>
Inheritance diagram for OpSpreadOrigin:
Public Member Functions | |
OpSpreadOrigin () | |
Default constructor. | |
~OpSpreadOrigin () | |
Default destructor. | |
virtual void | Do (OpDescriptor *pOpDesc) |
This func starts a drag that will end up setting the spread origin. | |
virtual void | DragPointerMove (DocCoord PointerPos, ClickModifiers ClickMods, Spread *, BOOL bSolidDrag) |
Responds to a mouse move during a drag of the origin. | |
virtual void | DragFinished (DocCoord PointerPos, ClickModifiers ClickMods, Spread *, BOOL Success, BOOL bSolidDrag) |
Responds to the drag of a guideline ending. | |
void | RenderMyDragBlobs () |
Renders the blobs associated with the current drag. | |
void | RenderDragBlobs (DocRect Rect, Spread *pSpread, BOOL bSolidDrag) |
Main routine for rendering the blobs associated with the current drag. This can be called from anywhere, e.g. when the view scrolls. | |
Static Public Member Functions | |
static BOOL | Init () |
Registers an op desc for this op. | |
static OpState | GetState (String_256 *Description, OpDescriptor *) |
Func for determining the usability of this op. | |
Protected Member Functions | |
void | DoDrag (Spread *pSpread, DocCoord PointerPos) |
Starts a drag for the origin. | |
BOOL | DoChangeOrigin (Spread *pSpread, DocCoord NewOrigin) |
Undoably set a new grid/user origin. | |
Private Member Functions | |
CC_DECLARE_DYNCREATE (OpSpreadOrigin) | |
Private Attributes | |
Spread * | pSpread |
DocCoord | CurrentOrigin |
BOOL | RenderOn |
Definition at line 439 of file guides.h.
|
Default constructor.
Definition at line 2841 of file guides.cpp.
|
|
Default destructor.
Definition at line 2861 of file guides.cpp.
|
|
|
|
This func starts a drag that will end up setting the spread origin.
Reimplemented from OpGridResize. Reimplemented in OpResetSpreadOrigin. Definition at line 2879 of file guides.cpp.
|
|
Undoably set a new grid/user origin.
Definition at line 3012 of file guides.cpp. 03013 { 03014 ERROR2IF(pSpread==NULL,FALSE,"OpSpreadOrigin::DoChangeOrigin() - pSpread==NULL"); 03015 03016 NodeGrid* pDefaultGrid = pSpread->FindFirstDefaultGridInSpread(); 03017 ERROR2IF(pDefaultGrid==NULL,FALSE,"OpSpreadOrigin::DoChangeOrigin() - FindFirstDefaultGrid() failed"); 03018 03019 // if no change in origin, just return without inserting an op 03020 MILLIPOINT x,y; 03021 pDefaultGrid->GetOrigin(&x,&y); // call me stupid but couldn't this return a DocCoord! 03022 if (DocCoord(x,y)==NewOrigin) 03023 return TRUE; 03024 03025 // cunningly (NOT) OpGridResize expects the origin to be page relative! 03026 DocCoord NewPageRelativeOrigin; 03027 pSpread->SpreadCoordToPagesCoord(&NewPageRelativeOrigin,NewOrigin); 03028 03029 // Force the origin to snap to a pixel boundary. 03030 NewPageRelativeOrigin.x = ((NewPageRelativeOrigin.x + 375) / 750) * 750; 03031 NewPageRelativeOrigin.y = ((NewPageRelativeOrigin.y + 375) / 750) * 750; 03032 03033 // set up a complete set of grid params with new origin 03034 // (would be nice to have them all default to 'no change' and only specify the new ones but that would be far to obvious!) 03035 GridResizeInfo GridParams; 03036 GridParams.pSpread = pSpread; 03037 GridParams.OriginX = NewPageRelativeOrigin.x; 03038 GridParams.OriginY = NewPageRelativeOrigin.y; 03039 GridParams.GridDivisions = pDefaultGrid->GetDivisions(); 03040 GridParams.GridSubDivisions = pDefaultGrid->GetSubdivisions(); 03041 GridParams.GridUnits = pDefaultGrid->GetUnits(); 03042 GridParams.TypeOfGrid = pDefaultGrid->GetGridType(); 03043 // GridParams.GridSpacing // this seems to be 'MainStep' which is also determined from Divisions and Units 03044 03045 return DoResizeGrid(&GridParams); 03046 }
|
|
Starts a drag for the origin.
Definition at line 2901 of file guides.cpp. 02902 { 02903 pSpread = pThisSpread; 02904 02905 if (pSpread == NULL) 02906 pSpread = Document::GetSelectedSpread(); 02907 02908 ERROR3IF(pSpread == NULL,"pSpread == NULL"); 02909 if (pSpread == NULL) 02910 { 02911 End(); 02912 return; 02913 } 02914 02915 CurrentOrigin = PointerPos; 02916 02917 RenderMyDragBlobs(); 02918 02919 // put up some status line help 02920 StatusLine* pStatusLine=GetApplication()->GetpStatusLine(); 02921 if (pStatusLine!=NULL) 02922 { 02923 String_256 temp(_R(IDS_OPSPREADORIGINDRAG)); 02924 pStatusLine->UpdateText(&temp,STATUSLINE_SELDESC_STATBAR); 02925 } 02926 02927 // Tell the Dragging system that we need drags to happen 02928 StartDrag( DRAGTYPE_DEFERSCROLL ); 02929 }
|
|
Responds to the drag of a guideline ending.
Reimplemented from Operation. Definition at line 2978 of file guides.cpp. 02979 { 02980 // First Rub out the old boxes 02981 RenderMyDragBlobs(); 02982 02983 Success = (Success && !OpGuideline::IsMouseOverRuler()); 02984 02985 if (Success) 02986 { 02987 DocView::SnapCurrent(pSpread,&PointerPos); 02988 CurrentOrigin = PointerPos; 02989 02990 Success = DoChangeOrigin(pSpread,CurrentOrigin); 02991 } 02992 02993 if (!Success) 02994 FailAndExecute(); 02995 02996 // End the op & Drag 02997 End(); 02998 EndDrag(); 02999 }
|
|
Responds to a mouse move during a drag of the origin.
Reimplemented from Operation. Definition at line 2947 of file guides.cpp. 02948 { 02949 // First Rub out the old box 02950 RenderMyDragBlobs(); 02951 02952 DocView::SnapCurrent(pSpread,&PointerPos); 02953 02954 CurrentOrigin = PointerPos; 02955 02956 // Render the new drag box 02957 RenderMyDragBlobs(); 02958 }
|
|
Func for determining the usability of this op.
Reimplemented from OpGridResize. Reimplemented in OpResetSpreadOrigin. Definition at line 3167 of file guides.cpp. 03168 { 03169 OpState State; 03170 return State; 03171 }
|
|
Registers an op desc for this op.
Reimplemented from OpGridResize. Reimplemented in OpResetSpreadOrigin. Definition at line 3138 of file guides.cpp. 03139 { 03140 return RegisterOpDescriptor(0, 03141 _R(IDS_OPSPREADORIGIN), 03142 CC_RUNTIME_CLASS(OpSpreadOrigin), 03143 OPTOKEN_SPREADORIGIN , 03144 OpSpreadOrigin::GetState, 03145 0, /* help ID */ 03146 0, /* bubble ID */ 03147 0 /* bitmap ID */ 03148 ); 03149 }
|
|
Main routine for rendering the blobs associated with the current drag. This can be called from anywhere, e.g. when the view scrolls.
Reimplemented from Operation. Definition at line 3086 of file guides.cpp. 03087 { 03088 static DocRect RenderRect; 03089 03090 RenderRegion* pRender = DocView::RenderOnTop( NULL, pSpread, UnclippedEOR ); 03091 03092 DocCoord Start; 03093 DocCoord End; 03094 03095 while (pRender != NULL) 03096 { 03097 pRender->SetLineColour(COLOUR_BLACK); 03098 pRender->SetLineWidth(pRender->GetScaledPixelWidth()); 03099 03100 if (RenderOn) 03101 { 03102 View* pView = pRender->GetRenderView(); 03103 if (pView != NULL) 03104 { 03105 RenderRect = pView->GetDocViewRect(pSpread); 03106 RenderRect = RenderRect.ToSpread(pSpread,pView); 03107 } 03108 RenderRect.Inflate(pRender->GetScaledPixelWidth()); 03109 } 03110 03111 Start = DocCoord(CurrentOrigin.x,RenderRect.lo.y); 03112 End = DocCoord(CurrentOrigin.x,RenderRect.hi.y); 03113 pRender->DrawDashLine(Start,End); 03114 03115 Start = DocCoord(RenderRect.lo.x,CurrentOrigin.y); 03116 End = DocCoord(RenderRect.hi.x,CurrentOrigin.y); 03117 pRender->DrawDashLine(Start,End); 03118 03119 // Get the Next render region 03120 pRender = DocView::GetNextOnTop(NULL); 03121 } 03122 }
|
|
Renders the blobs associated with the current drag.
Definition at line 3063 of file guides.cpp. 03064 { 03065 DocRect Rect; 03066 RenderDragBlobs(Rect,pSpread, FALSE); 03067 RenderOn = !RenderOn; 03068 }
|
|
|
|
|
|
|