Fossil SCM

Allow the rail patch on graphs to go as low as 11 pixels. Adjust the offset of the merge risers as the rail pitch gets smaller so that merge arrows do not overlap the merge risers.

drh 2015-03-10 02:21 trunk
Commit e81344f3bd663c143ed3e9857fb794bc596fdae0
2 files changed +6 -3 +13 -2
+6 -3
--- src/graph.c
+++ src/graph.c
@@ -47,11 +47,11 @@
4747
u8 isDup; /* True if this is duplicate of a prior entry */
4848
u8 isLeaf; /* True if this is a leaf node */
4949
u8 timeWarp; /* Child is earlier in time */
5050
u8 bDescender; /* True if riser from bottom of graph to here. */
5151
i8 iRail; /* Which rail this check-in appears on. 0-based.*/
52
- i8 mergeOut; /* Merge out to this rail. -1 if no merge-out */
52
+ i8 mergeOut; /* Merge out on rail mergeOut/4. -1 for none */
5353
u8 mergeIn[GR_MAX_RAIL]; /* Merge in from non-zero rails */
5454
int aiRiser[GR_MAX_RAIL]; /* Risers from this node to a higher row. */
5555
int mergeUpto; /* Draw the mergeOut rail up to this level */
5656
u64 mergeDown; /* Draw merge lines up from bottom of graph */
5757
@@ -584,9 +584,12 @@
584584
585585
/*
586586
** Find the maximum rail number.
587587
*/
588588
find_max_rail(p);
589
- p->iRailPitch = 18 - (p->mxRail/3);
590
- if( p->iRailPitch<12 ) p->iRailPitch = 12;
589
+ p->iRailPitch = atoi(PD("railpitch","0"));
590
+ if( p->iRailPitch<=0 ){
591
+ p->iRailPitch = 18 - (p->mxRail/3);
592
+ if( p->iRailPitch<11 ) p->iRailPitch = 11;
593
+ }
591594
p->nErr = 0;
592595
}
593596
--- src/graph.c
+++ src/graph.c
@@ -47,11 +47,11 @@
47 u8 isDup; /* True if this is duplicate of a prior entry */
48 u8 isLeaf; /* True if this is a leaf node */
49 u8 timeWarp; /* Child is earlier in time */
50 u8 bDescender; /* True if riser from bottom of graph to here. */
51 i8 iRail; /* Which rail this check-in appears on. 0-based.*/
52 i8 mergeOut; /* Merge out to this rail. -1 if no merge-out */
53 u8 mergeIn[GR_MAX_RAIL]; /* Merge in from non-zero rails */
54 int aiRiser[GR_MAX_RAIL]; /* Risers from this node to a higher row. */
55 int mergeUpto; /* Draw the mergeOut rail up to this level */
56 u64 mergeDown; /* Draw merge lines up from bottom of graph */
57
@@ -584,9 +584,12 @@
584
585 /*
586 ** Find the maximum rail number.
587 */
588 find_max_rail(p);
589 p->iRailPitch = 18 - (p->mxRail/3);
590 if( p->iRailPitch<12 ) p->iRailPitch = 12;
 
 
 
591 p->nErr = 0;
592 }
593
--- src/graph.c
+++ src/graph.c
@@ -47,11 +47,11 @@
47 u8 isDup; /* True if this is duplicate of a prior entry */
48 u8 isLeaf; /* True if this is a leaf node */
49 u8 timeWarp; /* Child is earlier in time */
50 u8 bDescender; /* True if riser from bottom of graph to here. */
51 i8 iRail; /* Which rail this check-in appears on. 0-based.*/
52 i8 mergeOut; /* Merge out on rail mergeOut/4. -1 for none */
53 u8 mergeIn[GR_MAX_RAIL]; /* Merge in from non-zero rails */
54 int aiRiser[GR_MAX_RAIL]; /* Risers from this node to a higher row. */
55 int mergeUpto; /* Draw the mergeOut rail up to this level */
56 u64 mergeDown; /* Draw merge lines up from bottom of graph */
57
@@ -584,9 +584,12 @@
584
585 /*
586 ** Find the maximum rail number.
587 */
588 find_max_rail(p);
589 p->iRailPitch = atoi(PD("railpitch","0"));
590 if( p->iRailPitch<=0 ){
591 p->iRailPitch = 18 - (p->mxRail/3);
592 if( p->iRailPitch<11 ) p->iRailPitch = 11;
593 }
594 p->nErr = 0;
595 }
596
+13 -2
--- src/timeline.c
+++ src/timeline.c
@@ -610,10 +610,15 @@
610610
){
611611
if( pGraph && pGraph->nErr==0 && pGraph->nRow>0 ){
612612
GraphRow *pRow;
613613
int i;
614614
char cSep;
615
+ int mergeOffset;
616
+
617
+ /* Number of pixels that the thin merge lines are offset from the
618
+ ** the center of the think rail lines */
619
+ mergeOffset = pGraph->iRailPitch>=14 ? 4 : pGraph->iRailPitch>=13 ? 3 : 0;
615620
616621
@ <script>
617622
@ var railPitch=%d(pGraph->iRailPitch);
618623
619624
/* the rowinfo[] array contains all the information needed to generate
@@ -651,11 +656,17 @@
651656
for(pRow=pGraph->pFirst; pRow; pRow=pRow->pNext){
652657
int mo = pRow->mergeOut;
653658
if( mo<0 ){
654659
mo = 0;
655660
}else{
656
- mo = (mo/4)*pGraph->iRailPitch - 3 + 4*(mo&3);
661
+ int x = (mo/4)*pGraph->iRailPitch;
662
+ switch( mo&3 ){
663
+ case 0: x -= mergeOffset-2; break;
664
+ case 1: x += 1; break;
665
+ case 2: x += mergeOffset+1; break;
666
+ }
667
+ mo = x;
657668
}
658669
cgi_printf("{id:%d,bg:\"%s\",r:%d,d:%d,mo:%d,mu:%d,u:%d,f:%d,au:",
659670
pRow->idx, /* id */
660671
pRow->zBgClr, /* bg */
661672
pRow->iRail, /* r */
@@ -678,11 +689,11 @@
678689
cgi_printf("],mi:");
679690
/* mi */
680691
cSep = '[';
681692
for(i=0; i<GR_MAX_RAIL; i++){
682693
if( pRow->mergeIn[i] ){
683
- int mi = i*pGraph->iRailPitch - 8 + 4*pRow->mergeIn[i];
694
+ int mi = i*pGraph->iRailPitch - mergeOffset*(2 - pRow->mergeIn[i]);
684695
if( pRow->mergeDown & (1<<i) ) mi = -mi;
685696
cgi_printf("%c%d", cSep, mi);
686697
cSep = ',';
687698
}
688699
}
689700
--- src/timeline.c
+++ src/timeline.c
@@ -610,10 +610,15 @@
610 ){
611 if( pGraph && pGraph->nErr==0 && pGraph->nRow>0 ){
612 GraphRow *pRow;
613 int i;
614 char cSep;
 
 
 
 
 
615
616 @ <script>
617 @ var railPitch=%d(pGraph->iRailPitch);
618
619 /* the rowinfo[] array contains all the information needed to generate
@@ -651,11 +656,17 @@
651 for(pRow=pGraph->pFirst; pRow; pRow=pRow->pNext){
652 int mo = pRow->mergeOut;
653 if( mo<0 ){
654 mo = 0;
655 }else{
656 mo = (mo/4)*pGraph->iRailPitch - 3 + 4*(mo&3);
 
 
 
 
 
 
657 }
658 cgi_printf("{id:%d,bg:\"%s\",r:%d,d:%d,mo:%d,mu:%d,u:%d,f:%d,au:",
659 pRow->idx, /* id */
660 pRow->zBgClr, /* bg */
661 pRow->iRail, /* r */
@@ -678,11 +689,11 @@
678 cgi_printf("],mi:");
679 /* mi */
680 cSep = '[';
681 for(i=0; i<GR_MAX_RAIL; i++){
682 if( pRow->mergeIn[i] ){
683 int mi = i*pGraph->iRailPitch - 8 + 4*pRow->mergeIn[i];
684 if( pRow->mergeDown & (1<<i) ) mi = -mi;
685 cgi_printf("%c%d", cSep, mi);
686 cSep = ',';
687 }
688 }
689
--- src/timeline.c
+++ src/timeline.c
@@ -610,10 +610,15 @@
610 ){
611 if( pGraph && pGraph->nErr==0 && pGraph->nRow>0 ){
612 GraphRow *pRow;
613 int i;
614 char cSep;
615 int mergeOffset;
616
617 /* Number of pixels that the thin merge lines are offset from the
618 ** the center of the think rail lines */
619 mergeOffset = pGraph->iRailPitch>=14 ? 4 : pGraph->iRailPitch>=13 ? 3 : 0;
620
621 @ <script>
622 @ var railPitch=%d(pGraph->iRailPitch);
623
624 /* the rowinfo[] array contains all the information needed to generate
@@ -651,11 +656,17 @@
656 for(pRow=pGraph->pFirst; pRow; pRow=pRow->pNext){
657 int mo = pRow->mergeOut;
658 if( mo<0 ){
659 mo = 0;
660 }else{
661 int x = (mo/4)*pGraph->iRailPitch;
662 switch( mo&3 ){
663 case 0: x -= mergeOffset-2; break;
664 case 1: x += 1; break;
665 case 2: x += mergeOffset+1; break;
666 }
667 mo = x;
668 }
669 cgi_printf("{id:%d,bg:\"%s\",r:%d,d:%d,mo:%d,mu:%d,u:%d,f:%d,au:",
670 pRow->idx, /* id */
671 pRow->zBgClr, /* bg */
672 pRow->iRail, /* r */
@@ -678,11 +689,11 @@
689 cgi_printf("],mi:");
690 /* mi */
691 cSep = '[';
692 for(i=0; i<GR_MAX_RAIL; i++){
693 if( pRow->mergeIn[i] ){
694 int mi = i*pGraph->iRailPitch - mergeOffset*(2 - pRow->mergeIn[i]);
695 if( pRow->mergeDown & (1<<i) ) mi = -mi;
696 cgi_printf("%c%d", cSep, mi);
697 cSep = ',';
698 }
699 }
700

Keyboard Shortcuts

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