Author: weiden
Date: Thu Sep 27 03:10:41 2007
New Revision: 29225
URL:
http://svn.reactos.org/svn/reactos?rev=29225&view=rev
Log:
Implement the "List all modes" dialog, read-only for now
Modified:
trunk/reactos/dll/win32/shellext/deskadp/deskadp.c
trunk/reactos/dll/win32/shellext/deskadp/deskadp.h
trunk/reactos/dll/win32/shellext/deskadp/lang/en-US.rc
trunk/reactos/dll/win32/shellext/deskadp/precomp.h
trunk/reactos/dll/win32/shellext/deskadp/resource.h
Modified: trunk/reactos/dll/win32/shellext/deskadp/deskadp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shellext/deskadp…
==============================================================================
--- trunk/reactos/dll/win32/shellext/deskadp/deskadp.c (original)
+++ trunk/reactos/dll/win32/shellext/deskadp/deskadp.c Thu Sep 27 03:10:41 2007
@@ -6,6 +6,198 @@
static HINSTANCE hInstance;
typedef INT_PTR (WINAPI *PDEVICEPROPERTIESEXW)(HWND,LPCWSTR,LPCWSTR,DWORD,BOOL);
+
+static VOID
+GetColorDescription(PDEVMODEW lpDevMode,
+ LPTSTR lpBuffer,
+ DWORD dwBufferLen)
+{
+ UINT uid = 0;
+
+ switch (lpDevMode->dmBitsPerPel)
+ {
+ case 4:
+ uid = IDS_4BPP;
+ break;
+ case 8:
+ uid = IDS_8BPP;
+ break;
+ case 15:
+ uid = IDS_15BPP;
+ break;
+ case 16:
+ uid = IDS_16BPP;
+ break;
+ case 24:
+ uid = IDS_24BPP;
+ break;
+ case 32:
+ uid = IDS_32BPP;
+ break;
+ }
+
+ if (uid == 0 ||
+ !LoadString(hInstance,
+ uid,
+ lpBuffer,
+ dwBufferLen))
+ {
+ lpBuffer[0] = TEXT('\0');
+ }
+}
+
+static VOID
+GetRefreshRateDescription(PDEVMODEW lpDevMode,
+ LPTSTR lpBuffer,
+ DWORD dwBufferLen)
+{
+ TCHAR szFormat[64];
+
+ if (lpDevMode->dmDisplayFrequency <= 1)
+ {
+ if (!LoadString(hInstance,
+ IDS_DEFREFRESHRATE,
+ lpBuffer,
+ dwBufferLen))
+ {
+ lpBuffer[0] = TEXT('\0');
+ }
+ }
+ else
+ {
+ if (!LoadString(hInstance,
+ IDES_REFRESHRATEFMT,
+ szFormat,
+ sizeof(szFormat) / sizeof(szFormat[0])))
+ {
+ szFormat[0] = TEXT('\0');
+ }
+
+ _sntprintf(lpBuffer,
+ dwBufferLen,
+ szFormat,
+ lpDevMode->dmDisplayFrequency);
+ }
+}
+
+static VOID
+InitListAllModesDialog(PDESKDISPLAYADAPTER This,
+ HWND hwndListAllModesDlg)
+{
+ TCHAR szFormat[64], szBuffer[64], szColors[64], szRefreshRate[64];
+ PDEVMODEW lpDevMode;
+ DWORD dwIndex = 0;
+ INT i;
+
+ if (This->DeskExtInterface != NULL)
+ {
+ if (!LoadString(hInstance,
+ IDS_MODEFMT,
+ szFormat,
+ sizeof(szFormat) / sizeof(szFormat[0])))
+ {
+ szFormat[0] = TEXT('\0');
+ }
+
+ do
+ {
+ lpDevMode =
This->DeskExtInterface->EnumAllModes(This->DeskExtInterface->Context,
+ dwIndex++);
+ if (lpDevMode != NULL)
+ {
+ GetColorDescription(lpDevMode,
+ szColors,
+ sizeof(szColors) / sizeof(szColors[0]));
+
+ GetRefreshRateDescription(lpDevMode,
+ szRefreshRate,
+ sizeof(szRefreshRate) /
sizeof(szRefreshRate[0]));
+
+ _sntprintf(szBuffer,
+ sizeof(szBuffer) / sizeof(szBuffer[0]),
+ szFormat,
+ lpDevMode->dmPelsWidth,
+ lpDevMode->dmPelsHeight,
+ szColors,
+ szRefreshRate);
+
+ i = (INT)SendDlgItemMessage(hwndListAllModesDlg,
+ IDC_ALLVALIDMODES,
+ LB_ADDSTRING,
+ 0,
+ (LPARAM)szBuffer);
+ if (i >= 0)
+ {
+ SendDlgItemMessage(hwndListAllModesDlg,
+ IDC_ALLVALIDMODES.
+ LB_SETITEMDATA,
+ (WPARAM)i,
+ (LPARAM)lpDevMode);
+ }
+ }
+
+ } while (lpDevMode != NULL);
+ }
+}
+
+static INT_PTR CALLBACK
+ListAllModesDlgProc(HWND hwndDlg,
+ UINT uMsg,
+ WPARAM wParam,
+ LPARAM lParam)
+{
+ PDESKDISPLAYADAPTER This;
+ INT_PTR Ret = 0;
+
+ if (uMsg != WM_INITDIALOG)
+ {
+ This = (PDESKDISPLAYADAPTER)GetWindowLongPtr(hwndDlg,
+ DWL_USER);
+ }
+
+ switch (uMsg)
+ {
+ case WM_INITDIALOG:
+ This = (PDESKDISPLAYADAPTER)lParam;
+ SetWindowLongPtr(hwndDlg,
+ DWL_USER,
+ (LONG_PTR)This);
+
+ InitListAllModesDialog(This,
+ hwndDlg);
+ Ret = TRUE;
+ break;
+
+ case WM_COMMAND:
+ switch (LOWORD(wParam))
+ {
+ case IDOK:
+ break;
+ case IDCANCEL:
+ EndDialog(hwndDlg,
+ IDCANCEL);
+ break;
+ }
+ break;
+
+ case WM_CLOSE:
+ EndDialog(hwndDlg,
+ IDCANCEL);
+ break;
+ }
+
+ return Ret;
+}
+
+static VOID
+ShowListAllModes(PDESKDISPLAYADAPTER This)
+{
+ DialogBoxParam(hInstance,
+ MAKEINTRESOURCE(IDD_LISTALLMODES),
+ This->hwndDlg,
+ ListAllModesDlgProc,
+ (LPARAM)This);
+}
static VOID
ShowAdapterProperties(PDESKDISPLAYADAPTER This)
@@ -106,6 +298,11 @@
case IDC_ADAPTERPROPERTIES:
ShowAdapterProperties(This);
break;
+
+ case IDC_LISTALLMODES:
+ MessageBox(hwndDlg, _T("Bla"), NULL, 0);
+ ShowListAllModes(This);
+ break;
}
break;
Modified: trunk/reactos/dll/win32/shellext/deskadp/deskadp.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shellext/deskadp…
==============================================================================
--- trunk/reactos/dll/win32/shellext/deskadp/deskadp.h (original)
+++ trunk/reactos/dll/win32/shellext/deskadp/deskadp.h Thu Sep 27 03:10:41 2007
@@ -54,7 +54,7 @@
LPFNADDPROPSHEETPAGE pfnReplacePage,
LPARAM lParam);
-static const GUID CLSID_IDeskDisplayAdapter =
{0x42071712,0x76d4,0x11d1,{0x8b,0x24,0x00,0xa0,0xc9,0x06,0x8f,0xf3}};
+static const GUID CLSID_IDeskDisplayAdapter =
{0x42071712,0x76d4,0x11d1,{0x8b,0x24,0x00,0xa0,0xc9,0x06,0x8f,0xf9}};
ULONG __cdecl DbgPrint(PCCH Format,...);
Modified: trunk/reactos/dll/win32/shellext/deskadp/lang/en-US.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shellext/deskadp…
==============================================================================
--- trunk/reactos/dll/win32/shellext/deskadp/lang/en-US.rc (original)
+++ trunk/reactos/dll/win32/shellext/deskadp/lang/en-US.rc Thu Sep 27 03:10:41 2007
@@ -19,5 +19,30 @@
LTEXT "", IDC_ADAPTERSTRING, 71, 104, 160, 8
LTEXT "BIOS Information:", -1, 13, 116, 58, 8
LTEXT "", IDC_BIOSINFORMATION, 71, 116, 160, 8
+ PUSHBUTTON "&List All Modes...", IDC_LISTALLMODES, 7, 139, 75, 14
END
+IDD_LISTALLMODES DIALOGEX 0, 0, 225, 135
+STYLE DS_SETFONT | DS_FIXEDSYS | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE |
WS_DLGFRAME
+CAPTION "List All Modes"
+FONT 8, "MS Shell Dlg", 0, 0, 0x0
+BEGIN
+ DEFPUSHBUTTON "OK", IDOK, 112, 115, 50, 15, WS_DISABLED
+ PUSHBUTTON "Cancel", IDCANCEL, 167, 115, 50, 15
+ GROUPBOX "List of valid modes", -1, 6, 7, 212, 98
+ LISTBOX IDC_ALLVALIDMODES, 10, 20, 204, 87, LBS_NOTIFY | WS_VSCROLL
+END
+
+STRINGTABLE
+BEGIN
+ IDS_MODEFMT "%d by %d, %s, %s"
+ IDS_DEFREFRESHRATE "Default Refresh"
+ IDES_REFRESHRATEFMT "%d Hertz"
+ IDS_4BPP "16 Colors"
+ IDS_8BPP "256 Colors"
+ IDS_15BPP "High Color (15 bit)"
+ IDS_16BPP "High Color (16 bit)"
+ IDS_24BPP "True Color (24 bit)"
+ IDS_32BPP "True Color (32 bit)"
+END
+
Modified: trunk/reactos/dll/win32/shellext/deskadp/precomp.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shellext/deskadp…
==============================================================================
--- trunk/reactos/dll/win32/shellext/deskadp/precomp.h (original)
+++ trunk/reactos/dll/win32/shellext/deskadp/precomp.h Thu Sep 27 03:10:41 2007
@@ -4,6 +4,7 @@
#define COBJMACROS
#include <windows.h>
#include <tchar.h>
+#include <stdio.h>
#include <shlobj.h>
#include <dll/desk/deskcplx.h>
#include "deskadp.h"
Modified: trunk/reactos/dll/win32/shellext/deskadp/resource.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shellext/deskadp…
==============================================================================
--- trunk/reactos/dll/win32/shellext/deskadp/resource.h (original)
+++ trunk/reactos/dll/win32/shellext/deskadp/resource.h Thu Sep 27 03:10:41 2007
@@ -2,6 +2,7 @@
#define __RESOURCE__H
#define IDD_DISPLAYADAPTER 100
+#define IDD_LISTALLMODES 101
#define IDC_ADAPTERNAME 201
#define IDC_ADAPTERPROPERTIES 202
@@ -10,5 +11,18 @@
#define IDC_MEMORYSIZE 205
#define IDC_ADAPTERSTRING 206
#define IDC_BIOSINFORMATION 207
+#define IDC_LISTALLMODES 208
+
+#define IDC_ALLVALIDMODES 301
+
+#define IDS_MODEFMT 101
+#define IDS_DEFREFRESHRATE 102
+#define IDES_REFRESHRATEFMT 103
+#define IDS_4BPP 104
+#define IDS_8BPP 105
+#define IDS_15BPP 106
+#define IDS_16BPP 107
+#define IDS_24BPP 108
+#define IDS_32BPP 109
#endif /* __RESOURCE__H */