src/osd/winui/columnedit.c
| r7112 | r7113 | |
| 38 | 38 | LV_ITEM lvi; |
| 39 | 39 | TCHAR buf[80]; |
| 40 | 40 | int nFrom, nTo; |
| 41 | HRESULT res; |
| 41 | 42 | |
| 42 | 43 | nFrom = ListView_GetItemCount(hFrom); |
| 43 | 44 | nTo = ListView_GetItemCount(hTo); |
| r7112 | r7113 | |
| 57 | 58 | if (ListView_GetItem(hFrom, &lvi)) |
| 58 | 59 | { |
| 59 | 60 | // Add this item to the Show and delete it from Available |
| 60 | | ListView_DeleteItem(hFrom, lvi.iItem); |
| 61 | res = ListView_DeleteItem(hFrom, lvi.iItem); |
| 61 | 62 | lvi.iItem = ListView_GetItemCount(hTo); |
| 62 | | ListView_InsertItem(hTo, &lvi); |
| 63 | res = ListView_InsertItem(hTo, &lvi); |
| 63 | 64 | ListView_SetItemState(hTo, lvi.iItem, |
| 64 | 65 | LVIS_FOCUSED | LVIS_SELECTED, |
| 65 | 66 | LVIS_FOCUSED | LVIS_SELECTED); |
| r7112 | r7113 | |
| 74 | 75 | LV_ITEM lvi; |
| 75 | 76 | TCHAR buf[80]; |
| 76 | 77 | int nMaxpos; |
| 78 | HRESULT res; |
| 77 | 79 | |
| 78 | 80 | lvi.iItem = ListView_GetNextItem(hWnd, -1, LVIS_SELECTED | LVIS_FOCUSED); |
| 79 | 81 | nMaxpos = ListView_GetItemCount(hWnd); |
| r7112 | r7113 | |
| 92 | 94 | if (ListView_GetItem(hWnd, &lvi)) |
| 93 | 95 | { |
| 94 | 96 | // Add this item to the Show and delete it from Available |
| 95 | | ListView_DeleteItem(hWnd, lvi.iItem); |
| 97 | res = ListView_DeleteItem(hWnd, lvi.iItem); |
| 96 | 98 | lvi.iItem += (bDown) ? 1 : -1; |
| 97 | | ListView_InsertItem(hWnd,&lvi); |
| 99 | res = ListView_InsertItem(hWnd,&lvi); |
| 98 | 100 | ListView_SetItemState(hWnd, lvi.iItem, |
| 99 | 101 | LVIS_FOCUSED | LVIS_SELECTED, |
| 100 | 102 | LVIS_FOCUSED | LVIS_SELECTED); |
| r7112 | r7113 | |
| 126 | 128 | int i, nCount = 0; |
| 127 | 129 | LV_ITEM lvi; |
| 128 | 130 | DWORD dwShowStyle, dwAvailableStyle, dwView; |
| 131 | HRESULT res; |
| 129 | 132 | |
| 130 | 133 | switch (Msg) |
| 131 | 134 | { |
| r7112 | r7113 | |
| 177 | 180 | if (shown[order[i]]) |
| 178 | 181 | { |
| 179 | 182 | lvi.iItem = nShown; |
| 180 | | ListView_InsertItem(hShown, &lvi); |
| 183 | res = ListView_InsertItem(hShown, &lvi); |
| 181 | 184 | nShown++; |
| 182 | 185 | } |
| 183 | 186 | else |
| 184 | 187 | { |
| 185 | 188 | lvi.iItem = nAvail; |
| 186 | | ListView_InsertItem(hAvailable, &lvi); |
| 189 | res = ListView_InsertItem(hAvailable, &lvi); |
| 187 | 190 | nAvail++; |
| 188 | 191 | } |
| 189 | 192 | } |
| r7112 | r7113 | |
| 408 | 411 | lvi.mask = LVIF_PARAM; |
| 409 | 412 | lvi.pszText = 0; |
| 410 | 413 | lvi.iItem = i; |
| 411 | | ListView_GetItem(hShown, &lvi); |
| 414 | res = ListView_GetItem(hShown, &lvi); |
| 412 | 415 | order[nCount++] = lvi.lParam; |
| 413 | 416 | shown[lvi.lParam] = TRUE; |
| 414 | 417 | } |
| r7112 | r7113 | |
| 418 | 421 | lvi.mask = LVIF_PARAM; |
| 419 | 422 | lvi.pszText = 0; |
| 420 | 423 | lvi.iItem = i; |
| 421 | | ListView_GetItem(hAvailable, &lvi); |
| 424 | res = ListView_GetItem(hAvailable, &lvi); |
| 422 | 425 | order[nCount++] = lvi.lParam; |
| 423 | 426 | shown[lvi.lParam] = FALSE; |
| 424 | 427 | } |
src/osd/winui/picker.c
| r7112 | r7113 | |
| 339 | 339 | int shown_columns; |
| 340 | 340 | LVCOLUMN col; |
| 341 | 341 | struct PickerInfo *pPickerInfo; |
| 342 | HRESULT res; |
| 342 | 343 | |
| 343 | 344 | pPickerInfo = GetPickerInfo(hWnd); |
| 344 | 345 | |
| r7112 | r7113 | |
| 371 | 372 | { |
| 372 | 373 | nColumn = Picker_GetRealColumnFromViewColumn(hWnd, i++); |
| 373 | 374 | widths[nColumn] = col.cx; |
| 374 | | ListView_DeleteColumn(hWnd, 0); |
| 375 | res = ListView_DeleteColumn(hWnd, 0); |
| 375 | 376 | } |
| 376 | 377 | |
| 377 | 378 | pPickerInfo->pCallbacks->pfnSetColumnWidths(widths); |
| r7112 | r7113 | |
| 390 | 391 | lvc.iSubItem = nColumn; |
| 391 | 392 | lvc.cx = widths[order[i]]; |
| 392 | 393 | lvc.fmt = LVCFMT_LEFT; |
| 393 | | ListView_InsertColumn(hWnd, nColumn, &lvc); |
| 394 | res = ListView_InsertColumn(hWnd, nColumn, &lvc); |
| 394 | 395 | pPickerInfo->pnColumnsOrder[nColumn] = order[i]; |
| 395 | 396 | |
| 396 | 397 | dprintf("Visible column %d: Logical column %d; Width=%d\n", nColumn, order[i], widths[order[i]]); |
| r7112 | r7113 | |
| 412 | 413 | } |
| 413 | 414 | |
| 414 | 415 | if (GetListFontColor() == RGB(255, 255, 255)) |
| 415 | | ListView_SetTextColor(hWnd, RGB(240, 240, 240)); |
| 416 | res = ListView_SetTextColor(hWnd, RGB(240, 240, 240)); |
| 416 | 417 | else |
| 417 | | ListView_SetTextColor(hWnd, GetListFontColor()); |
| 418 | res = ListView_SetTextColor(hWnd, GetListFontColor()); |
| 418 | 419 | |
| 419 | 420 | done: |
| 420 | 421 | if (widths) |
| r7112 | r7113 | |
| 507 | 508 | struct PickerInfo *pPickerInfo; |
| 508 | 509 | int i; |
| 509 | 510 | LONG_PTR l; |
| 511 | HRESULT res; |
| 510 | 512 | |
| 511 | 513 | assert(hwndPicker); |
| 512 | 514 | |
| r7112 | r7113 | |
| 561 | 563 | SetWindowLongPtr(hwndPicker, GWLP_USERDATA, (LONG_PTR) pPickerInfo); |
| 562 | 564 | SetWindowLongPtr(hwndPicker, GWLP_WNDPROC, (LONG_PTR) ListViewWndProc); |
| 563 | 565 | |
| 564 | | ListView_SetExtendedListViewStyle(hwndPicker, LVS_EX_FULLROWSELECT | LVS_EX_HEADERDRAGDROP | |
| 566 | res = ListView_SetExtendedListViewStyle(hwndPicker, LVS_EX_FULLROWSELECT | LVS_EX_HEADERDRAGDROP | |
| 565 | 567 | LVS_EX_UNDERLINEHOT | LVS_EX_UNDERLINECOLD | LVS_EX_LABELTIP); |
| 566 | 568 | |
| 567 | 569 | Picker_InternalResetColumnDisplay(hwndPicker, TRUE); |
| r7112 | r7113 | |
| 656 | 658 | POINTS p; |
| 657 | 659 | DWORD res = GetMessagePos(); |
| 658 | 660 | LVHITTESTINFO htInfo; |
| 661 | HRESULT result; |
| 659 | 662 | |
| 660 | 663 | memset(&htInfo, 0, sizeof(htInfo)); |
| 661 | 664 | p = MAKEPOINTS(res); |
| 662 | 665 | GetWindowRect(hWnd, &rect); |
| 663 | 666 | htInfo.pt.x = p.x - rect.left; |
| 664 | 667 | htInfo.pt.y = p.y - rect.top; |
| 665 | | ListView_HitTest(hWnd, &htInfo); |
| 668 | result = ListView_HitTest(hWnd, &htInfo); |
| 666 | 669 | |
| 667 | 670 | return (! (htInfo.flags & LVHT_NOWHERE)); |
| 668 | 671 | } |
| r7112 | r7113 | |
| 673 | 676 | { |
| 674 | 677 | int nItem; |
| 675 | 678 | LV_ITEM lvi; |
| 679 | HRESULT res; |
| 676 | 680 | |
| 677 | 681 | nItem = ListView_GetNextItem(hWnd, -1, LVIS_SELECTED | LVIS_FOCUSED); |
| 678 | 682 | if (nItem < 0) |
| r7112 | r7113 | |
| 681 | 685 | memset(&lvi, 0, sizeof(lvi)); |
| 682 | 686 | lvi.iItem = nItem; |
| 683 | 687 | lvi.mask = LVIF_PARAM; |
| 684 | | ListView_GetItem(hWnd, &lvi); |
| 688 | res = ListView_GetItem(hWnd, &lvi); |
| 685 | 689 | return lvi.lParam; |
| 686 | 690 | } |
| 687 | 691 | |
| r7112 | r7113 | |
| 689 | 693 | |
| 690 | 694 | void Picker_SetSelectedPick(HWND hWnd, int nIndex) |
| 691 | 695 | { |
| 696 | HRESULT res; |
| 697 | |
| 692 | 698 | if (nIndex < 0) |
| 693 | 699 | nIndex = 0; |
| 694 | 700 | |
| 695 | 701 | ListView_SetItemState(hWnd, nIndex, LVIS_FOCUSED | LVIS_SELECTED, |
| 696 | 702 | LVIS_FOCUSED | LVIS_SELECTED); |
| 697 | | ListView_EnsureVisible(hWnd, nIndex, FALSE); |
| 703 | res = ListView_EnsureVisible(hWnd, nIndex, FALSE); |
| 698 | 704 | } |
| 699 | 705 | |
| 700 | 706 | |
| r7112 | r7113 | |
| 753 | 759 | HWND hwndHeader; |
| 754 | 760 | HD_ITEM hdi; |
| 755 | 761 | int i, nViewColumn; |
| 762 | HRESULT res; |
| 756 | 763 | |
| 757 | 764 | pPickerInfo = GetPickerInfo(hwndPicker); |
| 758 | 765 | |
| r7112 | r7113 | |
| 764 | 771 | for (i = 0; i < pPickerInfo->nColumnCount; i++) |
| 765 | 772 | { |
| 766 | 773 | if (i != pPickerInfo->pCallbacks->pfnGetSortColumn()) |
| 767 | | Header_SetItem(hwndHeader, Picker_GetViewColumnFromRealColumn(hwndPicker, i), &hdi); |
| 774 | res = Header_SetItem(hwndHeader, Picker_GetViewColumnFromRealColumn(hwndPicker, i), &hdi); |
| 768 | 775 | } |
| 769 | 776 | |
| 770 | 777 | if (GetUseXPControl()) |
| r7112 | r7113 | |
| 782 | 789 | } |
| 783 | 790 | |
| 784 | 791 | nViewColumn = Picker_GetViewColumnFromRealColumn(hwndPicker, pPickerInfo->pCallbacks->pfnGetSortColumn()); |
| 785 | | Header_SetItem(hwndHeader, nViewColumn, &hdi); |
| 792 | res = Header_SetItem(hwndHeader, nViewColumn, &hdi); |
| 786 | 793 | } |
| 787 | 794 | |
| 788 | 795 | |
| r7112 | r7113 | |
| 922 | 929 | struct PickerInfo *pPickerInfo; |
| 923 | 930 | struct CompareProcParams params; |
| 924 | 931 | int nItem; |
| 932 | HRESULT res; |
| 925 | 933 | |
| 926 | 934 | pPickerInfo = GetPickerInfo(hwndPicker); |
| 927 | 935 | |
| 928 | 936 | // populate the CompareProcParams structure |
| 929 | 937 | Picker_PopulateCompareProcParams(hwndPicker, ¶ms); |
| 930 | 938 | |
| 931 | | ListView_SortItems(hwndPicker, Picker_CompareProc, (LPARAM) ¶ms); |
| 939 | res = ListView_SortItems(hwndPicker, Picker_CompareProc, (LPARAM) ¶ms); |
| 932 | 940 | |
| 933 | 941 | Picker_ResetHeaderSortIcon(hwndPicker); |
| 934 | 942 | |
| r7112 | r7113 | |
| 937 | 945 | lvfi.lParam = Picker_GetSelectedItem(hwndPicker); |
| 938 | 946 | nItem = ListView_FindItem(hwndPicker, -1, &lvfi); |
| 939 | 947 | |
| 940 | | ListView_EnsureVisible(hwndPicker, nItem, FALSE); |
| 948 | res = ListView_EnsureVisible(hwndPicker, nItem, FALSE); |
| 941 | 949 | } |
| 942 | 950 | |
| 943 | 951 | |
| r7112 | r7113 | |
| 949 | 957 | struct CompareProcParams params; |
| 950 | 958 | int nCompareResult; |
| 951 | 959 | LVITEM lvi; |
| 960 | HRESULT res; |
| 952 | 961 | |
| 953 | 962 | pPickerInfo = GetPickerInfo(hwndPicker); |
| 954 | 963 | |
| r7112 | r7113 | |
| 965 | 974 | memset(&lvi, 0, sizeof(lvi)); |
| 966 | 975 | lvi.mask = LVIF_PARAM; |
| 967 | 976 | lvi.iItem = nMid; |
| 968 | | ListView_GetItem(hwndPicker, &lvi); |
| 977 | res = ListView_GetItem(hwndPicker, &lvi); |
| 969 | 978 | |
| 970 | 979 | nCompareResult = Picker_CompareProc(nParam, lvi.lParam, (LPARAM) ¶ms); |
| 971 | 980 | |
| r7112 | r7113 | |
| 1235 | 1244 | int nParent; |
| 1236 | 1245 | HBITMAP hBackground = GetBackgroundBitmap(); |
| 1237 | 1246 | MYBITMAPINFO *pbmDesc = GetBackgroundInfo(); |
| 1247 | HRESULT res; |
| 1238 | 1248 | |
| 1239 | 1249 | pPickerInfo = GetPickerInfo(hWnd); |
| 1240 | 1250 | |
| r7112 | r7113 | |
| 1250 | 1260 | else |
| 1251 | 1261 | { |
| 1252 | 1262 | /* Get the Column Order and save it */ |
| 1253 | | ListView_GetColumnOrderArray(hWnd, nColumnMax, order); |
| 1263 | res = ListView_GetColumnOrderArray(hWnd, nColumnMax, order); |
| 1254 | 1264 | |
| 1255 | 1265 | /* Disallow moving column 0 */ |
| 1256 | 1266 | if (order[0] != 0) |
| r7112 | r7113 | |
| 1263 | 1273 | order[0] = 0; |
| 1264 | 1274 | } |
| 1265 | 1275 | } |
| 1266 | | ListView_SetColumnOrderArray(hWnd, nColumnMax, order); |
| 1276 | res = ListView_SetColumnOrderArray(hWnd, nColumnMax, order); |
| 1267 | 1277 | } |
| 1268 | 1278 | } |
| 1269 | 1279 | |
| r7112 | r7113 | |
| 1278 | 1288 | lvi.pszText = szBuff; |
| 1279 | 1289 | lvi.cchTextMax = sizeof(szBuff) / sizeof(szBuff[0]); |
| 1280 | 1290 | lvi.stateMask = 0xFFFF; /* get all state flags */ |
| 1281 | | ListView_GetItem(hWnd, &lvi); |
| 1291 | res = ListView_GetItem(hWnd, &lvi); |
| 1282 | 1292 | |
| 1283 | 1293 | bSelected = ((lvi.state & LVIS_DROPHILITED) || ( (lvi.state & LVIS_SELECTED) |
| 1284 | 1294 | && ((bFocus) || (GetWindowLong(hWnd, GWL_STYLE) & LVS_SHOWSELALWAYS)))); |
| r7112 | r7113 | |
| 1297 | 1307 | { |
| 1298 | 1308 | lvi.mask = LVIF_PARAM; |
| 1299 | 1309 | lvi.iItem = i; |
| 1300 | | ListView_GetItem(hWnd, &lvi); |
| 1310 | res = ListView_GetItem(hWnd, &lvi); |
| 1301 | 1311 | |
| 1302 | 1312 | if (lvi.lParam == nParent) |
| 1303 | 1313 | { |
| r7112 | r7113 | |
| 1322 | 1332 | } |
| 1323 | 1333 | } |
| 1324 | 1334 | |
| 1325 | | ListView_GetItemRect_Modified(hWnd, nItem, &rcAllLabels, LVIR_BOUNDS); |
| 1326 | | ListView_GetItemRect_Modified(hWnd, nItem, &rcLabel, LVIR_LABEL); |
| 1335 | res = ListView_GetItemRect_Modified(hWnd, nItem, &rcAllLabels, LVIR_BOUNDS); |
| 1336 | res = ListView_GetItemRect_Modified(hWnd, nItem, &rcLabel, LVIR_LABEL); |
| 1327 | 1337 | |
| 1328 | 1338 | rcAllLabels.left = rcLabel.left; |
| 1329 | 1339 | |
| r7112 | r7113 | |
| 1362 | 1372 | RealizePalette(htempDC); |
| 1363 | 1373 | } |
| 1364 | 1374 | |
| 1365 | | ListView_GetItemRect_Modified(hWnd, 0, &rcFirstItem, LVIR_BOUNDS); |
| 1375 | res = ListView_GetItemRect_Modified(hWnd, 0, &rcFirstItem, LVIR_BOUNDS); |
| 1366 | 1376 | |
| 1367 | 1377 | for (i = rcFirstItem.left; i < rcClient.right; i += pbmDesc->bmWidth) |
| 1368 | 1378 | for (j = rcFirstItem.top; j < rcClient.bottom; j += pbmDesc->bmHeight) |
| r7112 | r7113 | |
| 1384 | 1394 | { |
| 1385 | 1395 | RECT rect; |
| 1386 | 1396 | |
| 1387 | | ListView_GetItemRect_Modified(hWnd, nItem, &rect, LVIR_ICON); |
| 1397 | res = ListView_GetItemRect_Modified(hWnd, nItem, &rect, LVIR_ICON); |
| 1388 | 1398 | |
| 1389 | 1399 | /* indent width of icon + the space between the icon and text |
| 1390 | 1400 | * so left of clone icon starts at text of parent |
| r7112 | r7113 | |
| 1472 | 1482 | ImageList_Draw(hImageList, nImage, hDC, rcItem.left, rcItem.top, ILD_TRANSPARENT); |
| 1473 | 1483 | } |
| 1474 | 1484 | |
| 1475 | | ListView_GetItemRect_Modified(hWnd, nItem, &rcIcon, LVIR_ICON); |
| 1485 | res = ListView_GetItemRect_Modified(hWnd, nItem, &rcIcon, LVIR_ICON); |
| 1476 | 1486 | |
| 1477 | 1487 | rcIcon.left += indent_space; |
| 1478 | 1488 | |
| 1479 | | ListView_GetItemRect_Modified(hWnd, nItem, &rcItem, LVIR_LABEL); |
| 1489 | res = ListView_GetItemRect_Modified(hWnd, nItem, &rcItem, LVIR_LABEL); |
| 1480 | 1490 | |
| 1481 | 1491 | hImageList = ListView_GetImageList(hWnd, LVSIL_SMALL); |
| 1482 | 1492 | if (hImageList) |
| r7112 | r7113 | |
| 1489 | 1499 | } |
| 1490 | 1500 | } |
| 1491 | 1501 | |
| 1492 | | ListView_GetItemRect_Modified(hWnd, nItem, &rcItem, LVIR_LABEL); |
| 1502 | res = ListView_GetItemRect_Modified(hWnd, nItem, &rcItem, LVIR_LABEL); |
| 1493 | 1503 | |
| 1494 | 1504 | pszText = MakeShortString(hDC, szBuff, rcItem.right - rcItem.left, 2*offset + indent_space); |
| 1495 | 1505 | |
| r7112 | r7113 | |
| 1507 | 1517 | LV_ITEM lvItem; |
| 1508 | 1518 | |
| 1509 | 1519 | lvc.mask = LVCF_FMT | LVCF_WIDTH; |
| 1510 | | ListView_GetColumn(hWnd, order[nColumn], &lvc); |
| 1520 | res = ListView_GetColumn(hWnd, order[nColumn], &lvc); |
| 1511 | 1521 | |
| 1512 | 1522 | lvItem.mask = LVIF_TEXT; |
| 1513 | 1523 | lvItem.iItem = nItem; |
| r7112 | r7113 | |
| 1608 | 1618 | int *tmpOrder; |
| 1609 | 1619 | int nColumnMax, i; |
| 1610 | 1620 | BOOL bSuccess = FALSE; |
| 1621 | HRESULT res; |
| 1611 | 1622 | |
| 1612 | 1623 | pPickerInfo = GetPickerInfo(hwndPicker); |
| 1613 | 1624 | |
| r7112 | r7113 | |
| 1641 | 1652 | else |
| 1642 | 1653 | { |
| 1643 | 1654 | /* Get the Column Order and save it */ |
| 1644 | | ListView_GetColumnOrderArray(hwndPicker, nColumnMax, tmpOrder); |
| 1655 | res = ListView_GetColumnOrderArray(hwndPicker, nColumnMax, tmpOrder); |
| 1645 | 1656 | |
| 1646 | 1657 | for (i = 0; i < nColumnMax; i++) |
| 1647 | 1658 | { |
src/osd/winui/winui.c
| r7112 | r7113 | |
| 1040 | 1040 | int tmpOrder[COLUMN_MAX]; |
| 1041 | 1041 | int nColumnMax; |
| 1042 | 1042 | int i; |
| 1043 | HRESULT res; |
| 1043 | 1044 | |
| 1044 | 1045 | nColumnMax = Picker_GetNumColumns(hwndList); |
| 1045 | 1046 | |
| 1046 | 1047 | /* Get the Column Order and save it */ |
| 1047 | 1048 | if (!oldControl) |
| 1048 | 1049 | { |
| 1049 | | ListView_GetColumnOrderArray(hwndList, nColumnMax, tmpOrder); |
| 1050 | res = ListView_GetColumnOrderArray(hwndList, nColumnMax, tmpOrder); |
| 1050 | 1051 | |
| 1051 | 1052 | for (i = 0; i < nColumnMax; i++) |
| 1052 | 1053 | { |
| r7112 | r7113 | |
| 2139 | 2140 | MINMAXINFO *mminfo; |
| 2140 | 2141 | int i; |
| 2141 | 2142 | TCHAR szClass[128]; |
| 2143 | HRESULT res; |
| 2142 | 2144 | |
| 2143 | 2145 | switch (message) |
| 2144 | 2146 | { |
| r7112 | r7113 | |
| 2449 | 2451 | i = ListView_FindItem(hwndList, -1, &lvfi); |
| 2450 | 2452 | if (i != -1) |
| 2451 | 2453 | { |
| 2452 | | ListView_RedrawItems(hwndList, i, i); |
| 2454 | res = ListView_RedrawItems(hwndList, i, i); |
| 2453 | 2455 | } |
| 2454 | 2456 | } |
| 2455 | 2457 | break; |
| r7112 | r7113 | |
| 2531 | 2533 | LV_FINDINFO lvfi; |
| 2532 | 2534 | int nCount = ListView_GetItemCount(hwndList); |
| 2533 | 2535 | BOOL changed = FALSE; |
| 2536 | HRESULT res; |
| 2534 | 2537 | |
| 2535 | 2538 | MSG msg; |
| 2536 | 2539 | for(i=0; i<nCount;i++) |
| r7112 | r7113 | |
| 2540 | 2543 | lvi.iItem = i; |
| 2541 | 2544 | lvi.iSubItem = 0; |
| 2542 | 2545 | lvi.mask = LVIF_PARAM; |
| 2543 | | ListView_GetItem(hwndList, &lvi); |
| 2546 | res = ListView_GetItem(hwndList, &lvi); |
| 2544 | 2547 | nGameIndex = lvi.lParam; |
| 2545 | 2548 | SetRomAuditResults(nGameIndex, UNKNOWN); |
| 2546 | 2549 | SetSampleAuditResults(nGameIndex, UNKNOWN); |
| r7112 | r7113 | |
| 2562 | 2565 | lvi.iItem = i; |
| 2563 | 2566 | lvi.iSubItem = 0; |
| 2564 | 2567 | lvi.mask = LVIF_PARAM; |
| 2565 | | ListView_GetItem(hwndList, &lvi); |
| 2568 | res = ListView_GetItem(hwndList, &lvi); |
| 2566 | 2569 | nGameIndex = lvi.lParam; |
| 2567 | 2570 | if (GetRomAuditResults(nGameIndex) == UNKNOWN) |
| 2568 | 2571 | { |
| r7112 | r7113 | |
| 2582 | 2585 | i = ListView_FindItem(hwndList, -1, &lvfi); |
| 2583 | 2586 | if (changed && i != -1); |
| 2584 | 2587 | { |
| 2585 | | ListView_RedrawItems(hwndList, i, i); |
| 2588 | res = ListView_RedrawItems(hwndList, i, i); |
| 2586 | 2589 | while( PeekMessage( &msg, hwndList, 0, 0, PM_REMOVE ) != 0) |
| 2587 | 2590 | { |
| 2588 | 2591 | TranslateMessage(&msg); |
| r7112 | r7113 | |
| 2605 | 2608 | LV_FINDINFO lvfi; |
| 2606 | 2609 | int i; |
| 2607 | 2610 | BOOL changed = FALSE; |
| 2611 | HRESULT res; |
| 2608 | 2612 | |
| 2609 | 2613 | if (game_index == 0) |
| 2610 | 2614 | ProgressBarShow(); |
| r7112 | r7113 | |
| 2634 | 2638 | |
| 2635 | 2639 | i = ListView_FindItem(hwndList, -1, &lvfi); |
| 2636 | 2640 | if (changed && i != -1); |
| 2637 | | ListView_RedrawItems(hwndList, i, i); |
| 2641 | res = ListView_RedrawItems(hwndList, i, i); |
| 2638 | 2642 | if ((game_index % progBarStep) == 0) |
| 2639 | 2643 | ProgressBarStep(); |
| 2640 | 2644 | game_index++; |
| r7112 | r7113 | |
| 3809 | 3813 | LV_ITEM lvi; |
| 3810 | 3814 | BOOL no_selection = FALSE; |
| 3811 | 3815 | LPTREEFOLDER lpFolder = GetCurrentFolder(); |
| 3816 | HRESULT res; |
| 3812 | 3817 | |
| 3813 | 3818 | if (!lpFolder) |
| 3814 | 3819 | { |
| r7112 | r7113 | |
| 3825 | 3830 | |
| 3826 | 3831 | SetWindowRedraw(hwndList,FALSE); |
| 3827 | 3832 | |
| 3828 | | ListView_DeleteAllItems(hwndList); |
| 3833 | res = ListView_DeleteAllItems(hwndList); |
| 3829 | 3834 | |
| 3830 | 3835 | // hint to have it allocate it all at once |
| 3831 | 3836 | ListView_SetItemCount(hwndList,driver_list_get_count(drivers)); |
| r7112 | r7113 | |
| 3848 | 3853 | lvi.lParam = i; |
| 3849 | 3854 | lvi.pszText = LPSTR_TEXTCALLBACK; |
| 3850 | 3855 | lvi.iImage = I_IMAGECALLBACK; |
| 3851 | | ListView_InsertItem(hwndList, &lvi); |
| 3856 | res = ListView_InsertItem(hwndList, &lvi); |
| 3852 | 3857 | } |
| 3853 | 3858 | } while (i != -1); |
| 3854 | 3859 | |
| r7112 | r7113 | |
| 3957 | 3962 | CHOOSEFONT cf; |
| 3958 | 3963 | TCHAR szClass[128]; |
| 3959 | 3964 | HWND hWnd; |
| 3965 | HRESULT res; |
| 3960 | 3966 | |
| 3961 | 3967 | GetListFont(&font); |
| 3962 | 3968 | font.lfQuality = DEFAULT_QUALITY; |
| r7112 | r7113 | |
| 3992 | 3998 | { |
| 3993 | 3999 | if (!_tcscmp(szClass, TEXT("SysListView32"))) |
| 3994 | 4000 | { |
| 3995 | | ListView_SetTextColor(hWnd, textColor); |
| 4001 | res = ListView_SetTextColor(hWnd, textColor); |
| 3996 | 4002 | } |
| 3997 | 4003 | else if (!_tcscmp(szClass, TEXT("SysTreeView32"))) |
| 3998 | 4004 | { |
| 3999 | | TreeView_SetTextColor(hTreeView, textColor); |
| 4005 | res = TreeView_SetTextColor(hTreeView, textColor); |
| 4000 | 4006 | } |
| 4001 | 4007 | } |
| 4002 | 4008 | hWnd = GetWindow(hWnd, GW_HWNDNEXT); |
| r7112 | r7113 | |
| 4041 | 4047 | int i; |
| 4042 | 4048 | LPTREEFOLDER folder; |
| 4043 | 4049 | char* t_szFile; |
| 4050 | HRESULT res; |
| 4044 | 4051 | |
| 4045 | 4052 | switch (id) |
| 4046 | 4053 | { |
| r7112 | r7113 | |
| 4595 | 4602 | /* enter key */ |
| 4596 | 4603 | if (g_in_treeview_edit) |
| 4597 | 4604 | { |
| 4598 | | TreeView_EndEditLabelNow(hTreeView, FALSE); |
| 4605 | res = TreeView_EndEditLabelNow(hTreeView, FALSE); |
| 4599 | 4606 | return TRUE; |
| 4600 | 4607 | } |
| 4601 | 4608 | else |
| r7112 | r7113 | |
| 4606 | 4613 | |
| 4607 | 4614 | case IDCANCEL : /* esc key */ |
| 4608 | 4615 | if (g_in_treeview_edit) |
| 4609 | | TreeView_EndEditLabelNow(hTreeView, TRUE); |
| 4616 | res = TreeView_EndEditLabelNow(hTreeView, TRUE); |
| 4610 | 4617 | break; |
| 4611 | 4618 | |
| 4612 | 4619 | case IDC_PLAY_GAME : |
| r7112 | r7113 | |
| 4682 | 4689 | |
| 4683 | 4690 | case ID_CONTEXT_RESET_PLAYTIME: |
| 4684 | 4691 | ResetPlayTime( Picker_GetSelectedItem(hwndList) ); |
| 4685 | | ListView_RedrawItems(hwndList, GetSelectedPick(), GetSelectedPick()); |
| 4692 | res = ListView_RedrawItems(hwndList, GetSelectedPick(), GetSelectedPick()); |
| 4686 | 4693 | break; |
| 4687 | 4694 | |
| 4688 | 4695 | case ID_CONTEXT_RESET_PLAYCOUNT: |
| 4689 | 4696 | ResetPlayCount( Picker_GetSelectedItem(hwndList) ); |
| 4690 | | ListView_RedrawItems(hwndList, GetSelectedPick(), GetSelectedPick()); |
| 4697 | res = ListView_RedrawItems(hwndList, GetSelectedPick(), GetSelectedPick()); |
| 4691 | 4698 | break; |
| 4692 | 4699 | |
| 4693 | 4700 | case ID_CONTEXT_RENAME_CUSTOM : |
| r7112 | r7113 | |
| 4917 | 4924 | LVBKIMAGE bki; |
| 4918 | 4925 | TCHAR path[MAX_PATH]; |
| 4919 | 4926 | TCHAR* t_bgdir; |
| 4927 | HRESULT res; |
| 4920 | 4928 | |
| 4921 | 4929 | static const struct PickerCallbacks s_gameListCallbacks = |
| 4922 | 4930 | { |
| r7112 | r7113 | |
| 4956 | 4964 | opts.ppszColumnNames = column_names; |
| 4957 | 4965 | SetupPicker(hwndList, &opts); |
| 4958 | 4966 | |
| 4959 | | ListView_SetTextBkColor(hwndList, CLR_NONE); |
| 4960 | | ListView_SetBkColor(hwndList, CLR_NONE); |
| 4967 | res = ListView_SetTextBkColor(hwndList, CLR_NONE); |
| 4968 | res = ListView_SetBkColor(hwndList, CLR_NONE); |
| 4961 | 4969 | t_bgdir = tstring_from_utf8(GetBgDir()); |
| 4962 | 4970 | if( !t_bgdir ) |
| 4963 | 4971 | return; |
| r7112 | r7113 | |
| 4965 | 4973 | bki.ulFlags = LVBKIF_SOURCE_URL | LVBKIF_STYLE_TILE; |
| 4966 | 4974 | bki.pszImage = path; |
| 4967 | 4975 | if( hBackground ) |
| 4968 | | ListView_SetBkImage(hwndList, &bki); |
| 4976 | res = ListView_SetBkImage(hwndList, &bki); |
| 4969 | 4977 | |
| 4970 | 4978 | CreateIcons(); |
| 4971 | 4979 | |
| r7112 | r7113 | |
| 5356 | 5364 | static HICON GetSelectedPickItemIcon() |
| 5357 | 5365 | { |
| 5358 | 5366 | LV_ITEM lvi; |
| 5367 | HRESULT res; |
| 5359 | 5368 | |
| 5360 | 5369 | lvi.iItem = GetSelectedPick(); |
| 5361 | 5370 | lvi.iSubItem = 0; |
| 5362 | 5371 | lvi.mask = LVIF_IMAGE; |
| 5363 | | ListView_GetItem(hwndList, &lvi); |
| 5372 | res = ListView_GetItem(hwndList, &lvi); |
| 5364 | 5373 | |
| 5365 | 5374 | return ImageList_GetIcon(hLarge, lvi.iImage, ILD_TRANSPARENT); |
| 5366 | 5375 | } |
| r7112 | r7113 | |
| 5960 | 5969 | static void MamePlayGameWithOptions(int nGame, const play_options *playopts) |
| 5961 | 5970 | { |
| 5962 | 5971 | DWORD dwExitCode; |
| 5972 | HRESULT res; |
| 5963 | 5973 | |
| 5964 | 5974 | #ifdef MESS |
| 5965 | 5975 | if (!MessApproveImageList(hMain, nGame)) |
| r7112 | r7113 | |
| 5977 | 5987 | if (dwExitCode == 0) |
| 5978 | 5988 | { |
| 5979 | 5989 | IncrementPlayCount(nGame); |
| 5980 | | ListView_RedrawItems(hwndList, GetSelectedPick(), GetSelectedPick()); |
| 5990 | res = ListView_RedrawItems(hwndList, GetSelectedPick(), GetSelectedPick()); |
| 5981 | 5991 | } |
| 5982 | 5992 | else |
| 5983 | 5993 | { |
| r7112 | r7113 | |
| 6025 | 6035 | COLORREF textColor; |
| 6026 | 6036 | TCHAR szClass[128]; |
| 6027 | 6037 | HWND hWnd; |
| 6038 | HRESULT res; |
| 6028 | 6039 | |
| 6029 | 6040 | /* WM_SETTINGCHANGE also */ |
| 6030 | 6041 | xtraX = GetSystemMetrics(SM_CXFIXEDFRAME); /* Dialog frame width */ |
| r7112 | r7113 | |
| 6052 | 6063 | { |
| 6053 | 6064 | if (!_tcscmp(szClass, TEXT("SysListView32"))) |
| 6054 | 6065 | { |
| 6055 | | ListView_SetBkColor(hWnd, GetSysColor(COLOR_WINDOW)); |
| 6056 | | ListView_SetTextColor(hWnd, textColor); |
| 6066 | res = ListView_SetBkColor(hWnd, GetSysColor(COLOR_WINDOW)); |
| 6067 | res = ListView_SetTextColor(hWnd, textColor); |
| 6057 | 6068 | } |
| 6058 | 6069 | else if (!_tcscmp(szClass, TEXT("SysTreeView32"))) |
| 6059 | 6070 | { |
| 6060 | | TreeView_SetBkColor(hTreeView, GetSysColor(COLOR_WINDOW)); |
| 6061 | | TreeView_SetTextColor(hTreeView, textColor); |
| 6071 | res = TreeView_SetBkColor(hTreeView, GetSysColor(COLOR_WINDOW)); |
| 6072 | res = TreeView_SetTextColor(hTreeView, textColor); |
| 6062 | 6073 | } |
| 6063 | 6074 | } |
| 6064 | 6075 | hWnd = GetWindow(hWnd, GW_HWNDNEXT); |
| r7112 | r7113 | |
| 6161 | 6172 | HMENU hMenu; |
| 6162 | 6173 | TVHITTESTINFO hti; |
| 6163 | 6174 | POINT pt; |
| 6175 | HRESULT res; |
| 6164 | 6176 | |
| 6165 | 6177 | if ((HWND)wParam != GetDlgItem(hWnd, IDC_TREE)) |
| 6166 | 6178 | return FALSE; |
| r7112 | r7113 | |
| 6175 | 6187 | ScreenToClient(hTreeView,&hti.pt); |
| 6176 | 6188 | (void)TreeView_HitTest(hTreeView,&hti); |
| 6177 | 6189 | if ((hti.flags & TVHT_ONITEM) != 0) |
| 6178 | | TreeView_SelectItem(hTreeView,hti.hItem); |
| 6190 | res = TreeView_SelectItem(hTreeView,hti.hItem); |
| 6179 | 6191 | |
| 6180 | 6192 | hTreeMenu = LoadMenu(hInst,MAKEINTRESOURCE(IDR_CONTEXT_TREE)); |
| 6181 | 6193 | |
| r7112 | r7113 | |
| 6693 | 6705 | { |
| 6694 | 6706 | LV_ITEM lvi; |
| 6695 | 6707 | POINT pt; |
| 6708 | HRESULT res; |
| 6696 | 6709 | |
| 6697 | 6710 | lvi.iItem = pnmv->iItem; |
| 6698 | 6711 | lvi.mask = LVIF_PARAM; |
| 6699 | | ListView_GetItem(hwndList, &lvi); |
| 6712 | res = ListView_GetItem(hwndList, &lvi); |
| 6700 | 6713 | |
| 6701 | 6714 | game_dragged = lvi.lParam; |
| 6702 | 6715 | |
| r7112 | r7113 | |
| 6728 | 6741 | { |
| 6729 | 6742 | HTREEITEM htiTarget; |
| 6730 | 6743 | TV_HITTESTINFO tvht; |
| 6744 | HRESULT res; |
| 6731 | 6745 | |
| 6732 | 6746 | POINT pt; |
| 6733 | 6747 | pt.x = p.x; |
| r7112 | r7113 | |
| 6746 | 6760 | { |
| 6747 | 6761 | ImageList_DragShowNolock(FALSE); |
| 6748 | 6762 | if (htiTarget != NULL) |
| 6749 | | TreeView_SelectDropTarget(hTreeView,htiTarget); |
| 6763 | res = TreeView_SelectDropTarget(hTreeView,htiTarget); |
| 6750 | 6764 | else |
| 6751 | | TreeView_SelectDropTarget(hTreeView,NULL); |
| 6765 | res = TreeView_SelectDropTarget(hTreeView,NULL); |
| 6752 | 6766 | ImageList_DragShowNolock(TRUE); |
| 6753 | 6767 | |
| 6754 | 6768 | prev_drag_drop_target = htiTarget; |
| r7112 | r7113 | |
| 6761 | 6775 | HTREEITEM htiTarget; |
| 6762 | 6776 | TV_HITTESTINFO tvht; |
| 6763 | 6777 | TVITEM tvi; |
| 6778 | HRESULT res; |
| 6764 | 6779 | |
| 6765 | 6780 | ReleaseCapture(); |
| 6766 | 6781 | |
| r7112 | r7113 | |
| 6768 | 6783 | ImageList_EndDrag(); |
| 6769 | 6784 | ImageList_Destroy(himl_drag); |
| 6770 | 6785 | |
| 6771 | | TreeView_SelectDropTarget(hTreeView,NULL); |
| 6786 | res = TreeView_SelectDropTarget(hTreeView,NULL); |
| 6772 | 6787 | |
| 6773 | 6788 | g_listview_dragging = FALSE; |
| 6774 | 6789 | |
| r7112 | r7113 | |
| 6825 | 6840 | { |
| 6826 | 6841 | HTREEITEM htree; |
| 6827 | 6842 | TVITEM tvi; |
| 6843 | HRESULT res; |
| 6828 | 6844 | htree = TreeView_GetSelection(hTreeView); |
| 6829 | 6845 | if(htree != NULL) |
| 6830 | 6846 | { |
| 6831 | 6847 | tvi.hItem = htree; |
| 6832 | 6848 | tvi.mask = TVIF_PARAM; |
| 6833 | | TreeView_GetItem(hTreeView,&tvi); |
| 6849 | res = TreeView_GetItem(hTreeView,&tvi); |
| 6834 | 6850 | return (LPTREEFOLDER)tvi.lParam; |
| 6835 | 6851 | } |
| 6836 | 6852 | return NULL; |
| r7112 | r7113 | |
| 6842 | 6858 | TVITEM tvi; |
| 6843 | 6859 | HIMAGELIST hSmall_icon; |
| 6844 | 6860 | LPTREEFOLDER folder; |
| 6861 | HRESULT res; |
| 6845 | 6862 | htree = TreeView_GetSelection(hTreeView); |
| 6846 | 6863 | |
| 6847 | 6864 | if (htree != NULL) |
| 6848 | 6865 | { |
| 6849 | 6866 | tvi.hItem = htree; |
| 6850 | 6867 | tvi.mask = TVIF_PARAM; |
| 6851 | | TreeView_GetItem(hTreeView,&tvi); |
| 6868 | res = TreeView_GetItem(hTreeView,&tvi); |
| 6852 | 6869 | |
| 6853 | 6870 | folder = (LPTREEFOLDER)tvi.lParam; |
| 6854 | 6871 | //hSmall_icon = TreeView_GetImageList(hTreeView,(int)tvi.iImage); |
| r7112 | r7113 | |
| 6861 | 6878 | /* Updates all currently displayed Items in the List with the latest Data*/ |
| 6862 | 6879 | void UpdateListView(void) |
| 6863 | 6880 | { |
| 6881 | HRESULT res; |
| 6864 | 6882 | if( (GetViewMode() == VIEW_GROUPED) || (GetViewMode() == VIEW_DETAILS ) ) |
| 6865 | | ListView_RedrawItems(hwndList,ListView_GetTopIndex(hwndList), |
| 6883 | res = ListView_RedrawItems(hwndList,ListView_GetTopIndex(hwndList), |
| 6866 | 6884 | ListView_GetTopIndex(hwndList)+ ListView_GetCountPerPage(hwndList) ); |
| 6867 | 6885 | } |
| 6868 | 6886 | |
src/mess/osd/winui/propertiesms.c
| r7112 | r7113 | |
| 58 | 58 | static void AppendList(HWND hList, LPCTSTR lpItem, int nItem) |
| 59 | 59 | { |
| 60 | 60 | LV_ITEM Item; |
| 61 | HRESULT res; |
| 61 | 62 | memset(&Item, 0, sizeof(LV_ITEM)); |
| 62 | 63 | Item.mask = LVIF_TEXT; |
| 63 | 64 | Item.pszText = (LPTSTR) lpItem; |
| 64 | 65 | Item.iItem = nItem; |
| 65 | | ListView_InsertItem(hList, &Item); |
| 66 | res = ListView_InsertItem(hList, &Item); |
| 66 | 67 | } |
| 67 | 68 | |
| 68 | 69 | |
| r7112 | r7113 | |
| 74 | 75 | TCHAR outbuf[MAX_PATH]; |
| 75 | 76 | HWND hList; |
| 76 | 77 | LPTSTR lpIn; |
| 78 | HRESULT res; |
| 77 | 79 | |
| 78 | 80 | g_bModifiedSoftwarePaths = TRUE; |
| 79 | 81 | |
| r7112 | r7113 | |
| 105 | 107 | |
| 106 | 108 | AppendList(hList, lpItem, nItem); |
| 107 | 109 | if (bBrowse) |
| 108 | | ListView_DeleteItem(hList, nItem+1); |
| 110 | res = ListView_DeleteItem(hList, nItem+1); |
| 109 | 111 | MarkChanged(hDlg); |
| 110 | 112 | return TRUE; |
| 111 | 113 | } |
| r7112 | r7113 | |
| 118 | 120 | int nSelect; |
| 119 | 121 | int nItem; |
| 120 | 122 | HWND hList = GetDlgItem(hDlg, IDC_DIR_LIST); |
| 123 | HRESULT res; |
| 121 | 124 | |
| 122 | 125 | g_bModifiedSoftwarePaths = TRUE; |
| 123 | 126 | |
| r7112 | r7113 | |
| 130 | 133 | if (nItem == ListView_GetItemCount(hList) - 1) |
| 131 | 134 | return FALSE; |
| 132 | 135 | |
| 133 | | ListView_DeleteItem(hList, nItem); |
| 136 | res = ListView_DeleteItem(hList, nItem); |
| 134 | 137 | |
| 135 | 138 | nCount = ListView_GetItemCount(hList); |
| 136 | 139 | if (nCount <= 1) |
| r7112 | r7113 | |
| 282 | 285 | TCHAR buffer[2048]; |
| 283 | 286 | char *dir_list; |
| 284 | 287 | int i, pos, driver_index; |
| 288 | HRESULT res; |
| 285 | 289 | |
| 286 | 290 | // determine the directory count; note that one item is the "< >" entry |
| 287 | 291 | directory_count = ListView_GetItemCount(control); |
| r7112 | r7113 | |
| 303 | 307 | lvi.iItem = i; |
| 304 | 308 | lvi.pszText = &buffer[pos]; |
| 305 | 309 | lvi.cchTextMax = ARRAY_LENGTH(buffer) - pos; |
| 306 | | ListView_GetItem(control, &lvi); |
| 310 | res = ListView_GetItem(control, &lvi); |
| 307 | 311 | |
| 308 | 312 | // advance the position |
| 309 | 313 | pos += _tcslen(&buffer[pos]); |
| r7112 | r7113 | |
| 329 | 333 | TCHAR *s; |
| 330 | 334 | LV_COLUMN lvc; |
| 331 | 335 | RECT r; |
| 336 | HRESULT res; |
| 332 | 337 | |
| 333 | 338 | // access the directory list, and convert to TCHARs |
| 334 | 339 | driver_index = PropertiesCurrentGame(dialog); |
| r7112 | r7113 | |
| 338 | 343 | return FALSE; |
| 339 | 344 | |
| 340 | 345 | // delete all items in the list control |
| 341 | | ListView_DeleteAllItems(control); |
| 346 | res = ListView_DeleteAllItems(control); |
| 342 | 347 | |
| 343 | 348 | // add the column |
| 344 | 349 | GetClientRect(control, &r); |
| 345 | 350 | memset(&lvc, 0, sizeof(LVCOLUMN)); |
| 346 | 351 | lvc.mask = LVCF_WIDTH; |
| 347 | 352 | lvc.cx = r.right - r.left - GetSystemMetrics(SM_CXHSCROLL); |
| 348 | | ListView_InsertColumn(control, 0, &lvc); |
| 353 | res = ListView_InsertColumn(control, 0, &lvc); |
| 349 | 354 | |
| 350 | 355 | // add each of the directories |
| 351 | 356 | pos = 0; |