summaryrefslogtreecommitdiff
path: root/plugins/WinterSpeak
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-05-17 17:09:50 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-05-17 17:09:50 +0300
commitbce8bc74daf1c5f510404c8bdf956b41fb1c10fc (patch)
tree9879ad5ce5f42087558601af6a6f2827d7df4c39 /plugins/WinterSpeak
parentba1083b4da33ca44a5ae7d90eabbe3d6d340a81e (diff)
WinterSpeak, WhoUsesMyFiles, WhenWasIt, wbOSD, Watrack_MPD -> CMPlugin
Diffstat (limited to 'plugins/WinterSpeak')
-rw-r--r--plugins/WinterSpeak/src/SpeechApi51Lexicon.cpp5
-rw-r--r--plugins/WinterSpeak/src/main.cpp29
-rw-r--r--plugins/WinterSpeak/src/stdafx.h8
3 files changed, 20 insertions, 22 deletions
diff --git a/plugins/WinterSpeak/src/SpeechApi51Lexicon.cpp b/plugins/WinterSpeak/src/SpeechApi51Lexicon.cpp
index 8762265b4f..17794455fc 100644
--- a/plugins/WinterSpeak/src/SpeechApi51Lexicon.cpp
+++ b/plugins/WinterSpeak/src/SpeechApi51Lexicon.cpp
@@ -2,9 +2,6 @@
#include "SpeechApi51Lexicon.h"
#include "SpeechApi51.h"
-
-extern HINSTANCE g_hInst;
-
//------------------------------------------------------------------------------
SpeechApi51Lexicon::SpeechApi51Lexicon(HWND window) : m_parent_window(window), m_window(nullptr)
{
@@ -19,7 +16,7 @@ SpeechApi51Lexicon::~SpeechApi51Lexicon()
bool SpeechApi51Lexicon::display()
{
/* m_window = CreateDialog(
- g_hInst,
+ g_plugin.getInst(),
MAKEINTRESOURCE(IDD_TTS_LEXICON),
m_parent_window,
dialogEvent);
diff --git a/plugins/WinterSpeak/src/main.cpp b/plugins/WinterSpeak/src/main.cpp
index 34b0c95268..cbe678d4c1 100644
--- a/plugins/WinterSpeak/src/main.cpp
+++ b/plugins/WinterSpeak/src/main.cpp
@@ -1,8 +1,7 @@
#include "stdafx.h"
-HINSTANCE g_hInst;
+CMPlugin g_plugin;
int hLangpack;
-DWORD g_mirandaVersion;
SpeakConfig *g_speak_config = nullptr;
SpeakAnnounce *g_speak_announce = nullptr;
@@ -24,6 +23,11 @@ PLUGININFOEX pluginInfo={
{ 0x81e189dc, 0xc251, 0x45f6, { 0x9e, 0xdf, 0xa0, 0xf3, 0xa0, 0x5c, 0x42, 0x48 } }
};
+extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
+{
+ return &pluginInfo;
+}
+
//-----------------------------------------------------------------------------
// Description : External hook
//-----------------------------------------------------------------------------
@@ -68,7 +72,7 @@ int protocolAck(WPARAM, LPARAM lParam)
int dialogOptionsInitialise(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = g_hInst;
+ odp.hInstance = g_plugin.getInst();
odp.szGroup.w = LPGENW("Speak");
odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE;
@@ -95,11 +99,7 @@ int dialogOptionsInitialise(WPARAM wParam, LPARAM)
return 0;
}
-extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
-{
- g_mirandaVersion = mirandaVersion;
- return &pluginInfo;
-}
+/////////////////////////////////////////////////////////////////////////////////////////
extern "C" __declspec(dllexport) int Load(void)
{
@@ -107,7 +107,7 @@ extern "C" __declspec(dllexport) int Load(void)
if (!g_speak_config)
{
- g_speak_config = new SpeakConfig(g_hInst);
+ g_speak_config = new SpeakConfig(g_plugin.getInst());
// expose to allow miranda + plugins to access my speak routines
CreateServiceFunction(MS_SPEAK_STATUS, status);
@@ -116,7 +116,7 @@ extern "C" __declspec(dllexport) int Load(void)
if (!g_speak_announce)
{
- g_speak_announce = new SpeakAnnounce(g_hInst);
+ g_speak_announce = new SpeakAnnounce(g_plugin.getInst());
// tap into contact setting change event
g_event_status_change = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, eventStatusChange);
@@ -135,6 +135,8 @@ extern "C" __declspec(dllexport) int Load(void)
return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" __declspec(dllexport) int Unload(void)
{
UnhookEvent(g_dialog_options_initialise);
@@ -157,10 +159,3 @@ extern "C" __declspec(dllexport) int Unload(void)
return 0;
}
-
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
-{
- DisableThreadLibraryCalls(hinstDLL);
- g_hInst = hinstDLL;
- return TRUE;
-} \ No newline at end of file
diff --git a/plugins/WinterSpeak/src/stdafx.h b/plugins/WinterSpeak/src/stdafx.h
index 79c4a9a1da..44c88cbd35 100644
--- a/plugins/WinterSpeak/src/stdafx.h
+++ b/plugins/WinterSpeak/src/stdafx.h
@@ -8,7 +8,6 @@
#include <memory>
-#define __NO_CMPLUGIN_NEEDED
#include <newpluginapi.h>
#include <m_langpack.h>
#include <m_database.h>
@@ -46,3 +45,10 @@
#include "Subject.h"
#include "SpeechInterface.h"
#include "SpeakConfig.h"
+
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>("speak_config")
+ {}
+};