Changeset 395


Ignore:
Timestamp:
Jun 27, 2007, 1:08:25 AM (13 years ago)
Author:
Peter Johansson
Message:

font color shading depending on age of line in blame output (refs #160). Yet to be implemented is when x-axis is rev rather than default time, in which case the shading should depend on the revision.

Location:
trunk/lib
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/File.cc

    r381 r395  
    8181
    8282
    83   void File::print_blame(std::ofstream& os) const
     83  void File::print_blame(std::ofstream& os, const SVNlog& log) const
    8484  {
    8585    os << "<br><h3>Blame Information</h3>";
     
    9696    HtmlStream hs(os);
    9797    SVNblame blame(path_);
     98    assert(log.date().size());
     99    time_t last = Date(log.date().back()).seconds();
     100    // color is calculated linearly on time, c = kt + m
     101    // brightest color (for oldest rev in log) is set to 192.
     102    double k = 192.0/(Date(log.date()[0]).seconds()-last);
     103    double m = -last*k;
    98104    while (blame.valid()) {
    99       os << "<tr>\n<td class=\"number\">" << blame.revision()
    100          << "</td>\n<td class=\"date\">"  << Date(blame.date())("%e %b %y")
     105      std::string color(hex(static_cast<int>(k*Date(blame.date()).seconds()+m),
     106                            2));
     107      os << "<tr>\n<td class=\"number\"><font color=\"#" << color
     108         << color << color << "\">" << blame.revision()
     109         << "</td>\n<td class=\"date\"><font color=\"#" << color
     110         << color << color << "\">" << Date(blame.date())("%e %b %y")
    101111         << "</td>\n<td class=\"author\">";
    102112      hs << blame.author();
     
    251261    os << "</p>\n";
    252262
    253     print_blame(os);
     263    print_blame(os, log);
    254264
    255265    print_footer(os);
  • trunk/lib/File.h

    r380 r395  
    8383
    8484    /**
    85        @brief Print blame output
     85       @brief Print blame output 
    8686    */
    87     void print_blame(std::ofstream&) const;
     87    void print_blame(std::ofstream& os, const SVNlog& log) const;
    8888
    8989    void print_core(bool verbose=false) const;
  • trunk/lib/SVNblame.h

    r381 r395  
    6060
    6161    /**
    62        @brief Retrieve the blame date for the current line.
     62       @brief Retrieve the author for the current line.
    6363
    6464       If current line is outside blame entries the behaviour is
    6565       undefined.
    6666
    67        @return The date.
     67       @return The author.
    6868    */
    6969    std::string author(void);
Note: See TracChangeset for help on using the changeset viewer.