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/res/resource.rc | 11 ++++++----- plugins/NewStory/src/options.cpp | 16 +++++++++++++++- plugins/NewStory/src/resource.h | 1 + 3 files changed, 22 insertions(+), 6 deletions(-) (limited to 'plugins') diff --git a/plugins/NewStory/res/resource.rc b/plugins/NewStory/res/resource.rc index 8f7ae835a6..340661acad 100644 --- a/plugins/NewStory/res/resource.rc +++ b/plugins/NewStory/res/resource.rc @@ -148,17 +148,18 @@ IDD_OPT_TEMPLATES DIALOGEX 0, 0, 307, 223 STYLE DS_SETFONT | WS_CHILD FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN + LTEXT "Template list:",IDC_STATIC,7,7,140,8 CONTROL "Tree1",IDC_TEMPLATES,"SysTreeView32",TVS_DISABLEDRAGDROP | TVS_SHOWSELALWAYS | TVS_FULLROWSELECT | WS_BORDER | WS_TABSTOP,12,20,135,117 LTEXT "Edit template:",IDC_STATIC,7,142,293,8 EDITTEXT IDC_EDITTEMPLATE,12,155,288,42,ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_WANTRETURN - CONTROL "",IDC_VARHELP,"MButtonClass",WS_DISABLED | WS_TABSTOP,284,202,16,14 - EDITTEXT IDC_PREVIEW,162,20,138,42,ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY - LTEXT "Template list:",IDC_STATIC,7,7,140,8 LTEXT "Text preview:",IDC_STATIC,157,7,143,8 - CONTROL "",IDC_DISCARD,"MButtonClass",WS_TABSTOP,252,202,16,14 + EDITTEXT IDC_PREVIEW,162,20,138,42,ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY LTEXT "Graphic preview:",IDC_STATIC,157,67,143,8 CONTROL "",IDC_GPREVIEW,"MTextControl",WS_TABSTOP,162,80,138,57 - CONTROL "",IDC_UPDATEPREVIEW,"MButtonClass",WS_TABSTOP,268,202,16,14 + CONTROL "",IDC_RESET,"MButtonClass",WS_TABSTOP,230,202,16,16 + CONTROL "",IDC_DISCARD,"MButtonClass",WS_TABSTOP,248,202,16,16 + CONTROL "",IDC_UPDATEPREVIEW,"MButtonClass",WS_TABSTOP,266,202,16,16 + CONTROL "",IDC_VARHELP,"MButtonClass",WS_DISABLED | WS_TABSTOP,284,202,16,16 END IDD_FILTERMODE DIALOGEX 0, 0, 219, 171 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