From 8fbba48ab65bcc02ade47a2784f1983d7721058c Mon Sep 17 00:00:00 2001 From: mataes2007 Date: Thu, 28 Apr 2011 08:19:23 +0000 Subject: PopUp (patch from Wishmaster51): +added support for custom langpacks +added hotkey to open popup history *background can now be changed together with font in font options -removed old PLUGININFO support git-svn-id: http://miranda-plugins.googlecode.com/svn/trunk@57 e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb --- popup/src/config.cpp | 20 +++----------------- popup/src/config.h | 1 - popup/src/font.cpp | 12 +++++++----- popup/src/headers.h | 1 + popup/src/main.cpp | 31 +++++++++++++------------------ popup/src/skin.h | 2 +- 6 files changed, 25 insertions(+), 42 deletions(-) (limited to 'popup/src') diff --git a/popup/src/config.cpp b/popup/src/config.cpp index b8ff1f5..1702829 100644 --- a/popup/src/config.cpp +++ b/popup/src/config.cpp @@ -75,20 +75,6 @@ PLUGININFOEX pluginInfoEx = POPUP_UUID }; -PLUGININFO pluginInfo = -{ - sizeof(PLUGININFO), - pluginInfoEx.shortName, - pluginInfoEx.version, - pluginInfoEx.description, - pluginInfoEx.author, - pluginInfoEx.authorEmail, - pluginInfoEx.copyright, - pluginInfoEx.homepage, - pluginInfoEx.flags, - pluginInfoEx.replacesDefaultModule -}; - // MLU layer for ansi release #if !defined(_UNICODE) BOOL (WINAPI *MySetLayeredWindowAttributes)(HWND,COLORREF,BYTE,DWORD); @@ -197,7 +183,7 @@ void LoadOptions() { PopUpOptions.debug = DBGetContactSettingByte(NULL, MODULNAME, "debug", FALSE); #endif DWORD prevVersion = DBGetContactSettingDword(NULL, MODULNAME, "PopupPlusVersion", 0); - if ( (prevVersion < pluginInfo.version) && + if ( (prevVersion < pluginInfoEx.version) && !PopUpOptions.debug && !DBGetContactSettingByte(NULL, MODULNAME, "NeverShowNews", 0) ) { @@ -213,7 +199,7 @@ void LoadOptions() { SWP_SHOWWINDOW); ShowWindow(hwnd, SW_SHOWNORMAL); } - DBWriteContactSettingDword(NULL, MODULNAME, "PopupPlusVersion", pluginInfo.version); + DBWriteContactSettingDword(NULL, MODULNAME, "PopupPlusVersion", pluginInfoEx.version); //Load PopUp Options if(!OptionLoaded){ @@ -350,7 +336,7 @@ static int NukePopupSettings(const char* szModul) mir_free(setting_items); setting_items = next; } - DBWriteContactSettingDword(NULL, MODULNAME, "PopupPlusVersion", pluginInfo.version); + DBWriteContactSettingDword(NULL, MODULNAME, "PopupPlusVersion", pluginInfoEx.version); return 0; } diff --git a/popup/src/config.h b/popup/src/config.h index ace3060..64ff3f2 100644 --- a/popup/src/config.h +++ b/popup/src/config.h @@ -170,7 +170,6 @@ extern bool OptionLoaded; //extern SKINELEMENT *n_skin; //===== Plugin informations struct ===== -extern PLUGININFO pluginInfo; extern PLUGININFOEX pluginInfoEx; //===== Transparency & APIs which are not supported by every OS ===== diff --git a/popup/src/font.cpp b/popup/src/font.cpp index 1f6b513..d9502ea 100644 --- a/popup/src/font.cpp +++ b/popup/src/font.cpp @@ -43,37 +43,39 @@ void InitFonts() { fid.flags = FIDF_DEFAULTVALID; fid.deffontsettings.charset = DEFAULT_CHARSET; fid.deffontsettings.size = -11; + lstrcpy(fid.backgroundGroup,_T(PU_FNT_AND_COLOR)); + lstrcpy(fid.backgroundName,_T(PU_COL_BACK_NAME)); lstrcpy(fid.deffontsettings.szFace, _T("Tahoma")); lstrcpy(fid.name, _T(PU_FNT_NAME_TITLE)); mir_snprintf(fid.prefix, sizeof(fid.prefix), PU_FNT_PREFIX, PU_FNT_NAME_TITLE); fid.deffontsettings.style = DBFONTF_BOLD; fid.deffontsettings.colour = RGB(0,0,0); - CallService(MS_FONT_REGISTERT, (WPARAM)&fid, 0); + FontRegisterT(&fid); lstrcpy(fid.name, _T(PU_FNT_NAME_CLOCK)); mir_snprintf(fid.prefix, sizeof(fid.prefix), PU_FNT_PREFIX, PU_FNT_NAME_CLOCK); //fid.deffontsettings.style = DBFONTF_BOLD; //fid.deffontsettings.colour = RGB(0,0,0); - CallService(MS_FONT_REGISTERT, (WPARAM)&fid, 0); + FontRegisterT(&fid); lstrcpy(fid.name, _T(PU_FNT_NAME_TEXT)); mir_snprintf(fid.prefix, sizeof(fid.prefix), PU_FNT_PREFIX, PU_FNT_NAME_TEXT); fid.deffontsettings.style = 0; //fid.deffontsettings.colour = RGB(0,0,0); - CallService(MS_FONT_REGISTERT, (WPARAM)&fid, 0); + FontRegisterT(&fid); lstrcpy(fid.name, _T("Action")); mir_snprintf(fid.prefix, sizeof(fid.prefix), PU_FNT_PREFIX, "Action"); //fid.deffontsettings.style = 0; fid.deffontsettings.colour = RGB(0,0,255); - CallService(MS_FONT_REGISTERT, (WPARAM)&fid, 0); + FontRegisterT(&fid); lstrcpy(fid.name, _T("Hovered Action")); mir_snprintf(fid.prefix, sizeof(fid.prefix), PU_FNT_PREFIX, "Hovered Action"); fid.deffontsettings.style = DBFONTF_UNDERLINE; //fid.deffontsettings.colour = RGB(0,0,255); - CallService(MS_FONT_REGISTERT, (WPARAM)&fid, 0); + FontRegisterT(&fid); ColourIDT cid = {0}; cid.cbSize = sizeof(ColourIDT); diff --git a/popup/src/headers.h b/popup/src/headers.h index fb2a904..0e3f7bc 100644 --- a/popup/src/headers.h +++ b/popup/src/headers.h @@ -90,6 +90,7 @@ Last change by : $Author: Merlin_de $ #define NOWIN2K #define MIRANDA_VER 0x0900 + #define MIRANDA_CUSTOM_LP //Miranda API (see Miranda svn) #include diff --git a/popup/src/main.cpp b/popup/src/main.cpp index 494a7e4..3850a43 100644 --- a/popup/src/main.cpp +++ b/popup/src/main.cpp @@ -51,6 +51,7 @@ static int OptionsInitialize(WPARAM,LPARAM); //===== Initializations ===== static int OkToExit(WPARAM,LPARAM); bool OptionLoaded = false; +int hLangpack = 0; //===== Global variables ===== //===== DLLs ===== @@ -352,7 +353,7 @@ void registerUpdate(){ Update update = {0}; char szVersion[16]; update.cbSize = sizeof(Update); - update.szComponentName = pluginInfo.shortName; + update.szComponentName = pluginInfoEx.shortName; update.pbVersion = (BYTE *)CreateVersionStringPluginEx(&pluginInfoEx, szVersion); update.cpbVersion = (int)strlen((char *)update.pbVersion); @@ -382,6 +383,12 @@ void LoadHotkey(){ hk.ptszSection = LPGENT(MODULNAME_PLU); hk.pszService = MENUCOMMAND_SVC; CallService(MS_HOTKEY_REGISTER, 0, (LPARAM) &hk); + + // 'Popup History' Hotkey + hk.pszName = "Popup History"; + hk.ptszDescription = LPGENT("Popup History"); + hk.pszService = MENUCOMMAND_HISTORY; + CallService(MS_HOTKEY_REGISTER, 0, (LPARAM) &hk); } //menu @@ -485,21 +492,8 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved) //===== MirandaPluginInfo ===== //Called by Miranda to get the information associated to this plugin. -//It only returns the PLUGININFO structure, without any test on the version +//It only returns the PLUGININFOEX structure, without any test on the version //@param mirandaVersion - The version of the application calling this function -MIRAPI PLUGININFO* MirandaPluginInfo(DWORD mirandaVersion) -{ - g_popup.MirVer = mirandaVersion; - -#if defined(_UNICODE) - pluginInfo.flags = UNICODE_AWARE; -#else - if (GetProcAddress(GetModuleHandle(_T("user32")), "DrawTextExW")) - pluginInfo.flags = 1; // dynamic UNICODE_AWARE -#endif - return &pluginInfo; -} - MIRAPI PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion) { g_popup.MirVer = mirandaVersion; @@ -532,7 +526,7 @@ static int OkToExit(WPARAM wParam, LPARAM lParam) static INT_PTR svcGetVersion(WPARAM, LPARAM) { - return pluginInfo.version; + return pluginInfoEx.version; } //===== Load ===== @@ -557,6 +551,7 @@ MIRAPI int Load(PLUGINLINK *link) mir_getMMI (&mmi); mir_getUTFI (&utfi); mir_getMTI (&MText); + mir_getLP(&pluginInfoEx); #if defined(_DEBUG) PopUpOptions.debug = DBGetContactSettingByte(NULL, MODULNAME, "debug", FALSE); @@ -648,7 +643,7 @@ MIRAPI int Load(PLUGINLINK *link) PopupHistoryLoad(); LoadPopupThread(); - if (!(LoadPopupWnd2())) + if (!LoadPopupWnd2()) { MessageBox(0, TranslateTS( _T("Error: I could not register the PopUp Window class.\r\n") @@ -662,7 +657,7 @@ MIRAPI int Load(PLUGINLINK *link) // Register in DBEditor++ DBVARIANT dbv; if (DBGetContactSetting(NULL, "KnownModules", MODULNAME, &dbv)) - DBWriteContactSettingString(NULL, "KnownModules", pluginInfo.shortName, MODULNAME); + DBWriteContactSettingString(NULL, "KnownModules", pluginInfoEx.shortName, MODULNAME); DBFreeVariant(&dbv); hModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded); diff --git a/popup/src/skin.h b/popup/src/skin.h index fb9890f..8cc7171 100644 --- a/popup/src/skin.h +++ b/popup/src/skin.h @@ -153,7 +153,7 @@ public: int useInternalClock() const { return m_internalClock; } int getLegacyRegionOpacity() const { return m_legacy_region_opacity; } int getShadowRegionOpacity() const { return m_shadow_region_opacity; } - bool isCompatible() const { return (DWORD) m_popup_version <= (DWORD) pluginInfo.version; } + bool isCompatible() const { return (DWORD) m_popup_version <= (DWORD) pluginInfoEx.version; } const LPTSTR getName() const { return m_name; } -- cgit v1.2.3