diff options
-rw-r--r-- | dbeditorpp/headers.h | 4 | ||||
-rw-r--r-- | dbeditorpp/icons.cpp | 25 | ||||
-rw-r--r-- | dbeditorpp/main.cpp | 100 |
3 files changed, 64 insertions, 65 deletions
diff --git a/dbeditorpp/headers.h b/dbeditorpp/headers.h index b1b4c23..8cd54c9 100644 --- a/dbeditorpp/headers.h +++ b/dbeditorpp/headers.h @@ -6,6 +6,7 @@ #define _WIN32_WINNT 0x0501
#define MIRANDA_VER 0x0900
+#define MIRANDA_CUSTOM_LP
#if defined( UNICODE ) && !defined( _UNICODE )
#define _UNICODE
@@ -43,6 +44,7 @@ #include <m_history.h>
#include <m_popup.h>
#include <m_icolib.h>
+#include <m_hotkeys.h>
#include "m_updater.h"
#include "m_toptoolbar.h"
@@ -57,7 +59,7 @@ /////// icons support
extern BYTE UsingIconManager;
-void addIcons(char* szModuleFileName);
+void addIcons(TCHAR* szModuleFileName);
HICON LoadSkinnedDBEIcon(int icon);
int AddIconToList(HIMAGELIST hil, HICON hIcon);
void AddProtoIconsToList(HIMAGELIST hil, int newshift);
diff --git a/dbeditorpp/icons.cpp b/dbeditorpp/icons.cpp index d3e977d..f6ac36e 100644 --- a/dbeditorpp/icons.cpp +++ b/dbeditorpp/icons.cpp @@ -2,65 +2,66 @@ HIMAGELIST himl;
-void addIcons(char* szModuleFileName)
+void addIcons(TCHAR* szModuleFileName)
{
SKINICONDESC sid={0};
char name[32];
sid.cbSize = sizeof(sid);
- sid.pszSection = Translate(modFullname);
- sid.pszDefaultFile = szModuleFileName;
+ sid.ptszSection = _T(modFullname);
+ sid.ptszDefaultFile = szModuleFileName;
+ sid.flags = SIDF_ALL_TCHAR;
// closed known module
- sid.pszDescription = Translate("Closed Known Module");
+ sid.ptszDescription = LPGENT("Closed Known Module");
mir_snprintf(name, SIZEOF(name), "DBE++_%d", ICO_KNOWN);
sid.pszName = name;
sid.iDefaultIndex = -ICO_KNOWN;
CallService(MS_SKIN2_ADDICON,0,(LPARAM)&sid);
// open known module
- sid.pszDescription = Translate("Open Known Module");
+ sid.ptszDescription = LPGENT("Open Known Module");
mir_snprintf(name, SIZEOF(name), "DBE++_%d", ICO_KNOWNOPEN);
- sid.pszName = name;;
+ sid.pszName = name;
sid.iDefaultIndex = -ICO_KNOWNOPEN;
CallService(MS_SKIN2_ADDICON,0,(LPARAM)&sid);
// closed unknown module
- sid.pszDescription = Translate("Closed Unknown Module");
+ sid.ptszDescription = LPGENT("Closed Unknown Module");
mir_snprintf(name, SIZEOF(name), "DBE++_%d", ICO_UNKNOWN);
sid.pszName = name;
sid.iDefaultIndex = -ICO_UNKNOWN;
CallService(MS_SKIN2_ADDICON,0,(LPARAM)&sid);
// open unknown module
- sid.pszDescription = Translate("Open Unknown Module");
+ sid.ptszDescription = LPGENT("Open Unknown Module");
mir_snprintf(name, SIZEOF(name), "DBE++_%d", ICO_UNKNOWNOPEN);
sid.pszName = name;
sid.iDefaultIndex = -ICO_UNKNOWNOPEN;
CallService(MS_SKIN2_ADDICON,0,(LPARAM)&sid);
// settings contact
- sid.pszDescription = Translate("Settings");
+ sid.ptszDescription = LPGENT("Settings");
mir_snprintf(name, SIZEOF(name), "DBE++_%d", ICO_SETTINGS);
sid.pszName = name;
sid.iDefaultIndex = -ICO_SETTINGS;
CallService(MS_SKIN2_ADDICON,0,(LPARAM)&sid);
// contact group
- sid.pszDescription = Translate("Contacts Group");
+ sid.ptszDescription = LPGENT("Contacts Group");
mir_snprintf(name, SIZEOF(name), "DBE++_%d", ICO_CONTACTS);
sid.pszName = name;
sid.iDefaultIndex = -ICO_CONTACTS;
CallService(MS_SKIN2_ADDICON,0,(LPARAM)&sid);
// unknwon contact
- sid.pszDescription = Translate("Unknown Contact");
+ sid.ptszDescription = LPGENT("Unknown Contact");
mir_snprintf(name, SIZEOF(name), "DBE++_%d", ICO_OFFLINE);
sid.pszName = name;
sid.iDefaultIndex = -ICO_OFFLINE;
CallService(MS_SKIN2_ADDICON,0,(LPARAM)&sid);
// known contact
- sid.pszDescription = Translate("Known Contact");
+ sid.ptszDescription = LPGENT("Known Contact");
mir_snprintf(name, SIZEOF(name), "DBE++_%d", ICO_ONLINE);
sid.pszName = name;
sid.iDefaultIndex = -ICO_ONLINE;
diff --git a/dbeditorpp/main.cpp b/dbeditorpp/main.cpp index 280d72e..91563e3 100644 --- a/dbeditorpp/main.cpp +++ b/dbeditorpp/main.cpp @@ -13,11 +13,13 @@ BOOL bServiceMode = FALSE; BOOL usePopUps;
HWND hwnd2watchedVarsWindow;
int UDB;
+int hLangpack;
BYTE nameOrder[NAMEORDERCOUNT];
HANDLE hUserMenu;
HANDLE hRestore;
WatchListArrayStruct WatchListArray;
BYTE UsingIconManager;
+HANDLE sMenuCommand, sRegisterModule, sRegisterSingleModule, sImport;
//========================
// MirandaPluginInfo
@@ -61,14 +63,6 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved) return TRUE;
}
-//===================
-// MainInit
-//===================
-int MainInit(WPARAM wParam,LPARAM lParam)
-{
- return 0;
-}
-
void settingChanged(HWND hwnd2Settings, HANDLE hContact, char* module, char* setting);
int DBSettingChanged(WPARAM wParam,LPARAM lParam)
@@ -191,7 +185,7 @@ int ModulesLoaded(WPARAM wParam,LPARAM lParam) char *coreMods = "";
char *mods;
char mod[64] = "";
- char szModuleFileName[MAX_PATH];
+ TCHAR szModuleFileName[MAX_PATH];
int i=0, len;
if (!DBGetContactSetting(NULL,modname,"CoreModules",&dbv) && dbv.type == DBVT_ASCIIZ)
mods = dbv.pszVal;
@@ -223,7 +217,7 @@ int ModulesLoaded(WPARAM wParam,LPARAM lParam) doOldKnownModulesList(); // add the old plugins which havnt been changed over yet..
// icons
- if (GetModuleFileName(hInst,szModuleFileName,MAX_PATH) && ServiceExists(MS_SKIN2_ADDICON))
+ if (GetModuleFileName(hInst, szModuleFileName, MAX_PATH) && ServiceExists(MS_SKIN2_ADDICON))
{
UsingIconManager =1;
addIcons(szModuleFileName);
@@ -270,25 +264,7 @@ int ModulesLoaded(WPARAM wParam,LPARAM lParam) // useless if DB doesnt not support unicode
UOS = (UDB && IsCP_UTF8() && IsWinVerNT());
- // updater support
- {
- Update update = {0};
- char szVersion[16];
-
- update.cbSize = sizeof(Update);
-
- update.szComponentName = pluginInfoEx.shortName;
- update.pbVersion = (BYTE *)CreateVersionStringPluginEx(&pluginInfoEx, szVersion);
- update.cpbVersion = (int)strlen((char *)update.pbVersion);
-
- update.szUpdateURL = "http://addons.miranda-im.org/feed.php?dlsource=2957";
- update.szVersionURL = "http://addons.miranda-im.org/details.php?action=viewfile&id=2957";
-
- update.szBetaVersionURL = "http://forums.miranda-im.org/showpost.php?p=38051&postcount=1";
- update.szBetaUpdateURL = "http://etplanet.com/bio/miranda/archive/other/dbeditorpp.dll";
-
- CallService(MS_UPDATE_REGISTER, 0, (WPARAM)&update);
- }
+ CallService(MS_UPDATE_REGISTERFL,2957,(LPARAM)&pluginInfoEx);
hTTBHook = HookEvent(ME_TTB_MODULELOADED, OnTTBLoaded);
@@ -315,6 +291,11 @@ int PreShutdown(WPARAM wParam,LPARAM lParam) if (hHookedEvents[i]) UnhookEvent(hHookedEvents[i]);
}
+ DestroyServiceFunction(sMenuCommand);
+ DestroyServiceFunction(sRegisterModule);
+ DestroyServiceFunction(sRegisterSingleModule);
+ DestroyServiceFunction(sImport);
+
return 0;
}
@@ -342,6 +323,7 @@ extern "C" __declspec(dllexport) int Load(PLUGINLINK *link) pluginLink = link;
mir_getMMI(&mmi);
mir_getUTFI( &utfi );
+ mir_getLP(&pluginInfoEx);
hwnd2mainWindow = 0;
hwnd2watchedVarsWindow = 0;
@@ -352,29 +334,29 @@ extern "C" __declspec(dllexport) int Load(PLUGINLINK *link) // hHookedEvents[2] = HookEvent(ME_CLIST_PREBUILDCONTACTMENU,PrebuildContactMenu);
HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown);
hModulesLoadedHook = HookEvent(ME_SYSTEM_MODULESLOADED,ModulesLoaded);
- CreateServiceFunction("DBEditorpp/MenuCommand", DBEditorppMenuCommand);
- CreateServiceFunction("DBEditorpp/RegisterModule", RegisterModule);
- CreateServiceFunction("DBEditorpp/RegisterSingleModule", RegisterSingleModule);
- CreateServiceFunction("DBEditorpp/Import", ImportFromFile);
- ZeroMemory(&mi,sizeof(mi));
- mi.cbSize=sizeof(mi);
- mi.position=1900000001;
- mi.flags=0;
- mi.hIcon=LoadIcon(hInst,MAKEINTRESOURCE(ICO_REGEDIT));
- mi.pszName=modFullname;
- mi.pszService="DBEditorpp/MenuCommand";
- mi.pszContactOwner=NULL;
- CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&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="Open user tree in DBE++";
- mi.pszService="DBEditorpp/MenuCommand";
- mi.pszContactOwner=NULL;
- hUserMenu = (HANDLE) CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM) & mi);
+ sMenuCommand = CreateServiceFunction("DBEditorpp/MenuCommand", DBEditorppMenuCommand);
+ sRegisterModule = CreateServiceFunction("DBEditorpp/RegisterModule", RegisterModule);
+ sRegisterSingleModule = CreateServiceFunction("DBEditorpp/RegisterSingleModule", RegisterSingleModule);
+ sImport = CreateServiceFunction("DBEditorpp/Import", ImportFromFile);
+ ZeroMemory(&mi, sizeof(mi));
+ mi.cbSize = sizeof(mi);
+ mi.position = 1900000001;
+ mi.flags = CMIF_TCHAR;
+ mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(ICO_REGEDIT));
+ mi.ptszName = _T(modFullname);
+ mi.pszService = "DBEditorpp/MenuCommand";
+ mi.pszContactOwner = NULL;
+ CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM)&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.ptszName = LPGENT("Open user tree in DBE++");
+ mi.pszService = "DBEditorpp/MenuCommand";
+ mi.pszContactOwner = NULL;
+ hUserMenu = (HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM) & mi);
hHookedEvents[3] = CreateServiceFunction(MS_SERVICEMODE_LAUNCH, ServiceMode);
@@ -391,6 +373,20 @@ extern "C" __declspec(dllexport) int Load(PLUGINLINK *link) ZeroMemory(&WatchListArray, sizeof(WatchListArray));
+ if(ServiceExists(MS_HOTKEY_REGISTER))
+ {
+ HOTKEYDESC hkd = {0};
+ hkd.cbSize = sizeof(hkd);
+ hkd.dwFlags = HKD_TCHAR;
+ hkd.pszName = "hk_dbepp_open";
+ hkd.pszService = "DBEditorpp/MenuCommand";
+ hkd.ptszDescription = LPGENT("Open Database Editor");
+ hkd.ptszSection = _T(modFullname);
+ hkd.DefHotKey = HOTKEYCODE(HOTKEYF_SHIFT|HOTKEYF_EXT, 'D');
+
+ CallService(MS_HOTKEY_REGISTER,0,(LPARAM)&hkd);
+ }
+
return 0;
}
|