bmpprefs.h

Go to the documentation of this file.
00001 // $Id: bmpprefs.h 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 // Header file for BmpPrefs.cpp
00100 //
00101 // 
00102 
00103 #ifndef INC_BMPPREFS
00104 #define INC_BMPPREFS
00105 
00106 //#include "bmpdlg.h"
00107 //#include "bitmap.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00108 //#include "dialogop.h"
00109 //#include "dibconv.h"              // for DITHER - in camtypes.h [AUTOMATICALLY REMOVED]
00110 #include "gpalopt.h"
00111 #include "filter_types.h"
00112 
00113 class BitmapExportDocument;
00114 class DocRect;
00115 //class MaskedFilterExportOptions;
00116 class BitmapExportParam;
00117 class BmpDlgParam;
00118 class CXaraFileRecord;
00119 
00120 
00121 enum PALETTE
00122 {
00123     PAL_STANDARD    = 0,    // just to make sure
00124     PAL_OPTIMISED,
00125     PAL_BROWSER,
00126     PAL_GLOBALOPTIMISED,
00127     PAL_WEBSNAP             //  For the 'WebSnap optimised' option.
00128 };
00129 
00130 
00131 //  This enum is used with the antialiasing options on the bitmap tab
00132 //  of the bitmap export options dialog.
00133 enum ANTIALIASING
00134 {
00135     MAINTAIN_SCREEN_AA  = 0,    //  Just to make sure
00136     MINIMISE_VISIBLE_AA
00137 };
00138 
00139 
00140 //  The following 2 structures are for an 'expanded' palette, containing all the information shown 
00141 //  in the palette control of the bitmap export dialog. 
00142 typedef struct
00143 {
00144     BYTE Red;
00145     BYTE Green;
00146     BYTE Blue;
00147     INT32 Flags;                    //  properties that the colour has. 
00148     BYTE PreEditedRed;
00149     BYTE PreEditedGreen;
00150     BYTE PreEditedBlue;
00151 } ExtendedPaletteEntry;
00152 
00153 
00154 typedef struct
00155 {
00156     INT32 NumberOfColours;
00157     ExtendedPaletteEntry Data[256];
00158 } ExtendedPalette;
00159 
00160 
00161 //  Enum for the different display types in the File type drop list in the bitmap export dialog.
00162 //  The current type is stored in a variable in the bitmap export options.
00163 //enum ExportFileType { GIF_TYPE = 0, PNG_TYPE, BMP_TYPE, JPG_TYPE };
00164 
00165 typedef double      DPI;
00166 typedef UINT32      BMP_SIZE;   // that's in pixels
00167 typedef UINT32      BMP_DEPTH;  // that's in planes
00168 typedef INT32       FILTER_ID;
00169 
00170 /********************************************************************************************
00171 >   PaletteMarkType
00172     Author:     Alex_Price (Xara Group Ltd) <camelotdev@xara.com>
00173     Date:       01/07/99
00174     Comment:    This is meant for the palette drawing code. It represents
00175                 all the different marks that can be drawn in any one of the palette control's
00176                 colour rectangles.
00177 
00178                 ...and the flags the palette uses! -- Jonathan
00179 ********************************************************************************************/ 
00180 typedef enum
00181 {
00182     LOCKED_COLOUR           = 1,
00183     TRANSPARENT_COLOUR      = 2,
00184     DELETED_COLOUR          = 4,
00185 } PaletteMarkType;
00186 
00187 
00188 /********************************************************************************************
00189 >   class BitmapExportOptions : public OpParam
00190 
00191     Author:     Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
00192     Created:    30/10/96
00193     Purpose:    Base class for storing information about the bitmap we're exporting.
00194 ********************************************************************************************/
00195 
00196 class BitmapExportOptions : public OpParam
00197 {
00198     CC_DECLARE_DYNCREATE(BitmapExportOptions)
00199 
00200 public:
00201     BitmapExportOptions();
00202     BitmapExportOptions(const CDlgResID DialogID, const FilterType FilterID, 
00203                         const StringBase* pFilterName);
00204     ~BitmapExportOptions();
00205     static BOOL Init();
00206     static BOOL Declare();
00207 
00208     // Data Integrity Checking
00209     BOOL        IsValid() const;
00210     void        MarkInvalid();
00211     void        MarkValid();
00212 
00213     // Options persistence
00214     virtual BOOL    RetrieveDefaults();
00215     virtual BOOL    SetAsDefaults() const;
00216 
00217     // Save and load from named export set properties.
00218     virtual BOOL Write(CXaraFileRecord* pRec);
00219     virtual BOOL Read(CXaraFileRecord* pRec);
00220 
00221     // Data member access functions
00222     DPI             GetDPI() const;
00223     BOOL            SetDPI(const DPI& Dpi);
00224 
00225     virtual BOOL    GetSupportsImageMap() { return FALSE; }
00226 
00227     // WEBSTER - markn 5/2/97
00228     virtual INT32 GetTransparencyIndex()    const                   { return m_TransparencyIndex; }
00229     virtual void SetTransparencyIndex(INT32 TransparencyIndex);
00230 
00231     BMP_DEPTH       GetDepth() const;
00232     BOOL            SetDepth(const BMP_DEPTH& Depth);
00233 
00234     SelectionType   GetSelectionType() const    { return m_SelectionType;   }
00235     void            SetSelectionType(const SelectionType& Sel);
00236 
00237     BOOL            GetSeparateLayerFiles() const               {return m_bSeparateLayerFiles;}
00238     void            SetSeparateLayerFiles(const BOOL newFlag)   {m_bSeparateLayerFiles = newFlag;}
00239 
00240     BOOL            GetTempFileFlag() const                     {return m_bTempFileFlag;}
00241     void            SetTempFileFlag(const BOOL newFlag)         {m_bTempFileFlag = newFlag;}
00242 
00243     CDlgResID           GetDialogType() const                   {return m_DialogID;}
00244     const FilterType    GetFilterType() const                   {return m_FilterID;}
00245     const StringBase*   GetFilterName() const;
00246 
00247     // smfix 
00248     virtual UINT32 GetFilterNameStrID() { return 0;} // this should be overriden by other export option subclasses
00249     BaseBitmapFilter * FindBitmapFilterForTheseExportOptions(); // uses the about String ID to find a filter of the right name
00250 
00251     Coord           GetOutputSize()                 { return m_OutputSize;  }
00252     void            SetOutputSize(UINT32 x, UINT32 y)   { m_OutputSize.x = (INT32) x; m_OutputSize.y = (INT32) y;   }
00253     Coord           GetPixelOutputSize()                    { return m_PixelOutputSize; }
00254     void            SetPixelOutputSize(UINT32 x, UINT32 y)  { m_PixelOutputSize.x = (INT32) x; m_PixelOutputSize.y = (INT32) y; }
00255     BmpDlgParam*    GetBmpDlgParam()                { return m_pBmpDlgParam; }
00256     BOOL            SetBitmapExportParam(BitmapExportParam* pParam); 
00257     virtual BOOL    CanExportSeparateLayers();
00258 
00259 // WEBSTER - markn 17/1/97
00260     virtual void SetNumColsInPalette(UINT32 NumCols)            { m_NumColsInPalette = NumCols; }
00261     virtual void SetUseSystemColours(BOOL SystemColours)    { m_UseSystemColours = SystemColours; }
00262     virtual UINT32 GetNumColsInPalette()                        { return m_NumColsInPalette; }
00263     virtual BOOL GetUseSystemColours()                      { return m_UseSystemColours; }
00264     virtual BOOL UseSpecificNumColsInPalette()              { return FALSE; }
00265 
00266     //  Access functions for the aa variable.
00267     ANTIALIASING    GetAntiAliasing()   const               { return m_Antialiasing; }
00268     void            SetAntiAliasing( ANTIALIASING aa );
00269 
00270     // Provide a baseclass version which returns something
00271     virtual DITHER GetDither() const                { return XARADITHER_NONE; }
00272     virtual BOOL SetDither(const DITHER&) { ERROR3("The base class has no concept of dithering"); return FALSE; }
00273 
00274     BOOL ShouldPutHTMLTagOnClipboard()              { return m_fPutHTMLTagOnClipboard; }
00275     void SetPutHTMLTagOnClipboard(BOOL fValueToSet) { m_fPutHTMLTagOnClipboard = fValueToSet; }
00276 
00277     // for handling the temporary file during export
00278     void SetPathName(PathName *pTempPath);
00279     PathName GetPathName()                          { return m_TempPath; };
00280     BOOL HasTempFile()                              { return m_bTempFileExported; }
00281     void SetTempFileMatchesExportOptions(BOOL OptionsMatch) {m__TempFileMatchesExportOptions = OptionsMatch; }
00282     BOOL DoesTempFileMatchExportOptions() { return m__TempFileMatchesExportOptions; }
00283 
00284     // for object copying and comparing
00285     BitmapExportOptions* MakeCopy();
00286     virtual BOOL CopyFrom(BitmapExportOptions* pOther);
00287 
00288     // Same as above, except it is used to copy information when changing file types
00289     virtual BOOL FileTypeChangeCopyFrom(BitmapExportOptions *pOther);
00290 //  virtual BOOL Equal(BitmapExportOptions *pOther);
00291 
00292     void SetCanUseDesignNotes(BOOL ok)              { m_UseDesignNotes = ok; }
00293     BOOL GetCanUseDesignNotes() const               { return m_UseDesignNotes; }
00294 
00295 //  void SetPalette(ExtendedPalette* pPalette);
00296     ExtendedPalette* GetPalette();
00297     //SMFIX
00298 
00299     // Given an index into the logical palette, this function sets its flags so it is unreadable - this is used
00300     // as a bodge when deleting palette entrys
00301     void MakePaletteEntryUnreadable(INT32 i) { if (m__pLogicalPalette) m__pLogicalPalette->palPalEntry[i].peFlags = 255; }
00302 
00303     // create palette Optimiser
00304     // returns TRUE if created
00305     // returns FALSE if we already have a valid palette optimiser
00306     BOOL CreatePaletteOptimiser();
00307     // flush the palette optimiser if the bitmap source pixels have changed
00308     // since this will affect the stats that were fed into it
00309     void BitmapSourceHasChanged();
00310     // feed the optimiser with stats from the image
00311     void GatherPaletteStats(const RGBQUAD* pBitmap, UINT32 nSize );
00312     // this sets all the extended palette to fill in the optimised palette colours
00313     void CreateValidPalette();
00314     // this likewise sets the extended palette but from a known logical palette
00315     // which is only used in the creation of a global palette for all animated frames
00316     void CreateValidPalette(LOGPALETTE * pPal, INT32 TranspIndex = 0);
00317     // this likewise sets the extended palette to a preset browser palette
00318     // which is only used in the creation of a global palette for all animated frames
00319     void CreateValidBrowserPalette(BOOL WantTransp = TRUE);
00320 
00321     // used by the back end to get the logical palette which is managed
00322     // by this class and based on the extended palette
00323     LOGPALETTE * GetLogicalPalette();
00324 
00325     // Get Logical Palette gets uses the pre-edited colours as these are needed for consistant results
00326     // this function swaps these preedited colours to the postedited colours for any locked colour
00327     BOOL SwapEditedColoursInLogicalPalette();
00328 
00329     INT32 FindNextLockedColour(INT32 pos); // internal fn
00330 
00331     // the user wants a background transparent colour?
00332     BOOL IsBackgroundTransparent() { return m__BackgroundIsTransparent; }
00333     void SetBackgroundTransparency(BOOL t);
00334 
00335     // get the extended palette. Use this to edit what the locked colours are and
00336     // display the colours used etc.
00337     ExtendedPalette * GetExtendedPalette() { return &m_Palette; }
00338 
00339     BOOL IsClipToPage();
00340 
00341     // sjk 20/10/00 access functions to the variables put in to drive the palette optimiser
00342     // SMFIX
00343     BOOL IsPaletteValid(); // is the palette in this export object completely valid and perfect?
00344     void InvalidatePalette();
00345     INT32    GetNumberOfUserRequestedColours();
00346     void SetNumberOfUserRequestedColours(INT32 n);
00347     BOOL IsUsingBrowserPalette();
00348     void SetToUseBrowserPalette(BOOL SetIt);
00349     BOOL IsUsingSystemPalette();
00350     void SetToUseSystemPalette(BOOL SetIt);
00351     INT32  GetWebSnapPaletteAmount();
00352     void SetWebSnapPaletteAmount(INT32 SetIt);
00353     INT32  GetPrimarySnapPaletteAmount();
00354     void SetPrimarySnapPaletteAmount(INT32 SetIt);
00355 
00356     // SMFIX!! New Functions to help dialog setup
00357     DWORD GetSupportedDithers();
00358     DWORD GetInterlaceType();
00359     DWORD GetSupportedColourDepths();
00360     BOOL GetSupportsTransparency();
00361     BOOL GetSupportsPalette();
00362 
00363     void SetCMYK(BOOL SetIt);
00364     BOOL IsCMYK();
00365 
00366     // this enum is a list of colour depths we can show.
00367     // NOTE!!!! The values are bitfiled values so make sure adding a new one
00368     // is set to 64!!!!!
00369     enum eCOLOUR_DEPTHS
00370     {
00371         COLOUR_2 = 1,
00372         COLOUR_16 = 2,
00373         COLOUR_256 = 4,
00374         COLOUR_16BIT = 8,
00375         COLOUR_24BIT = 16,
00376         COLOUR_32BIT = 32
00377     };
00378 
00379     // this enum is a list of Interlacing and progresion we can show.
00380     // NOTE!!!! The values are bitfiled values so make sure adding a new one
00381     // is set to 8!!!!!
00382     enum eINTERLACE_PROGRESSIVE
00383     {
00384         GIF_INTERLACE = 1,
00385         PNG_INTERLACE = 2,
00386         JPG_PROGRESSIVE = 4
00387     };
00388 
00389     // this enum is a list of Dithering we can show.
00390     // NOTE!!!! The values are bitfiled values so make sure adding a new one
00391     // is set to 4!!!!!
00392     enum eDITHERING
00393     {
00394         ORDERED_DITHER = 1,
00395         ERROR_DITHER = 2
00396     };
00397 
00398 protected:
00399     BOOL ArePalettesEqual(BitmapExportOptions* pOther);
00400     void CopyPaletteInformationFrom(BitmapExportOptions* pOther);
00401 
00402 protected:
00403     SelectionType   m_SelectionType;            // ...remove this
00404     Coord           m_OutputSize;               // ...and this
00405     Coord           m_PixelOutputSize;          // Added by Graham 1/7/97
00406     FilterType      m_FilterID;                 // keep this rubbish for now
00407     BmpDlgParam*    m_pBmpDlgParam;
00408     BOOL            m_UseDesignNotes;           // sjk - use compat. files with Dream Weaver?
00409     BOOL            m_bSeparateLayerFiles;          // True if should export layers as separate files
00410     BOOL            m_bTempFileFlag;
00411 
00412 // WEBSTER - markn 17/1/97
00413     UINT32          m_NumColsInPalette;
00414     BOOL            m_UseSystemColours;
00415     static UINT32       g_NumColsInPalette;         // These persistant vars maintained in MaskedFilterExportOptions
00416     static BOOL     g_UseSystemColours;     
00417 
00418 public:
00419     BOOL m_fPutHTMLTagOnClipboard;              // Whether an HTML tag should be put on the clipboard
00420     static BOOL ms_fPutHTMLTagOnClipboard;      // The default value of whether an HTML tag should be put on the clipboard
00421     static TCHAR ms_strPutHTMLTagOnClipboard[]; // The string identifying our HTML tag preference
00422     static BOOL ms_IsBackGroundTransparent;
00423     static ANTIALIASING ms_Antialiasing;
00424     static BOOL ms_bSeparateLayerFiles;
00425 
00426 
00427 private:
00428     // Parameters that the dialog can set
00429     BOOL                m_bValid;               // Ok or cancel selected 
00430     DPI                 m_DPI;
00431     BMP_DEPTH           m_Depth;
00432 
00433     // WEBSTER - markn 5/2/97
00434     INT32               m_TransparencyIndex;
00435     CDlgResID           m_DialogID;
00436     const StringBase*   m_pFilterName;          // pointer to filter name
00437 
00438     // for the export preview dialog
00439     PathName            m_TempPath;             // the path to the temp file
00440     BOOL                m_bTempFileExported;    // true, if a temp file was exported
00441 
00442     //  Need the following to hold all the palette information for the bitmap
00443     ExtendedPalette     m_Palette;
00444     
00445     //  For use with the aa options in the bitmap size tab of the bitmap export dialog
00446     ANTIALIASING        m_Antialiasing;
00447 
00448 //  // Persistent buff
00449 //  static String_256 g_DefaultPath;
00450 
00451 
00452     // new variables added 20/10/00 by sjk in the recoding of the bitmap export dlg
00453     // the theory is that these export options can be used to regenerate the bitmap correctly
00454     // even if some change has occured to it
00455     // SMFIX
00456 
00457     BOOL m__PaletteIsValid; // this is the major flag, TRUE means that the palette held
00458                             // by the export object (m_Palette) is THE palette to use - no arguements.
00459                             // FALSE means that something has changed and the palette may no longer
00460                             // be exactly the best palette to use. But do not disregard it, it still holds the
00461                             // locked colours and the users edited colours. These can be passed to the palette
00462                             // optimiser to generate an optimal palette containing these colours that meets
00463                             // the spec of the export options.
00464 
00465     LOGPALETTE * m__pLogicalPalette; // A logical palette that is managed by this class. It can be accessed by GetLogicalPalette()
00466                                      // but should never be deleted by any other class.
00467                                      // This is invalidated when the palette is validated and is created on demand from the
00468                                      // extended palette.
00469 
00470     INT32 m__NumberOfColoursUserRequested; // This is the figure that the user has typed in the no of colours field.
00471                                          // this is a top range of the number of colours that we will give in the palette.
00472                                          // the palette may contain fewer than this.
00473                                          // If the colour depth is changed this value should be changed to match the largest
00474                                          // value available at this colour depth.
00475 
00476     // Flags of user preference that the palette optimiser needs to build a good optimal palette
00477     BOOL m__UseBrowserPalette;
00478     BOOL m__UseSystemColoursInPalette;
00479         // use like a bool, is an INT32 for future proofing. The value if the distance of the snap.
00480     INT32 m__UseWebSnapPalette;     // usually 12 if on
00481     INT32 m__UsePrimarySnapPalette; // usually 1 if on
00482 
00483     BOOL m__BackgroundIsTransparent; // Does the user want the background to be visible or not
00484                                      // if this is off this doesn't mean that there can be no transparency as the
00485                                      // user could have marked an arby colour in the palette as transparent
00486     PaletteOptimiser* m__pPaletteOptimiser; // ptr to the current palette optimiser
00487                                              // this can be null if there isn't one or we dont need a palette
00488     BOOL m__HavePrimedOptimier; // m__pPaletteOptimiser may be not null but has it been fed with stats and these stats been processed?
00489 
00490     BOOL m__TempFileMatchesExportOptions;   // This is TRUE when the options haven't been changed in a way
00491                                             // that would affect the appearance of the temp file
00492     BOOL m_bCMYK;
00493 };
00494 
00495 
00496 /********************************************************************************************
00497 >   class BmpPrefsDlg : public DialogOp
00498 
00499     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> 
00500     Created:    23/08/94
00501     Purpose:    The export bitmaps preference dialog box
00502     
00503                 Allows the user to set options like:-
00504                 Save selection, drawing or spread
00505                 Bitmap resolution
00506                 Colour depth
00507                 Dithering type
00508                 TIFF/JPEG/BMP   
00509 ********************************************************************************************/
00510 
00511 #define OPTOKEN_BMPPREFSDLG _T("BmpPrefsDlg")
00512 
00513 PORTNOTE("other","Removed BmpPrefsDlg - derived from DialogOp")
00514 #ifndef EXCLUDE_FROM_XARALX
00515 class BmpPrefsDlg : public DialogOp
00516 {
00517     CC_DECLARE_DYNCREATE(BmpPrefsDlg)
00518 
00519 public:
00520     BmpPrefsDlg();
00521     BOOL Create();                          // Create this dialog
00522 
00523     static BOOL Init();                                     // Setup function
00524     static OpState GetState(String_256*, OpDescriptor*);    // Return the state of this operation
00525     virtual void DoWithParam(OpDescriptor*, OpParam* Param);
00526     virtual void Do(OpDescriptor*);
00527     
00528     // Set up explicit details about this dialog box such as the id and type
00529     static CDlgResID IDD;                   // Dialog box id
00530     static const CDlgMode Mode;             // Dialog box mode of operation (mode or modeless)
00531 
00532     static BOOL InvokeDialog(BitmapExportOptions* pOptions);
00533 
00534 protected:
00535     // Overridables
00536     virtual BOOL        InitDialog();
00537     virtual MsgResult   Message(Msg* Message);      // Message handler
00538     virtual BOOL        CommitDialogValues();
00539 
00540     // Support Functions
00541     BitmapExportOptions*    GetOptions() const;
00542 
00543     typedef UINT32  TIFF_COMPRESSION;
00544     BOOL SetTIFFCompressionSelection( TIFF_COMPRESSION Compression, INT32 nBPP );
00545     TIFF_COMPRESSION GetTIFFCompressionSelection( INT32 nBPP );
00546 
00547     void SetBPPButtons(CGadgetID ButtonClicked,BOOL CheckNumColValueRange); // handles things reliant on bpp
00548     void SetPaletteButtons(CGadgetID ButtonClicked);
00549     void SetDitherButtons(CGadgetID ButtonClicked);
00550     void RecalculateSize();                         // Works out the selection size
00551     void RecalculatePixels();                       // Works out the size in pixels
00552     void RecalculateDpiFromX();                     // Works out the dpi from x pixels
00553     void RecalculateDpiFromY();                     // Works out the dpi from y pixels
00554 
00555     SelectionType GetSelection();                   // returns spread/drawing/selection
00556     BOOL SetUpResolutionList();                     // Put values into resolution como box
00557 
00558     void InitDepthRadioGroup();     // GetDepthGadget()->Init()???
00559     void InitPaletteRadioGroup(const PALETTE& Palette);
00560     void InitDitherRadioGroup(const DITHER& DitherType);
00561     void InitSelectionRadioGroup();
00562 
00563     UINT32 GetFilterHelpID(FilterType FilterID);
00564 
00565 // WEBSTER - markn 17/1/97
00566     void InitNumColoursGroup(BitmapExportOptions* pOptions);
00567     void HideNumColoursGroup();
00568     void UpdateNumColoursGroup(BOOL CheckNumColValueRange); // New 'CheckNumColValueRange' flag - WEBSTER - markn 1/2/97
00569     BOOL SetNumColoursInPalette(BitmapExportOptions* pOptions);
00570 
00571     inline  void SetLoopCheckBox(BOOL Value)    { LoopCheckBoxEnabled = Value;  }   // Selector function
00572     inline  BOOL GetLoopCheckBox()              { return LoopCheckBoxEnabled;   }   // Selector function
00573     BOOL    SetBmpPrefsDlgState();                                                      
00574     
00575     // Remember the last bpp setting
00576     CGadgetID LastBppSelected;
00577 
00578     // Remember the selection/drawing/spreads height and width in Millipoints
00579     // and the DocRect that was used to calculate this.
00580     MILLIPOINT Width;   
00581     MILLIPOINT Height;  
00582     INT32 PixelWidth;   
00583     INT32 PixelHeight;
00584     double Dpi; 
00585     DocRect ClipRect;
00586 
00587     BOOL m_bDpiSupported;           // Does the (should be) given filter support DPI?
00588     BOOL m_bLockAspect;             // Should we lock the aspect ratio ?
00589     BOOL IsDelayMany;               // Is the delay value set to MANY ? 
00590     BOOL IsDelayDefault;            // Is the delay value set to the default of 10cs ?
00591     BOOL HasDelayChanged;           // Has user changed the Delay ed field?
00592     BOOL HasRestoreChanged;         // Has the user changed the Restore ed field?
00593     BOOL IsManyDisplayed;           // Is MANY displayed in the Restore ListBox ?
00594     BOOL DisplayMany;               // Should we display MANY ? 
00595     BOOL LoopCheckBoxEnabled;       // Is the Loop Continously check box selected.
00596 
00597 private:
00598     BitmapExportOptions*    m_pOptions;
00599 
00600     // Variables used to lock out other fields being updated just by putting a
00601     // new number into them and hence getting circular updates.
00602     BOOL RecalculatingPixels;
00603     BOOL RecalculatingXDpi;
00604     BOOL RecalculatingYDpi;
00605 };
00606 #endif
00607 
00608 
00609 
00610 /********************************************************************************************
00611 >   class ExportSelection : public CC_CLASS_MEMDUMP
00612     class RandomSelection : public ExportSelection
00613     class SingleBitmapSelection : public ExportSelection
00614     class MultipleBitmapSelection : public ExportSelection
00615     class SpreadSelection : public ExportSelection
00616     class DrawingSelection : public ExportSelection
00617 
00618     Author:     Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
00619     Created:    25/06/96
00620     Purpose:    Abstract classes representing selections of objects
00621                 They're not actually used much though ...
00622 ********************************************************************************************/
00623 
00624 class ExportSelection : public CC_CLASS_MEMDUMP
00625 {
00626 public:
00627     virtual ~ExportSelection() { }
00628     // Don't use this: for backwards compatability only
00629     virtual SelectionType GetSelectionType() = 0;
00630     virtual DocRect GetSize() = 0;
00631 };
00632 
00633 
00634 class RandomSelection : public ExportSelection
00635 {
00636 public:
00637     RandomSelection(SelRange* pRange) : m_pSelectionRange(pRange)   {}
00638 
00639     virtual DocRect GetSize();
00640     virtual SelectionType GetSelectionType()    {   return SELECTION;   }
00641 
00642 protected:
00643     SelRange*   m_pSelectionRange;
00644 };
00645 
00646 
00647 class SingleBitmapSelection : public ExportSelection
00648 {
00649 public:
00650     SingleBitmapSelection(KernelBitmap* pBitmap) : m_pBitmap(pBitmap) {}
00651     virtual DocRect GetSize();
00652     virtual SelectionType GetSelectionType()    {   return ABITMAP; }
00653 
00654 protected:
00655     KernelBitmap*   m_pBitmap;
00656 };
00657 
00658 
00659 class MultipleBitmapSelection : public ExportSelection
00660 {
00661 public:
00662     MultipleBitmapSelection(BitmapExportDocument* pBitmaps) : m_pBitmaps(pBitmaps)  {}
00663     virtual DocRect GetSize();
00664     virtual SelectionType GetSelectionType()    {   return SOMEBITMAPS; }
00665 
00666 protected:
00667     BitmapExportDocument*   m_pBitmaps;
00668 };
00669 
00670 
00671 class SpreadSelection : public ExportSelection
00672 {
00673 public:
00674     SpreadSelection(Spread* pSpread) : m_pSpread(pSpread) {}
00675     virtual DocRect GetSize();
00676     virtual SelectionType GetSelectionType()    {   return SPREAD;  }
00677 
00678 protected:
00679     Spread*     m_pSpread;
00680 };
00681 
00682 
00683 class DrawingSelection : public ExportSelection
00684 {
00685 public:
00686     DrawingSelection(Spread* pSpread) : m_pSpread(pSpread) {}
00687     virtual DocRect GetSize();
00688     virtual SelectionType GetSelectionType()    {   return DRAWING; }
00689 
00690 protected:
00691     Spread*     m_pSpread;
00692 };
00693 
00694 
00695 
00696 /********************************************************************************************
00697 >   class JPEGExportPrefsDialog : public BmpPrefsDlg
00698 
00699     Author:     Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
00700     Created:    02/11/96
00701     Purpose:    Provides a dialog asking for user options in the JPEG export
00702 ********************************************************************************************/
00703 
00704 PORTNOTE("other","Removed JPEGExportPrefsDialog - derived from BmpPrefsDlg")
00705 #ifndef EXCLUDE_FROM_XARALX
00706 class JPEGExportPrefsDialog : public BmpPrefsDlg
00707 {
00708     CC_DECLARE_DYNCREATE( JPEGExportPrefsDialog )
00709 
00710 public:
00711     JPEGExportPrefsDialog();
00712     void    SetJPEGDlgState ();
00713     inline BOOL GetOriginalSourcePresent() const        { return m_OriginalSourcePresent;  } 
00714     inline void SetOriginalSourcePresent(BOOL Value)    { m_OriginalSourcePresent = Value; }
00715 
00716 protected:
00717     // Overridden functions
00718     virtual BOOL        InitDialog();
00719     virtual MsgResult   Message(Msg* Message);
00720     virtual BOOL        CommitDialogValues();
00721     
00722     BOOL m_OriginalSourcePresent;
00723 };
00724 #endif
00725 
00726 
00727 /********************************************************************************************
00728 >   class PhotoCDDlgParam : public OpParam
00729 
00730     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> 
00731     Created:    23/11/94
00732     Purpose:    Allows data to be passed into the photocd options dialog box and 
00733                 then returned to the caller.
00734 ********************************************************************************************/
00735 
00736 class PhotoCDDlgParam : public OpParam
00737 {
00738     CC_DECLARE_MEMDUMP(PhotoCDDlgParam)
00739 
00740 public:
00741     PhotoCDDlgParam(UINT32 Page)
00742       : NumberOfPages(Page) { /* empty */ }
00743 
00744     // Parameters that the dialog can set
00745     UINT32 ImageNumber;                 // number of the image chosen by the user
00746     UINT32 NumberOfPages;                   // number of pages available
00747     BOOL PhotoCDOk;                     // Ok or cancel selected 
00748 };
00749 
00750 
00751 
00752 /********************************************************************************************
00753 >   class ImpPhotoCDDlg : public DialogOp
00754 
00755     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> 
00756     Created:    23/11/94
00757     Purpose:    The import photocd dialog box.
00758                 Allows the user to select which of the photocd images are imported.
00759 ********************************************************************************************/
00760 
00761 #define OPTOKEN_PHOTOCDDLG _T("PhotoCDDlg")
00762 
00763 PORTNOTE("other","Removed PhotoCDDlg - derived from DialogOp")
00764 #ifndef EXCLUDE_FROM_XARALX
00765 class PhotoCDDlg : public DialogOp
00766 {
00767     CC_DECLARE_DYNCREATE( PhotoCDDlg )
00768 
00769 public:
00770     PhotoCDDlg();                                   // constructor
00771 
00772     void DoWithParam(OpDescriptor*, OpParam* Param); // "DoWithParam" function
00773     void Do(OpDescriptor*);                         // "Do" function
00774     static BOOL Init();                             // Setup function
00775     BOOL Create();                                  // Create this dialog
00776     static OpState GetState(String_256*, OpDescriptor*);
00777                                                     // Return the state of this operation
00778     virtual MsgResult Message(Msg* Message);
00779                                                     // Message handler
00780     
00781     // Set up explicit details about this dialog box such as the id and type
00782 PORTNOTE("other","Need dialog resources PhotoCDDlg")
00783 #ifndef EXCLUDE_FROM_XARALX
00784     enum { IDD = _R(IDD_PHOTOCDOPTS) };                 // id
00785 #endif
00786     static const CDlgMode Mode;                     // mode or modeless
00787 
00788 public:
00789     static BOOL InvokeDialog(UINT32 *ImageNumber);
00790 
00791 private:
00792     BOOL InitDialog(PhotoCDDlg* pPhotoCD);  // Standard set up function
00793     
00794 protected:
00795     // Useful dialog processing functions
00796     BOOL CommitDialogValues(PhotoCDDlg* pPhotoCD);
00797 
00798     // Parameter passing class
00799     static PhotoCDDlgParam *pParams;
00800 }; 
00801 #endif
00802 
00803 #endif  // !INC_BMPPREFS

Generated on Sat Nov 10 03:44:30 2007 for Camelot by  doxygen 1.4.4