property.cpp

Go to the documentation of this file.
00001 // $Id: property.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 // Property.cpp
00100 //
00101 // This file implements the basic useful functionality to implement a property tab.
00102 // This will be basically a tabbed dialog box but this linked list handles a lot
00103 // of the mundane work required to handle a MODELESS property tabbed dialog box.
00104 //
00105 // Curent users of this system are:-
00106 // - The layer roperties dialog box. Brought up from the layer gallery menu item.
00107 
00108 /*
00109 */
00110 
00111 #include "camtypes.h"
00112 //#include "document.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00113 //#include "spread.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00114 //#include "docview.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00115 #include "property.h"
00116 
00117 //#include "dialogop.h" // DialogOp header - in camtypes.h [AUTOMATICALLY REMOVED]
00118 //#include "nev.h"      // error strings
00119 
00120 #include "layerprp.h"
00121 //#include "lyrprop.h"  // tabs for the layer properties
00122 
00123 // The property tabs themselves
00124 #include "prpslyrs.h"   // Layer properties tab handler
00125 #include "prpsgds.h"    // Guides properties tab handler
00126 
00127 //#include "will.h"     // _R(IDS_CLOSEDOCS)
00128 //#include "resource.h" // _R(IDS_CANCEL)
00129 
00130 // This is not compulsory, but you may as well put it in so that the correct version
00131 // of your file can be registered in the .exe
00132 DECLARE_SOURCE("$Revision: 1282 $");
00133 
00134 // An implement to match the Declare in the .h file.
00135 // If you have many classes, it is recommended to place them all together, here at the start of the file
00136 CC_IMPLEMENT_DYNAMIC(PropertyTabs, ListItem)
00137 
00138 // This will get Camelot to display the filename and linenumber of any memory allocations
00139 // that are not released at program exit
00140 #define new CAM_DEBUG_NEW
00141 
00142 UnitType    PropertyTabs::CurrentPageUnits  = NOTYPE;   // The units used to display page measurements in
00143 
00144 Document    *PropertyTabs::pScopeDocument   = NULL;     // Pointer to the current document
00145 Document    *PropertyTabs::pDocument        = NULL;     // Document we are supposed to be working on
00146 Spread      *PropertyTabs::pSpread          = NULL;     // Spread we are supposed to be working on
00147 Layer       *PropertyTabs::pActiveLayer     = NULL;     // Layer we are supposed to be working on
00148 Layer       *PropertyTabs::pCurrentLayer    = NULL;     // Layer we are supposed to be working on
00149 
00150 //List      PropertyTabs::PropertyTabsList;             // The global list of installed options tabs.
00151 
00152 /******************************************************************************************
00153 ******************************************************************************************/
00154 
00155 // Code to handle a list of options tabs available to the system
00156 
00157 /********************************************************************************************
00158 
00159 >   PropertyTabs::PropertyTabs()
00160 
00161     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00162     Created:    28/9/95
00163     Purpose:    Constructor.
00164     Errors:
00165     SeeAlso:    PropertyTabsDlg;
00166 
00167 ********************************************************************************************/
00168 
00169 PropertyTabs::PropertyTabs()
00170 {
00171     // Set up some good default values.
00172 //  pScopeDocument      = NULL;
00173 //  pDocument           = NULL;
00174 //  pSpread             = NULL;
00175 //  CurrentPageUnits    = NOTYPE; 
00176 //  pActiveLayer        = NULL;
00177 //  pCurrentLayer       = NULL;
00178 }
00179 
00180 
00181 /********************************************************************************************
00182 
00183 >   PropertyTabs::Init()
00184 
00185     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00186     Created:    28/9/95
00187     Purpose:    Initialiser.
00188     Errors:
00189     SeeAlso:    PropertyTabsDlg;
00190 
00191 ********************************************************************************************/
00192 
00193 BOOL PropertyTabs::Init()
00194 {
00195     // Do nothing for now.
00196     return TRUE;
00197 }
00198 
00199 
00200 
00201 //********************************************************************************************
00202 //
00203 //> static BOOL PropertyTabs::DeclarePropertyTab(PropertyTabs *pProperty)
00204 //
00205 //  Author:     Neville
00206 //  Created:    5/12/95
00207 //  Inputs:     A pointer to a new PropertyTabs class already declared into the system
00208 //  Returns:    True if tab declared, False if something went wrong. 
00209 //  Purpose:    A function to declare a new tab to the system.
00210 //  SeeAlso:    LayerProperty
00211 //
00212 //********************************************************************************************/
00213 //
00214 //BOOL PropertyTabs::DeclarePropertyTab(PropertyTabs *pProperty)
00215 //{
00216 //  // First check to see if somebody has actually declared the pointer to be non null.
00217 //  if (pProperty == NULL) return FALSE;
00218 //
00219 //  if (!pProperty->Init())
00220 //  {
00221 //      /* Error occured - report it and stop trying to initialise the options tab. */
00222 //      InformError();
00223 //      return TRUE;
00224 //  }
00225 //  PropertyTabsList.AddTail(pProperty);
00226 //  
00227 //  // All ok
00228 //  return TRUE;
00229 //}
00230 //
00231 //********************************************************************************************
00232 //
00233 //> static BOOL PropertyTabs::UndeclarePropertyTab(PropertyTabs *pProperty)
00234 //
00235 //  Author:     Neville
00236 //  Created:    5/12/95
00237 //  Inputs:     A pointer to a new PropertyTabs class already declared into the system
00238 //  Returns:    True if tab declared, False if something went wrong. 
00239 //  Purpose:    A function to remove a tab handler that has been declared to the system.
00240 //  SeeAlso:    LayerProperty
00241 //
00242 //********************************************************************************************/
00243 //
00244 //BOOL PropertyTabs::UndeclarePropertyTab(PropertyTabs *pProperty)
00245 //{
00246 //  // First check to see if somebody has actually declared the pointer to be non null.
00247 //  if (pProperty == NULL) return FALSE;
00248 //
00249 //  BOOL Found = FALSE;
00250 //  PropertyTabs * pProps = PropertyTabs::GetFirst();
00251 //  while (pProps && !Found)
00252 //  {
00253 //      if (pProps == pProperty)
00254 //      {
00255 //          // First remove from the list
00256 //          PropertyTabsList.RemoveItem(pProperty);
00257 //          // Do not delete the class itself, as this list just stores the fact that
00258 //          // this property tab is around.
00259 //          pProps = NULL;
00260 //
00261 //          // Flag, we have done as required and deleted the item
00262 //          Found = TRUE;
00263 //      }
00264 //      else
00265 //          pProps = PropertyTabs::GetNext(pProps);
00266 //  }
00267 //
00268 //  ERROR3IF(!Found,"PropertyTabs::UndeclarePropertyTab tab not found");
00269 //  
00270 //  // All ok
00271 //  return TRUE;
00272 //}
00273 //
00274 //********************************************************************************************
00275 //
00276 //> static PropertyTabs *PropertyTabs::GetFirst()
00277 //
00278 //  Author:     Neville
00279 //  Created:    28/9/95
00280 //  Returns:    Pointer to the first PropertyTab, or NULL if none.
00281 //  Purpose:    Iterating through the list of PropertyTabs known to Camelot.  This function
00282 //              returns the first PropertyTabs.
00283 //  SeeAlso:    PropertyTabs::GetNext()
00284 //  Scope:      Static
00285 //
00286 //********************************************************************************************/
00287 //
00288 //PropertyTabs *PropertyTabs::GetFirst()
00289 //{
00290 //  return (PropertyTabs *) PropertyTabsList.GetHead();
00291 //}
00292 //
00293 //********************************************************************************************
00294 //
00295 //> static PropertyTabs *PropertyTabs::GetNext(PropertyTabs *pPropertyTabs)
00296 //
00297 //  Author:     Neville
00298 //  Created:    5/12/95
00299 //  Inputs:     pPropertyTabs - pointer to the PropertyTabs to be used to get the following
00300 //              PropertyTabs.
00301 //  Returns:    Pointer to the next PropertyTabs, or NULL if none.
00302 //  Purpose:    Iterating through the list of PropertyTabs known to Camelot.  This function
00303 //              returns the next PropertyTabs.
00304 //  SeeAlso:    PropertyTabs::GetFirst
00305 //
00306 //********************************************************************************************/
00307 //
00308 //PropertyTabs *PropertyTabs::GetNext(PropertyTabs *pPropertyTabs)
00309 //{
00310 //  return (PropertyTabs *) PropertyTabsList.GetNext(pPropertyTabs);
00311 //}
00312 
00313 
00314 
00315 /******************************************************************************************
00316 
00317 >   virtual void PropertyTabs::SetDefaultUnits()
00318 
00319     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00320     Created:    28/9/95
00321     Inputs:     -
00322     Outputs:    -
00323     Returns:    -
00324     Purpose:    Sets up the units class variables to the default values. 
00325     Errors:     -
00326     SeeAlso:    SetUpDocUnits;
00327 
00328 ******************************************************************************************/
00329 void PropertyTabs::SetDefaultUnits()
00330 {
00331     // Just to be on the safe side set up some default values 
00332     CurrentPageUnits = MILLIMETRES;         // Set up random default units.
00333 }
00334 
00335 /******************************************************************************************
00336 
00337 >   virtual void PropertyTabs::SetUpDocUnits()
00338 
00339     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00340     Created:    28/9/95
00341     Inputs:     -
00342     Outputs:    -
00343     Returns:    TRUE if set up ok, FALSE otherwise.
00344     Purpose:    Sets up the units variable to the currently set document units 
00345     Errors:     -
00346     SeeAlso:    SetDefaultUnits;
00347 
00348 ******************************************************************************************/
00349 
00350 BOOL PropertyTabs::SetUpDocUnits()
00351 {
00352     BOOL SetUpOk = FALSE; 
00353 
00354     // Set up the default document measurement units that are used
00355     // Get the page units from the doc unit list of the current document unless there
00356     // is no document present.
00357     // Otherwise just pick a random default.
00358     pDocument = Document::GetSelected();
00359     if (pDocument == NULL)
00360     {
00361         // Just to be on the safe side set up some default values 
00362         CurrentPageUnits = MILLIMETRES;                     
00363     }
00364     else
00365     {
00366         // Get the unit list attached to the current document
00367         DocUnitList* pDocUnitList = pDocument->GetDocUnitList();
00368         ERROR3IF(pDocUnitList == NULL,"PropertyTabs::SetUpDocUnits No doc unit list attached to this doc yet");
00369     
00370         if (pDocUnitList != NULL)
00371         {
00372             CurrentPageUnits = pDocUnitList->GetPageUnits();    // Set to the page units.
00373         
00374             // Flag that everything went ok
00375             SetUpOk = TRUE; 
00376         }
00377         else
00378         {
00379             // Just to be on the safe side set up some default values 
00380             CurrentPageUnits = MILLIMETRES;                     // Set up random default units.
00381         }
00382     }
00383 
00384     return (SetUpOk);
00385 }
00386 
00387 /********************************************************************************************
00388 
00389 >   virtual void PropertyTabs::SetCurrentDocAndSpread(const Document *pDoc)
00390 
00391     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00392     Created:    28/9/95
00393     Inputs:     Pointer to the document to use, can be NULL of course.
00394     Outputs:    -
00395     Returns:    - 
00396     Purpose:    Sets up the document and spread that we are currently supposed to be working on.
00397                 This can then be used by the tabs instead of each one using their own method
00398                 to work it out.
00399     Errors:     -
00400     SeeAlso:    -
00401 
00402 ********************************************************************************************/
00403 
00404 void PropertyTabs::SetCurrentDocAndSpread(Document *pDoc)
00405 {
00406     // Note this new document in our class variable.
00407     pDocument = pDoc;
00408 
00409     // Set up what we consider to be the current spread using the current document
00410     // class variable. 
00411     if (pDocument)
00412     {
00413         pSpread = pDocument->FindFirstSpread();
00414         // We will get the active layer of this spread
00415         if (pSpread)
00416             pActiveLayer = pSpread->FindActiveLayer();      
00417     }
00418     else
00419     {
00420         pSpread = NULL;
00421         pActiveLayer = NULL;    
00422     }
00423     
00424 }   
00425 
00426 /********************************************************************************************
00427 
00428 >   virtual void PropertyTabs::SetActiveLayer(Layer * pNewLayer)
00429 
00430     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00431     Created:    3/10/95
00432     Inputs:     Pointer to the new active layer to use, can be NULL of course.
00433     Outputs:    -
00434     Returns:    - 
00435     Purpose:    Sets up the active layer that we are currently supposed to be working on.
00436                 This can then be used by the tabs instead of each one using their own method
00437                 to work it out.
00438                 This may be different to a current layer used by say the layer properties tab
00439                 as this will be the one that the layer properties tabbed dialog box was
00440                 brought up over using the adjust click menu on the layer gallery.
00441     Errors:     -
00442     SeeAlso:    PropertyTabs::GetActiveLayer; LayerPropertyTabs::GetCurrentLayer;
00443 
00444 ********************************************************************************************/
00445 
00446 void PropertyTabs::SetActiveLayer(Layer * pNewLayer)
00447 {
00448     pActiveLayer = pNewLayer;   
00449 }
00450 
00451 /********************************************************************************************
00452 
00453 >   virtual Layer * PropertyTabs::GetActiveLayer()
00454 
00455     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00456     Created:    3/10/95
00457     Returns:    A pointer to the current layer that should be used.
00458     Purpose:    Sets up the layer that we are currently supposed to be working on.
00459                 This can then be used by the tabs instead of each one using their own method
00460                 to work it out.
00461                 This may be different to a current layer used by say the layer properties tab
00462                 as this will be the one that the layer properties tabbed dialog box was
00463                 brought up over using the adjust click menu on the layer gallery.
00464     Errors:     -
00465     SeeAlso:    PropertyTabs::SetActiveLayer; LayerPropertyTabs::SetCurrentLayer;
00466 
00467 ********************************************************************************************/
00468 Layer * PropertyTabs::GetActiveLayer()
00469 {
00470     return pActiveLayer;        
00471 }
00472     
00473 /********************************************************************************************
00474 
00475 >   virtual Layer * PropertyTabs::GetGuideLayer()
00476 
00477     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
00478     Created:    5/10/95
00479     Returns:    A pointer to the guide layer of the associated spread, or NULL
00480     Purpose:    Returns ptr to the guide layer to use, or NULL if it can't find one
00481     Errors:     -
00482     SeeAlso:    -
00483 
00484 ********************************************************************************************/
00485 
00486 Layer * PropertyTabs::GetGuideLayer()
00487 {
00488     if (pSpread != NULL)
00489         return (pSpread->FindFirstGuideLayer());
00490 
00491     return NULL;        
00492 }
00493     
00494 
00495 /******************************************************************************************
00496 
00497 >   virtual BOOL PropertyTabs::GreyApplyNow()
00498 
00499     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00500     Created:    28/9/95
00501     Inputs:     -
00502     Outputs:    -
00503     Returns:    TRUE if successful, else FALSE
00504     Purpose:    Makes the Apply Now button on the main page of the tabbed dialog grey. 
00505     Errors:     -
00506     SeeAlso:    -
00507 
00508 ******************************************************************************************/
00509 
00510 BOOL PropertyTabs::GreyApplyNow()
00511 {
00512     // First, get a pointer to the dialog box that we are going to use
00513     DialogTabOp * pPropertiesDlg = GetTabbedDlg();
00514     ERROR2IF(pPropertiesDlg == NULL, FALSE, "LayerPropertyTabs::GreyApplyNow called with no dialog pointer");
00515 
00516     // Grey out the apply now button on the main page
00517     // Must restore the state of the currently selected tab as otherwise you might start
00518     // switching to talking to the main page when we are in the middle of talking to controls
00519     // on one of the pages and hence give rise to unknown controls messages when we try to
00520     // talk to the pages controls again.
00521     CDlgResID PageID = pPropertiesDlg->GetCurrentPageID();  // Get currently selected Tab id
00522     pPropertiesDlg->TalkToPage(0);
00523 
00524     pPropertiesDlg->EnableGadget(_R(ID_APPLY_NOW), FALSE);
00525     pPropertiesDlg->EnableGadget(_R(wxID_OK), FALSE);
00526     pPropertiesDlg->SetStringGadgetValue(_R(wxID_CANCEL),_R(IDS_CLOSEDOCS));
00527 
00528     pPropertiesDlg->TalkToPage(PageID);                     // Select the originally selected tab
00529 
00530     return TRUE;
00531 }
00532 
00533 /******************************************************************************************
00534 
00535 >   virtual BOOL PropertyTabs::UngreyApplyNow()
00536 
00537     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00538     Created:    28/9/95
00539     Inputs:     -
00540     Outputs:    -
00541     Returns:    TRUE if successful, else FALSE
00542     Purpose:    Makes the Apply Now button on the main page of the tabbed dialog ungrey. 
00543     Errors:     -
00544     SeeAlso:    -
00545 
00546 ******************************************************************************************/
00547 
00548 BOOL PropertyTabs::UngreyApplyNow()
00549 {
00550     // First, get a pointer to the dialog box that we are going to use
00551     DialogTabOp * pPropertiesDlg = GetTabbedDlg();
00552     ERROR2IF(pPropertiesDlg == NULL,FALSE,"LayerPropertyTabs::UngreyApplyNow called with no dialog pointer");
00553     
00554     // Ungrey the apply now button on the main page
00555     // Must restore the state of the currently selected tab as otherwise you might start
00556     // switching to talking to the main page when we are in the middle of talking to controls
00557     // on one of the pages and hence give rise to unknown controls messages when we try to
00558     // talk to the pages controls again.
00559     CDlgResID PageID = pPropertiesDlg->GetCurrentPageID();  // Get currently selected Tab id
00560     pPropertiesDlg->TalkToPage(0);                      // Select the main tab
00561 
00562     pPropertiesDlg->EnableGadget(_R(ID_APPLY_NOW), TRUE);       // ungrey button on main tab
00563     pPropertiesDlg->EnableGadget(_R(wxID_OK), TRUE);
00564     pPropertiesDlg->SetStringGadgetValue(_R(wxID_CANCEL),_R(IDS_CANCEL));
00565 
00566     pPropertiesDlg->TalkToPage(PageID);                     // Select the originally selected tab
00567 
00568     return TRUE;
00569 }
00570 
00571 
00572 /******************************************************************************************
00573 
00574 >   virtual BOOL PropertyTabs::NewUnitsInSection()
00575 
00576     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00577     Created:    28/9/95
00578     Inputs:     -
00579     Outputs:    -
00580     Returns:    TRUE if successful, else FALSE
00581     Purpose:    Called when new default units chosen. Gives any tabbed dialog a chance to
00582                 update any fields with new units in.
00583                 This is the base class version and so will be used for any tabs which have
00584                 no specified handling code. 
00585     Errors:     -
00586     SeeAlso:    -
00587 
00588 ******************************************************************************************/
00589 
00590 BOOL PropertyTabs::NewUnitsInSection()
00591 {
00592     // Called when new default units chosen
00593     // Would normally be overriden by a a particular tab
00594     return TRUE;
00595 }
00596 
00597 /******************************************************************************************
00598 
00599 >   BOOL virtual PropertyTabs::GreySection()
00600 
00601     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00602     Created:    28/9/95
00603     Inputs:     -
00604     Outputs:    -
00605     Returns:    TRUE if successful, else FALSE
00606     Purpose:    Called when the user has closed all documents. Gives any tabbed dialog a
00607                 chance to grey any fields which are document specific.
00608                 This is the base class version and so will be used for any tabs which have
00609                 no specified handling code.  
00610     Errors:     -
00611     SeeAlso:    PropertyTabs::UngreySection(); PropertyTabs::UpdateSection();
00612 
00613 ******************************************************************************************/
00614 
00615 BOOL PropertyTabs::GreySection()
00616 {
00617     // Called when the user has closed all documents
00618     // Would normally be overriden by a a particular tab
00619     return TRUE;
00620 }
00621 
00622 /******************************************************************************************
00623 
00624 >   virtual BOOL PropertyTabs::UngreySection()
00625 
00626     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00627     Created:    28/9/95
00628     Inputs:     -
00629     Outputs:    -
00630     Returns:    TRUE if successful, else FALSE
00631     Purpose:    Called when the user has opened a document. Gives any tabbed dialog a
00632                 chance to update any fields which may have been greyed when the last
00633                 document was closed.
00634                 This is the base class version and so will be used for any tabs which have
00635                 no specified handling code.   
00636     Errors:     -
00637     SeeAlso:     PropertyTabs::GreySection(); PropertyTabs::UpdateSection();
00638 
00639 ******************************************************************************************/
00640 
00641 BOOL PropertyTabs::UngreySection()
00642 {
00643     // Called when the user has opened a document
00644     // Would normally be overriden by a a particular tab
00645     return TRUE;
00646 }
00647 
00648 /******************************************************************************************
00649 
00650 >   virtual BOOL PropertyTabs::UpdateSection()
00651 
00652     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00653     Created:    28/9/95
00654     Returns:    TRUE if successful, else FALSE
00655     Purpose:    Called when the user has clicked on a new document or opened a new document.
00656                 Gives any tabbed dialog a chance to update any fields which are used to
00657                 reflect the current document's status.
00658                 This is the base class version and so will be used for any tabs which have
00659                 no specified handling code.   
00660     Errors:     -
00661     SeeAlso:    PropertyTabs::UngreySection(); PropertyTabs::GreySection();
00662 
00663 ******************************************************************************************/
00664 
00665 BOOL PropertyTabs::UpdateSection()
00666 {
00667     // Called when the user has opened a document
00668     // Would normally be overriden by a a particular tab
00669     return TRUE;
00670 }
00671 
00672 /******************************************************************************************
00673 
00674 >   virtual BOOL PropertyTabs::UpdateSpreadSection()
00675 
00676     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00677     Created:    3/10/95
00678     Returns:    TRUE if successful, else FALSE
00679     Purpose:    Called when the user has clicked or done something to change the selected 
00680                 spread.
00681                 Gives any tabbed dialog a chance to update any fields which are used to
00682                 reflect the current spread's status.
00683                 This is the base class version and so will be used for any tabs which have
00684                 no specified handling code.   
00685     Errors:     -
00686     SeeAlso:    PropertyTabs::UngreySection(); PropertyTabs::GreySection();
00687     SeeAlso:    PropertyTabs::UpdateSection(); PropertyTabs::UpdateLayerSection();
00688 
00689 ******************************************************************************************/
00690 
00691 BOOL PropertyTabs::UpdateSpreadSection()
00692 {
00693     // Called when the user has changed the selected spread
00694     // Would normally be overriden by a a particular tab
00695     return TRUE;
00696 }
00697 
00698 /******************************************************************************************
00699 
00700 >   virtual BOOL PropertyTabs::UpdateLayerSection()
00701 
00702     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00703     Created:    3/10/95
00704     Returns:    TRUE if successful, else FALSE
00705     Purpose:    Called when the user has clicked or done something to change the selected 
00706                 layer.
00707                 Gives any tabbed dialog a chance to update any fields which are used to
00708                 reflect the current layer's status.
00709                 This is the base class version and so will be used for any tabs which have
00710                 no specified handling code.   
00711     Errors:     -
00712     SeeAlso:    PropertyTabs::UngreySection(); PropertyTabs::GreySection();
00713     SeeAlso:    PropertyTabs::UpdateSection(); PropertyTabs::UpdateSpreadSection();
00714 
00715 ******************************************************************************************/
00716 
00717 BOOL PropertyTabs::UpdateLayerSection()
00718 {
00719     // Called when the user has changed the selected/active layer
00720     // Would normally be overriden by a a particular tab
00721     return TRUE;
00722 }
00723 
00724 
00725 /******************************************************************************************
00726 
00727 >   virtual BOOL PropertyTabs::UpdateGuidelineSection()
00728 
00729     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
00730     Created:    4/10/95
00731     Returns:    TRUE if successful, else FALSE
00732     Purpose:    Called when the user has clicked or done something to change the guidelines
00733                 of the *active* layer.
00734                 Gives any tabbed dialog a chance to update any fields which are used to
00735                 reflect the current layer's status.
00736                 This is the base class version and so will be used for any tabs which have
00737                 no specified handling code.   
00738     Errors:     -
00739     SeeAlso:    PropertyTabs::UngreySection(); PropertyTabs::GreySection();
00740     SeeAlso:    PropertyTabs::UpdateSection(); PropertyTabs::UpdateSpreadSection();
00741 
00742 ******************************************************************************************/
00743 
00744 BOOL PropertyTabs::UpdateGuidelineSection()
00745 {
00746     // Called when the user has changed the selected/active layer
00747     // Would normally be overriden by a a particular tab
00748     return TRUE;
00749 }
00750 
00751 /******************************************************************************************
00752 
00753 >   virtual BOOL PropertyTabs::ColourListChanged(Document* pDoc)
00754 
00755     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
00756     Created:    9/10/95
00757     inputs:     pDoc = ptr to document that contains the changed list, or NULL if there's no longer a list
00758     Returns:    TRUE if successful, else FALSE
00759     Purpose:    Called when the colour list changes in some way.
00760                 pDoc points to the doc that contains the list that's changed.
00761                 If pDoc is NULL, then there is no longer a colour list (e.g. all docs closed)
00762     Errors:     -
00763     SeeAlso:    -
00764 
00765 ******************************************************************************************/
00766 
00767 BOOL PropertyTabs::ColourListChanged(Document* pDoc)
00768 {
00769     return TRUE;
00770 }
00771 
00772 /******************************************************************************************
00773 
00774 >   virtual BOOL PropertyTabs::IsPropertyRequired()
00775 
00776     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00777     Created:    28/9/95
00778     Inputs:     -
00779     Outputs:    -
00780     Returns:    Returns True if this tab is required.     
00781     Purpose:    Allows the layer properties options dialog code to determine if this tab
00782                 belongs is required at this point.
00783                 This base class version allow the majority of tabs to answer yes to this
00784                 question and hence only needs overiding if the tab is not required.
00785     Errors:     -
00786 
00787 ******************************************************************************************/
00788 
00789 BOOL PropertyTabs::IsPropertyRequired()
00790 {
00791     return FALSE;
00792 }
00793 
00794 
00795 /********************************************************************************************
00796 
00797 >   virtual void PropertyTabs::SetCurrentLayer(Layer * pNewLayer)
00798 
00799     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00800     Created:    3/10/95
00801     Inputs:     Pointer to the layer to use, can be NULL of course.
00802     Outputs:    -
00803     Returns:    - 
00804     Purpose:    Sets up the layer that we are currently supposed to be working on.
00805                 This can then be used by the tabs instead of each one using their own method
00806                 to work it out.
00807                 This may be different to the active layer set up in the baseclass. The current
00808                 one as far as we are concerned is the one that the layer properties tabbed
00809                 dialog box was brought up over using the adjust click menu on the layer gallery.
00810     Errors:     -
00811     SeeAlso:    PropertyTabs::GetActiveLayer; PropertyTabs::GetCurrentLayer;
00812 
00813 ********************************************************************************************/
00814 
00815 void PropertyTabs::SetCurrentLayer(Layer * pNewLayer)
00816 {
00817     PropertyTabs::pCurrentLayer = pNewLayer;    
00818 }
00819 
00820 /********************************************************************************************
00821 
00822 >   virtual Layer * PropertyTabs::GetCurrentLayer()
00823 
00824     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00825     Created:    3/10/95
00826     Returns:    A pointer to the current layer that should be used.
00827     Purpose:    Sets up the layer that we are currently supposed to be working on.
00828                 This can then be used by the tabs instead of each one using their own method
00829                 to work it out.
00830                 This may be different to the active layer set up in the baseclass. The current
00831                 one as far as we are concerned is the one that the layer properties tabbed
00832                 dialog box was brought up over using the adjust click menu on the layer gallery.
00833     Errors:     -
00834     SeeAlso:    PropertyTabs::SetActiveLayer; PropertyTabs::SetCurrentLayer;
00835 
00836 ********************************************************************************************/
00837 
00838 Layer * PropertyTabs::GetCurrentLayer()
00839 {
00840     return PropertyTabs::pCurrentLayer;     
00841 }
00842 
00843 /******************************************************************************************
00844 
00845 >   virtual BOOL PropertyTabs::SetOkState(BOOL Val)
00846 
00847     Author:     Ranbir_Rana (Xara Group Ltd) <camelotdev@xara.com>
00848     Created:    16/07/97
00849     Inputs:     Val - BOOLEAN Value to determine whether to grey/ungrey the OK button.
00850     Outputs:    -
00851     Returns:    TRUE if successful, else FALSE
00852     Purpose:    Greys/Ungreys  the OK button on the main page of the tabbed dialog.
00853     
00854 ******************************************************************************************/
00855 BOOL PropertyTabs::SetOkState(BOOL Val)
00856 {
00857     // Get a pointer to the dialog box that we are going to use.
00858     DialogTabOp * pPropertiesDlg = GetTabbedDlg();
00859     ERROR2IF(pPropertiesDlg == NULL,FALSE,"LayerPropertyTabs::UngreyApplyNow called with no dialog pointer");
00860     
00861     // Grey/Ungrey the OK button on the main page.
00862     // Get currently selected Tab id
00863     CDlgResID PageID = pPropertiesDlg->GetCurrentPageID();  
00864 
00865     // Select the main tab
00866     pPropertiesDlg->TalkToPage(0);                  
00867 
00868     // ungrey button on main tab
00869     pPropertiesDlg->EnableGadget(_R(ID_OK), Val);       
00870         
00871     // Select the originally selected tab
00872     pPropertiesDlg->TalkToPage(PageID);                     
00873 
00874     return TRUE;
00875 }
00876 
00877 
00878     
00879 
00880 /******************************************************************************************
00881 ********************************************************************************************/

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