From c23145643c47428677da6a42f3185b94968fddf1 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 27 Sep 2012 19:35:36 +0000 Subject: clutch for TopToolBar not to destroy buttons on Apply in options git-svn-id: http://svn.miranda-ng.org/main/trunk@1691 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_modern/src/modern_toolbar.cpp | 6 +---- plugins/Clist_nicer/src/cluiservices.cpp | 36 +++++++++++++++-------------- plugins/ExternalAPI/m_toptoolbar.h | 1 + plugins/TopToolBar/src/ttbopt.cpp | 7 ++++-- 4 files changed, 26 insertions(+), 24 deletions(-) diff --git a/plugins/Clist_modern/src/modern_toolbar.cpp b/plugins/Clist_modern/src/modern_toolbar.cpp index ce407edc96..0390e39949 100644 --- a/plugins/Clist_modern/src/modern_toolbar.cpp +++ b/plugins/Clist_modern/src/modern_toolbar.cpp @@ -100,11 +100,6 @@ struct ModernToolbarCtrl : public TTBCtrl XPTHANDLE mtbXPTheme; }; -struct MTB_BUTTONINFO -{ - HWND hWindow; -}; - struct { HBITMAP mtb_hBmpBackground; @@ -304,6 +299,7 @@ void CustomizeToolbar(HWND hwnd) CallService(MS_SKINENG_REGISTERPAINTSUB,(WPARAM)hwnd,(LPARAM)ToolBar_LayeredPaintProc); pMTBInfo->mtbXPTheme = xpt_AddThemeHandle(hwnd, L"TOOLBAR"); + pMTBInfo->bHardUpdate = TRUE; } #define TTB_OPTDIR "TopToolBar" diff --git a/plugins/Clist_nicer/src/cluiservices.cpp b/plugins/Clist_nicer/src/cluiservices.cpp index d5cba25d3d..9572935020 100644 --- a/plugins/Clist_nicer/src/cluiservices.cpp +++ b/plugins/Clist_nicer/src/cluiservices.cpp @@ -240,26 +240,28 @@ void CluiProtocolStatusChanged( int parStatus, const char* szProto ) * status mode button */ - if (szStatus) { - if (pcli->hwndContactList && IsWindow(GetDlgItem(pcli->hwndContactList, IDC_TBGLOBALSTATUS))) { - HWND hwndTtbStatus = ClcGetButtonWindow(IDC_TBTOPSTATUS); - - SendMessage(GetDlgItem(pcli->hwndContactList, IDC_TBGLOBALSTATUS), WM_SETTEXT, 0, (LPARAM) szStatus); - if (!hIcon) { - SendMessage(GetDlgItem(pcli->hwndContactList, IDC_TBGLOBALSTATUS), BUTTONSETIMLICON, (WPARAM) hCListImages, (LPARAM) iIcon); - if (g_ButtonItems == NULL && hwndTtbStatus) - SendMessage( hwndTtbStatus, BUTTONSETIMLICON, (WPARAM) hCListImages, (LPARAM) iIcon); - } - else { - SendMessage(GetDlgItem(pcli->hwndContactList, IDC_TBGLOBALSTATUS), BM_SETIMAGE, IMAGE_ICON, (LPARAM) hIcon); - if (g_ButtonItems == NULL && hwndTtbStatus) + if (szStatus && pcli->hwndContactList) { + HWND hwndClistBtn = GetDlgItem(pcli->hwndContactList, IDC_TBGLOBALSTATUS); + if ( IsWindow(hwndClistBtn)) { + SendMessage(hwndClistBtn, WM_SETTEXT, 0, (LPARAM) szStatus); + if (!hIcon) + SendMessage(hwndClistBtn, BUTTONSETIMLICON, (WPARAM) hCListImages, (LPARAM) iIcon); + else + SendMessage(hwndClistBtn, BM_SETIMAGE, IMAGE_ICON, (LPARAM) hIcon); + InvalidateRect(hwndClistBtn, NULL, TRUE); + } + + HWND hwndTtbStatus = ClcGetButtonWindow(IDC_TBTOPSTATUS); + if ( IsWindow(hwndTtbStatus)) { + if (g_ButtonItems == NULL) { + if (!hIcon) + SendMessage(hwndTtbStatus, BUTTONSETIMLICON, (WPARAM) hCListImages, (LPARAM) iIcon); + else SendMessage(hwndTtbStatus, BM_SETIMAGE, IMAGE_ICON, (LPARAM) hIcon); } - InvalidateRect(GetDlgItem(pcli->hwndContactList, IDC_TBGLOBALSTATUS), NULL, TRUE); - if (hwndTtbStatus) - InvalidateRect(hwndTtbStatus, NULL, TRUE); - SFL_Update(hIcon, iIcon, hCListImages, szStatus, TRUE); + InvalidateRect(hwndTtbStatus, NULL, TRUE); } + SFL_Update(hIcon, iIcon, hCListImages, szStatus, TRUE); } return; } diff --git a/plugins/ExternalAPI/m_toptoolbar.h b/plugins/ExternalAPI/m_toptoolbar.h index ee3e1d0038..3c9d569d31 100644 --- a/plugins/ExternalAPI/m_toptoolbar.h +++ b/plugins/ExternalAPI/m_toptoolbar.h @@ -165,6 +165,7 @@ struct TTBCtrl int nLastHeight; // fix against recursion in WM_SIZE BOOL bOrderChanged; // set by buttons' arrange procedure if the buttons' order was changed BOOL bFlatButtons, bAutoSize, bSingleLine; + BOOL bHardUpdate; // clist modern requires to delete buttons to update them SortedList* pButtonList; diff --git a/plugins/TopToolBar/src/ttbopt.cpp b/plugins/TopToolBar/src/ttbopt.cpp index db7d78dcb5..ea6e994cba 100644 --- a/plugins/TopToolBar/src/ttbopt.cpp +++ b/plugins/TopToolBar/src/ttbopt.cpp @@ -131,8 +131,11 @@ static void RecreateWindows() for (int i = 0; i < Buttons.getCount(); i++) { TopButtonInt *b = Buttons[i]; if (b->hwnd) { - DestroyWindow(b->hwnd); - b->CreateWnd(); + if (g_ctrl->bHardUpdate) { + DestroyWindow(b->hwnd); + b->CreateWnd(); + } + else b->SetBitmap(); } } } -- cgit v1.2.3