Fossil SCM

In the graph layout, make sure that the idxTop value is properly relayed across gaps.

drh 2019-05-17 19:30 graph-improvements
Commit e0186fdb5ef46795c03a235d12103a468f7f5548897b45af95f5ab3dd70e20c2
1 file changed +14 -11
+14 -11
--- src/graph.c
+++ src/graph.c
@@ -515,16 +515,13 @@
515515
if( pRow->nParent<=0 ) continue; /* Root node */
516516
pParent = hashFind(p, pRow->aParent[0]);
517517
if( pParent==0 ) continue; /* Parent off-screen */
518518
if( pParent->zBranch!=pRow->zBranch ) continue; /* Different branch */
519519
if( pParent->idx <= pRow->idx ){
520
- pParent->timeWarp = 1;
521
- continue; /* Time-warp */
522
- }
523
- if( pRow->idxTop < pParent->idxTop ){
520
+ pParent->timeWarp = 1;
521
+ }else if( pRow->idx < pParent->idx ){
524522
pParent->pChild = pRow;
525
- pParent->idxTop = pRow->idxTop;
526523
}
527524
}
528525
529526
if( tmFlags & TIMELINE_FILLGAPS ){
530527
/* If a node has no pChild but there is a node higher up in the graph
@@ -538,34 +535,40 @@
538535
if( pLoop->nParent>0
539536
&& pLoop->zBranch==pRow->zBranch
540537
&& hashFind(p,pLoop->aParent[0])==0
541538
){
542539
pRow->pChild = pLoop;
543
- pRow->idxTop = pLoop->idxTop;
544540
pRow->isStepParent = 1;
545541
pLoop->aParent[0] = pRow->rid;
546542
break;
547543
}
548544
}
549545
}
550546
}
547
+
548
+ /* Set the idxTop values for all entries. The idxTop value is the
549
+ ** "idx" value for the top entry in its stack of children.
550
+ */
551
+ for(pRow=p->pFirst; pRow; pRow=pRow->pNext){
552
+ GraphRow *pChild = pRow->pChild;
553
+ if( pChild && pRow->idxTop>pChild->idxTop ){
554
+ pRow->idxTop = pChild->idxTop;
555
+ }
556
+ }
551557
552558
/* Identify rows where the primary parent is off screen. Assign
553559
** each to a rail and draw descenders downward.
554560
**
555561
** Strive to put the "trunk" branch on far left.
556562
*/
557563
zTrunk = persistBranchName(p, "trunk");
558564
for(i=0; i<2; i++){
559565
for(pRow=p->pLast; pRow; pRow=pRow->pPrev){
566
+ if( i==0 && pRow->zBranch!=zTrunk ) continue;
567
+ if( pRow->iRail>=0 ) continue;
560568
if( pRow->isDup ) continue;
561569
if( pRow->nParent<0 ) continue;
562
- if( i==0 ){
563
- if( pRow->zBranch!=zTrunk ) continue;
564
- }else {
565
- if( pRow->iRail>=0 ) continue;
566
- }
567570
if( pRow->nParent==0 || hashFind(p,pRow->aParent[0])==0 ){
568571
pRow->iRail = findFreeRail(p, pRow->idxTop, pRow->idx+RISER_MARGIN, 0);
569572
if( p->mxRail>=GR_MAX_RAIL ) return;
570573
mask = BIT(pRow->iRail);
571574
if( !omitDescenders ){
572575
--- src/graph.c
+++ src/graph.c
@@ -515,16 +515,13 @@
515 if( pRow->nParent<=0 ) continue; /* Root node */
516 pParent = hashFind(p, pRow->aParent[0]);
517 if( pParent==0 ) continue; /* Parent off-screen */
518 if( pParent->zBranch!=pRow->zBranch ) continue; /* Different branch */
519 if( pParent->idx <= pRow->idx ){
520 pParent->timeWarp = 1;
521 continue; /* Time-warp */
522 }
523 if( pRow->idxTop < pParent->idxTop ){
524 pParent->pChild = pRow;
525 pParent->idxTop = pRow->idxTop;
526 }
527 }
528
529 if( tmFlags & TIMELINE_FILLGAPS ){
530 /* If a node has no pChild but there is a node higher up in the graph
@@ -538,34 +535,40 @@
538 if( pLoop->nParent>0
539 && pLoop->zBranch==pRow->zBranch
540 && hashFind(p,pLoop->aParent[0])==0
541 ){
542 pRow->pChild = pLoop;
543 pRow->idxTop = pLoop->idxTop;
544 pRow->isStepParent = 1;
545 pLoop->aParent[0] = pRow->rid;
546 break;
547 }
548 }
549 }
550 }
 
 
 
 
 
 
 
 
 
 
551
552 /* Identify rows where the primary parent is off screen. Assign
553 ** each to a rail and draw descenders downward.
554 **
555 ** Strive to put the "trunk" branch on far left.
556 */
557 zTrunk = persistBranchName(p, "trunk");
558 for(i=0; i<2; i++){
559 for(pRow=p->pLast; pRow; pRow=pRow->pPrev){
 
 
560 if( pRow->isDup ) continue;
561 if( pRow->nParent<0 ) continue;
562 if( i==0 ){
563 if( pRow->zBranch!=zTrunk ) continue;
564 }else {
565 if( pRow->iRail>=0 ) continue;
566 }
567 if( pRow->nParent==0 || hashFind(p,pRow->aParent[0])==0 ){
568 pRow->iRail = findFreeRail(p, pRow->idxTop, pRow->idx+RISER_MARGIN, 0);
569 if( p->mxRail>=GR_MAX_RAIL ) return;
570 mask = BIT(pRow->iRail);
571 if( !omitDescenders ){
572
--- src/graph.c
+++ src/graph.c
@@ -515,16 +515,13 @@
515 if( pRow->nParent<=0 ) continue; /* Root node */
516 pParent = hashFind(p, pRow->aParent[0]);
517 if( pParent==0 ) continue; /* Parent off-screen */
518 if( pParent->zBranch!=pRow->zBranch ) continue; /* Different branch */
519 if( pParent->idx <= pRow->idx ){
520 pParent->timeWarp = 1;
521 }else if( pRow->idx < pParent->idx ){
 
 
522 pParent->pChild = pRow;
 
523 }
524 }
525
526 if( tmFlags & TIMELINE_FILLGAPS ){
527 /* If a node has no pChild but there is a node higher up in the graph
@@ -538,34 +535,40 @@
535 if( pLoop->nParent>0
536 && pLoop->zBranch==pRow->zBranch
537 && hashFind(p,pLoop->aParent[0])==0
538 ){
539 pRow->pChild = pLoop;
 
540 pRow->isStepParent = 1;
541 pLoop->aParent[0] = pRow->rid;
542 break;
543 }
544 }
545 }
546 }
547
548 /* Set the idxTop values for all entries. The idxTop value is the
549 ** "idx" value for the top entry in its stack of children.
550 */
551 for(pRow=p->pFirst; pRow; pRow=pRow->pNext){
552 GraphRow *pChild = pRow->pChild;
553 if( pChild && pRow->idxTop>pChild->idxTop ){
554 pRow->idxTop = pChild->idxTop;
555 }
556 }
557
558 /* Identify rows where the primary parent is off screen. Assign
559 ** each to a rail and draw descenders downward.
560 **
561 ** Strive to put the "trunk" branch on far left.
562 */
563 zTrunk = persistBranchName(p, "trunk");
564 for(i=0; i<2; i++){
565 for(pRow=p->pLast; pRow; pRow=pRow->pPrev){
566 if( i==0 && pRow->zBranch!=zTrunk ) continue;
567 if( pRow->iRail>=0 ) continue;
568 if( pRow->isDup ) continue;
569 if( pRow->nParent<0 ) continue;
 
 
 
 
 
570 if( pRow->nParent==0 || hashFind(p,pRow->aParent[0])==0 ){
571 pRow->iRail = findFreeRail(p, pRow->idxTop, pRow->idx+RISER_MARGIN, 0);
572 if( p->mxRail>=GR_MAX_RAIL ) return;
573 mask = BIT(pRow->iRail);
574 if( !omitDescenders ){
575

Keyboard Shortcuts

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