Fossil SCM

Fill the boxes on the graph with the same background color as the text in the timeline description.

drh 2010-04-15 23:50 trunk
Commit 0e7b85bb92ba33660410560fb0a531e2318702da
3 files changed +1 -1 +7 -1 +5 -8
+1 -1
--- src/finfo.c
+++ src/finfo.c
@@ -159,11 +159,11 @@
159159
int gidx;
160160
char zTime[10];
161161
char zShort[20];
162162
char zShortCkin[20];
163163
if( zBr==0 ) zBr = "trunk";
164
- gidx = graph_add_row(pGraph, frid, fpid>0 ? 1 : 0, &fpid, zBr);
164
+ gidx = graph_add_row(pGraph, frid, fpid>0 ? 1 : 0, &fpid, zBr, zBgClr);
165165
if( memcmp(zDate, zPrevDate, 10) ){
166166
sprintf(zPrevDate, "%.10s", zDate);
167167
@ <tr><td>
168168
@ <div class="divider"><nobr>%s(zPrevDate)</nobr></div>
169169
@ </td></tr>
170170
--- src/finfo.c
+++ src/finfo.c
@@ -159,11 +159,11 @@
159 int gidx;
160 char zTime[10];
161 char zShort[20];
162 char zShortCkin[20];
163 if( zBr==0 ) zBr = "trunk";
164 gidx = graph_add_row(pGraph, frid, fpid>0 ? 1 : 0, &fpid, zBr);
165 if( memcmp(zDate, zPrevDate, 10) ){
166 sprintf(zPrevDate, "%.10s", zDate);
167 @ <tr><td>
168 @ <div class="divider"><nobr>%s(zPrevDate)</nobr></div>
169 @ </td></tr>
170
--- src/finfo.c
+++ src/finfo.c
@@ -159,11 +159,11 @@
159 int gidx;
160 char zTime[10];
161 char zShort[20];
162 char zShortCkin[20];
163 if( zBr==0 ) zBr = "trunk";
164 gidx = graph_add_row(pGraph, frid, fpid>0 ? 1 : 0, &fpid, zBr, zBgClr);
165 if( memcmp(zDate, zPrevDate, 10) ){
166 sprintf(zPrevDate, "%.10s", zDate);
167 @ <tr><td>
168 @ <div class="divider"><nobr>%s(zPrevDate)</nobr></div>
169 @ </td></tr>
170
+7 -1
--- src/graph.c
+++ src/graph.c
@@ -38,10 +38,11 @@
3838
struct GraphRow {
3939
int rid; /* The rid for the check-in */
4040
int nParent; /* Number of parents */
4141
int aParent[GR_MAX_PARENT]; /* Array of parents. 0 element is primary .*/
4242
char *zBranch; /* Branch name */
43
+ char *zBgClr; /* Background Color */
4344
4445
GraphRow *pNext; /* Next row down in the list of all rows */
4546
GraphRow *pPrev; /* Previous row */
4647
4748
int idx; /* Row index. First is 1. 0 used for "none" */
@@ -140,10 +141,12 @@
140141
141142
/*
142143
** Return the canonical pointer for a given branch name.
143144
** Multiple calls to this routine with equivalent strings
144145
** will return the same pointer.
146
+**
147
+** Note: also used for background color names.
145148
*/
146149
static char *persistBranchName(GraphContext *p, const char *zBranch){
147150
int i;
148151
for(i=0; i<p->nBranch; i++){
149152
if( strcmp(zBranch, p->azBranch[i])==0 ) return p->azBranch[i];
@@ -161,20 +164,23 @@
161164
int graph_add_row(
162165
GraphContext *p, /* The context to which the row is added */
163166
int rid, /* RID for the check-in */
164167
int nParent, /* Number of parents */
165168
int *aParent, /* Array of parents */
166
- const char *zBranch /* Branch for this check-in */
169
+ const char *zBranch, /* Branch for this check-in */
170
+ const char *zBgClr /* Background color. NULL or "" for white. */
167171
){
168172
GraphRow *pRow;
169173
170174
if( p->nErr ) return 0;
171175
if( nParent>GR_MAX_PARENT ){ p->nErr++; return 0; }
172176
pRow = (GraphRow*)safeMalloc( sizeof(GraphRow) );
173177
pRow->rid = rid;
174178
pRow->nParent = nParent;
175179
pRow->zBranch = persistBranchName(p, zBranch);
180
+ if( zBgClr==0 || zBgClr[0]==0 ) zBgClr = "white";
181
+ pRow->zBgClr = persistBranchName(p, zBgClr);
176182
memcpy(pRow->aParent, aParent, sizeof(aParent[0])*nParent);
177183
if( p->pFirst==0 ){
178184
p->pFirst = pRow;
179185
}else{
180186
p->pLast->pNext = pRow;
181187
--- src/graph.c
+++ src/graph.c
@@ -38,10 +38,11 @@
38 struct GraphRow {
39 int rid; /* The rid for the check-in */
40 int nParent; /* Number of parents */
41 int aParent[GR_MAX_PARENT]; /* Array of parents. 0 element is primary .*/
42 char *zBranch; /* Branch name */
 
43
44 GraphRow *pNext; /* Next row down in the list of all rows */
45 GraphRow *pPrev; /* Previous row */
46
47 int idx; /* Row index. First is 1. 0 used for "none" */
@@ -140,10 +141,12 @@
140
141 /*
142 ** Return the canonical pointer for a given branch name.
143 ** Multiple calls to this routine with equivalent strings
144 ** will return the same pointer.
 
 
145 */
146 static char *persistBranchName(GraphContext *p, const char *zBranch){
147 int i;
148 for(i=0; i<p->nBranch; i++){
149 if( strcmp(zBranch, p->azBranch[i])==0 ) return p->azBranch[i];
@@ -161,20 +164,23 @@
161 int graph_add_row(
162 GraphContext *p, /* The context to which the row is added */
163 int rid, /* RID for the check-in */
164 int nParent, /* Number of parents */
165 int *aParent, /* Array of parents */
166 const char *zBranch /* Branch for this check-in */
 
167 ){
168 GraphRow *pRow;
169
170 if( p->nErr ) return 0;
171 if( nParent>GR_MAX_PARENT ){ p->nErr++; return 0; }
172 pRow = (GraphRow*)safeMalloc( sizeof(GraphRow) );
173 pRow->rid = rid;
174 pRow->nParent = nParent;
175 pRow->zBranch = persistBranchName(p, zBranch);
 
 
176 memcpy(pRow->aParent, aParent, sizeof(aParent[0])*nParent);
177 if( p->pFirst==0 ){
178 p->pFirst = pRow;
179 }else{
180 p->pLast->pNext = pRow;
181
--- src/graph.c
+++ src/graph.c
@@ -38,10 +38,11 @@
38 struct GraphRow {
39 int rid; /* The rid for the check-in */
40 int nParent; /* Number of parents */
41 int aParent[GR_MAX_PARENT]; /* Array of parents. 0 element is primary .*/
42 char *zBranch; /* Branch name */
43 char *zBgClr; /* Background Color */
44
45 GraphRow *pNext; /* Next row down in the list of all rows */
46 GraphRow *pPrev; /* Previous row */
47
48 int idx; /* Row index. First is 1. 0 used for "none" */
@@ -140,10 +141,12 @@
141
142 /*
143 ** Return the canonical pointer for a given branch name.
144 ** Multiple calls to this routine with equivalent strings
145 ** will return the same pointer.
146 **
147 ** Note: also used for background color names.
148 */
149 static char *persistBranchName(GraphContext *p, const char *zBranch){
150 int i;
151 for(i=0; i<p->nBranch; i++){
152 if( strcmp(zBranch, p->azBranch[i])==0 ) return p->azBranch[i];
@@ -161,20 +164,23 @@
164 int graph_add_row(
165 GraphContext *p, /* The context to which the row is added */
166 int rid, /* RID for the check-in */
167 int nParent, /* Number of parents */
168 int *aParent, /* Array of parents */
169 const char *zBranch, /* Branch for this check-in */
170 const char *zBgClr /* Background color. NULL or "" for white. */
171 ){
172 GraphRow *pRow;
173
174 if( p->nErr ) return 0;
175 if( nParent>GR_MAX_PARENT ){ p->nErr++; return 0; }
176 pRow = (GraphRow*)safeMalloc( sizeof(GraphRow) );
177 pRow->rid = rid;
178 pRow->nParent = nParent;
179 pRow->zBranch = persistBranchName(p, zBranch);
180 if( zBgClr==0 || zBgClr[0]==0 ) zBgClr = "white";
181 pRow->zBgClr = persistBranchName(p, zBgClr);
182 memcpy(pRow->aParent, aParent, sizeof(aParent[0])*nParent);
183 if( p->pFirst==0 ){
184 p->pFirst = pRow;
185 }else{
186 p->pLast->pNext = pRow;
187
+5 -8
--- src/timeline.c
+++ src/timeline.c
@@ -273,11 +273,11 @@
273273
if( db_step(&qbranch)==SQLITE_ROW ){
274274
zBr = db_column_text(&qbranch, 0);
275275
}else{
276276
zBr = "trunk";
277277
}
278
- gidx = graph_add_row(pGraph, rid, nParent, aParent, zBr);
278
+ gidx = graph_add_row(pGraph, rid, nParent, aParent, zBr, zBgClr);
279279
db_reset(&qbranch);
280280
@ <div id="m%d(gidx)"></div>
281281
}
282282
if( zBgClr && zBgClr[0] ){
283283
@ <td valign="top" align="left" bgcolor="%h(zBgClr)">
@@ -369,12 +369,13 @@
369369
int i;
370370
char cSep;
371371
@ <script type="text/JavaScript">
372372
cgi_printf("var rowinfo = [\n");
373373
for(pRow=pGraph->pFirst; pRow; pRow=pRow->pNext){
374
- cgi_printf("{id:\"m%d\",r:%d,d:%d,mo:%d,mu:%d,u:%d,au:",
374
+ cgi_printf("{id:\"m%d\",bg:\"%s\",r:%d,d:%d,mo:%d,mu:%d,u:%d,au:",
375375
pRow->idx,
376
+ pRow->zBgClr,
376377
pRow->iRail,
377378
pRow->bDescender,
378379
pRow->mergeOut,
379380
pRow->mergeUpto,
380381
pRow->aiRaiser[pRow->iRail]
@@ -464,11 +465,11 @@
464465
@ function drawThinLine(x0,y0,x1,y1){
465466
@ drawBox("black",x0,y0,x1,y1);
466467
@ }
467468
@ function drawNode(p, left, btm){
468469
@ drawBox("black",p.x-5,p.y-5,p.x+6,p.y+6);
469
- @ drawBox("white",p.x-4,p.y-4,p.x+5,p.y+5);
470
+ @ drawBox(p.bg,p.x-4,p.y-4,p.x+5,p.y+5);
470471
@ if( p.u>0 ){
471472
@ var u = rowinfo[p.u-1];
472473
@ drawUpArrow(p.x, u.y+6, p.y-5);
473474
@ }
474475
@ if( p.d ){
@@ -525,18 +526,14 @@
525526
@ var context;
526527
@ if( realCanvas && realCanvas.getContext
527528
@ && (context = realCanvas.getContext('2d'))) {
528529
@ drawBox = function(color,x0,y0,x1,y1) {
529530
@ if( y0>32767 || y1>32767 ) return;
530
- @ var colors = {
531
- @ 'white':'rgba(255,255,255,1)',
532
- @ 'black':'rgba(0,0,0,1)'
533
- @ };
534531
@ if( x0>x1 ){ var t=x0; x0=x1; x1=t; }
535532
@ if( y0>y1 ){ var t=y0; y0=y1; y1=t; }
536533
@ if(isNaN(x0) || isNaN(y0) || isNaN(x1) || isNaN(y1)) return;
537
- @ context.fillStyle = colors[color];
534
+ @ context.fillStyle = color;
538535
@ context.fillRect(x0-left+5,y0,x1-x0+1,y1-y0+1);
539536
@ };
540537
@ }
541538
@ for(var i in rowinfo){
542539
@ drawNode(rowinfo[i], left, btm);
543540
--- src/timeline.c
+++ src/timeline.c
@@ -273,11 +273,11 @@
273 if( db_step(&qbranch)==SQLITE_ROW ){
274 zBr = db_column_text(&qbranch, 0);
275 }else{
276 zBr = "trunk";
277 }
278 gidx = graph_add_row(pGraph, rid, nParent, aParent, zBr);
279 db_reset(&qbranch);
280 @ <div id="m%d(gidx)"></div>
281 }
282 if( zBgClr && zBgClr[0] ){
283 @ <td valign="top" align="left" bgcolor="%h(zBgClr)">
@@ -369,12 +369,13 @@
369 int i;
370 char cSep;
371 @ <script type="text/JavaScript">
372 cgi_printf("var rowinfo = [\n");
373 for(pRow=pGraph->pFirst; pRow; pRow=pRow->pNext){
374 cgi_printf("{id:\"m%d\",r:%d,d:%d,mo:%d,mu:%d,u:%d,au:",
375 pRow->idx,
 
376 pRow->iRail,
377 pRow->bDescender,
378 pRow->mergeOut,
379 pRow->mergeUpto,
380 pRow->aiRaiser[pRow->iRail]
@@ -464,11 +465,11 @@
464 @ function drawThinLine(x0,y0,x1,y1){
465 @ drawBox("black",x0,y0,x1,y1);
466 @ }
467 @ function drawNode(p, left, btm){
468 @ drawBox("black",p.x-5,p.y-5,p.x+6,p.y+6);
469 @ drawBox("white",p.x-4,p.y-4,p.x+5,p.y+5);
470 @ if( p.u>0 ){
471 @ var u = rowinfo[p.u-1];
472 @ drawUpArrow(p.x, u.y+6, p.y-5);
473 @ }
474 @ if( p.d ){
@@ -525,18 +526,14 @@
525 @ var context;
526 @ if( realCanvas && realCanvas.getContext
527 @ && (context = realCanvas.getContext('2d'))) {
528 @ drawBox = function(color,x0,y0,x1,y1) {
529 @ if( y0>32767 || y1>32767 ) return;
530 @ var colors = {
531 @ 'white':'rgba(255,255,255,1)',
532 @ 'black':'rgba(0,0,0,1)'
533 @ };
534 @ if( x0>x1 ){ var t=x0; x0=x1; x1=t; }
535 @ if( y0>y1 ){ var t=y0; y0=y1; y1=t; }
536 @ if(isNaN(x0) || isNaN(y0) || isNaN(x1) || isNaN(y1)) return;
537 @ context.fillStyle = colors[color];
538 @ context.fillRect(x0-left+5,y0,x1-x0+1,y1-y0+1);
539 @ };
540 @ }
541 @ for(var i in rowinfo){
542 @ drawNode(rowinfo[i], left, btm);
543
--- src/timeline.c
+++ src/timeline.c
@@ -273,11 +273,11 @@
273 if( db_step(&qbranch)==SQLITE_ROW ){
274 zBr = db_column_text(&qbranch, 0);
275 }else{
276 zBr = "trunk";
277 }
278 gidx = graph_add_row(pGraph, rid, nParent, aParent, zBr, zBgClr);
279 db_reset(&qbranch);
280 @ <div id="m%d(gidx)"></div>
281 }
282 if( zBgClr && zBgClr[0] ){
283 @ <td valign="top" align="left" bgcolor="%h(zBgClr)">
@@ -369,12 +369,13 @@
369 int i;
370 char cSep;
371 @ <script type="text/JavaScript">
372 cgi_printf("var rowinfo = [\n");
373 for(pRow=pGraph->pFirst; pRow; pRow=pRow->pNext){
374 cgi_printf("{id:\"m%d\",bg:\"%s\",r:%d,d:%d,mo:%d,mu:%d,u:%d,au:",
375 pRow->idx,
376 pRow->zBgClr,
377 pRow->iRail,
378 pRow->bDescender,
379 pRow->mergeOut,
380 pRow->mergeUpto,
381 pRow->aiRaiser[pRow->iRail]
@@ -464,11 +465,11 @@
465 @ function drawThinLine(x0,y0,x1,y1){
466 @ drawBox("black",x0,y0,x1,y1);
467 @ }
468 @ function drawNode(p, left, btm){
469 @ drawBox("black",p.x-5,p.y-5,p.x+6,p.y+6);
470 @ drawBox(p.bg,p.x-4,p.y-4,p.x+5,p.y+5);
471 @ if( p.u>0 ){
472 @ var u = rowinfo[p.u-1];
473 @ drawUpArrow(p.x, u.y+6, p.y-5);
474 @ }
475 @ if( p.d ){
@@ -525,18 +526,14 @@
526 @ var context;
527 @ if( realCanvas && realCanvas.getContext
528 @ && (context = realCanvas.getContext('2d'))) {
529 @ drawBox = function(color,x0,y0,x1,y1) {
530 @ if( y0>32767 || y1>32767 ) return;
 
 
 
 
531 @ if( x0>x1 ){ var t=x0; x0=x1; x1=t; }
532 @ if( y0>y1 ){ var t=y0; y0=y1; y1=t; }
533 @ if(isNaN(x0) || isNaN(y0) || isNaN(x1) || isNaN(y1)) return;
534 @ context.fillStyle = color;
535 @ context.fillRect(x0-left+5,y0,x1-x0+1,y1-y0+1);
536 @ };
537 @ }
538 @ for(var i in rowinfo){
539 @ drawNode(rowinfo[i], left, btm);
540

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button