JPEGExportPrefsDialog Class Reference

Provides a dialog asking for user options in the JPEG export. More...

#include <bmpprefs.h>

Inheritance diagram for JPEGExportPrefsDialog:

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

Public Member Functions

 JPEGExportPrefsDialog ()
 JPEGExportPrefsDialog constructor.
void SetJPEGDlgState ()
 This will be called to set JPEG dlg controls if the user decides not to export using the the Origianl JPEG image.
BOOL GetOriginalSourcePresent () const
void SetOriginalSourcePresent (BOOL Value)

Protected Member Functions

virtual BOOL InitDialog ()
 Sets initial dialog values.
virtual MsgResult Message (Msg *Message)
 Handles JPEG dialog specific 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.

Protected Attributes

BOOL m_OriginalSourcePresent

Detailed Description

Provides a dialog asking for user options in the JPEG export.

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
02/11/96

Definition at line 706 of file bmpprefs.h.


Constructor & Destructor Documentation

JPEGExportPrefsDialog::JPEGExportPrefsDialog  ) 
 

JPEGExportPrefsDialog constructor.

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/11/96

Definition at line 4468 of file bmpprefs.cpp.

04468                                             : BmpPrefsDlg() 
04469 {
04470     m_OriginalSourcePresent = FALSE;
04471 }


Member Function Documentation

BOOL JPEGExportPrefsDialog::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:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com> (from Neville)
Date:
03/10/94
Parameters:
pointer to the options to commit [INPUTS]
- [OUTPUTS]
Returns:
True if values in dialog box ok, False otherwise.

Errors: -

See also:
BmpPrefsDlg::CommitDialogValues;

Reimplemented from BmpPrefsDlg.

Definition at line 4763 of file bmpprefs.cpp.

04764 {
04765     JPEGExportOptions* pOptions = (JPEGExportOptions*)GetOptions();
04766     ERROR3IF(pOptions == NULL, "JPEGExportPrefsDialog::CommitDialogValues called after duff initialisation?!");
04767 
04768     //Added by Graham 27/5/97
04769     //First, let's set the pixel width and height into our OutputSize option
04770     pOptions->SetPixelOutputSize(PixelWidth, PixelHeight);
04771 
04772     // We only want new values, if the "Use Origianl JPEG image" switvh is OFF.
04773     if (!pOptions->GetJPEGPresentAndSelected())
04774     {
04775         // Ok has been pressed so take the values and set up the static values so that the
04776         // caller can access them
04777 
04778         BOOL Valid = 0; // Flag for validity of value
04779         BOOL State = 0; // Flag for reading the state of gadgets
04780 
04781         // Get the dpi value from the resolution combo box 
04782         // Minimum of 5dpi as anything lower causes major problems.  
04783         INT32 Value = GetLongGadgetValue(_R(IDC_BMPOPTS_RES), 5, MAXDPI, _R(IDS_BMPPREFS_INVALIDDPI) ,&Valid);
04784         if ( Valid) 
04785         {
04786             // If returned value in range then set the new default
04787             pOptions->SetDPI(Value);
04788         }
04789         else
04790             return FALSE; 
04791 
04792         // Check that we have not gone over our GDraw limit for pixel width
04793         // Pixel height should not be so much of a problem as we will strip the export. 
04794         RecalculatePixels();
04795         if ((DWORD) PixelWidth > GRenderRegion::GetMaxBitmapWidth() ||
04796             (DWORD) PixelWidth < 1 || (DWORD) PixelHeight < 1 )
04797         {
04798             // There is a problem so warn the user that the value is incorrect
04799             String_256 WarnMsg;
04800 
04801             WarnMsg.MakeMsg(_R(IDE_BMP_BADPIXELWIDTH), GRenderRegion::GetMaxBitmapWidth());
04802             Error::SetError(0, WarnMsg, 0);
04803             InformWarning(0, _R(IDS_OK));
04804             return FALSE; 
04805         }
04806 
04807         // Get quality slider value
04808         State = GetLongGadgetValue(_R(IDC_BMPOPTS_QUALITY), 0, 100, 0, &Valid);
04809         if (Valid)
04810         {
04811             // Return compression to caller
04812             pOptions->SetQuality(100 - State);
04813         }
04814             
04815         // Work out what is currently selected
04816         SelectionType FoundSelection = GetSelection();
04817         pOptions->SetSelectionType(FoundSelection);
04818 
04819         // Get whether a progressive file is wanted or not
04820         State = GetBoolGadgetSelected(_R(IDC_JPGOPTS_PROGRESSIVE), 0, &Valid);
04821         if (Valid)
04822         {
04823             pOptions->SetMakeProgressive(State);
04824         }
04825     }
04826         return TRUE;
04827 }

BOOL JPEGExportPrefsDialog::GetOriginalSourcePresent  )  const [inline]
 

Definition at line 713 of file bmpprefs.h.

00713 { return m_OriginalSourcePresent;  } 

BOOL JPEGExportPrefsDialog::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 BmpPrefs [INPUTS]
[OUTPUTS] 
Returns:
TRUE if successful, else FALSE

Errors: -

See also:
-

Reimplemented from BmpPrefsDlg.

Definition at line 4488 of file bmpprefs.cpp.

04489 {
04490     JPEGExportOptions* pOptions = (JPEGExportOptions*)GetOptions();
04491     ERROR2IF(pOptions == NULL,FALSE, "BmpPrefsDlg::InitJPEGDialog called after duff initialisation?!");
04492 
04493     // Set up the title of the dialog box according to the passed in string which
04494     // is the name of the filter plus export bitmap options.
04495     String_256 Temp = *(pOptions->GetFilterName());
04496     Temp += String_256(_R(IDN_EXPORTBMPOPTS));
04497 
04498     SetTitlebarName(&Temp); 
04499 
04500     // Is this already a compressed JPEG? 
04501     
04502     pOptions->SetJPEGPresentAndSelected(FALSE);
04503 
04504     KernelBitmap* pKernelBitmap = pOptions->GetKernelBitmap();
04505 
04506     if (pKernelBitmap != NULL)
04507     {
04508         BitmapSource* pSource = NULL;
04509         BaseBitmapFilter* pDummyFilter;
04510 
04511         pOptions->SetJPEGPresentAndSelected(pKernelBitmap->GetOriginalSource(&pSource, &pDummyFilter));
04512     }
04513 
04514     if (pOptions->GetJPEGPresentAndSelected())
04515     {
04516         SetBoolGadgetSelected(_R(IDC_JPEG_ORIGINAL), TRUE);
04517 
04518         // Disable the other gadgets/
04519 //      EnableGadget(_R(IDC_BMPOPTS_SPREAD), FALSE);
04520         EnableGadget(_R(IDC_BMPOPTS_DRAWING), FALSE);
04521         EnableGadget(_R(IDC_BMPOPTS_SELECT), FALSE);
04522         EnableGadget(_R(IDC_JPGOPTS_PROGRESSIVE), FALSE);
04523 
04524         // Set the range of the slider control plus a step value of 1
04525         SetGadgetRange(_R(IDC_BMPOPTS_QUALITY), 0, 100, 1);
04526         SetGadgetBitmaps(_R(IDC_BMPOPTS_QUALITY), _R(IDB_SLIDERBASE), _R(IDB_SLIDERSLIDER));
04527         SetLongGadgetValue(_R(IDC_BMPOPTS_QUALITY), 0);
04528         EnableGadget(_R(IDC_BMPOPTS_QUALITY), FALSE);
04529 
04530         EnableGadget(_R(IDC_BMPOPTS_RES), FALSE);
04531         EnableGadget(_R(IDC_BMPOPTS_XPIXELS), FALSE);
04532         EnableGadget(_R(IDC_BMPOPTS_YPIXELS), FALSE);
04533         // WEBSTER - markn 5/2/97
04534         // Taken out the X & Y size gadgets
04535 #ifndef WEBSTER
04536         SetStringGadgetValue(_R(IDC_BMPOPTS_XSIZE), &String_8("-"));
04537         SetStringGadgetValue(_R(IDC_BMPOPTS_YSIZE), &String_8("-"));
04538         EnableGadget(_R(IDC_BMPOPTS_XSIZE), FALSE);
04539         EnableGadget(_R(IDC_BMPOPTS_YSIZE), FALSE);
04540 #endif // WEBSTER
04541         EnableGadget(_R(IDC_BMPOPTS_PERCENT), FALSE);
04542     }
04543     else
04544     {
04545         // Disable the "Use Original Source" control.
04546         EnableGadget(_R(IDC_JPEG_ORIGINAL), FALSE);
04547 
04548         // Flag that DPI is supported by JPEGs
04549         m_bDpiSupported = TRUE;
04550 
04551         // First, set up the resolution combo box
04552         SetUpResolutionList();
04553     
04554         // Set up the quality slider and percentage display
04555         INT32 Quality = pOptions->GetQuality(); // Default Quality
04556         // Check that value is not bigger than maximum allowed
04557         if (Quality > 100)
04558             Quality = 100;
04559 
04560         // Set the range of the slider control plus a step value of 1
04561         SetGadgetRange(_R(IDC_BMPOPTS_QUALITY), 0, 100, 1);
04562         SetGadgetBitmaps(_R(IDC_BMPOPTS_QUALITY), _R(IDB_SLIDERBASE), _R(IDB_SLIDERSLIDER));
04563         SetLongGadgetValue(_R(IDC_BMPOPTS_QUALITY), 100 - Quality);
04564         SetBoolGadgetSelected(_R(IDC_JPGOPTS_PROGRESSIVE), pOptions->DoAsProgressive());
04565     
04566         // Set the percentage string
04567         TCHAR Str[32];
04568         String_32 jcf(_R(IDS_PERCENT_FORMAT));
04569         camSprintf(Str, jcf, Quality);
04570         String_32 PercentStr(Str);
04571         SetStringGadgetValue(_R(IDC_BMPOPTS_PERCENT), &PercentStr);
04572 
04573         InitSelectionRadioGroup();
04574     
04575         // Make sure that size fields are displaying the values correctly
04576         RecalculateSize();
04577     }
04578 
04579         return TRUE;
04580 }

MsgResult JPEGExportPrefsDialog::Message Msg pMessage  )  [protected, virtual]
 

Handles JPEG dialog specific messages.

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/11/96
Parameters:
See DialogOp for interface details [INPUTS]

Reimplemented from BmpPrefsDlg.

Definition at line 4676 of file bmpprefs.cpp.

04677 {
04678     ERROR3IF(GetOptions() == NULL, "BmpPrefsDlg::Message - GetOptions() NULL");
04679 
04680     if (IS_OUR_DIALOG_MSG(pMessage))
04681     {
04682         DialogMsg* pMsg = (DialogMsg*)pMessage;
04683         ERROR3IF(!pMsg->IS_KIND_OF(DialogMsg), "pMsg isn't");
04684 
04685         // Should now handle the required messages that we respond to
04686         switch (pMsg->DlgMsg)
04687         {
04688             case DIM_SLIDER_POS_CHANGING:
04689                 // special message for the JPEG qualty control
04690                 // Messages to all the controls, handled individually
04691                 switch (pMsg->GadgetID)
04692                 {
04693                     case _R(IDC_BMPOPTS_QUALITY):
04694                     {
04695                         // Find the current quality scroller's position
04696                         TCHAR Str[32];
04697                         BOOL Valid;
04698                         INT32 Result = GetLongGadgetValue(_R(IDC_BMPOPTS_QUALITY), 0, 100, 0, &Valid);
04699                         Result = 100 - Result;
04700 
04701                         // Build the Percentage string and set it
04702                         String_32 jcf(_R(IDS_PERCENT_FORMAT));
04703                         wsprintf(Str, jcf, (INT32) Result);
04704                         String_32 PercentStr(Str);
04705                         SetStringGadgetValue(_R(IDC_BMPOPTS_PERCENT), &PercentStr);
04706                     }
04707                     break;
04708                 }
04709             break; // DIM_SLIDER_POS_CHANGING       
04710             
04711             case DIM_LFT_BN_CLICKED:
04712                 {
04713                     switch (pMsg->GadgetID)
04714                     {
04715                         case _R(IDC_JPEG_ORIGINAL):
04716                         {
04717                             BOOL Value = GetBoolGadgetSelected(_R(IDC_JPEG_ORIGINAL));
04718                             if (Value)
04719                             {
04720                                 JPEGExportOptions::SetJPEGPresentAndSelected(TRUE);
04721                                 SetJPEGDlgState();
04722                             }
04723                             else
04724                             {
04725                                 JPEGExportOptions::SetJPEGPresentAndSelected(FALSE);
04726                                 SetJPEGDlgState();
04727                             }
04728                         }
04729                         break;
04730                     }
04731                     break;
04732                 }
04733                 break; //DIM_LFT_BN_CLICKED
04734 
04735                 case DIM_CANCEL:
04736                 {
04737                     // The Export has been cancelled, 
04738                     // set our KernelBitmap pointer to NULL.
04739                     JPEGExportOptions::SetKernelBitmap(NULL);
04740                 }
04741                 break;  // DIM_CANCEL
04742         }
04743     }
04744     return BmpPrefsDlg::Message(pMessage);
04745 }

void JPEGExportPrefsDialog::SetJPEGDlgState  ) 
 

This will be called to set JPEG dlg controls if the user decides not to export using the the Origianl JPEG image.

Author:
Ranbir_Rana (Xara Group Ltd) <camelotdev@xara.com> (from Neville)
Date:
21/01/97
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 4598 of file bmpprefs.cpp.

04599 {
04600     JPEGExportOptions* pOptions = (JPEGExportOptions*)GetOptions();
04601     ERROR3IF(pOptions == NULL, "pOptions is NULL");
04602 
04603     if (pOptions->GetJPEGPresentAndSelected())
04604     {
04605         SetBoolGadgetSelected(_R(IDC_JPEG_ORIGINAL), TRUE);
04606 
04607         // Disable the other gadgets.
04608 //      EnableGadget(_R(IDC_BMPOPTS_SPREAD), FALSE);
04609         EnableGadget(_R(IDC_BMPOPTS_DRAWING), FALSE);
04610         EnableGadget(_R(IDC_BMPOPTS_SELECT), FALSE);
04611         EnableGadget(_R(IDC_JPGOPTS_PROGRESSIVE), FALSE);
04612         EnableGadget(_R(IDC_BMPOPTS_QUALITY), FALSE);
04613         EnableGadget(_R(IDC_BMPOPTS_RES), FALSE);
04614 
04615         EnableGadget(_R(IDC_BMPOPTS_XPIXELS), FALSE);
04616         EnableGadget(_R(IDC_BMPOPTS_YPIXELS), FALSE);
04617         // WEBSTER - markn 5/2/97
04618         // Taken out the X & Y size gadgets
04619 #ifndef WEBSTER
04620         SetStringGadgetValue(_R(IDC_BMPOPTS_XSIZE), &String_8("-"));
04621         SetStringGadgetValue(_R(IDC_BMPOPTS_YSIZE), &String_8("-"));
04622         EnableGadget(_R(IDC_BMPOPTS_XSIZE), FALSE);
04623         EnableGadget(_R(IDC_BMPOPTS_YSIZE), FALSE);
04624 #endif // WEBSTER
04625         EnableGadget(_R(IDC_BMPOPTS_PERCENT), FALSE);
04626     }
04627     else
04628     {
04629         // Enbale the quality & progress controls.
04630         EnableGadget(_R(IDC_BMPOPTS_QUALITY), TRUE);
04631         EnableGadget(_R(IDC_JPGOPTS_PROGRESSIVE), TRUE);
04632         EnableGadget(_R(IDC_BMPOPTS_PERCENT), TRUE);
04633 
04634         // Flag that DPI is supported by JPEGs
04635         m_bDpiSupported = TRUE;
04636 
04637         // First, set up the resolution combo box
04638         SetUpResolutionList();
04639     
04640         // Set up the quality slider and percentage display
04641         INT32 Quality = pOptions->GetQuality(); // Default Quality
04642         // Check that value is not bigger than maximum allowed
04643         if (Quality > 100)
04644             Quality = 100;
04645 
04646         // Set the range of the slider control plus a step value of 1
04647         SetGadgetRange(_R(IDC_BMPOPTS_QUALITY), 0, 100, 1);
04648         SetGadgetBitmaps(_R(IDC_BMPOPTS_QUALITY), _R(IDB_SLIDERBASE), _R(IDB_SLIDERSLIDER));
04649         SetLongGadgetValue(_R(IDC_BMPOPTS_QUALITY), 100 - Quality);
04650         SetBoolGadgetSelected(_R(IDC_JPGOPTS_PROGRESSIVE), pOptions->DoAsProgressive());
04651     
04652         // Set the percentage string
04653         TCHAR Str[32];
04654         String_32 jcf(_R(IDS_PERCENT_FORMAT));
04655         camSprintf(Str, jcf, Quality);
04656         String_32 PercentStr(Str);
04657         SetStringGadgetValue(_R(IDC_BMPOPTS_PERCENT), &PercentStr);
04658 
04659         InitSelectionRadioGroup();
04660     
04661         // Make sure that size fields are displaying the values correctly
04662         RecalculateSize();
04663     }
04664 };

void JPEGExportPrefsDialog::SetOriginalSourcePresent BOOL  Value  )  [inline]
 

Definition at line 714 of file bmpprefs.h.

00714 { m_OriginalSourcePresent = Value; }


Member Data Documentation

BOOL JPEGExportPrefsDialog::m_OriginalSourcePresent [protected]
 

Definition at line 722 of file bmpprefs.h.


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