From c420cf1a7491cedc2d073d22d37b12a3a581bc44 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 28 Jul 2012 16:21:03 +0000 Subject: service plugin's Load() can be called before Skin* services' registration git-svn-id: http://svn.miranda-ng.org/main/trunk@1224 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/DbEditorPP/src/main.cpp | 83 +++++++++++++++++++---------------------- 1 file changed, 39 insertions(+), 44 deletions(-) (limited to 'plugins/DbEditorPP') diff --git a/plugins/DbEditorPP/src/main.cpp b/plugins/DbEditorPP/src/main.cpp index 4ad0588629..2d4e21c310 100644 --- a/plugins/DbEditorPP/src/main.cpp +++ b/plugins/DbEditorPP/src/main.cpp @@ -161,6 +161,34 @@ static int OnTTBLoaded(WPARAM wParam,LPARAM lParam) int ModulesLoaded(WPARAM wParam,LPARAM lParam) { + // Register menu item + CLISTMENUITEM mi = { 0 }; + mi.cbSize = sizeof(mi); + mi.position = 1900000001; + mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(ICO_REGEDIT)); + mi.pszName = modFullname; + mi.pszService = "DBEditorpp/MenuCommand"; + Menu_AddMainMenuItem(&mi); + + ZeroMemory(&mi, sizeof(mi)); + mi.cbSize = sizeof(mi); + mi.position = 1900000001; + mi.flags = DBGetContactSettingByte(NULL,modname,"UserMenuItem",0)?0:CMIF_HIDDEN; + mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(ICO_REGUSER)); + mi.pszName = LPGEN("Open user tree in DBE++"); + mi.pszService = "DBEditorpp/MenuCommand"; + hUserMenu = Menu_AddContactMenuItem(&mi); + + // Register hotkeys + HOTKEYDESC hkd = {0}; + hkd.cbSize = sizeof(hkd); + hkd.pszName = "hk_dbepp_open"; + hkd.pszService = "DBEditorpp/MenuCommand"; + hkd.ptszDescription = LPGEN("Open Database Editor"); + hkd.ptszSection = modFullname; + hkd.DefHotKey = HOTKEYCODE(HOTKEYF_SHIFT|HOTKEYF_EXT, 'D'); + Hotkey_Register(&hkd); + DBVARIANT dbv; char *coreMods = ""; char *mods; @@ -169,22 +197,18 @@ int ModulesLoaded(WPARAM wParam,LPARAM lParam) int i=0, len; if (!DBGetContactSetting(NULL,modname,"CoreModules",&dbv) && dbv.type == DBVT_ASCIIZ) mods = dbv.pszVal; - else - { + else { DBWriteContactSettingString(NULL,modname,"CoreModules",coreMods); mods = coreMods; } len = (int)strlen(mods); - while (i < len) - { - if (mods[i] == '\\' && mods[i+1] == ' ') - { + while (i < len) { + if (mods[i] == '\\' && mods[i+1] == ' ') { strcat(mod," "); i++; } - else if (mods[i] == ' ' || mods[i] == ',' || mods[i] == '\r' || mods[i] == '\n'|| mods[i] == '\0') - { + else if (mods[i] == ' ' || mods[i] == ',' || mods[i] == '\r' || mods[i] == '\n'|| mods[i] == '\0') { if (mod[0]) CallService("DBEditorpp/RegisterSingleModule",(WPARAM)mod,0); mod[0] = '\0'; @@ -192,7 +216,9 @@ int ModulesLoaded(WPARAM wParam,LPARAM lParam) else strncat(mod,&mods[i],1); i++; } - if (mod[0]) CallService("DBEditorpp/RegisterSingleModule",(WPARAM)mod,0); + + if (mod[0]) + CallService("DBEditorpp/RegisterSingleModule",(WPARAM)mod,0); doOldKnownModulesList(); // add the old plugins which havnt been changed over yet.. @@ -206,10 +232,10 @@ int ModulesLoaded(WPARAM wParam,LPARAM lParam) usePopUps = DBGetContactSettingByte(NULL,modname,"UsePopUps",0); // Load the name order - for(i=0;i