summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormataes2007 <mataes2007@e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb>2011-07-03 09:08:35 +0000
committermataes2007 <mataes2007@e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb>2011-07-03 09:08:35 +0000
commitd7c51a9f51f08224ef91f89547b52dbf370a4bfd (patch)
treea9e38abdd0bd5c59d7bdb59d542de6d9f56a8c11
parent63d7c410aff770eb186460b9dcc2bba8f25acd3a (diff)
TranslitSwitcher:
for history++, IEView and any popup plugins. Now you can convert layout of incoming messages. just select something from the log and press "Convert All" hotkey. you'll see a popup window with the desired result. version bump git-svn-id: http://miranda-plugins.googlecode.com/svn/trunk@139 e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb
-rw-r--r--TranslitSwitcher/Src/Layoutproc.cpp91
-rw-r--r--TranslitSwitcher/Src/TranslitSwitcher.h3
-rw-r--r--TranslitSwitcher/Version.h6
3 files changed, 89 insertions, 11 deletions
diff --git a/TranslitSwitcher/Src/Layoutproc.cpp b/TranslitSwitcher/Src/Layoutproc.cpp
index c610380..1d7e8bd 100644
--- a/TranslitSwitcher/Src/Layoutproc.cpp
+++ b/TranslitSwitcher/Src/Layoutproc.cpp
@@ -420,10 +420,84 @@ VOID SwitchLayout(BOOL lastword)
if(hwnd2 != NULL)
{
- TCHAR szClassName[16];
+ TCHAR szClassName[MAX_PATH];
GetClassName(hwnd2, szClassName, SIZEOF(szClassName));
+ if((lstrcmp(szClassName, _T("THppRichEdit.UnicodeClass")) == 0 || lstrcmp(szClassName, _T("THistoryGrid.UnicodeClass")) == 0 || lstrcmp(szClassName, _T("TExtHistoryGrid.UnicodeClass")) == 0 || lstrcmp(szClassName, _T("Internet Explorer_Server")) == 0) && ServiceExists(MS_POPUP_SHOWMESSAGE)) // make popup here
+ {
+ TCHAR buf[2048];
+
+ if (lstrcmp(szClassName, _T("Internet Explorer_Server")) == 0)
+ {
+ TCHAR *selected = 0;
+ IEVIEWEVENT event;
+ HWND hwnd3 = GetParent(GetParent(hwnd2));
+ ZeroMemory((void *)&event, sizeof(event));
+ event.cbSize = sizeof(IEVIEWEVENT);
+ event.hContact = 0;
+ event.dwFlags = 0;
+ event.iType = IEE_GET_SELECTION;
+ event.hwnd = hwnd3;
+ selected = (TCHAR *)CallService(MS_IEVIEW_EVENT, 0, (LPARAM) & event);
+ lstrcpy(buf, selected);
+ }
+ else
+ SendMessage(hwnd2, WM_GETTEXT, SIZEOF(buf), (LPARAM)buf); // gimme, gimme, gimme...
+
+ int slen = lstrlen(buf);
+ if (slen != 0)
+ {
+ HKL hkl;
+ ActivateKeyboardLayout((HKL)HKL_NEXT, KLF_ACTIVATE); // go to next layout before....
+ hkl = GetKeyboardLayout(dwThreadID);
+ ActivateKeyboardLayout((HKL)HKL_PREV, KLF_ACTIVATE); // return to prev layout
+
+ if (ServiceExists(MS_SMILEYADD_BATCHPARSE))
+ {
+ ZeroMemory(&smgp, sizeof(smgp));
+ smgp.cbSize = sizeof(smgp);
+ smgp.str = buf;
+ smgp.flag = SAFL_TCHAR;
+ smileyPrs = (SMADD_BATCHPARSERES *)CallService(MS_SMILEYADD_BATCHPARSE, 0, (LPARAM)&smgp);
+ }
+
+ for(int i = 0; i < slen; i++)
+ {
+ SHORT vks;
+ BYTE keys[256] = {0};
+
+ vks = VkKeyScanEx(buf[i], hkl);
+
+ keys[VK_SHIFT] = (HIBYTE(vks) & 1) ? 0xFF : 0x00; // shift
+ keys[VK_CONTROL] = (HIBYTE(vks) & 2) ? 0xFF : 0x00; // ctrl
+ keys[VK_MENU] = (HIBYTE(vks) & 4) ? 0xFF : 0x00; // alt
+
+ if (!isItSmiley(i))
+ {
+ TCHAR tchr;
+ if(ToUnicodeEx(LOBYTE(vks), 0, keys, &tchr, 1, 0, GetKeyboardLayout(dwThreadID)) == 1)
+ buf[i] = tchr;
+ }
+ }
+ if (smileyPrs != NULL)
+ CallService(MS_SMILEYADD_BATCHFREE, 0, (LPARAM)smileyPrs);
+
+ POPUPDATAT_V2 pd;
+ ZeroMemory(&pd, sizeof(pd));
+ pd.cbSize = sizeof(POPUPDATAT_V2);
+ pd.lchContact = NULL; //(HANDLE)wParam;
+ pd.lchIcon = (HICON)CallService(MS_SKIN2_GETICON, 0, (LPARAM) "SwitchLayout and Send");
+ lstrcpyn(pd.lptzText, buf, SIZEOF(pd.lptzText));
+ lstrcpyn(pd.lptzContactName, TranslateT("TranslitSwitcher"), SIZEOF(pd.lptzContactName));
+ pd.colorBack = pd.colorText = 0;
+ pd.iSeconds = 0;
+ CallService(MS_POPUP_ADDPOPUPT, (WPARAM) &pd, 0);
+
+ //PUShowMessageT(buf, SM_NOTIFY);
+ }
+ }
+ else
if(lstrcmp(szClassName, _T("RichEdit20W")) == 0)
{
DWORD dwStart, dwEnd;
@@ -448,13 +522,14 @@ VOID SwitchLayout(BOOL lastword)
if (slen != 0)
{
- ZeroMemory(&smgp, sizeof(smgp));
- smgp.cbSize = sizeof(smgp);
- smgp.str = sel;
- smgp.flag = SAFL_UNICODE;
-
- if (ServiceExists(MS_SMILEYADD_BATCHPARSE))
+ if (ServiceExists(MS_SMILEYADD_BATCHPARSE))
+ {
+ ZeroMemory(&smgp, sizeof(smgp));
+ smgp.cbSize = sizeof(smgp);
+ smgp.str = sel;
+ smgp.flag = SAFL_TCHAR;
smileyPrs = (SMADD_BATCHPARSERES *)CallService(MS_SMILEYADD_BATCHPARSE, 0, (LPARAM)&smgp);
+ }
end = slen;
if (lastword && !somethingIsSelected)
@@ -712,7 +787,7 @@ int OnButtonPressed(WPARAM wParam, LPARAM lParam)
ZeroMemory(&smgp, sizeof(smgp));
smgp.cbSize = sizeof(smgp);
smgp.str = sel;
- smgp.flag = SAFL_UNICODE;
+ smgp.flag = SAFL_TCHAR;
if (ServiceExists(MS_SMILEYADD_BATCHPARSE))
smileyPrs = (SMADD_BATCHPARSERES *)CallService(MS_SMILEYADD_BATCHPARSE, 0, (LPARAM)&smgp);
diff --git a/TranslitSwitcher/Src/TranslitSwitcher.h b/TranslitSwitcher/Src/TranslitSwitcher.h
index 1672a61..cc720c1 100644
--- a/TranslitSwitcher/Src/TranslitSwitcher.h
+++ b/TranslitSwitcher/Src/TranslitSwitcher.h
@@ -37,10 +37,13 @@ Boston, MA 02111-1307, USA.
#include "win2k.h"
#include <m_icolib.h>
#include "m_msg_buttonsbar.h"
+#include "m_popup.h"
#include "..\version.h"
#include "..\resource.h"
#include "m_smileyadd.h"
+#include "m_ieview.h"
+#include "m_popup2.h"
#define IDC_MESSAGE 1002
#define IDC_CHATMESSAGE 1009
diff --git a/TranslitSwitcher/Version.h b/TranslitSwitcher/Version.h
index af7d272..794cba7 100644
--- a/TranslitSwitcher/Version.h
+++ b/TranslitSwitcher/Version.h
@@ -1,7 +1,7 @@
#define __MAJOR_VERSION 0
#define __MINOR_VERSION 0
-#define __RELEASE_NUM 0
-#define __BUILD_NUM 9
+#define __RELEASE_NUM 1
+#define __BUILD_NUM 0
#define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM
#define __FILEVERSION_DOTS __MAJOR_VERSION.__MINOR_VERSION.__RELEASE_NUM.__BUILD_NUM
@@ -25,4 +25,4 @@
#define __AUTHOR "Mataes, tico-tico, Tim"
#define __AUTHOREMAIL "mataes2007@gmail.com"
#define __AUTHORWEB "http://mataes.googlecode.com/svn/Miranda/Plugins/TranslitSwitcher/"
-#define __COPYRIGHT "© 2010 Mataes, tico-tico © 2007 Dmitry Titkov"
+#define __COPYRIGHT "© 2011-2010 Mataes, tico-tico © 2007 Dmitry Titkov"