#include <bmpprefs.h>
Inheritance diagram for BmpPrefsDlg:

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. | |
| BitmapExportOptions * | GetOptions () 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 | |
| BitmapExportOptions * | m_pOptions |
| BOOL | RecalculatingPixels |
| BOOL | RecalculatingXDpi |
| BOOL | RecalculatingYDpi |
Definition at line 515 of file bmpprefs.h.
|
|
Definition at line 543 of file bmpprefs.h. |
|
|
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; /*!
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 }
|
|
|
Takes the values in the dialog box and sets the return values accordingly Called when ok is pressed on the dialog box.
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 }
|
|
|
BmpPrefsDlg create method.
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 }
|
|
|
Creates then opens the dialog in response to a request from the user.
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 }
|
|
||||||||||||
|
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.
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 }
|
|
|
|
|
|
Definition at line 572 of file bmpprefs.h. 00572 { return LoopCheckBoxEnabled; } // Selector function
|
|
|
Helper function.
Definition at line 4063 of file bmpprefs.cpp. 04064 { 04065 return m_pOptions; 04066 }
|
|
|
Works out what the current selection/spread/drawing state is.
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 }
|
|
||||||||||||
|
BmpPrefsDlg GetState method.
Definition at line 2748 of file bmpprefs.cpp. 02749 { 02750 OpState OpSt; 02751 return(OpSt); 02752 }
|
|
|
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.
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 }
|
|
|
Hides the "number of colour in palette" group in the bitmap export dlg.
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 }
|
|
|
BmpPrefsDlg Init method.
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 }
|
|
|
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 }
|
|
|
Sets initial dialog values.
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 = |