From 78d71d2cad6f243c6ff31d41380b8c5b58407de5 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Thu, 17 May 2012 17:37:22 +0000 Subject: added some plugins git-svn-id: http://svn.miranda-ng.org/main/trunk@20 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/UserGuide/UserGuide_10.sln | 25 +++ plugins/UserGuide/UserGuide_10.vcxproj | 285 +++++++++++++++++++++++++ plugins/UserGuide/UserGuide_10.vcxproj.filters | 27 +++ plugins/UserGuide/commonheaders.h | 10 + plugins/UserGuide/main.c | 130 +++++++++++ 5 files changed, 477 insertions(+) create mode 100644 plugins/UserGuide/UserGuide_10.sln create mode 100644 plugins/UserGuide/UserGuide_10.vcxproj create mode 100644 plugins/UserGuide/UserGuide_10.vcxproj.filters create mode 100644 plugins/UserGuide/commonheaders.h create mode 100644 plugins/UserGuide/main.c (limited to 'plugins/UserGuide') diff --git a/plugins/UserGuide/UserGuide_10.sln b/plugins/UserGuide/UserGuide_10.sln new file mode 100644 index 0000000000..6e11d96610 --- /dev/null +++ b/plugins/UserGuide/UserGuide_10.sln @@ -0,0 +1,25 @@ +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UserGuide", "UserGuide_10.vcxproj", "{92E3BDEE-DD17-4619-AD61-70C0ADE04217}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {92E3BDEE-DD17-4619-AD61-70C0ADE04217}.Debug|Win32.ActiveCfg = Debug|Win32 + {92E3BDEE-DD17-4619-AD61-70C0ADE04217}.Debug|Win32.Build.0 = Debug|Win32 + {92E3BDEE-DD17-4619-AD61-70C0ADE04217}.Debug|x64.ActiveCfg = Debug|x64 + {92E3BDEE-DD17-4619-AD61-70C0ADE04217}.Debug|x64.Build.0 = Debug|x64 + {92E3BDEE-DD17-4619-AD61-70C0ADE04217}.Release|Win32.ActiveCfg = Release|Win32 + {92E3BDEE-DD17-4619-AD61-70C0ADE04217}.Release|Win32.Build.0 = Release|Win32 + {92E3BDEE-DD17-4619-AD61-70C0ADE04217}.Release|x64.ActiveCfg = Release|x64 + {92E3BDEE-DD17-4619-AD61-70C0ADE04217}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/plugins/UserGuide/UserGuide_10.vcxproj b/plugins/UserGuide/UserGuide_10.vcxproj new file mode 100644 index 0000000000..ac05a53d99 --- /dev/null +++ b/plugins/UserGuide/UserGuide_10.vcxproj @@ -0,0 +1,285 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + UserGuide + {92E3BDEE-DD17-4619-AD61-70C0ADE04217} + UserGuide + + + + DynamicLibrary + false + MultiByte + + + DynamicLibrary + false + MultiByte + + + DynamicLibrary + false + MultiByte + true + + + DynamicLibrary + false + MultiByte + true + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.40219.1 + $(SolutionDir)$(Configuration)/Plugins\ + $(SolutionDir)$(Configuration)64/Plugins\ + false + false + $(SolutionDir)$(Configuration)/Plugins\ + $(SolutionDir)$(Configuration)64/Plugins\ + $(SolutionDir)$(Configuration)/Obj/$(ProjectName)\ + $(SolutionDir)$(Configuration)64/Obj/$(ProjectName)\ + true + true + $(SolutionDir)$(Configuration)/Obj/$(ProjectName)\ + $(SolutionDir)$(Configuration)64/Obj/$(ProjectName)\ + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + Win32 + .\Release/UserGuide.tlb + + + + + Full + AnySuitable + true + Size + false + false + true + ../../include;../ExternalAPI;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USRDLL;UserGuide_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + MultiThreadedDLL + true + + + Level3 + true + + + NDEBUG;%(PreprocessorDefinitions) + 0x0419 + + + true + false + $(IntDir)UserGuide.pdb + false + + + $(IntDir)$(TargetName).lib + MachineX86 + true + true + + + $(IntDir)$(TargetName).xml + + + true + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + .\Release/UserGuide.tlb + + + + + Full + AnySuitable + true + Size + false + false + true + ../../include;../ExternalAPI;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USRDLL;UserGuide_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + MultiThreadedDLL + true + + + Level3 + true + + + NDEBUG;%(PreprocessorDefinitions) + 0x0419 + + + true + false + $(IntDir)UserGuide.pdb + false + + + $(IntDir)$(TargetName).lib + true + true + + + $(IntDir)$(TargetName).xml + + + true + + + + + _DEBUG;%(PreprocessorDefinitions) + true + true + Win32 + .\Debug/UserGuide.tlb + + + + + Disabled + ../../include;../ExternalAPI;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;UserGuide_EXPORTS;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + true + Level3 + true + EditAndContinue + + + _DEBUG;%(PreprocessorDefinitions) + 0x0419 + + + true + true + $(IntDir)UserGuide.pdb + false + + + $(IntDir)$(TargetName).lib + MachineX86 + + + $(IntDir)$(TargetName).xml + + + true + + + + + _DEBUG;%(PreprocessorDefinitions) + true + true + .\Debug/UserGuide.tlb + + + + + Disabled + ../../include;../ExternalAPI;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;UserGuide_EXPORTS;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebug + true + Level3 + true + ProgramDatabase + + + _DEBUG;%(PreprocessorDefinitions) + 0x0419 + + + true + true + $(IntDir)UserGuide.pdb + false + + + $(IntDir)$(TargetName).lib + + + $(IntDir)$(TargetName).xml + + + true + + + + + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + + + + + + + + + \ No newline at end of file diff --git a/plugins/UserGuide/UserGuide_10.vcxproj.filters b/plugins/UserGuide/UserGuide_10.vcxproj.filters new file mode 100644 index 0000000000..a9fe7c62a4 --- /dev/null +++ b/plugins/UserGuide/UserGuide_10.vcxproj.filters @@ -0,0 +1,27 @@ + + + + + {dcd1a3fe-3ade-453c-9845-9cb074da6b5b} + cpp;c;cxx;rc;def;r;odl;idl;hpj;bat + + + {72da96a4-67f9-49cc-94d3-6730544c949f} + h;hpp;hxx;hm;inl + + + {34beb523-18cd-4f3d-85db-ec309fbf1d1a} + ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe + + + + + Source Files + + + + + Header Files + + + \ No newline at end of file diff --git a/plugins/UserGuide/commonheaders.h b/plugins/UserGuide/commonheaders.h new file mode 100644 index 0000000000..4f7479c2ef --- /dev/null +++ b/plugins/UserGuide/commonheaders.h @@ -0,0 +1,10 @@ +#include +#include +#include +#include +#include +#include +#include +#include + +#define MIID_USERGUIDE {0x297ec1e7, 0x41b7, 0x41f9, { 0xbb, 0x91, 0xef, 0xa9, 0x50, 0x28, 0xf1, 0x6c }} //297ec1e7-41b7-41f9-bb91-efa95028f16c diff --git a/plugins/UserGuide/main.c b/plugins/UserGuide/main.c new file mode 100644 index 0000000000..853658300c --- /dev/null +++ b/plugins/UserGuide/main.c @@ -0,0 +1,130 @@ +#include "commonheaders.h" + +struct MM_INTERFACE mmi; +HINSTANCE hInst; +PLUGINLINK *pluginLink; +HANDLE hModulesLoaded; + +PLUGININFOEX pluginInfo={ + sizeof(PLUGININFOEX), + "User Guide Plugin", + PLUGIN_MAKE_VERSION(0,0,0,1), + "This plug-in adds the main menu item used to view miranda-im pack user guide.", + "Yasnovidyashii", + "yasnovidyashii@gmail.com", + "© 2009 Mikhail Yuriev", + "http://miranda-im.org/", + 0, //not transient + 0, //doesn't replace anything built-in + // Generate your own unique id for your plugin. + // Do not use this UUID! + // Use uuidgen.exe to generate the uuuid + MIID_USERGUIDE +}; + +static INT_PTR ShowGuideFile(WPARAM wParam,LPARAM lParam) +{ + DBVARIANT dbv = {0}; + int iRes; + + LPCSTR pszEmptySting=""; + LPSTR pszDirName, pszDirNameEx, pszFileName,pszDivider; + + REPLACEVARSDATA dat = {0}; + dat.cbSize = sizeof( dat ); + dat.dwFlags = 0; + + pszDirName=(LPSTR)mir_alloc(250*sizeof(CHAR)); + pszFileName=(LPSTR)mir_alloc(250*sizeof(CHAR)); + + iRes = DBGetContactSettingString(NULL,"UserGuide","PathToHelpFile",&dbv); + + if (iRes!=0) + { + strcpy(pszDirName, "%miranda_path%\\Plugins"); + strcpy(pszFileName, "UserGuide.chm"); + } + else + if(strcmp((dbv.pszVal),pszEmptySting)==0) + { + strcpy(pszDirName, "%miranda_path%\\Plugins"); + strcpy(pszFileName, "UserGuide.chm"); + mir_free(dbv.pszVal); + } + else + { + pszDivider = strrchr(dbv.pszVal, '\\'); + if (pszDivider == NULL) + { + pszDirName = ""; + strncpy(pszFileName, dbv.pszVal, strlen(dbv.pszVal) ); + } + else + { + strncpy(pszFileName, pszDivider+1, strlen(dbv.pszVal)-strlen(pszDivider)-1); + pszFileName[strlen(dbv.pszVal)-strlen(pszDivider)-1] = 0; + strncpy(pszDirName, dbv.pszVal, pszDivider-dbv.pszVal); + pszDirName[pszDivider-dbv.pszVal] = 0; + } + mir_free(dbv.pszVal); + } + if (ServiceExists(MS_UTILS_REPLACEVARS)) + pszDirNameEx = (char *) CallService(MS_UTILS_REPLACEVARS,(WPARAM)pszDirName,(LPARAM)&dat); + else + pszDirNameEx = mir_strdup(pszDirName); + + ShellExecuteA(NULL,"open",pszFileName,NULL,pszDirNameEx,SW_SHOW); + mir_free(pszDirName); + mir_free(pszFileName); + mir_free(pszDirNameEx); + return 0; +} + +int ModulesLoaded(WPARAM wParam,LPARAM lParam) +{ + CLISTMENUITEM mi; + + CreateServiceFunction("UserGuide/ShowGuide",ShowGuideFile); + ZeroMemory(&mi,sizeof(mi)); + mi.cbSize=sizeof(mi); + mi.position=500000; + mi.flags=0; + mi.hIcon=LoadSkinnedIcon(SKINICON_OTHER_HELP); + mi.pszName=LPGEN("User Guide"); + mi.pszService="UserGuide/ShowGuide"; + CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&mi); + + return 0; +} + +BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved) +{ + hInst=hinstDLL; + return TRUE; +} + + +__declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion) +{ + return &pluginInfo; +} + +static const MUUID interfaces[] = {MIID_USERGUIDE, MIID_LAST}; +__declspec(dllexport) const MUUID* MirandaPluginInterfaces(void) +{ + return interfaces; +} + +int __declspec(dllexport) Load(PLUGINLINK *link) +{ + pluginLink=link; + mir_getMMI(&mmi); + hModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED,ModulesLoaded); + return 0; +} + +int __declspec(dllexport) Unload(void) +{ + UnhookEvent(hModulesLoaded); + return 0; +} \ No newline at end of file -- cgit v1.2.3