[PATCH setup v3 1/6] Use the IDD_SITE dialog for cygwin.com mirrors only
Ken Brown
kbrown@cornell.edu
Wed Dec 6 20:46:00 GMT 2017
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
More information about the Cygwin-apps
mailing list