setup: Colour code package trust levels

Max Bowsher maxb@ukf.net
Fri Jan 31 23:33:00 GMT 2003


Below is a patch which adds colour coding to the package picker.

Should I conditionalize it on a boolean command line option, or do we need
to be able to specify which colours to use, as opposed to whether to use
colours?



Max.

Index: PickPackageLine.cc
===================================================================
RCS file: /home/max/cvsmirror/cygwin-apps-cvs/setup/PickPackageLine.cc,v
retrieving revision 2.9
diff -u -p -r2.9 PickPackageLine.cc
--- PickPackageLine.cc 2002/07/13 14:00:37 2.9
+++ PickPackageLine.cc 2002/11/10 09:49:13
@@ -78,6 +78,13 @@ PickPackageLine::paint (HDC hdc, int x,
   SelectClipRgn (hdc, oldClip2);
   if (pkg.installed)
     {
+      COLORREF oldclr;
+      /**/ if (pkg.installed.Name().size() == 0) oldclr = SetTextColor(hdc,
RGB(0,0,0));
+      else if (pkg.installed == pkg.curr) oldclr = SetTextColor(hdc,
RGB(0,0,127));
+      else if (pkg.installed == pkg.prev) oldclr = SetTextColor(hdc,
RGB(127,127,0));
+      else if (pkg.installed == pkg.exp)  oldclr = SetTextColor(hdc,
RGB(0,127,127));
+      else /*                          */ oldclr = SetTextColor(hdc,
RGB(255,0,0));
+
       IntersectClipRect (hdc, x + theView.headers[theView.current_col].x,
     r,
     x + theView.headers[theView.current_col].x +
@@ -90,9 +97,17 @@ PickPackageLine::paint (HDC hdc, int x,
       BitBlt (hdc, x + theView.headers[theView.new_col].x + HMARGIN / 2,
        by, 11, 11, theView.bitmap_dc, 0, 0, SRCCOPY);
       SelectClipRgn (hdc, oldClip2);
+      SetTextColor(hdc, oldclr);
     }

   String s = pkg.action_caption ();
+  {
+  COLORREF oldclr;
+  /**/ if (pkg.desired.Name().size() == 0) oldclr = SetTextColor(hdc,
RGB(0,0,0));
+  else if (pkg.desired == pkg.curr) oldclr = SetTextColor(hdc,
RGB(0,0,127));
+  else if (pkg.desired == pkg.prev) oldclr = SetTextColor(hdc,
RGB(127,127,0));
+  else if (pkg.desired == pkg.exp)  oldclr = SetTextColor(hdc,
RGB(0,127,127));
+  else /*                        */ oldclr = SetTextColor(hdc,
RGB(255,0,0));
   IntersectClipRect (hdc, x + theView.headers[theView.new_col].x,
        r,
        x + theView.headers[theView.new_col].x +
@@ -106,6 +121,8 @@ PickPackageLine::paint (HDC hdc, int x,
    RTARROW_WIDTH + HMARGIN / 2, by, 11, 11, theView.bitmap_dc, 0, 0,
    SRCCOPY);
   SelectClipRgn (hdc, oldClip2);
+  SetTextColor(hdc, oldclr);
+  }

   int checked;




More information about the Cygwin-apps mailing list