From ff3e3d685cc9fc8e924f57f0371dfc3a4d5c20d8 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 10 May 2018 13:29:53 +0200 Subject: fixes #1338 (StdMsg: add "Send on Ctr+Enter" option) --- src/core/stdmsg/res/resource.rc | 31 ++++++++++++++++++------------- src/core/stdmsg/src/globals.cpp | 1 + src/core/stdmsg/src/globals.h | 1 + src/core/stdmsg/src/msgdialog.cpp | 6 +++++- src/core/stdmsg/src/msgoptions.cpp | 4 +++- src/core/stdmsg/src/resource.h | 13 +++++-------- 6 files changed, 33 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/core/stdmsg/res/resource.rc b/src/core/stdmsg/res/resource.rc index 1fd8b4fb82..bbe30e819d 100644 --- a/src/core/stdmsg/res/resource.rc +++ b/src/core/stdmsg/res/resource.rc @@ -33,8 +33,12 @@ EXSTYLE WS_EX_CONTROLPARENT FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN LTEXT "Automatically popup window when:",IDC_STATIC,7,7,141,13 - CONTROL "Tree1",IDC_POPLIST,"SysTreeView32",TVS_DISABLEDRAGDROP | TVS_NOTOOLTIPS | TVS_NOHSCROLL | TVS_NONEVENHEIGHT | WS_BORDER | WS_HSCROLL | WS_TABSTOP,199,6,98,42 + CONTROL "Tree1",IDC_POPLIST,"SysTreeView32",TVS_DISABLEDRAGDROP | TVS_NOTOOLTIPS | TVS_NOHSCROLL | TVS_NONEVENHEIGHT | WS_BORDER | WS_TABSTOP,199,6,98,42 CONTROL "In background",IDC_DONOTSTEALFOCUS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,21,130,10 + + LTEXT "Maximum number of flashes",IDC_STATIC,7,35,141,8 + EDITTEXT IDC_NFLASHES,148,33,25,12,ES_AUTOHSCROLL | ES_NUMBER + CONTROL "Close the message window on send",IDC_AUTOCLOSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,50,289,10 CONTROL "Minimize the message window on send",IDC_AUTOMIN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,62,289,10 CONTROL "Use the contact's status icon as the window icon",IDC_STATUSWIN, @@ -42,27 +46,28 @@ BEGIN CONTROL "Save the window size and location individually for each contact",IDC_SAVEPERCONTACT, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,86,289,10 CONTROL "Cascade new windows",IDC_CASCADE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,98,289,10 - CONTROL "Show 'Send' button",IDC_SHOWSENDBTN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,166,135,10 - CONTROL "Show toolbar buttons on top row",IDC_SHOWBUTTONLINE, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,192,137,10 - CONTROL "Send message on double 'Enter'",IDC_SENDONDBLENTER, - "Button", BS_AUTORADIOBUTTON | WS_TABSTOP,148,166,149,10 - CONTROL "Send message on 'Enter'",IDC_SENDONENTER,"Button", BS_AUTORADIOBUTTON | WS_TABSTOP,148,179,152,10 - CONTROL "Show character count",IDC_CHARCOUNT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,148,192,149,10 - LTEXT "Show warning when message has not been received after",IDC_STATIC,8,208,211,8 - EDITTEXT IDC_SECONDS,223,206,25,12,ES_AUTOHSCROLL - LTEXT "seconds",IDC_STATIC,253,208,44,8 CONTROL "Support CTRL+Up/Down in message area to show previously sent messages",IDC_CTRLSUPPORT, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,110,289,10 CONTROL "Delete temporary contacts when closing message window",IDC_DELTEMP, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,122,287,10 CONTROL "Enable avatar support in the message window",IDC_AVATARSUPPORT, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,135,289,10 + CONTROL "Limit avatar height to",IDC_LIMITAVATARH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,149,126,10 EDITTEXT IDC_AVATARHEIGHT,148,148,28,13,ES_AUTOHSCROLL LTEXT "pixels",IDC_STATIC,181,150,35,8 - LTEXT "Maximum number of flashes",IDC_STATIC,7,35,141,8 - EDITTEXT IDC_NFLASHES,148,33,25,12,ES_AUTOHSCROLL | ES_NUMBER + + CONTROL "Show 'Send' button",IDC_SHOWSENDBTN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,166,135,10 + CONTROL "Show character count",IDC_CHARCOUNT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,179,135,10 + CONTROL "Show toolbar buttons on top row",IDC_SHOWBUTTONLINE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,192,137,10 + + CONTROL "Send message on double 'Enter'",IDC_SENDONDBLENTER,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,148,166,149,10 + CONTROL "Send message on 'Enter'",IDC_SENDONENTER,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,148,179,152,10 + CONTROL "Send message on 'Ctrl-Enter'",IDC_SENDONCTRLENTER, "Button",BS_AUTORADIOBUTTON | WS_TABSTOP,148,192,152,10 + + LTEXT "Show warning when message has not been received after",IDC_STATIC,8,208,211,8 + EDITTEXT IDC_SECONDS,223,206,25,12,ES_AUTOHSCROLL + LTEXT "seconds",IDC_STATIC,253,208,44,8 END IDD_MSGSENDERROR DIALOGEX 0, 0, 187, 110 diff --git a/src/core/stdmsg/src/globals.cpp b/src/core/stdmsg/src/globals.cpp index 01aa85af7b..1516d7582d 100644 --- a/src/core/stdmsg/src/globals.cpp +++ b/src/core/stdmsg/src/globals.cpp @@ -126,6 +126,7 @@ GlobalMessageData::GlobalMessageData() : bCtrlSupport(SRMMMOD, "SupportCtrlUpDn", true), bShowReadChar(SRMMMOD, "ShowCharCount", false), bSendOnDblEnter(SRMMMOD, "SendOnDblEnter", false), + bSendOnCtrlEnter(SRMMMOD, "SendOnCtrlEnter", false), bDeleteTempCont(SRMMMOD, "DeleteTempCont", false), bSavePerContact(SRMMMOD, "SavePerContact", false), bUseStatusWinIcon(SRMMMOD, "UseStatusWinIcon", false), diff --git a/src/core/stdmsg/src/globals.h b/src/core/stdmsg/src/globals.h index fef2a2a44f..34df8e639b 100644 --- a/src/core/stdmsg/src/globals.h +++ b/src/core/stdmsg/src/globals.h @@ -41,6 +41,7 @@ struct GlobalMessageData CMOption bShowReadChar; CMOption bSendOnEnter; CMOption bSendOnDblEnter; + CMOption bSendOnCtrlEnter; CMOption bAutoClose; CMOption bAutoMin; CMOption bTypingNew; diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp index d62015dbcc..edfd5d73c8 100644 --- a/src/core/stdmsg/src/msgdialog.cpp +++ b/src/core/stdmsg/src/msgdialog.cpp @@ -747,7 +747,11 @@ LRESULT CSrmmWindow::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam) isAlt = (GetKeyState(VK_MENU) & 0x8000) != 0; if (wParam == VK_RETURN) { - if (!isShift && isCtrl != g_dat.bSendOnEnter) { + if (!isShift && !isCtrl && g_dat.bSendOnEnter) { + onClick_Ok(&m_btnOk); + return 0; + } + if (!isShift && isCtrl && g_dat.bSendOnCtrlEnter) { onClick_Ok(&m_btnOk); return 0; } diff --git a/src/core/stdmsg/src/msgoptions.cpp b/src/core/stdmsg/src/msgoptions.cpp index 5168b2933c..b5e3112a34 100644 --- a/src/core/stdmsg/src/msgoptions.cpp +++ b/src/core/stdmsg/src/msgoptions.cpp @@ -156,7 +156,7 @@ class COptionMainDlg : public CPluginDlgBase CCtrlCheck chkAutoMin, chkAutoClose, chkSavePerContact, chkDoNotStealFocus; CCtrlCheck chkDelTemp, chkCascade, chkCharCount, chkStatusWin, chkCtrlSupport; CCtrlCheck chkAvatar, chkLimitAvatar; - CCtrlCheck chkSendOnEnter, chkSendOnDblEnter, chkShowSend, chkShowButtons; + CCtrlCheck chkSendOnEnter, chkSendOnDblEnter, chkSendOnCtrlEnter, chkShowSend, chkShowButtons; CCtrlTreeView tree; @@ -211,6 +211,7 @@ public: chkCtrlSupport(this, IDC_CTRLSUPPORT), chkSendOnEnter(this, IDC_SENDONENTER), chkSendOnDblEnter(this, IDC_SENDONDBLENTER), + chkSendOnCtrlEnter(this, IDC_SENDONCTRLENTER), chkSavePerContact(this, IDC_SAVEPERCONTACT), chkDoNotStealFocus(this, IDC_DONOTSTEALFOCUS) { @@ -239,6 +240,7 @@ public: CreateLink(chkCtrlSupport, g_dat.bCtrlSupport); CreateLink(chkSendOnEnter, g_dat.bSendOnEnter); CreateLink(chkSendOnDblEnter, g_dat.bSendOnDblEnter); + CreateLink(chkSendOnCtrlEnter, g_dat.bSendOnCtrlEnter); CreateLink(chkSavePerContact, g_dat.bSavePerContact); CreateLink(chkDoNotStealFocus, g_dat.bDoNotStealFocus); } diff --git a/src/core/stdmsg/src/resource.h b/src/core/stdmsg/src/resource.h index fda43c6d1e..affe1f1b02 100644 --- a/src/core/stdmsg/src/resource.h +++ b/src/core/stdmsg/src/resource.h @@ -1,4 +1,4 @@ -//{{NO_DEPENDENCIES}} +//{{NO_DEPENDENCIES}} // Microsoft Visual C++ generated include file. // Used by resource.rc // @@ -60,7 +60,6 @@ #define IDI_INCOMING 276 #define IDI_OUTGOING 277 #define IDI_EXCL 282 - #define IDC_SPLITTERX 1003 #define IDC_AUTOCLOSE 1004 #define IDC_AUTOMIN 1005 @@ -88,6 +87,7 @@ #define IDC_SENDONDBLENTER 1044 #define IDC_LOADTIMEN 1045 #define IDC_LOADTIMESPIN 1046 +#define IDC_SENDONCTRLENTER 1046 #define IDC_LOADTIME 1047 #define IDC_STMINSOLD 1048 #define IDC_SPIN1 1049 @@ -130,10 +130,9 @@ #define IDC_HIGHLIGHT 1089 #define IDC_TEXTO 1090 #define IDC_LOGGING 1091 - +#define IDC_STMSGLOGGROUP 1442 #define IDC_DETAILS 1469 #define IDC_USERMENU 1471 -#define IDC_STMSGLOGGROUP 1442 #define IDC_ERRORTEXT 1596 #define IDC_MSGTEXT 1597 #define IDC_SHOWNOTIFY 1600 @@ -158,7 +157,6 @@ #define IDC_CLOSETABS 1621 #define IDC_RESTORETABS 1622 #define IDC_TABSBOTTOM 1623 - #define IDM_CUT 40000 #define IDM_COPY 40001 #define IDM_PASTE 40002 @@ -169,17 +167,16 @@ #define IDM_COPYALL 40011 #define IDM_SELECTALL 40012 #define IDM_CLEAR 40013 - #define ID_MESS 40021 #define ID_COPYALL 40026 #define ID_CLEARLOG 40029 +#define ID_MESSAGE_PASTE 40030 #define ID_MESSAGE_UNDO 40033 #define ID_MESSAGE_COPY 40034 #define ID_MESSAGE_CUT 40035 #define ID_MESSAGE_CLEAR 40037 #define ID_MESSAGE_SELECTALL 40038 #define ID_MESSAGE_REDO 40039 -#define ID_MESSAGE_PASTE 40030 #define ID_CLOSE 40042 #define ID_CLOSEOTHER 40043 #define ID_LOCKPOSITION 40044 @@ -190,7 +187,7 @@ // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 290 +#define _APS_NEXT_RESOURCE_VALUE 291 #define _APS_NEXT_COMMAND_VALUE 40019 #define _APS_NEXT_CONTROL_VALUE 1620 #define _APS_NEXT_SYMED_VALUE 101 -- cgit v1.2.3