From c16e8e071b0b84bfb4ed58d22779e3052b8407d3 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 4 Feb 2013 14:57:59 +0000 Subject: fix for always visible TopToolBar frame fixes #74 git-svn-id: http://svn.miranda-ng.org/main/trunk@3421 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/TopToolBar/src/toolbar.cpp | 6 +++--- plugins/TopToolBar/src/toolbarwnd.cpp | 19 ++++++------------- plugins/TopToolBar/src/ttbopt.cpp | 2 +- 3 files changed, 10 insertions(+), 17 deletions(-) (limited to 'plugins/TopToolBar') diff --git a/plugins/TopToolBar/src/toolbar.cpp b/plugins/TopToolBar/src/toolbar.cpp index dde3ee5134..eabd252d17 100644 --- a/plugins/TopToolBar/src/toolbar.cpp +++ b/plugins/TopToolBar/src/toolbar.cpp @@ -538,7 +538,7 @@ int OnIconChange(WPARAM wParam, LPARAM lParam) if (g_ctrl->hWnd) { g_ctrl->bOrderChanged = true; - PostMessage(g_ctrl->hWnd, TTB_UPDATEFRAMEVISIBILITY, TRUE, 0); + PostMessage(g_ctrl->hWnd, TTB_UPDATEFRAMEVISIBILITY, 0, 0); } return 0; @@ -564,7 +564,7 @@ int OnPluginLoad(WPARAM wParam, LPARAM lParam) { CallPluginEventHook((HINSTANCE)lParam, hTTBModuleLoaded, 0, 0); if (g_ctrl->hWnd && g_ctrl->bOrderChanged) - PostMessage(g_ctrl->hWnd, TTB_UPDATEFRAMEVISIBILITY, TRUE, 0); + PostMessage(g_ctrl->hWnd, TTB_UPDATEFRAMEVISIBILITY, 0, 0); return 0; } @@ -587,7 +587,7 @@ int OnPluginUnload(WPARAM wParam, LPARAM lParam) if (bNeedUpdate) { ArrangeButtons(); if (g_ctrl->hWnd) - PostMessage(g_ctrl->hWnd, TTB_UPDATEFRAMEVISIBILITY, TRUE, 0); + PostMessage(g_ctrl->hWnd, TTB_UPDATEFRAMEVISIBILITY, 0, 0); } } return 0; diff --git a/plugins/TopToolBar/src/toolbarwnd.cpp b/plugins/TopToolBar/src/toolbarwnd.cpp index c4a3dc993f..99793040d4 100644 --- a/plugins/TopToolBar/src/toolbarwnd.cpp +++ b/plugins/TopToolBar/src/toolbarwnd.cpp @@ -124,7 +124,7 @@ LRESULT CALLBACK TopToolBarProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara switch(msg) { case WM_CREATE: g_ctrl->hWnd = hwnd; - PostMessage(hwnd, TTB_UPDATEFRAMEVISIBILITY, 1, 0); + PostMessage(hwnd, TTB_UPDATEFRAMEVISIBILITY, 0, 0); return FALSE; case WM_DESTROY: @@ -154,7 +154,7 @@ LRESULT CALLBACK TopToolBarProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara GetClientRect(g_ctrl->hWnd, &rcClient); if (rcClient.bottom - rcClient.top != iHeight && iHeight) { supressRepos = true; - PostMessage(hwnd, TTB_UPDATEFRAMEVISIBILITY, -1, 0); + PostMessage(hwnd, TTB_UPDATEFRAMEVISIBILITY, 0, 0); } } return 0; @@ -208,12 +208,10 @@ LRESULT CALLBACK TopToolBarProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara case TTB_UPDATEFRAMEVISIBILITY: { - BOOL vis=(BOOL)wParam; - BOOL curvis = IsWindowVisible(hwnd); bool bResize = false; - int Height = ArrangeButtons(); if (g_ctrl->bAutoSize) { + int Height = ArrangeButtons(); INT_PTR frameopt = CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS, MAKEWPARAM(FO_HEIGHT, g_ctrl->hFrame), 0); if (Height != frameopt) { CallService(MS_CLIST_FRAMES_SETFRAMEOPTIONS, MAKEWPARAM(FO_HEIGHT, g_ctrl->hFrame), Height); @@ -224,12 +222,8 @@ LRESULT CALLBACK TopToolBarProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara if (g_ctrl->bOrderChanged) bResize = TRUE, g_ctrl->bOrderChanged = FALSE; - if ((curvis != vis || bResize) && vis != -1) { - INT_PTR frameopt = CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS, MAKEWPARAM(FO_FLAGS, g_ctrl->hFrame), 0); - frameopt &= ~F_VISIBLE; - frameopt |= vis ? F_VISIBLE : 0; - CallService(MS_CLIST_FRAMES_SETFRAMEOPTIONS, MAKEWPARAM(FO_FLAGS, g_ctrl->hFrame), frameopt); - } + if (bResize) + CallService(MS_CLIST_FRAMES_UPDATEFRAME, (WPARAM)g_ctrl->hFrame, FU_FMPOS); } break; @@ -288,8 +282,7 @@ INT_PTR OnEventFire(WPARAM wParam, LPARAM lParam) // if there's no customized frames, create our own if (g_ctrl->hFrame == NULL) { - CLISTFrame Frame = { 0 }; - Frame.cbSize = sizeof(Frame); + CLISTFrame Frame = { sizeof(Frame) }; Frame.tname = _T("Toolbar"); Frame.hWnd = g_ctrl->hWnd; Frame.align = alTop; diff --git a/plugins/TopToolBar/src/ttbopt.cpp b/plugins/TopToolBar/src/ttbopt.cpp index 8ce57aea76..5055ae2639 100644 --- a/plugins/TopToolBar/src/ttbopt.cpp +++ b/plugins/TopToolBar/src/ttbopt.cpp @@ -141,7 +141,7 @@ static void RecreateWindows() } if (g_ctrl->hWnd) - PostMessage(g_ctrl->hWnd, TTB_UPDATEFRAMEVISIBILITY, TRUE, 0); + PostMessage(g_ctrl->hWnd, TTB_UPDATEFRAMEVISIBILITY, 0, 0); } ///////////////////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3