[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]
[XaraXtreme-commits] Commit Complete
Commit by : phil
Repository : xara
Revision : 1157
Date : Mon May 22 12:40:40 BST 2006
Changed paths:
M /Trunk/XaraLX/Kernel/menuops.cpp
Re-instated Luke's R1150 change...
Diff:
Index: Trunk/XaraLX/Kernel/menuops.cpp
===================================================================
--- Trunk/XaraLX/Kernel/menuops.cpp (revision 1156)
+++ Trunk/XaraLX/Kernel/menuops.cpp (revision 1157)
@@ -578,29 +578,39 @@
String_256 strPathOfAnimationTemplate=GetDefaultAnimationTemplate().GetPath(FALSE);
String_256 strPathOfFile;
- for (INT32 i=0; i<iNumberOfTemplate; i++)
+ TRACEUSER( "jlh92", _T("DefPath = %s, %s
"), PCTSTR(strPathOfDrawingTemplate),
+ PCTSTR(strPathOfAnimationTemplate) );
+
+ std::set<String_256> setSortFilename;
+
+ while( FileUtil::FindNextFile( &strNameOfFile ) )
{
- do
+ pathOfFile.SetFileNameAndType(strNameOfFile);
+ strPathOfFile=pathOfFile.GetFileName(TRUE);
+
+ if( 0 != strPathOfFile.CompareTo( strPathOfDrawingTemplate, FALSE ) &&
+ 0 != strPathOfFile.CompareTo( strPathOfAnimationTemplate, FALSE ) )
{
- if (!FileUtil::FindNextFile(&strNameOfFile))
- {
- //We failed to find a template. So remove this
- //item from the menu.
- FileUtil::StopFindingFiles();
- // Don't allow any errors set while searching to propagate outside this scope
- Error::ClearError();
- return OpState(FALSE, FALSE, TRUE);
- }
-
- pathOfFile.SetFileNameAndType(strNameOfFile);
- strPathOfFile=pathOfFile.GetPath(FALSE);
+ setSortFilename.insert( strPathOfFile );
+ TRACEUSER( "jlh92", _T("Curr = %s
"), PCTSTR(strPathOfFile) );
}
- while (strPathOfFile.CompareTo(strPathOfDrawingTemplate, FALSE)==0 ||
- strPathOfFile.CompareTo(strPathOfAnimationTemplate, FALSE)==0);
}
-
FileUtil::StopFindingFiles();
+ if( iNumberOfTemplate >= setSortFilename.size() )
+ {
+ // Don't allow any errors set while searching to propagate outside this scope
+ Error::ClearError();
+ return OpState(FALSE, FALSE, TRUE);
+ }
+
+ std::set<String_256>::iterator iter = setSortFilename.begin();
+ for( INT32 i = 1; i < iNumberOfTemplate; ++i, ++iter )
+ { /*Do nothing!*/ }
+
+ strNameOfFile = *iter;
+ TRACEUSER( "jlh92", _T("Final(%d) = %s
"), iNumberOfTemplate, PCTSTR(strPathOfFile) );
+
//We've found a file. So strip the .xar from the name, as follows...
pathTemplates.SetFileNameAndType(strNameOfFile);
*UIDescription=pathTemplates.GetFileName(FALSE);
@@ -1201,7 +1211,7 @@
FileNewTemplateAction(7);
else if ((WhichOp->Token) == String(OPTOKEN_FILENEW_TEMPLATE8))
FileNewTemplateAction(8);
- else if ((WhichOp->Token) == String(OPTOKEN_FILENEW_TEMPLATE9))
+ else if ((WhichOp->Token) == String(OPTOKEN_FILENEW_TEMPLATE9))
FileNewTemplateAction(9);
else if ((WhichOp->Token) == String(OPTOKEN_FILENEW_TEMPLATE10))
FileNewTemplateAction(10);
@@ -1586,7 +1596,7 @@
// REGOP(HELP, DEMOS, HelpOps);
-PORTNOTE("Movies", "Removed link to demo movies until we have some worth linking to")
+PORTNOTE("movies", "Removed use of movies until we have some")
#if 0
OpDescriptor* DemosOp = new OpDescriptor(
0,
Xara