diff options
author | George Hazan <george.hazan@gmail.com> | 2012-12-01 20:32:13 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-12-01 20:32:13 +0000 |
commit | 1860018b201d995ed051c0affb72d5a1d09fa02e (patch) | |
tree | 1ee096c43578fdf5694e5487d672830f810f186c /plugins/SmileyAdd/src/main.cpp | |
parent | 7300094417302d82aa4f3f6e469f91d8facf4f26 (diff) |
SKINICONDESC initialization - end of story
git-svn-id: http://svn.miranda-ng.org/main/trunk@2598 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/SmileyAdd/src/main.cpp')
-rw-r--r-- | plugins/SmileyAdd/src/main.cpp | 86 |
1 files changed, 29 insertions, 57 deletions
diff --git a/plugins/SmileyAdd/src/main.cpp b/plugins/SmileyAdd/src/main.cpp index cbf4531f0c..61e4b2bbb8 100644 --- a/plugins/SmileyAdd/src/main.cpp +++ b/plugins/SmileyAdd/src/main.cpp @@ -33,14 +33,8 @@ extern LIST<void> menuHandleArray; char* metaProtoName;
-
-
-//static globals
-static HANDLE hHooks[7];
-static HANDLE hService[13];
int hLangpack;
-
static const PLUGININFOEX pluginInfoEx =
{
sizeof(PLUGININFOEX),
@@ -51,19 +45,11 @@ static const PLUGININFOEX pluginInfoEx = "borkra@miranda-im.org",
"Copyright© 2004 - 2012 Boris Krasnovskiy, portions by Rein-Peter de Boer",
"http://miranda-ng.org/",
- // "http://miranda-ng.org/",
UNICODE_AWARE,
// {BD542BB4-5AE4-4d0e-A435-BA8DBE39607F}
{ 0xbd542bb4, 0x5ae4, 0x4d0e, { 0xa4, 0x35, 0xba, 0x8d, 0xbe, 0x39, 0x60, 0x7f } }
};
-static SKINICONDESC skinDesc =
-{
- sizeof(SKINICONDESC), "SmileyAdd", NULL,
- "SmileyAdd_ButtonSmiley", NULL, -IDI_SMILINGICON
-};
-
-
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD /* mirandaVersion */)
{
return (PLUGININFOEX*)&pluginInfoEx;
@@ -77,9 +63,13 @@ static int ModulesLoaded(WPARAM, LPARAM) char path[MAX_PATH];
GetModuleFileNameA(g_hInst, path, MAX_PATH);
- skinDesc.pszDefaultFile = path;
- skinDesc.pszDescription = LPGEN("Button Smiley");
- HANDLE hSkinIcon = Skin_AddIcon(&skinDesc);
+ SKINICONDESC sid = { sizeof(SKINICONDESC) };
+ sid.pszName = "SmileyAdd_ButtonSmiley";
+ sid.pszSection = "SmileyAdd";
+ sid.pszDescription = LPGEN("Button Smiley");
+ sid.pszDefaultFile = path;
+ sid.iDefaultIndex = -IDI_SMILINGICON;
+ HANDLE hSkinIcon = Skin_AddIcon(&sid);
INT_PTR temp = CallService(MS_MC_GETPROTOCOLNAME, 0, 0);
metaProtoName = mir_strdup(temp == CALLSERVICE_NOTFOUND ? NULL : (char*)temp);
@@ -112,11 +102,9 @@ static int MirandaShutdown(WPARAM, LPARAM) extern "C" __declspec(dllexport) int Load(void)
{
-
mir_getLP(&pluginInfoEx);
- if (ServiceExists(MS_SMILEYADD_REPLACESMILEYS))
- {
+ if (ServiceExists(MS_SMILEYADD_REPLACESMILEYS)) {
static const TCHAR errmsg[] = _T("Only one instance of SmileyAdd could be executed.\n")
_T("Remove duplicate instances from 'Plugins' directory");
ReportError(TranslateTS(errmsg));
@@ -133,48 +121,35 @@ extern "C" __declspec(dllexport) int Load(void) // create smiley events
hEvent1 = CreateHookableEvent(ME_SMILEYADD_OPTIONSCHANGED);
- hHooks[0] = HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
- hHooks[1] = HookEvent(ME_SYSTEM_PRESHUTDOWN, MirandaShutdown);
- hHooks[2] = HookEvent(ME_OPT_INITIALISE, SmileysOptionsInitialize);
- hHooks[3] = HookEvent(ME_CLIST_PREBUILDCONTACTMENU, RebuildContactMenu);
- hHooks[4] = HookEvent(ME_SMILEYADD_OPTIONSCHANGED, UpdateSrmmDlg);
- hHooks[5] = HookEvent(ME_PROTO_ACCLISTCHANGED, AccountListChanged);
- hHooks[6] = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, DbSettingChanged);
+ HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
+ HookEvent(ME_SYSTEM_PRESHUTDOWN, MirandaShutdown);
+ HookEvent(ME_OPT_INITIALISE, SmileysOptionsInitialize);
+ HookEvent(ME_CLIST_PREBUILDCONTACTMENU, RebuildContactMenu);
+ HookEvent(ME_SMILEYADD_OPTIONSCHANGED, UpdateSrmmDlg);
+ HookEvent(ME_PROTO_ACCLISTCHANGED, AccountListChanged);
+ HookEvent(ME_DB_CONTACT_SETTINGCHANGED, DbSettingChanged);
//create the smiley services
- hService[0] = CreateServiceFunction(MS_SMILEYADD_REPLACESMILEYS, ReplaceSmileysCommand);
- hService[1] = CreateServiceFunction(MS_SMILEYADD_GETSMILEYICON, GetSmileyIconCommand);
- hService[2] = CreateServiceFunction(MS_SMILEYADD_SHOWSELECTION, ShowSmileySelectionCommand);
- hService[3] = CreateServiceFunction(MS_SMILEYADD_GETINFO, GetInfoCommand);
- hService[4] = CreateServiceFunction(MS_SMILEYADD_GETINFO2, GetInfoCommand2);
- hService[5] = CreateServiceFunction(MS_SMILEYADD_PARSE, ParseText);
- hService[6] = CreateServiceFunction(MS_SMILEYADD_REGISTERCATEGORY, RegisterPack);
- hService[7] = CreateServiceFunction(MS_SMILEYADD_BATCHPARSE, ParseTextBatch);
- hService[8] = CreateServiceFunction(MS_SMILEYADD_BATCHFREE, FreeTextBatch);
- hService[9] = CreateServiceFunction(MS_SMILEYADD_CUSTOMCATMENU, CustomCatMenu);
- hService[10] = CreateServiceFunction(MS_SMILEYADD_RELOAD, ReloadPack);
- hService[11] = CreateServiceFunction(MS_SMILEYADD_LOADCONTACTSMILEYS, LoadContactSmileys);
-
-
- hService[12] = CreateServiceFunction(MS_SMILEYADD_PARSEW, ParseTextW);
-
-
+ CreateServiceFunction(MS_SMILEYADD_REPLACESMILEYS, ReplaceSmileysCommand);
+ CreateServiceFunction(MS_SMILEYADD_GETSMILEYICON, GetSmileyIconCommand);
+ CreateServiceFunction(MS_SMILEYADD_SHOWSELECTION, ShowSmileySelectionCommand);
+ CreateServiceFunction(MS_SMILEYADD_GETINFO, GetInfoCommand);
+ CreateServiceFunction(MS_SMILEYADD_GETINFO2, GetInfoCommand2);
+ CreateServiceFunction(MS_SMILEYADD_PARSE, ParseText);
+ CreateServiceFunction(MS_SMILEYADD_REGISTERCATEGORY, RegisterPack);
+ CreateServiceFunction(MS_SMILEYADD_BATCHPARSE, ParseTextBatch);
+ CreateServiceFunction(MS_SMILEYADD_BATCHFREE, FreeTextBatch);
+ CreateServiceFunction(MS_SMILEYADD_CUSTOMCATMENU, CustomCatMenu);
+ CreateServiceFunction(MS_SMILEYADD_RELOAD, ReloadPack);
+ CreateServiceFunction(MS_SMILEYADD_LOADCONTACTSMILEYS, LoadContactSmileys);
+ CreateServiceFunction(MS_SMILEYADD_PARSEW, ParseTextW);
return 0;
}
-
extern "C" __declspec(dllexport) int Unload(void)
{
- int i;
-
RemoveDialogBoxHook();
- for (i=0; i<SIZEOF(hHooks); i++)
- UnhookEvent(hHooks[i]);
-
- for (i=0; i<SIZEOF(hService); i++)
- DestroyServiceFunction(hService[i]);
-
DestroyHookableEvent(hEvent1);
RichEditData_Destroy();
@@ -191,15 +166,12 @@ extern "C" __declspec(dllexport) int Unload(void) menuHandleArray.destroy();
mir_free(metaProtoName);
-
return 0;
}
-
extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID /*lpvReserved*/)
{
- switch(fdwReason)
- {
+ switch(fdwReason) {
case DLL_PROCESS_ATTACH:
g_hInst = hinstDLL;
DisableThreadLibraryCalls(hinstDLL);
|