SaveFileDialog Class Reference

This is the Save Dialog that is brought up in responce to the saveas option. It will select the last used directory etc and is generally very fabby. More...

#include <filedlgs.h>

Inheritance diagram for SaveFileDialog:

BaseFileDialog SaveTemplateDialog SliceSaveFileDlg List of all members.

Public Member Functions

 SaveFileDialog (LPCTSTR FilterString, const String_256 &, const String_256 &)
 Constructs a Save File Dialog. It sets the File Must Exist and Hide Read Only Flags. Call PrepareDialog() then DoModal() to use.
 SaveFileDialog (LPCTSTR FilterString, const String_256 &DefPath, const String_256 &DefName, const String_256 &DocumentName)
 Constructs a Save File Dialog. It sets the File Must Exist and Hide Read Only Flags. Call PrepareDialog() then DoModal() to use.
virtual BOOL PrepareDialog ()
 Does anything the dialogs want doing after they have been created, but before they are displayed.
void SetDefaultPath (const String_256 &NewPath)
 Sets the default path. The next Save As dialog will default to this path.
virtual void AppendExtension (wxString *pFilename)
 Given a filename, this function will attach the .art file extension to the to it.

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 Save dlg opens up the .web save options.
BOOL OnInitDialog ()
 Changes a few bits and bobs about in the Save 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.
void DoDataExchange (CDataExchange *pDX)
 Gets the state of the "Compress file" check-box in the save file dialog.
 DECLARE_DYNAMIC (SaveFileDialog)

Protected Attributes

String_256 DefaultName
String_256 DefaultPath
String_256 DocName
wxButton * CompressButton
wxButton * Options
wxStaticText * CurrentOptions

Detailed Description

This is the Save Dialog that is brought up in responce to the saveas option. It will select the last used directory etc and is generally very fabby.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/1/95
See also:
BaseFileDialog

Definition at line 365 of file filedlgs.h.


Constructor & Destructor Documentation

SaveFileDialog::SaveFileDialog LPCTSTR  FilterString,
const String_256 DefPath,
const String_256 DefName
 

Constructs a Save File Dialog. It sets the File Must Exist and Hide Read Only Flags. Call PrepareDialog() then DoModal() to use.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/1/95
Parameters:
FilterString - The string of available filters [INPUTS] DefPath - The Default Path for the file DefName - The Default FileName for the file

Definition at line 2551 of file filedlgs.cpp.

02552   : BaseFileDialog( FALSE, wxFILE_MUST_EXIST, FilterString )
02553 //  : BaseFileDialog(FALSE, OFN_HIDEREADONLY | OFN_PATHMUSTEXIST, FilterString)
02554 {
02555     // Make a note of this lot
02556     DefaultName = DefName;
02557     DefaultPath = DefPath;
02558     DocName = DefName;
02559 
02560 PORTNOTE("other", "Removed OFN_OVERWRITEPROMPT - not sure if needed" )
02561 #if !defined(EXCLUDE_FROM_XARALX)
02562     // Under Windows 95 the OnFileNameOK system does not work, so use the default one
02563     // Disable for VC4.0/MFC 4.0 as they have fixed it.
02564 #if _MFC_VER < 0x400
02565     if (IsWin32c())
02566         m_ofn.Flags |= OFN_OVERWRITEPROMPT;
02567 #endif
02568 #endif
02569 }

SaveFileDialog::SaveFileDialog LPCTSTR  FilterString,
const String_256 DefPath,
const String_256 DefName,
const String_256 DocumentName
 

Constructs a Save File Dialog. It sets the File Must Exist and Hide Read Only Flags. Call PrepareDialog() then DoModal() to use.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/1/95
Parameters:
FilterString - The string of available filters [INPUTS] DefPath - The Default Path for the file DefName - The Default FileName for the file DocumentName - The name of the document to put in the dialog title

Definition at line 2588 of file filedlgs.cpp.

02591     : BaseFileDialog( FALSE, ((CCamApp::IsNewWindowsUI()) ? OFN_ENABLETEMPLATE : 0) | OFN_HIDEREADONLY | OFN_PATHMUSTEXIST, FilterString)
02592     : BaseFileDialog( FALSE, wxFILE_MUST_EXIST, FilterString )
02593 {
02594     // Make a note of this lot
02595     DefaultName = DefName;
02596     DefaultPath = DefPath;
02597     DocName = DocumentName;
02598 
02599 PORTNOTE("other", "Disabled template stuff" )
02600 #if !defined(EXCLUDE_FROM_XARALX)
02601     if (CCamApp::IsNewWindowsUI())
02602     {
02603         // Use our template to do the ammendment and addition of controls to the dialog box
02604         m_ofn.lpTemplateName = MAKEINTRESOURCE(_R(IDD_PREVIEWBITMAP));
02605     }
02606     else
02607         m_ofn.lpTemplateName = NULL;
02608 #endif
02609     
02610     // Set the preview bitmap to be NULL
02611     pBitmapToUse = NULL;
02612 }


Member Function Documentation

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

Given a filename, this function will attach the .art file extension to the to it.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/6/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]

Reimplemented from BaseFileDialog.

Definition at line 2887 of file filedlgs.cpp.

02888 {
02889     // Make sure we were not passed rubbish
02890     if ((pFilename==NULL) || (pFilename->IsEmpty()))
02891         return;
02892 
02893     TRACEUSER( "Rik", _T("Append Extension in - %s\n"), (const TCHAR*)(*pFilename));
02894 
02895     // First we will see if this filename has an extension already
02896     INT32   ExtensionLen = pFilename->length() - pFilename->Find( '.', true );
02897     INT32   i = pFilename->Find( '.', true );
02898 
02899     // See if we found a valid extension
02900     if( ExtensionLen > 3 || i < 0 )
02901     {
02902         // No extension as yet, so add one in
02903         String_32 NewExtension(_R(IDS_DEFAULT_EXTENSION));
02904         *pFilename += wxString( _T(".") );
02905         *pFilename += wxString( (const TCHAR *)NewExtension );
02906     }
02907 
02908     TRACEUSER( "Rik", _T("Append Extension out- %s\n\n"), (const TCHAR*)(*pFilename) );
02909 }

SaveFileDialog::DECLARE_DYNAMIC SaveFileDialog   )  [protected]
 

void SaveFileDialog::DoDataExchange CDataExchange *  pDX  )  [protected]
 

Gets the state of the "Compress file" check-box in the save file dialog.

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

Reimplemented in SaveTemplateDialog.

Definition at line 2745 of file filedlgs.cpp.

02746 {
02747     BaseFileDialog::DoDataExchange(pDX);
02748     //{{AFX_DATA_MAP(CMyDialog)
02749 #ifdef _DEBUG
02750     DDX_Check(pDX, _R(IDC_COMPRESS_BUTTON), CamelotNativeEPSFilter::CompressNative);
02751 #endif
02752 //  DDX_Check(pDX, _R(IDC_SAVEASWEB_BUTTON), SaveWebFile); //BaseCamelotFilter::ExportWebFile);
02753     if (CCamApp::IsNewWindowsUI())
02754     {
02755         DDX_Check(pDX, _R(IDC_SHOWPREVIEW), BaseFileDialog::ShowPreviewBitmap);
02756     }
02757     //}}AFX_DATA_MAP
02758 }

BOOL SaveFileDialog::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:
2/7/96
Returns:
TRUE if it worked, FALSE if it failed
See also:
BaseFileDialog::ExplorerInitDialog; BaseFileDialog::OnHookMsg; BaseFileDialog::HookProc;

Reimplemented from BaseFileDialog.

Reimplemented in SaveTemplateDialog.

Definition at line 2688 of file filedlgs.cpp.

02689 {
02690 PORTNOTE("other", "Remove MFC code" )
02691 #if !defined(EXCLUDE_FROM_XARALX)
02692     // Do nothing of not on explorer type dialog boxes
02693     if (!CCamApp::IsNewWindowsUI())
02694         return TRUE;
02695 
02696     // Set up and initialise the new buttons and controls
02697 
02698     // Give it the correct state according to the preference.
02699     CheckDlgButton(_R(IDC_SHOWPREVIEW), BaseFileDialog::ShowPreviewBitmap != FALSE);
02700 
02701     wxWindow* Icon = FindWindow( _R(IDC_PREVIEW));
02702     ::EnableWindow(Icon, TRUE);
02703 
02704     // WEBSTER - markn 28/1/97
02705     Icon = FindWindow( _R(IDC_FILEDLG_OPTIONS));
02706 #ifndef WEBSTER
02707     ::ShowWindow(Icon, SW_HIDE);
02708 #else
02709     ::ShowWindow(Icon, SW_SHOWNORMAL);
02710     ::EnableWindow(Icon, TRUE);
02711 #endif // WEBSTER
02712 
02713     //Graham 27/10/97: And the "use as default" button
02714     Icon = FindWindow( _R(IDC_USEASDEFAULT));
02715 
02716     ::ShowWindow(Icon, SW_HIDE);
02717     // Move the Preview box down a little, so that it lines up with the List box
02718     CWnd *wndDlg = GetParent();
02719     wxWindow* pWndPreview = GetDlgItem(_R(IDC_PREVIEW));
02720     wxRect rPreview, rList;
02721     pWndPreview->GetWindowRect(&rPreview);
02722     ScreenToClient(rPreview);
02723     wxWindow* pWndList = wndDlg->GetDlgItem(lst1);  // lst1 is the ID for the main list box
02724     pWndList->GetWindowRect(&rList);
02725     ScreenToClient(rList);
02726     pWndPreview->SetWindowPos(NULL, rPreview.left, rList.top, rPreview.Width(), rPreview.Height(), 0);
02727 
02728     ExplorerInited = TRUE;
02729 #endif
02730 
02731     return TRUE;
02732 }

BOOL SaveFileDialog::HandleOptions  )  [protected, virtual]
 

Implements the options button installed for WEBSTER Save dlg opens up the .web save options.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/1/97
Returns:
-

Reimplemented from BaseFileDialog.

Definition at line 2925 of file filedlgs.cpp.

02926 {
02927 #ifndef WEBSTER
02928     return BaseFileDialog::HandleOptions();
02929 #else
02930     if (CCamApp::IsNewWindowsUI())
02931     {
02932         CamelotWebFilter* pWebFilter = NULL;
02933         {
02934             // Find the web filter
02935             Filter* pFilter = Filter::GetFirst();
02936             while (pFilter != NULL && pFilter->FilterID != FILTERID_WEB)
02937                 pFilter = Filter::GetNext(pFilter);     // Try the next filter
02938 
02939             if (pFilter != NULL && IS_A(pFilter,CamelotWebFilter))
02940                 pWebFilter = (CamelotWebFilter*)pFilter;
02941         }
02942 
02943         // Make sure that we found the web Filter
02944         if (pWebFilter == NULL)
02945         {
02946             InformError(_R(IDT_CANT_FIND_FILTER));
02947             return FALSE;
02948         }
02949 
02950         WebPrefsDlgParam Prefs;
02951 
02952         Prefs.SetSelType(pWebFilter->GetSelType());
02953 
02954         // Use the preference option in the baseclass camelot filter;
02955         Prefs.SetBmpCompression(            pWebFilter->GetBitmapCompression());
02956         Prefs.SetExportPreviewBitmap(       pWebFilter->GetPreviewBitmapExport());
02957         Prefs.SetConvertTextToOutlines(     pWebFilter->GetConvertTextToOutlines());
02958         Prefs.SetConvertBlendsToOutlines(   pWebFilter->GetConvertBlendsToOutlines());
02959         Prefs.SetHTMLToClipboard(   pWebFilter->ShouldExportHTMLTag());
02960         
02961         // This is ok as we are using a modal dialog box
02962         BOOL Ok = WebPrefsDlg::InvokeDialog(&Prefs);
02963 
02964         // If ok, and the OK button was clicked to close the dlg
02965         if (OK && Prefs.GetWebOk())
02966         {
02967             // Set up some returned variables as the user has oked them
02968             pWebFilter->SetBitmapCompression(Prefs.GetBmpCompression());
02969             pWebFilter->SetPreviewBitmapExport(Prefs.GetExportPreviewBitmap());
02970             pWebFilter->SetConvertTextToOutlines(Prefs.GetConvertTextToOutlines());
02971             pWebFilter->SetConvertBlendsToOutlines(Prefs.GetConvertBlendsToOutlines());
02972             pWebFilter->SetRemoveInvisibleLayers(TRUE);
02973             pWebFilter->SetRemoveUnusedColours(FALSE);
02974             pWebFilter->SetMinimalWebFormat(FALSE);
02975             pWebFilter->SetSelType(Prefs.GetSelType());
02976             pWebFilter->SetHTMLToClipboard(Prefs.GetHTMLToClipboard());
02977         }
02978     }
02979 
02980     return TRUE;
02981 #endif // WEBSTER
02982 }

BOOL SaveFileDialog::OnFileNameOK  )  [protected]
 

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 2863 of file filedlgs.cpp.

02864 {
02865     // ask the new function if the name is OK
02866     if (IsValidFilename())
02867         return FALSE;
02868     else
02869         return TRUE;
02870 }

BOOL SaveFileDialog::OnInitDialog  )  [protected]
 

Changes a few bits and bobs about in the Save Dialog.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/1/95
Returns:
TRUE => normal window focus is required.
See also:
SaveFileDialog

Definition at line 2627 of file filedlgs.cpp.

02628 {
02629     // Set up the string we require
02630     String_256      NewText(_R(IDS_SAVEBUTTON));
02631     const TCHAR*    NewTextStr = NewText;
02632 
02633     // Get the handle of the ok button.
02634     wxButton*       OkButton = (wxButton*)FindWindow( wxID_OK );
02635 
02636     // Now replace the 'ok' by 'Save' and return
02637     OkButton->SetLabel( NewTextStr );
02638 
02639 PORTNOTE( "other", "Remove code to add compression check" )
02640 #if !defined(EXCLUDE_FROM_XARALX) && defined(_DEBUG)
02641     // Move the bottom of the dialog down...
02642     WINDOWPLACEMENT Placement;
02643     Placement.length = sizeof(Placement);
02644     ::GetWindowPlacement(GetSafeHwnd(), &Placement);
02645     INT32 Height = Placement.rcNormalPosition.bottom - Placement.rcNormalPosition.top;
02646     if (!CCamApp::IsNewWindowsUI())
02647     {
02648         // Only resize the window on older UI i.e. NT 3 and Win 3 as handled differently
02649         // on Windows 95 UI forms.
02650         ::MoveWindow(GetSafeHwnd(),
02651                      Placement.rcNormalPosition.left,
02652                      Placement.rcNormalPosition.top,
02653                      Placement.rcNormalPosition.right - Placement.rcNormalPosition.left,
02654                      Height + 20,
02655                      TRUE);
02656     }
02657     
02658     // ...and add a check box for the compression on/off preference.
02659     wxRect ButtonPos(10, Height - 35, 110, Height - 15);
02660 
02661     CompressButton.Create((TCHAR *)String_32(_R(IDS_FILEDLGS_COMPRESS_FILE)),
02662                         WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_AUTOCHECKBOX, 
02663                         ButtonPos, this, _R(IDC_COMPRESS_BUTTON));
02664     
02665     // Give it the correct state according to the preference.
02666     CompressButton.SetCheck(CamelotNativeEPSFilter::CompressNative != FALSE);
02667 #endif
02668 
02669     return TRUE;
02670 }

BOOL SaveFileDialog::PrepareDialog  )  [virtual]
 

Does anything the dialogs want doing after they have been created, but before they are displayed.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/1/95
Returns:
TRUE if it worked, FALSE if not

Reimplemented from BaseFileDialog.

Reimplemented in SaveTemplateDialog.

Definition at line 2773 of file filedlgs.cpp.

02774 {
02775     // Set the title of the dialog, depending on what the document name is
02776     if (!DocName.IsEmpty())
02777     {
02778         // Get a string to build the document title in
02779         String_256 DialogTitle;
02780 
02781         // make a title for the dialog, using the default name for the document
02782         // ie it will come out a bit like this... Save MyDoc.art As
02783         if (DialogTitle.MakeMsg(_R(IDS_SAVENAMEDTITLE), &DocName)!=0)
02784         {
02785             // OK, we have the title in a string 256, so put it into a normal string
02786             UINT32 CopyLength = DialogTitle.Length() + 1;
02787             if (CopyLength > TITLE_SIZE)
02788             {
02789                 CopyLength = TITLE_SIZE - 1;
02790             }
02791             camStrncpy( Title, (const TCHAR*)(DialogTitle), CopyLength);
02792             Title[CopyLength] = TEXT('\0');
02793         
02794             // Change the dialogs data structure to use the new title string
02795             wxFileDialog::SetTitle( Title );
02796         }
02797     }
02798     else
02799     {
02800         // We have no title for the document, so just use 'Save As' instead
02801         if (SmartLoadString(0, _R(IDS_SAVETITLE), Title, 128))
02802             wxFileDialog::SetTitle( Title );
02803     }
02804 
02805     // Select the desired path, use the one passed in to the constructor is available
02806     if (!DefaultPath.IsEmpty())
02807     {
02808         // Set the default path
02809         SetDirectory( DefaultPath );
02810     }
02811     else
02812     {
02813         // or use the global default path
02814         if( DefaultSaveFilePath.Length() == 0 )
02815             // use the My Documents folder
02816             DefaultOpenFilePath = wxStandardPaths::Get().GetUserConfigDir();
02817 
02818         SetDirectory( DefaultSaveFilePath );
02819     }
02820 
02821     // Do the same for the filename
02822     if (!DefaultName.IsEmpty())
02823         SetFilename( DefaultName );
02824 
02825     return TRUE;
02826 }

void SaveFileDialog::SetDefaultPath const String_256 NewPath  ) 
 

Sets the default path. The next Save As dialog will default to this path.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/1/95
Parameters:
NewPath - The path to use as the default [INPUTS]

Definition at line 2841 of file filedlgs.cpp.

02842 {
02843     // Set the default path
02844     DefaultSaveFilePath = NewPath;
02845 }


Member Data Documentation

wxButton* SaveFileDialog::CompressButton [protected]
 

Definition at line 408 of file filedlgs.h.

wxStaticText* SaveFileDialog::CurrentOptions [protected]
 

Definition at line 410 of file filedlgs.h.

String_256 SaveFileDialog::DefaultName [protected]
 

Definition at line 404 of file filedlgs.h.

String_256 SaveFileDialog::DefaultPath [protected]
 

Definition at line 405 of file filedlgs.h.

String_256 SaveFileDialog::DocName [protected]
 

Definition at line 406 of file filedlgs.h.

wxButton* SaveFileDialog::Options [protected]
 

Definition at line 409 of file filedlgs.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 04:00:37 2007 for Camelot by  doxygen 1.4.4