summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2023-10-02 18:11:59 +0300
committerGeorge Hazan <george.hazan@gmail.com>2023-10-02 18:11:59 +0300
commit3e7f47be3cd75398b20b7486ed5374967ac0fa71 (patch)
tree16999fa514e1fe2e18fb2582d672bba4f10b5616
parentfce28529f1b38382c92e1987844cc67250041390 (diff)
missing controls shall not wipe database settings
-rw-r--r--plugins/TabSRMM/src/msgoptions.cpp15
-rw-r--r--src/mir_core/src/Windows/CCtrlCheck.cpp4
-rw-r--r--src/mir_core/src/Windows/CCtrlColor.cpp4
-rw-r--r--src/mir_core/src/Windows/CCtrlSlider.cpp4
-rw-r--r--src/mir_core/src/Windows/CCtrlSpin.cpp4
5 files changed, 17 insertions, 14 deletions
diff --git a/plugins/TabSRMM/src/msgoptions.cpp b/plugins/TabSRMM/src/msgoptions.cpp
index 83d0aeef0c..1cbdd9be21 100644
--- a/plugins/TabSRMM/src/msgoptions.cpp
+++ b/plugins/TabSRMM/src/msgoptions.cpp
@@ -832,9 +832,6 @@ public:
bool OnApply() override
{
- uint32_t dwFlags = M.GetDword("mwflags", MWF_LOG_DEFAULT) & ~(MWF_LOG_ALL);
- db_set_dw(0, SRMSGMOD_T, "mwflags", m_flags | dwFlags);
-
if (chkLoadCount.GetState())
g_plugin.setByte(SRMSGSET_LOADHISTORY, LOADHISTORY_COUNT);
else if (chkLoadTime.GetState())
@@ -844,14 +841,20 @@ public:
g_plugin.setWord(SRMSGSET_LOADCOUNT, spnLoadCount.GetPosition());
g_plugin.setWord(SRMSGSET_LOADTIME, spnLoadTime.GetPosition());
- db_set_dw(0, SRMSGMOD_T, "IndentAmount", spnLeft.GetPosition());
- db_set_dw(0, SRMSGMOD_T, "RightIndent", spnRight.GetPosition());
-
// scan the tree view and obtain the options...
if (chkAlwaysTrim.GetState())
db_set_dw(0, SRMSGMOD_T, "maxhist", spnTrim.GetPosition());
else
db_set_dw(0, SRMSGMOD_T, "maxhist", 0);
+
+ if (logOpts.GetHwnd()) {
+ uint32_t dwFlags = M.GetDword("mwflags", MWF_LOG_DEFAULT) & ~(MWF_LOG_ALL);
+ db_set_dw(0, SRMSGMOD_T, "mwflags", m_flags | dwFlags);
+
+ db_set_dw(0, SRMSGMOD_T, "IndentAmount", spnLeft.GetPosition());
+ db_set_dw(0, SRMSGMOD_T, "RightIndent", spnRight.GetPosition());
+ }
+
PluginConfig.reloadSettings();
Srmm_ApplyOptions();
return true;
diff --git a/src/mir_core/src/Windows/CCtrlCheck.cpp b/src/mir_core/src/Windows/CCtrlCheck.cpp
index 5e69738b23..69bedcece2 100644
--- a/src/mir_core/src/Windows/CCtrlCheck.cpp
+++ b/src/mir_core/src/Windows/CCtrlCheck.cpp
@@ -41,14 +41,14 @@ bool CCtrlCheck::OnApply()
{
CSuper::OnApply();
- if (m_dbLink != nullptr)
+ if (m_hwnd && m_dbLink)
SaveInt(GetState());
return true;
}
void CCtrlCheck::OnReset()
{
- if (m_dbLink != nullptr)
+ if (m_hwnd && m_dbLink)
SetState(LoadInt());
}
diff --git a/src/mir_core/src/Windows/CCtrlColor.cpp b/src/mir_core/src/Windows/CCtrlColor.cpp
index b61fb5760a..d41604ecf2 100644
--- a/src/mir_core/src/Windows/CCtrlColor.cpp
+++ b/src/mir_core/src/Windows/CCtrlColor.cpp
@@ -39,14 +39,14 @@ bool CCtrlColor::OnApply()
{
CSuper::OnApply();
- if (m_dbLink != nullptr)
+ if (m_hwnd && m_dbLink)
SaveInt(GetColor());
return true;
}
void CCtrlColor::OnReset()
{
- if (m_dbLink != nullptr)
+ if (m_hwnd && m_dbLink)
SetColor(LoadInt());
}
diff --git a/src/mir_core/src/Windows/CCtrlSlider.cpp b/src/mir_core/src/Windows/CCtrlSlider.cpp
index 9938736e42..3bcab67b4c 100644
--- a/src/mir_core/src/Windows/CCtrlSlider.cpp
+++ b/src/mir_core/src/Windows/CCtrlSlider.cpp
@@ -46,7 +46,7 @@ bool CCtrlSlider::OnApply()
{
CSuper::OnApply();
- if (m_dbLink != nullptr)
+ if (m_hwnd && m_dbLink)
SaveInt(GetPosition());
return true;
}
@@ -55,7 +55,7 @@ void CCtrlSlider::OnReset()
{
SendMsg(TBM_SETRANGE, 0, MAKELONG(m_wMin, m_wMax));
- if (m_dbLink != nullptr)
+ if (m_hwnd && m_dbLink)
SetPosition(LoadInt());
}
diff --git a/src/mir_core/src/Windows/CCtrlSpin.cpp b/src/mir_core/src/Windows/CCtrlSpin.cpp
index e871296259..f75c7a0f03 100644
--- a/src/mir_core/src/Windows/CCtrlSpin.cpp
+++ b/src/mir_core/src/Windows/CCtrlSpin.cpp
@@ -51,7 +51,7 @@ bool CCtrlSpin::OnApply()
CSuper::OnApply();
m_wCurr = SendMsg(UDM_GETPOS, 0, 0);
- if (m_dbLink != nullptr)
+ if (m_hwnd && m_dbLink)
SaveInt(m_wCurr);
HWND hwndBuddy = (HWND)SendMsg(UDM_GETBUDDY, 0, 0);
@@ -68,7 +68,7 @@ void CCtrlSpin::OnReset()
{
SendMsg(UDM_SETRANGE, 0, MAKELPARAM(m_wMax, m_wMin));
- if (m_dbLink != nullptr)
+ if (m_hwnd && m_dbLink)
SetPosition(LoadInt());
}