BmpPrefsDlg Class Reference

#include <bmpprefs.h>

Inheritance diagram for BmpPrefsDlg:

DialogOp Operation MessageHandler ListItem CCObject SimpleCCObject JPEGExportPrefsDialog List of all members.

Public Member Functions

 BmpPrefsDlg ()
 BmpPrefsDlg constructor. Creates a non-undoable operation.
BOOL Create ()
 BmpPrefsDlg create method.
virtual void DoWithParam (OpDescriptor *, OpParam *Param)
 Creates then opens the dialog in response to a request from the user and allows values to be passed in and returned to the caller via the BmpPrefsDlgParam class.
virtual void Do (OpDescriptor *)
 Creates then opens the dialog in response to a request from the user.

Static Public Member Functions

static BOOL Init ()
 BmpPrefsDlg Init method.
static OpState GetState (String_256 *, OpDescriptor *)
 BmpPrefsDlg GetState method.
static BOOL InvokeDialog (BitmapExportOptions *pOptions)
 How to invoke or start a BmpPrefsDlg box.

Static Public Attributes

static CDlgResID IDD
static const CDlgMode Mode

Protected Types

typedef UINT32 TIFF_COMPRESSION

Protected Member Functions

virtual BOOL InitDialog ()
 Sets initial dialog values.
virtual MsgResult Message (Msg *Message)
 Handles all the bitmap preferences dialog's messages.
virtual BOOL CommitDialogValues ()
 Takes the values in the dialog box and sets the return values accordingly Called when ok is pressed on the dialog box.
BitmapExportOptionsGetOptions () const
 Helper function.
BOOL SetTIFFCompressionSelection (TIFF_COMPRESSION Compression, INT32 nBPP)
 This function has been added because no allowances have been made for the fact that the compression options list is different for each BPP setting.
TIFF_COMPRESSION GetTIFFCompressionSelection (INT32 nBPP)
 This function has been added because no allowances have been made for the fact that the compression options list is different for each BPP setting.
void SetBPPButtons (CGadgetID ButtonClicked, BOOL CheckNumColValueRange)
 Sets all other radio buttons in the group off.
void SetPaletteButtons (CGadgetID ButtonClicked)
 Sets all other radio buttons in the group off.
void SetDitherButtons (CGadgetID ButtonClicked)
 Sets all other radio buttons in the group off.
void RecalculateSize ()
 Calculates the size of the selection/spread/drawing and fills in the width and height fields accordingly. It then calculates the pixel size and/or dpi.
void RecalculatePixels ()
 Takes the size of the selection/spread/drawing and calculates the size that this will be in pixels given the current dpi field.
void RecalculateDpiFromX ()
 Takes the size of the selection/spread/drawing and the size in the pixel width field and calculates a new current dpi from this.
void RecalculateDpiFromY ()
 Takes the size of the selection/spread/drawing and the size in the pixel height field and calculates a new current dpi from this.
SelectionType GetSelection ()
 Works out what the current selection/spread/drawing state is.
BOOL SetUpResolutionList ()
 Sets up the initial values in the resolution/dpi combo box.
void InitDepthRadioGroup ()
void InitPaletteRadioGroup (const PALETTE &Palette)
void InitDitherRadioGroup (const DITHER &DitherType)
void InitSelectionRadioGroup ()
UINT32 GetFilterHelpID (FilterType FilterID)
void InitNumColoursGroup (BitmapExportOptions *pOptions)
 Inits the "number of colour in palette" group in the bitmap export dlg.
void HideNumColoursGroup ()
 Hides the "number of colour in palette" group in the bitmap export dlg.
void UpdateNumColoursGroup (BOOL CheckNumColValueRange)
 Enables/disables the "number of colour in palette" group in the bitmap export dlg.
BOOL SetNumColoursInPalette (BitmapExportOptions *pOptions)
 Extracts the number of colours in palette & the system colours switch data from the relevant gadgets, and stuffs the data in pOptions.
void SetLoopCheckBox (BOOL Value)
BOOL GetLoopCheckBox ()
BOOL SetBmpPrefsDlgState ()
 This will be called When the "loop continuously" switch is turned off. It will grey/ungrey the "Loop" ed field.

Protected Attributes

CGadgetID LastBppSelected
MILLIPOINT Width
MILLIPOINT Height
INT32 PixelWidth
INT32 PixelHeight
double Dpi
DocRect ClipRect
BOOL m_bDpiSupported
BOOL m_bLockAspect
BOOL IsDelayMany
BOOL IsDelayDefault
BOOL HasDelayChanged
BOOL HasRestoreChanged
BOOL IsManyDisplayed
BOOL DisplayMany
BOOL LoopCheckBoxEnabled

Private Attributes

BitmapExportOptionsm_pOptions
BOOL RecalculatingPixels
BOOL RecalculatingXDpi
BOOL RecalculatingYDpi

Detailed Description

Definition at line 515 of file bmpprefs.h.


Member Typedef Documentation

typedef UINT32 BmpPrefsDlg::TIFF_COMPRESSION [protected]
 

Definition at line 543 of file bmpprefs.h.


Constructor & Destructor Documentation

BmpPrefsDlg::BmpPrefsDlg  ) 
 

BmpPrefsDlg constructor. Creates a non-undoable operation.

/ PhotoCDDlgParam * PhotoCDDlg::pParams = NULL; // Data passing class

Set up the dialog box details stored as statics in the class CDlgResID BmpPrefsDlg::IDD = _R(IDD_EXPORTBMPOPTS); // default dialog box id const CDlgMode BmpPrefsDlg::Mode = MODAL; // This dialog is modal

const CDlgMode PhotoCDDlg::Mode = MODAL; // This dialog is modal

Tiff compression types we can cope with. Cannot use the Accusoft types as these are not contiguous and hence would not correspond to items in a list enum TiffTypes {UNCOMPRESSED_TIFF, LZW_TIFF, HUFFMAN_TIFF, G3FAX_TIFF, G4FAX_TIFF, PACKBITS_TIFF, TWODENCODING_TIFF };

Andy Hills, 05-09-00 The above enum is only applicable for 1bpp TIFF export. The options are different for 4/8/24 bpp.

The values correspond to the positions of the respective compression types in the drop-down list. This will have to make do until someone does a vast re-write of the TIFF export options code!

Note that LZW_TIFF and HUFFMAN_TIFF are at the same position: this is because they don't actually appear at the same time. For 1bpp, the options are { uncompressed, huffman, g3 ... } For 8ppp, the options are { uncompressed, lzw }

define UNCOMPRESSED_TIFF 0 define LZW_TIFF 1 define HUFFMAN_TIFF 1 define G3FAX_TIFF 2 define G4FAX_TIFF 3 define PACKBITS_TIFF 4 define TWODENCODING_TIFF 5

BODGE: We get some bad pixel cropping on some images if we use doubles. So limit the doubles to fixed values until these problems are fixed. Hence the conversion of GetDoubleGadgetValues into GetLongGadgetValues. static const double D_MAXDPI = 3000.0; static const INT32 MAXDPI = 3000;

Height of extra bit at the bottom of the dialogue with the Animation options static const INT32 ANIMATION_EXTRABIT = 76; static const INT32 NUMCOLS_EXTRABIT = 56; static const INT32 NUMCOLS_GROUP_SHIFT = 80;

WEBSTER - markn 24/1/97 The number of system colours added when the "Add system colours" switch is on (28 because there are 27 Gavin primary colours (which includes most of the windows colour) plus one windows colour that isn't a Gavin primary) static const INT32 NUM_SYS_COLS = 28;

/*!

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/08/94

Definition at line 1140 of file bmpprefs.cpp.

01140                         : DialogOp(BmpPrefsDlg::IDD, BmpPrefsDlg::Mode) 
01141 {
01142     m_pOptions = NULL;
01143 
01144     Width       = 0;
01145     Height      = 0;
01146     PixelWidth  = 0;
01147     PixelHeight = 0;
01148     Dpi         = 96.0;
01149 
01150     LastBppSelected = 0;
01151 
01152     RecalculatingPixels = FALSE;
01153     RecalculatingXDpi   = FALSE;
01154     RecalculatingYDpi   = FALSE;
01155 
01156     m_bDpiSupported = FALSE;
01157     m_bLockAspect   = FALSE;
01158     IsDelayMany = FALSE;            
01159     IsDelayDefault = FALSE;     
01160     HasDelayChanged = FALSE;
01161     HasRestoreChanged = FALSE;
01162     IsManyDisplayed = FALSE;
01163     DisplayMany = FALSE;
01164     LoopCheckBoxEnabled = TRUE;
01165 }


Member Function Documentation

BOOL BmpPrefsDlg::CommitDialogValues  )  [protected, virtual]
 

Takes the values in the dialog box and sets the return values accordingly Called when ok is pressed on the dialog box.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
03/10/94
Parameters:
pointer to the dialogue box [INPUTS]
- [OUTPUTS]
Returns:
True if values in dialog box ok, False otherwise.

Errors: -

See also:
-

Reimplemented in JPEGExportPrefsDialog.

Definition at line 2101 of file bmpprefs.cpp.

02102 {
02103     BitmapExportOptions* pOptions = GetOptions();
02104     ERROR2IF(pOptions == NULL, FALSE, "BmpPrefsDlg::CommitDialogValues called after duff initialisation?!");
02105 
02106     // Ok has been pressed so take the values and set up the static values so that the
02107     // caller can access them
02108 
02109     BOOL Valid = 0; // Flag for validity of value
02110 
02111     //Added by Graham 27/5/97
02112     //First, let's set the pixel width and height into our OutputSize option
02113     pOptions->SetPixelOutputSize(PixelWidth, PixelHeight);
02114 
02115     // Although the file format may not support DPI, BaseBitmapFilter::PrepareToExport doesn't support
02116     // anything else. Since we may want to stretch the selection, we therefore need to supply a bogus dpi
02117     // based on the desired export size. dpi supporting formats can follow the mess...
02118     if (m_bDpiSupported)
02119     {
02120         // Get the dpi value from the resolution combo box
02121         // Minimum of 5dpi as anything lower causes major problems.  
02122         //double Value = GetDoubleGadgetValue(_R(IDC_BMPOPTS_RES), 5.0, D_MAXDPI, _R(IDS_BMPPREFS_INVALIDDPI) ,&Valid);
02123         double Value = (double)GetLongGadgetValue(_R(IDC_BMPOPTS_RES), 5, MAXDPI, _R(IDS_BMPPREFS_INVALIDDPI) ,&Valid);
02124         if (Valid) 
02125         {
02126             // If returned value in range then set the new default
02127             pOptions->SetDPI(Value);
02128         }
02129         else
02130             return FALSE;
02131 
02132         RecalculatePixels();
02133     }
02134     else
02135     {
02136         double Resolution = (Width>0) ? ((double) PixelWidth * 72000.0) / ((double) Width) : 96.0;
02137         // A bit of a safety net here
02138         if (Resolution < 5.0)
02139         {
02140             // User has set an illegal state so warn them about it.
02141             InformError(_R(IDS_BMPPREFS_DPITOOSMALL));
02142             //Dpi = 0;
02143             return FALSE;
02144         }
02145         else if (Resolution > D_MAXDPI)
02146         {
02147             // User has set an illegal state so warn them about it.
02148             InformError(_R(IDS_BMPPREFS_DPITOOBIG));
02149             //Dpi = 0;
02150             return FALSE;
02151         }
02152         else
02153         {
02154             INT32 b_dpi = (INT32)(Resolution + 0.5);
02155             Dpi = b_dpi; //Resolution;
02156         }
02157         pOptions->SetDPI(Dpi);
02158     }
02159 
02160     // Get the output depth from the bpp radio buttons
02161     BOOL State = 0;
02162     UINT32 Depth = 24;
02163     if ( GetLongGadgetValue(_R(IDC_BMPOPTS_CMYK), 0, 1, 0, &Valid) )
02164     {
02165         pOptions->SetCMYK(TRUE);
02166         Depth = 32;
02167     }
02168     else if ( GetLongGadgetValue(_R(IDC_BMPOPTS_24BPP), 0, 1, 0, &Valid) )
02169         Depth = 24;
02170     else if ( GetLongGadgetValue(_R(IDC_BMPOPTS_8BPP), 0, 1, 0, &Valid) )
02171         Depth = 8;
02172     else if ( GetLongGadgetValue(_R(IDC_BMPOPTS_4BPP), 0, 1, 0, &Valid) )
02173         Depth = 4;
02174     else if ( GetLongGadgetValue(_R(IDC_BMPOPTS_1BPP), 0, 1, 0, &Valid) )
02175         Depth = 1;
02176     pOptions->SetDepth(Depth);
02177 
02178     // WEBSTER - markn 17/1/97
02179     // NOTE! This can change the Depth value set earlier in this function
02180     if (!SetNumColoursInPalette(pOptions))
02181         return FALSE;
02182 
02183     // Get the Palette setting from the radio buttons
02184     PALETTE Palette = PAL_STANDARD;
02185     if ( GetLongGadgetValue(_R(IDC_BMPOPTS_PAL_OPT), 0, 1, 0, &Valid) )
02186     {
02187         TRACEUSER( "Will", _T("Optimised Palette selected\n"));
02188         Palette = PAL_OPTIMISED;
02189     }
02190 
02191     // Get the dither type from the radio buttons
02192     DITHER DitherType = XARADITHER_ERROR_DIFFUSION;
02193     if ( GetLongGadgetValue(_R(IDC_BMPOPTS_NODITHER), 0, 1, 0, &Valid) )
02194         DitherType = XARADITHER_NONE;
02195     else if ( GetLongGadgetValue(_R(IDC_BMPOPTS_ORDDITHER), 0, 1, 0, &Valid) )
02196         DitherType = XARADITHER_ORDERED_GREY;
02197     else if ( GetLongGadgetValue(_R(IDC_BMPOPTS_DIFFUSION), 0, 1, 0, &Valid) )
02198         DitherType = XARADITHER_ERROR_DIFFUSION;
02199 
02200     TRACEUSER( "Will", _T("Dither %d selected\n"), DitherType);
02201 
02202     // Check that we have not gone over our GDraw limits for pixel width
02203     // Pixel height should not be so much of a problem as we will strip the export. 
02204 
02205     // This cast is here because PixelWidth is a signed number (for some odd reason)
02206     if ((DWORD) PixelWidth > GRenderRegion::GetMaxBitmapWidth() ||
02207         (DWORD) PixelWidth < 1 || (DWORD) PixelHeight < 1 )
02208     {
02209         // There is a problem so warn the user that the value is incorrect
02210         String_256 WarnMsg;
02211 
02212         WarnMsg.MakeMsg(_R(IDE_BMP_BADPIXELWIDTH), GRenderRegion::GetMaxBitmapWidth());
02213         Error::SetError(0, WarnMsg, 0);
02214         InformWarning(0, _R(IDS_OK));
02215         return FALSE; 
02216     }
02217 
02218     // Mostly the compression fields change according to the filter type in use
02219     switch ( pOptions->GetFilterType() ) 
02220     {
02221         case TIFF_UNCOMPRESSED:
02222         {
02223             //WEBSTER-Martin-03/01/97
02224 #ifndef WEBSTER
02225             TIFFExportOptions* pTIFFOptions = (TIFFExportOptions*)pOptions;
02226             ERROR3IF(!pTIFFOptions->IS_KIND_OF(TIFFExportOptions), "pTIFFOptions isn't");
02227 
02228             // Get the state of the TIFF compression selection combo box
02229             TIFF_COMPRESSION Compression = GetTIFFCompressionSelection(Depth);
02230             ERROR2IF( (Compression==-1), FALSE, "BmpPrefsDlg::CommitDialogValues - invalid compresion type" );
02231             pTIFFOptions->SetCompression(Compression);
02232 
02233 //Mark Howitt, 27/10/97. We need to setup both the Dither & Palette for the TIFF Options, as well as
02234 //                       the Accusoft DitherToUse variable to ensure proper functionality.
02235             pTIFFOptions->SetDither(DitherType);
02236             pTIFFOptions->SetPalette(Palette);
02237             AccusoftFilters::SetDitherToUse(DitherType);
02238 
02239 #endif //WEBSTER
02240             break;
02241         }
02242         case PNG:
02243         {
02244             PNGExportOptions* pPNGOptions = (PNGExportOptions*)pOptions;
02245             ERROR3IF(!pPNGOptions->IS_KIND_OF(PNGExportOptions), "pPNGOptions isn't");
02246 
02247             // GIF radio buttons used to hold the transparent/interlaced settings
02248             BOOL Interlace = GetLongGadgetValue(_R(IDC_BMPOPTS_INTERLACED), 0, 1, 0, &Valid);
02249             BOOL Transparent = GetLongGadgetValue(_R(IDC_BMPOPTS_TRANSPARENT), 0, 1, 0, &Valid);
02250             // Transparency is not available at present
02251             // Only if we are exporting as a 32bpp bitmap.
02252             if (Valid)
02253             {
02254                 //pPNGOptions->SetMakeTransparent(Transparent);
02255                 pPNGOptions->SetMakeInterlaced(Interlace);
02256 
02257                 // WEBSTER - markn 5/2/97
02258                 // If the user has deselected Transparent, then make sure the cached index is set to -1
02259                 if (!Transparent)
02260                     pPNGOptions->SetTransparencyIndex(-1);
02261             }
02262             pPNGOptions->SetDither(DitherType);
02263 //          pPNGOptions->SetPalette(Palette);
02264             break;
02265         }
02266 
02267         case MAKE_BITMAP_FILTER:
02268         {
02269             MakeBitmapExportOptions* pMkBOptions = (MakeBitmapExportOptions*)pOptions;
02270             ERROR3IF(!pMkBOptions->IS_KIND_OF(MakeBitmapExportOptions), "pMkBOptions isn't");
02271 
02272             pMkBOptions->SetDither(DitherType);
02273 //          pMkBOptions->SetPalette(Palette);
02274 
02275             // radio buttons used to hold the transparent/interlaced settings
02276             BOOL Interlace = GetLongGadgetValue(_R(IDC_BMPOPTS_INTERLACED), 0, 1, 0, &Valid);
02277             BOOL Transparent = GetLongGadgetValue(_R(IDC_BMPOPTS_TRANSPARENT), 0, 1, 0, &Valid);
02278             //pMkBOptions->SetMakeTransparent(Transparent);
02279             pMkBOptions->SetMakeInterlaced(Interlace);
02280 
02281             break;
02282         }
02283         case TI_GIF:
02284         case TI_GIF_ANIM:
02285         {
02286             GIFExportOptions* pGIFOptions = (GIFExportOptions*)pOptions;
02287             ERROR3IF(!pGIFOptions->IS_KIND_OF(GIFExportOptions), "pGIFOptions isn't");
02288                                     
02289             pGIFOptions->SetDither(DitherType);
02290 //          pGIFOptions->SetPalette(Palette);
02291 
02292             // GIF radio buttons used to hold the transparent/interlaced settings
02293             BOOL Interlace = GetLongGadgetValue(_R(IDC_BMPOPTS_INTERLACED), 0, 1, 0, &Valid);
02294             BOOL Transparent = GetLongGadgetValue(_R(IDC_BMPOPTS_TRANSPARENT), 0, 1, 0, &Valid);
02295             //pGIFOptions->SetMakeTransparent(Transparent);
02296             pGIFOptions->SetMakeInterlaced(Interlace);
02297 
02298             // WEBSTER - markn 5/2/97
02299             // If the user has deselected Transparent, then make sure the cached index is set to -1
02300             if (!Transparent)
02301                 pGIFOptions->SetTransparencyIndex(-1);
02302 
02303             if (pOptions->GetFilterType() == TI_GIF)
02304             {
02305                 HideGadget(_R(IDC_ANIMOPTS_LOOP), TRUE);    
02306                 HideGadget(_R(IDC_ANIMOPTS_DELAY), TRUE);   
02307                 HideGadget(_R(IDC_ANIMOPTS_ITERATIONS), TRUE);
02308                 HideGadget(_R(IDC_ANIMOPTS_REMOVAL), TRUE); 
02309             }
02310 
02311             if (pOptions->GetFilterType() == TI_GIF_ANIM)
02312             {
02313                 UINT32 List = 0;
02314                 BmpDlgParam* pBmpDlgParam = pOptions->GetBmpDlgParam();
02315                                     
02316                 if (pBmpDlgParam != NULL)
02317                 {
02318                     KernelBitmap** pListOfBitmaps = pBmpDlgParam->GetBitmapList();
02319                     List = pBmpDlgParam->GetListSize();
02320 
02321                     ERROR3IF(pListOfBitmaps == NULL && List > 0, "Where Have Our Bitmaps Gone?");
02322                     
02323                     if(pListOfBitmaps != NULL)
02324                     {
02325                         pGIFOptions->SetBitmapList(pListOfBitmaps);
02326                         pGIFOptions->SetListSize(List);
02327                     }
02328                 }
02329                 
02330                 // Get the Animation Delay details.
02331                 if (HasDelayChanged)
02332                 {
02333                      CENTISECONDS Delay = GetLongGadgetValue(_R(IDC_ANIMOPTS_DELAY), 0, 65535, _R(IDS_BMPPREFS_INVALIDDELAY) ,&Valid);
02334                                      
02335                     if (Valid)
02336                     {
02337                         pBmpDlgParam->SetAnimDelay(Delay);
02338                         pBmpDlgParam->SetAreDelayValuesSame(TRUE);
02339 
02340                         UINT32 ListSize = pGIFOptions->GetListSize();
02341                         KernelBitmap** pListOfBitmaps = pGIFOptions->GetBitmapList();
02342 
02343                         ERROR3IF(pListOfBitmaps == NULL && ListSize > 0,"Do what");
02344 
02345                         // A new delay value has been set, store it in the bitmaps.
02346             
02347                         if (pListOfBitmaps != NULL)
02348                         {
02349                             while (ListSize > 0)
02350                             {
02351                                 KernelBitmap* pBitmap = pListOfBitmaps[--ListSize] ;    
02352 
02353                                 if(pBitmap != NULL)
02354                                 {
02355                                     pBitmap->SetDelay(pBmpDlgParam->GetAnimDelay());
02356                                 }
02357                             }
02358                         }
02359                     }
02360                     else
02361                         return FALSE;   
02362                 }
02363         
02364                 // Get the Animation Restore details.
02365                 if (HasRestoreChanged)
02366                 {
02367                     INT32 Restore  = GetSelectedValueIndex(_R(IDC_ANIMOPTS_REMOVAL));
02368                                 
02369                     if(Restore != OPTION_FOUR)
02370                     {
02371                         pBmpDlgParam->SetRestoreType((GIFDisposalMethod) Restore);
02372                         pBmpDlgParam->SetSameRestoreType(TRUE);
02373                         UINT32 ListSize = pGIFOptions->GetListSize();
02374 
02375                         KernelBitmap** pListOfBitmaps = pGIFOptions->GetBitmapList();
02376                         ERROR3IF(pListOfBitmaps == NULL && ListSize > 0,"Do what");
02377 
02378                         // A new Restore type has been entered, store it in the bitmaps.
02379                         if (pListOfBitmaps != NULL)
02380                         {
02381                             while (ListSize > 0)
02382                             {
02383                                 KernelBitmap* pKernelBitmap = pListOfBitmaps[--ListSize] ;  
02384 
02385                                 if (pKernelBitmap != NULL)
02386                                 {
02387                                     OILBitmap* pOILBitmap = pKernelBitmap->GetActualBitmap();
02388 
02389                                     if (pOILBitmap != NULL)
02390                                     {
02391                                         pOILBitmap->SetAnimationRestoreType(pBmpDlgParam->GetRestoreType());
02392     
02393                                     }
02394                                 }
02395                             }
02396                         }
02397                     }
02398                 }
02399                 // Get the Animation Loop details.
02400                 BOOL Value = GetBoolGadgetSelected(_R(IDC_ANIMOPTS_LOOP));
02401                 INT32 Loop = GetLongGadgetValue(_R(IDC_ANIMOPTS_ITERATIONS), 0, 65535, _R(IDS_BMPPREFS_INVALIDLOOP) ,&Valid);
02402                 if (Valid)
02403                 {
02404                     pGIFOptions->SetAnimationLoopCount(Loop, Value);
02405                 }
02406                 else
02407                     return FALSE;   
02408 
02409             }
02410             break;
02411         }
02412 
02413         case BMP_UNCOMPRESSED:
02414         {
02415             BMPExportOptions* pBMPOptions = (BMPExportOptions*)pOptions;
02416             ERROR3IF(!pBMPOptions->IS_KIND_OF(BMPExportOptions), "pBMPOptions isn't");
02417 
02418             // WEBSTER - markn 23/1/97
02419             // Can't do RLE without Accusoft
02420             #ifndef WEBSTER
02421             // Get the state of the compression buttons but only allowed in 4 and 8 bpp modes
02422             BMP_COMPRESSION Compression;
02423             State = GetLongGadgetValue(_R(IDC_BMPOPTS_RLE), 0, 1, 0, &Valid);
02424             if (State && (Depth == 4 || Depth == 8))
02425                 Compression = BMP_RLE;      // button on
02426             else
02427                 Compression = BMP_RGB;  // button off
02428 
02429             if (Valid)
02430             {
02431                 pBMPOptions->SetCompression(Compression);
02432             }
02433             #endif // WEBSTER
02434 
02435             pBMPOptions->SetCompression(BMP_RGB);
02436 
02437             pBMPOptions->SetDither(DitherType);
02438             pBMPOptions->SetPalette(Palette);
02439             break;
02440         }
02441 
02442         // The remaining AccusoftOnes:
02443         case WPG:
02444         case PHOTOCD:
02445         case IFF_ILBM:
02446         case XWD:
02447         case DCX:
02448         case PCX:
02449         case PICT:
02450         case RAST:
02451         case PHOTOSHOP:
02452         case TARGA:
02453         case MACPAINT:
02454         case MSP:
02455         {
02456             //WEBSTER-Martin-03/01/97
02457 #ifndef WEBSTER
02458             AccusoftExportOptions* pAccyOptions = (AccusoftExportOptions*)pOptions;
02459             ERROR3IF(!pAccyOptions->IS_KIND_OF(AccusoftExportOptions), "pAccyOptions isn't");
02460         
02461             pAccyOptions->SetDither(DitherType);
02462             pAccyOptions->SetPalette(Palette);
02463 #endif //WEBSTER
02464             break;
02465         }
02466             
02467         default:
02468             // At present, only BMP and TIFFs can change the compression type.
02469             // Just us mice here
02470             break;
02471     }
02472 
02473     // Get the state of the selection, drawing or spread buttons
02474     SelectionType FoundSelection = GetSelection();
02475     pOptions->SetSelectionType(FoundSelection);
02476 
02477     return TRUE;
02478 }

BOOL BmpPrefsDlg::Create void   )  [virtual]
 

BmpPrefsDlg create method.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/08/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if successful, else FALSE

Errors: -

See also:
-

Reimplemented from DialogOp.

Definition at line 2861 of file bmpprefs.cpp.

02862 {                            
02863     if (DialogOp::Create())
02864     { 
02865         // Set the initial control values 
02866         // Dialog now Modal so set up happens in the message handler
02867         //InitDialog(this);
02868 
02869         return TRUE; 
02870     }
02871     else
02872     {
02873         return FALSE; 
02874     }
02875 }

void BmpPrefsDlg::Do OpDescriptor  )  [virtual]
 

Creates then opens the dialog in response to a request from the user.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/08/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Reimplemented from Operation.

Definition at line 2895 of file bmpprefs.cpp.

02896 {
02897     BOOL ok;
02898     
02899     // Force the dialog box to be created, as it is modal it will be opened via a message
02900     ok = Create();
02901 
02902     if ( !ok )
02903     {
02904         // Could not create the dialog box so call inform error 
02905         InformError();
02906         End();         // End the operation 
02907     }
02908 }

void BmpPrefsDlg::DoWithParam OpDescriptor ,
OpParam pParam
[virtual]
 

Creates then opens the dialog in response to a request from the user and allows values to be passed in and returned to the caller via the BmpPrefsDlgParam class.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/08/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Reimplemented from Operation.

Definition at line 2927 of file bmpprefs.cpp.

02928 {
02929     if (pParam == NULL)
02930     {
02931         ERROR3("BmpPrefsDlg::DoWithParam - NULL Args");
02932         return;
02933     }
02934 
02935     // Use the OpParam that has been passed in to us
02936     ERROR3IF(!pParam->IS_KIND_OF(BitmapExportOptions), "pParam isn't");
02937     m_pOptions = (BitmapExportOptions*) pParam;
02938 
02939     BOOL ok;
02940     
02941     // Force the dialog box to be created, as it is modal it will be opened via a message
02942     ok = Create();
02943 
02944     if ( !ok )
02945     {
02946         // Could not create the dialog box so call inform error 
02947         InformError();
02948         End();         // End the operation 
02949     }
02950 }

UINT32 BmpPrefsDlg::GetFilterHelpID FilterType  FilterID  )  [protected]
 

BOOL BmpPrefsDlg::GetLoopCheckBox  )  [inline, protected]
 

Definition at line 572 of file bmpprefs.h.

00572 { return LoopCheckBoxEnabled;   }   // Selector function

BitmapExportOptions * BmpPrefsDlg::GetOptions  )  const [protected]
 

Helper function.

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/11/96
Returns:
A pointer to the BitmapExportOptions to be filled in by this dialog

Definition at line 4063 of file bmpprefs.cpp.

04064 {
04065     return m_pOptions;
04066 }

SelectionType BmpPrefsDlg::GetSelection  )  [protected]
 

Works out what the current selection/spread/drawing state is.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/3/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
Selection, Drawing or Spread.

Errors: -

See also:
-

Definition at line 1184 of file bmpprefs.cpp.

01185 {
01186     // Get the state of the selection, drawing or spread buttons
01187     BOOL Valid = FALSE;
01188 
01189     // If opening specification was a bitmap then nothing doing
01190     if (GetOptions()->GetSelectionType() == ABITMAP)
01191         return ABITMAP;
01192 
01193     if (GetOptions()->GetSelectionType() == SOMEBITMAPS)
01194         return SOMEBITMAPS;
01195 
01196     SelectionType FoundSelection = DRAWING;
01197     
01198     BOOL ExportDrawing = GetLongGadgetValue(_R(IDC_BMPOPTS_DRAWING), 0, 1, 0, &Valid);
01199     // Use the state on entry to dictate the possible output values.
01200     if (GetOptions()->GetSelectionType() == SELECTION)
01201     {
01202         // If selection present then choose between Selection or Drawing
01203         if (ExportDrawing)
01204             FoundSelection = DRAWING;
01205         else        
01206             FoundSelection = SELECTION;
01207     }
01208     else
01209     {
01210         // Graham 24/7/97: If no selection, then set DRAWING automatically
01211         FoundSelection = DRAWING;       
01212     }
01213     
01214     // return what was found to the caller
01215     return FoundSelection;
01216 }   

OpState BmpPrefsDlg::GetState String_256 ,
OpDescriptor
[static]
 

BmpPrefsDlg GetState method.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/08/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 2748 of file bmpprefs.cpp.

02749 {    
02750     OpState OpSt;
02751     return(OpSt);
02752 }

TIFF_COMPRESSION BmpPrefsDlg::GetTIFFCompressionSelection INT32  nBPP  )  [protected]
 

This function has been added because no allowances have been made for the fact that the compression options list is different for each BPP setting.

Author:
Andy_Hills (Xara Group Ltd) <camelotdev@xara.com>
Date:
05/09/00
Parameters:
nBPP Currently selected bits-per-pixel [INPUTS]
[OUTPUTS] 
Returns:
The currently selected compression type.

Errors: Returns -1 on failure.

See also:
SetBPPButtons

Definition at line 1971 of file bmpprefs.cpp.

01972 {
01973     // Get the state of the TIFF compression selection combo box
01974     TIFF_COMPRESSION Compression;
01975     INT32 nIndex = GetSelectedValueIndex(_R(IDC_BMPOPTS_TIFF));
01976 
01977     if( nBPP == 1 )
01978     {
01979         switch ( nIndex )
01980         {
01981             case TWODENCODING_TIFF: Compression = TIFF_2D;              break;
01982             case PACKBITS_TIFF:     Compression = TIFF_PACK;            break;
01983             case HUFFMAN_TIFF:      Compression = TIFF_HUFFMAN;         break;
01984             case G3FAX_TIFF:        Compression = TIFF_G3_FAX;          break;
01985             case G4FAX_TIFF:        Compression = TIFF_G4_FAX;          break;
01986             default:                
01987             case UNCOMPRESSED_TIFF: Compression = TIFF_UNCOMPRESSED;    break;
01988         }
01989     }
01990     else if( nBPP==8 || nBPP==24 || nBPP==32 )
01991     {
01992         switch ( nIndex )
01993         {
01994             case LZW_TIFF:          Compression = TIFF_LZW;             break;
01995             default:                
01996             case UNCOMPRESSED_TIFF: Compression = TIFF_UNCOMPRESSED;    break;
01997         }
01998     }
01999     else if( nBPP == 4 )
02000     {
02001         Compression = TIFF_UNCOMPRESSED;
02002     }
02003     else
02004     {
02005         ERROR2( -1, "BmpPrefsDlg::GetTIFFCompressionSelection - invalid nBPP" );
02006     }
02007     
02008     return Compression;
02009 }

void BmpPrefsDlg::HideNumColoursGroup  )  [protected]
 

Hides the "number of colour in palette" group in the bitmap export dlg.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/1/97
Parameters:
- [INPUTS]
Returns:
-
Introduced in WEBSTER

Definition at line 3747 of file bmpprefs.cpp.

03748 {
03749     HideGadget(_R(IDC_BMPOPTS_NUMCOLS_EDIT)    ,TRUE);
03750     HideGadget(_R(IDC_BMPOPTS_NUMCOLS_SYSCOLS) ,TRUE);
03751     HideGadget(_R(IDC_BMPOPTS_NUMCOLS_GROUP)   ,TRUE);
03752     HideGadget(_R(IDC_BMPOPTS_NUMCOLS_EDITTEXT),TRUE);
03753 }

BOOL BmpPrefsDlg::Init void   )  [static]
 

BmpPrefsDlg Init method.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/08/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Reimplemented from SimpleCCObject.

Definition at line 2770 of file bmpprefs.cpp.

02771 {
02772     BOOL InitOK;
02773 
02774     InitOK = RegisterOpDescriptor(
02775                                 0,                  /* Tool ID */
02776                                 _R(IDS_BMPPREFSDLG),
02777                                 CC_RUNTIME_CLASS(BmpPrefsDlg),
02778                                 OPTOKEN_BMPPREFSDLG,
02779                                 GetState,
02780                                 0,                  /* help ID */
02781                                 0,                  /* bubble help */
02782                                 0,                  /* resource ID */
02783                                 0                   /* control ID */
02784                                 );
02785 
02786     if (InitOK)
02787     {
02788         InitOK = RegisterOpDescriptor(
02789                                 0,                  /* Tool ID */
02790                                 _R(IDS_BMPPREFSDLG),
02791                                 CC_RUNTIME_CLASS(JPEGExportPrefsDialog),
02792                                 OPTOKEN_JPGPREFSDLG,
02793                                 GetState,
02794                                 0,                  /* help ID */
02795                                 0,                  /* bubble help */
02796                                 0,                  /* resource ID */
02797                                 0                   /* control ID */
02798                                 );
02799     }
02800     return (InitOK);
02801 }

void BmpPrefsDlg::InitDepthRadioGroup  )  [protected]
 

Definition at line 3903 of file bmpprefs.cpp.

03904 {
03905     // Set up the Bits per pixel buttons
03906     // Filtered above for illegal cases
03907     switch ( GetOptions()->GetDepth() ) 
03908     {
03909         case 1:
03910             SetBPPButtons(_R(IDC_BMPOPTS_1BPP),FALSE);
03911             SetLongGadgetValue(_R(IDC_BMPOPTS_1BPP), TRUE);
03912             LastBppSelected = _R(IDC_BMPOPTS_1BPP);
03913             break;
03914         case 4:
03915             SetBPPButtons(_R(IDC_BMPOPTS_4BPP),FALSE);
03916             SetLongGadgetValue(_R(IDC_BMPOPTS_4BPP), TRUE);
03917             LastBppSelected = _R(IDC_BMPOPTS_4BPP);
03918             break;
03919         case 8:
03920             SetBPPButtons(_R(IDC_BMPOPTS_8BPP),FALSE);
03921             SetLongGadgetValue(_R(IDC_BMPOPTS_8BPP), TRUE);
03922             LastBppSelected = _R(IDC_BMPOPTS_8BPP);
03923             break;
03924         case 24:
03925             SetBPPButtons(_R(IDC_BMPOPTS_24BPP),FALSE);
03926             SetLongGadgetValue(_R(IDC_BMPOPTS_24BPP), TRUE);
03927             LastBppSelected = _R(IDC_BMPOPTS_24BPP);
03928             break;
03929         default:
03930             SetBPPButtons(_R(IDC_BMPOPTS_CMYK),FALSE);
03931             SetLongGadgetValue(_R(IDC_BMPOPTS_CMYK), TRUE);
03932             LastBppSelected = _R(IDC_BMPOPTS_CMYK);
03933             break;
03934     }
03935 }

BOOL BmpPrefsDlg::InitDialog  )  [protected, virtual]
 

Sets initial dialog values.

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com> (from Neville)
Date:
23/08/94
Parameters:
pointer to the dialog box [INPUTS]
Returns:
TRUE if successful, else FALSE

Reimplemented in JPEGExportPrefsDialog.

Definition at line 3044 of file bmpprefs.cpp.

03045 {
03046     BitmapExportOptions* pOptions = GetOptions();
03047     ERROR2IF(pOptions == NULL, FALSE, "pOptions NULL");
03048 
03049     if (pOptions->GetFilterType() != MAKE_BITMAP_FILTER)
03050     {
03051         // Set up the title of the dialog box according to the passed in string which
03052         // is the name of the filter plus export bitmap options.
03053         String_256 Temp = *(pOptions->GetFilterName());
03054         Temp += String_256(_R(IDN_EXPORTBMPOPTS));
03055 
03056         SetTitlebarName(&Temp); 
03057     }
03058 
03059     // Default to a locked aspect ratio
03060     m_bLockAspect = TRUE;
03061 
03062     // Now set up the bits per pixel radio buttons
03063     // The various filters require different controls, most just require bits disabling
03064     // such as the bpp switches available
03065     UINT32 Depth = pOptions->GetDepth();
03066     BOOL bYoDither  = FALSE;
03067     PALETTE Palette;    // maybe want this pileo'sh'
03068     DITHER Dither;  // maybe want this pileo'sh'
03069 
03070     // WEBSTER - markn 23/1/97
03071     // Hide these in Webster
03072 #ifdef WEBSTER
03073     HideGadget(_R(IDC_BMPOPTS_TIFF), TRUE);     // Hide the TIFF compression selection 
03074     HideGadget(_R(IDC_BMPOPTS_RLE), TRUE);      // Hide the BMP rgb compression
03075     HideGadget(_R(IDC_BMPOPTS_RGB), TRUE);      // Hide the BMP rle compression
03076     HideGadget(_R(IDC_BMPOPTS_COMPRESS), TRUE); // Hide the compression group
03077 #endif // WEBSTER
03078 
03079     // WEBSTER - markn 17/1/97
03080     // Display the 'number of colours in palette' group and extend the dlg if necessary
03081     // but only for export options of the correct type
03082     InitNumColoursGroup(pOptions);
03083 
03084     // oh ye virtuals
03085     switch ( pOptions->GetFilterType() ) 
03086     {
03087         case TIFF_UNCOMPRESSED:
03088         {
03089             //WEBSTER-Martin-03/01/97
03090 #ifndef WEBSTER
03091             BOOL ok;
03092             TIFFExportOptions* pTIFFOptions = (TIFFExportOptions*)pOptions;
03093             ERROR3IF(!pTIFFOptions->IS_KIND_OF(TIFFExportOptions), "pTIFFOptions isn't");
03094 
03095             // Make sure we show the correct compression selection field
03096             HideGadget(_R(IDC_BMPOPTS_TIFF), FALSE);    // Show the TIFF compression selection 
03097             HideGadget(_R(IDC_BMPOPTS_RLE), TRUE);      // Hide the BMP rgb compression
03098             HideGadget(_R(IDC_BMPOPTS_RGB), TRUE);      // Hide the BMP rle compression
03099             HideGadget(_R(IDC_BMPOPTS_COMPRESS), FALSE);// Show the compression group
03100 
03101             // Check for illegal case of the the depth for this filter type
03102 //          if (Depth == 32)
03103 //              Depth = 24;
03104 
03105             HideGadget(_R(IDC_BMPOPTS_32BPP), TRUE);
03106 
03107             // Convert the Accusoft ID's into their equivalent list item numbers
03108             // If 1bpp then omit the 1bpp compression types to 1bpp images only.
03109             INT32 TiffCompression = pTIFFOptions->GetCompression();
03110 
03111             // Set up the TIFF compression types list
03112             // Now the resolution combo box and hence the default value in the editable field
03113             ok = SetLongGadgetValue(_R(IDC_BMPOPTS_TIFF), pTIFFOptions->GetCompression(), FALSE, -1);
03114             // Set up the list of available TIFF compressions. Must be the same as the list
03115             // in TiffTypes.
03116             // Assusoft seem to imply they support lots of save options but in fact they do not!
03117             SetStringGadgetValue(_R(IDC_BMPOPTS_TIFF), &String_32(_R(IDN_TIFF_NONE)));
03118             
03119             if( Depth==8 || Depth==24 || Depth==32 )
03120             {
03121                 SetStringGadgetValue(_R(IDC_BMPOPTS_TIFF), &String_32(_R(IDN_TIFF_LZW)));
03122             }
03123 
03124             // Only allow the next options if 1bpp is selected as otherwise not appropriate
03125             if (Depth == 1)
03126             {
03127                 // 1bpp export so enable these 1bpp compression types
03128                 SetStringGadgetValue(_R(IDC_BMPOPTS_TIFF), &String_32(_R(IDN_TIFF_HUFFMAN)));
03129                 SetStringGadgetValue(_R(IDC_BMPOPTS_TIFF), &String_32(_R(IDN_TIFF_G3FAX)));
03130                 SetStringGadgetValue(_R(IDC_BMPOPTS_TIFF), &String_32(_R(IDN_TIFF_G4FAX)));
03131                 SetStringGadgetValue(_R(IDC_BMPOPTS_TIFF), &String_32(_R(IDN_TIFF_PACKBITS)));
03132             }
03133             else
03134             {
03135                 // Anything but 1bpp export.
03136                 // Must ensure that only a valid compression type is allowed
03137                 //if (TiffCompression != UNCOMPRESSED_TIFF && TiffCompression != LZW_TIFF)
03138                 //  TiffCompression = LZW_TIFF;
03139             }
03140             SetComboListLength(_R(IDC_BMPOPTS_TIFF));
03141 
03142             ok = SetTIFFCompressionSelection( TiffCompression, Depth );
03143 
03144             // if the previously selected compression is now disabled, select NONE
03145             if( ! ok )
03146             {
03147                 ok = SetTIFFCompressionSelection( TIFF_UNCOMPRESSED, Depth );
03148                 
03149                 // We should ALWAYS be able to select UNCOMPRESSED
03150                 ERROR3IF( (!ok), "BmpPrefsDlg::InitDialog - could not select uncompressed" );
03151             }
03152 
03153             Palette = pTIFFOptions->GetPalette();
03154             Dither = pTIFFOptions->GetDither();
03155             bYoDither = TRUE;
03156 
03157             m_bDpiSupported = TRUE;
03158 #endif //WEBSTER
03159             break;
03160         }
03161         case PNG:
03162         {
03163             PNGExportOptions* pPNGOptions = (PNGExportOptions*)pOptions;
03164             ERROR3IF(!pPNGOptions->IS_KIND_OF(PNGExportOptions), "pPNGOptions isn't");
03165             // 1, 4, 8, 24 and 32 bpp
03166 
03167             // WEBSTER - markn 23/1/97
03168             // Compression group always hidden in Webster
03169             #ifndef WEBSTER
03170             HideGadget(_R(IDC_BMPOPTS_TIFF), TRUE);     // Hide the TIFF compression selection 
03171             HideGadget(_R(IDC_BMPOPTS_RLE), TRUE);      // Hide the BMP rgb compression
03172             HideGadget(_R(IDC_BMPOPTS_RGB), TRUE);      // Hide the BMP rle compression
03173             HideGadget(_R(IDC_BMPOPTS_COMPRESS), TRUE); // Hide the compression group
03174             #endif // WEBSTER
03175 
03176             HideGadget(_R(IDC_BMPOPTS_CMYK), TRUE);
03177             EnableGadget(_R(IDC_BMPOPTS_32BPP), FALSE);
03178 
03179             // We will use the special PNG radio buttons for interlaced and transparent.
03180             // These are hidden by default.
03181             // Now set up the list
03182             // Must correspond to the order PNG .. PNG_TRANSINTER defined in accuflts.h
03183             // Translate the compression type into the transparency and interlace states.
03184             BOOL Transparent = pPNGOptions->WantTransparent();
03185             BOOL Interlace   = pPNGOptions->WantInterlaced();
03186             // If we are at the deeper colour depths then transparency is not allowed
03187             if (Depth == 24 || Depth == 32)
03188                 Transparent = FALSE;
03189             HideGadget(_R(IDC_BMPOPTS_GIFTYPE), FALSE);
03190             HideGadget(_R(IDC_BMPOPTS_TRANSPARENT), FALSE);
03191             HideGadget(_R(IDC_BMPOPTS_INTERLACED), FALSE);
03192             EnableGadget(_R(IDC_BMPOPTS_GIFTYPE), TRUE);
03193             EnableGadget(_R(IDC_BMPOPTS_INTERLACED), TRUE);
03194             SetLongGadgetValue(_R(IDC_BMPOPTS_TRANSPARENT), Transparent);
03195             SetLongGadgetValue(_R(IDC_BMPOPTS_INTERLACED), Interlace);
03196 
03197 //          Palette = pPNGOptions->GetPalette();
03198             Dither = pPNGOptions->GetDither();
03199             bYoDither = TRUE;
03200 
03201             m_bDpiSupported = TRUE;
03202             break;
03203         }
03204         case GIF:
03205         case TI_GIF:
03206         case TI_GIF_ANIM:
03207         {
03208             GIFExportOptions* pGIFOptions = (GIFExportOptions*)pOptions;
03209             ERROR3IF(!pGIFOptions->IS_KIND_OF(GIFExportOptions), "pGIFOptions isn't");
03210 
03211             // 4 8 bpp only
03212             // WEBSTER - markn 23/1/97
03213             // Compression group always hidden in Webster
03214             #ifndef WEBSTER
03215             HideGadget(_R(IDC_BMPOPTS_TIFF), TRUE);     // Hide the TIFF compression selection 
03216             HideGadget(_R(IDC_BMPOPTS_RLE), TRUE);      // Hide the BMP rle compression
03217             HideGadget(_R(IDC_BMPOPTS_RGB), TRUE);      // Hide the BMP rgb compression
03218             HideGadget(_R(IDC_BMPOPTS_COMPRESS), TRUE); // Hide the compression group
03219             #endif // WEBSTER
03220 
03221             m_bDpiSupported = FALSE;
03222 
03223             // Check for illegal case of the the depth for this filter type
03224             if (Depth == 32 || Depth == 24)
03225                 Depth = 8;
03226             // Disable all illegal bpp buttons
03227             HideGadget(_R(IDC_BMPOPTS_CMYK), TRUE);
03228             EnableGadget(_R(IDC_BMPOPTS_32BPP), FALSE);
03229             EnableGadget(_R(IDC_BMPOPTS_24BPP), FALSE);
03230 
03231             // We will use the special GIF radio buttons for interlaced and transparent.
03232             // These are hidden by default.
03233             // But only if our special GIF filter.
03234             if (pOptions->GetFilterType() == TI_GIF ||
03235                 pOptions->GetFilterType() == TI_GIF_ANIM)
03236             {
03237                 // Now set up the list
03238                 // Must correspond to the order TI_GIF .. TI_GIF_TRANSINTER defined in accuflts.h
03239                 // Translate the compression type into the transparency and interlace states.
03240 
03241                 BOOL Transparent = pGIFOptions->WantTransparent();
03242                 BOOL Interlace   = pGIFOptions->WantInterlaced();
03243                 HideGadget(_R(IDC_BMPOPTS_GIFTYPE), FALSE);
03244                 HideGadget(_R(IDC_BMPOPTS_TRANSPARENT), FALSE);
03245                 HideGadget(_R(IDC_BMPOPTS_INTERLACED), FALSE);
03246                 EnableGadget(_R(IDC_BMPOPTS_GIFTYPE), TRUE);
03247                 EnableGadget(_R(IDC_BMPOPTS_INTERLACED), TRUE);
03248                 EnableGadget(_R(IDC_BMPOPTS_TRANSPARENT), TRUE);
03249 
03250                 SetLongGadgetValue(_R(IDC_BMPOPTS_TRANSPARENT), Transparent);
03251                 SetLongGadgetValue(_R(IDC_BMPOPTS_INTERLACED), Interlace);
03252             }
03253             if (pOptions->GetFilterType() == TI_GIF_ANIM)
03254             {
03255                 HideGadget(_R(IDC_ANIMOPTS_ANIMGROUP) , FALSE);     // Un-hide the Animation Group
03256                 HideGadget(_R(IDC_ANIMOPTS_REMOVAL)   , FALSE);
03257                 HideGadget(_R(IDC_ANIMOPTS_DELAYFOR)  , FALSE);
03258                 HideGadget(_R(IDC_ANIMOPTS_CS)        , FALSE);
03259                 HideGadget(_R(IDC_ANIMOPTS_LOOPTEXT)  , FALSE);
03260                 HideGadget(_R(IDC_ANIMOPTS_DELAY)     , FALSE);
03261                 HideGadget(_R(IDC_ANIMOPTS_ITERATIONS), FALSE);
03262                 HideGadget(_R(IDC_ANIMOPTS_TIMES)     , FALSE);
03263                 HideGadget(_R(IDC_ANIMOPTS_LOOP)      , FALSE);
03264                 HideGadget(_R(IDC_ANIMOPTS_RESTORE)   , FALSE);
03265 
03266                 // Unlock the aspect ratio
03267                 m_bLockAspect = FALSE;
03268 
03269                 // ************************************************
03270                 // This is Oily code.  Should be replaced with Dialogue Manager function call
03271                 // Extend the dialogue height, so we can see the animation options
03272 
03273                 WINDOWPLACEMENT Place;
03274                 Place.length = sizeof(WINDOWPLACEMENT);
03275                 if (GetWindowPlacement((HWND)WindowID, &Place))
03276                 {
03277                     Place.rcNormalPosition.bottom = Place.rcNormalPosition.bottom + (ANIMATION_EXTRABIT);
03278                     SetWindowPlacement((HWND)WindowID, &Place);
03279                 }
03280 
03281                 // Added for Webster RanbirR 11\02\97
03282                 BmpDlgParam* pBmpDlgParam = pOptions->GetBmpDlgParam();
03283                 if (pBmpDlgParam == NULL)
03284                     return FALSE;
03285 
03286                 // Go through our list of bitmaps, to find if any are Transparent.
03287 
03288                 // Get a list of our selected bitmaps.
03289                 UINT32 ListSize =  pBmpDlgParam->GetListSize();
03290                 KernelBitmap** pList = pBmpDlgParam->GetBitmapList();
03291                 BOOL Transparent = FALSE;
03292                 INT32 Index=0;
03293 
03294                 // Added for Webster - RanbirR 11\02\97
03295                 // Are any of our bitmaps Transparent ?
03296                 while (ListSize > 0)
03297                 {
03298                     KernelBitmap* pKernelBitmap = pList[--ListSize];
03299 
03300                     if (pKernelBitmap != NULL)
03301                     {
03302                         // Is this bitmap Transparent.
03303                         if(pKernelBitmap->GetTransparencyIndex(&Index))
03304                             Transparent = TRUE;
03305                     }
03306                 }
03307 
03308                 HideGadget(_R(IDC_BMPOPTS_TRANSPARENT), FALSE);
03309                 EnableGadget(_R(IDC_BMPOPTS_TRANSPARENT), TRUE);
03310                 SetLongGadgetValue(_R(IDC_BMPOPTS_TRANSPARENT), Transparent);
03311 
03312                 if (pBmpDlgParam->GetAreDelayValuesSame())
03313                 {
03314                     SetLongGadgetValue(_R(IDC_ANIMOPTS_DELAY), pBmpDlgParam->GetAnimDelay());   
03315                     IsDelayMany=FALSE;
03316                 }
03317                 else
03318                 {
03319                     SetStringGadgetValue(_R(IDC_ANIMOPTS_DELAY), _R(IDS_MANY)); 
03320                     IsDelayMany=TRUE;
03321                 }
03322                 
03323                 if (pBmpDlgParam->GetSameRestoreType())
03324                 {
03325                     SetStringGadgetValue(_R(IDC_ANIMOPTS_REMOVAL), &String_32(_R(IDS_RESTORE_NOTHING)));
03326                     SetStringGadgetValue(_R(IDC_ANIMOPTS_REMOVAL), &String_32(_R(IDS_RESTORE_LEAVEASIS)));
03327                     SetStringGadgetValue(_R(IDC_ANIMOPTS_REMOVAL), &String_32(_R(IDS_RESTORE_BACKGROUND)));
03328                     SetStringGadgetValue(_R(IDC_ANIMOPTS_REMOVAL), &String_32(_R(IDS_RESTORE_PREVIOUS)));
03329                     SetComboListLength(_R(IDC_ANIMOPTS_REMOVAL));
03330                     SetSelectedValueIndex(_R(IDC_ANIMOPTS_REMOVAL), pBmpDlgParam->GetRestoreType());
03331                 }
03332                 else
03333                 {
03334                     SetStringGadgetValue (_R(IDC_ANIMOPTS_REMOVAL), _R(IDS_MANY));
03335                     SetSelectedValueIndex(_R(IDC_ANIMOPTS_REMOVAL), OPTION_ONE);
03336                     IsManyDisplayed = TRUE;
03337                 }
03338         
03339                 SetLongGadgetValue(_R(IDC_ANIMOPTS_ITERATIONS), pGIFOptions->GetAnimationLoopCount());
03340                 EnableGadget(_R(IDC_ANIMOPTS_ITERATIONS), FALSE);
03341                 SetBoolGadgetSelected(_R(IDC_ANIMOPTS_LOOP), TRUE);
03342 
03343             }
03344 
03345 //          Palette = pGIFOptions->GetPalette();
03346             Dither = pGIFOptions->GetDither();
03347             bYoDither = TRUE;
03348 
03349             break;
03350         }
03351         case MAKE_BITMAP_FILTER:
03352         {
03353             MakeBitmapExportOptions* pMkBOptions = (MakeBitmapExportOptions*)pOptions;
03354             ERROR3IF(!pMkBOptions->IS_KIND_OF(MakeBitmapExportOptions), "pMkBOptions isn't");
03355             // 1 4 8 24 bpp
03356             HideGadget(_R(IDC_BMPOPTS_CMYK), TRUE);
03357             EnableGadget(_R(IDC_BMPOPTS_32BPP), FALSE);
03358             HideGadget(_R(IDC_BMPOPTS_CREATEOPTS), FALSE);
03359             HideGadget(_R(IDC_BMPOPTS_GIFTYPE), TRUE);
03360             // WEBSTER - markn 23/1/97
03361             // Compression group always hidden in Webster
03362             #ifndef WEBSTER
03363             HideGadget(_R(IDC_BMPOPTS_TIFF), TRUE);     // Hide the TIFF compression selection 
03364             HideGadget(_R(IDC_BMPOPTS_RLE), TRUE);      // Hide the BMP rle compression
03365             HideGadget(_R(IDC_BMPOPTS_RGB), TRUE);      // Hide the BMP rgb compression
03366             HideGadget(_R(IDC_BMPOPTS_COMPRESS), TRUE); // Hide the compression group
03367             #endif // WEBSTER
03368             
03369             HideGadget(_R(IDC_ANIMOPTS_LOOP), TRUE);    
03370             HideGadget(_R(IDC_ANIMOPTS_DELAY), TRUE);   
03371             HideGadget(_R(IDC_ANIMOPTS_ITERATIONS), TRUE);
03372             HideGadget(_R(IDC_ANIMOPTS_REMOVAL), TRUE); 
03373 
03374             HideGadget(_R(IDC_TIMES_STATIC),TRUE);  
03375             HideGadget(_R(IDC_RESTORE_STATIC),TRUE);
03376 
03377             m_bDpiSupported = TRUE;
03378 
03379             // We will use the special GIF radio buttons for interlaced and transparent.
03380             // These are hidden by default.
03381 
03382             String_256 Temp(_R(IDS_MAKEBMPOPTS));
03383             SetTitlebarName(&Temp); 
03384 
03385             SetStringGadgetValue(IDOK, &String_32(_R(IDS_CREATEBMP)));
03386             SetStringGadgetValue(_R(IDC_BMPOPTS_SAVEAREA), &String_32(_R(IDS_CREATEFROM)));
03387 
03388             // Now set up the list
03389             // Must correspond to the order TI_GIF .. TI_GIF_TRANSINTER defined in outptgif.h
03390             // Translate the compression type into the transparency and interlace states.
03391             BOOL Transparent = pMkBOptions->WantTransparent();
03392             BOOL Interlace   = FALSE;
03393             HideGadget(_R(IDC_BMPOPTS_TRANSPARENT), FALSE);
03394             HideGadget(_R(IDC_BMPOPTS_INTERLACED), TRUE);
03395             EnableGadget(_R(IDC_BMPOPTS_INTERLACED), FALSE);
03396             EnableGadget(_R(IDC_BMPOPTS_TRANSPARENT), TRUE);
03397 
03398             SetLongGadgetValue(_R(IDC_BMPOPTS_TRANSPARENT), Transparent);
03399 
03400 //          Palette = pMkBOptions->GetPalette();
03401             Dither = pMkBOptions->GetDither();
03402             bYoDither = TRUE;
03403             break;
03404         }
03405         case WPG:
03406             // 1 4 8 bpp only
03407             // WEBSTER - markn 23/1/97
03408             // Compression group always hidden in Webster
03409             #ifndef WEBSTER
03410             HideGadget(_R(IDC_BMPOPTS_TIFF), TRUE);     // Hide the TIFF compression selection 
03411             HideGadget(_R(IDC_BMPOPTS_RLE), TRUE);      // Hide the BMP rgb compression
03412             HideGadget(_R(IDC_BMPOPTS_RGB), TRUE);      // Hide the BMP rle compression
03413             HideGadget(_R(IDC_BMPOPTS_COMPRESS), TRUE); // Hide the compression group
03414             #endif // WEBSTER
03415 
03416             // Check for illegal case of the the depth for this filter type
03417             if (Depth == 32 || Depth == 24)
03418                 Depth = 8;
03419             m_bDpiSupported = FALSE;
03420             // Disable all illegal bpp buttons
03421             HideGadget(_R(IDC_BMPOPTS_CMYK), TRUE);
03422             EnableGadget(_R(IDC_BMPOPTS_32BPP), FALSE);
03423             EnableGadget(_R(IDC_BMPOPTS_24BPP), FALSE);
03424 
03425             //WEBSTER-Martin-06/01/97
03426             #ifndef WEBSTER
03427             Palette = ((AccusoftExportOptions*)pOptions)->GetPalette();
03428             Dither = ((AccusoftExportOptions*)pOptions)->GetDither();
03429             #endif //WEBSTER
03430             bYoDither = TRUE;
03431 
03432             break;
03433         case PHOTOCD:
03434             // 24 bpp only
03435             // WEBSTER - markn 23/1/97
03436             // Compression group always hidden in Webster
03437             #ifndef WEBSTER
03438             HideGadget(_R(IDC_BMPOPTS_TIFF), TRUE);     // Hide the TIFF compression selection 
03439             HideGadget(_R(IDC_BMPOPTS_RLE), TRUE);      // Hide BMP rgb compression
03440             HideGadget(_R(IDC_BMPOPTS_RGB), TRUE);      // Hide BMP rle compression
03441             HideGadget(_R(IDC_BMPOPTS_COMPRESS), TRUE); // Hide compression group
03442             #endif // WEBSTER
03443 
03444             // Check for illegal case of the the depth for this filter type
03445             if (Depth != 24)
03446                 Depth = 24;
03447             // Disable all illegal bpp buttons
03448             HideGadget(_R(IDC_BMPOPTS_CMYK), TRUE);
03449             EnableGadget(_R(IDC_BMPOPTS_8BPP), FALSE);
03450             EnableGadget(_R(IDC_BMPOPTS_4BPP), FALSE);
03451             EnableGadget(_R(IDC_BMPOPTS_1BPP), FALSE);
03452             m_bDpiSupported = TRUE;
03453             break;
03454         case IFF_ILBM:
03455         case XWD:
03456         case DCX:
03457         case PCX:
03458         case PICT:
03459             // 1 4 8 24 bpp
03460             // WEBSTER - markn 23/1/97
03461             // Compression group always hidden in Webster
03462             #ifndef WEBSTER
03463             HideGadget(_R(IDC_BMPOPTS_TIFF), TRUE);     // Hide the TIFF compression selection 
03464             HideGadget(_R(IDC_BMPOPTS_RLE), TRUE);      // Hide BMP rgb compression
03465             HideGadget(_R(IDC_BMPOPTS_RGB), TRUE);      // Hide BMP rle compression
03466             HideGadget(_R(IDC_BMPOPTS_COMPRESS), TRUE); // Hide compression group
03467             #endif // WEBSTER
03468 
03469             // Check for illegal case of the the depth for this filter type
03470             if (Depth == 32)
03471                 Depth = 24;
03472             // Disable all illegal bpp buttons
03473             HideGadget(_R(IDC_BMPOPTS_CMYK), TRUE);
03474             EnableGadget(_R(IDC_BMPOPTS_32BPP), FALSE);
03475             m_bDpiSupported = FALSE;
03476 
03477             //WEBSTER-Martin-06/01/97
03478             #ifndef WEBSTER
03479             Palette = ((AccusoftExportOptions*)pOptions)->GetPalette();
03480             Dither = ((AccusoftExportOptions*)pOptions)->GetDither();
03481             #endif // WEBSTER
03482             bYoDither = TRUE;
03483             break;
03484 
03485         case RAST:
03486         case PHOTOSHOP:
03487             // 1 8 24 bpp
03488             // WEBSTER - markn 23/1/97
03489             // Compression group always hidden in Webster
03490             #ifndef WEBSTER
03491             HideGadget(_R(IDC_BMPOPTS_TIFF), TRUE);     // Hide the TIFF compression selection 
03492             HideGadget(_R(IDC_BMPOPTS_RLE), TRUE);      // Hide BMP rgb compression
03493             HideGadget(_R(IDC_BMPOPTS_RGB), TRUE);      // Hide BMP rle compression
03494             HideGadget(_R(IDC_BMPOPTS_COMPRESS), TRUE); // Hide compression group
03495             #endif // WEBSTER
03496 
03497             // Check for illegal case of the the depth for this filter type
03498             if (Depth == 32 || Depth == 4)
03499                 Depth = 24;
03500             // Disable all illegal bpp buttons
03501             HideGadget(_R(IDC_BMPOPTS_CMYK), TRUE);
03502             EnableGadget(_R(IDC_BMPOPTS_32BPP), FALSE);
03503             EnableGadget(_R(IDC_BMPOPTS_4BPP), FALSE);
03504             m_bDpiSupported = FALSE;
03505 
03506             //WEBSTER-Martin-06/01/97
03507             #ifndef WEBSTER
03508             Palette = ((AccusoftExportOptions*)pOptions)->GetPalette();
03509             Dither = ((AccusoftExportOptions*)pOptions)->GetDither();
03510             #endif // WEBSTER
03511             bYoDither = TRUE;
03512 
03513             break;
03514         case TARGA:
03515             // 8 24 bpp
03516             // WEBSTER - markn 23/1/97
03517             // Compression group always hidden in Webster
03518             #ifndef WEBSTER
03519             HideGadget(_R(IDC_BMPOPTS_TIFF), TRUE);     // Hide the TIFF compression selection 
03520             HideGadget(_R(IDC_BMPOPTS_RLE), TRUE);      // Hide BMP rgb compression
03521             HideGadget(_R(IDC_BMPOPTS_RGB), TRUE);      // Hide BMP rle compression
03522             HideGadget(_R(IDC_BMPOPTS_COMPRESS), TRUE); // Hide compression group
03523             #endif // WEBSTER
03524 
03525             // Check for illegal case of the the depth for this filter type
03526             if (Depth == 32  || Depth == 4 || Depth == 1)
03527                 Depth = 24;
03528             // Disable all illegal bpp buttons
03529             HideGadget(_R(IDC_BMPOPTS_CMYK), TRUE);
03530             EnableGadget(_R(IDC_BMPOPTS_32BPP), FALSE);
03531             EnableGadget(_R(IDC_BMPOPTS_4BPP), FALSE);
03532             EnableGadget(_R(IDC_BMPOPTS_1BPP), FALSE);
03533             m_bDpiSupported = FALSE;
03534 
03535             //WEBSTER-Martin-06/01/97
03536             #ifndef WEBSTER
03537             Palette = ((AccusoftExportOptions*)pOptions)->GetPalette();
03538             Dither = ((AccusoftExportOptions*)pOptions)->GetDither();
03539             #endif // WEBSTER
03540             bYoDither = TRUE;
03541             break;
03542 
03543         case MACPAINT:
03544         case MSP:
03545             // 1bpp only
03546             return FALSE;
03547             break;
03548         case BMP_UNCOMPRESSED:
03549         {
03550             BMPExportOptions* pBMPOptions = (BMPExportOptions*)pOptions;
03551             ERROR3IF(!pBMPOptions->IS_KIND_OF(BMPExportOptions), "pBMPOptions isn't");
03552 
03553             // WEBSTER - markn 23/1/97
03554             // Compression group always hidden in Webster
03555             #ifndef WEBSTER
03556             HideGadget(_R(IDC_BMPOPTS_TIFF), TRUE);     // Hide the TIFF compression selection 
03557             HideGadget(_R(IDC_BMPOPTS_RLE), FALSE);     // Show the BMP rgb compression
03558             HideGadget(_R(IDC_BMPOPTS_RGB), FALSE);     // Show the BMP rle compression
03559             HideGadget(_R(IDC_BMPOPTS_COMPRESS), FALSE);// Show the compression group
03560 
03561             // Now set up the other buttons according to the values set in the variables
03562             if (pBMPOptions->GetCompression())
03563                 SetLongGadgetValue(_R(IDC_BMPOPTS_RLE), TRUE);
03564             else
03565                 SetLongGadgetValue(_R(IDC_BMPOPTS_RGB), TRUE);
03566             #endif // WEBSTER
03567 
03568             // Check for illegal case of the the depth for this filter type
03569             if ( Depth == 16 )
03570                 Depth = 24;
03571             EnableGadget(_R(IDC_BMPOPTS_32BPP), FALSE);
03572             HideGadget(_R(IDC_BMPOPTS_CMYK), FALSE);
03573             Palette = pBMPOptions->GetPalette();
03574             Dither = pBMPOptions->GetDither();
03575             bYoDither = TRUE;
03576 
03577             m_bDpiSupported = TRUE;
03578             break;
03579         }
03580         default:
03581             return FALSE;
03582     }
03583 
03584     // Override the Export button if being invoked from the Name gallery.
03585     if (NamedExportProp::m_fApplyNotExport)
03586         SetStringGadgetValue(IDOK, &String(_R(IDS_PREVIEW_APPLY)));
03587 
03588     // If the default depth's not supported give a sensible one
03589     if (Depth != pOptions->GetDepth())
03590     {
03591         pOptions->SetDepth(Depth);
03592     }
03593 
03594     if (!m_bDpiSupported)                           // Doesn't support dpi...
03595     {
03596         // and ensure that its always the number of dpi as defined by a pixel unit
03597         DocUnitList* pDocUnitList = DocUnitList::GetCurrentDocUnitList();
03598         ERROR3IF(pDocUnitList == NULL, "BmpPrefsDlg::InitDialog() - no pDocUnitList!")
03599         Unit* pPixelUnit = pDocUnitList->FindUnit(PIXELS);
03600         ERROR3IF(pPixelUnit == NULL, "BmpPrefsDlg::InitDialog() - no pixel units!")
03601         Unit* pInchUnit = pDocUnitList->FindUnit(INCHES);
03602         ERROR3IF(pInchUnit == NULL, "BmpPrefsDlg::InitDialog() - no inch units!")
03603         double newDpi = (pPixelUnit->GetMillipoints()>0) ? pInchUnit->GetMillipoints() / pPixelUnit->GetMillipoints() : 96.0;
03604         Dpi = (INT32)newDpi;
03605         pOptions->SetDPI(newDpi);
03606 
03607         // Now, set up the resolution combo box
03608         SetUpResolutionList();
03609 
03610         // so disallow changes to dpi field
03611         EnableGadget(_R(IDC_BMPOPTS_RES), FALSE);
03612         EnableGadget(_R(IDC_BMPOPTS_DPI), FALSE);
03613     }
03614     else
03615     {
03616         // Now, set up the resolution combo box
03617         SetUpResolutionList();
03618     }
03619 
03620     // blooooody classes!!!! foookin virtuals!!!
03621     InitDepthRadioGroup();
03622     InitSelectionRadioGroup();
03623     if (bYoDither)
03624     {
03625         InitPaletteRadioGroup(Palette);
03626         InitDitherRadioGroup(Dither);       // GetDitherGadget()->Init()???
03627     }
03628 
03629     // Make sure that size fields are displaying the values correctly
03630     RecalculateSize();
03631 
03632     if (m_bDpiSupported)
03633     {
03634         // Start off with input focus in the dpi field
03635         SetKeyboardFocus(_R(IDC_BMPOPTS_RES));
03636     }
03637     else
03638     {
03639         // Start off with input focus in the x pixel size
03640         SetKeyboardFocus(_R(IDC_BMPOPTS_XPIXELS));
03641     }
03642 
03643     return TRUE;
03644 }

void BmpPrefsDlg::InitDitherRadioGroup const DITHER DitherType  )  [protected]
 

Definition at line 3960 of file bmpprefs.cpp.

03961 {
03962     // Set up the dithering selection radio buttons
03963     switch (DitherType)
03964     {
03965         case XARADITHER_NONE:
03966             SetLongGadgetValue(_R(IDC_BMPOPTS_NODITHER), TRUE);
03967             break;
03968 
03969         case XARADITHER_ORDERED_GREY:
03970             SetLongGadgetValue(_R(IDC_BMPOPTS_ORDDITHER), TRUE);
03971             break;
03972 
03973         case XARADITHER_ERROR_DIFFUSION:
03974             SetLongGadgetValue(_R(IDC_BMPOPTS_DIFFUSION), TRUE);
03975             break;
03976 
03977         default:
03978             SetLongGadgetValue(_R(IDC_BMPOPTS_DIFFUSION), TRUE);
03979             break;
03980     }
03981 
03982     if (GetOptions()->GetSelectionType() == ABITMAP)
03983     {
03984         // If we are outputing a bitmap directly, then we
03985         // don't need the palette and dithering options
03986         EnableGadget(_R(IDC_BMPOPTS_NODITHER), FALSE);
03987         EnableGadget(_R(IDC_BMPOPTS_ORDDITHER), FALSE);
03988         EnableGadget(_R(IDC_BMPOPTS_DIFFUSION), FALSE);
03989         EnableGadget(_R(IDC_BMPOPTS_PAL_STD), FALSE);
03990         EnableGadget(_R(IDC_BMPOPTS_PAL_OPT), FALSE);
03991     }
03992 }

void BmpPrefsDlg::InitNumColoursGroup BitmapExportOptions pOptions  )  [protected]
 

Inits the "number of colour in palette" group in the bitmap export dlg.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/1/97
Parameters:
pOptions = The options for this bitmap export [INPUTS]
Returns:
-
NOTE: If the options don't allow a specific number of colours to be show, then this function will hide them instead

Introduced in WEBSTER

Definition at line 3663 of file bmpprefs.cpp.

03664 {
03665     if (pOptions == NULL)
03666         return;
03667 
03668     // Don't show these options if we can't support a specific number of colours
03669     if (!pOptions->UseSpecificNumColsInPalette())
03670     {
03671         HideNumColoursGroup();
03672         return;
03673     }
03674 
03675     INT32 Gadgets[] = { _R(IDC_BMPOPTS_NUMCOLS_GROUP),
03676                         _R(IDC_BMPOPTS_NUMCOLS_EDIT),
03677                         _R(IDC_BMPOPTS_NUMCOLS_SYSCOLS),
03678                         _R(IDC_BMPOPTS_NUMCOLS_EDITTEXT),
03679                         0};
03680 
03681     // ************************************************
03682     // This is Oily code.  Should be replaced with Dialogue Manager function call
03683     // It moves the numcols gadgets into the correct place on the dialog and
03684     // extends the dialog so you can see them.  Lovely!
03685 
03686     {
03687         INT32 Index = 0;
03688         for (Index = 0;Gadgets[Index] != 0;Index++)
03689         {
03690             HWND hGadget = GetDlgItem((HWND)WindowID, (INT32)Gadgets[Index]);
03691             RECT MoveRect;
03692             POINT TopLeft;
03693 
03694             if (GetWindowRect(hGadget, &MoveRect))
03695             {
03696                 TopLeft.x = MoveRect.left;      // Convert TopLeft coord into client coords
03697                 TopLeft.y = MoveRect.top;
03698                 ScreenToClient((HWND)WindowID, &TopLeft);
03699                 TopLeft.y -= NUMCOLS_GROUP_SHIFT;
03700 
03701                 SetWindowPos(hGadget, NULL,
03702                                 TopLeft.x, TopLeft.y, 0, 0,
03703                                 SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER);
03704             }
03705         }
03706 
03707         for (Index = 0;Gadgets[Index] != 0;Index++)
03708             HideGadget(Gadgets[Index],FALSE);
03709 
03710         WINDOWPLACEMENT Place;
03711         Place.length = sizeof(WINDOWPLACEMENT);
03712         if (GetWindowPlacement((HWND)WindowID, &Place))
03713         {
03714             Place.rcNormalPosition.bottom = Place.rcNormalPosition.bottom + (NUMCOLS_EXTRABIT);
03715             SetWindowPlacement((HWND)WindowID, &Place);
03716         }
03717     }
03718 
03719     // Init the gadgets
03720     INT32 NumCols = 0;
03721     BOOL UseSysCols = TRUE;
03722     NumCols     = pOptions->GetNumColsInPalette();
03723     UseSysCols  = pOptions->GetUseSystemColours();
03724 
03725     // Adjust in case we added the system colours
03726     if (UseSysCols)
03727         NumCols -= NUM_SYS_COLS;
03728   
03729     SetLongGadgetValue(_R(IDC_BMPOPTS_NUMCOLS_EDIT),NumCols);
03730     SetBoolGadgetSelected(_R(IDC_BMPOPTS_NUMCOLS_SYSCOLS),UseSysCols);
03731 }

void BmpPrefsDlg::InitPaletteRadioGroup const PALETTE Palette  )  [protected]
 

Definition at line 3938 of file bmpprefs.cpp.

03939 {
03940 // WEBSTER - markn 17/1/97
03941 // Calls SetPaletteButtons() to do the hard work now.
03942 
03943     switch (Palette)
03944     {
03945         case PAL_OPTIMISED:
03946             SetPaletteButtons(_R(IDC_BMPOPTS_PAL_OPT));
03947             break;
03948 
03949         case PAL_STANDARD:
03950             SetPaletteButtons(_R(IDC_BMPOPTS_PAL_STD));
03951             break;
03952 
03953         default:
03954             TRACE( _T("Non-standard palette set"));
03955             break;
03956     }
03957 }

void BmpPrefsDlg::InitSelectionRadioGroup  )  [protected]
 

Definition at line 3999 of file bmpprefs.cpp.

04000 {
04001     //  Always disable this button.
04002     EnableGadget(_R(IDC_BMPOPTS_SPREAD), FALSE);
04003 
04004     // Set up the save spread/selection radio buttons
04005     if (GetOptions()->GetFilterType() == MAKE_BITMAP_FILTER ||
04006         GetOptions()->GetFilterType() == TI_GIF_ANIM)
04007     {
04008         SetLongGadgetValue(_R(IDC_BMPOPTS_SELECT), TRUE);
04009         // Disable all buttons
04010         EnableGadget(_R(IDC_BMPOPTS_SELECT), FALSE);
04011         EnableGadget(_R(IDC_BMPOPTS_DRAWING), FALSE);
04012     }
04013     else
04014     {
04015         // The drawing option is always available.
04016         EnableGadget(_R(IDC_BMPOPTS_DRAWING), TRUE);
04017 
04018         // If selection is True then enable the spread/selection/drawing buttons otherwise
04019         // disable the selection button and allow choice between spread or drawing, drawing
04020         // being the default.
04021         switch (GetOptions()->GetSelectionType())
04022         {
04023             case SELECTION:
04024                 // If selection present then choose export selection by default
04025                 SetLongGadgetValue(_R(IDC_BMPOPTS_SELECT), TRUE);
04026 
04027                 // Selection present, so enable that button.
04028                 EnableGadget(_R(IDC_BMPOPTS_SELECT), TRUE);
04029                 break;
04030 
04031             default:
04032                 // If no selection present then choose export drawing by default        
04033                 SetLongGadgetValue(_R(IDC_BMPOPTS_DRAWING), TRUE);
04034 
04035                 // No selection present, so let all options be used
04036                 EnableGadget(_R(IDC_BMPOPTS_SELECT), FALSE);
04037                 break;
04038         }
04039     }
04040 
04041     // Finally, smash it over the head with a bodge to disable the whole
04042     // group of gadgets when being invoked from the Name gallery.
04043     if (NamedExportProp::m_fApplyNotExport)
04044     {
04045         EnableGadget(_R(IDC_BMPOPTS_SAVEAREA), FALSE);
04046         EnableGadget(_R(IDC_BMPOPTS_SELECT), FALSE);
04047         EnableGadget(_R(IDC_BMPOPTS_DRAWING), FALSE);
04048         EnableGadget(_R(IDC_BMPOPTS_SPREAD), FALSE);
04049     }
04050 }

BOOL BmpPrefsDlg::InvokeDialog BitmapExportOptions pExportOptions  )  [static]
 

How to invoke or start a BmpPrefsDlg box.

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
07/11/96
Parameters:
pointer to some export options [INPUTS]
Returns:
True if Ok used or False if Cancel used.

Definition at line 2816 of file bmpprefs.cpp.

02817 {
02818     ERROR2IF(pExportOptions == NULL, FALSE, "pExportOptions NULL");
02819     ERROR3IF(!pExportOptions->IS_KIND_OF(BitmapExportOptions), "pExportOptions isn't");
02820 
02821     IDD = pExportOptions->GetDialogType();
02822 
02823     OpDescriptor *OpDesc;
02824     if (IDD == _R(IDD_EXPORTJPEGOPTS))
02825         OpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_JPGPREFSDLG);
02826     else
02827         OpDesc = OpDescriptor::FindOpDescriptor(CC_RUNTIME_CLASS(BmpPrefsDlg));
02828 
02829 
02830     if (OpDesc == NULL)
02831     {
02832         ERROR3("BmpPrefsDlg::InvokeDialog is unable to find the BmpPrefsDlg OpDescriptor");
02833         pExportOptions->MarkInvalid();
02834     }
02835     else
02836     {
02837         OpDesc->Invoke((OpParam *)pExportOptions);
02838     }
02839 
02840     return pExportOptions->IsValid();
02841 }

MsgResult BmpPrefsDlg::Message Msg Message  )  [protected, virtual]
 

Handles all the bitmap preferences dialog's messages.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/08/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Reimplemented from DialogOp.

Reimplemented in JPEGExportPrefsDialog.

Definition at line 2497 of file bmpprefs.cpp.

02498 {
02499     if (IS_OUR_DIALOG_MSG(Message))
02500     {
02501         DialogMsg* Msg = (DialogMsg*) Message;
02502         MsgResult Result;
02503         BOOL EndDialog = FALSE;     // TRUE if we should quit the dialog
02504 
02505         BitmapExportOptions* pOptions = GetOptions();
02506         ERROR3IF(pOptions == NULL, "BmpPrefsDlg::Message - Parameters not been set up");
02507 
02508         // Should now handle the required messages that we respond to
02509         switch (Msg->DlgMsg)
02510         {
02511             case DIM_CREATE:
02512                 {
02513                     // Make sure the updating variable is set to something sensible
02514                     RecalculatingPixels = FALSE;
02515                     RecalculatingXDpi = FALSE;
02516                     RecalculatingYDpi = FALSE;
02517 
02518                     // As it is a modal dialog box we are sent a message to say the dialog box
02519                     // is being created, so we have a chance to set the initial control values
02520                     // JPEG export has a special dialog box, all others use the same one 
02521                     InitDialog();
02522                     HasDelayChanged = FALSE;
02523                     HasRestoreChanged = FALSE;
02524                 }
02525             break;
02526 
02527             case DIM_COMMIT:
02528                 {
02529                     // (ok) accept all changes that the user has made to the settings
02530                     // brackets make the ok local to this case 
02531                     // JPEG export has a special dialog box, all others use the same one 
02532                     BOOL ok;
02533                     ok = CommitDialogValues();
02534                     if (ok)
02535                     {
02536                         // Values found ok so quit dialogue then go ahead and export
02537                         GetOptions()->MarkValid();          // Flag ok used
02538                         EndDialog = TRUE;               // Flag to close and end
02539                     }
02540                 }
02541             break;
02542 
02543             case DIM_CANCEL:
02544                 // Cancel all changes that the user has made to the settings
02545                 GetOptions()->MarkInvalid();            // Flag cancel used
02546                 EndDialog = TRUE;                       // Flag to close and end
02547             break;
02548 
02549             case DIM_LISTDROPPED:
02550                 {
02551                     
02552                     HasRestoreChanged = TRUE;
02553 
02554                     if(IsManyDisplayed)
02555                     {
02556                         DeleteAllValues(_R(IDC_ANIMOPTS_REMOVAL));  
02557                         SetStringGadgetValue(_R(IDC_ANIMOPTS_REMOVAL), _R(IDS_RESTORE_NOTHING));
02558                         SetStringGadgetValue(_R(IDC_ANIMOPTS_REMOVAL), _R(IDS_RESTORE_LEAVEASIS));
02559                         SetStringGadgetValue(_R(IDC_ANIMOPTS_REMOVAL), _R(IDS_RESTORE_BACKGROUND));
02560                         SetStringGadgetValue(_R(IDC_ANIMOPTS_REMOVAL), _R(IDS_RESTORE_PREVIOUS));
02561                         SetStringGadgetValue(_R(IDC_ANIMOPTS_REMOVAL), _R(IDS_MANY));
02562                         SetSelectedValueIndex(_R(IDC_ANIMOPTS_REMOVAL), OPTION_FOUR);
02563                         SetComboListLength(_R(IDC_ANIMOPTS_REMOVAL));
02564                         IsManyDisplayed = FALSE;
02565                     }
02566                 }
02567             break;
02568 
02569             case DIM_LFT_BN_CLICKED:
02570 
02571                 // If they clicked on a "help" button then invoke the help system for this dialog.
02572                 if (Msg->GadgetID == _R(ID_CC_HELP_BUTTON))
02573                 {
02574                     UINT32 HelpID = GetFilterHelpID(GetOptions()->GetFilterType());
02575 
02576                     if (HelpID > 0)
02577                     {
02578                         // Invoke the help system and mark this message as completely processed.
02579                         HelpUserTopic(HelpID);
02580                         return DLG_EAT_IF_HUNGRY(Msg);
02581                     }
02582                 }
02583                 // A control on the dialog box has been clicked...
02584                 switch (Msg->GadgetID)
02585                 {
02586                     if (pOptions->GetFilterType() != JPEG)
02587                     {
02588                         // Uses a generic routine which checks to see if the chosen option means
02589                         // that other options become greyed or ungreyed
02590                         // case _R(IDC_BMPOPTS_32BPP): // 32 bpp case no longer exists. Why? Some spappy reason or other.
02591                         case _R(IDC_BMPOPTS_CMYK):
02592                         case _R(IDC_BMPOPTS_24BPP):
02593                         case _R(IDC_BMPOPTS_8BPP):
02594                         case _R(IDC_BMPOPTS_4BPP):
02595                         case _R(IDC_BMPOPTS_1BPP):
02596                             SetBPPButtons(Msg->GadgetID,TRUE);
02597                         break;
02598 
02599                         case _R(IDC_BMPOPTS_PAL_STD):
02600                         case _R(IDC_BMPOPTS_PAL_OPT):
02601                             SetPaletteButtons(Msg->GadgetID);
02602                         break;
02603 
02604                         case _R(IDC_BMPOPTS_NODITHER):
02605                         case _R(IDC_BMPOPTS_ORDDITHER):
02606                         case _R(IDC_BMPOPTS_DIFFUSION):
02607                             SetDitherButtons(Msg->GadgetID);
02608                         break;
02609                         case _R(IDC_ANIMOPTS_LOOP):
02610                         {
02611                             BOOL Value = GetBoolGadgetSelected(_R(IDC_ANIMOPTS_LOOP));
02612                             if (Value)
02613                             {
02614                                 SetLoopCheckBox(TRUE);
02615                                 SetBmpPrefsDlgState();
02616                             }
02617                             else
02618                             {
02619                                 SetLoopCheckBox(FALSE);
02620                                 SetBmpPrefsDlgState();
02621                             }
02622                         }
02623                         break;
02624                     }
02625                     // All other buttons should take care of themselves
02626                     // Apart from if the user changes the selection/spread/drawing buttons
02627                     // we must go and recalculate the sizes and resolution on display.  
02628                     case _R(IDC_BMPOPTS_DRAWING):
02629                     case _R(IDC_BMPOPTS_SELECT):
02630                         RecalculateSize();
02631                     break;
02632                 }
02633             break; // DIM_LFT_BN_CLICKED        
02634 
02635             case DIM_SELECTION_CHANGED:
02636                 // A control on the dialog box has been typed in...
02637                 switch (Msg->GadgetID)
02638                 {
02639                     case _R(IDC_BMPOPTS_RES):
02640                         RecalculatePixels();
02641                     break;
02642                 }
02643             break; // DIM_SELECTION_CHANGED     
02644 
02645             case DIM_TEXT_CHANGED:
02646                 // A control on the dialog box has been typed in...
02647                 switch (Msg->GadgetID)
02648                 {
02649                     case _R(IDC_BMPOPTS_RES):
02650                         RecalculatePixels();
02651                     break;
02652                     case _R(IDC_BMPOPTS_XPIXELS):
02653                         RecalculateDpiFromX();
02654                     break;
02655                     case _R(IDC_BMPOPTS_YPIXELS):
02656                         RecalculateDpiFromY();
02657                     break;
02658                     case _R(IDC_ANIMOPTS_DELAY):
02659                         HasDelayChanged = TRUE;
02660                     break;
02661                 }
02662             break; // DIM_TEXT_CHANGED      
02663 
02664         }
02665 
02666         // Allow the base class access to the message, it will do the
02667         // DLG_EAT_IF_HUNGRY(Msg) for us
02668         // Must do this before the Close and End
02669         Result = DialogOp::Message(Message);
02670 
02671         // End dialog here
02672         if (EndDialog) 
02673         {
02674             Close();                // Hide the dialog box
02675             End();                  // Finish the operation
02676         }
02677 
02678         // The message was for our dialog box so return that we have handled it, if necessary
02679         //return (DLG_EAT_IF_HUNGRY(Msg)); 
02680         return Result;
02681     }
02682 
02683     return DialogOp::Message(Message); 
02684 }

void BmpPrefsDlg::RecalculateDpiFromX  )  [protected]
 

Takes the size of the selection/spread/drawing and the size in the pixel width field and calculates a new current dpi from this.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/3/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 1492 of file bmpprefs.cpp.

01493 {    
01494     // If the RecalculatePixels() function is setting the values then make sure we
01495     // do not update the values as well. 
01496     if (RecalculatingPixels || RecalculatingYDpi)
01497         return;
01498 
01499     // Now work out the pixel sizes which this will correspond to at the current dpi setting
01500     // Get the x and y pixel sizes from the editable fields, with no error reporting
01501     // Use 9 as minimum so that when deleting, the dpi is not blanked when down to one digit
01502     BOOL Valid = FALSE; // Flag for validity of value
01503     PixelWidth = GetLongGadgetValue(_R(IDC_BMPOPTS_XPIXELS), 9, INT32_MAX, NULL ,&Valid);
01504 
01505     if ( Valid ) 
01506     {
01507         RecalculatingXDpi = TRUE;
01508 
01509         double Resolution = (Width>0) ? ((double) PixelWidth * 72000.0) / ((double) Width) : 96.0;
01510 
01511         // A bit of a safety net here
01512         if ((Resolution < 5.0) || (Resolution > D_MAXDPI))
01513         {
01514             // There is a problem with the x pixels field so blank the pixel height
01515             // and dpi fields 
01516             SetStringGadgetValue(_R(IDC_BMPOPTS_YPIXELS), &String_8(""));
01517             if (m_bDpiSupported)
01518             {
01519                 SetStringGadgetValue(_R(IDC_BMPOPTS_RES), &String_8(""), FALSE, -1);
01520             }
01521         }
01522         else
01523         {
01524             // Use 0.5 so that we are forced to round up to the next dpi, if possible
01525             INT32 b_dpi = (INT32)(Resolution + 0.5);
01526             Dpi = b_dpi; //Resolution;
01527             if (m_bDpiSupported)
01528             {
01529                 //SetDoubleGadgetValue(_R(IDC_BMPOPTS_RES), Dpi, FALSE, -1);
01530                 SetLongGadgetValue(_R(IDC_BMPOPTS_RES), (INT32)Dpi, FALSE, -1);
01531             }
01532 
01533             // Given the new dpi, recalculate the y pixels
01534             // This is once again the calculation we are doing
01535             // INT32 PixelHeight = (INT32)(((Height * Dpi)/72000) + 0.5);
01536             // but using the same code that wil be used for exporting
01537             Matrix Identity;    // default construction is an identity matrix
01538             WinRect Rect = OSRenderRegion::BitmapDocRectToWin( Identity, ClipRect, Dpi );
01539             PixelHeight = Rect.Height();
01540             SetLongGadgetValue(_R(IDC_BMPOPTS_YPIXELS), PixelHeight);
01541         }
01542                 
01543         RecalculatingXDpi = FALSE;
01544     }
01545     else
01546     {
01547         RecalculatingXDpi = TRUE;
01548 
01549         // There is a problem with the x pixels field so blank the pixel height
01550         // and dpi fields 
01551         SetStringGadgetValue(_R(IDC_BMPOPTS_YPIXELS), &String_8(""));
01552         if (m_bDpiSupported)
01553         {
01554             SetStringGadgetValue(_R(IDC_BMPOPTS_RES), &String_8(""), FALSE, -1);
01555         }
01556 
01557         RecalculatingXDpi = FALSE;
01558     }
01559 }

void BmpPrefsDlg::RecalculateDpiFromY  )  [protected]
 

Takes the size of the selection/spread/drawing and the size in the pixel height field and calculates a new current dpi from this.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/3/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 1577 of file bmpprefs.cpp.

01578 {    
01579     // If the RecalculatePixels() function is setting the values then make sure we
01580     // do not update the values as well. 
01581     if (RecalculatingPixels || RecalculatingXDpi)
01582         return;
01583 
01584     // Now work out the pixel sizes which this will correspond to at the current dpi setting
01585     // Get the x and y pixel sizes from the editable fields, with no error reporting
01586     // Use 9 as minimum so that when deleting, the dpi is not blanked when down to one digit
01587     BOOL Valid = FALSE;     // Flag for validity of value
01588     PixelHeight = GetLongGadgetValue(_R(IDC_BMPOPTS_YPIXELS), 9, INT32_MAX, NULL ,&Valid);
01589 
01590     if ( Valid ) 
01591     {
01592         RecalculatingYDpi = TRUE;
01593         
01594         double Resolution = (Height>0) ? ((double) PixelHeight * 72000.0) / ((double) Height) : 96.0;
01595 
01596         // A bit of a safety net here
01597         if ((Resolution < 5.0) || (Resolution > D_MAXDPI))
01598         {
01599             // There is a problem with the y pixels field so blank the pixel width
01600             // and dpi fields 
01601             SetStringGadgetValue(_R(IDC_BMPOPTS_XPIXELS), &String_8(""));
01602             if (m_bDpiSupported)
01603             {
01604                 SetStringGadgetValue(_R(IDC_BMPOPTS_RES), &String_8(""), FALSE, -1);
01605             }
01606         }
01607         else
01608         {
01609             // Use 0.5 so that we are forced to round up to the next dpi, if possible
01610             INT32 b_dpi = (INT32)(Resolution + 0.5);
01611             Dpi = b_dpi; //Resolution;
01612             {
01613                 //SetDoubleGadgetValue(_R(IDC_BMPOPTS_RES), Dpi, FALSE, -1);
01614                 SetLongGadgetValue(_R(IDC_BMPOPTS_RES), (INT32)Dpi, FALSE, -1);
01615             }
01616             
01617             // Given the new dpi, recalculate the y pixels
01618             // This is once again the calculation we are doing
01619             // INT32 PixelWidth = (INT32)(((Width * Dpi)/72000) + 0.5);
01620             // but using the same code that wil be used for exporting
01621             Matrix Identity;    // default construction is an identity matrix
01622             WinRect Rect = OSRenderRegion::BitmapDocRectToWin( Identity, ClipRect, Dpi );
01623             PixelWidth = Rect.Width();
01624             SetLongGadgetValue(_R(IDC_BMPOPTS_XPIXELS), PixelWidth);
01625         }
01626 
01627         RecalculatingYDpi = FALSE;
01628     }
01629     else
01630     {
01631         RecalculatingYDpi = TRUE;
01632 
01633         // There is a problem with the y pixels field so blank the pixel width
01634         // and dpi fields 
01635         SetStringGadgetValue(_R(IDC_BMPOPTS_XPIXELS), &String_8(""));
01636         if (m_bDpiSupported)
01637         {
01638             SetStringGadgetValue(_R(IDC_BMPOPTS_RES), &String_8(""), FALSE, -1);
01639         }
01640 
01641         RecalculatingYDpi = FALSE;
01642     }
01643 }

void BmpPrefsDlg::RecalculatePixels  )  [protected]
 

Takes the size of the selection/spread/drawing and calculates the size that this will be in pixels given the current dpi field.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/3/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 1413 of file bmpprefs.cpp.

01414 {    
01415 
01416     // If the RecalculateDpiFromX() or RecalculateDpiFromY() functions are setting the
01417     // values then make sure we do not update the values as well. 
01418     if (RecalculatingXDpi || RecalculatingYDpi)
01419         return;
01420 
01421     // Now work out the pixel sizes which this will correspond to at the current dpi setting
01422     PixelWidth = 0; 
01423     PixelHeight = 0;    
01424     Dpi = 0;
01425     BOOL Valid = 0;         // Flag for validity of value
01426 
01427     // Get the dpi value from the resolution combo box, with no error reporting
01428     // Don't change the current values if the dpi is wrong
01429     if (!m_bDpiSupported)
01430     {
01431         Dpi = GetOptions()->GetDPI();
01432         Valid = TRUE;
01433     }
01434     else
01435     {
01436         Dpi = (double)GetLongGadgetValue(_R(IDC_BMPOPTS_RES), 5, MAXDPI, NULL ,&Valid);
01437     }
01438     
01439     if ( Valid ) 
01440     {
01441         // This is the calculation that we are effectively doing
01442         // Use 0.5 so that we are forced to round up to the next pixel, if possible
01443         //PixelWidth = (INT32)(((Width * Dpi)/72000) + 0.5);
01444         //PixelHeight = (INT32)(((Height * Dpi)/72000) + 0.5);
01445         // but use the same code that the bitmap code will use so that we are consistent
01446         Matrix Identity;    // default construction is an identity matrix
01447         WinRect Rect = OSRenderRegion::BitmapDocRectToWin( Identity, ClipRect, Dpi );
01448         PixelWidth = Rect.Width();
01449         PixelHeight = Rect.Height();
01450 
01451         // More of a safety net here.
01452         if (PixelWidth < 0)
01453             PixelWidth = 0;
01454         if (PixelHeight < 0)
01455             PixelHeight = 0;
01456 
01457         RecalculatingPixels = TRUE;  // flag no updates to dpi field from RecalculateDpiFromX, Y
01458         
01459         SetLongGadgetValue(_R(IDC_BMPOPTS_XPIXELS), PixelWidth);
01460         SetLongGadgetValue(_R(IDC_BMPOPTS_YPIXELS), PixelHeight);
01461         
01462         RecalculatingPixels = FALSE;     // flag no updates to dpi field from RecalculateDpiFromX, Y
01463     }
01464     else
01465     {
01466         RecalculatingPixels = TRUE;  // flag no updates to dpi field from RecalculateDpiFromX, Y
01467 
01468         // There is a problem with the dpi so blank the pixel width/height fields 
01469         SetStringGadgetValue(_R(IDC_BMPOPTS_XPIXELS), &String_8(""));
01470         SetStringGadgetValue(_R(IDC_BMPOPTS_YPIXELS), &String_8(""));
01471 
01472         RecalculatingPixels = FALSE;     // flag no updates to dpi field from RecalculateDpiFromX, Y
01473     }
01474 }

void BmpPrefsDlg::RecalculateSize  )  [protected]
 

Calculates the size of the selection/spread/drawing and fills in the width and height fields accordingly. It then calculates the pixel size and/or dpi.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/3/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 1234 of file bmpprefs.cpp.

01235 {    
01236     // Get the state of the selection, drawing or spread buttons
01237     SelectionType FoundSelection = GetSelection();
01238 
01239     // Construct our spread/drawing/selection size rectangle
01240     ClipRect;
01241     ClipRect.MakeEmpty(); 
01242 
01243     if (FoundSelection == ABITMAP)
01244     {
01245         // Show only the PixelWidth of the bitmap, size in units is irrelevent
01246         BaseBitmapFilter::GetSizeOfBitmap(&PixelWidth, &PixelHeight);
01247 
01248         RecalculatingPixels = TRUE;  // flag no updates to dpi field from RecalculateDpiFromX, Y
01249         
01250         SetLongGadgetValue(_R(IDC_BMPOPTS_XPIXELS), PixelWidth);
01251         SetLongGadgetValue(_R(IDC_BMPOPTS_YPIXELS), PixelHeight);
01252 
01253         // WEBSTER - markn 5/2/97
01254         // Taken out the X & Y size gadgets
01255 #ifndef WEBSTER
01256         SetStringGadgetValue(_R(IDC_BMPOPTS_XSIZE), &String_8("-"));
01257         SetStringGadgetValue(_R(IDC_BMPOPTS_YSIZE), &String_8("-"));
01258         EnableGadget(_R(IDC_BMPOPTS_XSIZE), FALSE);
01259         EnableGadget(_R(IDC_BMPOPTS_YSIZE), FALSE);
01260 #endif // WEBSTER
01261         EnableGadget(_R(IDC_BMPOPTS_XPIXELS), FALSE);
01262         EnableGadget(_R(IDC_BMPOPTS_YPIXELS), FALSE);
01263 
01264         RecalculatingPixels = FALSE;     // flag no updates to dpi field from RecalculateDpiFromX, Y
01265 
01266         // We need a DPI to work with, so we'll just use the default pixel unit size
01267         DocUnitList* pDocUnitList = DocUnitList::GetCurrentDocUnitList();
01268         ERROR3IF(pDocUnitList == NULL, "BmpPrefsDlg::RecalculateSize() - no pDocUnitList!")
01269         Unit* pPixelUnit = pDocUnitList->FindUnit(PIXELS);
01270         ERROR3IF(pPixelUnit == NULL, "BmpPrefsDlg::RecalculateSize() - no pixel units!")
01271         Unit* pInchUnit = pDocUnitList->FindUnit(INCHES);
01272         ERROR3IF(pInchUnit == NULL, "BmpPrefsDlg::RecalculateSize() - no inch units!")
01273         double newDpi = (pPixelUnit->GetMillipoints()>0) ? pInchUnit->GetMillipoints() / pPixelUnit->GetMillipoints() : 96.0;
01274         Dpi = (INT32)newDpi;
01275         GetOptions()->SetDPI(newDpi);
01276     
01277         ClipRect.lo = DocCoord(0,0);
01278         ClipRect.hi = DocCoord(PixelWidth * (INT32)newDpi, PixelHeight * (INT32)newDpi);
01279 
01280         Width = ClipRect.Width();   
01281         Height = ClipRect.Height(); 
01282 
01283         // All work is now complete so exit
01284         return;
01285     }   
01286 
01287     if (FoundSelection == SOMEBITMAPS)
01288     {
01289         // Setup size of animation frames
01290         ClipRect.lo = DocCoord(0,0);
01291         ClipRect.hi = DocCoord(GetOptions()->GetOutputSize().x, GetOptions()->GetOutputSize().y);
01292     }   
01293 
01294     // Find the application and selected document 
01295     Application* pApplication = GetApplication();
01296     Document* pDocument = Document::GetSelected();
01297     Spread* pSpread = NULL;
01298 
01299     // As long as we have an application and a selected document then go and work out
01300     // the rectangles
01301     if (pApplication && pDocument && FoundSelection != ABITMAP  && FoundSelection != SOMEBITMAPS)
01302     {
01303         // First, check if there is a selection present. ClipRect should be empty if not.
01304         SelRange* pSelection = pApplication->FindSelection();
01305         if (pSelection)
01306         {
01307             // Get the bounding rectangle for the selection
01308             ClipRect = pSelection->GetBoundingRect();
01309 
01310             // Work out the parent spread by finding the first node in the selection
01311             Node* pNode = pSelection->FindFirst();
01312             // if there is a first node then just find the parent spread
01313             // otherwise just use the first spread in the document
01314             if (pNode)
01315                 pSpread = pNode->FindParentSpread();
01316             else
01317                 pSpread = pDocument->FindFirstSpread();
01318         }
01319 
01320         if (pSpread)
01321         {
01322             switch (FoundSelection)
01323             {
01324                 case ABITMAP:
01325                     ERROR3IF(TRUE, "BmpPrefsDlg::RecalculateSize() - This should have already been taken care of")
01326                     // This should have already been taken care of
01327                     break;
01328                 case SELECTION:
01329                     // This should have already been taken care of
01330                     break;
01331                 case SPREAD:
01332                 {
01333                     // Work out the size of the rectangle encompassing the spread,
01334                     // using the same function that the bitmap export code uses.
01335                     ERROR3("Selection == Spread!");
01336 
01337                     ClipRect = BaseBitmapFilter::GetSizeOfSpread(pSpread);
01338                     //break;
01339                 }
01340                 
01341                 default:
01342                 {
01343                     // Work out the size of the rectangle encompassing the drawing, (visible 
01344                     // layers only), using the same function that the bitmap export code
01345                     // uses.
01346                     ClipRect = BaseBitmapFilter::GetSizeOfDrawing(pSpread);
01347                     break;
01348                 }
01349             } // End switch
01350         }
01351     }
01352 
01353     // Graeme 25/7/00 - If our clip rectangle is less than the minimum export size,
01354     // resize the clipping rectangle to encompass the entire page.
01355     if ( ClipRect.IsEmpty() ||
01356          ClipRect.Width() < BaseBitmapFilter::MinExportSize ||
01357          ClipRect.Height() < BaseBitmapFilter::MinExportSize )
01358     {
01359         // Set the ClipRect to be the size of the spread.
01360         ClipRect = pSpread->FindFirstPageInSpread ()->GetPageRect ();
01361     }   
01362 
01363     // Work out the size of this rectangle encompassing the speread/drawing/selection
01364     // in Millipoints and store these in the class variables for later reuse
01365     Width = ClipRect.Width();   
01366     Height = ClipRect.Height(); 
01367 
01368     // Work out what the current units we should be displaying in
01369     DocUnitList* pDocUnitList = NULL;
01370     UnitType CurrentPageUnits = MILLIMETRES;
01371     if (pDocument)
01372     {
01373         pDocUnitList = pDocument->GetDocUnitList();
01374         if (pDocUnitList)
01375             CurrentPageUnits = pDocUnitList->GetPageUnits();
01376     }
01377     
01378     // WEBSTER - markn 5/2/97
01379     // Taken out the X & Y size gadgets
01380     #ifndef WEBSTER
01381     if (m_bDpiSupported)
01382     {
01383         SetUnitGadgetValue(_R(IDC_BMPOPTS_XSIZE), CurrentPageUnits, Width, FALSE, -1);
01384         SetUnitGadgetValue(_R(IDC_BMPOPTS_YSIZE), CurrentPageUnits, Height, FALSE, -1);
01385     }
01386     else
01387     {
01388         SetStringGadgetValue(_R(IDC_BMPOPTS_XSIZE), &String_8("-"));
01389         SetStringGadgetValue(_R(IDC_BMPOPTS_YSIZE), &String_8("-"));
01390     }
01391     #endif // WEBSTER
01392     
01393     // Work out what this size is in pixels and fill in the editable fields
01394     RecalculatePixels();
01395 }

BOOL BmpPrefsDlg::SetBmpPrefsDlgState  )  [protected]
 

This will be called When the "loop continuously" switch is turned off. It will grey/ungrey the "Loop" ed field.

Author:
Ranbir_Rana (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/01/97
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if successful, else FALSE.

Errors:

See also:
-

Definition at line 3008 of file bmpprefs.cpp.

03009 {
03010     BitmapExportOptions* pOptions = GetOptions();
03011     ERROR2IF(pOptions == NULL, FALSE, "pOptions is NULL");
03012     
03013     // The "loop continuously" switch is on.
03014     if (GetLoopCheckBox())
03015     {
03016         // Grey the Loop ed field.
03017         EnableGadget(_R(IDC_ANIMOPTS_ITERATIONS), FALSE);
03018     }
03019 
03020     // The "loop continuously" switch is off. 
03021     if (!GetLoopCheckBox())
03022     {
03023         GIFExportOptions* pGIFOptions = (GIFExportOptions*)pOptions;
03024         ERROR3IF(!pGIFOptions->IS_KIND_OF(GIFExportOptions), "pGIFOptions isn't");
03025 
03026         // Ungrey the Loop ed field.    
03027         EnableGadget(_R(IDC_ANIMOPTS_ITERATIONS), TRUE);
03028         SetLongGadgetValue(_R(IDC_ANIMOPTS_ITERATIONS), pGIFOptions->GetAnimationLoopCount());
03029     }
03030     return TRUE;
03031 }

void BmpPrefsDlg::SetBPPButtons CGadgetID  ButtonClicked,
BOOL  CheckNumColValueRange
[protected]
 

Sets all other radio buttons in the group off.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/08/94
Parameters:
the id of the clicked radio button [INPUTS] CheckNumColValueRange = TRUE if the value in the num col ed field should be checked. (added for WEBSTER - markn 1/2/97)
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 1661 of file bmpprefs.cpp.

01662 {    
01663     BitmapExportOptions* pOptions = GetOptions();
01664     if (pOptions == NULL)
01665     {
01666         ERROR3("pOptions == NULL");
01667         return;
01668     }
01669 
01670     // WEBSTER - markn 23/1/97
01671     SetLongGadgetValue(ButtonClicked, TRUE);
01672 
01673     BOOL EnablePalette = FALSE;
01674 
01675     // If either 8, 4 or 1 bpp clicked then enable the Palette and Dithering Options
01676     if ( ButtonClicked == _R(IDC_BMPOPTS_8BPP) || ButtonClicked == _R(IDC_BMPOPTS_4BPP)  || ButtonClicked == _R(IDC_BMPOPTS_1BPP))
01677         EnablePalette = TRUE;
01678 
01679     EnableGadget(_R(IDC_BMPOPTS_PAL_STD), EnablePalette);
01680     EnableGadget(_R(IDC_BMPOPTS_PAL_OPT), EnablePalette);
01681     EnableGadget(_R(IDC_BMPOPTS_NODITHER),  EnablePalette);
01682     EnableGadget(_R(IDC_BMPOPTS_DIFFUSION), EnablePalette);
01683 
01684     if (EnablePalette)
01685     {
01686         BOOL Valid = 0;
01687         if ( GetLongGadgetValue(_R(IDC_BMPOPTS_PAL_OPT), 0, 1, 0, &Valid) )
01688             EnableGadget(_R(IDC_BMPOPTS_ORDDITHER), FALSE);
01689         else
01690             EnableGadget(_R(IDC_BMPOPTS_ORDDITHER), TRUE);
01691     }
01692     else
01693         EnableGadget(_R(IDC_BMPOPTS_ORDDITHER), FALSE);
01694 
01695     // WEBSTER - markn 17/1/97
01696     // Only update for relevant filters
01697     if (pOptions->UseSpecificNumColsInPalette())
01698         UpdateNumColoursGroup(CheckNumColValueRange);   // New parameter - WEBSTER - markn 1/2/97
01699 
01700     if (pOptions->GetFilterType() == MAKE_BITMAP_FILTER)
01701     {
01702         // Disable transparency button in same circustances as
01703         // the palette buttons are disabled
01704         EnableGadget(_R(IDC_BMPOPTS_TRANSPARENT), EnablePalette);
01705 
01706         // If we're greying out the button, turn off the transparency flag too
01707         // so that we take no notice of it when it's grey
01708         if (!EnablePalette)
01709         {
01710             SetLongGadgetValue(_R(IDC_BMPOPTS_TRANSPARENT), 0);
01711         }
01712         else
01713         {
01714             MaskedFilterExportOptions* pMaskOptions = (MaskedFilterExportOptions*)pOptions;
01715             ERROR3IF(!pMaskOptions->IS_KIND_OF(MaskedFilterExportOptions), "pMaskOptions isn't");
01716 
01717             SetLongGadgetValue(_R(IDC_BMPOPTS_TRANSPARENT), pMaskOptions->WantTransparent());
01718         }
01719     }
01720 
01721     // Cope with the transparency button on a PNG options dialog box    
01722     if (pOptions->GetFilterType() == PNG) 
01723     {
01724         PNGExportOptions* pPNGOptions = (PNGExportOptions*)pOptions;
01725         ERROR3IF(!pPNGOptions->IS_KIND_OF(PNGExportOptions), "pPNGOptions isn't");
01726         // Now enable or disable the transparency if we are in the wrong bpp mode
01727         // Transparency only available in 8 bpp mode or less
01728         BOOL Enable = FALSE;
01729         if ( ButtonClicked == _R(IDC_BMPOPTS_8BPP) || ButtonClicked == _R(IDC_BMPOPTS_4BPP) ||
01730              ButtonClicked == _R(IDC_BMPOPTS_1BPP) )
01731             Enable = TRUE;
01732 
01733         // Enable should be True if 8bpp or 4bpp or 1bpp button is On and False if not 
01734         EnableGadget(_R(IDC_BMPOPTS_TRANSPARENT), Enable);
01735         if (!Enable)
01736         {
01737             SetLongGadgetValue(_R(IDC_BMPOPTS_TRANSPARENT), 0);
01738         }
01739         else
01740         {
01741             SetLongGadgetValue(_R(IDC_BMPOPTS_TRANSPARENT), pPNGOptions->WantTransparent());
01742         }
01743     }
01744 
01745     // WEBSTER - markn 23/1/97
01746     // Compression group always hidden in Webster
01747     #ifndef WEBSTER
01748     // Cope with the compression buttons on a BMP options dialog box    
01749     if (pOptions->GetFilterType() == BMP_UNCOMPRESSED) 
01750     {
01751         // Now enable or disable the switches that are dependent on the 8 bpp switch 
01752         // RLE compression switch, only available in 8 bpp mode or 4 bpp
01753         BOOL Enable = FALSE;
01754         if ( ButtonClicked == _R(IDC_BMPOPTS_8BPP) || ButtonClicked == _R(IDC_BMPOPTS_4BPP) )
01755             Enable = TRUE;
01756 
01757         // Enable should be True if 8bpp or 4bpp button is On and False if not 
01758         // Present only on the BMP export dialog box
01759         EnableGadget(_R(IDC_BMPOPTS_COMPRESS), Enable);     // main group icon
01760         EnableGadget(_R(IDC_BMPOPTS_RLE), Enable);
01761         EnableGadget(_R(IDC_BMPOPTS_RGB), Enable);
01762     }
01763     #endif // WEBSTER
01764 
01765     // Cope with the compression buttons on a TIFF options dialog box   
01766     // Enable should be True if 8bpp or 4bpp button is On and False if not 
01767     if (pOptions->GetFilterType() == TIFF_UNCOMPRESSED) 
01768     {
01769     //WEBSTER-Martin-06/01/97
01770 #ifndef WEBSTER
01771         TIFFExportOptions* pTIFFOptions = (TIFFExportOptions*)pOptions;
01772         ERROR3IF(!pTIFFOptions->IS_KIND_OF(TIFFExportOptions), "pTIFFOptions isn't");
01773     
01774         // Now enable or disable the compression options depending upon the BPP
01775         BOOL bEnableLZW = FALSE;
01776         BOOL bEnableMonoCompression = FALSE;
01777 
01778         if ( ButtonClicked == _R(IDC_BMPOPTS_1BPP))
01779             bEnableMonoCompression = TRUE;
01780 
01781         if ( ButtonClicked == _R(IDC_BMPOPTS_24BPP) || ButtonClicked == _R(IDC_BMPOPTS_8BPP) || ButtonClicked == _R(IDC_BMPOPTS_CMYK) )
01782             bEnableLZW = TRUE;
01783 
01784 
01785         // Cannot grey items in the list so we need to change the list itself.
01786         // But only change it if we need to. Check last state and see if we have changed.
01787         // from 1bpp or to 1bpp.
01788         if ( /*
01789             (LastBppSelected == _R(IDC_BMPOPTS_1BPP) && ButtonClicked != _R(IDC_BMPOPTS_1BPP)) ||
01790             (LastBppSelected != _R(IDC_BMPOPTS_1BPP) && ButtonClicked == _R(IDC_BMPOPTS_1BPP))
01791            */ TRUE )
01792         {
01793             // So, set up the list of available TIFF compressions. Must be the same as the list
01794             // in TiffTypes.
01795             //TiffTypes CompressionType = (TiffTypes)GetSelectedValueIndex(_R(IDC_BMPOPTS_TIFF));
01796             
01797             // Andy Hills, 05-09-00
01798             // We can't use TiffTypes to determine the selection.
01799             // This is because the list of compression types changes between bpp settings.
01800             // Instead we will call the new function GetTIFFCompressionSelection
01801             // which works out which compression type is selected.
01802             // We need to tell it which bpp is selected.
01803 
01804             INT32 nBPP;
01805             switch( ButtonClicked )
01806             {
01807             case _R(IDC_BMPOPTS_1BPP):  nBPP=1;     break;
01808             case _R(IDC_BMPOPTS_4BPP):  nBPP=4;     break;
01809             case _R(IDC_BMPOPTS_8BPP):  nBPP=8;     break;
01810             case _R(IDC_BMPOPTS_24BPP): nBPP=24;    break;
01811             case _R(IDC_BMPOPTS_CMYK):  nBPP=32;    break;
01812             default:
01813                 ERROR3( "BmpPrefsDlg::SetBPPButtons - invalid bpp obtained" );
01814             }
01815             
01816             INT32 CompressionType = GetTIFFCompressionSelection(nBPP);
01817 
01818             // First delete all present items
01819             DeleteAllValues(_R(IDC_BMPOPTS_TIFF));
01820             // Set up the default value in the editable field
01821             BOOL ok = SetLongGadgetValue(_R(IDC_BMPOPTS_TIFF), pTIFFOptions->GetCompression(), FALSE, -1);
01822 
01823             // Set all the basic options (i.e. no compression)
01824             SetStringGadgetValue(_R(IDC_BMPOPTS_TIFF), &String_32(_R(IDN_TIFF_NONE)));
01825 
01826             // Andy Hills, 16-08-00: re-added LZW export
01827             if (bEnableLZW)
01828             {
01829                 // 8 / 24-bit, so enable LZW
01830                 SetStringGadgetValue(_R(IDC_BMPOPTS_TIFF), &String_32(_R(IDN_TIFF_LZW)));
01831             }
01832 
01833             if (bEnableMonoCompression)
01834             {
01835                 // 1bpp so allow all options (except LZW)
01836                 SetStringGadgetValue(_R(IDC_BMPOPTS_TIFF), &String_32(_R(IDN_TIFF_HUFFMAN)));
01837                 SetStringGadgetValue(_R(IDC_BMPOPTS_TIFF), &String_32(_R(IDN_TIFF_G3FAX)));
01838                 SetStringGadgetValue(_R(IDC_BMPOPTS_TIFF), &String_32(_R(IDN_TIFF_G4FAX)));
01839                 SetStringGadgetValue(_R(IDC_BMPOPTS_TIFF), &String_32(_R(IDN_TIFF_PACKBITS)));
01840                 //SetStringGadgetValue(_R(IDC_BMPOPTS_TIFF), &String_32(_R(IDN_TIFF_2DENCODING)));
01841             }
01842 
01843             SetComboListLength(_R(IDC_BMPOPTS_TIFF));
01844 
01845             // Select the correct item again
01846 
01847             if( nBPP == 1 && LastBppSelected != _R(IDC_BMPOPTS_1BPP) && LastBppSelected )
01848             {
01849                 // changing to 1bpp
01850                 // --> set compression to NONE
01851                 ok = SetTIFFCompressionSelection( TIFF_UNCOMPRESSED, nBPP );
01852                 
01853                 // We should ALWAYS be able to select UNCOMPRESSED
01854                 ERROR3IF( (!ok), "BmpPrefsDlg::SetBPPButtons - could not select uncompressed" );
01855             }
01856             else if( nBPP >= 8 && 
01857                 (LastBppSelected == _R(IDC_BMPOPTS_1BPP) || LastBppSelected == _R(IDC_BMPOPTS_4BPP)) )
01858             {
01859                 // changing to 8/24bpp (from 1/4bpp)
01860                 // --> set compression to LZW
01861                 ok = SetTIFFCompressionSelection( TIFF_LZW, nBPP );
01862                 
01863                 // We should ALWAYS be able to select LZW from 8/24 bpp
01864                 ERROR3IF( (!ok), "BmpPrefsDlg::SetBPPButtons - could not select LZW" );
01865             }
01866             else
01867             {
01868                 // otherwise, just leave compression as it is
01869                 ok = SetTIFFCompressionSelection( CompressionType, nBPP );
01870                 
01871                 // if the previously selected compression is now disabled, select NONE
01872                 if( ! ok )
01873                 {
01874                     //SetSelectedValueIndex(_R(IDC_BMPOPTS_TIFF), _R(IDN_TIFF_NONE));
01875                     ok = SetTIFFCompressionSelection( TIFF_UNCOMPRESSED, nBPP );
01876                     
01877                     // We should ALWAYS be able to select UNCOMPRESSED
01878                     ERROR3IF( (!ok), "BmpPrefsDlg::SetBPPButtons - could not select uncompressed" );
01879                 }
01880             }
01881         }
01882     
01883         // Update the last button to be the one just selected
01884         LastBppSelected = ButtonClicked;
01885 #endif //WEBSTER
01886     }
01887 }

void BmpPrefsDlg::SetDitherButtons CGadgetID  ButtonClicked  )  [protected]
 

Sets all other radio buttons in the group off.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/05/96
Parameters:
the id of the clicked radio button [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 1949 of file bmpprefs.cpp.

01950 {    
01951 }

void BmpPrefsDlg::SetLoopCheckBox BOOL  Value  )  [inline, protected]
 

Definition at line 571 of file bmpprefs.h.

00571 { LoopCheckBoxEnabled = Value;  }   // Selector function

BOOL BmpPrefsDlg::SetNumColoursInPalette BitmapExportOptions pOptions  )  [protected]
 

Extracts the number of colours in palette & the system colours switch data from the relevant gadgets, and stuffs the data in pOptions.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/1/97
Parameters:
pOptions = ptr to the export options to use [INPUTS]
Returns:
-
Introduced in WEBSTER

Definition at line 3823 of file bmpprefs.cpp.

03824 {
03825     // Don't bother unless the user wants an optimised palette
03826     if (!GetBoolGadgetSelected(_R(IDC_BMPOPTS_PAL_OPT)))
03827         return TRUE;
03828 
03829     // Only do this for filters that support this feature
03830     if (pOptions != NULL && pOptions->UseSpecificNumColsInPalette())
03831     {
03832         // Set the default values for an 8bpp bitmap
03833         UINT32 MaxNumCols = 256;
03834         UINT32 MinNumCols = 2;
03835         BOOL SystemColours = GetBoolGadgetSelected(_R(IDC_BMPOPTS_NUMCOLS_SYSCOLS));
03836         UINT32 Depth = pOptions->GetDepth();
03837         BOOL Valid;
03838 
03839         // 4bpp has a max num colours of 16, and can't include the system colours
03840         if (Depth == 4)
03841         {
03842             MaxNumCols = 16;
03843             SystemColours = FALSE;
03844         }
03845 
03846         // If we are adding system colours, then the smallest number the user can enter is 0
03847         if (SystemColours)
03848             MinNumCols = 0;
03849 
03850         UINT32 NumCols = GetLongGadgetValue(_R(IDC_BMPOPTS_NUMCOLS_EDIT), MinNumCols, MaxNumCols, 0, &Valid);
03851 
03852         if (!Valid)
03853         {
03854             // Only report an err message in 8bpp & 4bpp modes
03855             if ((Depth == 8) || (Depth == 4))
03856             {
03857                 String_256 ErrMsg;
03858                 ErrMsg.MakeMsg(_R(IDS_BMPPREFS_NUMCOLSWRONG),MinNumCols,MaxNumCols);
03859                 Error::SetError(0,ErrMsg,0);
03860                 InformError();
03861                 return FALSE;
03862             }
03863             NumCols = MaxNumCols;
03864         }
03865 
03866         // If the user wants to add the system colours, then we need to increase the number of 
03867         // total colours to create
03868 
03869         // The number of sys colours is either NUM_SYS_COLS, or 0 if the switch is off
03870         UINT32 NumSysCols = NUM_SYS_COLS;
03871         if (!SystemColours)
03872             NumSysCols = 0;
03873 
03874         NumCols += NumSysCols;
03875         if (NumCols > MaxNumCols)
03876             NumCols = MaxNumCols;
03877 
03878         // Are we to include a transparent colour?
03879         UINT32 NumTransparentCols = 0;
03880         if (GetBoolGadgetSelected(_R(IDC_BMPOPTS_TRANSPARENT)))
03881             NumTransparentCols = 1;
03882 
03883         // Can we reduce the number of bpp automatically?
03884         // Do it only for optimised palettes
03885         if (Depth == 8)
03886         {
03887             // If the total number of colours is 16 or less, choose 4bpp
03888             if (NumCols <= (16-NumTransparentCols))
03889                 GetOptions()->SetDepth(4);
03890 
03891             // If the total number of colours is 2 or less, choose 1bpp
03892             if (NumCols <= (2-NumTransparentCols))
03893                 GetOptions()->SetDepth(1);
03894         }
03895 
03896         pOptions->SetNumColsInPalette(NumCols);
03897         pOptions->SetUseSystemColours(SystemColours);
03898     }
03899 
03900     return TRUE;
03901 }

void BmpPrefsDlg::SetPaletteButtons CGadgetID  ButtonClicked  )  [protected]
 

Sets all other radio buttons in the group off.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/05/96
Parameters:
the id of the clicked radio button [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 1904 of file bmpprefs.cpp.

01905 {    
01906     if ( ButtonClicked == _R(IDC_BMPOPTS_PAL_OPT) )
01907     {
01908         BOOL Valid = 0;
01909         if ( GetLongGadgetValue(_R(IDC_BMPOPTS_ORDDITHER), 0, 1, 0, &Valid) )
01910         {
01911             SetLongGadgetValue(_R(IDC_BMPOPTS_ORDDITHER), FALSE);
01912             SetLongGadgetValue(_R(IDC_BMPOPTS_DIFFUSION), TRUE);
01913         }
01914 
01915         SetLongGadgetValue(_R(IDC_BMPOPTS_PAL_OPT), TRUE);
01916         
01917         EnableGadget(_R(IDC_BMPOPTS_ORDDITHER), FALSE);
01918 
01919         // WEBSTER - markn 17/1/97
01920         // Update num colours group
01921         UpdateNumColoursGroup(FALSE);
01922     }
01923     else
01924     {
01925         SetLongGadgetValue(_R(IDC_BMPOPTS_PAL_STD), TRUE);
01926             
01927         EnableGadget(_R(IDC_BMPOPTS_ORDDITHER), TRUE);
01928 
01929         // WEBSTER - markn 17/1/97
01930         UpdateNumColoursGroup(FALSE);
01931     }
01932 }

BOOL BmpPrefsDlg::SetTIFFCompressionSelection TIFF_COMPRESSION  Compression,
INT32  nBPP
[protected]
 

This function has been added because no allowances have been made for the fact that the compression options list is different for each BPP setting.

Author:
Andy_Hills (Xara Group Ltd) <camelotdev@xara.com>
Date:
05/09/00
Parameters:
Compression Desired compression setting [INPUTS] nBPP Currently selected bits-per-pixel
[OUTPUTS] 
Returns:
TRUE on success

Errors: Returns FALSE on failure e.g. if the specified compression type is not available with the current bpp setting.

See also:
SetBPPButtons

Definition at line 2032 of file bmpprefs.cpp.

02033 {
02034     if( nBPP == 1 )
02035     {
02036         if
02037         (
02038             Compression != TIFF_2D &&
02039             Compression != TIFF_PACK &&
02040             Compression != TIFF_HUFFMAN &&
02041             Compression != TIFF_G3_FAX &&
02042             Compression != TIFF_G4_FAX &&
02043             Compression != TIFF_UNCOMPRESSED
02044         ) return FALSE;
02045     }
02046     else if( nBPP==8 || nBPP==24 || nBPP==32 )
02047     {
02048         if
02049         (
02050             Compression != TIFF_LZW &&
02051             Compression != TIFF_UNCOMPRESSED
02052         ) return FALSE;
02053     }
02054     else if( nBPP == 4 )
02055     {
02056         if
02057         (
02058             Compression != TIFF_UNCOMPRESSED
02059         ) return FALSE;
02060     }
02061     else
02062     {
02063         ERROR2( -1, "BmpPrefsDlg::GetTIFFCompressionSelection - invalid nBPP" );
02064     }
02065     
02066     // look up the index of the compression type
02067     INT32 nIndex;
02068     switch ( Compression )
02069     {
02070         case TIFF_UNCOMPRESSED: nIndex = UNCOMPRESSED_TIFF; break;
02071         case TIFF_LZW:          nIndex = LZW_TIFF;          break;
02072         case TIFF_HUFFMAN:      nIndex = HUFFMAN_TIFF;      break;
02073         case TIFF_G3_FAX:       nIndex = G3FAX_TIFF;        break;
02074         case TIFF_G4_FAX:       nIndex = G4FAX_TIFF;        break;
02075         case TIFF_PACK:         nIndex = PACKBITS_TIFF;     break;
02076         case TIFF_2D:           nIndex = TWODENCODING_TIFF; break;
02077         default:                nIndex = UNCOMPRESSED_TIFF; break;
02078     }
02079 
02080     // Actually select the compression type.
02081     return SetSelectedValueIndex(_R(IDC_BMPOPTS_TIFF), nIndex);
02082 }

BOOL BmpPrefsDlg::SetUpResolutionList  )  [protected]
 

Sets up the initial values in the resolution/dpi combo box.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/03/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if successful, else FALSE

Errors: -

See also:
-

Definition at line 2968 of file bmpprefs.cpp.

02969 {
02970     if (!m_bDpiSupported)
02971     {
02972         SetStringGadgetValue(_R(IDC_BMPOPTS_RES), &String_8(" -"), FALSE, -1);
02973         return TRUE;
02974     }
02975 
02976     // First, set up the resolution combo box
02977     // Set up the default value in the editable field
02978     SetLongGadgetValue(_R(IDC_BMPOPTS_RES), (INT32)GetOptions()->GetDPI(), FALSE, -1);
02979     // Set up the list
02980     SetLongGadgetValue(_R(IDC_BMPOPTS_RES), 50);
02981     SetLongGadgetValue(_R(IDC_BMPOPTS_RES), 75);
02982     SetLongGadgetValue(_R(IDC_BMPOPTS_RES), 96);
02983     SetLongGadgetValue(_R(IDC_BMPOPTS_RES), 100);
02984     SetLongGadgetValue(_R(IDC_BMPOPTS_RES), 150);
02985     SetLongGadgetValue(_R(IDC_BMPOPTS_RES), 200);
02986     SetLongGadgetValue(_R(IDC_BMPOPTS_RES), 250);
02987     SetLongGadgetValue(_R(IDC_BMPOPTS_RES), 300);
02988     SetComboListLength(_R(IDC_BMPOPTS_RES));
02989     
02990     return TRUE;
02991 }   

void BmpPrefsDlg::UpdateNumColoursGroup BOOL  CheckValueRange  )  [protected]
 

Enables/disables the "number of colour in palette" group in the bitmap export dlg.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/1/97
Parameters:
CheckNumColValueRange = TRUE if the value in the num col ed field should be range checked. [INPUTS]
Returns:
-
It also makes sure that the number in the ed field is in range

Introduced in WEBSTER

Definition at line 3771 of file bmpprefs.cpp.

03772 {
03773     BOOL OptPal = GetBoolGadgetSelected(_R(IDC_BMPOPTS_PAL_OPT));
03774     BOOL Bpp8   = GetBoolGadgetSelected(_R(IDC_BMPOPTS_8BPP));
03775     BOOL Bpp4   = GetBoolGadgetSelected(_R(IDC_BMPOPTS_4BPP));
03776 
03777     EnableGadget(_R(IDC_BMPOPTS_NUMCOLS_EDIT)    ,OptPal && (Bpp8 || Bpp4));
03778     EnableGadget(_R(IDC_BMPOPTS_NUMCOLS_EDITTEXT),OptPal && (Bpp8 || Bpp4));
03779     EnableGadget(_R(IDC_BMPOPTS_NUMCOLS_SYSCOLS) ,OptPal && Bpp8);          // 8 bpp only
03780     EnableGadget(_R(IDC_BMPOPTS_NUMCOLS_GROUP)   ,TRUE);                    // Always show group
03781 
03782     // Check that the value in the ed string is not out of range
03783     if ((Bpp8 || Bpp4))
03784     {
03785         BOOL SystemColours = (Bpp8 && GetBoolGadgetSelected(_R(IDC_BMPOPTS_NUMCOLS_SYSCOLS)));
03786         UINT32 Max = 256;
03787         UINT32 Min = 2;
03788         if (Bpp4)
03789             Max = 16;
03790 
03791         // If we are adding system colours, then the smallest number the user can enter is 0
03792         if (SystemColours)
03793             Min = 0;
03794 
03795         // Slight bodge fix here - changed so that every time the user changes the bpp, it resets
03796         // the number of colours to the max colours available
03797         // Comment this line out if you don't want this functionality
03798         if (CheckValueRange)
03799             Min = Max;
03800 
03801         UINT32 NumCols = GetLongGadgetValue(_R(IDC_BMPOPTS_NUMCOLS_EDIT), Min, Max);
03802         if (NumCols > Max)  NumCols = Max;
03803         if (NumCols < Min)  NumCols = Min;
03804         SetLongGadgetValue(_R(IDC_BMPOPTS_NUMCOLS_EDIT),NumCols);
03805     }
03806 }


Member Data Documentation

DocRect BmpPrefsDlg::ClipRect [protected]
 

Definition at line 585 of file bmpprefs.h.

BOOL BmpPrefsDlg::DisplayMany [protected]
 

Definition at line 594 of file bmpprefs.h.

double BmpPrefsDlg::Dpi [protected]
 

Definition at line 584 of file bmpprefs.h.

BOOL BmpPrefsDlg::HasDelayChanged [protected]
 

Definition at line 591 of file bmpprefs.h.

BOOL BmpPrefsDlg::HasRestoreChanged [protected]
 

Definition at line 592 of file bmpprefs.h.

MILLIPOINT BmpPrefsDlg::Height [protected]
 

Definition at line 581 of file bmpprefs.h.

CDlgResID BmpPrefsDlg::IDD [static]
 

Definition at line 529 of file bmpprefs.h.

BOOL BmpPrefsDlg::IsDelayDefault [protected]
 

Definition at line 590 of file bmpprefs.h.

BOOL BmpPrefsDlg::IsDelayMany [protected]
 

Definition at line 589 of file bmpprefs.h.

BOOL BmpPrefsDlg::IsManyDisplayed [protected]
 

Definition at line 593 of file bmpprefs.h.

CGadgetID BmpPrefsDlg::LastBppSelected [protected]
 

Definition at line 576 of file bmpprefs.h.

BOOL BmpPrefsDlg::LoopCheckBoxEnabled [protected]
 

Definition at line 595 of file bmpprefs.h.

BOOL BmpPrefsDlg::m_bDpiSupported [protected]
 

Definition at line 587 of file bmpprefs.h.

BOOL BmpPrefsDlg::m_bLockAspect [protected]
 

Definition at line 588 of file bmpprefs.h.

BitmapExportOptions* BmpPrefsDlg::m_pOptions [private]
 

Definition at line 598 of file bmpprefs.h.

const CDlgMode BmpPrefsDlg::Mode [static]
 

Definition at line 530 of file bmpprefs.h.

INT32 BmpPrefsDlg::PixelHeight [protected]
 

Definition at line 583 of file bmpprefs.h.

INT32 BmpPrefsDlg::PixelWidth [protected]
 

Definition at line 582 of file bmpprefs.h.

BOOL BmpPrefsDlg::RecalculatingPixels [private]
 

Definition at line 602 of file bmpprefs.h.

BOOL BmpPrefsDlg::RecalculatingXDpi [private]
 

Definition at line 603 of file bmpprefs.h.

BOOL BmpPrefsDlg::RecalculatingYDpi [private]
 

Definition at line 604 of file bmpprefs.h.

MILLIPOINT BmpPrefsDlg::Width [protected]
 

Definition at line 580 of file bmpprefs.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 03:51:35 2007 for Camelot by  doxygen 1.4.4