summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-01-11 16:23:36 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-01-11 16:23:36 +0000
commitc559a18ca21a2a1fa3199c4bb60bcd031ec17134 (patch)
tree23a3716abd31956933bb8e01a90bff2c9eaf452b
parent764b106951b4c47cef929d17ca99e8f4a8165483 (diff)
MS_UTILS_ENTERSTRING moved from Jabber to the core, cause it's very handy
git-svn-id: http://svn.miranda-ng.org/main/trunk@7593 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--include/m_utils.h32
-rw-r--r--protocols/JabberG/res/jabber.rc14
-rw-r--r--protocols/JabberG/src/jabber_chat.cpp12
-rw-r--r--protocols/JabberG/src/jabber_groupchat.cpp2
-rw-r--r--protocols/JabberG/src/jabber_iqid_muc.cpp4
-rw-r--r--protocols/JabberG/src/jabber_menu.cpp2
-rw-r--r--protocols/JabberG/src/jabber_opt.cpp4
-rw-r--r--protocols/JabberG/src/jabber_proto.h3
-rw-r--r--protocols/JabberG/src/jabber_util.cpp220
-rw-r--r--protocols/JabberG/src/resource.h5
-rw-r--r--src/core/commonheaders.h1
-rw-r--r--src/miranda32_10.vcxproj3
-rw-r--r--src/miranda32_10.vcxproj.filters3
-rw-r--r--src/miranda32_11.vcxproj3
-rw-r--r--src/miranda32_11.vcxproj.filters3
-rw-r--r--src/miranda32_12.vcxproj3
-rw-r--r--src/miranda32_12.vcxproj.filters9
-rw-r--r--src/modules/utils/utils.cpp3
-rw-r--r--src/resource.h7
-rw-r--r--src/resource.rc12
20 files changed, 103 insertions, 242 deletions
diff --git a/include/m_utils.h b/include/m_utils.h
index a400842fa3..7b25987b6a 100644
--- a/include/m_utils.h
+++ b/include/m_utils.h
@@ -461,4 +461,36 @@ __forceinline TCHAR* Utils_ReplaceVarsT(const TCHAR *szData) {
#define MS_UTILS_GETBITMAPFILTERSTRINGST MS_UTILS_GETBITMAPFILTERSTRINGS
#endif
+/////////////////////////////////////////////////////////////////////////////////////////
+// one field form
+
+#define ESF_MULTILINE 1
+#define ESF_COMBO 2
+#define ESF_RICHEDIT 3
+#define ESF_PASSWORD 4
+
+typedef struct
+{
+ int cbSize; // structure size
+ int type; // one of ESF_* constants
+ LPCSTR szModuleName; // module name to save window size and combobox strings
+ LPCSTR szDataPrefix; // prefix for stored database variables
+ LPCTSTR caption; // window caption
+ LPTSTR *result; // initial value + result entered
+ int recentCount; // number of combobox strings to store
+ int timeout; // timeout for the form auto-close
+}
+ENTER_STRING;
+
+// enters one string
+// wParam = 0 (unused)
+// lParam = ENTER_STRING* (form description)
+// returns TRUE on pressing OK if Cancel was pressed
+#define MS_UTILS_ENTERSTRING "Utils/EnterString"
+
+__forceinline BOOL EnterString(ENTER_STRING *pForm)
+{
+ return (BOOL)CallService(MS_UTILS_ENTERSTRING, 0, (LPARAM)pForm);
+}
+
#endif // M_UTILS_H__
diff --git a/protocols/JabberG/res/jabber.rc b/protocols/JabberG/res/jabber.rc
index c10fb82dc0..42de6ac56e 100644
--- a/protocols/JabberG/res/jabber.rc
+++ b/protocols/JabberG/res/jabber.rc
@@ -707,20 +707,6 @@ BEGIN
DEFPUSHBUTTON "Send",IDOK,299,209,50,14
END
-IDD_GROUPCHAT_INPUT DIALOGEX 0, 0, 242, 42
-STYLE DS_SETFONT | DS_SETFOREGROUND | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
-EXSTYLE WS_EX_CONTROLPARENT
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
-BEGIN
- EDITTEXT IDC_TXT_MULTILINE,6,6,230,12,ES_MULTILINE | ES_AUTOVSCROLL | ES_WANTRETURN | NOT WS_VISIBLE | WS_VSCROLL
- EDITTEXT IDC_TXT_PASSWORD,6,6,230,12,ES_AUTOHSCROLL | NOT WS_VISIBLE | ES_PASSWORD
- COMBOBOX IDC_TXT_COMBO,6,6,230,92,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | NOT WS_VISIBLE | WS_VSCROLL | WS_TABSTOP
- CONTROL "",IDC_TXT_RICHEDIT,RICHEDIT_CLASS,NOT WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_TABSTOP | 0x1004,6,6,230,12
- DEFPUSHBUTTON "OK",IDOK,131,23,50,14
- PUSHBUTTON "Cancel",IDCANCEL,186,23,50,14
-END
-
-
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
diff --git a/protocols/JabberG/src/jabber_chat.cpp b/protocols/JabberG/src/jabber_chat.cpp
index 8fadba06dc..295ee89257 100644
--- a/protocols/JabberG/src/jabber_chat.cpp
+++ b/protocols/JabberG/src/jabber_chat.cpp
@@ -1065,7 +1065,7 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK*
szBuffer.Format(_T("%s: "), me->m_tszResourceName);
szTitle.Format(TranslateT("Reason to kick %s"), him->m_tszResourceName);
TCHAR *resourceName_copy = mir_tstrdup(him->m_tszResourceName); // copy resource name to prevent possible crash if user list rebuilds
- if (ppro->EnterString(szBuffer, szTitle, JES_MULTILINE, "gcReason_"))
+ if (ppro->EnterString(szBuffer, szTitle, ESF_MULTILINE, "gcReason_"))
ppro->m_ThreadInfo->send(
XmlNodeIq(_T("set"), ppro->SerialNext(), item->jid) << XQUERY(JABBER_FEAT_MUC_ADMIN)
<< XCHILD(_T("item")) << XATTR(_T("nick"), resourceName_copy) << XATTR(_T("role"), _T("none"))
@@ -1144,7 +1144,7 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK*
szBuffer.Format(_T("%s: "), me->m_tszResourceName);
szTitle.Format(TranslateT("Reason to ban %s"), him->m_tszResourceName);
- if (ppro->EnterString(szBuffer, szTitle, JES_MULTILINE, "gcReason_"))
+ if (ppro->EnterString(szBuffer, szTitle, ESF_MULTILINE, "gcReason_"))
ppro->m_ThreadInfo->send(
XmlNodeIq(_T("set"), ppro->SerialNext(), item->jid) << XQUERY(JABBER_FEAT_MUC_ADMIN)
<< XCHILD(_T("item")) << XATTR(_T("jid"), szVictimBareJid) << XATTR(_T("affiliation"), _T("outcast"))
@@ -1173,7 +1173,7 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK*
if (!szInviteTo) break;
szTitle.Format(TranslateT("Invite %s to %s"), him->m_tszResourceName, szInviteTo);
- if (!ppro->EnterString(szBuffer, szTitle, JES_MULTILINE))
+ if (!ppro->EnterString(szBuffer, szTitle, ESF_MULTILINE))
break;
szTitle.Format(_T("%s/%s"), item->jid, resourceName_copy);
@@ -1271,7 +1271,7 @@ static void sttLogListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* g
szTitle.Format(TranslateT("Set topic for %s"), gch->pDest->ptszID);
szBuffer = item->getTemp()->m_tszStatusMessage;
szBuffer.Replace(_T("\n"), _T("\r\n"));
- if (ppro->EnterString(szBuffer, szTitle, JES_RICHEDIT, "gcTopic_"))
+ if (ppro->EnterString(szBuffer, szTitle, ESF_RICHEDIT, "gcTopic_"))
ppro->m_ThreadInfo->send(
XmlNode(_T("message")) << XATTR(_T("to"), gch->pDest->ptszID) << XATTR(_T("type"), _T("groupchat"))
<< XCHILD(_T("subject"), szBuffer));
@@ -1281,7 +1281,7 @@ static void sttLogListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* g
szTitle.Format(TranslateT("Change nickname in %s"), gch->pDest->ptszID);
if (item->nick)
szBuffer = item->nick;
- if (ppro->EnterString(szBuffer, szTitle, JES_COMBO, "gcNick_")) {
+ if (ppro->EnterString(szBuffer, szTitle, ESF_COMBO, "gcNick_")) {
JABBER_LIST_ITEM *item = ppro->ListGetItemPtr(LIST_CHATROOM, gch->pDest->ptszID);
if (item != NULL) {
TCHAR text[1024];
@@ -1317,7 +1317,7 @@ static void sttLogListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* g
}
case IDM_DESTROY:
szTitle.Format(TranslateT("Reason to destroy %s"), gch->pDest->ptszID);
- if (ppro->EnterString(szBuffer, szTitle, JES_MULTILINE, "gcReason_"))
+ if (ppro->EnterString(szBuffer, szTitle, ESF_MULTILINE, "gcReason_"))
ppro->m_ThreadInfo->send(
XmlNodeIq(_T("set"), ppro->SerialNext(), gch->pDest->ptszID) << XQUERY(JABBER_FEAT_MUC_OWNER)
<< XCHILD(_T("destroy")) << XCHILD(_T("reason"), szBuffer));
diff --git a/protocols/JabberG/src/jabber_groupchat.cpp b/protocols/JabberG/src/jabber_groupchat.cpp
index 517519b3e8..1e8560dcde 100644
--- a/protocols/JabberG/src/jabber_groupchat.cpp
+++ b/protocols/JabberG/src/jabber_groupchat.cpp
@@ -753,7 +753,7 @@ static VOID CALLBACK JabberGroupchatChangeNickname(void* arg)
if (item->nick)
szBuffer = item->nick;
- if (param->ppro->EnterString(szBuffer, szTitle, JES_COMBO, "gcNick_")) {
+ if (param->ppro->EnterString(szBuffer, szTitle, ESF_COMBO, "gcNick_")) {
replaceStrT(item->nick, szBuffer);
param->ppro->SendPresenceTo(param->ppro->m_iStatus, CMString().Format(_T("%s/%s"), item->jid, szBuffer), NULL);
}
diff --git a/protocols/JabberG/src/jabber_iqid_muc.cpp b/protocols/JabberG/src/jabber_iqid_muc.cpp
index 42d460c578..1e941ee9dc 100644
--- a/protocols/JabberG/src/jabber_iqid_muc.cpp
+++ b/protocols/JabberG/src/jabber_iqid_muc.cpp
@@ -326,7 +326,7 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc(HWND hwndDlg, UINT msg, WPARAM w
ListView_GetItem(nm->hdr.hwndFrom, &lvi);
if (lvi.lParam == (LPARAM)(-1)) {
CMString szBuffer(dat->type2str());
- if (!dat->ppro->EnterString(szBuffer, NULL, JES_COMBO, "gcAddNick_"))
+ if (!dat->ppro->EnterString(szBuffer, NULL, ESF_COMBO, "gcAddNick_"))
break;
// Trim leading and trailing whitespaces
@@ -336,7 +336,7 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc(HWND hwndDlg, UINT msg, WPARAM w
CMString rsn(dat->type2str());
if (dat->type == MUC_BANLIST) {
- dat->ppro->EnterString(rsn, TranslateT("Reason to ban"), JES_COMBO, "gcAddReason_");
+ dat->ppro->EnterString(rsn, TranslateT("Reason to ban"), ESF_COMBO, "gcAddReason_");
if (szBuffer)
dat->ppro->AddMucListItem(dat, szBuffer, rsn);
else
diff --git a/protocols/JabberG/src/jabber_menu.cpp b/protocols/JabberG/src/jabber_menu.cpp
index 9d1036b90f..6f3cb5f8e2 100644
--- a/protocols/JabberG/src/jabber_menu.cpp
+++ b/protocols/JabberG/src/jabber_menu.cpp
@@ -1143,7 +1143,7 @@ INT_PTR __cdecl CJabberProto::OnMenuHandleDirectPresence(WPARAM wParam, LPARAM l
else jid = tszJid;
CMString szValue;
- if (EnterString(szValue, TranslateT("Status Message"), JES_MULTILINE))
+ if (EnterString(szValue, TranslateT("Status Message"), ESF_MULTILINE))
SendPresenceTo(res, jid, NULL, szValue);
return 0;
}
diff --git a/protocols/JabberG/src/jabber_opt.cpp b/protocols/JabberG/src/jabber_opt.cpp
index 14f3ca7cba..65ea059fc9 100644
--- a/protocols/JabberG/src/jabber_opt.cpp
+++ b/protocols/JabberG/src/jabber_opt.cpp
@@ -564,7 +564,7 @@ private:
{
CMString buf;
TCHAR pass[512];
- if (!m_proto->EnterString(buf, TranslateT("Confirm password"), JES_PASSWORD))
+ if (!m_proto->EnterString(buf, TranslateT("Confirm password"), ESF_PASSWORD))
return;
m_txtPassword.GetText(pass, SIZEOF(pass));
@@ -1849,7 +1849,7 @@ private:
void btnRegister_OnClick(CCtrlButton *)
{
CMString buf;
- if (!m_proto->EnterString(buf, TranslateT("Confirm password"), JES_PASSWORD))
+ if (!m_proto->EnterString(buf, TranslateT("Confirm password"), ESF_PASSWORD))
return;
TCHAR pass[512];
diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h
index 73d56674f7..cf57fdc42b 100644
--- a/protocols/JabberG/src/jabber_proto.h
+++ b/protocols/JabberG/src/jabber_proto.h
@@ -42,9 +42,6 @@ struct CJabberProto;
enum TJabberGcLogInfoType { INFO_BAN, INFO_STATUS, INFO_CONFIG, INFO_AFFILIATION, INFO_ROLE };
-// for JabberEnterString
-enum { JES_MULTILINE, JES_COMBO, JES_RICHEDIT, JES_PASSWORD };
-
typedef UNIQUE_MAP<TCHAR,TCharKeyCmp> U_TCHAR_MAP;
#define JABBER_DEFAULT_RECENT_COUNT 10
diff --git a/protocols/JabberG/src/jabber_util.cpp b/protocols/JabberG/src/jabber_util.cpp
index f15be70a32..ff95a160ee 100644
--- a/protocols/JabberG/src/jabber_util.cpp
+++ b/protocols/JabberG/src/jabber_util.cpp
@@ -1009,208 +1009,6 @@ void JabberCopyText(HWND hwnd, const TCHAR *text)
CloseClipboard();
}
-/////////////////////////////////////////////////////////////////////////////////////////
-// One string entry dialog
-
-struct JabberEnterStringParam
-{
- CJabberProto *ppro;
-
- int type;
- LPCTSTR caption;
- CMString &result;
- char *windowName;
- int recentCount;
- int timeout;
- int idcControl;
- int height;
-};
-
-static int sttEnterStringResizer(HWND, LPARAM, UTILRESIZECONTROL *urc)
-{
- switch (urc->wId) {
- case IDC_TXT_MULTILINE:
- case IDC_TXT_COMBO:
- case IDC_TXT_RICHEDIT:
- return RD_ANCHORX_LEFT | RD_ANCHORY_TOP | RD_ANCHORX_WIDTH | RD_ANCHORY_HEIGHT;
-
- case IDOK:
- case IDCANCEL:
- return RD_ANCHORX_RIGHT | RD_ANCHORY_BOTTOM;
- }
- return RD_ANCHORX_LEFT | RD_ANCHORY_TOP;
-}
-
-static INT_PTR CALLBACK sttEnterStringDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- JabberEnterStringParam *params = (JabberEnterStringParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
-
- switch (msg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwndDlg);
- SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)LoadSkinnedIconBig(SKINICON_OTHER_RENAME));
- SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)LoadSkinnedIcon(SKINICON_OTHER_RENAME));
- params = (JabberEnterStringParam *)lParam;
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)params);
- SetWindowText(hwndDlg, params->caption);
- {
- RECT rc; GetWindowRect(hwndDlg, &rc);
- switch (params->type) {
- case JES_PASSWORD:
- params->idcControl = IDC_TXT_PASSWORD;
- params->height = rc.bottom - rc.top;
- break;
-
- case JES_MULTILINE:
- params->idcControl = IDC_TXT_MULTILINE;
- params->height = 0;
- rc.bottom += (rc.bottom - rc.top) * 2;
- SetWindowPos(hwndDlg, NULL, 0, 0, rc.right - rc.left, rc.bottom - rc.top, SWP_NOMOVE | SWP_NOREPOSITION);
- break;
-
- case JES_COMBO:
- params->idcControl = IDC_TXT_COMBO;
- params->height = rc.bottom - rc.top;
- if (params->windowName && params->recentCount)
- params->ppro->ComboLoadRecentStrings(hwndDlg, IDC_TXT_COMBO, params->windowName, params->recentCount);
- break;
-
- case JES_RICHEDIT:
- params->idcControl = IDC_TXT_RICHEDIT;
- SendDlgItemMessage(hwndDlg, IDC_TXT_RICHEDIT, EM_AUTOURLDETECT, TRUE, 0);
- SendDlgItemMessage(hwndDlg, IDC_TXT_RICHEDIT, EM_SETEVENTMASK, 0, ENM_LINK);
- params->height = 0;
- rc.bottom += (rc.bottom - rc.top) * 2;
- SetWindowPos(hwndDlg, NULL, 0, 0, rc.right - rc.left, rc.bottom - rc.top, SWP_NOMOVE | SWP_NOREPOSITION);
- break;
- }
- }
- ShowWindow(GetDlgItem(hwndDlg, params->idcControl), SW_SHOW);
- SetDlgItemText(hwndDlg, params->idcControl, params->result);
-
- if (params->windowName)
- Utils_RestoreWindowPosition(hwndDlg, NULL, params->ppro->m_szModuleName, params->windowName);
-
- SetTimer(hwndDlg, 1000, 50, NULL);
-
- if (params->timeout > 0) {
- SetTimer(hwndDlg, 1001, 1000, NULL);
- TCHAR buf[128];
- mir_sntprintf(buf, SIZEOF(buf), TranslateT("OK (%d)"), params->timeout);
- SetDlgItemText(hwndDlg, IDOK, buf);
- }
-
- return TRUE;
-
- case WM_DESTROY:
- WindowFreeIcon(hwndDlg);
- break;
-
- case WM_TIMER:
- switch (wParam) {
- case 1000:
- KillTimer(hwndDlg,1000);
- EnableWindow(GetParent(hwndDlg), TRUE);
- break;
-
- case 1001:
- TCHAR buf[128];
- mir_sntprintf(buf, SIZEOF(buf), TranslateT("OK (%d)"), --params->timeout);
- SetDlgItemText(hwndDlg, IDOK, buf);
-
- if (params->timeout < 0) {
- KillTimer(hwndDlg, 1001);
- UIEmulateBtnClick(hwndDlg, IDOK);
- }
- }
- return TRUE;
-
- case WM_SIZE:
- {
- UTILRESIZEDIALOG urd = { 0 };
- urd.cbSize = sizeof(urd);
- urd.hInstance = hInst;
- urd.hwndDlg = hwndDlg;
- urd.lpTemplate = MAKEINTRESOURCEA(IDD_GROUPCHAT_INPUT);
- urd.pfnResizer = sttEnterStringResizer;
- CallService(MS_UTILS_RESIZEDIALOG, 0, (LPARAM)&urd);
- }
- break;
-
- case WM_GETMINMAXINFO:
- {
- LPMINMAXINFO lpmmi = (LPMINMAXINFO)lParam;
- if (params && params->height)
- lpmmi->ptMaxSize.y = lpmmi->ptMaxTrackSize.y = params->height;
- }
- break;
-
- case WM_NOTIFY:
- {
- ENLINK *param = (ENLINK *)lParam;
- if (param->nmhdr.idFrom != IDC_TXT_RICHEDIT) break;
- if (param->nmhdr.code != EN_LINK) break;
- if (param->msg != WM_LBUTTONUP) break;
-
- CHARRANGE sel;
- SendMessage(param->nmhdr.hwndFrom, EM_EXGETSEL, 0, (LPARAM) & sel);
- if (sel.cpMin != sel.cpMax) break; // allow link selection
-
- TEXTRANGE tr;
- tr.chrg = param->chrg;
- tr.lpstrText = (TCHAR *)mir_alloc(sizeof(TCHAR)*(tr.chrg.cpMax - tr.chrg.cpMin + 2));
- SendMessage(param->nmhdr.hwndFrom, EM_GETTEXTRANGE, 0, (LPARAM) & tr);
-
- char *tmp = mir_t2a(tr.lpstrText);
- CallService(MS_UTILS_OPENURL, 1, (LPARAM)tmp);
- mir_free(tmp);
- mir_free(tr.lpstrText);
- }
- return TRUE;
-
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDC_TXT_MULTILINE:
- case IDC_TXT_RICHEDIT:
- if ((HIWORD(wParam) != EN_SETFOCUS) && (HIWORD(wParam) != EN_KILLFOCUS)) {
- SetDlgItemText(hwndDlg, IDOK, TranslateT("OK"));
- KillTimer(hwndDlg, 1001);
- }
- break;
-
- case IDC_TXT_COMBO:
- if ((HIWORD(wParam) != CBN_SETFOCUS) && (HIWORD(wParam) != CBN_KILLFOCUS)) {
- SetDlgItemText(hwndDlg, IDOK, TranslateT("OK"));
- KillTimer(hwndDlg, 1001);
- }
- break;
-
- case IDCANCEL:
- if (params->windowName)
- Utils_SaveWindowPosition(hwndDlg, NULL, params->ppro->m_szModuleName, params->windowName);
-
- EndDialog(hwndDlg, 0);
- break;
-
- case IDOK:
- HWND hWnd = GetDlgItem(hwndDlg, params->idcControl);
- int len = GetWindowTextLength(hWnd);
- params->result.Truncate(len);
- GetWindowText(hWnd, params->result.GetBuffer(), len+1);
-
- if ((params->type == JES_COMBO) && params->windowName && params->recentCount)
- params->ppro->ComboAddRecentString(hwndDlg, IDC_TXT_COMBO, params->windowName, params->result, params->recentCount);
- if (params->windowName)
- Utils_SaveWindowPosition(hwndDlg, NULL, params->ppro->m_szModuleName, params->windowName);
-
- EndDialog(hwndDlg, 1);
- break;
- }
- }
-
- return FALSE;
-}
-
BOOL CJabberProto::EnterString(CMString &result, LPCTSTR caption, int type, char *windowName, int recentCount, int timeout)
{
if (caption == NULL) {
@@ -1218,8 +1016,22 @@ BOOL CJabberProto::EnterString(CMString &result, LPCTSTR caption, int type, char
result.Empty();
}
- JabberEnterStringParam param = { this, type, caption, result, windowName, recentCount, timeout };
- return DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_GROUPCHAT_INPUT), GetForegroundWindow(), sttEnterStringDlgProc, LPARAM(&param));
+ TCHAR *pData = mir_tstrdup(result);
+
+ ENTER_STRING param = { sizeof(param) };
+ param.type = type;
+ param.caption = caption;
+ param.szModuleName = m_szModuleName;
+ param.szDataPrefix = windowName;
+ param.recentCount = recentCount;
+ param.timeout = timeout;
+ param.result = &pData;
+ BOOL res = ::EnterString(&param);
+ if (res) {
+ result = pData;
+ mir_free(pData);
+ }
+ return res;
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/JabberG/src/resource.h b/protocols/JabberG/src/resource.h
index aa0b90632c..8834602db5 100644
--- a/protocols/JabberG/src/resource.h
+++ b/protocols/JabberG/src/resource.h
@@ -44,7 +44,6 @@
#define IDI_AGENTS 154
#define IDI_VCARD 155
#define IDI_SAVE 166
-#define IDD_GROUPCHAT_INPUT 167
#define IDD_JIDLIST 171
#define IDD_GROUPCHAT_INVITE 183
#define IDD_GROUPCHAT_INVITE_ACCEPT 184
@@ -182,8 +181,6 @@
#define IDC_EDIT 1131
#define IDC_LIST 1133
#define IDC_TABS 1141
-#define IDC_TXT_MULTILINE 1141
-#define IDC_TXT_PASSWORD 1142
#define IDC_MANUAL_REGISTER 1167
#define IDC_REASON 1171
#define IDC_CLIST 1172
@@ -286,7 +283,6 @@
#define IDC_TXT_ID 1295
#define IDC_CB_FILTER 1296
#define IDC_TXT_ROLE 1296
-#define IDC_TXT_COMBO 1296
#define IDC_CB_TYPE 1296
#define IDC_TXT_METHOD 1296
#define IDC_CB_MODES 1296
@@ -295,7 +291,6 @@
#define IDC_TXT_FROM 1298
#define IDC_TXT_AFFILIATION 1299
#define IDC_ICO_STATUS 1300
-#define IDC_TXT_RICHEDIT 1302
#define IDC_TXT_SLAP 1304
#define IDC_TXT_TAGS 1304
#define IDC_EMAILS 1306
diff --git a/src/core/commonheaders.h b/src/core/commonheaders.h
index 5cb9c620a2..57aa90dc68 100644
--- a/src/core/commonheaders.h
+++ b/src/core/commonheaders.h
@@ -40,6 +40,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <commctrl.h>
#include <vssym32.h>
#include <Shlwapi.h>
+#include <Richedit.h>
#ifdef _DEBUG
#include <crtdbg.h>
diff --git a/src/miranda32_10.vcxproj b/src/miranda32_10.vcxproj
index 8a3ec29ec3..dd742ec9ec 100644
--- a/src/miranda32_10.vcxproj
+++ b/src/miranda32_10.vcxproj
@@ -452,6 +452,9 @@
<ClCompile Include="modules\utils\colourpicker.cpp">
<PrecompiledHeaderFile>..\..\core\commonheaders.h</PrecompiledHeaderFile>
</ClCompile>
+ <ClCompile Include="modules\utils\enterstring.cpp" >
+ <PrecompiledHeaderFile>..\..\core\commonheaders.h</PrecompiledHeaderFile>
+ </ClCompile>
<ClCompile Include="modules\utils\hyperlink.cpp">
<PrecompiledHeaderFile>..\..\core\commonheaders.h</PrecompiledHeaderFile>
</ClCompile>
diff --git a/src/miranda32_10.vcxproj.filters b/src/miranda32_10.vcxproj.filters
index e8d729352c..4ef4ea036f 100644
--- a/src/miranda32_10.vcxproj.filters
+++ b/src/miranda32_10.vcxproj.filters
@@ -554,6 +554,9 @@
<ClCompile Include="modules\srmm\statusicon.cpp">
<Filter>Modules\srmm</Filter>
</ClCompile>
+ <ClCompile Include="modules\utils\enterstring.cpp">
+ <Filter>Modules\utils</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="resource.rc">
diff --git a/src/miranda32_11.vcxproj b/src/miranda32_11.vcxproj
index 01945ac124..4eed34ef0c 100644
--- a/src/miranda32_11.vcxproj
+++ b/src/miranda32_11.vcxproj
@@ -455,6 +455,9 @@
<ClCompile Include="modules\utils\colourpicker.cpp">
<PrecompiledHeaderFile>..\..\core\commonheaders.h</PrecompiledHeaderFile>
</ClCompile>
+ <ClCompile Include="modules\utils\enterstring.cpp" >
+ <PrecompiledHeaderFile>..\..\core\commonheaders.h</PrecompiledHeaderFile>
+ </ClCompile>
<ClCompile Include="modules\utils\hyperlink.cpp">
<PrecompiledHeaderFile>..\..\core\commonheaders.h</PrecompiledHeaderFile>
</ClCompile>
diff --git a/src/miranda32_11.vcxproj.filters b/src/miranda32_11.vcxproj.filters
index e9e02aaa72..4cc2fe9de8 100644
--- a/src/miranda32_11.vcxproj.filters
+++ b/src/miranda32_11.vcxproj.filters
@@ -554,6 +554,9 @@
<ClCompile Include="modules\srmm\statusicon.cpp">
<Filter>Modules\srmm</Filter>
</ClCompile>
+ <ClCompile Include="modules\utils\enterstring.cpp">
+ <Filter>Modules\utils</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="resource.rc">
diff --git a/src/miranda32_12.vcxproj b/src/miranda32_12.vcxproj
index caca6170ca..cd679e6818 100644
--- a/src/miranda32_12.vcxproj
+++ b/src/miranda32_12.vcxproj
@@ -456,6 +456,9 @@
<ClCompile Include="modules\utils\colourpicker.cpp">
<PrecompiledHeaderFile>..\..\core\commonheaders.h</PrecompiledHeaderFile>
</ClCompile>
+ <ClCompile Include="modules\utils\enterstring.cpp" >
+ <PrecompiledHeaderFile>..\..\core\commonheaders.h</PrecompiledHeaderFile>
+ </ClCompile>
<ClCompile Include="modules\utils\hyperlink.cpp">
<PrecompiledHeaderFile>..\..\core\commonheaders.h</PrecompiledHeaderFile>
</ClCompile>
diff --git a/src/miranda32_12.vcxproj.filters b/src/miranda32_12.vcxproj.filters
index e9e02aaa72..7bb84c760a 100644
--- a/src/miranda32_12.vcxproj.filters
+++ b/src/miranda32_12.vcxproj.filters
@@ -156,9 +156,6 @@
<ClInclude Include="..\include\m_userinfo.h">
<Filter>SDK</Filter>
</ClInclude>
- <ClInclude Include="..\include\m_utils.h">
- <Filter>SDK</Filter>
- </ClInclude>
<ClInclude Include="..\include\newpluginapi.h">
<Filter>SDK</Filter>
</ClInclude>
@@ -252,6 +249,9 @@
<ClInclude Include="..\include\m_extraicons.h">
<Filter>Modules\extraicons</Filter>
</ClInclude>
+ <ClInclude Include="..\include\m_utils.h">
+ <Filter>Modules\utils</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="core\commonheaders.cpp">
@@ -554,6 +554,9 @@
<ClCompile Include="modules\srmm\statusicon.cpp">
<Filter>Modules\srmm</Filter>
</ClCompile>
+ <ClCompile Include="modules\utils\enterstring.cpp">
+ <Filter>Modules\utils</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="resource.rc">
diff --git a/src/modules/utils/utils.cpp b/src/modules/utils/utils.cpp
index 823b981721..8bcb4a1fa7 100644
--- a/src/modules/utils/utils.cpp
+++ b/src/modules/utils/utils.cpp
@@ -43,6 +43,8 @@ void InitTimeZones(void);
int InitCrypt(void);
void UninitCrypt(void);
+INT_PTR __cdecl svcEnterString(WPARAM, LPARAM lParam);
+
static BOOL bModuleInitialized = FALSE;
static CountryListEntry countries[] = {
@@ -470,6 +472,7 @@ int LoadUtilsModule(void)
CreateServiceFunction(MS_UTILS_GETCOUNTRYBYISOCODE, GetCountryByISOCode);
CreateServiceFunction(MS_UTILS_GETCOUNTRYLIST, GetCountryList);
CreateServiceFunction(MS_UTILS_GETRANDOM, GenerateRandom);
+ CreateServiceFunction(MS_UTILS_ENTERSTRING, svcEnterString);
CreateServiceFunction(MS_SYSTEM_RESTART, RestartMiranda);
InitOpenUrl();
diff --git a/src/resource.h b/src/resource.h
index e21bd019cb..131d866515 100644
--- a/src/resource.h
+++ b/src/resource.h
@@ -21,6 +21,7 @@
#define IDI_LOADED_GRAY 113
#define IDI_NOTLOADED_GRAY 114
#define IDD_ADDED 115
+#define IDD_ENTER_STRING 116
#define IDD_URLSEND 119
#define IDD_URLRECV 120
#define IDD_AUTHREQ 121
@@ -232,6 +233,10 @@
#define IDC_GENMENU_DEFAULT 1089
#define IDC_CANVAS 1094
#define IDC_CANVAS2 1095
+#define IDC_TXT_MULTILINE 1096
+#define IDC_TXT_PASSWORD 1097
+#define IDC_TXT_COMBO 1098
+#define IDC_TXT_RICHEDIT 1099
#define IDC_BUILDTIME 1108
#define IDC_CREDITSFILE 1109
#define IDC_NUMBER 1113
@@ -537,7 +542,7 @@
#define ID_UNGROUP 40067
// Next default values for new objects
-//
+//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 328
diff --git a/src/resource.rc b/src/resource.rc
index 9395c2ee0f..52e895917e 100644
--- a/src/resource.rc
+++ b/src/resource.rc
@@ -723,6 +723,18 @@ BEGIN
LTEXT "You can group/ungroup icons by selecting them (CTRL+left click) and using the popup menu (right click)",IDC_STATIC,1,208,274,20
END
+IDD_ENTER_STRING DIALOGEX 0, 0, 242, 42
+STYLE DS_SETFONT | DS_SETFOREGROUND | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
+EXSTYLE WS_EX_CONTROLPARENT
+FONT 8, "MS Shell Dlg", 0, 0, 0x1
+BEGIN
+ EDITTEXT IDC_TXT_MULTILINE,6,6,230,12,ES_MULTILINE | ES_AUTOVSCROLL | ES_WANTRETURN | NOT WS_VISIBLE | WS_VSCROLL
+ EDITTEXT IDC_TXT_PASSWORD,6,6,230,12,ES_AUTOHSCROLL | NOT WS_VISIBLE | ES_PASSWORD
+ COMBOBOX IDC_TXT_COMBO,6,6,230,92,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | NOT WS_VISIBLE | WS_VSCROLL | WS_TABSTOP
+ CONTROL "",IDC_TXT_RICHEDIT,"RichEdit20W",NOT WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_TABSTOP | 0x1004,6,6,230,12
+ DEFPUSHBUTTON "OK",IDOK,131,23,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,186,23,50,14
+END
/////////////////////////////////////////////////////////////////////////////
//