summaryrefslogtreecommitdiff
path: root/plugins/PackUpdater/Src/Options.cpp
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2015-01-02 19:40:35 +0000
committerKirill Volinsky <mataes2007@gmail.com>2015-01-02 19:40:35 +0000
commite185ce0df50fa161f5ea5c89fe0edfdbabb59185 (patch)
treea9dde200742c3edbee7d1be5e88335060372cbd6 /plugins/PackUpdater/Src/Options.cpp
parent006238c7b97bd68b99667146f1b5df1f3661f470 (diff)
fixed version compare
warning level changed to w4 git-svn-id: http://svn.miranda-ng.org/main/trunk@11726 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/PackUpdater/Src/Options.cpp')
-rw-r--r--plugins/PackUpdater/Src/Options.cpp172
1 files changed, 86 insertions, 86 deletions
diff --git a/plugins/PackUpdater/Src/Options.cpp b/plugins/PackUpdater/Src/Options.cpp
index a061a518d8..a8bb9049a9 100644
--- a/plugins/PackUpdater/Src/Options.cpp
+++ b/plugins/PackUpdater/Src/Options.cpp
@@ -1,5 +1,5 @@
-/*
-Copyright (C) 2010 Mataes
+/*
+Copyright (C) 2011-2015 Mataes
This is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
@@ -14,7 +14,7 @@ Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this file; see the file license.txt. If
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
+Boston, MA 02111-1307, USA.
*/
#include "common.h"
@@ -55,7 +55,7 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
ComboBox_SetCurSel(GetDlgItem(hwndDlg, IDC_PERIODMEASURE), PeriodMeasure);
CheckDlgButton(hwndDlg, IDC_REMINDER, Reminder ? BST_CHECKED : BST_UNCHECKED);
- if ( ServiceExists(MS_POPUP_ADDPOPUPT)) {
+ if (ServiceExists(MS_POPUP_ADDPOPUPT)) {
ShowWindow(GetDlgItem(hwndDlg, IDC_NOTIFY2), SW_HIDE);
ShowWindow(GetDlgItem(hwndDlg, IDC_MSG_BOXES2), SW_HIDE);
ShowWindow(GetDlgItem(hwndDlg, IDC_ERRORS2), SW_HIDE);
@@ -65,7 +65,7 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
else {
for (int i = 1; i < POPUPS; i++) {
mir_snprintf(str, SIZEOF(str), "Popups%dM", i);
- CheckDlgButton(hwndDlg, (i+1029), (db_get_b(NULL, MODNAME, str, DEFAULT_MESSAGE_ENABLED)) ? BST_CHECKED: BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, (i + 1029), (db_get_b(NULL, MODNAME, str, DEFAULT_MESSAGE_ENABLED)) ? BST_CHECKED : BST_UNCHECKED);
}
}
return TRUE;
@@ -82,14 +82,14 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
break;
case IDC_UPDATEONPERIOD:
- {
- BOOL value = IsDlgButtonChecked(hwndDlg, IDC_UPDATEONPERIOD);
- EnableWindow(GetDlgItem(hwndDlg, IDC_PERIOD), value);
- EnableWindow(GetDlgItem(hwndDlg, IDC_PERIODSPIN), value);
- EnableWindow(GetDlgItem(hwndDlg, IDC_PERIODMEASURE), value);
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- }
- break;
+ {
+ BOOL value = IsDlgButtonChecked(hwndDlg, IDC_UPDATEONPERIOD);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_PERIOD), value);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_PERIODSPIN), value);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_PERIODMEASURE), value);
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ }
+ break;
case IDC_PERIODMEASURE:
if (HIWORD(wParam) == CBN_SELCHANGE)
@@ -101,13 +101,13 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
break;
case IDC_LINK_HOTKEY:
- {
- OPENOPTIONSDIALOG ood = { sizeof(ood) };
- ood.pszGroup = "Customize";
- ood.pszPage = "Hotkeys";
- Options_Open(&ood);
- }
- return true;
+ {
+ OPENOPTIONSDIALOG ood = { sizeof(ood) };
+ ood.pszGroup = "Customize";
+ ood.pszPage = "Hotkeys";
+ Options_Open(&ood);
+ }
+ return true;
case IDC_MSG_BOXES2:
case IDC_ERRORS2:
@@ -120,50 +120,50 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
break;
case WM_NOTIFY:
- {
- NMHDR *hdr = (NMHDR *)lParam;
- if(hdr && hdr->code == UDN_DELTAPOS)
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ {
+ NMHDR *hdr = (NMHDR *)lParam;
+ if (hdr && hdr->code == UDN_DELTAPOS)
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- if (hdr && hdr->code == PSN_APPLY) {
- UpdateOnStartup = IsDlgButtonChecked(hwndDlg, IDC_UPDATEONSTARTUP);
- OnlyOnceADay = IsDlgButtonChecked(hwndDlg, IDC_ONLYONCEADAY);
+ if (hdr && hdr->code == PSN_APPLY) {
+ UpdateOnStartup = IsDlgButtonChecked(hwndDlg, IDC_UPDATEONSTARTUP);
+ OnlyOnceADay = IsDlgButtonChecked(hwndDlg, IDC_ONLYONCEADAY);
- UpdateOnPeriod = IsDlgButtonChecked(hwndDlg, IDC_UPDATEONPERIOD);
+ UpdateOnPeriod = IsDlgButtonChecked(hwndDlg, IDC_UPDATEONPERIOD);
- char buffer[3] = {0};
- Edit_GetText(GetDlgItem(hwndDlg, IDC_PERIOD), (LPWSTR)&buffer, 2);
- Period = atoi(buffer);
+ char buffer[3] = { 0 };
+ Edit_GetText(GetDlgItem(hwndDlg, IDC_PERIOD), (LPWSTR)&buffer, 2);
+ Period = atoi(buffer);
- PeriodMeasure = ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_PERIODMEASURE));
+ PeriodMeasure = ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_PERIODMEASURE));
- InitTimer();
+ InitTimer();
- db_set_b(NULL, MODNAME, "UpdateOnStartup", UpdateOnStartup);
- db_set_b(NULL, MODNAME, "OnlyOnceADay", OnlyOnceADay);
- db_set_b(NULL, MODNAME, "UpdateOnPeriod", UpdateOnPeriod);
- db_set_dw(NULL, MODNAME, "Period", Period);
- db_set_b(NULL, MODNAME, "PeriodMeasure", PeriodMeasure);
- Reminder = IsDlgButtonChecked(hwndDlg, IDC_REMINDER);
- db_set_b(NULL, MODNAME, "Reminder", Reminder);
- if ( !ServiceExists(MS_POPUP_ADDPOPUPT)) {
- for (int i = 1; i < POPUPS; i++) {
- mir_snprintf(str, SIZEOF(str), "Popups%dM", i);
- db_set_b(NULL, MODNAME, str, (BYTE)(IsDlgButtonChecked(hwndDlg, (i+1029))));
- }
+ db_set_b(NULL, MODNAME, "UpdateOnStartup", UpdateOnStartup);
+ db_set_b(NULL, MODNAME, "OnlyOnceADay", OnlyOnceADay);
+ db_set_b(NULL, MODNAME, "UpdateOnPeriod", UpdateOnPeriod);
+ db_set_dw(NULL, MODNAME, "Period", Period);
+ db_set_b(NULL, MODNAME, "PeriodMeasure", PeriodMeasure);
+ Reminder = IsDlgButtonChecked(hwndDlg, IDC_REMINDER);
+ db_set_b(NULL, MODNAME, "Reminder", Reminder);
+ if (!ServiceExists(MS_POPUP_ADDPOPUPT)) {
+ for (int i = 1; i < POPUPS; i++) {
+ mir_snprintf(str, SIZEOF(str), "Popups%dM", i);
+ db_set_b(NULL, MODNAME, str, (BYTE)(IsDlgButtonChecked(hwndDlg, (i + 1029))));
}
}
- break;
}
+ break;
+ }
}
return FALSE;
}
-INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
+INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
int i;
WORD idCtrl;
- char str[20] = {0}, str2[20] = {0};
+ char str[20] = { 0 }, str2[20] = { 0 };
switch (msg) {
case WM_INITDIALOG:
@@ -185,14 +185,14 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
CheckDlgButton(hdlg, IDC_USEWINCOLORS, BST_UNCHECKED);
}
for (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)), (MyOptions.DefColors == byCOLOR_OWN));
- EnableWindow(GetDlgItem(hdlg, (i+41071)), (MyOptions.DefColors == byCOLOR_OWN));
+ 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)), (MyOptions.DefColors == byCOLOR_OWN));
+ EnableWindow(GetDlgItem(hdlg, (i + 41071)), (MyOptions.DefColors == byCOLOR_OWN));
}
//Timeout
SendDlgItemMessage(hdlg, IDC_TIMEOUT_VALUE, EM_LIMITTEXT, 4, 0);
- SendDlgItemMessage(hdlg, IDC_TIMEOUT_VALUE_SPIN, UDM_SETRANGE32, -1, 9999);
+ SendDlgItemMessage(hdlg, IDC_TIMEOUT_VALUE_SPIN, UDM_SETRANGE32, -1, 9999);
SetDlgItemInt(hdlg, IDC_TIMEOUT_VALUE, MyOptions.Timeout, TRUE);
//Mouse actions
for (i = 0; i < SIZEOF(PopupActions); i++) {
@@ -205,14 +205,14 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
for (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);
- CheckDlgButton(hdlg, (i+1024), (db_get_b(NULL, MODNAME, str2, DEFAULT_MESSAGE_ENABLED)) ? BST_CHECKED: BST_UNCHECKED);
- if (IsDlgButtonChecked(hdlg, (i+40071)))
- EnableWindow(GetDlgItem(hdlg, (i+1024)), FALSE);
+ CheckDlgButton(hdlg, (i + 40071), (db_get_b(NULL, MODNAME, str, DEFAULT_POPUP_ENABLED)) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hdlg, (i + 1024), (db_get_b(NULL, MODNAME, str2, DEFAULT_MESSAGE_ENABLED)) ? BST_CHECKED : BST_UNCHECKED);
+ if (IsDlgButtonChecked(hdlg, (i + 40071)))
+ EnableWindow(GetDlgItem(hdlg, (i + 1024)), FALSE);
else if (i > 0)
- EnableWindow(GetDlgItem(hdlg, (i+1024)), TRUE);
+ EnableWindow(GetDlgItem(hdlg, (i + 1024)), TRUE);
}
- if (!(db_get_dw(NULL, "Popup", "Actions", 0) & 1) || !ServiceExists(MS_POPUP_REGISTERACTIONS))
+ if (!(db_get_dw(NULL, "Popup", "Actions", 0) & 1) || !ServiceExists(MS_POPUP_REGISTERACTIONS))
EnableWindow(GetDlgItem(hdlg, (40071)), FALSE);
else
EnableWindow(GetDlgItem(hdlg, (40071)), TRUE);
@@ -220,7 +220,7 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
return TRUE;
case WM_SHOWWINDOW:
- if (!(db_get_dw(NULL, "Popup", "Actions", 0) & 1) || !ServiceExists(MS_POPUP_REGISTERACTIONS))
+ if (!(db_get_dw(NULL, "Popup", "Actions", 0) & 1) || !ServiceExists(MS_POPUP_REGISTERACTIONS))
EnableWindow(GetDlgItem(hdlg, (40071)), FALSE);
else
EnableWindow(GetDlgItem(hdlg, (40071)), TRUE);
@@ -229,48 +229,48 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
case WM_COMMAND:
idCtrl = LOWORD(wParam);
if (HIWORD(wParam) == CPN_COLOURCHANGED) {
- if(idCtrl > 40070) {
+ if (idCtrl > 40070) {
//It's a color picker change. idCtrl is the control id.
COLORREF color = SendDlgItemMessage(hdlg, idCtrl, CPM_GETCOLOUR, 0, 0);
int ctlID = idCtrl;
if ((ctlID > 41070) && (ctlID < 42070)) //It's 41071 or above => Text color.
- PopupsList[ctlID-41071].colorText = color;
+ PopupsList[ctlID - 41071].colorText = color;
else if (ctlID > 42070)//Background color.
- PopupsList[ctlID-42071].colorBack = color;
+ PopupsList[ctlID - 42071].colorBack = color;
SendMessage(GetParent(hdlg), PSM_CHANGED, 0, 0);
return TRUE;
}
}
- if (HIWORD(wParam) == CBN_SELCHANGE) {
+ if (HIWORD(wParam) == CBN_SELCHANGE) {
if (idCtrl == IDC_LC)
MyOptions.LeftClickAction = (BYTE)SendDlgItemMessage(hdlg, IDC_LC, CB_GETCURSEL, 0, 0);
- else if(idCtrl == IDC_RC)
+ else if (idCtrl == IDC_RC)
MyOptions.RightClickAction = (BYTE)SendDlgItemMessage(hdlg, IDC_RC, CB_GETCURSEL, 0, 0);
SendMessage(GetParent(hdlg), PSM_CHANGED, 0, 0);
return TRUE;
}
- switch(idCtrl) {
- case IDC_USEOWNCOLORS:
+ switch (idCtrl) {
+ case IDC_USEOWNCOLORS:
if (HIWORD(wParam) == BN_CLICKED) {
MyOptions.DefColors = byCOLOR_OWN;
BOOL bEnableOthers = TRUE;
for (i = 0; i < POPUPS; i++) {
- EnableWindow(GetDlgItem(hdlg, (i+42071)), bEnableOthers); //Background
- EnableWindow(GetDlgItem(hdlg, (i+41071)), bEnableOthers); //Text
+ EnableWindow(GetDlgItem(hdlg, (i + 42071)), bEnableOthers); //Background
+ EnableWindow(GetDlgItem(hdlg, (i + 41071)), bEnableOthers); //Text
}
SendMessage(GetParent(hdlg), PSM_CHANGED, 0, 0);
}
break;
- case IDC_USEWINCOLORS:
+ case IDC_USEWINCOLORS:
if (HIWORD(wParam) == BN_CLICKED) {
//Use Windows colors
MyOptions.DefColors = byCOLOR_WINDOWS;
BOOL bEnableOthers = FALSE;
for (i = 0; i < POPUPS; i++) {
- EnableWindow(GetDlgItem(hdlg, (i+42071)), bEnableOthers); //Background
- EnableWindow(GetDlgItem(hdlg, (i+41071)), bEnableOthers); //Text
+ EnableWindow(GetDlgItem(hdlg, (i + 42071)), bEnableOthers); //Background
+ EnableWindow(GetDlgItem(hdlg, (i + 41071)), bEnableOthers); //Text
}
SendMessage(GetParent(hdlg), PSM_CHANGED, 0, 0);
}
@@ -282,18 +282,18 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
MyOptions.DefColors = byCOLOR_POPUP;
BOOL bEnableOthers = FALSE;
for (i = 0; i < POPUPS; i++) {
- EnableWindow(GetDlgItem(hdlg, (i+42071)), bEnableOthers); //Background
- EnableWindow(GetDlgItem(hdlg, (i+41071)), bEnableOthers); //Text
+ EnableWindow(GetDlgItem(hdlg, (i + 42071)), bEnableOthers); //Background
+ EnableWindow(GetDlgItem(hdlg, (i + 41071)), bEnableOthers); //Text
}
SendMessage(GetParent(hdlg), PSM_CHANGED, 0, 0);
}
break;
- case IDC_PREVIEW:
+ case IDC_PREVIEW:
Title = TranslateT("Pack Updater");
Text = TranslateT("Test");
for (int i = 0; i < POPUPS; i++) {
- if ((BST_UNCHECKED == IsDlgButtonChecked(hdlg, (i+40071))) || (!IsWindowEnabled(GetDlgItem(hdlg, (i+40071)))))
+ if ((BST_UNCHECKED == IsDlgButtonChecked(hdlg, (i + 40071))) || (!IsWindowEnabled(GetDlgItem(hdlg, (i + 40071)))))
continue;
show_popup(0, Title, Text, i, 0);
}
@@ -338,7 +338,7 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
}
break;
- case WM_NOTIFY:
+ case WM_NOTIFY:
switch (((LPNMHDR)lParam)->code) {
case PSN_RESET:
//Restore the options stored in memory.
@@ -346,16 +346,16 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
InitPopupList();
return TRUE;
- case PSN_APPLY:
+ case PSN_APPLY:
//Text color
- char szSetting[20] = {0};
+ char szSetting[20] = { 0 };
DWORD ctlColor = 0;
- for (i = 0; i <= POPUPS-1; i++) {
- ctlColor = SendDlgItemMessage(hdlg, (i+42071), CPM_GETCOLOUR, 0, 0);
+ for (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);
db_set_dw(NULL, MODNAME, szSetting, ctlColor);
- ctlColor = SendDlgItemMessage(hdlg, (i+41071), CPM_GETCOLOUR, 0, 0);
+ ctlColor = SendDlgItemMessage(hdlg, (i + 41071), CPM_GETCOLOUR, 0, 0);
PopupsList[i].colorText = ctlColor;
mir_snprintf(szSetting, SIZEOF(szSetting), "Popups%iTx", i);
db_set_dw(NULL, MODNAME, szSetting, ctlColor);
@@ -372,9 +372,9 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
//Notified popups
for (i = 0; i < POPUPS; i++) {
mir_snprintf(str, SIZEOF(str), "Popups%d", i);
- db_set_b(NULL, MODNAME, str, (BYTE)(IsDlgButtonChecked(hdlg, (i+40071))));
+ db_set_b(NULL, MODNAME, str, (BYTE)(IsDlgButtonChecked(hdlg, (i + 40071))));
mir_snprintf(str2, SIZEOF(str2), "Popups%dM", i);
- db_set_b(NULL, MODNAME, str2, (BYTE)(IsDlgButtonChecked(hdlg, (i+1024))));
+ db_set_b(NULL, MODNAME, str2, (BYTE)(IsDlgButtonChecked(hdlg, (i + 1024))));
}
return TRUE;
}
@@ -383,7 +383,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;
@@ -395,7 +395,7 @@ int OptInit(WPARAM wParam, LPARAM lParam)
odp.pfnDlgProc = UpdateNotifyOptsProc;
Options_AddPage(wParam, &odp);
- if ( ServiceExists(MS_POPUP_ADDPOPUPT)) {
+ if (ServiceExists(MS_POPUP_ADDPOPUPT)) {
odp.pszTemplate = MAKEINTRESOURCEA(IDD_POPUP);
odp.ptszGroup = LPGENT("Popups");
odp.ptszTitle = LPGENT("Pack Updater");