--- trunk/RenegadeMapSelector/RenegadeMapSelector.cpp 2003/03/12 04:33:33 73 +++ trunk/RenegadeMapSelector/RenegadeMapSelector.cpp 2003/03/13 21:05:06 74 @@ -285,10 +285,107 @@ int CALLBACK selector(HWND hwndDlg, UINT } break; case IDC_UP_MAP: - cout << "STUB: up\a\n"; + { + unsigned count = SendMessage(GetDlgItem(hwndDlg, IDC_SELECTED), + LB_GETSELCOUNT, 0, 0); + unsigned* ups = new unsigned[count]; + + SendMessage(GetDlgItem(hwndDlg, IDC_SELECTED), LB_GETSELITEMS, + count, long(ups)); + + unsigned insert = ups[0] - 1; + + if (debug) cerr << "ups = {\n"; + for (unsigned index = 0; index < count; index++) + { + if (debug) cerr << " [" << index << "] = " << ups[index] + << "\n"; + + char* up = new char[SendMessage(GetDlgItem(hwndDlg, + IDC_SELECTED), LB_GETTEXTLEN, ups[index], 0) + 1]; + + SendMessage(GetDlgItem(hwndDlg, IDC_SELECTED), LB_GETTEXT, + ups[index], long(up)); + SendMessage(GetDlgItem(hwndDlg, IDC_SELECTED), + LB_DELETESTRING, ups[index], 0); + SendMessage(GetDlgItem(hwndDlg, IDC_SELECTED), + LB_INSERTSTRING, insert, long(up)); + SendMessage(GetDlgItem(hwndDlg, IDC_SELECTED), LB_SETSEL, + true, insert++); + } + if (debug) cerr << "}\n"; + + delete [] ups; + + if (SendMessage(GetDlgItem(hwndDlg, IDC_SELECTED), + LB_GETSEL, 0, 0) == 0) + { + EnableWindow(GetDlgItem(hwndDlg, IDC_UP_MAP), true); + } + else + { + EnableWindow(GetDlgItem(hwndDlg, IDC_UP_MAP), false); + } + + if (SendMessage(GetDlgItem(hwndDlg, IDC_SELECTED), + LB_GETSEL, SendMessage(GetDlgItem(hwndDlg, IDC_SELECTED + ), LB_GETCOUNT, 0, 0) - 1, 0) == 0) + { + EnableWindow(GetDlgItem(hwndDlg, IDC_DOWN_MAP), true); + } + } break; case IDC_DOWN_MAP: - cout << "STUB: down\a\n"; + { + unsigned count = SendMessage(GetDlgItem(hwndDlg, IDC_SELECTED), + LB_GETSELCOUNT, 0, 0); + unsigned* downs = new unsigned[count]; + + SendMessage(GetDlgItem(hwndDlg, IDC_SELECTED), LB_GETSELITEMS, + count, long(downs)); + + unsigned insert = downs[count - 1] + 1; + + if (debug) cerr << "downs = {\n"; + for (unsigned index = count; index > 0; index--) + { + if (debug) cerr << " [" << index << "] = " << downs[index + - 1] << "\n"; + + char* down = new char[SendMessage(GetDlgItem(hwndDlg, + IDC_SELECTED), LB_GETTEXTLEN, downs[index - 1], 0) + + 1]; + + SendMessage(GetDlgItem(hwndDlg, IDC_SELECTED), LB_GETTEXT, + downs[index - 1], long(down)); + SendMessage(GetDlgItem(hwndDlg, IDC_SELECTED), + LB_DELETESTRING, downs[index - 1], 0); + SendMessage(GetDlgItem(hwndDlg, IDC_SELECTED), + LB_INSERTSTRING, insert, long(down)); + SendMessage(GetDlgItem(hwndDlg, IDC_SELECTED), LB_SETSEL, + true, insert--); + } + if (debug) cerr << "}\n"; + + delete [] downs; + + if (SendMessage(GetDlgItem(hwndDlg, IDC_SELECTED), + LB_GETSEL, 0, 0) == 0) + { + EnableWindow(GetDlgItem(hwndDlg, IDC_UP_MAP), true); + } + + if (SendMessage(GetDlgItem(hwndDlg, IDC_SELECTED), + LB_GETSEL, SendMessage(GetDlgItem(hwndDlg, IDC_SELECTED + ), LB_GETCOUNT, 0, 0) - 1, 0) == 0) + { + EnableWindow(GetDlgItem(hwndDlg, IDC_DOWN_MAP), true); + } + else + { + EnableWindow(GetDlgItem(hwndDlg, IDC_DOWN_MAP), false); + } + } break; case IDC_AVAILABLE: switch (HIWORD(wParam))