From 503f8c2abd447c01f9e9cf6a02cc355ce8d32d55 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Sun, 8 Jul 2012 16:34:36 +0000 Subject: PasteIt: adopted git-svn-id: http://svn.miranda-ng.org/main/trunk@854 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/PasteIt/Options.cpp | 12 ++-- plugins/PasteIt/PasteIt.cpp | 58 +++++----------- plugins/PasteIt/PasteIt.vcxproj | 114 ++++++++++++-------------------- plugins/PasteIt/PasteIt.vcxproj.filters | 6 -- plugins/PasteIt/dllmain.cpp | 14 ---- plugins/PasteIt/stdafx.cpp | 8 --- plugins/PasteIt/stdafx.h | 6 +- 7 files changed, 67 insertions(+), 151 deletions(-) delete mode 100644 plugins/PasteIt/dllmain.cpp delete mode 100644 plugins/PasteIt/stdafx.cpp (limited to 'plugins') diff --git a/plugins/PasteIt/Options.cpp b/plugins/PasteIt/Options.cpp index 799bc27e54..49309bc580 100644 --- a/plugins/PasteIt/Options.cpp +++ b/plugins/PasteIt/Options.cpp @@ -199,7 +199,7 @@ void GetPagesSettings(HWND hwndDlg, OptsPagesData* optsPagesData) { int selected = optsPagesData->lastPage; int format = ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_DEFFORMAT)); - if(format >= 0 && format < optsPagesData->webOptions[selected]->formats.size()) + if(format >= 0 && format < (int)optsPagesData->webOptions[selected]->formats.size()) { for(std::list::iterator it = optsPagesData->webOptions[selected]->formats.begin(); it != optsPagesData->webOptions[selected]->formats.end(); ++it) { @@ -218,7 +218,7 @@ void GetPagesSettings(HWND hwndDlg, OptsPagesData* optsPagesData) if(optsPagesData->webOptions[selected]->isCombo1) { int sel = ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_COMBO1)); - if(sel >= 0 && sel < optsPagesData->webOptions[selected]->combo1Values.size()) + if(sel >= 0 && sel < (int)optsPagesData->webOptions[selected]->combo1Values.size()) { for(std::list::iterator it = optsPagesData->webOptions[selected]->combo1Values.begin(); it != optsPagesData->webOptions[selected]->combo1Values.end(); ++it) { @@ -477,7 +477,7 @@ INT_PTR CALLBACK Options::DlgProcOptsPages(HWND hwndDlg, UINT msg, WPARAM wParam void SelectLbConfigure(HWND hwndDlg, int sel, OptsConfigureData* optsConfigureData) { - if(sel >= 0 && sel < optsConfigureData->tempFormats.size()) + if(sel >= 0 && sel < (int)optsConfigureData->tempFormats.size()) { Button_Enable(GetDlgItem(hwndDlg, IDC_DELETE), TRUE); if(sel == 0) @@ -580,7 +580,7 @@ INT_PTR CALLBACK Options::DlgProcOptsConfigure(HWND hwndDlg, UINT msg, WPARAM wP HWND lb = GetDlgItem(hwndDlg, IDC_FORMATTING); OptsConfigureData* optsConfigureData = (OptsConfigureData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); int sel = ListBox_GetCurSel(lb); - if(sel >= 0 && sel + 1 < optsConfigureData->tempFormats.size()) + if(sel >= 0 && sel + 1 < (int)optsConfigureData->tempFormats.size()) { int i = sel; for(std::list::iterator it = optsConfigureData->tempFormats.begin(); it != optsConfigureData->tempFormats.end(); ++it) @@ -782,12 +782,12 @@ int Options::InitOptions(WPARAM wParam, LPARAM lParam) odp.ptszTab = LPGENT("Main"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_MAIN); odp.pfnDlgProc = Options::DlgProcOptsMain; - CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp); + Options_AddPage(wParam, &odp); odp.ptszTab = LPGENT("Web page"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_PAGES); odp.pfnDlgProc = Options::DlgProcOptsPages; - CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp); + Options_AddPage(wParam, &odp); return 0; } diff --git a/plugins/PasteIt/PasteIt.cpp b/plugins/PasteIt/PasteIt.cpp index 1ae7e1d7e9..204b58ced5 100644 --- a/plugins/PasteIt/PasteIt.cpp +++ b/plugins/PasteIt/PasteIt.cpp @@ -41,6 +41,7 @@ HGENMENU hWebPageMenus[PasteToWeb::pages]; HANDLE hMainIcon; HANDLE hOptionsInit; HANDLE hWindowEvent = NULL; +HINSTANCE hInst; #define MODULE "PasteIt" #define FROM_CLIPBOARD 10 @@ -58,14 +59,18 @@ PLUGININFOEX pluginInfo={ __COPYRIGHT, __AUTHORWEB, UNICODE_AWARE, - 0, MIID_PASTEIT }; -MM_INTERFACE mmi = {0}; XML_API xi = {0}; int hLangpack = 0; +BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) +{ + hInst = hModule; + return TRUE; +} + extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion) { gMirandaVersion = mirandaVersion; @@ -169,25 +174,18 @@ void PasteIt(HANDLE hContact, int mode) INT_PTR *vtable = (INT_PTR *)*vptr; if(VirtualQuery((void*)vtable[0], &mb, sizeof(MEMORY_BASIC_INFORMATION))) { - typedef PLUGININFO * (__cdecl * Miranda_Plugin_Info) ( DWORD mirandaVersion ); typedef PLUGININFOEX * (__cdecl * Miranda_Plugin_InfoEx) ( DWORD mirandaVersion ); HINSTANCE hInst = (HINSTANCE)mb.AllocationBase; // Now I can get PLUGININFOEX from protocol - Miranda_Plugin_Info info = (Miranda_Plugin_Info) GetProcAddress(hInst, "MirandaPluginInfo"); Miranda_Plugin_InfoEx infoEx = (Miranda_Plugin_InfoEx) GetProcAddress(hInst, "MirandaPluginInfoEx"); PLUGININFOEX* pi = NULL; if(infoEx != NULL) { pi = infoEx(gMirandaVersion); } - else if(info != NULL) - { - pi = (PLUGININFOEX*)info(gMirandaVersion); - } - // If PLUGININFOEX flags contains UNICODE_AWARE, // this mean that protocol is unicode. - if(pi != NULL && pi->cbSize >= sizeof(PLUGININFO)) + if(pi != NULL && pi->cbSize == sizeof(PLUGININFOEX)) { isUnicodePlugin = pi->flags & UNICODE_AWARE; } @@ -386,7 +384,7 @@ void InitIcolib() sid.pszName = "PasteIt_main"; sid.ptszDescription = LPGENT("Paste It"); sid.iDefaultIndex = -IDI_MENU; - hMainIcon = (HANDLE)CallService(MS_SKIN2_ADDICON, 0, (LPARAM)&sid); + hMainIcon = Skin_AddIcon(&sid); } void InitMenuItems() @@ -400,7 +398,7 @@ void InitMenuItems() mi.position = 3000090005; mi.ptszName = _T("Paste It"); - hContactMenu = (HGENMENU)CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM)&mi); + hContactMenu = Menu_AddContactMenuItem(&mi); memset(&mi, 0, sizeof(mi)); mi.cbSize = sizeof(mi); @@ -409,15 +407,15 @@ void InitMenuItems() mi.hParentMenu = hContactMenu; mi.popupPosition = FROM_CLIPBOARD; mi.ptszName = _T("Paste from clipboard"); - CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM)&mi); + Menu_AddContactMenuItem(&mi); mi.popupPosition = FROM_FILE; mi.ptszName = _T("Paste from file"); - CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM)&mi); + Menu_AddContactMenuItem(&mi); mi.popupPosition = DEF_PAGES_START - 1; mi.ptszName = _T("Default web page"); - HGENMENU hDefWebMenu = (HGENMENU)CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM)&mi); + HGENMENU hDefWebMenu = Menu_AddContactMenuItem(&mi); mi2.cbSize = sizeof(mi2); mi2.pszService = MS_PASTEIT_CONTACTMENU; @@ -429,7 +427,7 @@ void InitMenuItems() mi2.flags |= CMIF_CHECKED; mi2.ptszName = pasteToWebs[i]->GetName(); mi2.popupPosition = mi2.position = DEF_PAGES_START + i; - hWebPageMenus[i] = (HGENMENU)CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM)&mi2); + hWebPageMenus[i] = Menu_AddContactMenuItem(&mi2); } hPrebuildContactMenu = HookEvent(ME_CLIST_PREBUILDCONTACTMENU, PrebuildContactMenu); @@ -474,29 +472,6 @@ void InitTabsrmmButton() } } -void InitUpdater() -{ - if (ServiceExists(MS_UPDATE_REGISTER)) - { - Update update = {0}; - char szVersion[16]; - update.cbSize = sizeof(Update); - update.szComponentName = pluginInfo.shortName; - update.pbVersion = (BYTE *)CreateVersionStringPluginEx(&pluginInfo, szVersion); - update.cpbVersion = (int)strlen((char *)update.pbVersion); - -#ifdef _WIN64 - update.szUpdateURL = "http://programista.free.of.pl/miranda/PasteIt64.zip"; -#else - update.szUpdateURL = "http://programista.free.of.pl/miranda/PasteIt.zip"; -#endif - update.szVersionURL = "http://programista.free.of.pl/miranda/PasteItVersion.txt"; - update.pbVersionPrefix = (BYTE *)"Paste It "; - update.cpbVersionPrefix = (int)strlen((char *)update.pbVersionPrefix); - CallService(MS_UPDATE_REGISTER, 0, (WPARAM)&update); - } -} - int WindowEvent(WPARAM wParam, MessageWindowEventData* lParam) { if(lParam->uType == MSG_WINDOW_EVT_OPEN) @@ -527,16 +502,13 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) InitIcolib(); InitMenuItems(); InitTabsrmmButton(); - InitUpdater(); hWindowEvent = HookEvent(ME_MSG_WINDOWEVENT, (MIRANDAHOOK)WindowEvent); return 0; } -extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) +extern "C" int __declspec(dllexport) Load(void) { - pluginLink = link; - mir_getMMI(&mmi); mir_getXI(&xi); mir_getLP(&pluginInfo); NETLIBUSER nlu = {0}; diff --git a/plugins/PasteIt/PasteIt.vcxproj b/plugins/PasteIt/PasteIt.vcxproj index 0cb427047b..b0f5cae238 100644 --- a/plugins/PasteIt/PasteIt.vcxproj +++ b/plugins/PasteIt/PasteIt.vcxproj @@ -20,35 +20,29 @@ {BAEBC482-CDA9-4053-A7D0-08222E85118E} - Win32Proj - PasteIt DynamicLibrary true Unicode - Windows7.1SDK DynamicLibrary true Unicode - Windows7.1SDK DynamicLibrary false true Unicode - v90 DynamicLibrary false true Unicode - Windows7.1SDK @@ -66,24 +60,17 @@ - - true - obj\$(Platform)\$(Configuration)\ - C:\Miranda\Plugins\ - - - true - obj\$(Platform)\$(Configuration)\ - C:\Miranda Im\Plugins\ - - - false - $(SolutionDir)$(Platform)\$(Configuration)\ - obj\$(Platform)\$(Configuration)\ - - - false - obj\$(Platform)\$(Configuration)\ + + <_ProjectFileVersion>10.0.30319.1 + $(SolutionDir)$(Configuration)\Plugins\ + $(SolutionDir)$(Configuration)64\Plugins\ + $(SolutionDir)$(Configuration)\Obj\$(ProjectName)\ + $(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\ + $(SolutionDir)$(Configuration)\Plugins\ + $(SolutionDir)$(Configuration)64\Plugins\ + $(SolutionDir)$(Configuration)\Obj\$(ProjectName)\ + $(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\ + true @@ -91,15 +78,18 @@ Level3 Disabled WIN32;_DEBUG;_WINDOWS;_USRDLL;PASTEIT_EXPORTS;%(PreprocessorDefinitions) - ..\..\include;%(AdditionalIncludeDirectories) + ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) Windows true - %(AdditionalDependencies) + false + $(IntDir)$(TargetName).lib + $(SolutionDir)\lib - ..\..\include\msapi;%(AdditionalIncludeDirectories) + ..\..\include\msapi + _DEBUG;%(PreprocessorDefinitions) @@ -107,68 +97,70 @@ Use Level3 Disabled - WIN32;_DEBUG;_WINDOWS;_USRDLL;PASTEIT_EXPORTS;_WIN64;_AMD64_;%(PreprocessorDefinitions) - ..\..\include;%(AdditionalIncludeDirectories) + WIN64;_DEBUG;_WINDOWS;_USRDLL;PASTEIT_EXPORTS;%(PreprocessorDefinitions) + ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) Windows true - %(AdditionalDependencies) + false + $(IntDir)$(TargetName).lib + $(SolutionDir)\lib - ..\..\include\msapi;%(AdditionalIncludeDirectories) + ..\..\include\msapi + _DEBUG;%(PreprocessorDefinitions) Level3 Use - MaxSpeed + Full true true WIN32;NDEBUG;_WINDOWS;_USRDLL;PASTEIT_EXPORTS;%(PreprocessorDefinitions) - ..\..\include;%(AdditionalIncludeDirectories) + ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) + Size Windows true true true - %(AdditionalDependencies) + false + $(IntDir)$(TargetName).lib + $(SolutionDir)\lib - ..\..\include\msapi;%(AdditionalIncludeDirectories) + ..\..\include\msapi + NDEBUG;%(PreprocessorDefinitions) - - if not exist "$(TargetDir)Docs\" mkdir "$(TargetDir)Docs\" -copy "$(ProjectDir)Docs\*.*" "$(TargetDir)Docs\" - Level3 Use - MaxSpeed + Full true true - WIN32;NDEBUG;_WINDOWS;_USRDLL;PASTEIT_EXPORTS;_WIN64;_AMD64_;%(PreprocessorDefinitions) - ..\..\include;%(AdditionalIncludeDirectories) + WIN64;NDEBUG;_WINDOWS;_USRDLL;PASTEIT_EXPORTS;%(PreprocessorDefinitions) + ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) + Size Windows true true true - %(AdditionalDependencies) + false + $(IntDir)$(TargetName).lib + $(SolutionDir)\lib - ..\..\include\msapi;%(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) + ..\..\include\msapi + NDEBUG;%(PreprocessorDefinitions) - - if not exist "$(TargetDir)Docs\" mkdir "$(TargetDir)Docs\" -copy "$(ProjectDir)Docs\*.*" "$(TargetDir)Docs\" - @@ -181,31 +173,13 @@ copy "$(ProjectDir)Docs\*.*" "$(TargetDir)Docs\" - - false - false - - - - - false - false - - - - - - + + Create + - - Create - Create - Create - Create - diff --git a/plugins/PasteIt/PasteIt.vcxproj.filters b/plugins/PasteIt/PasteIt.vcxproj.filters index afdb460375..494819693d 100644 --- a/plugins/PasteIt/PasteIt.vcxproj.filters +++ b/plugins/PasteIt/PasteIt.vcxproj.filters @@ -44,15 +44,9 @@ - - Source Files - Source Files - - Source Files - Source Files diff --git a/plugins/PasteIt/dllmain.cpp b/plugins/PasteIt/dllmain.cpp deleted file mode 100644 index ad89773ec8..0000000000 --- a/plugins/PasteIt/dllmain.cpp +++ /dev/null @@ -1,14 +0,0 @@ -// dllmain.cpp : Defines the entry point for the DLL application. -#include "stdafx.h" - -HINSTANCE hInst; - -BOOL APIENTRY DllMain( HMODULE hModule, - DWORD ul_reason_for_call, - LPVOID lpReserved - ) -{ - hInst = hModule; - return TRUE; -} - diff --git a/plugins/PasteIt/stdafx.cpp b/plugins/PasteIt/stdafx.cpp deleted file mode 100644 index 12ae832e21..0000000000 --- a/plugins/PasteIt/stdafx.cpp +++ /dev/null @@ -1,8 +0,0 @@ -// stdafx.cpp : source file that includes just the standard includes -// PasteIt.pch will be the pre-compiled header -// stdafx.obj will contain the pre-compiled type information - -#include "stdafx.h" - -// TODO: reference any additional headers you need in STDAFX.H -// and not in this file diff --git a/plugins/PasteIt/stdafx.h b/plugins/PasteIt/stdafx.h index 0089cbb943..2be1eff36d 100644 --- a/plugins/PasteIt/stdafx.h +++ b/plugins/PasteIt/stdafx.h @@ -21,8 +21,7 @@ #include #include -#define MIRANDA_VER 0x0700 -#define MIRANDA_CUSTOM_LP +#define MIRANDA_VER 0x0A00 #include #include @@ -40,5 +39,4 @@ #include #include -#include "sdk/m_msg_buttonsbar.h" -#include "sdk/m_updater.h" +#include "m_msg_buttonsbar.h" -- cgit v1.2.3