From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1416 invoked by alias); 26 Aug 2016 14:43:57 -0000 Mailing-List: contact cygwin-apps-help@cygwin.com; run by ezmlm Precedence: bulk Sender: cygwin-apps-owner@cygwin.com List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Mail-Followup-To: cygwin-apps@cygwin.com Received: (qmail 1405 invoked by uid 89); 26 Aug 2016 14:43:57 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=1.5 required=5.0 tests=AWL,BAYES_50,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_NONE autolearn=no version=3.3.2 spammy=Packages, Select, HCc:D*uk, Shell X-HELO: rgout0503.bt.lon5.cpcloud.co.uk Received: from rgout0503.bt.lon5.cpcloud.co.uk (HELO rgout0503.bt.lon5.cpcloud.co.uk) (65.20.0.224) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 26 Aug 2016 14:43:47 +0000 X-OWM-Source-IP: 31.51.206.108 (GB) X-OWM-Env-Sender: jonturney@btinternet.com X-Junkmail-Premium-Raw: score=27/50,refid=2.7.2:2016.8.25.135716:17:27.888,ip=31.51.206.108,rules=__HAS_FROM, __TO_MALFORMED_2, __TO_NO_NAME, __HAS_CC_HDR, __CC_NAME, __CC_NAME_DIFF_FROM_ACC, __SUBJ_ALPHA_END, __HAS_MSGID, __SANE_MSGID, __HAS_X_MAILER, __IN_REP_TO, __REFERENCES, __FROM_DOMAIN_IN_ANY_CC1, __CP_NAME_BODY, BODY_SIZE_4000_4999, __MIME_TEXT_ONLY, RDNS_GENERIC_POOLED, SXL_IP_DYNAMIC[108.206.51.31.fur], HTML_00_01, HTML_00_10, BODY_SIZE_5000_LESS, RDNS_SUSP_GENERIC, NO_URI_FOUND, NO_CTA_URI_FOUND, __FROM_DOMAIN_IN_RCPT, RDNS_SUSP, IN_REP_TO, REFERENCES, BODY_SIZE_7000_LESS, NO_URI_HTTPS, MSG_THREAD, __CC_REAL_NAMES, MULTIPLE_REAL_RCPTS, LEGITIMATE_SIGNS, LEGITIMATE_NEGATE Received: from localhost.localdomain (31.51.206.108) by rgout05.bt.lon5.cpcloud.co.uk (8.6.122.06) (authenticated as jonturney@btinternet.com) id 57BECDEE003051DB; Fri, 26 Aug 2016 15:43:14 +0100 From: Jon Turney To: cygwin-apps@cygwin.com Cc: Jon Turney Subject: [PATCH setup 6/6] Use a splitbutton to show the view choosing popup menu Date: Fri, 26 Aug 2016 14:43:00 -0000 Message-Id: <20160826144252.23840-2-jon.turney@dronecode.org.uk> In-Reply-To: <20160826144252.23840-1-jon.turney@dronecode.org.uk> References: <20160826144252.23840-1-jon.turney@dronecode.org.uk> X-SW-Source: 2016-08/txt/msg00095.txt.bz2 Pass WM_NOTIFY notifications for child controls of the property page through to OnMessageCommand as well. Future-proof RootPage::OnMessageCmd() to check the notification code. Give IDC_CHOOSE_VIEW button the BS_SPLITBUTTON style, and handle the BCN_DROPDOWN notification from that to show the view choosing menu. --- choose.cc | 34 +++++++++++++++++++--------------- proppage.cc | 10 +++++++--- res.rc | 6 +++--- root.cc | 3 +++ 4 files changed, 32 insertions(+), 21 deletions(-) diff --git a/choose.cc b/choose.cc index 19c1fc9..ecfd5f1 100644 --- a/choose.cc +++ b/choose.cc @@ -385,17 +385,18 @@ ChooserPage::OnMessageCmd (int id, HWND hwndctl, UINT code) Log (LOG_BABBLE) << "OnMesageCmd " << id << " " << hwndctl << " " << code << endLog; #endif - if (code == EN_CHANGE && id == IDC_CHOOSE_SEARCH_EDIT) + if (code == EN_CHANGE) { - 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; + if (id == IDC_CHOOSE_SEARCH_EDIT) + { + SetTimer(GetHWND (), timer_id, SEARCH_TIMER_DELAY, (TIMERPROC) NULL); + return true; + } + else + return false; } - + else if (code == BN_CLICKED) + { switch (id) { case IDC_CHOOSE_CLEAR_SEARCH: @@ -422,10 +423,6 @@ ChooserPage::OnMessageCmd (int id, HWND hwndctl, UINT code) changeTrust (TRUST_TEST); break; - case IDC_CHOOSE_VIEW: - selectView(); - break; - case IDC_CHOOSE_HIDE: chooser->setObsolete (!IsButtonChecked (id)); break; @@ -433,9 +430,16 @@ ChooserPage::OnMessageCmd (int id, HWND hwndctl, UINT code) // Wasn't recognized or handled. return false; } - - // Was handled since we never got to default above. return true; + } + else if (code == BCN_DROPDOWN) + { + if (id == IDC_CHOOSE_VIEW) + selectView(); + } + + // we don't care. + return false; } static void diff --git a/proppage.cc b/proppage.cc index c03e5f7..31f439f 100644 --- a/proppage.cc +++ b/proppage.cc @@ -139,7 +139,9 @@ PropertyPage::DialogProc (UINT message, WPARAM wParam, LPARAM lParam) return TRUE; } case WM_NOTIFY: - switch (((NMHDR FAR *) lParam)->code) + { + NMHDR *pNmHdr = (NMHDR *) lParam; + switch (pNmHdr->code) { case PSN_APPLY: { @@ -256,10 +258,12 @@ PropertyPage::DialogProc (UINT message, WPARAM wParam, LPARAM lParam) } default: { - // Unrecognized notification - return FALSE; + // Pass unrecognized notifications to WM_COMMAND handler + return OnMessageCmd (pNmHdr->idFrom, pNmHdr->hwndFrom, + pNmHdr->code); } } + } break; case WM_COMMAND: { diff --git a/res.rc b/res.rc index 0d124a6..2cdacfb 100644 --- a/res.rc +++ b/res.rc @@ -318,8 +318,8 @@ END // Left-aligned controls. #define SETUP_VIEW_X (7) -#define SETUP_VIEW_W (26) -#define SETUP_SEARCH_X (SETUP_VIEW_X + SETUP_VIEW_W + 125) +#define SETUP_VIEW_W (33) +#define SETUP_SEARCH_X (SETUP_VIEW_X + SETUP_VIEW_W + 2) #define SETUP_SEARCH_W (32) #define SETUP_SEARCHTEXT_X (SETUP_SEARCH_X + SETUP_SEARCH_W + 2) #define SETUP_SEARCHTEXT_W (60) @@ -333,7 +333,7 @@ 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 + 14, BS_SPLITBUTTON 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, diff --git a/root.cc b/root.cc index edf7a91..80f3162 100644 --- a/root.cc +++ b/root.cc @@ -227,6 +227,9 @@ directory_contains_wrong_version (HWND h) bool RootPage::OnMessageCmd (int id, HWND hwndctl, UINT code) { + if ((code != BN_CLICKED) && (code != EN_CHANGE)) + return false; + switch (id) { -- 2.8.3