summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2013-01-13 15:24:40 +0000
committerKirill Volinsky <mataes2007@gmail.com>2013-01-13 15:24:40 +0000
commit44d565bb91b211f80c6f21fb92804084af37d4db (patch)
treed10b1024ca960a681691f4d2e2f440f863b9ab36
parent1534bf7c811cc1eee460e0e4d89fa99ee585845a (diff)
added toptoolbar support
fixed autoupdate saving setting cleanup git-svn-id: http://svn.miranda-ng.org/main/trunk@3095 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--plugins/Weather/src/version.h6
-rw-r--r--plugins/Weather/src/weather.cpp21
-rw-r--r--plugins/Weather/src/weather.h26
-rw-r--r--plugins/Weather/src/weather_svcs.cpp6
4 files changed, 32 insertions, 27 deletions
diff --git a/plugins/Weather/src/version.h b/plugins/Weather/src/version.h
index f36385ce1a..8cc0354dce 100644
--- a/plugins/Weather/src/version.h
+++ b/plugins/Weather/src/version.h
@@ -4,14 +4,8 @@
#define __BUILD_NUM 1
#define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM
-#define __FILEVERSION_DOTS __MAJOR_VERSION.__MINOR_VERSION.__RELEASE_NUM.__BUILD_NUM
-
-#define __STRINGIFY_IMPL(x) #x
-#define __STRINGIFY(x) __STRINGIFY_IMPL(x)
-#define __VERSION_STRING __STRINGIFY(__FILEVERSION_DOTS)
#define __PLUGIN_NAME "Weather"
-#define __INTERNAL_NAME "Weather"
#define __FILENAME "Weather.dll"
#define __DESCRIPTION "Retrieves weather information and displays it in your contact list."
#define __AUTHOR "Miranda NG Team"
diff --git a/plugins/Weather/src/weather.cpp b/plugins/Weather/src/weather.cpp
index 4d7abb15f7..d4f1f8547e 100644
--- a/plugins/Weather/src/weather.cpp
+++ b/plugins/Weather/src/weather.cpp
@@ -56,6 +56,8 @@ BOOL ThreadRunning;
// variable to determine if module loaded
BOOL ModuleLoaded;
+HANDLE hTBButton = NULL;
+
// plugin info
static const PLUGININFOEX pluginInfoEx =
{
@@ -69,7 +71,7 @@ static const PLUGININFOEX pluginInfoEx =
__AUTHORWEB,
UNICODE_AWARE,
// {6B612A34-DCF2-4e32-85CF-B6FD006B745E}
- {0x6b612a34, 0xdcf2, 0x4e32, { 0x85, 0xcf, 0xb6, 0xfd, 0x0, 0x6b, 0x74, 0x5e}}
+ {0x6b612a34, 0xdcf2, 0x4e32, {0x85, 0xcf, 0xb6, 0xfd, 0x0, 0x6b, 0x74, 0x5e}}
};
extern "C" __declspec(dllexport) const PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
@@ -102,6 +104,21 @@ int WeatherShutdown(WPARAM wParam,LPARAM lParam)
return 0;
}
+int OnToolbarLoaded(WPARAM wParam, LPARAM lParam)
+{
+ TTBButton tbb = {0};
+ tbb.cbSize = sizeof(TTBButton);
+ tbb.name = LPGEN("Enable/disable auto update");
+ tbb.pszService = MS_WEATHER_ENABLED;
+ tbb.pszTooltipUp = LPGEN("Auto Update Enabled");
+ tbb.pszTooltipDn = LPGEN("Auto Update Disabled");
+ tbb.hIconHandleUp = GetIconHandle("main");
+ tbb.hIconHandleDn = GetIconHandle("disabled");
+ tbb.dwFlags = (db_get_b(NULL, WEATHERPROTONAME, "AutoUpdate", 1) ? 0 : TTBBF_PUSHED) | TTBBF_ASPUSHBUTTON | TTBBF_VISIBLE;
+ hTBButton = TopToolbar_AddButton(&tbb);
+ return 0;
+}
+
// weather protocol initialization function
// run after the event ME_SYSTEM_MODULESLOADED occurs
int WeatherInit(WPARAM wParam,LPARAM lParam)
@@ -121,6 +138,8 @@ int WeatherInit(WPARAM wParam,LPARAM lParam)
// weather user detail
HookEvent(ME_USERINFO_INITIALISE, UserInfoInit);
+ HookEvent(ME_TTB_MODULELOADED, OnToolbarLoaded);
+
hDataWindowList = (HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST,0,0);
hWindowList = (HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST,0,0);
diff --git a/plugins/Weather/src/weather.h b/plugins/Weather/src/weather.h
index e4acc35e04..694a475549 100644
--- a/plugins/Weather/src/weather.h
+++ b/plugins/Weather/src/weather.h
@@ -1,6 +1,6 @@
/*
-Weather Protocol plugin for Miranda IM
-Copyright (c) 2012 Miranda NG Team
+Weather Protocol plugin for Miranda NG
+Copyright (c) 2012-2013 Miranda NG Team
Copyright (c) 2005-2011 Boris Krasnovskiy All Rights Reserved
Copyright (c) 2002-2005 Calvin Che
@@ -26,35 +26,21 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define _CRT_SECURE_NO_WARNINGS
#include <m_stdhdr.h>
-
-#include <stdio.h>
-#include <io.h>
#include <share.h>
-#include <direct.h>
-#include <process.h>
#include <time.h>
-
#include <windows.h>
#include <commctrl.h>
#include <richedit.h>
-#include <win2k.h>
-
-#define MIRANDA_VER 0x0A00
-
#include <newpluginapi.h>
-#include <m_system.h>
#include <m_system_cpp.h>
#include <m_protomod.h>
-#include <m_protosvc.h>
-#include <m_clist.h>
#include <m_icolib.h>
#include <m_options.h>
#include <m_langpack.h>
#include <m_skin.h>
#include <m_database.h>
#include <m_history.h>
-#include <m_utils.h>
#include <m_userinfo.h>
#include <m_netlib.h>
#include <m_ignore.h>
@@ -66,10 +52,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <m_fontservice.h>
#include <m_skin_eng.h>
#include <m_cluiframes.h>
-
#include <m_popup.h>
+#include <win2k.h>
+
+#include <m_weather.h>
+#include <m_toptoolbar.h>
-#include "m_weather.h"
#include "resource.h"
#include "version.h"
@@ -373,7 +361,7 @@ extern HANDLE hHookWeatherUpdated;
extern HANDLE hHookWeatherError;
extern HANDLE hWindowList;
extern HANDLE hMwinMenu;
-
+extern HANDLE hTBButton;
extern UINT_PTR timerId;
// check if weather is currently updating
diff --git a/plugins/Weather/src/weather_svcs.cpp b/plugins/Weather/src/weather_svcs.cpp
index ee0948bf4c..d61bdc2a8b 100644
--- a/plugins/Weather/src/weather_svcs.cpp
+++ b/plugins/Weather/src/weather_svcs.cpp
@@ -225,21 +225,25 @@ void UpdateMenu(BOOL State)
{
// update option setting
opt.CAutoUpdate = State;
- db_set_b(NULL, WEATHERPROTONAME, "AutoUpdate", (BYTE)opt.AutoUpdate);
+ db_set_b(NULL, WEATHERPROTONAME, "AutoUpdate", (BYTE)State);
CLISTMENUITEM mi = { sizeof(mi) };
if (State) { // to enable auto-update
mi.pszName = LPGEN("Auto Update Enabled");
mi.icolibItem = GetIconHandle("main");
+ opt.AutoUpdate = 1;
}
else { // to disable auto-update
mi.pszName = LPGEN("Auto Update Disabled");
mi.icolibItem = GetIconHandle("disabled");
+ opt.AutoUpdate = 0;
}
mi.flags = CMIM_ICON | CMIM_NAME | CMIF_ICONFROMICOLIB;
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hEnableDisableMenu, (LPARAM)&mi);
+ CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hTBButton, !State ? TTBST_PUSHED : TTBST_RELEASED);
+
}
void UpdatePopupMenu(BOOL State)