This is the mail archive of the
cygwin-apps
mailing list for the Cygwin project.
[setup patch] paint older-to-install versions red
- From: Reini Urban <rurban at x-ray dot at>
- To: "[ML] CygWin-Apps" <cygwin-apps at cygwin dot com>
- Date: Mon, 30 Jun 2008 16:24:36 +0200
- Subject: [setup patch] paint older-to-install versions red
Setup has a strange versioning logic:
The setup.ini lastmodified date overrides the package number
This patch marks the spin button red of such packages which installed
version numbers are higher than the current version of setup.exe, when
setup wants to overwrite "newer" versions.
Usually I have to click the spin buttons on those a couple of numbers.
It's a useful visual feedback of todo's.
--
Reini Urban
http://phpwiki.org/ http://murbreak.at/
Index: setup/PickPackageLine.cc
===================================================================
--- setup.orig/PickPackageLine.cc
+++ setup/PickPackageLine.cc
@@ -32,11 +32,18 @@ PickPackageLine::paint (HDC hdc, HRGN un
}
else if (col_num == theView.new_col)
{
+ // COLORREF red_color = RGB(255,0,0);
// TextOut (hdc, x + HMARGIN/2 + NEW_COL_SIZE_SLOP, y, s.c_str(), s.size());
// theView.DrawIcon (hdc, x + HMARGIN/2 + ICON_MARGIN/2 + RTARROW_WIDTH, by, theView.bm_spin);
TextOut (hdc, x + HMARGIN/2 + ICON_MARGIN/2 + SPIN_WIDTH , y,
pkg.action_caption ().c_str(), pkg.action_caption ().size());
- theView.DrawIcon (hdc, x + HMARGIN/2, by, theView.bm_spin);
+ /* if installed is newer than curr, paint it red */
+ if ((pkg.action_caption() == pkg.desired.Canonical_version()) && (pkg.curr < pkg.installed)) {
+ theView.DrawIcon (hdc, x + HMARGIN/2, by, theView.bm_redspin);
+ //SetTextColor(hdc, red_color);
+ } else {
+ theView.DrawIcon (hdc, x + HMARGIN/2, by, theView.bm_spin);
+ }
}
else if (col_num == theView.bintick_col)
{
Index: setup/PickView.cc
===================================================================
--- setup.orig/PickView.cc
+++ setup/PickView.cc
@@ -526,6 +526,7 @@ PickView::init(views _mode)
bitmap_dc = CreateCompatibleDC (dc);
#define LI(x) LoadImage (hinstance, MAKEINTRESOURCE (x), IMAGE_BITMAP, 0, 0, 0);
bm_spin = LI (IDB_SPIN);
+ bm_redspin = LI (IDB_REDSPIN);
bm_checkyes = LI (IDB_CHECK_YES);
bm_checkno = LI (IDB_CHECK_NO);
bm_checkna = LI (IDB_CHECK_NA);
Index: setup/PickView.h
===================================================================
--- setup.orig/PickView.h
+++ setup/PickView.h
@@ -75,7 +75,7 @@ public:
HBITMAP bm_icon;
HRGN rect_icon;
HBRUSH bg_fg_brush;
- HANDLE bm_spin, bm_checkyes, bm_checkno, bm_checkna, bm_treeplus, bm_treeminus;
+ HANDLE bm_spin, bm_redspin, bm_checkyes, bm_checkno, bm_checkna, bm_treeplus, bm_treeminus;
trusts deftrust;
HANDLE sysfont;
int scroll_ulc_x, scroll_ulc_y;
Index: setup/choose-redspin.bmp
===================================================================
Files setup.orig/choose-redspin.bmp and setup/choose-redspin.bmp differ
Index: setup/res.rc
===================================================================
--- setup.orig/res.rc
+++ setup/res.rc
@@ -416,6 +416,7 @@ CYGWIN.ICON FILE DISCARDA
//
IDB_SPIN BITMAP DISCARDABLE "choose-spin.bmp"
+IDB_REDSPIN BITMAP DISCARDABLE "choose-redspin.bmp"
IDB_CHECK_YES BITMAP DISCARDABLE "check-yes.bmp"
IDB_CHECK_NO BITMAP DISCARDABLE "check-no.bmp"
IDB_CHECK_NA BITMAP DISCARDABLE "check-na.bmp"
Index: setup/resource.h
===================================================================
--- setup.orig/resource.h
+++ setup/resource.h
@@ -67,6 +67,7 @@
#define IDB_CHECK_NA 303
#define IDB_TREE_PLUS 304
#define IDB_TREE_MINUS 305
+#define IDB_REDSPIN 306
// icons
2008-06-30 Reini Urban
* PickPackageLine.cc (PickPackageLine::paint): if installed is newer than curr,
paint the spin button red
* PickView.cc (PickView::init), PickView.h, res.rc, resource.h, choose-redspin.bmp:
add resource IDB_REDSPIN