Index: dxglcfg2/dxglcfg2.c |
— | — | @@ -66,6 +66,8 @@ |
67 | 67 | HRESULT(WINAPI *_DrawThemeBackground)(HTHEME hTheme, HDC hdc, int iPartID,
|
68 | 68 | int iStateID, const RECT *pRect, const RECT *pClipRect) = NULL;
|
69 | 69 | HRESULT(WINAPI *_EnableThemeDialogTexture)(HWND hwnd, DWORD dwFlags) = NULL;
|
| 70 | +static BOOL ExtraModes_Dropdown = FALSE;
|
| 71 | +static HWND hDialog = NULL;
|
70 | 72 |
|
71 | 73 |
|
72 | 74 | typedef struct
|
— | — | @@ -128,6 +130,16 @@ |
129 | 131 | _T("8/15/16/24/32-bit")
|
130 | 132 | };
|
131 | 133 |
|
| 134 | +static const TCHAR *extramodes[7] = {
|
| 135 | + _T("Common low resolutions"),
|
| 136 | + _T("Uncommon low resolutions"),
|
| 137 | + _T("Uncommon SD resolutions"),
|
| 138 | + _T("High Definition resolutions"),
|
| 139 | + _T("Ultra-HD resolutions"),
|
| 140 | + _T("Ultra-HD above 4k"),
|
| 141 | + _T("Very uncommon resolutions")
|
| 142 | +};
|
| 143 | +
|
132 | 144 | DWORD AddApp(LPCTSTR path, BOOL copyfile, BOOL admin, BOOL force, HWND hwnd)
|
133 | 145 | {
|
134 | 146 | BOOL installed = FALSE;
|
— | — | @@ -708,6 +720,8 @@ |
709 | 721 | COLORREF OldTextColor, OldBackColor;
|
710 | 722 | RECT r;
|
711 | 723 | TCHAR combotext[64];
|
| 724 | + DWORD cursel;
|
| 725 | + int i;
|
712 | 726 | switch (Msg)
|
713 | 727 | {
|
714 | 728 | case WM_INITDIALOG:
|
— | — | @@ -740,19 +754,83 @@ |
741 | 755 | }
|
742 | 756 | else ExtTextOut(drawitem->hDC, 0, 0, ETO_OPAQUE, &drawitem->rcItem, NULL, 0, NULL);
|
743 | 757 | memcpy(&r, &drawitem->rcItem, sizeof(RECT));
|
744 | | - r.left = r.left + 2;
|
745 | | - r.right = r.left + GetSystemMetrics(SM_CXMENUCHECK);
|
746 | | - if (hThemeDisplay) _DrawThemeBackground(hThemeDisplay, drawitem->hDC, BS_AUTOCHECKBOX,
|
747 | | - CBS_CHECKEDNORMAL, &r, NULL);
|
748 | | - else DrawFrameControl(drawitem->hDC, &r, DFC_BUTTON, DFCS_BUTTONCHECK | DFCS_CHECKED | DFCS_HOT);
|
749 | | - drawitem->rcItem.left += GetSystemMetrics(SM_CXMENUCHECK) + 5;
|
| 758 | + if (drawitem->itemID != -1 && !(drawitem->itemState & ODS_COMBOBOXEDIT))
|
| 759 | + {
|
| 760 | + r.left = r.left + 2;
|
| 761 | + r.right = r.left + GetSystemMetrics(SM_CXMENUCHECK);
|
| 762 | + if ((cfg->AddModes >> drawitem->itemID) & 1)
|
| 763 | + {
|
| 764 | + if (hThemeDisplay)
|
| 765 | + {
|
| 766 | + if (drawitem->itemState & ODS_SELECTED)
|
| 767 | + _DrawThemeBackground(hThemeDisplay, drawitem->hDC, BS_AUTOCHECKBOX, CBS_CHECKEDHOT, &r, NULL);
|
| 768 | + else _DrawThemeBackground(hThemeDisplay, drawitem->hDC, BS_AUTOCHECKBOX, CBS_CHECKEDNORMAL, &r, NULL);
|
| 769 | + }
|
| 770 | + else
|
| 771 | + {
|
| 772 | + if (drawitem->itemState & ODS_SELECTED)
|
| 773 | + DrawFrameControl(drawitem->hDC, &r, DFC_BUTTON, DFCS_BUTTONCHECK | DFCS_CHECKED | DFCS_HOT);
|
| 774 | + else DrawFrameControl(drawitem->hDC, &r, DFC_BUTTON, DFCS_BUTTONCHECK | DFCS_CHECKED);
|
| 775 | + }
|
| 776 | + }
|
| 777 | + else
|
| 778 | + {
|
| 779 | + if (hThemeDisplay)
|
| 780 | + {
|
| 781 | + if (drawitem->itemState & ODS_SELECTED)
|
| 782 | + _DrawThemeBackground(hThemeDisplay, drawitem->hDC, BS_AUTOCHECKBOX, CBS_UNCHECKEDHOT, &r, NULL);
|
| 783 | + else _DrawThemeBackground(hThemeDisplay, drawitem->hDC, BS_AUTOCHECKBOX, CBS_UNCHECKEDNORMAL, &r, NULL);
|
| 784 | + }
|
| 785 | + else
|
| 786 | + {
|
| 787 | + if (drawitem->itemState & ODS_SELECTED)
|
| 788 | + DrawFrameControl(drawitem->hDC, &r, DFC_BUTTON, DFCS_BUTTONCHECK | DFCS_HOT);
|
| 789 | + else DrawFrameControl(drawitem->hDC, &r, DFC_BUTTON, DFCS_BUTTONCHECK);
|
| 790 | + }
|
| 791 | + }
|
| 792 | + drawitem->rcItem.left += GetSystemMetrics(SM_CXMENUCHECK) + 5;
|
| 793 | + }
|
750 | 794 | combotext[0] = 0;
|
751 | | - SendDlgItemMessage(hWnd, IDC_EXTRAMODES, CB_GETLBTEXT, drawitem->itemID, combotext);
|
752 | | - DrawText(drawitem->hDC, combotext, _tcslen(combotext), &drawitem->rcItem,
|
| 795 | + if (drawitem->itemID != -1 && !(drawitem->itemState & ODS_COMBOBOXEDIT))
|
| 796 | + SendDlgItemMessage(hWnd, IDC_EXTRAMODES, CB_GETLBTEXT, drawitem->itemID, combotext);
|
| 797 | + else
|
| 798 | + {
|
| 799 | + switch (cfg->AddModes)
|
| 800 | + {
|
| 801 | + case 0:
|
| 802 | + _tcscpy(combotext, _T("None"));
|
| 803 | + break;
|
| 804 | + case 1:
|
| 805 | + _tcscpy(combotext, extramodes[0]);
|
| 806 | + break;
|
| 807 | + case 2:
|
| 808 | + _tcscpy(combotext, extramodes[1]);
|
| 809 | + break;
|
| 810 | + case 4:
|
| 811 | + _tcscpy(combotext, extramodes[2]);
|
| 812 | + break;
|
| 813 | + case 8:
|
| 814 | + _tcscpy(combotext, extramodes[3]);
|
| 815 | + break;
|
| 816 | + case 16:
|
| 817 | + _tcscpy(combotext, extramodes[4]);
|
| 818 | + break;
|
| 819 | + case 32:
|
| 820 | + _tcscpy(combotext, extramodes[5]);
|
| 821 | + break;
|
| 822 | + case 64:
|
| 823 | + _tcscpy(combotext, extramodes[6]);
|
| 824 | + break;
|
| 825 | + default:
|
| 826 | + _tcscpy(combotext, _T("Multiple selections"));
|
| 827 | + }
|
| 828 | + }
|
| 829 | + DrawText(drawitem->hDC, combotext, _tcslen(combotext), &drawitem->rcItem,
|
753 | 830 | DT_LEFT | DT_SINGLELINE | DT_VCENTER);
|
754 | 831 | SetTextColor(drawitem->hDC, OldTextColor);
|
755 | 832 | SetBkColor(drawitem->hDC, OldBackColor);
|
756 | | - drawitem->rcItem.left -= GetSystemMetrics(SM_CXMENUCHECK) + 5;
|
| 833 | + if (drawitem->itemID != -1 && !(drawitem->itemState & ODS_COMBOBOXEDIT))
|
| 834 | + drawitem->rcItem.left -= GetSystemMetrics(SM_CXMENUCHECK) + 5;
|
757 | 835 | if (drawitem->itemState & ODS_FOCUS) DrawFocusRect(drawitem->hDC, &drawitem->rcItem);
|
758 | 836 | DefWindowProc(hWnd, Msg, wParam, lParam);
|
759 | 837 | break;
|
— | — | @@ -765,6 +843,36 @@ |
766 | 844 | if (hThemeDisplay) _CloseThemeData(hThemeDisplay);
|
767 | 845 | _OpenThemeData(hWnd, L"Button");
|
768 | 846 | }
|
| 847 | + case WM_COMMAND:
|
| 848 | + {
|
| 849 | + switch (LOWORD(wParam))
|
| 850 | + {
|
| 851 | + case IDC_EXTRAMODES:
|
| 852 | + if (HIWORD(wParam) == CBN_SELENDOK)
|
| 853 | + {
|
| 854 | + if (ExtraModes_Dropdown)
|
| 855 | + {
|
| 856 | + cursel = SendDlgItemMessage(hWnd, IDC_EXTRAMODES, CB_GETCURSEL, 0, 0);
|
| 857 | + i = ((cfg->AddModes >> cursel) & 1);
|
| 858 | + if (i) cfg->AddModes &= ~(1 << cursel);
|
| 859 | + else cfg->AddModes |= 1 << cursel;
|
| 860 | + EnableWindow(GetDlgItem(hDialog, IDC_APPLY), TRUE);
|
| 861 | + *dirty = TRUE;
|
| 862 | + }
|
| 863 | + }
|
| 864 | + if (HIWORD(wParam) == CBN_DROPDOWN)
|
| 865 | + {
|
| 866 | + ExtraModes_Dropdown = TRUE;
|
| 867 | + }
|
| 868 | + if (HIWORD(wParam) == CBN_CLOSEUP)
|
| 869 | + {
|
| 870 | + ExtraModes_Dropdown = FALSE;
|
| 871 | + }
|
| 872 | + /*cfg->ExtraModes = GetCheck(hWnd,IDC_EXTRAMODES,&cfgmask->ExtraModes);
|
| 873 | + */
|
| 874 | + break;
|
| 875 | + }
|
| 876 | + }
|
769 | 877 | default:
|
770 | 878 | return FALSE;
|
771 | 879 | }
|
— | — | @@ -900,6 +1008,7 @@ |
901 | 1009 | switch (Msg)
|
902 | 1010 | {
|
903 | 1011 | case WM_INITDIALOG:
|
| 1012 | + hDialog = hWnd;
|
904 | 1013 | tristate = FALSE;
|
905 | 1014 | maxapps = 128;
|
906 | 1015 | apps = (app_setting *)malloc(maxapps*sizeof(app_setting));
|
— | — | @@ -1226,21 +1335,11 @@ |
1227 | 1336 | SendDlgItemMessage(hTabs[0], IDC_COLORDEPTH, CB_ADDSTRING, i, (LPARAM)buffer);
|
1228 | 1337 | }
|
1229 | 1338 | SendDlgItemMessage(hTabs[0], IDC_COLORDEPTH, CB_SETCURSEL, cfg->AddColorDepths, 0);
|
1230 | | - _tcscpy(buffer, _T("Common low resolutions"));
|
1231 | | - SendDlgItemMessage(hTabs[0], IDC_EXTRAMODES, CB_ADDSTRING, 0, (LPARAM)buffer);
|
1232 | | - _tcscpy(buffer, _T("Uncommon low resolutions"));
|
1233 | | - SendDlgItemMessage(hTabs[0], IDC_EXTRAMODES, CB_ADDSTRING, 1, (LPARAM)buffer);
|
1234 | | - _tcscpy(buffer, _T("Uncommon SD resolutions"));
|
1235 | | - SendDlgItemMessage(hTabs[0], IDC_EXTRAMODES, CB_ADDSTRING, 2, (LPARAM)buffer);
|
1236 | | - _tcscpy(buffer, _T("High Definition resolutions"));
|
1237 | | - SendDlgItemMessage(hTabs[0], IDC_EXTRAMODES, CB_ADDSTRING, 3, (LPARAM)buffer);
|
1238 | | - _tcscpy(buffer, _T("Ultra-HD resolutions"));
|
1239 | | - SendDlgItemMessage(hTabs[0], IDC_EXTRAMODES, CB_ADDSTRING, 4, (LPARAM)buffer);
|
1240 | | - _tcscpy(buffer, _T("Ultra-HD above 4k"));
|
1241 | | - SendDlgItemMessage(hTabs[0], IDC_EXTRAMODES, CB_ADDSTRING, 5, (LPARAM)buffer);
|
1242 | | - _tcscpy(buffer, _T("Very uncommon resolutions"));
|
1243 | | - SendDlgItemMessage(hTabs[0], IDC_EXTRAMODES, CB_ADDSTRING, 6, (LPARAM)buffer);
|
1244 | | - //FIXME: Populate extra resolution combobox
|
| 1339 | + for (i = 0; i < 7; i++)
|
| 1340 | + {
|
| 1341 | + _tcscpy(buffer, extramodes[i]);
|
| 1342 | + SendDlgItemMessage(hTabs[0], IDC_EXTRAMODES, CB_ADDSTRING, i, (LPARAM)buffer);
|
| 1343 | + }
|
1245 | 1344 | // Enable shader
|
1246 | 1345 | if (cfg->colormode) SendDlgItemMessage(hTabs[1], IDC_USESHADER, BM_SETCHECK, BST_CHECKED, 0);
|
1247 | 1346 | else SendDlgItemMessage(hTabs[1], IDC_USESHADER, BM_SETCHECK, BST_UNCHECKED, 0);
|
— | — | @@ -1462,14 +1561,18 @@ |
1463 | 1562 | case IDC_APPS:
|
1464 | 1563 | OldTextColor = GetTextColor(drawitem->hDC);
|
1465 | 1564 | OldBackColor = GetBkColor(drawitem->hDC);
|
1466 | | - if((drawitem->itemAction & ODA_SELECT) && (drawitem->itemState & ODS_SELECTED) &&
|
1467 | | - !(drawitem->itemState & ODS_COMBOBOXEDIT))
|
| 1565 | + if((drawitem->itemState & ODS_SELECTED))
|
1468 | 1566 | {
|
1469 | 1567 | SetTextColor(drawitem->hDC,GetSysColor(COLOR_HIGHLIGHTTEXT));
|
1470 | 1568 | SetBkColor(drawitem->hDC,GetSysColor(COLOR_HIGHLIGHT));
|
1471 | 1569 | FillRect(drawitem->hDC,&drawitem->rcItem,(HBRUSH)(COLOR_HIGHLIGHT+1));
|
1472 | 1570 | }
|
1473 | | - else ExtTextOut(drawitem->hDC,0,0,ETO_OPAQUE,&drawitem->rcItem,NULL,0,NULL);
|
| 1571 | + else
|
| 1572 | + {
|
| 1573 | + SetTextColor(drawitem->hDC, GetSysColor(COLOR_WINDOWTEXT));
|
| 1574 | + SetBkColor(drawitem->hDC, GetSysColor(COLOR_WINDOW));
|
| 1575 | + FillRect(drawitem->hDC, &drawitem->rcItem, (HBRUSH)(COLOR_WINDOW + 1));
|
| 1576 | + }
|
1474 | 1577 | DrawIconEx(drawitem->hDC,drawitem->rcItem.left+2,drawitem->rcItem.top,
|
1475 | 1578 | apps[drawitem->itemID].icon,GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),0,NULL,DI_NORMAL);
|
1476 | 1579 | drawitem->rcItem.left += GetSystemMetrics(SM_CXSMICON)+5;
|
— | — | @@ -1476,6 +1579,8 @@ |
1477 | 1580 | DrawText(drawitem->hDC,apps[drawitem->itemID].name,
|
1478 | 1581 | _tcslen(apps[drawitem->itemID].name),&drawitem->rcItem,
|
1479 | 1582 | DT_LEFT|DT_SINGLELINE|DT_VCENTER);
|
| 1583 | + drawitem->rcItem.left -= GetSystemMetrics(SM_CXSMICON)+5;
|
| 1584 | + if (drawitem->itemState & ODS_FOCUS) DrawFocusRect(drawitem->hDC, &drawitem->rcItem);
|
1480 | 1585 | SetTextColor(drawitem->hDC,OldTextColor);
|
1481 | 1586 | SetBkColor(drawitem->hDC,OldBackColor);
|
1482 | 1587 | DefWindowProc(hWnd,Msg,wParam,lParam);
|
— | — | @@ -1673,11 +1778,6 @@ |
1674 | 1779 | EnableWindow(GetDlgItem(hWnd,IDC_APPLY),TRUE);
|
1675 | 1780 | *dirty = TRUE;
|
1676 | 1781 | break;
|
1677 | | - case IDC_EXTRAMODES:
|
1678 | | - cfg->ExtraModes = GetCheck(hWnd,IDC_EXTRAMODES,&cfgmask->ExtraModes);
|
1679 | | - EnableWindow(GetDlgItem(hWnd,IDC_APPLY),TRUE);
|
1680 | | - *dirty = TRUE;
|
1681 | | - break;
|
1682 | 1782 | case IDC_TEXTUREFORMAT:
|
1683 | 1783 | cfg->TextureFormat = GetCombo(hWnd,IDC_TEXTUREFORMAT,&cfgmask->TextureFormat);
|
1684 | 1784 | EnableWindow(GetDlgItem(hWnd,IDC_APPLY),TRUE);
|