[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]
[XaraXtreme-commits] Commit Complete
Commit by : phil
Repository : xara
Revision : 1116
Date : Thu May 18 14:34:05 BST 2006
Changed paths:
M /Trunk/XaraLX/wxOil/camdoc.cpp
M /Trunk/XaraLX/wxOil/camelot.cpp
M /Trunk/XaraLX/wxOil/menucmds.cpp
Use Preferences DefaultOpenFilePath and DefaultSaveFilePath to record Open and Save paths across sessions.
Diff:
Index: Trunk/XaraLX/wxOil/menucmds.cpp
===================================================================
--- Trunk/XaraLX/wxOil/menucmds.cpp (revision 1115)
+++ Trunk/XaraLX/wxOil/menucmds.cpp (revision 1116)
@@ -133,6 +133,7 @@
#include "group.h" // for management of blend stuff
#include "rechblnd.h" // so that can reset blend pointers
//#include "urls.h"
+#include "filedlgs.h"
DECLARE_SOURCE("$Revision$");
#define THIRTY_TWO 32
@@ -340,6 +341,7 @@
{
// OnFileOpen needs an event, but doesn't use it
wxCommandEvent event;
+ AfxGetApp().GetDocumentManager()->SetLastDirectory(BaseFileDialog::DefaultOpenFilePath);
AfxGetApp().GetDocumentManager()->OnFileOpen( event );
CCamDoc::EnableRemoveUntouchedDocs(); // Next idle event will try ro get rid of
// the auto-created startup document
@@ -420,14 +422,8 @@
void FileSaveAction()
{
-#if 0
- ((CCamDoc *)
- (((CMDIFrameWnd *)
- ((AfxGetApp())->m_pMainWnd))->MDIGetActive() //Get Active Child Window
- )->GetActiveDocument() //Get Active Document
- )->OnFileSave(); //Save Active Document
-#endif
wxCommandEvent event;
+// AfxGetApp().GetDocumentManager()->SetLastDirectory(BaseFileDialog::DefaultSaveFilePath);
AfxGetApp().GetDocumentManager()->OnFileSave( event );
}
@@ -460,25 +456,18 @@
void FileSaveAsAction()
{
-PORTNOTETRACE("other", "FileSaveAsAction does nothing");
-#if !defined(EXCLUDE_FROM_XARALX)
- ((CCamDoc *)
- (((CMDIFrameWnd *)
- ((AfxGetApp())->m_pMainWnd))->MDIGetActive() //Get Active Child Window
- )->GetActiveDocument() //Get Active Document
- )->OnFileSaveAs(); //SaveAs Active Document
-#else
-// wxCommandEvent event;
-// AfxGetApp().GetDocumentManager()->OnFileSaveAs( event );
+// AfxGetApp().GetDocumentManager()->SetLastDirectory(BaseFileDialog::DefaultSaveFilePath);
// Don't call wxDocManager::OnFileSaveAs because that calls wxDocument non-virtual functions
// We need to ensure our pointer is cast to a CCamDoc*
// Note also that GetCurrentDocument doesn't mean "Current" in the way that the Kernel defines it!!!
// (It means "Active"...)
+// wxCommandEvent event;
+// AfxGetApp().GetDocumentManager()->OnFileSaveAs( event );
+
wxDocument* pDoc = AfxGetApp().GetDocumentManager()->GetCurrentDocument();
if (pDoc && pDoc->IsKindOf(CLASSINFO(CCamDoc)))
((CCamDoc*)pDoc)->SaveAs();
-#endif
}
Index: Trunk/XaraLX/wxOil/camelot.cpp
===================================================================
--- Trunk/XaraLX/wxOil/camelot.cpp (revision 1115)
+++ Trunk/XaraLX/wxOil/camelot.cpp (revision 1116)
@@ -128,6 +128,7 @@
#include "cartctl.h"
#include "xmlutils.h"
#include "camplatform.h"
+#include "filedlgs.h"
//
// Define FILELIST for recent file list on file menu.
@@ -558,7 +559,7 @@
#endif
if (wxDir::Exists(strConfigPath))
- m_docManager->SetLastDirectory(strConfigPath);
+ BaseFileDialog::DefaultOpenFilePath = strConfigPath;
}
// NOTE! Set bFirstRun = FALSE in OnExit handler below
Index: Trunk/XaraLX/wxOil/camdoc.cpp
===================================================================
--- Trunk/XaraLX/wxOil/camdoc.cpp (revision 1115)
+++ Trunk/XaraLX/wxOil/camdoc.cpp (revision 1116)
@@ -108,6 +108,8 @@
#include "camdoc.h"
#include "errors.h"
#include "menuops.h"
+#include "camelot.h"
+#include "filedlgs.h"
IMPLEMENT_DYNAMIC_CLASS( CCamDoc, wxDocument )
@@ -894,6 +896,9 @@
#endif
+ // Record the path we opened in a preference so it survives sessions
+ BaseFileDialog::DefaultOpenFilePath = AfxGetApp().GetDocumentManager()->GetLastDirectory();
+
SetOriginalPath( strFilename.c_str() );
if( s_RemoveExistingOnNewDoc )
@@ -1709,7 +1714,8 @@
}
if (strPath.IsEmpty())
- strPath = docTemplate->GetDirectory();
+// strPath = docTemplate->GetDirectory();
+ strPath = (LPCTSTR) BaseFileDialog::DefaultSaveFilePath;
// We want to force the use of the .xar extension...
strExt = docTemplate->GetDefaultExtension();
@@ -1790,18 +1796,22 @@
if (!OnSaveDocument(m_documentFile))
return false;
- // A file that doesn't use the default extension of its document template cannot be opened
- // via the FileHistory, so we do not add it.
- if (docTemplate->FileMatchesTemplate(fileName))
- {
- GetDocumentManager()->AddFileToHistory(fileName);
- }
- else
- {
- // The user will probably not be able to open the file again, so
- // we could warn about the wrong file-extension here.
- }
- return true;
+ // Record the path we saved in a preference so it survives sessions
+ BaseFileDialog::DefaultSaveFilePath = strPath;
+
+ // A file that doesn't use the default extension of its document template cannot be opened
+ // via the FileHistory, so we do not add it.
+ if (docTemplate->FileMatchesTemplate(fileName))
+ {
+ GetDocumentManager()->AddFileToHistory(fileName);
+ }
+ else
+ {
+ // The user will probably not be able to open the file again, so
+ // we could warn about the wrong file-extension here.
+ }
+
+ return true;
}
Xara