brshname.cpp

Go to the documentation of this file.
00001 // $Id: brshname.cpp 1732 2006-09-03 14:08:16Z alex $
00002 /* @@tag:xara-cn@@ DO NOT MODIFY THIS LINE
00003 ================================XARAHEADERSTART===========================
00004  
00005                Xara LX, a vector drawing and manipulation program.
00006                     Copyright (C) 1993-2006 Xara Group Ltd.
00007        Copyright on certain contributions may be held in joint with their
00008               respective authors. See AUTHORS file for details.
00009 
00010 LICENSE TO USE AND MODIFY SOFTWARE
00011 ----------------------------------
00012 
00013 This file is part of Xara LX.
00014 
00015 Xara LX is free software; you can redistribute it and/or modify it
00016 under the terms of the GNU General Public License version 2 as published
00017 by the Free Software Foundation.
00018 
00019 Xara LX and its component source files are distributed in the hope
00020 that it will be useful, but WITHOUT ANY WARRANTY; without even the
00021 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00022 See the GNU General Public License for more details.
00023 
00024 You should have received a copy of the GNU General Public License along
00025 with Xara LX (see the file GPL in the root directory of the
00026 distribution); if not, write to the Free Software Foundation, Inc., 51
00027 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
00028 
00029 
00030 ADDITIONAL RIGHTS
00031 -----------------
00032 
00033 Conditional upon your continuing compliance with the GNU General Public
00034 License described above, Xara Group Ltd grants to you certain additional
00035 rights. 
00036 
00037 The additional rights are to use, modify, and distribute the software
00038 together with the wxWidgets library, the wxXtra library, and the "CDraw"
00039 library and any other such library that any version of Xara LX relased
00040 by Xara Group Ltd requires in order to compile and execute, including
00041 the static linking of that library to XaraLX. In the case of the
00042 "CDraw" library, you may satisfy obligation under the GNU General Public
00043 License to provide source code by providing a binary copy of the library
00044 concerned and a copy of the license accompanying it.
00045 
00046 Nothing in this section restricts any of the rights you have under
00047 the GNU General Public License.
00048 
00049 
00050 SCOPE OF LICENSE
00051 ----------------
00052 
00053 This license applies to this program (XaraLX) and its constituent source
00054 files only, and does not necessarily apply to other Xara products which may
00055 in part share the same code base, and are subject to their own licensing
00056 terms.
00057 
00058 This license does not apply to files in the wxXtra directory, which
00059 are built into a separate library, and are subject to the wxWindows
00060 license contained within that directory in the file "WXXTRA-LICENSE".
00061 
00062 This license does not apply to the binary libraries (if any) within
00063 the "libs" directory, which are subject to a separate license contained
00064 within that directory in the file "LIBS-LICENSE".
00065 
00066 
00067 ARRANGEMENTS FOR CONTRIBUTION OF MODIFICATIONS
00068 ----------------------------------------------
00069 
00070 Subject to the terms of the GNU Public License (see above), you are
00071 free to do whatever you like with your modifications. However, you may
00072 (at your option) wish contribute them to Xara's source tree. You can
00073 find details of how to do this at:
00074   http://www.xaraxtreme.org/developers/
00075 
00076 Prior to contributing your modifications, you will need to complete our
00077 contributor agreement. This can be found at:
00078   http://www.xaraxtreme.org/developers/contribute/
00079 
00080 Please note that Xara will not accept modifications which modify any of
00081 the text between the start and end of this header (marked
00082 XARAHEADERSTART and XARAHEADEREND).
00083 
00084 
00085 MARKS
00086 -----
00087 
00088 Xara, Xara LX, Xara X, Xara X/Xtreme, Xara Xtreme, the Xtreme and Xara
00089 designs are registered or unregistered trademarks, design-marks, and/or
00090 service marks of Xara Group Ltd. All rights in these marks are reserved.
00091 
00092 
00093       Xara Group Ltd, Gaddesden Place, Hemel Hempstead, HP2 6EX, UK.
00094                         http://www.xara.com/
00095 
00096 =================================XARAHEADEREND============================
00097  */
00098 
00099 // brush name dialog implementation
00100 
00101 #include "camtypes.h"
00102 #include "brshname.h"
00103 //#include "brushres.h"  // dialog resources
00104 #include "brushop.h"  // change brush op
00105 //#include "resource.h"
00106 #include "brshcomp.h"
00107 //#include "rik.h"   // for the strings
00108 //#include "reshlpid.h"
00109 
00110 CC_IMPLEMENT_DYNAMIC(CBaseBrushNameDlg, DialogOp)
00111 CC_IMPLEMENT_DYNCREATE(CNameBrushDlg, CBaseBrushNameDlg)
00112 CC_IMPLEMENT_DYNCREATE(CInitBrushNameDlg, CNameBrushDlg)
00113 
00114 // Preference for modal (default) or modeless Name Objects dialog.
00115 BOOL CBaseBrushNameDlg::m_bModeless = FALSE;
00116 
00117 
00118 /********************************************************************************************
00119 >   CBaseBrushNameDlg::CBaseBrushNameDlg(CDlgResID idRes, CDlgMode nMode)
00120 
00121     Author:     Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
00122     Created:    30/6/2000
00123     Inputs:     idRes       ---     resource ID of the dialog template to use
00124                 nMode       ---     mode to run in, MODAL or MODELESS
00125     Purpose:    Create a CBaseBrushNameDlg, an abstract base class for the Name name
00126                 and  dialogs.
00127     SeeAlso:    CBrushNameDlg; CRenameBrushDlg
00128 ********************************************************************************************/
00129 
00130 CBaseBrushNameDlg::CBaseBrushNameDlg(CDlgResID idRes, CDlgMode nMode)
00131   : DialogOp(idRes, nMode)
00132 {   
00133     m_BrushHandle = BrushHandle_NoBrush;
00134 }        
00135 
00136 
00137 
00138 
00139 /********************************************************************************************
00140 >   virtual void CBaseBrushNameDlg::Do(OpDescriptor*)
00141 
00142     Author:     Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
00143     Created:    30/6/2000
00144     Purpose:    Creates and runs a CBaseBrushNameDlg.  Shouldn't really use this as we will
00145                 have no definition to name
00146     SeeAlso:    CBaseBrushNameDlg; CBaseBrushNameDlg
00147 ********************************************************************************************/
00148 
00149 void CBaseBrushNameDlg::Do(OpDescriptor*)
00150 {
00151     // Try to run this operation.
00152     if (!Create())
00153     {
00154         InformError(0, _R(IDS_OK));
00155         End();
00156     }
00157     if (m_bModeless == TRUE)
00158         Open();
00159     
00160 }
00161 
00162 /********************************************************************************************
00163 >   virtual void CBaseBrushNameDlg::Do(OpDescriptor*)
00164 
00165     Author:     Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
00166     Created:    30/6/2000
00167     Purpose:    Creates and runs a CBaseBrushNameDlg to get a name for the brush definition
00168                 included in our param
00169     SeeAlso:    CBaseBrushNameDlg; CBaseBrushNameDlg
00170 ********************************************************************************************/
00171 
00172 void CBaseBrushNameDlg::DoWithParam(OpDescriptor* pDesc, OpParam* pParam)
00173 {
00174     if (pParam == NULL)
00175     {
00176         ERROR3("Param is null in CBaseBrushNameDlg::DoWithParam");
00177         return;
00178     }
00179     // first extract the brush handle
00180     m_BrushHandle =  static_cast<BrushHandle> (pParam->Param1);
00181     
00182     // now do it
00183     Do(pDesc);
00184 }
00185 
00186 /********************************************************************************************
00187 >   virtual MsgResult CBaseBrushNameDlg::Message(Msg* pMessage)
00188 
00189     Author:     Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
00190     Created:    30/6/2000
00191     Purpose:    Handles kernel messages for the CBaseBrushNameDlg dialog operation.
00192 ********************************************************************************************/
00193 
00194 MsgResult CBaseBrushNameDlg::Message(Msg* pMessage)
00195 {
00196     // A message from the dialog or its gadgets?
00197     if (IS_OUR_DIALOG_MSG(pMessage))
00198     {
00199         DialogMsg* pMsg = (DialogMsg*) pMessage;
00200         switch (pMsg->DlgMsg)
00201         {
00202         case DIM_CREATE:
00203             InitGadgetText();
00204             break;
00205 
00206         case DIM_TEXT_CHANGED:
00207             // Disable the OK/Apply button if there's no document or entered text.
00208             EnableGadget(_R(IDOK), !GetStringGadgetValue(_R(IDC_EDITBRUSHNAME), 0).IsEmpty()
00209                             && Document::GetSelected() != 0);
00210             break;
00211 
00212         case DIM_LFT_BN_CLICKED:    // enter messages when the edit box has the focus get cast to this
00213             if (pMsg->GadgetID == _R(ID_CC_HELP_BUTTON))
00214                 break;
00215         case DIM_COMMIT:
00216             {
00217                 // Check name for validity.
00218                 String_256 strEnter = GetStringGadgetValue(_R(IDC_EDITBRUSHNAME), 0);
00219                 UINT32 nErrID = IsValid(strEnter);
00220                 
00221                 if (nErrID != 0)
00222                 {
00223                     // Invalid, reinitialise.
00224                     InformError(nErrID);
00225                     if (nErrID == _R(IDS_BRUSHNAME_INVALID))
00226                     {
00227                         String_32 s(strEnter);
00228                         InitGadgetText(&s, FALSE);
00229                     }
00230                     else
00231                         InitGadgetText(NULL);
00232                     break;
00233                 }
00234                 else
00235                 {
00236                     // Entry is valid, try committing it.
00237                     String_32 FinalString(strEnter);
00238                     if (DoCommit(strEnter))
00239                     {
00240                         // Don't close, reinitialise (dialog is modeless).
00241                         InitGadgetText();
00242                         pMsg->DlgMsg = DIM_NONE; // stop base class closing it
00243                         break;
00244                     }
00245                     else
00246                     {
00247                         // Close();
00248                         // End(); - base class will close
00249                         break;
00250                     }
00251                 }
00252                         
00253             }
00254             break;
00255         case DIM_CANCEL:
00256             HandleCancel(); // base class will close
00257             break;
00258         default:
00259             break;
00260         }
00261     }
00262     
00263 
00264     // Has the document been switched or closed?
00265     else if (MESSAGE_IS_A(pMessage, DocChangingMsg))
00266     {
00267         DocChangingMsg* pMsg = (DocChangingMsg*) pMessage;
00268         if (pMsg->State == DocChangingMsg::SELCHANGED)
00269             EnableGadget(_R(IDOK), pMsg->pNewDoc != 0);
00270     }
00271 
00272     // Pass everything on to the base class . . .
00273     return DialogOp::Message(pMessage);
00274 }  
00275 
00276 
00277 /********************************************************************************************
00278 >   virtual UINT32 CBaseBrushNameDlg::IsValid(const StringBase& strName)
00279 
00280     Author:     Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
00281     Created:    30/6/2000
00282     Inputs:     strName     ---     name to test for suitability
00283     Returns:    0 if valid (by default any non-empty text is valid), or the ID of an
00284                 error string explaining why if it is not.
00285     SeeAlso:    CBaseBrushNameDlg::Message
00286 ********************************************************************************************/
00287 
00288 UINT32 CBaseBrushNameDlg::IsValid(const StringBase& strName)
00289 {
00290     return 0;
00291 }
00292 
00293 /*---------------------------------------------------------------------------------------------
00294 ----------------------------------CBrushNameDlg class implementation---------------------------
00295 ----------------------------------------------------------------------------------------------*/
00296 
00297 
00298 
00299 /********************************************************************************************
00300 >   CNameBrushDlg::CNameBrushDlg()
00301 
00302     Author:     Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
00303     Created:    30/6/2000
00304     Purpose:    Constructs a CNameBrushDlg object, a modeless version of the base class
00305                 dialog, which gets a name for a newly created brush
00306     SeeAlso:    CBaseNameBrushDlg
00307 ********************************************************************************************/
00308 
00309 CNameBrushDlg::CNameBrushDlg()
00310   : CBaseBrushNameDlg(_R(IDD_BRUSHNAMEDLG), m_bModeless ? MODELESS : MODAL)
00311 {
00312     // Empty.
00313 }
00314 
00315 
00316 
00317 /********************************************************************************************
00318 >   virtual StringBase* CNameBrushDlg::GetDescription(StringBase* pstrDesc)
00319 
00320     Author:     Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
00321     Created:    30/6/2000
00322     Returns:    The input.
00323     Outputs:    what came in!
00324     Purpose:    Nothing, at the moment, when I get around to writing some descriptive strings
00325                 I will add them in here
00326     
00327 ********************************************************************************************/
00328 
00329 StringBase* CNameBrushDlg::GetDescription(StringBase* pstrDesc)
00330 {
00331     return pstrDesc;
00332 }
00333 
00334 
00335 
00336 /********************************************************************************************
00337 >   virtual void CNameBrushDlg::InitGadgetText(String_32* pString)
00338 
00339     Author:     Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
00340     Created:    30/6/2000
00341     Inputs:     pString - if you want to suggest a name based on a particular string
00342                 then pass a string, defaults to FALSE though so you don't have to
00343     Purpose:    Initialises the text of the gadgets in the dialog.
00344     SeeAlso:    CBaseBrushNameDlg::Message
00345 ********************************************************************************************/
00346 
00347 void CNameBrushDlg::InitGadgetText(String_32* pString, BOOL resizeDialog /*= TRUE*/)
00348 {
00349     if (pString != NULL)
00350         m_strSuggest = *pString;
00351     SetStringGadgetValue(_R(IDC_EDITBRUSHNAME), *GetSuggestion(&m_strSuggest));
00352     HighlightText(_R(IDC_EDITBRUSHNAME));
00353     SetKeyboardFocus(_R(IDC_EDITBRUSHNAME));
00354 
00355     // change the dialog title to "Enter brush name:"
00356     String_256 Name = TEXT("Enter brush name:");
00357     SetTitlebarName(&Name);
00358 
00359     if (resizeDialog)
00360     {
00361         // what we want to do is shrink the dialog by the size of the label and then hide it
00362         RECT LabelRect;
00363         GetGadgetPosition(_R(IDC_STATICBRUSHGROUP), &LabelRect);
00364         
00365         // hide the label
00366         HideGadget(_R(IDC_STATICBRUSHGROUP), TRUE);
00367 
00368         // get the size of this dialog
00369         RECT DialogRect;
00370         GetWindowPosition(&DialogRect);
00371         
00372         // subtract the size of the label
00373         INT32 Subtract = LabelRect.bottom - LabelRect.top;
00374         DialogRect.bottom -= Subtract;
00375 
00376         // We want to move up the buttons
00377         RECT OkRect;
00378         if (GetGadgetPosition(_R(IDOK), &OkRect))
00379         {
00380             OkRect.top -= Subtract;
00381             OkRect.bottom -= Subtract;
00382             INT32 Width = OkRect.right - OkRect.left;
00383             Width = (Width * 2) / 3;
00384             OkRect.left += Width ;
00385             OkRect.right += Width;
00386             SetGadgetPosition(_R(IDOK), OkRect);
00387         }
00388 
00389         RECT CancelRect;
00390         if (GetGadgetPosition(_R(IDCANCEL), &CancelRect))
00391         {
00392             CancelRect.top -= Subtract;
00393             CancelRect.bottom -= Subtract;
00394             INT32 Width = CancelRect.right - CancelRect.left;
00395             Width = (Width * 2) / 3;
00396             CancelRect.left += Width;
00397             CancelRect.right += Width;
00398             SetGadgetPosition(_R(IDCANCEL), CancelRect);
00399         }
00400 
00401         // Reset the window
00402         SetWindowPosition(DialogRect);
00403         
00404         // Hide the help button
00405         HideGadget(_R(ID_CC_HELP_BUTTON), TRUE);
00406     }
00407 }
00408 
00409 
00410 /********************************************************************************************
00411 >   virtual StringBase* CNameBrushDlg::GetSuggestion(StringBase* pstrSuggest)
00412 
00413     Author:     Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
00414     Created:    30/6/2000
00415     Outputs:    pstrSuggest  ---    a suggested name for the new brush, if any.
00416     Returns:    pstrSuggest, ie. the input.
00417     Purpose:    Works out a suggestion for the name of the new brush
00418     
00419 ********************************************************************************************/
00420 
00421 StringBase* CNameBrushDlg::GetSuggestion(StringBase* pstrSuggest)
00422 {
00423     ERROR2IF(pstrSuggest == NULL, FALSE, "Null input pointer to CNameBrushDlg::GetSuggestion");
00424 
00425     // get the brush component from the document
00426     Document* pDoc = Document::GetCurrent();
00427     ERROR2IF(pDoc == NULL, FALSE, "Wheres the document?");
00428     BrushComponent* pBrushComp = (BrushComponent*)pDoc->GetDocComponent(CC_RUNTIME_CLASS(BrushComponent));
00429     ERROR2IF(pBrushComp == NULL, FALSE, "No brush component");
00430     
00431     if (!pstrSuggest->IsEmpty())
00432         *pstrSuggest = pBrushComp->GetUniqueName((String_32*)pstrSuggest);
00433     else
00434         *pstrSuggest = pBrushComp->GetUniqueName(NULL);
00435 
00436     return pstrSuggest;
00437 }
00438 
00439 
00440 
00441 /********************************************************************************************
00442 >   virtual UINT32 CNameBrushDlg::IsValid(const StringBase& strName)
00443 
00444     Author:     Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
00445     Created:    9/5/99
00446     Inputs:     strName     ---     name to test for suitability
00447     Returns:    0 if valid (ie. not a name already in use), ID of an error string
00448                 explaining why if it is not (new names must be _new_, ie. different
00449                 to any existing ones).
00450     SeeAlso:    CBaseNameBrushDlg::Message
00451 ********************************************************************************************/
00452 
00453 UINT32 CNameBrushDlg::IsValid(const StringBase& strName)
00454 {
00455     UINT32 NumChars = strName.Length();
00456     if (NumChars > 20)
00457         return _R(IDS_BRUSHNAME_TOOLONG);
00458     // get the brush component from the document
00459     Document* pDoc = Document::GetCurrent();
00460     ERROR2IF(pDoc == NULL, FALSE, "Wheres the document?");
00461     BrushComponent* pBrushComp = (BrushComponent*)pDoc->GetDocComponent(CC_RUNTIME_CLASS(BrushComponent));
00462     ERROR2IF(pBrushComp == NULL, FALSE, "No brush component");
00463     
00464     if (pBrushComp->NameIsUnique(strName))
00465         return 0;
00466 
00467     return _R(IDS_BRUSHNAME_INVALID);
00468 }
00469 
00470 
00471 
00472 /********************************************************************************************
00473 >   virtual BOOL CNameBrushDlg::DoCommit(const StringBase& strName)
00474 
00475     Author:     Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
00476     Created:    30/6/2000
00477     Inputs:     strName         ---     the name to apply
00478     Returns:    TRUE / FALSE    ---     don't / do close the dialog on returning.
00479     Purpose:    Invokes the op to apply the name to the brush
00480     SeeAlso:    BaseCNameBrushDlg::Message; OpApplyNames
00481 ********************************************************************************************/
00482 
00483 BOOL CNameBrushDlg::DoCommit(const StringBase& strName)
00484 {
00485     // Apply and (do or do not) close the dialog.
00486     OpDescriptor* pDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_CHANGEBRUSHDEF);
00487     
00488     // if we haven't got a brush then error
00489     if (m_BrushHandle == BrushHandle_NoBrush)
00490     {
00491         ERROR3("No brush handle in CNameBrushDlg::DoCommit");
00492         return FALSE;
00493     }
00494 
00495     // our param needs to know the brush handle and new name
00496     ChangeBrushDefOpParam Param;
00497     Param.m_NewBrushName = (String_32)strName;
00498     Param.m_Handle = m_BrushHandle;
00499     Param.ChangeType = CHANGEBRUSH_NAME;
00500 
00501     ERROR3IF(pDesc == 0, "CNameBrushDlg::DoCommit: can't find descriptor");
00502     pDesc->Invoke(&Param);
00503     return m_bModeless;
00504 }
00505 
00506 
00507 /********************************************************************************************
00508 >   static BOOL CNameBrushDlg::Init()
00509 
00510     Author:     Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
00511     Created:    30/6/2000
00512     Purpose:    Register operation.
00513     SeeAlso:    
00514 ********************************************************************************************/
00515 
00516 BOOL CNameBrushDlg::Init()
00517 {  
00518     return RegisterOpDescriptor(0,
00519                                 _R(IDS_OK),
00520                                 CC_RUNTIME_CLASS(CNameBrushDlg),
00521                                 OPTOKEN_NAME_BRUSH_DLG,
00522                                 CNameBrushDlg::GetState,
00523                                 0,                              // help ID
00524                                 0);                             // bubble ID
00525 }   
00526 
00527 
00528 
00529 /********************************************************************************************
00530 >   static OpState CNameBrushDlg::GetState(String_256*, OpDescriptor*)
00531 
00532     Author:     Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
00533     Created:    30/6/2000
00534     Purpose:    The usual default GetState function for the CNameBrushDlg dialog operation.
00535 ********************************************************************************************/
00536 
00537 OpState CNameBrushDlg::GetState(String_256*, OpDescriptor*)
00538 {    
00539     OpState OpSt;
00540     return OpSt;
00541 }
00542 
00543 
00544 
00545 /*--------------------------------------------------------------------------------------------
00546 ----------------------------------CInitBrushNameDlg implementation----------------------------
00547 ---------------------------------------------------------------------------------------------*/
00548 
00549 
00550 /********************************************************************************************
00551 >   static BOOL CNameBrushDlg::Init()
00552 
00553     Author:     Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
00554     Created:    30/6/2000
00555     Purpose:    Register operation.
00556     SeeAlso:    
00557 ********************************************************************************************/
00558 
00559 BOOL CInitBrushNameDlg::Init()
00560 {  
00561     return RegisterOpDescriptor(0,
00562                                 _R(IDS_OK),
00563                                 CC_RUNTIME_CLASS(CInitBrushNameDlg),
00564                                 OPTOKEN_INITNAME_BRUSH_DLG,
00565                                 CInitBrushNameDlg::GetState,
00566                                 0,                              // help ID
00567                                 0);                             // bubble ID
00568 }   
00569 
00570 
00571 
00572 /********************************************************************************************
00573 >   static OpState CNameBrushDlg::GetState(String_256*, OpDescriptor*)
00574 
00575     Author:     Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
00576     Created:    30/6/2000
00577     Purpose:    The usual default GetState function for the CNameBrushDlg dialog operation.
00578 ********************************************************************************************/
00579 
00580 OpState CInitBrushNameDlg::GetState(String_256*, OpDescriptor*)
00581 {    
00582     OpState OpSt;
00583     return OpSt;
00584 }
00585 
00586 
00587 
00588 /********************************************************************************************
00589 >   virtual void CInitBrushNameDlg::InitGadgetText(String_32* pString)
00590 
00591     Author:     Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
00592     Created:    30/6/2000
00593     Inputs:     pString - if you want to suggest a name based on a particular string
00594                 then pass a string, defaults to FALSE though so you don't have to
00595     Purpose:    Initialises the text of the gadgets in the dialog.
00596     SeeAlso:    CBaseBrushNameDlg::Message
00597 ********************************************************************************************/
00598 
00599 void CInitBrushNameDlg::InitGadgetText(String_32* pString, BOOL resizeDialog /*= TRUE*/)
00600 {
00601     if (pString != NULL)
00602         m_strSuggest = *pString;
00603     SetStringGadgetValue(_R(IDC_EDITBRUSHNAME), *GetSuggestion(&m_strSuggest));
00604 
00605     // change the dialog title to "Enter brush name:"
00606     // Errr, NO!  This is very bad for translation!
00607 //  String_256 Name = TEXT("Create new brush:");
00608 //  SetTitlebarName(&Name);
00609 
00610     // Show the help button
00611     HideGadget(_R(ID_CC_HELP_BUTTON), FALSE);
00612 
00613     // show the group info text
00614     SetStringGadgetValue(_R(IDC_STATICBRUSHGROUP), _R(IDS_BRUSHGROUP));
00615     HideGadget(_R(IDC_STATICBRUSHGROUP), FALSE);
00616 
00617     
00618     
00619     HighlightText(_R(IDC_EDITBRUSHNAME));
00620     SetKeyboardFocus(_R(IDC_EDITBRUSHNAME));
00621 
00622 
00623 }
00624 
00625 /********************************************************************************************
00626 >   virtual BOOL CNameBrushDlg::DoCommit(const StringBase& strName)
00627 
00628     Author:     Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
00629     Created:    30/6/2000
00630     Inputs:     strName         ---     the name to apply
00631     Returns:    TRUE / FALSE    ---     don't / do close the dialog on returning.
00632     Purpose:    simply retrieves the brush definition and changes the name, this means
00633                 that it will not be undoable
00634     SeeAlso:    BaseCNameBrushDlg::Message; OpApplyNames
00635 ********************************************************************************************/
00636 
00637 BOOL CInitBrushNameDlg::DoCommit(const StringBase& strName)
00638 {
00639     String_32 Name(strName);
00640     BrushComponent::SetNewName(strName);
00641     return m_bModeless;
00642 }
00643 
00644 
00645 
00646 /********************************************************************************************
00647 >   virtual BOOL CNameBrushDlg::DoCommit(const StringBase& strName)
00648 
00649     Author:     Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
00650     Created:    30/6/2000
00651     Inputs:     strName         ---     the name to apply
00652     Returns:    TRUE / FALSE    ---     don't / do close the dialog on returning.
00653     Purpose:    simply retrieves the brush definition and changes the name, this means
00654                 that it will not be undoable
00655     SeeAlso:    BaseCNameBrushDlg::Message; OpApplyNames
00656 ********************************************************************************************/
00657 
00658 void CInitBrushNameDlg::HandleCancel()
00659 {
00660     BrushComponent::CancelNewBrush();
00661 }
00662 
00663 /********************************************************************************************
00664 >   CNameBrushDlg::CNameBrushDlg()
00665 
00666     Author:     Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
00667     Created:    30/6/2000
00668     Purpose:    Constructs a CNameBrushDlg object, a modeless version of the base class
00669                 dialog, which gets a name for a newly created brush
00670     SeeAlso:    CBaseNameBrushDlg
00671 ********************************************************************************************/
00672 
00673 CInitBrushNameDlg::CInitBrushNameDlg()
00674   : CNameBrushDlg()
00675 {
00676     // Empty.
00677 }

Generated on Sat Nov 10 03:44:33 2007 for Camelot by  doxygen 1.4.4