SelectorInfoBarOp Class Reference

Class for handling the Selector tool's information bar. More...

#include <selinfo.h>

Inheritance diagram for SelectorInfoBarOp:

InformationBarOp DialogBarOp DialogOp Operation MessageHandler ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 SelectorInfoBarOp ()
 Default constructor for a SelectorInfoBarOp.
BOOL IsAspectLocked () const
 Enquires of the state of the "Lock Aspect Ratio" button.
BOOL InRotateMode () const
 Checks the state of the "Rotate/Bounds blobs" button.
BOOL ShouldScaleLines () const
 Checks the state of the "Leave Copy" button. Checks the state of the "Scale Lines" button.
BOOL DontConsiderAttrs (void) const
 Checks the "DontConsiderAttrs" state. This is used to determine if displays and editing of widths and heights of objects should include the effect of attributes - for example, line widths can significantly affect the size of an object.
void SetAspectLock (BOOL fState)
 Checks the state of the "Scale Lines" button. NB. FEATURE REMOVED FOR THIS RELEASE. Sets the state of the "Lock Aspect Ratio" button.
void SetRotateMode (BOOL fState)
 Sets the state of the "Rotate/Bounds blobs" button.
void SetScaleLines (BOOL fState)
 Sets the state of the "Leave Copy" button. Sets the state of the "Scale Lines" button.
void SetEdit (CGadgetID gid, INT32 nValue, Spread *pUnitSpread, BOOL fUpdate=TRUE)
 Converts the given value to the appropriate units, as contained in the spread, converts it to text and writes in into the edit-field.
void SetDoubleEdit (CGadgetID gid, double nValue, BOOL fUpdate=TRUE)
 Converts the given double value to text and writes in into the edit-field.
void SetEdit (CGadgetID gid, FIXED16 fxValue, Spread *pUnitSpread, BOOL fUpdate=TRUE)
 Sets an edit-field in the selector info-bar to the given fixed-point value. If a spread is passed then the value will be converted to the appropriate units for the spread. Currently ANGLEs are always in degrees so this is not yet implemented.
void ClearEdit (CGadgetID gid)
 Blanks the given edit-field.
void SetEdit_OnSelectionChange ()
 Updates the X, Y, W, H edit fields of the info-bar with the position and extent of the currently selected object(s), if any. If there is no selection then it clears and disables the edit-fields until there is. Called by the selector tool when it is notified that the selection has changed.
void SetEdit_OnDrag (TransformBoundingData *pData, Spread *pSpread)
 Dynamically updates the text in the edit-fields as an object is being dragged. Works out what needs doing from the pData argument.
void EnableAllEdits (BOOL fEnabled)
 Enables or disables the edit-fields in the info-bar, clearing them to blank if they are being disabled.
void EnableGrid (BOOL fEnabled)
 Enables or disables the rotate grid control.
void PaintAllEditsNow ()
 Forces an immediate repaint of any edit field that has had its contents changed.
void UpdateAllRecords ()
 Updates internal records of all edit-controls.
void ReportEditError (UINT32 nErrorMsgID)
 Reports errors the user makes when typing in the selector tool-bar edit fields.

Public Attributes

SelectorToolpSelectorTool

Protected Member Functions

virtual MsgResult Message (Msg *pMessage)
 Takes a look at the message and if it is for for selector tool info-bar then respond to it.

Private Member Functions

void HandleCreate (DialogMsg *pDlgMsg)
 Sets the initial state of the controls in the info-bar.
BOOL HandleButtonDown (DialogMsg *pDlgMsg)
 For the given button calls the appropriate functions that update the blob manager.
void HandleButtonUp (DialogMsg *pDlgMsg)
 For "nudge-buttons", responds to them being released by calling the HandleEditCommit function, ie. acting as if the user hit the ENTER key within an edit-field meaning that the program should act on any changes made. For all other buttons, does nothing.
void HandleEditCommit (DialogMsg *pDlgMsg)
 Reads the text from the edit-fields, converts it to millipoints, informs the selector tool that the user has changed the selection's position and/or extent.
void HandleGridButton (DialogMsg *pDlgMsg)
 Responds to a click on the "telephone keypad", passing the event on to the selector tool.
void HandleBumpClickLinear (UINT32 nEditControlID, INT32 nSign)
 Responds to a click on a bump button ("nudge") for a "linear" control, ie. an X, Y, width or height field, not an angle. The value will be nudged in the direction indicated by nSign, by the (user preference) nudge distance.
void HandleBumpClickAngle (UINT32 nEditControlID, INT32 nSign, double Min, double Max)
 Responds to a click on a bump button for angles, ie unitless numeric data.
SelEditRecordGetRecord (UINT32 nEditControlID)
 Sets the state of the "Transform Fills" button. NB. FEATURE REMOVED FOR THIS RELEASE.
void UpdateRecord (SelEditRecord *per)
 Called when an edit-field is initialised or changed by the user.
void UpdateRecord (UINT32 nControlID)
 Updates internal records of the given edit-control.
BOOL HasChangedRecord (INT32 i)
 Reports on whether the given edit-control has new info in it.
double ConvertRecord (INT32 i)
 Reads the text in the given edit-control record and converts it to a INT32.
MILLIPOINT ConvertMillipointRecord (INT32 i)
 Converts an edit-control to a millipoint value, allowing for unit conversions.
FIXED16 ConvertFixedpointRecord (INT32 i)
 Converts the given edit-control to a fixed-point number.

Private Attributes

SelEditRecord aerEdits [8]
BOOL fConvertedOK

Static Private Attributes

static BOOL fLockAspect = TRUE
static BOOL fRotateMode = FALSE
static BOOL fScaleLines = TRUE

Friends

BOOL SelectorTool::ReadPrefs ()
void SelectorTool::SelectChange (BOOL)
BOOL SelectorTool::OnKeyPress (KeyPress *)
void SelectorTool::HandleButtonUp ()
void SelectorTool::FigureUserFeedback (Spread *pSpread, DocCoord dcPos, ClickModifiers cmods, BOOL DoSlowTests, String_256 *pStr, Cursor **ppPointerShape)

Detailed Description

Class for handling the Selector tool's information bar.

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

Definition at line 129 of file selinfo.h.


Constructor & Destructor Documentation

SelectorInfoBarOp::SelectorInfoBarOp  ) 
 

Default constructor for a SelectorInfoBarOp.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/7/94
See also:
class InformationBarOp

Definition at line 159 of file selinfo.cpp.

00160   : pSelectorTool(NULL)
00161 {
00162     DlgResID = _R(IDD_SELECTORINFO);
00163 }


Member Function Documentation

void SelectorInfoBarOp::ClearEdit CGadgetID  gid  ) 
 

Blanks the given edit-field.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/9/94
Parameters:
gid the gadget ID of the edit-field to clear [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 866 of file selinfo.cpp.

00867 {
00868     String_256 str;
00869     str.Empty();
00870     if(HasWindow())
00871         SetStringGadgetValue(gid, str, FALSE);
00872     UpdateRecord((UINT32) gid);
00873 }

FIXED16 SelectorInfoBarOp::ConvertFixedpointRecord INT32  i  )  [private]
 

Converts the given edit-control to a fixed-point number.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/11/94
Parameters:
i edit-control identifier, 0-7 [INPUTS]
- [OUTPUTS]
Returns:
Contents of the edit-control as a fixed-point number

Errors: -

See also:
-

Definition at line 730 of file selinfo.cpp.

00731 {
00732     BOOL fOk;
00733     double n = Convert::StringToDouble( aerEdits[i].strText, MILLIPOINTS, &fOk );       // NB. not really
00734     fConvertedOK = fConvertedOK && fOk;
00735     return (FIXED16) n;
00736 }

MILLIPOINT SelectorInfoBarOp::ConvertMillipointRecord INT32  i  )  [private]
 

Converts an edit-control to a millipoint value, allowing for unit conversions.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/11/94
Parameters:
i identifier of an edit-control, 0-7 [INPUTS]
- [OUTPUTS]
Returns:
The contents of the given edit-control as a millipoint value.

Errors: -

See also:
-

Definition at line 705 of file selinfo.cpp.

00706 {
00707     MILLIPOINT n;
00708     DimScale* pDimScale = DimScale::GetPtrDimScale(pSelectorTool->GetSelectionSpread());
00709     ERROR2IF (pDimScale == NULL, 1,
00710                 "Null DimScale* in SelectorInfoBarOp::ConvertMillipointRecord");
00711     fConvertedOK = fConvertedOK && pDimScale->ConvertToMillipoints( aerEdits[i].strText, &n );
00712     return n;
00713 }

double SelectorInfoBarOp::ConvertRecord INT32  i  )  [private]
 

Reads the text in the given edit-control record and converts it to a INT32.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/11/94
Parameters:
i identifier of an edit-control, 0-7 [INPUTS]
- [OUTPUTS]
Returns:
The numeric value of the contents of the edit-control.

Errors: -

See also:
-

Definition at line 683 of file selinfo.cpp.

00684 {
00685     double n;
00686     fConvertedOK = fConvertedOK && Convert::StringToDouble( aerEdits[i].strText, &n );
00687     return n;
00688 }

BOOL SelectorInfoBarOp::DontConsiderAttrs void   )  const
 

Checks the "DontConsiderAttrs" state. This is used to determine if displays and editing of widths and heights of objects should include the effect of attributes - for example, line widths can significantly affect the size of an object.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/2/96
Returns:
TRUE if attributes should NOT be considered in width/height displays
Notes: Depending on the user preferences, this option is either slaved off the "Scale Line Widths" option, or is forced on/off permanently.

The preferences controlling this behaviour are held in the SelectorTool

Definition at line 377 of file selinfo.cpp.

00378 {
00379     // If "SlaveLineWidthToButton" preference is TRUE, then we use the Scale Line Widths
00380     // button state to determine the return value
00381     if (SelectorTool::fSlaveLineWidthToButton)
00382         return(!ShouldScaleLines());
00383 
00384     // Otherwise, we take the setting from the "ConsiderLineWidths" preference
00385     return(!SelectorTool::fConsiderLineWidths);
00386 }

void SelectorInfoBarOp::EnableAllEdits BOOL  fEnabled  ) 
 

Enables or disables the edit-fields in the info-bar, clearing them to blank if they are being disabled.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
31/8/94
Parameters:
fEnabled TRUE if the gadgets should be enabled, FALSE if they [INPUTS] should be disabled.
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 892 of file selinfo.cpp.

00893 {
00894     if (!HasWindow())
00895     {
00896         TRACEUSER( "JustinF", _T("Tried to enable edit controls but they don't exist?!?\n"));
00897         return;
00898     }
00899 
00900     // Clear the edit fields if being disabled.
00901     if (!fEnabled)
00902     {
00903         ClearEdit(_R(IDC_SEL_EDIT_X));
00904         ClearEdit(_R(IDC_SEL_EDIT_Y));
00905         ClearEdit(_R(IDC_SEL_EDIT_W));
00906         ClearEdit(_R(IDC_SEL_EDIT_H));
00907         ClearEdit(_R(IDC_SEL_EDIT_XSCALE));
00908         ClearEdit(_R(IDC_SEL_EDIT_YSCALE));
00909         ClearEdit(_R(IDC_SEL_EDIT_ANGLE));
00910         ClearEdit(_R(IDC_SEL_EDIT_SHEAR));
00911     }
00912     
00913     // Enable/disable the controls.
00914     EnableGadget(_R(IDC_SEL_EDIT_X),      fEnabled);
00915     EnableGadget(_R(IDC_SEL_EDIT_Y),      fEnabled);
00916     EnableGadget(_R(IDC_SEL_EDIT_W),      fEnabled);
00917     EnableGadget(_R(IDC_SEL_EDIT_H),      fEnabled);
00918     EnableGadget(_R(IDC_SEL_EDIT_XSCALE), fEnabled);
00919     EnableGadget(_R(IDC_SEL_EDIT_YSCALE), fEnabled);
00920     EnableGadget(_R(IDC_SEL_EDIT_ANGLE),  fEnabled);
00921     EnableGadget(_R(IDC_SEL_EDIT_SHEAR),  fEnabled);
00922 }

void SelectorInfoBarOp::EnableGrid BOOL  fEnabled  ) 
 

Enables or disables the rotate grid control.

Author:
Alex Bligh <alex@alex.org.uk>
Date:
03-Feb-2005
Parameters:
fEnabled TRUE if the gadgets should be enabled, FALSE if they [INPUTS] should be disabled.
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 938 of file selinfo.cpp.

00939 {
00940     EnableGadget(_R(IDC_SEL_GRID_NW), fEnabled);
00941     EnableGadget(_R(IDC_SEL_GRID_N) , fEnabled);
00942     EnableGadget(_R(IDC_SEL_GRID_NE), fEnabled);
00943     EnableGadget(_R(IDC_SEL_GRID_W) , fEnabled);
00944     EnableGadget(_R(IDC_SEL_GRID_CENTRE), fEnabled);
00945     EnableGadget(_R(IDC_SEL_GRID_E) , fEnabled);
00946     EnableGadget(_R(IDC_SEL_GRID_SW), fEnabled);
00947     EnableGadget(_R(IDC_SEL_GRID_S) , fEnabled);
00948     EnableGadget(_R(IDC_SEL_GRID_SE), fEnabled);
00949 }

SelEditRecord * SelectorInfoBarOp::GetRecord UINT32  nEditControlID  )  [private]
 

Sets the state of the "Transform Fills" button. NB. FEATURE REMOVED FOR THIS RELEASE.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
4/11/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 537 of file selinfo.cpp.

00538 {
00539     if (!HasWindow()) return NULL;
00540 
00541     // Search through the array of edit-records lloking for the given ID.
00542     for (SelEditRecord* per = aerEdits; per < &aerEdits[8]; per++)
00543     {
00544         if (per->nControlID == nEditControlID) return per;
00545     }
00546     
00547     // Couldn't find the corresponding edit-field (big problem!)
00548     ERROR3("Couldn't find edit-field record in SelectorInfoBarOp::GetRecord!");
00549     return NULL;
00550 }

void SelectorInfoBarOp::HandleBumpClickAngle UINT32  nEditControlID,
INT32  nSign,
double  Min,
double  Max
[private]
 

Responds to a click on a bump button for angles, ie unitless numeric data.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/11/94
Parameters:
nEditControlID identifier of the edit-control [INPUTS] nSign whether to increase (+1) or decrease (-1) the field Min The minimum allowed value in this field (inclusive) Max The maximum allowed angle in this field (inclusive)
- [OUTPUTS]
Returns:
-
Notes: The value in the icon is incremented by the value in nSign. If this value is less than the minimum or greater than the maximum, the value will be clipped to the appropriate limit.

Returns:
Errors: -
See also:
-

Definition at line 1537 of file selinfo.cpp.

01538 {
01539     // If there's nothing selected then ignore the clicks.
01540     if (pSelectorTool->GetSelectionSpread() == NULL) return;
01541 
01542     // Try to read the edit-field.
01543     BOOL fOk;
01544     String_256 str = GetStringGadgetValue(nEditControlID, &fOk);
01545     if (!fOk)
01546     {
01547         TRACEUSER( "JustinF", _T("Couldn't read edit control\n") );
01548         return;
01549     }
01550 
01551     // Convert from text to a number.
01552     double nAngle = Convert::StringToDouble( str, MILLIPOINTS, &fOk);
01553     if (!fOk)
01554     {
01555         TRACEUSER( "JustinF", _T("Couldn't convert edit control\n") );
01556         return;
01557     }
01558 
01559     // Increment as required
01560     nAngle += nSign;
01561 
01562     // And clip to allowable range
01563     if (nAngle < Min)
01564         nAngle = Min;
01565 
01566     if (nAngle > Max)
01567         nAngle = Max;
01568 
01569     // Adjust it by nSign and write the new value to the edit-field.
01570     SetEdit(nEditControlID, (ANGLE) nAngle, NULL, FALSE);
01571 
01572     // Set the input focus to the associated edit-field.  NB. we don't do this anymore
01573     // because Charles doesn't like it.
01574 //  SetKeyboardFocus(nEditControlID);
01575 //  HighlightText(nEditControlID);
01576 }

void SelectorInfoBarOp::HandleBumpClickLinear UINT32  nEditControlID,
INT32  nSign
[private]
 

Responds to a click on a bump button ("nudge") for a "linear" control, ie. an X, Y, width or height field, not an angle. The value will be nudged in the direction indicated by nSign, by the (user preference) nudge distance.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/11/94
Parameters:
nEditControlID --- the identifier of the (EDIT) control associated [INPUTS] with the clicked bump button nSign --- either -1 or 1, depending on which of the bumps was clicked (eg. less, more)
- [OUTPUTS]
Returns:
-

Errors: -

See also:
SelectorInfoBarOp::HandleBumpClickAngle

Definition at line 1484 of file selinfo.cpp.

01485 {
01486     // If there's no selection then ignore the clicks.
01487     Spread* pUnitSpread = pSelectorTool->GetSelectionSpread();
01488     if (pUnitSpread == NULL) return;
01489 
01490     // Get the dimension units object for the spread containing the selection.
01491     DimScale* pDimScale = DimScale::GetPtrDimScale((Node*) pUnitSpread);
01492     ERROR3IF(pDimScale == NULL, "Null DimScale* in SelectorInfoBarOp::HandleBumpClick");
01493 
01494     // Read the edit field and convert to millipoints.
01495     BOOL fOk;
01496     INT32 nMilli;
01497     String_256 str = GetStringGadgetValue(nEditControlID, &fOk);
01498     if (!fOk || !pDimScale->ConvertToMillipoints( str, &nMilli ))
01499     {
01500         TRACEUSER( "JustinF", _T("Couldn't convert edit control\n") );
01501         return;
01502     }
01503 
01504     // Write the new value to the edit-field.
01505     SetEdit(nEditControlID, nMilli + (nSign * OpNudge::GetNudgeStep()), pUnitSpread, FALSE);
01506 
01507     // Set the input focus to the associated edit-field.  NB. we don't do this anymore
01508     // because Charles doesn't like it.
01509 //  SetKeyboardFocus(nEditControlID);
01510 //  HighlightText(nEditControlID);
01511 }

BOOL SelectorInfoBarOp::HandleButtonDown DialogMsg pDlgMsg  )  [private]
 

For the given button calls the appropriate functions that update the blob manager.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com> / Rik
Date:
12/7/94
Parameters:
A pointer to a "dialogue box" message about a button click. [INPUTS]
Returns:
TRUE if message handled and should be passd to the InformationBarOp, FALSE if not handled and should be passed toDialogBarOp (which doesn't eat messages and can properly invoked operations).
See also:
SelectorInfoBarOp::Message; SelectorInfoBarOp::UpdateBlobManager

Definition at line 1235 of file selinfo.cpp.

01236 {
01237     // Get ourselves an empty blob style (ie all entries set to FALSE)
01238     BlobStyle ChangingBlob;
01239 
01240     // Have a look at which button was pressed and deal with it
01241     // switch (pDlgMsg->GadgetID)
01242     
01243     // "Show Bounds Blobs"
01244     if (pDlgMsg->GadgetID == _R(IDC_SEL_SHOWBOUNDSBLOBS))
01245     {
01246         pSelectorTool->BoundsButtonChange();
01247     }
01248     // "Show Objects".
01249     else if (pDlgMsg->GadgetID == _R(IDC_SEL_SHOWOBJECTBLOBS))
01250     {   // We want to toggle the state of the Object blobs
01251         ChangingBlob.Object = TRUE;
01252     }
01253     // "Show Fills".
01254     else if (pDlgMsg->GadgetID == _R(IDC_SEL_SHOWFILLBLOBS))
01255     {   // We want to toggle the state of the Object blobs
01256         ChangingBlob.Fill = TRUE;
01257     }
01258     else if (pDlgMsg->GadgetID == _R(IDC_SEL_PADLOCK))
01259     {   // Toggle the state of the padlock button.
01260         fLockAspect = !fLockAspect;
01261     }
01262     // "Rotate mode".  Will immediately notify the tool, so it can display new blobs.
01263     else if (pDlgMsg->GadgetID == _R(IDC_SEL_ROTATEBUTTON))
01264     {
01265         pSelectorTool->RotateButtonChange(fRotateMode = !fRotateMode);
01266     }
01267     // "Scale lines when scaling an object".
01268     else if (pDlgMsg->GadgetID == _R(IDC_SEL_SCALELINES))
01269     {
01270         fScaleLines = !fScaleLines;
01271 
01272         // Because the "consider attributes" state (which affects the displayed width/height
01273         // of the selection) can be slaved off this button, we must also ensure that the
01274         // selector tool has cached and is displaying correct info.
01275         if (pSelectorTool)
01276             pSelectorTool->SelectionHasChanged();
01277     }
01278     // "Flip horizontally".
01279     else if (pDlgMsg->GadgetID == _R(IDC_SEL_FLIPHORZ))
01280     {
01281         pSelectorTool->FlipButtonChange(FALSE);
01282     }
01283     // "Flip vertically".
01284     else if (pDlgMsg->GadgetID == _R(IDC_SEL_FLIPVERT))
01285     {
01286         pSelectorTool->FlipButtonChange(TRUE);
01287     }
01288     // "Decrease X a bit".
01289     else if (pDlgMsg->GadgetID == _R(IDC_SEL_BUMP_X_LESS))
01290     {
01291         HandleBumpClickLinear(_R(IDC_SEL_EDIT_X), -1);
01292     }
01293     // "Increase X a bit".
01294     else if (pDlgMsg->GadgetID == _R(IDC_SEL_BUMP_X_MORE))
01295     {
01296         HandleBumpClickLinear(_R(IDC_SEL_EDIT_X), 1);
01297     }
01298     // "Decrease Y a bit".
01299     else if (pDlgMsg->GadgetID == _R(IDC_SEL_BUMP_Y_LESS))
01300     {
01301         HandleBumpClickLinear(_R(IDC_SEL_EDIT_Y), -1);
01302     }
01303     // "Increase Y a bit".
01304     else if (pDlgMsg->GadgetID == _R(IDC_SEL_BUMP_Y_MORE))
01305     {
01306         HandleBumpClickLinear(_R(IDC_SEL_EDIT_Y), 1);
01307     }
01308     // "Decrease W a bit".
01309     else if (pDlgMsg->GadgetID == _R(IDC_SEL_BUMP_W_LESS))
01310     {
01311         HandleBumpClickLinear(_R(IDC_SEL_EDIT_W), -1);
01312     }
01313     // "Increase W a bit".
01314     else if (pDlgMsg->GadgetID == _R(IDC_SEL_BUMP_W_MORE))
01315     {
01316         HandleBumpClickLinear(_R(IDC_SEL_EDIT_W), 1);
01317     }
01318     // "Decrease H a bit".
01319     else if (pDlgMsg->GadgetID == _R(IDC_SEL_BUMP_H_LESS))
01320     {
01321         HandleBumpClickLinear(_R(IDC_SEL_EDIT_H), -1);
01322     }
01323     // "Increase H a bit".
01324     else if (pDlgMsg->GadgetID == _R(IDC_SEL_BUMP_H_MORE))
01325     {
01326         HandleBumpClickLinear(_R(IDC_SEL_EDIT_H), 1);
01327     }
01328     // "Decrease angle a bit".
01329     else if (pDlgMsg->GadgetID == _R(IDC_SEL_BUMP_ANGLE_LESS))
01330     {
01331         HandleBumpClickAngle(_R(IDC_SEL_EDIT_ANGLE), -1, -360.0, +360.0);
01332     }
01333     // "Increase angle a bit".
01334     else if (pDlgMsg->GadgetID == _R(IDC_SEL_BUMP_ANGLE_MORE))
01335     {
01336         HandleBumpClickAngle(_R(IDC_SEL_EDIT_ANGLE), 1, -360.0, +360.0);
01337     }
01338     // "Decrease shear-angle a bit".
01339     else if (pDlgMsg->GadgetID == _R(IDC_SEL_BUMP_SHEAR_LESS))
01340     {
01341         HandleBumpClickAngle(_R(IDC_SEL_EDIT_SHEAR), -1, -89.0, +89.0);
01342     }
01343     // "Increase shear-angle a bit".
01344     else if (pDlgMsg->GadgetID == _R(IDC_SEL_BUMP_SHEAR_MORE))
01345     {       
01346         HandleBumpClickAngle(_R(IDC_SEL_EDIT_SHEAR), 1, -89.0, +89.0);
01347     }
01348     else if (pDlgMsg->GadgetID == _R(IDC_SEL_GRID_NW))
01349     {       
01350         pSelectorTool->SetRotateCentre(1);
01351     }
01352     else if (pDlgMsg->GadgetID == _R(IDC_SEL_GRID_N))
01353     {       
01354         pSelectorTool->SetRotateCentre(2);
01355     }
01356     else if (pDlgMsg->GadgetID == _R(IDC_SEL_GRID_NE))
01357     {       
01358         pSelectorTool->SetRotateCentre(3);
01359     }
01360     else if (pDlgMsg->GadgetID == _R(IDC_SEL_GRID_W))
01361     {       
01362         pSelectorTool->SetRotateCentre(4);
01363     }
01364     else if (pDlgMsg->GadgetID == _R(IDC_SEL_GRID_CENTRE))
01365     {       
01366         pSelectorTool->SetRotateCentre(0);
01367     }
01368     else if (pDlgMsg->GadgetID == _R(IDC_SEL_GRID_E))
01369     {       
01370         pSelectorTool->SetRotateCentre(5);
01371     }
01372     else if (pDlgMsg->GadgetID == _R(IDC_SEL_GRID_SW))
01373     {       
01374         pSelectorTool->SetRotateCentre(6);
01375     }
01376     else if (pDlgMsg->GadgetID == _R(IDC_SEL_GRID_S))
01377     {       
01378         pSelectorTool->SetRotateCentre(7);
01379     }
01380     else if (pDlgMsg->GadgetID == _R(IDC_SEL_GRID_SE))
01381     {       
01382         pSelectorTool->SetRotateCentre(8);
01383     }
01384     // Other gadgets, pass to _DialogBarOp_ base class which can properly invoke
01385     // ops attached to gadgets, unlike InformationBarOp which just eats everything.
01386     else
01387     {
01388     //  TRACEUSER( "JustinF", _T("SelectorInfoBarOp::HandleButtonDown: passing to DialogBarOp\n"));
01389         return FALSE;
01390     }
01391 
01392     // Ask the tool to deal with the blob manager as well as its tool blobs if needed.
01393     if (pSelectorTool != NULL) pSelectorTool->SelectionBlobChange(ChangingBlob);
01394     return TRUE;    // handled
01395 
01396 }

void SelectorInfoBarOp::HandleButtonUp DialogMsg pDlgMsg  )  [private]
 

For "nudge-buttons", responds to them being released by calling the HandleEditCommit function, ie. acting as if the user hit the ENTER key within an edit-field meaning that the program should act on any changes made. For all other buttons, does nothing.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
1/12/94
Parameters:
pDlgMsg pointer to a dialogue message from a button. [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 1416 of file selinfo.cpp.

01417 {
01418     if (
01419         (pDlgMsg->GadgetID == _R(IDC_SEL_BUMP_X_LESS)) ||
01420         (pDlgMsg->GadgetID == _R(IDC_SEL_BUMP_X_MORE)) ||
01421         (pDlgMsg->GadgetID == _R(IDC_SEL_BUMP_Y_LESS)) ||
01422         (pDlgMsg->GadgetID == _R(IDC_SEL_BUMP_Y_MORE)) ||
01423         (pDlgMsg->GadgetID == _R(IDC_SEL_BUMP_W_LESS)) ||
01424         (pDlgMsg->GadgetID == _R(IDC_SEL_BUMP_W_MORE)) ||
01425         (pDlgMsg->GadgetID == _R(IDC_SEL_BUMP_H_LESS)) ||
01426         (pDlgMsg->GadgetID == _R(IDC_SEL_BUMP_H_MORE)) ||
01427         (pDlgMsg->GadgetID == _R(IDC_SEL_BUMP_ANGLE_LESS)) ||
01428         (pDlgMsg->GadgetID == _R(IDC_SEL_BUMP_ANGLE_MORE)) ||
01429         (pDlgMsg->GadgetID == _R(IDC_SEL_BUMP_SHEAR_LESS)) ||
01430         (pDlgMsg->GadgetID == _R(IDC_SEL_BUMP_SHEAR_MORE))
01431         )
01432     {
01433         HandleEditCommit(NULL);
01434     }
01435     else if (
01436         (pDlgMsg->GadgetID == _R(IDC_SEL_GRID_NW)) ||
01437         (pDlgMsg->GadgetID == _R(IDC_SEL_GRID_N) ) ||
01438         (pDlgMsg->GadgetID == _R(IDC_SEL_GRID_NE)) ||
01439         (pDlgMsg->GadgetID == _R(IDC_SEL_GRID_W) ) ||
01440         (pDlgMsg->GadgetID == _R(IDC_SEL_GRID_CENTRE)) ||
01441         (pDlgMsg->GadgetID == _R(IDC_SEL_GRID_E)) ||
01442         (pDlgMsg->GadgetID == _R(IDC_SEL_GRID_SW)) ||
01443         (pDlgMsg->GadgetID == _R(IDC_SEL_GRID_S) ) ||
01444         (pDlgMsg->GadgetID == _R(IDC_SEL_GRID_SE))
01445         )
01446     {
01447         CGadgetID clicked = pDlgMsg->GadgetID;
01448         clicked = (CGadgetID)0; // Right now remove ALL selected ones to remove toggle functionality. 
01449         if (clicked != _R(IDC_SEL_GRID_NW) ) SetBoolGadgetSelected(_R(IDC_SEL_GRID_NW), FALSE);
01450         if (clicked != _R(IDC_SEL_GRID_N)  ) SetBoolGadgetSelected(_R(IDC_SEL_GRID_N),  FALSE);
01451         if (clicked != _R(IDC_SEL_GRID_NE) ) SetBoolGadgetSelected(_R(IDC_SEL_GRID_NE), FALSE);
01452         if (clicked != _R(IDC_SEL_GRID_W)  ) SetBoolGadgetSelected(_R(IDC_SEL_GRID_W),  FALSE);
01453         if (clicked != _R(IDC_SEL_GRID_CENTRE) ) SetBoolGadgetSelected(_R(IDC_SEL_GRID_CENTRE), FALSE);
01454         if (clicked != _R(IDC_SEL_GRID_E)  ) SetBoolGadgetSelected(_R(IDC_SEL_GRID_E) , FALSE);
01455         if (clicked != _R(IDC_SEL_GRID_SW) ) SetBoolGadgetSelected(_R(IDC_SEL_GRID_SW), FALSE);
01456         if (clicked != _R(IDC_SEL_GRID_S)  ) SetBoolGadgetSelected(_R(IDC_SEL_GRID_S) , FALSE);
01457         if (clicked != _R(IDC_SEL_GRID_SE) ) SetBoolGadgetSelected(_R(IDC_SEL_GRID_SE), FALSE);
01458     }
01459 
01460     return;
01461 }

void SelectorInfoBarOp::HandleCreate DialogMsg pDlgMsg  )  [private]
 

Sets the initial state of the controls in the info-bar.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
13/7/94
Parameters:
A pointer to the DIM_CREATE dialog message to handle (not used) [INPUTS]
See also:
SelectorInfoBarOp::Message

Definition at line 1179 of file selinfo.cpp.

01180 {
01181 //  TRACEUSER( "JustinF", _T("In SelectorInfoBarOp::HandleCreate\n"));
01182 
01183     // Get an empty list of the blob types.
01184     ENSURE(pSelectorTool != NULL, "No selector tool in SelectorInfoBarOp::HandleCreate");
01185     BlobStyle SelectorBlobs = pSelectorTool->GetBlobStyle();
01186     if (HasWindow())
01187     {
01188         // Set all the blob buttons in the info bar according to the information.
01189         SetLongGadgetValue(_R(IDC_SEL_SHOWBOUNDSBLOBS),  pSelectorTool->fShowToolBlobs, FALSE);
01190         SetLongGadgetValue(_R(IDC_SEL_SHOWOBJECTBLOBS),  SelectorBlobs.Object,          FALSE);
01191         SetLongGadgetValue(_R(IDC_SEL_SHOWFILLBLOBS),    SelectorBlobs.Fill,            FALSE);
01192 //      SetLongGadgetValue(_R(IDC_SEL_SHOWARTLINEBLOBS), SelectorBlobs.Artistic,        FALSE);
01193 
01194         // Set all the option buttons.
01195         SetLongGadgetValue(_R(IDC_SEL_ROTATEBUTTON),     fRotateMode,                   FALSE);
01196         SetLongGadgetValue(_R(IDC_SEL_SCALELINES),       fScaleLines,                   FALSE);
01197         SetLongGadgetValue(_R(IDC_SEL_PADLOCK),          fLockAspect,                   FALSE);
01198 //      SetLongGadgetValue(_R(IDC_SEL_LEAVECOPY),        fLeaveCopy,                    FALSE);
01199 //      SetLongGadgetValue(_R(IDC_SEL_TRANSFILL),        fTransFills,                   FALSE);
01200     }
01201     
01202     // Initialise the edit-field records.
01203     aerEdits[0].nControlID = _R(IDC_SEL_EDIT_X);
01204     aerEdits[1].nControlID = _R(IDC_SEL_EDIT_Y);
01205     aerEdits[2].nControlID = _R(IDC_SEL_EDIT_W);
01206     aerEdits[3].nControlID = _R(IDC_SEL_EDIT_H);
01207     aerEdits[4].nControlID = _R(IDC_SEL_EDIT_XSCALE);
01208     aerEdits[5].nControlID = _R(IDC_SEL_EDIT_YSCALE);
01209     aerEdits[6].nControlID = _R(IDC_SEL_EDIT_ANGLE);
01210     aerEdits[7].nControlID = _R(IDC_SEL_EDIT_SHEAR);
01211 
01212     // Now set the edit controls.
01213     SetEdit_OnSelectionChange();
01214 
01215     // Make sure their current values are recorded.
01216     UpdateAllRecords();
01217 }    

void SelectorInfoBarOp::HandleEditCommit DialogMsg pDlgMsg  )  [private]
 

Reads the text from the edit-fields, converts it to millipoints, informs the selector tool that the user has changed the selection's position and/or extent.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
31/8/94
Parameters:
pDlgMsg the "commit" dialogue message sent when the user hits ENTER [INPUTS] within an edit-field.
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-
Maybe fix innacurate scaling [Harrison Ainsworth 7/11/97]

Definition at line 1596 of file selinfo.cpp.

01597 {
01598     // If there's nothing selected then ignore the clicks.
01599     if (pSelectorTool->GetSelectionSpread() == NULL) return;
01600 
01601     // Ignore all but "hard-commits" in proper dialogue messages (not "faked" ones).
01602     if (pDlgMsg != NULL && ((SelChangeMsgSubType) pDlgMsg->DlgMsgParam) != ENTER_COMMIT)
01603         return;
01604 
01605 
01606     // Tell the selector tool to ignore selection change messages until further notice.
01607     pSelectorTool->fIgnoreSelChange = TRUE;
01608 
01609     // Compare the current contents of the edit-fields against their recorded values, to
01610     // see if any have been modified.
01611     BOOL fMustTransform = FALSE;
01612     for (INT32 i = 0; i < 8; i++)
01613     {
01614         if (HasChangedRecord(i))
01615         {
01616             UpdateRecord(&aerEdits[i]);
01617             fMustTransform = TRUE;
01618         }
01619     }
01620 
01621     // After checking and updating our records, do we have to run a transform?  Note that
01622     // we check these as they appear on the bar from left to right.
01623     UINT32 nErrorMsg=0;
01624     fConvertedOK = TRUE;
01625 
01626     if (fMustTransform)
01627     {
01628 
01629         TRACEUSER( "Matt", _T("HandleEditCommit()\n"));
01630         Range* Selection = GetApplication()->FindSelection();
01631         RangeControl TransFlags = Selection->GetRangeControlFlags();
01632         TransFlags.IgnoreNoneRenderable=TRUE;
01633         TransFlags.IgnoreInvisibleLayers = TRUE;
01634         Selection->SetRangeControl(TransFlags);
01635         SliceHelper::ModifySelectionToContainWholeButtonElements();
01636 
01637 
01638         if (aerEdits[0].fIsDirty || aerEdits[1].fIsDirty)
01639         {
01640             // X or Y has been changed - run a translate.
01641             INT32 x = ConvertMillipointRecord(0);
01642             INT32 y = ConvertMillipointRecord(1);
01643 
01644             // Convert the entered pages coordinates to spread-relative coordinates.
01645             Spread* pSpread = pSelectorTool->GetSelectionSpread();
01646             ERROR3IF(pSpread == NULL,"No selected Spread* in SelectorInfoBarOp::HandleEditCommit");
01647             DocCoord dc = UserCoord(x,y).ToSpread(pSpread);
01648 
01649             if (!fConvertedOK)
01650             {
01651                 nErrorMsg = _R(IDS_SEL_ERROR_XY);
01652                 goto AfterXform;
01653             }
01654 
01655             pSelectorTool->DoTranslateImmediate(dc.x, dc.y);
01656         }
01657 
01658         if (aerEdits[2].fIsDirty || aerEdits[3].fIsDirty)
01659         {
01660             // W or H has been changed - run a scale.
01661             INT32 w = ConvertMillipointRecord(2);
01662             INT32 h = ConvertMillipointRecord(3);
01663             if (!fConvertedOK || w == 0 || h == 0)
01664             {
01665                 fConvertedOK = FALSE;
01666                 nErrorMsg = _R(IDS_SEL_ERROR_WH);
01667                 goto AfterXform;
01668             }
01669             
01670             if (fLockAspect)
01671             {
01672                 // The aspect ratio is locked, which means we must scale either the width or
01673                 // height accordingly, whichever was not changed.  If both were changed then
01674                 // we have a little problem.
01675                 DocRect oldrect = pSelectorTool->GetSelectionBounds(DontConsiderAttrs());
01676                 if (!aerEdits[2].fIsDirty)
01677                 {
01678                     w = MulDiv32By32(oldrect.Width(), h, oldrect.Height());
01679                 }
01680                 else
01681                 {
01682                     h = MulDiv32By32(w, oldrect.Height(), oldrect.Width());
01683                 }
01684             }
01685 
01687 //          if( !DontConsiderAttrs()  &&  SelectorTool::fUseScalingFix )
01688 //              pSelectorTool->DoScaleImmediate(w, h, TRUE );   // special fix
01689 //          else
01690                 pSelectorTool->DoScaleImmediate(w, h);          // normal
01691         }
01692 
01693         if (aerEdits[4].fIsDirty || aerEdits[5].fIsDirty)
01694         {
01695             // X-scale or Y-scale has been changed - run a scale.
01696             double w = ConvertRecord(4);
01697             double h = ConvertRecord(5);
01698 
01699             // Ensure that the entered value is valid. Note that values near to zero are
01700             // actually illegal (they'd cause a divide by zero), but these are properly handled
01701             // by DoScalePercentImmediate, below.
01702             if (!fConvertedOK)
01703             {
01704                 fConvertedOK = FALSE;
01705                 nErrorMsg = _R(IDS_SEL_ERROR_XYSCALE);
01706                 goto AfterXform;
01707             }
01708 
01709             // Quietly limit the maximum scaling to 200 times (20,000%). This should allow more
01710             // than enough scaling, especially while our zoom limits are 26000%
01711             if (w > 19999.0)    w = 19999.0;
01712             if (w < -19999.0)   w = -19999.0;
01713             if (h > 19999.0)    h = 19999.0;
01714             if (h < -19999.0)   h = -19999.0;
01715 
01716             // Check for the "Lock Aspect" button.
01717             if (fLockAspect)
01718             {
01719                 // If only one edit has been changed then set the other to be equal.
01720                 if (!aerEdits[4].fIsDirty)
01721                 {
01722                     w = h;
01723                     SetDoubleEdit(_R(IDC_SEL_EDIT_XSCALE), w, FALSE);
01724                 }
01725                 else
01726                 {
01727                     // One or both have been changed but "lock aspect" is set, which presents a
01728                     // problem.  For now take the x-scale as overriding.
01729                     h = w;
01730                     SetDoubleEdit(_R(IDC_SEL_EDIT_YSCALE), h, FALSE);
01731                 }
01732             }
01733 
01734             pSelectorTool->DoScalePercentImmediate(w, h);
01735         }
01736 
01737         if (aerEdits[6].fIsDirty)
01738         {
01739             // Angle has been changed - run a rotate.
01740             double Angle = ConvertRecord(6);
01741             if (!fConvertedOK)
01742             {
01743                 nErrorMsg = _R(IDS_SEL_ERROR_ANGLE);
01744                 goto AfterXform;
01745             }
01746 
01747             // Ensure the angle is between -360 and +360. We use an integer modulus to get
01748             // the angle back under control.
01749             if (fabs(Angle) >= 360.0)
01750             {
01751                 // The angle is out of range, so we need to make it sensible
01752                 BOOL Negative = (Angle < 0.0);
01753 
01754                 Angle = ((INT32)floor(fabs(Angle))) % 360;
01755 
01756                 if (Negative)
01757                     Angle = -Angle;
01758             }
01759 
01760             pSelectorTool->DoRotateImmediate((FIXED16) Angle);
01761         }
01762 
01763         if (aerEdits[7].fIsDirty)
01764         {
01765             // Shear-angle has been changed - run a shear.
01766             double Angle = ConvertRecord(7);
01767             if (!fConvertedOK)
01768             {
01769                 nErrorMsg = _R(IDS_SEL_ERROR_SHEAR);
01770                 goto AfterXform;
01771             }
01772 
01773             // Clip the angle to lie between +/- 89.0 degrees
01774             if (fabs(Angle) > 89.0)
01775                 Angle = (Angle < 0.0) ? -89.0 : 89.0;
01776 
01777             pSelectorTool->DoShearImmediate((FIXED16) Angle);
01778         }
01779 
01780         SliceHelper::RestoreSelection();
01781     }
01782 
01783 AfterXform:
01784     // Check if we got here because an edit conversion failed.
01785     if (!fConvertedOK) ReportEditError(nErrorMsg);
01786 
01787     // Reset the selection-change handler flag.  If we ran a transform then manually
01788     // update the selection.
01789     pSelectorTool->fIgnoreSelChange = FALSE;
01790 
01791     if (fMustTransform && fConvertedOK)
01792     {
01793         pSelectorTool->SelectionHasChanged();
01794     }
01795 }

void SelectorInfoBarOp::HandleGridButton DialogMsg pDlgMsg  )  [private]
 

Responds to a click on the "telephone keypad", passing the event on to the selector tool.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/11/94
Parameters:
pDlgMsg pointer to a dialogue message. [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
SelectorTool::SetRotateCentre

Definition at line 1840 of file selinfo.cpp.

01841 {
01842     pSelectorTool->SetRotateCentre((INT32) pDlgMsg->DlgMsgParam);
01843 }

BOOL SelectorInfoBarOp::HasChangedRecord INT32  i  )  [private]
 

Reports on whether the given edit-control has new info in it.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/11/94
Parameters:
i 0 - 7, identifying which edit-control to report on. [INPUTS]
- [OUTPUTS]
Returns:
TRUE if edit-control [i] has been changed recently by the user

Errors: -

See also:
-

Definition at line 647 of file selinfo.cpp.

00648 {
00649     // Copy the text in the edit field.
00650     SelEditRecord* per = &aerEdits[i];
00651