#include <ngdialog.h>
Inheritance diagram for NameObjectsDlg:
Public Member Functions | |
NameObjectsDlg () | |
void | DoWithParam (OpDescriptor *, OpParam *) |
Creates then opens the dialog. | |
MsgResult | Message (Msg *Message) |
Handles kernel messages for the NameObjectsDlg dialog operation. | |
Static Public Member Functions | |
static BOOL | Init () |
Initialises preferences for this class. | |
static BOOL | Init () |
Declares a preference that allows you to clear memory in delete(). | |
static OpState | GetState (String_256 *, OpDescriptor *) |
The usual default GetState function for the NameObjectsDlg dialog operation. | |
Protected Member Functions | |
NameObjectsDlg () | |
Constructs a NameObjectsDlg object, a modeless version of the base class dialog, which creates names of objects in the Attribute gallery. | |
virtual StringBase * | GetDescription (StringBase *pstrDesc) |
virtual StringBase * | GetSuggestion (StringBase *pstrDesc) |
Works out a suggestion for the name of the selected objects, if any. | |
virtual UINT32 | IsValid (const StringBase &strName) |
virtual BOOL | DoCommit (const StringBase &strName) |
Applies the name to the selected objects, if any. | |
Private Member Functions | |
CC_DECLARE_DYNCREATE (NameObjectsDlg) | |
Private Attributes | |
String_256 * | m_pstrOutputName |
BOOL * | m_pfOkCancel |
Static Private Attributes | |
static BOOL | m_fModeless = FALSE |
Definition at line 155 of file ngdialog.h.
|
Constructs a NameObjectsDlg object, a modeless version of the base class dialog, which creates names of objects in the Attribute gallery.
Definition at line 329 of file ngdialog.cpp. 00330 : BaseNameObjectsDlg(_R(IDD_NAMEDLG_NAME_TEMPLATE), m_fModeless ? MODELESS : MODAL) 00331 { 00332 // Empty. 00333 }
|
|
|
|
|
|
Applies the name to the selected objects, if any.
Implements BaseNameObjectsDlg. Definition at line 451 of file ngdialog.cpp. 00452 { 00453 // Invoke either OpApplyNameToSel or OpApplyNameToNone, with a single name parameter. 00454 const TCHAR* pszTok = (GetApplication()->FindSelection()->IsEmpty()) 00455 ? OPTOKEN_APPLY_NAME_TO_NONE 00456 : OPTOKEN_APPLY_NAME_TO_SEL; 00457 00458 // Apply and (do or do not) close the dialog. 00459 OpDescriptor* pDesc = OpDescriptor::FindOpDescriptor((TCHAR*) pszTok); 00460 ERROR3IF(pDesc == 0, "NameObjectsDlg::DoCommit: can't find descriptor"); 00461 OpParam param((void *) &strName, 0); 00462 pDesc->Invoke(¶m); 00463 return m_fModeless; 00464 }
|
|
Creates then opens the dialog.
Reimplemented from Operation. Definition at line 1833 of file sgname.cpp. 01834 { 01835 // Remember the output parameters. 01836 ERROR3IF(pOpParam == 0, "NameObjectsDlg::DoWithParam: no OpParam"); 01837 ERROR3IF(pOpParam->Param1 == 0 || pOpParam->Output == 0, 01838 "NameObjectsDlg::DoWithParam: no output parameters"); 01839 01840 // Extract the input and output parameters. 01841 m_pstrOutputName = (String_256*) (pOpParam->Param1); 01842 DlgResID = (CDlgResID) pOpParam->Param2; 01843 m_pfOkCancel = (BOOL*) (pOpParam->Output); 01844 01845 // Try to run the operation. 01846 *m_pfOkCancel = FALSE; 01847 if (!Create()) 01848 { 01849 InformError(0, _R(IDS_OK)); 01850 End(); 01851 } 01852 }
|
|
Implements BaseNameObjectsDlg. Definition at line 348 of file ngdialog.cpp. 00349 { 00350 // No objects, one object, some objects. 00351 SelRange* pSel = GetApplication()->FindSelection(); 00352 if (pSel->IsEmpty()) 00353 pstrDesc->Load(_R(IDS_NAMEDLG_DESCRIBE_NOSELECT)); 00354 else 00355 if (pSel->Count() == 1) 00356 { 00357 String_256 desc=pSel->Describe(MENU); 00358 pstrDesc->MakeMsg(_R(IDS_NAMEDLG_DESCRIBE_SELECT), &desc); 00359 } 00360 else 00361 { 00362 String_256 desc=pSel->Describe(STATUS_BAR); 00363 pstrDesc->MakeMsg(_R(IDS_NAMEDLG_DESCRIBE_SELECT_PL), &desc); 00364 } 00365 00366 return pstrDesc; 00367 }
|
|
The usual default GetState function for the NameObjectsDlg dialog operation.
Definition at line 1903 of file sgname.cpp. 01904 { 01905 OpState OpSt; 01906 return OpSt; 01907 }
|
|
Works out a suggestion for the name of the selected objects, if any.
Implements BaseNameObjectsDlg. Definition at line 382 of file ngdialog.cpp. 00383 { 00384 // Work out what default text to put in the dialog edit-field. 00385 SelRange* pSel = GetApplication()->FindSelection(); 00386 if (pSel->IsEmpty()) 00387 pstrSuggest->Load(_R(IDS_NAMEDLG_DEFAULT_NAME)); 00388 else 00389 { 00390 // Pluralisise / capitalise the selection description. 00391 if (pSel->Count() == 1) 00392 { 00393 *pstrSuggest = pSel->Describe(MENU); 00394 pstrSuggest->toTitle(); 00395 } 00396 else 00397 *pstrSuggest = pSel->Describe(STATUS_BAR); 00398 } 00399 00400 // Make the name unique, if necessary, by appending ascending numerals. 00401 Document* pDoc = Document::GetCurrent(); 00402 if (pDoc != 0) 00403 { 00404 NodeSetSentinel* pSentry = pDoc->GetSetSentinel(); 00405 if (pSentry != 0) 00406 { 00407 String_256 strBase = *pstrSuggest; 00408 INT32 nAppend = 2; 00409 while (pSentry->GetNameAttr(*pstrSuggest) != 0) 00410 pstrSuggest->MakeMsg(_R(IDS_NAMEDLG_UNIQUE_MASK), &strBase, nAppend++); 00411 } 00412 } 00413 00414 return pstrSuggest; 00415 }
|
|
Declares a preference that allows you to clear memory in delete().
Reimplemented from SimpleCCObject. |
|
Initialises preferences for this class.
Reimplemented from SimpleCCObject. Definition at line 478 of file ngdialog.cpp. 00479 { 00480 ERROR2IF(!GetApplication()->DeclareSection(TEXT("Name Gallery"), 5) || 00481 !GetApplication()->DeclarePref(TEXT("Name Gallery"), 00482 TEXT("ModelessNameObjects"), 00483 &m_fModeless, FALSE, TRUE), 00484 FALSE, 00485 _R(IDE_BAD_INI_FILE)); 00486 00487 return TRUE; 00488 }
|
|
Reimplemented from BaseNameObjectsDlg. Definition at line 431 of file ngdialog.cpp. 00432 { 00433 // All new names must be unique, it's a policy. 00434 return Document::GetSelected()->GetSetSentinel()->GetNameAttr(strName) != 0 00435 ? _R(IDE_NAMEDLG_NAME_EXISTS) : 0; 00436 }
|
|
Handles kernel messages for the NameObjectsDlg dialog operation.
Reimplemented from DialogOp. Definition at line 1864 of file sgname.cpp. 01865 { 01866 // A message from the dialog or its gadgets? 01867 if (IS_OUR_DIALOG_MSG(pMessage)) 01868 { 01869 DialogMsg* pMsg = (DialogMsg*) pMessage; 01870 switch (pMsg->DlgMsg) 01871 { 01872 case DIM_CREATE: 01873 SetStringGadgetValue(_R(IDC_NAMEOBJ_NAME), m_pstrOutputName); 01874 SetKeyboardFocus(_R(IDC_NAMEOBJ_NAME)); 01875 HighlightText(_R(IDC_NAMEOBJ_NAME)); 01876 break; 01877 01878 case DIM_COMMIT: 01879 *m_pstrOutputName = GetStringGadgetValue(_R(IDC_NAMEOBJ_NAME), m_pfOkCancel); 01880 // nobreak; 01881 01882 case DIM_CANCEL: 01883 Close(); 01884 End(); 01885 break; 01886 } 01887 } 01888 01889 // Pass everything on to the base class . . . 01890 return DialogOp::Message(pMessage); 01891 }
|
|
Definition at line 158 of file ngdialog.h. |
|
|
|
|