00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103 #ifndef INC_BMPPREFS
00104 #define INC_BMPPREFS
00105
00106
00107
00108
00109
00110 #include "gpalopt.h"
00111 #include "filter_types.h"
00112
00113 class BitmapExportDocument;
00114 class DocRect;
00115
00116 class BitmapExportParam;
00117 class BmpDlgParam;
00118 class CXaraFileRecord;
00119
00120
00121 enum PALETTE
00122 {
00123 PAL_STANDARD = 0,
00124 PAL_OPTIMISED,
00125 PAL_BROWSER,
00126 PAL_GLOBALOPTIMISED,
00127 PAL_WEBSNAP
00128 };
00129
00130
00131
00132
00133 enum ANTIALIASING
00134 {
00135 MAINTAIN_SCREEN_AA = 0,
00136 MINIMISE_VISIBLE_AA
00137 };
00138
00139
00140
00141
00142 typedef struct
00143 {
00144 BYTE Red;
00145 BYTE Green;
00146 BYTE Blue;
00147 INT32 Flags;
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
00162
00163
00164
00165 typedef double DPI;
00166 typedef UINT32 BMP_SIZE;
00167 typedef UINT32 BMP_DEPTH;
00168 typedef INT32 FILTER_ID;
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180 typedef enum
00181 {
00182 LOCKED_COLOUR = 1,
00183 TRANSPARENT_COLOUR = 2,
00184 DELETED_COLOUR = 4,
00185 } PaletteMarkType;
00186
00187
00188
00189
00190
00191
00192
00193
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
00209 BOOL IsValid() const;
00210 void MarkInvalid();
00211 void MarkValid();
00212
00213
00214 virtual BOOL RetrieveDefaults();
00215 virtual BOOL SetAsDefaults() const;
00216
00217
00218 virtual BOOL Write(CXaraFileRecord* pRec);
00219 virtual BOOL Read(CXaraFileRecord* pRec);
00220
00221
00222 DPI GetDPI() const;
00223 BOOL SetDPI(const DPI& Dpi);
00224
00225 virtual BOOL GetSupportsImageMap() { return FALSE; }
00226
00227
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
00248 virtual UINT32 GetFilterNameStrID() { return 0;}
00249 BaseBitmapFilter * FindBitmapFilterForTheseExportOptions();
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
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
00267 ANTIALIASING GetAntiAliasing() const { return m_Antialiasing; }
00268 void SetAntiAliasing( ANTIALIASING aa );
00269
00270
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
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
00285 BitmapExportOptions* MakeCopy();
00286 virtual BOOL CopyFrom(BitmapExportOptions* pOther);
00287
00288
00289 virtual BOOL FileTypeChangeCopyFrom(BitmapExportOptions *pOther);
00290
00291
00292 void SetCanUseDesignNotes(BOOL ok) { m_UseDesignNotes = ok; }
00293 BOOL GetCanUseDesignNotes() const { return m_UseDesignNotes; }
00294
00295
00296 ExtendedPalette* GetPalette();
00297
00298
00299
00300
00301 void MakePaletteEntryUnreadable(INT32 i) { if (m__pLogicalPalette) m__pLogicalPalette->palPalEntry[i].peFlags = 255; }
00302
00303
00304
00305
00306 BOOL CreatePaletteOptimiser();
00307
00308
00309 void BitmapSourceHasChanged();
00310
00311 void GatherPaletteStats(const RGBQUAD* pBitmap, UINT32 nSize );
00312
00313 void CreateValidPalette();
00314
00315
00316 void CreateValidPalette(LOGPALETTE * pPal, INT32 TranspIndex = 0);
00317
00318
00319 void CreateValidBrowserPalette(BOOL WantTransp = TRUE);
00320
00321
00322
00323 LOGPALETTE * GetLogicalPalette();
00324
00325
00326
00327 BOOL SwapEditedColoursInLogicalPalette();
00328
00329 INT32 FindNextLockedColour(INT32 pos);
00330
00331
00332 BOOL IsBackgroundTransparent() { return m__BackgroundIsTransparent; }
00333 void SetBackgroundTransparency(BOOL t);
00334
00335
00336
00337 ExtendedPalette * GetExtendedPalette() { return &m_Palette; }
00338
00339 BOOL IsClipToPage();
00340
00341
00342
00343 BOOL IsPaletteValid();
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
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
00367
00368
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
00380
00381
00382 enum eINTERLACE_PROGRESSIVE
00383 {
00384 GIF_INTERLACE = 1,
00385 PNG_INTERLACE = 2,
00386 JPG_PROGRESSIVE = 4
00387 };
00388
00389
00390
00391
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;
00404 Coord m_OutputSize;
00405 Coord m_PixelOutputSize;
00406 FilterType m_FilterID;
00407 BmpDlgParam* m_pBmpDlgParam;
00408 BOOL m_UseDesignNotes;
00409 BOOL m_bSeparateLayerFiles;
00410 BOOL m_bTempFileFlag;
00411
00412
00413 UINT32 m_NumColsInPalette;
00414 BOOL m_UseSystemColours;
00415 static UINT32 g_NumColsInPalette;
00416 static BOOL g_UseSystemColours;
00417
00418 public:
00419 BOOL m_fPutHTMLTagOnClipboard;
00420 static BOOL ms_fPutHTMLTagOnClipboard;
00421 static TCHAR ms_strPutHTMLTagOnClipboard[];
00422 static BOOL ms_IsBackGroundTransparent;
00423 static ANTIALIASING ms_Antialiasing;
00424 static BOOL ms_bSeparateLayerFiles;
00425
00426
00427 private:
00428
00429 BOOL m_bValid;
00430 DPI m_DPI;
00431 BMP_DEPTH m_Depth;
00432
00433
00434 INT32 m_TransparencyIndex;
00435 CDlgResID m_DialogID;
00436 const StringBase* m_pFilterName;
00437
00438
00439 PathName m_TempPath;
00440 BOOL m_bTempFileExported;
00441
00442
00443 ExtendedPalette m_Palette;
00444
00445
00446 ANTIALIASING m_Antialiasing;
00447
00448
00449
00450
00451
00452
00453
00454
00455
00456
00457 BOOL m__PaletteIsValid;
00458
00459
00460
00461
00462
00463
00464
00465 LOGPALETTE * m__pLogicalPalette;
00466
00467
00468
00469
00470 INT32 m__NumberOfColoursUserRequested;
00471
00472
00473
00474
00475
00476
00477 BOOL m__UseBrowserPalette;
00478 BOOL m__UseSystemColoursInPalette;
00479
00480 INT32 m__UseWebSnapPalette;
00481 INT32 m__UsePrimarySnapPalette;
00482
00483 BOOL m__BackgroundIsTransparent;
00484
00485
00486 PaletteOptimiser* m__pPaletteOptimiser;
00487
00488 BOOL m__HavePrimedOptimier;
00489
00490 BOOL m__TempFileMatchesExportOptions;
00491
00492 BOOL m_bCMYK;
00493 };
00494
00495
00496
00497
00498
00499
00500
00501
00502
00503
00504
00505
00506
00507
00508
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();
00522
00523 static BOOL Init();
00524 static OpState GetState(String_256*, OpDescriptor*);
00525 virtual void DoWithParam(OpDescriptor*, OpParam* Param);
00526 virtual void Do(OpDescriptor*);
00527
00528
00529 static CDlgResID IDD;
00530 static const CDlgMode Mode;
00531
00532 static BOOL InvokeDialog(BitmapExportOptions* pOptions);
00533
00534 protected:
00535
00536 virtual BOOL InitDialog();
00537 virtual MsgResult Message(Msg* Message);
00538 virtual BOOL CommitDialogValues();
00539
00540
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);
00548 void SetPaletteButtons(CGadgetID ButtonClicked);
00549 void SetDitherButtons(CGadgetID ButtonClicked);
00550 void RecalculateSize();
00551 void RecalculatePixels();
00552 void RecalculateDpiFromX();
00553 void RecalculateDpiFromY();
00554
00555 SelectionType GetSelection();
00556 BOOL SetUpResolutionList();
00557
00558 void InitDepthRadioGroup();
00559 void InitPaletteRadioGroup(const PALETTE& Palette);
00560 void InitDitherRadioGroup(const DITHER& DitherType);
00561 void InitSelectionRadioGroup();
00562
00563 UINT32 GetFilterHelpID(FilterType FilterID);
00564
00565
00566 void InitNumColoursGroup(BitmapExportOptions* pOptions);
00567 void HideNumColoursGroup();
00568 void UpdateNumColoursGroup(BOOL CheckNumColValueRange);
00569 BOOL SetNumColoursInPalette(BitmapExportOptions* pOptions);
00570
00571 inline void SetLoopCheckBox(BOOL Value) { LoopCheckBoxEnabled = Value; }
00572 inline BOOL GetLoopCheckBox() { return LoopCheckBoxEnabled; }
00573 BOOL SetBmpPrefsDlgState();
00574
00575
00576 CGadgetID LastBppSelected;
00577
00578
00579
00580 MILLIPOINT Width;
00581 MILLIPOINT Height;
00582 INT32 PixelWidth;
00583 INT32 PixelHeight;
00584 double Dpi;
00585 DocRect ClipRect;
00586
00587 BOOL m_bDpiSupported;
00588 BOOL m_bLockAspect;
00589 BOOL IsDelayMany;
00590 BOOL IsDelayDefault;
00591 BOOL HasDelayChanged;
00592 BOOL HasRestoreChanged;
00593 BOOL IsManyDisplayed;
00594 BOOL DisplayMany;
00595 BOOL LoopCheckBoxEnabled;
00596
00597 private:
00598 BitmapExportOptions* m_pOptions;
00599
00600
00601
00602 BOOL RecalculatingPixels;
00603 BOOL RecalculatingXDpi;
00604 BOOL RecalculatingYDpi;
00605 };
00606 #endif
00607
00608
00609
00610
00611
00612
00613
00614
00615
00616
00617
00618
00619
00620
00621
00622
00623
00624 class ExportSelection : public CC_CLASS_MEMDUMP
00625 {
00626 public:
00627 virtual ~ExportSelection() { }
00628
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
00698
00699
00700
00701
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
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
00729
00730
00731
00732
00733
00734
00735
00736 class PhotoCDDlgParam : public OpParam
00737 {
00738 CC_DECLARE_MEMDUMP(PhotoCDDlgParam)
00739
00740 public:
00741 PhotoCDDlgParam(UINT32 Page)
00742 : NumberOfPages(Page) { }
00743
00744
00745 UINT32 ImageNumber;
00746 UINT32 NumberOfPages;
00747 BOOL PhotoCDOk;
00748 };
00749
00750
00751
00752
00753
00754
00755
00756
00757
00758
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();
00771
00772 void DoWithParam(OpDescriptor*, OpParam* Param);
00773 void Do(OpDescriptor*);
00774 static BOOL Init();
00775 BOOL Create();
00776 static OpState GetState(String_256*, OpDescriptor*);
00777
00778 virtual MsgResult Message(Msg* Message);
00779
00780
00781
00782 PORTNOTE("other","Need dialog resources PhotoCDDlg")
00783 #ifndef EXCLUDE_FROM_XARALX
00784 enum { IDD = _R(IDD_PHOTOCDOPTS) };
00785 #endif
00786 static const CDlgMode Mode;
00787
00788 public:
00789 static BOOL InvokeDialog(UINT32 *ImageNumber);
00790
00791 private:
00792 BOOL InitDialog(PhotoCDDlg* pPhotoCD);
00793
00794 protected:
00795
00796 BOOL CommitDialogValues(PhotoCDDlg* pPhotoCD);
00797
00798
00799 static PhotoCDDlgParam *pParams;
00800 };
00801 #endif
00802
00803 #endif // !INC_BMPPREFS