[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]
[XaraXtreme-commits] Commit Complete
Commit by : luke
Repository : xara
Revision : 1055
Date : Mon May 15 16:05:11 BST 2006
Changed paths:
M /Trunk/XaraLX/Kernel/menuops.cpp
M /Trunk/XaraLX/wxOil/fileutil.cpp
M /Trunk/XaraLX/wxOil/fileutil.h
Re-enable code to restore template functionality to a par with Camelot
Diff:
Index: Trunk/XaraLX/Kernel/menuops.cpp
===================================================================
--- Trunk/XaraLX/Kernel/menuops.cpp (revision 1054)
+++ Trunk/XaraLX/Kernel/menuops.cpp (revision 1055)
@@ -541,8 +541,6 @@
pOp->Token == String(OPTOKEN_FILENEW_TEMPLATE9) ||
pOp->Token == String(OPTOKEN_FILENEW_TEMPLATE10))
{
-PORTNOTE("other","Remove template determination - needed find file from FileUtil")
-#ifndef EXCLUDE_FROM_XARALX
//First find the default template path
Application* pApplication=GetApplication();
@@ -551,6 +549,7 @@
//Now search that path for templates
//Start by setting the leaf name to *.xar
String_256 strSearchFilename(_R(IDS_NEWTEMPLATES_DEFAULTTEMPLATEEXTENSION));
+ TRACEUSER( "jlh92", _T("Search = %s
"), (PCTSTR)strSearchFilename );
pathTemplates.SetFileNameAndType(strSearchFilename);
@@ -558,8 +557,9 @@
//(This code isn't particularly pleasant)
String_256 strNumberOfTemplate;
- INT32 iPositionOfFCharacter=pOp->Token.FindNextChar('F');
-
+ INT32 iPositionOfFCharacter=pOp->Token.FindNextChar( 'F', 0 );
+ TRACEUSER( "jlh92", _T("Token = %s(%d)
"), PCTSTR(pOp->Token), iPositionOfFCharacter );
+
pOp->Token.Left(&strNumberOfTemplate, iPositionOfFCharacter);
TCHAR* pszTmp;
@@ -573,6 +573,8 @@
String_256 strNameOfFile;
PathName pathOfFile=pathTemplates;
+ TRACEUSER( "jlh92", _T("SFF = true
") );
+
String_256 strPathOfDrawingTemplate=GetDefaultDrawingTemplate().GetPath(FALSE);
String_256 strPathOfAnimationTemplate=GetDefaultAnimationTemplate().GetPath(FALSE);
String_256 strPathOfFile;
@@ -606,7 +608,6 @@
return OpState(FALSE, FALSE, FALSE);
}
-#endif
}
// File/SaveAll is only available if there is a document that is "dirty".
Index: Trunk/XaraLX/wxOil/fileutil.h
===================================================================
--- Trunk/XaraLX/wxOil/fileutil.h (revision 1054)
+++ Trunk/XaraLX/wxOil/fileutil.h (revision 1055)
@@ -159,11 +159,9 @@
private: // Private data
static BOOL SearchActive;
+ static bool s_fStarted;
static String_256 SearchPath;
-#if defined(__WXMSW__)
- static HANDLE SearchHandle;
- static WIN32_FIND_DATA SearchData;
-#endif
+ static wxDir s_dirSearch;
};
/****************************************************************************
Index: Trunk/XaraLX/wxOil/fileutil.cpp
===================================================================
--- Trunk/XaraLX/wxOil/fileutil.cpp (revision 1054)
+++ Trunk/XaraLX/wxOil/fileutil.cpp (revision 1055)
@@ -104,19 +104,18 @@
#include "pathname.h"
#include "sgliboil.h"
-PORTNOTE("other", "Removed lots of Windows'isms" )
-#if !defined(EXCLUDE_FROM_XARALX)
-
// Place any IMPLEMENT type statements here
CC_IMPLEMENT_MEMDUMP(FindFiles, CC_CLASS_MEMDUMP);
#define new CAM_DEBUG_NEW
-BOOL FileUtil::SearchActive = FALSE;
-String_256 FileUtil::SearchPath = TEXT("");
-HANDLE FileUtil::SearchHandle = INVALID_HANDLE_VALUE;
-WIN32_FIND_DATA FileUtil::SearchData;
+BOOL FileUtil::SearchActive = FALSE;
+bool FileUtil::s_fStarted = false;
+String_256 FileUtil::SearchPath = TEXT("");
+wxDir FileUtil::s_dirSearch;
+PORTNOTE("other", "Removed lots of Windows'isms" )
+#if !defined(EXCLUDE_FROM_XARALX)
/******************************************************************************
@@ -172,8 +171,8 @@
return Found;
}
+#endif
-
/********************************************************************************************
> static BOOL FileUtil::StartFindingFiles(String_256 *FileSpecifier)
@@ -229,10 +228,8 @@
return(FALSE);
}
- ERROR3IF(SearchHandle != INVALID_HANDLE_VALUE, "Something is fishy with me search handle");
-
SearchActive = TRUE;
- SearchHandle = INVALID_HANDLE_VALUE;
+ s_fStarted = false;
SearchPath = *FileSpecifier;
return(TRUE);
@@ -282,27 +279,33 @@
while (result)
{
- if (SearchHandle == INVALID_HANDLE_VALUE)
+ wxString strFileName;
+
+ if( !s_fStarted )
{
// find first
- SearchHandle = ::FindFirstFile((TCHAR *)SearchPath, &SearchData);
- result = (SearchHandle != INVALID_HANDLE_VALUE);
+ result = s_dirSearch.Open( wxGetCwd() );
+ result = result && s_dirSearch.GetFirst( &strFileName, (PCTSTR)SearchPath, wxDIR_FILES );
+ s_fStarted = result;
}
else
{
// find next
- result = ::FindNextFile(SearchHandle, &SearchData);
+ result = s_dirSearch.GetNext( &strFileName );
}
if (result)
{
+PORTNOTE("other", "This is part of initial GetFirst" )
+#if !defined(EXCLUDE_FROM_XARALX)
// Only return "files" which are not system or hidden, and which aren't directories!
const DWORD AttrMask = FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM;
if ((SearchData.dwFileAttributes & AttrMask) == 0)
+#endif
{
// OK, it's a safe file to return, so return it
- *FoundFile = SearchData.cFileName;
+ *FoundFile = (PCTSTR)strFileName;
return(TRUE);
}
}
@@ -339,13 +342,13 @@
void FileUtil::StopFindingFiles(void)
{
ERROR3IF(!SearchActive, "StopFindingFiles called when StartFindingFiles not called/failed");
- if (SearchActive && SearchHandle != NULL)
- ::FindClose(SearchHandle);
- SearchHandle = INVALID_HANDLE_VALUE;
+ s_fStarted = false;
SearchActive = FALSE;
}
+PORTNOTE("other", "Removed lots of Windows'isms" )
+#if !defined(EXCLUDE_FROM_XARALX)
/********************************************************************************************
Xara