#include <filedlgs.h>
Inheritance diagram for SaveFileDialog:
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 |
Definition at line 365 of file filedlgs.h.
|
Constructs a Save File Dialog. It sets the File Must Exist and Hide Read Only Flags. Call PrepareDialog() then DoModal() to use.
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 }
|
|
Constructs a Save File Dialog. It sets the File Must Exist and Hide Read Only Flags. Call PrepareDialog() then DoModal() to use.
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 }
|
|
Given a filename, this function will attach the .art file extension to the to it.
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 }
|
|
|
|
Gets the state of the "Compress file" check-box in the save file dialog.
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 }
|
|
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.
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 }
|
|
Implements the options button installed for WEBSTER Save dlg opens up the .web save options.
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 }
|
|
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.
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 }
|
|
Changes a few bits and bobs about in the Save Dialog.
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 }
|
|
Does anything the dialogs want doing after they have been created, but before they are displayed.
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 }
|
|
Sets the default path. The next Save As dialog will default to this path.
Definition at line 2841 of file filedlgs.cpp. 02842 { 02843 // Set the default path 02844 DefaultSaveFilePath = NewPath; 02845 }
|
|
Definition at line 408 of file filedlgs.h. |
|
Definition at line 410 of file filedlgs.h. |
|
Definition at line 404 of file filedlgs.h. |
|
Definition at line 405 of file filedlgs.h. |
|
Definition at line 406 of file filedlgs.h. |
|
Definition at line 409 of file filedlgs.h. |