webprefs.cpp

Go to the documentation of this file.
00001 // $Id: webprefs.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 // WebPrefs.cpp
00100 //
00101 // This file implements the dialogue box that allows the user to set the export web file
00102 // preferences.
00103 
00104 /*
00105 */
00106 
00107 #include "camtypes.h"
00108 //#include "app.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00109 //#include "spread.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00110 #include "page.h"
00111 #include "layer.h"
00112 
00113 #include "xarprefs.h"
00114 #include "webprefs.h"
00115 #include "webparam.h"
00116 
00117 //#include "filtrres.h" // _R(IDS_WEBPREFSDLG)
00118 
00119 //#include "ensure.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00120 //#include "errors.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00121 //#include "dlgtypes.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00122 //#include "resource.h"
00123 //#include "rikdlg.h"       // _R(IDB_SLIDERBASE), _R(IDB_SLIDERSLIDER)
00124 //#include "xardlg.h"       // Resource file for the base dialogue.
00125 //#include "webdlg.h"       // Resource file for the dialogue.
00126 
00127 //#include "dialogop.h" // DialogOp header - in camtypes.h [AUTOMATICALLY REMOVED]
00128 #include "dlgmgr.h"     // Dialogue manager class
00129 //#include "msg.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00130 //#include "justin2.h"  // _R(IDS_PERCENT_FORMAT)
00131 
00132 #include "bmpcomp.h"    // bitmap list
00133 //#include "bitmap.h"       // kernel bitmap  - in camtypes.h [AUTOMATICALLY REMOVED]
00134 
00135 // This is not compulsory, but you may as well put it in so that the correct version
00136 // of your file can be registered in the .exe
00137 DECLARE_SOURCE("$Revision: 1282 $");
00138 
00139 // An implement to match the Declare in the .h file.
00140 // If you have many classes, it is recommended to place them all together, here at the start of the file
00141 CC_IMPLEMENT_DYNCREATE  ( WebPrefsDlg,      NativePrefsDlg )
00142 CC_IMPLEMENT_MEMDUMP    ( WebPrefsDlgParam, OpParam )
00143 
00144 // This will get Camelot to display the filename and linenumber of any memory allocations
00145 // that are not released at program exit
00146 #define new CAM_DEBUG_NEW
00147 
00148 /******************************************************************************************
00149 
00150 >   WebPrefsDlg::WebPrefsDlg () : NativePrefsDlg ( _R(IDD_EXPORTWEBOPTS) )
00151 
00152     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00153     Created:    1/5/96
00154     Inputs:     -
00155     Outputs:    -
00156     Returns:    -
00157     Purpose:    WebPrefsDlg constructor. Creates a non-undoable operation
00158     Errors:     -
00159     SeeAlso:    -
00160 
00161 ******************************************************************************************/
00162 
00163 WebPrefsDlg::WebPrefsDlg () : NativePrefsDlg ( _R(IDD_EXPORTWEBOPTS) )
00164 {
00165     // The base class takes care of all the business.
00166 }
00167 
00168 /******************************************************************************************
00169 
00170 >   BOOL WebPrefsDlg::CommitDialogValues(WebPrefsDlg* pWebPrefs)
00171 
00172     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00173     Created:    1/5/96
00174     Inputs:     pointer to the dialogue box
00175     Outputs:    -
00176     Returns:    True if values in dialog box ok, False otherwise.     
00177     Purpose:    Takes the values in the dialog box and sets the return values accordingly
00178                 Called when ok is pressed on the dialog box.
00179     Errors:     -
00180     SeeAlso:    WebPrefsDlg::CommitDialogValues;
00181 
00182 ******************************************************************************************/
00183 
00184 BOOL WebPrefsDlg::CommitDialogValues ()
00185 {
00186     // Ok has been pressed so take the values and set up the static values so that the
00187     // caller can access them
00188 
00189     BOOL Valid = 0; // Flag for validity of value
00190     BOOL State = 0; // Flag for reading the state of gadgets
00191 
00192     // Work out what is currently selected
00193     // Graeme (25/1/00) - Split SetSelType up into SetExportSel and SetViewportSel.
00194     mpParams->SetViewportSel    ( GetExportSelection ( _R(IDC_WEBOPTS_DRAWING)) );  
00195     
00196     // WEBSTER - markn 28/1/97
00197     // Always compress file
00198 #ifndef WEBSTER
00199     BOOL Compression = GetLongGadgetValue(_R(IDC_WEBOPTS_COMPRESS), 0, 1, 0, &Valid);
00200     mpParams->SetCompression(Compression);
00201 #else
00202     mpParams->SetCompression(TRUE);  
00203 #endif // WEBSTER
00204 
00205     // Switch is Remove preview bitmap and so logic is reversed
00206     BOOL ExportPreviewBitmap = !GetLongGadgetValue(_R(IDC_WEBOPTS_PREVIEWBITMAP), 0, 1, 0, &Valid);
00207     mpParams->SetExportPreviewBitmap(ExportPreviewBitmap);
00208 
00209     BOOL ConvertTextToOutlines = GetLongGadgetValue(_R(IDC_WEBOPTS_TEXTOUTLINES), 0, 1, 0, &Valid);
00210     mpParams->SetConvertTextToOutlines(ConvertTextToOutlines);
00211 
00212     // No need to convert blends to outlines anymore, because the compact renderer can cope with
00213     // them now.  (29 today, and wondering whether I should be spending the last days of my twenties doing this)
00214     mpParams->SetConvertBlendsToOutlines(FALSE);
00215     
00216     // WEBSTER - markn 28/1/97
00217     // Always default to non-minimal format
00218 #ifndef WEBSTER
00219     BOOL MinimalWebFormat = GetLongGadgetValue(_R(IDC_WEBOPTS_MINIMAL), 0, 1, 0, &Valid);
00220     mpParams->SetMinimalWebFormat(MinimalWebFormat);
00221 #else
00222     mpParams->SetMinimalWebFormat(FALSE);
00223 #endif // WEBSTER
00224 
00225     // WEBSTER - markn 28/1/97
00226     // Always default to remove invisible layers
00227 #ifndef WEBSTER
00228     BOOL RemoveInvisibleLayers = GetLongGadgetValue(_R(IDC_WEBOPTS_INVISIBLELAYERS), 0, 1, 0, &Valid);
00229     mpParams->SetRemoveInvisibleLayers(RemoveInvisibleLayers);
00230 #else
00231     mpParams->SetRemoveInvisibleLayers(TRUE);
00232 #endif // WEBSTER
00233 
00234     // WEBSTER - markn 28/1/97
00235     // Always default to DON'T remove unused colours
00236 #ifndef WEBSTER
00237     BOOL RemoveUnusedColours = GetLongGadgetValue(_R(IDC_WEBOPTS_UNUSEDCOLOURS), 0, 1, 0, &Valid);
00238     mpParams->SetRemoveUnusedColours(RemoveUnusedColours);
00239 #else
00240     mpParams->SetRemoveUnusedColours(FALSE);
00241 #endif // WEBSTER
00242 
00243     // Get bitmap compression quality slider value
00244     INT32 Quality = 75;
00245     INT32 SliderState = GetLongGadgetValue(_R(IDC_WEBOPTS_QUALITY), 0, 100, 0, &Valid);
00246     if (Valid)
00247     {
00248         // Get that quality setting
00249         Quality = 100 - SliderState; 
00250     }
00251 
00252     BOOL MinimiseBmpSize = GetLongGadgetValue(_R(IDC_WEBOPTS_MINIMISEBITMAPRES), 0, 1, 0, &Valid);
00253     if (!MinimiseBmpSize)
00254     {
00255         // Set the bitmap compression to a large value to indicate none required.
00256         // Actually add 101 to the quality value so we remember the old value and signify that the
00257         // switch is off
00258         mpParams->SetBmpCompression(Quality + 101);
00259     }
00260     else
00261     {
00262         // return the value on the slider to the caller
00263         mpParams->SetBmpCompression(Quality); 
00264     }
00265 
00266     //Added by Graham 21/5/97
00267     //Get the state of the "Put HTML on clipboard" radio button
00268     //This applies in both Webster and camelot
00269     BOOL PutHTMLOnClipboard = GetLongGadgetValue(_R(IDC_WEBOPTS_HTMLTAG), 0, 1, 0, &Valid);
00270     if (Valid)
00271         mpParams->SetHTMLToClipboard(PutHTMLOnClipboard);
00272 
00273 
00274     return NativePrefsDlg::CommitDialogValues ();
00275 }
00276 
00277 /******************************************************************************************
00278 
00279 >   MsgResult WebPrefsDlg::Message(CDlgMessage DlgMsg, CGadgetID Gadget) 
00280 
00281 
00282     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00283     Created:    1/5/96
00284     Inputs:     -
00285     Outputs:    -
00286     Returns:    -
00287     Purpose:    Handles all the web preferences dialog's messages
00288     Errors:     -
00289     SeeAlso:    -
00290 
00291 ******************************************************************************************/
00292 
00293 MsgResult WebPrefsDlg::Message(Msg* Message)
00294 {
00295     if (IS_OUR_DIALOG_MSG(Message) && mpParams)
00296     {
00297         DialogMsg* Msg = (DialogMsg*)Message;
00298 
00299         // Should now handle the required messages that we respond to
00300         switch (Msg->DlgMsg)
00301         {
00302             case DIM_LFT_BN_CLICKED:
00303                 // A control on the dialog box has been clicked...
00304                 switch (Msg->GadgetID)
00305                 {
00306                     case _R(IDC_WEBOPTS_MINIMISEBITMAPRES):
00307                     {
00308                         BOOL Valid = TRUE;
00309                         BOOL MinimiseBmpSize = GetLongGadgetValue(_R(IDC_WEBOPTS_MINIMISEBITMAPRES), 0, 1, 0, &Valid);
00310 
00311                         // Grey the slider according to the minimise bitmaps switch
00312                         EnableGadget(_R(IDC_WEBOPTS_QUALITY), MinimiseBmpSize);
00313                         EnableGadget(_R(IDC_WEBOPTS_PERCENT), MinimiseBmpSize);
00314                         EnableGadget(_R(IDC_WEBOPTS_0PERCENT), MinimiseBmpSize);
00315                         EnableGadget(_R(IDC_WEBOPTS_100PERCENT), MinimiseBmpSize);
00316                     }
00317                     break;
00318 
00319 // WEBSTER - Graham 8/7/97
00320 // No left button click handing needed for this button
00321 #ifndef WEBSTER
00322 
00323                     case _R(IDC_WEBOPTS_MINIMAL):
00324                     {
00325                         BOOL Valid = TRUE;
00326                         BOOL MinimalWebFormat = GetLongGadgetValue(_R(IDC_WEBOPTS_MINIMAL), 0, 1, 0, &Valid);
00327 
00328                         // These switches are only appropriate if we are not in minimal mode
00329                         EnableGadget(_R(IDC_WEBOPTS_INVISIBLELAYERS), !MinimalWebFormat);
00330                         EnableGadget(_R(IDC_WEBOPTS_UNUSEDCOLOURS), !MinimalWebFormat);
00331                     }
00332                     break;
00333 #endif // WEBSTER
00334                 }
00335 
00336 
00337             break; // DIM_LFT_BN_CLICKED        
00338 
00339             case DIM_SLIDER_POS_CHANGING:
00340                 // special message for the JPEG qualty control
00341                 // Messages to all the controls, handled individually
00342                 switch (Msg->GadgetID)
00343                 {
00344                     case _R(IDC_WEBOPTS_QUALITY):
00345                     {
00346                         // Find the current quality scroller's position
00347                         TCHAR Str[32];
00348                         BOOL Valid;
00349                         INT32 Result = GetLongGadgetValue(_R(IDC_WEBOPTS_QUALITY), 0, 100, 0, &Valid);
00350                         Result = 100 - Result;
00351 
00352                         // Build the Percentage string and set it
00353                         String_32 jcf(_R(IDS_PERCENT_FORMAT));
00354                         wsprintf(Str, jcf, (INT32) Result);
00355                         String_32 PercentStr(Str);
00356                         SetStringGadgetValue(_R(IDC_WEBOPTS_PERCENT), &PercentStr);
00357                     }
00358                     break;
00359                 }
00360             break; // DIM_SLIDER_POS_CHANGING       
00361         }
00362     }
00363 
00364     return NativePrefsDlg::Message(Message); 
00365 }
00366 
00367 /******************************************************************************************
00368 
00369 >   BOOL WebPrefsDlg::Init ()
00370 
00371     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00372     Created:    1/5/96
00373     Inputs:     -
00374     Outputs:    -
00375     Returns:    -
00376     Purpose:    WebPrefsDlg Init method
00377     Errors:     -
00378     SeeAlso:    -
00379 
00380 ******************************************************************************************/
00381 
00382 BOOL WebPrefsDlg::Init ()
00383 {
00384     BOOL InitOK;
00385 
00386     InitOK = RegisterOpDescriptor(
00387                                 0,                  /* Tool ID */
00388                                 _R(IDS_WEBPREFSDLG),
00389                                 CC_RUNTIME_CLASS(WebPrefsDlg),
00390                                 OPTOKEN_WEBPREFSDLG,
00391                                 GetState,
00392                                 0,                  /* help ID */
00393                                 0,                  /* bubble help */
00394                                 0,                  /* resource ID */
00395                                 0                   /* control ID */
00396                                 );
00397 
00398     return (InitOK);
00399 }
00400 
00401 /********************************************************************************************
00402 
00403 >   BOOL WebPrefsDlg::Create()
00404 
00405     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00406     Created:    1/5/96
00407     Inputs:     -
00408     Outputs:    -
00409     Returns:    TRUE if successful, else FALSE
00410     Purpose:    WebPrefsDlg create method 
00411     Errors:     -
00412     SeeAlso:    -
00413 
00414 ********************************************************************************************/
00415        
00416 BOOL WebPrefsDlg::Create()
00417 {                     
00418     // Pass the responsibility to the baseclass.
00419     return NativePrefsDlg::Create ();
00420 }
00421 
00422 /******************************************************************************************
00423 
00424 >   BOOL WebPrefsDlg::CheckIfCompatibleBitmaps(Document* pDoc)
00425 
00426     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00427     Created:    29/8/96
00428     Inputs:     pointer to the document to check
00429     Outputs:    -
00430     Returns:    TRUE if compatible bitmaps are present, else FALSE
00431     Purpose:    Checks if any of the bitmaps in the specified document are JPEGable 
00432     Errors:     -
00433     SeeAlso:    -
00434 
00435 ******************************************************************************************/
00436 
00437 BOOL WebPrefsDlg::CheckIfCompatibleBitmaps(Document* pDoc)
00438 {
00439     ERROR2IF(pDoc == NULL,FALSE,"WebPrefsDlg::CheckIfCompatibleBitmaps null pDoc");
00440 
00441     BitmapList* pBitmaps = pDoc->GetBitmapList();
00442 
00443     // The bitmap list contains bitmaps which may not actually be being used,
00444     // so lets find the ones that are really being used ...
00445 
00446     BOOL CompatibleBitmapsFound = FALSE;
00447 
00448     if (pBitmaps)
00449     {
00450         // Go through all the bitmaps in the list 
00451         ListItem *Ptr = pBitmaps->GetHead();
00452         while (Ptr != NULL)
00453         {
00454             KernelBitmap* pBmp = (KernelBitmap*)Ptr;
00455 
00456             if (pBmp->IsUsedInDocument(pDoc))
00457             {
00458                 // If it gets here then you've found a bitmap that is being used in the document
00459                 // Check the colour depth of the bitmap, if its JPEGable then set our flag True
00460                 UINT32 Bpp = pBmp->GetBPP();
00461                 // Check if the bitmap has a transparent colour or masking colour present.
00462                 // If so then we may need to change our saving strategy
00463                 INT32 TransparentColour = -1;
00464                 if (Bpp <= 8)
00465                     pBmp->GetTransparencyIndex(&TransparentColour);
00466                 // See if we have a BitmapSource for the bitmap 
00467                 BitmapSource* pSource = NULL;
00468                 BaseBitmapFilter* pDummyFilter;
00469                 BOOL OriginalSourcePresent = pBmp->GetOriginalSource(&pSource, &pDummyFilter);
00470                 
00471                 // Only JPEGable at present, if 24bpp and 8bpp but not 8bpp with a transparent colour
00472                 if (!OriginalSourcePresent && (Bpp == 24 || (Bpp == 8 && TransparentColour == -1)))
00473                     CompatibleBitmapsFound = TRUE;
00474             }
00475             
00476             Ptr = pBitmaps->GetNext(Ptr);
00477         }
00478     }
00479 
00480     return CompatibleBitmapsFound;
00481 }
00482 
00483 /******************************************************************************************
00484 
00485 >   BOOL WebPrefsDlg::InitDialog(WebPrefsDlg* pWebPrefs)
00486 
00487     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00488     Created:    1/5/96
00489     Inputs:     -
00490     Outputs:    -
00491     Returns:    TRUE if successful, else FALSE
00492     Purpose:    Sets initial dialog values 
00493     Errors:     -
00494     SeeAlso:    -
00495 
00496 ******************************************************************************************/
00497 
00498 BOOL WebPrefsDlg::InitDialog ( void )
00499 {
00500     ERROR2IF(mpParams == NULL, FALSE, "WebPrefsDlg::InitDialog called after duff initialisation?!");
00501 
00502     // Set up the save spread/selection radio buttons
00503     // Rewritten by Graham 6/8/97
00504 
00505     //First, do we have a selection?
00506     Application * pApp = GetApplication();
00507 
00508     ERROR2IF(pApp == NULL, FALSE,"WebPrefsDlg::InitDialog -  no application!");
00509     
00510     SelRange* pRange = pApp->FindSelection();
00511     
00512     ERROR2IF(pRange == NULL, FALSE,"WebPrefsDlg::InitDialog - no selection range!");
00513     DocRect ClipRect = pRange->GetBoundingRect();
00514     
00515     BOOL fThereIsASelection=!ClipRect.IsEmpty();
00516 
00517     //Now, is there a selection?
00518     if (fThereIsASelection)
00519     {
00520         // Yes. So ungrey both the buttons for selecting the nodes to export.
00521         EnableGadget(_R(IDC_NATIVEOPTS_SELECT), TRUE);
00522         EnableGadget(_R(IDC_NATIVEOPTS_DRAWING), TRUE);
00523 
00524         // Graeme (25-1-00) - and Also the viewport buttons.
00525         EnableGadget(_R(IDC_WEBOPTS_SELECT), TRUE);
00526         EnableGadget(_R(IDC_WEBOPTS_DRAWING), TRUE);
00527 
00528         //Now, which of those buttons should be selected?
00529         switch ( mpParams->GetExportSel () )
00530         {
00531         case SELECTION:
00532             // Choose the export pair of buttons.
00533             SetLongGadgetValue(_R(IDC_NATIVEOPTS_DRAWING), FALSE);
00534             SetLongGadgetValue(_R(IDC_NATIVEOPTS_SELECT), TRUE);
00535             break;
00536 
00537         default:
00538         case DRAWING:
00539             // Choose the export pair of buttons.
00540             SetLongGadgetValue(_R(IDC_NATIVEOPTS_DRAWING), TRUE);
00541             SetLongGadgetValue(_R(IDC_NATIVEOPTS_SELECT), FALSE);
00542             break;
00543         }
00544 
00545         // Graeme (25-1-00) - Repeat for the viewport selection.
00546         switch ( mpParams->GetViewportSel () )
00547         {
00548         case SELECTION:
00549             // Choose the viewport pair of buttons.
00550             SetLongGadgetValue(_R(IDC_WEBOPTS_DRAWING), FALSE);
00551             SetLongGadgetValue(_R(IDC_WEBOPTS_SELECT), TRUE);
00552             break;
00553 
00554         default:
00555         case DRAWING:
00556             // Choose the viewport pair of buttons.
00557             SetLongGadgetValue(_R(IDC_WEBOPTS_DRAWING), TRUE);
00558             SetLongGadgetValue(_R(IDC_WEBOPTS_SELECT), FALSE);
00559             break;
00560         }
00561     }
00562     else
00563     {
00564         //No. So grey the SELECTION button and ungrey
00565         //the DRAWING button
00566         EnableGadget(_R(IDC_NATIVEOPTS_SELECT), FALSE);
00567         EnableGadget(_R(IDC_NATIVEOPTS_DRAWING), TRUE);
00568 
00569         // Graeme (25-1-00) - Added to grey the viewport controls.
00570         EnableGadget(_R(IDC_WEBOPTS_SELECT), FALSE);
00571         EnableGadget(_R(IDC_WEBOPTS_DRAWING), TRUE);
00572 
00573         //And we must select the DRAWING button for the export area controls.
00574         SetLongGadgetValue(_R(IDC_NATIVEOPTS_DRAWING), TRUE);
00575         SetLongGadgetValue(_R(IDC_NATIVEOPTS_SELECT), FALSE);
00576 
00577         // Graeme (25-1-00) - And set the selection for the viewport area.
00578         SetLongGadgetValue(_R(IDC_WEBOPTS_DRAWING), TRUE);
00579         SetLongGadgetValue(_R(IDC_WEBOPTS_SELECT), FALSE);
00580     }
00581 
00582     // Preview bitmap switch is Remove preview bitmap and so is reverse logic
00583     SetLongGadgetValue(_R(IDC_WEBOPTS_PREVIEWBITMAP), !mpParams->GetExportPreviewBitmap());
00584 
00585     SetLongGadgetValue(_R(IDC_WEBOPTS_TEXTOUTLINES), mpParams->GetConvertTextToOutlines());
00586 
00587 #ifndef WEBSTER
00588     // WEBSTER - markn 28/1/97
00589     // Most buttons removed
00590     SetLongGadgetValue(_R(IDC_WEBOPTS_MINIMAL), mpParams->GetMinimalWebFormat());
00591 
00592     SetLongGadgetValue(_R(IDC_WEBOPTS_INVISIBLELAYERS), mpParams->GetRemoveInvisibleLayers());
00593 
00594     SetLongGadgetValue(_R(IDC_WEBOPTS_UNUSEDCOLOURS), mpParams->GetRemoveUnusedColours());
00595 
00596     // These switches are only appropriate if we are not in minimal mode
00597     EnableGadget(_R(IDC_WEBOPTS_INVISIBLELAYERS), !mpParams->GetMinimalWebFormat());
00598     EnableGadget(_R(IDC_WEBOPTS_UNUSEDCOLOURS), !mpParams->GetMinimalWebFormat());
00599 #endif // WEBSTER
00600 
00601     //Graham 21/5/97
00602     //Set the "Put HTML on clipboard switch"
00603     SetLongGadgetValue(_R(IDC_WEBOPTS_HTMLTAG), mpParams->GetHTMLToClipboard());
00604 
00605     // Set up the quality slider and percentage display
00606     INT32 Quality = mpParams->GetBmpCompression();  // Default Quality
00607 
00608     //Graham 8/7/97: If we're in Webster, the default value of the minimise
00609     //bitmap size switch is FALSE. In CorelXARA, it's TRUE.
00610     // This has been removed as it breaks the system. The Quality is what really
00611     // controls this. This means that the user is shown no compression but the quality
00612     // setting means that it will compress! Neville 10/10/97
00613     BOOL MinimiseBmpSize = TRUE;
00614     // If the value is bigger than 100 then minimise bitmap resolution
00615     // is False
00616     if (Quality > 100)
00617     {
00618         // Move the range back down into the 0-100 range
00619         // 101 - 201 means JPEG compression off but this is the old JPEG slider position
00620         Quality -= 101;
00621         // Double checked that we are in the required range
00622         if (Quality < 0 || Quality > 100)
00623             Quality = 100; 
00624         
00625         MinimiseBmpSize = FALSE;
00626     }
00627 
00628     SetLongGadgetValue(_R(IDC_WEBOPTS_MINIMISEBITMAPRES), MinimiseBmpSize);
00629 
00630     // Set the range of the slider control plus a step value of 1
00631     SetGadgetRange(_R(IDC_WEBOPTS_QUALITY), 0, 100, 1);
00632     SetGadgetBitmaps(_R(IDC_WEBOPTS_QUALITY), _R(IDB_SLIDERBASE), _R(IDB_SLIDERSLIDER));
00633     SetLongGadgetValue(_R(IDC_WEBOPTS_QUALITY), 100 - Quality);
00634     
00635     // Set the percentage string
00636     TCHAR Str[32];
00637     String_32 jcf(_R(IDS_PERCENT_FORMAT));
00638     camSprintf(Str, jcf, Quality);
00639     String_32 PercentStr(Str);
00640     SetStringGadgetValue(_R(IDC_WEBOPTS_PERCENT), &PercentStr);
00641 
00642     Document* pDoc = Document::GetSelected();
00643     BOOL CompatibleBitmaps = CheckIfCompatibleBitmaps(pDoc);
00644     if (CompatibleBitmaps)
00645     {
00646         EnableGadget(_R(IDC_WEBOPTS_MINIMISEBITMAPRES), TRUE);
00647     }
00648     else
00649     {
00650         EnableGadget(_R(IDC_WEBOPTS_MINIMISEBITMAPRES), FALSE);
00651         // Force the JPEG slider to be greyed
00652         MinimiseBmpSize = FALSE;
00653     }
00654     
00655     // Grey the slider according to the minimise bitmaps switch
00656     EnableGadget(_R(IDC_WEBOPTS_QUALITY), MinimiseBmpSize);
00657     EnableGadget(_R(IDC_WEBOPTS_PERCENT), MinimiseBmpSize);
00658     EnableGadget(_R(IDC_WEBOPTS_0PERCENT), MinimiseBmpSize);
00659     EnableGadget(_R(IDC_WEBOPTS_100PERCENT), MinimiseBmpSize);
00660 
00661     return TRUE;
00662 }
00663 

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