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     BOOL fOk;
00652     String_256 str;
00653     if(HasWindow())
00654         str = GetStringGadgetValue(per->nControlID, &fOk);
00655     else
00656         fOk = FALSE;
00657 
00658     if (!fOk)
00659     {
00660         TRACEUSER( "JustinF", _T("Couldn't test edit-field %u\n"), per->nControlID );
00661         return per->fIsDirty = FALSE;
00662     }
00663 
00664     // Compare the existing text with the old record.
00665     return per->fIsDirty = (str != per->strText);
00666 }

BOOL SelectorInfoBarOp::InRotateMode  )  const
 

Checks the state of the "Rotate/Bounds blobs" button.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
31/8/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if the "Rotate/Bounds blobs" button is down.

Errors: -

See also:
-

Definition at line 310 of file selinfo.cpp.

00311 {
00312     return fRotateMode;
00313 }

BOOL SelectorInfoBarOp::IsAspectLocked  )  const
 

Enquires of the state of the "Lock Aspect Ratio" button.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
31/8/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if the "Lock Aspect Ratio" button is down.

Errors: -

See also:
-

Definition at line 290 of file selinfo.cpp.

00291 {
00292     return fLockAspect;
00293 }

MsgResult SelectorInfoBarOp::Message Msg pMessage  )  [protected, virtual]
 

Takes a look at the message and if it is for for selector tool info-bar then respond to it.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/7/94
Parameters:
pMessage - A pointer to a dialog message. [INPUTS]
Returns:
The result of the message.

Errors: -

See also:
SelectorInfoBarOp::HandleCreate; SelectorInfoBarOp::HandleButtonDown; SelectorInfoBarOp::HandleSelChange; SelectorTool::SelectionHasChanged

Reimplemented from InformationBarOp.

Definition at line 181 of file selinfo.cpp.

00182 {
00183     // If we aren't the current tool then pass to the base class.
00184     if (((SelectorTool*) Tool::GetCurrent()) != pSelectorTool /* || !HasWindow() */)
00185     {
00186         return InformationBarOp::Message(pMessage);
00187     }
00188 
00189     // Does this message mean that the selected object has changed, or its attributes (bounds)?
00190     if (pMessage->IsKindOf(CC_RUNTIME_CLASS(SelChangingMsg)))
00191     {   
00192         if (pSelectorTool != NULL)
00193         {
00194             switch (((SelChangingMsg*) pMessage)->State)
00195             {
00196             case SelChangingMsg::SELECTIONCHANGED:
00197                 if (!pSelectorTool->fIgnoreSelChange) pSelectorTool->SelectionHasChanged();
00198                 break;
00199             
00200             case SelChangingMsg::NONCOLOURATTCHANGED:
00201                 pSelectorTool->AttributeHasChanged();
00202                 break;
00203             
00204             default:
00205                 break;
00206             }
00207         }
00208     }
00209 
00210     // How about a view changing message?
00211     else if (MESSAGE_IS_A(pMessage, DocViewMsg))
00212     {
00213         // Yes, tell the selector tool to sort its blobs out.
00214         if (pSelectorTool != NULL)
00215         {
00216             pSelectorTool->ViewChanged(*((DocViewMsg*) pMessage));
00217         }
00218     }
00219 
00220     // Or an options-changing message?
00221     else if (MESSAGE_IS_A(pMessage, OptionsChangingMsg))
00222     {
00223         // Yes, so force the edit-fields to reconvert themselves to the new settings.
00224         TRACEUSER( "JustinF", _T("Updating on options-change in selector tool info-bar\n"));
00225         SetEdit_OnSelectionChange();
00226     }
00227 
00228     // Otherwise, is this a dialog message for us?
00229     else if (IS_OUR_DIALOG_MSG(pMessage))
00230     {
00231         // Yes.  Act on the dialog message.
00232         DialogMsg* pDlgMsg = (DialogMsg*) pMessage;
00233         switch (pDlgMsg->DlgMsg)
00234         {           
00235             // Initialise the bar's controls.
00236             case DIM_CREATE:
00237                 HandleCreate(pDlgMsg);
00238                 break;
00239                 
00240             // "Close" the bar.
00241             case DIM_CANCEL:
00242                 SelectorTool::UnCacheInfoBar(TRUE);
00243                 break;
00244 
00245             // Handle a button being clicked.
00246             case DIM_LFT_BN_CLICKED:
00247                 if (!HandleButtonDown(pDlgMsg)) return DialogBarOp::Message(pMessage);
00248                 break;
00249 
00250             // Handle a button being released.
00251             case DIM_LFT_BN_UP:
00252                 HandleButtonUp(pDlgMsg);
00253                 break;
00254 
00255             // Handle ENTER being typed in an edit field.
00256             case DIM_SELECTION_CHANGED:
00257                 HandleEditCommit(pDlgMsg);
00258                 break;
00259 
00260             // Handle a "telephone keypad" button message.
00261             case DIM_GRID_BUTTON_DOWN:
00262                 HandleGridButton(pDlgMsg);
00263                 break;
00264 
00265             // Some other message irrelevant to us.
00266             default:
00267                 break;
00268         }
00269     }
00270 
00271     // Pass message on to base class.
00272     return InformationBarOp::Message(pMessage); 
00273 }

void SelectorInfoBarOp::PaintAllEditsNow  ) 
 

Forces an immediate repaint of any edit field that has had its contents changed.

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

Errors: -

See also:
-

Definition at line 965 of file selinfo.cpp.

00966 {
00967     if (!HasWindow()) return;
00968     PaintGadgetNow(_R(IDC_SEL_EDIT_X));
00969     PaintGadgetNow(_R(IDC_SEL_EDIT_Y));
00970     PaintGadgetNow(_R(IDC_SEL_EDIT_W));
00971     PaintGadgetNow(_R(IDC_SEL_EDIT_H));
00972     PaintGadgetNow(_R(IDC_SEL_EDIT_XSCALE));
00973     PaintGadgetNow(_R(IDC_SEL_EDIT_YSCALE));
00974     PaintGadgetNow(_R(IDC_SEL_EDIT_ANGLE));
00975     PaintGadgetNow(_R(IDC_SEL_EDIT_SHEAR));
00976 }

void SelectorInfoBarOp::ReportEditError UINT32  nErrorMsgID  ) 
 

Reports errors the user makes when typing in the selector tool-bar edit fields.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/2/95
Parameters:
nErrorMsgID the string resource ID of the error message to [INPUTS] display in the error dialogue.
- [OUTPUTS]
Returns:
-

Errors: -

See also:
SelectorInfoBarOp::HandleEditCommit

Definition at line 1815 of file selinfo.cpp.

01816 {
01817     // Report the error with a message box.
01818     ToolInformError(TOOLID_SELECTOR, nErrorMsgID);
01819 
01820     // Reset the edit fields to correct values.
01821     SetEdit_OnSelectionChange();
01822 }

void SelectorInfoBarOp::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.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
31/8/94
Parameters:
fState the new state of the "Lock Aspect Ratio" button (TRUE = down) [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 424 of file selinfo.cpp.

00425 {
00426     if(HasWindow())
00427         SetLongGadgetValue(_R(IDC_SEL_PADLOCK), (fLockAspect = fState), FALSE);
00428 }

void SelectorInfoBarOp::SetDoubleEdit CGadgetID  gid,
double  nValue,
BOOL  fUpdate = TRUE
 

Converts the given double value to text and writes in into the edit-field.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/2/95
Parameters:
gid gadget identifier [INPUTS] nValue the value to set in the edit field (INT32 integer) fUpdate update the internal records of the field's contents if TRUE (the default).
- [OUTPUTS]
Returns:
-

Errors: -

See also:
SelectorInfoBarOp::SetEdit; SelectorInfoBarOp::SetEdit_OnDrag; SelectorInfoBarOp::SetEdit_OnSelectionChange

Definition at line 806 of file selinfo.cpp.

00807 {
00808     // No unit conversion necessary, just convert to text.
00809     if (HasWindow()) SetDoubleGadgetValue(gid, nValue);
00810 
00811     // Grab the text for our records, if required.
00812     if (fUpdate) UpdateRecord((UINT32) gid);
00813 }

void SelectorInfoBarOp::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.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/9/94
Parameters:
gid the edit-field gadget (control) identifier that is to be set [INPUTS] fxValue the fixed-point value to set in the field pUnitSpread the spread that is used for unit conversions. If null then no unit conversion will occur (CURRENTLY NOT SUPPORTED).
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 837 of file selinfo.cpp.

00839 {
00840 /*  if (pUnitSpread != NULL && IsUserName("JustinF"))
00841     {
00842         TRACE( _T("Warning - non-null pUnitSpread in SelectorInfoBarOp::SetEdit\n"));
00843     }
00844 */
00845     String str;
00846     fxValue.ToString(&str);
00847     if (HasWindow()) SetStringGadgetValue(gid, str, FALSE);
00848     if (fUpdate) UpdateRecord((UINT32) gid);
00849 }

void SelectorInfoBarOp::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.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
31/8/94
Parameters:
gid gadget identifier [INPUTS] nValue the value to set in the edit field (INT32 integer) pUnitSpread the spread containing the object (so its units can be extracted). If this parameter is NULL then no unit conversion is performed. fUpdate update the internal records of the field's contents if TRUE (the default).
- [OUTPUTS]
Returns:
-

Errors: -

See also:
SelectorInfoBarOp::SetEdit_OnDrag; SelectorInfoBarOp::SetEdit_OnSelectionChange

Definition at line 762 of file selinfo.cpp.

00763 {
00764     if (pUnitSpread != NULL)
00765     {
00766         // Get the dimension scaling object (units) associated with the given spread
00767         // and convert to its units.
00768         DimScale* pDimScale = DimScale::GetPtrDimScale((Node*) pUnitSpread);
00769         ENSURE(pDimScale != NULL, "Null DimScale* in SelectorInfoBarOp::SetEdit");
00770     
00771         // Convert to units & text and display.
00772         String_256 str;
00773         pDimScale->ConvertToUnits((INT32) nValue, &str);
00774         if (HasWindow()) SetStringGadgetValue(gid, str);
00775     }
00776     else
00777     {
00778         // No unit conversion necessary, just convert to text.
00779         if (HasWindow()) SetLongGadgetValue(gid, nValue);
00780     }     
00781 
00782     // Grab the text for our records, if required.
00783     if (fUpdate) UpdateRecord((UINT32) gid);
00784 }

void SelectorInfoBarOp::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.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
31/8/94
Parameters:
pData pointer to the "callback" data generated by mouse-drags, [INPUTS] containing a description of the dragged object's extent etc.
- [OUTPUTS]
Returns:
-

Errors: -

See also:
SelectorTool::DragMove

Definition at line 1085 of file selinfo.cpp.

01086 {
01087     // Make sure the info-bar hasn't been hidden.
01088     if (!HasWindow()) return;
01089     
01090     if (pData->XYChanged)
01091     {
01092         // Convert the spread coords to user coords, and update gadgets
01093         UserCoord UserPos = DocCoord(pData->x, pData->y).ToUser(pSpread);
01094         SetEdit(_R(IDC_SEL_EDIT_X), UserPos.x, pSpread);
01095         SetEdit(_R(IDC_SEL_EDIT_Y), UserPos.y, pSpread);
01096         PaintGadgetNow(_R(IDC_SEL_EDIT_X));
01097         PaintGadgetNow(_R(IDC_SEL_EDIT_Y));
01098         pData->XYChanged = FALSE;
01099     }
01100 
01101     if (pData->WHChanged)
01102     {
01103         SetEdit(_R(IDC_SEL_EDIT_W), pData->Width, pSpread);
01104         SetEdit(_R(IDC_SEL_EDIT_H), pData->Height, pSpread);
01105         PaintGadgetNow(_R(IDC_SEL_EDIT_W));
01106         PaintGadgetNow(_R(IDC_SEL_EDIT_H));
01107         pData->WHChanged = FALSE;
01108     }
01109 
01110     if (pData->ScaleChanged)
01111     {
01112         // Take the absolute value and round to the nearest percent.
01113         FIXED16 xfx = (pData->XScale < 0) ? -pData->XScale : pData->XScale;
01114         FIXED16 yfx = (pData->YScale < 0) ? -pData->YScale : pData->YScale;
01115         INT32 xs = (xfx * 100 + FIXED16(0.5)).MakeLong();
01116         INT32 ys = (yfx * 100 + FIXED16(0.5)).MakeLong();
01117         SetEdit(_R(IDC_SEL_EDIT_XSCALE), xs, NULL);
01118         SetEdit(_R(IDC_SEL_EDIT_YSCALE), ys, NULL);
01119         PaintGadgetNow(_R(IDC_SEL_EDIT_XSCALE));
01120         PaintGadgetNow(_R(IDC_SEL_EDIT_YSCALE));
01121         pData->ScaleChanged = FALSE;
01122     }
01123 
01124     if (pData->RotateChanged)
01125     {
01126         SetEdit(_R(IDC_SEL_EDIT_ANGLE), pData->Rotation, pSpread);
01127         PaintGadgetNow(_R(IDC_SEL_EDIT_ANGLE));
01128         pData->RotateChanged = FALSE;
01129     }
01130 
01131     if (pData->ShearChanged)
01132     {
01133         double ShearAngle = pData->Shear.MakeDouble();
01134 
01135         // First we muct ensure that the displayed angle is in the -90..+90 range -
01136         // The angles coming in will either be centered around 0 or 180 degrees.
01137         // We therefore move them all to the 0 origin, so that they are displayed correctly
01138         if (ShearAngle >= 90.0)
01139             ShearAngle = -180.0 + ShearAngle;
01140 
01141         if (ShearAngle <= -90.0)
01142             ShearAngle = 180.0 + ShearAngle;
01143 
01144         // And ensure they lie in a sensible range
01145         if (ShearAngle < -89.0)
01146             ShearAngle = -89.0;
01147 
01148         if (ShearAngle > 89.0)
01149             ShearAngle = 89.0;
01150 
01151         SetEdit(_R(IDC_SEL_EDIT_SHEAR), (ANGLE) ShearAngle, pSpread);
01152         PaintGadgetNow(_R(IDC_SEL_EDIT_SHEAR));
01153         pData->ShearChanged = FALSE;
01154     }
01155 
01156     if (pData->ScaleLinesChanged)
01157     {
01158         SetScaleLines(pData->ScaleLines);
01159         PaintGadgetNow(_R(IDC_SEL_SCALELINES));
01160         pData->ScaleLinesChanged = FALSE;
01161     }
01162 
01163     // Make sure all changes are immediately visible.
01164 //  PaintAllEditsNow();
01165 }

void SelectorInfoBarOp::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.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
31/8/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-
Now also greys/ungreys info-bar buttons, as appropriate.
Returns:
Errors: -
See also:
-

Definition at line 999 of file selinfo.cpp.

01000 {
01001     if (!HasWindow())
01002     {
01003 //      TRACEUSER( "JustinF", _T("Tried to set edits on selection change but they don't exist?!?\n"));
01004         return;
01005     }
01006 
01007     Spread* pSpread = pSelectorTool->GetSelectionSpread();
01008     if (pSpread != NULL)
01009     {
01010         // Get extent of new selection in user coords, and Update all the numeric gadgets.
01011         DocRect  DRSelExtent = pSelectorTool->GetSelectionBounds(DontConsiderAttrs());
01012         UserRect   SelExtent = DRSelExtent.ToUser(pSpread);
01013         SetEdit(_R(IDC_SEL_EDIT_X), SelExtent.lo.x, pSpread);
01014         SetEdit(_R(IDC_SEL_EDIT_Y), SelExtent.lo.y, pSpread);
01015         SetEdit(_R(IDC_SEL_EDIT_W), SelExtent.Width(), pSpread);
01016         SetEdit(_R(IDC_SEL_EDIT_H), SelExtent.Height(), pSpread);
01017         SetEdit(_R(IDC_SEL_EDIT_XSCALE), (FIXED16) 100, NULL);
01018         SetEdit(_R(IDC_SEL_EDIT_YSCALE), (FIXED16) 100, NULL);
01019         SetEdit(_R(IDC_SEL_EDIT_ANGLE), (FIXED16) 0, NULL);
01020         SetEdit(_R(IDC_SEL_EDIT_SHEAR), (FIXED16) 0, NULL);
01021 
01022         // Ungrey the buttons that are now available.
01023         EnableGadget(_R(IDC_SEL_BUMP_X_LESS), TRUE);
01024         EnableGadget(_R(IDC_SEL_BUMP_X_MORE), TRUE);
01025         EnableGadget(_R(IDC_SEL_BUMP_Y_LESS), TRUE);
01026         EnableGadget(_R(IDC_SEL_BUMP_Y_MORE), TRUE);
01027         EnableGadget(_R(IDC_SEL_BUMP_W_LESS), TRUE);
01028         EnableGadget(_R(IDC_SEL_BUMP_W_MORE), TRUE);
01029         EnableGadget(_R(IDC_SEL_BUMP_H_LESS), TRUE);
01030         EnableGadget(_R(IDC_SEL_BUMP_H_MORE), TRUE);
01031         EnableGadget(_R(IDC_SEL_BUMP_ANGLE_LESS), TRUE);
01032         EnableGadget(_R(IDC_SEL_BUMP_ANGLE_MORE), TRUE);
01033         EnableGadget(_R(IDC_SEL_BUMP_SHEAR_LESS), TRUE);
01034         EnableGadget(_R(IDC_SEL_BUMP_SHEAR_MORE), TRUE);
01035         EnableGadget(_R(IDC_SEL_FLIPHORZ), TRUE);
01036         EnableGadget(_R(IDC_SEL_FLIPVERT), TRUE);
01037 //      EnableGadget(_R(IDC_SEL_ROTATE_GRID), TRUE);
01038         EnableGrid(TRUE);
01039 
01040         // Reenable the edit-controls.
01041         EnableAllEdits(TRUE);
01042     }
01043     else
01044     {
01045         // Disable all the edit-controls and blank them.
01046         EnableAllEdits(FALSE);
01047 
01048         // Grey the buttons that are now unavailable.
01049         EnableGadget(_R(IDC_SEL_BUMP_X_LESS), FALSE);
01050         EnableGadget(_R(IDC_SEL_BUMP_X_MORE), FALSE);
01051         EnableGadget(_R(IDC_SEL_BUMP_Y_LESS), FALSE);
01052         EnableGadget(_R(IDC_SEL_BUMP_Y_MORE), FALSE);
01053         EnableGadget(_R(IDC_SEL_BUMP_W_LESS), FALSE);
01054         EnableGadget(_R(IDC_SEL_BUMP_W_MORE), FALSE);
01055         EnableGadget(_R(IDC_SEL_BUMP_H_LESS), FALSE);
01056         EnableGadget(_R(IDC_SEL_BUMP_H_MORE), FALSE);
01057         EnableGadget(_R(IDC_SEL_BUMP_ANGLE_LESS), FALSE);
01058         EnableGadget(_R(IDC_SEL_BUMP_ANGLE_MORE), FALSE);
01059         EnableGadget(_R(IDC_SEL_BUMP_SHEAR_LESS), FALSE);
01060         EnableGadget(_R(IDC_SEL_BUMP_SHEAR_MORE), FALSE);
01061         EnableGadget(_R(IDC_SEL_FLIPHORZ), FALSE);
01062         EnableGadget(_R(IDC_SEL_FLIPVERT), FALSE);
01063 //      EnableGadget(_R(IDC_SEL_ROTATE_GRID), FALSE);
01064         EnableGrid(FALSE);
01065     }
01066 }

void SelectorInfoBarOp::SetRotateMode BOOL  fState  ) 
 

Sets the state of the "Rotate/Bounds blobs" button.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
31/8/94
Parameters:
fState TRUE if the button should be down [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 445 of file selinfo.cpp.

00446 {
00447     fRotateMode = fState;
00448     if (HasWindow()) SetLongGadgetValue(_R(IDC_SEL_ROTATEBUTTON), fState, FALSE);
00449 }

void SelectorInfoBarOp::SetScaleLines BOOL  fState  ) 
 

Sets the state of the "Leave Copy" button. Sets the state of the "Scale Lines" button.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
31/8/94
Parameters:
fState TRUE if the button should be down [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 487 of file selinfo.cpp.

00488 {
00489     if (HasWindow())
00490     {
00491         SetLongGadgetValue(_R(IDC_SEL_SCALELINES), (fScaleLines = fState), FALSE);
00492 
00493         // Make sure that the selector tool is displaying the correct information for
00494         // the new button state (which can affect the displayed size of the selection)
00495         if (pSelectorTool)
00496             pSelectorTool->SelectionHasChanged();
00497     }
00498 
00499 }

BOOL SelectorInfoBarOp::ShouldScaleLines  )  const
 

Checks the state of the "Leave Copy" button. Checks the state of the "Scale Lines" button.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
31/8/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if the "Scale Lines" button is down.

Errors: -

See also:
-

Definition at line 350 of file selinfo.cpp.

00351 {
00352     return fScaleLines;
00353 }

void SelectorInfoBarOp::UpdateAllRecords  ) 
 

Updates internal records of all edit-controls.

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

Errors: -

See also:
-

Definition at line 624 of file selinfo.cpp.

00625 {
00626     for (SelEditRecord* per = aerEdits; per < &aerEdits[8]; per++)
00627     {
00628         UpdateRecord(per);
00629     }
00630 }

void SelectorInfoBarOp::UpdateRecord UINT32  nControlID  )  [private]
 

Updates internal records of the given edit-control.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/11/94
Parameters:
nControlID resource ID the edit-control [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 604 of file selinfo.cpp.

00605 {
00606     UpdateRecord(GetRecord(nControlID));
00607 }

void SelectorInfoBarOp::UpdateRecord SelEditRecord per  )  [private]
 

Called when an edit-field is initialised or changed by the user.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
4/11/94
Parameters:
pefr --- pointer to the edit-field record to be updated [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 567 of file selinfo.cpp.

00568 {
00569     if (per)
00570     {
00571         // Copy the text in the edit field.
00572         BOOL fOk = TRUE;
00573         if (HasWindow())
00574         {
00575             per->strText = GetStringGadgetValue(per->nControlID, &fOk);
00576             if (!fOk)
00577             {
00578                 TRACEUSER( "JustinF", _T("Couldn't update edit-field %u\n"), per->nControlID);
00579                 per->strText = TEXT("");
00580             }
00581         }
00582         else
00583         {
00584             per->strText = TEXT("");
00585         }
00586     }
00587 }


Friends And Related Function Documentation

void SelectorTool::FigureUserFeedback Spread pSpread,
DocCoord  dcPos,
ClickModifiers  cmods,
BOOL  DoSlowTests,
String_256 pStr,
Cursor **  ppPointerShape
[friend]
 

void SelectorTool::HandleButtonUp  )  [friend]
 

BOOL SelectorTool::OnKeyPress KeyPress  )  [friend]
 

BOOL SelectorTool::ReadPrefs  )  [friend]
 

void SelectorTool::SelectChange BOOL   )  [friend]
 


Member Data Documentation

SelEditRecord SelectorInfoBarOp::aerEdits[8] [private]
 

Definition at line 224 of file selinfo.h.

BOOL SelectorInfoBarOp::fConvertedOK [private]
 

Definition at line 225 of file selinfo.h.

BOOL SelectorInfoBarOp::fLockAspect = TRUE [static, private]
 

Definition at line 229 of file selinfo.h.

BOOL SelectorInfoBarOp::fRotateMode = FALSE [static, private]
 

Definition at line 230 of file selinfo.h.

BOOL SelectorInfoBarOp::fScaleLines = TRUE [static, private]
 

Definition at line 231 of file selinfo.h.

SelectorTool* SelectorInfoBarOp::pSelectorTool
 

Definition at line 136 of file selinfo.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 04:00:46 2007 for Camelot by  doxygen 1.4.4