diff options
author | George Hazan <george.hazan@gmail.com> | 2024-11-22 21:02:01 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2024-11-22 21:02:01 +0300 |
commit | 102004f61dc8d254f900818c6fafe91c7270690c (patch) | |
tree | 6219b1bdd7e847a7476aef4f62f1b5627e2113d9 | |
parent | 8e17c8b03821a89f06e74e8ced95ea1e16d23b03 (diff) |
PluginUpdater: fix for a glitch in options
-rw-r--r-- | plugins/PluginUpdater/src/Options.cpp | 66 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/resource.h | 16 |
2 files changed, 31 insertions, 51 deletions
diff --git a/plugins/PluginUpdater/src/Options.cpp b/plugins/PluginUpdater/src/Options.cpp index 9fb7ecfa6c..3de1c9f53d 100644 --- a/plugins/PluginUpdater/src/Options.cpp +++ b/plugins/PluginUpdater/src/Options.cpp @@ -71,6 +71,7 @@ wchar_t* GetDefaultUrl() class COptionsDlg : public CDlgBase
{
+ CCtrlEdit edtCustom;
CCtrlSpin spinBackups, spinPeriod;
CCtrlCombo cmbPeriod;
CCtrlCheck chkPeriod, chkStable, chkStableSym, chkTrunk, chkTrunkSym, chkCustom;
@@ -86,19 +87,19 @@ class COptionsDlg : public CDlgBase wchar_t defurl[MAX_PATH];
if (chkStable.GetState()) {
mir_snwprintf(defurl, DEFAULT_UPDATE_URL, GetBits());
- SetDlgItemText(m_hwnd, IDC_CUSTOMURL, defurl);
+ edtCustom.SetText(defurl);
}
else if (chkStableSym.GetState()) {
mir_snwprintf(defurl, DEFAULT_UPDATE_URL_STABLE_SYMBOLS, GetBits());
- SetDlgItemText(m_hwnd, IDC_CUSTOMURL, defurl);
+ edtCustom.SetText(defurl);
}
else if (chkTrunk.GetState()) {
mir_snwprintf(defurl, DEFAULT_UPDATE_URL_TRUNK, GetBits());
- SetDlgItemText(m_hwnd, IDC_CUSTOMURL, defurl);
+ edtCustom.SetText(defurl);
}
else if (chkTrunkSym.GetState()) {
mir_snwprintf(defurl, DEFAULT_UPDATE_URL_TRUNK_SYMBOLS, GetBits());
- SetDlgItemText(m_hwnd, IDC_CUSTOMURL, defurl);
+ edtCustom.SetText(defurl);
}
}
@@ -119,6 +120,7 @@ public: chkStable(this, IDC_STABLE),
chkStableSym(this, IDC_STABLE_SYMBOLS),
chkCustom(this, IDC_CUSTOM),
+ edtCustom(this, IDC_CUSTOMURL),
spinPeriod(this, IDC_PERIODSPIN, 99, 1),
spinBackups(this, IDC_BACKUPS_SPIN, 10, 1)
@@ -135,11 +137,8 @@ public: chkPeriod.OnChange = Callback(this, &COptionsDlg::onChange_Period);
chkStartup.OnChange = Callback(this, &COptionsDlg::onChange_Startup);
- chkTrunk.OnChange = Callback(this, &COptionsDlg::onChange_Trunk);
- chkTrunkSym.OnChange = Callback(this, &COptionsDlg::onChange_TrunkSymbols);
- chkStable.OnChange = Callback(this, &COptionsDlg::onChange_Stable);
- chkStableSym.OnChange = Callback(this, &COptionsDlg::onChange_StableSymbols);
- chkCustom.OnChange = Callback(this, &COptionsDlg::onChange_Custom);
+ chkTrunk.OnChange = chkTrunkSym.OnChange = chkStable.OnChange = chkStableSym.OnChange = chkCustom.OnChange =
+ Callback(this, &COptionsDlg::onChange_Source);
}
bool OnInitDialog() override
@@ -190,13 +189,13 @@ public: break;
default:
chkCustom.SetState(true);
- EnableWindow(GetDlgItem(m_hwnd, IDC_CUSTOMURL), TRUE);
+ edtCustom.Enable();
chkPlatform.Disable();
ptrW url(g_plugin.getWStringA(DB_SETTING_UPDATE_URL));
if (url == NULL)
url = GetDefaultUrl();
- SetDlgItemText(m_hwnd, IDC_CUSTOMURL, url);
+ edtCustom.SetText(url);
}
#ifndef _WIN64
@@ -236,7 +235,7 @@ public: }
else {
wchar_t wszUrl[100];
- GetDlgItemText(m_hwnd, IDC_CUSTOMURL, wszUrl, _countof(wszUrl));
+ edtCustom.GetText(wszUrl, _countof(wszUrl));
g_plugin.setWString(DB_SETTING_UPDATE_URL, wszUrl);
iNewMode = UPDATE_MODE_CUSTOM;
}
@@ -293,43 +292,24 @@ public: cmbPeriod.Enable(value);
}
- void onChange_TrunkSymbols(CCtrlCheck *)
+ void onChange_Source(CCtrlCheck *pCheck)
{
- chkPlatform.Enable();
- EnableWindow(GetDlgItem(m_hwnd, IDC_CUSTOMURL), FALSE);
- UpdateUrl();
- }
-
- void onChange_Trunk(CCtrlCheck *)
- {
- chkPlatform.Enable();
- EnableWindow(GetDlgItem(m_hwnd, IDC_CUSTOMURL), FALSE);
- UpdateUrl();
- }
-
- void onChange_Stable(CCtrlCheck *)
- {
- chkPlatform.Enable();
- EnableWindow(GetDlgItem(m_hwnd, IDC_CUSTOMURL), FALSE);
- UpdateUrl();
- }
+ if (!m_bInitialized)
+ return;
- void onChange_StableSymbols(CCtrlCheck *)
- {
- chkPlatform.Enable();
- EnableWindow(GetDlgItem(m_hwnd, IDC_CUSTOMURL), FALSE);
- UpdateUrl();
- }
+ if (pCheck->GetCtrlId() != IDC_CUSTOM) {
+ chkPlatform.Enable();
+ edtCustom.Disable();
+ UpdateUrl();
+ }
+ else {
+ chkPlatform.Disable();
+ edtCustom.Enable();
- void onChange_Custom(CCtrlCheck *)
- {
- chkPlatform.Disable();
- EnableWindow(GetDlgItem(m_hwnd, IDC_CUSTOMURL), TRUE);
- {
ptrW url(g_plugin.getWStringA(DB_SETTING_UPDATE_URL));
if (url == NULL)
url = GetDefaultUrl();
- SetDlgItemText(m_hwnd, IDC_CUSTOMURL, url);
+ edtCustom.SetText(url);
}
}
diff --git a/plugins/PluginUpdater/src/resource.h b/plugins/PluginUpdater/src/resource.h index 38c82a5170..af0d59cc8c 100644 --- a/plugins/PluginUpdater/src/resource.h +++ b/plugins/PluginUpdater/src/resource.h @@ -43,14 +43,14 @@ #define IDC_PERIODSPIN 1039
#define IDC_PERIODMEASURE 1040
#define IDC_CUSTOMURL 1042
-#define IDC_STABLE 1043
-#define IDC_TRUNK 1044
-#define IDC_TRUNK_SYMBOLS 1045
-#define IDC_CUSTOM 1046
-#define IDC_SILENTMODE 1047
-#define IDC_NEEDRESTARTLABEL 1048
-#define IDC_BACKUP 1049
-#define IDC_STABLE_SYMBOLS 1050
+#define IDC_TRUNK 1043
+#define IDC_TRUNK_SYMBOLS 1044
+#define IDC_STABLE 1045
+#define IDC_STABLE_SYMBOLS 1046
+#define IDC_CUSTOM 1047
+#define IDC_SILENTMODE 1048
+#define IDC_NEEDRESTARTLABEL 1049
+#define IDC_BACKUP 1050
#define IDC_USE_HTTPS 1051
#define IDC_CHANGE_PLATFORM 1052
#define IDC_SEARCH 1053
|