summaryrefslogtreecommitdiff
path: root/plugins/Clist_modern/src/modern_toolbar.cpp
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/modern_toolbar.cpp
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/modern_toolbar.cpp')
-rw-r--r--plugins/Clist_modern/src/modern_toolbar.cpp30
1 files changed, 22 insertions, 8 deletions
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;
}