This is the mail archive of the cygwin-apps mailing list for the Cygwin 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]

[PATCH setup v2 1/5] Add checkbox IDC_ALLOW_USER_URL to IDD_SITE dialog


Enable the "User URL" edit box and "Add" button only if
IDC_ALLOW_USER_URL is checked.
---
 res.rc     | 15 ++++++++-------
 resource.h |  1 +
 site.cc    | 15 +++++++++++++++
 3 files changed, 24 insertions(+), 7 deletions(-)

diff --git a/res.rc b/res.rc
index a4d7e70..b5dcb3e 100644
--- a/res.rc
+++ b/res.rc
@@ -135,21 +135,22 @@ CAPTION "Cygwin Setup - Choose Download Site(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 | 
+    LISTBOX         IDC_URL_LIST,66,34,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 
-                    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",
                     IDC_STATIC,21,9,239,16,NOT WS_GROUP
     LTEXT           "Choose A Download Site",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
+    EDITTEXT        IDC_EDIT_USER_URL,65,165,185,14,ES_AUTOHSCROLL |
+                    WS_GROUP | WS_DISABLED
+    LTEXT           "User URL:",IDC_SITE_USERURL,15,167,45,8,NOT WS_GROUP |
+                    WS_DISABLED
+    PUSHBUTTON      "Add",IDC_BUTTON_ADD_URL,255,165,50,14,WS_DISABLED
+    CONTROL         "Allow sites that are not cygwin.com mirrors",
+                    IDC_ALLOW_USER_URL,"Button",BS_AUTOCHECKBOX,15,150,200,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 230d82c..607c591 100644
--- a/site.cc
+++ b/site.cc
@@ -64,6 +64,7 @@ static ControlAdjuster::ControlInfo SiteControlsInfo[] = {
   {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 +79,7 @@ SitePage::SitePage ()
 
 using namespace std;
 
+bool allow_user_url;
 bool cache_is_usable;
 bool cache_needs_writing;
 string cache_warn_urls;
@@ -637,6 +639,10 @@ SitePage::CheckControlsAndDisableAccordingly () const
       ButtonFlags |= PSWIZB_NEXT;
     }
   GetOwner ()->SetButtons (ButtonFlags);
+
+  EnableWindow (GetDlgItem (IDC_EDIT_USER_URL), allow_user_url);
+  EnableWindow (GetDlgItem (IDC_SITE_USERURL), allow_user_url);
+  EnableWindow (GetDlgItem (IDC_BUTTON_ADD_URL), allow_user_url);
 }
 
 void
@@ -720,6 +726,15 @@ bool SitePage::OnMessageCmd (int id, HWND hwndctl, UINT code)
 	  }
 	break;
       }
+    case IDC_ALLOW_USER_URL:
+      {
+	if (code == BN_CLICKED)
+	  {
+	    allow_user_url = IsButtonChecked (IDC_ALLOW_USER_URL);
+	    CheckControlsAndDisableAccordingly ();
+	  }
+	break;
+      }
     default:
       // Wasn't recognized or handled.
       return false;
-- 
2.15.1


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