#include <penedit.h>
Inheritance diagram for OpPenEditPath:
Public Member Functions | |
OpPenEditPath () | |
OpPenEditPath constructor. | |
BOOL | DoPenDragPath () |
virtual void | DragPointerMove (DocCoord Pos, ClickModifiers Mods, Spread *pSpread, BOOL bSolidDrag) |
This is called every time the mouse moves, during a drag. | |
virtual void | DragFinished (DocCoord Pos, ClickModifiers Mods, Spread *pSpread, BOOL Success, BOOL bSolidDrag) |
This is called when a drag operation finishes. | |
virtual void | RenderDragBlobs (DocRect, Spread *, BOOL bSolidDrag) |
Render some drag control handles as the mouse moves around. These will spin around an anchor point. | |
Static Public Member Functions | |
static BOOL | Init () |
Declares a preference that allows you to clear memory in delete(). | |
static OpState | GetState (String_256 *, OpDescriptor *) |
Protected Member Functions | |
DocRect | GetBoundingRect () |
Find the bounding box of the edit path and the drag handles. | |
void | ConvertToLine (const INT32 index) |
Convert the currently edited curve element into a line. | |
void | RemoveRotateEnd (const INT32 index) |
Remove any rotate bits from a bezier element, starting at index. | |
BOOL | InsertBezier (DocCoord pt1, DocCoord pt2, DocCoord pt3) |
Add a specific curve at the end of the path. | |
BOOL | InsertCurvedLine (DocCoord pt1, DocCoord pt2) |
Add a specific curve at the end of the path. The curve is made of colinear points. | |
BOOL | InsertGhostedBezier (DocCoord pt1, DocCoord pt2, DocCoord pt3) |
Add a specific curve at the end of the path. The curve control points are made up of { pt2, Ghost(pt1,pt2), LinIntpl(Ghost,pt3), pt3 }. | |
BOOL | ConvertPathEnd (Path *pDocPath) |
Common code to convert an edited element to a line, or remove its rotation bits. This should happen when the user simply clicks and does not perform a drag. The built curve element should be replaced by either a none smoothed curve or a line. | |
void | SetWobbleIndex (WobbleFlags wibble, const INT32 index) |
Set the control handle index of our edit curve which will follow the dragging control handles. | |
void | WobbleCoords () |
Moves the control handles around dependent on the classes wobble flags. | |
Protected Attributes | |
Path * | pEditPath |
INT32 | WobbleIndex |
WobbleFlags | Wobble |
Definition at line 371 of file penedit.h.
|
OpPenEditPath constructor.
Definition at line 1058 of file penedit.cpp.
|
|
Common code to convert an edited element to a line, or remove its rotation bits. This should happen when the user simply clicks and does not perform a drag. The built curve element should be replaced by either a none smoothed curve or a line.
Definition at line 1384 of file penedit.cpp. 01385 { 01386 BOOL converted = FALSE; 01387 01388 // set the path position and read the coordinate data 01389 INT32 LastEl = pDocPath->GetNumCoords(); 01390 pDocPath->SetPathPosition(LastEl-1); 01391 01392 DocCoord CtrlPtC = pDocPath->GetCoord(); 01393 PathVerb CtrlPtV = (pDocPath->GetVerb()) & ~PT_CLOSEFIGURE; 01394 PathFlags CtrlPtF = pDocPath->GetFlags(); 01395 01396 // now create an element dependent on the control point type 01397 01398 switch (CtrlPtV) 01399 { 01400 case PT_BEZIERTO: 01401 if (CtrlPtF.IsRotate) 01402 RemoveRotateEnd(1); 01403 else 01404 ConvertToLine(1); 01405 converted=TRUE; 01406 break; 01407 01408 case PT_LINETO: 01409 ConvertToLine(1); 01410 converted=TRUE; 01411 break; 01412 } 01413 return converted; 01414 }
|
|
Convert the currently edited curve element into a line.
Definition at line 1240 of file penedit.cpp. 01241 { 01242 // remove the curve element, then stick a none smooth line 01243 // segment in there. 01244 01245 pEditPath->DeleteFromElement(index); 01246 PathFlags tempflags; 01247 tempflags.IsSelected = TRUE; 01248 pEditPath->InsertLineTo(GetMidHandle(), &tempflags); 01249 }
|
|
Definition at line 1100 of file penedit.cpp. 01101 { 01102 // Tell the Dragging system that we need drags to happen 01103 DocRect HandlesRect = GetBoundingRect(); 01104 return StartDrag(DRAGTYPE_AUTOSCROLL, &HandlesRect, &CurrentMousePos); 01105 }
|
|
This is called when a drag operation finishes.
Reimplemented from Operation. Reimplemented in OpPenCreatePath, OpPenAddElement, and OpPenClosePath. Definition at line 1434 of file penedit.cpp. 01436 { 01437 // terminate the drag and operation 01438 EndDrag(); 01439 }
|
|
This is called every time the mouse moves, during a drag.
Reimplemented from Operation. Reimplemented in OpPenClosePath. Definition at line 1159 of file penedit.cpp. 01162 { 01163 // If drag has moved onto a different spread, convert the coord to be relative to the 01164 // original spread. 01165 if (pSpread != StartSpread) 01166 PointerPos = MakeRelativeToSpread(StartSpread, pSpread, PointerPos); 01167 01168 // Make sure we get the grid snapping involved 01169 DocCoord SnapPos = PointerPos; 01170 DocView::SnapCurrent(pSpread,&SnapPos); 01171 01172 if (CurrentMousePos != SnapPos) 01173 { 01174 01175 // Rub out the old EORed version of the path and stick a new one on 01176 DocRect Rect = OpPenEditPath::GetBoundingRect(); 01177 RenderDragBlobs(Rect, StartSpread, bSolidDrag); 01178 01179 Rect.IncludePoint(SnapPos); 01180 01181 // Alter the curve drag handles 01182 ChangeTrackHandle(SnapPos, ClickMods.Constrain); 01183 01184 // make sure we wobble all the coordinates around this control point 01185 // correctly. 01186 WobbleCoords(); 01187 01188 // Now render the blobs back on again 01189 Rect = Rect.Union(OpPenEditPath::GetBoundingRect()); 01190 RenderDragBlobs(Rect, StartSpread, bSolidDrag); 01191 } 01192 01193 }
|
|
Find the bounding box of the edit path and the drag handles.
Definition at line 1208 of file penedit.cpp. 01209 { 01210 01211 DocRect Rect; 01212 DocView* pDocView = DocView::GetSelected(); 01213 ENSURE( pDocView != NULL, "There was no selected docview when getting the bounding box" ); 01214 01215 if ( pDocView != NULL ) 01216 { 01217 DocRect BlobRect; 01218 DocCoord Coord; 01219 Rect = pEditPath->GetBoundingRect(); 01220 Rect = Rect.Union(OpPenHandles::GetHandlesRect()); 01221 // inflate by 1/4 of an inch to avoid eor problems 01222 Rect.Inflate(72000>>2); 01223 } 01224 01225 return Rect; 01226 }
|
|
Reimplemented in OpPenCreatePath, OpPenAddElement, and OpPenClosePath. |
|
Declares a preference that allows you to clear memory in delete().
Reimplemented from SimpleCCObject. Reimplemented in OpPenCreatePath, OpPenAddElement, and OpPenClosePath. |
|
Add a specific curve at the end of the path.
Definition at line 1285 of file penedit.cpp. 01286 { 01287 // insert a particular type of curve 01288 PathFlags tempflags; 01289 tempflags.IsRotate = TRUE; 01290 BOOL done = pEditPath->InsertCurveTo(pt1, pt2, pt3, &tempflags); 01291 01292 if (done) 01293 { 01294 INT32 npts = pEditPath->GetNumCoords(); 01295 PathFlags* Flags = pEditPath->GetFlagArray(); 01296 Flags[npts-1].IsSelected = TRUE; 01297 } 01298 return done; 01299 }
|
|
Add a specific curve at the end of the path. The curve is made of colinear points.
Definition at line 1315 of file penedit.cpp. 01316 { 01317 01318 BOOL ok = pEditPath->InsertMoveTo(pt1, NULL); 01319 if (ok) 01320 { 01321 DocCoord Cpt1; 01322 Cpt1.x = (2*pt1.x + pt2.x)/3; 01323 Cpt1.y = (2*pt1.y + pt2.y)/3; 01324 01325 DocCoord Cpt2; 01326 Cpt2.x = (pt1.x + 2*pt2.x)/3; 01327 Cpt2.y = (pt1.y + 2*pt2.y)/3; 01328 01329 ok = InsertBezier(Cpt1, Cpt2, pt2); 01330 01331 } 01332 return ok; 01333 }
|
|
Add a specific curve at the end of the path. The curve control points are made up of { pt2, Ghost(pt1,pt2), LinIntpl(Ghost,pt3), pt3 }.
Definition at line 1350 of file penedit.cpp. 01351 { 01352 BOOL ok = pEditPath->InsertMoveTo(pt2, NULL); 01353 if (ok) 01354 { 01355 DocCoord Cpt1; 01356 Cpt1.x = pt2.x - (pt1.x - pt2.x); 01357 Cpt1.y = pt2.y - (pt1.y - pt2.y); 01358 01359 DocCoord Cpt2; 01360 Cpt2.x = (Cpt1.x + 2*pt3.x)/3; 01361 Cpt2.y = (Cpt1.y + 2*pt3.y)/3; 01362 01363 ok = InsertBezier(Cpt1, Cpt2, pt3); 01364 } 01365 return ok; 01366 }
|
|
Remove any rotate bits from a bezier element, starting at index.
Definition at line 1264 of file penedit.cpp. 01265 { 01266 // Remove all rotate values from the end curve element 01267 PathFlags* Flags = pEditPath->GetFlagArray(); 01268 Flags[index].IsRotate = FALSE; 01269 Flags[index+1].IsRotate = FALSE; 01270 Flags[index+2].IsRotate = FALSE; 01271 }
|
|
Render some drag control handles as the mouse moves around. These will spin around an anchor point.
Reimplemented from Operation. Definition at line 1454 of file penedit.cpp. 01455 { 01456 01457 RenderRegion* pRegion = DocView::RenderOnTop( &Rect, StartSpread, ClippedEOR ); 01458 while ( pRegion ) 01459 { 01460 // Get the edit path to render itself 01461 pRegion -> SetLineColour(COLOUR_XOREDIT); 01462 pRegion -> SetLineWidth(0); 01463 pRegion -> DrawPath(pEditPath); 01464 01465 // Render the drag handles on top 01466 OpPenHandles::UpdateHandles(pRegion); 01467 01468 pRegion = DocView::GetNextOnTop(NULL); 01469 } 01470 }
|
|
Set the control handle index of our edit curve which will follow the dragging control handles.
Definition at line 1079 of file penedit.cpp. 01080 { 01081 Wobble = wibble; 01082 WobbleIndex = index; 01083 }
|
|
Moves the control handles around dependent on the classes wobble flags.
Definition at line 1120 of file penedit.cpp. 01121 { 01122 DocCoord* Coords = pEditPath->GetCoordArray(); 01123 01124 if (Wobble.PrevBrother) 01125 Coords[WobbleIndex-1] = GetGhostHandle(); 01126 01127 if (Wobble.PrevSister) 01128 { 01129 Coords[WobbleIndex-2].x = (2*Coords[WobbleIndex-3].x + Coords[WobbleIndex-1].x)/3; 01130 Coords[WobbleIndex-2].y = (2*Coords[WobbleIndex-3].y + Coords[WobbleIndex-1].y)/3; 01131 } 01132 01133 if (Wobble.NextBrother) 01134 Coords[WobbleIndex+1] = GetTrackHandle(); 01135 01136 if (Wobble.NextSister) 01137 { 01138 Coords[WobbleIndex+2].x = (Coords[WobbleIndex+1].x + 2*Coords[WobbleIndex+3].x)/3; 01139 Coords[WobbleIndex+2].y = (Coords[WobbleIndex+1].y + 2*Coords[WobbleIndex+3].y)/3; 01140 } 01141 }
|
|
|
|
|
|
|