ExportFileDialog Class Reference

To provide a custom open file dialog, which enables us to resize the drop down list of filters. More...

#include <filedlgs.h>

Inheritance diagram for ExportFileDialog:

BaseFileDialog GIFExportFileDialog List of all members.

Public Member Functions

 ExportFileDialog (LPCTSTR lpszFilter=NULL)
 Contructs an export file dialog.
virtual void AppendExtension (wxString *pFilename)
 Given a filename, this function will attach the appropriate file extension according to the chosen filter to it. Based on the function SaveFileDialog::AppendExtension but needs to append the selected filer name rather than an explicit .art.
virtual void AddExtension (wxString *pFilename, BOOL Replace=FALSE, BOOL AskAboutReplace=FALSE, UINT32 Selection=0)
 Given a filename, this function will attach the appropriate file extension according to the chosen filter to it. Based on the function SaveFileDialog::AppendExtension but needs to append the selected filer name rather than an explicit .art.
void ExportABitmap (BOOL bExportABitmap, KernelBitmap *pBitmap=0)

Protected Member Functions

virtual BOOL ExplorerInitDialog (wxWindow *hDlg)
 Should be called when the explorer style dialog boxes need setting up. We can take this opportunity to add in any extra controls that we require.
virtual BOOL HandleOptions ()
 Implements the options button installed for WEBSTER This opens the GIF Animation properties tabs dialog with the Browser PReview tab selected.

Protected Attributes

BOOL m_bExportABitmap
KernelBitmapm_pBitmapToExport

Private Member Functions

BOOL OnInitDialog (wxInitDialogEvent &event)
 Make the drop-down filter box bigger than usual.
void DoDataExchange (CDataExchange *pDX)
 Handles data exchange messages for the export file dialog.
BOOL OnFileNameOK ()
 So we can do our own 'that file already exists' check, as the standard one used Y/N and that is officially forbidden (despite the fact that 99.999% of Windows programs use it). Its an MFC overridable.
virtual void OnTypeChange ()
 Should be called when the user has selected a new file type from the "Files of type" combo box. We might need to do things like fix the file extension for the currently selected save/export filter. Only called back if OFN_EXPLORER is set and you can only do this on Windows 95 otherwise a dialog is not popped up.
virtual void OnLBSelChangedNotify (UINT32 nIDBox, UINT32 iCurSel, UINT32 nCode)
 Should be called when the user has selected a new file type from the "Files of type" combo box. We might need to do things like fix the file extension for the currently selected save/export filter. This should be called on all OS's, so we must disable it in Windows 95. This turns out not to be the case as it does not seem to get called on Windows 95, probably due to the ExportFileDialog::OnTypeChange() override. It is called on initing the dialog box but shouldn't cause a problem. Filenames of the sort *.gif are automatically fixed by the OS. As soon as you type a real name in though, they are no longer fixed!
virtual BOOL IsValidFilename ()
 Check to see if the file name is OK.
BOOL SetStateOnFilterChange ()
 Implements the options button installed for WEBSTER Finds out whether to grey the Options button and/or the Auto-preview checkbox.
afx_msg void OnAutoPreview ()
 Should be called when the user has selected a new file type from the "Files of type" combo box. We might need to do things like fix the file extension for the currently selected save/export filter. Only called back if OFN_EXPLORER is set and you can only do this on Windows 95 otherwise a dialog is not popped up.
 DECLARE_DYNAMIC (ExportFileDialog)

Detailed Description

To provide a custom open file dialog, which enables us to resize the drop down list of filters.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/03/94
See also:
OpMenuExport

Definition at line 529 of file filedlgs.h.


Constructor & Destructor Documentation

ExportFileDialog::ExportFileDialog LPCTSTR  lpszFilter = NULL  ) 
 

Contructs an export file dialog.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/5/95
Parameters:
lpszFilter which file extensions to display/allow [INPUTS]

Definition at line 3217 of file filedlgs.cpp.

03218     : BaseFileDialog(FALSE, ((CCamApp::IsNewWindowsUI()) ? OFN_ENABLETEMPLATE : 0) | OFN_HIDEREADONLY | OFN_PATHMUSTEXIST, lpszFilter, NULL)
03219     : BaseFileDialog( FALSE, 0, lpszFilter, NULL )
03220 {
03221 PORTNOTE("other", "Disabled template stuff" )
03222 #if !defined(EXCLUDE_FROM_XARALX)
03223     // Under Windows 95 the OnFileNameOK system does not work, so use the default one
03224     // Disable for VC4.0/MFC 4.0 as they have fixed it.
03225 #if _MFC_VER < 0x400
03226     if (IsWin32c())
03227         m_ofn.Flags |= OFN_OVERWRITEPROMPT;
03228 #endif
03229 
03230     if (CCamApp::IsNewWindowsUI())
03231     {
03232         // Use our template to do the ammendment and addition of controls to the dialog box
03233         m_ofn.lpTemplateName = MAKEINTRESOURCE(_R(IDD_PREVIEWBITMAP));
03234     }
03235     else
03236         m_ofn.lpTemplateName = NULL;
03237 #endif
03238     
03239     // Set the preview bitmap to be NULL
03240     pBitmapToUse = NULL;    
03241 
03242     m_bExportABitmap = FALSE;
03243 
03244 #if FALSE
03245     // for the future "Options" button handling
03246 
03247     // set the options to be NULL
03248     m_pOptions = NULL;
03249 #endif
03250 }


Member Function Documentation

void ExportFileDialog::AddExtension wxString *  pFilename,
BOOL  Replace = FALSE,
BOOL  AskAboutReplace = FALSE,
UINT32  Selection = 0
[virtual]
 

Given a filename, this function will attach the appropriate file extension according to the chosen filter to it. Based on the function SaveFileDialog::AppendExtension but needs to append the selected filer name rather than an explicit .art.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/1/96
Parameters:
pFilename - the filename to append an extension to [INPUTS] Replace - True if want when an extension is present, it will be replaced
  • False only adds extensions when none are present AskAboutReplace - If extension does not match the filter the ask about replacing it Selection - Non-zero means that this is the selected item
pFilename - the input filename with the .art extension on the end (if needed) [OUTPUTS]
Ideally should do this when the user selects a new export filter type on the list and when the box is first brought up but alledgedly trapping the list clicks is difficult.

See also:
SaveFileDialog::AppendExtension;

Definition at line 3473 of file filedlgs.cpp.

03474 {
03475     // Make sure we were not passed rubbish
03476     if ((pFilename==NULL) || (pFilename->IsEmpty()))
03477         return;
03478 
03479     TRACEUSER( "Neville", _T("Add Extension in - %s\n"), (PCTSTR)*pFilename );
03480 
03481     // First we will see if this filename has an extension already
03482     INT32   ExtensionLen = pFilename->length() - pFilename->Find( '.', true );
03483     INT32   i = pFilename->Find( '.', true );
03484 
03485     // If a selection has been passed in then use that, otherwise use the one stored in the
03486     // class variable.
03487     INT32 TheSelectedFilter = 0;
03488     if (Selection)
03489         TheSelectedFilter = Selection;
03490     else
03491         TheSelectedFilter = GetSelectedFilterIndex(); // could use m_ofn.nFilterIndex but beware bodge!
03492 
03493 TRACEUSER( "Neville", _T("TheSelectedFilter - %d\n"), TheSelectedFilter);
03494     // Find the filter that the user has chosen
03495     Filter *pFilter = GetSelectedExportFilter(TheSelectedFilter);
03496 
03497     // If no filter was found then return immediately
03498     if (pFilter == NULL)
03499         return;
03500 
03501     String_32 ExtStr = pFilter->pOILFilter->FilterExt;
03502     // Filters might have multiple extensions listed separated by commas
03503     // so use first e.g. AI eps filter has ai and eps.
03504     // Work out the position of the first separator character, - 1 if none
03505     String_8    SepMark = _T(",");
03506     INT32       Position = ExtStr.Sub( SepMark );
03507     
03508     // If comma separator was found use up to the separator 
03509     if (Position > 0)
03510         ExtStr.Left(&ExtStr, Position);
03511 
03512     // See if we found a valid extension
03513     if ((ExtensionLen > 3) || (i < 0))
03514     {
03515         // No valid extension as yet so add one
03516         *pFilename += wxString( _T(".") );
03517         *pFilename += (TCHAR*)ExtStr;
03518     }
03519     else if (ExtensionLen <= 3 && ExtensionLen > 0 && i > 0)
03520     {
03521         // FLag we don't overwrite by default
03522         BOOL OverwriteExtension = FALSE;
03523 
03524         // Only if wanting to ask and not force the replacement do we need to
03525         // check the extension and ask the user if they want to correct it
03526         if (AskAboutReplace && !Replace)
03527         {
03528             // Valid extension found so check that it is correct
03529             String_32   FoundExtStr( _T("") );
03530             TCHAR*      FoundExt = (TCHAR *)FoundExtStr;
03531             INT32       j;
03532             for( j = 0; j < ExtensionLen; j++ )
03533                 FoundExt[j] = pFilename->operator[](i + 1 + j);
03534 
03535             // Stuff a terminator on the end
03536             FoundExt[j] = '\0';
03537             // Ensure in lower case
03538             FoundExtStr.toLower();
03539 
03540             if (FoundExtStr != ExtStr)
03541             {
03542                 // Wrong extension present so warn the user
03543                 String_256 Msg;
03544                 Msg.MakeMsg(_R(IDW_REPLACEEXTENSION), (TCHAR *)FoundExtStr, (TCHAR *)ExtStr);
03545                 Error::SetError(0, Msg, 0);
03546                 INT32 ButtonPressed = InformWarning(0, _R(IDS_CORRECT), _R(IDS_DONTCORRECT));
03547                 Error::ClearError();
03548 
03549                 // If the user presses 'Correct' then go and fix the extension to what
03550                 // it should be 
03551                 if(ButtonPressed == 1)
03552                 {
03553                     OverwriteExtension = TRUE;
03554                 }
03555             }
03556         }
03557         else if (Replace)
03558         {
03559             // Flag that we require an overwrite
03560             OverwriteExtension = TRUE;
03561         }
03562         
03563         if (OverwriteExtension)
03564         {
03565             // Hack off the current extension
03566             *pFilename = pFilename->Left(i);
03567             
03568             // Add in the new one
03569             *pFilename += wxString( _T(".") );
03570             *pFilename += (TCHAR*)ExtStr;
03571         }
03572     }
03573 
03574     TRACEUSER( "Neville", _T("Add Extension out- %s\n\n"), PCTSTR(*pFilename) );
03575 }

void ExportFileDialog::AppendExtension wxString *  pFilename  )  [virtual]
 

Given a filename, this function will attach the appropriate file extension according to the chosen filter to it. Based on the function SaveFileDialog::AppendExtension but needs to append the selected filer name rather than an explicit .art.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/7/95
Parameters:
pFilename - the filename to append an extension to [INPUTS]
pFilename - the input filename with the .art extension on the end (if needed) [OUTPUTS]
Ideally should do this when the user selects a new export filter type on the list and when the box is first brought up but alledgedly trapping the list clicks is difficult.

See also:
SaveFileDialog::AppendExtension;

Reimplemented from BaseFileDialog.

Definition at line 3440 of file filedlgs.cpp.

03441 {
03442     // Use the new routine in its default state i.e. only add extension if not present already
03443     AddExtension(pFilename);
03444     return; 
03445 }

ExportFileDialog::DECLARE_DYNAMIC ExportFileDialog   )  [private]
 

void ExportFileDialog::DoDataExchange CDataExchange *  pDX  )  [private]
 

Handles data exchange messages for the export file dialog.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/1/96
Parameters:
(a standard MFC object) [INPUTS]

Definition at line 3383 of file filedlgs.cpp.

03384 {
03385     BaseFileDialog::DoDataExchange(pDX);
03386     //{{AFX_DATA_MAP(CMyDialog)
03387     //DDX_Check(pDX, _R(IDC_LAYERS_BUTTON), Filter::ImportWithLayers);
03388     if (CCamApp::IsNewWindowsUI())
03389     {
03390         DDX_Check(pDX, _R(IDC_SHOWPREVIEW), BaseFileDialog::ShowPreviewBitmap);
03391     }
03392     //}}AFX_DATA_MAP
03393 }

BOOL ExportFileDialog::ExplorerInitDialog wxWindow *  hDlg  )  [protected, virtual]
 

Should be called when the explorer style dialog boxes need setting up. We can take this opportunity to add in any extra controls that we require.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/7/96
Returns:
TRUE if it worked, FALSE if it failed
See also:
BaseFileDialog::ExplorerInitDialog; BaseFileDialog::OnHookMsg; BaseFileDialog::HookProc;

Reimplemented from BaseFileDialog.

Reimplemented in GIFExportFileDialog.

Definition at line 3312 of file filedlgs.cpp.

03313 {
03314 PORTNOTE("other", "Remove MFC code" )
03315 #if !defined(EXCLUDE_FROM_XARALX)
03316     // Do nothing of not on explorer type dialog boxes
03317     if (!CCamApp::IsNewWindowsUI())
03318         return TRUE;
03319 
03320     // Replace the 'OK' button by 'Export' or 'Apply'.
03321 /*  ::SetWindowText(FindWindow( IDOK),
03322                     (LPCSTR) String(NamedExportProp::m_fApplyNotExport
03323                                             ? _R(IDS_PREVIEW_APPLY) : _R(IDN_EXPORTBUTTON)));
03324 */
03325     // Actually stand a chance of replacing the 'OK' button by 'Export' or 'Apply'...
03326     SetControlText(IDOK, (LPCSTR) String(NamedExportProp::m_fApplyNotExport ? _R(IDS_PREVIEW_APPLY) : _R(IDN_EXPORTBUTTON)));
03327 
03328     // Give it the correct state according to the preference.
03329     CheckDlgButton(_R(IDC_SHOWPREVIEW), BaseFileDialog::ShowPreviewBitmap != FALSE);
03330 
03331     wxWindow* Icon = FindWindow( _R(IDC_PREVIEW));
03332     ::EnableWindow(Icon, TRUE);
03333 
03334     // WEBSTER - markn 28/1/97
03335     Icon = FindWindow( _R(IDC_FILEDLG_OPTIONS));
03336     // Grey the options button.
03337     ::EnableWindow(Icon, FALSE);
03338     ::ShowWindow(Icon, SW_HIDE);
03339 
03340     //Graham 27/10/97: And the "use as default" button
03341     Icon = FindWindow( _R(IDC_USEASDEFAULT));
03342     ::ShowWindow(Icon, SW_HIDE);
03343 
03344     //And the "default templates folder" button
03345     //Icon = FindWindow( _R(IDC_DEFAULTTEMPLATESFOLDER));
03346     //::ShowWindow(Icon, SW_HIDE);
03347 
03348     // initialise the state of the Options button
03349     SetStateOnFilterChange();
03350 
03351     // Move the Preview box down a little, so that it lines up with the List box
03352     CWnd *wndDlg = GetParent();
03353     wxWindow* pWndPreview = GetDlgItem(_R(IDC_PREVIEW));
03354     wxRect rPreview, rList;
03355     pWndPreview->GetWindowRect(&rPreview);
03356     ScreenToClient(rPreview);
03357     wxWindow* pWndList = wndDlg->GetDlgItem(lst1);  // lst1 is the ID for the main list box
03358     pWndList->GetWindowRect(&rList);
03359     ScreenToClient(rList);
03360     pWndPreview->SetWindowPos(NULL, rPreview.left, rList.top, rPreview.Width(), rPreview.Height(), 0);
03361 
03362     // set the state of the Auto-preview check-box
03363 //J ::CheckDlgButton(GetSafeHwnd(), _R(IDC_AUTO_CHECK), BmapPrevDlg::m_bDoAutoPreview);
03364     return ExplorerInited = TRUE;
03365 #endif
03366 
03367     return TRUE;
03368 }

void ExportFileDialog::ExportABitmap BOOL  bExportABitmap,
KernelBitmap pBitmap = 0
[inline]
 

Definition at line 546 of file filedlgs.h.

00547         { m_bExportABitmap = bExportABitmap; m_pBitmapToExport = pBitmap; }

BOOL ExportFileDialog::HandleOptions  )  [protected, virtual]
 

Implements the options button installed for WEBSTER This opens the GIF Animation properties tabs dialog with the Browser PReview tab selected.

Author:
Ranbir_Rana (Xara Group Ltd) <camelotdev@xara.com>
Date:
07/07/97
Returns:
-

Reimplemented from BaseFileDialog.

Reimplemented in GIFExportFileDialog.

Definition at line 3926 of file filedlgs.cpp.

03927 {
03928 PORTNOTETRACE("other", "ExportFileDialog::HandleOptions - Do nothing - ControlHelper, GIFAnimationPropertyTabsDlg" );
03929 #if !defined(EXCLUDE_FROM_XARALX)
03930     // Get a ptr to the correct op. 
03931     OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_EXPORTGIFANIMTABSDLG);
03932 
03933     if (pOpDesc != NULL)
03934     {
03935         // If the animation properties dialog is open, close it.
03936         if (GIFAnimationPropertyTabsDlg::GetGIFAnimationPropertyTabsDlg())
03937         {
03938             // Get a ptr to the dlg.
03939             GIFAnimationPropertyTabsDlg* pDlg = GIFAnimationPropertyTabsDlg::GetGIFAnimationPropertyTabsDlg();
03940 
03941             // Ensure it is a valid ptr.
03942             if(pDlg)
03943             {
03944                 // Close the dialog.
03945                 pDlg->Close();      
03946                 pDlg->End();            
03947             }
03948         }
03949     
03950         // Select the "Browser Preview tab".
03951         GIFAnimationPropertyTabsDlg::SetPageToOpen(0);
03952 
03953         // Hide all other tabs. This flag is set back to FALSE in the destructor of AnimExOptns.
03954         GIFAnimationPropertyTabs::SetBrowserPreviewTab(TRUE);
03955 
03956         // This ensures that the dialog process works correctly.
03957         ControlHelper::InformModalDialogOpened();
03958         
03959         // Open the dialog.
03960         pOpDesc->Invoke();
03961 
03962         // Get a ptr to the dialog.
03963         GIFAnimationPropertyTabsDlg* pDlg = GIFAnimationPropertyTabsDlg::GetGIFAnimationPropertyTabsDlg();
03964 
03965         // Ensure the ptr is valid.
03966         if (pDlg)
03967         {
03968             // Send our DIM_CANCEL message.
03969             BROADCAST_TO_CLASS( DialogMsg( pDlg->WindowID, DIM_CANCEL, 0) ,DialogOp );
03970         }
03971 
03972         // The dialog has closed.
03973         ControlHelper::InformModalDialogClosed();
03974     }
03975 #endif
03976 
03977     // Everything ok.
03978     return TRUE;
03979 }

BOOL ExportFileDialog::IsValidFilename  )  [private, virtual]
 

Check to see if the file name is OK.

Author:
Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/5/97
Returns:
TRUE if the current filename is Acceptable, FALSE if not
If the file already exists, then we check with the *currently selected filter* to see if it wants to accept an existing file.

Most filters will put up a message to ask the user whether they want to replace the file. However, the ImagemapFilter will also give the user the option to intelligently insert an imagemap into the HTML file.

See also:
BaseFileDialog::IsValidFilename

Reimplemented from BaseFileDialog.

Definition at line 3860 of file filedlgs.cpp.

03861 {
03862     // Get the pathname
03863     wxString    FullPath = GetPath();
03864     AppendExtension(&FullPath);
03865 
03866     // if doesn't exist then thats fine
03867     if( !wxFile::Exists( FullPath ) )
03868     {
03869         return TRUE;
03870     }
03871 
03872     // But it does exist.
03873     // So we need to get the currently selected filter to warn the user
03874     // So get the currently selected filter
03875     Filter*     pFilter = GetSelectedExportFilter(GetSelectedFilterIndex());
03876 
03877     // Check it's there
03878     ERROR2IF(pFilter==NULL, FALSE, "ExportFileDialog::IsValidFilename - filter does not exist");
03879 
03880     // And ask that filter if it wants to accept an existing file
03881     String_256  strFullPath(FullPath);
03882     PathName    pthFullPath(strFullPath);
03883 
03884     return pFilter->WillAcceptExistingFile(pthFullPath);
03885 }

afx_msg void ExportFileDialog::OnAutoPreview  )  [private]
 

Should be called when the user has selected a new file type from the "Files of type" combo box. We might need to do things like fix the file extension for the currently selected save/export filter. Only called back if OFN_EXPLORER is set and you can only do this on Windows 95 otherwise a dialog is not popped up.

Author:
Stefan_Stoykov (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/7/97
Returns:
-
See also:
BaseFileDialog::OnHookMsg; BaseFileDialog::HookProc;

ExportFileDialog::OnLBSelChangedNotify;

Definition at line 3908 of file filedlgs.cpp.

03909 {
03910 //J BmapPrevDlg::m_bDoAutoPreview = IsDlgButtonChecked(_R(IDC_AUTO_CHECK));
03911 }

BOOL ExportFileDialog::OnFileNameOK  )  [private]
 

So we can do our own 'that file already exists' check, as the standard one used Y/N and that is officially forbidden (despite the fact that 99.999% of Windows programs use it). Its an MFC overridable.

Author:
Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/9/94
Returns:
TRUE if we didn't like it, FALSE if it was OK. (This is contrary to the MFC docs, but they seem to be wrong).
See also:
ExportFileDialog

Definition at line 3410 of file filedlgs.cpp.

03411 {
03412     // ask the new function if the name is OK
03413     if (IsValidFilename())
03414         return FALSE;
03415     else
03416         return TRUE;
03417 }

BOOL ExportFileDialog::OnInitDialog wxInitDialogEvent &  event  )  [private]
 

Make the drop-down filter box bigger than usual.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/03/94
Returns:
TRUE => normal window focus is required.
See also:
ExportFileDialog

Definition at line 3264 of file filedlgs.cpp.

03265 {
03266     // Set up the string we require
03267     String_256 NewText(_R(IDN_EXPORTBUTTON));
03268 
03269     // Get the handle of the ok button.
03270     wxButton*   OkButton = dynamic_cast<wxButton *>( FindWindow( wxID_OK ) );
03271 
03272     // Now replace the 'ok' by 'export'
03273     OkButton->SetLabel( (LPCTSTR)NewText );
03274 
03275 PORTNOTE("other", "Remove code to re-arrange ImportFileDialog" )
03276 #if !defined(EXCLUDE_FROM_XARALX)
03277     // Get the handle of the filter list box.
03278     wxComboBox* ComboBox = dynamic_cast<wxComboBox *>( FindWindow( cmb1 ) );
03279 
03280     // Find out where the list box is.
03281     WINDOWPLACEMENT Placement;
03282     Placement.length = sizeof(WINDOWPLACEMENT);
03283     ::GetWindowPlacement(ComboBox, &Placement);
03284 
03285     // Make the list box deeper than usual
03286     ::MoveWindow(ComboBox,
03287                  Placement.rcNormalPosition.left,
03288                  Placement.rcNormalPosition.top,
03289                  Placement.rcNormalPosition.right - Placement.rcNormalPosition.left,
03290                  (Placement.rcNormalPosition.bottom - Placement.rcNormalPosition.top) * 5,
03291                  TRUE);
03292 #endif
03293 
03294     // Let the base class do the rest . . .
03295     BaseFileDialog::OnInitDialog( event );
03296     return TRUE;
03297 }

void ExportFileDialog::OnLBSelChangedNotify UINT32  nIDBox,
UINT32  iCurSel,
UINT32  nCode
[private, virtual]
 

Should be called when the user has selected a new file type from the "Files of type" combo box. We might need to do things like fix the file extension for the currently selected save/export filter. This should be called on all OS's, so we must disable it in Windows 95. This turns out not to be the case as it does not seem to get called on Windows 95, probably due to the ExportFileDialog::OnTypeChange() override. It is called on initing the dialog box but shouldn't cause a problem. Filenames of the sort *.gif are automatically fixed by the OS. As soon as you type a real name in though, they are no longer fixed!

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/1/96
Parameters:
nIDBox The ID of the list box or combo box in which the selection occurred. [INPUTS] iCurSel The index of the current selection. nCode The control notification code. Values are: CD_LBSELCHANGE Specifies iCurSel is the selected item in a single-selection list box. CD_LBSELSUB Specifies that iCurSel is no longer selected in a multiselection list box. CD_LBSELADD Specifies that iCurSel is selected in a multiselection list box. CD_LBSELNOITEMS Specifies that no selection exists in a multiselection list box.
Returns:
TRUE if it worked, FALSE if it failed
See also:
BaseFileDialog::OnHookMsg; BaseFileDialog::HookProc;

ExportFileDialog::OnTypeChange();

Definition at line 3778 of file filedlgs.cpp.

03779 {
03780 PORTNOTE("other", "Removed MFC junk" )
03781 #if !defined(EXCLUDE_FROM_XARALX)
03782     // If its Windows 95 or NT 4 then use the proper method of ExportFileDialog::OnTypeChange()
03783     // which is not called on Windows NT 3
03784     // It would appear that this does not get called at all on Windows 95!
03785     if (CCamApp::IsNewWindowsUI())
03786         return;
03787     
03788     // Combo box = filter type box
03789     if (nIDBox == cmb1 && nCode == CD_LBSELCHANGE)
03790     {
03791         // Find out the Path name of the newly selected file
03792         TRACEUSER( "Neville", _T("Selection Changed - New selection = (%i)\n"), iCurSel);
03793         
03794         // Try and put this back into the edit box containing the filename
03795         wxWindow* hFileNameBox = FindWindow( edt1);
03796 
03797         if (hFileNameBox)
03798         {
03799             // Get the current filename from the edit field
03800             //wxString FullPath = GetPathName(); // This doesn't work and returns zero
03801             String_256 StrVal;
03802             ::GetWindowText(hFileNameBox, (LPSTR)(TCHAR*)StrVal, StrVal.MaxLength());
03803 
03804             // List boxes go from 1..n rather than 0..n 
03805             INT32 TheSelectedFilter = iCurSel + 1;
03806             
03807             // Find the filter that the user has chosen
03808             Filter *pFilter = GetSelectedExportFilter(TheSelectedFilter);
03809 
03810             if (!StrVal.IsEmpty() && pFilter && pFilter->pOILFilter)
03811             {
03812                 PathName TempPath(StrVal);
03813                 if (!TempPath.IsValid())
03814                 {
03815                     // There was a problem e.g. user has typed f:
03816                     // Magically a bad pathname sets an error so clear it!
03817                     Error::ClearError();
03818                     return;
03819                 }
03820 
03821                 // Get the OILFilter class to check the extension for the selected or default filter
03822                 // matches
03823                 if (!pFilter->pOILFilter->DoesExtensionOfPathNameMatch(&TempPath))
03824                 {   
03825                     // Extension is either blank or does not match the one supplied by the filter
03826                     // Ask the OILFilter class to fix it for us
03827                     pFilter->pOILFilter->FixExtensionOfPathName(&TempPath);
03828                     // Now copy that back into the name
03829                     StrVal = TempPath.GetPath();
03830 
03831                     // Try and put this back into the edit box containing the filename
03832                     ::SetWindowText(hFileNameBox, (TCHAR*)(StrVal));
03833                 }
03834             }
03835         }
03836     }
03837 #endif
03838 }

void ExportFileDialog::OnTypeChange  )  [private, virtual]
 

Should be called when the user has selected a new file type from the "Files of type" combo box. We might need to do things like fix the file extension for the currently selected save/export filter. Only called back if OFN_EXPLORER is set and you can only do this on Windows 95 otherwise a dialog is not popped up.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/1/96
Returns:
-
See also:
BaseFileDialog::OnHookMsg; BaseFileDialog::HookProc;

ExportFileDialog::OnLBSelChangedNotify;

Definition at line 3715 of file filedlgs.cpp.

03716 {
03717 #if _MFC_VER >= 0x400
03718     // Remove code completely if using less than MFC4.0 as calls like SetControlText
03719     // will not be present and this function will not work
03720     // Just in case Windows NT 3 decides to call this we'd better stop it as otherwise things
03721     // will be happening more than they should. This is the method used on Windows 95 or NT 4.
03722     if (!CCamApp::IsNewWindowsUI())
03723         return;
03724 
03725     // set the state of the Options button and the Auto-preview checkbox
03726     SetStateOnFilterChange();
03727 
03728     // Get the filename which the user has entered in the field
03729     wxString FileName = GetFileName();
03730     // If its empty then return immediately
03731     if (FileName.IsEmpty())
03732         return;
03733     
03734     // Add in the selection for the newly selected filter forcing an overwrite of any extension
03735     // already present
03736     AddExtension(&FileName, TRUE);
03737 
03738     // Try and put this back into the edit box containing the filename
03739     if (!FileName.IsEmpty())
03740     {
03741         // The following call ensures on NT. 
03742         SetControlText(edt1, (LPCSTR)(FileName.GetBuffer(1))); // 1 = min buffer size!
03743     }
03744 
03745 #endif
03746     return;
03747 }

BOOL ExportFileDialog::SetStateOnFilterChange  )  [private]
 

Implements the options button installed for WEBSTER Finds out whether to grey the Options button and/or the Auto-preview checkbox.

Author:
Stefan_Stoykov (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/07/97
Returns:
The state of the Options button

Definition at line 3650 of file filedlgs.cpp.

03651 {
03652     // get the filter index
03653     INT32 TheSelectedFilter = GetSelectedFilterIndex(); // could use m_ofn.nFilterIndex but beware bodge!
03654 
03655     // Find the filter that the user has chosen
03656     Filter *pFilter = GetSelectedExportFilter(TheSelectedFilter);
03657 
03658     BOOL State; // the state of the options button
03659 
03660 PORTNOTE("other", "Removed BMPFilter usage" )
03661     // enable the Options button, but only if a bitmap filter 
03662     //and not the BMP filter if exporting a bitmap
03663     if ((pFilter != NULL) && pFilter->IS_KIND_OF(BaseBitmapFilter) && 
03664         (!m_bExportABitmap /*|| !IS_A(pFilter, BMPFilter)*/ ) )
03665         State = TRUE; // the state of the checkbox
03666     else
03667         State = FALSE;
03668     
03669 //  wxWindow* Icon;
03670 #if FALSE
03671     // for the future "Options" button handling
03672 
03673     // enable the Options button
03674     Icon = FindWindow( _R(IDC_FILEDLG_OPTIONS));
03675     ::EnableWindow(Icon, State);
03676 
03677     // delete the options created for the last filter
03678     if (m_pOptions != NULL)
03679         delete m_pOptions;
03680     m_pOptions = NULL;
03681 #endif
03682 
03683     // set the state the "Auto-preview" checkbox
03684 //  Icon = FindWindow( _R(IDC_AUTO_CHECK));
03685 
03686     // display it first
03687 //  ::ShowWindow(Icon, SW_SHOW);
03688 
03689     // when exporting a bitmap we only have auto-preview on Options if using the JPEG filter
03690 //  BOOL AutoPreviewState = State && (!m_bExportABitmap || 
03691 //                                    (pFilter != NULL) && (IS_A(pFilter,JPEGExportFilter))); 
03692 //  ::EnableWindow(Icon, AutoPreviewState);
03693 
03694     return State;
03695 }


Member Data Documentation

BOOL ExportFileDialog::m_bExportABitmap [protected]
 

Definition at line 578 of file filedlgs.h.

KernelBitmap* ExportFileDialog::m_pBitmapToExport [protected]
 

Definition at line 579 of file filedlgs.h.


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