Changeset 403


Ignore:
Timestamp:
Jun 29, 2007, 1:23:12 AM (13 years ago)
Author:
Peter Johansson
Message:

fixes #160 - color coding different linetypes in blame output

Location:
trunk/lib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/File.cc

    r401 r403  
    8888    os << "<thead>\n";
    8989    os << "<tr>\n";
    90     os << "<th class=\"number\">Rev</th>\n";
     90    os << "<th class=\"rev\">Rev</th>\n";
    9191    os << "<th class=\"date\">Date</th>\n";
    9292    os << "<th class=\"author\">Author</th>\n";
    93     os << "<th class=\"number\">Line</th>\n";
     93    os << "<th class=\"line\">Line</th>\n";
    9494    os << "<th></th>\n";
    9595    os << "</tr>\n</thead>\n";
     
    9797    HtmlStream hs(os);
    9898    SVNblame blame(path_);
     99    Parser parser(path_);
     100    std::vector<Parser::line_type>::const_iterator
     101      line_type(parser.type().begin());
    99102    int last=0;
    100103    int first=0;
     
    118121      else
    119122        color = hex(static_cast<int>(k*blame.revision()+m),2);
    120       os << "<tr>\n<td class=\"number\"><font color=\"#" << color
     123      os << "<tr>\n<td class=\"rev\"><font color=\"#" << color
    121124         << color << color << "\">" << blame.revision()
    122125         << "</font></td>\n<td class=\"date\"><font color=\"#" << color
     
    125128      os << "</font></td>\n<td class=\"author\">";
    126129      hs << blame.author();
    127       os << "</td>\n<td class=\"number\">" << blame.line_no()+1
     130      os << "</td>\n<td class=\"";
     131      assert(line_type!=parser.type().end());
     132      if (*line_type==Parser::empty)
     133        os << "line-other";
     134      else if (*line_type==Parser::comment)
     135        os << "line-comment";
     136      else
     137        os << "line-code";
     138      os << "\">" << blame.line_no()+1
    128139         << "</td>\n<td>";
    129140      hs << blame.line();
    130141      os << "</td>\n</tr>\n";
    131142      blame.next_line();
     143      ++line_type;
    132144    }
    133145    os << "</tbody>\n";
  • trunk/lib/css.cc

    r402 r403  
    177177    s << "table.blame th.author { width: 5em; text-align:right }\n";
    178178    s << "table.blame th.date { width: 8em; text-align:center }\n";
    179     s << "table.blame th.number { width: 3em }\n";
     179    s << "table.blame th.rev { width: 3em }\n";
     180    s << "table.blame th.line { width: 3em }\n";
    180181    s << "table.blame thead th {\n";
    181182    s << " background: #eee;\n";
     
    195196    s << "table.blame tbody td.author { text-align: right; }\n";
    196197    s << "table.blame tbody td.date { text-align: center; }\n";
    197     s << "table.blame tbody td.number { text-align: right; }\n";
     198    s << "table.blame tbody td.rev { text-align: right; }\n";
     199    s << "table.blame tbody td.line-code { text-align: right; "
     200      << "background: #cfcfff; }\n";
     201    s << "table.blame tbody td.line-comment { text-align: right; "
     202      << "background: #e8e8ff; }\n";
     203    s << "table.blame tbody td.line-other { text-align: right; "
     204      << "background: #fffff}\n";
    198205    s << "table.blame tbody tr:hover { background: #eed; }\n";
    199206    s << "\n";
Note: See TracChangeset for help on using the changeset viewer.