version 1.130, 2007/04/03 10:10:57
|
version 1.131, 2007/04/16 14:54:56
|
Line 35
|
Line 35
|
#include "init_f.h" |
#include "init_f.h" |
#include "wxdialogapi_f.h" |
#include "wxdialogapi_f.h" |
#include "AHTURLTools_f.h" |
#include "AHTURLTools_f.h" |
|
|
#endif /* TEMPLATES */ |
#endif /* TEMPLATES */ |
|
|
|
|
#include "fetchXMLname_f.h" |
#include "fetchXMLname_f.h" |
#include "MENUconf.h" |
#include "MENUconf.h" |
|
|
|
|
/* Paths from which looking for templates.*/ |
/* Paths from which looking for templates.*/ |
static Prop_Templates_Path *TemplateRepositoryPaths; |
static Prop_Templates_Path *TemplateRepositoryPaths; |
|
|
|
|
/*---------------------------------------------------------------------- |
/*---------------------------------------------------------------------- |
IsTemplateInstanceDocument: Test if a document is a template instance |
IsTemplateInstanceDocument: Test if a document is a template instance |
doc : Document to test |
doc : Document to test |
Line 104 void* AllocTemplateRepositoryListElement
|
Line 100 void* AllocTemplateRepositoryListElement
|
----------------------------------------------------------------------*/ |
----------------------------------------------------------------------*/ |
void FreeTemplateRepositoryList (void* list) |
void FreeTemplateRepositoryList (void* list) |
{ |
{ |
Prop_Templates_Path** l = (Prop_Templates_Path**) list; |
Prop_Templates_Path **l = (Prop_Templates_Path**) list; |
|
Prop_Templates_Path *element = *l; |
Prop_Templates_Path* element = *l; |
|
l = NULL; |
l = NULL; |
while (element) |
while (element) |
{ |
{ |
Prop_Templates_Path* next = element->NextPath; |
Prop_Templates_Path* next = element->NextPath; |
TtaFreeMemory(element); |
TtaFreeMemory (element); |
element = next; |
element = next; |
} |
} |
} |
} |
Line 126 static void CopyTemplateRepositoryList (
|
Line 122 static void CopyTemplateRepositoryList (
|
{ |
{ |
Prop_Templates_Path *element=NULL, *current=NULL; |
Prop_Templates_Path *element=NULL, *current=NULL; |
|
|
if (*src!=NULL) |
if (*src) |
{ |
{ |
*dst = (Prop_Templates_Path*) TtaGetMemory (sizeof(Prop_Templates_Path)); |
*dst = (Prop_Templates_Path*) TtaGetMemory (sizeof(Prop_Templates_Path)); |
(*dst)->NextPath = NULL; |
(*dst)->NextPath = NULL; |
Line 159 static int LoadTemplateRepositoryList (P
|
Line 155 static int LoadTemplateRepositoryList (P
|
int nb = 0; |
int nb = 0; |
FILE *file; |
FILE *file; |
|
|
FreeTemplateRepositoryList(list); |
//clean up the curent list |
|
FreeTemplateRepositoryList (list); |
|
|
|
// open the file |
path = (char *) TtaGetMemory (MAX_LENGTH); |
path = (char *) TtaGetMemory (MAX_LENGTH); |
homePath = TtaGetEnvString ("APP_HOME"); |
homePath = TtaGetEnvString ("APP_HOME"); |
sprintf (path, "%s%ctemplates.dat", homePath, DIR_SEP); |
sprintf (path, "%s%ctemplates.dat", homePath, DIR_SEP); |
|
|
file = TtaReadOpen ((char *)path); |
file = TtaReadOpen ((char *)path); |
if (!file) |
if (!file) |
{ |
{ |
Line 178 static int LoadTemplateRepositoryList (P
|
Line 175 static int LoadTemplateRepositoryList (P
|
|
|
if (file) |
if (file) |
{ |
{ |
|
// read the file |
c = (unsigned char*)path; |
c = (unsigned char*)path; |
*c = EOS; |
*c = EOS; |
while (TtaReadByte (file, c)) |
while (TtaReadByte (file, c)) |
Line 280 void SetTemplateRepositoryList (const vo
|
Line 278 void SetTemplateRepositoryList (const vo
|
void InitTemplates () |
void InitTemplates () |
{ |
{ |
TtaSetEnvBoolean ("SHOW_TEMPLATES", TRUE, FALSE); |
TtaSetEnvBoolean ("SHOW_TEMPLATES", TRUE, FALSE); |
LoadTemplateRepositoryList(&TemplateRepositoryPaths); |
LoadTemplateRepositoryList (&TemplateRepositoryPaths); |
} |
} |
|
|
|
|
Line 290 void InitTemplates ()
|
Line 288 void InitTemplates ()
|
void NewTemplate (Document doc, View view) |
void NewTemplate (Document doc, View view) |
{ |
{ |
#ifdef TEMPLATES |
#ifdef TEMPLATES |
char *templateDir = TtaGetEnvString ("TEMPLATES_DIRECTORY"); |
|
ThotBool created; |
ThotBool created; |
|
|
if (Templates_Dic == NULL) |
if (Templates_Dic == NULL) |
InitializeTemplateEnvironment (); |
InitializeTemplateEnvironment (); |
created = CreateNewTemplateDocDlgWX (BaseDialog + OpenTemplate, |
created = CreateNewTemplateDocDlgWX (BaseDialog + OpenTemplate, |
/*TtaGetViewFrame (doc, view)*/NULL, doc, |
/*TtaGetViewFrame (doc, view)*/NULL, doc, |
TtaGetMessage (AMAYA, AM_NEW_TEMPLATE),templateDir); |
TtaGetMessage (AMAYA, AM_NEW_TEMPLATE)); |
|
|
if (created) |
if (created) |
{ |
{ |