public inbox for cygwin-apps@cygwin.com
 help / color / mirror / Atom feed
From: Ken Brown <kbrown@cornell.edu>
To: cygwin-apps@cygwin.com
Subject: [PATCH setup v3 1/6] Use the IDD_SITE dialog for cygwin.com mirrors only
Date: Wed, 06 Dec 2017 20:46:00 -0000	[thread overview]
Message-ID: <20171206204559.4756-2-kbrown@cornell.edu> (raw)
In-Reply-To: <20171206204559.4756-1-kbrown@cornell.edu>

Remove controls related to adding a user URL.  Add a checkbox
IDC_ALLOW_USER_URL; checking this sets a new boolean variable
allow_user_url.
---
 res.rc     | 14 ++++++--------
 resource.h |  1 +
 site.cc    | 39 ++++-----------------------------------
 3 files changed, 11 insertions(+), 43 deletions(-)

diff --git a/res.rc b/res.rc
index a4d7e70..ffc4722 100644
--- a/res.rc
+++ b/res.rc
@@ -131,25 +131,23 @@ IDD_SITE DIALOG DISCARDABLE  0, 0, SETUP_STANDARD_DIALOG_DIMS
 STYLE DS_MODALFRAME | DS_3DLOOK | DS_CENTER | WS_CHILD | WS_VISIBLE | 
     WS_CAPTION | WS_SYSMENU
 EXSTYLE WS_EX_CONTROLPARENT
-CAPTION "Cygwin Setup - Choose Download Site(s)"
+CAPTION "Cygwin Setup - Choose Mirror(s)"
 FONT 8, "MS Shell Dlg"
 BEGIN
     ICON            IDI_CYGWIN,IDC_HEADICON,SETUP_HEADICON_X,0,21,20
     LISTBOX         IDC_URL_LIST,66,45,185,110,LBS_NOINTEGRALHEIGHT | 
                     LBS_EXTENDEDSEL | WS_VSCROLL | WS_HSCROLL | WS_GROUP | 
                     WS_TABSTOP
-    LTEXT           "Available Download Sites:",IDC_STATIC,66,34,183,8,NOT 
+    LTEXT           "Available Mirrors:",IDC_STATIC,66,34,183,8,NOT
                     WS_GROUP
     CONTROL         "",IDC_HEADSEPARATOR,"Static",SS_BLACKFRAME | SS_SUNKEN,0,28,
                     SETUP_STANDARD_DIALOG_W,1
-    LTEXT           "Choose a site from this list, or add your own sites to the list",
+    LTEXT           "Choose a cygwin.com mirror from this list",
                     IDC_STATIC,21,9,239,16,NOT WS_GROUP
-    LTEXT           "Choose A Download Site",IDC_STATIC_HEADER_TITLE,7,0,258,
+    LTEXT           "Choose A Mirror",IDC_STATIC_HEADER_TITLE,7,0,258,
                     8,NOT WS_GROUP
-    EDITTEXT        IDC_EDIT_USER_URL,65,160,185,14,ES_AUTOHSCROLL | 
-                    WS_GROUP
-    LTEXT           "User URL:",IDC_SITE_USERURL,15,162,45,8,NOT WS_GROUP
-    PUSHBUTTON      "Add",IDC_BUTTON_ADD_URL,255,160,50,14
+    CONTROL         "Allow sites that are not cygwin.com mirrors (to be chosen on the next page)",
+                    IDC_ALLOW_USER_URL,"Button",BS_AUTOCHECKBOX,15,162,350,8
 END
 
 IDD_NET DIALOG DISCARDABLE  0, 0, SETUP_STANDARD_DIALOG_DIMS
diff --git a/resource.h b/resource.h
index a2e867f..d111853 100644
--- a/resource.h
+++ b/resource.h
@@ -177,3 +177,4 @@
 #define IDC_FILE_INUSE_HELP               592
 #define IDC_NET_DIRECT_LEGACY             593
 #define IDC_DOWNLOAD_EDIT                 594
+#define IDC_ALLOW_USER_URL                595
diff --git a/site.cc b/site.cc
index a945d28..1b04343 100644
--- a/site.cc
+++ b/site.cc
@@ -61,9 +61,7 @@ enum
  */
 static ControlAdjuster::ControlInfo SiteControlsInfo[] = {
   {IDC_URL_LIST, 		CP_STRETCH, CP_STRETCH},
-  {IDC_EDIT_USER_URL,		CP_STRETCH, CP_BOTTOM},
-  {IDC_BUTTON_ADD_URL,		CP_RIGHT,   CP_BOTTOM},
-  {IDC_SITE_USERURL,            CP_LEFT,    CP_BOTTOM},
+  {IDC_ALLOW_USER_URL,          CP_LEFT,    CP_BOTTOM},
   {0, CP_LEFT, CP_TOP}
 };
 
@@ -78,6 +76,7 @@ SitePage::SitePage ()
 
 using namespace std;
 
+bool allow_user_url;
 bool cache_is_usable;
 bool cache_needs_writing;
 string cache_warn_urls;
@@ -677,13 +676,6 @@ bool SitePage::OnMessageCmd (int id, HWND hwndctl, UINT code)
 {
   switch (id)
     {
-    case IDC_EDIT_USER_URL:
-      {
-	// Set the default pushbutton to ADD if the user is entering text.
-	if (code == EN_CHANGE)
-	  SendMessage (GetHWND (), DM_SETDEFID, (WPARAM) IDC_BUTTON_ADD_URL, 0);
-	break;
-      }
     case IDC_URL_LIST:
       {
 	if (code == LBN_SELCHANGE)
@@ -693,33 +685,10 @@ bool SitePage::OnMessageCmd (int id, HWND hwndctl, UINT code)
 	  }
 	break;
       }
-    case IDC_BUTTON_ADD_URL:
+    case IDC_ALLOW_USER_URL:
       {
 	if (code == BN_CLICKED)
-	  {
-	    // User pushed the Add button.
-	    std::string other_url = egetString (GetHWND (), IDC_EDIT_USER_URL);
-	    if (other_url.size())
-	    {
-	    site_list_type newsite (other_url, "", "", "", false);
-	    SiteList::iterator i = find (all_site_list.begin(),
-					 all_site_list.end(), newsite);
-	    if (i == all_site_list.end())
-	      {
-		all_site_list.push_back (newsite);
-		Log (LOG_BABBLE) << "Adding site: " << other_url << endLog;
-		site_list.push_back (newsite);
-	      }
-	    else
-	      site_list.push_back (*i);
-
-	    // Update the list box.
-	    PopulateListBox ();
-	    // And allow the user to continue
-	    CheckControlsAndDisableAccordingly ();
-	    eset (GetHWND (), IDC_EDIT_USER_URL, "");
-	    }
-	  }
+	  allow_user_url = IsButtonChecked (IDC_ALLOW_USER_URL);
 	break;
       }
     default:
-- 
2.15.1

  reply	other threads:[~2017-12-06 20:46 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-06 20:46 [PATCH setup v3 0/6] Distinguish between user URLs and cygwin mirrors in UI Ken Brown
2017-12-06 20:46 ` Ken Brown [this message]
2017-12-06 20:46 ` [PATCH setup v3 4/6] Display full URLs in the user site list Ken Brown
2017-12-06 20:46 ` [PATCH setup v3 3/6] Create new page UserSitePage for user URLs Ken Brown
2017-12-06 20:46 ` [PATCH setup v3 2/6] Use SitePage for cygwin.com mirrors only Ken Brown
2017-12-06 20:46 ` [PATCH setup v3 6/6] Display area and location of mirrors, and add these to the sort key Ken Brown
2017-12-06 20:46 ` [PATCH setup v3 5/6] Keep the mirror list sorted properly Ken Brown
2017-12-06 21:08 ` [PATCH setup v3 0/6] Distinguish between user URLs and cygwin mirrors in UI Brian Inglis
2017-12-06 21:55   ` Ken Brown
2017-12-06 22:15     ` Brian Inglis
2017-12-07 13:55       ` Jon Turney
2017-12-07 15:08         ` Ken Brown
2017-12-07 19:08           ` Jon Turney
2017-12-07 20:15             ` Achim Gratz
2017-12-07 21:49             ` Ken Brown
2017-12-08 18:53               ` Achim Gratz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171206204559.4756-2-kbrown@cornell.edu \
    --to=kbrown@cornell.edu \
    --cc=cygwin-apps@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).