summaryrefslogtreecommitdiff
path: root/plugins/Clist_modern/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-03-10 11:51:00 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-03-10 11:51:00 +0000
commit03758f8f918f392386a1dd7a1c7a795927f8c221 (patch)
treedc4dede8653397df0275f49e730b0d44605d7a7c /plugins/Clist_modern/src
parent1416051048756ab769de52ab5eb67a31e41524fd (diff)
- ME_TTB_INITBUTTONS event considered useless;
- clist_modern & clist_nicer are trained to reload TTB buttons when TopToolBar plugin is loaded dynamically; - TTB processing code slightly reordered git-svn-id: http://svn.miranda-ng.org/main/trunk@3953 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Clist_modern/src')
-rw-r--r--plugins/Clist_modern/src/hdr/modern_commonheaders.h10
-rw-r--r--plugins/Clist_modern/src/hdr/modern_commonprototypes.h1
-rw-r--r--plugins/Clist_modern/src/modern_tbbutton.cpp14
-rw-r--r--plugins/Clist_modern/src/modern_toolbar.cpp30
-rw-r--r--plugins/Clist_modern/src/modern_viewmodebar.cpp3
5 files changed, 31 insertions, 27 deletions
diff --git a/plugins/Clist_modern/src/hdr/modern_commonheaders.h b/plugins/Clist_modern/src/hdr/modern_commonheaders.h
index a3338e4641..b8088cc8ff 100644
--- a/plugins/Clist_modern/src/hdr/modern_commonheaders.h
+++ b/plugins/Clist_modern/src/hdr/modern_commonheaders.h
@@ -174,13 +174,13 @@ DWORD exceptFunction(LPEXCEPTION_POINTERS EP);
// lParam = 0
#define ME_BACKGROUNDCONFIG_CHANGED "ModernBkgrCfg/Changed"
-
-
HBITMAP ske_CreateDIB32(int cx, int cy);
-extern void InitDisplayNameCache(void);
-extern void FreeDisplayNameCache();
-extern int CLUI_ShowWindowMod(HWND hwnd, int cmd);
+void InitDisplayNameCache(void);
+void FreeDisplayNameCache();
+int CLUI_ShowWindowMod(HWND hwnd, int cmd);
+
+void MakeButtonSkinned(HWND hWnd);
#ifdef UNICODE
#define GSMDF_TCHAR_MY GSMDF_TCHAR|CNF_UNICODE
diff --git a/plugins/Clist_modern/src/hdr/modern_commonprototypes.h b/plugins/Clist_modern/src/hdr/modern_commonprototypes.h
index 847aefa464..efbb035932 100644
--- a/plugins/Clist_modern/src/hdr/modern_commonprototypes.h
+++ b/plugins/Clist_modern/src/hdr/modern_commonprototypes.h
@@ -272,7 +272,6 @@ HRESULT PreLoadContactListModule();
HRESULT ClcLoadModule();
HRESULT ToolbarLoadModule();
HRESULT ToolbarButtonLoadModule();
-void CustomizeButton(HWND);
// INTERFACES
diff --git a/plugins/Clist_modern/src/modern_tbbutton.cpp b/plugins/Clist_modern/src/modern_tbbutton.cpp
index 9a797411ec..d8f697ee3a 100644
--- a/plugins/Clist_modern/src/modern_tbbutton.cpp
+++ b/plugins/Clist_modern/src/modern_tbbutton.cpp
@@ -463,7 +463,9 @@ void MakeButtonSkinned(HWND hWnd)
WindowList_Add(hButtonWindowList, hWnd, NULL);
}
-static void CustomizeButton(HANDLE ttbid, HWND hWnd, LPARAM lParam)
+/////////////////////////////////////////////////////////////////////////////////////////
+
+void CustomizeButton(HANDLE ttbid, HWND hWnd, LPARAM lParam)
{
if (ttbid == TTB_WINDOW_HANDLE) {
CustomizeToolbar(hWnd);
@@ -473,19 +475,13 @@ static void CustomizeButton(HANDLE ttbid, HWND hWnd, LPARAM lParam)
MakeButtonSkinned(hWnd);
TBBUTTONDATA* p = (TBBUTTONDATA*)GetWindowLongPtr(hWnd, 0);
- p->szButtonID, "Toolbar.MissingID";
+ p->szButtonID = "Toolbar.MissingID";
p->ttbID = ttbid;
SendMessage(hWnd, MBM_UPDATETRANSPARENTFLAG, 0, 2);
}
/////////////////////////////////////////////////////////////////////////////////////////
-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);
@@ -494,8 +490,6 @@ 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_modern/src/modern_toolbar.cpp b/plugins/Clist_modern/src/modern_toolbar.cpp
index 486cfe8a78..6d654d889c 100644
--- a/plugins/Clist_modern/src/modern_toolbar.cpp
+++ b/plugins/Clist_modern/src/modern_toolbar.cpp
@@ -55,7 +55,7 @@ static void SetButtonPressed(int i, int state)
CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)BTNS[i].hButton, state ? TTBST_PUSHED : TTBST_RELEASED);
}
-static int Modern_InitButtons(WPARAM, LPARAM)
+void Modern_InitButtons()
{
for (int i=0; i < SIZEOF(BTNS); i++) {
TTBButton tbb = { 0 };
@@ -91,7 +91,6 @@ static int Modern_InitButtons(WPARAM, LPARAM)
SetButtonPressed(3, db_get_b(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT));
SetButtonPressed(6, db_get_b(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT));
SetButtonPressed(7, db_get_b(NULL, "Skin", "UseSound", SETTING_ENABLESOUNDS_DEFAULT));
- return 1;
}
///////////////////////////////////////////////////////////////////////////////
@@ -304,15 +303,13 @@ void CustomizeToolbar(HWND hwnd)
pMTBInfo->mtbXPTheme = xpt_AddThemeHandle(hwnd, L"TOOLBAR");
pMTBInfo->bHardUpdate = TRUE;
+
+ Modern_InitButtons();
}
#define TTB_OPTDIR "TopToolBar"
-#if defined(WIN64)
- static char szUrl[] = "http://miranda-ng.org/x64/Plugins/toptoolbar.zip";
-#else
- static char szUrl[] = "http://miranda-ng.org/x32/Plugins/toptoolbar.zip";
-#endif
+static char szUrl[] = "http://wiki.miranda-ng.org/index.php?title=Plugin:TopToolBar";
static TCHAR szWarning[] = LPGENT("To view a toolbar in Clist Modern you need the TopToolBar plugin. Click Yes to download it or Cancel to continue");
@@ -321,12 +318,27 @@ static void CopySettings(const char* to, const char* from, int defValue)
db_set_b(NULL, TTB_OPTDIR, to, db_get_b(NULL,"ModernToolBar",from, defValue));
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
+void CustomizeButton(HANDLE ttbid, HWND hWnd, LPARAM lParam);
+
+static int Toolbar_ModuleReloaded(WPARAM wParam, LPARAM lParam)
+{
+ PLUGININFOEX *pInfo = (PLUGININFOEX*)wParam;
+ if ( !_stricmp(pInfo->shortName, "TopToolBar"))
+ TopToolbar_SetCustomProc(CustomizeButton, 0);
+
+ return 0;
+}
+
static int Toolbar_ModulesLoaded(WPARAM, LPARAM)
{
CallService(MS_BACKGROUNDCONFIG_REGISTER, (WPARAM)"ToolBar Background/ToolBar",0);
+
HookEvent(ME_DB_CONTACT_SETTINGCHANGED, ehhToolBarSettingsChanged);
HookEvent(ME_BACKGROUNDCONFIG_CHANGED, ehhToolBarBackgroundSettingsChanged);
- HookEvent(ME_TTB_INITBUTTONS, Modern_InitButtons);
+
+ TopToolbar_SetCustomProc(CustomizeButton, 0);
BYTE bOldSetting = 0;
if ( !db_get_b(NULL, "Compatibility", "TTB_Upgrade", 0)) {
@@ -356,6 +368,8 @@ static int Toolbar_ModulesLoaded(WPARAM, LPARAM)
HRESULT ToolbarLoadModule()
{
ehhToolBarBackgroundSettingsChanged(0, 0);
+
+ HookEvent(ME_SYSTEM_MODULELOAD, Toolbar_ModuleReloaded);
HookEvent(ME_SYSTEM_MODULESLOADED, Toolbar_ModulesLoaded);
return S_OK;
}
diff --git a/plugins/Clist_modern/src/modern_viewmodebar.cpp b/plugins/Clist_modern/src/modern_viewmodebar.cpp
index 6f23c660bb..da5f2f3296 100644
--- a/plugins/Clist_modern/src/modern_viewmodebar.cpp
+++ b/plugins/Clist_modern/src/modern_viewmodebar.cpp
@@ -26,14 +26,11 @@ $Id: viewmodes.c 2998 2006-06-01 07:11:52Z nightwish2004 $
*/
#include "hdr/modern_commonheaders.h"
-#include "m_variables.h"
#include "hdr/modern_cluiframes.h"
#include "m_api/m_skinbutton.h"
#define TIMERID_VIEWMODEEXPIRE 100
-void MakeButtonSkinned(HWND hWnd);
-
typedef int (__cdecl *pfnEnumCallback)(char *szName);
static HWND clvmHwnd = 0;
static int clvm_curItem = 0;