[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]

[XaraXtreme-commits] Commit Complete



Commit by  : phil
Repository : xara
Revision   : 1071
Date       : Tue May 16 12:09:40 BST 2006

Changed paths:
   M /Trunk/XaraLX/wxOil/camdoc.cpp

Tidied up to allow previously chosen path/file/ext to be passed into save dialog again after overwrite warning.


Diff:
Index: Trunk/XaraLX/wxOil/camdoc.cpp
===================================================================
--- Trunk/XaraLX/wxOil/camdoc.cpp	(revision 1070)
+++ Trunk/XaraLX/wxOil/camdoc.cpp	(revision 1071)
@@ -1696,30 +1696,34 @@
 #else
     wxString filter = docTemplate->GetFileFilter() ;
 #endif
-    wxString path, name, ext;
 
+    wxString strPath;
+	wxString strName;
+	wxString strExt;
+
 	// If this document already has a path, make Save As default to that path
-	wxString strDefaultDir = GetFilename();
-	if (!strDefaultDir.IsEmpty())
+	wxString tmp = GetFilename();
+	if (!tmp.IsEmpty())
 	{
-	    wxSplitPath(strDefaultDir, &path, &name, &ext);
-		strDefaultDir = path;
+	    wxSplitPath(tmp, &strPath, &strName, &strExt);
 	}
 
-	if (strDefaultDir.IsEmpty())
-		strDefaultDir = docTemplate->GetDirectory();
+	if (strPath.IsEmpty())
+		strPath = docTemplate->GetDirectory();
 
+	// We want to force the use of the .xar extension...
+	strExt = docTemplate->GetDefaultExtension();
+
 	// We can't use wxOVERWRITE_PROMPT because is doesn't conform to our UI guidelines
 	// So we must run that logic ourselves...
 	BOOL bShowFileSelectorAgain = FALSE;
-	wxString tmp;
 	do
 	{
 		wxString title(CamResource::GetText(_R(IDS_SAVEAS)));
 		tmp = wxFileSelector(title,
-							strDefaultDir,
-							wxFileNameFromPath(GetFilename()),
-							docTemplate->GetDefaultExtension(),
+							strPath,
+							strName,
+							strExt,
 							filter,
 							wxSAVE,
 							GetDocumentWindow());
@@ -1745,6 +1749,7 @@
 			else if (Answer== _R(IDB_SAVEAS))
 			{
 				// User wants to save as some other name
+				wxSplitPath(tmp, &strPath, &strName, &strExt);
 				tmp = _T("");
 				bShowFileSelectorAgain = TRUE;
 			}
@@ -1760,9 +1765,9 @@
 	while (bShowFileSelectorAgain);
 
     wxString fileName(tmp);
-    wxSplitPath(fileName, & path, & name, & ext);
+    wxSplitPath(fileName, &strPath, &strName, &strExt);
 
-    if (ext.IsEmpty())
+    if (strExt.IsEmpty())
     {
         fileName += wxT(".");
         fileName += docTemplate->GetDefaultExtension();


Xara