optsundo.cpp

Go to the documentation of this file.
00001 // $Id: optsundo.cpp 1282 2006-06-09 09:46:49Z 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 // Implementation of the Undo tab of the options dialog box
00100 
00101 /*
00102 
00103 */
00104 
00105 #include "camtypes.h"
00106 #include "appprefs.h"
00107 #include "optsundo.h"
00108 //#include "app.h"      // Camelot object - in camtypes.h [AUTOMATICALLY REMOVED]
00109 //#include "convert.h"  // StringToBytes and BytesToString - in camtypes.h [AUTOMATICALLY REMOVED]
00110 #include "ophist.h"
00111 
00112 CC_IMPLEMENT_DYNAMIC(UndoTab, OptionsTabs)   
00113               
00114 // This is not compulsory, but you may as well put it in so that the correct version
00115 // of your file can be registered in the .exe
00116 DECLARE_SOURCE("$Revision: 1282 $");
00117 
00118 /********************************************************************************************
00119 
00120 >   UndoTab::UndoTab() 
00121 
00122 
00123     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00124     Created:    20/1/95
00125     Inputs:     -
00126     Outputs:    -
00127     Returns:    -
00128     Purpose:    UndoTab constructor. Creates a non-undoable operation
00129     Errors:     -
00130     SeeAlso:    -
00131 
00132 ********************************************************************************************/
00133 
00134 UndoTab::UndoTab()
00135 {   
00136     // Do nothing at present
00137 }        
00138 
00139 /********************************************************************************************
00140 
00141 >   UndoTab::~UndoTab()
00142 
00143 
00144     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00145     Created:    20/1/95
00146     Inputs:     -
00147     Outputs:    -
00148     Returns:    -
00149     Purpose:    UndoTab destructor
00150     Errors:     -
00151     SeeAlso:    -
00152 
00153 ********************************************************************************************/
00154                                                                                 
00155 UndoTab::~UndoTab()
00156 {   
00157 }        
00158 
00159 /********************************************************************************************
00160 
00161 >   BOOL UndoTab::Init()
00162 
00163 
00164     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00165     Created:    20/1/95
00166     Inputs:     -
00167     Outputs:    -
00168     Returns:    True if initialised ok, False if failed.
00169     Purpose:    UndoTab initialisation routine
00170     Errors:     -
00171     SeeAlso:    -
00172 
00173 ********************************************************************************************/
00174                                                                                 
00175 BOOL UndoTab::Init()
00176 {   
00177     return TRUE;
00178 }        
00179 
00180 
00181 /******************************************************************************************
00182 
00183 >   CDlgResID UndoTab::GetPageID()()
00184 
00185     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00186     Created:    20/1/95
00187     Inputs:     -
00188     Outputs:    -
00189     Returns:    The dialog ID of this tab section.    
00190     Purpose:    Allows the options dialog code to determine the dialog ID of this section.
00191     Errors:     -
00192     SeeAlso:    -
00193 
00194 ******************************************************************************************/
00195 
00196 CDlgResID UndoTab::GetPageID()
00197 {
00198     return _R(IDD_OPTSTAB_UNDO);
00199 }
00200 
00201 /******************************************************************************************
00202 
00203 >   BOOL UndoTab::IsDocumentOption()
00204 
00205     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00206     Created:    20/1/95
00207     Inputs:     -
00208     Outputs:    -
00209     Returns:    Returns True if this tab is a document option.    
00210     Purpose:    Allows the document options dialog code to determine if this tab belongs
00211                 to the group of document options.
00212     Errors:     -
00213     SeeAlso:    IsProgramOption();
00214 
00215 ******************************************************************************************/
00216 
00217 BOOL UndoTab::IsDocumentOption()
00218 {
00219     return TRUE;    // This tab is not a document option 
00220 }
00221 
00222 /******************************************************************************************
00223 
00224 >   BOOL UndoTab::IsProgramOption()
00225 
00226     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00227     Created:    20/1/95
00228     Inputs:     -
00229     Outputs:    -
00230     Returns:    Returns True if this tab is a program option.     
00231     Purpose:    Allows the program options dialog code to determine if this tab belongs
00232                 to the group of program options.
00233     Errors:     -
00234     SeeAlso:    IsProgramOption();
00235 
00236 ******************************************************************************************/
00237 
00238 BOOL UndoTab::IsProgramOption()
00239 {
00240     return TRUE;    // This tab is a program option 
00241 }
00242 
00243 
00244 /******************************************************************************************
00245 
00246 >   BOOL UndoTab::CommitSection()
00247 
00248     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00249     Created:    20/1/95
00250     Inputs:     -
00251     Outputs:    -
00252     Returns:    True if values in dialog box ok, False otherwise.     
00253     Purpose:    Takes the values in the Undo section tab of the options dialog box and
00254                 sets the associated preference values accordingly
00255                 Called when ok is pressed on the dialog box.
00256     Errors:     -
00257     SeeAlso:    -
00258 
00259 ******************************************************************************************/
00260 
00261 BOOL UndoTab::CommitSection()
00262 {
00263 TRACEUSER( "Neville", _T("commit undo section\n"));
00264     ERROR3IF(pPrefsDlg == NULL, "UndoTab::CommitSection called with no dialog pointer");
00265 
00266     BOOL ok = pPrefsDlg->TalkToPage(_R(IDD_OPTSTAB_UNDO));  // The Undo View identifier
00267     if (!ok)
00268         return TRUE;    // Talk to View failed to return now
00269 
00270     // Ok has been pressed so take the values from this section of the dialog box
00271     BOOL Valid=TRUE;        // Flag for validity of value
00272 //  BOOL State=FALSE;       // Flag for state of button/switch
00273 //  BOOL SetOk=TRUE;        // Preference value set ok
00274 
00275     // Section = Undo settings
00276 
00277     // Get the currently selected document
00278     Document* pDocument = Document::GetSelected();
00279     if (pDocument != NULL)
00280     {
00281         // Getthe current undo size
00282         UINT32 CurrentSize = pDocument->GetOpHistory().GetSize();
00283         UINT32 CurrentMaxSize = pDocument->GetOpHistory().GetMaxSize();
00284 
00285         // Now read the state of the use maximum memory switch, if on then set TempWorkMemory to 0
00286         BOOL Unlimited = pPrefsDlg->GetLongGadgetValue(_R(IDC_OPTS_UNLIMITEDUNDO), 0, 1, 0, &Valid);
00287 
00288         UINT32 NewMaxUndoSize;
00289         if (Unlimited)
00290         {
00291             // Use the maximum possible value
00292             NewMaxUndoSize = UINT32_MAX;
00293         }
00294         else
00295         {
00296             // Read the value from the editable field limiting the values in the process
00297             NewMaxUndoSize = pPrefsDlg->GetMemoryGadgetValue(_R(IDC_OPTS_MAXUNDOSIZE),
00298                                                              1*1024, UINT32_MAX-1,
00299                                                              _R(IDE_OPTS_INVALIDUNDOSIZE), &Valid);
00300             if (!Valid)
00301                 return FALSE;           // Undo size incorrect, user has been warned already
00302         }
00303 TRACEUSER( "Neville", _T("Current undo size =%d\n"),CurrentSize);
00304 TRACEUSER( "Neville", _T("Current maximum undo size =%d\n"),CurrentMaxSize);
00305 TRACEUSER( "Neville", _T("New maximum undo size =%d\n"),NewMaxUndoSize);
00306         
00307         // If a new size has been entered then try to set this as the new maximum
00308         if (NewMaxUndoSize != CurrentMaxSize)
00309         {
00310 #if 0 //def _DEBUG
00311             // If the resize means that data will be lost then warn the user and ask for confirmation
00312             // otherwise just set the new limit.
00313             BOOL OkToResize = TRUE;
00314             if (NewMaxUndoSize < CurrentSize)
00315             {
00316                 // Ask user to confirm loss of undo data
00317                 // Warn the user that there is no selection = large export
00318                 ErrorInfo Info;
00319                 Info.ErrorMsg = _R(IDT_OPTS_LOSSOFUNDO);
00320                 Info.Button[0] = _R(IDB_UNDOQUERY_RESIZE);
00321                 Info.Button[1] = _R(IDB_UNDOQUERY_DONTRESIZE);
00322                 if (AskQuestion(&Info) == _R(IDB_UNDOQUERY_DONTRESIZE))
00323                 {
00324                     // If the user has cancelled just display the current value again
00325                     OkToResize = FALSE;
00326                 }
00327             }
00328         
00329             // If everything is ok then try the resize
00330             if (OkToResize)
00331             {
00332                 SetOk = pDocument->GetOpHistory().SetNewMaxSize(NewMaxUndoSize);
00333                 if (!SetOk)
00334                 {
00335                     // Out of ID's at present so use wrong error message 
00336                     InformError(_R(IDE_OPTS_BADUNDORESIZE));
00337                 
00338                     // Force the update to the old max size value
00339                     OkToResize = FALSE;
00340                 }
00341             }
00342 
00343             // If for any reason OkToResize has been set ot FALSE then update the undo size
00344             // field and exit FALSE
00345             if (!OkToResize)
00346             {
00347                 // Restore the MaxSize in dialog field
00348                 //String_256    String;
00349                 // Get current size
00350                 UINT32 MaxUndoSize = pDocument->GetOpHistory().GetMaxSize();
00351                 // Show that value on the dialog box as a memory size
00352                 pPrefsDlg->SetMemoryGadgetValue(_R(IDC_OPTS_MAXUNDOSIZE), MaxUndoSize);
00353 
00354                 return FALSE;
00355             }
00356 #else
00357             InformWarning(_R(IDW_NOUNDORESIZING));
00358 #endif
00359         }
00360     }
00361     //else
00362     //  ERROR2(FALSE,_R(IDE_OPTS_SETPREF_UNDO));
00363 
00364     return TRUE;
00365 }
00366 
00367 /********************************************************************************************
00368 
00369 >   BOOL UndoTab::GreySection()
00370 
00371     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00372     Created:    4/2/95
00373     Inputs:     -
00374     Outputs:    -
00375     Returns:    -
00376     Purpose:    Called when the user has closed all documents 
00377     Errors:     -
00378     SeeAlso:    UndoTab::UngreySection;
00379 
00380 ********************************************************************************************/
00381 
00382 BOOL UndoTab::GreySection()
00383 {
00384 TRACEUSER( "Neville", _T("GreySection in UndoTab section\n"));
00385     ERROR2IF(pPrefsDlg == NULL,FALSE,"UndoTab::GreySection called with no dialog pointer");
00386 
00387     BOOL ok = pPrefsDlg->TalkToPage(_R(IDD_OPTSTAB_UNDO));  // The UndoTab identifier
00388     if (!ok)
00389         return TRUE;    // Talk to page failed to return now
00390 
00391     // Only update if we are not already grey 
00392     if (GreyStatus == TRUE)
00393         return TRUE;
00394 
00395     // Call our central greying/ungreying function
00396     ok = ChangeControlStatus(FALSE);
00397     
00398     GreyStatus = TRUE;
00399 
00400     return ok;
00401 } 
00402 
00403 /********************************************************************************************
00404 
00405 >   BOOL UndoTab::UngreySection()
00406 
00407     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00408     Created:    4/2/95
00409     Inputs:     -
00410     Outputs:    -
00411     Returns:    -
00412     Purpose:    Called when the user has selected a new document 
00413     Errors:     -
00414     SeeAlso:    UndoTab::UngreySection;
00415 
00416 ********************************************************************************************/
00417 
00418 BOOL UndoTab::UngreySection()
00419 {
00420 TRACEUSER( "Neville", _T("UngreySection in UndoTab section\n"));
00421     ERROR2IF(pPrefsDlg == NULL,FALSE,"UndoTab::UngreySection called with no dialog pointer");
00422 
00423     BOOL ok = pPrefsDlg->TalkToPage(_R(IDD_OPTSTAB_UNDO));  // The UndoTab identifier
00424     if (!ok)
00425         return TRUE;    // Talk to page failed to return now
00426 
00427     // Only update if we are not already ungrey 
00428     if (GreyStatus == FALSE)
00429         return TRUE;
00430 
00431     // Call our central greying/ungreying function
00432     ok = ChangeControlStatus(TRUE);
00433     
00434     GreyStatus = FALSE;
00435 
00436     return ok;
00437 }
00438 
00439 /********************************************************************************************
00440 
00441 >   BOOL UndoTab::ChangeControlStatus(const BOOL Status)
00442 
00443     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00444     Created:    4/2/95
00445     Inputs:     -
00446     Outputs:    -
00447     Returns:    -
00448     Purpose:    Called to grey/ungrey all controls on this tab. 
00449     Errors:     -
00450     SeeAlso:    UndoTab::GreySection;   UndoTab::UngreySection;
00451 
00452 ********************************************************************************************/
00453 
00454 BOOL UndoTab::ChangeControlStatus(const BOOL Status)
00455 {
00456     pPrefsDlg->EnableGadget(_R(IDC_OPTS_UNDOGROUP), Status);
00457     pPrefsDlg->EnableGadget(_R(IDC_OPTS_UNDOSIZETXT), Status);
00458     pPrefsDlg->EnableGadget(_R(IDC_OPTS_UNDOSIZE), Status);
00459     pPrefsDlg->EnableGadget(_R(IDC_OPTS_MAXUNDOSIZE), Status);
00460     pPrefsDlg->EnableGadget(_R(IDC_OPTS_UNLIMITEDUNDO), Status);
00461     pPrefsDlg->EnableGadget(_R(IDC_OPTS_MAXUNDOTXT), Status);
00462     pPrefsDlg->EnableGadget(_R(IDC_OPTS_MAXUNDOSIZE), Status);
00463 
00464     return TRUE;
00465 }           
00466 
00467 /********************************************************************************************
00468 
00469 >   BOOL UndoTab::UpdateSection(String_256 *DocumentName)
00470 
00471     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00472     Created:    4/2/95
00473     Inputs:     Name of document
00474     Outputs:    -
00475     Returns:    -
00476     Purpose:    Called when we have switched to a new document and need to update all the 
00477                 controls on this tab. Should only init the tab if the page is present.  
00478                 The document name allows the info field on the tab to be filled in correctly.
00479     Errors:     -
00480     SeeAlso:    UndoTab::GreySection; UndoTab::UngreySection; UndoTab::InitSection;
00481 
00482 ********************************************************************************************/
00483 
00484 BOOL UndoTab::UpdateSection(String_256 *DocumentName)
00485 {
00486 TRACEUSER( "Neville", _T("UndoTab::UpdateSection\n"));
00487     ERROR2IF(pPrefsDlg == NULL,FALSE,"UndoTab::UpdateSection called with no dialog pointer");
00488 
00489     BOOL ok = pPrefsDlg->TalkToPage(_R(IDD_OPTSTAB_UNDO));  // The UndoTab identifier
00490     if (!ok)
00491         return TRUE;        // page not present
00492 
00493     // Remove any lists that we have created.
00494     //pPrefsDlg->DeleteAllValues(_R(IDC_OPTS_SIZELIST));
00495 
00496     // Call the normal init section code
00497     return InitSection();
00498 }
00499 
00500 /********************************************************************************************
00501 
00502 >   BOOL UndoTab::HandleMsg(DialogMsg* Msg)
00503 
00504     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00505     Created:    20/1/95
00506     Inputs:     -
00507     Outputs:    -
00508     Returns:    -
00509     Purpose:    Handles all the Undo options tabs messages 
00510     Errors:     -
00511     SeeAlso:    -
00512 
00513 ********************************************************************************************/
00514 
00515 BOOL UndoTab::HandleMsg(DialogMsg* Msg)
00516 {
00517 TRACEUSER( "Neville", _T("HandleUndoMsg\n"));
00518     ERROR2IF(Msg == NULL,FALSE,"UndoTab::Message null message received");
00519     ERROR2IF(pPrefsDlg == NULL,FALSE,"UndoTab::HandleMsg called with no dialog pointer");
00520 
00521     BOOL ok = pPrefsDlg->TalkToPage(_R(IDD_OPTSTAB_UNDO));  // The Undo View identifier
00522     if (!ok)
00523         return TRUE;        // page not present
00524 
00525     switch(Msg->DlgMsg)
00526     {
00527         case DIM_CREATE:    // Initialise controls
00528             GreyStatus = FALSE; // we are ungreyed by default
00529             ok = InitSection();
00530             if (!ok)
00531                 InformError();
00532             break;
00533         case DIM_LFT_BN_CLICKED:
00534             OptionsTabs::SetApplyNowState(TRUE);
00535             if (Msg->GadgetID == _R(IDC_OPTS_UNLIMITEDUNDO))
00536             {
00537                 BOOL Valid;
00538                 BOOL Unlimited = pPrefsDlg->GetLongGadgetValue(_R(IDC_OPTS_UNLIMITEDUNDO), 0, 1, 0, &Valid);
00539                 // If set then grey the editable field and its name text otherwise ungrey
00540                 pPrefsDlg->EnableGadget(_R(IDC_OPTS_MAXUNDOTXT), !Unlimited);
00541                 pPrefsDlg->EnableGadget(_R(IDC_OPTS_MAXUNDOSIZE), !Unlimited);
00542             }
00543 #if 0
00544             else if (Msg->GadgetID == _R(IDC_OPTS_DEFAULTUNDO))
00545             {
00546                 // Set the MaxSize in the dialog field to a default value
00547                 String_256  String;
00548                 UINT32 MaxUndoSize = UINT32_MAX; //40*1024*1024;    // 40 Mbytes
00549                 // Put that size in a string formatted as a memory size value
00550                 BytesToString(&String, MaxUndoSize);
00551                 // Show that on the dialog box
00552                 pPrefsDlg->SetStringGadgetValue(_R(IDC_OPTS_MAXUNDOSIZE), &String);
00553             }
00554 #endif
00555             break;
00556         case DIM_SELECTION_CHANGED:
00557         case DIM_TEXT_CHANGED:
00558             OptionsTabs::SetApplyNowState(TRUE);
00559             break;
00560         default:
00561             break;
00562     }
00563 
00564     return TRUE;
00565 }  
00566 
00567 
00568 /******************************************************************************************
00569 
00570 >   BOOL UndoTab::InitSection()
00571 
00572     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00573     Created:    20/1/95
00574     Inputs:     -
00575     Outputs:    -
00576     Returns:    TRUE if successful, else FALSE
00577     Purpose:    Sets initial values for the Undo section of the options dialog box.
00578                 This section includes the:-
00579                 - Unlimited undo memory size switch
00580                 - OR maximum memory allowed for undo system 
00581     Errors:     -
00582     SeeAlso:    AppPrefsDlg; OptionsTabs;
00583 
00584 ******************************************************************************************/
00585 
00586 BOOL UndoTab::InitSection()
00587 {
00588 TRACEUSER( "Neville", _T("InitUndoSection\n"));
00589     ERROR2IF(pPrefsDlg == NULL,FALSE,"UndoTab::InitSection called with no dialog pointer");
00590 
00591 //  BOOL ReadOk = FALSE;    // Flag to say whether the preference value was read ok 
00592 
00593     // Make sure the information field displaying the name of the current document
00594     // is correct.
00595     String_256 *DocumentName = GetDocumentName();
00596     pPrefsDlg->SetStringGadgetValue(_R(IDC_OPTS_DOCUMENT), *DocumentName);
00597 
00598 
00599     // Section = Undo settings
00600 
00601     // Set up the display for the current size of the undo buffer.
00602     Document* pDocument = Document::GetSelected();
00603     if (pDocument != NULL)
00604     {
00605         // Get the current undo size
00606         UINT32 UndoSize = pDocument->GetOpHistory().GetSize();
00607         
00608         // Put that size in a string formatted as a memory size value
00609         // and show that on the dialog box
00610         pPrefsDlg->SetMemoryGadgetValue(_R(IDC_OPTS_UNDOSIZE), UndoSize);
00611 
00612         // Now get the currently set maximum size
00613         UINT32 MaxUndoSize = pDocument->GetOpHistory().GetMaxSize();
00614 
00615         // If set at the maximum size possible then assume unlimited
00616         BOOL Unlimited = FALSE;
00617         if (MaxUndoSize == UINT32_MAX)
00618             Unlimited = TRUE;
00619         else
00620             Unlimited = FALSE;
00621 
00622         // Put that size in a string formatted as a memory size value
00623         // and show that on the dialog box
00624         pPrefsDlg->SetMemoryGadgetValue(_R(IDC_OPTS_MAXUNDOSIZE), MaxUndoSize);
00625 
00626         // Set the unlimited switch state
00627         pPrefsDlg->SetLongGadgetValue(_R(IDC_OPTS_UNLIMITEDUNDO), Unlimited);
00628         
00629         // Grey or ungrey the editable field and its name text accordingly
00630         pPrefsDlg->EnableGadget(_R(IDC_OPTS_MAXUNDOTXT), !Unlimited);
00631         pPrefsDlg->EnableGadget(_R(IDC_OPTS_MAXUNDOSIZE), !Unlimited);
00632 
00633 TRACEUSER( "Neville", _T("undo size ='%d'\n"),UndoSize);
00634 TRACEUSER( "Neville", _T("max undo size ='%d'\n"),MaxUndoSize);
00635     }
00636     else
00637     {
00638         // Ensure our section is greyed
00639         GreySection();
00640     }
00641 
00642     return TRUE;
00643 }

Generated on Sat Nov 10 03:46:21 2007 for Camelot by  doxygen 1.4.4