Diff for /Amaya/amaya/HTMLbook.c between versions 1.24 and 1.25

version 1.24, 1997/11/12 13:45:43 version 1.25, 1997/11/13 16:48:16
Line 24 Line 24
 #define NumZonePrinterName 5  #define NumZonePrinterName 5
 #define PRINT_MAX_REF      6  #define PRINT_MAX_REF      6
   
 /* Thot printer variables */  /* structure to register sub-documents in MakeBook function*/
   typedef struct _SubDoc
     {
        struct _SubDoc  *SDnext;
        Element          SDel;
        char            *SDname;
     }SubDoc;
   
   static struct _SubDoc  *SubDocs;
 static int              PaperPrint;  static int              PaperPrint;
 static int              ManualFeed;  static int              ManualFeed;
 static int              PageSize;  static int              PageSize;
Line 35  static boolean  numberLinks; Line 43  static boolean  numberLinks;
 static boolean          withToC;  static boolean          withToC;
 static int              basePrint;  static int              basePrint;
   
 /* structure to register sub-documents */  
 typedef struct _SubDoc  
   {  
      struct _SubDoc  *SDnext;  
      Element          SDel;  
      char            *SDname;  
   }SubDoc;  
 static struct _SubDoc  *SubDocs = NULL;  
 static Document         docBook = 0;  
   
 #include "init_f.h"  #include "init_f.h"
 #include "HTMLactions_f.h"  #include "HTMLactions_f.h"
 #include "HTMLbook_f.h"  #include "HTMLbook_f.h"
 #include "HTMLedit_f.h"  #include "HTMLedit_f.h"
   #include "HTMLhistory_f.h"
   
   
 /*----------------------------------------------------------------------  /*----------------------------------------------------------------------
Line 153  Document                document; Line 152  Document                document;
 #endif  #endif
 {  {
   Element               root, el, div;    Element               root, el, div;
   Element               link, target;    Element               link, target, sibling;
   ElementType           elType;    ElementType           elType;
   Attribute             HrefAttr, IntLinkAttr;    Attribute             HrefAttr, IntLinkAttr;
   Attribute             attr, ExtLinkAttr;    Attribute             attr, ExtLinkAttr;
   AttributeType         attrType;    AttributeType         attrType;
   char                 *text, *ptr, *url;    char                 *text, *ptr, *url, number[10];
   char                  value[MAX_LENGTH];    char                  value[MAX_LENGTH];
   int                   length, i;    int                   length, i, volume;
   int                   status;    int                   status, position;
   boolean               split;    boolean               split;
   
   /* Remember the current status of the document */    /* Remember the current status of the document */
   status = TtaIsDocumentModified (document);    status = TtaIsDocumentModified (document);
   root = TtaGetMainRoot (document);    root = TtaGetMainRoot (document);
     volume = TtaGetElementVolume (root);
   elType = TtaGetElementType (root);    elType = TtaGetElementType (root);
   elType.ElTypeNum = HTML_EL_BODY;    elType.ElTypeNum = HTML_EL_BODY;
   el = TtaSearchTypedElement (elType, SearchForward, root);    el = TtaSearchTypedElement (elType, SearchForward, root);
Line 177  Document                document; Line 177  Document                document;
   link = el;    link = el;
   while (link != NULL)    while (link != NULL)
     {      {
         /* display the progression of the work */
         el = link;
         position = 0;
         while (el != NULL)
           {
             sibling = el;
             do
               {
                 /* add volume of each previous element */
                 TtaPreviousSibling (&sibling);
                 if (sibling != NULL)
                   position += TtaGetElementVolume (sibling);
               }
             while (sibling != NULL);
             el = TtaGetParent (el);
           }
         sprintf (number, "%d", position*100/volume);
         TtaSetStatus (document, 1, TtaGetMessage (AMAYA, AM_UPDATED_LINK), number);
         TtaHandlePendingEvents ();
       link = TtaSearchTypedElement (elType, SearchForward, link);        link = TtaSearchTypedElement (elType, SearchForward, link);
       if (link != NULL)        if (link != NULL)
         /* an anchor has been found */          /* an anchor has been found */
Line 205  Document                document; Line 224  Document                document;
               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 = strrchr (text, '#');                    ptr = strrchr (text, '#');
                   url = text;                    url = text;
Line 817  Document            document; Line 836  Document            document;
    AttributeType        attrType;     AttributeType        attrType;
    int                  length;     int                  length;
    char                 *text, *ptr, *url;     char                 *text, *ptr, *url;
    Document             includedDocument, newdoc;     Document             newdoc;
   
    attrType.AttrSSchema = TtaGetDocumentSSchema (document);     attrType.AttrSSchema = TtaGetDocumentSSchema (document);
    attrType.AttrTypeNum = HTML_ATTR_REL;     attrType.AttrTypeNum = HTML_ATTR_REL;
Line 866  Document            document; Line 885  Document            document;
              /* this link designate an external document */               /* this link designate an external document */
              {               {
                /* create a new document and loads the target document */                 /* create a new document and loads the target document */
                includedDocument = TtaNewDocument ("HTML", "tmp");                 IncludedDocument = TtaNewDocument ("HTML", "tmp");
                TtaSetStatus (document, 1, TtaGetMessage (AMAYA, AM_FETCHING), url);                 TtaSetStatus (document, 1, TtaGetMessage (AMAYA, AM_FETCHING), url);
                newdoc = GetHTMLDocument (url, NULL, includedDocument,                 newdoc = GetHTMLDocument (url, NULL, IncludedDocument,
                                          document, CE_MAKEBOOK, FALSE);                                           document, CE_MAKEBOOK, FALSE);
                if (newdoc != 0 && newdoc != document)                 if (newdoc != 0 && newdoc != document)
                  {                   {
                    /* it's not the document itself */                     /* it's not the document itself */
                    /* copy the target document at the position of the link */                     /* copy the target document at the position of the link */
                    MoveDocumentBody (&next, document, newdoc, ptr, url,                     MoveDocumentBody (&next, document, newdoc, ptr, url,
                                      newdoc == includedDocument);                                       newdoc == IncludedDocument);
                  }                   }
                FreeDocumentResource (includedDocument);                 FreeDocumentResource (IncludedDocument);
                TtaCloseDocument (includedDocument);                 TtaCloseDocument (IncludedDocument);
                  IncludedDocument = 0;
              }               }
                             
            TtaFreeMemory (text);             TtaFreeMemory (text);
Line 905  View                view; Line 925  View                view;
    Element          root, body, el;     Element          root, body, el;
    ElementType      elType;     ElementType      elType;
   
    docBook = document;  
    /* stops all current transfers on this document */     /* stops all current transfers on this document */
    StopTransfer (docBook, 1);     StopTransfer (document, 1);
      /* simulate a transfert in the main document */
      ActiveMakeBook (document);
    root = TtaGetMainRoot (document);     root = TtaGetMainRoot (document);
    elType = TtaGetElementType (root);     elType = TtaGetElementType (root);
    elType.ElTypeNum = HTML_EL_BODY;     elType.ElTypeNum = HTML_EL_BODY;
Line 918  View                view; Line 939  View                view;
    WinMakeBookFlag = TRUE;     WinMakeBookFlag = TRUE;
 #endif /* _WINDOWS */  #endif /* _WINDOWS */
    el = body;     el = body;
    while (el != NULL)     while (el != NULL && DocBook == document)
       el = GetIncludedDocuments (el, document);        el = GetIncludedDocuments (el, document);
    TtaSetStatus (document, 1, TtaGetMessage (AMAYA, AM_DOCUMENT_LOADED), NULL);     ResetStop (document);
    /* update internal links */     /* update internal links */
    SetInternalLinks (document);     SetInternalLinks (document);
 #if !defined(AMAYA_JAVA) && !defined(AMAYA_ILU) && defined (_WINDOWS)  #if !defined(AMAYA_JAVA) && !defined(AMAYA_ILU) && defined (_WINDOWS)
Line 929  View                view; Line 950  View                view;
 #endif /* _WINDOWS */  #endif /* _WINDOWS */
    /* remove registered  sub-documents */     /* remove registered  sub-documents */
    FreeSubDocTable ();     FreeSubDocTable ();
    docBook = 0;     DocBook = 0;
      TtaSetStatus (document, 1, TtaGetMessage (AMAYA, AM_DOCUMENT_LOADED), NULL);
 }  }

Removed from v.1.24  
changed lines
  Added in v.1.25


Webmaster