Fossil

Check-in [4f2b2309]
Login

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

Overview
Comment: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.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | arrow-color-fix
Files: files | file ages | folders
SHA3-256: 4f2b230944317fd78520f51db11185da488b39880745d44b88f12d663838015a
User & Date: drh 2018-06-14 13:43:00.116
Context
2018-06-14
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
Unified Diff Ignore Whitespace Patch
Changes to src/timeline.c.
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
    }
  }
  @ </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];







<







745
746
747
748
749
750
751

752
753
754
755
756
757
758
    }
  }
  @ </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];
771
772
773
774
775
776
777

778



779
780
781
782
783
784
785
786
787
788
789
790
  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 */







>
|
>
>
>




<







770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785

786
787
788
789
790
791
792
  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 */
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
        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;







<



<







880
881
882
883
884
885
886

887
888
889

890
891
892
893
894
895
896
        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;