diff options
author | Tobias Weimer <wishmaster51@googlemail.com> | 2014-05-29 15:34:20 +0000 |
---|---|---|
committer | Tobias Weimer <wishmaster51@googlemail.com> | 2014-05-29 15:34:20 +0000 |
commit | d8b7b2b660f81c3d78c64641e894666ac194495d (patch) | |
tree | 0b036fd9ded5f2b2e6004fc60d29046c19ee623f /plugins/PluginUpdater/src/Options.cpp | |
parent | dcdc05c1287a9007301ecc7bfd3814f3270cc70b (diff) |
PluginUpdater:
- Fixed Apply button
- Added Logging
- Minor cleanup
git-svn-id: http://svn.miranda-ng.org/main/trunk@9351 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/PluginUpdater/src/Options.cpp')
-rw-r--r-- | plugins/PluginUpdater/src/Options.cpp | 46 |
1 files changed, 18 insertions, 28 deletions
diff --git a/plugins/PluginUpdater/src/Options.cpp b/plugins/PluginUpdater/src/Options.cpp index 10624c4ba3..ff86820cf3 100644 --- a/plugins/PluginUpdater/src/Options.cpp +++ b/plugins/PluginUpdater/src/Options.cpp @@ -20,24 +20,12 @@ Boston, MA 02111-1307, USA. #include "common.h"
PlugOptions opts;
-WNDPROC g_pOldProc;
-
-LRESULT CALLBACK MyEditProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
-{
- switch (message) {
- case WM_KEYDOWN:
- SendMessage(GetParent(GetParent(hwnd)), PSM_CHANGED, 0, 0);
- break;
- }
- return CallWindowProc(g_pOldProc, hwnd, message, wParam, lParam);
-}
INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- DBVARIANT dbv;
-
switch (msg) {
case WM_INITDIALOG:
+ {
TranslateDialogDefault(hwndDlg);
CheckDlgButton(hwndDlg, IDC_UPDATEONSTARTUP, opts.bUpdateOnStartup);
CheckDlgButton(hwndDlg, IDC_ONLYONCEADAY, opts.bOnlyOnceADay);
@@ -54,13 +42,11 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA SendDlgItemMessage(hwndDlg, IDC_PERIODSPIN, UDM_SETPOS, 0, (LPARAM)opts.Period);
Edit_LimitText(GetDlgItem(hwndDlg, IDC_PERIOD), 2);
- g_pOldProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_PERIOD), GWLP_WNDPROC, (LONG_PTR)MyEditProc);
ComboBox_InsertString(GetDlgItem(hwndDlg, IDC_PERIODMEASURE), 0, TranslateT("hours"));
ComboBox_InsertString(GetDlgItem(hwndDlg, IDC_PERIODMEASURE), 1, TranslateT("days"));
ComboBox_SetCurSel(GetDlgItem(hwndDlg, IDC_PERIODMEASURE), opts.bPeriodMeasure);
-
- EnableWindow(GetDlgItem(hwndDlg, IDC_CUSTOMURL), FALSE);
+ DBVARIANT dbv;
if ( db_get_s(NULL, MODNAME, "UpdateURL", &dbv)) {
SetDlgItemText(hwndDlg, IDC_CUSTOMURL, _T(DEFAULT_UPDATE_URL));
CheckDlgButton(hwndDlg, IDC_STABLE, TRUE);
@@ -79,14 +65,13 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA }
db_free(&dbv);
}
+ }
return TRUE;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_UPDATEONSTARTUP:
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
EnableWindow(GetDlgItem(hwndDlg, IDC_ONLYONCEADAY), IsDlgButtonChecked(hwndDlg, IDC_UPDATEONSTARTUP));
- break;
case IDC_SILENTMODE:
case IDC_ONLYONCEADAY:
@@ -111,6 +96,12 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
+ case IDC_PERIOD:
+ case IDC_CUSTOMURL:
+ if ((HWND)lParam == GetFocus() && (HIWORD(wParam) == EN_CHANGE))
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+
case IDC_PERIODMEASURE:
if (HIWORD(wParam) == CBN_SELCHANGE)
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
@@ -182,7 +173,6 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- int i;
char str[20] = {0}, str2[20] = {0};
switch (msg) {
@@ -205,7 +195,7 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) CheckDlgButton(hdlg, IDC_USEPOPUPCOLORS, BST_CHECKED);
CheckDlgButton(hdlg, IDC_USEWINCOLORS, BST_UNCHECKED);
}
- for (i = 0; i < POPUPS; i++) {
+ for (int i = 0; i < POPUPS; i++) {
SendDlgItemMessage(hdlg, (i+42071), CPM_SETCOLOUR, 0, PopupsList[i].colorBack);
SendDlgItemMessage(hdlg, (i+41071), CPM_SETCOLOUR, 0, PopupsList[i].colorText);
EnableWindow(GetDlgItem(hdlg, (i+42071)), (PopupOptions.DefColors == byCOLOR_OWN));
@@ -216,7 +206,7 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) SendDlgItemMessage(hdlg, IDC_TIMEOUT_VALUE_SPIN, UDM_SETRANGE32, -1, 9999);
SetDlgItemInt(hdlg, IDC_TIMEOUT_VALUE, PopupOptions.Timeout, TRUE);
//Mouse actions
- for (i = 0; i < SIZEOF(PopupActions); i++) {
+ for (int i = 0; i < SIZEOF(PopupActions); i++) {
SendMessage(GetDlgItem(hdlg, IDC_LC), CB_SETITEMDATA, SendMessage(GetDlgItem(hdlg, IDC_LC), CB_ADDSTRING, 0, (LPARAM)TranslateTS(PopupActions[i].Text)), PopupActions[i].Action);
SendMessage(GetDlgItem(hdlg, IDC_RC), CB_SETITEMDATA, SendMessage(GetDlgItem(hdlg, IDC_RC), CB_ADDSTRING, 0, (LPARAM)TranslateTS(PopupActions[i].Text)), PopupActions[i].Action);
}
@@ -224,7 +214,7 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) SendDlgItemMessage(hdlg, IDC_RC, CB_SETCURSEL, PopupOptions.RightClickAction, 0);
//Popups nitified
- for (i = 0; i < POPUPS; i++) {
+ for (int i = 0; i < POPUPS; i++) {
mir_snprintf(str, SIZEOF(str), "Popups%d", i);
mir_snprintf(str2, SIZEOF(str2), "Popups%dM", i);
CheckDlgButton(hdlg, (i+40071), (db_get_b(NULL, MODNAME, str, DEFAULT_POPUP_ENABLED)) ? BST_CHECKED: BST_UNCHECKED);
@@ -275,7 +265,7 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) PopupOptions.DefColors = byCOLOR_OWN;
- for (i = 0; i < POPUPS; i++) {
+ for (int i = 0; i < POPUPS; i++) {
EnableWindow(GetDlgItem(hdlg, (i+42071)), TRUE); //Background
EnableWindow(GetDlgItem(hdlg, (i+41071)), TRUE); //Text
}
@@ -288,7 +278,7 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) //Use Windows colors
PopupOptions.DefColors = byCOLOR_WINDOWS;
- for (i = 0; i < POPUPS; i++) {
+ for (int i = 0; i < POPUPS; i++) {
EnableWindow(GetDlgItem(hdlg, (i+42071)), FALSE); //Background
EnableWindow(GetDlgItem(hdlg, (i+41071)), FALSE); //Text
}
@@ -301,7 +291,7 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) //Use Popup colors
PopupOptions.DefColors = byCOLOR_POPUP;
- for (i = 0; i < POPUPS; i++) {
+ for (int i = 0; i < POPUPS; i++) {
EnableWindow(GetDlgItem(hdlg, (i+42071)), FALSE); //Background
EnableWindow(GetDlgItem(hdlg, (i+41071)), FALSE); //Text
}
@@ -364,7 +354,7 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) //Text color
char szSetting[20] = {0};
DWORD ctlColor = 0;
- for (i = 0; i <= POPUPS-1; i++) {
+ for (int i = 0; i <= POPUPS-1; i++) {
ctlColor = SendDlgItemMessage(hdlg, (i+42071), CPM_GETCOLOUR, 0, 0);
PopupsList[i].colorBack = ctlColor;
mir_snprintf(szSetting, SIZEOF(szSetting), "Popups%iBg", i);
@@ -384,7 +374,7 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) //Right mouse click
db_set_b(NULL, MODNAME, "RightClickAction", PopupOptions.RightClickAction);
//Notified popups
- for (i = 0; i < POPUPS; i++) {
+ for (int i = 0; i < POPUPS; i++) {
mir_snprintf(str, SIZEOF(str), "Popups%d", i);
db_set_b(NULL, MODNAME, str, (BYTE)(IsDlgButtonChecked(hdlg, (i+40071))));
mir_snprintf(str2, SIZEOF(str2), "Popups%dM", i);
@@ -398,7 +388,7 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) return FALSE;
}
-int OptInit(WPARAM wParam, LPARAM lParam)
+int OptInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { sizeof(odp) };
odp.position = 100000000;
|