Bug Fix - missing color

- There's something wrong with Color::Color (int, int), so this is a
  temporary fix.
This commit is contained in:
Paul Beckingham 2009-10-05 23:53:28 -04:00
parent 175dd3eb4f
commit e5fce9ac08
4 changed files with 21 additions and 17 deletions

View file

@ -70,6 +70,7 @@ Color::Color (const Color& other)
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/*
Color::Color (unsigned int c) Color::Color (unsigned int c)
: value (0) : value (0)
{ {
@ -79,6 +80,7 @@ Color::Color (unsigned int c)
value = c & (_COLOR_256 | _COLOR_HASBG | _COLOR_HASFG |_COLOR_UNDERLINE | value = c & (_COLOR_256 | _COLOR_HASBG | _COLOR_HASFG |_COLOR_UNDERLINE |
_COLOR_BOLD | _COLOR_BRIGHT | _COLOR_BG | _COLOR_FG); _COLOR_BOLD | _COLOR_BRIGHT | _COLOR_BG | _COLOR_FG);
} }
*/
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Supports the following constructs: // Supports the following constructs:
@ -225,6 +227,7 @@ Color::Color (const std::string& spec)
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/*
Color::Color (color_id fg) Color::Color (color_id fg)
: value (0) : value (0)
{ {
@ -234,6 +237,7 @@ Color::Color (color_id fg)
value |= fg; value |= fg;
} }
} }
*/
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
Color::Color (color_id fg, color_id bg) Color::Color (color_id fg, color_id bg)

View file

@ -46,9 +46,9 @@ public:
Color (); Color ();
Color (const Color&); Color (const Color&);
Color (unsigned int); // 256 | UNDERLINE | BOLD | BRIGHT | (BG << 8) | FG // Color (unsigned int); // 256 | UNDERLINE | BOLD | BRIGHT | (BG << 8) | FG
Color (const std::string&); // "red on bright black" Color (const std::string&); // "red on bright black"
Color (color_id); // fg. // Color (color_id); // fg.
Color (color_id, color_id); // fg, bg. Color (color_id, color_id); // fg, bg.
Color (color_id, color_id, bool, bool, bool); // fg, bg, underline, bold, bright Color (color_id, color_id, bool, bool, bool); // fg, bg, underline, bold, bright
~Color (); ~Color ();

View file

@ -582,7 +582,7 @@ void TDB::undo ()
row = table.addRow (); row = table.addRow ();
table.addCell (row, 0, *name); table.addCell (row, 0, *name);
table.addCell (row, 1, renderAttribute (*name, before.get (*name))); table.addCell (row, 1, renderAttribute (*name, before.get (*name)));
table.setCellColor (row, 1, Color (Color::red)); table.setCellColor (row, 1, Color (Color::red, Color::nocolor));
} }
foreach (name, before) foreach (name, before)
@ -599,8 +599,8 @@ void TDB::undo ()
if (priorValue != currentValue) if (priorValue != currentValue)
{ {
table.setCellColor (row, 1, Color (Color::red)); table.setCellColor (row, 1, Color (Color::red, Color::nocolor));
table.setCellColor (row, 2, Color (Color::green)); table.setCellColor (row, 2, Color (Color::green, Color::nocolor));
} }
} }
} }
@ -610,7 +610,7 @@ void TDB::undo ()
row = table.addRow (); row = table.addRow ();
table.addCell (row, 0, *name); table.addCell (row, 0, *name);
table.addCell (row, 2, renderAttribute (*name, after.get (*name))); table.addCell (row, 2, renderAttribute (*name, after.get (*name)));
table.setCellColor (row, 2, Color (Color::green)); table.setCellColor (row, 2, Color (Color::green, Color::nocolor));
} }
} }
else else
@ -621,7 +621,7 @@ void TDB::undo ()
row = table.addRow (); row = table.addRow ();
table.addCell (row, 0, name->first); table.addCell (row, 0, name->first);
table.addCell (row, 2, renderAttribute (name->first, after.get (name->first))); table.addCell (row, 2, renderAttribute (name->first, after.get (name->first)));
table.setCellColor (row, 2, Color (Color::green)); table.setCellColor (row, 2, Color (Color::green, Color::nocolor));
} }
} }

View file

@ -886,8 +886,8 @@ int handleReportHistory (std::string &outs)
table.addCell (row, 5, net); table.addCell (row, 5, net);
if ((context.config.get ("color", true) || context.config.get (std::string ("_forcecolor"), false)) && net) if ((context.config.get ("color", true) || context.config.get (std::string ("_forcecolor"), false)) && net)
table.setCellColor (row, 5, net > 0 ? Color (Color::red) : table.setCellColor (row, 5, net > 0 ? Color (Color::red, Color::nocolor, false, false, false) :
Color (Color::green)); Color (Color::green, Color::nocolor, false, false, false));
} }
if (table.rowCount ()) if (table.rowCount ())
@ -989,9 +989,9 @@ int handleReportGHistory (std::string &outs)
else else
table.setTableDashedUnderline (); table.setTableDashedUnderline ();
Color color_added (Color::black, Color::red); Color color_added (Color::black, Color::red, false, false, false);
Color color_completed (Color::black, Color::green); Color color_completed (Color::black, Color::green, false, false, false);
Color color_deleted (Color::black, Color::yellow); Color color_deleted (Color::black, Color::yellow, false, false, false);
// Determine the longest line, and the longest "added" line. // Determine the longest line, and the longest "added" line.
int maxAddedLine = 0; int maxAddedLine = 0;
@ -1426,7 +1426,7 @@ std::string renderMonths (
today.day () == d && today.day () == d &&
today.month () == months.at (mpl) && today.month () == months.at (mpl) &&
today.year () == years.at (mpl)) today.year () == years.at (mpl))
table.setCellColor (row, thisCol, Color (Color::cyan)); table.setCellColor (row, thisCol, Color (Color::cyan, Color::nocolor, false, false, false));
foreach (task, all) foreach (task, all)
{ {
@ -1440,7 +1440,7 @@ std::string renderMonths (
due.month () == months.at (mpl) && due.month () == months.at (mpl) &&
due.year () == years.at (mpl)) due.year () == years.at (mpl))
{ {
Color c (Color::black, (due < today ? Color::red : Color::yellow)); Color c (Color::black, (due < today ? Color::red : Color::yellow), false, false, false);
table.setCellColor (row, thisCol, c); table.setCellColor (row, thisCol, c);
} }
} }
@ -1620,9 +1620,9 @@ int handleReportCalendar (std::string &outs)
} }
} }
Color color_today (Color::cyan); Color color_today (Color::cyan, Color::nocolor, false, false, false);
Color color_due (Color::black, Color::yellow); Color color_due (Color::black, Color::yellow, false, false, false);
Color color_overdue (Color::black, Color::red); Color color_overdue (Color::black, Color::red, false, false, false);
if (context.config.get ("color", true) || context.config.get (std::string ("_forcecolor"), false)) if (context.config.get ("color", true) || context.config.get (std::string ("_forcecolor"), false))
out << "Legend: " out << "Legend: "