[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]
[XaraXtreme-commits] Commit Complete
Commit by : phil
Repository : xara
Revision : 1107
Date : Wed May 17 17:23:18 BST 2006
Changed paths:
M /Trunk/XaraLX/wxOil/camelot.cpp
M /Trunk/XaraLX/wxOil/camelot.h
On first run default path for Open File dialog is set to installed Examples folder.
BZ1062
Diff:
Index: Trunk/XaraLX/wxOil/camelot.h
===================================================================
--- Trunk/XaraLX/wxOil/camelot.h (revision 1106)
+++ Trunk/XaraLX/wxOil/camelot.h (revision 1107)
@@ -165,6 +165,8 @@
static BOOL MainWndMinimized; // user maximized preference
static String_256 MainWndPosString; // user window position
+ static BOOL bFirstRun; // TRUE if this is the first time the app has been run
+ // (first time with this set of preferences)
BOOL allowRegistryWrite; // if a copy of camelot is open, and we try do load another one,
// and exit (we prevent this), then we don't wan't to write to
// the registry !!!!
Index: Trunk/XaraLX/wxOil/camelot.cpp
===================================================================
--- Trunk/XaraLX/wxOil/camelot.cpp (revision 1106)
+++ Trunk/XaraLX/wxOil/camelot.cpp (revision 1107)
@@ -159,6 +159,7 @@
********************************************************************************************/
BOOL CCamApp::MainWndMaximized = FALSE;
+
/********************************************************************************************
Preference: MainWndMin
@@ -172,6 +173,7 @@
********************************************************************************************/
BOOL CCamApp::MainWndMinimized = FALSE;
+
/********************************************************************************************
Preference: MainWndPos
@@ -183,6 +185,20 @@
********************************************************************************************/
String_256 CCamApp::MainWndPosString;
+
+/********************************************************************************************
+
+ Preference: FirstRun
+ Section: Preferences
+ Range: 0 (FALSE) or 1 (TRUE)
+ Purpose: If 1 then this is the first time this application has been run with
+ this set of preferences
+ If 0 then it has been run before
+
+********************************************************************************************/
+BOOL CCamApp::bFirstRun = TRUE;
+
+
/***************************************************************************************************************************/
//
// Timer used for background redraw.
@@ -520,6 +536,34 @@
m_docManager->FileHistoryLoad(Preferences::GetOilPrefs());
#endif
+ // --------------------------------------------------------------------------
+ // Detect first-time run and make Open File dialog default to Examples folder
+ if (Camelot.DeclareSection(TEXT("Preferences"), 10))
+ {
+ Camelot.DeclarePref(NULL, TEXT("FirstRun"), &bFirstRun, 0, 1);
+ }
+
+ if (bFirstRun)
+ {
+ // Set File Open dialog location to our Examples folder
+ PSTR pszDataPath = br_find_data_dir("/usr/share");
+ wxString strConfigPath(pszDataPath, wxConvUTF8);
+ free(pszDataPath);
+ strConfigPath += _T("/xaralx/Examples");
+
+#if defined(_DEBUG)
+ // Debug-only fallback
+ if (!wxDir::Exists(strConfigPath))
+ strConfigPath = _T("/usr/share/xaralx/Examples");
+#endif
+
+ if (wxDir::Exists(strConfigPath))
+ m_docManager->SetLastDirectory(strConfigPath);
+ }
+
+ // NOTE! Set bFirstRun = FALSE in OnExit handler below
+ // --------------------------------------------------------------------------
+
// Set idles to only get sent to windows that want them
wxIdleEvent::SetMode(wxIDLE_PROCESS_SPECIFIED);
@@ -710,6 +754,8 @@
#endif
m_docManager = std::auto_ptr<wxDocManager>( NULL );
+ bFirstRun = FALSE;
+
// Now deinit everything
CXMLUtils::DeInitialise();
Xara