NativePrefsDlg Class Reference

#include <xarprefs.h>

Inheritance diagram for NativePrefsDlg:

DialogOp Operation MessageHandler ListItem CCObject SimpleCCObject WebPrefsDlg List of all members.

Public Member Functions

 NativePrefsDlg ()
 NativePrefsDlg constructor. Creates a non-undoable operation.
 ~NativePrefsDlg ()
 NativePrefsDlg destructor.
void DoWithParam (OpDescriptor *, OpParam *Param)
 Creates then opens the dialog in response to a request from the user and allows values to be passed in and returned to the caller via the WebPrefsDlgParam class.
void Do (OpDescriptor *)
 Creates then opens the dialog in response to a request from the user.
BOOL Create ()
 NativePrefsDlg create method.
virtual MsgResult Message (Msg *Message)
 Handles all the web preferences dialog's messages.

Static Public Member Functions

static BOOL Init ()
 NativePrefsDlg Init method.
static OpState GetState (String_256 *, OpDescriptor *)
 NativePrefsDlg GetState method.

Protected Member Functions

 NativePrefsDlg (CDlgResID IDD)
 NativePrefsDlg constructor. Creates a non-undoable operation.
SelectionType GetExportSelection (UINT32 ControlID)
 Works out what the current export selection state is.
virtual BOOL CommitDialogValues ()
 Takes the values in the dialog box and sets the return values accordingly Called when ok is pressed on the dialog box.
virtual BOOL InitDialog ()
 Sets initial dialog values.

Protected Attributes

WebPrefsDlgParammpParams

Detailed Description

Definition at line 126 of file xarprefs.h.


Constructor & Destructor Documentation

NativePrefsDlg::NativePrefsDlg  ) 
 

NativePrefsDlg constructor. Creates a non-undoable operation.

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

Errors: -

See also:
-

Definition at line 156 of file xarprefs.cpp.

00156                                 : DialogOp ( NativeID, MODAL )
00157 {
00158     // The base class does all the work.
00159 }

NativePrefsDlg::~NativePrefsDlg  ) 
 

NativePrefsDlg destructor.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/03/2006
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 176 of file xarprefs.cpp.

00177 {
00178     // The base class does all the work.
00179 }

NativePrefsDlg::NativePrefsDlg CDlgResID  IDD  )  [protected]
 

NativePrefsDlg constructor. Creates a non-undoable operation.

Author:
Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/10/00
Parameters:
IDD - The ID of the dialogue being created. [INPUTS]

Definition at line 192 of file xarprefs.cpp.

00192                                                : DialogOp ( IDD, MODAL )
00193 {
00194     // The base class does all the work.
00195 }


Member Function Documentation

BOOL NativePrefsDlg::CommitDialogValues void   )  [protected, virtual]
 

Takes the values in the dialog box and sets the return values accordingly Called when ok is pressed on the dialog box.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
1/5/96
Parameters:
pointer to the dialogue box [INPUTS]
- [OUTPUTS]
Returns:
True if values in dialog box ok, False otherwise.

Errors: -

See also:
NativePrefsDlg::CommitDialogValues;

Reimplemented in WebPrefsDlg.

Definition at line 458 of file xarprefs.cpp.

00459 {
00460     ERROR2IF(mpParams == NULL, FALSE, "NativePrefsDlg::CommitDialogValues called after duff initialisation?!");
00461 
00462     // What export selection has been made?
00463     mpParams->SetExportSel ( GetExportSelection ( _R(IDC_NATIVEOPTS_DRAWING) ) );  
00464 
00465     return TRUE;
00466 }

BOOL NativePrefsDlg::Create void   )  [virtual]
 

NativePrefsDlg create method.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
1/5/96
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if successful, else FALSE

Errors: -

See also:
-

Reimplemented from DialogOp.

Reimplemented in WebPrefsDlg.

Definition at line 303 of file xarprefs.cpp.

00304 {                     
00305     // Pass the responsibility to the baseclass.
00306     return DialogOp::Create ();
00307 }

void NativePrefsDlg::Do OpDescriptor  )  [virtual]
 

Creates then opens the dialog in response to a request from the user.

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

Errors: -

See also:
-

Reimplemented from Operation.

Definition at line 240 of file xarprefs.cpp.

00241 {
00242     BOOL ok;
00243     
00244     // Force the dialog box to be created, as it is modal it will be opened via a message
00245     ok = Create();
00246 
00247     if ( !ok )
00248     {
00249         // Could not create the dialog box so call inform error 
00250         InformError();
00251         End();         // End the operation 
00252     }
00253 }

void NativePrefsDlg::DoWithParam OpDescriptor ,
OpParam Param
[virtual]
 

Creates then opens the dialog in response to a request from the user and allows values to be passed in and returned to the caller via the WebPrefsDlgParam class.

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

Errors: -

See also:
-

Reimplemented from Operation.

Definition at line 214 of file xarprefs.cpp.

00215 {
00216     ERROR3IF(Param == NULL, "NativePrefsDlg::DoWithParam - NULL Param passed in");
00217 
00218     // Use the OpParam that has been passed in to us
00219     mpParams = (WebPrefsDlgParam *) Param;
00220 
00221     // Call the Do function to finish the job off.
00222     Do ( NULL );
00223 }

SelectionType NativePrefsDlg::GetExportSelection UINT32  ControlID  )  [protected]
 

Works out what the current export selection state is.

Author:
Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/10/00
Parameters:
ControlID - The ID number of the control being examined. [INPUTS]
Returns:
SelectionType - (DRAWING or SELECTION) Whether to export the entire drawing, or just the selected parts.

Definition at line 426 of file xarprefs.cpp.

00427 {
00428     // If the dialogue box has had the "Drawing" selection chosen, this function will
00429     // return TRUE, which, in turn, will cause this method to return DRAWING.
00430     BOOL IsValid = FALSE;
00431 
00432     if ( GetLongGadgetValue ( ControlID, 0, 1, 0, &IsValid ) )
00433     {
00434         return DRAWING;
00435     }
00436     else
00437     {
00438         return SELECTION;
00439     }
00440 }   

OpState NativePrefsDlg::GetState String_256 ,
OpDescriptor
[static]
 

NativePrefsDlg GetState method.

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

Errors: -

See also:
-

Definition at line 324 of file xarprefs.cpp.

00325 {    
00326     OpState OpSt;
00327     return(OpSt);
00328 }

BOOL NativePrefsDlg::Init void   )  [static]
 

NativePrefsDlg Init method.

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

Errors: -

See also:
-

Reimplemented from SimpleCCObject.

Reimplemented in WebPrefsDlg.

Definition at line 269 of file xarprefs.cpp.

00270 {
00271     BOOL InitOK;
00272 
00273     InitOK = RegisterOpDescriptor(
00274                                 0,                  /* Tool ID */
00275                                 _R(IDS_NATIVEPREFSDLG),
00276                                 CC_RUNTIME_CLASS ( NativePrefsDlg ),
00277                                 OPTOKEN_NATIVEPREFSDLG,
00278                                 GetState,
00279                                 0,                  /* help ID */
00280                                 0,                  /* bubble help */
00281                                 0,                  /* resource ID */
00282                                 0                   /* control ID */
00283                                 );
00284 
00285     return (InitOK);
00286 }

BOOL NativePrefsDlg::InitDialog void   )  [protected, virtual]
 

Sets initial dialog values.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
1/5/96
Parameters:
pointer to the dialog box [INPUTS]
- [OUTPUTS]
Returns:
TRUE if successful, else FALSE

Errors: -

See also:
-

Reimplemented in WebPrefsDlg.

Definition at line 483 of file xarprefs.cpp.

00484 {
00485     ERROR2IF ( mpParams == NULL, FALSE,
00486                "NativePrefsDlg::InitDialog called after duff initialisation?!" );
00487 
00488     //First, do we have a selection?
00489     Application *pApp = GetApplication();
00490 
00491     ERROR2IF(pApp == NULL, FALSE,"NativePrefsDlg::InitDialog -  no application!");
00492     
00493     SelRange *pRange = pApp->FindSelection();
00494     
00495     ERROR2IF(pRange == NULL, FALSE,"NativePrefsDlg::InitDialog - no selection range!");
00496     DocRect ClipRect = pRange->GetBoundingRect();
00497 
00498     BOOL fThereIsASelection=!ClipRect.IsEmpty();
00499 
00500     //Now, is there a selection?
00501     if (fThereIsASelection)
00502     {
00503         // Yes. So ungrey both the buttons for selecting the nodes to export.
00504         EnableGadget(_R(IDC_NATIVEOPTS_SELECT), TRUE);
00505         EnableGadget(_R(IDC_NATIVEOPTS_DRAWING), TRUE);
00506 
00507         //Now, which of those buttons should be selected?
00508         switch ( mpParams->GetExportSel () )
00509         {
00510         case SELECTION:
00511             // Choose the export pair of buttons.
00512             SetLongGadgetValue(_R(IDC_NATIVEOPTS_SELECT), FALSE);
00513             SetLongGadgetValue(_R(IDC_NATIVEOPTS_DRAWING), TRUE);
00514             break;
00515 
00516         default:
00517         case DRAWING:
00518             // Choose the export pair of buttons.
00519             SetLongGadgetValue(_R(IDC_NATIVEOPTS_SELECT), TRUE);
00520             SetLongGadgetValue(_R(IDC_NATIVEOPTS_DRAWING), FALSE);
00521             break;
00522         }
00523     }
00524     else
00525     {
00526         //No. So grey the SELECTION button and ungrey
00527         //the DRAWING button
00528         EnableGadget(_R(IDC_NATIVEOPTS_SELECT), FALSE);
00529         EnableGadget(_R(IDC_NATIVEOPTS_DRAWING), TRUE);
00530 
00531         // And we must select the DRAWING button for the export area controls.
00532         SetLongGadgetValue(_R(IDC_NATIVEOPTS_SELECT), TRUE);
00533         SetLongGadgetValue(_R(IDC_NATIVEOPTS_DRAWING), FALSE);
00534     }
00535 
00536     return TRUE;
00537 }

MsgResult NativePrefsDlg::Message Msg Message  )  [virtual]
 

Handles all the web preferences dialog's messages.

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

Errors: -

See also:
-

Reimplemented from DialogOp.

Reimplemented in WebPrefsDlg.

Definition at line 345 of file xarprefs.cpp.

00346 {
00347     if (IS_OUR_DIALOG_MSG(Message) && mpParams)
00348     {
00349         DialogMsg* Msg = (DialogMsg*)Message;
00350 
00351         MsgResult Result;
00352 
00353         // Should now handle the required messages that we respond to
00354         switch (Msg->DlgMsg)
00355         {
00356             case DIM_CREATE:
00357                 {
00358                     InitDialog();
00359                 }
00360             break;
00361 
00362             case DIM_COMMIT:
00363                 {
00364                     // (ok) accept all changes that the user has made to the settings
00365                     // brackets make the ok local to this case 
00366                     BOOL ok;
00367                     ok = CommitDialogValues ();
00368                     if (ok)
00369                     {
00370                         // Values found ok so quit dialogue then go ahead and export
00371                         if ( mpParams != NULL )
00372                         {
00373                             mpParams->SetWebOk( TRUE ); // Flag ok used.
00374                         }
00375                         else
00376                         {
00377                             ERROR3 ( "mpParams is not set!" );
00378                         }
00379 
00380                     }
00381                 }
00382             break;
00383 
00384             case DIM_CANCEL:
00385                 // Cancel all changes that the user has made to the settings
00386                 if ( mpParams != NULL )
00387                 {
00388                     mpParams->SetWebOk(FALSE);          // Flag cancel used
00389                 }
00390                 else
00391                 {
00392                     ERROR3 ( "mpParams is not set!" );
00393                 }
00394 
00395             break;
00396 
00397             default:
00398                 break;
00399         }
00400 
00401         // Allow the base class access to the message, it will do the
00402         // DLG_EAT_IF_HUNGRY(Msg) for us
00403         // Must do this before the Close and End
00404         Result = DialogOp::Message ( Message );
00405 
00406         // The message was for our dialog box so return that we have handled it, if necessary
00407         return Result;
00408     }
00409 
00410     return DialogOp::Message(Message); 
00411 }


Member Data Documentation

WebPrefsDlgParam* NativePrefsDlg::mpParams [protected]
 

Definition at line 157 of file xarprefs.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 03:56:27 2007 for Camelot by  doxygen 1.4.4