[SCM] Render HTML and CSS content with tk branch, master, updated. 7f7e7bc3cdfa6ec14fcca4971f80fb328601ab22

Ole Streicher debian at liska.ath.cx
Fri Mar 2 14:05:59 UTC 2012


The following commit has been merged in the master branch:
commit fa489a5a7223e2da6ec4096f7783a76aefb50536
Author: Ole Streicher <debian at liska.ath.cx>
Date:   Fri Mar 2 12:34:18 2012 +0100

    Add unsorted DS9 patches

diff --git a/debian/patches/ds9_patches.diff b/debian/patches/ds9_patches.diff
new file mode 100644
index 0000000..e3d3b71
--- /dev/null
+++ b/debian/patches/ds9_patches.diff
@@ -0,0 +1,352 @@
+Origin: http://hea-www.harvard.edu/saord/download/ds9/source/ds9.6.2.tar.gz
+Description: These are source code patches on an old version of TkHtml (around the year 2000)-
+ Some of them may be still useful...
+diff -urw tkHTML/src/htmlcmd.c tkHTML_ds9//src/htmlcmd.c
+--- tkHTML/src/htmlcmd.c	2000-11-26 15:13:18.000000000 +0100
++++ tkHTML_ds9//src/htmlcmd.c	2012-03-02 10:48:54.000000000 +0100
+@@ -268,15 +287,40 @@
+       break;
+     }
+-  }else{
++  } else if( argc==4 && !strncmp(argv[2],"text",4)) {
++    HtmlElement *p;
++    int i;
++
++    HtmlLock(htmlPtr);
++    if( HtmlGetIndex(htmlPtr, argv[3], &p, &i)!=0 ){
++      if( !HtmlUnlock(htmlPtr) ){
++	Tcl_AppendResult(interp,"malformed index: \"", argv[3], "\"", 0);
++      }
++      
++      return TCL_ERROR;
++    }
++    if( !HtmlUnlock(htmlPtr) && p ){
++      if( p->base.type==Html_Text ) {
++	int offset = p->text.y-20;
++	if (offset<0)
++	  offset = 0;
++	HtmlVerticalScroll(htmlPtr, offset);
++      }
++      
++    }
++  }
++  else{
+     int count;
+     double fraction;
+     int maxY = htmlPtr->maxY;
+Only in tkHTML_ds9//src: htmlexts.c
+diff -urw tkHTML/src/htmllayout.c tkHTML_ds9//src/htmllayout.c
+--- tkHTML/src/htmllayout.c	2000-11-26 15:13:18.000000000 +0100
++++ tkHTML_ds9//src/htmllayout.c	2012-03-02 10:48:54.000000000 +0100
+@@ -690,19 +709,21 @@
+     case CLEAR_Both:
+       ClearObstacle(pLC,CLEAR_Left);
+       ClearObstacle(pLC,CLEAR_Right);
+       break;
+ 
+     case CLEAR_Left:
+       while( pLC->leftMargin && pLC->leftMargin->bottom>=0 ){
+-        if( newBottom < pLC->leftMargin->bottom ){
+           newBottom = pLC->leftMargin->bottom;
+-        }
+         HtmlPopOneMargin(&pLC->leftMargin);
+       }
+       if( newBottom > pLC->bottom + pLC->headRoom ){
+         pLC->headRoom = 0;
+       }else{
+         pLC->headRoom = newBottom - pLC->bottom;
+       }
+       pLC->bottom = newBottom;
+       PopExpiredMargins(&pLC->rightMargin, pLC->bottom);
+@@ -710,15 +731,16 @@
+ 
+     case CLEAR_Right:
+       while( pLC->rightMargin && pLC->rightMargin->bottom>=0 ){
+-        if( newBottom < pLC->rightMargin->bottom ){
+           newBottom = pLC->rightMargin->bottom;
+-        }
+         HtmlPopOneMargin(&pLC->rightMargin);
+       }
+       if( newBottom > pLC->bottom + pLC->headRoom ){
+         pLC->headRoom = 0;
+       }else{
+         pLC->headRoom = newBottom - pLC->bottom;
+       }
+       pLC->bottom = newBottom;
+       PopExpiredMargins(&pLC->leftMargin, pLC->bottom);
+@@ -729,25 +751,27 @@
+         if( pLC->rightMargin 
+          && pLC->rightMargin->bottom < pLC->leftMargin->bottom
+         ){
+-          if( newBottom < pLC->rightMargin->bottom ){
+             newBottom = pLC->rightMargin->bottom;
+-          }
+           HtmlPopOneMargin(&pLC->rightMargin);
+         }else{
+-          if( newBottom < pLC->leftMargin->bottom ){
+             newBottom = pLC->leftMargin->bottom;
+-          }
+           HtmlPopOneMargin(&pLC->leftMargin);
+         }
+       }else if( pLC->rightMargin && pLC->rightMargin->bottom>=0 ){
+         newBottom = pLC->rightMargin->bottom;
+         HtmlPopOneMargin(&pLC->rightMargin);
+       }else{
+       }
+       if( newBottom > pLC->bottom + pLC->headRoom ){
+         pLC->headRoom = 0;
+       }else{
+         pLC->headRoom = newBottom - pLC->bottom;
+       }
+       pLC->bottom = newBottom;
+       break;
+diff -urw tkHTML/src/htmlparse.c tkHTML_ds9//src/htmlparse.c
+--- tkHTML/src/htmlparse.c	2000-11-26 15:13:18.000000000 +0100
++++ tkHTML_ds9//src/htmlparse.c	2012-03-02 10:48:54.000000000 +0100
+@@ -586,7 +591,6 @@
+           break;
+         }
+       }
+-      if( z[i]==0 ) goto incomplete;
+       if( p->pScript ){
+         pScript->nScript = i - n;
+       }
+diff -urw tkHTML/src/htmltable.c tkHTML_ds9//src/htmltable.c
+--- tkHTML/src/htmltable.c	2000-11-26 15:13:18.000000000 +0100
++++ tkHTML_ds9//src/htmltable.c	2012-03-02 10:48:54.000000000 +0100
+@@ -162,39 +163,19 @@
+   z = HtmlMarkupArg(pStart, "hspace", 0);
+   hspace = z ? atoi(z) : DFLT_HSPACE;
+ 
+-  /* Figure out the maximum space available available */
+-  z = HtmlMarkupArg(pStart, "width", 0);
+-  if( z ){
+-    int len = strlen(z);
+-    if( len>0 && z[len-1]=='%' ){
+-      maxTableWidth = (atoi(z) * lineWidth)/100;
+-    }else{
+-      maxTableWidth = atoi(z);
+-    }
+-  }else{
+-    maxTableWidth = lineWidth;
+-  }
+-  maxTableWidth -= 2*margin;
+-  SETMAX( maxTableWidth, 1);
+-  TRACE(HtmlTrace_Table1,
+-    ("lineWidth=%d maxTableWidth = %d margin=%d\n", 
+-       lineWidth, maxTableWidth, margin));
+-
+-  for(p=pStart->pNext; p; p=pNext){
+-    if( p->base.type==Html_EndTABLE){
+-      p->ref.pOther = pStart;
+-      break;
+-    }
++  for(p=pStart->pNext; p && p->base.type!=Html_EndTABLE; p=pNext){
+     pNext = p->pNext;
+     switch( p->base.type ){
+       case Html_EndTD:
+       case Html_EndTH:
+       case Html_EndTABLE:
+         p->ref.pOther = pStart;
+         break;
+       case Html_EndTR:
+         p->ref.pOther = pStart;
+         inRow = 0;
+         break;
+       case Html_TR:
+         p->ref.pOther = pStart;
+@@ -202,12 +183,14 @@
+         pStart->table.nRow++;
+         iCol = 0;
+         inRow = 1;
+-        availWidth = maxTableWidth;
++        maxTableWidth = availWidth = lineWidth - 2*margin;
+         break;
+       case Html_CAPTION:
+         while( p && p->base.type!=Html_EndTABLE 
+                && p->base.type!=Html_EndCAPTION ){
+           p = p->pNext;
+         }
+         break;
+       case Html_TD:
+@@ -257,12 +240,13 @@
+         pNext = MinMax(htmlPtr, p, &minW, &maxW, availWidth);
+         p->cell.pEnd = pNext;
+         if( (z = HtmlMarkupArg(p, "width", 0))!=0 ){
+-          for(i=0; isdigit(z[i]) || z[i]=='.'; i++){}
++          for(i=0; isdigit(z[i]); i++){}
+           if( strcmp(z,"*")==0 ){
+             requestedW = availWidth;
+           }else if( z[i]==0 ){
+             requestedW = atoi(z);
+           }else if( z[i]=='%' ){
+             requestedW = (atoi(z)*maxTableWidth + 99)/100;
+           }
+         }else{
+@@ -287,14 +271,15 @@
+             min = pStart->table.minW[iCol] + separation;
+           }else{
+             int n = p->cell.colspan;
+-            int per = maxW/n;
+-            int ix;
+             SETMAX( ColMin(iCol,iCol+n-1), minW);
+             SETMAX( ColReq(iCol,iCol+n-1), requestedW);
+             min = minW + separation;
+-            for(ix=iCol; ix<iCol+n; ix++){
+-              SETMAX( pStart->table.maxW[ix], per);
++#if 0
++            maxW = (maxW + (n - 1)*(1-separation))/n;
++            for(i=iCol; i<iCol + n && i<HTML_MAX_COLUMNS; i++){
++              SETMAX( pStart->table.maxW[i], maxW );
+             }
++#endif
+           }
+           availWidth -= min;
+         }
+@@ -475,11 +460,8 @@
+     }else{
+       totalWidth = atoi(z);
+     }
+-    SETMAX( totalWidth, pStart->table.minW[0] );
+-    requestedW = totalWidth;
+-    SETMAX( pStart->table.maxW[0], totalWidth );
++    SETMAX( requestedW, totalWidth );
+   }
+-  SETMAX( maxTableWidth, pStart->table.minW[0] );
+   if( lineWidth && (requestedW > lineWidth) ){
+     TRACE(HtmlTrace_Table5,("RequestedW reduced to lineWidth: %d -> %d\n", 
+        requestedW, lineWidth));
+@@ -768,7 +756,6 @@
+   char *z;                /* A string */
+   int leftMargin;         /* The left edge of space available for drawing */
+   int lineWidth;          /* Total horizontal space available for drawing */
+-  int specWidth;          /* Total horizontal drawing width per width= attr */
+   int separation;         /* Distance between content of columns (or rows) */
+   int i;                  /* Loop counter */
+   int n;                  /* Number of columns */
+@@ -829,21 +817,10 @@
+   
+   /* Figure out how wide to draw the table 
+   */
+-  z = HtmlMarkupArg(pTable, "width", 0);
+-  if( z ){
+-    int len = strlen(z);
+-    if( len>0 && z[len-1]=='%' ){
+-      specWidth = (atoi(z) * lineWidth)/100;
+-    }else{
+-      specWidth = atoi(z);
+-    }
+-  }else{
+-    specWidth = lineWidth;
+-  }
+-  if( specWidth < pTable->table.minW[0] ){
++  if( lineWidth < pTable->table.minW[0] ){
+     width = pTable->table.minW[0];
+-  }else if( specWidth <= pTable->table.maxW[0] ){
+-    width = specWidth;
++  }else if( lineWidth <= pTable->table.maxW[0] ){
++    width = lineWidth;
+   }else{
+     width = pTable->table.maxW[0];
+   }
+@@ -878,7 +855,7 @@
+     return pEnd;
+   }
+   zAlign = HtmlMarkupArg(pTable, "align", "");
+-  if( width <= lineWidth ){
++  if( width < lineWidth ){
+     int align = pTable->base.style.align;
+     if( align==ALIGN_Right || stricmp(zAlign,"right")==0 ){
+       x[1] += lineWidth - width;
+diff -urw tkHTML/src/htmlurl.c tkHTML_ds9//src/htmlurl.c
+--- tkHTML/src/htmlurl.c	2000-11-26 15:13:18.000000000 +0100
++++ tkHTML_ds9//src/htmlurl.c	2012-03-02 10:48:54.000000000 +0100
+@@ -332,13 +335,15 @@
+               continue;
+             }
+           }
++	  /* look for /../ at begining */
++	  if (!strncmp(zBuf,"/../",4))
++	    strcpy(zBuf,zBuf+3);
++
+           HtmlFree(base->zPath);
+           base->zPath = zBuf;
+         }
+         ReplaceStr(&base->zQuery, term->zQuery);
+         ReplaceStr(&base->zFragment, term->zFragment);
+-      }else if( term->zQuery ){
+-        ReplaceStr(&base->zQuery, term->zQuery);
+       }
+       FreeUri(term);
+     }
+diff -urw tkHTML/src/htmlwidget.c tkHTML_ds9//src/htmlwidget.c
+--- tkHTML/src/htmlwidget.c	2000-11-26 15:13:18.000000000 +0100
++++ tkHTML_ds9//src/htmlwidget.c	2012-03-02 10:48:54.000000000 +0100
+@@ -518,7 +538,7 @@
+       htmlPtr->yOffset = 0;
+     }
+     w = htmlPtr->realWidth - 2*insetX;
+-    if( htmlPtr->xOffset + w > htmlPtr->maxX ){
++    if( htmlPtr->xOffset + h > htmlPtr->maxX ){
+       htmlPtr->xOffset = htmlPtr->maxX - w;
+     }
+     if( htmlPtr->xOffset < 0 ){
+@@ -1370,6 +1427,13 @@
+   ** compatibility.
+   */
+   n = strlen(zColor);
++
++  /* trucate any spaces on the end */
++  while (n>0 && zColor[n-1]==' ') {
++    zColor[n-1] = '\0';
++    n--;
++  }
++
+   if( n==6 || n==3 || n==9 || n==12 ){
+     for(i=0; i<n; i++){
+       if( !isxdigit(zColor[i]) ) break;
+@@ -1488,21 +1552,35 @@
+   float dist;
+   float closestDist;
+   int closest;
++  /*
+   int r, g, b;
+ # define COLOR_MASK  0xf800
++  */
++
++  XColor* q;
++  q = Tk_GetColorByValue(htmlPtr->clipwin, pRef);
+ 
+   /* Search for an exact match */
++  /*
+   r = pRef->red &= COLOR_MASK;
+   g = pRef->green &= COLOR_MASK;
+   b = pRef->blue &= COLOR_MASK;
++  */
+   for(i=0; i<N_COLOR; i++){
+     XColor *p = htmlPtr->apColor[i];
++    /*
+     if( p && (p->red & COLOR_MASK)==r && (p->green & COLOR_MASK)==g 
+     && (p->blue & COLOR_MASK)==b ){
++    */
++    if (p && (q->red == p->red) 
++	&& (q->green == p->green) 
++	&& (q->blue == p->blue)) {
+       htmlPtr->colorUsed |= (1<<i);
++      Tk_FreeColor(q);
+       return i;
+     }
+   }
++  Tk_FreeColor(q);
+ 
+   /* No exact matches.  Look for a completely unused slot */
+   for(i=N_PREDEFINED_COLOR; i<N_COLOR; i++){
+@@ -1659,7 +1743,7 @@
+   { "resolve",   0,         2, 0, "?URI ...?",           HtmlResolveCmd },
+   { "selection", "clear",   3, 3, 0,                     HtmlSelectionClearCmd},
+   { 0,           "set",     5, 5, "START END",           HtmlSelectionSetCmd },
+-  { "text",      "ascii",   5, 5, "START END",           0 },
++  { "text",      "ascii",   5, 5, "START END",           HtmlTextAsciiCmd},
+   { 0,           "delete",  5, 5, "START END",           0 },
+   { 0,           "html",    5, 5, "START END",           0 },
+   { 0,           "insert",  5, 5, "INDEX TEXT",          0 },

-- 
Render HTML and CSS content with tk



More information about the debian-science-commits mailing list