diff options
author | Vadim Dashevskiy <watcherhd@gmail.com> | 2013-03-17 13:41:49 +0000 |
---|---|---|
committer | Vadim Dashevskiy <watcherhd@gmail.com> | 2013-03-17 13:41:49 +0000 |
commit | 5e6e1e8838fe7637ef588e0fb080ad07fc5700aa (patch) | |
tree | 2cc32c95da0cf49f8361879eec1fa5a4a4b557d8 /plugins/!NotAdopted | |
parent | 561f00a7d38c61ec30c5898b90766314011d32d8 (diff) |
Winter Speak plugin added (not adopted)
git-svn-id: http://svn.miranda-ng.org/main/trunk@4076 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/!NotAdopted')
58 files changed, 5847 insertions, 0 deletions
diff --git a/plugins/!NotAdopted/WinterSpeak/general/debug/debug.h b/plugins/!NotAdopted/WinterSpeak/general/debug/debug.h new file mode 100644 index 0000000000..a50189cf97 --- /dev/null +++ b/plugins/!NotAdopted/WinterSpeak/general/debug/debug.h @@ -0,0 +1,21 @@ +#ifndef guard_general_debug_debug_h
+#define guard_general_debug_debug_h
+//==============================================================================
+
+//------------------------------------------------------------------------------
+#ifdef _DEBUG
+
+ #include <iostream>
+
+ #define CLASSCERR(string) (std::cerr << this << " " << string << std::endl)
+ #define CERR(string) (std::cerr << " " << string << std::endl)
+
+#else
+
+ #define CLASSCERR(string)
+ #define CERR(string)
+
+#endif
+
+//==============================================================================
+#endif
\ No newline at end of file diff --git a/plugins/!NotAdopted/WinterSpeak/general/debug/debug_file.h b/plugins/!NotAdopted/WinterSpeak/general/debug/debug_file.h new file mode 100644 index 0000000000..1e5c9f7671 --- /dev/null +++ b/plugins/!NotAdopted/WinterSpeak/general/debug/debug_file.h @@ -0,0 +1,94 @@ +#ifndef guard_general_debug_debug_file_h
+#define guard_general_debug_debug_file_h
+//==============================================================================
+// Miranda Speak Plugin, © 2002 Ryan Winter
+//==============================================================================
+
+#ifdef _DEBUG
+//==============================================================================
+
+#include <fstream>
+
+//------------------------------------------------------------------------------
+template <class charT, class traits = std::char_traits<charT> >
+class FileStreamBuf : public std::basic_streambuf<charT, traits>
+{
+ public:
+ FileStreamBuf()
+ :
+ m_output()
+ {
+// m_output.open("speak_output.txt", std::ios_base::app);
+ m_output.open("speak_output.txt");
+ }
+
+ ~FileStreamBuf()
+ {
+ m_output.close();
+ }
+
+ protected:
+ virtual int_type overflow(int_type c)
+ {
+ if (!traits_type::eq_int_type(c, traits_type::eof()))
+ {
+ m_buffer += c;
+
+ if (c == '\n')
+ {
+ m_output << m_buffer.c_str();
+ m_output.flush();
+
+ m_buffer.erase();
+ }
+
+ return c;
+ }
+
+ return traits_type::not_eof(c);
+ }
+
+ private:
+ // assignment and copy are undefined in iostreams and so we hide them.
+ FileStreamBuf(const FileStreamBuf &);
+ FileStreamBuf & operator=(const FileStreamBuf &);
+
+ std::ofstream m_output;
+ std::string m_buffer;
+};
+
+//------------------------------------------------------------------------------
+class DebugFile : public std::ostream
+{
+ public:
+ DebugFile()
+ :
+ std::basic_ostream<char>(&m_stream_buf)
+ {
+ // redirect cerr to our debug window
+ std::cerr = *this;
+ }
+
+ virtual ~DebugFile()
+ {
+ m_stream_buf.pubsync();
+ }
+
+ private:
+ FileStreamBuf<char> m_stream_buf;
+
+ DebugFile(const DebugFile &);
+ DebugFile & operator=(const DebugFile &);
+};
+
+//==============================================================================
+//
+// Summary : Output debug to a file
+//
+// Description : Provides a target to place our debugging information
+//
+//==============================================================================
+
+#endif
+
+#endif
\ No newline at end of file diff --git a/plugins/!NotAdopted/WinterSpeak/general/debug/debug_window.h b/plugins/!NotAdopted/WinterSpeak/general/debug/debug_window.h new file mode 100644 index 0000000000..43f15e4522 --- /dev/null +++ b/plugins/!NotAdopted/WinterSpeak/general/debug/debug_window.h @@ -0,0 +1,111 @@ +#ifndef guard_general_debug_debug_window_h
+#define guard_general_debug_debug_window_h
+//==============================================================================
+// Miranda Speak Plugin, © 2002 Ryan Winter
+//==============================================================================
+
+#ifdef _DEBUG
+//==============================================================================
+
+#include <windows.h>
+
+#include <iostream>
+#include <string>
+
+//------------------------------------------------------------------------------
+template <class charT, class traits = std::char_traits<charT> >
+class WindowStreamBuf : public std::basic_streambuf<charT, traits>
+{
+ public:
+ WindowStreamBuf()
+ {
+ // create the window to put our debug into
+ m_debug_window = CreateWindow(
+ "Listbox",
+ "Debug Window",
+ WS_OVERLAPPEDWINDOW | WS_VSCROLL,
+ 5,
+ 5,
+ 400,
+ 600,
+ (HWND) NULL,
+ (HMENU) NULL,
+ NULL,
+ (LPVOID) NULL);
+
+ ShowWindow(m_debug_window, SW_SHOW);
+ }
+
+ protected:
+ virtual int_type overflow(int_type c)
+ {
+ if (!traits_type::eq_int_type(c, traits_type::eof()))
+ {
+ if (c == '\n')
+ {
+ // add the string to the window
+ SendMessage(m_debug_window, LB_ADDSTRING, 0,
+ (long)m_buffer.c_str());
+
+ // select the last string added
+ int c = SendMessage(m_debug_window, LB_GETCOUNT, 0,
+ (long)m_buffer.c_str());
+ SendMessage(m_debug_window, LB_SETCURSEL, c - 1, 0);
+
+ m_buffer.erase(m_buffer.begin(), m_buffer.end());
+ }
+ else
+ {
+ m_buffer += c;
+ }
+
+ return c;
+ }
+
+ return traits_type::not_eof(c);
+ }
+
+ private:
+ // assignment and copy are undefined in iostreams and so we hide them.
+ WindowStreamBuf(const WindowStreamBuf &);
+ WindowStreamBuf & operator=(const WindowStreamBuf &);
+
+ HWND m_debug_window;
+ std::string m_buffer;
+};
+
+//------------------------------------------------------------------------------
+class DebugWindow : public std::ostream
+{
+ public:
+ DebugWindow()
+ :
+ std::basic_ostream<char>(&m_stream_buf)
+ {
+ // redirect cerr to our debug window
+ std::cerr = *this;
+ }
+
+ virtual ~DebugWindow()
+ {
+ m_stream_buf.pubsync();
+ }
+
+ private:
+ WindowStreamBuf<char> m_stream_buf;
+
+ DebugWindow(const DebugWindow &);
+ DebugWindow & operator=(const DebugWindow &);
+};
+
+//==============================================================================
+//
+// Summary : Create a debug window
+//
+// Description : Provides a target to place our debugging information
+//
+//==============================================================================
+
+#endif
+
+#endif
\ No newline at end of file diff --git a/plugins/!NotAdopted/WinterSpeak/general/general.dsp b/plugins/!NotAdopted/WinterSpeak/general/general.dsp new file mode 100644 index 0000000000..f268d44f9a --- /dev/null +++ b/plugins/!NotAdopted/WinterSpeak/general/general.dsp @@ -0,0 +1,214 @@ +# Microsoft Developer Studio Project File - Name="general" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Static Library" 0x0104
+
+CFG=general - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "general.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "general.mak" CFG="general - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "general - Win32 Release" (based on "Win32 (x86) Static Library")
+!MESSAGE "general - Win32 Debug" (based on "Win32 (x86) Static Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""$/general/vc_project", SKBAAAAA"
+# PROP Scc_LocalPath "."
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "general - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Build\Release"
+# PROP Intermediate_Dir "Build\Release"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O1 /Ob2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0xc09 /d "NDEBUG"
+# ADD RSC /l 0xc09 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+
+!ELSEIF "$(CFG)" == "general - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Build\Debug"
+# PROP Intermediate_Dir "Build\Debug"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /Gi /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /FD /GZ /c
+# SUBTRACT CPP /Fr /YX
+# ADD BASE RSC /l 0xc09 /d "_DEBUG"
+# ADD RSC /l 0xc09 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+
+!ENDIF
+
+# Begin Target
+
+# Name "general - Win32 Release"
+# Name "general - Win32 Debug"
+# Begin Group "Source"
+
+# PROP Default_Filter ""
+# Begin Group "optimize"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\optimise\aggressive_optimise.h
+# End Source File
+# End Group
+# Begin Group "text_to_speech"
+
+# PROP Default_Filter ""
+# Begin Group "speech_api_51"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\text_to_speech\speech_api_51\speech_api_51.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\text_to_speech\speech_api_51\speech_api_51.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\text_to_speech\speech_api_51\speech_api_51_lexicon.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\text_to_speech\speech_api_51\speech_api_51_lexicon.h
+# End Source File
+# End Group
+# Begin Group "speech_api_40a"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\text_to_speech\speech_api_40a\speech_api_40a.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\text_to_speech\speech_api_40a\speech_api_40a.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\text_to_speech\speech_api_40a\speech_api_40a_lexicon.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\text_to_speech\speech_api_40a\speech_api_40a_lexicon.h
+# End Source File
+# End Group
+# Begin Source File
+
+SOURCE=.\text_to_speech\text_to_speech\text_to_speech.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\text_to_speech\text_to_speech\text_to_speech.h
+# End Source File
+# End Group
+# Begin Group "debug"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\debug\debug.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\debug\debug_file.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\debug\debug_window.h
+# End Source File
+# End Group
+# Begin Group "observer"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\observer\observer.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\observer\observer.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\observer\subject.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\observer\subject.h
+# End Source File
+# End Group
+# Begin Group "multimedia"
+
+# PROP Default_Filter ""
+# Begin Group "winamp_2"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\multimedia\winamp_2\winamp_2.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\multimedia\winamp_2\winamp_2.h
+# End Source File
+# End Group
+# End Group
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\general.rc
+# End Source File
+# Begin Source File
+
+SOURCE=.\resource.h
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/plugins/!NotAdopted/WinterSpeak/general/general.dsw b/plugins/!NotAdopted/WinterSpeak/general/general.dsw new file mode 100644 index 0000000000..7c17a5108b --- /dev/null +++ b/plugins/!NotAdopted/WinterSpeak/general/general.dsw @@ -0,0 +1,33 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "general"=.\general.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+ begin source code control
+ "$/general", AIBAAAAA
+ .
+ end source code control
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/plugins/!NotAdopted/WinterSpeak/general/general.rc b/plugins/!NotAdopted/WinterSpeak/general/general.rc new file mode 100644 index 0000000000..9a0dee8466 --- /dev/null +++ b/plugins/!NotAdopted/WinterSpeak/general/general.rc @@ -0,0 +1,104 @@ +//Microsoft Developer Studio generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (Australia) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENA)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_AUS
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_TTS_LEXICON DIALOG DISCARDABLE 0, 0, 262, 186
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+FONT 8, "MS Sans Serif"
+BEGIN
+ CONTROL "List2",IDC_TTS_LEXICON_LIST,"SysListView32",LVS_REPORT |
+ WS_BORDER | WS_TABSTOP,7,7,247,135
+ EDITTEXT IDC_TTS_LEXICON_ORIGINAL,7,147,118,14,ES_AUTOHSCROLL
+ EDITTEXT IDC_TTS_LEXICON_FINAL,131,147,123,14,ES_AUTOHSCROLL
+ PUSHBUTTON "Add",IDC_TTS_LEXICON_ADD,61,164,50,15
+ PUSHBUTTON "Remove",IDC_TTS_LEXICON_REMOVE,116,164,50,15
+ PUSHBUTTON "Test",IDC_TTS_LEXICON_TEST,7,164,50,15
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO DISCARDABLE
+BEGIN
+ IDD_TTS_LEXICON, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 254
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 179
+ HORZGUIDE, 142
+ HORZGUIDE, 147
+ HORZGUIDE, 164
+ END
+END
+#endif // APSTUDIO_INVOKED
+
+#endif // English (Australia) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/plugins/!NotAdopted/WinterSpeak/general/multimedia/winamp_2/winamp_2.cpp b/plugins/!NotAdopted/WinterSpeak/general/multimedia/winamp_2/winamp_2.cpp new file mode 100644 index 0000000000..7ee65580ad --- /dev/null +++ b/plugins/!NotAdopted/WinterSpeak/general/multimedia/winamp_2/winamp_2.cpp @@ -0,0 +1,157 @@ +//==============================================================================
+// General Code, © 2002 Ryan Winter
+//==============================================================================
+ +#include "winamp_2.h" +
+#include <general/debug/debug.h> +
+#include <frontend.h>
+
+namespace
+{
+ const int WINAMP_PLAY = WINAMP_BUTTON2;
+ const int WINAMP_PAUSE = WINAMP_BUTTON3;
+ const int WINAMP_STOP = WINAMP_BUTTON4;
+}
+ +//------------------------------------------------------------------------------ +// public: +//------------------------------------------------------------------------------ +Winamp2::Winamp2()
+ :
+ m_state(PlayState_Unknown) +{ + CLASSCERR("Winamp2::Winamp2");
+} + +//------------------------------------------------------------------------------ +Winamp2::~Winamp2() +{ + CLASSCERR("Winamp2::~Winamp2");
+} +
+//------------------------------------------------------------------------------
+void
+Winamp2::play()
+{
+ CLASSCERR("Winamp2::play");
+
+ HWND handle;
+
+ if (getHandle(handle))
+ {
+ m_state = getState();
+ SendMessage(handle, WM_COMMAND, WINAMP_PLAY, 0);
+ }
+}
+
+//------------------------------------------------------------------------------
+void
+Winamp2::stop()
+{
+ CLASSCERR("Winamp2::stop");
+
+ HWND handle;
+
+ if (getHandle(handle))
+ {
+ m_state = getState();
+ SendMessage(handle, WM_COMMAND, WINAMP_STOP, 0);
+ }
+}
+
+//------------------------------------------------------------------------------
+void
+Winamp2::pause()
+{
+ CLASSCERR("Winamp2::pause");
+
+ HWND handle;
+
+ if (getHandle(handle))
+ {
+ m_state = getState();
+
+ if (PlayState_Playing == m_state)
+ {
+ SendMessage(handle, WM_COMMAND, WINAMP_PAUSE, 0);
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
+Winamp2::PlayState
+Winamp2::restoreState()
+{
+ CLASSCERR("Winamp2::restoreState");
+
+ switch (m_state)
+ {
+ case PlayState_Playing:
+ play();
+ break;
+
+ case PlayState_Stopped:
+ stop();
+ break;
+
+ case PlayState_Paused:
+ pause();
+ break;
+ }
+
+ return m_state;
+}
+
+//------------------------------------------------------------------------------
+// private:
+//------------------------------------------------------------------------------
+bool
+Winamp2::getHandle(HWND &handle)
+{
+ handle = FindWindow("Winamp v1.x", NULL);
+
+ bool ret = true;
+
+ if (NULL == handle)
+ {
+ ret = false;
+ }
+
+ return ret;
+}
+
+//------------------------------------------------------------------------------
+Winamp2::PlayState
+Winamp2::getState()
+{
+ CLASSCERR("Winamp2::getState");
+
+ HWND handle;
+
+ if (getHandle(handle))
+ {
+ int state = SendMessage(handle, WM_WA_IPC, 0, IPC_ISPLAYING);
+
+ switch (state)
+ {
+ case 0:
+ return PlayState_Stopped;
+ break;
+
+ case 1:
+ return PlayState_Playing;
+ break;
+
+ case 3:
+ return PlayState_Paused;
+ break;
+ }
+ }
+
+ return PlayState_Unknown;
+}
+ +//============================================================================== + diff --git a/plugins/!NotAdopted/WinterSpeak/general/multimedia/winamp_2/winamp_2.h b/plugins/!NotAdopted/WinterSpeak/general/multimedia/winamp_2/winamp_2.h new file mode 100644 index 0000000000..372d1e38d9 --- /dev/null +++ b/plugins/!NotAdopted/WinterSpeak/general/multimedia/winamp_2/winamp_2.h @@ -0,0 +1,62 @@ +#ifndef guard_general_multimedia_winamp_2_winamp_2_h +#define guard_general_multimedia_winamp_2_winamp_2_h +//==============================================================================
+// General Code, © 2002 Ryan Winter
+//==============================================================================
+
+#include <windows.h>
+ +class Winamp2 +{ + public: + Winamp2(); + ~Winamp2();
+
+ enum PlayState
+ {
+ PlayState_Unknown,
+ PlayState_Stopped,
+ PlayState_Playing,
+ PlayState_Paused,
+ };
+
+ //--------------------------------------------------------------------------
+ // Description : play/pause/stop the current song
+ //--------------------------------------------------------------------------
+ void play();
+ void stop();
+ void pause();
+
+ //--------------------------------------------------------------------------
+ // Description : restore winamp to its previoud play state
+ // Return : the play state winamp has been restored to
+ //--------------------------------------------------------------------------
+ PlayState restoreState();
+
+ private:
+ //--------------------------------------------------------------------------
+ // Description : get the handle to the winamp application
+ // Parameters : handle - where to place the handle
+ // Returns : true - the handle was found
+ // false - the handle wasn't found
+ //--------------------------------------------------------------------------
+ bool getHandle(HWND &handle);
+
+ //--------------------------------------------------------------------------
+ // Description : get the current state of the winamp application
+ //--------------------------------------------------------------------------
+ PlayState getState();
+
+ PlayState m_state; +}; + +//==============================================================================
+//
+// Summary : Control Winamp 2.x
+//
+// Description : Allows remote control over numberous winamp 2.x setting
+// including volume, play, pause, stop etc.
+//
+//==============================================================================
+ +#endif diff --git a/plugins/!NotAdopted/WinterSpeak/general/observer/observer.cpp b/plugins/!NotAdopted/WinterSpeak/general/observer/observer.cpp new file mode 100644 index 0000000000..99e0b3a081 --- /dev/null +++ b/plugins/!NotAdopted/WinterSpeak/general/observer/observer.cpp @@ -0,0 +1,19 @@ +//==============================================================================
+// General Code, © 2002 Ryan Winter
+//==============================================================================
+ +#include "observer.h" +
+#include "subject.h" +
+#include <general/debug/debug.h>
+ +//------------------------------------------------------------------------------ +// public: +//------------------------------------------------------------------------------ +Observer::~Observer()
+{
+ CLASSCERR("Observer::~Observer");
+}
+
+//============================================================================== diff --git a/plugins/!NotAdopted/WinterSpeak/general/observer/observer.h b/plugins/!NotAdopted/WinterSpeak/general/observer/observer.h new file mode 100644 index 0000000000..9f93ea91f1 --- /dev/null +++ b/plugins/!NotAdopted/WinterSpeak/general/observer/observer.h @@ -0,0 +1,30 @@ +#ifndef guard_general_observer_observer_observer_h +#define guard_general_observer_observer_observer_h +//==============================================================================
+// General Code, © 2002 Ryan Winter
+//==============================================================================
+ +class Subject; +
+class Observer +{ + public: + virtual ~Observer(); + + //-------------------------------------------------------------------------- + // Description : Called by a subject that this observer is observing
+ // to signify a change in state
+ // Parameters : subject - the subject that changed + //-------------------------------------------------------------------------- + virtual void update(Subject &subject) = 0; +}; +
+//==============================================================================
+//
+// Summary : Observer side of the observer pattern
+//
+// Description :
+//
+//==============================================================================
+ +#endif diff --git a/plugins/!NotAdopted/WinterSpeak/general/observer/subject.cpp b/plugins/!NotAdopted/WinterSpeak/general/observer/subject.cpp new file mode 100644 index 0000000000..e28c66c44b --- /dev/null +++ b/plugins/!NotAdopted/WinterSpeak/general/observer/subject.cpp @@ -0,0 +1,77 @@ +//==============================================================================
+// General Code, © 2002 Ryan Winter
+//==============================================================================
+ +#include "subject.h" +
+#include <general/debug/debug.h> + +//------------------------------------------------------------------------------ +// public: +//------------------------------------------------------------------------------ +Subject::Subject() + :
+ m_observer_list() +{ + CLASSCERR("Subject::Subject"); +} + +//------------------------------------------------------------------------------ +Subject::~Subject() +{ + CLASSCERR("Subject::~Subject"); +} + +//------------------------------------------------------------------------------ +void +Subject::notify() +{ + CLASSCERR("Subject::notify"); + + // call update for all observers in the list + for (std::list<Observer *>::iterator iter = m_observer_list.begin();
+ iter != m_observer_list.end();
+ ++iter)
+ {
+ (*iter)->update(*this);
+ }
+} + +//------------------------------------------------------------------------------ +void +Subject::attach(Observer &observer) +{ + CLASSCERR("Subject::attach(" << &observer << ")"); + + for (std::list<Observer *>::iterator iter = m_observer_list.begin();
+ iter != m_observer_list.end();
+ ++iter)
+ {
+ if (*iter == &observer)
+ {
+ return;
+ }
+ }
+
+ m_observer_list.push_back(&observer);
+} + +//------------------------------------------------------------------------------ +void +Subject::detach(const Observer &observer) +{ + CLASSCERR("Subject::detach(" << &observer << ")"); +
+ for (std::list<Observer *>::iterator iter = m_observer_list.begin();
+ iter != m_observer_list.end();
+ ++iter)
+ {
+ if (*iter == &observer)
+ {
+ m_observer_list.erase(iter);
+ }
+ }
+}
+ +//============================================================================== + diff --git a/plugins/!NotAdopted/WinterSpeak/general/observer/subject.h b/plugins/!NotAdopted/WinterSpeak/general/observer/subject.h new file mode 100644 index 0000000000..a086e80765 --- /dev/null +++ b/plugins/!NotAdopted/WinterSpeak/general/observer/subject.h @@ -0,0 +1,52 @@ +#ifndef guard_general_observer_subject_h +#define guard_general_observer_subject_h +//==============================================================================
+// General Code, © 2002 Ryan Winter
+//==============================================================================
+ +#include "observer.h"
+
+#include <list>
+ +class Subject +{ + public: + Subject(); + virtual ~Subject(); + + //-------------------------------------------------------------------------- + // Description : Notify all observers of a state change
+ //-------------------------------------------------------------------------- + void notify(); + + //-------------------------------------------------------------------------- + // Description : Attach an observer to the subject
+ // Parameters : observer - the observer + //-------------------------------------------------------------------------- + void attach(Observer &observer); + + //-------------------------------------------------------------------------- + // Description : Detach an observer from the subject
+ // Parameters : observer - the observer + //-------------------------------------------------------------------------- + void detach(const Observer &observer); +
+ private: + //-------------------------------------------------------------------------- + // Description : Disallow assignment operator and copy constructor
+ //-------------------------------------------------------------------------- + Subject(const Subject &rhs); + const Subject & operator=(const Subject &rhs); + + std::list<Observer *> m_observer_list;
+}; + +//==============================================================================
+//
+// Summary : Subject side of the observer pattern
+//
+// Description : Instances of this class are what is observered by observers
+//
+//==============================================================================
+ +#endif diff --git a/plugins/!NotAdopted/WinterSpeak/general/optimise/aggressive_optimise.h b/plugins/!NotAdopted/WinterSpeak/general/optimise/aggressive_optimise.h new file mode 100644 index 0000000000..6494bf6eb9 --- /dev/null +++ b/plugins/!NotAdopted/WinterSpeak/general/optimise/aggressive_optimise.h @@ -0,0 +1,29 @@ +#ifndef guard_aggressive_optimise_h
+#define guard_aggressive_optimise_h
+//==============================================================================
+// General Code, © 2002 Ryan Winter
+//==============================================================================
+
+#ifdef NDEBUG
+
+// we define the WIN32_LEAN_AND_MEAN tag so that the quick windows
+// macros and functions are used. Using this should make a slight
+// performance improvement (even though we probably won't see it
+// in this program).
+#define WIN32_LEAN_AND_MEAN
+
+#pragma comment(linker,"/RELEASE")
+#pragma comment(linker,"/FILEALIGN:0x200")
+
+#endif
+
+//==============================================================================
+//
+// Summary : aggresively optimise the binary for size
+//
+// Description : uses various linker switches to decrease the size of the
+// binary
+//
+//==============================================================================
+
+#endif
\ No newline at end of file diff --git a/plugins/!NotAdopted/WinterSpeak/general/resource.h b/plugins/!NotAdopted/WinterSpeak/general/resource.h new file mode 100644 index 0000000000..cd10886cff --- /dev/null +++ b/plugins/!NotAdopted/WinterSpeak/general/resource.h @@ -0,0 +1,22 @@ +//{{NO_DEPENDENCIES}}
+// Microsoft Developer Studio generated include file.
+// Used by general.rc
+//
+#define IDD_TTS_LEXICON 201
+#define IDC_TTS_LEXICON_LIST 2001
+#define IDC_TTS_LEXICON_ORIGINAL 2002
+#define IDC_TTS_LEXICON_FINAL 2003
+#define IDC_TTS_LEXICON_ADD 2004
+#define IDC_TTS_LEXICON_REMOVE 2005
+#define IDC_TTS_LEXICON_TEST 2006
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 202
+#define _APS_NEXT_COMMAND_VALUE 42001
+#define _APS_NEXT_CONTROL_VALUE 2007
+#define _APS_NEXT_SYMED_VALUE 202
+#endif
+#endif
diff --git a/plugins/!NotAdopted/WinterSpeak/general/text_to_speech/speech_api_40a/speech_api_40a.cpp b/plugins/!NotAdopted/WinterSpeak/general/text_to_speech/speech_api_40a/speech_api_40a.cpp new file mode 100644 index 0000000000..4c0a82c9e5 --- /dev/null +++ b/plugins/!NotAdopted/WinterSpeak/general/text_to_speech/speech_api_40a/speech_api_40a.cpp @@ -0,0 +1,327 @@ +//==============================================================================
+// General Code, © 2002 Ryan Winter
+//==============================================================================
+
+#pragma warning(disable:4786)
+
+#include "speech_api_40a.h"
+#include "speech_api_40a_lexicon.h"
+
+#include <general/debug/debug.h>
+
+#include <windows.h>
+#include <initguid.h>
+#include <speech.h>
+
+#include <sstream>
+#include <memory>
+
+//------------------------------------------------------------------------------
+SpeechApi40a::SpeechApi40a()
+ :
+ m_tts_central(0),
+ m_tts_attribs(0),
+ m_state(TextToSpeech::State_Unloaded),
+ m_voice(""),
+ m_volume(50),
+ m_pitch(50),
+ m_rate(50)
+{
+ CLASSCERR("SpeechApi40a::SpeechApi40a");
+}
+
+//------------------------------------------------------------------------------
+SpeechApi40a::~SpeechApi40a()
+{
+ CLASSCERR("SpeechApi40a::~SpeechApi40a");
+
+ unload();
+
+ CoUninitialize();
+}
+
+//------------------------------------------------------------------------------
+bool
+SpeechApi40a::isAvailable()
+{
+ CLASSCERR("SpeechApi40a::isAvailable");
+
+ CoInitialize(NULL);
+
+ PITTSENUM pITTSEnum;
+ bool ret = true;
+
+ // create the enumerator
+ if (FAILED(CoCreateInstance(CLSID_TTSEnumerator, NULL, CLSCTX_ALL,
+ IID_ITTSEnum, (void**)&pITTSEnum)))
+ {
+ ret = false;
+ }
+ else
+ {
+ pITTSEnum->Release();
+ }
+
+ CLASSCERR("SpeechApi40a::isAvailable return " << (ret?"T":"F"));
+ return ret;
+}
+
+//------------------------------------------------------------------------------
+bool
+SpeechApi40a::load()
+{
+ CLASSCERR("SpeechApi40a::load");
+
+ if (isLoaded())
+ {
+ return true;
+ }
+
+ return loadWithVoice(std::string(m_voice));
+}
+
+//------------------------------------------------------------------------------
+bool
+SpeechApi40a::unload()
+{
+ CLASSCERR("SpeechApi40a::unload");
+
+ if (m_tts_attribs)
+ {
+ m_tts_attribs->Release();
+ m_tts_attribs = 0;
+ }
+
+ if (m_tts_central)
+ {
+ m_tts_central->Release();
+ m_tts_central = 0;
+ }
+
+ m_state = TextToSpeech::State_Unloaded;
+
+ return true;
+}
+
+//------------------------------------------------------------------------------
+bool
+SpeechApi40a::isLoaded() const
+{
+ return (TextToSpeech::State_Loaded == m_state);
+}
+
+//------------------------------------------------------------------------------
+bool
+SpeechApi40a::say(const std::string &sentence)
+{
+ CLASSCERR("SpeechApi40a::say(" << sentence << ")");
+
+ bool ret = true;
+
+ if (!isLoaded())
+ {
+ ret = false;
+ }
+ else
+ {
+ SDATA data;
+ data.dwSize = sentence.size();
+ data.pData = (char *)sentence.c_str();
+ m_tts_central->TextData(CHARSET_TEXT, 0, data, NULL, IID_ITTSBufNotifySinkA);
+ }
+
+ CLASSCERR("SpeechApi40a::say() return " << (ret?"T":"F"));
+ return ret;
+}
+
+//------------------------------------------------------------------------------
+bool
+SpeechApi40a::setVolume(int volume)
+{
+ m_volume = volume;
+
+ if (!isLoaded())
+ {
+ return true;
+ }
+
+ DWORD new_vol = volume / 100.0 * 0xffff;
+ new_vol |= new_vol << 16;
+
+ if (FAILED(m_tts_attribs->VolumeSet(new_vol)))
+ {
+ CLASSCERR("SpeechApi40a::setVolume() failed");
+ return false;
+ }
+
+ return true;
+}
+
+//------------------------------------------------------------------------------
+bool
+SpeechApi40a::setPitch(int pitch)
+{
+ m_pitch = pitch;
+
+ // valid range is 50 to 350
+ if (isLoaded() && FAILED(m_tts_attribs->PitchSet(pitch * 3.0 + 50)))
+ {
+ return false;
+ }
+
+ return true;
+}
+
+//------------------------------------------------------------------------------
+bool
+SpeechApi40a::setRate(int rate)
+{
+ m_rate = rate;
+
+ // valid range is 50 to 350
+ if (isLoaded() && FAILED(m_tts_attribs->SpeedSet(rate * 3.0 + 50)))
+ {
+ return false;
+ }
+
+ return true;
+}
+
+//------------------------------------------------------------------------------
+bool
+SpeechApi40a::setVoice(const std::string &voice)
+{
+ CLASSCERR("SpeechApi40a::setVoice(" << voice << ")");
+
+ m_voice = voice;
+
+ if (!isLoaded())
+ {
+ return true;
+ }
+
+ unload();
+ return load();
+}
+
+//------------------------------------------------------------------------------
+std::vector<std::string>
+SpeechApi40a::getVoices() const
+{
+ CLASSCERR("SpeechApi40a::getVoice");
+
+ std::vector<std::string> ret;
+
+ PITTSENUM pITTSEnum = NULL;
+ TTSMODEINFO inf;
+
+ CoInitialize(NULL);
+
+ if (FAILED(CoCreateInstance(CLSID_TTSEnumerator, NULL, CLSCTX_ALL,
+ IID_ITTSEnum, (void**)&pITTSEnum)))
+ {
+ CLASSCERR("SpeechApi40a::getVoice failed to create enum");
+ return ret;
+ }
+
+ while (!pITTSEnum->Next(1, &inf, NULL))
+ {
+ ret.push_back(inf.szModeName);
+ }
+
+ pITTSEnum->Release();
+
+ CLASSCERR("SpeechApi40a::getVoice return");
+ return ret;
+}
+
+//------------------------------------------------------------------------------
+bool
+SpeechApi40a::lexiconDialog(HWND window)
+{
+ CLASSCERR("SpeechApi40a::lexiconDialog");
+
+ // open the dialog
+ SpeechApi40aLexicon dialog(window, m_tts_central);
+
+ if (!dialog.display())
+ {
+ return false;
+ }
+
+ return true;
+}
+
+//------------------------------------------------------------------------------
+std::string
+SpeechApi40a::getDescription()
+{
+ CERR("SpeechApi40a::getDescription");
+
+ return "Microsoft SAPI v4.0";
+}
+
+//------------------------------------------------------------------------------
+// private:
+//------------------------------------------------------------------------------
+bool
+SpeechApi40a::loadWithVoice(std::string &voice)
+{
+ CLASSCERR("SpeechApi40a::loadWithVoice(" << voice << ")");
+
+ CoInitialize(NULL);
+
+ PITTSENUM pITTSEnum;
+ TTSMODEINFO inf;
+ LPUNKNOWN pAudioDest;
+
+ // create the enumerator
+ if (FAILED(CoCreateInstance(CLSID_TTSEnumerator, NULL, CLSCTX_ALL,
+ IID_ITTSEnum, (void**)&pITTSEnum)))
+ {
+ CLASSCERR("SpeechApi40a::createTtsEngine() failed to create enum");
+ return false;
+ }
+
+ // iterate through the voices until we find the right one
+ while (!pITTSEnum->Next(1, &inf, NULL))
+ {
+ if (inf.szModeName == voice)
+ {
+ break;
+ }
+ }
+
+ if (FAILED(CoCreateInstance(CLSID_MMAudioDest, NULL, CLSCTX_ALL,
+ IID_IAudioMultiMediaDevice, (void**)&pAudioDest)))
+ {
+ CLASSCERR("SpeechApi40a::createTtsEngine() failed to create audio dest");
+ pITTSEnum->Release();
+ return false;
+ }
+
+ // select that voice
+ if (FAILED(pITTSEnum->Select(inf.gModeID, &m_tts_central, pAudioDest)))
+ {
+ CLASSCERR("SpeechApi40a::createTtsEngine() failed to select voice");
+ pITTSEnum->Release();
+ return NULL;
+ }
+
+ m_tts_central->QueryInterface(IID_ITTSAttributes, (LPVOID *)&m_tts_attribs);
+
+ pITTSEnum->Release();
+
+ // we made it
+ m_state = TextToSpeech::State_Loaded;
+
+ // configure the new voice
+ setVolume(m_volume);
+ setRate(m_rate);
+ setPitch(m_pitch);
+
+ CLASSCERR("SpeechApi40a::loadWithVoice() return successful");
+ return true;
+}
+
+//------------------------------------------------------------------------------
diff --git a/plugins/!NotAdopted/WinterSpeak/general/text_to_speech/speech_api_40a/speech_api_40a.h b/plugins/!NotAdopted/WinterSpeak/general/text_to_speech/speech_api_40a/speech_api_40a.h new file mode 100644 index 0000000000..4d3a40abb4 --- /dev/null +++ b/plugins/!NotAdopted/WinterSpeak/general/text_to_speech/speech_api_40a/speech_api_40a.h @@ -0,0 +1,103 @@ +#ifndef guard_general_text_to_speech_speech_api_40a_speech_api_40_h
+#define guard_general_text_to_speech_speech_api_40a_speech_api_40_h
+//==============================================================================
+// General Code, © 2002 Ryan Winter
+//==============================================================================
+
+#include <general/text_to_speech/text_to_speech/text_to_speech.h>
+
+struct ITTSCentralA;
+struct ITTSAttributesA;
+
+class SpeechApi40a : public TextToSpeech
+{
+ public:
+ SpeechApi40a();
+ virtual ~SpeechApi40a();
+
+ //--------------------------------------------------------------------------
+ // Description : is the api available for use
+ // Return : true - it is available
+ // false - it is not available
+ //--------------------------------------------------------------------------
+ virtual bool isAvailable();
+
+ //--------------------------------------------------------------------------
+ // Description : load/unload/reload the speech api
+ // Return : true - the action succeeded
+ // false - the action failed
+ //--------------------------------------------------------------------------
+ virtual bool load();
+ virtual bool unload();
+
+ //--------------------------------------------------------------------------
+ // Description : check if the speech api is loaded
+ // Return : true - the speech_api is loaded
+ // false - its not loaded
+ //--------------------------------------------------------------------------
+ virtual bool isLoaded() const;
+
+ //--------------------------------------------------------------------------
+ // Description : speak a sentence
+ // Parameters : sentence - the sentence to speak
+ // Returns : true - speak successful
+ // false - speak failed
+ //--------------------------------------------------------------------------
+ virtual bool say(const std::string &sentence);
+
+ //--------------------------------------------------------------------------
+ // Description : set the voice settings
+ // Parameters : range from 0 to 100
+ //--------------------------------------------------------------------------
+ virtual bool setVolume(int volume);
+ virtual bool setPitch(int pitch);
+ virtual bool setRate(int rate);
+
+ //--------------------------------------------------------------------------
+ // Description : set the voice
+ //--------------------------------------------------------------------------
+ virtual bool setVoice(const std::string &voice);
+
+ //--------------------------------------------------------------------------
+ // Description : get the available voices
+ //--------------------------------------------------------------------------
+ virtual std::vector<std::string> getVoices() const;
+
+ //--------------------------------------------------------------------------
+ // Description : open the lexicon dialog for this engine
+ // Parameters : window - handle to the parent window
+ // Return : true - dialog completely successfully
+ // false - dialog failed
+ //--------------------------------------------------------------------------
+ virtual bool lexiconDialog(HWND window);
+
+ //--------------------------------------------------------------------------
+ // Description : get the description of the tts engine
+ //--------------------------------------------------------------------------
+ static std::string getDescription();
+
+ private:
+ //--------------------------------------------------------------------------
+ // Description : load the speech api with the specified voice
+ //--------------------------------------------------------------------------
+ bool loadWithVoice(std::string &voice);
+
+ ITTSCentralA *m_tts_central;
+ ITTSAttributesA *m_tts_attribs;
+
+ TextToSpeech::State m_state;
+ std::string m_voice;
+ int m_volume;
+ int m_pitch;
+ int m_rate;
+};
+
+//==============================================================================
+//
+// Summary : API encapsulation
+//
+// Description : This encapsulates the SAPI 4.0a interface
+//
+//==============================================================================
+
+#endif
\ No newline at end of file diff --git a/plugins/!NotAdopted/WinterSpeak/general/text_to_speech/speech_api_40a/speech_api_40a_lexicon.cpp b/plugins/!NotAdopted/WinterSpeak/general/text_to_speech/speech_api_40a/speech_api_40a_lexicon.cpp new file mode 100644 index 0000000000..5dd8bbdb22 --- /dev/null +++ b/plugins/!NotAdopted/WinterSpeak/general/text_to_speech/speech_api_40a/speech_api_40a_lexicon.cpp @@ -0,0 +1,57 @@ +//==============================================================================
+// General Code, © 2002 Ryan Winter
+//==============================================================================
+
+#pragma warning(disable:4786)
+
+#include "speech_api_40a_lexicon.h"
+
+#include <general/debug/debug.h>
+
+#include <windows.h>
+#include <speech.h>
+
+//------------------------------------------------------------------------------
+SpeechApi40aLexicon::SpeechApi40aLexicon(HWND window,
+ ITTSCentralA *tts_central)
+ :
+ m_window(window),
+ m_tts_central(tts_central)
+{
+ CLASSCERR("SpeechApi40aLexicon::SpeechApi40aLexicon");
+}
+
+//------------------------------------------------------------------------------
+SpeechApi40aLexicon::~SpeechApi40aLexicon()
+{
+ CLASSCERR("SpeechApi40aLexicon::~SpeechApi40aLexicon");
+}
+
+//------------------------------------------------------------------------------
+bool
+SpeechApi40aLexicon::display()
+{
+ if (!m_tts_central)
+ {
+ return false;
+ }
+
+ ITTSDialogs *tts_dialogs = 0;
+
+ m_tts_central->QueryInterface(IID_ITTSDialogs, (void**)&tts_dialogs);
+
+ if (!tts_dialogs)
+ {
+ return false;
+ }
+
+ if (NOERROR != tts_dialogs->LexiconDlg(m_window, NULL))
+ {
+ return false;
+ }
+
+ tts_dialogs->Release();
+ return true;
+}
+
+//------------------------------------------------------------------------------
diff --git a/plugins/!NotAdopted/WinterSpeak/general/text_to_speech/speech_api_40a/speech_api_40a_lexicon.h b/plugins/!NotAdopted/WinterSpeak/general/text_to_speech/speech_api_40a/speech_api_40a_lexicon.h new file mode 100644 index 0000000000..8b36a05364 --- /dev/null +++ b/plugins/!NotAdopted/WinterSpeak/general/text_to_speech/speech_api_40a/speech_api_40a_lexicon.h @@ -0,0 +1,44 @@ +#ifndef guard_general_text_to_speech_speech_api_40a_speech_api_40a_lexicon_h
+#define guard_general_text_to_speech_speech_api_40a_speech_api_40a_lexicon_h
+//==============================================================================
+// General Code, © 2002 Ryan Winter
+//==============================================================================
+
+#include <wtypes.h>
+
+struct ITTSCentralA;
+
+class SpeechApi40aLexicon
+{
+ public:
+ //--------------------------------------------------------------------------
+ // Description : Constuctor
+ // Parameters : window - handle to the parent window
+ // tts_central - pointer to the tts_central engine to use
+ //--------------------------------------------------------------------------
+ SpeechApi40aLexicon(HWND window, ITTSCentralA *tts_central);
+
+ ~SpeechApi40aLexicon();
+
+ //--------------------------------------------------------------------------
+ // Description : display the lexicon dialog
+ // Return : true - display ok
+ // false - display failed
+ //--------------------------------------------------------------------------
+ bool display();
+
+ private:
+ HWND m_window;
+ ITTSCentralA *m_tts_central;
+};
+
+//==============================================================================
+//
+// Summary : Lexicon dialog
+//
+// Description : Displays the lexicon dialog for the speech api 4.0a which
+// allows the user to add/remove/edit the user lexicon database
+//
+//==============================================================================
+
+#endif
\ No newline at end of file diff --git a/plugins/!NotAdopted/WinterSpeak/general/text_to_speech/speech_api_51/speech_api_51.cpp b/plugins/!NotAdopted/WinterSpeak/general/text_to_speech/speech_api_51/speech_api_51.cpp new file mode 100644 index 0000000000..4c28167f76 --- /dev/null +++ b/plugins/!NotAdopted/WinterSpeak/general/text_to_speech/speech_api_51/speech_api_51.cpp @@ -0,0 +1,311 @@ +//==============================================================================
+// General Code, © 2002 Ryan Winter
+//==============================================================================
+
+#pragma warning(disable:4786)
+
+#include "speech_api_51.h"
+
+#include <general/debug/debug.h>
+#include <general/text_to_speech/speech_api_51/speech_api_51_lexicon.h>
+
+#include <sapi.h>
+#include <sphelper.h>
+
+#include <sstream>
+#include <memory>
+
+namespace
+{
+
+//------------------------------------------------------------------------------
+// Description : implement callback
+//------------------------------------------------------------------------------
+/*class Sapi51Callback : public ISpNotifyCallback
+{
+ public:
+ Sapi51Callback();
+
+ virtual STDMETHODIMP NotifyCallback(WPARAM wParam, LPARAM lParam)
+ {
+
+ return S_OK;
+ }
+};*/
+
+}
+
+//------------------------------------------------------------------------------
+SpeechApi51::SpeechApi51()
+ :
+ m_sapi(0),
+ m_state(TextToSpeech::State_Unloaded),
+ m_voice(""),
+ m_volume(50),
+ m_pitch(50),
+ m_rate(50)
+{
+ CLASSCERR("SpeechApi51::SpeechApi51");
+}
+
+//------------------------------------------------------------------------------
+SpeechApi51::~SpeechApi51()
+{
+ CLASSCERR("SpeechApi51::~SpeechApi51");
+
+ unload();
+
+ CoUninitialize();
+}
+
+//------------------------------------------------------------------------------
+bool
+SpeechApi51::isAvailable()
+{
+ CLASSCERR("SpeechApi51::isAvailable");
+
+ CoInitialize(NULL);
+
+ ISpVoice *sapi;
+ bool ret = true;
+
+ if (FAILED(CoCreateInstance(CLSID_SpVoice, NULL, CLSCTX_ALL, IID_ISpVoice,
+ reinterpret_cast<void **>(&sapi))))
+ {
+ ret = false;
+ }
+ else
+ {
+ sapi->Release();
+ }
+
+ CLASSCERR("SpeechApi51::isAvailable return " << (ret?"T":"F"));
+ return ret;
+}
+
+//------------------------------------------------------------------------------
+bool
+SpeechApi51::load()
+{
+ CLASSCERR("SpeechApi51::load");
+
+ if (isLoaded())
+ {
+ CLASSCERR("SpeechApi51::load engine already loaded");
+ return true;
+ }
+
+ CoInitialize(NULL);
+
+ if (FAILED(CoCreateInstance(CLSID_SpVoice, NULL, CLSCTX_ALL, IID_ISpVoice,
+ reinterpret_cast<void **>(&m_sapi))))
+ {
+ CLASSCERR("SpeechApi51::load could not initialise sapi");
+ return false;
+ }
+
+ m_state = TextToSpeech::State_Loaded;
+
+ // adjust the volume and rate settings
+ setVoice(m_voice);
+ setVolume(m_volume);
+ setRate(m_rate);
+
+ CLASSCERR("SpeechApi51::load return success");
+ return true;
+}
+
+//------------------------------------------------------------------------------
+bool
+SpeechApi51::unload()
+{
+ CLASSCERR("SpeechApi51::unload");
+
+ if (isLoaded())
+ {
+ m_sapi->Release();
+ m_sapi = 0;
+ }
+
+ m_state = TextToSpeech::State_Unloaded;
+ return true;
+}
+
+//------------------------------------------------------------------------------
+bool
+SpeechApi51::isLoaded() const
+{
+ return (TextToSpeech::State_Loaded == m_state);
+}
+
+//------------------------------------------------------------------------------
+bool
+SpeechApi51::say(const std::string &sentence)
+{
+ CLASSCERR("SpeechApi51::say(" << sentence << ")");
+
+ if (!isLoaded())
+ {
+ CLASSCERR("SpeechApi51::say() engine not loaded");
+ return false;
+ }
+
+ // prepend the pitch setting
+ std::stringstream output;
+ output << "<pitch middle='" << m_pitch << "'/> " << sentence;
+
+ std::auto_ptr<wchar_t> sapi_sentence(new wchar_t[output.str().size() + 1]);
+ mbstowcs(sapi_sentence.get(), output.str().c_str(), output.str().size() + 1);
+
+ // speak the sentence
+ if (FAILED(m_sapi->Speak(sapi_sentence.get(), SPF_IS_XML | SPF_ASYNC, NULL)))
+ {
+ CLASSCERR("SpeechApi51::say() failed to speak sentence");
+ return false;
+ }
+
+ CLASSCERR("SpeechApi51::say() succeeded");
+ return true;
+}
+
+//------------------------------------------------------------------------------
+bool
+SpeechApi51::setVolume(int volume)
+{
+ m_volume = volume;
+
+ if (isLoaded() && FAILED(m_sapi->SetVolume(volume)))
+ {
+ return false;
+ }
+
+ return true;
+}
+
+//------------------------------------------------------------------------------
+bool
+SpeechApi51::setPitch(int pitch)
+{
+ m_pitch = (pitch / 5) - 10;
+
+ return true;
+}
+
+//------------------------------------------------------------------------------
+bool
+SpeechApi51::setRate(int rate)
+{
+ m_rate = rate;
+
+ // convert it to the range -10 to 10
+ if (isLoaded() && FAILED(m_sapi->SetRate((rate / 5.0) - 10)))
+ {
+ return false;
+ }
+
+ return true;
+}
+
+//------------------------------------------------------------------------------
+bool
+SpeechApi51::setVoice(const std::string &voice)
+{
+ CLASSCERR("SpeechApi51::setVoice(" << voice << ")");
+
+ m_voice = voice;
+
+ if (!isLoaded())
+ {
+ CLASSCERR("SpeechApi51::setVoice() engine not loaded");
+ return true;
+ }
+
+ // get a voice enumerator
+ CComPtr<IEnumSpObjectTokens> cpEnum;
+ if (FAILED(SpEnumTokens(SPCAT_VOICES, NULL, NULL, &cpEnum)))
+ {
+ CLASSCERR("SpeechApi51::setVoice failed to load enumerator");
+ return false;
+ }
+
+ // iterate through the list till we find a matching voice
+ ISpObjectToken *voice_token;
+ while (S_OK == cpEnum->Next(1, &voice_token, NULL))
+ {
+ CSpDynamicString voice_str;
+
+ if (SUCCEEDED(SpGetDescription(voice_token, &voice_str))
+ && (voice == voice_str.CopyToChar()))
+ {
+ m_sapi->SetVoice(voice_token);
+ CLASSCERR("SpeechApi51::setVoice() voice found");
+ return true;
+ }
+ }
+
+ CLASSCERR("SpeechApi51::setVoice() voice not found");
+ return false;
+}
+
+//------------------------------------------------------------------------------
+std::vector<std::string>
+SpeechApi51::getVoices() const
+{
+ CLASSCERR("SpeechApi51::getVoices");
+
+ std::vector<std::string> ret;
+
+ CoInitialize(NULL);
+
+ // get a voice enumerator
+ CComPtr<IEnumSpObjectTokens> cpEnum;
+ if (S_OK != SpEnumTokens(SPCAT_VOICES, NULL, NULL, &cpEnum))
+ {
+ CLASSCERR("SpeechApi51::getVoices failed to load enumerator");
+ return ret;
+ }
+
+ // iterate through the voices and add them to the string vector
+ ISpObjectToken *voice_token;
+ while (S_OK == cpEnum->Next(1, &voice_token, NULL))
+ {
+ CSpDynamicString voice_str;
+
+ if (SUCCEEDED(SpGetDescription(voice_token, &voice_str)))
+ {
+ ret.push_back(voice_str.CopyToChar());
+ }
+ }
+
+ CLASSCERR("SpeechApi51::getVoices return");
+ return ret;
+}
+
+
+//------------------------------------------------------------------------------
+bool
+SpeechApi51::lexiconDialog(HWND window)
+{
+ CLASSCERR("SpeechApi51::lexiconDialog");
+
+ // open the dialog
+ SpeechApi51Lexicon dialog(window);
+
+ if (!dialog.display())
+ {
+ return false;
+ }
+
+ return true;
+}
+
+//------------------------------------------------------------------------------
+std::string
+SpeechApi51::getDescription()
+{
+ CERR("SpeechApi51::getDescription");
+
+ return "Microsoft SAPI v5.1";
+}
+
+//------------------------------------------------------------------------------
diff --git a/plugins/!NotAdopted/WinterSpeak/general/text_to_speech/speech_api_51/speech_api_51.h b/plugins/!NotAdopted/WinterSpeak/general/text_to_speech/speech_api_51/speech_api_51.h new file mode 100644 index 0000000000..a6f1fef3e2 --- /dev/null +++ b/plugins/!NotAdopted/WinterSpeak/general/text_to_speech/speech_api_51/speech_api_51.h @@ -0,0 +1,97 @@ +#ifndef guard_general_text_to_speech_speech_api_51_speech_api_51_h
+#define guard_general_text_to_speech_speech_api_51_speech_api_51_h
+//==============================================================================
+// General Code, © 2002 Ryan Winter
+//==============================================================================
+
+#include <general/text_to_speech/text_to_speech/text_to_speech.h>
+
+struct ISpVoice;
+class Sapi51Callback;
+
+class SpeechApi51 : public TextToSpeech
+{
+ public:
+ SpeechApi51();
+ virtual ~SpeechApi51();
+
+ //--------------------------------------------------------------------------
+ // Description : is the api available for use
+ // Return : true - it is available
+ // false - it is not available
+ //--------------------------------------------------------------------------
+ virtual bool isAvailable();
+
+ //--------------------------------------------------------------------------
+ // Description : load/unload/reload the speech api
+ // Return : true - the action succeeded
+ // false - the action failed
+ //--------------------------------------------------------------------------
+ virtual bool load();
+ virtual bool unload();
+
+ //--------------------------------------------------------------------------
+ // Description : check if the speech api is loaded
+ // Return : true - the speech_api is loaded
+ // false - its not loaded
+ //--------------------------------------------------------------------------
+ virtual bool isLoaded() const;
+
+ //--------------------------------------------------------------------------
+ // Description : speak a sentence
+ // Parameters : sentence - the sentence to speak
+ // Returns : true - speak successful
+ // false - speak failed
+ //--------------------------------------------------------------------------
+ virtual bool say(const std::string &sentence);
+
+ //--------------------------------------------------------------------------
+ // Description : set the voice settings
+ // Parameters : range from 0 to 100
+ //--------------------------------------------------------------------------
+ virtual bool setVolume(int volume);
+ virtual bool setPitch(int pitch);
+ virtual bool setRate(int rate);
+
+ //--------------------------------------------------------------------------
+ // Description : set the voice
+ //--------------------------------------------------------------------------
+ virtual bool setVoice(const std::string &voice);
+
+ //--------------------------------------------------------------------------
+ // Description : get the available voices
+ //--------------------------------------------------------------------------
+ virtual std::vector<std::string> getVoices() const;
+
+ //--------------------------------------------------------------------------
+ // Description : open the lexicon dialog for this engine
+ // Parameters : window - handle to the parent window
+ // Return : true - dialog completely successfully
+ // false - dialog failed
+ //--------------------------------------------------------------------------
+ virtual bool lexiconDialog(HWND window);
+
+ //--------------------------------------------------------------------------
+ // Description : get the description of the tts engine
+ //--------------------------------------------------------------------------
+ static std::string getDescription();
+
+ private:
+ ISpVoice *m_sapi;
+
+ TextToSpeech::State m_state;
+ std::string m_voice;
+ int m_volume;
+ int m_pitch;
+ int m_rate;
+};
+
+//==============================================================================
+//
+// Summary : API encapsulation
+//
+// Description : This encapsulates the SAPI 5.1 interface
+//
+//==============================================================================
+
+#endif
\ No newline at end of file diff --git a/plugins/!NotAdopted/WinterSpeak/general/text_to_speech/speech_api_51/speech_api_51_lexicon.cpp b/plugins/!NotAdopted/WinterSpeak/general/text_to_speech/speech_api_51/speech_api_51_lexicon.cpp new file mode 100644 index 0000000000..79581a62c9 --- /dev/null +++ b/plugins/!NotAdopted/WinterSpeak/general/text_to_speech/speech_api_51/speech_api_51_lexicon.cpp @@ -0,0 +1,99 @@ +//==============================================================================
+// General Code, © 2002 Ryan Winter
+//==============================================================================
+
+#pragma warning(disable:4786)
+
+#include "speech_api_51_lexicon.h"
+
+#include "speech_api_51.h"
+
+#include <general/debug/debug.h>
+#include <general/resource.h>
+
+#include <windows.h>
+//#include <sapi.h>
+//#include <sphelper.h>
+
+extern HINSTANCE g_hInst;
+
+//------------------------------------------------------------------------------
+SpeechApi51Lexicon::SpeechApi51Lexicon(HWND window)
+ :
+ m_parent_window(window),
+ m_window(0)
+{
+ CLASSCERR("SpeechApi51Lexicon::SpeechApi51Lexicon");
+}
+
+//------------------------------------------------------------------------------
+SpeechApi51Lexicon::~SpeechApi51Lexicon()
+{
+ CLASSCERR("SpeechApi51Lexicon::~SpeechApi51Lexicon");
+}
+
+//------------------------------------------------------------------------------
+bool
+SpeechApi51Lexicon::display()
+{
+ CLASSCERR("SpeechApi51Lexicon::display");
+
+ m_window = CreateDialog(
+ g_hInst,
+ MAKEINTRESOURCE(IDD_TTS_LEXICON),
+ m_parent_window,
+ dialogEvent);
+
+ if (!m_window)
+ {
+ return false;
+ }
+
+ ShowWindow(m_window, SW_SHOW);
+
+/* WNDCLASS wc;
+
+ wc.style = 0;
+! wc.lpfnWndProc = (WNDPROC)MainWndProc; // Window procedure for this class.
+ wc.cbClsExtra = 0; // No per-class extra data.
+! wc.cbWndExtra = 0; // No per-window extra data.
+ wc.hInstance = hInstance; // Application that owns the class.
+ wc.hIcon = NULL;
+ wc.hCursor = NULL;
+ wc.hbrBackground = NULL;
+ wc.lpszMenuName = NULL;
+ wc.lpszClassName = "Comdlg32WClass"; // Name used in call to CreateWindow.
+
+ return (RegisterClass(&wc));*/
+
+ return true;
+}
+
+//------------------------------------------------------------------------------
+INT_PTR CALLBACK
+SpeechApi51Lexicon::dialogEvent(HWND hwndDlg, UINT uMsg, WPARAM wParam,
+ LPARAM lParam)
+{
+
+ return TRUE;
+}
+
+//------------------------------------------------------------------------------
+void
+SpeechApi51Lexicon::addLexicon()
+{
+}
+
+//------------------------------------------------------------------------------
+void
+SpeechApi51Lexicon::deleteLexicon()
+{
+}
+
+//------------------------------------------------------------------------------
+void
+SpeechApi51Lexicon::displayLexicon()
+{
+}
+
+//------------------------------------------------------------------------------
diff --git a/plugins/!NotAdopted/WinterSpeak/general/text_to_speech/speech_api_51/speech_api_51_lexicon.h b/plugins/!NotAdopted/WinterSpeak/general/text_to_speech/speech_api_51/speech_api_51_lexicon.h new file mode 100644 index 0000000000..f0a240fb67 --- /dev/null +++ b/plugins/!NotAdopted/WinterSpeak/general/text_to_speech/speech_api_51/speech_api_51_lexicon.h @@ -0,0 +1,50 @@ +#ifndef guard_general_text_to_speech_speech_api_51_speech_api_51_lexicon_h
+#define guard_general_text_to_speech_speech_api_51_speech_api_51_lexicon_h
+//==============================================================================
+// General Code, © 2002 Ryan Winter
+//==============================================================================
+
+#include <wtypes.h>
+
+class SpeechApi51;
+
+class SpeechApi51Lexicon
+{
+ public:
+ //--------------------------------------------------------------------------
+ // Description : Constuctor
+ // Parameters : window - handle to the parent window
+ //--------------------------------------------------------------------------
+ SpeechApi51Lexicon(HWND window);
+
+ ~SpeechApi51Lexicon();
+
+ //--------------------------------------------------------------------------
+ // Description : display the lexicon dialog
+ // Return : true - display ok
+ // false - display failed
+ //--------------------------------------------------------------------------
+ bool display();
+
+ private:
+ static INT_PTR CALLBACK dialogEvent(HWND hwndDlg, UINT uMsg,
+ WPARAM wParam, LPARAM lParam);
+
+ void addLexicon();
+ void deleteLexicon();
+ void displayLexicon();
+
+ HWND m_parent_window;
+ HWND m_window;
+};
+
+//==============================================================================
+//
+// Summary : Lexicon dialog
+//
+// Description : Displays the lexicon dialog for the speech api 5.1 which
+// allows the user to add/remove/edit the user lexicon database
+//
+//==============================================================================
+
+#endif
\ No newline at end of file diff --git a/plugins/!NotAdopted/WinterSpeak/general/text_to_speech/text_to_speech/text_to_speech.cpp b/plugins/!NotAdopted/WinterSpeak/general/text_to_speech/text_to_speech/text_to_speech.cpp new file mode 100644 index 0000000000..ffc4cdc78e --- /dev/null +++ b/plugins/!NotAdopted/WinterSpeak/general/text_to_speech/text_to_speech/text_to_speech.cpp @@ -0,0 +1,17 @@ +//==============================================================================
+// General Code, © 2002 Ryan Winter
+//==============================================================================
+
+#include "text_to_speech.h"
+
+//------------------------------------------------------------------------------
+TextToSpeech::TextToSpeech()
+{
+}
+
+//------------------------------------------------------------------------------
+TextToSpeech::~TextToSpeech()
+{
+}
+
+//------------------------------------------------------------------------------
diff --git a/plugins/!NotAdopted/WinterSpeak/general/text_to_speech/text_to_speech/text_to_speech.h b/plugins/!NotAdopted/WinterSpeak/general/text_to_speech/text_to_speech/text_to_speech.h new file mode 100644 index 0000000000..36a59d9692 --- /dev/null +++ b/plugins/!NotAdopted/WinterSpeak/general/text_to_speech/text_to_speech/text_to_speech.h @@ -0,0 +1,88 @@ +#ifndef guard_general_text_to_speech_text_to_speech_text_to_speech_h
+#define guard_general_text_to_speech_text_to_speech_text_to_speech_h
+//==============================================================================
+// General Code, © 2002 Ryan Winter
+//==============================================================================
+
+#include <wtypes.h>
+#include <string>
+#include <vector>
+
+class TextToSpeech
+{
+ public:
+ enum State
+ {
+ State_Loaded,
+ State_Unloaded,
+ };
+
+ TextToSpeech();
+ virtual ~TextToSpeech();
+
+ //--------------------------------------------------------------------------
+ // Description : is the api available for use
+ // Return : true - it is available
+ // false - it is not available
+ //--------------------------------------------------------------------------
+ virtual bool isAvailable() = 0;
+
+ //--------------------------------------------------------------------------
+ // Description : load/unload/reload the speech api
+ // Return : true - the action succeeded
+ // false - the action failed
+ //--------------------------------------------------------------------------
+ virtual bool load() = 0;
+ virtual bool unload() = 0;
+
+ //--------------------------------------------------------------------------
+ // Description : check if the speech api is loaded
+ // Return : true - the speech_api is loaded
+ // false - its not loaded
+ //--------------------------------------------------------------------------
+ virtual bool isLoaded() const = 0;
+
+ //--------------------------------------------------------------------------
+ // Description : speak a sentence
+ // Parameters : sentence - the sentence to speak
+ // Returns : true - speak successful
+ // false - speak failed
+ //--------------------------------------------------------------------------
+ virtual bool say(const std::string &sentence) = 0;
+
+ //--------------------------------------------------------------------------
+ // Description : set the voice settings
+ // Parameters : range from 0 to 100
+ //--------------------------------------------------------------------------
+ virtual bool setVolume(int volume) = 0;
+ virtual bool setPitch(int pitch) = 0;
+ virtual bool setRate(int rate) = 0;
+
+ //--------------------------------------------------------------------------
+ // Description : set the voice
+ //--------------------------------------------------------------------------
+ virtual bool setVoice(const std::string &voice) = 0;
+
+ //--------------------------------------------------------------------------
+ // Description : get the available voices
+ //--------------------------------------------------------------------------
+ virtual std::vector<std::string> getVoices() const = 0;
+
+ //--------------------------------------------------------------------------
+ // Description : open the lexicon dialog for this engine
+ // Parameters : window - handle to the parent window
+ // Return : true - dialog completely successfully
+ // false - dialog failed
+ //--------------------------------------------------------------------------
+ virtual bool lexiconDialog(HWND window) = 0;
+};
+
+//==============================================================================
+//
+// Summary : ABC for text to speech engines
+//
+// Description : Define the interface for the engine so i can polymorph
+//
+//==============================================================================
+
+#endif
\ No newline at end of file diff --git a/plugins/!NotAdopted/WinterSpeak/speak/announce/announce_database.cpp b/plugins/!NotAdopted/WinterSpeak/speak/announce/announce_database.cpp new file mode 100644 index 0000000000..f5720624a7 --- /dev/null +++ b/plugins/!NotAdopted/WinterSpeak/speak/announce/announce_database.cpp @@ -0,0 +1,111 @@ +//==============================================================================
+// Miranda Speak Plugin, © 2002 Ryan Winter
+//==============================================================================
+
+#pragma warning(disable:4786)
+
+#include "announce_database.h"
+
+#include <general/debug/debug.h>
+
+#include <windows.h>
+#include <miranda32/random/plugins/newpluginapi.h>
+#include <miranda32/database/m_database.h>
+
+//------------------------------------------------------------------------------
+namespace
+{
+ const char *SPEAK = "speak_announce";
+ const char *STATUS_FLAGS = "status_flags";
+ const char *EVENT_FLAGS = "event_flags";
+ const char *MAX_MSG_SIZE = "max_msg_size";
+}
+
+//------------------------------------------------------------------------------
+// public:
+//------------------------------------------------------------------------------
+AnnounceDatabase::AnnounceDatabase()
+ :
+ m_status_flags(0),
+ m_event_flags(0),
+ m_max_msg(0)
+{
+ CLASSCERR("AnnounceDatabase::AnnounceDatabase");
+
+ // load the database from miranda
+ load();
+}
+
+//------------------------------------------------------------------------------
+AnnounceDatabase::~AnnounceDatabase()
+{
+ CLASSCERR("AnnounceDatabase::~AnnounceDatabase");
+}
+
+//------------------------------------------------------------------------------
+bool
+AnnounceDatabase::getStatusFlag(StatusFlag flag) const
+{
+ return ((m_status_flags & (1 << flag)) != 0);
+}
+
+//------------------------------------------------------------------------------
+void
+AnnounceDatabase::setStatusFlag(StatusFlag flag, bool state)
+{
+ if (state)
+ {
+ m_status_flags |= (1 << flag);
+ }
+ else
+ {
+ m_status_flags &= ~(1 << flag);
+ }
+}
+
+//------------------------------------------------------------------------------
+bool
+AnnounceDatabase::getEventFlag(EventFlag flag) const
+{
+ return ((m_event_flags & (1 << flag)) != 0);
+}
+
+//------------------------------------------------------------------------------
+void
+AnnounceDatabase::setEventFlag(EventFlag flag, bool state)
+{
+ if (state)
+ {
+ m_event_flags |= (1 << flag);
+ }
+ else
+ {
+ m_event_flags &= ~(1 << flag);
+ }
+}
+
+//------------------------------------------------------------------------------
+void
+AnnounceDatabase::load()
+{
+ CLASSCERR("AnnounceDatabase::load");
+
+ m_status_flags = DBGetContactSettingDword(NULL, SPEAK, STATUS_FLAGS,
+ 0xffff);
+ m_event_flags = DBGetContactSettingDword(NULL, SPEAK, EVENT_FLAGS,
+ 0xffff);
+ m_max_msg = DBGetContactSettingDword(NULL, SPEAK, MAX_MSG_SIZE, 50);
+}
+
+//------------------------------------------------------------------------------
+void
+AnnounceDatabase::save()
+{
+ CLASSCERR("AnnounceDatabase::save");
+
+ DBWriteContactSettingDword(NULL, SPEAK, STATUS_FLAGS, m_status_flags);
+ DBWriteContactSettingDword(NULL, SPEAK, EVENT_FLAGS, m_event_flags);
+ DBWriteContactSettingDword(NULL, SPEAK, MAX_MSG_SIZE, m_max_msg);
+}
+
+//==============================================================================
diff --git a/plugins/!NotAdopted/WinterSpeak/speak/announce/announce_database.h b/plugins/!NotAdopted/WinterSpeak/speak/announce/announce_database.h new file mode 100644 index 0000000000..b3c950cd8d --- /dev/null +++ b/plugins/!NotAdopted/WinterSpeak/speak/announce/announce_database.h @@ -0,0 +1,80 @@ +#ifndef guard_speak_announce_announce_database_h
+#define guard_speak_announce_announce_database_h
+//==============================================================================
+// Miranda Speak Plugin, © 2002 Ryan Winter
+//==============================================================================
+
+#include <string>
+
+class AnnounceDatabase
+{
+ public:
+ AnnounceDatabase();
+ ~AnnounceDatabase();
+
+ enum StatusFlag
+ {
+ StatusFlag_Offline = 0,
+ StatusFlag_Online,
+ StatusFlag_Away,
+ StatusFlag_Dnd,
+ StatusFlag_Na,
+ StatusFlag_Occupied,
+ StatusFlag_FreeForChat,
+ StatusFlag_Invisible,
+ StatusFlag_SpeakStatusMsg,
+ StatusFlag_SuppressConnect,
+ };
+
+ enum EventFlag
+ {
+ EventFlag_Message = 0,
+ EventFlag_Url,
+ EventFlag_Added,
+ EventFlag_AuthRequest,
+ EventFlag_File,
+ EventFlag_ReadMsgLength,
+ EventFlag_DialogOpen,
+ EventFlag_DialogFocused,
+ };
+
+ //--------------------------------------------------------------------------
+ // Description : get/set a status flags
+ //--------------------------------------------------------------------------
+ bool getStatusFlag(StatusFlag flag) const;
+ void setStatusFlag(StatusFlag flag, bool state);
+
+ //--------------------------------------------------------------------------
+ // Description : get/set an event flags
+ //--------------------------------------------------------------------------
+ bool getEventFlag(EventFlag flag) const;
+ void setEventFlag(EventFlag flag, bool state);
+
+ //--------------------------------------------------------------------------
+ // Description : get/set an event flags
+ //--------------------------------------------------------------------------
+ unsigned int getMaxMsgSize() const { return m_max_msg; }
+ void setMaxMsgSize(unsigned int size) { m_max_msg = size; }
+
+ //--------------------------------------------------------------------------
+ // Description : load/save the settings from the miranda database
+ //--------------------------------------------------------------------------
+ void load();
+ void save();
+
+ private:
+ unsigned int m_status_flags;
+ unsigned int m_event_flags;
+
+ unsigned int m_max_msg;
+};
+
+//==============================================================================
+//
+// Summary : encapsulate the access to the miranda database
+//
+// Description : see summary
+//
+//==============================================================================
+
+#endif
\ No newline at end of file diff --git a/plugins/!NotAdopted/WinterSpeak/speak/announce/dialog_announce.cpp b/plugins/!NotAdopted/WinterSpeak/speak/announce/dialog_announce.cpp new file mode 100644 index 0000000000..5a21859ba5 --- /dev/null +++ b/plugins/!NotAdopted/WinterSpeak/speak/announce/dialog_announce.cpp @@ -0,0 +1,209 @@ +//==============================================================================
+// Miranda Speak Plugin, © 2002 Ryan Winter
+//==============================================================================
+
+#pragma warning(disable:4786)
+
+#include "announce/dialog_announce.h"
+
+#include "resource.h"
+#include "speak.h"
+
+#include <general/debug/debug.h>
+
+#include <windows.h>
+
+//------------------------------------------------------------------------------
+AnnounceDialog *AnnounceDialog::m_instance = 0;
+
+//------------------------------------------------------------------------------
+// public:
+//------------------------------------------------------------------------------
+AnnounceDialog::AnnounceDialog(AnnounceDatabase &db)
+ :
+ m_db(db)
+{
+ CLASSCERR("AnnounceDialog::AnnounceDialog");
+
+ m_instance = this;
+}
+
+//------------------------------------------------------------------------------
+AnnounceDialog::~AnnounceDialog()
+{
+ CLASSCERR("AnnounceDialog::~AnnounceDialog");
+
+ m_instance = 0;
+}
+
+//------------------------------------------------------------------------------
+// private:
+//------------------------------------------------------------------------------
+int CALLBACK
+AnnounceDialog::process(HWND window, UINT message, WPARAM wparam, LPARAM lparam)
+{
+ if (!m_instance)
+ {
+ return 1;
+ }
+
+ switch (message)
+ {
+ case WM_INITDIALOG:
+ m_instance->load(window);
+ break;
+
+ case WM_COMMAND:
+ m_instance->command(window, wparam);
+ break;
+
+ case WM_NOTIFY:
+ if (PSN_APPLY == LPNMHDR(lparam)->code)
+ {
+ m_instance->save(window);
+ }
+ break;
+ }
+
+ return 0;
+}
+
+//------------------------------------------------------------------------------
+void
+AnnounceDialog::command(HWND window, int control)
+{
+ switch (LOWORD(control))
+ {
+ case IDC_STATUS_OFFLINE:
+ case IDC_STATUS_ONLINE:
+ case IDC_STATUS_AWAY:
+ case IDC_STATUS_DND:
+ case IDC_STATUS_NA:
+ case IDC_STATUS_OCCUPIED:
+ case IDC_STATUS_FREEFORCHAT:
+ case IDC_STATUS_INVISIBLE:
+ case IDC_SPEAK_STATUS_MSG:
+ case IDC_SUPPRESS_CONNECT:
+ case IDC_EVENT_MESSAGE:
+ case IDC_EVENT_URL:
+ case IDC_EVENT_FILE:
+ case IDC_EVENT_AUTHREQUEST:
+ case IDC_EVENT_ADDED:
+ case IDC_READ_MSG_LENGTH:
+ case IDC_DIALOG_OPEN:
+ case IDC_DIALOG_FOCUSED:
+
+ changed(window);
+ break;
+
+ case IDC_MAX_MSG:
+ if (EN_CHANGE == HIWORD(control))
+ {
+ changed(window);
+ }
+ break;
+ }
+}
+
+//------------------------------------------------------------------------------
+void
+AnnounceDialog::load(HWND window)
+{
+ CLASSCERR("AnnounceDialog::load");
+
+ TranslateDialogDefault(window);
+
+ // initialise the checkboxes
+ CheckDlgButton(window, IDC_STATUS_OFFLINE,
+ m_db.getStatusFlag(AnnounceDatabase::StatusFlag_Offline));
+ CheckDlgButton(window, IDC_STATUS_ONLINE,
+ m_db.getStatusFlag(AnnounceDatabase::StatusFlag_Online));
+ CheckDlgButton(window, IDC_STATUS_AWAY,
+ m_db.getStatusFlag(AnnounceDatabase::StatusFlag_Away));
+ CheckDlgButton(window, IDC_STATUS_DND,
+ m_db.getStatusFlag(AnnounceDatabase::StatusFlag_Dnd));
+ CheckDlgButton(window, IDC_STATUS_NA,
+ m_db.getStatusFlag(AnnounceDatabase::StatusFlag_Na));
+ CheckDlgButton(window, IDC_STATUS_OCCUPIED,
+ m_db.getStatusFlag(AnnounceDatabase::StatusFlag_Occupied));
+ CheckDlgButton(window, IDC_STATUS_FREEFORCHAT,
+ m_db.getStatusFlag(AnnounceDatabase::StatusFlag_FreeForChat));
+ CheckDlgButton(window, IDC_STATUS_INVISIBLE,
+ m_db.getStatusFlag(AnnounceDatabase::StatusFlag_Invisible));
+ CheckDlgButton(window, IDC_SPEAK_STATUS_MSG,
+ m_db.getStatusFlag(AnnounceDatabase::StatusFlag_SpeakStatusMsg));
+ CheckDlgButton(window, IDC_SUPPRESS_CONNECT,
+ m_db.getStatusFlag(AnnounceDatabase::StatusFlag_SuppressConnect));
+
+ CheckDlgButton(window, IDC_EVENT_MESSAGE,
+ m_db.getEventFlag(AnnounceDatabase::EventFlag_Message));
+ CheckDlgButton(window, IDC_EVENT_URL,
+ m_db.getEventFlag(AnnounceDatabase::EventFlag_Url));
+ CheckDlgButton(window, IDC_EVENT_FILE,
+ m_db.getEventFlag(AnnounceDatabase::EventFlag_File));
+ CheckDlgButton(window, IDC_EVENT_AUTHREQUEST,
+ m_db.getEventFlag(AnnounceDatabase::EventFlag_AuthRequest));
+ CheckDlgButton(window, IDC_EVENT_ADDED,
+ m_db.getEventFlag(AnnounceDatabase::EventFlag_Added));
+ CheckDlgButton(window, IDC_READ_MSG_LENGTH,
+ m_db.getEventFlag(AnnounceDatabase::EventFlag_ReadMsgLength));
+ CheckDlgButton(window, IDC_DIALOG_OPEN,
+ m_db.getEventFlag(AnnounceDatabase::EventFlag_DialogOpen));
+ CheckDlgButton(window, IDC_DIALOG_FOCUSED,
+ m_db.getEventFlag(AnnounceDatabase::EventFlag_DialogFocused));
+
+ // initialise the welcome message box
+ SetDlgItemInt(window, IDC_MAX_MSG, m_db.getMaxMsgSize(), 0);
+}
+
+//------------------------------------------------------------------------------
+void
+AnnounceDialog::save(HWND window)
+{
+ CLASSCERR("AnnounceDialog::save");
+
+ // store the checkboxes
+ m_db.setStatusFlag(AnnounceDatabase::StatusFlag_Offline,
+ (IsDlgButtonChecked(window, IDC_STATUS_OFFLINE) != 0));
+ m_db.setStatusFlag(AnnounceDatabase::StatusFlag_Online,
+ (IsDlgButtonChecked(window, IDC_STATUS_ONLINE) != 0));
+ m_db.setStatusFlag(AnnounceDatabase::StatusFlag_Away,
+ (IsDlgButtonChecked(window, IDC_STATUS_AWAY) != 0));
+ m_db.setStatusFlag(AnnounceDatabase::StatusFlag_Dnd,
+ (IsDlgButtonChecked(window, IDC_STATUS_DND) != 0));
+ m_db.setStatusFlag(AnnounceDatabase::StatusFlag_Na,
+ (IsDlgButtonChecked(window, IDC_STATUS_NA) != 0));
+ m_db.setStatusFlag(AnnounceDatabase::StatusFlag_Occupied,
+ (IsDlgButtonChecked(window, IDC_STATUS_OCCUPIED) != 0));
+ m_db.setStatusFlag(AnnounceDatabase::StatusFlag_FreeForChat,
+ (IsDlgButtonChecked(window, IDC_STATUS_FREEFORCHAT) != 0));
+ m_db.setStatusFlag(AnnounceDatabase::StatusFlag_Invisible,
+ (IsDlgButtonChecked(window, IDC_STATUS_INVISIBLE) != 0));
+ m_db.setStatusFlag(AnnounceDatabase::StatusFlag_SpeakStatusMsg,
+ (IsDlgButtonChecked(window, IDC_SPEAK_STATUS_MSG) != 0));
+ m_db.setStatusFlag(AnnounceDatabase::StatusFlag_SuppressConnect,
+ (IsDlgButtonChecked(window, IDC_SUPPRESS_CONNECT) != 0));
+
+ m_db.setEventFlag(AnnounceDatabase::EventFlag_Message,
+ (IsDlgButtonChecked(window, IDC_EVENT_MESSAGE) != 0));
+ m_db.setEventFlag(AnnounceDatabase::EventFlag_Url,
+ (IsDlgButtonChecked(window, IDC_EVENT_URL) != 0));
+ m_db.setEventFlag(AnnounceDatabase::EventFlag_File,
+ (IsDlgButtonChecked(window, IDC_EVENT_FILE) != 0));
+ m_db.setEventFlag(AnnounceDatabase::EventFlag_AuthRequest,
+ (IsDlgButtonChecked(window, IDC_EVENT_AUTHREQUEST) != 0));
+ m_db.setEventFlag(AnnounceDatabase::EventFlag_Added,
+ (IsDlgButtonChecked(window, IDC_EVENT_ADDED) != 0));
+ m_db.setEventFlag(AnnounceDatabase::EventFlag_ReadMsgLength,
+ (IsDlgButtonChecked(window, IDC_READ_MSG_LENGTH) != 0));
+ m_db.setEventFlag(AnnounceDatabase::EventFlag_DialogOpen,
+ (IsDlgButtonChecked(window, IDC_DIALOG_OPEN) != 0));
+ m_db.setEventFlag(AnnounceDatabase::EventFlag_DialogFocused,
+ (IsDlgButtonChecked(window, IDC_DIALOG_FOCUSED) != 0));
+
+ m_db.setMaxMsgSize(GetDlgItemInt(window, IDC_MAX_MSG, NULL, 0));
+
+ m_instance->m_db.save();
+}
+
+//==============================================================================
\ No newline at end of file diff --git a/plugins/!NotAdopted/WinterSpeak/speak/announce/dialog_announce.h b/plugins/!NotAdopted/WinterSpeak/speak/announce/dialog_announce.h new file mode 100644 index 0000000000..ea8fca5407 --- /dev/null +++ b/plugins/!NotAdopted/WinterSpeak/speak/announce/dialog_announce.h @@ -0,0 +1,48 @@ +#ifndef guard_speak_announce_announce_dialog_h
+#define guard_speak_announce_announce_dialog_h
+//==============================================================================
+// Miranda Speak Plugin, © 2002 Ryan Winter
+//==============================================================================
+
+#include "dialog/miranda_dialog.h"
+#include "announce/announce_database.h"
+
+#include <wtypes.h>
+#include <string>
+
+class AnnounceDialog : public MirandaDialog
+{
+ public:
+ AnnounceDialog(AnnounceDatabase &db);
+ ~AnnounceDialog();
+
+ //--------------------------------------------------------------------------
+ // Description : process a dialog message
+ // Return : true - update the systems configuration
+ // false - do nothing
+ //--------------------------------------------------------------------------
+ static int CALLBACK process(HWND window, UINT message, WPARAM wparam,
+ LPARAM lparam);
+
+ private:
+ void command(HWND window, int control);
+
+ //--------------------------------------------------------------------------
+ // Description : load/save settings to the miranda database
+ //--------------------------------------------------------------------------
+ void load(HWND window);
+ void save(HWND window);
+
+ static AnnounceDialog *m_instance;
+ AnnounceDatabase &m_db;
+};
+
+//==============================================================================
+//
+// Summary : Configuration Dialog box
+//
+// Description : Set up the configuration dialog box and process its input
+//
+//==============================================================================
+
+#endif
\ No newline at end of file diff --git a/plugins/!NotAdopted/WinterSpeak/speak/announce/event_information.cpp b/plugins/!NotAdopted/WinterSpeak/speak/announce/event_information.cpp new file mode 100644 index 0000000000..bf326e5cfb --- /dev/null +++ b/plugins/!NotAdopted/WinterSpeak/speak/announce/event_information.cpp @@ -0,0 +1,117 @@ +//==============================================================================
+// Miranda Speak Plugin, © 2002 Ryan Winter
+//==============================================================================
+
+#pragma warning(disable:4786)
+
+#include "event_information.h"
+#include "speak.h"
+
+#include <general/debug/debug.h>
+
+//------------------------------------------------------------------------------
+// public:
+//------------------------------------------------------------------------------
+EventInformation::EventInformation()
+ :
+ m_event_strings(),
+ m_event_info()
+{
+ CLASSCERR("EventInformation::EventInformation");
+
+ // insert the event strings into a map for easy access
+ m_event_strings[EVENTTYPE_MESSAGE]
+ = Translate("incoming message from %u");
+ m_event_strings[EVENTTYPE_URL]
+ = Translate("incoming U R L from %u");
+ m_event_strings[EVENTTYPE_ADDED]
+ = Translate("you have been added to %u's contact list");
+ m_event_strings[EVENTTYPE_AUTHREQUEST]
+ = Translate("%u requests your authorization");
+ m_event_strings[EVENTTYPE_FILE]
+ = Translate("there is an incoming file from %u");
+
+ ZeroMemory(&m_event_info, sizeof(m_event_info));
+}
+
+//------------------------------------------------------------------------------
+EventInformation::~EventInformation()
+{
+ CLASSCERR("EventInformation::~EventInformation");
+}
+
+//------------------------------------------------------------------------------
+bool
+EventInformation::isValidEvent(HANDLE event)
+{
+ CLASSCERR("EventInformation::isValidEvent()");
+
+ // clean up the old event
+ if (m_event_info.pBlob)
+ {
+ delete m_event_info.pBlob;
+ }
+ ZeroMemory(&m_event_info, sizeof(m_event_info));
+
+ // find out and assign the space we need for the new event
+ m_event_info.cbSize = sizeof(m_event_info);
+ m_event_info.cbBlob = CallService(MS_DB_EVENT_GETBLOBSIZE,
+ reinterpret_cast<LPARAM>(event), 0);
+
+ if (-1 == m_event_info.cbBlob)
+ {
+ return false;
+ }
+
+ m_event_info.pBlob = new unsigned char[m_event_info.cbBlob];
+
+ // get the event info
+ CallService(MS_DB_EVENT_GET, reinterpret_cast<LPARAM>(event),
+ reinterpret_cast<LPARAM>(&m_event_info));
+
+ // if the event has already been read or was sent by me then exit
+ if (m_event_info.flags & (DBEF_SENT | DBEF_READ))
+ {
+ return false;
+ }
+
+ // if the event string doesn't exist in our list then exit
+ if (m_event_strings.find(m_event_info.eventType) == m_event_strings.end())
+ {
+ return false;
+ }
+
+ // event was good
+ return true;
+}
+
+//------------------------------------------------------------------------------
+std::string
+EventInformation::getMessage()
+{
+ CLASSCERR("EventInformation::getMessage");
+
+ const std::string intro = Translate("%u says");
+
+ return intro + " " + (char *)m_event_info.pBlob;
+}
+
+//------------------------------------------------------------------------------
+unsigned int
+EventInformation::getMessageSize()
+{
+ CLASSCERR("EventInformation::getMessageSize");
+
+ return std::string((char *)m_event_info.pBlob).size();
+}
+
+//------------------------------------------------------------------------------
+std::string
+EventInformation::eventString()
+{
+ CLASSCERR("EventInformation::eventString");
+
+ return m_event_strings[m_event_info.eventType];
+}
+
+//==============================================================================
diff --git a/plugins/!NotAdopted/WinterSpeak/speak/announce/event_information.h b/plugins/!NotAdopted/WinterSpeak/speak/announce/event_information.h new file mode 100644 index 0000000000..626515e8ea --- /dev/null +++ b/plugins/!NotAdopted/WinterSpeak/speak/announce/event_information.h @@ -0,0 +1,69 @@ +#ifndef guard_speak_announce_event_information_h
+#define guard_speak_announce_event_information_h
+//==============================================================================
+// Miranda Speak Plugin, © 2002 Ryan Winter
+//==============================================================================
+
+#include <speak.h>
+
+#include <map>
+#include <string>
+
+class EventInformation
+{
+ public:
+ EventInformation();
+ ~EventInformation();
+
+ //--------------------------------------------------------------------------
+ // Description : is the event valid?
+ // Return : true = the event is valid
+ //--------------------------------------------------------------------------
+ bool isValidEvent(HANDLE event);
+
+ //--------------------------------------------------------------------------
+ // Description : get the last event received
+ // Return : the last event or 0 if none yet received
+ //--------------------------------------------------------------------------
+ unsigned short getLastEvent() { return m_event_info.eventType; }
+
+ //--------------------------------------------------------------------------
+ // Description : was the last event a messsage event?
+ // Return : true - yes it was
+ // false - no it wasn't
+ //--------------------------------------------------------------------------
+// bool isMessageEvent()
+// { return (m_event_info.eventType == EVENTTYPE_MESSAGE); }
+
+ //--------------------------------------------------------------------------
+ // Description : get the message from the last event
+ // Return : the last message
+ //--------------------------------------------------------------------------
+ std::string getMessage();
+
+ //--------------------------------------------------------------------------
+ // Description : get the size of the message from the last event
+ // Return : the size of the message
+ //--------------------------------------------------------------------------
+ unsigned int getMessageSize();
+
+ //--------------------------------------------------------------------------
+ // Description : get the event string
+ //--------------------------------------------------------------------------
+ std::string eventString();
+
+ private:
+ std::map<unsigned short, std::string> m_event_strings;
+
+ DBEVENTINFO m_event_info;
+};
+
+//==============================================================================
+//
+// Summary : API encapsulation
+//
+// Description : This encapsulates the SAPI 5.1 interface
+//
+//==============================================================================
+
+#endif
\ No newline at end of file diff --git a/plugins/!NotAdopted/WinterSpeak/speak/announce/protocol_information.cpp b/plugins/!NotAdopted/WinterSpeak/speak/announce/protocol_information.cpp new file mode 100644 index 0000000000..b3d9752bd4 --- /dev/null +++ b/plugins/!NotAdopted/WinterSpeak/speak/announce/protocol_information.cpp @@ -0,0 +1,100 @@ +//==============================================================================
+// Miranda Speak Plugin, © 2002 Ryan Winter
+//==============================================================================
+
+#pragma warning(disable:4786)
+
+#include "protocol_information.h"
+
+#include <general/debug/debug.h>
+
+//------------------------------------------------------------------------------
+ProtocolInformation *ProtocolInformation::m_instance = 0;
+
+//------------------------------------------------------------------------------
+// public:
+//------------------------------------------------------------------------------
+ProtocolInformation::ProtocolInformation()
+ :
+ m_protocol_timeout()
+{
+ CLASSCERR("ProtocolInformation::ProtocolInformation");
+
+ m_instance = this;
+}
+
+//------------------------------------------------------------------------------
+ProtocolInformation::~ProtocolInformation()
+{
+ CLASSCERR("ProtocolInformation::~ProtocolInformation");
+
+ m_instance = 0;
+
+ // kill all the timers
+ for (ProtocolTimeoutQueue::const_iterator iter = m_protocol_timeout.begin();
+ iter != m_protocol_timeout.end();
+ ++iter)
+ {
+ KillTimer(NULL, (*iter).second);
+ }
+}
+
+//------------------------------------------------------------------------------
+void
+ProtocolInformation::disable(const char *protocol)
+{
+ CLASSCERR("ProtocolInformation::disable(" << protocol << ")");
+
+ if (NULL == protocol)
+ {
+ return;
+ }
+
+ const unsigned int TIMEOUT = 10000;
+
+ unsigned int t
+ = SetTimer(NULL, NULL, TIMEOUT, ProtocolInformation::timeout);
+ m_protocol_timeout.push_back(std::make_pair(protocol, t));
+}
+
+//------------------------------------------------------------------------------
+bool
+ProtocolInformation::isDisabled(const char *protocol) const
+{
+ CLASSCERR("ProtocolInformation::isDisable(" << protocol << ")");
+
+ if (NULL == protocol)
+ {
+ return false;
+ }
+
+ // iterate through the list and see if the protocol has a timer callback
+ for (ProtocolTimeoutQueue::const_iterator iter = m_protocol_timeout.begin();
+ iter != m_protocol_timeout.end();
+ ++iter)
+ {
+ if (0 == (*iter).first.compare(protocol))
+ {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+//------------------------------------------------------------------------------
+// private:
+//------------------------------------------------------------------------------
+void CALLBACK
+ProtocolInformation::timeout(HWND hwnd, UINT uMsg, UINT idEvent, DWORD dwTime)
+{
+ CERR("ProtocolInformation::timeout(,,,)");
+
+ ProtocolTimeout pt = m_instance->m_protocol_timeout.front();
+
+ KillTimer(NULL, pt.second);
+
+ m_instance->m_protocol_timeout.pop_front();
+}
+
+//==============================================================================
diff --git a/plugins/!NotAdopted/WinterSpeak/speak/announce/protocol_information.h b/plugins/!NotAdopted/WinterSpeak/speak/announce/protocol_information.h new file mode 100644 index 0000000000..c003f43034 --- /dev/null +++ b/plugins/!NotAdopted/WinterSpeak/speak/announce/protocol_information.h @@ -0,0 +1,41 @@ +#ifndef guard_speak_announce_protocol_information_h
+#define guard_speak_announce_protocol_information_h
+//==============================================================================
+// Miranda Speak Plugin, © 2002 Ryan Winter
+//==============================================================================
+
+#include <windows.h>
+
+#include <deque>
+#include <utility>
+
+class ProtocolInformation
+{
+ public:
+ ProtocolInformation();
+ ~ProtocolInformation();
+
+ void disable(const char *protocol);
+ bool isDisabled(const char *protocol) const;
+
+ private:
+ typedef std::pair<std::string, unsigned int> ProtocolTimeout;
+ typedef std::deque<ProtocolTimeout> ProtocolTimeoutQueue;
+
+ static void CALLBACK timeout(HWND hwnd, UINT uMsg, UINT idEvent,
+ DWORD dwTime);
+
+ static ProtocolInformation *m_instance;
+
+ ProtocolTimeoutQueue m_protocol_timeout;
+};
+
+//==============================================================================
+//
+// Summary :
+//
+// Description :
+//
+//==============================================================================
+
+#endif
\ No newline at end of file diff --git a/plugins/!NotAdopted/WinterSpeak/speak/announce/speak_announce.cpp b/plugins/!NotAdopted/WinterSpeak/speak/announce/speak_announce.cpp new file mode 100644 index 0000000000..d54d8354ed --- /dev/null +++ b/plugins/!NotAdopted/WinterSpeak/speak/announce/speak_announce.cpp @@ -0,0 +1,243 @@ +//==============================================================================
+// Miranda Speak Plugin, © 2002 Ryan Winter
+//==============================================================================
+
+#pragma warning(disable:4786)
+
+#include "speak_announce.h"
+
+#include "m_speak.h"
+
+#include <general/debug/debug.h>
+
+//------------------------------------------------------------------------------
+// public:
+//------------------------------------------------------------------------------
+SpeakAnnounce::SpeakAnnounce(HINSTANCE instance)
+ :
+ m_instance(instance),
+ m_db(),
+ m_dialog(m_db),
+ m_user_info(),
+ m_event_info(),
+ m_protocol_info()
+{
+ CLASSCERR("SpeakAnnounce::SpeakAnnounce");
+}
+
+//------------------------------------------------------------------------------
+SpeakAnnounce::~SpeakAnnounce()
+{
+ CLASSCERR("SpeakAnnounce::~SpeakAnnounce");
+}
+
+//------------------------------------------------------------------------------
+void
+SpeakAnnounce::statusChange(DBCONTACTWRITESETTING *write_setting, HANDLE user)
+{
+ const std::string STATUS = "Status";
+
+ // if the user is myself (NULL) then return
+ // if it's not a status change then return
+ // check and update the user's status, if status didn't change the return
+ if ((NULL == user)
+ || (STATUS != write_setting->szSetting)
+ || (!m_user_info.updateStatus(user, write_setting->value.wVal)))
+ {
+ return;
+ }
+
+ // check if we just connected, and want to suppress status changes
+ if (!m_db.getStatusFlag(AnnounceDatabase::StatusFlag_SuppressConnect)
+ && m_protocol_info.isDisabled(
+ (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)user, 0)))
+ {
+ return;
+ }
+
+ bool speak = false;
+
+ switch (write_setting->value.wVal)
+ {
+ case ID_STATUS_OFFLINE:
+ speak = m_db.getStatusFlag(AnnounceDatabase::StatusFlag_Offline);
+ break;
+ case ID_STATUS_ONLINE:
+ speak = m_db.getStatusFlag(AnnounceDatabase::StatusFlag_Online);
+ break;
+ case ID_STATUS_AWAY:
+ speak = m_db.getStatusFlag(AnnounceDatabase::StatusFlag_Away);
+ break;
+ case ID_STATUS_DND:
+ speak = m_db.getStatusFlag(AnnounceDatabase::StatusFlag_Dnd);
+ break;
+ case ID_STATUS_NA:
+ speak = m_db.getStatusFlag(AnnounceDatabase::StatusFlag_Na);
+ break;
+ case ID_STATUS_OCCUPIED:
+ speak = m_db.getStatusFlag(AnnounceDatabase::StatusFlag_Occupied);
+ break;
+ case ID_STATUS_FREECHAT:
+ speak = m_db.getStatusFlag(AnnounceDatabase::StatusFlag_FreeForChat);
+ break;
+ case ID_STATUS_INVISIBLE:
+ speak = m_db.getStatusFlag(AnnounceDatabase::StatusFlag_Invisible);
+ break;
+ }
+
+ if (!speak)
+ {
+ return;
+ }
+
+ // translate, insert name then speak
+ std::string status_str = Translate(m_user_info.statusString(user).c_str());
+ m_user_info.insertName(status_str, user);
+ say(status_str, user);
+}
+
+//------------------------------------------------------------------------------
+void
+SpeakAnnounce::incomingEvent(HANDLE user, HANDLE event)
+{
+ CLASSCERR("SpeakAnnounce::incomingEvent(" << user << "," << event << ")");
+
+ if (m_event_info.isValidEvent(event))
+ {
+ bool speak = false;
+
+ switch (m_event_info.getLastEvent())
+ {
+ case EVENTTYPE_MESSAGE:
+ speak = m_db.getEventFlag(AnnounceDatabase::EventFlag_Message);
+ break;
+
+ case EVENTTYPE_URL:
+ speak = m_db.getEventFlag(AnnounceDatabase::EventFlag_Url);
+ break;
+
+ case EVENTTYPE_ADDED:
+ speak = m_db.getEventFlag(AnnounceDatabase::EventFlag_Added);
+ break;
+
+ case EVENTTYPE_AUTHREQUEST:
+ speak = m_db.getEventFlag(AnnounceDatabase::EventFlag_AuthRequest);
+ break;
+
+ case EVENTTYPE_FILE:
+ speak = m_db.getEventFlag(AnnounceDatabase::EventFlag_File);
+ break;
+
+ }
+
+ if (!speak)
+ {
+ return;
+ }
+
+ std::string event_str = "";
+
+ if (EVENTTYPE_MESSAGE == m_event_info.getLastEvent())
+ {
+ if (!readMessage(user))
+ {
+ // message dialog is open so just leave without saying anything
+ return;
+ }
+
+ if ((m_db.getEventFlag(AnnounceDatabase::EventFlag_ReadMsgLength))
+ && (m_event_info.getMessageSize() <= m_db.getMaxMsgSize()))
+ {
+ // conditions met to read the message
+ event_str = m_event_info.getMessage();
+ }
+ else
+ {
+ event_str = m_event_info.eventString();
+ }
+ }
+ else
+ {
+ event_str = m_event_info.eventString();
+ }
+
+ // translate the string, insert the name, then speak it
+ m_user_info.insertName(event_str, user);
+ say(event_str, user);
+ }
+}
+
+//------------------------------------------------------------------------------
+void
+SpeakAnnounce::protocolAck(ACKDATA *ack)
+{
+ if (ACKTYPE_STATUS != ack->type)
+ {
+ return;
+ }
+
+ if (ID_STATUS_CONNECTING != (int)ack->hProcess)
+ {
+ return;
+ }
+
+ m_protocol_info.disable((char *)ack->szModule);
+}
+
+//------------------------------------------------------------------------------
+void
+SpeakAnnounce::say(const std::string &sentence, HANDLE user)
+{
+ CLASSCERR("SpeakAnnounce::say(" << sentence << ", " << (int)user << ")");
+
+ CallService(ME_SPEAK_SAY, reinterpret_cast<LPARAM>(user),
+ reinterpret_cast<WPARAM>(sentence.c_str()));
+}
+
+//------------------------------------------------------------------------------
+bool
+SpeakAnnounce::readMessage(HANDLE contact)
+{
+ std::string title = m_user_info.nameString(contact) + " ("
+ + m_user_info.statusModeString(contact) + "): ";
+
+ HWND window = NULL;
+
+ window = FindWindow("#32770", (title + Translate("Message Session")).c_str());
+ if (window)
+ {
+ // check if we dont want to read message if dialog is open
+ if (m_db.getEventFlag(AnnounceDatabase::EventFlag_DialogOpen))
+ {
+ return false;
+ }
+
+ // check if we dont want to read message if dialog if focused
+ if ((window == GetForegroundWindow())
+ && m_db.getEventFlag(AnnounceDatabase::EventFlag_DialogFocused))
+ {
+ return false;
+ }
+ }
+
+ window = FindWindow("#32770", (title + Translate("Message Received")).c_str());
+ if (window)
+ {
+ // check if we dont want to read message if dialog is open
+ if (m_db.getEventFlag(AnnounceDatabase::EventFlag_DialogOpen))
+ {
+ return false;
+ }
+
+ // check if we dont want to read message if dialog if focused
+ if ((window == GetForegroundWindow())
+ && m_db.getEventFlag(AnnounceDatabase::EventFlag_DialogFocused))
+ {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+//==============================================================================
diff --git a/plugins/!NotAdopted/WinterSpeak/speak/announce/speak_announce.h b/plugins/!NotAdopted/WinterSpeak/speak/announce/speak_announce.h new file mode 100644 index 0000000000..bd20ed6689 --- /dev/null +++ b/plugins/!NotAdopted/WinterSpeak/speak/announce/speak_announce.h @@ -0,0 +1,74 @@ +#ifndef guard_speak_announce_speak_announce_h
+#define guard_speak_announce_speak_announce_h
+//==============================================================================
+// Miranda Speak Plugin, © 2002 Ryan Winter
+//==============================================================================
+
+#include "speak.h"
+#include "user/user_information.h"
+#include "announce/event_information.h"
+#include "announce/protocol_information.h"
+#include "announce/announce_database.h"
+#include "announce/dialog_announce.h"
+
+#include <wtypes.h>
+#include <string>
+#include <memory>
+
+class SpeakAnnounce
+{
+ public:
+ SpeakAnnounce(HINSTANCE instance);
+ ~SpeakAnnounce();
+
+ //--------------------------------------------------------------------------
+ // Description : handle a status change
+ //--------------------------------------------------------------------------
+ void statusChange(DBCONTACTWRITESETTING *write_setting, HANDLE user);
+
+ //--------------------------------------------------------------------------
+ // Description : handle an event
+ //--------------------------------------------------------------------------
+ void incomingEvent(HANDLE user, HANDLE event);
+
+ //--------------------------------------------------------------------------
+ // Description : handle a protocol state change
+ //--------------------------------------------------------------------------
+ void protocolAck(ACKDATA *ack);
+
+ //--------------------------------------------------------------------------
+ // Description : speak a sentence
+ // Parameters : sentence - the sentence to speak
+ // user - the user who is speaking, or NULL for no user
+ // Returns : true - speak successful
+ // false - speak failed
+ //--------------------------------------------------------------------------
+ void say(const std::string &sentence, HANDLE user);
+
+ private:
+ //--------------------------------------------------------------------------
+ // Description : check if the users message window is open and focused
+ // Parameters : contact - the user to check for
+ // Returns : true = message window is open
+ // false = message window not open
+ //--------------------------------------------------------------------------
+ bool readMessage(HANDLE contact);
+
+ HINSTANCE m_instance;
+
+ AnnounceDatabase m_db;
+ AnnounceDialog m_dialog;
+ UserInformation m_user_info;
+ EventInformation m_event_info;
+ ProtocolInformation m_protocol_info;
+};
+
+//==============================================================================
+//
+// Summary : The main object for the speak plugins
+//
+// Description : see summary
+//
+//==============================================================================
+
+#endif
\ No newline at end of file diff --git a/plugins/!NotAdopted/WinterSpeak/speak/checked.ico b/plugins/!NotAdopted/WinterSpeak/speak/checked.ico Binary files differnew file mode 100644 index 0000000000..e3e0d9513e --- /dev/null +++ b/plugins/!NotAdopted/WinterSpeak/speak/checked.ico diff --git a/plugins/!NotAdopted/WinterSpeak/speak/config/config_database.cpp b/plugins/!NotAdopted/WinterSpeak/speak/config/config_database.cpp new file mode 100644 index 0000000000..d634e44824 --- /dev/null +++ b/plugins/!NotAdopted/WinterSpeak/speak/config/config_database.cpp @@ -0,0 +1,174 @@ +//==============================================================================
+// Miranda Speak Plugin, © 2002 Ryan Winter
+//==============================================================================
+
+#pragma warning(disable:4786)
+
+#include "config_database.h"
+
+#include "speak.h"
+
+#include <general/debug/debug.h>
+
+//------------------------------------------------------------------------------
+namespace
+{
+ const char *SPEAK = "speak_config";
+ const char *ACTIVE_FLAGS = "active_flags";
+ const char *ACTIVE_STATE = "active_state";
+ const char *WELCOME_MSG = "welcome_msg";
+ const char *ENGINE = "engine";
+ const char *VOICE = "voice";
+ const char *VOLUME = "volume";
+ const char *RATE = "rate";
+ const char *PITCH = "pitch";
+}
+
+//------------------------------------------------------------------------------
+// public:
+//------------------------------------------------------------------------------
+ConfigDatabase::ConfigDatabase()
+ :
+ m_voice_desc(),
+ m_active_flags(0),
+ m_welcome_msg(""),
+ m_active_users()
+{
+ CLASSCERR("ConfigDatabase::ConfigDatabase");
+
+ // load the database from miranda
+ load();
+}
+
+//------------------------------------------------------------------------------
+ConfigDatabase::~ConfigDatabase()
+{
+ CLASSCERR("ConfigDatabase::~ConfigDatabase");
+}
+
+//------------------------------------------------------------------------------
+bool
+ConfigDatabase::getActiveFlag(ActiveFlag flag) const
+{
+ return ((m_active_flags & (1 << flag)) != 0);
+}
+
+//------------------------------------------------------------------------------
+void
+ConfigDatabase::setActiveFlag(ActiveFlag flag, bool state)
+{
+ if (state)
+ {
+ m_active_flags |= (1 << flag);
+ }
+ else
+ {
+ m_active_flags &= ~(1 << flag);
+ }
+}
+
+//------------------------------------------------------------------------------
+bool
+ConfigDatabase::getActiveUser(HANDLE user) const
+{
+ ActiveUsersMap::const_iterator iter = m_active_users.find(user);
+
+ if (iter == m_active_users.end())
+ {
+ // get the unknown user status
+ iter = m_active_users.find(0);
+
+ if (iter == m_active_users.end())
+ {
+ CLASSCERR("ConfigDatabase::getActiveUser user error");
+ return false;
+ }
+ }
+
+ return iter->second;
+}
+
+//------------------------------------------------------------------------------
+void
+ConfigDatabase::setActiveUser(HANDLE user, bool state)
+{
+ m_active_users[user] = state;
+}
+
+//------------------------------------------------------------------------------
+void
+ConfigDatabase::load()
+{
+ CLASSCERR("ConfigDatabase::load");
+
+ m_voice_desc.engine = DBGetContactSettingString(SPEAK, ENGINE, "");
+ m_voice_desc.voice = DBGetContactSettingString(SPEAK, VOICE, "");
+ m_voice_desc.volume = DBGetContactSettingDword(NULL, SPEAK, VOLUME, 50);
+ m_voice_desc.pitch = DBGetContactSettingDword(NULL, SPEAK, PITCH, 50);
+ m_voice_desc.rate = DBGetContactSettingDword(NULL, SPEAK, RATE, 50);
+
+ m_active_flags = DBGetContactSettingDword(NULL, SPEAK, ACTIVE_FLAGS, 0xffff);
+
+ m_welcome_msg = DBGetContactSettingString(SPEAK, WELCOME_MSG,
+ "welcome to i c q");
+
+ // iterate through all the users and add them to the list if active
+ HANDLE contact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+
+ while (NULL != contact)
+ {
+ m_active_users[contact]
+ = DBGetContactSettingByte(contact, SPEAK, ACTIVE_STATE, true);
+
+ contact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)contact, 0);
+ }
+
+ // load unknown users setting
+ m_active_users[0] = DBGetContactSettingByte(NULL, SPEAK, ACTIVE_STATE, true);
+}
+
+//------------------------------------------------------------------------------
+void
+ConfigDatabase::save()
+{
+ CLASSCERR("ConfigDatabase::save");
+
+ DBWriteContactSettingString(NULL, SPEAK, ENGINE, m_voice_desc.engine.c_str());
+ DBWriteContactSettingString(NULL, SPEAK, VOICE, m_voice_desc.voice.c_str());
+ DBWriteContactSettingDword(NULL, SPEAK, VOLUME, m_voice_desc.volume);
+ DBWriteContactSettingDword(NULL, SPEAK, PITCH, m_voice_desc.pitch);
+ DBWriteContactSettingDword(NULL, SPEAK, RATE, m_voice_desc.rate);
+
+ DBWriteContactSettingDword(NULL, SPEAK, ACTIVE_FLAGS, m_active_flags);
+
+ DBWriteContactSettingString(NULL, SPEAK, WELCOME_MSG, m_welcome_msg.c_str());
+
+ for (ActiveUsersMap::iterator i = m_active_users.begin();
+ i != m_active_users.end(); ++i)
+ {
+ DBWriteContactSettingByte(i->first, SPEAK, ACTIVE_STATE, i->second);
+ }
+
+ // notify the subjects that things have changed
+ notify();
+}
+
+//------------------------------------------------------------------------------
+// private:
+//------------------------------------------------------------------------------
+std::string
+ConfigDatabase::DBGetContactSettingString(const char *szModule,
+ const char *szSetting, const char *def)
+{
+ std::string ret = def;
+ DBVARIANT dbv;
+
+ if (!DBGetContactSetting(NULL, szModule, szSetting, &dbv))
+ {
+ ret = dbv.pszVal;
+ }
+
+ return ret;
+}
+
+//==============================================================================
diff --git a/plugins/!NotAdopted/WinterSpeak/speak/config/config_database.h b/plugins/!NotAdopted/WinterSpeak/speak/config/config_database.h new file mode 100644 index 0000000000..716745a3ce --- /dev/null +++ b/plugins/!NotAdopted/WinterSpeak/speak/config/config_database.h @@ -0,0 +1,91 @@ +#ifndef guard_speak_config_config_database_h
+#define guard_speak_config_config_database_h
+//==============================================================================
+// Miranda Speak Plugin, © 2002 Ryan Winter
+//==============================================================================
+
+#include "defs/voice_desc.h"
+
+#include <general/observer/subject.h>
+
+#include <windows.h>
+#include <string>
+#include <map>
+
+class ConfigDatabase : public Subject
+{
+ public:
+ ConfigDatabase();
+ ~ConfigDatabase();
+
+ enum ActiveFlag
+ {
+ ActiveFlag_Online = 1,
+ ActiveFlag_Away,
+ ActiveFlag_Dnd,
+ ActiveFlag_Na,
+ ActiveFlag_Occupied,
+ ActiveFlag_FreeForChat,
+ ActiveFlag_Invisible
+ };
+
+ typedef std::map<HANDLE, bool> ActiveUsersMap;
+
+ //--------------------------------------------------------------------------
+ // Description : get/set the voice description
+ //--------------------------------------------------------------------------
+ VoiceDesc getVoiceDesc() const { return m_voice_desc; }
+ void setVoiceDesc(const VoiceDesc &desc) { m_voice_desc = desc; }
+
+ //--------------------------------------------------------------------------
+ // Description : get/set the welcome message
+ //--------------------------------------------------------------------------
+ const std::string & getWelcomeMessage() const { return m_welcome_msg; }
+ void setWelcomeMessage(const std::string &msg) { m_welcome_msg = msg; }
+
+ //--------------------------------------------------------------------------
+ // Description : get/set an status flags
+ //--------------------------------------------------------------------------
+ bool getActiveFlag(ActiveFlag flag) const;
+ void setActiveFlag(ActiveFlag flag, bool state);
+
+ //--------------------------------------------------------------------------
+ // Description : get/set the user active flag
+ //--------------------------------------------------------------------------
+ bool getActiveUser(HANDLE user) const;
+ void setActiveUser(HANDLE user, bool state);
+ ActiveUsersMap getActiveUsers() const { return m_active_users; }
+
+ //--------------------------------------------------------------------------
+ // Description : load/save the settings from the miranda database
+ //--------------------------------------------------------------------------
+ void load();
+ void save();
+
+ private:
+ //--------------------------------------------------------------------------
+ // Description : For some reason this isn't implemented in miranda yet
+ // Just get a string from the db
+ // Parameters : szModule - the entrys' module
+ // szSetting - the entrys' setting
+ // def - default string if entry doesn't exist
+ //--------------------------------------------------------------------------
+ static std::string DBGetContactSettingString(const char *szModule,
+ const char *szSetting, const char *def);
+
+ VoiceDesc m_voice_desc;
+ unsigned int m_active_flags;
+ std::string m_welcome_msg;
+ ActiveUsersMap m_active_users;
+};
+
+//==============================================================================
+//
+// Summary : encapsulate the access to the miranda database
+//
+// Description : Provide a subject that allows clients to know when changes
+// are made to the miranda database.
+//
+//==============================================================================
+
+#endif
\ No newline at end of file diff --git a/plugins/!NotAdopted/WinterSpeak/speak/config/dialog_config_active.cpp b/plugins/!NotAdopted/WinterSpeak/speak/config/dialog_config_active.cpp new file mode 100644 index 0000000000..9d261adc24 --- /dev/null +++ b/plugins/!NotAdopted/WinterSpeak/speak/config/dialog_config_active.cpp @@ -0,0 +1,234 @@ +//==============================================================================
+// Miranda Speak Plugin, © 2002 Ryan Winter
+//==============================================================================
+
+#pragma warning(disable:4786)
+
+#include "dialog_config_active.h"
+
+#include "speak.h"
+#include "resource.h"
+
+#include <general/debug/debug.h>
+
+#include <windows.h>
+#include <commctrl.h>
+
+//------------------------------------------------------------------------------
+DialogConfigActive *DialogConfigActive::m_instance = 0;
+
+//------------------------------------------------------------------------------
+// public:
+//------------------------------------------------------------------------------
+DialogConfigActive::DialogConfigActive(ConfigDatabase &db)
+ :
+ m_db(db)
+{
+ CLASSCERR("DialogConfigActive::DialogConfigActive");
+
+ m_instance = this;
+}
+
+//------------------------------------------------------------------------------
+DialogConfigActive::~DialogConfigActive()
+{
+ CLASSCERR("DialogConfigActive::~DialogConfigActive");
+
+ m_instance = 0;
+}
+
+//------------------------------------------------------------------------------
+int CALLBACK
+DialogConfigActive::process(HWND window, UINT message, WPARAM wparam,
+ LPARAM lparam)
+{
+ if (!m_instance)
+ {
+ return 1;
+ }
+
+ switch (message)
+ {
+ case WM_INITDIALOG:
+ m_instance->load(window);
+ break;
+
+ case WM_NOTIFY:
+ switch (reinterpret_cast<LPNMHDR>(lparam)->code)
+ {
+ case PSN_APPLY:
+ m_instance->save(window);
+ break;
+
+ case LVN_ITEMCHANGED:
+ m_instance->changed(window);
+ break;
+ }
+ break;
+
+ case WM_COMMAND:
+ switch (LOWORD(wparam))
+ {
+ case IDC_ACTIVE_OFFLINE:
+ case IDC_ACTIVE_ONLINE:
+ case IDC_ACTIVE_AWAY:
+ case IDC_ACTIVE_DND:
+ case IDC_ACTIVE_NA:
+ case IDC_ACTIVE_OCCUPIED:
+ case IDC_ACTIVE_FREEFORCHAT:
+ case IDC_ACTIVE_INVISIBLE:
+ m_instance->changed(window);
+ break;
+
+ case IDC_ACTIVE_ALL:
+ m_instance->selectAllUsers(window, true);
+ break;
+
+ case IDC_ACTIVE_NONE:
+ m_instance->selectAllUsers(window, false);
+ break;
+
+ case IDC_ACTIVE_USERS:
+ m_instance->changed(window);
+ break;
+ }
+ break;
+ }
+
+ return 0;
+}
+
+//------------------------------------------------------------------------------
+// private:
+//------------------------------------------------------------------------------
+void
+DialogConfigActive::load(HWND window)
+{
+ CLASSCERR("DialogConfigActive::load");
+
+ TranslateDialogDefault(window);
+
+ // initialise the checkboxes
+ CheckDlgButton(window, IDC_ACTIVE_ONLINE,
+ m_db.getActiveFlag(ConfigDatabase::ActiveFlag_Online));
+ CheckDlgButton(window, IDC_ACTIVE_AWAY,
+ m_db.getActiveFlag(ConfigDatabase::ActiveFlag_Away));
+ CheckDlgButton(window, IDC_ACTIVE_DND,
+ m_db.getActiveFlag(ConfigDatabase::ActiveFlag_Dnd));
+ CheckDlgButton(window, IDC_ACTIVE_NA,
+ m_db.getActiveFlag(ConfigDatabase::ActiveFlag_Na));
+ CheckDlgButton(window, IDC_ACTIVE_OCCUPIED,
+ m_db.getActiveFlag(ConfigDatabase::ActiveFlag_Occupied));
+ CheckDlgButton(window, IDC_ACTIVE_FREEFORCHAT,
+ m_db.getActiveFlag(ConfigDatabase::ActiveFlag_FreeForChat));
+ CheckDlgButton(window, IDC_ACTIVE_INVISIBLE,
+ m_db.getActiveFlag(ConfigDatabase::ActiveFlag_Invisible));
+
+ // add all the users active states
+ ConfigDatabase::ActiveUsersMap active_users = m_db.getActiveUsers();
+
+ HWND listview = GetDlgItem(window, IDC_ACTIVE_USERS);
+
+ // add checkboxes
+ ListView_SetExtendedListViewStyle(listview, LVS_EX_CHECKBOXES);
+
+ LV_ITEM lv_item;
+ lv_item.mask = LVIF_TEXT | LVIF_PARAM;
+ lv_item.iSubItem = 0;
+
+ int index = 0;
+ ConfigDatabase::ActiveUsersMap::const_iterator iter;
+ for (iter = active_users.begin(); iter != active_users.end(); ++iter)
+ {
+ lv_item.lParam = (LPARAM)iter->first;
+ std::string str = "";
+
+ // if its index 0, the use its the unknown user
+ if (0 == lv_item.lParam)
+ {
+ lv_item.pszText = "Unknown";
+ }
+ else
+ {
+ char *protocol = reinterpret_cast<char *>(
+ CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)iter->first,0));
+
+ if (protocol)
+ {
+ str += protocol;
+ str += ": ";
+ }
+
+ str += reinterpret_cast<char *>(
+ CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)iter->first, 0));
+
+ lv_item.pszText = const_cast<char *>(str.c_str());
+ }
+ lv_item.iItem = index++;
+
+ int it = ListView_InsertItem(listview, &lv_item);
+ ListView_SetCheckState(listview, it, iter->second);
+ }
+}
+
+//------------------------------------------------------------------------------
+void
+DialogConfigActive::save(HWND window)
+{
+ CLASSCERR("DialogConfigActive::save");
+
+ // store the checkboxes
+ m_db.setActiveFlag(ConfigDatabase::ActiveFlag_Online,
+ (IsDlgButtonChecked(window, IDC_ACTIVE_ONLINE) != 0));
+ m_db.setActiveFlag(ConfigDatabase::ActiveFlag_Away,
+ (IsDlgButtonChecked(window, IDC_ACTIVE_AWAY) != 0));
+ m_db.setActiveFlag(ConfigDatabase::ActiveFlag_Dnd,
+ (IsDlgButtonChecked(window, IDC_ACTIVE_DND) != 0));
+ m_db.setActiveFlag(ConfigDatabase::ActiveFlag_Na,
+ (IsDlgButtonChecked(window, IDC_ACTIVE_NA) != 0));
+ m_db.setActiveFlag(ConfigDatabase::ActiveFlag_Occupied,
+ (IsDlgButtonChecked(window, IDC_ACTIVE_OCCUPIED) != 0));
+ m_db.setActiveFlag(ConfigDatabase::ActiveFlag_FreeForChat,
+ (IsDlgButtonChecked(window, IDC_ACTIVE_FREEFORCHAT) != 0));
+ m_db.setActiveFlag(ConfigDatabase::ActiveFlag_Invisible,
+ (IsDlgButtonChecked(window, IDC_ACTIVE_INVISIBLE) != 0));
+
+ // look through the listview an extract the active users
+ HWND listview = GetDlgItem(window, IDC_ACTIVE_USERS);
+
+ LV_ITEM lv_item;
+ lv_item.mask = LVIF_PARAM;
+ lv_item.iSubItem = 0;
+
+ for (int i = 0; i < ListView_GetItemCount(listview); ++i)
+ {
+ lv_item.iItem = i;
+
+ if (TRUE == ListView_GetItem(listview, &lv_item))
+ {
+ m_db.setActiveUser((HANDLE)lv_item.lParam,
+ ListView_GetCheckState(listview, i));
+ }
+ }
+
+ m_db.save();
+}
+
+//------------------------------------------------------------------------------
+void
+DialogConfigActive::selectAllUsers(HWND window, bool state)
+{
+ CLASSCERR("DialogConfigActive::selectAllUsers");
+ // look through the listview an extract the active users
+
+ HWND listview = GetDlgItem(window, IDC_ACTIVE_USERS);
+
+ for (int i = 0; i < ListView_GetItemCount(listview); ++i)
+ {
+ ListView_SetCheckState(listview, i, state);
+ }
+
+ changed(window);
+}
+
+//==============================================================================
diff --git a/plugins/!NotAdopted/WinterSpeak/speak/config/dialog_config_active.h b/plugins/!NotAdopted/WinterSpeak/speak/config/dialog_config_active.h new file mode 100644 index 0000000000..5e0c0e2403 --- /dev/null +++ b/plugins/!NotAdopted/WinterSpeak/speak/config/dialog_config_active.h @@ -0,0 +1,56 @@ +#ifndef guard_speak_config_dialog_config_active_h
+#define guard_speak_config_dialog_config_active_h
+//==============================================================================
+// Miranda Speak Plugin, © 2002 Ryan Winter
+//==============================================================================
+
+#include "dialog/miranda_dialog.h"
+#include "config/config_database.h"
+
+#include <wtypes.h>
+
+class DialogConfigActive : public MirandaDialog
+{
+ public:
+ //--------------------------------------------------------------------------
+ // Description : Initialise
+ // Parameters : db - reference to the database to initalise and save
+ // control to and from
+ //--------------------------------------------------------------------------
+ DialogConfigActive(ConfigDatabase &db);
+ virtual ~DialogConfigActive();
+
+ //--------------------------------------------------------------------------
+ // Description : process a dialog message
+ // Return : 0 - process ok
+ // 1 - error
+ //--------------------------------------------------------------------------
+ static int CALLBACK process(HWND window, UINT message, WPARAM wparam,
+ LPARAM lparam);
+
+ private:
+ //--------------------------------------------------------------------------
+ // Description : load/save setting to the miranda database
+ //--------------------------------------------------------------------------
+ void load(HWND window);
+ void save(HWND window);
+
+ //--------------------------------------------------------------------------
+ // Description : select/unselect all the active status checkboxes
+ // Parameters : state - the state to apply to the checkboxes
+ //--------------------------------------------------------------------------
+ void selectAllUsers(HWND window, bool state);
+
+ static DialogConfigActive *m_instance;
+ ConfigDatabase &m_db;
+};
+
+//==============================================================================
+//
+// Summary : Configuration Engine Dialog box
+//
+// Description : Set up the configuration dialog box and process its input
+//
+//==============================================================================
+
+#endif
\ No newline at end of file diff --git a/plugins/!NotAdopted/WinterSpeak/speak/config/dialog_config_engine.cpp b/plugins/!NotAdopted/WinterSpeak/speak/config/dialog_config_engine.cpp new file mode 100644 index 0000000000..d95e610916 --- /dev/null +++ b/plugins/!NotAdopted/WinterSpeak/speak/config/dialog_config_engine.cpp @@ -0,0 +1,289 @@ +//==============================================================================
+// Miranda Speak Plugin, © 2002 Ryan Winter
+//==============================================================================
+
+#pragma warning(disable:4786)
+
+#include "dialog_config_engine.h"
+
+#include "speak.h"
+#include "resource.h"
+#include "config/speech_interface.h"
+
+#include <general/debug/debug.h>
+#include <general/text_to_speech/text_to_speech/text_to_speech.h>
+
+#include <windows.h>
+#include <commctrl.h>
+
+//------------------------------------------------------------------------------
+DialogConfigEngine *DialogConfigEngine::m_instance = 0;
+
+//------------------------------------------------------------------------------
+// public:
+//------------------------------------------------------------------------------
+DialogConfigEngine::DialogConfigEngine(ConfigDatabase &db)
+ :
+ m_db(db),
+ m_test_tts(0)
+{
+ CLASSCERR("DialogConfigEngine::DialogConfigEngine");
+
+ m_instance = this;
+}
+
+//------------------------------------------------------------------------------
+DialogConfigEngine::~DialogConfigEngine()
+{
+ CLASSCERR("DialogConfigEngine::~DialogConfigEngine");
+
+ m_instance = 0;
+}
+
+//------------------------------------------------------------------------------
+int CALLBACK
+DialogConfigEngine::process(HWND window, UINT message, WPARAM wparam,
+ LPARAM lparam)
+{
+ if (!m_instance)
+ {
+ return 1;
+ }
+
+ switch (message)
+ {
+ case WM_INITDIALOG:
+ m_instance->load(window);
+ break;
+
+ case WM_NOTIFY:
+ if (PSN_APPLY == reinterpret_cast<LPNMHDR>(lparam)->code)
+ {
+ m_instance->save(window);
+ m_instance->m_db.save();
+ }
+ break;
+
+ case WM_HSCROLL:
+ m_instance->changed(window);
+ break;
+
+ case WM_COMMAND:
+ m_instance->command(window, wparam);
+ break;
+ }
+
+ return 0;
+}
+
+//------------------------------------------------------------------------------
+// private:
+//------------------------------------------------------------------------------
+void
+DialogConfigEngine::command(HWND window, int control)
+{
+ switch (LOWORD(control))
+ {
+ case IDC_WELCOME_MSG:
+ if (EN_CHANGE == HIWORD(control))
+ {
+ changed(window);
+ }
+ break;
+
+ case IDC_SELECT_VOICE:
+ if (CBN_SELCHANGE == HIWORD(control))
+ {
+ changed(window);
+ }
+ break;
+
+ case IDC_SELECT_ENGINE:
+ if (CBN_SELCHANGE == HIWORD(control))
+ {
+ updateVoices(window);
+ changed(window);
+ }
+ break;
+
+ case IDC_CONFIG_LEXICON:
+ if (createTts(window))
+ {
+ if (!m_test_tts->lexiconDialog(window))
+ {
+ MessageBox(window, "Lexicon for this engine is not supported",
+ "Speak", MB_OK | MB_ICONEXCLAMATION);
+ }
+ }
+ break;
+
+ case IDC_BUTTON_TEST:
+ if (createTts(window))
+ {
+ m_test_tts->say(Translate("testing testing 1 2 3"));
+ }
+ break;
+ }
+}
+
+//------------------------------------------------------------------------------
+void
+DialogConfigEngine::load(HWND window)
+{
+ CLASSCERR("DialogConfigEngine::load()");
+
+ TranslateDialogDefault(window);
+
+ // add the available engines to the combo box
+ SpeechInterface si;
+ std::vector<std::string> engines = si.getAvailableEngines();
+ for (unsigned int i = 0; i < engines.size(); ++i)
+ {
+ CLASSCERR("DialogConfigEngine::load adding " << engines[i].c_str());
+
+ SendDlgItemMessage(window, IDC_SELECT_ENGINE, CB_ADDSTRING, 0,
+ (long)engines[i].c_str());
+ }
+
+ VoiceDesc desc = m_db.getVoiceDesc();
+
+ // initialise the sliders
+ SendDlgItemMessage(window, IDC_SLIDER_VOLUME, TBM_SETPOS, TRUE,
+ desc.volume);
+ SendDlgItemMessage(window, IDC_SLIDER_PITCH, TBM_SETPOS, TRUE,
+ desc.pitch);
+ SendDlgItemMessage(window, IDC_SLIDER_RATE, TBM_SETPOS, TRUE,
+ desc.rate);
+
+ // select the speech engine
+ SendDlgItemMessage(window, IDC_SELECT_ENGINE, CB_SELECTSTRING, 0,
+ reinterpret_cast<long>(desc.engine.c_str()));
+
+ // initialise the welcome message box
+ SetDlgItemText(window, IDC_WELCOME_MSG, m_db.getWelcomeMessage().c_str());
+
+ updateVoices(window);
+}
+
+//------------------------------------------------------------------------------
+void
+DialogConfigEngine::save(HWND window)
+{
+ CLASSCERR("DialogConfigEngine::save()");
+
+ VoiceDesc desc;
+ getVoiceDesc(window, desc);
+ m_db.setVoiceDesc(desc);
+
+ // store the welcome message
+ char text[512];
+ GetDlgItemText(window, IDC_WELCOME_MSG, text, sizeof(text));
+ m_db.setWelcomeMessage(std::string(text));
+}
+
+//------------------------------------------------------------------------------
+void
+DialogConfigEngine::updateVoices(HWND window)
+{
+ CLASSCERR("DialogConfigEngine::updateVoices()");
+
+ SpeechInterface si;
+ m_test_tts = std::auto_ptr<TextToSpeech>(si.createTts(getEngine(window)));
+
+ if (!m_test_tts.get())
+ {
+ // we couldnt open the text to speech engine
+ CLASSCERR("DialogConfigEngine::updateVoices invalid tts");
+ return;
+ }
+
+ // add the voices onto the list
+ std::vector<std::string> voices = m_test_tts->getVoices();
+
+ SendDlgItemMessage(window, IDC_SELECT_VOICE, CB_RESETCONTENT, 0, 0);
+ for (unsigned int i = 0; i < voices.size(); ++i)
+ {
+ SendDlgItemMessage(window, IDC_SELECT_VOICE, CB_ADDSTRING, 0,
+ (long)voices[i].c_str());
+ }
+
+ // get the voice saved in the database
+ std::string voice = m_db.getVoiceDesc().voice;
+
+ if (FAILED(SendDlgItemMessage(window, IDC_SELECT_VOICE,
+ CB_FINDSTRINGEXACT, 0, (long)voice.c_str())))
+ {
+ // select the first one
+ SendDlgItemMessage(window, IDC_SELECT_VOICE, CB_SETCURSEL , 0, 0);
+ }
+ else
+ {
+ // select the saved voice
+ SendDlgItemMessage(window, IDC_SELECT_VOICE, CB_SELECTSTRING, 0,
+ (long)voice.c_str());
+ }
+}
+
+//------------------------------------------------------------------------------
+void
+DialogConfigEngine::getVoiceDesc(HWND window, VoiceDesc &desc)
+{
+ CLASSCERR("DialogConfigEngine::getVoiceDesc(,)");
+
+ // get the engine
+ char text[100];
+ GetDlgItemText(window, IDC_SELECT_ENGINE, text, sizeof(text));
+ desc.engine = std::string(text);
+
+ // get the voice
+ std::auto_ptr<char> voice(new char[50]);
+ SendDlgItemMessage(window, IDC_SELECT_VOICE, CB_GETLBTEXT,
+ SendDlgItemMessage(window, IDC_SELECT_VOICE, CB_GETCURSEL, 0, 0),
+ reinterpret_cast<long>(voice.get()));
+ desc.voice = voice.get();
+
+ // get the voice setting sliders
+ desc.volume
+ = SendDlgItemMessage(window, IDC_SLIDER_VOLUME, TBM_GETPOS, 0, 0);
+ desc.pitch
+ = SendDlgItemMessage(window, IDC_SLIDER_PITCH, TBM_GETPOS, 0, 0);
+ desc.rate
+ = SendDlgItemMessage(window, IDC_SLIDER_RATE, TBM_GETPOS, 0, 0);
+}
+
+//------------------------------------------------------------------------------
+std::string
+DialogConfigEngine::getEngine(HWND window)
+{
+ CLASSCERR("DialogConfigEngine::getEngine()");
+
+ // store the engine
+ char text[100];
+ GetDlgItemText(window, IDC_SELECT_ENGINE, text, sizeof(text));
+
+ CLASSCERR("DialogConfigEngine::getEngine() return " << text);
+ return text;
+}
+
+//------------------------------------------------------------------------------
+bool
+DialogConfigEngine::createTts(HWND window)
+{
+ CLASSCERR("DialogConfigEngine::createTts()");
+
+ VoiceDesc desc;
+ getVoiceDesc(window, desc);
+
+ SpeechInterface si;
+ m_test_tts = std::auto_ptr<TextToSpeech>(si.createTts(desc.engine));
+
+ if (!m_test_tts.get())
+ {
+ return false;
+ }
+
+ si.configureTts(m_test_tts.get(), desc);
+ return true;
+}
+
+//==============================================================================
diff --git a/plugins/!NotAdopted/WinterSpeak/speak/config/dialog_config_engine.h b/plugins/!NotAdopted/WinterSpeak/speak/config/dialog_config_engine.h new file mode 100644 index 0000000000..9aed91aa9b --- /dev/null +++ b/plugins/!NotAdopted/WinterSpeak/speak/config/dialog_config_engine.h @@ -0,0 +1,59 @@ +#ifndef guard_speak_config_dialog_config_engine_h
+#define guard_speak_config_dialog_config_engine_h
+//==============================================================================
+// Miranda Speak Plugin, © 2002 Ryan Winter
+//==============================================================================
+
+#include "dialog/miranda_dialog.h"
+#include "config/config_database.h"
+
+#include <wtypes.h>
+#include <memory>
+
+class TextToSpeech;
+
+class DialogConfigEngine : public MirandaDialog
+{
+ public:
+ DialogConfigEngine(ConfigDatabase &db);
+ virtual ~DialogConfigEngine();
+
+ //--------------------------------------------------------------------------
+ // Description : process a dialog message
+ // Return : 0 - process ok
+ // 1 - error
+ //--------------------------------------------------------------------------
+ static int CALLBACK process(HWND window, UINT message, WPARAM wparam,
+ LPARAM lparam);
+
+ private:
+ void command(HWND window, int control);
+
+ //--------------------------------------------------------------------------
+ // Description : load/save setting to the miranda database
+ //--------------------------------------------------------------------------
+ void load(HWND window);
+ void save(HWND window);
+
+ //--------------------------------------------------------------------------
+ // Description : update the voices combo box
+ //--------------------------------------------------------------------------
+ void updateVoices(HWND window);
+ void getVoiceDesc(HWND window, VoiceDesc &desc);
+ std::string getEngine(HWND window);
+ bool createTts(HWND window);
+
+ static DialogConfigEngine *m_instance;
+ ConfigDatabase &m_db;
+ std::auto_ptr<TextToSpeech> m_test_tts;
+};
+
+//==============================================================================
+//
+// Summary : Configuration Engine Dialog box
+//
+// Description : Set up the configuration dialog box and process its input
+//
+//==============================================================================
+
+#endif
\ No newline at end of file diff --git a/plugins/!NotAdopted/WinterSpeak/speak/config/speak_config.cpp b/plugins/!NotAdopted/WinterSpeak/speak/config/speak_config.cpp new file mode 100644 index 0000000000..c9f6bfdbde --- /dev/null +++ b/plugins/!NotAdopted/WinterSpeak/speak/config/speak_config.cpp @@ -0,0 +1,170 @@ +//==============================================================================
+// Miranda Speak Plugin, © 2002 Ryan Winter
+//==============================================================================
+
+#pragma warning(disable:4786)
+
+#include "speak_config.h"
+
+#include "defs/voice_desc.h"
+#include "config/speech_interface.h"
+#include "config/dialog_config_engine.h"
+#include "config/dialog_config_active.h"
+
+#include <general/debug/debug.h>
+#include <general/text_to_speech/text_to_speech/text_to_speech.h>
+//#include <general/multimedia/winamp_2/winamp_2.h>
+
+#include <sstream>
+
+//------------------------------------------------------------------------------
+// public:
+//------------------------------------------------------------------------------
+SpeakConfig::SpeakConfig(HINSTANCE instance)
+ :
+ m_instance(instance),
+ m_db(),
+ m_tts(0),
+ m_dialog_engine(m_db),
+ m_dialog_active(m_db)
+{
+ CLASSCERR("SpeakConfig::SpeakConfig");
+
+ // create and configure the tts
+ SpeechInterface si;
+ VoiceDesc desc = m_db.getVoiceDesc();
+ m_tts = std::auto_ptr<TextToSpeech>(si.createTts(desc.engine));
+ si.configureTts(m_tts.get(), desc);
+
+ // observer the database for changes
+ m_db.attach(*this);
+
+ say(m_db.getWelcomeMessage());
+}
+
+//------------------------------------------------------------------------------
+SpeakConfig::~SpeakConfig()
+{
+ CLASSCERR("SpeakConfig::~SpeakConfig");
+}
+
+//------------------------------------------------------------------------------
+void
+SpeakConfig::update(Subject &subject)
+{
+ CLASSCERR("SpeakConfig::update(" << &subject << ")");
+
+ ConfigDatabase &db = static_cast<ConfigDatabase &>(subject);
+
+ SpeechInterface si;
+ VoiceDesc desc = db.getVoiceDesc();
+ m_tts = std::auto_ptr<TextToSpeech>(si.createTts(desc.engine));
+ si.configureTts(m_tts.get(), desc);
+}
+
+//------------------------------------------------------------------------------
+bool
+SpeakConfig::say(const std::string &sentence, HANDLE user)
+{
+ CLASSCERR("SpeakConfig::say(" << sentence << ")");
+
+ if (!m_tts.get())
+ {
+ return false;
+ }
+
+ bool active = true;
+
+ if (NULL != user)
+ {
+ // get the status of the protocol of this user
+ const char *protocol = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO,
+ (WPARAM)user, 0);
+
+ if (ID_STATUS_OFFLINE == CallProtoService(protocol, PS_GETSTATUS, 0, 0))
+ {
+ // if we are offline for this protocol, then don't speak the
+ // sentence this is so we don't announce users offline status if
+ // we are disconnected.
+ active = false;
+ }
+ else
+ {
+ switch (CallService(MS_CLIST_GETSTATUSMODE, 0, 0))
+ {
+ case ID_STATUS_ONLINE:
+ active = m_db.getActiveFlag(ConfigDatabase::ActiveFlag_Online);
+ break;
+ case ID_STATUS_AWAY:
+ active = m_db.getActiveFlag(ConfigDatabase::ActiveFlag_Away);
+ break;
+ case ID_STATUS_DND:
+ active = m_db.getActiveFlag(ConfigDatabase::ActiveFlag_Dnd);
+ break;
+ case ID_STATUS_NA:
+ active = m_db.getActiveFlag(ConfigDatabase::ActiveFlag_Na);
+ break;
+ case ID_STATUS_OCCUPIED:
+ active = m_db.getActiveFlag(ConfigDatabase::ActiveFlag_Occupied);
+ break;
+ case ID_STATUS_FREECHAT:
+ active = m_db.getActiveFlag(ConfigDatabase::ActiveFlag_FreeForChat);
+ break;
+ case ID_STATUS_INVISIBLE:
+ active = m_db.getActiveFlag(ConfigDatabase::ActiveFlag_Invisible);
+ break;
+ default:
+ active = false;
+ break;
+ }
+ }
+
+ // if its a user say, then check the users status
+ if (active && (NULL != user))
+ {
+ active = m_db.getActiveUser(user);
+ }
+ }
+
+ if (!active)
+ {
+ return false;
+ }
+
+ bool ret = m_tts->say(sentence);
+
+ return ret;
+}
+
+//------------------------------------------------------------------------------
+/*int
+SpeakConfig::dialogEngine(HWND window, unsigned int message, WPARAM wparam,
+ LPARAM lparam)
+{
+ if (WM_INITDIALOG == message)
+ {
+ m_dialog_engine = std::auto_ptr<DialogConfigEngine>
+ (new DialogConfigEngine(window, m_db));
+ }
+ else if (WM_DESTROY == message)
+ {
+ m_dialog_engine = std::auto_ptr<DialogConfigEngine>(0);
+ }
+
+ if (!m_dialog_engine.get())
+ {
+ return 1;
+ }
+
+ // process the message and if settings are changed, reload the tts
+ if (m_dialog_engine->process(message, wparam, lparam))
+ {
+ m_db.load();
+ SpeechInterface si;
+ m_tts = std::auto_ptr<TextToSpeech>(si.createTts(m_db.getVoiceDesc()));
+ }
+
+ return 0;
+}*/
+
+//==============================================================================
diff --git a/plugins/!NotAdopted/WinterSpeak/speak/config/speak_config.h b/plugins/!NotAdopted/WinterSpeak/speak/config/speak_config.h new file mode 100644 index 0000000000..c664c9d9d8 --- /dev/null +++ b/plugins/!NotAdopted/WinterSpeak/speak/config/speak_config.h @@ -0,0 +1,59 @@ +#ifndef guard_speak_config_speak_config_h
+#define guard_speak_config_speak_config_h
+//==============================================================================
+// Miranda Speak Plugin, © 2002 Ryan Winter
+//==============================================================================
+
+#include "speak.h"
+#include "config/config_database.h"
+#include "config/dialog_config_active.h"
+#include "config/dialog_config_engine.h"
+
+#include <general/observer/observer.h>
+
+#include <wtypes.h>
+#include <memory>
+
+class TextToSpeech;
+
+class SpeakConfig : public Observer
+{
+ public:
+ SpeakConfig(HINSTANCE instance);
+ virtual ~SpeakConfig();
+
+ //--------------------------------------------------------------------------
+ // Description : Called by a subject that this observer is observing
+ // to signify a change in state
+ // Parameters : subject - the subject that changed
+ //--------------------------------------------------------------------------
+ virtual void update(Subject &subject);
+
+ //--------------------------------------------------------------------------
+ // Description : speak a sentence
+ // Parameters : sentence - the sentence to speak
+ // user - the user to associate the say with
+ // NULL = ignore user
+ // Returns : true - speak successful
+ // false - speak failed
+ //--------------------------------------------------------------------------
+ bool say(const std::string &sentence, HANDLE user = NULL);
+
+ private:
+ HINSTANCE m_instance;
+
+ ConfigDatabase m_db;
+ std::auto_ptr<TextToSpeech> m_tts;
+ DialogConfigEngine m_dialog_engine;
+ DialogConfigActive m_dialog_active;
+};
+
+//==============================================================================
+//
+// Summary : The main object for the speak plugins
+//
+// Description : see summary
+//
+//==============================================================================
+
+#endif
\ No newline at end of file diff --git a/plugins/!NotAdopted/WinterSpeak/speak/config/speech_interface.cpp b/plugins/!NotAdopted/WinterSpeak/speak/config/speech_interface.cpp new file mode 100644 index 0000000000..c80a219165 --- /dev/null +++ b/plugins/!NotAdopted/WinterSpeak/speak/config/speech_interface.cpp @@ -0,0 +1,91 @@ +//==============================================================================
+// Miranda Speak Plugin, © 2002 Ryan Winter
+//==============================================================================
+
+#pragma warning(disable:4786)
+
+#include "speech_interface.h"
+
+#include "config/config_database.h"
+
+#include <general/debug/debug.h>
+#include <general/text_to_speech/speech_api_40a/speech_api_40a.h>
+#include <general/text_to_speech/speech_api_51/speech_api_51.h>
+
+//------------------------------------------------------------------------------
+// public:
+//------------------------------------------------------------------------------
+SpeechInterface::SpeechInterface()
+{
+ CLASSCERR("SpeechInterface::SpeechInterface");
+}
+
+//------------------------------------------------------------------------------
+SpeechInterface::~SpeechInterface()
+{
+ CLASSCERR("SpeechInterface::~SpeechInterface");
+}
+
+//------------------------------------------------------------------------------
+TextToSpeech *
+SpeechInterface::createTts(std::string &engine) const
+{
+ CLASSCERR("SpeechInterface::createTts()");
+
+ TextToSpeech *tts = 0;
+
+ if (SpeechApi40a::getDescription() == engine)
+ {
+ tts = new SpeechApi40a();
+ }
+ else if (SpeechApi51::getDescription() == engine)
+ {
+ tts = new SpeechApi51();
+ }
+
+ CLASSCERR("SpeechInterface::createTts() return " << tts);
+ return tts;
+}
+
+//------------------------------------------------------------------------------
+void
+SpeechInterface::configureTts(TextToSpeech *tts, const VoiceDesc &desc) const
+{
+ CLASSCERR("SpeechInterface::configureTts(" << tts << ",)");
+
+ if (!tts)
+ {
+ return;
+ }
+
+ tts->setVoice(desc.voice);
+ tts->setVolume(desc.volume);
+ tts->setRate(desc.rate);
+ tts->setPitch(desc.pitch);
+ tts->load();
+}
+
+//------------------------------------------------------------------------------
+std::vector<std::string>
+SpeechInterface::getAvailableEngines()
+{
+ CLASSCERR("SpeechInterface::getAvailableEngines");
+
+ std::vector<std::string> engines;
+
+ SpeechApi40a sapi40a;
+ if (sapi40a.isAvailable())
+ {
+ engines.push_back(SpeechApi40a::getDescription());
+ }
+
+ SpeechApi51 sapi51;
+ if (sapi51.isAvailable())
+ {
+ engines.push_back(SpeechApi51::getDescription());
+ }
+
+ return engines;
+}
+
+//==============================================================================
diff --git a/plugins/!NotAdopted/WinterSpeak/speak/config/speech_interface.h b/plugins/!NotAdopted/WinterSpeak/speak/config/speech_interface.h new file mode 100644 index 0000000000..69d2d44e14 --- /dev/null +++ b/plugins/!NotAdopted/WinterSpeak/speak/config/speech_interface.h @@ -0,0 +1,48 @@ +#ifndef guard_speak_config_speech_interface_h
+#define guard_speak_config_speech_interface_h
+//==============================================================================
+// Miranda Speak Plugin, © 2002 Ryan Winter
+//==============================================================================
+
+#include "defs/voice_desc.h"
+
+#include <string>
+#include <vector>
+
+class TextToSpeech;
+
+class SpeechInterface
+{
+ public:
+ SpeechInterface();
+ ~SpeechInterface();
+
+ //--------------------------------------------------------------------------
+ // Description : create the text to speech object
+ // Parameters : engine - the name of the engine to create
+ // Returns : an instance of the text to speech engine
+ //--------------------------------------------------------------------------
+ TextToSpeech * createTts(std::string &engine) const;
+
+ //--------------------------------------------------------------------------
+ // Description : configure the tts object
+ // Parameters : tts - the tts object to configure
+ // desc - the description of the voice
+ //--------------------------------------------------------------------------
+ void configureTts(TextToSpeech *tts, const VoiceDesc &desc) const;
+
+ //--------------------------------------------------------------------------
+ // Description : create a vector of available engines
+ //--------------------------------------------------------------------------
+ std::vector<std::string> getAvailableEngines();
+};
+
+//==============================================================================
+//
+// Summary : Configure a text to speech object
+//
+// Description : Encapsulate the different speech engines available
+//
+//==============================================================================
+
+#endif
\ No newline at end of file diff --git a/plugins/!NotAdopted/WinterSpeak/speak/defs/voice_desc.h b/plugins/!NotAdopted/WinterSpeak/speak/defs/voice_desc.h new file mode 100644 index 0000000000..9edde585e8 --- /dev/null +++ b/plugins/!NotAdopted/WinterSpeak/speak/defs/voice_desc.h @@ -0,0 +1,26 @@ +#ifndef guard_speak_defs_voice_desc_h
+#define guard_speak_defs_voice_desc_h
+//==============================================================================
+// Miranda Speak Plugin, © 2002 Ryan Winter
+//==============================================================================
+
+#include <string>
+
+struct VoiceDesc
+{
+ std::string engine;
+ std::string voice;
+ int volume;
+ int pitch;
+ int rate;
+};
+
+//==============================================================================
+//
+// Summary : struct describing a voice
+//
+// Description :
+//
+//==============================================================================
+
+#endif
\ No newline at end of file diff --git a/plugins/!NotAdopted/WinterSpeak/speak/dialog/miranda_dialog.cpp b/plugins/!NotAdopted/WinterSpeak/speak/dialog/miranda_dialog.cpp new file mode 100644 index 0000000000..bdd222f31d --- /dev/null +++ b/plugins/!NotAdopted/WinterSpeak/speak/dialog/miranda_dialog.cpp @@ -0,0 +1,36 @@ +//==============================================================================
+// Miranda Speak Plugin, © 2002 Ryan Winter
+//==============================================================================
+
+#pragma warning(disable:4786)
+
+#include "miranda_dialog.h"
+
+//------------------------------------------------------------------------------
+//MirandaDialog *AnnounceDialog::m_instance = 0;
+//std::list<HWND, MirandaDialog *> MirandaDialog::m_window_list = 0;
+
+//------------------------------------------------------------------------------
+// public:
+//------------------------------------------------------------------------------
+MirandaDialog::MirandaDialog()
+// :
+// m_window(0)
+{
+}
+
+//------------------------------------------------------------------------------
+MirandaDialog::~MirandaDialog()
+{
+}
+
+//------------------------------------------------------------------------------
+// protected:
+//------------------------------------------------------------------------------
+void
+MirandaDialog::changed(HWND window)
+{
+ SendMessage(GetParent(window), PSM_CHANGED, 0, 0);
+}
+
+//==============================================================================
\ No newline at end of file diff --git a/plugins/!NotAdopted/WinterSpeak/speak/dialog/miranda_dialog.h b/plugins/!NotAdopted/WinterSpeak/speak/dialog/miranda_dialog.h new file mode 100644 index 0000000000..833e277434 --- /dev/null +++ b/plugins/!NotAdopted/WinterSpeak/speak/dialog/miranda_dialog.h @@ -0,0 +1,59 @@ +#ifndef guard_speak_dialog_miranda_dialog_h
+#define guard_speak_dialog_miranda_dialog_h
+//==============================================================================
+// Miranda Speak Plugin, © 2002 Ryan Winter
+//==============================================================================
+
+#include <windows.h>
+
+#include <map>
+
+class MirandaDialog
+{
+ public:
+// MirandaDialog(HWND window);
+ MirandaDialog();
+ virtual ~MirandaDialog() = 0;
+
+ protected:
+ //--------------------------------------------------------------------------
+ // Description : set the window the dialog events are coming from
+ //--------------------------------------------------------------------------
+/* void setWindow(HWND window)
+ {
+ m_window = window;
+ }
+
+ HWND getWindow()
+ {
+ return m_window;
+ }*/
+
+ //--------------------------------------------------------------------------
+ // Description : return a pointer to the class object
+ //--------------------------------------------------------------------------
+// MirandaDialog * instance()
+// {
+// return m_instance;
+// }
+// MirandaDialog * instance(HWND window);
+
+ //--------------------------------------------------------------------------
+ // Description : flag that a dialog control has changed
+ //--------------------------------------------------------------------------
+ void changed(HWND window);
+
+// static std::map<HWND, MirandaDialog *> m_window_map;
+
+// HWND m_window;
+};
+
+//==============================================================================
+//
+// Summary : Abstract base class for the dialog forms
+//
+// Description : Implement common code
+//
+//==============================================================================
+
+#endif
\ No newline at end of file diff --git a/plugins/!NotAdopted/WinterSpeak/speak/m_speak.h b/plugins/!NotAdopted/WinterSpeak/speak/m_speak.h new file mode 100644 index 0000000000..94b84bcbcd --- /dev/null +++ b/plugins/!NotAdopted/WinterSpeak/speak/m_speak.h @@ -0,0 +1,18 @@ +#ifndef guard_m_speak_h
+#define guard_m_speak_h
+//==============================================================================
+// Miranda Speak Plugin, © 2002 Ryan Winter
+//==============================================================================
+
+#define ME_SPEAK_SAY "Speak/Say"
+
+//==============================================================================
+//
+// Summary : speak miranda includes
+//
+// Description : The includes need to be guarded to avoid multiple declaration
+// errors
+//
+//==============================================================================
+
+#endif
\ No newline at end of file diff --git a/plugins/!NotAdopted/WinterSpeak/speak/resource.h b/plugins/!NotAdopted/WinterSpeak/speak/resource.h new file mode 100644 index 0000000000..e06bfd8431 --- /dev/null +++ b/plugins/!NotAdopted/WinterSpeak/speak/resource.h @@ -0,0 +1,57 @@ +//{{NO_DEPENDENCIES}}
+// Microsoft Developer Studio generated include file.
+// Used by speak.rc
+//
+#define IDD_CONFIG 101
+#define IDD_ANNOUNCE 102
+#define IDD_ACTIVEMODES 103
+#define IDC_SELECT_ENGINE 1001
+#define IDC_SELECT_VOICE 1002
+#define IDC_SLIDER_RATE 1003
+#define IDC_SLIDER_VOLUME 1004
+#define IDC_SLIDER_PITCH 1005
+#define IDC_LOAD_SAPI 1006
+#define IDC_WELCOME_MSG 1007
+#define IDC_ACTIVE_OFFLINE 1008
+#define IDC_ACTIVE_ONLINE 1009
+#define IDC_ACTIVE_AWAY 1010
+#define IDC_ACTIVE_DND 1011
+#define IDC_ACTIVE_NA 1012
+#define IDC_ACTIVE_OCCUPIED 1013
+#define IDC_ACTIVE_FREEFORCHAT 1014
+#define IDC_ACTIVE_INVISIBLE 1015
+#define IDC_BUTTON_TEST 1016
+#define IDC_STATUS_OFFLINE 1100
+#define IDC_STATUS_ONLINE 1101
+#define IDC_STATUS_AWAY 1102
+#define IDC_STATUS_DND 1103
+#define IDC_STATUS_NA 1104
+#define IDC_STATUS_OCCUPIED 1105
+#define IDC_STATUS_FREEFORCHAT 1106
+#define IDC_STATUS_INVISIBLE 1107
+#define IDC_SPEAK_STATUS_MSG 1108
+#define IDC_EVENT_MESSAGE 1109
+#define IDC_EVENT_URL 1110
+#define IDC_EVENT_FILE 1111
+#define IDC_EVENT_AUTHREQUEST 1112
+#define IDC_EVENT_ADDED 1113
+#define IDC_READ_MSG_LENGTH 1114
+#define IDC_MAX_MSG 1115
+#define IDC_DIALOG_OPEN 1116
+#define IDC_DIALOG_FOCUSED 1117
+#define IDC_ACTIVE_USERS 1118
+#define IDC_ACTIVE_ALL 1119
+#define IDC_ACTIVE_NONE 1120
+#define IDC_SUPPRESS_CONNECT 1121
+#define IDC_CONFIG_LEXICON 1122
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 104
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1123
+#define _APS_NEXT_SYMED_VALUE 104
+#endif
+#endif
diff --git a/plugins/!NotAdopted/WinterSpeak/speak/speak.cpp b/plugins/!NotAdopted/WinterSpeak/speak/speak.cpp new file mode 100644 index 0000000000..d15641d532 --- /dev/null +++ b/plugins/!NotAdopted/WinterSpeak/speak/speak.cpp @@ -0,0 +1,238 @@ +//==============================================================================
+// Miranda Speak Plugin, © 2002 Ryan Winter
+//==============================================================================
+
+#pragma warning(disable:4786)
+
+#include "speak.h"
+#include "m_speak.h"
+
+#include "resource.h"
+#include "config/speak_config.h"
+#include "announce/speak_announce.h"
+#include "announce/dialog_announce.h"
+#include "config/dialog_config_active.h"
+#include "config/dialog_config_engine.h"
+
+#include <general/debug/debug.h>
+#include <general/debug/debug_window.h>
+#include <general/debug/debug_file.h>
+#include <general/optimise/aggressive_optimise.h>
+
+//-----------------------------------------------------------------------------
+PLUGINLINK *pluginLink = 0;
+HINSTANCE g_hInst;
+
+SpeakConfig *g_speak_config = 0;
+SpeakAnnounce *g_speak_announce = 0;
+HANDLE g_dialog_options_initialise;
+HANDLE g_event_status_change;
+HANDLE g_event_message_added;
+HANDLE g_protocol_ack;
+
+PLUGININFO g_pluginInfo =
+{
+ sizeof(PLUGININFO),
+ "Speak",
+ PLUGIN_MAKE_VERSION(0,9,7,0),
+ "Miranda interface to the Microsoft Speech API",
+ "Ryan Winter",
+ "ryanwinter@hotmail.com",
+ "© 2002 Ryan Winter",
+ "",
+ 0,
+ 0
+};
+
+#ifdef _DEBUG
+ DebugWindow g_debug_window;
+// DebugFile g_debug_file;
+#endif
+
+
+//-----------------------------------------------------------------------------
+// Description : External hook
+//-----------------------------------------------------------------------------
+int say(WPARAM wParam, LPARAM lParam)
+{
+ return g_speak_config->say(
+ reinterpret_cast<char *>(lParam),
+ reinterpret_cast<HANDLE>(wParam));
+}
+
+//-----------------------------------------------------------------------------
+// Description : an status change event occured
+//-----------------------------------------------------------------------------
+int eventStatusChange(WPARAM wParam, LPARAM lParam)
+{
+ g_speak_announce->statusChange(
+ reinterpret_cast<DBCONTACTWRITESETTING *>(lParam),
+ reinterpret_cast<HANDLE>(wParam));
+
+ return 0;
+}
+
+//-----------------------------------------------------------------------------
+// Description : a message event occured
+//-----------------------------------------------------------------------------
+int eventMessageAdded(WPARAM wParam, LPARAM lParam)
+{
+ g_speak_announce->incomingEvent(
+ reinterpret_cast<HANDLE>(wParam),
+ reinterpret_cast<HANDLE>(lParam));
+
+ return 0;
+}
+
+//-----------------------------------------------------------------------------
+// Description : a messaging protocol changed state
+//-----------------------------------------------------------------------------
+int protocolAck(WPARAM wParam, LPARAM lParam)
+{
+ g_speak_announce->protocolAck(reinterpret_cast<ACKDATA *>(lParam));
+
+ return 0;
+}
+
+//-----------------------------------------------------------------------------
+// Description : request for dialog box
+//-----------------------------------------------------------------------------
+int dialogOptionsInitialise(WPARAM wParam,LPARAM lParam)
+{
+ OPTIONSDIALOGPAGE odp;
+
+ ZeroMemory(&odp, sizeof(odp));
+
+ odp.cbSize = sizeof(odp);
+ odp.position = 100000000;
+ odp.hInstance = g_hInst;
+ odp.pszGroup = Translate("Speak");
+
+ if (g_speak_config)
+ {
+ odp.pszTemplate = MAKEINTRESOURCE(IDD_CONFIG);
+ odp.pszTitle = Translate("Engine/Voice");
+ odp.pfnDlgProc = DialogConfigEngine::process;
+ CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+
+ odp.pszTemplate = MAKEINTRESOURCE(IDD_ACTIVEMODES);
+ odp.pszTitle = Translate("Active Modes");
+ odp.pfnDlgProc = DialogConfigActive::process;
+ CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+ }
+
+ if (g_speak_announce)
+ {
+ odp.pszTemplate = MAKEINTRESOURCE(IDD_ANNOUNCE);
+ odp.pszTitle = Translate("Announce");
+ odp.pfnDlgProc = AnnounceDialog::process;
+ CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+ }
+
+ return 0;
+}
+
+//-----------------------------------------------------------------------------
+// Description : Return info about the plugin
+//-----------------------------------------------------------------------------
+extern "C" __declspec(dllexport) PLUGININFO *
+MirandaPluginInfo(DWORD mirandaVersion)
+{
+ return &g_pluginInfo;
+}
+
+//-----------------------------------------------------------------------------
+// Description : Construct the plugin
+//-----------------------------------------------------------------------------
+extern "C" int __declspec(dllexport)
+Load(PLUGINLINK *link)
+{
+ pluginLink = link;
+
+ if (!g_speak_config)
+ {
+ g_speak_config = new SpeakConfig(g_hInst);
+
+ // expose to allow miranda + plugins to access my speak routines
+ CreateServiceFunction("Speak/Say", say);
+ }
+
+ if (!g_speak_announce)
+ {
+ g_speak_announce = new SpeakAnnounce(g_hInst);
+
+ // tap into contact setting change event
+ g_event_status_change
+ = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, eventStatusChange);
+
+ // a new message event has occured
+ g_event_message_added = HookEvent(ME_DB_EVENT_ADDED, eventMessageAdded);
+
+ // a messaging protocol changed state
+ g_protocol_ack = HookEvent(ME_PROTO_ACK, protocolAck);
+
+ }
+
+ // a option dialog box request has occured
+ g_dialog_options_initialise
+ = HookEvent(ME_OPT_INITIALISE, dialogOptionsInitialise);
+
+ return 0;
+}
+
+//-----------------------------------------------------------------------------
+// Description : Destruct the plugin
+//-----------------------------------------------------------------------------
+extern "C" int __declspec(dllexport)
+Unload(void)
+{
+ UnhookEvent(g_dialog_options_initialise);
+
+ if (g_speak_config)
+ {
+ delete g_speak_config;
+ g_speak_config = 0;
+ }
+
+ if (g_speak_announce)
+ {
+ UnhookEvent(g_event_status_change);
+ UnhookEvent(g_event_message_added);
+ UnhookEvent(g_protocol_ack);
+
+ delete g_speak_announce;
+ g_speak_announce = 0;
+ }
+
+ return 0;
+}
+
+//-----------------------------------------------------------------------------
+// Description : Main line
+//-----------------------------------------------------------------------------
+BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD dwReason, LPVOID)
+{
+ CERR("================================================================");
+
+ DisableThreadLibraryCalls(hinstDLL);
+ g_hInst = hinstDLL;
+
+ // dispatch application messages
+/* MSG msg;
+
+ while(::GetMessage(&msg, NULL, 0, 0))
+ {
+ ::TranslateMessage(&msg);
+ ::DispatchMessage(&msg);
+ }*/
+
+ return TRUE;
+}
+
+//==============================================================================
+//
+// Summary : DLL interface
+//
+// Description : Define the interface to the miranda program
+//
+//==============================================================================
diff --git a/plugins/!NotAdopted/WinterSpeak/speak/speak.dsp b/plugins/!NotAdopted/WinterSpeak/speak/speak.dsp new file mode 100644 index 0000000000..ec62dcaa90 --- /dev/null +++ b/plugins/!NotAdopted/WinterSpeak/speak/speak.dsp @@ -0,0 +1,275 @@ +# Microsoft Developer Studio Project File - Name="speak" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=speak - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "speak.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "speak.mak" CFG="speak - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "speak - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "speak - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""$/miranda/plugins/speak/speak", OOBAAAAA"
+# PROP Scc_LocalPath "."
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "speak - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TESTPLUG_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O1 /Ob2 /I ".\\" /I "D:\PROJECT\MIRANDA\MIRANDA0100" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SPEAK_EXPORTS" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x809 /d "NDEBUG"
+# ADD RSC /l 0xc09 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib /nologo /base:"0x43500000" /dll /machine:I386 /pdbtype:sept
+# SUBTRACT LINK32 /pdb:none /incremental:yes /debug /nodefaultlib
+
+!ELSEIF "$(CFG)" == "speak - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 1
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TESTPLUG_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /GX /Zi /Od /I ".\\" /I "D:\PROJECT\MIRANDA\MIRANDA0100" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SPEAK_EXPORTS" /FD /GZ /c
+# SUBTRACT CPP /X /Fr /YX
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x809 /d "_DEBUG"
+# ADD RSC /l 0xc09 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib /nologo /base:"0x43500000" /dll /incremental:no /debug /machine:I386 /out:"../../miranda0100/debug/plugins/speak.dll" /pdbtype:sept
+# SUBTRACT LINK32 /verbose /nodefaultlib
+
+!ENDIF
+
+# Begin Target
+
+# Name "speak - Win32 Release"
+# Name "speak - Win32 Debug"
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# Begin Source File
+
+SOURCE=.\checked.ico
+# End Source File
+# Begin Source File
+
+SOURCE=.\resource.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\speak.rc
+# End Source File
+# Begin Source File
+
+SOURCE=.\unchecked.ico
+# End Source File
+# End Group
+# Begin Group "Source"
+
+# PROP Default_Filter ""
+# Begin Group "config"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\config\config_database.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\config\config_database.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\config\dialog_config_active.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\config\dialog_config_active.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\config\dialog_config_engine.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\config\dialog_config_engine.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\config\speak_config.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\config\speak_config.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\config\speech_interface.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\config\speech_interface.h
+# End Source File
+# End Group
+# Begin Group "announce"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\announce\announce_database.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\announce\announce_database.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\announce\dialog_announce.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\announce\dialog_announce.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\announce\event_information.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\announce\event_information.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\announce\protocol_information.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\announce\protocol_information.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\announce\speak_announce.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\announce\speak_announce.h
+# End Source File
+# End Group
+# Begin Group "dialog"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\dialog\miranda_dialog.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\dialog\miranda_dialog.h
+# End Source File
+# End Group
+# Begin Group "defs"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\defs\voice_desc.h
+# End Source File
+# End Group
+# Begin Group "user"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\user\user_information.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\user\user_information.h
+# End Source File
+# End Group
+# Begin Source File
+
+SOURCE=.\m_speak.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\speak.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\speak.h
+# End Source File
+# End Group
+# Begin Group "Package"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\package\langpack_speak.txt
+# End Source File
+# Begin Source File
+
+SOURCE=.\package\langpack_speak_german.txt
+# End Source File
+# Begin Source File
+
+SOURCE=.\package\langpack_speak_italian.txt
+# End Source File
+# Begin Source File
+
+SOURCE=.\package\langpack_speak_russian.txt
+# End Source File
+# Begin Source File
+
+SOURCE=.\package\Speak.txt
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/plugins/!NotAdopted/WinterSpeak/speak/speak.dsw b/plugins/!NotAdopted/WinterSpeak/speak/speak.dsw new file mode 100644 index 0000000000..db7ffd011c --- /dev/null +++ b/plugins/!NotAdopted/WinterSpeak/speak/speak.dsw @@ -0,0 +1,79 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "general"=..\..\..\general\general.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+ begin source code control
+ "$/general", AIBAAAAA
+ ..\..\..\general
+ end source code control
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "main"=..\..\miranda0100\plugins\Speakv5\main.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "miranda32"=..\..\miranda0100\miranda32\miranda32.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "speak"=.\speak.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+ begin source code control
+ "$/miranda/plugins/speak", IOBAAAAA
+ .
+ end source code control
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name miranda32
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name general
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/plugins/!NotAdopted/WinterSpeak/speak/speak.h b/plugins/!NotAdopted/WinterSpeak/speak/speak.h new file mode 100644 index 0000000000..202faa6312 --- /dev/null +++ b/plugins/!NotAdopted/WinterSpeak/speak/speak.h @@ -0,0 +1,27 @@ +#ifndef guard_speak_speak_h
+#define guard_speak_speak_h
+//==============================================================================
+// Miranda Speak Plugin, © 2002 Ryan Winter
+//==============================================================================
+
+#include <windows.h>
+
+#include <miranda32/random/plugins/newpluginapi.h>
+#include <miranda32/random/skin/m_skin.h>
+#include <miranda32/random/langpack/m_langpack.h>
+#include <miranda32/ui/contactlist/m_clist.h>
+#include <miranda32/ui/options/m_options.h>
+#include <miranda32/database/m_database.h>
+#include <miranda32/protocols/protocols/m_protocols.h>
+#include <miranda32/protocols/protocols/m_protosvc.h>
+
+//==============================================================================
+//
+// Summary : speak miranda includes
+//
+// Description : The includes need to be guarded to avoid multiple declaration
+// errors
+//
+//==============================================================================
+
+#endif
\ No newline at end of file diff --git a/plugins/!NotAdopted/WinterSpeak/speak/speak.rc b/plugins/!NotAdopted/WinterSpeak/speak/speak.rc new file mode 100644 index 0000000000..b902ccfff4 --- /dev/null +++ b/plugins/!NotAdopted/WinterSpeak/speak/speak.rc @@ -0,0 +1,266 @@ +//Microsoft Developer Studio generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include <general/general.rc>
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "#include <general/general.rc>\r\n"
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// English (Australia) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENA)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_AUS
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_CONFIG DIALOGEX 0, 0, 314, 240
+STYLE DS_3DLOOK | WS_CHILD | WS_VISIBLE
+EXSTYLE WS_EX_CONTROLPARENT
+FONT 8, "MS Shell Dlg", 0, 0, 0x1
+BEGIN
+ GROUPBOX "Engine Settings",IDC_STATIC,64,45,185,113
+ COMBOBOX IDC_SELECT_VOICE,122,71,120,71,CBS_DROPDOWNLIST |
+ WS_VSCROLL | WS_TABSTOP
+ CONTROL "Slider1",IDC_SLIDER_VOLUME,"msctls_trackbar32",TBS_TOP |
+ TBS_NOTICKS | WS_TABSTOP,118,87,126,14
+ CONTROL "Slider1",IDC_SLIDER_RATE,"msctls_trackbar32",TBS_TOP |
+ TBS_NOTICKS | WS_TABSTOP,118,103,126,14
+ CONTROL "Slider1",IDC_SLIDER_PITCH,"msctls_trackbar32",TBS_TOP |
+ TBS_NOTICKS | WS_TABSTOP,118,120,126,14
+ LTEXT "Rate",IDC_STATIC,70,108,46,8
+ LTEXT "Volume",IDC_STATIC,70,92,47,8
+ LTEXT "Voice",IDC_STATIC,70,74,47,8
+ LTEXT "Pitch",IDC_STATIC,70,124,47,8
+ PUSHBUTTON "Test",IDC_BUTTON_TEST,141,139,47,14
+ LTEXT "Engine",IDC_STATIC,70,60,47,8
+ COMBOBOX IDC_SELECT_ENGINE,122,56,120,71,CBS_DROPDOWNLIST |
+ WS_VSCROLL | WS_TABSTOP
+ EDITTEXT IDC_WELCOME_MSG,72,170,170,14,ES_AUTOHSCROLL
+ GROUPBOX "Welcome Message",IDC_STATIC,64,160,185,30
+ PUSHBUTTON "Lexicon",IDC_CONFIG_LEXICON,193,139,50,14
+END
+
+IDD_ANNOUNCE DIALOG DISCARDABLE 0, 0, 314, 240
+STYLE WS_CHILD
+FONT 8, "MS Sans Serif"
+BEGIN
+ GROUPBOX "Message Events",IDC_STATIC,112,117,195,116
+ CONTROL "Read message if less characters than",
+ IDC_READ_MSG_LENGTH,"Button",BS_AUTOCHECKBOX |
+ WS_TABSTOP,120,131,150,10
+ EDITTEXT IDC_MAX_MSG,274,128,25,14,ES_AUTOHSCROLL | ES_NUMBER
+ CONTROL "Ignore event if message dialog is open",IDC_DIALOG_OPEN,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,120,142,181,10
+ GROUPBOX "Status Changes",IDC_STATIC,7,7,99,107
+ CONTROL "Offline",IDC_STATUS_OFFLINE,"Button",BS_AUTOCHECKBOX |
+ WS_TABSTOP,15,19,85,10
+ CONTROL "Online",IDC_STATUS_ONLINE,"Button",BS_AUTOCHECKBOX |
+ WS_TABSTOP,15,30,85,10
+ CONTROL "Away",IDC_STATUS_AWAY,"Button",BS_AUTOCHECKBOX |
+ WS_TABSTOP,15,41,85,10
+ CONTROL "Do not Disturb",IDC_STATUS_DND,"Button",BS_AUTOCHECKBOX |
+ WS_TABSTOP,15,52,85,10
+ CONTROL "Not Available",IDC_STATUS_NA,"Button",BS_AUTOCHECKBOX |
+ WS_TABSTOP,15,63,85,10
+ CONTROL "Occupied",IDC_STATUS_OCCUPIED,"Button",BS_AUTOCHECKBOX |
+ WS_TABSTOP,15,74,85,10
+ CONTROL "Free for Chat",IDC_STATUS_FREEFORCHAT,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,15,85,85,10
+ CONTROL "Invisible",IDC_STATUS_INVISIBLE,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,15,96,84,10
+ GROUPBOX "Occuring Events",IDC_STATIC,7,117,99,116
+ CONTROL "Incoming Message",IDC_EVENT_MESSAGE,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,15,131,85,10
+ CONTROL "Incoming URL",IDC_EVENT_URL,"Button",BS_AUTOCHECKBOX |
+ WS_TABSTOP,15,142,85,10
+ CONTROL "Incoming File",IDC_EVENT_FILE,"Button",BS_AUTOCHECKBOX |
+ WS_TABSTOP,15,153,85,10
+ CONTROL "Authorisation Request",IDC_EVENT_AUTHREQUEST,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,15,164,85,10
+ CONTROL "Added to Contact List",IDC_EVENT_ADDED,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,15,175,85,10
+ CONTROL "Ignore event if message dialog is focused",
+ IDC_DIALOG_FOCUSED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
+ 120,153,181,10
+ GROUPBOX "Status Messages",IDC_STATIC,112,7,195,107
+ CONTROL "Announce status changes on connect",
+ IDC_SUPPRESS_CONNECT,"Button",BS_AUTOCHECKBOX |
+ WS_TABSTOP,120,19,181,10
+END
+
+IDD_ACTIVEMODES DIALOG DISCARDABLE 0, 0, 314, 240
+STYLE WS_CHILD
+FONT 8, "MS Sans Serif"
+BEGIN
+ GROUPBOX "Active Modes",IDC_STATIC,40,17,90,97
+ CONTROL "Online",IDC_ACTIVE_ONLINE,"Button",BS_AUTOCHECKBOX |
+ WS_TABSTOP,47,30,75,10
+ CONTROL "Away",IDC_ACTIVE_AWAY,"Button",BS_AUTOCHECKBOX |
+ WS_TABSTOP,47,41,75,10
+ CONTROL "Do not Disturb",IDC_ACTIVE_DND,"Button",BS_AUTOCHECKBOX |
+ WS_TABSTOP,47,52,75,10
+ CONTROL "Not Available",IDC_ACTIVE_NA,"Button",BS_AUTOCHECKBOX |
+ WS_TABSTOP,47,63,75,10
+ CONTROL "Occupied",IDC_ACTIVE_OCCUPIED,"Button",BS_AUTOCHECKBOX |
+ WS_TABSTOP,47,74,75,10
+ CONTROL "Free for Chat",IDC_ACTIVE_FREEFORCHAT,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,47,85,75,10
+ CONTROL "Invisible",IDC_ACTIVE_INVISIBLE,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,47,97,75,10
+ GROUPBOX "Active Users",IDC_STATIC,137,17,131,204
+ PUSHBUTTON "All",IDC_ACTIVE_ALL,145,200,35,14
+ PUSHBUTTON "None",IDC_ACTIVE_NONE,187,200,35,14
+ CONTROL "List1",IDC_ACTIVE_USERS,"SysListView32",LVS_SMALLICON |
+ LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP,145,29,114,
+ 166
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO DISCARDABLE
+BEGIN
+ IDD_CONFIG, DIALOG
+ BEGIN
+ LEFTMARGIN, 5
+ RIGHTMARGIN, 306
+ TOPMARGIN, 4
+ BOTTOMMARGIN, 233
+ END
+
+ IDD_ANNOUNCE, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 307
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 233
+ END
+
+ IDD_ACTIVEMODES, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 307
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 233
+ END
+END
+#endif // APSTUDIO_INVOKED
+
+
+#ifndef _MAC
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 0,9,7,0
+ PRODUCTVERSION 0,0,0,0
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x40004L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "0c0904b0"
+ BEGIN
+ VALUE "Comments", "\0"
+ VALUE "CompanyName", "\0"
+ VALUE "FileDescription", "Speak plugin for Miranda ICQ\0"
+ VALUE "FileVersion", "0, 9, 7, 0\0"
+ VALUE "InternalName", "speak\0"
+ VALUE "LegalCopyright", "Copyright © 2002 Ryan Winter\0"
+ VALUE "LegalTrademarks", "\0"
+ VALUE "OriginalFilename", "speak.dll\0"
+ VALUE "PrivateBuild", "\0"
+ VALUE "ProductName", "\0"
+ VALUE "ProductVersion", "0, 0, 0, 0\0"
+ VALUE "SpecialBuild", "\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0xc09, 1200
+ END
+END
+
+#endif // !_MAC
+
+#endif // English (Australia) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/plugins/!NotAdopted/WinterSpeak/speak/unchecked.ico b/plugins/!NotAdopted/WinterSpeak/speak/unchecked.ico Binary files differnew file mode 100644 index 0000000000..ff31e16b6a --- /dev/null +++ b/plugins/!NotAdopted/WinterSpeak/speak/unchecked.ico diff --git a/plugins/!NotAdopted/WinterSpeak/speak/user/user_information.cpp b/plugins/!NotAdopted/WinterSpeak/speak/user/user_information.cpp new file mode 100644 index 0000000000..0a2317f78c --- /dev/null +++ b/plugins/!NotAdopted/WinterSpeak/speak/user/user_information.cpp @@ -0,0 +1,116 @@ +//==============================================================================
+// Miranda Speak Plugin, © 2002 Ryan Winter
+//==============================================================================
+
+#pragma warning(disable:4786)
+
+#include "user_information.h"
+
+#include "speak.h"
+
+#include <general/debug/debug.h>
+
+//------------------------------------------------------------------------------
+// public:
+//------------------------------------------------------------------------------
+UserInformation::UserInformation()
+ :
+ m_status_info(),
+ m_status_strings()
+{
+ CLASSCERR("UserInformation::UserInformation");
+
+ // insert the status strings into a map for easy access
+ m_status_strings[ID_STATUS_OFFLINE] = "%u is now offline";
+ m_status_strings[ID_STATUS_ONLINE] = "%u is now online";
+ m_status_strings[ID_STATUS_AWAY] = "%u is away";
+ m_status_strings[ID_STATUS_INVISIBLE] = "%u is invisible";
+ m_status_strings[ID_STATUS_NA] = "%u is not available";
+ m_status_strings[ID_STATUS_DND] = "%u does not want to be disturbed";
+ m_status_strings[ID_STATUS_OCCUPIED] = "%u is occupied";
+ m_status_strings[ID_STATUS_FREECHAT] = "%u is free for chat";
+}
+
+//------------------------------------------------------------------------------
+UserInformation::~UserInformation()
+{
+ CLASSCERR("UserInformation::~UserInformation");
+}
+
+//------------------------------------------------------------------------------
+bool
+UserInformation::updateStatus(HANDLE user, int status)
+{
+ CLASSCERR("UserInformation::updateStatus(," << status << ")");
+
+ bool ret = false;
+
+ // if the user exists and their status hasn't changed, then return false
+ if ((m_status_info.find(user) != m_status_info.end())
+ && (m_status_info[user] != status))
+ {
+ ret = true;
+ }
+
+ // update the status
+ m_status_info[user] = status;
+
+ return ret;
+}
+
+//------------------------------------------------------------------------------
+std::string
+UserInformation::statusString(HANDLE user)
+{
+ CLASSCERR("UserInformation::statusString()");
+
+ return m_status_strings[m_status_info[user]];
+}
+
+//------------------------------------------------------------------------------
+std::string
+UserInformation::statusModeString(HANDLE user)
+{
+ CLASSCERR("UserInformation::statusModeString()");
+
+ int status = CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION,
+ m_status_info[user], 0);
+
+ if (NULL == status)
+ {
+ return "";
+ }
+
+ return reinterpret_cast<char *>(status);
+}
+
+//------------------------------------------------------------------------------
+void
+UserInformation::insertName(std::string &str, HANDLE user) const
+{
+ CLASSCERR("UserInformation::insertName(" << str << ",)");
+
+ // insert the user's name into the string
+ str.replace(str.find("%u"), 2, nameString(user));
+}
+
+//------------------------------------------------------------------------------
+std::string
+UserInformation::nameString(HANDLE user) const
+{
+ CLASSCERR("UserInformation::nameString()");
+
+ char *ret = reinterpret_cast<char *>(
+ CallService(MS_CLIST_GETCONTACTDISPLAYNAME,
+ reinterpret_cast<unsigned int>(user),
+ 0));
+
+ if (0 == ret)
+ {
+ return "";
+ }
+
+ return Translate(ret);
+}
+
+//==============================================================================
diff --git a/plugins/!NotAdopted/WinterSpeak/speak/user/user_information.h b/plugins/!NotAdopted/WinterSpeak/speak/user/user_information.h new file mode 100644 index 0000000000..5e6ec80d46 --- /dev/null +++ b/plugins/!NotAdopted/WinterSpeak/speak/user/user_information.h @@ -0,0 +1,69 @@ +#ifndef guard_speak_user_user_information_h
+#define guard_speak_user_user_information_h
+//==============================================================================
+// Miranda Speak Plugin, © 2002 Ryan Winter
+//==============================================================================
+
+#include <windows.h>
+
+#include <map>
+#include <string>
+
+class UserInformation
+{
+ public:
+ UserInformation();
+ ~UserInformation();
+
+ //--------------------------------------------------------------------------
+ // Description : update the users status
+ // Parameters : user - the current user
+ // status - the users status
+ // Returns : true - the status changed
+ // false - the status stayed the same
+ //--------------------------------------------------------------------------
+ bool updateStatus(HANDLE user, int status);
+
+ //--------------------------------------------------------------------------
+ // Description : get a string containing the users current status string
+ // Parameters : user - the current user
+ // Returns : the string containing the users status
+ //--------------------------------------------------------------------------
+ std::string statusString(HANDLE user);
+
+ //--------------------------------------------------------------------------
+ // Description : return the status mode of the user
+ // Parameters : user - the current user
+ // Returns : the string containing the users status mode
+ //--------------------------------------------------------------------------
+ std::string statusModeString(HANDLE user);
+
+ //--------------------------------------------------------------------------
+ // Description : insert the name into the string at the %u location
+ // Parameters : str - the string to have the username inserted into
+ // user - the current user
+ //--------------------------------------------------------------------------
+ void insertName(std::string &str, HANDLE user) const;
+
+ //--------------------------------------------------------------------------
+ // Description : get the name string for the user
+ // Parameters : user - the current user
+ // Returns : a string containing the user's name
+ //--------------------------------------------------------------------------
+ std::string nameString(HANDLE user) const;
+
+ private:
+ std::map<HANDLE, int> m_status_info;
+ std::map<int, std::string> m_status_strings;
+};
+
+//==============================================================================
+//
+// Summary : Contain information about the current users
+//
+// Description : Provides an interface to get various information about the
+// user. Also holds the users current status.
+//
+//==============================================================================
+
+#endif
\ No newline at end of file |