Bug Fix - Color::Color (color_id, color_id)

- Removed temporary fix from task code to accommodate above bug.
This commit is contained in:
Paul Beckingham 2009-10-06 00:20:50 -04:00
parent e5fce9ac08
commit 010ef7cd07
4 changed files with 18 additions and 22 deletions

View file

@ -70,7 +70,6 @@ Color::Color (const Color& other)
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/*
Color::Color (unsigned int c) Color::Color (unsigned int c)
: value (0) : value (0)
{ {
@ -80,7 +79,6 @@ 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:
@ -227,7 +225,6 @@ Color::Color (const std::string& spec)
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/*
Color::Color (color_id fg) Color::Color (color_id fg)
: value (0) : value (0)
{ {
@ -237,7 +234,6 @@ 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)
@ -245,7 +241,7 @@ Color::Color (color_id fg, color_id bg)
{ {
if (bg != Color::nocolor) if (bg != Color::nocolor)
{ {
value |= _COLOR_HASFG; value |= _COLOR_HASBG;
value |= (bg << 8); value |= (bg << 8);
} }

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, Color::nocolor)); table.setCellColor (row, 1, Color (Color::red));
} }
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, Color::nocolor)); table.setCellColor (row, 1, Color (Color::red));
table.setCellColor (row, 2, Color (Color::green, Color::nocolor)); table.setCellColor (row, 2, Color (Color::green));
} }
} }
} }
@ -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, Color::nocolor)); table.setCellColor (row, 2, Color (Color::green));
} }
} }
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, Color::nocolor)); table.setCellColor (row, 2, Color (Color::green));
} }
} }

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, Color::nocolor, false, false, false) : table.setCellColor (row, 5, net > 0 ? Color (Color::red) :
Color (Color::green, Color::nocolor, false, false, false)); Color (Color::green));
} }
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, false, false, false); Color color_added (Color::black, Color::red);
Color color_completed (Color::black, Color::green, false, false, false); Color color_completed (Color::black, Color::green);
Color color_deleted (Color::black, Color::yellow, false, false, false); Color color_deleted (Color::black, Color::yellow);
// 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, Color::nocolor, false, false, false)); table.setCellColor (row, thisCol, Color (Color::cyan));
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), false, false, false); Color c (Color::black, (due < today ? Color::red : Color::yellow));
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::nocolor, false, false, false); Color color_today (Color::cyan);
Color color_due (Color::black, Color::yellow, false, false, false); Color color_due (Color::black, Color::yellow);
Color color_overdue (Color::black, Color::red, false, false, false); Color color_overdue (Color::black, Color::red);
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: "