summaryrefslogtreecommitdiff
path: root/tipper/options.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tipper/options.cpp')
-rw-r--r--tipper/options.cpp103
1 files changed, 52 insertions, 51 deletions
diff --git a/tipper/options.cpp b/tipper/options.cpp
index c6fdccd..3fe5314 100644
--- a/tipper/options.cpp
+++ b/tipper/options.cpp
@@ -31,7 +31,7 @@ void CreateDefaultItems() {
di_node->next = options.di_list;
options.di_list = di_node;
options.di_count++;
-
+
// status substitution
ds_node = (DSListNode *)malloc(sizeof(DSListNode));
_tcsncpy(ds_node->ds.name, _T("status"), LABEL_LEN);
@@ -332,11 +332,11 @@ void LoadOptions() {
options.sidebar_width = DBGetContactSettingDword(0, MODULE, "SidebarWidth", 22);
options.show_no_focus = (DBGetContactSettingByte(0, MODULE, "ShowNoFocus", 1) == 1);
- int real_count = 0;
+ int i, real_count = 0;
options.ds_list = 0;
DSListNode *ds_node;
options.ds_count = DBGetContactSettingWord(0, MODULE, "DSNumValues", 0);
- for(int i = options.ds_count - 1; i >= 0; i--) {
+ for(i = options.ds_count - 1; i >= 0; i--) {
ds_node = (DSListNode *)malloc(sizeof(DSListNode));
if(LoadDS(&ds_node->ds, i)) {
ds_node->next = options.ds_list;
@@ -350,7 +350,7 @@ void LoadOptions() {
options.di_list = 0;
DIListNode *di_node;
options.di_count = DBGetContactSettingWord(0, MODULE, "DINumValues", 0);
- for(int i = options.di_count - 1; i >= 0; i--) {
+ for(i = options.di_count - 1; i >= 0; i--) {
di_node = (DIListNode *)malloc(sizeof(DIListNode));
if(LoadDI(&di_node->di, i)) {
di_node->next = options.di_list;
@@ -376,46 +376,46 @@ void LoadOptions() {
DBDeleteContactSetting(0, MODULE, "ShowLastMessage");
// find end of list
- di_node = options.di_list;
- while(di_node && di_node->next) di_node = di_node->next;
+ di_node = options.di_list;
+ while(di_node && di_node->next) di_node = di_node->next;
// last message item
if(di_node) {
di_node->next = (DIListNode *)malloc(sizeof(DIListNode));
- di_node = di_node->next;
- } else {
- options.di_list = (DIListNode *)malloc(sizeof(DIListNode));
- di_node = options.di_list;
- }
+ di_node = di_node->next;
+ } else {
+ options.di_list = (DIListNode *)malloc(sizeof(DIListNode));
+ di_node = options.di_list;
+ }
_tcsncpy(di_node->di.label, _T("Last message: (%sys:last_msg_reltime% ago)"), LABEL_LEN);
_tcsncpy(di_node->di.value, _T("%sys:last_msg%"), VALUE_LEN);
di_node->di.line_above = di_node->di.value_newline = true;
di_node->next = 0;
- options.di_count++;
+ options.di_count++;
}
if(DBGetContactSettingByte(0, MODULE, "ShowStatusMessage", 0)) {
DBDeleteContactSetting(0, MODULE, "ShowStatusMessage");
-
- // find end of list
- di_node = options.di_list;
- while(di_node && di_node->next) di_node = di_node->next;
+
+ // find end of list
+ di_node = options.di_list;
+ while(di_node && di_node->next) di_node = di_node->next;
- // status message item
+ // status message item
if(di_node) {
- di_node->next = (DIListNode *)malloc(sizeof(DIListNode));
- di_node = di_node->next;
- } else {
- options.di_list = (DIListNode *)malloc(sizeof(DIListNode));
- di_node = options.di_list;
- }
+ di_node->next = (DIListNode *)malloc(sizeof(DIListNode));
+ di_node = di_node->next;
+ } else {
+ options.di_list = (DIListNode *)malloc(sizeof(DIListNode));
+ di_node = options.di_list;
+ }
_tcsncpy(di_node->di.label, _T("Status message:"), LABEL_LEN);
_tcsncpy(di_node->di.value, _T("%sys:status_msg%"), VALUE_LEN);
di_node->di.line_above = di_node->di.value_newline = true;
di_node->next = 0;
- options.di_count++;
+ options.di_count++;
}
options.label_valign = DBGetContactSettingWord(0, MODULE, "LabelVAlign", DT_TOP /*DT_VCENTER*/);
@@ -494,17 +494,16 @@ static BOOL CALLBACK DlgProcAddSubst(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
}
{
- int index, id;
- for(int i = 0; i < num_tfuncs; i++) {
+ int index, id, i;
+ for(i = 0; i < num_tfuncs; i++) {
index = SendDlgItemMessage(hwndDlg, IDC_CMB_TRANSLATE, CB_ADDSTRING, (WPARAM)-1, (LPARAM)TranslateTS(translations[i].name));
SendDlgItemMessage(hwndDlg, IDC_CMB_TRANSLATE, CB_SETITEMDATA, index, (LPARAM)translations[i].id);
}
- for(int i = 0; i < num_tfuncs; i++) {
+ for(i = 0; i < num_tfuncs; i++) {
id = SendDlgItemMessage(hwndDlg, IDC_CMB_TRANSLATE, CB_GETITEMDATA, i, 0);
if(id == ds->translate_func_id)
SendDlgItemMessage(hwndDlg, IDC_CMB_TRANSLATE, CB_SETCURSEL, i, 0);
}
-
}
SendMessage(hwndDlg, WMU_ENABLE_MODULE_ENTRY, 0, 0);
@@ -825,6 +824,7 @@ static BOOL CALLBACK DlgProcOpts2(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
case WM_NOTIFY:
if (((LPNMHDR)lParam)->code == (unsigned)PSN_APPLY ) {
DIListNode *di_node;
+ int i;
while(options.di_list) {
di_node = options.di_list;
options.di_list = options.di_list->next;
@@ -833,7 +833,7 @@ static BOOL CALLBACK DlgProcOpts2(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
DIListNode *di_value;
options.di_count = SendDlgItemMessage(hwndDlg, IDC_LST_ITEMS, LB_GETCOUNT, 0, 0);
- for(int i = options.di_count - 1; i >= 0; i--) {
+ for(i = options.di_count - 1; i >= 0; i--) {
di_node = (DIListNode *)SendDlgItemMessage(hwndDlg, IDC_LST_ITEMS, LB_GETITEMDATA, i, 0);
di_value = (DIListNode *)malloc(sizeof(DIListNode));
*di_value = *di_node;
@@ -851,7 +851,7 @@ static BOOL CALLBACK DlgProcOpts2(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
DSListNode *ds_value;
options.ds_count = SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_GETCOUNT, 0, 0);
- for(int i = options.ds_count - 1; i >= 0; i--) {
+ for(i = options.ds_count - 1; i >= 0; i--) {
ds_node = (DSListNode *)SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_GETITEMDATA, i, 0);
ds_value = (DSListNode *)malloc(sizeof(DSListNode));
*ds_value = *ds_node;
@@ -867,14 +867,15 @@ static BOOL CALLBACK DlgProcOpts2(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
case WM_DESTROY:
{
DIListNode *di_value;
+ int i;
int count = SendDlgItemMessage(hwndDlg, IDC_LST_ITEMS, LB_GETCOUNT, 0, 0);
- for(int i = 0; i < count; i++) {
+ for(i = 0; i < count; i++) {
di_value = (DIListNode *)SendDlgItemMessage(hwndDlg, IDC_LST_ITEMS, LB_GETITEMDATA, i, 0);
free(di_value);
}
DSListNode *ds_value;
count = SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_GETCOUNT, 0, 0);
- for(int i = 0; i < count; i++) {
+ for(i = 0; i < count; i++) {
ds_value = (DSListNode *)SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_GETITEMDATA, i, 0);
free(ds_value);
}
@@ -909,35 +910,35 @@ static BOOL CALLBACK DlgProcOpts1(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
SendDlgItemMessage(hwndDlg, IDC_CMB_LV, CB_ADDSTRING, 0, (LPARAM)TranslateT("Top"));
SendDlgItemMessage(hwndDlg, IDC_CMB_LV, CB_ADDSTRING, 0, (LPARAM)TranslateT("Centre"));
- SendDlgItemMessage(hwndDlg, IDC_CMB_LV, CB_ADDSTRING, 0, (LPARAM)TranslateT("Bottom"));
- switch(options.label_valign) {
+ SendDlgItemMessage(hwndDlg, IDC_CMB_LV, CB_ADDSTRING, 0, (LPARAM)TranslateT("Bottom"));
+ switch(options.label_valign) {
case DT_TOP: SendDlgItemMessage(hwndDlg, IDC_CMB_LV, CB_SETCURSEL, 0, 0); break;
case DT_VCENTER: SendDlgItemMessage(hwndDlg, IDC_CMB_LV, CB_SETCURSEL, 1, 0); break;
- case DT_BOTTOM: SendDlgItemMessage(hwndDlg, IDC_CMB_LV, CB_SETCURSEL, 2, 0); break;
- }
+ case DT_BOTTOM: SendDlgItemMessage(hwndDlg, IDC_CMB_LV, CB_SETCURSEL, 2, 0); break;
+ }
SendDlgItemMessage(hwndDlg, IDC_CMB_VV, CB_ADDSTRING, 0, (LPARAM)TranslateT("Top"));
SendDlgItemMessage(hwndDlg, IDC_CMB_VV, CB_ADDSTRING, 0, (LPARAM)TranslateT("Centre"));
SendDlgItemMessage(hwndDlg, IDC_CMB_VV, CB_ADDSTRING, 0, (LPARAM)TranslateT("Bottom"));
- switch(options.value_valign) {
+ switch(options.value_valign) {
case DT_TOP: SendDlgItemMessage(hwndDlg, IDC_CMB_VV, CB_SETCURSEL, 0, 0); break;
case DT_VCENTER: SendDlgItemMessage(hwndDlg, IDC_CMB_VV, CB_SETCURSEL, 1, 0); break;
- case DT_BOTTOM: SendDlgItemMessage(hwndDlg, IDC_CMB_VV, CB_SETCURSEL, 2, 0); break;
- }
-
+ case DT_BOTTOM: SendDlgItemMessage(hwndDlg, IDC_CMB_VV, CB_SETCURSEL, 2, 0); break;
+ }
+
SendDlgItemMessage(hwndDlg, IDC_CMB_LH, CB_ADDSTRING, 0, (LPARAM)TranslateT("Left"));
SendDlgItemMessage(hwndDlg, IDC_CMB_LH, CB_ADDSTRING, 0, (LPARAM)TranslateT("Right"));
- switch(options.label_halign) {
+ switch(options.label_halign) {
case DT_LEFT: SendDlgItemMessage(hwndDlg, IDC_CMB_LH, CB_SETCURSEL, 0, 0); break;
- case DT_RIGHT: SendDlgItemMessage(hwndDlg, IDC_CMB_LH, CB_SETCURSEL, 1, 0); break;
- }
+ case DT_RIGHT: SendDlgItemMessage(hwndDlg, IDC_CMB_LH, CB_SETCURSEL, 1, 0); break;
+ }
SendDlgItemMessage(hwndDlg, IDC_CMB_VH, CB_ADDSTRING, 0, (LPARAM)TranslateT("Left"));
SendDlgItemMessage(hwndDlg, IDC_CMB_VH, CB_ADDSTRING, 0, (LPARAM)TranslateT("Right"));
- switch(options.value_halign) {
+ switch(options.value_halign) {
case DT_LEFT: SendDlgItemMessage(hwndDlg, IDC_CMB_VH, CB_SETCURSEL, 0, 0); break;
- case DT_RIGHT: SendDlgItemMessage(hwndDlg, IDC_CMB_VH, CB_SETCURSEL, 1, 0); break;
- }
+ case DT_RIGHT: SendDlgItemMessage(hwndDlg, IDC_CMB_VH, CB_SETCURSEL, 1, 0); break;
+ }
SendDlgItemMessage(hwndDlg, IDC_CMB_AV, CB_ADDSTRING, 0, (LPARAM)TranslateT("No avatar"));
if(ServiceExists(MS_AV_DRAWAVATAR)) {
@@ -1071,11 +1072,11 @@ static BOOL CALLBACK DlgProcOpts1(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
int OptInit(WPARAM wParam, LPARAM lParam) {
OPTIONSDIALOGPAGE odp = { 0 };
-#define OPTIONPAGE_OLD_SIZE2 60
- DWORD mirVir = (DWORD)CallService(MS_SYSTEM_GETVERSION, 0, 0);
- odp.cbSize = (mirVir >= 0x00060000 ? sizeof(odp) : OPTIONPAGE_OLD_SIZE2);
- //odp.cbSize = sizeof(odp);
-
+#define OPTIONPAGE_OLD_SIZE2 60
+ DWORD mirVir = (DWORD)CallService(MS_SYSTEM_GETVERSION, 0, 0);
+ odp.cbSize = (mirVir >= 0x00060000 ? sizeof(odp) : OPTIONPAGE_OLD_SIZE2);
+ //odp.cbSize = sizeof(odp);
+
odp.flags = ODPF_BOLDGROUPS;
//odp.flags |= ODPF_UNICODE;
odp.position = -790000000;