Fossil SCM

Fix the display of technotes on the main timeline so that their background color shows again.

drh 2018-02-10 15:38 trunk
Commit 694e11a72e32bb45a503157a9873f56af5ee59318fed2bcfd86cba15ae458285
+10 -6
--- src/graph.c
+++ src/graph.c
@@ -27,14 +27,17 @@
2727
2828
/* The graph appears vertically beside a timeline. Each row in the
2929
** timeline corresponds to a row in the graph. GraphRow.idx is 0 for
3030
** the top-most row and increases moving down. Hence (in the absence of
3131
** time skew) parents have a larger index than their children.
32
+**
33
+** The nParent field is -1 for entires that do not participate in the graph
34
+** but which are included just so that we can capture their background color.
3235
*/
3336
struct GraphRow {
3437
int rid; /* The rid for the check-in */
35
- i8 nParent; /* Number of parents */
38
+ i8 nParent; /* Number of parents. -1 for technote lines */
3639
int *aParent; /* Array of parents. 0 element is primary .*/
3740
char *zBranch; /* Branch name */
3841
char *zBgClr; /* Background Color */
3942
char zUuid[41]; /* Check-in for file ID */
4043
@@ -188,23 +191,23 @@
188191
int nByte;
189192
static int nRow = 0;
190193
191194
if( p->nErr ) return 0;
192195
nByte = sizeof(GraphRow);
193
- nByte += sizeof(pRow->aParent[0])*nParent;
196
+ if( nParent>0 ) nByte += sizeof(pRow->aParent[0])*nParent;
194197
pRow = (GraphRow*)safeMalloc( nByte );
195
- pRow->aParent = (int*)&pRow[1];
198
+ pRow->aParent = nParent>0 ? (int*)&pRow[1] : 0;
196199
pRow->rid = rid;
197200
pRow->nParent = nParent;
198201
pRow->zBranch = persistBranchName(p, zBranch);
199202
if( zUuid==0 ) zUuid = "";
200203
sqlite3_snprintf(sizeof(pRow->zUuid), pRow->zUuid, "%s", zUuid);
201204
pRow->isLeaf = isLeaf;
202205
memset(pRow->aiRiser, -1, sizeof(pRow->aiRiser));
203206
if( zBgClr==0 ) zBgClr = "";
204207
pRow->zBgClr = persistBranchName(p, zBgClr);
205
- memcpy(pRow->aParent, aParent, sizeof(aParent[0])*nParent);
208
+ if( nParent>0 ) memcpy(pRow->aParent, aParent, sizeof(aParent[0])*nParent);
206209
if( p->pFirst==0 ){
207210
p->pFirst = pRow;
208211
}else{
209212
p->pLast->pNext = pRow;
210213
}
@@ -432,11 +435,11 @@
432435
** In the case of a fork, choose the pChild that results in the
433436
** longest rail.
434437
*/
435438
for(pRow=p->pFirst; pRow; pRow=pRow->pNext){
436439
if( pRow->isDup ) continue;
437
- if( pRow->nParent==0 ) continue; /* Root node */
440
+ if( pRow->nParent<=0 ) continue; /* Root node */
438441
pParent = hashFind(p, pRow->aParent[0]);
439442
if( pParent==0 ) continue; /* Parent off-screen */
440443
if( pParent->zBranch!=pRow->zBranch ) continue; /* Different branch */
441444
if( pParent->idx <= pRow->idx ){
442445
pParent->timeWarp = 1;
@@ -455,10 +458,11 @@
455458
*/
456459
zTrunk = persistBranchName(p, "trunk");
457460
for(i=0; i<2; i++){
458461
for(pRow=p->pLast; pRow; pRow=pRow->pPrev){
459462
if( pRow->isDup ) continue;
463
+ if( pRow->nParent<0 ) continue;
460464
if( i==0 ){
461465
if( pRow->zBranch!=zTrunk ) continue;
462466
}else {
463467
if( pRow->iRail>=0 ) continue;
464468
}
@@ -492,11 +496,11 @@
492496
riser_to_top(pRow);
493497
}
494498
}
495499
continue;
496500
}
497
- if( pRow->isDup ){
501
+ if( pRow->isDup || pRow->nParent<0 ){
498502
continue;
499503
}else{
500504
assert( pRow->nParent>0 );
501505
parentRid = pRow->aParent[0];
502506
pParent = hashFind(p, parentRid);
503507
--- src/graph.c
+++ src/graph.c
@@ -27,14 +27,17 @@
27
28 /* The graph appears vertically beside a timeline. Each row in the
29 ** timeline corresponds to a row in the graph. GraphRow.idx is 0 for
30 ** the top-most row and increases moving down. Hence (in the absence of
31 ** time skew) parents have a larger index than their children.
 
 
 
32 */
33 struct GraphRow {
34 int rid; /* The rid for the check-in */
35 i8 nParent; /* Number of parents */
36 int *aParent; /* Array of parents. 0 element is primary .*/
37 char *zBranch; /* Branch name */
38 char *zBgClr; /* Background Color */
39 char zUuid[41]; /* Check-in for file ID */
40
@@ -188,23 +191,23 @@
188 int nByte;
189 static int nRow = 0;
190
191 if( p->nErr ) return 0;
192 nByte = sizeof(GraphRow);
193 nByte += sizeof(pRow->aParent[0])*nParent;
194 pRow = (GraphRow*)safeMalloc( nByte );
195 pRow->aParent = (int*)&pRow[1];
196 pRow->rid = rid;
197 pRow->nParent = nParent;
198 pRow->zBranch = persistBranchName(p, zBranch);
199 if( zUuid==0 ) zUuid = "";
200 sqlite3_snprintf(sizeof(pRow->zUuid), pRow->zUuid, "%s", zUuid);
201 pRow->isLeaf = isLeaf;
202 memset(pRow->aiRiser, -1, sizeof(pRow->aiRiser));
203 if( zBgClr==0 ) zBgClr = "";
204 pRow->zBgClr = persistBranchName(p, zBgClr);
205 memcpy(pRow->aParent, aParent, sizeof(aParent[0])*nParent);
206 if( p->pFirst==0 ){
207 p->pFirst = pRow;
208 }else{
209 p->pLast->pNext = pRow;
210 }
@@ -432,11 +435,11 @@
432 ** In the case of a fork, choose the pChild that results in the
433 ** longest rail.
434 */
435 for(pRow=p->pFirst; pRow; pRow=pRow->pNext){
436 if( pRow->isDup ) continue;
437 if( pRow->nParent==0 ) continue; /* Root node */
438 pParent = hashFind(p, pRow->aParent[0]);
439 if( pParent==0 ) continue; /* Parent off-screen */
440 if( pParent->zBranch!=pRow->zBranch ) continue; /* Different branch */
441 if( pParent->idx <= pRow->idx ){
442 pParent->timeWarp = 1;
@@ -455,10 +458,11 @@
455 */
456 zTrunk = persistBranchName(p, "trunk");
457 for(i=0; i<2; i++){
458 for(pRow=p->pLast; pRow; pRow=pRow->pPrev){
459 if( pRow->isDup ) continue;
 
460 if( i==0 ){
461 if( pRow->zBranch!=zTrunk ) continue;
462 }else {
463 if( pRow->iRail>=0 ) continue;
464 }
@@ -492,11 +496,11 @@
492 riser_to_top(pRow);
493 }
494 }
495 continue;
496 }
497 if( pRow->isDup ){
498 continue;
499 }else{
500 assert( pRow->nParent>0 );
501 parentRid = pRow->aParent[0];
502 pParent = hashFind(p, parentRid);
503
--- src/graph.c
+++ src/graph.c
@@ -27,14 +27,17 @@
27
28 /* The graph appears vertically beside a timeline. Each row in the
29 ** timeline corresponds to a row in the graph. GraphRow.idx is 0 for
30 ** the top-most row and increases moving down. Hence (in the absence of
31 ** time skew) parents have a larger index than their children.
32 **
33 ** The nParent field is -1 for entires that do not participate in the graph
34 ** but which are included just so that we can capture their background color.
35 */
36 struct GraphRow {
37 int rid; /* The rid for the check-in */
38 i8 nParent; /* Number of parents. -1 for technote lines */
39 int *aParent; /* Array of parents. 0 element is primary .*/
40 char *zBranch; /* Branch name */
41 char *zBgClr; /* Background Color */
42 char zUuid[41]; /* Check-in for file ID */
43
@@ -188,23 +191,23 @@
191 int nByte;
192 static int nRow = 0;
193
194 if( p->nErr ) return 0;
195 nByte = sizeof(GraphRow);
196 if( nParent>0 ) nByte += sizeof(pRow->aParent[0])*nParent;
197 pRow = (GraphRow*)safeMalloc( nByte );
198 pRow->aParent = nParent>0 ? (int*)&pRow[1] : 0;
199 pRow->rid = rid;
200 pRow->nParent = nParent;
201 pRow->zBranch = persistBranchName(p, zBranch);
202 if( zUuid==0 ) zUuid = "";
203 sqlite3_snprintf(sizeof(pRow->zUuid), pRow->zUuid, "%s", zUuid);
204 pRow->isLeaf = isLeaf;
205 memset(pRow->aiRiser, -1, sizeof(pRow->aiRiser));
206 if( zBgClr==0 ) zBgClr = "";
207 pRow->zBgClr = persistBranchName(p, zBgClr);
208 if( nParent>0 ) memcpy(pRow->aParent, aParent, sizeof(aParent[0])*nParent);
209 if( p->pFirst==0 ){
210 p->pFirst = pRow;
211 }else{
212 p->pLast->pNext = pRow;
213 }
@@ -432,11 +435,11 @@
435 ** In the case of a fork, choose the pChild that results in the
436 ** longest rail.
437 */
438 for(pRow=p->pFirst; pRow; pRow=pRow->pNext){
439 if( pRow->isDup ) continue;
440 if( pRow->nParent<=0 ) continue; /* Root node */
441 pParent = hashFind(p, pRow->aParent[0]);
442 if( pParent==0 ) continue; /* Parent off-screen */
443 if( pParent->zBranch!=pRow->zBranch ) continue; /* Different branch */
444 if( pParent->idx <= pRow->idx ){
445 pParent->timeWarp = 1;
@@ -455,10 +458,11 @@
458 */
459 zTrunk = persistBranchName(p, "trunk");
460 for(i=0; i<2; i++){
461 for(pRow=p->pLast; pRow; pRow=pRow->pPrev){
462 if( pRow->isDup ) continue;
463 if( pRow->nParent<0 ) continue;
464 if( i==0 ){
465 if( pRow->zBranch!=zTrunk ) continue;
466 }else {
467 if( pRow->iRail>=0 ) continue;
468 }
@@ -492,11 +496,11 @@
496 riser_to_top(pRow);
497 }
498 }
499 continue;
500 }
501 if( pRow->isDup || pRow->nParent<0 ){
502 continue;
503 }else{
504 assert( pRow->nParent>0 );
505 parentRid = pRow->aParent[0];
506 pParent = hashFind(p, parentRid);
507
--- src/graph.js
+++ src/graph.js
@@ -208,10 +208,11 @@
208208
var e = document.getElementById("mc"+p.id);
209209
if(e) e.style.backgroundColor = p.bg;
210210
e = document.getElementById("md"+p.id);
211211
if(e) e.style.backgroundColor = p.bg;
212212
}
213
+ if( p.r<0 ) return;
213214
if( p.u>0 ) drawUpArrow(p,tx.rowinfo[p.u-tx.iTopRow],p.fg);
214215
var cls = node.cls;
215216
if( p.mi.length ) cls += " merge";
216217
if( p.f&1 ) cls += " leaf";
217218
var n = drawBox(cls,p.bg,p.x,p.y);
218219
--- src/graph.js
+++ src/graph.js
@@ -208,10 +208,11 @@
208 var e = document.getElementById("mc"+p.id);
209 if(e) e.style.backgroundColor = p.bg;
210 e = document.getElementById("md"+p.id);
211 if(e) e.style.backgroundColor = p.bg;
212 }
 
213 if( p.u>0 ) drawUpArrow(p,tx.rowinfo[p.u-tx.iTopRow],p.fg);
214 var cls = node.cls;
215 if( p.mi.length ) cls += " merge";
216 if( p.f&1 ) cls += " leaf";
217 var n = drawBox(cls,p.bg,p.x,p.y);
218
--- src/graph.js
+++ src/graph.js
@@ -208,10 +208,11 @@
208 var e = document.getElementById("mc"+p.id);
209 if(e) e.style.backgroundColor = p.bg;
210 e = document.getElementById("md"+p.id);
211 if(e) e.style.backgroundColor = p.bg;
212 }
213 if( p.r<0 ) return;
214 if( p.u>0 ) drawUpArrow(p,tx.rowinfo[p.u-tx.iTopRow],p.fg);
215 var cls = node.cls;
216 if( p.mi.length ) cls += " merge";
217 if( p.f&1 ) cls += " leaf";
218 var n = drawBox(cls,p.bg,p.x,p.y);
219
+7 -1
--- src/timeline.c
+++ src/timeline.c
@@ -418,11 +418,11 @@
418418
}else{
419419
zBgClr = hash_color(zBr);
420420
}
421421
}
422422
}
423
- if( zType[0]=='c' && (pGraph || (tmFlags & TIMELINE_BRCOLOR)!=0) ){
423
+ if( zType[0]=='c' && pGraph ){
424424
int nParent = 0;
425425
int aParent[GR_MAX_RAIL];
426426
static Stmt qparent;
427427
db_static_prepare(&qparent,
428428
"SELECT pid FROM plink"
@@ -436,10 +436,16 @@
436436
db_reset(&qparent);
437437
gidx = graph_add_row(pGraph, rid, nParent, aParent, zBr, zBgClr,
438438
zUuid, isLeaf);
439439
db_reset(&qbranch);
440440
@ <div id="m%d(gidx)" class="tl-nodemark"></div>
441
+ }else if( zType[0]=='e' && pGraph && zBgClr && zBgClr[0] ){
442
+ /* For technotes, make a graph node with nParent==(-1). This will
443
+ ** not actually draw anything on the graph, but it will set the
444
+ ** background color of the timeline entry */
445
+ gidx = graph_add_row(pGraph, rid, -1, 0, zBr, zBgClr, zUuid, 0);
446
+ @ <div id="m%d(gidx)" class="tl-nodemark"></div>
441447
}
442448
@</td>
443449
if( !isSelectedOrCurrent ){
444450
@ <td class="timeline%s(zStyle)Cell" id='mc%d(gidx)'>
445451
}else{
446452
--- src/timeline.c
+++ src/timeline.c
@@ -418,11 +418,11 @@
418 }else{
419 zBgClr = hash_color(zBr);
420 }
421 }
422 }
423 if( zType[0]=='c' && (pGraph || (tmFlags & TIMELINE_BRCOLOR)!=0) ){
424 int nParent = 0;
425 int aParent[GR_MAX_RAIL];
426 static Stmt qparent;
427 db_static_prepare(&qparent,
428 "SELECT pid FROM plink"
@@ -436,10 +436,16 @@
436 db_reset(&qparent);
437 gidx = graph_add_row(pGraph, rid, nParent, aParent, zBr, zBgClr,
438 zUuid, isLeaf);
439 db_reset(&qbranch);
440 @ <div id="m%d(gidx)" class="tl-nodemark"></div>
 
 
 
 
 
 
441 }
442 @</td>
443 if( !isSelectedOrCurrent ){
444 @ <td class="timeline%s(zStyle)Cell" id='mc%d(gidx)'>
445 }else{
446
--- src/timeline.c
+++ src/timeline.c
@@ -418,11 +418,11 @@
418 }else{
419 zBgClr = hash_color(zBr);
420 }
421 }
422 }
423 if( zType[0]=='c' && pGraph ){
424 int nParent = 0;
425 int aParent[GR_MAX_RAIL];
426 static Stmt qparent;
427 db_static_prepare(&qparent,
428 "SELECT pid FROM plink"
@@ -436,10 +436,16 @@
436 db_reset(&qparent);
437 gidx = graph_add_row(pGraph, rid, nParent, aParent, zBr, zBgClr,
438 zUuid, isLeaf);
439 db_reset(&qbranch);
440 @ <div id="m%d(gidx)" class="tl-nodemark"></div>
441 }else if( zType[0]=='e' && pGraph && zBgClr && zBgClr[0] ){
442 /* For technotes, make a graph node with nParent==(-1). This will
443 ** not actually draw anything on the graph, but it will set the
444 ** background color of the timeline entry */
445 gidx = graph_add_row(pGraph, rid, -1, 0, zBr, zBgClr, zUuid, 0);
446 @ <div id="m%d(gidx)" class="tl-nodemark"></div>
447 }
448 @</td>
449 if( !isSelectedOrCurrent ){
450 @ <td class="timeline%s(zStyle)Cell" id='mc%d(gidx)'>
451 }else{
452

Keyboard Shortcuts

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