diff options
author | (no author) <(no author)@4f64403b-2f21-0410-a795-97e2b3489a10> | 2010-04-04 23:41:11 +0000 |
---|---|---|
committer | (no author) <(no author)@4f64403b-2f21-0410-a795-97e2b3489a10> | 2010-04-04 23:41:11 +0000 |
commit | 0c2db8f67782848603cdd845713ca70e285c0f49 (patch) | |
tree | 9ee0652d8c23593b567b91cd5e34c13c62d61611 /worldtime_protocol/options.cpp | |
parent | d11bac94bbcbd92bf550ccca094a10bb50e6df4b (diff) |
Fixed incorrect time after time zone table changes
Reduced size plugin size
git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@487 4f64403b-2f21-0410-a795-97e2b3489a10
Diffstat (limited to 'worldtime_protocol/options.cpp')
-rw-r--r-- | worldtime_protocol/options.cpp | 36 |
1 files changed, 14 insertions, 22 deletions
diff --git a/worldtime_protocol/options.cpp b/worldtime_protocol/options.cpp index 7b04e34..071c88c 100644 --- a/worldtime_protocol/options.cpp +++ b/worldtime_protocol/options.cpp @@ -4,24 +4,23 @@ bool set_format = false, hide_proto = false;
TCHAR format_string[512], date_format_string[512], clist_format_string[512];
-ITEMLIST temp_listbox_items;
+ITEMLIST temp_listbox_items(10);
void fill_timezone_list_control(HWND hwndDlg) {
- int index = 0;
HWND hw = GetDlgItem(hwndDlg, IDC_LIST_TIMES);
SendMessage(hw, LB_RESETCONTENT, 0, 0);
if(IsDlgButtonChecked(hwndDlg, IDC_RAD_ALPHA)) {
- for(TimeList::iterator i = timezone_list.begin(); i != timezone_list.end(); i++, index++) {
- SendMessage(hw, LB_INSERTSTRING, (WPARAM)-1, (LPARAM)i->tcName);
- SendMessage(hw, LB_SETITEMDATA, (WPARAM)index, (LPARAM)i->list_index);
+ for(int i = 0; i < timezone_list.getCount(); i++) {
+ SendMessage(hw, LB_INSERTSTRING, (WPARAM)-1, (LPARAM)timezone_list[i].tcName);
+ SendMessage(hw, LB_SETITEMDATA, (WPARAM)i, (LPARAM)timezone_list[i].list_index);
}
} else {
- for(TimeList::iterator i = geo_timezone_list.begin(); i != geo_timezone_list.end(); i++, index++) {
- SendMessage(hw, LB_INSERTSTRING, (WPARAM)-1, (LPARAM)i->tcName);
- SendMessage(hw, LB_SETITEMDATA, (WPARAM)index, (LPARAM)i->list_index);
+ for(int i =0; i < geo_timezone_list.getCount(); ++i) {
+ SendMessage(hw, LB_INSERTSTRING, (WPARAM)-1, (LPARAM)timezone_list[i].tcName);
+ SendMessage(hw, LB_SETITEMDATA, (WPARAM)i, (LPARAM)timezone_list[i].list_index);
}
}
}
@@ -125,12 +124,11 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA TranslateDialogDefault( hwndDlg );
load_listbox_items();
- temp_listbox_items = listbox_items;
+ copy_listbox_items(temp_listbox_items, listbox_items);
hw = GetDlgItem(hwndDlg, IDC_LIST_TIMES2);
- index = 0;
- for(ITEMLIST::iterator ili = temp_listbox_items.begin(); ili != temp_listbox_items.end(); ili++, index++) {
- sel = SendMessage(hw, LB_INSERTSTRING, (WPARAM)-1, (LPARAM)&ili->pszText);
+ for(index = 0; index < temp_listbox_items.getCount(); index++) {
+ sel = SendMessage(hw, LB_INSERTSTRING, (WPARAM)-1, (LPARAM)temp_listbox_items[index].pszText);
}
bool set_format = (DBGetContactSettingByte(NULL, "WorldTime", "EnableTimeFormat", 0) == 1);
@@ -208,7 +206,7 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA add_edit_item.hContact = 0;
if(DialogBox(hInst, MAKEINTRESOURCE(IDD_DIALOG2), hwndDlg, DlgProcOptsEdit) == IDOK) {
- temp_listbox_items.push_back(add_edit_item);
+ temp_listbox_items.insert(new LISTITEM(add_edit_item));
hw = GetDlgItem(hwndDlg, IDC_LIST_TIMES2);
sel = SendMessage(hw, LB_INSERTSTRING, (WPARAM)-1, (LPARAM)add_edit_item.pszText);
@@ -229,12 +227,7 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA if(sel != LB_ERR) {
SendMessage(hw, LB_DELETESTRING, (WPARAM)sel, 0);
- {
- ITEMLIST::iterator i = temp_listbox_items.begin();
- for(int j = 0; j < sel; j++)
- i++;
- temp_listbox_items.erase(i);
- }
+ temp_listbox_items.remove(sel);
hw = GetDlgItem(hwndDlg, IDC_BTN_REM);
EnableWindow(hw, FALSE);
@@ -277,10 +270,9 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA DBWriteContactSettingString(NULL, "WorldTime", "CListFormat", buf);
strncpy(clist_format_string, buf, 512);
- listbox_items = temp_listbox_items;
+ copy_listbox_items(listbox_items, temp_listbox_items);
save_listbox_items();
- temp_listbox_items = listbox_items; // copy back new hContact values
-
+ copy_listbox_items(temp_listbox_items, listbox_items); // copy back new hContact values
return TRUE;
}
break;
|