diff options
author | George Hazan <george.hazan@gmail.com> | 2012-07-07 20:38:34 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-07-07 20:38:34 +0000 |
commit | 37690f6a83f2935292f28cdec8340c206a2f3aac (patch) | |
tree | bbd87013cecd8dc3aa06cf5a7cfe707de657cde7 /plugins | |
parent | 990064649ebc7b3df17b3784b6c38d6a09df39ec (diff) |
fix for top toolbar drawing in Clist Nicer & Clist Modern
git-svn-id: http://svn.miranda-ng.org/main/trunk@838 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/Clist_modern/modern_tbbutton.cpp | 24 | ||||
-rw-r--r-- | plugins/Clist_nicer/SRC/CLCButton.cpp | 20 | ||||
-rw-r--r-- | plugins/ExternalAPI/m_toptoolbar.h | 12 | ||||
-rw-r--r-- | plugins/TopToolBar/InternalButtons.cpp | 6 | ||||
-rw-r--r-- | plugins/TopToolBar/common.h | 2 | ||||
-rw-r--r-- | plugins/TopToolBar/toolbar.cpp | 21 |
6 files changed, 71 insertions, 14 deletions
diff --git a/plugins/Clist_modern/modern_tbbutton.cpp b/plugins/Clist_modern/modern_tbbutton.cpp index 2f38cc25e3..8b4941f69d 100644 --- a/plugins/Clist_modern/modern_tbbutton.cpp +++ b/plugins/Clist_modern/modern_tbbutton.cpp @@ -4,6 +4,7 @@ #include "hdr/modern_clcpaint.h"
#include <m_button_int.h>
+#include <m_toptoolbar.h>
#ifdef __MINGW32__
#include <ctype.h>
@@ -248,11 +249,8 @@ static LRESULT CALLBACK ToolbarButtonProc(HWND hwndDlg, UINT msg, WPARAM wParam case WM_DESTROY:
xpt_FreeThemeForWindow(hwndDlg);
WindowList_Remove(hButtonWindowList, hwndDlg);
- if (lpSBData) {
- if (lpSBData->hIconPrivate)
- DestroyIcon(lpSBData->hIconPrivate);
- free(lpSBData); // lpSBData was malloced by native malloc
- }
+ if (lpSBData->hIconPrivate)
+ DestroyIcon(lpSBData->hIconPrivate);
break; // DONT! fall thru
case WM_SETTEXT:
@@ -519,23 +517,29 @@ static LRESULT CALLBACK ToolbarButtonProc(HWND hwndDlg, UINT msg, WPARAM wParam return 0;
}
-void CustomizeButton(HWND hwnd)
+static void CustomizeButton(HANDLE ttbid, HWND hWnd, LPARAM lParam)
{
MButtonCustomize Custom;
Custom.cbLen = sizeof(TBBUTTONDATA);
Custom.fnPainter = (pfnPainterFunc)PaintWorker;
Custom.fnWindowProc = ToolbarButtonProc;
- SendMessage(hwnd, BUTTONSETCUSTOM, 0, (LPARAM)&Custom);
+ SendMessage(hWnd, BUTTONSETCUSTOM, 0, (LPARAM)&Custom);
- TBBUTTONDATA* p = (TBBUTTONDATA*)GetWindowLongPtr(hwnd, 0);
+ TBBUTTONDATA* p = (TBBUTTONDATA*)GetWindowLongPtr(hWnd, 0);
p->nFontID = -1;
p->hThemeButton = xpt_AddThemeHandle(p->hwnd, L"BUTTON");
p->hThemeToolbar = xpt_AddThemeHandle(p->hwnd, L"TOOLBAR");
- WindowList_Add(hButtonWindowList, hwnd, NULL);
+ WindowList_Add(hButtonWindowList, hWnd, NULL);
}
/////////////////////////////////////////////////////////////////////////////////////////
+int Buttons_ModuleLoaded(WPARAM wParam, LPARAM lParam)
+{
+ TopToolbar_SetCustomProc(CustomizeButton, 0);
+ return 0;
+}
+
int Buttons_OnSkinModeSettingsChanged(WPARAM wParam, LPARAM lParam)
{
WindowList_BroadcastAsync(hButtonWindowList, MBM_UPDATETRANSPARENTFLAG,0,2);
@@ -544,6 +548,8 @@ int Buttons_OnSkinModeSettingsChanged(WPARAM wParam, LPARAM lParam) HRESULT ToolbarButtonLoadModule()
{
+ HookEvent(ME_SYSTEM_MODULESLOADED, Buttons_ModuleLoaded);
+
hButtonWindowList = (HANDLE) CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0);
hIconChangedHook = HookEvent(ME_SKIN2_ICONSCHANGED,OnIconLibIconChanged);
hBkgChangedHook = HookEvent(ME_BACKGROUNDCONFIG_CHANGED,Buttons_OnSkinModeSettingsChanged);
diff --git a/plugins/Clist_nicer/SRC/CLCButton.cpp b/plugins/Clist_nicer/SRC/CLCButton.cpp index f27892f884..134ca1ae71 100644 --- a/plugins/Clist_nicer/SRC/CLCButton.cpp +++ b/plugins/Clist_nicer/SRC/CLCButton.cpp @@ -19,6 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <commonheaders.h>
#include <m_button_int.h>
+#include <m_toptoolbar.h>
extern HINSTANCE g_hInst;
extern LONG g_cxsmIcon, g_cysmIcon;
@@ -393,15 +394,32 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L return 0;
}
-void CustomizeButton(HWND hWnd, bool bIsSkinned, bool bIsThemed, bool bIsFlat)
+static void CustomizeToolbar(HANDLE, HWND hWnd, LPARAM)
{
MButtonCustomize Custom;
Custom.cbLen = sizeof(MButtonExtension);
Custom.fnPainter = (pfnPainterFunc)PaintWorker;
Custom.fnWindowProc = TSButtonWndProc;
SendMessage(hWnd, BUTTONSETCUSTOM, 0, (LPARAM)&Custom);
+}
+
+void CustomizeButton(HWND hWnd, bool bIsSkinned, bool bIsThemed, bool bIsFlat)
+{
+ CustomizeToolbar(0, hWnd, 0);
SendMessage(hWnd, BUTTONSETSKINNED, bIsSkinned, 0);
SendMessage(hWnd, BUTTONSETASTHEMEDBTN, bIsThemed, 0);
SendMessage(hWnd, BUTTONSETASFLATBTN, bIsFlat, 0);
}
+
+static int Nicer_CustomizeToolbar(WPARAM, LPARAM)
+{
+ TopToolbar_SetCustomProc(CustomizeToolbar, 0);
+ return 0;
+}
+
+int LoadButtonModule()
+{
+ HookEvent(ME_SYSTEM_MODULESLOADED, Nicer_CustomizeToolbar);
+ return 0;
+}
diff --git a/plugins/ExternalAPI/m_toptoolbar.h b/plugins/ExternalAPI/m_toptoolbar.h index 576daf944b..bdbe35057f 100644 --- a/plugins/ExternalAPI/m_toptoolbar.h +++ b/plugins/ExternalAPI/m_toptoolbar.h @@ -109,5 +109,17 @@ returns: 1 on success, -1 on failure. */
#define MS_TTB_SETBUTTONOPTIONS "TopToolBar/SetOptions"
+/*
+toptoolbar/setcustomproc service
+wparam = pfnCustomproc
+lparam = procedure parameter
+returns: always returns 0.
+*/
+
+typedef void (__cdecl *pfnCustomProc)(HANDLE hTTButton, HWND hwndBtn, LPARAM userInfo);
+
+__forceinline void TopToolbar_SetCustomProc(pfnCustomProc pFunc, LPARAM lParam)
+{ CallService("TopToolBar/SetCustomProc", (WPARAM)pFunc, lParam);
+}
#endif
\ No newline at end of file diff --git a/plugins/TopToolBar/InternalButtons.cpp b/plugins/TopToolBar/InternalButtons.cpp index 2a79cd566f..4551d55c7d 100644 --- a/plugins/TopToolBar/InternalButtons.cpp +++ b/plugins/TopToolBar/InternalButtons.cpp @@ -1,9 +1,9 @@ #include "common.h"
-#define TTBI_GROUPSHOWHIDE "TTBInternal/GroupShowHide"
-#define TTBI_SOUNDSONOFF "TTBInternal/SoundsOnOFF"
-#define TTBI_MAINMENUBUTT "TTBInternal/MainMenuBUTT"
+#define TTBI_GROUPSHOWHIDE "TTBInternal/GroupShowHide"
+#define TTBI_SOUNDSONOFF "TTBInternal/SoundsOnOFF"
+#define TTBI_MAINMENUBUTT "TTBInternal/MainMenuBUTT"
int LoadInternalButtons( HWND );
int UnLoadInternalButtons();
diff --git a/plugins/TopToolBar/common.h b/plugins/TopToolBar/common.h index 432879c57f..3ce3807d57 100644 --- a/plugins/TopToolBar/common.h +++ b/plugins/TopToolBar/common.h @@ -121,7 +121,7 @@ char *AS(char *str, const char *setting, char *addstr) return str;
}
-#define TTB_LAUNCHSERVICE "TTB/LaunchSerice"
+#define TTB_LAUNCHSERVICE "TTB/LaunchService"
INT_PTR TTBAddButton(WPARAM, LPARAM);
INT_PTR TTBRemoveButton(WPARAM, LPARAM);
diff --git a/plugins/TopToolBar/toolbar.cpp b/plugins/TopToolBar/toolbar.cpp index f2e9932738..7dc3535efb 100644 --- a/plugins/TopToolBar/toolbar.cpp +++ b/plugins/TopToolBar/toolbar.cpp @@ -1,6 +1,9 @@ #include "common.h"
+pfnCustomProc g_CustomProc = NULL;
+LPARAM g_CustomProcParam = 0;
+
HWND hwndContactList = 0;
HWND hwndTopToolBar = 0;
bool StopArrange;
@@ -756,6 +759,16 @@ static INT_PTR OnEventFire(WPARAM wParam, LPARAM lParam) CallService(MS_SYSTEM_REMOVEWAIT, wParam, 0);
StopArrange = FALSE;
NotifyEventHooks(hHookTTBModuleLoaded, 0, 0);
+
+ if (g_CustomProc) {
+ mir_cslock lck(csButtonsHook);
+
+ for (int i=0; i < Buttons.getCount(); i++) {
+ TopButtonInt* p = Buttons[i];
+ g_CustomProc((HANDLE)p->id, p->hwnd, g_CustomProcParam);
+ }
+ }
+
return 0;
}
@@ -772,6 +785,13 @@ static int OnBGChange(WPARAM wParam, LPARAM lParam) return 0;
}
+static INT_PTR TTBSetCustomProc(WPARAM wParam, LPARAM lParam)
+{
+ g_CustomProc = (pfnCustomProc)wParam;
+ g_CustomProcParam = lParam;
+ return 0;
+}
+
/////////////////////////////////////////////////////////////////////////////////////////
int OnModulesLoad(WPARAM wParam, LPARAM lParam)
@@ -829,6 +849,7 @@ int LoadToolbarModule() CreateServiceFunction(TTB_LAUNCHSERVICE, LaunchService);
+ CreateServiceFunction("TopToolBar/SetCustomProc", TTBSetCustomProc);
CreateServiceFunction("TTB_ONSTARTUPFIRE", OnEventFire);
BUTTHEIGHT = DBGetContactSettingByte(0, TTB_OPTDIR, "BUTTHEIGHT", DEFBUTTHEIGHT);
|