diff options
author | George Hazan <george.hazan@gmail.com> | 2013-02-05 14:49:25 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-02-05 14:49:25 +0000 |
commit | 0233716a1aeab439b0195408a76285fd2ecbbe93 (patch) | |
tree | dc2fa3b38320ea8398272cf4dd7b9207b381596b /plugins/MyDetails/src/mydetails.cpp | |
parent | f0b70db9efcaf1b5d5e8c7723fa0be118ebc1f5e (diff) |
slightly optimized color creation
git-svn-id: http://svn.miranda-ng.org/main/trunk@3439 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MyDetails/src/mydetails.cpp')
-rw-r--r-- | plugins/MyDetails/src/mydetails.cpp | 282 |
1 files changed, 128 insertions, 154 deletions
diff --git a/plugins/MyDetails/src/mydetails.cpp b/plugins/MyDetails/src/mydetails.cpp index ddd65b54ad..3956494c9c 100644 --- a/plugins/MyDetails/src/mydetails.cpp +++ b/plugins/MyDetails/src/mydetails.cpp @@ -17,14 +17,14 @@ not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-
#include "commons.h"
-// Prototypes /////////////////////////////////////////////////////////////////////////////////////
-
HINSTANCE hInst;
int hLangpack = 0;
+
+// Prototypes ///////////////////////////////////////////////////////////////////////////
+
PLUGININFOEX pluginInfo={
sizeof(PLUGININFOEX),
"My Details",
@@ -35,7 +35,8 @@ PLUGININFOEX pluginInfo={ "© 2005-2008 Ricardo Pescuma Domenecci, Drugwash",
"http://miranda-ng.org/",
UNICODE_AWARE,
- { 0xa82baeb3, 0xa33c, 0x4036, { 0xb8, 0x37, 0x78, 0x3, 0xa5, 0xb6, 0xc2, 0xab } } // {A82BAEB3-A33C-4036-B837-7803A5B6C2AB}
+ // {A82BAEB3-A33C-4036-B837-7803A5B6C2AB}
+ { 0xa82baeb3, 0xa33c, 0x4036, { 0xb8, 0x37, 0x78, 0x3, 0xa5, 0xb6, 0xc2, 0xab } }
};
static IconItem iconList[] =
@@ -55,24 +56,8 @@ HWND hwndSetNickname; long status_msg_dialog_open;
HWND hwndSetStatusMsg;
-// Hook called after init
-static int MainInit(WPARAM wparam,LPARAM lparam);
-static int MainUninit(WPARAM wParam, LPARAM lParam);
-
-// Services
-static INT_PTR PluginCommand_SetMyNicknameUI(WPARAM wParam,LPARAM lParam);
-static INT_PTR PluginCommand_SetMyNickname(WPARAM wParam,LPARAM lParam);
-static INT_PTR PluginCommand_GetMyNickname(WPARAM wParam,LPARAM lParam);
-static INT_PTR PluginCommand_SetMyAvatarUI(WPARAM wParam,LPARAM lParam);
-static INT_PTR PluginCommand_SetMyAvatar(WPARAM wParam,LPARAM lParam);
-static INT_PTR PluginCommand_GetMyAvatar(WPARAM wParam,LPARAM lParam);
-static INT_PTR PluginCommand_SetMyStatusMessageUI(WPARAM wParam,LPARAM lParam);
-static INT_PTR PluginCommand_CycleThroughtProtocols(WPARAM wParam,LPARAM lParam);
-
-
// Functions //////////////////////////////////////////////////////////////////////////////////////
-
BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved)
{
hInst = hinstDLL;
@@ -86,139 +71,6 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda extern "C" __declspec(dllexport) const MUUID interfaces[] = { MIID_MDETAILS, MIID_LAST };
-extern "C" __declspec(dllexport) int Load()
-{
- mir_getLP(&pluginInfo);
-
- // Hook event to load messages and show first one
- HookEvent(ME_SYSTEM_MODULESLOADED, MainInit);
- HookEvent(ME_SYSTEM_PRESHUTDOWN, MainUninit);
-
- nickname_dialog_open = 0;
- status_msg_dialog_open = 0;
-
- // Options
- InitOptions();
-
- // Register services
- CreateServiceFunction(MS_MYDETAILS_SETMYNICKNAME, PluginCommand_SetMyNickname);
- CreateServiceFunction(MS_MYDETAILS_SETMYNICKNAMEUI, PluginCommand_SetMyNicknameUI);
- CreateServiceFunction(MS_MYDETAILS_SETMYAVATAR, PluginCommand_SetMyAvatar);
- CreateServiceFunction(MS_MYDETAILS_SETMYAVATARUI, PluginCommand_SetMyAvatarUI);
- CreateServiceFunction(MS_MYDETAILS_GETMYNICKNAME, PluginCommand_GetMyNickname);
- CreateServiceFunction(MS_MYDETAILS_GETMYAVATAR, PluginCommand_GetMyAvatar);
- CreateServiceFunction(MS_MYDETAILS_SETMYSTATUSMESSAGEUI, PluginCommand_SetMyStatusMessageUI);
- CreateServiceFunction(MS_MYDETAILS_SHOWNEXTPROTOCOL, PluginCommand_ShowNextProtocol);
- CreateServiceFunction(MS_MYDETAILS_SHOWPREVIOUSPROTOCOL, PluginCommand_ShowPreviousProtocol);
- CreateServiceFunction(MS_MYDETAILS_SHOWPROTOCOL, PluginCommand_ShowProtocol);
- CreateServiceFunction(MS_MYDETAILS_CYCLE_THROUGH_PROTOCOLS, PluginCommand_CycleThroughtProtocols);
-
- return 0;
-}
-
-extern "C" __declspec(dllexport) int Unload(void)
-{
- DestroyServiceFunction(MS_MYDETAILS_SETMYNICKNAME);
- DestroyServiceFunction(MS_MYDETAILS_SETMYNICKNAMEUI);
- DestroyServiceFunction(MS_MYDETAILS_SETMYAVATAR);
- DestroyServiceFunction(MS_MYDETAILS_SETMYAVATARUI);
- DestroyServiceFunction(MS_MYDETAILS_GETMYNICKNAME);
- DestroyServiceFunction(MS_MYDETAILS_GETMYAVATAR);
- DestroyServiceFunction(MS_MYDETAILS_SETMYSTATUSMESSAGEUI);
- DestroyServiceFunction(MS_MYDETAILS_SHOWNEXTPROTOCOL);
- DestroyServiceFunction(MS_MYDETAILS_SHOWPREVIOUSPROTOCOL);
- DestroyServiceFunction(MS_MYDETAILS_SHOWPROTOCOL);
- DestroyServiceFunction(MS_MYDETAILS_CYCLE_THROUGH_PROTOCOLS);
-
- DeInitProtocolData();
- return 0;
-}
-
-
-static INT_PTR Menu_SetMyAvatarUI(WPARAM wParam,LPARAM lParam)
-{
- return PluginCommand_SetMyAvatarUI(0, 0);
-}
-
-static INT_PTR Menu_SetMyNicknameUI(WPARAM wParam,LPARAM lParam)
-{
- return PluginCommand_SetMyNicknameUI(0, 0);
-}
-
-static INT_PTR Menu_SetMyStatusMessageUI(WPARAM wParam,LPARAM lParam)
-{
- return PluginCommand_SetMyStatusMessageUI(0, 0);
-}
-
-
-// Hook called after init
-static int MainInit(WPARAM wparam,LPARAM lparam)
-{
- InitProtocolData();
-
- // Add options to menu
- // !!!!!!!! check it later
- CLISTMENUITEM mi = { sizeof(mi) };
-
- if (protocols->CanSetAvatars()) {
- mi.flags = CMIF_TCHAR;
- mi.popupPosition = 500050000;
- mi.ptszPopupName = LPGENT("My Details");
- mi.position = 100001;
- mi.ptszName = LPGENT("Set My Avatar...");
- CreateServiceFunction("MENU_" MS_MYDETAILS_SETMYAVATARUI, Menu_SetMyAvatarUI);
- mi.pszService = "MENU_" MS_MYDETAILS_SETMYAVATARUI;
- Menu_AddMainMenuItem(&mi);
- }
-
- ZeroMemory(&mi,sizeof(mi));
- mi.cbSize = sizeof(mi);
- mi.flags = CMIF_TCHAR;
- mi.popupPosition = 500050000;
- mi.ptszPopupName = LPGENT("My Details");
- mi.position = 100002;
- mi.ptszName = LPGENT("Set My Nickname...");
- CreateServiceFunction("MENU_" MS_MYDETAILS_SETMYNICKNAMEUI, Menu_SetMyNicknameUI);
- mi.pszService = "MENU_" MS_MYDETAILS_SETMYNICKNAMEUI;
- Menu_AddMainMenuItem(&mi);
-
- ZeroMemory(&mi,sizeof(mi));
- mi.cbSize = sizeof(mi);
- mi.flags = CMIF_TCHAR;
- mi.popupPosition = 500050000;
- mi.ptszPopupName = LPGENT("My Details");
- mi.position = 100003;
- mi.ptszName = LPGENT("Set My Status Message...");
- CreateServiceFunction("MENU_" MS_MYDETAILS_SETMYSTATUSMESSAGEUI, Menu_SetMyStatusMessageUI);
- mi.pszService = "MENU_" MS_MYDETAILS_SETMYSTATUSMESSAGEUI;
- Menu_AddMainMenuItem(&mi);
-
- // Set protocols to show frame
- ZeroMemory(&mi,sizeof(mi));
- mi.cbSize = sizeof(mi);
- mi.flags = CMIF_TCHAR;
- mi.popupPosition = 500050000;
- mi.ptszPopupName = LPGENT("My Details");
- mi.position = 200001;
- mi.ptszName = LPGENT("Show next protocol");
- mi.pszService = MS_MYDETAILS_SHOWNEXTPROTOCOL;
- Menu_AddMainMenuItem(&mi);
-
- InitFrames();
-
- if ( Skin_GetIcon("LISTENING_TO_ICON") == NULL)
- Icon_Register(hInst, LPGEN("Contact List"), iconList, 1);
-
- Icon_Register(hInst, LPGEN("My Details"), iconList+1, SIZEOF(iconList)-1);
- return 0;
-}
-
-static int MainUninit(WPARAM wParam, LPARAM lParam)
-{
- DeInitFrames();
- return 0;
-}
-
// Set nickname ///////////////////////////////////////////////////////////////////////////////////
#define WMU_SETDATA (WM_USER+1)
@@ -712,4 +564,126 @@ static INT_PTR PluginCommand_CycleThroughtProtocols(WPARAM wParam,LPARAM lParam) LoadOptions();
return 0;
-}
\ No newline at end of file +}
+
+// Services ///////////////////////////////////////////////////////////////////////////////////////
+
+static INT_PTR Menu_SetMyAvatarUI(WPARAM wParam,LPARAM lParam)
+{
+ return PluginCommand_SetMyAvatarUI(0, 0);
+}
+
+static INT_PTR Menu_SetMyNicknameUI(WPARAM wParam,LPARAM lParam)
+{
+ return PluginCommand_SetMyNicknameUI(0, 0);
+}
+
+static INT_PTR Menu_SetMyStatusMessageUI(WPARAM wParam,LPARAM lParam)
+{
+ return PluginCommand_SetMyStatusMessageUI(0, 0);
+}
+
+// Hook called after init
+static int MainInit(WPARAM wparam,LPARAM lparam)
+{
+ InitProtocolData();
+
+ // Add options to menu
+ CLISTMENUITEM mi = { sizeof(mi) };
+ mi.cbSize = sizeof(mi);
+ mi.popupPosition = 500050000;
+
+ if (protocols->CanSetAvatars()) {
+ mi.pszPopupName = LPGEN("My Details");
+ mi.position = 100001;
+ mi.pszName = LPGEN("Set My Avatar...");
+ CreateServiceFunction("MENU_" MS_MYDETAILS_SETMYAVATARUI, Menu_SetMyAvatarUI);
+ mi.pszService = "MENU_" MS_MYDETAILS_SETMYAVATARUI;
+ Menu_AddMainMenuItem(&mi);
+ }
+
+ mi.pszPopupName = LPGEN("My Details");
+ mi.position = 100002;
+ mi.pszName = LPGEN("Set My Nickname...");
+ CreateServiceFunction("MENU_" MS_MYDETAILS_SETMYNICKNAMEUI, Menu_SetMyNicknameUI);
+ mi.pszService = "MENU_" MS_MYDETAILS_SETMYNICKNAMEUI;
+ Menu_AddMainMenuItem(&mi);
+
+ mi.position = 100003;
+ mi.pszName = LPGEN("Set My Status Message...");
+ CreateServiceFunction("MENU_" MS_MYDETAILS_SETMYSTATUSMESSAGEUI, Menu_SetMyStatusMessageUI);
+ mi.pszService = "MENU_" MS_MYDETAILS_SETMYSTATUSMESSAGEUI;
+ Menu_AddMainMenuItem(&mi);
+
+ // Set protocols to show frame
+ mi.position = 200001;
+ mi.pszName = LPGEN("Show next protocol");
+ mi.pszService = MS_MYDETAILS_SHOWNEXTPROTOCOL;
+ Menu_AddMainMenuItem(&mi);
+
+ InitFrames();
+
+ if ( Skin_GetIcon("LISTENING_TO_ICON") == NULL)
+ Icon_Register(hInst, LPGEN("Contact List"), iconList, 1);
+
+ Icon_Register(hInst, LPGEN("My Details"), iconList+1, SIZEOF(iconList)-1);
+ return 0;
+}
+
+static int MainUninit(WPARAM wParam, LPARAM lParam)
+{
+ DeInitFrames();
+ return 0;
+}
+
+// Load ///////////////////////////////////////////////////////////////////////////////////////////
+
+extern "C" __declspec(dllexport) int Load()
+{
+ mir_getLP(&pluginInfo);
+
+ // Hook event to load messages and show first one
+ HookEvent(ME_SYSTEM_MODULESLOADED, MainInit);
+ HookEvent(ME_SYSTEM_PRESHUTDOWN, MainUninit);
+
+ nickname_dialog_open = 0;
+ status_msg_dialog_open = 0;
+
+ // Options
+ InitOptions();
+
+ // Register services
+ CreateServiceFunction(MS_MYDETAILS_SETMYNICKNAME, PluginCommand_SetMyNickname);
+ CreateServiceFunction(MS_MYDETAILS_SETMYNICKNAMEUI, PluginCommand_SetMyNicknameUI);
+ CreateServiceFunction(MS_MYDETAILS_SETMYAVATAR, PluginCommand_SetMyAvatar);
+ CreateServiceFunction(MS_MYDETAILS_SETMYAVATARUI, PluginCommand_SetMyAvatarUI);
+ CreateServiceFunction(MS_MYDETAILS_GETMYNICKNAME, PluginCommand_GetMyNickname);
+ CreateServiceFunction(MS_MYDETAILS_GETMYAVATAR, PluginCommand_GetMyAvatar);
+ CreateServiceFunction(MS_MYDETAILS_SETMYSTATUSMESSAGEUI, PluginCommand_SetMyStatusMessageUI);
+ CreateServiceFunction(MS_MYDETAILS_SHOWNEXTPROTOCOL, PluginCommand_ShowNextProtocol);
+ CreateServiceFunction(MS_MYDETAILS_SHOWPREVIOUSPROTOCOL, PluginCommand_ShowPreviousProtocol);
+ CreateServiceFunction(MS_MYDETAILS_SHOWPROTOCOL, PluginCommand_ShowProtocol);
+ CreateServiceFunction(MS_MYDETAILS_CYCLE_THROUGH_PROTOCOLS, PluginCommand_CycleThroughtProtocols);
+
+ return 0;
+}
+
+// Unload /////////////////////////////////////////////////////////////////////////////////////////
+
+extern "C" __declspec(dllexport) int Unload(void)
+{
+ DestroyServiceFunction(MS_MYDETAILS_SETMYNICKNAME);
+ DestroyServiceFunction(MS_MYDETAILS_SETMYNICKNAMEUI);
+ DestroyServiceFunction(MS_MYDETAILS_SETMYAVATAR);
+ DestroyServiceFunction(MS_MYDETAILS_SETMYAVATARUI);
+ DestroyServiceFunction(MS_MYDETAILS_GETMYNICKNAME);
+ DestroyServiceFunction(MS_MYDETAILS_GETMYAVATAR);
+ DestroyServiceFunction(MS_MYDETAILS_SETMYSTATUSMESSAGEUI);
+ DestroyServiceFunction(MS_MYDETAILS_SHOWNEXTPROTOCOL);
+ DestroyServiceFunction(MS_MYDETAILS_SHOWPREVIOUSPROTOCOL);
+ DestroyServiceFunction(MS_MYDETAILS_SHOWPROTOCOL);
+ DestroyServiceFunction(MS_MYDETAILS_CYCLE_THROUGH_PROTOCOLS);
+
+ DeInitProtocolData();
+ return 0;
+}
|