From c9afe68aa201d99fd8651a35e45064b57e4d2699 Mon Sep 17 00:00:00 2001 From: sje Date: Wed, 1 Nov 2006 14:34:02 +0000 Subject: git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@5 4f64403b-2f21-0410-a795-97e2b3489a10 --- font_service/FontService.cpp | 95 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 font_service/FontService.cpp (limited to 'font_service/FontService.cpp') diff --git a/font_service/FontService.cpp b/font_service/FontService.cpp new file mode 100644 index 0000000..e03e804 --- /dev/null +++ b/font_service/FontService.cpp @@ -0,0 +1,95 @@ +// Copyright Scott Ellis (mail@scottellis.com.au) 2005 +// This software is licenced under the GPL (General Public Licence) +// available at http://www.gnu.org/copyleft/gpl.html + +#include "common.h" +#include "FontService.h" +#include "m_fontservice.h" + +#include "module_fonts.h" + +PLUGININFO pluginInfo={ + sizeof(PLUGININFO), + "FontService", + PLUGIN_MAKE_VERSION(0, 1, 4, 3), + "Provides a UI for font settings, and services to plugins for font control.", + "S. Ellis", + "mail@scottellis.com.au", + "© 2005 S. Ellis", + "www.scottellis.com.au", + 0, + 0 +}; + +HINSTANCE hInstance; +PLUGINLINK *pluginLink; +struct MM_INTERFACE memoryManagerInterface; + +HANDLE hFontReloadEvent, hColourReloadEvent; + +extern "C" FONTSERVICE_API PLUGININFO* MirandaPluginInfo(DWORD mirandaVersion) +{ + return &pluginInfo; +} + +extern "C" BOOL APIENTRY DllMain( HANDLE hModule, + DWORD ul_reason_for_call, + LPVOID lpReserved + ) +{ + hInstance = (HINSTANCE)hModule; + DisableThreadLibraryCalls(hInstance); + return TRUE; +} + + +int ModulesLoaded(WPARAM wParam, LPARAM lParam) { + if(!GetModuleHandle(L"CLIST_MODERN")) + RegisterCListFonts(); + + if(GetModuleHandle(L"SRMM")) + RegisterSRMMFonts(); + if(GetModuleHandle(L"CHAT")) + RegisterChatFonts(); + + return 0; +} + +extern "C" FONTSERVICE_API int Load(PLUGINLINK *link) +{ + pluginLink=link; + memset(&memoryManagerInterface, 0, sizeof(memoryManagerInterface)); + memoryManagerInterface.cbSize = sizeof(memoryManagerInterface); + CallService(MS_SYSTEM_GET_MMI, 0, (LPARAM) & memoryManagerInterface); + + HookEvent(ME_OPT_INITIALISE, OptInit); + + CreateServiceFunction(MS_FONT_REGISTER, RegisterFont); + CreateServiceFunction(MS_FONT_GET, GetFont); + + CreateServiceFunction(MS_COLOUR_REGISTER, RegisterColour); + CreateServiceFunction(MS_COLOUR_GET, GetColour); + + CreateServiceFunction(MS_FONT_REGISTERW, RegisterFontW); + CreateServiceFunction(MS_FONT_GETW, GetFontW); + + CreateServiceFunction(MS_COLOUR_REGISTERW, RegisterColourW); + CreateServiceFunction(MS_COLOUR_GETW, GetColourW); + + hFontReloadEvent = CreateHookableEvent(ME_FONT_RELOAD); + hColourReloadEvent = CreateHookableEvent(ME_COLOUR_RELOAD); + + if(ServiceExists(MS_LANGPACK_GETCODEPAGE)) + code_page = CallService(MS_LANGPACK_GETCODEPAGE, 0, 0); + + // do last for silly dyna plugin + HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded); + return 0; +} + +extern "C" FONTSERVICE_API int Unload(PLUGINLINK *link) +{ + DestroyHookableEvent(hFontReloadEvent); + DestroyHookableEvent(hColourReloadEvent); + return 0; +} -- cgit v1.2.3