This is the mail archive of the
cygwin-apps@cygwin.com
mailing list for the Cygwin project.
[setup PATCH] Improve Category column (Take 2)
- From: "Max Bowsher" <maxb at ukf dot net>
- To: <cygwin-apps at cygwin dot com>
- Date: Thu, 19 Sep 2002 15:57:45 +0100
- Subject: [setup PATCH] Improve Category column (Take 2)
Take 2. I'm confident about everything but my const qualifiers on
packagemeta::getReadableCategoryList ().
Please pay close attention to them. Thanks.
Max.
Index: PickPackageLine.cc
Comments: Call pkg.getReadableCategoryList(), and fix an error in the x2 arg of
IntersectClipRect()
===================================================================
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/09/19 14:51:36
@@ -136,14 +136,10 @@ PickPackageLine::paint (HDC hdc, int x,
/* shows "first" category - do we want to show any? */
if (pkg.categories.size () && show_cat)
{
- String catName;
- if (pkg.categories.find ("All") == pkg.categories.begin () &&
- pkg.categories.size () > 1)
- catName = *(++pkg.categories.begin());
- else catName = * pkg.categories.begin ();
+ String catName = pkg.getReadableCategoryList();
IntersectClipRect (hdc, x + theView.headers[theView.cat_col].x, r,
x + theView.headers[theView.cat_col].x +
- theView.headers[theView.cat_col].x, rb);
+ theView.headers[theView.cat_col].width - HMARGIN / 2, rb);
TextOut (hdc, x + theView.headers[theView.cat_col].x + HMARGIN / 2, r,
catName.cstr_oneuse(),
catName.size());
Index: PickView.cc
Comments: Rename column
===================================================================
RCS file: /home/max/cvsmirror/cygwin-apps-cvs/setup/PickView.cc,v
retrieving revision 2.10
diff -u -p -r2.10 PickView.cc
--- PickView.cc 2002/07/09 06:57:40 2.10
+++ PickView.cc 2002/09/19 14:45:34
@@ -29,7 +29,7 @@ static PickView::Header pkg_headers[] =
{"New", 3, 0, 0},
{"Bin?", 4, 0, 0},
{"Src?", 4, 0, 0},
- {"Category", 8, 0, 0},
+ {"Categories", 8, 0, 0},
{"Package", 7, 0, 0},
{0, 0, 0, 0}
};
Index: package_meta.cc
Comments: Implement packagemeta::getReadableCategoryList ()
===================================================================
RCS file: /home/max/cvsmirror/cygwin-apps-cvs/setup/package_meta.cc,v
retrieving revision 2.31
diff -u -p -r2.31 package_meta.cc
--- package_meta.cc 2002/07/13 14:00:37 2.31
+++ package_meta.cc 2002/09/19 14:40:13
@@ -241,6 +241,30 @@ packagemeta::add_category (String const
categories.insert (cat);
}
+String const
+packagemeta::getReadableCategoryList () const
+{
+ String catName;
+ set<String, String::caseless>::const_iterator it = categories.begin();
+ set<String, String::caseless>::const_iterator end = categories.end();
+ set<String, String::caseless>::const_iterator all = categories.find("All");
+ while(it != end) {
+ if (all == it) {
+ it++;
+ continue;
+ }
+ catName += *(it);
+ if (++it == end)
+ break;
+ if (all == it) {
+ it++;
+ continue;
+ }
+ catName += ", ";
+ }
+ return catName;
+}
+
static bool
hasSDesc(packageversion const &pkg)
{
Index: package_meta.h
Comments: Declare packagemeta::getReadableCategoryList ()
===================================================================
RCS file: /home/max/cvsmirror/cygwin-apps-cvs/setup/package_meta.h,v
retrieving revision 2.19
diff -u -p -r2.19 package_meta.h
--- package_meta.h 2002/07/07 15:14:50 2.19
+++ package_meta.h 2002/09/19 14:32:08
@@ -96,6 +96,7 @@ public:
*/
void add_category (String const &);
set <String, String::caseless> categories;
+ String const getReadableCategoryList () const;
set <packageversion> versions;
/* which one is installed. */
END_PATCH