[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]
[XaraXtreme-commits] Commit Complete
Commit by : luke
Repository : xara
Revision : 1128
Date : Fri May 19 13:48:15 BST 2006
Changed paths:
M /Trunk/XaraLX/Kernel/app.cpp
M /Trunk/XaraLX/Kernel/menuops.cpp
M /Trunk/XaraLX/wxOil/camdoc.cpp
M /Trunk/XaraLX/wxOil/camelot.cpp
M /Trunk/XaraLX/wxOil/fileutil.cpp
M /Trunk/XaraLX/wxOil/menucmds.cpp
M /Trunk/XaraLX/wxOil/sgliboil.cpp
M /Trunk/XaraLX/wxOil/xrc/EN/resimmap-strings.xrc
Enable discover and loading of templates from template directory (there's a bug with initial display of new file, see BZ#1084)
Diff:
Index: Trunk/XaraLX/Kernel/app.cpp
===================================================================
--- Trunk/XaraLX/Kernel/app.cpp (revision 1127)
+++ Trunk/XaraLX/Kernel/app.cpp (revision 1128)
@@ -613,14 +613,11 @@
//exe path with " emplates\" on the end
if (m_TemplatesPath.IsEmpty())
{
- PORTNOTETRACE("other","Application::LateInit - do nothing");
-#ifndef EXCLUDE_FROM_XARALX
- TCHAR Pathname[MAX_PATH];
- if( GetModuleFileName(NULL, Pathname, MAX_PATH) == 0 )
- return FALSE;
+ std::auto_ptr<char> Pathname( br_find_data_dir( "/usr/share" ) );
// Put the path name into a string
- String_256 strPathname(Pathname);
+ String_256 strPathname( Pathname.get() );
+ strPathname += _T("/xarlx/doc/");
PathName ModulePath(strPathname);
m_TemplatesPath = ModulePath.GetLocation(TRUE);
@@ -629,6 +626,10 @@
String_256 strRelativePath(_R(IDS_NEWTEMPLATES_RELATIVEPATH));
m_TemplatesPath+=strRelativePath;
+
+#if defined(_DEBUG)
+ if( !wxDir::Exists( m_TemplatesPath ) )
+ m_TemplatesPath = _T("/usr/share/xaralx/doc/Templates/");
#endif
}
Index: Trunk/XaraLX/Kernel/menuops.cpp
===================================================================
--- Trunk/XaraLX/Kernel/menuops.cpp (revision 1127)
+++ Trunk/XaraLX/Kernel/menuops.cpp (revision 1128)
@@ -549,7 +549,6 @@
//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);
Index: Trunk/XaraLX/wxOil/menucmds.cpp
===================================================================
--- Trunk/XaraLX/wxOil/menucmds.cpp (revision 1127)
+++ Trunk/XaraLX/wxOil/menucmds.cpp (revision 1128)
@@ -252,8 +252,6 @@
void FileNewTemplateAction(INT32 iNumberOfTemplate)
{
-PORTNOTETRACE("other", "FileNewTemplateAction does nothing");
-#if !defined(EXCLUDE_FROM_XARALX)
//First we must find the name of the template to use
//So search through the templates directory
@@ -305,11 +303,12 @@
CCamDoc::SetNextTemplateToUse(pathTemplates);
- AfxGetApp().OnFileNew();
+ // OnFileOpen needs an event, but doesn't use it
+ wxCommandEvent event;
+ AfxGetApp().GetDocumentManager()->OnFileNew( event );
CCamDoc::EnableRemoveUntouchedDocs(); // Next idle event will try ro get rid of
// the auto-created startup document
-#endif
}
Index: Trunk/XaraLX/wxOil/sgliboil.cpp
===================================================================
--- Trunk/XaraLX/wxOil/sgliboil.cpp (revision 1127)
+++ Trunk/XaraLX/wxOil/sgliboil.cpp (revision 1128)
@@ -2861,8 +2861,8 @@
return;
if(Str->Length() > 0)
- if( ((TCHAR *)*Str)[Str->Length()-1] != '\' )
- *Str += TEXT("\");
+ if( ((TCHAR *)*Str)[Str->Length()-1] != '/' )
+ *Str += TEXT("/");
}
Index: Trunk/XaraLX/wxOil/camelot.cpp
===================================================================
--- Trunk/XaraLX/wxOil/camelot.cpp (revision 1127)
+++ Trunk/XaraLX/wxOil/camelot.cpp (revision 1128)
@@ -505,6 +505,9 @@
if( !InitKernel() )
return false;
+ if( !Camelot.LateInit() )
+ return false;
+
TRACET(_T("CCamApp::Calling GRenderRegion::Init"));
if (!GRenderRegion::Init(true))
return false;
Index: Trunk/XaraLX/wxOil/camdoc.cpp
===================================================================
--- Trunk/XaraLX/wxOil/camdoc.cpp (revision 1127)
+++ Trunk/XaraLX/wxOil/camdoc.cpp (revision 1128)
@@ -361,9 +361,12 @@
CCLexFile *pFile;
if (Filename)
{
- // Found a disk file, use that.
-// pFile = new CCDiskFile(PathName(Filename), ios::in | ios::binary);
- pFile = res.Open(Filename);
+ if( wxFile::Exists( Filename ) )
+ // Found a disk file, use that.
+ pFile = new CCDiskFile(PathName(Filename), ios::in | ios::binary);
+ else
+ // Else we fall back to memory
+ pFile = res.Open(Filename);
}
else
{
Index: Trunk/XaraLX/wxOil/xrc/EN/resimmap-strings.xrc
===================================================================
--- Trunk/XaraLX/wxOil/xrc/EN/resimmap-strings.xrc (revision 1127)
+++ Trunk/XaraLX/wxOil/xrc/EN/resimmap-strings.xrc (revision 1128)
@@ -457,7 +457,7 @@
<object class="sizeritem">
<flag>wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE</flag>
<object class="wxStaticText" name="IDS_NEWTEMPLATES_RELATIVEPATH">
- <label>templates\</label>
+ <label>Templates/</label>
</object>
</object>
<object class="sizeritem">
Index: Trunk/XaraLX/wxOil/fileutil.cpp
===================================================================
--- Trunk/XaraLX/wxOil/fileutil.cpp (revision 1127)
+++ Trunk/XaraLX/wxOil/fileutil.cpp (revision 1128)
@@ -280,12 +280,13 @@
while (result)
{
wxString strFileName;
-
+
if( !s_fStarted )
{
// find first
- result = s_dirSearch.Open( wxGetCwd() );
- result = result && s_dirSearch.GetFirst( &strFileName, (PCTSTR)SearchPath, wxDIR_FILES );
+ PathName path( SearchPath );
+ result = s_dirSearch.Open( path.GetLocation() );
+ result = result && s_dirSearch.GetFirst( &strFileName, (PCTSTR)path.GetFileName(), wxDIR_FILES );
s_fStarted = result;
}
else
Xara