summaryrefslogtreecommitdiff
path: root/plugins/Popup/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-07-08 20:51:14 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-07-08 20:51:14 +0000
commit696f4ea57845f48d6d979ecd9d66bb22bd9f738d (patch)
treec32ac05d363bff47320c1b204561b966aa1c81fd /plugins/Popup/src
parent3b396a2da6b0b8e0f4d2c051aca133772d317820 (diff)
TopToolbar usage fixed everywhere
git-svn-id: http://svn.miranda-ng.org/main/trunk@861 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Popup/src')
-rw-r--r--plugins/Popup/src/headers.h1
-rw-r--r--plugins/Popup/src/main.cpp67
2 files changed, 15 insertions, 53 deletions
diff --git a/plugins/Popup/src/headers.h b/plugins/Popup/src/headers.h
index e0c8f65d7f..032b050899 100644
--- a/plugins/Popup/src/headers.h
+++ b/plugins/Popup/src/headers.h
@@ -130,7 +130,6 @@ Last change by : $Author: Merlin_de $
#define MTEXT_NOHELPERS
#endif // MTEXT_NOHELPERS
#include <m_text.h>
- #include <m_toolbar.h>
#include <m_toptoolbar.h>
#include <m_updater.h>
#include <m_popup.h> //core define see miranda\include\
diff --git a/plugins/Popup/src/main.cpp b/plugins/Popup/src/main.cpp
index 0e7218ed4e..b44725c0bc 100644
--- a/plugins/Popup/src/main.cpp
+++ b/plugins/Popup/src/main.cpp
@@ -80,15 +80,11 @@ HANDLE hGetStatus = NULL;
//===== Event Handles =====
HANDLE hOptionsInitialize;
-//HANDLE hNotifyOptionsInitialize; deprecatet
HANDLE hModulesLoaded;
-HANDLE hTTBLoaded;
-HANDLE hTBLoaded;
HANDLE hOkToExit;
HANDLE hIconsChanged, hFontsChanged;
HANDLE hEventStatusChanged; //To automatically disable on status change.
-int hTTButton = -1;
-HANDLE hTButton = NULL;
+HANDLE hTTButton = NULL;
GLOBAL g_popup = {0};
@@ -207,47 +203,21 @@ static int IconsChanged(WPARAM wParam,LPARAM lParam)
static int TTBLoaded(WPARAM wParam,LPARAM lParam)
{
- if (hTTButton == -1) {
- TTBButton btn = {0};
- btn.cbSize = sizeof(btn);
- btn.pszService = MENUCOMMAND_SVC;
- btn.lParamUp = 1;
- btn.lParamDown = 0;
- btn.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP;
- btn.name = "Toggle Popups";
- btn.hIconUp = IcoLib_GetIcon(ICO_POPUP_OFF,0);
- btn.hIconDn = IcoLib_GetIcon(ICO_POPUP_ON,0);
- hTTButton = CallService(MS_TTB_ADDBUTTON, (WPARAM)&btn, 0);
+ if ( !hTTButton) {
+ TTBButton btn = {0};
+ btn.cbSize = sizeof(btn);
+ btn.pszService = MENUCOMMAND_SVC;
+ btn.lParamUp = 1;
+ btn.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP | TTBBF_ICONBYHANDLE;
+ btn.name = LPGEN("Toggle Popups");
+ btn.hIconHandleUp = Skin_GetIconHandle(ICO_TB_POPUP_OFF);
+ btn.hIconHandleDn = Skin_GetIconHandle(ICO_TB_POPUP_ON);
+ btn.pszTooltipUp = LPGEN("Enable popups");
+ btn.pszTooltipDn = LPGEN("Disable popups");
+ hTTButton = TopToolbar_AddButton(&btn);
}
- if (PopUpOptions.ModuleIsEnabled) {
- CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hTTButton, TTBST_RELEASED);
- CallService(MS_TTB_SETBUTTONOPTIONS, MAKEWPARAM(TTBO_TIPNAME,hTTButton), (LPARAM)LPGEN("Disable popups"));
- }
- else {
- CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hTTButton, TTBST_PUSHED);
- CallService(MS_TTB_SETBUTTONOPTIONS, MAKEWPARAM(TTBO_TIPNAME,hTTButton), (LPARAM)LPGEN("Enable popups"));
- }
- return 0;
-}
-
-//register Modern Toolbarbutton
-static int ToolbarSet(WPARAM, LPARAM){
- if (hTButton == NULL){
- TBButton tbb = {0};
- tbb.cbSize = sizeof(TBButton);
- tbb.pszButtonID = "PopupToogle";
- tbb.pszButtonName = Translate("Toggle Popups");
- tbb.pszServiceName = MENUCOMMAND_SVC;
- tbb.pszTooltipUp = Translate("Popups are disabled");
- tbb.pszTooltipDn = Translate("Popups are enabled");
- tbb.hPrimaryIconHandle = (HANDLE)CallService(MS_SKIN2_GETICONHANDLE, 0, (LPARAM)ICO_TB_POPUP_OFF);
- tbb.hSecondaryIconHandle = (HANDLE)CallService(MS_SKIN2_GETICONHANDLE, 0, (LPARAM)ICO_TB_POPUP_ON);
- tbb.tbbFlags = TBBF_VISIBLE;
- tbb.defPos = 10000;
- hTButton = (HANDLE)CallService(MS_TB_ADDBUTTON,0, (LPARAM)&tbb);
- }
- CallService(MS_TB_SETBUTTONSTATEBYID, (WPARAM)"PopupToogle", PopUpOptions.ModuleIsEnabled?TBST_PUSHED:TBST_RELEASED);
+ CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hTTButton, (PopUpOptions.ModuleIsEnabled) ? TTBST_RELEASED : TTBST_PUSHED);
return 0;
}
@@ -280,7 +250,6 @@ INT_PTR svcEnableDisableMenuCommand(WPARAM wp, LPARAM lp)
mi.flags = CMIM_ICON;
iResultRoot = CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)hMenuRoot,(LPARAM)&mi);
TTBLoaded(0,0);
- ToolbarSet(0,0);
if(iResult && iResultRoot)
return 1;
else
@@ -420,7 +389,7 @@ static int ModulesLoaded(WPARAM wParam,LPARAM lParam)
LoadActions();
LoadNotifications();
//hook TopToolBar
- hTTBLoaded = HookEvent(ME_TTB_MODULELOADED, TTBLoaded);
+ HookEvent(ME_TTB_MODULELOADED, TTBLoaded);
//Folder plugin support
LPTSTR pszPath = mir_a2t(MIRANDA_PATH "\\Skins\\PopUp");
folderId = FoldersRegisterCustomPathT(MODULNAME_LONG, "Skins", pszPath);
@@ -439,11 +408,6 @@ static int ModulesLoaded(WPARAM wParam,LPARAM lParam)
SrmmMenu_Load();
//Hotkey
LoadHotkey();
- //Modern Toolbar support
- if(ServiceExists(MS_TB_ADDBUTTON)) {
- hTBLoaded = HookEvent(ME_TB_MODULELOADED, ToolbarSet);
- ToolbarSet(0,0);
- }
//Updater support
if(ServiceExists(MS_UPDATE_REGISTER)) registerUpdate();
@@ -589,7 +553,6 @@ MIRAPI int Unload(void)
UnhookEvent(hEventStatusChanged);
UnhookEvent(hIconsChanged);
UnhookEvent(hFontsChanged);
- UnhookEvent(hTBLoaded);
DestroyServiceFunction(hShowHistory);
DestroyServiceFunction(hTogglePopup);