version 1.82, 2001/03/16 12:05:19
|
version 1.83, 2001/03/16 16:40:25
|
Line 45 ThotBool WithToC;
|
Line 45 ThotBool WithToC;
|
ThotBool IgnoreCSS; |
ThotBool IgnoreCSS; |
|
|
static struct _SubDoc *SubDocs; |
static struct _SubDoc *SubDocs; |
static CHAR_T PSfile[MAX_PATH]; |
static char PSfile[MAX_PATH]; |
static CHAR_T PPrinter[MAX_PATH]; |
static char PPrinter[MAX_PATH]; |
static STRING DocPrintURL; |
static STRING DocPrintURL; |
static Document DocPrint; |
static Document DocPrint; |
static int PaperPrint; |
static int PaperPrint; |
Line 81 static void RegisterSubDoc (Elem
|
Line 81 static void RegisterSubDoc (Elem
|
entry = TtaGetMemory (sizeof (struct _SubDoc)); |
entry = TtaGetMemory (sizeof (struct _SubDoc)); |
entry->SDnext = NULL; |
entry->SDnext = NULL; |
entry->SDel = el; |
entry->SDel = el; |
entry->SDname = TtaWCSdup (url); |
entry->SDname = TtaStrdup (url); |
|
|
if (SubDocs == NULL) |
if (SubDocs == NULL) |
SubDocs = entry; |
SubDocs = entry; |
Line 114 static Element SearchSubDoc (STRING
|
Line 114 static Element SearchSubDoc (STRING
|
el = NULL; |
el = NULL; |
while (!docFound && entry != NULL) |
while (!docFound && entry != NULL) |
{ |
{ |
docFound = (ustrcmp (url, entry->SDname) == 0); |
docFound = (strcmp (url, entry->SDname) == 0); |
if (!docFound) |
if (!docFound) |
entry = entry->SDnext; |
entry = entry->SDnext; |
else |
else |
Line 159 void SetInternalLinks (Docum
|
Line 159 void SetInternalLinks (Docum
|
Attribute attr, ExtLinkAttr; |
Attribute attr, ExtLinkAttr; |
AttributeType attrType; |
AttributeType attrType; |
STRING text, ptr, url; |
STRING text, ptr, url; |
CHAR_T number[10]; |
char number[10]; |
CHAR_T value[MAX_LENGTH]; |
char value[MAX_LENGTH]; |
int length, i, volume; |
int length, i, volume; |
int status, position; |
int status, position; |
ThotBool split; |
ThotBool split; |
Line 192 void SetInternalLinks (Docum
|
Line 192 void SetInternalLinks (Docum
|
while (sibling != NULL); |
while (sibling != NULL); |
el = TtaGetParent (el); |
el = TtaGetParent (el); |
} |
} |
usprintf (number, "%d", position*100/volume); |
sprintf (number, "%d", position*100/volume); |
TtaSetStatus (document, 1, TtaGetMessage (AMAYA, AM_UPDATED_LINK), number); |
TtaSetStatus (document, 1, TtaGetMessage (AMAYA, AM_UPDATED_LINK), number); |
TtaHandlePendingEvents (); |
TtaHandlePendingEvents (); |
link = TtaSearchTypedElement (elType, SearchForward, link); |
link = TtaSearchTypedElement (elType, SearchForward, link); |
Line 223 void SetInternalLinks (Docum
|
Line 223 void SetInternalLinks (Docum
|
/* this element has an HREF or cite attribute */ |
/* this element has an HREF or cite attribute */ |
{ |
{ |
length = TtaGetTextAttributeLength (HrefAttr); |
length = TtaGetTextAttributeLength (HrefAttr); |
text = TtaAllocString (length + 1); |
text = TtaGetMemory (length + 1); |
TtaGiveTextAttributeValue (HrefAttr, text, &length); |
TtaGiveTextAttributeValue (HrefAttr, text, &length); |
|
|
/* does an external link become an internal link ? */ |
/* does an external link become an internal link ? */ |
if (document == DocBook && SubDocs != NULL) |
if (document == DocBook && SubDocs != NULL) |
{ |
{ |
ptr = ustrrchr (text, '#'); |
ptr = strrchr (text, '#'); |
url = text; |
url = text; |
split = FALSE; |
split = FALSE; |
if (ptr == text) |
if (ptr == text) |
Line 264 void SetInternalLinks (Docum
|
Line 264 void SetInternalLinks (Docum
|
if (ptr != NULL) |
if (ptr != NULL) |
{ |
{ |
/* get the target name */ |
/* get the target name */ |
ustrcpy (value, ptr); |
strcpy (value, ptr); |
length = ustrlen (value); |
length = strlen (value); |
/* check whether the name changed */ |
/* check whether the name changed */ |
i = 0; |
i = 0; |
target = SearchNAMEattribute (document, &value[1], NULL); |
target = SearchNAMEattribute (document, &value[1], NULL); |
Line 278 void SetInternalLinks (Docum
|
Line 278 void SetInternalLinks (Docum
|
{ |
{ |
/* continue the search */ |
/* continue the search */ |
i++; |
i++; |
usprintf (&value[length], "%d", i); |
sprintf (&value[length], "%d", i); |
target = SearchNAMEattribute (document, |
target = SearchNAMEattribute (document, |
&value[1], NULL); |
&value[1], NULL); |
} |
} |
Line 348 void SetInternalLinks (Docum
|
Line 348 void SetInternalLinks (Docum
|
----------------------------------------------------------------------*/ |
----------------------------------------------------------------------*/ |
static void CheckPrintingDocument (Document document) |
static void CheckPrintingDocument (Document document) |
{ |
{ |
CHAR_T docName[MAX_LENGTH]; |
char docName[MAX_LENGTH]; |
CHAR_T *ptr; |
char *ptr; |
CHAR_T suffix[MAX_LENGTH]; |
char suffix[MAX_LENGTH]; |
int lg; |
int lg; |
|
|
if (DocPrint != document || DocPrintURL == NULL || |
if (DocPrint != document || DocPrintURL == NULL || |
ustrcmp(DocPrintURL, DocumentURLs[document])) |
strcmp(DocPrintURL, DocumentURLs[document])) |
{ |
{ |
/* initialize print parameters */ |
/* initialize print parameters */ |
TtaFreeMemory (DocPrintURL); |
TtaFreeMemory (DocPrintURL); |
Line 364 static void CheckPrintingDocumen
|
Line 364 static void CheckPrintingDocumen
|
/* define the new default PS file */ |
/* define the new default PS file */ |
ptr = TtaGetEnvString ("APP_TMPDIR"); |
ptr = TtaGetEnvString ("APP_TMPDIR"); |
if (ptr != NULL && TtaCheckDirectory (ptr)) |
if (ptr != NULL && TtaCheckDirectory (ptr)) |
ustrcpy (PSfile, ptr); |
strcpy (PSfile, ptr); |
else |
else |
ustrcpy (PSfile, TtaGetDefEnvString ("APP_TMPDIR")); |
strcpy (PSfile, TtaGetDefEnvString ("APP_TMPDIR")); |
lg = ustrlen (PSfile); |
lg = strlen (PSfile); |
if (PSfile[lg - 1] == WC_DIR_SEP) |
if (PSfile[lg - 1] == DIR_SEP) |
PSfile[--lg] = WC_EOS; |
PSfile[--lg] = EOS; |
ustrcpy (docName, TtaGetDocumentName (document)); |
strcpy (docName, TtaGetDocumentName (document)); |
ExtractSuffix (docName, suffix); |
ExtractSuffix (docName, suffix); |
usprintf (&PSfile[lg], "%c%s.ps", WC_DIR_SEP, docName); |
sprintf (&PSfile[lg], "%c%s.ps", DIR_SEP, docName); |
TtaSetPsFile (PSfile); |
TtaSetPsFile (PSfile); |
} |
} |
} |
} |
Line 387 static void PrintDocument (Docum
|
Line 387 static void PrintDocument (Docum
|
Attribute attr; |
Attribute attr; |
Element el; |
Element el; |
STRING files, dir; |
STRING files, dir; |
CHAR_T viewsToPrint[MAX_PATH]; |
char viewsToPrint[MAX_PATH]; |
ThotBool status, textFile; |
ThotBool status, textFile; |
|
|
textFile = (DocumentTypes[doc] == docText || |
textFile = (DocumentTypes[doc] == docText || |
Line 396 static void PrintDocument (Docum
|
Line 396 static void PrintDocument (Docum
|
|
|
/* initialize printing information */ |
/* initialize printing information */ |
CheckPrintingDocument (doc); |
CheckPrintingDocument (doc); |
ustrcpy (viewsToPrint, "Formatted_view "); |
strcpy (viewsToPrint, "Formatted_view "); |
if (DocumentTypes[doc] == docHTML && WithToC) |
if (DocumentTypes[doc] == docHTML && WithToC) |
ustrcat (viewsToPrint, "Table_of_contents "); |
strcat (viewsToPrint, "Table_of_contents "); |
|
|
if (textFile) |
if (textFile) |
{ |
{ |
Line 444 static void PrintDocument (Docum
|
Line 444 static void PrintDocument (Docum
|
else |
else |
TtaSetPrintSchema ("HTMLPLPUS"); |
TtaSetPrintSchema ("HTMLPLPUS"); |
} |
} |
ustrcat (viewsToPrint, "Links_view "); |
strcat (viewsToPrint, "Links_view "); |
} |
} |
else if (PageSize == PP_A4) |
else if (PageSize == PP_A4) |
{ |
{ |
Line 631 void CallbackPrint (int ref, int typedat
|
Line 631 void CallbackPrint (int ref, int typedat
|
{ |
{ |
if (PaperPrint == PP_PRINTER) |
if (PaperPrint == PP_PRINTER) |
/* text capture zone for the printer name */ |
/* text capture zone for the printer name */ |
ustrncpy (PPrinter, data, MAX_PATH); |
strncpy (PPrinter, data, MAX_PATH); |
else |
else |
/* text capture zone for the name of the PostScript file */ |
/* text capture zone for the name of the PostScript file */ |
ustrncpy (PSfile, data, MAX_PATH); |
strncpy (PSfile, data, MAX_PATH); |
} |
} |
break; |
break; |
} |
} |
Line 644 void CallbackPrint (int ref, int typedat
|
Line 644 void CallbackPrint (int ref, int typedat
|
----------------------------------------------------------------------*/ |
----------------------------------------------------------------------*/ |
void InitPrint (void) |
void InitPrint (void) |
{ |
{ |
CHAR_T* ptr; |
char* ptr; |
|
|
BasePrint = TtaSetCallback (CallbackPrint, PRINT_MAX_REF); |
BasePrint = TtaSetCallback (CallbackPrint, PRINT_MAX_REF); |
DocPrint = 0; |
DocPrint = 0; |
Line 653 void InitPrint (void)
|
Line 653 void InitPrint (void)
|
/* read default printer variable */ |
/* read default printer variable */ |
ptr = TtaGetEnvString ("THOTPRINT"); |
ptr = TtaGetEnvString ("THOTPRINT"); |
if (ptr == NULL) |
if (ptr == NULL) |
ustrcpy (PPrinter, ""); |
strcpy (PPrinter, ""); |
else |
else |
ustrcpy (PPrinter, ptr); |
strcpy (PPrinter, ptr); |
TtaSetPrintCommand (PPrinter); |
TtaSetPrintCommand (PPrinter); |
PaperPrint = PP_PRINTER; |
PaperPrint = PP_PRINTER; |
TtaSetPrintParameter (PP_Destination, PaperPrint); |
TtaSetPrintParameter (PP_Destination, PaperPrint); |
Line 680 void InitPrint (void)
|
Line 680 void InitPrint (void)
|
void SetupAndPrint (Document doc, View view) |
void SetupAndPrint (Document doc, View view) |
{ |
{ |
#ifndef _WINDOWS |
#ifndef _WINDOWS |
CHAR_T bufMenu[MAX_LENGTH]; |
char bufMenu[MAX_LENGTH]; |
int i; |
int i; |
#endif /* !_WINDOWS */ |
#endif /* !_WINDOWS */ |
ThotBool textFile; |
ThotBool textFile; |
Line 697 void SetupAndPrint (Docum
|
Line 697 void SetupAndPrint (Docum
|
/* Paper format submenu */ |
/* Paper format submenu */ |
i = 0; |
i = 0; |
sprintf (&bufMenu[i], "%s%s", "B", TtaGetMessage (LIB, TMSG_A4)); |
sprintf (&bufMenu[i], "%s%s", "B", TtaGetMessage (LIB, TMSG_A4)); |
i += ustrlen (&bufMenu[i]) + 1; |
i += strlen (&bufMenu[i]) + 1; |
sprintf (&bufMenu[i], "%s%s", "B", TtaGetMessage (LIB, TMSG_US)); |
sprintf (&bufMenu[i], "%s%s", "B", TtaGetMessage (LIB, TMSG_US)); |
TtaNewSubmenu (BasePrint + PaperFormat, BasePrint + FormPrint, 0, |
TtaNewSubmenu (BasePrint + PaperFormat, BasePrint + FormPrint, 0, |
TtaGetMessage (LIB, TMSG_PAPER_SIZE), 2, bufMenu, NULL, TRUE); |
TtaGetMessage (LIB, TMSG_PAPER_SIZE), 2, bufMenu, NULL, TRUE); |
Line 709 void SetupAndPrint (Docum
|
Line 709 void SetupAndPrint (Docum
|
/* Orientation submenu */ |
/* Orientation submenu */ |
i = 0; |
i = 0; |
sprintf (&bufMenu[i], "%s%s", "B", TtaGetMessage (AMAYA, AM_PORTRAIT)); |
sprintf (&bufMenu[i], "%s%s", "B", TtaGetMessage (AMAYA, AM_PORTRAIT)); |
i += ustrlen (&bufMenu[i]) + 1; |
i += strlen (&bufMenu[i]) + 1; |
sprintf (&bufMenu[i], "%s%s", "B", TtaGetMessage (AMAYA, AM_LANDSCAPE)); |
sprintf (&bufMenu[i], "%s%s", "B", TtaGetMessage (AMAYA, AM_LANDSCAPE)); |
TtaNewSubmenu (BasePrint + PaperOrientation, BasePrint + FormPrint, 0, |
TtaNewSubmenu (BasePrint + PaperOrientation, BasePrint + FormPrint, 0, |
TtaGetMessage (AMAYA, AM_ORIENTATION), 2, bufMenu, NULL, TRUE); |
TtaGetMessage (AMAYA, AM_ORIENTATION), 2, bufMenu, NULL, TRUE); |
Line 720 void SetupAndPrint (Docum
|
Line 720 void SetupAndPrint (Docum
|
/* Pages per sheet submenu */ |
/* Pages per sheet submenu */ |
i = 0; |
i = 0; |
sprintf (&bufMenu[i], "%s%s", "B", TtaGetMessage (LIB, TMSG_1_PAGE_SHEET)); |
sprintf (&bufMenu[i], "%s%s", "B", TtaGetMessage (LIB, TMSG_1_PAGE_SHEET)); |
i += ustrlen (&bufMenu[i]) + 1; |
i += strlen (&bufMenu[i]) + 1; |
sprintf (&bufMenu[i], "%s%s", "B", TtaGetMessage (LIB, TMSG_2_PAGE_SHEET)); |
sprintf (&bufMenu[i], "%s%s", "B", TtaGetMessage (LIB, TMSG_2_PAGE_SHEET)); |
i += ustrlen (&bufMenu[i]) + 1; |
i += strlen (&bufMenu[i]) + 1; |
sprintf (&bufMenu[i], "%s%s", "B", TtaGetMessage (LIB, TMSG_4_PAGE_SHEET)); |
sprintf (&bufMenu[i], "%s%s", "B", TtaGetMessage (LIB, TMSG_4_PAGE_SHEET)); |
TtaNewSubmenu (BasePrint + PPagesPerSheet, BasePrint + FormPrint, 0, |
TtaNewSubmenu (BasePrint + PPagesPerSheet, BasePrint + FormPrint, 0, |
TtaGetMessage (LIB, TMSG_REDUCTION), 3, bufMenu, NULL, TRUE); |
TtaGetMessage (LIB, TMSG_REDUCTION), 3, bufMenu, NULL, TRUE); |
Line 736 void SetupAndPrint (Docum
|
Line 736 void SetupAndPrint (Docum
|
/* Print to paper/ Print to file submenu */ |
/* Print to paper/ Print to file submenu */ |
i = 0; |
i = 0; |
sprintf (&bufMenu[i], "%s%s", "B", TtaGetMessage (LIB, TMSG_PRINTER)); |
sprintf (&bufMenu[i], "%s%s", "B", TtaGetMessage (LIB, TMSG_PRINTER)); |
i += ustrlen (&bufMenu[i]) + 1; |
i += strlen (&bufMenu[i]) + 1; |
sprintf (&bufMenu[i], "%s%s", "B", TtaGetMessage (LIB, TMSG_PS_FILE)); |
sprintf (&bufMenu[i], "%s%s", "B", TtaGetMessage (LIB, TMSG_PS_FILE)); |
TtaNewSubmenu (BasePrint + PrintSupport, BasePrint + FormPrint, 0, |
TtaNewSubmenu (BasePrint + PrintSupport, BasePrint + FormPrint, 0, |
TtaGetMessage (LIB, TMSG_OUTPUT), 2, bufMenu, NULL, TRUE); |
TtaGetMessage (LIB, TMSG_OUTPUT), 2, bufMenu, NULL, TRUE); |
Line 757 void SetupAndPrint (Docum
|
Line 757 void SetupAndPrint (Docum
|
/* The toggle */ |
/* The toggle */ |
i = 0; |
i = 0; |
sprintf (&bufMenu[i], "%s%s", "T", TtaGetMessage (LIB, TMSG_MANUAL_FEED)); |
sprintf (&bufMenu[i], "%s%s", "T", TtaGetMessage (LIB, TMSG_MANUAL_FEED)); |
i += ustrlen (&bufMenu[i]) + 1; |
i += strlen (&bufMenu[i]) + 1; |
sprintf (&bufMenu[i], "%s%s", "T", TtaGetMessage (AMAYA, AM_PRINT_TOC)); |
sprintf (&bufMenu[i], "%s%s", "T", TtaGetMessage (AMAYA, AM_PRINT_TOC)); |
i += ustrlen (&bufMenu[i]) + 1; |
i += strlen (&bufMenu[i]) + 1; |
sprintf (&bufMenu[i], "%s%s", "T", TtaGetMessage (AMAYA, AM_NUMBERED_LINKS)); |
sprintf (&bufMenu[i], "%s%s", "T", TtaGetMessage (AMAYA, AM_NUMBERED_LINKS)); |
i += ustrlen (&bufMenu[i]) + 1; |
i += strlen (&bufMenu[i]) + 1; |
sprintf (&bufMenu[i], "%s%s", "T", TtaGetMessage (AMAYA, AM_PRINT_URL)); |
sprintf (&bufMenu[i], "%s%s", "T", TtaGetMessage (AMAYA, AM_PRINT_URL)); |
i += ustrlen (&bufMenu[i]) + 1; |
i += strlen (&bufMenu[i]) + 1; |
sprintf (&bufMenu[i], "%s%s", "T", TtaGetMessage (AMAYA, AM_WITH_CSS)); |
sprintf (&bufMenu[i], "%s%s", "T", TtaGetMessage (AMAYA, AM_WITH_CSS)); |
TtaNewToggleMenu (BasePrint + PrintOptions, BasePrint + FormPrint, |
TtaNewToggleMenu (BasePrint + PrintOptions, BasePrint + FormPrint, |
TtaGetMessage (LIB, TMSG_OPTIONS), 5, bufMenu, NULL, FALSE); |
TtaGetMessage (LIB, TMSG_OPTIONS), 5, bufMenu, NULL, FALSE); |
Line 1096 static ThotBool GetIncludedDocuments (E
|
Line 1096 static ThotBool GetIncludedDocuments (E
|
if (attr) |
if (attr) |
{ |
{ |
length = TtaGetTextAttributeLength (attr); |
length = TtaGetTextAttributeLength (attr); |
text = TtaAllocString (length + 1); |
text = TtaGetMemory (length + 1); |
TtaGiveTextAttributeValue (attr, text, &length); |
TtaGiveTextAttributeValue (attr, text, &length); |
/* Valid rel values are rel="chapter" or rel="subdocument" */ |
/* Valid rel values are rel="chapter" or rel="subdocument" */ |
if (ustrcasecmp (text, "chapter") && |
if (strcasecmp (text, "chapter") && |
ustrcasecmp (text, "subdocument")) |
strcasecmp (text, "subdocument")) |
attr = NULL; |
attr = NULL; |
TtaFreeMemory (text); |
TtaFreeMemory (text); |
} |
} |
Line 1115 static ThotBool GetIncludedDocuments (E
|
Line 1115 static ThotBool GetIncludedDocuments (E
|
/* this link has an attribute HREF */ |
/* this link has an attribute HREF */ |
{ |
{ |
length = TtaGetTextAttributeLength (attr); |
length = TtaGetTextAttributeLength (attr); |
text = TtaAllocString (length + 1); |
text = TtaGetMemory (length + 1); |
TtaGiveTextAttributeValue (attr, text, &length); |
TtaGiveTextAttributeValue (attr, text, &length); |
ptr = ustrrchr (text, '#'); |
ptr = strrchr (text, '#'); |
url = text; |
url = text; |
if (ptr != NULL) |
if (ptr != NULL) |
{ |
{ |