This is the mail archive of the cygwin-apps-cvs mailing list for the cygwin-apps project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[setup - the official Cygwin setup program used to install Cygwin and keep it up to date] branch master, updated. release_2.874-22-g4f0fb3e




https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=4f0fb3e4b44b79600e27136d5bbf4607a3fd45fa

commit 4f0fb3e4b44b79600e27136d5bbf4607a3fd45fa
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Sun Aug 28 21:26:25 2016 +0100

    Use a drop-down list to directly select chooser view filter
    
    Rather than a button for cycling through views, use a drop-down list to
    choose the view
    
    Remove not very useful PickView::views::Unknown enum value so that enum can
    start from 0, so it can be used directly as a drop-down list index.

https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=fa8967caffbc75ff1b3028c8b229aecd9b9fcf51

commit fa8967caffbc75ff1b3028c8b229aecd9b9fcf51
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Wed Aug 3 22:35:05 2016 +0100

    Rename PickView::Package to PickView::PackagePending
    
    Rename PickView::Package to PickView::PackagePending, as that's what that
    view is

https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=bf374ed9be2131b112de131834f601669b8b0702

commit bf374ed9be2131b112de131834f601669b8b0702
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Wed Aug 3 22:31:05 2016 +0100

    Change PickView::view into an enum
    
    Change PickView::view from a class, into an enum
    
    Use a C++11 scoped enum so we don't have to change all the uses of it's
    values.

https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=abad8c0c6e750cef60c9227a656b64f71e621365

commit abad8c0c6e750cef60c9227a656b64f71e621365
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Wed Aug 3 22:15:25 2016 +0100

    Build C++ code with -std=gnu++11
    
    Use BASECXXFLAGS rather then AM_CXXFLAGS to make AM_CFLAGS
    Rationalize BASECXXFLAGS, adding -Werror and removing -Wno-uninitialized
    (since the bug preventing it being used is long fixed)
    Fix a bug detected by -Wuninitialized
    Build C++ code with -std=gnu++11 -Wno-deprecated-declarations


Diff:
---
 Makefile.am |    9 ++++-----
 PickView.cc |   58 ++++++++++++++++------------------------------------------
 PickView.h  |   44 ++++++++++----------------------------------
 choose.cc   |   53 +++++++++++++++++++++++++++++++++++------------------
 ini.cc      |    2 +-
 res.rc      |   20 ++++++++++----------
 6 files changed, 76 insertions(+), 110 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 7fa61e9..044a1ce 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -21,13 +21,12 @@ SUBDIRS := @subdirs@ tests
 
 # We would like to use -Winline for C++ as well, but some STL code triggers
 # this warning. (Bug verified present in gcc-3.3)
-# -Wno-uninitialized added to deal with g++ 3.4.4's spurious STL warnings
-# (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22207)
-BASECXXFLAGS = -Wall -Wno-uninitialized -Wpointer-arith -Wcomments \
+BASECXXFLAGS = -Werror -Wall -Wpointer-arith -Wcomments \
 	       -Wcast-align -Wwrite-strings -fno-builtin-sscanf \
 	       -Wno-attributes
-AM_CXXFLAGS = -Werror $(BASECXXFLAGS) ${$(*F)_CXXFLAGS}
-AM_CFLAGS = $(AM_CXXFLAGS) -Wmissing-declarations -Winline \
+AM_CXXFLAGS = $(BASECXXFLAGS) -std=gnu++11 -Wno-deprecated-declarations \
+	      ${$(*F)_CXXFLAGS}
+AM_CFLAGS = $(BASECXXFLAGS) -Wmissing-declarations -Winline \
 	    -Wstrict-prototypes -Wmissing-prototypes
 AM_YFLAGS = -d
 AM_LFLAGS = -8
diff --git a/PickView.cc b/PickView.cc
index c784a2a..fc6f8c2 100644
--- a/PickView.cc
+++ b/PickView.cc
@@ -52,15 +52,6 @@ static PickView::Header cat_headers[] = {
   {0, 0, 0, false}
 };
 
-// PickView:: views
-const PickView::views PickView::views::Unknown (0);
-const PickView::views PickView::views::PackageFull (1);
-const PickView::views PickView::views::Package (2);
-const PickView::views PickView::views::PackageKeeps (3);
-const PickView::views PickView::views::PackageSkips (4);
-const PickView::views PickView::views::PackageUserPicked (5);
-const PickView::views PickView::views::Category (6);
-
 ATOM PickView::WindowClassAtom = 0;
 
 // DoInsertItem - inserts an item into a header control.
@@ -90,11 +81,9 @@ DoInsertItem (HWND hwndHeader, int iInsertAfter, int nWidth, LPSTR lpsz)
 int
 PickView::set_header_column_order (views vm)
 {
-  if (vm == views::Unknown)
-    return -1;
-  else if (vm == views::PackageFull || vm == views::Package
-           || vm == views::PackageKeeps || vm == views::PackageSkips
-           || vm == views::PackageUserPicked)
+  if (vm == views::PackageFull || vm == views::PackagePending
+      || vm == views::PackageKeeps || vm == views::PackageSkips
+      || vm == views::PackageUserPicked)
     {
       headers = pkg_headers;
       current_col = 0;
@@ -150,12 +139,6 @@ PickView::note_width (PickView::Header *hdrs, HDC dc,
 }
 
 void
-PickView::cycleViewMode ()
-{
-  setViewMode (++view_mode);
-}
-
-void
 PickView::setViewMode (views mode)
 {
   view_mode = mode;
@@ -186,7 +169,7 @@ PickView::setViewMode (views mode)
               (view_mode == PickView::views::PackageFull)
 
               // "Pending" : packages that are being added/removed/upgraded
-              || (view_mode == PickView::views::Package &&
+              || (view_mode == PickView::views::PackagePending &&
                   ((!pkg.desired && pkg.installed) ||         // uninstall
                     (pkg.desired &&
                       (pkg.desired.picked () ||               // install bin
@@ -232,28 +215,28 @@ PickView::setViewMode (views mode)
   InvalidateRect (GetHWND(), &r, TRUE);
 }
 
-const char *
-PickView::mode_caption ()
+PickView::views
+PickView::getViewMode ()
 {
-  return view_mode.caption ();
+  return view_mode;
 }
 
 const char *
-PickView::views::caption ()
+PickView::mode_caption (views mode)
 {
-  switch (_value)
+  switch (mode)
     {
-    case 1:
+    case views::PackageFull:
       return "Full";
-    case 2:
+    case views::PackagePending:
       return "Pending";
-    case 3:
+    case views::PackageKeeps:
       return "Up To Date";
-    case 4:
+    case views::PackageSkips:
       return "Not Installed";
-    case 5:
+    case views::PackageUserPicked:
       return "Picked";
-    case 6:
+    case views::Category:
       return "Category";
     default:
       return "";
@@ -348,15 +331,6 @@ PickView::insert_category (Category *cat, bool collapsed)
     delete &catline;
 }
 
-PickView::views&
-PickView::views::operator++ ()
-{
-  ++_value;
-  if (_value > Category._value)
-    _value = 1;
-  return *this;
-}
-
 int
 PickView::click (int row, int x)
 {
@@ -835,7 +809,7 @@ PickView::WindowProc (UINT message, WPARAM wParam, LPARAM lParam)
                         lastWindowRect.width ()) != 0)
               {
                 cat_headers[set_header_column_order (views::Category)].width += dx;
-                pkg_headers[set_header_column_order (views::Package)].width += dx;
+                pkg_headers[set_header_column_order (views::PackagePending)].width += dx;
                 set_header_column_order (view_mode);
                 set_headers ();
                 ::MoveWindow (listheader, -scroll_ulc_x, 0,
diff --git a/PickView.h b/PickView.h
index fd20dc9..298f844 100644
--- a/PickView.h
+++ b/PickView.h
@@ -40,12 +40,12 @@ class PickView : public Window
 public:
   virtual bool Create (Window * Parent = NULL, DWORD Style = WS_OVERLAPPEDWINDOW | WS_VISIBLE | WS_CLIPCHILDREN, RECT * r = NULL);
   virtual bool registerWindowClass ();
-  class views;
+  enum class views;
   class Header;
   int num_columns;
   void defaultTrust (trusts trust);
-  void cycleViewMode ();
   void setViewMode (views mode);
+  views getViewMode ();
   void DrawIcon (HDC hdc, int x, int y, HANDLE hIcon);
   void paint (HWND hwnd);
   LRESULT CALLBACK list_click (HWND hwnd, BOOL dblclk, int x, int y, UINT hitCode);
@@ -57,7 +57,7 @@ public:
   PickView (Category & cat);
   void init(views _mode);
   ~PickView();
-  const char *mode_caption ();
+  static const char *mode_caption (views mode);
   void setObsolete (bool doit);
   void insert_pkg (packagemeta &);
   void insert_category (Category *, bool);
@@ -96,38 +96,14 @@ public:
     return listheader;
   }
 
-  class views
+  enum class views
   {
-  public:
-    static const views Unknown;
-    static const views PackageFull;
-    static const views Package;
-    static const views PackageKeeps;
-    static const views PackageSkips;
-    static const views PackageUserPicked;
-    static const views Category;
-      views ():_value (0)
-    {
-    };
-    views (int aInt)
-    {
-      _value = aInt;
-      if (_value < 0 || _value > 6)
-	_value = 0;
-    }
-    views & operator++ ();
-    bool operator == (views const &rhs)
-    {
-      return _value == rhs._value;
-    }
-    bool operator != (views const &rhs)
-    {
-      return _value != rhs._value;
-    }
-    const char *caption ();
-
-  private:
-    int _value;
+    PackageFull = 0,
+    PackagePending,
+    PackageKeeps,
+    PackageSkips,
+    PackageUserPicked,
+    Category,
   };
 
   class Header
diff --git a/choose.cc b/choose.cc
index 1c97f59..6563cb3 100644
--- a/choose.cc
+++ b/choose.cc
@@ -152,10 +152,8 @@ ChooserPage::createListview ()
   chooser->init(PickView::views::Category);
   chooser->Show(SW_SHOW);
   chooser->setViewMode (UpgradeAlsoOption || hasManualSelections ?
-			PickView::views::Package : PickView::views::Category);
-  if (!SetDlgItemText (GetHWND (), IDC_CHOOSE_VIEWCAPTION, chooser->mode_caption ()))
-    Log (LOG_BABBLE) << "Failed to set View button caption %ld" <<
-	 GetLastError () << endLog;
+			PickView::views::PackagePending : PickView::views::Category);
+  SendMessage (GetDlgItem (IDC_CHOOSE_VIEW), CB_SETCURSEL, (WPARAM)chooser->getViewMode(), 0);
 
   /* FIXME: do we need to init the desired fields ? */
   static int ta[] = { IDC_CHOOSE_KEEP, IDC_CHOOSE_CURR, IDC_CHOOSE_EXP, 0 };
@@ -241,6 +239,16 @@ ChooserPage::OnInit ()
 {
   CheckDlgButton (GetHWND (), IDC_CHOOSE_HIDE, BST_CHECKED);
 
+  /* Populate view dropdown list with choices */
+  HWND viewlist = GetDlgItem (IDC_CHOOSE_VIEW);
+  SendMessage (viewlist, CB_RESETCONTENT, 0, 0);
+  for (int view = (int)PickView::views::PackageFull;
+       view <= (int)PickView::views::Category;
+       view++)
+    {
+      SendMessage(viewlist, CB_ADDSTRING, 0, (LPARAM)PickView::mode_caption((PickView::views)view));
+    }
+
   SetBusy ();
   if (source == IDC_SOURCE_DOWNLOAD || source == IDC_SOURCE_LOCALDIR)
     packagemeta::ScanDownloadedFiles (MirrorOption);
@@ -385,17 +393,17 @@ ChooserPage::changeTrust(trusts aTrust)
 bool
 ChooserPage::OnMessageCmd (int id, HWND hwndctl, UINT code)
 {
+#if DEBUG
+  Log (LOG_BABBLE) << "OnMesageCmd " << id << " " << hwndctl << " " << code << endLog;
+#endif
+
   if (code == EN_CHANGE && id == IDC_CHOOSE_SEARCH_EDIT)
     {
       SetTimer(GetHWND (), timer_id, SEARCH_TIMER_DELAY, (TIMERPROC) NULL);
       return true;
     }
-  else if (code != BN_CLICKED && code != EN_CHANGE)
-    {
-      // Not a click notification, we don't care.
-      return false;
-    }
-
+  else if (code == BN_CLICKED)
+  {
   switch (id)
     {
     case IDC_CHOOSE_CLEAR_SEARCH:
@@ -422,14 +430,6 @@ ChooserPage::OnMessageCmd (int id, HWND hwndctl, UINT code)
         changeTrust (TRUST_TEST);
       break;
 
-    case IDC_CHOOSE_VIEW:
-      chooser->cycleViewMode ();
-      if (!SetDlgItemText
-        (GetHWND (), IDC_CHOOSE_VIEWCAPTION, chooser->mode_caption ()))
-      Log (LOG_BABBLE) << "Failed to set View button caption " <<
-           GetLastError () << endLog;
-      break;
-
     case IDC_CHOOSE_HIDE:
       chooser->setObsolete (!IsButtonChecked (id));
       break;
@@ -440,6 +440,23 @@ ChooserPage::OnMessageCmd (int id, HWND hwndctl, UINT code)
 
   // Was handled since we never got to default above.
   return true;
+  }
+  else if (code == CBN_SELCHANGE)
+    {
+      if (id == IDC_CHOOSE_VIEW)
+        {
+          // switch to the selected view
+          LRESULT view_mode = SendMessage (GetDlgItem (IDC_CHOOSE_VIEW),
+                                           CB_GETCURSEL, 0, 0);
+          if (view_mode != CB_ERR)
+            chooser->setViewMode ((PickView::views)view_mode);
+
+          return true;
+        }
+    }
+
+  // We don't care.
+  return false;
 }
 
 INT_PTR CALLBACK
diff --git a/ini.cc b/ini.cc
index f925bf5..82990a2 100644
--- a/ini.cc
+++ b/ini.cc
@@ -270,7 +270,7 @@ do_remote_ini (HWND owner)
   size_t ini_count = 0;
   GuiParseFeedback myFeedback;
   IniDBBuilderPackage aBuilder (myFeedback);
-  io_stream *ini_file, *ini_sig_file;
+  io_stream *ini_file = NULL, *ini_sig_file;
 
   /* FIXME: Get rid of this io_stream pointer travesty.  The need to
      explicitly delete these things is ridiculous. */
diff --git a/res.rc b/res.rc
index 2fae133..99305c3 100644
--- a/res.rc
+++ b/res.rc
@@ -318,10 +318,10 @@ END
 
 // Left-aligned controls.
 #define SETUP_VIEW_X		(7)
-#define SETUP_VIEW_W		(26)
-#define SETUP_VIEWCAP_X		(SETUP_VIEW_X + SETUP_VIEW_W +5)
-#define SETUP_VIEWCAP_W		(40)
-#define SETUP_SEARCH_X		(SETUP_VIEWCAP_X + SETUP_VIEWCAP_W + 80)
+#define SETUP_VIEW_W		(20)
+#define SETUP_VIEWLIST_X		(SETUP_VIEW_X + SETUP_VIEW_W + 2)
+#define SETUP_VIEWLIST_W		(60)
+#define SETUP_SEARCH_X		(SETUP_VIEWLIST_X + SETUP_VIEWLIST_W + 2)
 #define SETUP_SEARCH_W		(32)
 #define SETUP_SEARCHTEXT_X	(SETUP_SEARCH_X + SETUP_SEARCH_W + 2)
 #define SETUP_SEARCHTEXT_W	(60)
@@ -334,10 +334,10 @@ STYLE DS_MODALFRAME | DS_3DLOOK | WS_CHILD | WS_VISIBLE | WS_CAPTION |
 CAPTION "Cygwin Setup - Select Packages"
 FONT 8, "MS Shell Dlg"
 BEGIN
-    PUSHBUTTON      "&View", IDC_CHOOSE_VIEW, SETUP_VIEW_X, 30, SETUP_VIEW_W,
-                    14, WS_EX_RIGHT
-    LTEXT           "", IDC_CHOOSE_VIEWCAPTION, SETUP_VIEWCAP_X, 33,
-                    SETUP_VIEWCAP_W, 10
+    LTEXT           "View", IDC_CHOOSE_VIEWCAPTION, SETUP_VIEW_X, 33,
+                    SETUP_VIEW_W, 10
+    COMBOBOX        IDC_CHOOSE_VIEW, SETUP_VIEWLIST_X, 30, SETUP_VIEWLIST_W, 84,
+                    CBS_DROPDOWNLIST
     RTEXT           "&Search", IDC_STATIC, SETUP_SEARCH_X, 33, SETUP_SEARCH_W,
                     10, SS_CENTERIMAGE, WS_EX_RIGHT
     EDITTEXT        IDC_CHOOSE_SEARCH_EDIT, SETUP_SEARCHTEXT_X, 30,
@@ -536,8 +536,8 @@ BEGIN
        "considered the most stable. (RECOMMENDED)"
     IDS_TRUSTEXP_TOOLTIP    "Globally select the most recent version, even if "
        "that version is considered Experimental or for test use by the maintainer."
-    IDS_VIEWBUTTON_TOOLTIP  "Cycles the package view.  This determines "
-       "which packages are shown in the chooser below.\r\n"
+    IDS_VIEWBUTTON_TOOLTIP  "Select the package view.  This determines "
+       "which packages are shown below.\r\n"
        "\r\n"
        "Category: Group by package category.  Click on '+' to expand.\r\n"
        "\r\n"


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]