diff options
author | George Hazan <ghazan@miranda.im> | 2020-04-22 13:39:36 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2020-04-22 13:39:36 +0300 |
commit | d752ffd9ed1a88a1ac4cedd2631f7e77d725d815 (patch) | |
tree | c73d6dd610a5d78b58712058b30ed7eaff66d673 /plugins/NewStory/src | |
parent | f34bf81d0bc84e17b38587c44bc38e9efba5cf64 (diff) |
fixes #2350 (NewStory: в настройках шаблонов нужна кнопка "Reset to default")
Diffstat (limited to 'plugins/NewStory/src')
-rw-r--r-- | plugins/NewStory/src/options.cpp | 16 | ||||
-rw-r--r-- | plugins/NewStory/src/resource.h | 1 |
2 files changed, 16 insertions, 1 deletions
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 |