optsview.cpp

Go to the documentation of this file.
00001 // $Id: optsview.cpp 1771 2007-06-17 20:14:43Z 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 View tab of the options dialog box
00099 
00100 /*
00101 
00102 */
00103 
00104 #include "camtypes.h"
00105 //WEBSTER-ranbirr-13/11/96
00106 #ifndef WEBSTER
00107 //#include "app.h"      // Camelot object - in camtypes.h [AUTOMATICALLY REMOVED]
00108 //#include "docview.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00109 #include "appprefs.h"
00110 //#include "prefsdlg.h" // dialog/gadget ids
00111 //#include "optsres.h"  // error strings
00112 #include "optsmsgs.h"   // error strings
00113 #include "optsview.h"
00114 //#include "app.h"      // Camelot object - in camtypes.h [AUTOMATICALLY REMOVED]
00115 //#include "units.h"        // units - in camtypes.h [AUTOMATICALLY REMOVED]
00116 #include "ccolbar.h"    // show new state of colour bar
00117 //#include "jason.h"        // _R(IDS_COLCONTEXTNAME)
00118 #include "colcontx.h"   // For ColourContexts
00119 #include "palman.h"
00120 #include "coldlog.h"
00121 #include "bmpcomp.h"    // for BitmapList
00122 #include "imjpeg.h"
00123 
00124 CC_IMPLEMENT_DYNAMIC(ViewTab, OptionsTabs)   
00125               
00126 // This is not compulsory, but you may as well put it in so that the correct version
00127 // of your file can be registered in the .exe
00128 DECLARE_SOURCE("$Revision: 1771 $");
00129 
00130 /********************************************************************************************
00131 
00132 >   ViewTab::ViewTab() 
00133 
00134 
00135     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00136     Created:    7/12/94
00137     Inputs:     -
00138     Outputs:    -
00139     Returns:    -
00140     Purpose:    ViewTab constructor. Creates a non-undoable operation
00141     Errors:     -
00142     SeeAlso:    -
00143 
00144 ********************************************************************************************/
00145 
00146 ViewTab::ViewTab()
00147 {   
00148     // Set up our private variables to known states
00149     GreyStatus = TRUE;
00150 
00151     // Variables to store the old control states.
00152     OldShowTransparency = TRUE; 
00153     OldBackgroundRedraw = TRUE; 
00154     OldPropScroll = TRUE;
00155 }        
00156 
00157 /********************************************************************************************
00158 
00159 >   ViewTab::~ViewTab()
00160 
00161 
00162     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00163     Created:    7/12/94
00164     Inputs:     -
00165     Outputs:    -
00166     Returns:    -
00167     Purpose:    ViewTab destructor
00168     Errors:     -
00169     SeeAlso:    -
00170 
00171 ********************************************************************************************/
00172                                                                                 
00173 ViewTab::~ViewTab()
00174 {   
00175 }        
00176 
00177 /********************************************************************************************
00178 
00179 >   BOOL ViewTab::Init()
00180 
00181 
00182     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00183     Created:    7/12/94
00184     Inputs:     -
00185     Outputs:    -
00186     Returns:    True if initialised ok, False if failed.
00187     Purpose:    ViewTab initialisation routine
00188     Errors:     -
00189     SeeAlso:    -
00190 
00191 ********************************************************************************************/
00192                                                                                 
00193 BOOL ViewTab::Init()
00194 {   
00195     return TRUE;
00196 }        
00197 
00198 
00199 /******************************************************************************************
00200 
00201 >   CDlgResID ViewTab::GetPageID()()
00202 
00203     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00204     Created:    7/12/94
00205     Inputs:     -
00206     Outputs:    -
00207     Returns:    The dialog ID of this tab section.    
00208     Purpose:    Allows the options dialog code to determine the dialog ID of this section.
00209     Errors:     -
00210     SeeAlso:    -
00211 
00212 ******************************************************************************************/
00213 
00214 CDlgResID ViewTab::GetPageID()
00215 {
00216     return _R(IDD_OPTSTAB_VIEW);
00217 }
00218 
00219 /******************************************************************************************
00220 
00221 >   BOOL ViewTab::IsDocumentOption()
00222 
00223     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00224     Created:    14/12/94
00225     Inputs:     -
00226     Outputs:    -
00227     Returns:    Returns True if this tab is a document option.    
00228     Purpose:    Allows the document options dialog code to determine if this tab belongs
00229                 to the group of document options.
00230     Errors:     -
00231     SeeAlso:    IsProgramOption();
00232 
00233 ******************************************************************************************/
00234 
00235 BOOL ViewTab::IsDocumentOption()
00236 {
00237     return FALSE;   // This tab is not a document option 
00238 }
00239 
00240 /******************************************************************************************
00241 
00242 >   BOOL ViewTab::IsProgramOption()
00243 
00244     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00245     Created:    14/12/94
00246     Inputs:     -
00247     Outputs:    -
00248     Returns:    Returns True if this tab is a program option.     
00249     Purpose:    Allows the program options dialog code to determine if this tab belongs
00250                 to the group of program options.
00251     Errors:     -
00252     SeeAlso:    IsProgramOption();
00253 
00254 ******************************************************************************************/
00255 
00256 BOOL ViewTab::IsProgramOption()
00257 {
00258     return TRUE;    // This tab is a program option 
00259 }
00260 
00261 
00262 /******************************************************************************************
00263 
00264 >   BOOL ViewTab::DecodeModelListItem(BOOL *AutoColourModel, ColourModel *DisplayModel)
00265 
00266     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00267     Created:    11/4/95
00268     Inputs:     -
00269     Outputs:    AutoColourModel Is the automatic selection state
00270                 DisplayModel    Is the colour model chosen
00271     Returns:    True if taken from list ok, False otherwise.      
00272     Purpose:    Takes the selected item in the automatic colour model sleection list and
00273                 translates it into the two items required:-
00274                     - Automatic colour model selection flag
00275                     - colour model selected 
00276     Errors:     -
00277     SeeAlso:    CommitSection;
00278 
00279 ******************************************************************************************/
00280 
00281 BOOL ViewTab::DecodeModelListItem(BOOL *AutoColourModel, ColourModel *DisplayModel)
00282 {
00283 TRACEUSER( "Neville", _T("ViewTab::DecodeModelListItem\n"));
00284     ERROR3IF(pPrefsDlg == NULL, "ViewTab::DecodeModelListItem called with no dialog pointer");
00285 
00286     // Decode the selected item in the automatic colour model list into the two preference
00287     // values we require
00288     
00289     // Set up default values in case of early exit
00290     *AutoColourModel = FALSE;
00291     *DisplayModel = COLOURMODEL_HSVT;
00292 
00293     // Get the number of the selected item in the list
00294     WORD Index;
00295     pPrefsDlg->GetValueIndex(_R(IDC_OPTS_AUTOCOLOUR), &Index);
00296 
00297     // If the selected item is zero then Automatic has been chosen
00298     if (Index == 0)
00299     {
00300         // Set up the return variables
00301         *AutoColourModel = TRUE;
00302         *DisplayModel = COLOURMODEL_HSVT;
00303     }
00304     else if ((Index > 0) && (Index < (MAX_COLOURMODELS + 1)))
00305     {
00306         // Remove the automatic from the list
00307         Index--;
00308         
00309         // Work out the colour model required
00310         ColourContextArray ColContexts;
00311         ColourContext::GetGlobalDefaults(&ColContexts);
00312 
00313         // Variable for holding the selected model number
00314         INT32 NewModelNum;
00315 
00316         // Work through the colour model list an index number of times
00317         for (NewModelNum = 0; NewModelNum < MAX_COLOURMODELS; NewModelNum++)
00318         {
00319             if (ColContexts.Context[NewModelNum] != NULL)
00320             {
00321                 if ((Index--) <= 0)
00322                     break;
00323             }
00324         }
00325 
00326         // Set up the return variables
00327         *AutoColourModel = FALSE;
00328         *DisplayModel = (ColourModel) NewModelNum;
00329     }
00330     else
00331     {
00332         // something nasty has happened 
00333         return FALSE;
00334     }
00335 
00336     return TRUE;
00337     
00338 }   
00339 
00340 
00341 /******************************************************************************************
00342 
00343 >   BOOL ViewTab::CommitBitmapSmoothingFlag( BOOL bNewSetting )
00344 
00345     Author:     Andy_Hills (Xara Group Ltd) <camelotdev@xara.com>
00346     Created:    07/11/00
00347     Inputs:     bNewSetting     new bitmap smoothing setting
00348     Outputs:    -
00349     Returns:    TRUE on success
00350     Purpose:    Commits the 'allow bitmap smoothing when scaled up' setting.
00351                 All bitmaps which are affected by the setting will be redrawn.
00352     Errors:     -
00353     SeeAlso:    -
00354 
00355 ******************************************************************************************/
00356 
00357 BOOL ViewTab::CommitBitmapSmoothingFlag( BOOL bNewSetting )
00358 {
00359     if (!pDocument)
00360         return(TRUE);
00361     
00362     // Invalidate any affected bitmaps.
00363     /* BOOL bOldSetting =*/ pDocument->GetBitmapSmoothing();
00364 
00365     // Enable the new setting
00366     pDocument->SetBitmapSmoothing(bNewSetting);
00367 
00368 
00369     // get the document's list of bitmaps
00370     BitmapList *pBitmapList = pDocument->GetBitmapList();
00371     ERROR3IF( (!pBitmapList), "ViewTab::CommitBitmapSmoothingFlag - couldn't get bitmap list" );
00372     DWORD ListSize = pBitmapList->GetCount();
00373 
00374     // get the first bitmap in the list
00375     KernelBitmap *pBitmap = (KernelBitmap*) (pBitmapList->GetHead());
00376 
00377     // for every KernelBitmap in the current document 
00378     while(ListSize>0)
00379     {
00380         // validate the bitmap ptr
00381         ERROR3IF( (!(pBitmap->IsKindOf(CC_RUNTIME_CLASS(KernelBitmap)))), "ViewTab::CommitBitmapSmoothingFlag - pBitmap is not a KernelBitmap" );
00382         
00383         // This is now redundant.
00384         // Since the document bitmap smoothing flag now affects all bitmaps,
00385         // but the individual bitmap smoothing flags only affect bitmaps which
00386         // are scaled up, the rule for whether or not we invalidate a bitmap
00387         // is much more complicated (we can't just invalidate all references to
00388         // one bitmap, since some of them may be scaled up, others scaled down,
00389         // etc.)
00390         // So we will invalidate ALL bitmaps instead!
00391         
00392         /*
00393         // work out whether the bitmap was being smoothed before the change
00394         BOOL bWasSmoothed    = (pBitmap->GetInterpolation() && bOldSetting);
00395         BOOL bWillBeSmoothed = (pBitmap->GetInterpolation() && bNewSetting);
00396 
00397         // if the bitmap was smoothed but isn't now (or vice versa) then invalidate it
00398         if( bWasSmoothed != bWillBeSmoothed )
00399         {
00400             // all nodes which use the bitmap will be redrawn
00401             pBitmap->GetActualBitmap()->InvalidateAllReferences(pDocument);
00402         }
00403         */
00404 
00405         pBitmap->GetActualBitmap()->InvalidateAllReferences(pDocument);
00406 
00407         // get the next bitmap in the list
00408         pBitmap = (KernelBitmap*) (pBitmapList->GetNext(pBitmap));
00409         ListSize--;
00410     }
00411 
00412     return TRUE;
00413 }
00414 
00415 
00416 /******************************************************************************************
00417 
00418 >   BOOL ViewTab::CommitSection()
00419 
00420     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00421     Created:    7/12/94
00422     Inputs:     -
00423     Outputs:    -
00424     Returns:    True if values in dialog box ok, False otherwise.     
00425     Purpose:    Takes the values in the View section tab of the options dialog box and
00426                 sets the associated preference values accordingly
00427                 Called when ok is pressed on the dialog box.
00428     Errors:     -
00429     SeeAlso:    -
00430 
00431 ******************************************************************************************/
00432 
00433 BOOL ViewTab::CommitSection()
00434 {
00435 TRACEUSER( "Neville", _T("commit view section\n"));
00436     ERROR3IF(pPrefsDlg == NULL, "ViewTab::CommitSection called with no dialog pointer");
00437 
00438     BOOL ok = pPrefsDlg->TalkToPage(_R(IDD_OPTSTAB_VIEW));  // The View View identifier
00439     if (!ok)
00440         return TRUE;    // Talk to View failed to return now
00441 
00442     // Section = View
00443 
00444     // Ok has been pressed so take the values from this section of the dialog box
00445     BOOL Valid=TRUE;        // Flag for validity of value
00446     BOOL State=FALSE;       // Flag for state of button/switch
00447     BOOL SetOk=TRUE;        // Preference value set ok
00448 
00449     // Section = Display
00450 
00451     // Now the colour bar mode combo box
00452     INT32 ColourBarMode = 0;
00453     ColourBarMode = pPrefsDlg->GetSelectedValueIndex(_R(IDC_OPTS_COLOURBAR));
00454 TRACEUSER( "Neville", _T("commit colour bar mode='%d' \n"),ColourBarMode);
00455     SetOk = Camelot.SetPrefValue(TEXT("Displays"), TEXT("ColourBarMode"), &ColourBarMode);
00456     ERROR2IF(!SetOk,2,_R(IDE_OPTS_SETPREF_VIEW));
00457 
00458 #ifndef STANDALONE
00459     CColourBar::SetDisplayMode();       // Try and get the colour bar to update itself
00460 #endif
00461 
00462     // Now tell other users that there is a possibly new colour bar display mode
00463     // in operation and so update any necessary items. 
00464     BROADCAST_TO_ALL(OptionsChangingMsg(pDocument, OptionsChangingMsg::NEWCOLOURBARMODE));
00465 
00466     // Now set up the other preference values according to the switches
00467 
00468     // Automatic colour model selection in colour editor
00469     BOOL AutoColourModel;
00470     ColourModel DisplayModel;
00471     DecodeModelListItem(&AutoColourModel, &DisplayModel);
00472 
00473     // added by CGS ....
00474     // since the default colour model can now be set from within the colour editor (coldlog.cpp)
00475     // we now need to force it from in here as well (otherwise the colour editor will save the one
00476     // that it is currently using - and NOT the one that we have just applied here!
00477 
00478     OpDescriptor* pOpDescriptor = (OpDescriptor*) OpDescriptor::FindOpDescriptor( OPTOKEN_COLOUREDITDLG );
00479 
00480     String_256 Dummy;
00481     OpState ColourEditDlgState = pOpDescriptor->GetOpsState(&Dummy);
00482 
00483     if (ColourEditDlgState.Ticked)
00484     {
00485         ColourEditDlg* pColourEditDlg = ColourEditDlg::GetColourEditDlg ();
00486         ASSERT (pColourEditDlg);
00487 
00488         pColourEditDlg->SetDefaultDisplayModel (DisplayModel);
00489     }
00490 
00491     SetOk = Camelot.SetPrefValue(TEXT("Displays"), TEXT("ColourEditorAutoModel"), &AutoColourModel);
00492     INT32 DisplayModelPref = (INT32)DisplayModel;   
00493     SetOk = SetOk && Camelot.SetPrefValue(TEXT("Displays"), TEXT("ColourEditorDisplayModel"), &DisplayModelPref);
00494     ERROR2IF(!SetOk,2,_R(IDE_OPTS_SETPREF_VIEW));
00495 
00496     // Error diffused view option
00497     BOOL ViewDither = 2;
00498     ViewDither = GetSelectedDither();
00499     SetOk = Camelot.SetPrefValue(_T("Screen"), _T("ViewDither"), &ViewDither);
00500     ERROR2IF(!SetOk,2,_R(IDE_OPTS_SETPREF_VIEW));
00501 
00502     PaletteManager::RedrawAllPalettedWindows(NULL);
00503 
00504     // Section = Bitmaps
00505 
00506     // The 'allow bitmap smoothing when scaled up' setting has changed.
00507     BOOL bSmoothing = ! pPrefsDlg->GetBoolGadgetSelected(_R(IDC_OPTS_SMOOTH_BITMAPS), 0, NULL, -1 );
00508     ok = CommitBitmapSmoothingFlag(bSmoothing);
00509     if (!ok) return FALSE;
00510 
00511     INT32 m_compoundConvertToEditableShapesDPI = pPrefsDlg->GetLongGadgetValue(_R(IDC_OPTS_COMPOUNDDPI), 10, 1000, _R(IDE_OPTS_INVALIDCOMPOUNDDPISIZE), &Valid);
00512     if (Valid)
00513     {
00514         BOOL SetOk = Camelot.SetPrefValue(TEXT("Displays"), TEXT("CompCToEDPI"), &m_compoundConvertToEditableShapesDPI);
00515         ERROR2IF(!SetOk,2,_R(IDE_OPTS_SETPREF_TUNE));
00516     }
00517 
00518     BOOL fScaleJpg96dpi = FALSE; // Whether all JPEGs should be imported at 96DPI
00519     fScaleJpg96dpi = pPrefsDlg->GetLongGadgetValue( _R(IDC_JPEG_96DPI_CHECK), 0, 1, 0, &Valid );
00520     JPEGImportFilter::SetImportAt96dpi( fScaleJpg96dpi );
00521 
00522     // Automatic colour line, gallery scroll to colour selected
00523     State = pPrefsDlg->GetLongGadgetValue(_R(IDC_OPTS_AUTOSCROLL), 0, 1, 0, &Valid);
00524     SetOk = Camelot.SetPrefValue(TEXT("Displays"), TEXT("AutoScrollColours"), &State);
00525     ERROR2IF(!SetOk,2,_R(IDE_OPTS_SETPREF_VIEW));
00526 
00527 // Removed 18/12/95 as non longer required
00528 //  // Show progress hourglass
00529 //  State = pPrefsDlg->GetLongGadgetValue(_R(IDC_OPTS_HOURGLASS), 0, 1, 0, &Valid);
00531 //      // We need a special access routine for this pref, as we want to create & destroy as
00532 //  // it changes value.
00533 //  extern BOOL ProgressCursorSetPref(BOOL fNewState);
00534 //  SetOk = ProgressCursorSetPref(State);
00535 //  ERROR2IF(!SetOk,2,_R(IDE_OPTS_SETPREF_VIEW));
00536 
00537     // Show progress bar.
00538     State = pPrefsDlg->GetLongGadgetValue(_R(IDC_OPTS_PROGRESS), 0, 1, 0, &Valid);
00539     SetOk = Camelot.SetPrefValue(TEXT("Displays"), TEXT("ProgressBar"), &State);
00540     ERROR2IF(!SetOk,2,_R(IDE_OPTS_SETPREF_VIEW));
00541 
00542     // Section = Window
00543 
00544     // Now try and set the current view's state, if there is one.   
00545     DocView *pView = DocView::GetSelected();
00546     BOOL BackgroundRedraw = TRUE;
00547 
00548     // Proportional scrollbar state option (for main view) removed 10/10/05 by Marc.
00549     // The current scrollbars are always proportional so it didn't make sense
00550 
00551     // Read the state of the interactive fill editing switch and set the new value in the preferences
00552     BOOL InteractiveFill = pPrefsDlg->GetLongGadgetValue(_R(IDC_OPTS_INTERACTIVEFILL), 0, 1, 0, &Valid);
00553     SetOk = Camelot.SetPrefValue(TEXT("Dragging"), TEXT("InteractiveFillEditing"), &InteractiveFill);
00554     ERROR2IF(!SetOk,2,_R(IDE_OPTS_SETPREF_VIEW));
00555 
00556 // Removed 29/8/95 as transparency prompt dead
00557     // Read the state of the auto transparancy switch and set the new value in the preferences
00558 //  BOOL AutoTransparency = pPrefsDlg->GetLongGadgetValue(_R(IDC_OPTS_AUTOTRANS), 0, 1, 0, &Valid);
00559 //  SetOk = Camelot.SetPrefValue(TEXT("Rendering"), TEXT("AutoTransparency"), &AutoTransparency);
00560 //  ERROR2IF(!SetOk,2,_R(IDE_OPTS_SETPREF_VIEW));
00561 
00562     // Read the state of the show transparancy switch and set the new value in the
00563     // selected document. Read vack value afterwards as the user will have been asked to 
00564     // confirm the operation 
00565 // Removed 27/8/96; Transparency Control is DEAD 
00566 /*
00567     BOOL ShowTransparency = pPrefsDlg->GetLongGadgetValue(_R(IDC_OPTS_SHOWTRANS), 0, 1, 0, &Valid);
00568     if (pDocument != NULL)
00569     {
00570         // According to the state of the switch, try to enable or disable transparency
00571         BOOL NewState;
00572         if (ShowTransparency)
00573             NewState = pDocument->TransparencyState(Enable);
00574         else
00575             NewState = pDocument->TransparencyState(Disable);
00576 */
00577         // If transparancy is present and the user has tried to turn it off then they will
00578         // have been prompted as to whether they want to or not. Therefore, we must reset
00579         // the switch state according to thevalue returned to us.
00580 
00581 // removed 27/8/96 Transparency Control is DEAD 
00582 //      pPrefsDlg->SetLongGadgetValue(_R(IDC_OPTS_SHOWTRANS), NewState);
00583 
00584 // Removed 29/8/95 as transparency prompt dead
00585         // Just in case, we will check the state of the automatic transparency switch
00586 //      BOOL NewAutoTransparency = FALSE;
00587 //      BOOL ReadOk = Camelot.GetPrefValue(TEXT("Rendering"), TEXT("AutoTransparency"),
00588 //                                         &NewAutoTransparency);
00589 //      if (NewAutoTransparency != 0)
00590 //          pPrefsDlg->SetLongGadgetValue(_R(IDC_OPTS_AUTOTRANS), TRUE);
00591 //      else
00592 //          pPrefsDlg->SetLongGadgetValue(_R(IDC_OPTS_AUTOTRANS), FALSE);
00593 //  } 
00594 // Removed this rampant ERROR2 when no documents are present
00595 //  else
00596 //      ERROR2(FALSE,_R(IDE_OPTS_READPREF_VIEW));
00597 
00598 
00599     // Set the document altered state true if any of the document/view based items have been
00600     // changed but only if we have a valid document and view.
00601     if (pView != NULL && pDocument != NULL)
00602     {
00603         //removed 27/8/96 Transparency Control DEAD 
00604         if (
00605     //      OldShowTransparency != ShowTransparency || 
00606             OldBackgroundRedraw != BackgroundRedraw
00607            )
00608         {
00609             pDocument->SetModified(TRUE);       
00610         }
00611            
00612         // Now remember the new states
00613     //  OldShowTransparency = ShowTransparency; removed 27/8/96 transparency control DEAD
00614         OldBackgroundRedraw = BackgroundRedraw;
00615     }
00616 
00617     return TRUE;
00618 }
00619 
00620 /********************************************************************************************
00621 
00622 >   BOOL ViewTab::GreySection()
00623 
00624     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00625     Created:    4/2/95
00626     Inputs:     -
00627     Outputs:    -
00628     Returns:    -
00629     Purpose:    Called when the user has closed all documents 
00630     Errors:     -
00631     SeeAlso:    ViewTab::UngreySection;
00632 
00633 ********************************************************************************************/
00634 
00635 BOOL ViewTab::GreySection()
00636 {
00637 TRACEUSER( "Neville", _T("GreySection in ViewTab section\n"));
00638     ERROR2IF(pPrefsDlg == NULL,FALSE,"ViewTab::GreySection called with no dialog pointer");
00639 
00640     BOOL ok = pPrefsDlg->TalkToPage(_R(IDD_OPTSTAB_VIEW));  // The ViewTab identifier
00641     if (!ok)
00642         return TRUE;    // Talk to page failed to return now
00643 
00644     // Only update if we are not already grey 
00645     if (GreyStatus == TRUE)
00646         return TRUE;
00647 
00648     // Call our central greying/ungreying function
00649     ok = ChangeControlStatus(FALSE);
00650     
00651     GreyStatus = TRUE;
00652 
00653     return ok;
00654 } 
00655 
00656 /********************************************************************************************
00657 
00658 >   BOOL ViewTab::UngreySection()
00659 
00660     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00661     Created:    4/2/95
00662     Inputs:     -
00663     Outputs:    -
00664     Returns:    -
00665     Purpose:    Called when the user has selected a new document or the title has been changed.
00666     Errors:     -
00667     SeeAlso:    ViewTab::UngreySection;
00668 
00669 ********************************************************************************************/
00670 
00671 BOOL ViewTab::UngreySection()
00672 {
00673 TRACEUSER( "Neville", _T("UngreySection in ViewTab section\n"));
00674     ERROR2IF(pPrefsDlg == NULL,FALSE,"ViewTab::UngreySection called with no dialog pointer");
00675 
00676     BOOL ok = pPrefsDlg->TalkToPage(_R(IDD_OPTSTAB_VIEW));  // The ViewTab identifier
00677     if (!ok)
00678         return TRUE;    // Talk to page failed to return now
00679 
00680     BOOL bSmoothing = TRUE;
00681     if (pDocument)
00682         bSmoothing = pDocument->GetBitmapSmoothing();
00683     pPrefsDlg->SetBoolGadgetSelected(_R(IDC_OPTS_SMOOTH_BITMAPS), !bSmoothing, 0 );
00684 
00685     // Only update if we are not already ungrey 
00686     if (GreyStatus == FALSE)
00687         return TRUE;
00688 
00689     // Call our central greying/ungreying function
00690     ok = ChangeControlStatus(TRUE);
00691     
00692     GreyStatus = FALSE;
00693 
00694     return ok;
00695 }
00696 
00697 /********************************************************************************************
00698 
00699 >   BOOL ViewTab::ChangeControlStatus(const BOOL Status)
00700 
00701     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00702     Created:    4/2/95
00703     Inputs:     -
00704     Outputs:    -
00705     Returns:    -
00706     Purpose:    Called to grey/ungrey all controls on this tab. 
00707     Errors:     -
00708     SeeAlso:    ViewTab::GreySection;   ViewTab::UngreySection;
00709 
00710 ********************************************************************************************/
00711 
00712 BOOL ViewTab::ChangeControlStatus(const BOOL Status)
00713 {
00714     // Grey/ungrey the controls
00715 //  pPrefsDlg->EnableGadget(_R(IDC_OPTS_VIEWINFO), Status);
00716 
00717 //  pPrefsDlg->EnableGadget(_R(IDC_OPTS_DISPLAYGROUP), Status);
00719 //  pPrefsDlg->EnableGadget(_R(IDC_OPTS_PROGRESS), Status);
00720 
00721 //  pPrefsDlg->EnableGadget(_R(IDC_OPTS_COLOURLINEGROUP), Status);
00722 //  pPrefsDlg->EnableGadget(_R(IDC_OPTS_COLOURBAR), Status);
00723 
00724 //  pPrefsDlg->EnableGadget(_R(IDC_OPTS_COLOUREDITOR), Status);
00725 //  pPrefsDlg->EnableGadget(_R(IDC_OPTS_AUTOCOLOUR), Status);
00726 //  pPrefsDlg->EnableGadget(_R(IDC_OPTS_AUTOCOLOURTXT), Status);
00727 //  pPrefsDlg->EnableGadget(_R(IDC_OPTS_AUTOSCROLL), Status);
00728 
00729 //  pPrefsDlg->EnableGadget(_OPTS_INTERACTIVEFILL, Status);
00730 //  pPrefsDlg->EnableGadget(_R(IDC_OPTS_AUTOTRANS), Status);
00731 
00732 //  removed transparency control 27/8/96 
00733 //  pPrefsDlg->EnableGadget(_R(IDC_OPTS_SHOWTRANS), Status);
00734     pPrefsDlg->EnableGadget(_R(IDC_OPTS_SCROLLBARS), Status);
00735 
00736     pPrefsDlg->EnableGadget(_R(IDC_OPTS_SMOOTH_BITMAPS), Status);
00737 
00738     return TRUE;
00739 }           
00740 
00741 /********************************************************************************************
00742 
00743 >   BOOL ViewTab::UpdateSection(String_256 *DocumentName)
00744 
00745     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00746     Created:    4/2/95
00747     Inputs:     Name of document
00748     Outputs:    -
00749     Returns:    -
00750     Purpose:    Called when we have switched to a new document and need to update all the 
00751                 controls on this tab. Should only init the tab if the page is present.  
00752                 The document name allows the info field on the tab to be filled in correctly.
00753     Errors:     -
00754     SeeAlso:    ViewTab::GreySection; ViewTab::UngreySection; ViewTab::InitSection;
00755 
00756 ********************************************************************************************/
00757 
00758 BOOL ViewTab::UpdateSection(String_256 *DocumentName)
00759 {
00760 TRACEUSER( "Neville", _T("ViewTab::UpdateSection\n"));
00761     ERROR2IF(pPrefsDlg == NULL,FALSE,"ViewTab::UpdateSection called with no dialog pointer");
00762 
00763     BOOL ok = pPrefsDlg->TalkToPage(_R(IDD_OPTSTAB_VIEW));  // The ViewTab identifier
00764     if (!ok)
00765         return TRUE;        // page not present
00766 
00767     // Remove any lists that we have created.
00768     //pPrefsDlg->DeleteAllValues(_R(IDC_OPTS_COLOURBAR));
00769 
00770     // Update any document/view specific bits
00771     GetDisplayStyleForView();
00772 
00773     BOOL bSmoothing = TRUE;
00774     if (pDocument)
00775         bSmoothing = pDocument->GetBitmapSmoothing();
00776     pPrefsDlg->SetBoolGadgetSelected(_R(IDC_OPTS_SMOOTH_BITMAPS), !bSmoothing, 0 );
00777 
00778     // Call the normal init section code.
00779     // Not required are only a few items which are document based and there are no fields
00780     // displayed using units.
00781     //return InitSection();
00782     return ok;
00783 }
00784 
00785 
00786 /********************************************************************************************
00787 
00788 >   BOOL ViewTab::UpdateTransparencyState(const BOOL NewState)
00789 
00790     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00791     Created:    8/2/95
00792     Inputs:     -
00793     Outputs:    -
00794     Returns:    -
00795     Purpose:    Called when the transparency state has changed and so we must update the
00796                 switch state.
00797     Errors:     -
00798     SeeAlso:    ViewTab::UpdateSection;
00799 
00800 ********************************************************************************************/
00801 // removed 27/8/96; Transparency Control DEAD  
00802 /*
00803 BOOL ViewTab::UpdateTransparencyState(const BOOL NewState)
00804 {
00805 TRACEUSER( "Neville", _T("ViewTab::UpdateTransparencyState\n"));
00806     ERROR2IF(pPrefsDlg == NULL,FALSE,"ViewTab::UpdateTransparencyState called with no dialog pointer");
00807 
00808     BOOL ok = pPrefsDlg->TalkToPage(_R(IDD_OPTSTAB_VIEW));  // The ViewTab identifier
00809     if (!ok)
00810         return TRUE;        // page not present
00811 
00812     // Set the specified new state for the document's transparency state
00813     if (NewState != 0)
00814         pPrefsDlg->SetLongGadgetValue(_R(IDC_OPTS_SHOWTRANS), TRUE);
00815     else
00816         pPrefsDlg->SetLongGadgetValue(_R(IDC_OPTS_SHOWTRANS), FALSE);
00817 
00818     // If the show transparency button is turned off and the automatic
00819     // transparency is on then force it off.
00820 //  BOOL AutoTrans = pPrefsDlg->GetLongGadgetValue(_R(IDC_OPTS_AUTOTRANS), 0, 1, 0, &Valid);
00821 //  if (!NewState && AutoTrans)
00822 //  {
00823 //      pPrefsDlg->SetLongGadgetValue(_R(IDC_OPTS_AUTOTRANS), FALSE);
00824 //  }
00825 
00826     return(TRUE);
00827 }   */
00828 
00829 /********************************************************************************************
00830 
00831 >   BOOL ViewTab::HandleMsg(DialogMsg* Msg)
00832 
00833     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00834     Created:    7/12/94
00835     Inputs:     -
00836     Outputs:    -
00837     Returns:    -
00838     Purpose:    Handles all the View options tabs messages 
00839     Errors:     -
00840     SeeAlso:    -
00841 
00842 ********************************************************************************************/
00843 
00844 BOOL ViewTab::HandleMsg(DialogMsg* Msg)
00845 {
00846 TRACEUSER( "Neville", _T("HandleViewMsg\n"));
00847     ERROR2IF(Msg == NULL,FALSE,"ViewTab::Message null message received");
00848     ERROR2IF(pPrefsDlg == NULL,FALSE,"ViewTab::HandleMsg called with no dialog pointer");
00849 
00850     BOOL ok = pPrefsDlg->TalkToPage(_R(IDD_OPTSTAB_VIEW));  // The View View identifier
00851     if (!ok)
00852         return TRUE;        // page not present
00853 
00854     switch(Msg->DlgMsg)
00855     {
00856         case DIM_CREATE:    // Initialise controls
00857             GreyStatus = FALSE; // we are ungreyed by default
00858             ok = InitSection();
00859             if (!ok)
00860                 InformError();
00861             break;
00862         case DIM_LFT_BN_CLICKED:
00863             OptionsTabs::SetApplyNowState(TRUE);
00864 //          switch (Msg->GadgetID)
00865 //          {
00866 //              case _R(IDC_OPTS_SHOWTRANS):
00867 //                  // If the show transparency button is turned off and the automatic
00868 //                  // transparency is on then force it off.
00869 //                  BOOL Valid;
00870 //                  BOOL ShowTrans = pPrefsDlg->GetLongGadgetValue(_R(IDC_OPTS_SHOWTRANS), 0, 1, 0, &Valid);
00871 //                  BOOL AutoTrans = pPrefsDlg->GetLongGadgetValue(_R(IDC_OPTS_AUTOTRANS), 0, 1, 0, &Valid);
00872 //                  if (!ShowTrans && AutoTrans)
00873 //                  {
00874 //                      pPrefsDlg->SetLongGadgetValue(_R(IDC_OPTS_AUTOTRANS), FALSE);
00875 //                  }
00876 //                  break;
00877 //          }
00878             break;
00879         case DIM_SELECTION_CHANGED:
00880         case DIM_TEXT_CHANGED:
00881             OptionsTabs::SetApplyNowState(TRUE);
00882             break;
00883         default:
00884             break;
00885     }
00886 
00887     return TRUE;
00888 }  
00889 
00890 /******************************************************************************************
00891 
00892 >   BOOL ViewTab::GetDisplayStyleForView()
00893 
00894     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00895     Created:    24/3/95
00896     Inputs:     -
00897     Outputs:    -
00898     Returns:    TRUE if successful, else FALSE
00899     Purpose:    Reads the attributes associated with the current view. These include:-
00900                  - background redraw state
00901                  - proportional scroll bars state  
00902                  - transparency state  
00903     Errors:     -
00904     SeeAlso:    AppPrefsDlg; OptionsTabs;
00905 
00906 ******************************************************************************************/
00907 
00908 BOOL ViewTab::GetDisplayStyleForView()
00909 {
00910     // Now the document's transparency state
00911     if (pDocument != NULL)
00912     {
00913 //removed 27/8/96; Transparency Control DEAD  
00914 //      BOOL ShowTransparency = pDocument->TransparencyState(NoChange);
00915 //      if (ShowTransparency != 0)
00916 //          pPrefsDlg->SetLongGadgetValue(_R(IDC_OPTS_SHOWTRANS), TRUE);
00917 //      else
00918 //          pPrefsDlg->SetLongGadgetValue(_R(IDC_OPTS_SHOWTRANS), FALSE);
00919 
00920         // We must have a selected document to have a selected view
00921         DocView *pView = DocView::GetSelected();
00922         if (pView != NULL)
00923         {
00924         }
00925 
00926         // Remember this value for later use
00927 //      OldShowTransparency = ShowTransparency; removed 27/8/96 transparency control DEAD
00928     }
00929     else
00930     {
00931         // Ensure that the dodgy options are greyed and unuseable 
00932         GreySection();  
00933         return FALSE;
00934     }
00935         
00936     // Everything went well.
00937     return TRUE;
00938 }   
00939 
00940 
00941 
00942 /******************************************************************************************
00943 
00944 >   BOOL ViewTab::InitAutoColourModelList(ColourModel DisplayModel, INT32 *SelectedIndex)
00945 
00946     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00947     Created:    11/4/95
00948     Inputs:     DisplayModel    preference for the colour model to be used
00949     Outputs:    SelectedIndex   returned index into the list
00950     Returns:    TRUE if successful, else FALSE
00951     Purpose:    Sets initial list for the automatic colour model selection but also returns
00952                 the colour model passed in as an index into the list available.
00953     Errors:     -
00954     SeeAlso:    InitSection;
00955 
00956 ******************************************************************************************/
00957 
00958 BOOL ViewTab::InitAutoColourModelList(ColourModel DisplayModel, INT32 *SelectedIndex)
00959 {
00960 TRACEUSER( "Neville", _T("ViewTab::InitAutoColourModelList\n"));
00961     ERROR2IF(pPrefsDlg == NULL,FALSE,"ViewTab::InitAutoColourModelList called with no dialog pointer");
00962 
00963     // Wipe the list back to nothing, just in case
00964     pPrefsDlg->DeleteAllValues(_R(IDC_OPTS_AUTOCOLOUR));
00965     
00966     ColourContextArray ColContexts;
00967     ColourContext::GetGlobalDefaults(&ColContexts);
00968 
00969     // General variables
00970     String_64 NameString;
00971     INT32 Index = 0;
00972     String_32 ModelName;
00973     // Set up decent return value in case of early exit
00974     *SelectedIndex = 0;
00975 
00976     // First item in the list is an automatic.
00977     ModelName = String(_R(IDT_OPTS_AUTOMATIC));     // automatic colour model   
00978     NameString.MakeMsg(_R(IDS_COLCONTEXTNAME), (TCHAR *) ModelName);
00979     pPrefsDlg->SetStringGadgetValue(_R(IDC_OPTS_AUTOCOLOUR), NameString, FALSE, Index);
00980 
00981     for (INT32 i = 0; i < MAX_COLOURMODELS; i++)
00982     {
00983         if (ColContexts.Context[i] != NULL)
00984         {
00985             ColContexts.Context[i]->GetModelName(&ModelName);
00986 
00987             NameString.MakeMsg(_R(IDS_COLCONTEXTNAME), (TCHAR *) ModelName);
00988             pPrefsDlg->SetStringGadgetValue(_R(IDC_OPTS_AUTOCOLOUR), NameString, FALSE, Index + 1);
00989 
00990             // If the colour model is equal to the entry model then note the index for this item. 
00991             if (i == (INT32)DisplayModel)
00992                 *SelectedIndex = Index;
00993     
00994             Index++;
00995         }
00996     }       
00997 
00998     // Set the length of the list
00999     pPrefsDlg->SetComboListLength(_R(IDC_OPTS_AUTOCOLOUR));
01000 
01001     return TRUE;
01002 }
01003 
01004 /******************************************************************************************
01005 
01006 >   BOOL ViewTab::InitSection()
01007 
01008     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
01009     Created:    6/12/94
01010     Inputs:     -
01011     Outputs:    -
01012     Returns:    TRUE if successful, else FALSE
01013     Purpose:    Sets initial values for the View section of the options dialog box.
01014                 This section includes the:-
01015                 Window 
01016                  - background redraw option
01017                  - proportional scroll bars options  
01018                 Display
01019                  - Colour bar mode selector
01020                  - show system hourglass
01021                  - show progress bar    
01022     Errors:     -
01023     SeeAlso:    AppPrefsDlg; OptionsTabs;
01024 
01025 ******************************************************************************************/
01026 
01027 BOOL ViewTab::InitSection()
01028 {
01029 TRACEUSER( "Neville", _T("ViewTab::InitSection\n"));
01030     ERROR2IF(pPrefsDlg == NULL,FALSE,"ViewTab::InitSection called with no dialog pointer");
01031 
01032     BOOL ReadOk = FALSE;    // Flag to say whether the preference value was read ok 
01033 
01034     // Section = Display
01035 
01036     // Now the colour bar mode combo box
01037     INT32 ColourBarMode = 0; 
01038     ReadOk = Camelot.GetPrefValue(TEXT("Displays"), TEXT("ColourBarMode"), &ColourBarMode);
01039 TRACEUSER( "Neville", _T("set colour bar mode '%d'\n"),ColourBarMode);
01040     // Set up the list of available options
01041     pPrefsDlg->DeleteAllValues(_R(IDC_OPTS_COLOURBAR));
01042     pPrefsDlg->SetStringGadgetValue(_R(IDC_OPTS_COLOURBAR), String_32(_R(IDN_COLBAR_SMALL)));
01043     pPrefsDlg->SetStringGadgetValue(_R(IDC_OPTS_COLOURBAR), String_32(_R(IDN_COLBAR_MEDIUM)));
01044     pPrefsDlg->SetStringGadgetValue(_R(IDC_OPTS_COLOURBAR), String_32(_R(IDN_COLBAR_MEDSCROLL)));
01045     pPrefsDlg->SetStringGadgetValue(_R(IDC_OPTS_COLOURBAR), String_32(_R(IDN_COLBAR_LARGE)));
01046     pPrefsDlg->SetComboListLength(_R(IDC_OPTS_COLOURBAR));
01047     // Set up the default option displayed
01048     BOOL ok = pPrefsDlg->SetSelectedValueIndex(_R(IDC_OPTS_COLOURBAR),ColourBarMode);
01049     ERROR2IF(!ReadOk,FALSE,_R(IDE_OPTS_READPREF_VIEW));
01050 
01051     
01052     // Now the colour editor model selection
01053     BOOL ColourEditorAutoModel = FALSE; 
01054     ColourModel DisplayModel = COLOURMODEL_HSVT;
01055     INT32 DisplayModelPref = (INT32)DisplayModel;
01056     INT32 SelectedIndex = 0;
01057 
01058     // First check if automatic is set.
01059     ReadOk = Camelot.GetPrefValue(TEXT("Displays"), TEXT("ColourEditorAutoModel"), &ColourEditorAutoModel);
01060 TRACEUSER( "Neville", _T("set colour editor auto model mode '%d'\n"),ColourEditorAutoModel);
01061     // Now get the display model preference 
01062     ReadOk = ReadOk && Camelot.GetPrefValue(TEXT("Displays"), TEXT("ColourEditorDisplayModel"), &DisplayModelPref);
01063 TRACEUSER( "Neville", _T("set colour editor model '%d'\n"),DisplayModelPref);
01064 
01065     DisplayModel = (ColourModel)DisplayModelPref;
01066     // Set up the list, passing in the default colour model, returning an index into the list
01067     // of available colour models
01068     InitAutoColourModelList(DisplayModel, &SelectedIndex);  
01069 TRACEUSER( "Neville", _T("set colour editor list item '%d'\n"),SelectedIndex);
01070     if (ColourEditorAutoModel != 0)
01071     {
01072         // Automatic colour model selection so select the first in the list
01073         pPrefsDlg->SetSelectedValueIndex(_R(IDC_OPTS_AUTOCOLOUR), 0);
01074     }
01075     else
01076     {
01077         // Not automatic so select item in list taking into account extra automatic option
01078         // which is the first in the list.
01079         pPrefsDlg->SetSelectedValueIndex(_R(IDC_OPTS_AUTOCOLOUR), SelectedIndex + 1);
01080     }
01081     ERROR2IF(!ReadOk,FALSE,_R(IDE_OPTS_READPREF_VIEW));
01082     
01083     // Automatic colour line, gallery scroll to colour selected
01084     BOOL ColourAutoScroll = FALSE;
01085     ReadOk = Camelot.GetPrefValue(TEXT("Displays"), TEXT("AutoScrollColours"), &ColourAutoScroll);
01086     if (ColourAutoScroll != 0)
01087         pPrefsDlg->SetLongGadgetValue(_R(IDC_OPTS_AUTOSCROLL), TRUE);
01088     else
01089         pPrefsDlg->SetLongGadgetValue(_R(IDC_OPTS_AUTOSCROLL), FALSE);
01090     ERROR2IF(!ReadOk,FALSE,_R(IDE_OPTS_READPREF_VIEW));
01091 
01092 
01093     // Now set up the other buttons according to the values set in the variables
01094 // Removed 18/12/95 as non longer required
01095 //  BOOL HourGlass = FALSE;
01096 //  ReadOk = Camelot.GetPrefValue(TEXT("Displays"), TEXT("Hourglass"), &HourGlass);
01097 //  if (HourGlass != 0)
01098 //      pPrefsDlg->SetLongGadgetValue(_R(IDC_OPTS_HOURGLASS), TRUE);
01099 //  else
01100 //      pPrefsDlg->SetLongGadgetValue(_R(IDC_OPTS_HOURGLASS), FALSE);
01101 //  ERROR2IF(!ReadOk,FALSE,_R(IDE_OPTS_READPREF_VIEW));
01102 
01103     BOOL ProgressBar = FALSE;
01104     ReadOk = Camelot.GetPrefValue(TEXT("Displays"), TEXT("ProgressBar"), &ProgressBar);
01105     if (ProgressBar != 0)
01106         pPrefsDlg->SetLongGadgetValue(_R(IDC_OPTS_PROGRESS), TRUE);
01107     else
01108         pPrefsDlg->SetLongGadgetValue(_R(IDC_OPTS_PROGRESS), FALSE);
01109     ERROR2IF(!ReadOk,FALSE,_R(IDE_OPTS_READPREF_VIEW));
01110 
01111     // Section = Bitmaps
01112     BOOL bSmoothing = TRUE;
01113     if (pDocument)
01114         bSmoothing = pDocument->GetBitmapSmoothing();
01115     pPrefsDlg->SetBoolGadgetSelected(_R(IDC_OPTS_SMOOTH_BITMAPS), !bSmoothing, 0 );
01116 
01117     INT32 m_compoundConvertToEditableShapesDPI;
01118     ReadOk = Camelot.GetPrefValue(TEXT("Displays"), TEXT("CompCToEDPI"), &m_compoundConvertToEditableShapesDPI);
01119     pPrefsDlg->SetLongGadgetValue(_R(IDC_OPTS_COMPOUNDDPI), m_compoundConvertToEditableShapesDPI);
01120     ERROR2IF(!ReadOk,FALSE,_R(IDE_OPTS_READPREF_VIEW));
01121 
01122     // Set the force JPEG DPI flag
01123     pPrefsDlg->SetLongGadgetValue( _R(IDC_JPEG_96DPI_CHECK), INT32(JPEGImportFilter::GetImportAt96dpi()) );
01124 
01125     // Section = Window
01126 
01127 // Removed 29/8/95 as transparency prompt dead
01128 //  BOOL AutoTransparency = FALSE;
01129 //  ReadOk = Camelot.GetPrefValue(TEXT("Rendering"), TEXT("AutoTransparency"), &AutoTransparency);
01130 //  if (AutoTransparency != 0)
01131 //      pPrefsDlg->SetLongGadgetValue(_R(IDC_OPTS_AUTOTRANS), TRUE);
01132 //  else
01133 //      pPrefsDlg->SetLongGadgetValue(_R(IDC_OPTS_AUTOTRANS), FALSE);
01134 //  ERROR2IF(!ReadOk,FALSE,_R(IDE_OPTS_READPREF_VIEW));
01135 
01136     BOOL InteractiveFill = FALSE;
01137     ReadOk = Camelot.GetPrefValue(TEXT("Dragging"), TEXT("InteractiveFillEditing"), &InteractiveFill);
01138     if (InteractiveFill != 0)
01139         pPrefsDlg->SetLongGadgetValue(_R(IDC_OPTS_INTERACTIVEFILL), TRUE);
01140     else
01141         pPrefsDlg->SetLongGadgetValue(_R(IDC_OPTS_INTERACTIVEFILL), FALSE);
01142     ERROR2IF(!ReadOk,FALSE,_R(IDE_OPTS_READPREF_VIEW));
01143     
01144     INT32 ViewDither = 2;
01145     ReadOk = Camelot.GetPrefValue(_T("Screen"), _T("ViewDither"), &ViewDither);
01146     SetSelectedDither(ViewDither);
01147     ERROR2IF(!ReadOk,FALSE,_R(IDE_OPTS_READPREF_VIEW));
01148 
01149     // Set up the attributes which are document/view specific
01150     ok = GetDisplayStyleForView();
01151 
01152     return TRUE;
01153 }
01154 
01155 
01156 // Array of control IDs for the Get/SetSelectedDither functions
01157 
01158 static CGadgetID DitherGadgets[] = {_R(IDC_OPTS_DITHER_NONE),
01159                                     _R(IDC_OPTS_DITHER_ORDERED),
01160                                     _R(IDC_OPTS_DITHER_DIFFUSED),
01161                                     0};
01162 
01163 
01164 
01165 /********************************************************************************************
01166 
01167 >   INT32 ViewTab::GetSelectedDither(void)
01168 
01169 
01170     Author:     Gerry_Iles (Xara Group Ltd) <camelotdev@xara.com>
01171     Created:    10/5/96
01172     Inputs:     -
01173     Outputs:    -
01174     Returns:    The GDraw dither style specified by the controls
01175     Purpose:    Converts the state of the radio button controls to a dither style
01176     Errors:     -
01177     SeeAlso:    -
01178 
01179 ********************************************************************************************/
01180 
01181 INT32 ViewTab::GetSelectedDither(void)
01182 {
01183     INT32 DitherStyle = 2;  // Default to ordered dither
01184 
01185     CGadgetID Gadget = pPrefsDlg->GetRadioGroupSelected(DitherGadgets);
01186 
01187     if (Gadget ==  _R(IDC_OPTS_DITHER_NONE))
01188         DitherStyle = 4;
01189     else if (Gadget == _R(IDC_OPTS_DITHER_ORDERED))
01190         DitherStyle = 2;
01191     else if (Gadget == _R(IDC_OPTS_DITHER_DIFFUSED))
01192         DitherStyle = 3;
01193 
01194     return(DitherStyle);
01195 }
01196 
01197 
01198  
01199 /********************************************************************************************
01200 
01201 >   void ViewTab::SetSelectedDither(INT32 DitherStyle)
01202 
01203 
01204     Author:     Gerry_Iles (Xara Group Ltd) <camelotdev@xara.com>
01205     Created:    10/5/96
01206     Inputs:     DitherStyle - the GDraw dither style
01207     Outputs:    -
01208     Returns:    TRUE if it succeeded
01209     Purpose:    Sets the radio buttons to the correct state for the supplied dither style
01210     Errors:     -
01211     SeeAlso:    DialogOp::SetRadioGroupSelected()
01212 
01213 ********************************************************************************************/
01214 
01215 BOOL ViewTab::SetSelectedDither(INT32 DitherStyle)
01216 {
01217     CGadgetID Gadget = _R(IDC_OPTS_DITHER_ORDERED);
01218 
01219     switch(DitherStyle)
01220     {
01221         case 4:
01222             Gadget = _R(IDC_OPTS_DITHER_NONE);
01223             break;
01224 
01225         case 1:
01226         case 2:
01227             Gadget = _R(IDC_OPTS_DITHER_ORDERED);
01228             break;
01229 
01230         case 0:
01231         case 3:
01232             Gadget = _R(IDC_OPTS_DITHER_DIFFUSED);
01233             break;
01234 
01235         default:
01236             break;
01237     }
01238 
01239     return(pPrefsDlg->SetRadioGroupSelected(DitherGadgets, Gadget));
01240 }
01241 
01242 
01243 #endif //webster

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