Fossil

Check-in [57a0143b]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Reinstate the timeline arrow foreground color changes that were removed by check-in [7ac88481a69dd], but with fixes to avoid integer overflow.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:57a0143b52d5c90f5bba64e10356c4016a35d5d7495de1db260d8e8633a6b4f1
User & Date: drh 2018-06-14 13:48:23
Context
2018-06-14
19:33
Fix typos in documentation text. check-in: 862d630f user: drh tags: trunk
19:17
This code demonstrates ideas on how to implement a Forum feature in Fossil. This is just ideas - it is not even a working prototype. This change was originally stashed, but then I thought it better to check it in on a branch for the historical record. check-in: 1e363739 user: drh tags: forum-brainstorm-1
13:48
Reinstate the timeline arrow foreground color changes that were removed by check-in [7ac88481a69dd], but with fixes to avoid integer overflow. check-in: 57a0143b user: drh tags: trunk
13:43
Reinstate the foreground color changing for timeline arrors based on the background color of the text. This check-in uses the #00aa00 background color intentially for testing purposes. Closed-Leaf check-in: 4f2b2309 user: drh tags: arrow-color-fix
2018-06-13
02:18
The "fossil grep" command now agrees with the documentation. But there is still a lot of opportunity to make enhancements. check-in: 6499c93d user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/timeline.c.

745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
...
771
772
773
774
775
776
777

778



779
780
781
782
783
784
785
786
787
788
789
790
...
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
    }
  }
  @ </table>
  if( fchngQueryInit ) db_finalize(&fchngQuery);
  timeline_output_graph_javascript(pGraph, tmFlags, iTableId);
}

#if 0  /* not used */
/*
** Change the RGB background color given in the argument in a foreground
** color with the same hue.
*/
static const char *bg_to_fg(const char *zIn){
  int i;
  unsigned int x[3];
................................................................................
  if( whiteFg ){
    /* Make the color lighter */
    static const unsigned int t = 215;
    if( mx<t ) for(i=0; i<3; i++) x[i] += t - mx;
  }else{
    /* Make the color darker */
    static const unsigned int t = 128;

    if( mx>t ) for(i=0; i<3; i++) x[i] -= mx - t;



  }
  sqlite3_snprintf(sizeof(zRes),zRes,"#%02x%02x%02x",x[0],x[1],x[2]);
  return zRes;
}
#endif /* not used */

/*
** Generate all of the necessary javascript to generate a timeline
** graph.
*/
void timeline_output_graph_javascript(
  GraphContext *pGraph,     /* The graph to be displayed */
................................................................................
        if( pRow->aiRiser[i]>0 ){
          cgi_printf("%c%d,%d", cSep, i, pRow->aiRiser[i]);
          cSep = ',';
        }
      }
      if( cSep=='[' ) cgi_printf("[");
      cgi_printf("],");
#if 0
      if( colorGraph && pRow->zBgClr[0]=='#' ){
        cgi_printf("\"fg\":\"%s\",", bg_to_fg(pRow->zBgClr));
      }
#endif
      /* mi */
      cgi_printf("\"mi\":");
      cSep = '[';
      for(i=0; i<GR_MAX_RAIL; i++){
        if( pRow->mergeIn[i] ){
          int mi = i;
          if( (pRow->mergeDown >> i) & 1 ) mi = -mi;







<







 







>
|
>
>
>




<







 







<



<







745
746
747
748
749
750
751

752
753
754
755
756
757
758
...
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785

786
787
788
789
790
791
792
...
880
881
882
883
884
885
886

887
888
889

890
891
892
893
894
895
896
    }
  }
  @ </table>
  if( fchngQueryInit ) db_finalize(&fchngQuery);
  timeline_output_graph_javascript(pGraph, tmFlags, iTableId);
}


/*
** Change the RGB background color given in the argument in a foreground
** color with the same hue.
*/
static const char *bg_to_fg(const char *zIn){
  int i;
  unsigned int x[3];
................................................................................
  if( whiteFg ){
    /* Make the color lighter */
    static const unsigned int t = 215;
    if( mx<t ) for(i=0; i<3; i++) x[i] += t - mx;
  }else{
    /* Make the color darker */
    static const unsigned int t = 128;
    if( mx>t ){
      for(i=0; i<3; i++){
        x[i] = x[i]>=mx-t ? x[i] - (mx-t) : 0;
      }
    }
  }
  sqlite3_snprintf(sizeof(zRes),zRes,"#%02x%02x%02x",x[0],x[1],x[2]);
  return zRes;
}


/*
** Generate all of the necessary javascript to generate a timeline
** graph.
*/
void timeline_output_graph_javascript(
  GraphContext *pGraph,     /* The graph to be displayed */
................................................................................
        if( pRow->aiRiser[i]>0 ){
          cgi_printf("%c%d,%d", cSep, i, pRow->aiRiser[i]);
          cSep = ',';
        }
      }
      if( cSep=='[' ) cgi_printf("[");
      cgi_printf("],");

      if( colorGraph && pRow->zBgClr[0]=='#' ){
        cgi_printf("\"fg\":\"%s\",", bg_to_fg(pRow->zBgClr));
      }

      /* mi */
      cgi_printf("\"mi\":");
      cSep = '[';
      for(i=0; i<GR_MAX_RAIL; i++){
        if( pRow->mergeIn[i] ){
          int mi = i;
          if( (pRow->mergeDown >> i) & 1 ) mi = -mi;