From d752ffd9ed1a88a1ac4cedd2631f7e77d725d815 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 22 Apr 2020 13:39:36 +0300 Subject: =?UTF-8?q?fixes=20#2350=20(NewStory:=20=D0=B2=20=D0=BD=D0=B0?= =?UTF-8?q?=D1=81=D1=82=D1=80=D0=BE=D0=B9=D0=BA=D0=B0=D1=85=20=D1=88=D0=B0?= =?UTF-8?q?=D0=B1=D0=BB=D0=BE=D0=BD=D0=BE=D0=B2=20=D0=BD=D1=83=D0=B6=D0=BD?= =?UTF-8?q?=D0=B0=20=D0=BA=D0=BD=D0=BE=D0=BF=D0=BA=D0=B0=20"Reset=20to=20d?= =?UTF-8?q?efault")?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/NewStory/src/options.cpp | 16 +++++++++++++++- plugins/NewStory/src/resource.h | 1 + 2 files changed, 16 insertions(+), 1 deletion(-) (limited to 'plugins/NewStory/src') diff --git a/plugins/NewStory/src/options.cpp b/plugins/NewStory/src/options.cpp index d81d5b0bbf..f6e3d0895a 100644 --- a/plugins/NewStory/src/options.cpp +++ b/plugins/NewStory/src/options.cpp @@ -33,7 +33,7 @@ class COptionsDlg : public CDlgBase CCtrlBase preview, gpreview; CCtrlEdit m_edit; - CCtrlMButton btnDiscard, btnPreview, bthVarHelp; + CCtrlMButton btnDiscard, btnPreview, bthVarHelp, btnReset; CCtrlTreeView m_tree; public: @@ -43,10 +43,12 @@ public: m_tree(this, IDC_TEMPLATES), preview(this, IDC_PREVIEW), gpreview(this, IDC_GPREVIEW), + btnReset(this, IDC_RESET, Skin_LoadIcon(SKINICON_OTHER_UNDO), LPGEN("Reset to default")), btnDiscard(this, IDC_DISCARD, g_plugin.getIcon(ICO_RESET), LPGEN("Cancel edit")), bthVarHelp(this, IDC_VARHELP, g_plugin.getIcon(ICO_VARHELP), LPGEN("Help on variables")), btnPreview(this, IDC_UPDATEPREVIEW, g_plugin.getIcon(ICO_PREVIEW), LPGEN("Update preview")) { + btnReset.OnClick = Callback(this, &COptionsDlg::onClick_Reset); btnDiscard.OnClick = Callback(this, &COptionsDlg::onClick_Discard); btnPreview.OnClick = Callback(this, &COptionsDlg::UpdatePreview); bthVarHelp.OnClick = Callback(this, &COptionsDlg::onVarHelp); @@ -121,6 +123,18 @@ public: replaceStrW(it.tmpValue, nullptr); } + void onClick_Reset(CCtrlButton *) + { + for (auto &it : templates) { + replaceStrW(it.tmpValue, nullptr); + replaceStrW(it.value, nullptr); + } + + if (m_curr) + m_edit.SetText(m_curr->defvalue); + UpdatePreview(0); + } + void onClick_Discard(CCtrlButton *) { replaceStrW(m_curr->tmpValue, 0); diff --git a/plugins/NewStory/src/resource.h b/plugins/NewStory/src/resource.h index 749746c9e7..f52b7eaf74 100644 --- a/plugins/NewStory/src/resource.h +++ b/plugins/NewStory/src/resource.h @@ -37,6 +37,7 @@ #define IDC_PROGRESS 1002 //!!! #define IDC_EDIT1 1003 //!!! #define IDC_SEARCHTEXT 1004 +#define IDC_RESET 1005 #define IDC_MESSAGE 1010 #define IDC_USERINFO 1011 #define IDC_USERMENU 1012 -- cgit v1.2.3