diff options
Diffstat (limited to 'src/core/stdaway')
-rw-r--r-- | src/core/stdaway/res/resource.rc | 65 | ||||
-rw-r--r-- | src/core/stdaway/src/options.cpp | 73 | ||||
-rw-r--r-- | src/core/stdaway/src/resource.h | 27 | ||||
-rw-r--r-- | src/core/stdaway/src/stdafx.h | 2 | ||||
-rw-r--r-- | src/core/stdaway/stdaway.vcxproj | 1 | ||||
-rw-r--r-- | src/core/stdaway/stdaway.vcxproj.filters | 3 |
6 files changed, 113 insertions, 58 deletions
diff --git a/src/core/stdaway/res/resource.rc b/src/core/stdaway/res/resource.rc index d1034fcbe2..47616ab7f5 100644 --- a/src/core/stdaway/res/resource.rc +++ b/src/core/stdaway/res/resource.rc @@ -1,13 +1,12 @@ // Microsoft Visual C++ generated resource script.
//
-#include "..\..\mir_app\src\resource.h"
+#include "..\src\resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
-#include <windows.h>
#include <winres.h>
/////////////////////////////////////////////////////////////////////////////
@@ -36,12 +35,11 @@ BEGIN EDITTEXT IDC_MSG,5,5,177,43,ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | NOT WS_VISIBLE | WS_VSCROLL
END
-IDD_OPT_AWAYMSG DIALOGEX 0, 0, 263, 151
+IDD_OPT_AWAYMSG DIALOGEX 0, 0, 263, 170
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
- GROUPBOX "Status messages",IDC_STATIC,4,5,255,142
COMBOBOX IDC_STATUS,12,19,240,97,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "Do not reply to requests for this message",IDC_DONTREPLY,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,24,37,227,10
@@ -52,6 +50,8 @@ BEGIN CONTROL "By default, use this message:",IDC_USESPECIFIC,"Button",BS_AUTORADIOBUTTON,23,78,227,10
EDITTEXT IDC_MSG,33,91,219,38,ES_MULTILINE | ES_AUTOVSCROLL | ES_WANTRETURN | WS_VSCROLL
LTEXT "Use %time% for the current time, %date% for the current date",IDC_STATIC,33,131,219,8
+ GROUPBOX "Status messages",IDC_STATIC,4,5,255,160
+ PUSHBUTTON "Reset",IDC_RESET,202,144,50,14
END
IDD_SETAWAYMSG DIALOGEX 0, 0, 187, 72
@@ -64,7 +64,6 @@ BEGIN EDITTEXT IDC_MSG,5,5,177,43,ES_MULTILINE | ES_AUTOVSCROLL | ES_WANTRETURN | WS_VSCROLL
END
-#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
@@ -74,27 +73,9 @@ END #ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
BEGIN
- IDD_READAWAYMSG, DIALOG
- BEGIN
- LEFTMARGIN, 5
- RIGHTMARGIN, 182
- TOPMARGIN, 5
- BOTTOMMARGIN, 67
- END
IDD_OPT_AWAYMSG, DIALOG
BEGIN
- LEFTMARGIN, 4
- RIGHTMARGIN, 259
- TOPMARGIN, 4
- BOTTOMMARGIN, 147
- END
-
- IDD_SETAWAYMSG, DIALOG
- BEGIN
- LEFTMARGIN, 5
- RIGHTMARGIN, 182
- TOPMARGIN, 5
- BOTTOMMARGIN, 67
+ BOTTOMMARGIN, 151
END
END
#endif // APSTUDIO_INVOKED
@@ -106,22 +87,48 @@ END // TEXTINCLUDE
//
-1 TEXTINCLUDE
+1 TEXTINCLUDE
BEGIN
- "..\..\mir_app\src\resource.h\0"
+ "..\\src\\resource.h\0"
END
-2 TEXTINCLUDE
+2 TEXTINCLUDE
BEGIN
- "#include <windows.h>\r\n"
"#include <winres.h>\r\n"
"\0"
END
-3 TEXTINCLUDE
+3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// AFX_DIALOG_LAYOUT
+//
+
+IDD_OPT_AWAYMSG AFX_DIALOG_LAYOUT
+BEGIN
+ 0
+END
+
+#endif // English (United States) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/src/core/stdaway/src/options.cpp b/src/core/stdaway/src/options.cpp index 1287a623d3..a5cc267eb6 100644 --- a/src/core/stdaway/src/options.cpp +++ b/src/core/stdaway/src/options.cpp @@ -34,9 +34,10 @@ class CAwayMsgOptsDlg : public CDlgBase {
struct
{
- int ignore;
- int noDialog;
- int usePrevious;
+ int iStatus;
+ bool bIgnore;
+ bool bNoDialog;
+ bool bUsePrevious;
wchar_t msg[1024];
}
m_info[_countof(statusModes)];
@@ -46,18 +47,23 @@ class CAwayMsgOptsDlg : public CDlgBase CCtrlEdit etdMsg;
CCtrlCombo cmbStatus;
CCtrlCheck chkDontReply, chkUsePrev, chkUseSpecific, chkNoDialog;
+ CCtrlButton btnReset;
public:
CAwayMsgOptsDlg() :
CDlgBase(g_plugin, IDD_OPT_AWAYMSG),
etdMsg(this, IDC_MSG),
+ btnReset(this, IDC_RESET),
cmbStatus(this, IDC_STATUS),
chkUsePrev(this, IDC_USEPREVIOUS),
chkNoDialog(this, IDC_NODIALOG),
chkDontReply(this, IDC_DONTREPLY),
chkUseSpecific(this, IDC_USESPECIFIC)
{
+ btnReset.OnClick = Callback(this, &CAwayMsgOptsDlg::onClick_Reset);
+
chkUsePrev.OnChange = chkDontReply.OnChange = chkUseSpecific.OnChange = Callback(this, &CAwayMsgOptsDlg::onSelChange_Status);
+
cmbStatus.OnSelChanged = Callback(this, &CAwayMsgOptsDlg::onSelChange_Status);
}
@@ -67,16 +73,19 @@ public: if (!(protoModeMsgFlags & Proto_Status2Flag(it)))
continue;
- int j = cmbStatus.AddString(Clist_GetStatusModeDescription(it, 0), it);
- m_info[j].ignore = g_plugin.GetStatusModeByte(it, "Ignore");
- m_info[j].noDialog = g_plugin.GetStatusModeByte(it, "NoDlg", true);
- m_info[j].usePrevious = g_plugin.GetStatusModeByte(it, "UsePrev");
+ int j = cmbStatus.AddString(Clist_GetStatusModeDescription(it, 0));
+ auto &pPage = m_info[j];
+ pPage.iStatus = it;
+ pPage.bIgnore = g_plugin.GetStatusModeByte(it, "Ignore");
+ pPage.bNoDialog = g_plugin.GetStatusModeByte(it, "NoDlg", true);
+ pPage.bUsePrevious = g_plugin.GetStatusModeByte(it, "UsePrev");
DBVARIANT dbv;
if (g_plugin.getWString(StatusModeToDbSetting(it, "Default"), &dbv))
if (g_plugin.getWString(StatusModeToDbSetting(it, "Msg"), &dbv))
dbv.pwszVal = mir_wstrdup(GetDefaultMessage(it));
- mir_wstrcpy(m_info[j].msg, dbv.pwszVal);
+
+ mir_wstrcpy(pPage.msg, dbv.pwszVal);
mir_free(dbv.pwszVal);
}
@@ -90,36 +99,44 @@ public: onSelChange_Status(0);
for (int i = cmbStatus.GetCount() - 1; i >= 0; i--) {
- int status = cmbStatus.GetItemData(i);
- g_plugin.SetStatusModeByte(status, "Ignore", (uint8_t)m_info[i].ignore);
- g_plugin.SetStatusModeByte(status, "NoDlg", (uint8_t)m_info[i].noDialog);
- g_plugin.SetStatusModeByte(status, "UsePrev", (uint8_t)m_info[i].usePrevious);
- g_plugin.setWString(StatusModeToDbSetting(status, "Default"), m_info[i].msg);
+ auto &pPage = m_info[i];
+ g_plugin.SetStatusModeByte(pPage.iStatus, "Ignore", (uint8_t)pPage.bIgnore);
+ g_plugin.SetStatusModeByte(pPage.iStatus, "NoDlg", (uint8_t)pPage.bNoDialog);
+ g_plugin.SetStatusModeByte(pPage.iStatus, "UsePrev", (uint8_t)pPage.bUsePrevious);
+ g_plugin.setWString(StatusModeToDbSetting(pPage.iStatus, "Default"), pPage.msg);
}
return true;
}
+ void onClick_Reset(CCtrlButton *)
+ {
+ if (oldPage != -1)
+ etdMsg.SetText(GetDefaultMessage(m_info[oldPage].iStatus));
+ }
+
void onSelChange_Status(CCtrlCombo*)
{
if (oldPage != -1) {
- m_info[oldPage].ignore = chkDontReply.GetState();
- m_info[oldPage].noDialog = chkNoDialog.GetState();
- m_info[oldPage].usePrevious = chkUsePrev.GetState();
- etdMsg.GetText(m_info[oldPage].msg, _countof(m_info[oldPage].msg));
+ auto &pPage = m_info[oldPage];
+ pPage.bIgnore = chkDontReply.GetState();
+ pPage.bNoDialog = chkNoDialog.GetState();
+ pPage.bUsePrevious = chkUsePrev.GetState();
+ etdMsg.GetText(pPage.msg, _countof(pPage.msg));
}
int i = cmbStatus.GetCurSel();
- chkDontReply.SetState(i < 0 ? 0 : m_info[i].ignore);
- chkNoDialog.SetState(i < 0 ? 0 : m_info[i].noDialog);
- chkUsePrev.SetState(i < 0 ? 0 : m_info[i].usePrevious);
- chkUseSpecific.SetState(i < 0 ? 0 : !m_info[i].usePrevious);
-
- etdMsg.SetText(i < 0 ? L"" : m_info[i].msg);
-
- chkNoDialog.Enable(i < 0 ? 0 : !m_info[i].ignore);
- chkUsePrev.Enable(i < 0 ? 0 : !m_info[i].ignore);
- chkUseSpecific.Enable(i < 0 ? 0 : !m_info[i].ignore);
- etdMsg.Enable(i < 0 ? 0 : !(m_info[i].ignore || m_info[i].usePrevious));
+ auto &pPage = m_info[i];
+ chkDontReply.SetState(i < 0 ? 0 : pPage.bIgnore);
+ chkNoDialog.SetState(i < 0 ? 0 : pPage.bNoDialog);
+ chkUsePrev.SetState(i < 0 ? 0 : pPage.bUsePrevious);
+ chkUseSpecific.SetState(i < 0 ? 0 : !pPage.bUsePrevious);
+
+ etdMsg.SetText(i < 0 ? L"" : pPage.msg);
+
+ chkNoDialog.Enable(i < 0 ? 0 : !pPage.bIgnore);
+ chkUsePrev.Enable(i < 0 ? 0 : !pPage.bIgnore);
+ chkUseSpecific.Enable(i < 0 ? 0 : !pPage.bIgnore);
+ etdMsg.Enable(i < 0 ? 0 : !(pPage.bIgnore || pPage.bUsePrevious));
oldPage = i;
}
};
diff --git a/src/core/stdaway/src/resource.h b/src/core/stdaway/src/resource.h new file mode 100644 index 0000000000..e354546e16 --- /dev/null +++ b/src/core/stdaway/src/resource.h @@ -0,0 +1,27 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by W:\miranda-ng\src\core\stdaway\res\resource.rc +// +#define IDD_READAWAYMSG 101 +#define IDD_OPT_AWAYMSG 102 +#define IDD_SETAWAYMSG 103 +#define IDC_BUTTON1 1000 +#define IDC_RETRIEVING 1001 +#define IDC_MSG 1002 +#define IDC_STATUS 1003 +#define IDC_DONTREPLY 1004 +#define IDC_NODIALOG 1005 +#define IDC_USEPREVIOUS 1006 +#define IDC_USESPECIFIC 1007 +#define IDC_RESET 1008 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 102 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/src/core/stdaway/src/stdafx.h b/src/core/stdaway/src/stdafx.h index 83d5a859c9..e82cbc8d33 100644 --- a/src/core/stdaway/src/stdafx.h +++ b/src/core/stdaway/src/stdafx.h @@ -64,7 +64,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "version.h"
-#include "../../mir_app/src/resource.h"
+#include "../src/resource.h"
#define MODULENAME "SRAway"
diff --git a/src/core/stdaway/stdaway.vcxproj b/src/core/stdaway/stdaway.vcxproj index 9316ee1efe..c572e82baa 100644 --- a/src/core/stdaway/stdaway.vcxproj +++ b/src/core/stdaway/stdaway.vcxproj @@ -33,6 +33,7 @@ <ClCompile Include="src\stdafx.cxx">
<PrecompiledHeader>Create</PrecompiledHeader>
</ClCompile>
+ <ClInclude Include="src\resource.h" />
<ClInclude Include="src\stdafx.h" />
<ClInclude Include="src\version.h" />
</ItemGroup>
diff --git a/src/core/stdaway/stdaway.vcxproj.filters b/src/core/stdaway/stdaway.vcxproj.filters index cc89ad810a..53411a072d 100644 --- a/src/core/stdaway/stdaway.vcxproj.filters +++ b/src/core/stdaway/stdaway.vcxproj.filters @@ -25,6 +25,9 @@ <ClInclude Include="src\version.h">
<Filter>Header Files</Filter>
</ClInclude>
+ <ClInclude Include="src\resource.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="res\resource.rc">
|