From 010ef7cd070249edef6c453ac47fbab6e38721b5 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Tue, 6 Oct 2009 00:20:50 -0400 Subject: [PATCH] Bug Fix - Color::Color (color_id, color_id) - Removed temporary fix from task code to accommodate above bug. --- src/Color.cpp | 6 +----- src/Color.h | 4 ++-- src/TDB.cpp | 10 +++++----- src/report.cpp | 20 ++++++++++---------- 4 files changed, 18 insertions(+), 22 deletions(-) diff --git a/src/Color.cpp b/src/Color.cpp index d91b4afc0..b4762813f 100644 --- a/src/Color.cpp +++ b/src/Color.cpp @@ -70,7 +70,6 @@ Color::Color (const Color& other) } //////////////////////////////////////////////////////////////////////////////// -/* Color::Color (unsigned int c) : value (0) { @@ -80,7 +79,6 @@ Color::Color (unsigned int c) value = c & (_COLOR_256 | _COLOR_HASBG | _COLOR_HASFG |_COLOR_UNDERLINE | _COLOR_BOLD | _COLOR_BRIGHT | _COLOR_BG | _COLOR_FG); } -*/ //////////////////////////////////////////////////////////////////////////////// // Supports the following constructs: @@ -227,7 +225,6 @@ Color::Color (const std::string& spec) } //////////////////////////////////////////////////////////////////////////////// -/* Color::Color (color_id fg) : value (0) { @@ -237,7 +234,6 @@ Color::Color (color_id fg) value |= fg; } } -*/ //////////////////////////////////////////////////////////////////////////////// Color::Color (color_id fg, color_id bg) @@ -245,7 +241,7 @@ Color::Color (color_id fg, color_id bg) { if (bg != Color::nocolor) { - value |= _COLOR_HASFG; + value |= _COLOR_HASBG; value |= (bg << 8); } diff --git a/src/Color.h b/src/Color.h index c3f8db3d9..9f6b80c08 100644 --- a/src/Color.h +++ b/src/Color.h @@ -46,9 +46,9 @@ public: 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 (color_id); // fg. + Color (color_id); // fg. Color (color_id, color_id); // fg, bg. Color (color_id, color_id, bool, bool, bool); // fg, bg, underline, bold, bright ~Color (); diff --git a/src/TDB.cpp b/src/TDB.cpp index 09087a195..16f4754b1 100644 --- a/src/TDB.cpp +++ b/src/TDB.cpp @@ -582,7 +582,7 @@ void TDB::undo () row = table.addRow (); table.addCell (row, 0, *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) @@ -599,8 +599,8 @@ void TDB::undo () if (priorValue != currentValue) { - table.setCellColor (row, 1, Color (Color::red, Color::nocolor)); - table.setCellColor (row, 2, Color (Color::green, Color::nocolor)); + table.setCellColor (row, 1, Color (Color::red)); + table.setCellColor (row, 2, Color (Color::green)); } } } @@ -610,7 +610,7 @@ void TDB::undo () row = table.addRow (); table.addCell (row, 0, *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 @@ -621,7 +621,7 @@ void TDB::undo () row = table.addRow (); table.addCell (row, 0, 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)); } } diff --git a/src/report.cpp b/src/report.cpp index bc66b5cb1..c32b6e046 100644 --- a/src/report.cpp +++ b/src/report.cpp @@ -886,8 +886,8 @@ int handleReportHistory (std::string &outs) table.addCell (row, 5, 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) : - Color (Color::green, Color::nocolor, false, false, false)); + table.setCellColor (row, 5, net > 0 ? Color (Color::red) : + Color (Color::green)); } if (table.rowCount ()) @@ -989,9 +989,9 @@ int handleReportGHistory (std::string &outs) else table.setTableDashedUnderline (); - Color color_added (Color::black, Color::red, false, false, false); - Color color_completed (Color::black, Color::green, false, false, false); - Color color_deleted (Color::black, Color::yellow, false, false, false); + Color color_added (Color::black, Color::red); + Color color_completed (Color::black, Color::green); + Color color_deleted (Color::black, Color::yellow); // Determine the longest line, and the longest "added" line. int maxAddedLine = 0; @@ -1426,7 +1426,7 @@ std::string renderMonths ( today.day () == d && today.month () == months.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) { @@ -1440,7 +1440,7 @@ std::string renderMonths ( due.month () == months.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); } } @@ -1620,9 +1620,9 @@ int handleReportCalendar (std::string &outs) } } - Color color_today (Color::cyan, Color::nocolor, false, false, false); - Color color_due (Color::black, Color::yellow, false, false, false); - Color color_overdue (Color::black, Color::red, false, false, false); + Color color_today (Color::cyan); + Color color_due (Color::black, Color::yellow); + Color color_overdue (Color::black, Color::red); if (context.config.get ("color", true) || context.config.get (std::string ("_forcecolor"), false)) out << "Legend: "