#include <regshape.h>
Inheritance diagram for QuickShapeBaseInfoBarOp:

Public Member Functions | |
| QuickShapeBaseInfoBarOp (QuickShapeBase *pTool=NULL, ResourceID r=_R(IDD_REGSHAPETOOLBAR)) | |
| MsgResult | Message (Msg *Msg) |
| RegShape info bar message handler. | |
| MsgResult | DialogMessage (DialogMsg *Msg) |
| RegShape info bar dialog message handler (deals with dialog specifc messages). | |
| BOOL | InitialiseInfobar () |
| To initialise the regular shape tool's infobar. In particular it sets up the number of sides listbox, and puts the buttons into a sensible default state. | |
| BOOL | SetBarFromSelection () |
| Scans the selected items. If any Regular shapes are found then the infobar is setup using their parameters. | |
| INT32 | GetCreationMode () |
| To read which of the creation modes is currently selected. | |
| void | SetCreationMode (INT32 NewMode) |
| To set the creation mode the infobar is in (ie it sets the three buttons). | |
| BOOL | IsPolygonCreate () |
| To read wether ploygons or ellipses should be created. | |
| void | SetPolygonCreate (BOOL PolygonCreate) |
| To set the selection state of the polygon/ellipse buttons. If ellipse mode then the curve and stellate buttons are greyed. | |
| BOOL | IsStellationCreate () |
| To get the selection state of the stellation button. | |
| void | SetStellationCreate (BOOL StellationCreate) |
| To set the selection state of the stellation button. | |
| BOOL | IsCurvedCreate () |
| To get the selection state of the rounded edges button. | |
| void | SetCurvedCreate (BOOL CurvedCreate) |
| To set the selection state of the rounded corners button. | |
| INT32 | GetNumSides (BOOL Error) |
| To get the number of sides in the edit field. | |
| void | SetNumSides (INT32 NumberSides) |
| To initialise the regular shape tool's infobar. In particular it sets up the number of sides listbox. A value of -1 means clear the field. | |
| BOOL | AreShapesSelected () |
| To see if there are any regular shapes in the current selection. Also sets the member variable ChangeMode to the return value. | |
| void | SetToolMode () |
| Sets the text in the infobars Add/Change field. | |
| void | UpdateInfobar () |
| To ensure the infobar is up-to-date. Called on initial creation and selection changes. | |
| void | BuildEditMenu (BOOL UpdateImmediate=FALSE) |
| Builds the list-box menu for the the edit fields. The contents of the menu are dependent on the currenty selected shapes (whether or not thay have curvature). | |
| void | UpdateEditFields (NodeRegularShape *ShapeToShow=NULL, Spread *ShapeSpread=NULL) |
| Updates the edit fields. The contents depend on the currently selected menu item. | |
| BOOL | SetEdit (CGadgetID gid, INT32 nValue, BOOL PaintNow) |
| Converts the given value to the appropriate units, as contained in the spread, converts it to text and writes in into the edit-field. | |
| BOOL | SetEditPosition (CGadgetID gidX, CGadgetID gidY, DocCoord loc, Spread *pSpread, BOOL PaintNow) |
| Converts the given coordinate to the appropriate units, as contained in the spread, converts it to text and writes in into the edit-field. | |
| BOOL | EditCommit (BOOL UpperCommit) |
| Called when the user has committed a value in either of the edit fields. | |
| BOOL | GetFieldCoord (DocCoord *pCoord, Spread *pSpread) |
| Reads the text in the edit fields as coordinate values. | |
| BOOL | BumpLeft () |
| Called when the user clicks on the bump left button. Does different things depeding on what the edit fields are displaying. | |
| BOOL | BumpRight () |
| Called when the user clicks on the bump right button. Does different things depeding on what the edit fields are displaying. | |
| BOOL | BumpUp () |
| Called when the user clicks on the bump up button. Does different things depeding on what the edit fields are displaying. | |
| BOOL | BumpDown () |
| Called when the user clicks on the bump down button. Does different things depeding on what the edit fields are displaying. | |
| void | SetHelp () |
| Sets the bubble and status line help on the edit fields depending on the current menu setting. | |
| BOOL | IsEnabled (CGadgetID gid) |
| Test whether control is available to the user or not. | |
| BOOL | EditCommitCentre (BOOL UpperCommit, EditRegularShapeParam *ChangeData) |
| Does the processing involved when the user changes a vales in the edit fields when in centre mode. | |
| BOOL | EditCommitSizeAndRotation (BOOL UpperCommit, EditRegularShapeParam *ChangeData) |
| Does the processing involved when the user changes a vales in the edit fields when in size and rotation mode. | |
| BOOL | EditCommitStellation (BOOL UpperCommit, EditRegularShapeParam *ChangeData) |
| Does the processing involved when the user changes a vales in the edit fields when in stellation mode. | |
| BOOL | EditCommitCurvature (BOOL UpperCommit, EditRegularShapeParam *ChangeData) |
| Does the processing involved when the user changes a vales in the edit fields when in curvature mode. | |
| BOOL | EditCommitWidthAndHeight (BOOL UpperCommit, EditRegularShapeParam *ChangeData) |
| Does the processing involved when the user changes a vales in the edit fields when in width and height mode. | |
| BOOL | EditCommitRotation (BOOL UpperCommit, EditRegularShapeParam *ChangeData) |
| Does the processing involved when the user changes a vales in the edit fields when in rotation mode. | |
| double | RestrictAngleZero360 (double Current) |
| Restricts an angle for display purposes. | |
| double | RestrictAngleMinus180 (double Current) |
| Restricts an angle for display purposes. | |
Public Attributes | |
| QuickShapeBase * | pQuickShapeBase |
| BOOL | ChangeMode |
| Spread * | CurrentSpread |
| INT32 | BumpAmount |
| BOOL | PreviousCurvature |
| BOOL | PreviousStellation |
| BOOL | PreviousCircular |
Definition at line 222 of file regshape.h.
|
||||||||||||
|
Definition at line 227 of file regshape.h. 00228 { 00229 DlgResID = r; 00230 pQuickShapeBase = pTool; 00231 ChangeMode = FALSE; 00232 CurrentSpread = NULL; 00233 BumpAmount = 0; 00234 PreviousCurvature = FALSE; 00235 PreviousStellation = FALSE; 00236 PreviousCircular = FALSE; 00237 }; // Dummy default constructor for DYNCREATE
|
|
|
To see if there are any regular shapes in the current selection. Also sets the member variable ChangeMode to the return value.
Definition at line 2484 of file regshape.cpp. 02485 { 02486 ERROR2IF(pQuickShapeBase==NULL, FALSE, "NULL tool pointer"); 02487 02488 SelRange* Selection = GetApplication()->FindSelection(); 02489 Node* pNode = Selection->FindFirst(); 02490 02491 while (pNode != NULL) 02492 { 02493 if (IS_A(pNode, NodeRegularShape) && pQuickShapeBase->IsInterestingShape((NodeRegularShape*)pNode)) 02494 { 02495 ChangeMode = TRUE; 02496 return TRUE; 02497 } 02498 pNode = Selection->FindNext(pNode); 02499 } 02500 02501 ChangeMode = FALSE; 02502 return FALSE; 02503 }
|
|
|
Builds the list-box menu for the the edit fields. The contents of the menu are dependent on the currenty selected shapes (whether or not thay have curvature).
Definition at line 1198 of file regshape.cpp. 01199 { 01200 if (WindowID==NULL || pQuickShapeBase==NULL) 01201 return; 01202 01203 BOOL HasCurvature = FALSE; 01204 BOOL HasStellation = FALSE; 01205 BOOL JustCircular = TRUE; 01206 01207 // scan the selected shapes to see if any have curvature 01208 SelRange* Selection = GetApplication()->FindSelection(); 01209 Node* pNode = Selection->FindFirst(); 01210 01211 while ((pNode != NULL) && !(HasCurvature && HasStellation)) 01212 { 01213 if (IS_A(pNode, NodeRegularShape) && pQuickShapeBase->IsInterestingShape((NodeRegularShape*)pNode)) 01214 { 01215 NodeRegularShape* pShape = (NodeRegularShape*)pNode; 01216 01217 if (pShape->IsPrimaryCurvature() || pShape->IsStellationCurvature()) 01218 HasCurvature = TRUE; 01219 01220 if (pShape->IsStellated()) 01221 HasStellation = TRUE; 01222 01223 if (!pShape->IsCircular()) 01224 JustCircular = FALSE; 01225 } 01226 01227 pNode = Selection->FindNext(pNode); 01228 } 01229 01230 if (JustCircular) 01231 { 01232 HasCurvature = HasStellation = FALSE; 01233 } 01234 01235 // Re-build the drop down menu 01236 if ((PreviousCurvature != HasCurvature) || (PreviousStellation != HasStellation) || 01237 (PreviousCircular != JustCircular) || UpdateImmediate) 01238 { 01239 PreviousCircular = JustCircular; 01240 PreviousCurvature = HasCurvature; 01241 PreviousStellation = HasStellation; 01242 String_32 Str; 01243 const INT32 MenuEntries = 4; 01244 BOOL ResPresent[MenuEntries] = {TRUE, TRUE, HasStellation, HasCurvature}; 01245 UINT32 ResIDs[MenuEntries] = {_R(IDS_REGSHAPETOOL_MENUCENTRE), _R(IDS_REGSHAPETOOL_MENUMAJOR), 01246 _R(IDS_REGSHAPETOOL_MENUSTELL), _R(IDS_REGSHAPETOOL_MENUCURVE)}; 01247 QuickShapeBase::EditModeIDS OptionIDs[MenuEntries] = {QuickShapeBase::EDITF_CENTRE, QuickShapeBase::EDITF_MAJOR, QuickShapeBase::EDITF_STELLATION, QuickShapeBase::EDITF_CURVE}; 01248 01249 // By hiding and showing the gadget it forces closed an open drop-down list 01250 HideGadget(_R(IDC_EDIT_REGSHAPETOOL_POS), TRUE); 01251 DeleteAllValues(_R(IDC_EDIT_REGSHAPETOOL_POS)); 01252 HideGadget(_R(IDC_EDIT_REGSHAPETOOL_POS), FALSE); 01253 01254 // Fill in the standard menu options 01255 INT32 CurrentCount = 0; 01256 for (INT32 i = 0; i < MenuEntries; i++) 01257 { 01258 if (ResPresent[i]) 01259 { 01260 // Get the string and set the option name to it 01261 UINT32 StringResource = ResIDs[i]; 01262 if ((i == 1) && (pQuickShapeBase->IsEllipse() || pQuickShapeBase->IsRectangle())) 01263 { 01264 StringResource = _R(IDS_REGSHAPETOOL_MENUSIZE); 01265 pQuickShapeBase->EditFieldOptions[CurrentCount++] = QuickShapeBase::EDITF_SIZE; 01266 } 01267 else 01268 pQuickShapeBase->EditFieldOptions[CurrentCount++] = OptionIDs[i]; 01269 01270 Str.MakeMsg(StringResource); 01271 SetStringGadgetValue(_R(IDC_EDIT_REGSHAPETOOL_POS),Str); 01272 } 01273 } 01274 01275 // Ellipse and Rectangle tools have special rotate option 01276 if (pQuickShapeBase->IsEllipse() || pQuickShapeBase->IsRectangle()) 01277 { 01278 Str.MakeMsg(_R(IDS_REGSHAPETOOL_MENUROT)); 01279 pQuickShapeBase->EditFieldOptions[CurrentCount++] = QuickShapeBase::EDITF_ROT; 01280 SetStringGadgetValue(_R(IDC_EDIT_REGSHAPETOOL_POS),Str); 01281 } 01282 SetComboListLength(_R(IDC_EDIT_REGSHAPETOOL_POS)); 01283 01284 // Ensure that the selected mode is valid for this particular tool 01285 if ((!HasCurvature && (pQuickShapeBase->EditFieldMode == QuickShapeBase::EDITF_CURVE)) || 01286 (!HasStellation && (pQuickShapeBase->EditFieldMode == QuickShapeBase::EDITF_STELLATION)) ) 01287 { 01288 pQuickShapeBase->EditFieldMode = QuickShapeBase::EDITF_CENTRE; 01289 } 01290 if (!pQuickShapeBase->IsEllipse() && !pQuickShapeBase->IsRectangle() 01291 && ((pQuickShapeBase->EditFieldMode == QuickShapeBase::EDITF_SIZE) 01292 || (pQuickShapeBase->EditFieldMode == QuickShapeBase::EDITF_ROT))) 01293 { 01294 pQuickShapeBase->EditFieldMode = QuickShapeBase::EDITF_MAJOR; 01295 } 01296 INT32 SelectedItem = (INT32)pQuickShapeBase->EditFieldMode; 01297 if (SelectedItem == 3) 01298 { 01299 if (!HasStellation) 01300 SelectedItem = 2; 01301 } 01302 if (SelectedItem == (INT32)(QuickShapeBase::EDITF_SIZE)) 01303 SelectedItem = 1; 01304 if (SelectedItem == (INT32)(QuickShapeBase::EDITF_ROT)) 01305 { 01306 if (HasCurvature) 01307 SelectedItem = 3; 01308 else 01309 SelectedItem = 2; 01310 } 01311 SetSelectedValueIndex(_R(IDC_EDIT_REGSHAPETOOL_POS),SelectedItem); 01312 PaintGadgetNow(_R(IDC_EDIT_REGSHAPETOOL_POS)); 01313 } 01314 01315 UpdateEditFields(); 01316 }
|
|
|
Called when the user clicks on the bump down button. Does different things depeding on what the edit fields are displaying.
Definition at line 2835 of file regshape.cpp. 02836 { 02837 ERROR2IF(pQuickShapeBase==NULL, FALSE, "NULL tool pointer"); 02838 02839 // Get the current edit field 02840 BOOL Valid = TRUE; 02841 ERROR2IF(CurrentSpread == NULL, FALSE, "BumpRight found CurrentSpread was NULL"); 02842 DimScale* pDimScale = DimScale::GetPtrDimScale((Node*) CurrentSpread); 02843 ERROR2IF(pDimScale == NULL, FALSE, "NULL DimScalePtr"); 02844 String_256 FieldContents = GetStringGadgetValue(_R(IDC_EDIT_REGSHAPETOOL_LOWER), &Valid); 02845 02846 // Bump it 02847 if (Valid) 02848 { 02849 switch (pQuickShapeBase->EditFieldMode) 02850 { 02851 // bump centre down, and size down 02852 case QuickShapeBase::EDITF_CENTRE: 02853 { 02854 MILLIPOINT CurrentPos = 0; 02855 Valid = pDimScale->ConvertToMillipoints(FieldContents, &CurrentPos); 02856 if (Valid) 02857 { 02858 CurrentPos += OpNudge::GetNudgeStep(); 02859 SetEdit(_R(IDC_EDIT_REGSHAPETOOL_LOWER), CurrentPos, TRUE); 02860 } 02861 } 02862 break; 02863 02864 case QuickShapeBase::EDITF_SIZE: 02865 { 02866 MILLIPOINT CurrentPos = 0; 02867 Valid = pDimScale->ConvertToMillipoints(FieldContents, &CurrentPos); 02868 if (Valid) 02869 { 02870 CurrentPos += OpNudge::GetNudgeStep(); 02871 SetEdit(_R(IDC_EDIT_REGSHAPETOOL_LOWER), CurrentPos, TRUE); 02872 } 02873 } 02874 break; 02875 02876 // Rotate clockwise by 5 degrees 02877 case QuickShapeBase::EDITF_MAJOR: 02878 { 02879 double CurrentRot = GetDoubleGadgetValue(_R(IDC_EDIT_REGSHAPETOOL_LOWER), -360, 360, 0, &Valid); 02880 if (Valid) 02881 { 02882 CurrentRot = RestrictAngleZero360(CurrentRot + 5); 02883 SetDoubleGadgetValue(_R(IDC_EDIT_REGSHAPETOOL_LOWER), CurrentRot); 02884 } 02885 } 02886 break; 02887 02888 // Rotate stellation offset clockwise by 5 degrees 02889 case QuickShapeBase::EDITF_STELLATION: 02890 { 02891 double CurrentRot = GetDoubleGadgetValue(_R(IDC_EDIT_REGSHAPETOOL_LOWER), -180, 180, 0, &Valid); 02892 if (Valid) 02893 { 02894 CurrentRot = RestrictAngleMinus180(CurrentRot + 5); 02895 SetDoubleGadgetValue(_R(IDC_EDIT_REGSHAPETOOL_LOWER), CurrentRot); 02896 } 02897 } 02898 break; 02899 02900 case QuickShapeBase::EDITF_CURVE: 02901 { 02902 double CurrentCurve = GetDoubleGadgetValue(_R(IDC_EDIT_REGSHAPETOOL_LOWER), 0, 100, 0, &Valid); 02903 if (Valid) 02904 { 02905 CurrentCurve += .05; 02906 if (CurrentCurve < 0) 02907 CurrentCurve = 0; 02908 SetDoubleGadgetValue(_R(IDC_EDIT_REGSHAPETOOL_LOWER), CurrentCurve); 02909 } 02910 } 02911 break; 02912 02913 default: 02914 ERROR2(FALSE, "Unknown edit field mode found when bumping down"); 02915 } 02916 } 02917 02918 PaintGadgetNow(_R(IDC_EDIT_REGSHAPETOOL_LOWER)); 02919 return TRUE; 02920 }
|
|
|
Called when the user clicks on the bump left button. Does different things depeding on what the edit fields are displaying.
Definition at line 2555 of file regshape.cpp. 02556 { 02557 ERROR2IF(pQuickShapeBase==NULL, FALSE, "NULL tool pointer"); 02558 02559 // Get the current edit field 02560 BOOL Valid = TRUE; 02561 ERROR2IF(CurrentSpread == NULL, FALSE, "BumpLeft found CurrentSpread was NULL"); 02562 DimScale* pDimScale = DimScale::GetPtrDimScale((Node*) CurrentSpread); 02563 ERROR2IF(pDimScale == NULL, FALSE, "NULL DimScalePtr"); 02564 String_256 FieldContents = GetStringGadgetValue(_R(IDC_EDIT_REGSHAPETOOL_UPPER), &Valid); 02565 02566 // Bump it 02567 if (Valid) 02568 { 02569 switch (pQuickShapeBase->EditFieldMode) 02570 { 02571 // bump centre left, bump down major length, bump down size, bump down stellation 02572 case QuickShapeBase::EDITF_CENTRE: 02573 case QuickShapeBase::EDITF_MAJOR: 02574 case QuickShapeBase::EDITF_SIZE: 02575 case QuickShapeBase::EDITF_STELLATION: 02576 { 02577 MILLIPOINT CurrentPos = 0; 02578 Valid = pDimScale->ConvertToMillipoints(FieldContents, &CurrentPos); 02579 if (Valid) 02580 { 02581 CurrentPos -= OpNudge::GetNudgeStep(); 02582 if ((pQuickShapeBase->EditFieldMode == QuickShapeBase::EDITF_MAJOR) || (pQuickShapeBase->EditFieldMode == QuickShapeBase::EDITF_SIZE)) 02583 { 02584 if (CurrentPos>100) 02585 CurrentPos=100; 02586 } 02587 if (pQuickShapeBase->EditFieldMode == QuickShapeBase::EDITF_STELLATION) 02588 { 02589 if (CurrentPos>0) 02590 CurrentPos=0; 02591 } 02592 SetEdit(_R(IDC_EDIT_REGSHAPETOOL_UPPER), CurrentPos, TRUE); 02593 } 02594 } 02595 break; 02596 02597 case QuickShapeBase::EDITF_CURVE: 02598 { 02599 double CurrentCurve = GetDoubleGadgetValue(_R(IDC_EDIT_REGSHAPETOOL_UPPER), 0, 100, 0, &Valid); 02600 if (Valid) 02601 { 02602 CurrentCurve -= .05; 02603 if (CurrentCurve < 0) 02604 CurrentCurve = 0; 02605 SetDoubleGadgetValue(_R(IDC_EDIT_REGSHAPETOOL_UPPER), CurrentCurve); 02606 } 02607 } 02608 break; 02609 02610 // Rotate anti-clockwise by 5 degrees 02611 case QuickShapeBase::EDITF_ROT: 02612 { 02613 double CurrentRot = GetDoubleGadgetValue(_R(IDC_EDIT_REGSHAPETOOL_UPPER), -360, 360, 0, &Valid); 02614 if (Valid) 02615 { 02616 CurrentRot = RestrictAngleZero360(CurrentRot - 5); 02617 SetDoubleGadgetValue(_R(IDC_EDIT_REGSHAPETOOL_UPPER), CurrentRot); 02618 } 02619 } 02620 break; 02621 02622 default: 02623 ERROR2(FALSE, "Unknown edit field mode found when bumping left"); 02624 } 02625 PaintGadgetNow(_R(IDC_EDIT_REGSHAPETOOL_UPPER)); 02626 } 02627 02628 return TRUE; 02629 }
|
|
|
Called when the user clicks on the bump right button. Does different things depeding on what the edit fields are displaying.
Definition at line 2648 of file regshape.cpp. 02649 { 02650 ERROR2IF(pQuickShapeBase==NULL, FALSE, "NULL tool pointer"); 02651 02652 // Get the current edit field 02653 BOOL Valid = TRUE; 02654 ERROR2IF(CurrentSpread == NULL, FALSE, "BumpRight found CurrentSpread was NULL"); 02655 DimScale* pDimScale = DimScale::GetPtrDimScale((Node*) CurrentSpread); 02656 ERROR2IF(pDimScale == NULL, FALSE, "NULL DimScalePtr"); 02657 String_256 FieldContents = GetStringGadgetValue(_R(IDC_EDIT_REGSHAPETOOL_UPPER), &Valid); 02658 02659 // Bump it 02660 if (Valid) 02661 { 02662 switch (pQuickShapeBase->EditFieldMode) 02663 { 02664 // bump centre right, bump up major length, bump up size, bump up stellation 02665 case QuickShapeBase::EDITF_CENTRE: 02666 case QuickShapeBase::EDITF_MAJOR: 02667 case QuickShapeBase::EDITF_SIZE: 02668 case QuickShapeBase::EDITF_STELLATION: 02669 { 02670 MILLIPOINT CurrentPos = 0; 02671 Valid = pDimScale->ConvertToMillipoints(FieldContents, &CurrentPos); 02672 if (Valid) 02673 { 02674 CurrentPos += OpNudge::GetNudgeStep(); 02675 SetEdit(_R(IDC_EDIT_REGSHAPETOOL_UPPER), CurrentPos, TRUE); 02676 } 02677 } 02678 break; 02679 02680 case QuickShapeBase::EDITF_CURVE: 02681 { 02682 double CurrentCurve = GetDoubleGadgetValue(_R(IDC_EDIT_REGSHAPETOOL_UPPER), 0, 100, 0, &Valid); 02683 if (Valid) 02684 { 02685 CurrentCurve += .05; 02686 SetDoubleGadgetValue(_R(IDC_EDIT_REGSHAPETOOL_UPPER), CurrentCurve); 02687 } 02688 } 02689 break; 02690 02691 // Rotate clockwise by 5 degrees 02692 case QuickShapeBase::EDITF_ROT: 02693 { 02694 double CurrentRot = GetDoubleGadgetValue(_R(IDC_EDIT_REGSHAPETOOL_UPPER), -360, 360, 0, &Valid); 02695 if (Valid) 02696 { 02697 CurrentRot = RestrictAngleZero360(CurrentRot + 5); 02698 SetDoubleGadgetValue(_R(IDC_EDIT_REGSHAPETOOL_UPPER), CurrentRot); 02699 } 02700 } 02701 break; 02702 02703 default: 02704 ERROR2(FALSE, "Unknown edit field mode found when bumping right"); 02705 } 02706 PaintGadgetNow(_R(IDC_EDIT_REGSHAPETOOL_UPPER)); 02707 } 02708 02709 return TRUE; 02710 }
|
|
|
Called when the user clicks on the bump up button. Does different things depeding on what the edit fields are displaying.
Definition at line 2729 of file regshape.cpp. 02730 { 02731 ERROR2IF(pQuickShapeBase==NULL, FALSE, "NULL tool pointer"); 02732 02733 // Get the current edit field 02734 BOOL Valid = TRUE; 02735 ERROR2IF(CurrentSpread == NULL, FALSE, "BumpRight found CurrentSpread was NULL"); 02736 DimScale* pDimScale = DimScale::GetPtrDimScale((Node*) CurrentSpread); 02737 ERROR2IF(pDimScale == NULL, FALSE, "NULL DimScalePtr"); 02738 String_256 FieldContents = GetStringGadgetValue(_R(IDC_EDIT_REGSHAPETOOL_LOWER), &Valid); 02739 02740 // Bump it 02741 if (Valid) 02742 { 02743 switch (pQuickShapeBase->EditFieldMode) 02744 { 02745 // bump centre up 02746 case QuickShapeBase::EDITF_CENTRE: 02747 { 02748 MILLIPOINT CurrentPos = 0; 02749 Valid = pDimScale->ConvertToMillipoints(FieldContents, &CurrentPos); 02750 if (Valid) 02751 { 02752 CurrentPos -= OpNudge::GetNudgeStep(); 02753 SetEdit(_R(IDC_EDIT_REGSHAPETOOL_LOWER), CurrentPos, TRUE); 02754 } 02755 } 02756 break; 02757 02758 case QuickShapeBase::EDITF_SIZE: 02759 { 02760 MILLIPOINT CurrentPos = 0; 02761 Valid = pDimScale->ConvertToMillipoints(FieldContents, &CurrentPos); 02762 if (Valid) 02763 { 02764 CurrentPos -= OpNudge::GetNudgeStep(); 02765 if (CurrentPos < 0) 02766 CurrentPos = 0; 02767 SetEdit(_R(IDC_EDIT_REGSHAPETOOL_LOWER), CurrentPos, TRUE); 02768 } 02769 } 02770 break; 02771 02772 // Rotate anti-clockwise by 5 degrees 02773 case QuickShapeBase::EDITF_MAJOR: 02774 { 02775 double CurrentRot = GetDoubleGadgetValue(_R(IDC_EDIT_REGSHAPETOOL_LOWER), -360, 360, 0, &Valid); 02776 if (Valid) 02777 { 02778 CurrentRot = RestrictAngleZero360(CurrentRot - 5); 02779 SetDoubleGadgetValue(_R(IDC_EDIT_REGSHAPETOOL_LOWER), CurrentRot); 02780 } 02781 } 02782 break; 02783 02784 // Rotate stellation offset anti-clockwise by 5 degrees 02785 case QuickShapeBase::EDITF_STELLATION: 02786 { 02787 double CurrentRot = GetDoubleGadgetValue(_R(IDC_EDIT_REGSHAPETOOL_LOWER), -180, 180, 0, &Valid); 02788 if (Valid) 02789 { 02790 CurrentRot = RestrictAngleMinus180(CurrentRot - 5); 02791 SetDoubleGadgetValue(_R(IDC_EDIT_REGSHAPETOOL_LOWER), CurrentRot); 02792 } 02793 } 02794 break; 02795 02796 case QuickShapeBase::EDITF_CURVE: 02797 { 02798 double CurrentCurve = GetDoubleGadgetValue(_R(IDC_EDIT_REGSHAPETOOL_LOWER), 0, 100, 0, &Valid); 02799 if (Valid) 02800 { 02801 CurrentCurve -= .05; 02802 if (CurrentCurve < 0) 02803 CurrentCurve = 0; 02804 SetDoubleGadgetValue(_R(IDC_EDIT_REGSHAPETOOL_LOWER), CurrentCurve); 02805 } 02806 } 02807 break; 02808 02809 default: 02810 ERROR2(FALSE, "Unknown edit field mode found when bumping up"); 02811 } 02812 } 02813 02814 PaintGadgetNow(_R(IDC_EDIT_REGSHAPETOOL_LOWER)); 02815 return TRUE; 02816 }
|
|
|
RegShape info bar dialog message handler (deals with dialog specifc messages).
Definition at line 854 of file regshape.cpp. 00855 { 00856 Path NewPath; 00857 // Check if the message is a CANCEL 00858 if (Msg->DlgMsg == DIM_CANCEL) 00859 { 00860 Close(); // Close the dialog 00861 } 00862 else if (Msg->DlgMsg == DIM_CREATE) 00863 { 00864 InitialiseInfobar(); 00865 } 00866 else 00867 { 00868 BOOL CauseShapeEdit = FALSE; 00869 EditRegularShapeParam ChangeData(NULL); 00870 if (pQuickShapeBase!=NULL) 00871 ChangeData.ShapesToAffect = (EditRegularShapeParam::AffectShape)pQuickShapeBase->GetShapesToAffect(); 00872 00873 if (Msg->GadgetID == _R(IDC_BTN_REGSHAPETOOL_RADIUS)) 00874 { 00875 if (Msg->DlgMsg==DIM_LFT_BN_CLICKED && pQuickShapeBase!=NULL) 00876 { 00877 pQuickShapeBase->SetCreationMode(OpNewRegShape::RADIUS); 00878 SetCreationMode(OpNewRegShape::RADIUS); 00879 } 00880 } 00881 else if (Msg->GadgetID == _R(IDC_BTN_REGSHAPETOOL_DIAMETER)) 00882 { 00883 if (Msg->DlgMsg==DIM_LFT_BN_CLICKED && pQuickShapeBase!=NULL) 00884 { 00885 pQuickShapeBase->SetCreationMode(OpNewRegShape::DIAMETER); 00886 SetCreationMode(OpNewRegShape::DIAMETER); 00887 } 00888 } 00889 else if (Msg->GadgetID == _R(IDC_BTN_REGSHAPETOOL_BOUNDBOX)) 00890 { 00891 if (Msg->DlgMsg==DIM_LFT_BN_CLICKED && pQuickShapeBase!=NULL) 00892 { 00893 pQuickShapeBase->SetCreationMode(OpNewRegShape::BOUNDS); 00894 SetCreationMode(OpNewRegShape::BOUNDS); 00895 } 00896 } 00897 else if (Msg->GadgetID == _R(IDC_BTN_REGSHAPETOOL_STELLATION)) 00898 { 00899 if (Msg->DlgMsg==DIM_LFT_BN_CLICKED && pQuickShapeBase!=NULL) 00900 { 00901 BOOL NewStellSetting = IsStellationCreate(); 00902 pQuickShapeBase->SetStellation(NewStellSetting); 00903 // Pop the button out as the bitmap buttons are stupid 00904 if (!NewStellSetting) 00905 { 00906 SetLongGadgetValue(_R(IDC_BTN_REGSHAPETOOL_STELLATION), FALSE); 00907 } 00908 if (ChangeMode) 00909 { 00910 // Set the operation parameters 00911 if (NewStellSetting) 00912 ChangeData.NewStellated = EditRegularShapeParam::CHANGE_SETTRUE; 00913 else 00914 ChangeData.NewStellated = EditRegularShapeParam::CHANGE_SETFALSE; 00915 CauseShapeEdit = TRUE; 00916 } 00917 } 00918 } 00919 else if (Msg->GadgetID ==_R(IDC_BTN_REGSHAPETOOL_CURVATURE)) 00920 { 00921 if (Msg->DlgMsg==DIM_LFT_BN_CLICKED && pQuickShapeBase!=NULL) 00922 { 00923 BOOL NewCurveSetting = IsCurvedCreate(); 00924 pQuickShapeBase->SetCurved(NewCurveSetting); 00925 // Pop the button out as the bitmap buttons are stupid 00926 if (!NewCurveSetting) 00927 { 00928 SetLongGadgetValue(_R(IDC_BTN_REGSHAPETOOL_CURVATURE), FALSE); 00929 } 00930 if (ChangeMode) 00931 { 00932 // Set the operation parameters 00933 if (NewCurveSetting) 00934 { 00935 ChangeData.NewPrimaryCurvature = EditRegularShapeParam::CHANGE_SETTRUE; 00936 ChangeData.NewStellationCurvature = EditRegularShapeParam::CHANGE_SETTRUE; 00937 } 00938 else 00939 { 00940 ChangeData.NewPrimaryCurvature = EditRegularShapeParam::CHANGE_SETFALSE; 00941 ChangeData.NewStellationCurvature = EditRegularShapeParam::CHANGE_SETFALSE; 00942 } 00943 CauseShapeEdit = TRUE; 00944 } 00945 } 00946 } 00947 else if (Msg->GadgetID == _R(IDC_BTN_REGSHAPETOOL_POLYGON)) 00948 { 00949 if (Msg->DlgMsg==DIM_LFT_BN_CLICKED && pQuickShapeBase!=NULL) 00950 { 00951 pQuickShapeBase->SetPolygon(TRUE); 00952 if (ChangeMode) 00953 { 00954 // Set the operation parameters 00955 ChangeData.NewCircular = EditRegularShapeParam::CHANGE_SETFALSE; 00956 CauseShapeEdit = TRUE; 00957 } 00958 else 00959 { 00960 SetPolygonCreate(TRUE); 00961 } 00962 } 00963 } 00964 else if (Msg->GadgetID == _R(IDC_BTN_REGSHAPETOOL_ELLIPSE)) 00965 { 00966 if (Msg->DlgMsg==DIM_LFT_BN_CLICKED && pQuickShapeBase!=NULL) 00967 { 00968 pQuickShapeBase->SetPolygon(FALSE); 00969 if (ChangeMode) 00970 { 00971 // Set the operation parameters 00972 ChangeData.NewCircular = EditRegularShapeParam::CHANGE_SETTRUE; 00973 CauseShapeEdit = TRUE; 00974 } 00975 else 00976 { 00977 SetPolygonCreate(FALSE); 00978 } 00979 } 00980 } 00981 else if (Msg->GadgetID == _R(IDC_BTN_REGSHAPETOOL_LINES)) 00982 { 00983 if (Msg->DlgMsg==DIM_LFT_BN_CLICKED) 00984 { 00985 NewPath.Initialise(4,1); 00986 NewPath.AddMoveTo(DocCoord(0,0)); 00987 NewPath.AddLineTo(DocCoord(72000,0)); 00988 ChangeData.NewEdgePath1 = &NewPath; 00989 ChangeData.NewEdgePath2 = &NewPath; 00990 CauseShapeEdit = TRUE; 00991 } 00992 } 00993 else if (Msg->GadgetID == _R(IDC_EDIT_REGSHAPETOOL_BUMPLEFT)) 00994 { 00995 if (IsEnabled(_R(IDC_EDIT_REGSHAPETOOL_BUMPLEFT))) 00996 { 00997 if (Msg->DlgMsg==DIM_LFT_BN_CLICKED) 00998 { 00999 if (!BumpLeft()) 01000 InformError(); 01001 } 01002 else if (Msg->DlgMsg == DIM_LFT_BN_UP) 01003 { 01004 if (!EditCommit(TRUE)) 01005 InformError(); 01006 UpdateEditFields(); 01007 } 01008 } 01009 } 01010 else if (Msg->GadgetID == _R(IDC_EDIT_REGSHAPETOOL_BUMPRIGHT)) 01011 { 01012 if (IsEnabled(_R(IDC_EDIT_REGSHAPETOOL_BUMPRIGHT))) 01013 { 01014 if (Msg->DlgMsg==DIM_LFT_BN_CLICKED) 01015 { 01016 if (!BumpRight()) 01017 InformError(); 01018 } 01019 else if (Msg->DlgMsg == DIM_LFT_BN_UP) 01020 { 01021 if (!EditCommit(TRUE)) 01022 InformError(); 01023 UpdateEditFields(); 01024 } 01025 } 01026 } 01027 else if (Msg->GadgetID == _R(IDC_EDIT_REGSHAPETOOL_BUMPUP)) 01028 { 01029 if (IsEnabled(_R(IDC_EDIT_REGSHAPETOOL_BUMPUP))) 01030 { 01031 if (Msg->DlgMsg == DIM_LFT_BN_CLICKED) 01032 { 01033 if (!BumpUp()) 01034 InformError(); 01035 } 01036 else if (Msg->DlgMsg == DIM_LFT_BN_UP) 01037 { 01038 if (!EditCommit(FALSE)) 01039 InformError(); 01040 UpdateEditFields(); 01041 } 01042 } 01043 } 01044 else if (Msg->GadgetID == _R(IDC_EDIT_REGSHAPETOOL_BUMPDOWN)) 01045 { 01046 if (IsEnabled(_R(IDC_EDIT_REGSHAPETOOL_BUMPDOWN))) 01047 { 01048 if (Msg->DlgMsg == DIM_LFT_BN_CLICKED) 01049 { 01050 if (!BumpDown()) 01051 InformError(); 01052 } 01053 else if (Msg->DlgMsg == DIM_LFT_BN_UP) 01054 { 01055 if (!EditCommit(FALSE)) 01056 InformError(); 01057 UpdateEditFields(); 01058 } 01059 } 01060 } 01061 // Number of sides edit/drop down box 01062 else if (Msg->GadgetID == _R(IDC_EDIT_REGSHAPETOOL_SIDES)) 01063 { 01064 if (Msg->DlgMsg==DIM_SELECTION_CHANGED && pQuickShapeBase!=NULL) 01065 { 01066 INT32 NewNumSides = GetNumSides(TRUE); 01067 if (NewNumSides != -1) 01068 { 01069 pQuickShapeBase->SetNumSides(NewNumSides); 01070 if (ChangeMode) 01071 { 01072 // Set the operation parameters 01073 ChangeData.NewNumSides = NewNumSides; 01074 CauseShapeEdit = TRUE; 01075 } 01076 } 01077 } 01078 else if (Msg->DlgMsg== DIM_TEXT_CHANGED && pQuickShapeBase!=NULL) 01079 { 01080 BOOL Valid; 01081 String_256 string = GetStringGadgetValue(_R(IDC_EDIT_REGSHAPETOOL_SIDES),&Valid); 01082 if (!string.IsEmpty()) 01083 { 01084 pQuickShapeBase->SetNumSides(GetLongGadgetValue(_R(IDC_EDIT_REGSHAPETOOL_SIDES), 1, 99, 0, &Valid)); 01085 if (!Valid) 01086 { 01087 InformError(_R(IDE_REGSHAPETOOL_SIDES)); 01088 pQuickShapeBase->SetNumSides(3); 01089 UpdateInfobar(); 01090 } 01091 } 01092 } 01093 } 01094 else if (Msg->GadgetID == _R(IDC_EDIT_REGSHAPETOOL_POS)) 01095 { 01096 if (Msg->DlgMsg==DIM_SELECTION_CHANGED && pQuickShapeBase!=NULL) 01097 { 01098 WORD temp; 01099 GetValueIndex(_R(IDC_EDIT_REGSHAPETOOL_POS), &temp); 01100 pQuickShapeBase->EditFieldMode = pQuickShapeBase->EditFieldOptions[temp]; 01101 UpdateEditFields(); 01102 } 01103 } 01104 else if (Msg->GadgetID == _R(IDC_EDIT_REGSHAPETOOL_UPPER)) 01105 { 01106 if (Msg->DlgMsg == DIM_SELECTION_CHANGED) 01107 { 01108 if (!EditCommit(TRUE)) 01109 InformError(); 01110 UpdateEditFields(); 01111 } 01112 } 01113 else if (Msg->GadgetID == _R(IDC_EDIT_REGSHAPETOOL_LOWER)) 01114 { 01115 if (Msg->DlgMsg == DIM_SELECTION_CHANGED) 01116 { 01117 if (!EditCommit(FALSE)) 01118 InformError(); 01119 UpdateEditFields(); 01120 } 01121 } 01122 01123 // Invoke an operation to perform changes, if requested 01124 if (CauseShapeEdit) 01125 { 01126 OpDescriptor* Apple = OpDescriptor::FindOpDescriptor(CC_RUNTIME_CLASS(OpEditRegularShape)); 01127 if (Apple != NULL) 01128 Apple->Invoke(&ChangeData); 01129 } 01130 } 01131 01132 return OK; 01133 }
|
|
|
Called when the user has committed a value in either of the edit fields.
Definition at line 1878 of file regshape.cpp. 01879 { 01880 ERROR2IF(pQuickShapeBase==NULL, FALSE, "NULL tool pointer"); 01881 01882 01883 EditRegularShapeParam ChangeData(NULL); 01884 ChangeData.ShapesToAffect = (EditRegularShapeParam::AffectShape)pQuickShapeBase->GetShapesToAffect(); 01885 01886 // Put changes into ChangeData depending on selected edit 01887 switch (pQuickShapeBase->EditFieldMode) 01888 { 01889 case QuickShapeBase::EDITF_CENTRE: 01890 if (!EditCommitCentre(UpperCommit, &ChangeData)) 01891 return FALSE; 01892 break; 01893 case |