summaryrefslogtreecommitdiff
path: root/font_service/FontService.cpp
diff options
context:
space:
mode:
authorsje <sje@4f64403b-2f21-0410-a795-97e2b3489a10>2006-11-01 14:34:02 +0000
committersje <sje@4f64403b-2f21-0410-a795-97e2b3489a10>2006-11-01 14:34:02 +0000
commitc9afe68aa201d99fd8651a35e45064b57e4d2699 (patch)
tree7d44aa04d970e15da1b6a56974182155cef17654 /font_service/FontService.cpp
parent31d3a6408d045eadaff094d4c11bf017817743d7 (diff)
git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@5 4f64403b-2f21-0410-a795-97e2b3489a10
Diffstat (limited to 'font_service/FontService.cpp')
-rw-r--r--font_service/FontService.cpp95
1 files changed, 95 insertions, 0 deletions
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;
+}