Fossil SCM
In the timeline graph rendering code, hard-code the topRow value in the generated javascript.
Commit
e76f3bbe45dcefd941a5649fbcadcf0303da455c66b8fa68445e92e5d04d4d14
Parent
ba3444327f36442…
1 file changed
+7
-6
+7
-6
| --- src/timeline.c | ||
| +++ src/timeline.c | ||
| @@ -684,10 +684,11 @@ | ||
| 684 | 684 | char cSep; |
| 685 | 685 | int iRailPitch; /* Pixels between consecutive rails */ |
| 686 | 686 | int showArrowheads; /* True to draw arrowheads. False to omit. */ |
| 687 | 687 | int circleNodes; /* True for circle nodes. False for square nodes */ |
| 688 | 688 | int colorGraph; /* Use colors for graph lines */ |
| 689 | + int iTopRow; /* Index of the top row of the graph */ | |
| 689 | 690 | |
| 690 | 691 | iRailPitch = atoi(PD("railpitch","0")); |
| 691 | 692 | showArrowheads = skin_detail_boolean("timeline-arrowheads"); |
| 692 | 693 | circleNodes = skin_detail_boolean("timeline-circle-nodes"); |
| 693 | 694 | colorGraph = skin_detail_boolean("timeline-color-graph-lines"); |
| @@ -709,11 +710,11 @@ | ||
| 709 | 710 | /* the rowinfo[] array contains all the information needed to generate |
| 710 | 711 | ** the graph. Each entry contains information for a single row: |
| 711 | 712 | ** |
| 712 | 713 | ** id: The id of the <div> element for the row. This is an integer. |
| 713 | 714 | ** to get an actual id, prepend "m" to the integer. The top node |
| 714 | - ** is topRow and numbers increase moving down the timeline. | |
| 715 | + ** is iTopRow and numbers increase moving down the timeline. | |
| 715 | 716 | ** bg: The background color for this row |
| 716 | 717 | ** r: The "rail" that the node for this row sits on. The left-most |
| 717 | 718 | ** rail is 0 and the number increases to the right. |
| 718 | 719 | ** d: True if there is a "descender" - an arrow coming from the bottom |
| 719 | 720 | ** of the page straight up to this node. |
| @@ -735,11 +736,11 @@ | ||
| 735 | 736 | ** negative, then the rail position is the absolute value of mi[] |
| 736 | 737 | ** and a thin merge-arrow descender is drawn to the bottom of |
| 737 | 738 | ** the screen. |
| 738 | 739 | ** h: The artifact hash of the object being graphed |
| 739 | 740 | */ |
| 740 | - if( pGraph->pFirst ) cgi_printf("var topRow = %d\n", pGraph->pFirst->idx); | |
| 741 | + iTopRow = pGraph->pFirst ? pGraph->pFirst->idx : 0; | |
| 741 | 742 | cgi_printf("var rowinfo = [\n"); |
| 742 | 743 | for(pRow=pGraph->pFirst; pRow; pRow=pRow->pNext){ |
| 743 | 744 | cgi_printf("{id:%d,bg:\"%s\",r:%d,d:%d,mo:%d,mu:%d,u:%d,f:%d,au:", |
| 744 | 745 | pRow->idx, /* id */ |
| 745 | 746 | pRow->zBgClr, /* bg */ |
| @@ -912,11 +913,11 @@ | ||
| 912 | 913 | @ var x = p.x + (p.r<rail ? node.w : -mArrow.w); |
| 913 | 914 | @ var cls = "arrow merge " + (p.r<rail ? "l" : "r"); |
| 914 | 915 | @ drawBox(cls,null,x,y+(mLine.w-mArrow.h)/2); |
| 915 | 916 | @ } |
| 916 | 917 | @ function drawNode(p, btm){ |
| 917 | - @ if( p.u>0 ) drawUpArrow(p,rowinfo[p.u-topRow],p.fg); | |
| 918 | + @ if( p.u>0 ) drawUpArrow(p,rowinfo[p.u-%d(iTopRow)],p.fg); | |
| 918 | 919 | @ var cls = node.cls; |
| 919 | 920 | @ if( p.mi.length ) cls += " merge"; |
| 920 | 921 | @ if( p.f&1 ) cls += " leaf"; |
| 921 | 922 | @ var n = drawBox(cls,p.bg,p.x,p.y); |
| 922 | 923 | @ n.id = "tln"+p.id; |
| @@ -927,11 +928,11 @@ | ||
| 927 | 928 | @ if( p.d ) drawUpArrow({x: p.x, y: btm-node.h/2},p,p.fg); |
| 928 | 929 | } |
| 929 | 930 | @ if( p.mo>=0 ){ |
| 930 | 931 | @ var x0 = p.x + node.w/2; |
| 931 | 932 | @ var x1 = p.mo*railPitch + node.w/2; |
| 932 | - @ var u = rowinfo[p.mu-topRow]; | |
| 933 | + @ var u = rowinfo[p.mu-%d(iTopRow)]; | |
| 933 | 934 | @ var y1 = miLineY(u); |
| 934 | 935 | @ if( p.u<0 || p.mo!=p.r ){ |
| 935 | 936 | @ x1 += mergeLines[p.mo] = -mLine.w/2; |
| 936 | 937 | @ var y0 = p.y+2; |
| 937 | 938 | @ if( p.r!=p.mo ) drawMergeLine(x0,y0,x1+(x0<x1 ? mLine.w : 0),null); |
| @@ -951,11 +952,11 @@ | ||
| 951 | 952 | @ if( x0<x1 ){ |
| 952 | 953 | @ x0 = Math.ceil(x0); |
| 953 | 954 | @ x1 += line.w; |
| 954 | 955 | @ } |
| 955 | 956 | @ var y0 = p.y + (node.h-line.w)/2; |
| 956 | - @ var u = rowinfo[p.au[i+1]-topRow]; | |
| 957 | + @ var u = rowinfo[p.au[i+1]-%d(iTopRow)]; | |
| 957 | 958 | @ if( u.id<p.id ){ |
| 958 | 959 | @ drawLine(line,u.fg,x0,y0,x1,null); |
| 959 | 960 | @ drawUpArrow(p,u,u.fg); |
| 960 | 961 | @ }else{ |
| 961 | 962 | @ var y1 = u.y + (node.h-line.w)/2; |
| @@ -997,11 +998,11 @@ | ||
| 997 | 998 | @ drawNode(rowinfo[i], btm); |
| 998 | 999 | @ } |
| 999 | 1000 | @ } |
| 1000 | 1001 | @ var selRow; |
| 1001 | 1002 | @ function clickOnNode(){ |
| 1002 | - @ var p = rowinfo[parseInt(this.id.match(/\d+$/)[0], 10)-topRow]; | |
| 1003 | + @ var p = rowinfo[parseInt(this.id.match(/\d+$/)[0], 10)-%d(iTopRow)]; | |
| 1003 | 1004 | @ if( !selRow ){ |
| 1004 | 1005 | @ selRow = p; |
| 1005 | 1006 | @ this.className += " sel"; |
| 1006 | 1007 | @ canvasDiv.className += " sel"; |
| 1007 | 1008 | @ }else if( selRow==p ){ |
| 1008 | 1009 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -684,10 +684,11 @@ | |
| 684 | char cSep; |
| 685 | int iRailPitch; /* Pixels between consecutive rails */ |
| 686 | int showArrowheads; /* True to draw arrowheads. False to omit. */ |
| 687 | int circleNodes; /* True for circle nodes. False for square nodes */ |
| 688 | int colorGraph; /* Use colors for graph lines */ |
| 689 | |
| 690 | iRailPitch = atoi(PD("railpitch","0")); |
| 691 | showArrowheads = skin_detail_boolean("timeline-arrowheads"); |
| 692 | circleNodes = skin_detail_boolean("timeline-circle-nodes"); |
| 693 | colorGraph = skin_detail_boolean("timeline-color-graph-lines"); |
| @@ -709,11 +710,11 @@ | |
| 709 | /* the rowinfo[] array contains all the information needed to generate |
| 710 | ** the graph. Each entry contains information for a single row: |
| 711 | ** |
| 712 | ** id: The id of the <div> element for the row. This is an integer. |
| 713 | ** to get an actual id, prepend "m" to the integer. The top node |
| 714 | ** is topRow and numbers increase moving down the timeline. |
| 715 | ** bg: The background color for this row |
| 716 | ** r: The "rail" that the node for this row sits on. The left-most |
| 717 | ** rail is 0 and the number increases to the right. |
| 718 | ** d: True if there is a "descender" - an arrow coming from the bottom |
| 719 | ** of the page straight up to this node. |
| @@ -735,11 +736,11 @@ | |
| 735 | ** negative, then the rail position is the absolute value of mi[] |
| 736 | ** and a thin merge-arrow descender is drawn to the bottom of |
| 737 | ** the screen. |
| 738 | ** h: The artifact hash of the object being graphed |
| 739 | */ |
| 740 | if( pGraph->pFirst ) cgi_printf("var topRow = %d\n", pGraph->pFirst->idx); |
| 741 | cgi_printf("var rowinfo = [\n"); |
| 742 | for(pRow=pGraph->pFirst; pRow; pRow=pRow->pNext){ |
| 743 | cgi_printf("{id:%d,bg:\"%s\",r:%d,d:%d,mo:%d,mu:%d,u:%d,f:%d,au:", |
| 744 | pRow->idx, /* id */ |
| 745 | pRow->zBgClr, /* bg */ |
| @@ -912,11 +913,11 @@ | |
| 912 | @ var x = p.x + (p.r<rail ? node.w : -mArrow.w); |
| 913 | @ var cls = "arrow merge " + (p.r<rail ? "l" : "r"); |
| 914 | @ drawBox(cls,null,x,y+(mLine.w-mArrow.h)/2); |
| 915 | @ } |
| 916 | @ function drawNode(p, btm){ |
| 917 | @ if( p.u>0 ) drawUpArrow(p,rowinfo[p.u-topRow],p.fg); |
| 918 | @ var cls = node.cls; |
| 919 | @ if( p.mi.length ) cls += " merge"; |
| 920 | @ if( p.f&1 ) cls += " leaf"; |
| 921 | @ var n = drawBox(cls,p.bg,p.x,p.y); |
| 922 | @ n.id = "tln"+p.id; |
| @@ -927,11 +928,11 @@ | |
| 927 | @ if( p.d ) drawUpArrow({x: p.x, y: btm-node.h/2},p,p.fg); |
| 928 | } |
| 929 | @ if( p.mo>=0 ){ |
| 930 | @ var x0 = p.x + node.w/2; |
| 931 | @ var x1 = p.mo*railPitch + node.w/2; |
| 932 | @ var u = rowinfo[p.mu-topRow]; |
| 933 | @ var y1 = miLineY(u); |
| 934 | @ if( p.u<0 || p.mo!=p.r ){ |
| 935 | @ x1 += mergeLines[p.mo] = -mLine.w/2; |
| 936 | @ var y0 = p.y+2; |
| 937 | @ if( p.r!=p.mo ) drawMergeLine(x0,y0,x1+(x0<x1 ? mLine.w : 0),null); |
| @@ -951,11 +952,11 @@ | |
| 951 | @ if( x0<x1 ){ |
| 952 | @ x0 = Math.ceil(x0); |
| 953 | @ x1 += line.w; |
| 954 | @ } |
| 955 | @ var y0 = p.y + (node.h-line.w)/2; |
| 956 | @ var u = rowinfo[p.au[i+1]-topRow]; |
| 957 | @ if( u.id<p.id ){ |
| 958 | @ drawLine(line,u.fg,x0,y0,x1,null); |
| 959 | @ drawUpArrow(p,u,u.fg); |
| 960 | @ }else{ |
| 961 | @ var y1 = u.y + (node.h-line.w)/2; |
| @@ -997,11 +998,11 @@ | |
| 997 | @ drawNode(rowinfo[i], btm); |
| 998 | @ } |
| 999 | @ } |
| 1000 | @ var selRow; |
| 1001 | @ function clickOnNode(){ |
| 1002 | @ var p = rowinfo[parseInt(this.id.match(/\d+$/)[0], 10)-topRow]; |
| 1003 | @ if( !selRow ){ |
| 1004 | @ selRow = p; |
| 1005 | @ this.className += " sel"; |
| 1006 | @ canvasDiv.className += " sel"; |
| 1007 | @ }else if( selRow==p ){ |
| 1008 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -684,10 +684,11 @@ | |
| 684 | char cSep; |
| 685 | int iRailPitch; /* Pixels between consecutive rails */ |
| 686 | int showArrowheads; /* True to draw arrowheads. False to omit. */ |
| 687 | int circleNodes; /* True for circle nodes. False for square nodes */ |
| 688 | int colorGraph; /* Use colors for graph lines */ |
| 689 | int iTopRow; /* Index of the top row of the graph */ |
| 690 | |
| 691 | iRailPitch = atoi(PD("railpitch","0")); |
| 692 | showArrowheads = skin_detail_boolean("timeline-arrowheads"); |
| 693 | circleNodes = skin_detail_boolean("timeline-circle-nodes"); |
| 694 | colorGraph = skin_detail_boolean("timeline-color-graph-lines"); |
| @@ -709,11 +710,11 @@ | |
| 710 | /* the rowinfo[] array contains all the information needed to generate |
| 711 | ** the graph. Each entry contains information for a single row: |
| 712 | ** |
| 713 | ** id: The id of the <div> element for the row. This is an integer. |
| 714 | ** to get an actual id, prepend "m" to the integer. The top node |
| 715 | ** is iTopRow and numbers increase moving down the timeline. |
| 716 | ** bg: The background color for this row |
| 717 | ** r: The "rail" that the node for this row sits on. The left-most |
| 718 | ** rail is 0 and the number increases to the right. |
| 719 | ** d: True if there is a "descender" - an arrow coming from the bottom |
| 720 | ** of the page straight up to this node. |
| @@ -735,11 +736,11 @@ | |
| 736 | ** negative, then the rail position is the absolute value of mi[] |
| 737 | ** and a thin merge-arrow descender is drawn to the bottom of |
| 738 | ** the screen. |
| 739 | ** h: The artifact hash of the object being graphed |
| 740 | */ |
| 741 | iTopRow = pGraph->pFirst ? pGraph->pFirst->idx : 0; |
| 742 | cgi_printf("var rowinfo = [\n"); |
| 743 | for(pRow=pGraph->pFirst; pRow; pRow=pRow->pNext){ |
| 744 | cgi_printf("{id:%d,bg:\"%s\",r:%d,d:%d,mo:%d,mu:%d,u:%d,f:%d,au:", |
| 745 | pRow->idx, /* id */ |
| 746 | pRow->zBgClr, /* bg */ |
| @@ -912,11 +913,11 @@ | |
| 913 | @ var x = p.x + (p.r<rail ? node.w : -mArrow.w); |
| 914 | @ var cls = "arrow merge " + (p.r<rail ? "l" : "r"); |
| 915 | @ drawBox(cls,null,x,y+(mLine.w-mArrow.h)/2); |
| 916 | @ } |
| 917 | @ function drawNode(p, btm){ |
| 918 | @ if( p.u>0 ) drawUpArrow(p,rowinfo[p.u-%d(iTopRow)],p.fg); |
| 919 | @ var cls = node.cls; |
| 920 | @ if( p.mi.length ) cls += " merge"; |
| 921 | @ if( p.f&1 ) cls += " leaf"; |
| 922 | @ var n = drawBox(cls,p.bg,p.x,p.y); |
| 923 | @ n.id = "tln"+p.id; |
| @@ -927,11 +928,11 @@ | |
| 928 | @ if( p.d ) drawUpArrow({x: p.x, y: btm-node.h/2},p,p.fg); |
| 929 | } |
| 930 | @ if( p.mo>=0 ){ |
| 931 | @ var x0 = p.x + node.w/2; |
| 932 | @ var x1 = p.mo*railPitch + node.w/2; |
| 933 | @ var u = rowinfo[p.mu-%d(iTopRow)]; |
| 934 | @ var y1 = miLineY(u); |
| 935 | @ if( p.u<0 || p.mo!=p.r ){ |
| 936 | @ x1 += mergeLines[p.mo] = -mLine.w/2; |
| 937 | @ var y0 = p.y+2; |
| 938 | @ if( p.r!=p.mo ) drawMergeLine(x0,y0,x1+(x0<x1 ? mLine.w : 0),null); |
| @@ -951,11 +952,11 @@ | |
| 952 | @ if( x0<x1 ){ |
| 953 | @ x0 = Math.ceil(x0); |
| 954 | @ x1 += line.w; |
| 955 | @ } |
| 956 | @ var y0 = p.y + (node.h-line.w)/2; |
| 957 | @ var u = rowinfo[p.au[i+1]-%d(iTopRow)]; |
| 958 | @ if( u.id<p.id ){ |
| 959 | @ drawLine(line,u.fg,x0,y0,x1,null); |
| 960 | @ drawUpArrow(p,u,u.fg); |
| 961 | @ }else{ |
| 962 | @ var y1 = u.y + (node.h-line.w)/2; |
| @@ -997,11 +998,11 @@ | |
| 998 | @ drawNode(rowinfo[i], btm); |
| 999 | @ } |
| 1000 | @ } |
| 1001 | @ var selRow; |
| 1002 | @ function clickOnNode(){ |
| 1003 | @ var p = rowinfo[parseInt(this.id.match(/\d+$/)[0], 10)-%d(iTopRow)]; |
| 1004 | @ if( !selRow ){ |
| 1005 | @ selRow = p; |
| 1006 | @ this.className += " sel"; |
| 1007 | @ canvasDiv.className += " sel"; |
| 1008 | @ }else if( selRow==p ){ |
| 1009 |