mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 21:23:05 +00:00
- Add new spectrum bitmaps for 4bpp, 8bpp and 16-32bpp. The 8bpp one can probably be done better, but at least it's suitable ;-)
As we use StretchBlt in the code, the bitmaps are very small, so they are stretched to the full size at runtime. - Change the current spectrum bitmap, when the user selects another color depth - Enable support for 4bpp color depth - Fix a bug in "monslctl.c", which broke building under MSVC svn path=/trunk/; revision=30475
This commit is contained in:
parent
6fa082e5c1
commit
b5e7df42cc
9 changed files with 75 additions and 34 deletions
|
@ -49,6 +49,7 @@ INT AllocAndLoadString(LPTSTR *lpTarget,
|
||||||
ULONG __cdecl DbgPrint(PCCH Format,...);
|
ULONG __cdecl DbgPrint(PCCH Format,...);
|
||||||
|
|
||||||
#define MAX_DESK_PAGES 32
|
#define MAX_DESK_PAGES 32
|
||||||
|
#define NUM_SPECTRUM_BITMAPS 3
|
||||||
|
|
||||||
/* As slider control can't contain user data, we have to keep an
|
/* As slider control can't contain user data, we have to keep an
|
||||||
* array of RESOLUTION_INFO to have our own associated data.
|
* array of RESOLUTION_INFO to have our own associated data.
|
||||||
|
|
|
@ -15,6 +15,9 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
|
||||||
IDC_DESK_ICON ICON "resources/applet.ico"
|
IDC_DESK_ICON ICON "resources/applet.ico"
|
||||||
IDC_DESK_ICON2 ICON "resources/applet.ico"
|
IDC_DESK_ICON2 ICON "resources/applet.ico"
|
||||||
IDC_MONITOR BITMAP "resources/monitor.bmp"
|
IDC_MONITOR BITMAP "resources/monitor.bmp"
|
||||||
IDB_SPECTRUM BITMAP "resources/spectrum.bmp"
|
|
||||||
|
IDB_SPECTRUM_4 BITMAP "resources/spectrum_4.bmp"
|
||||||
|
IDB_SPECTRUM_8 BITMAP "resources/spectrum_8.bmp"
|
||||||
|
IDB_SPECTRUM_16 BITMAP "resources/spectrum_16.bmp"
|
||||||
|
|
||||||
#include "rsrc.rc"
|
#include "rsrc.rc"
|
||||||
|
|
|
@ -895,7 +895,7 @@ MonSelPaint(IN OUT PMONITORSELWND infoPtr,
|
||||||
|
|
||||||
/* Paint the dragging monitor last */
|
/* Paint the dragging monitor last */
|
||||||
if (infoPtr->IsDraggingMonitor &&
|
if (infoPtr->IsDraggingMonitor &&
|
||||||
(DWORD)infoPtr->DraggingMonitor >= 0)
|
infoPtr->DraggingMonitor >= 0)
|
||||||
{
|
{
|
||||||
MonSelRectToScreen(infoPtr,
|
MonSelRectToScreen(infoPtr,
|
||||||
&infoPtr->rcDragging,
|
&infoPtr->rcDragging,
|
||||||
|
|
|
@ -66,7 +66,10 @@
|
||||||
#define IDC_SETTINGS_ADVANCED 205
|
#define IDC_SETTINGS_ADVANCED 205
|
||||||
#define IDC_SETTINGS_MONSEL 206
|
#define IDC_SETTINGS_MONSEL 206
|
||||||
#define IDC_SETTINGS_SPECTRUM 207
|
#define IDC_SETTINGS_SPECTRUM 207
|
||||||
#define IDB_SPECTRUM 208
|
|
||||||
|
#define IDB_SPECTRUM_4 208
|
||||||
|
#define IDB_SPECTRUM_8 209
|
||||||
|
#define IDB_SPECTRUM_16 210
|
||||||
|
|
||||||
#define IDR_PREVIEW_MENU 2100
|
#define IDR_PREVIEW_MENU 2100
|
||||||
#define ID_MENU_NORMAL 2101
|
#define ID_MENU_NORMAL 2101
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 6.4 KiB |
BIN
reactos/dll/cpl/desk/resources/spectrum_16.bmp
Normal file
BIN
reactos/dll/cpl/desk/resources/spectrum_16.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
BIN
reactos/dll/cpl/desk/resources/spectrum_4.bmp
Normal file
BIN
reactos/dll/cpl/desk/resources/spectrum_4.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 126 B |
BIN
reactos/dll/cpl/desk/resources/spectrum_8.bmp
Normal file
BIN
reactos/dll/cpl/desk/resources/spectrum_8.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 438 B |
|
@ -15,9 +15,9 @@ typedef struct _GLOBAL_DATA
|
||||||
{
|
{
|
||||||
PDISPLAY_DEVICE_ENTRY DisplayDeviceList;
|
PDISPLAY_DEVICE_ENTRY DisplayDeviceList;
|
||||||
PDISPLAY_DEVICE_ENTRY CurrentDisplayDevice;
|
PDISPLAY_DEVICE_ENTRY CurrentDisplayDevice;
|
||||||
HBITMAP hBitmap;
|
HBITMAP hSpectrumBitmaps[NUM_SPECTRUM_BITMAPS];
|
||||||
int cxSource;
|
int cxSource[NUM_SPECTRUM_BITMAPS];
|
||||||
int cySource;
|
int cySource[NUM_SPECTRUM_BITMAPS];
|
||||||
} GLOBAL_DATA, *PGLOBAL_DATA;
|
} GLOBAL_DATA, *PGLOBAL_DATA;
|
||||||
|
|
||||||
|
|
||||||
|
@ -80,7 +80,8 @@ GetPossibleSettings(IN LPCTSTR DeviceName, OUT DWORD* pSettingsCount, OUT PSETTI
|
||||||
|
|
||||||
while (EnumDisplaySettingsEx(DeviceName, iMode, &devmode, dwFlags))
|
while (EnumDisplaySettingsEx(DeviceName, iMode, &devmode, dwFlags))
|
||||||
{
|
{
|
||||||
if ((devmode.dmBitsPerPel==8 ||
|
if ((devmode.dmBitsPerPel==4 ||
|
||||||
|
devmode.dmBitsPerPel==8 ||
|
||||||
devmode.dmBitsPerPel==16 ||
|
devmode.dmBitsPerPel==16 ||
|
||||||
devmode.dmBitsPerPel==24 ||
|
devmode.dmBitsPerPel==24 ||
|
||||||
devmode.dmBitsPerPel==32) &&
|
devmode.dmBitsPerPel==32) &&
|
||||||
|
@ -285,6 +286,7 @@ OnInitDialog(IN HWND hwndDlg)
|
||||||
BITMAP bitmap;
|
BITMAP bitmap;
|
||||||
DWORD Result = 0;
|
DWORD Result = 0;
|
||||||
DWORD iDevNum = 0;
|
DWORD iDevNum = 0;
|
||||||
|
INT i;
|
||||||
DISPLAY_DEVICE displayDevice;
|
DISPLAY_DEVICE displayDevice;
|
||||||
PGLOBAL_DATA pGlobalData;
|
PGLOBAL_DATA pGlobalData;
|
||||||
|
|
||||||
|
@ -362,14 +364,44 @@ OnInitDialog(IN HWND hwndDlg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* init the color spectrum*/
|
/* Initialize the color spectrum bitmaps */
|
||||||
pGlobalData->hBitmap = LoadImageW(hApplet, MAKEINTRESOURCEW(IDB_SPECTRUM), IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR);
|
for(i = 0; i < NUM_SPECTRUM_BITMAPS; i++)
|
||||||
if (pGlobalData->hBitmap != NULL)
|
|
||||||
{
|
{
|
||||||
GetObjectW(pGlobalData->hBitmap, sizeof(BITMAP), &bitmap);
|
pGlobalData->hSpectrumBitmaps[i] = LoadImageW(hApplet, MAKEINTRESOURCEW(IDB_SPECTRUM_4 + i), IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR);
|
||||||
|
|
||||||
pGlobalData->cxSource = bitmap.bmWidth;
|
if (pGlobalData->hSpectrumBitmaps[i] != NULL)
|
||||||
pGlobalData->cySource = bitmap.bmHeight;
|
{
|
||||||
|
GetObjectW(pGlobalData->hSpectrumBitmaps[i], sizeof(BITMAP), &bitmap);
|
||||||
|
|
||||||
|
pGlobalData->cxSource[i] = bitmap.bmWidth;
|
||||||
|
pGlobalData->cySource[i] = bitmap.bmHeight;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get the ID for GLOBAL_DATA::hSpectrumBitmaps */
|
||||||
|
static VOID
|
||||||
|
ShowColorSpectrum(IN HDC hDC, IN LPRECT client, IN DWORD BitsPerPel, IN PGLOBAL_DATA pGlobalData)
|
||||||
|
{
|
||||||
|
HDC hdcMem;
|
||||||
|
hdcMem = CreateCompatibleDC(hDC);
|
||||||
|
|
||||||
|
if (hdcMem)
|
||||||
|
{
|
||||||
|
INT iBitmap;
|
||||||
|
|
||||||
|
switch(BitsPerPel)
|
||||||
|
{
|
||||||
|
case 4: iBitmap = 0; break;
|
||||||
|
case 8: iBitmap = 1; break;
|
||||||
|
default: iBitmap = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
SelectObject(hdcMem, pGlobalData->hSpectrumBitmaps[iBitmap]);
|
||||||
|
StretchBlt(hDC, client->left, client->top, client->right - client->left,
|
||||||
|
client->bottom - client->top, hdcMem, 0, 0,
|
||||||
|
pGlobalData->cxSource[iBitmap], pGlobalData->cySource[iBitmap], SRCCOPY);
|
||||||
|
DeleteDC(hdcMem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -383,12 +415,19 @@ OnBPPChanged(IN HWND hwndDlg, IN PGLOBAL_DATA pGlobalData)
|
||||||
PSETTINGS_ENTRY Current;
|
PSETTINGS_ENTRY Current;
|
||||||
DWORD dmNewBitsPerPel;
|
DWORD dmNewBitsPerPel;
|
||||||
DWORD index;
|
DWORD index;
|
||||||
TCHAR Buffer[64];
|
HDC hSpectrumDC;
|
||||||
|
HWND hSpectrumControl;
|
||||||
|
RECT client;
|
||||||
|
|
||||||
SendDlgItemMessage(hwndDlg, IDC_SETTINGS_BPP, WM_GETTEXT, (WPARAM)(sizeof(Buffer) / sizeof(TCHAR)), (LPARAM)Buffer);
|
index = (DWORD) SendDlgItemMessage(hwndDlg, IDC_SETTINGS_BPP, CB_GETCURSEL, 0, 0);
|
||||||
index = (DWORD) SendDlgItemMessage(hwndDlg, IDC_SETTINGS_BPP, CB_FINDSTRINGEXACT, (WPARAM)-1, (LPARAM)Buffer);
|
|
||||||
dmNewBitsPerPel = (DWORD) SendDlgItemMessage(hwndDlg, IDC_SETTINGS_BPP, CB_GETITEMDATA, index, 0);
|
dmNewBitsPerPel = (DWORD) SendDlgItemMessage(hwndDlg, IDC_SETTINGS_BPP, CB_GETITEMDATA, index, 0);
|
||||||
|
|
||||||
|
/* Show a new spectrum bitmap */
|
||||||
|
hSpectrumControl = GetDlgItem(hwndDlg, IDC_SETTINGS_SPECTRUM);
|
||||||
|
hSpectrumDC = GetDC(hSpectrumControl);
|
||||||
|
GetClientRect(hSpectrumControl, &client);
|
||||||
|
ShowColorSpectrum(hSpectrumDC, &client, dmNewBitsPerPel, pGlobalData);
|
||||||
|
|
||||||
/* find if new parameters are valid */
|
/* find if new parameters are valid */
|
||||||
Current = pGlobalData->CurrentDisplayDevice->CurrentSettings;
|
Current = pGlobalData->CurrentDisplayDevice->CurrentSettings;
|
||||||
if (dmNewBitsPerPel == Current->dmBitsPerPel)
|
if (dmNewBitsPerPel == Current->dmBitsPerPel)
|
||||||
|
@ -585,20 +624,10 @@ SettingsPageProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lPar
|
||||||
{
|
{
|
||||||
LPDRAWITEMSTRUCT lpDrawItem;
|
LPDRAWITEMSTRUCT lpDrawItem;
|
||||||
lpDrawItem = (LPDRAWITEMSTRUCT) lParam;
|
lpDrawItem = (LPDRAWITEMSTRUCT) lParam;
|
||||||
|
|
||||||
if(lpDrawItem->CtlID == IDC_SETTINGS_SPECTRUM)
|
if(lpDrawItem->CtlID == IDC_SETTINGS_SPECTRUM)
|
||||||
{
|
ShowColorSpectrum(lpDrawItem->hDC, &lpDrawItem->rcItem, pGlobalData->CurrentDisplayDevice->CurrentSettings->dmBitsPerPel, pGlobalData);
|
||||||
HDC hdcMem;
|
|
||||||
hdcMem = CreateCompatibleDC(lpDrawItem->hDC);
|
|
||||||
if (hdcMem != NULL)
|
|
||||||
{
|
|
||||||
SelectObject(hdcMem, pGlobalData->hBitmap);
|
|
||||||
StretchBlt(lpDrawItem->hDC, lpDrawItem->rcItem.left, lpDrawItem->rcItem.top,
|
|
||||||
lpDrawItem->rcItem.right - lpDrawItem->rcItem.left,
|
|
||||||
lpDrawItem->rcItem.bottom - lpDrawItem->rcItem.top,
|
|
||||||
hdcMem, 0, 0, pGlobalData->cxSource, pGlobalData->cySource, SRCCOPY);
|
|
||||||
DeleteDC(hdcMem);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
|
@ -784,6 +813,8 @@ SettingsPageProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lPar
|
||||||
|
|
||||||
case WM_DESTROY:
|
case WM_DESTROY:
|
||||||
{
|
{
|
||||||
|
INT i;
|
||||||
|
|
||||||
PDISPLAY_DEVICE_ENTRY Current = pGlobalData->DisplayDeviceList;
|
PDISPLAY_DEVICE_ENTRY Current = pGlobalData->DisplayDeviceList;
|
||||||
while (Current != NULL)
|
while (Current != NULL)
|
||||||
{
|
{
|
||||||
|
@ -801,8 +832,11 @@ SettingsPageProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lPar
|
||||||
|
|
||||||
HeapFree(GetProcessHeap(), 0, pGlobalData);
|
HeapFree(GetProcessHeap(), 0, pGlobalData);
|
||||||
|
|
||||||
if (pGlobalData->hBitmap)
|
for(i = 0; i < NUM_SPECTRUM_BITMAPS; i++)
|
||||||
DeleteObject(pGlobalData->hBitmap);
|
{
|
||||||
|
if(pGlobalData->hSpectrumBitmaps[i])
|
||||||
|
DeleteObject(pGlobalData->hSpectrumBitmaps[i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue