From 809afa397b0c0c2c6e220f67c01278b406290fa8 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 2 Dec 2016 15:21:39 +0300 Subject: fix for the CSrmmToolbarOptions dialog --- src/mir_app/res/resource.rc | 3 ++- src/mir_app/src/resource.h | 1 + src/mir_app/src/srmm_toolbar.cpp | 25 ++++++++----------------- 3 files changed, 11 insertions(+), 18 deletions(-) (limited to 'src/mir_app') diff --git a/src/mir_app/res/resource.rc b/src/mir_app/res/resource.rc index e994096bb2..a894fa8a71 100644 --- a/src/mir_app/res/resource.rc +++ b/src/mir_app/res/resource.rc @@ -800,10 +800,11 @@ BEGIN PUSHBUTTON "Reset",IDC_BBRESET,250,211,53,15 CONTROL "Show in IM chats",IDC_IMCHECK,"Button",BS_AUTOCHECKBOX | BS_VCENTER | BS_MULTILINE | WS_TABSTOP,4,181,127,12 CONTROL "Show in chat rooms",IDC_CHATCHECK,"Button",BS_AUTOCHECKBOX | BS_VCENTER | BS_MULTILINE | WS_TABSTOP,4,196,127,12 + EDITTEXT IDC_EDIT1,252,183,32,12,ES_AUTOHSCROLL CONTROL "",IDC_SPIN1,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP,272,183,11,12 RTEXT "Gap between buttons:",IDC_STATIC,136,183,104,12,SS_CENTERIMAGE CONTROL "Hide if there isn't enough space",IDC_CANBEHIDDEN, - "Button",BS_AUTOCHECKBOX | BS_VCENTER | BS_MULTILINE | WS_TABSTOP,4,209,131,17 + "Button",BS_AUTOCHECKBOX | BS_VCENTER | BS_MULTILINE | WS_TABSTOP,4,211,127,12 PUSHBUTTON "Insert separator",IDC_SEPARATOR,137,211,103,15,BS_MULTILINE END diff --git a/src/mir_app/src/resource.h b/src/mir_app/src/resource.h index eb56125575..d7d616a911 100644 --- a/src/mir_app/src/resource.h +++ b/src/mir_app/src/resource.h @@ -286,6 +286,7 @@ #define IDC_CANBEHIDDEN 1102 #define IDC_SPIN1 1103 #define IDC_SEPARATOR 1104 +#define IDC_EDIT1 1105 #define IDC_BUILDTIME 1108 #define IDC_CREDITSFILE 1109 #define IDC_NUMBER 1113 diff --git a/src/mir_app/src/srmm_toolbar.cpp b/src/mir_app/src/srmm_toolbar.cpp index 8cc0d224b4..4858eba251 100644 --- a/src/mir_app/src/srmm_toolbar.cpp +++ b/src/mir_app/src/srmm_toolbar.cpp @@ -543,6 +543,7 @@ public: m_toolBar.SetFlags(MTREE_DND); // enable drag-n-drop m_toolBar.OnSelChanged = Callback(this, &CSrmmToolbarOptions::OnTreeSelChanged); m_toolBar.OnSelChanging = Callback(this, &CSrmmToolbarOptions::OnTreeSelChanging); + m_toolBar.OnChange = Callback(this, &CSrmmToolbarOptions::OnTreeChanged); m_btnReset.OnClick = Callback(this, &CSrmmToolbarOptions::btnResetClicked); m_btnSeparator.OnClick = Callback(this, &CSrmmToolbarOptions::btnSeparatorClicked); @@ -695,24 +696,14 @@ public: m_btnHidden.Enable(); m_btnHidden.SetState(cbd->m_bCanBeHidden); } - void OnTreeClicked(void*) + void OnTreeChanged(void*) { - TVHITTESTINFO hti = { 0 }; - GetCursorPos(&hti.pt); - ScreenToClient(m_toolBar.GetHwnd(), &hti.pt); - if (m_toolBar.HitTest(&hti)) { - if (hti.flags & TVHT_ONITEMSTATEICON) { - NotifyChange(); - int iNewState = m_toolBar.GetCheckState(hti.hItem); - m_btnIM.Enable(iNewState); - m_btnChat.Enable(iNewState); - m_btnHidden.Enable(iNewState); - if (iNewState) - m_btnIM.SetState(true); - - m_toolBar.SelectItem(hti.hItem); - } - } + int iNewState = !m_toolBar.GetCheckState(m_toolBar.GetSelection()); + m_btnIM.Enable(iNewState); + m_btnChat.Enable(iNewState); + m_btnHidden.Enable(iNewState); + if (iNewState) + m_btnIM.SetState(true); } }; -- cgit v1.2.3