Fossil SCM
Improved comments on the graph layout rail shuffling.
Commit
ebbfe7d9973664826c0a7c11b603b8e0a4c76382950d500d9cb57e1fdd757bb7
Parent
0324515b5971557…
1 file changed
+16
-3
+16
-3
| --- src/graph.c | ||
| +++ src/graph.c | ||
| @@ -890,17 +890,30 @@ | ||
| 890 | 890 | */ |
| 891 | 891 | find_max_rail(p); |
| 892 | 892 | |
| 893 | 893 | /* |
| 894 | 894 | ** Compute the rail mapping that tries to put the branch named |
| 895 | - ** zLeftBranch at the left margin. | |
| 895 | + ** zLeftBranch at the left margin. Other branches that merge | |
| 896 | + ** with zLeftBranch are to the right with merge rails in between. | |
| 896 | 897 | ** |
| 897 | 898 | ** aMap[X]=Y means that the X-th rail is drawn as the Y-th rail. |
| 899 | + ** | |
| 900 | + ** Do not move rails around if there are timewarps, because that can | |
| 901 | + ** seriously mess up the display of timewarps. Timewarps should be | |
| 902 | + ** rare so this should not be a serious limitation to the algorithm. | |
| 898 | 903 | */ |
| 899 | 904 | aMap = p->aiRailMap; |
| 900 | - for(i=0; i<=p->mxRail; i++) aMap[i] = i; | |
| 905 | + for(i=0; i<=p->mxRail; i++) aMap[i] = i; /* Set up a default mapping */ | |
| 901 | 906 | if( nTimewarp==0 ){ |
| 907 | + /* Priority bits: | |
| 908 | + ** | |
| 909 | + ** 0x04 The preferred branch | |
| 910 | + ** | |
| 911 | + ** 0x02 A merge rail - a rail that contains merge lines | |
| 912 | + ** | |
| 913 | + ** 0x01 A rail that merges with the preferred branch | |
| 914 | + */ | |
| 902 | 915 | u8 aPriority[GR_MAX_RAIL]; |
| 903 | 916 | memset(aPriority, 0, p->mxRail+1); |
| 904 | 917 | if( zLeftBranch ){ |
| 905 | 918 | char *zLeft = persistBranchName(p, zLeftBranch); |
| 906 | 919 | for(pRow=p->pFirst; pRow; pRow=pRow->pNext){ |
| @@ -922,11 +935,10 @@ | ||
| 922 | 935 | } |
| 923 | 936 | if( pRow->mergeOut>=0 ) aPriority[pRow->mergeOut] |= 1; |
| 924 | 937 | } |
| 925 | 938 | } |
| 926 | 939 | } |
| 927 | - j = 0; | |
| 928 | 940 | for(i=0; i<=p->mxRail; i++){ |
| 929 | 941 | if( p->mergeRail & BIT(i) ){ |
| 930 | 942 | aPriority[i] |= 2; |
| 931 | 943 | } |
| 932 | 944 | } |
| @@ -936,10 +948,11 @@ | ||
| 936 | 948 | fprintf(stderr,"Priority:"); |
| 937 | 949 | for(i=0; i<=p->mxRail; i++) fprintf(stderr," %d", aPriority[i]); |
| 938 | 950 | fprintf(stderr,"\n"); |
| 939 | 951 | #endif |
| 940 | 952 | |
| 953 | + j = 0; | |
| 941 | 954 | for(i=0; i<=p->mxRail; i++){ |
| 942 | 955 | if( aPriority[i]>=4 ) aMap[i] = j++; |
| 943 | 956 | } |
| 944 | 957 | for(i=p->mxRail; i>=0; i--){ |
| 945 | 958 | if( aPriority[i]==3 ) aMap[i] = j++; |
| 946 | 959 |
| --- src/graph.c | |
| +++ src/graph.c | |
| @@ -890,17 +890,30 @@ | |
| 890 | */ |
| 891 | find_max_rail(p); |
| 892 | |
| 893 | /* |
| 894 | ** Compute the rail mapping that tries to put the branch named |
| 895 | ** zLeftBranch at the left margin. |
| 896 | ** |
| 897 | ** aMap[X]=Y means that the X-th rail is drawn as the Y-th rail. |
| 898 | */ |
| 899 | aMap = p->aiRailMap; |
| 900 | for(i=0; i<=p->mxRail; i++) aMap[i] = i; |
| 901 | if( nTimewarp==0 ){ |
| 902 | u8 aPriority[GR_MAX_RAIL]; |
| 903 | memset(aPriority, 0, p->mxRail+1); |
| 904 | if( zLeftBranch ){ |
| 905 | char *zLeft = persistBranchName(p, zLeftBranch); |
| 906 | for(pRow=p->pFirst; pRow; pRow=pRow->pNext){ |
| @@ -922,11 +935,10 @@ | |
| 922 | } |
| 923 | if( pRow->mergeOut>=0 ) aPriority[pRow->mergeOut] |= 1; |
| 924 | } |
| 925 | } |
| 926 | } |
| 927 | j = 0; |
| 928 | for(i=0; i<=p->mxRail; i++){ |
| 929 | if( p->mergeRail & BIT(i) ){ |
| 930 | aPriority[i] |= 2; |
| 931 | } |
| 932 | } |
| @@ -936,10 +948,11 @@ | |
| 936 | fprintf(stderr,"Priority:"); |
| 937 | for(i=0; i<=p->mxRail; i++) fprintf(stderr," %d", aPriority[i]); |
| 938 | fprintf(stderr,"\n"); |
| 939 | #endif |
| 940 | |
| 941 | for(i=0; i<=p->mxRail; i++){ |
| 942 | if( aPriority[i]>=4 ) aMap[i] = j++; |
| 943 | } |
| 944 | for(i=p->mxRail; i>=0; i--){ |
| 945 | if( aPriority[i]==3 ) aMap[i] = j++; |
| 946 |
| --- src/graph.c | |
| +++ src/graph.c | |
| @@ -890,17 +890,30 @@ | |
| 890 | */ |
| 891 | find_max_rail(p); |
| 892 | |
| 893 | /* |
| 894 | ** Compute the rail mapping that tries to put the branch named |
| 895 | ** zLeftBranch at the left margin. Other branches that merge |
| 896 | ** with zLeftBranch are to the right with merge rails in between. |
| 897 | ** |
| 898 | ** aMap[X]=Y means that the X-th rail is drawn as the Y-th rail. |
| 899 | ** |
| 900 | ** Do not move rails around if there are timewarps, because that can |
| 901 | ** seriously mess up the display of timewarps. Timewarps should be |
| 902 | ** rare so this should not be a serious limitation to the algorithm. |
| 903 | */ |
| 904 | aMap = p->aiRailMap; |
| 905 | for(i=0; i<=p->mxRail; i++) aMap[i] = i; /* Set up a default mapping */ |
| 906 | if( nTimewarp==0 ){ |
| 907 | /* Priority bits: |
| 908 | ** |
| 909 | ** 0x04 The preferred branch |
| 910 | ** |
| 911 | ** 0x02 A merge rail - a rail that contains merge lines |
| 912 | ** |
| 913 | ** 0x01 A rail that merges with the preferred branch |
| 914 | */ |
| 915 | u8 aPriority[GR_MAX_RAIL]; |
| 916 | memset(aPriority, 0, p->mxRail+1); |
| 917 | if( zLeftBranch ){ |
| 918 | char *zLeft = persistBranchName(p, zLeftBranch); |
| 919 | for(pRow=p->pFirst; pRow; pRow=pRow->pNext){ |
| @@ -922,11 +935,10 @@ | |
| 935 | } |
| 936 | if( pRow->mergeOut>=0 ) aPriority[pRow->mergeOut] |= 1; |
| 937 | } |
| 938 | } |
| 939 | } |
| 940 | for(i=0; i<=p->mxRail; i++){ |
| 941 | if( p->mergeRail & BIT(i) ){ |
| 942 | aPriority[i] |= 2; |
| 943 | } |
| 944 | } |
| @@ -936,10 +948,11 @@ | |
| 948 | fprintf(stderr,"Priority:"); |
| 949 | for(i=0; i<=p->mxRail; i++) fprintf(stderr," %d", aPriority[i]); |
| 950 | fprintf(stderr,"\n"); |
| 951 | #endif |
| 952 | |
| 953 | j = 0; |
| 954 | for(i=0; i<=p->mxRail; i++){ |
| 955 | if( aPriority[i]>=4 ) aMap[i] = j++; |
| 956 | } |
| 957 | for(i=p->mxRail; i>=0; i--){ |
| 958 | if( aPriority[i]==3 ) aMap[i] = j++; |
| 959 |