optsplug.cpp

Go to the documentation of this file.
00001 // $Id: optsplug.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 // Implementation of the plug-in tab of the options dialog box
00099 
00100 /*
00101 
00102 */
00103 
00104 #include "camtypes.h"
00105 #include "appprefs.h"
00106 #include "optsplug.h"
00107 //#include "prefsdlg.h" // dialog/gadget ids
00108 //#include "optsres.h"  // error strings
00109 //#include "app.h"      // Camelot object - in camtypes.h [AUTOMATICALLY REMOVED]
00110 //#include "ollie.h"        // For _R(IDS_NO_WEB_UTILITY) and _R(IDS_NO_WEB_PAGE)
00111 //#include "resource.h" // For _R(IDS_OK)
00112 
00113 //#include "plugmngr.h" // PlugInManager
00114 #include "xpehost.h"
00115 //#include "urls.h"
00116 
00117 CC_IMPLEMENT_DYNAMIC(PlugInsTab, OptionsTabs)   
00118 
00119 // This is not compulsory, but you may as well put it in so that the correct version
00120 // of your file can be registered in the .exe
00121 DECLARE_SOURCE("$Revision: 1282 $");
00122 #define THIRTY_TWO 32
00123 
00124 /********************************************************************************************
00125 
00126 >   PlugInsTab::PlugInsTab() 
00127 
00128     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00129     Created:    12/12/96
00130     Inputs:     -
00131     Outputs:    -
00132     Returns:    -
00133     Purpose:    PlugInsTab constructor. Creates a non-undoable operation
00134     Errors:     -
00135     SeeAlso:    -
00136 
00137 ********************************************************************************************/
00138 
00139 PlugInsTab::PlugInsTab()
00140 {   
00141     // Set up our default states
00142     m_ChangedList = FALSE;
00143 }        
00144 
00145 /********************************************************************************************
00146 
00147 >   PlugInsTab::~PlugInsTab()
00148 
00149     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00150     Created:    12/12/96
00151     Inputs:     -
00152     Outputs:    -
00153     Returns:    -
00154     Purpose:    PlugInsTab destructor
00155     Errors:     -
00156     SeeAlso:    -
00157 
00158 ********************************************************************************************/
00159                                                                                 
00160 PlugInsTab::~PlugInsTab()
00161 {   
00162 }        
00163 
00164 /********************************************************************************************
00165 
00166 >   BOOL PlugInsTab::Init()
00167 
00168     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00169     Created:    12/12/96
00170     Inputs:     -
00171     Outputs:    -
00172     Returns:    True if initialised ok, False if failed.
00173     Purpose:    PlugInsTab initialisation routine
00174     Errors:     -
00175     SeeAlso:    -
00176 
00177 ********************************************************************************************/
00178                                                                                 
00179 BOOL PlugInsTab::Init()
00180 {   
00181 //  m_pManager = NULL;
00182 
00183     return TRUE;
00184 }        
00185 
00186 
00187 /******************************************************************************************
00188 
00189 >   CDlgResID PlugInsTab::GetPageID()()
00190 
00191     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00192     Created:    12/12/96
00193     Inputs:     -
00194     Outputs:    -
00195     Returns:    The dialog ID of this tab section.    
00196     Purpose:    Allows the options dialog code to determine the dialog ID of this section.
00197     Errors:     -
00198     SeeAlso:    -
00199 
00200 ******************************************************************************************/
00201 
00202 CDlgResID PlugInsTab::GetPageID()
00203 {
00204     return _R(IDD_OPTSTAB_PLUGINS);
00205 }
00206 
00207 /******************************************************************************************
00208 
00209 >   BOOL PlugInsTab::IsDocumentOption()
00210 
00211     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00212     Created:    12/12/96
00213     Inputs:     -
00214     Outputs:    -
00215     Returns:    Returns True if this tab is a document option.    
00216     Purpose:    Allows the document options dialog code to determine if this tab belongs
00217                 to the group of document options.
00218     Errors:     -
00219     SeeAlso:    IsProgramOption();
00220 
00221 ******************************************************************************************/
00222 
00223 BOOL PlugInsTab::IsDocumentOption()
00224 {
00225     return FALSE;   // This tab is not a document option 
00226 }
00227 
00228 /******************************************************************************************
00229 
00230 >   BOOL PlugInsTab::IsProgramOption()
00231 
00232     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00233     Created:    12/12/96
00234     Inputs:     -
00235     Outputs:    -
00236     Returns:    Returns True if this tab is a program option.     
00237     Purpose:    Allows the program options dialog code to determine if this tab belongs
00238                 to the group of program options.
00239     Errors:     -
00240     SeeAlso:    IsProgramOption();
00241 
00242 ******************************************************************************************/
00243 
00244 BOOL PlugInsTab::IsProgramOption()
00245 {
00246     return TRUE;    // This tab is a program option 
00247 }
00248 
00249 
00250 /******************************************************************************************
00251 
00252 >   BOOL AppPrefsDlg::CommitSection()
00253 
00254     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00255     Created:    12/12/96
00256     Inputs:     -
00257     Outputs:    -
00258     Returns:    True if values in dialog box ok, False otherwise.     
00259     Purpose:    Takes the values in the Units section tab of the options dialog box and
00260                 sets the associated preference values accordingly
00261                 Called when ok is pressed on the dialog box.
00262     Errors:     -
00263     SeeAlso:    -
00264 
00265 ******************************************************************************************/
00266 
00267 BOOL PlugInsTab::CommitSection()
00268 {
00269     ERROR2IF(pPrefsDlg == NULL,FALSE,"PlugInsTab::CommitSection called with no dialog pointer");
00270 
00271     BOOL ok = pPrefsDlg->TalkToPage(_R(IDD_OPTSTAB_PLUGINS));   // The units page identifier
00272     if (!ok)
00273         return TRUE;    // Talk to page failed to return now
00274 
00275     ok = CommitDialogValues();
00276 
00277     return ok;
00278 }
00279 
00280 /********************************************************************************************
00281 
00282 >   BOOL PlugInsTab::HandleMsg(DialogMsg* Msg)
00283 
00284     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00285     Created:    12/12/96
00286     Inputs:     -
00287     Outputs:    -
00288     Returns:    -
00289     Purpose:    Handles all the Plug-ins options tabs messages 
00290     Errors:     -
00291     SeeAlso:    -
00292 
00293 ********************************************************************************************/
00294 
00295 BOOL PlugInsTab::HandleMsg(DialogMsg* Msg)
00296 {
00297     ERROR2IF(Msg == NULL,FALSE,"PlugInsTab::Message null message received");
00298     ERROR2IF(pPrefsDlg == NULL,FALSE,"PlugInsTab::HandleMsg called with no dialog pointer");
00299 
00300     BOOL ok = pPrefsDlg->TalkToPage(_R(IDD_OPTSTAB_PLUGINS));   // The edit page identifier
00301     if (!ok)
00302         return TRUE;        // page not present
00303     
00304     switch(Msg->DlgMsg)
00305     {
00306         case DIM_CREATE:    // Initialise controls
00307 //          GreyStatus = FALSE; // we are ungreyed by default
00308             ok = InitSection();
00309             if (!ok)
00310                 InformError();
00311             break;
00312 
00313         case DIM_LFT_BN_CLICKED:
00314             OptionsTabs::SetApplyNowState(TRUE);
00315 //          ERROR2IF(m_pManager == NULL,FALSE,"PlugInsTab::HandleMsg called with no plug-ins manager pointer");
00316             switch (Msg->GadgetID)
00317             {
00318             case _R(IDC_OPTS_BUTTON_PLUGINS_SETUP):
00319                 BOOL bOK = XPEEditOp::EditPluginSettings();
00320                 break;
00321 /*              case _R(IDC_OPTS_NEWPATH):
00322                     // Create the user a new path
00323                     CreateNewPath();
00324                     break;
00325 
00326                 case _R(IDC_OPTS_BUYPLUGS):
00327                     // The user wishes to be relieved of money by buying plug-ins
00328                     BuyPluginsAction();
00329                     break;
00330 
00331                 case _R(IDC_OPTS_DELETEPATH):
00332                     // Delete the currently selected path
00333                     DeletePath();
00334                     break;
00335                 case _R(IDC_OPTS_PARSEATSTART):
00336                 {
00337                     BOOL Valid = FALSE;
00338                     BOOL ParseAtStartUp = pPrefsDlg->GetLongGadgetValue(_R(IDC_OPTS_PARSEATSTART), 0, 1, 0, &Valid);
00339                     if (Valid)
00340                         m_pManager->SetParseAtStartUp(ParseAtStartUp);
00341                     break;
00342                 }
00343 */
00344             }
00345             break; // DIM_LFT_BN_CLICKED
00346 
00347         case DIM_SELECTION_CHANGED:
00348         {
00349             OptionsTabs::SetApplyNowState(TRUE);
00350     
00351 /*          switch (Msg->GadgetID)
00352             {
00353                 case _R(IDC_OPTS_PLUGINSLIST):
00354                 {
00355                     // Clicked on the list of plug-in paths
00356                     // If its valid then ungrey the delete button
00357                     WORD Index = 0;
00358                     pPrefsDlg->GetValueIndex(_R(IDC_OPTS_PLUGINSLIST), &Index); 
00359                     BOOL Valid = FALSE;
00360                     BOOL ok = FALSE;
00361                     String_256 Path = pPrefsDlg->GetStringGadgetValue(_R(IDC_OPTS_PLUGINSLIST), &Valid, Index);
00362                     if (Valid && !Path.IsEmpty())
00363                     {
00364                         pPrefsDlg->EnableGadget(_R(IDC_OPTS_DELETEPATH), TRUE);
00365                     }
00366                     break;
00367                 }
00368             }
00369 */
00370             break; // DIM_SELECTION_CHANGED
00371         }
00372     }
00373 
00374     return TRUE;
00375 }  
00376 
00377 
00378 /********************************************************************************************
00379 
00380 >   BOOL PlugInsTab::CommitDialogValues()
00381 
00382     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00383     Created:    12/12/96
00384     Inputs:     - 
00385     Outputs:    -
00386     Returns:    -
00387     Purpose:    Takes the values in the dialog.
00388                 Called when the OK button is selected
00389     Errors:     -
00390     SeeAlso:    -
00391 
00392 ********************************************************************************************/
00393 
00394 BOOL PlugInsTab::CommitDialogValues()
00395 {
00396     ERROR2IF(pPrefsDlg == NULL,FALSE,"PlugInsTab::CommitDialogValues called with no dialog pointer");
00397 //  ERROR2IF(m_pManager == NULL,FALSE,"PlugInsTab::CommitDialogValues called with no plug-ins manager pointer");
00398 
00399     // All our settings should be up todate on the dialog box itself
00400     // All we need to do is rescan all of the plug-in paths available.
00401 
00402     // If we have changed our list changed flag then we should reparse the list of plug-ins for
00403     // these paths.
00404     BOOL ok = TRUE;
00405 //  if (m_ChangedList)
00406 //  {   
00407 //      ok = ok && m_pManager->DestroyPlugInsList();
00408 //      ok = ok && m_pManager->ParseAllPaths();
00409 //
00410 //      if (ok)
00411 //          m_ChangedList = FALSE;
00412 //  }
00413 
00414     BOOL SetOk = FALSE;
00415     INT32 State = 0;
00416     BOOL Valid = FALSE;
00417 
00418 /*  // Cacheing preferences
00419     State = pPrefsDlg->GetLongGadgetValue(_R(IDC_CHECK_CACHE_ENABLED), 0, 1, 0, &Valid);
00420     if (Valid)
00421         SetOk = Camelot.SetPrefValue(TEXT("Rendering"), TEXT("Cacheing"), &State);
00422 
00423 //  State = pPrefsDlg->GetLongGadgetValue(_R(IDC_EDIT_CACHE_SIZE), 1, 100, 0, &Valid);
00424     String_256 strCachePercent = pPrefsDlg->GetStringGadgetValue(_R(IDC_EDIT_CACHE_SIZE), &Valid);
00425     double dValue = 0;
00426     INT32 Pos = 0;
00427     INT32 iValue = 0;
00428     Convert::ReadNumber(&strCachePercent, &Pos, &dValue);   // Allow trailing chars
00429     if (Valid && dValue>=1 && dValue<=100)
00430         iValue = (INT32)dValue;
00431         SetOk = Camelot.SetPrefValue(TEXT("Cache"), TEXT("CacheRAMPercent"), &iValue);
00432 
00433     // Reset the cache size...
00434     CBitmapCache* pCache = Camelot.GetBitmapCache();
00435     if (pCache)
00436     {
00437         pCache->SetMaximumDataSize(pCache->CalcRecommendedMaximumDataSize());
00438         // If the new size if smaller than the old size, things will get
00439         // thrown out of the cache the next time any attempt is made to
00440         // store anything...
00441     }
00442 */
00443     // Effect resolution preferences
00444     INT32 dLiveResolution = pPrefsDlg->GetResDropListValue(_R(IDC_COMBO_LIVEEFFECT_RES), TRUE, &Valid);
00445     if (Valid)
00446         Camelot.SetPrefValue(TEXT("Effects"), TEXT("DefaultLivePixelsPerInch"), &dLiveResolution);
00447 
00448     INT32 dLockedResolution = pPrefsDlg->GetResDropListValue(_R(IDC_COMBO_LOCKEDEFFECT_RES), FALSE, &Valid);
00449     if (Valid)
00450         Camelot.SetPrefValue(TEXT("Effects"), TEXT("DefaultLockedPixelsPerInch"), &dLockedResolution);
00451 
00452     State = pPrefsDlg->GetLongGadgetValue(_R(IDC_CHECK_NEW_EFFECTS_LOCKED), 0, 1, 0, &Valid);
00453     SetOk = Camelot.SetPrefValue(TEXT("Effects"), TEXT("DefaultLocked"), &State);
00454 
00455     return ok;
00456 }
00457 
00458 /********************************************************************************************
00459 
00460 >   BOOL PlugInsTab::CreateNewPath()
00461 
00462     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00463     Created:    12/12/96
00464     Inputs:     - 
00465     Outputs:    -
00466     Returns:    -
00467     Purpose:    Creates a new path that the user has just requested.
00468     Errors:     -
00469     SeeAlso:    -
00470 
00471 ********************************************************************************************/
00472 /*
00473 BOOL PlugInsTab::CreateNewPath()
00474 {
00475     ERROR2IF(m_pManager == NULL,FALSE,"PlugInsTab::CreateNewPath called with no plug-ins manager pointer");
00476     
00477     PathName NewSearchPath;
00478     BOOL ok = m_pManager->GetPlugInPath( &NewSearchPath );
00479     if (ok)
00480     {
00481         ok = m_pManager->AddPlugInPath(NewSearchPath);
00482 
00483         // Now update the list of available pathnames
00484         // Do it the hard way to ensure we are in sync with the plug-in manager's list
00485         pPrefsDlg->DeleteAllValues(_R(IDC_OPTS_PLUGINSLIST));
00486         BOOL ok = ShowPathDetails();
00487 
00488         // Flag that we have changed the list so we should reparse it.
00489         m_ChangedList = TRUE;
00490     }
00491     
00492     return ok;
00493 }
00494 */
00495 /********************************************************************************************
00496 
00497 >   BOOL PlugInsTab::DeletePath()
00498 
00499     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00500     Created:    12/12/96
00501     Inputs:     - 
00502     Outputs:    -
00503     Returns:    -
00504     Purpose:    Deletes the currently selected path.
00505     Errors:     -
00506     SeeAlso:    -
00507 
00508 ********************************************************************************************/
00509 /*
00510 BOOL PlugInsTab::DeletePath()
00511 {
00512     ERROR2IF(m_pManager == NULL,FALSE,"PlugInsTab::DeleteUnit called with no plug-ins manager pointer");
00513 
00514     // Get the currently selected item, if its valid then delete it
00515     WORD Index = 0;
00516     pPrefsDlg->GetValueIndex(_R(IDC_OPTS_PLUGINSLIST), &Index);
00517     BOOL Valid = FALSE;
00518     BOOL ok = FALSE;
00519     String_256 Path = pPrefsDlg->GetStringGadgetValue(_R(IDC_OPTS_PLUGINSLIST), &Valid, Index);
00520     PathName OldPath(Path);
00521     if (Valid)
00522     {
00523         ok = m_pManager->DeletePlugInPath(OldPath);
00524         // Now update the list of available pathnames
00525         // Do it the hard way to ensure we are in sync with the plug-in manager's list
00526         pPrefsDlg->DeleteAllValues(_R(IDC_OPTS_PLUGINSLIST));
00527         ok = ShowPathDetails();
00528 
00529         // Flag that we have changed the list so we should reparse it.
00530         m_ChangedList = TRUE;
00531     }
00532 
00533     return ok;
00534 }
00535 */
00536 
00537 /******************************************************************************************************************
00538 
00539 >   void PlugInsTab::BuyPluginsAction() 
00540 
00541     Author:     Priestley (Xara Group Ltd) <camelotdev@xara.com>
00542     Created:    12/09/2000
00543     Inputs:     
00544     Outputs:    
00545     Returns     
00546     Purpose:    Provides access from the 'Buy Plugins' button to Xara's plugin pages.
00547     Errors      If the browser could not be opened, an Error message box is diplayed.
00548     See Also    ~ adapted from Ranbir's HelpXaraNewsAction() ~
00549 
00550 ******************************************************************************************************************/
00551 /*
00552 void PlugInsTab::BuyPluginsAction() 
00553 {
00554     // Opens the default Browser on Xara's Plug-ins Page
00555     String_256 lpURL(_R(IDS_URL_PLUGINS));
00556     HINSTANCE hChild = ShellExecute(HWND_DESKTOP, "open", (TCHAR*)lpURL, NULL, NULL ,SW_SHOW);
00557 
00558     // If the function (ShellExecute()) fails, then an error value that is less than or equal to 32 is returned. 
00559     if ( (INT32)hChild <= THIRTY_TWO )
00560     {
00561         switch ( (INT32)hChild )
00562         {
00563             case    ERROR_FILE_NOT_FOUND:
00564             case    ERROR_PATH_NOT_FOUND: 
00565             case    SE_ERR_ACCESSDENIED:
00566             case    SE_ERR_ASSOCINCOMPLETE:
00567             {
00568                 InformError(_R(IDS_NO_WEB_UTILITY),_R(IDS_OK));
00569             }
00570             break;
00571             default:
00572             {
00573                 InformError(_R(IDS_NO_WEB_PAGE),_R(IDS_OK));
00574             }
00575             break;
00576         }
00577     }
00578 }
00579 */
00580 
00581 
00582 /********************************************************************************************
00583 
00584 >   BOOL PlugInsTab::InitControls()
00585 
00586     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00587     Created:    12/12/96
00588     Inputs:     -
00589     Outputs:    -
00590     Returns:    -
00591     Purpose:    Inits all the controls in the dialog
00592                 Called immediately after the bar is created to init drop lists, grey
00593                 out gadgets, etc.
00594     SeeAlso:    -
00595 
00596 ********************************************************************************************/
00597 
00598 BOOL PlugInsTab::InitControls()
00599 {
00600 //  ERROR2IF(m_pManager == NULL,FALSE,"PlugInsTab::InitControls called with no plug-ins manager pointer");
00601 
00602     EnableControls();
00603 
00604     return TRUE;
00605 }
00606 /********************************************************************************************
00607 
00608 >   BOOL PlugInsTab::EnableControls()
00609 
00610     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00611     Created:    12/12/96
00612     Inputs:     -
00613     Outputs:    -
00614     Returns:    -
00615     Purpose:    Enables or disables the controls depending on the current context, i.e.
00616                 the controls are disabled if there is no selection, etc.
00617     SeeAlso:    -
00618 
00619 ********************************************************************************************/
00620 
00621 BOOL PlugInsTab::EnableControls()
00622 {
00623     ERROR2IF(pPrefsDlg == NULL,FALSE,"PlugInsTab::EnableControls called with no dialog pointer");
00624 //  ERROR2IF(m_pManager == NULL,FALSE,"PlugInsTab::EnableControls called with no plug-ins manager pointer");
00625 
00626     BOOL enable = FALSE; //(pDocUnitList->FindFirstUserUnit() != NULL);
00627 
00628     pPrefsDlg->EnableGadget(_R(IDC_OPTS_BUTTON_PLUGINS_SETUP),  enable);
00629 /*  pPrefsDlg->EnableGadget(_R(IDC_OPTS_DELETEPATH),    enable);
00630     pPrefsDlg->EnableGadget(_R(IDC_OPTS_BUYPLUGS),      enable);
00631     pPrefsDlg->EnableGadget(_R(IDC_OPTS_NEWPATH),       enable);
00632 */
00633     return TRUE;
00634 }           
00635 
00636 
00637 /******************************************************************************************
00638 
00639 >   BOOL PlugInsTab::ShowPathDetails()
00640 
00641     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00642     Created:    12/12/96
00643     Inputs:     -
00644     Outputs:    -
00645     Returns:    TRUE if successful, else FALSE
00646     Purpose:    Shows the list of pathnames in the list control.
00647     Errors:     -
00648     SeeAlso:    -
00649 
00650 ******************************************************************************************/
00651 /*
00652 BOOL PlugInsTab::ShowPathDetails()
00653 {
00654     ERROR2IF(pPrefsDlg == NULL,FALSE,"PlugInsTab::ShowPathDetails called with no dialog pointer");
00655     // Go through the list of pathnames stored in the plug-in manager
00656     // and show these on our list control
00657     String_256 Details;
00658     BOOL EndOfList = FALSE;
00659     INT32 Index = 0;
00660     PlugInPath * pPath = m_pManager->GetFirstPathName();
00661     while (pPath)
00662     {
00663         Details = pPath->GetPathNameAsString();
00664         pPrefsDlg->SetStringGadgetValue(_R(IDC_OPTS_PLUGINSLIST), &Details, EndOfList, Index);
00665         Index++;
00666         pPath = m_pManager->GetNextPathName(pPath);
00667     }
00668 
00669     return TRUE;
00670 }
00671 */
00672 /******************************************************************************************
00673 
00674 >   BOOL PlugInsTab::InitSection()
00675 
00676     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00677     Created:    12/12/96
00678     Inputs:     -
00679     Outputs:    -
00680     Returns:    TRUE if successful, else FALSE
00681     Purpose:    Sets initial values for the Plug-ins section of the options dialog box.
00682                 This section includes the:-
00683     Errors:     -
00684     SeeAlso:    -
00685 
00686 ******************************************************************************************/
00687 
00688 BOOL PlugInsTab::InitSection()
00689 {
00690     ERROR2IF(pPrefsDlg == NULL,FALSE,"PlugInsTab::InitSection called with no dialog pointer");
00691 
00692 /*  // Search the pathnames list in the plug-in manager
00693     m_pManager = GetApplication()->GetPlugInManager();
00694     ERROR2IF(m_pManager == NULL,FALSE,"PlugInsTab::InitSection no plug-ins manager");
00695 
00696     pPrefsDlg->DeleteAllValues(_R(IDC_OPTS_PLUGINSLIST));
00697     BOOL ok = ShowPathDetails();
00698 
00699     BOOL ParseAtStartUp = m_pManager->GetParseAtStartUp();
00700     pPrefsDlg->SetLongGadgetValue(_R(IDC_OPTS_PARSEATSTART), ParseAtStartUp);
00701 
00702     pPrefsDlg->EnableGadget(_R(IDC_OPTS_DELETEPATH),    FALSE);
00703     pPrefsDlg->EnableGadget(_R(IDC_OPTS_BUYPLUGS),      TRUE);
00704     pPrefsDlg->EnableGadget(_R(IDC_OPTS_NEWPATH),       TRUE);
00705 */          
00706     BOOL ok = TRUE;
00707     pPrefsDlg->EnableGadget(_R(IDC_OPTS_BUTTON_PLUGINS_SETUP),      TRUE);
00708 
00709     INT32 iLiveRes = 0;
00710     Camelot.GetPrefValue(TEXT("Effects"), TEXT("DefaultLivePixelsPerInch"), &iLiveRes);
00711     pPrefsDlg->BuildResDropList(_R(IDC_COMBO_LIVEEFFECT_RES), TRUE, TRUE, -1);
00712     pPrefsDlg->SetResDropListValue(_R(IDC_COMBO_LIVEEFFECT_RES), TRUE, iLiveRes);
00713 
00714     INT32 iLockedRes = 0;
00715     Camelot.GetPrefValue(TEXT("Effects"), TEXT("DefaultLockedPixelsPerInch"), &iLockedRes);
00716     pPrefsDlg->BuildResDropList(_R(IDC_COMBO_LOCKEDEFFECT_RES), FALSE, TRUE, -1);
00717     pPrefsDlg->SetResDropListValue(_R(IDC_COMBO_LOCKEDEFFECT_RES), FALSE, iLockedRes);
00718 
00719     BOOL bDefaultLocked = FALSE;
00720     Camelot.GetPrefValue(TEXT("Effects"), TEXT("DefaultLocked"), &bDefaultLocked);
00721     pPrefsDlg->SetBoolGadgetSelected(_R(IDC_CHECK_NEW_EFFECTS_LOCKED), bDefaultLocked);
00722 
00723 
00724 /*  BOOL bCacheingEnabled = FALSE;
00725     Camelot.GetPrefValue(TEXT("Rendering"), TEXT("Cacheing"), &bCacheingEnabled);
00726     pPrefsDlg->SetBoolGadgetSelected(_R(IDC_CHECK_CACHE_ENABLED), bCacheingEnabled);
00727 
00728     INT32 iCacheRAMPercent = 0;
00729     Camelot.GetPrefValue(TEXT("Cache"), TEXT("CacheRAMPercent"), &iCacheRAMPercent);
00730 //  pPrefsDlg->SetLongGadgetValue(_R(IDC_EDIT_CACHE_SIZE), iCacheRAMPercent);               // TODO: Should be percentage
00731     TCHAR Str[32];
00732     String_32 temp(_R(IDS_PERCENT_FORMAT));
00733     wsprintf(Str, temp, iCacheRAMPercent);
00734     String_32 PercentStr(Str);
00735     pPrefsDlg->SetStringGadgetValue(_R(IDC_EDIT_CACHE_SIZE), &PercentStr);
00736 
00737     CBitmapCache* pCache = GetApplication()->GetBitmapCache();
00738     if (pCache)
00739     {
00740         INT32 iCacheUsagePercent = ((UINT64)pCache->GetCurrentDataSize()*100)/pCache->GetMaximumDataSize();
00741 //      pPrefsDlg->SetLongGadgetValue(_R(IDC_EDIT_CURRENTCACHE), iCacheUsagePercent);       // TODO: Should be percentage
00742         TCHAR Str[32];
00743         String_32 temp(_R(IDS_PERCENT_FORMAT));
00744         wsprintf(Str, temp, iCacheUsagePercent);
00745         String_32 PercentStr(Str);
00746         pPrefsDlg->SetStringGadgetValue(_R(IDC_EDIT_CURRENTCACHE), &PercentStr);
00747 
00748 //      pPrefsDlg->SetLongGadgetValue(_R(IDC_PROGRESS_CACHEUSAGE), iCacheUsagePercent);     // TODO: Should be percentage
00749     }
00750 */
00751     return ok;
00752 }

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