#define IDS_EXPANSION 22
#define IDS_EXPANSION2 23
#define IDS_BOARD 24
+#define IDC_PANELTREE 50
+#define IDD_PANEL 51
+#define IDC_PANEL_FRAME 52
+#define IDC_PANEL_FRAME_OUTER 53
+#define IDC_RESETAMIGA 54
+#define IDC_QUITEMU 55
+#define IDC_RESTARTEMU 56
+#define IDC_ERRORLOG 57
#define IDS_EXTTEXT 100
#define IDS_EXTACTUAL 101
#define IDS_SOUND 102
#define IDI_DISK 182
#define IDR_DRIVE_SPINND_A500_1 182
#define IDS_YES 182
-#define IDD_PANEL 183
#define IDS_NO 183
#define IDD_PATHS 184
#define IDS_PRI_ABOVENORMAL 184
#define IDC_SOCKETS 1503
#define IDC_HF_DOSTYPE 1503
#define IDC_HDF_CONTROLLER 1504
-#define IDC_RESETAMIGA 1504
-#define IDC_QUITEMU 1505
#define IDC_HDF_CONTROLLER_UNIT 1505
#define IDC_HDF_CONTROLLER_TYPE 1506
#define IDC_MAPDRIVES 1507
#define IDC_HDF_FEATURE_LEVEL 1507
#define IDC_CPUTEXT 1508
#define IDC_MAPDRIVES_NET 1508
-#define IDC_RESTARTEMU 1508
#define IDC_CACHETEXT 1509
#define IDC_SWAP 1509
#define IDC_MAPDRIVES_CD 1509
-#define IDC_ERRORLOG 1509
#define IDC_SELECTRESTEXT 1510
#define IDC_FLUSHPRINTER 1510
#define IDC_MAPDRIVES_REMOVABLE 1510
#define IDC_AVIOUTPUT_FRAMELIMITER 1645
#define IDC_STATEREC_RATE 1646
#define IDC_SOUNDDRIVESELECT 1647
-#define IDC_PANELTREE 1647
#define IDC_AVIOUTPUT_NOSOUNDOUTPUT 1647
#define IDC_STATE_BUFFERSIZE_TEXT 1648
#define IDC_CONFIGTREE 1648
#define IDC_SOUNDFREQ 1652
#define IDC_STATEREC_AUTOPLAY 1652
#define IDC_SOUNDFREQTXT 1653
-#define IDC_PANEL_FRAME 1653
#define IDC_SCREENSHOT_ORIGINALSIZE2 1653
#define IDC_SCREENSHOT_CLIP 1653
#define IDC_SOUNDFILTERTXT 1654
-#define IDC_PANEL_FRAME_OUTER 1654
#define IDC_SOUNDSTEREO 1655
#define IDC_CONFIGTYPE 1655
#define IDC_SOUNDDRIVETXT 1656
#define IDC_ROM_ADDRESS 1862
#define IDC_ROM_ADDRESS2 1863
#define IDC_CUSTOMROMFILE 1864
+#define IDC_SCSIROMFILEPCMCIA 1865
#define ID__FLOPPYDRIVES 40004
#define ID_FLOPPYDRIVES_DF0 40005
#define ID_ST_CONFIGURATION 40010
#define ID_ST_CDEJECTALL 40047
#define ID_CDDRIVES_CD 40048
#define ID_ST_CD0 40049
-#define IDC_STATIC -1
// Next default values for new objects
//
#define _APS_3D_CONTROLS 1
#define _APS_NEXT_RESOURCE_VALUE 407
#define _APS_NEXT_COMMAND_VALUE 40050
-#define _APS_NEXT_CONTROL_VALUE 1864
+#define _APS_NEXT_CONTROL_VALUE 1865
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings xmlns:ws2="http://schemas.microsoft.com/SMI/2016/WindowsSettings">
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">True/PM</dpiAware>
- <ws2:dpiAwareness>PerMonitorV2, PerMonitor</ws2:dpiAwareness>
+ <ws2:dpiAwareness>PerMonitorV2</ws2:dpiAwareness>
<ws2:longPathAware>true</ws2:longPathAware>
</windowsSettings>
</application>
PUSHBUTTON "Cancel",IDCANCEL,427,328,47,14
PUSHBUTTON "Help",IDHELP,479,328,47,14,WS_DISABLED
GROUPBOX "",IDC_PANEL_FRAME_OUTER,116,2,409,324
- GROUPBOX "",IDC_PANEL_FRAME,119,5,402,318,NOT WS_VISIBLE
+ GROUPBOX "",IDC_PANEL_FRAME,119,5,402,318
CONTROL "",IDC_PANELTREE,"SysTreeView32",TVS_HASLINES | TVS_SHOWSELALWAYS | TVS_TRACKSELECT | TVS_NOHSCROLL | WS_BORDER | WS_TABSTOP,3,5,110,321,WS_EX_CLIENTEDGE
END
RTEXT "Controller ID:",IDC_STATIC,241,23,110,15,SS_CENTERIMAGE
COMBOBOX IDC_SCSIROMID,356,24,29,75,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "...",IDC_SCSIROMCHOOSER,376,42,10,15
- CONTROL "Autoboot disabled",IDC_SCSIROMFILEAUTOBOOT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,202,62,99,12
+ CONTROL "Autoboot disabled",IDC_SCSIROMFILEAUTOBOOT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,202,62,94,12
CONTROL "",IDC_EXPANSIONBOARDCHECKBOX,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,202,76,99,12
EDITTEXT IDC_EXPANSIONBOARDSTRINGBOX,202,76,172,14,ES_AUTOHSCROLL
COMBOBOX IDC_EXPANSIONBOARDSELECTOR,202,76,171,75,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,193,207,187,11
CONTROL "CD32 Full Motion Video cartridge",IDC_CS_CD32FMV,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,193,223,193,11
CONTROL "Enabled",IDC_SCSIROMSELECTED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,202,43,99,12
+ CONTROL "PCMCIA inserted",IDC_SCSIROMFILEPCMCIA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,301,62,84,12
END
IDD_CHSQUERY DIALOGEX 0, 0, 396, 85
//
VS_VERSION_INFO VERSIONINFO
- FILEVERSION 4,2,1,0
- PRODUCTVERSION 4,2,1,0
+ FILEVERSION 4,2,2,0
+ PRODUCTVERSION 4,2,2,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
BLOCK "040904b0"
BEGIN
VALUE "FileDescription", "WinUAE"
- VALUE "FileVersion", "4.2.1.0"
+ VALUE "FileVersion", "4.2.2.0"
VALUE "InternalName", "WinUAE"
VALUE "LegalCopyright", "© 1996-2019 under the GNU Public License (GPL)"
VALUE "OriginalFilename", "WinUAE.exe"
VALUE "ProductName", "WinUAE"
- VALUE "ProductVersion", "4.2.1.0"
+ VALUE "ProductVersion", "4.2.2.0"
END
END
BLOCK "VarFileInfo"
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings xmlns:ws2="http://schemas.microsoft.com/SMI/2016/WindowsSettings">
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">True/PM</dpiAware>
- <ws2:dpiAwareness>PerMonitorV2, PerMonitor</ws2:dpiAwareness>
+ <ws2:dpiAwareness>PerMonitorV2</ws2:dpiAwareness>
<ws2:longPathAware>true</ws2:longPathAware>
</windowsSettings>
</application>
HKEY hWinUAEKey = NULL;
COLORREF g_dwBackgroundColor;
+HMODULE userdll;
+HMODULE kerneldll;
int pause_emulation;
case WM_DRAWCLIPBOARD:
if (clipboard_initialized) {
clipboard_changed(hWnd);
- SendMessage(hwndNextViewer, message, wParam, lParam);
+ if (hwndNextViewer)
+ SendMessage(hwndNextViewer, message, wParam, lParam);
return 0;
}
break;
case WM_QUERYENDSESSION:
case WM_ENDSESSION:
return AmigaWindowProc (hWnd, message, wParam, lParam);
-#if 0
+
+ case WM_DWMCOMPOSITIONCHANGED:
+ case WM_THEMECHANGED:
case WM_DISPLAYCHANGE:
- if (isfullscreen() <= 0 && !currprefs.gfx_filter && (wParam + 7) / 8 != DirectDraw_GetBytesPerPixel ())
- WIN32GFX_DisplayChangeRequested ();
- break;
-#endif
- case WM_DWMCOMPOSITIONCHANGED:
- case WM_THEMECHANGED:
WIN32GFX_DisplayChangeRequested (-1);
return 0;
- case WM_POWERBROADCAST:
+ case WM_POWERBROADCAST:
if (wParam == PBT_APMRESUMEAUTOMATIC) {
setsystime ();
return TRUE;
}
return 0;
+ case WM_DPICHANGED:
+ {
+ if (isfullscreen() == 0) {
+ RECT* const r = (RECT*)lParam;
+ SetWindowPos(hWnd, NULL, r->left, r->top, r->right - r->left, r->bottom - r->top, SWP_NOZORDER | SWP_NOACTIVATE);
+ return 0;
+ }
+ }
+
case WM_GETMINMAXINFO:
{
LPMINMAXINFO lpmmi;
#ifdef _WIN64
wow64 = 1;
#else
- fnIsWow64Process = (LPFN_ISWOW64PROCESS)GetProcAddress (GetModuleHandle (_T("kernel32")), "IsWow64Process");
+ fnIsWow64Process = (LPFN_ISWOW64PROCESS)GetProcAddress(kerneldll, "IsWow64Process");
if (fnIsWow64Process)
fnIsWow64Process (GetCurrentProcess (), &wow64);
#endif
int os_admin, os_64bit, os_win7, os_win8, os_win10, os_vista, cpu_number, os_touch;
BOOL os_dwm_enabled;
+BOOL dpi_aware_v2;
static int isadminpriv (void)
{
PGETNATIVESYSTEMINFO pGetNativeSystemInfo;
PISUSERANADMIN pIsUserAnAdmin;
- pGetNativeSystemInfo = (PGETNATIVESYSTEMINFO)GetProcAddress (
- GetModuleHandle (_T("kernel32.dll")), "GetNativeSystemInfo");
- pIsUserAnAdmin = (PISUSERANADMIN)GetProcAddress (
- GetModuleHandle (_T("shell32.dll")), "IsUserAnAdmin");
+ pGetNativeSystemInfo = (PGETNATIVESYSTEMINFO)GetProcAddress(kerneldll, "GetNativeSystemInfo");
+ pIsUserAnAdmin = (PISUSERANADMIN)GetProcAddress(
+ GetModuleHandle(_T("shell32.dll")), "IsUserAnAdmin");
GetSystemInfo (&SystemInfo);
if (pGetNativeSystemInfo)
if (!os_touch)
return;
- pRegisterTouchWindow = (REGISTERTOUCHWINDOW)GetProcAddress(
- GetModuleHandle (_T("user32.dll")), "RegisterTouchWindow");
- pGetTouchInputInfo = (GETTOUCHINPUTINFO)GetProcAddress(
- GetModuleHandle (_T("user32.dll")), "GetTouchInputInfo");
- pCloseTouchInputHandle = (CLOSETOUCHINPUTHANDLE)GetProcAddress(
- GetModuleHandle (_T("user32.dll")), "CloseTouchInputHandle");
+ pRegisterTouchWindow = (REGISTERTOUCHWINDOW)GetProcAddress(userdll, "RegisterTouchWindow");
+ pGetTouchInputInfo = (GETTOUCHINPUTINFO)GetProcAddress(userdll, "GetTouchInputInfo");
+ pCloseTouchInputHandle = (CLOSETOUCHINPUTHANDLE)GetProcAddress(userdll, "CloseTouchInputHandle");
if (!pRegisterTouchWindow || !pGetTouchInputInfo || !pCloseTouchInputHandle)
return;
if (!pRegisterTouchWindow(hwnd, 0)) {
}
typedef BOOL (CALLBACK* CHANGEWINDOWMESSAGEFILTER)(UINT, DWORD);
+typedef DPI_AWARENESS_CONTEXT (CALLBACK* GETTHREADDPIAWARENESSCONTEXT)(void);
+typedef DPI_AWARENESS (CALLBACK* GETAWARENESSFROMDPIAWARENESSCONTEXT)(DPI_AWARENESS_CONTEXT);
#ifndef NDEBUG
typedef BOOL(WINAPI* SETPROCESSMITIGATIONPOLICY)(DWORD, PVOID, SIZE_T);
#endif
#endif
+ userdll = GetModuleHandle(_T("user32.dll"));
+ kerneldll = GetModuleHandle(_T("kernel32.dll"));
+ if (!userdll || !kerneldll)
+ return 0;
+
#ifndef NDEBUG
PROCESS_MITIGATION_STRICT_HANDLE_CHECK_POLICY p = { 0 };
p.HandleExceptionsPermanentlyEnabled = 1;
p.RaiseExceptionOnInvalidHandleReference = 1;
//ProcessStrictHandleCheckPolicy = 3
- pSetProcessMitigationPolicy = (SETPROCESSMITIGATIONPOLICY)GetProcAddress(GetModuleHandle(_T("kernel32.dll")), "SetProcessMitigationPolicy");
+ pSetProcessMitigationPolicy = (SETPROCESSMITIGATIONPOLICY)GetProcAddress(kerneldll, "SetProcessMitigationPolicy");
pSetProcessMitigationPolicy(3, &p, sizeof p);
#endif
SetDllDirectory (_T(""));
/* Make sure we do an InitCommonControls() to get some advanced controls */
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
+
+ GETTHREADDPIAWARENESSCONTEXT pGetThreadDpiAwarenessContext = (GETTHREADDPIAWARENESSCONTEXT)GetProcAddress(userdll, "GetThreadDpiAwarenessContext");
+ if (pGetThreadDpiAwarenessContext) {
+ DPI_AWARENESS_CONTEXT dpiawactx = pGetThreadDpiAwarenessContext();
+ if (dpiawactx) {
+ GETAWARENESSFROMDPIAWARENESSCONTEXT pGetAwarenessFromDpiAwarenessContext = (GETAWARENESSFROMDPIAWARENESSCONTEXT)GetProcAddress(userdll, "GetAwarenessFromDpiAwarenessContext");
+ if (pGetAwarenessFromDpiAwarenessContext) {
+ DPI_AWARENESS dpiawa = pGetAwarenessFromDpiAwarenessContext(dpiawactx);
+ if (dpiawa == DPI_AWARENESS_PER_MONITOR_AWARE)
+ dpi_aware_v2 = true;
+ }
+ }
+ }
+
InitCommonControls ();
original_affinity = 1;
#define MSGFLT_ADD 1
CHANGEWINDOWMESSAGEFILTER pChangeWindowMessageFilter;
pChangeWindowMessageFilter = (CHANGEWINDOWMESSAGEFILTER)GetProcAddress(
- GetModuleHandle(_T("user32.dll")), _T("ChangeWindowMessageFilter"));
+ userdll, "ChangeWindowMessageFilter");
if (pChangeWindowMessageFilter)
pChangeWindowMessageFilter(WM_DROPFILES, MSGFLT_ADD);
#endif
extern TCHAR VersionStr[256];
extern TCHAR BetaStr[64];
extern int os_admin, os_64bit, os_vista, os_win7, os_win8, os_win10, cpu_number, os_touch;
-extern BOOL os_dwm_enabled;
+extern BOOL os_dwm_enabled, dpi_aware_v2;
extern OSVERSIONINFO osVersion;
extern int paraport_mask;
extern int gui_active;
extern HKEY hWinUAEKey;
extern HINSTANCE hInst;
+extern HMODULE userdll;
+extern HMODULE kerneldll;
extern int af_path_2005;
extern TCHAR start_path_new1[MAX_DPATH], start_path_new2[MAX_DPATH];
extern TCHAR bootlogpath[MAX_DPATH];
#include <dwmapi.h>
#include <D3dkmthk.h>
#include <process.h>
+#include <shellscalingapi.h>
#include "sysdeps.h"
static GETDISPLAYCONFIGBUFFERSIZES pGetDisplayConfigBufferSizes;
static DISPLAYCONFIGGETDEVICEINFO pDisplayConfigGetDeviceInfo;
if (!pQueryDisplayConfig)
- pQueryDisplayConfig = (QUERYDISPLAYCONFIG)GetProcAddress(GetModuleHandle(_T("user32.dll")), "QueryDisplayConfig");
+ pQueryDisplayConfig = (QUERYDISPLAYCONFIG)GetProcAddress(userdll, "QueryDisplayConfig");
if (!pGetDisplayConfigBufferSizes)
- pGetDisplayConfigBufferSizes = (GETDISPLAYCONFIGBUFFERSIZES)GetProcAddress(GetModuleHandle(_T("user32.dll")), "GetDisplayConfigBufferSizes");
+ pGetDisplayConfigBufferSizes = (GETDISPLAYCONFIGBUFFERSIZES)GetProcAddress(userdll, "GetDisplayConfigBufferSizes");
if (!pDisplayConfigGetDeviceInfo)
- pDisplayConfigGetDeviceInfo = (DISPLAYCONFIGGETDEVICEINFO)GetProcAddress(GetModuleHandle(_T("user32.dll")), "DisplayConfigGetDeviceInfo");
+ pDisplayConfigGetDeviceInfo = (DISPLAYCONFIGGETDEVICEINFO)GetProcAddress(userdll, "DisplayConfigGetDeviceInfo");
if (!pQueryDisplayConfig || !pGetDisplayConfigBufferSizes || !pDisplayConfigGetDeviceInfo)
return false;
struct MultiDisplay *md = displayindex < 0 ? getdisplay(&currprefs, 0) : &Displays[displayindex];
render_screen(mon->monitor_id, 1, true);
}
-static int getstatuswindowheight(int monid)
+static int getdpiformonitor(HMONITOR mon)
+{
+ if (mon) {
+ static HMODULE shcore;
+ if (!shcore)
+ shcore = LoadLibrary(_T("Shcore.dll"));
+ if (shcore) {
+ typedef HRESULT(CALLBACK * GETDPIFORMONITOR)(HMONITOR, MONITOR_DPI_TYPE, UINT*, UINT*);
+ GETDPIFORMONITOR pGetDpiForMonitor = (GETDPIFORMONITOR)GetProcAddress(userdll, "GetDpiForMonitor");
+ if (pGetDpiForMonitor) {
+ UINT x, y;
+ if (SUCCEEDED(pGetDpiForMonitor(mon, MDT_EFFECTIVE_DPI, &x, &y)))
+ return y;
+ }
+ }
+ }
+ HDC hdc = GetDC(NULL);
+ int dpi = GetDeviceCaps(hdc, LOGPIXELSX);
+ ReleaseDC(NULL, hdc);
+ return dpi;
+}
+
+static int getdpiforwindow(HWND hwnd)
+{
+ typedef UINT (CALLBACK *GETDPIFORWINDOW)(HWND);
+ GETDPIFORWINDOW pGetDpiForWindow = (GETDPIFORWINDOW)GetProcAddress(userdll, "GetDpiForWindow");
+ if (pGetDpiForWindow)
+ return pGetDpiForWindow(hwnd);
+ HDC hdc = GetDC(NULL);
+ int dpi = GetDeviceCaps(hdc, LOGPIXELSY);
+ ReleaseDC(NULL, hdc);
+ return dpi;
+}
+
+static int getstatuswindowheight(int monid, HWND hwnd)
{
if (monid > 0)
return 0;
int def = GetSystemMetrics (SM_CYMENU) + 3;
WINDOWINFO wi;
HWND h = CreateWindowEx (
- 0, STATUSCLASSNAME, (LPCTSTR) NULL, SBARS_TOOLTIPS | WS_CHILD | WS_VISIBLE,
- 0, 0, 0, 0, hHiddenWnd, (HMENU) 1, hInst, NULL);
+ 0, STATUSCLASSNAME, (LPCTSTR) NULL, SBARS_TOOLTIPS | WS_CHILD,
+ 0, 0, 0, 0, hwnd ? hwnd : hHiddenWnd, (HMENU) 1, hInst, NULL);
if (!h)
return def;
wi.cbSize = sizeof wi;
- if (!GetWindowInfo (h, &wi))
- return def;
+ if (GetWindowInfo (h, &wi))
+ def = wi.rcWindow.bottom - wi.rcWindow.top;
+ int dpi = hwnd ? getdpiforwindow(hwnd) : getdpiformonitor(NULL);
DestroyWindow (h);
- return wi.rcWindow.bottom - wi.rcWindow.top;
+ return dpi * def / 96;
}
void graphics_reset(bool forced)
{
if (!os_vista)
return;
- DWMENABLEMMCSS pDwmEnableMMCSS;
- pDwmEnableMMCSS = (DWMENABLEMMCSS)GetProcAddress(GetModuleHandle(_T("dwmapi.dll")), "DwmEnableMMCSS");
- if (pDwmEnableMMCSS)
- pDwmEnableMMCSS (state);
+ HMODULE hm = GetModuleHandle(_T("dwmapi.dll"));
+ if (hm) {
+ DWMENABLEMMCSS pDwmEnableMMCSS;
+ pDwmEnableMMCSS = (DWMENABLEMMCSS)GetProcAddress(hm, "DwmEnableMMCSS");
+ if (pDwmEnableMMCSS)
+ pDwmEnableMMCSS(state);
+ }
}
void close_windows(struct AmigaMonitor *mon)
static void createstatuswindow(struct AmigaMonitor *mon)
{
- HDC hdc;
RECT rc;
HLOCAL hloc;
LPINT lpParts;
int fps_width, idle_width, snd_width, joy_width, net_width;
int joys = currprefs.win32_statusbar > 1 ? 2 : 0;
int num_parts = 12 + joys + 1;
- double scaleX, scaleY;
+ float scale = 1.0;
WINDOWINFO wi;
int extra;
wi.cbSize = sizeof wi;
GetWindowInfo(mon->hMainWnd, &wi);
extra = wi.rcClient.top - wi.rcWindow.top;
-
- hdc = GetDC(mon->hStatusWnd);
- scaleX = GetDeviceCaps(hdc, LOGPIXELSX) / 96.0;
- scaleY = GetDeviceCaps(hdc, LOGPIXELSY) / 96.0;
- ReleaseDC(mon->hStatusWnd, hdc);
- drive_width = (int)(24 * scaleX);
- hd_width = (int)(24 * scaleX);
- cd_width = (int)(24 * scaleX);
- power_width = (int)(42 * scaleX);
- fps_width = (int)(64 * scaleX);
- idle_width = (int)(64 * scaleX);
- net_width = (int)(24 * scaleX);
+ scale = getdpiforwindow(mon->hStatusWnd) / 96.0;
+ drive_width = (int)(24 * scale);
+ hd_width = (int)(24 * scale);
+ cd_width = (int)(24 * scale);
+ power_width = (int)(42 * scale);
+ fps_width = (int)(64 * scale);
+ idle_width = (int)(64 * scale);
+ net_width = (int)(24 * scale);
if (is_ppc_cpu(&currprefs))
- idle_width += (int)(68 * scaleX);
+ idle_width += (int)(68 * scale);
if (is_x86_cpu(&currprefs))
- idle_width += (int)(68 * scaleX);
- snd_width = (int)(72 * scaleX);
- joy_width = (int)(24 * scaleX);
+ idle_width += (int)(68 * scale);
+ snd_width = (int)(72 * scale);
+ joy_width = (int)(24 * scale);
GetClientRect(mon->hMainWnd, &rc);
/* Allocate an array for holding the right edge coordinates. */
hloc = LocalAlloc (LHND, sizeof (int) * (num_parts + 1));
if (hloc) {
- int i = 0, i1, j;
- lpParts = (LPINT)LocalLock (hloc);
- // left side, msg area
- lpParts[i] = rc.left + 2;
- i++;
- window_led_msg_start = i;
- /* Calculate the right edge coordinate for each part, and copy the coords to the array. */
- int startx = rc.right - (drive_width * 4) - power_width - idle_width - fps_width - cd_width - hd_width - snd_width - net_width - joys * joy_width - extra;
- for (j = 0; j < joys; j++) {
+ lpParts = (LPINT)LocalLock(hloc);
+ if (lpParts) {
+ int i = 0, i1;
+ // left side, msg area
+ lpParts[i] = rc.left + 2;
+ i++;
+ window_led_msg_start = i;
+ /* Calculate the right edge coordinate for each part, and copy the coords to the array. */
+ int startx = rc.right - (drive_width * 4) - power_width - idle_width - fps_width - cd_width - hd_width - snd_width - net_width - joys * joy_width - extra;
+ for (int j = 0; j < joys; j++) {
+ lpParts[i] = startx;
+ i++;
+ startx += joy_width;
+ }
+ window_led_joy_start = i;
+ if (lpParts[0] >= startx)
+ lpParts[0] = startx - 1;
+ // snd
lpParts[i] = startx;
i++;
- startx += joy_width;
+ // cpu
+ lpParts[i] = lpParts[i - 1] + snd_width;
+ i++;
+ // fps
+ lpParts[i] = lpParts[i - 1] + idle_width;
+ i++;
+ // power
+ lpParts[i] = lpParts[i - 1] + fps_width;
+ i++;
+ i1 = i;
+ // hd
+ lpParts[i] = lpParts[i - 1] + power_width;
+ i++;
+ // cd
+ lpParts[i] = lpParts[i - 1] + hd_width;
+ i++;
+ // net
+ lpParts[i] = lpParts[i - 1] + cd_width;
+ i++;
+ // df0
+ lpParts[i] = lpParts[i - 1] + net_width;
+ i++;
+ // df1
+ lpParts[i] = lpParts[i - 1] + drive_width;
+ i++;
+ // df2
+ lpParts[i] = lpParts[i - 1] + drive_width;
+ i++;
+ // df3
+ lpParts[i] = lpParts[i - 1] + drive_width;
+ i++;
+ // edge
+ lpParts[i] = lpParts[i - 1] + drive_width;
+
+ window_led_msg = lpParts[window_led_msg_start - 1];
+ window_led_msg_end = lpParts[window_led_msg_start - 1 + 1];
+ window_led_joys = lpParts[window_led_joy_start - joys];
+ window_led_joys_end = lpParts[window_led_joy_start - joys + 1];
+ window_led_hd = lpParts[i1];
+ window_led_hd_end = lpParts[i1 + 1];
+ window_led_drives = lpParts[i1 + 3];
+ window_led_drives_end = lpParts[i1 + 3 + 4];
+
+ /* Create the parts */
+ SendMessage(mon->hStatusWnd, SB_SETPARTS, (WPARAM)num_parts, (LPARAM)lpParts);
+ LocalUnlock(hloc);
+ LocalFree(hloc);
}
- window_led_joy_start = i;
- if (lpParts[0] >= startx)
- lpParts[0] = startx - 1;
- // snd
- lpParts[i] = startx;
- i++;
- // cpu
- lpParts[i] = lpParts[i - 1] + snd_width;
- i++;
- // fps
- lpParts[i] = lpParts[i - 1] + idle_width;
- i++;
- // power
- lpParts[i] = lpParts[i - 1] + fps_width;
- i++;
- i1 = i;
- // hd
- lpParts[i] = lpParts[i - 1] + power_width;
- i++;
- // cd
- lpParts[i] = lpParts[i - 1] + hd_width;
- i++;
- // net
- lpParts[i] = lpParts[i - 1] + cd_width;
- i++;
- // df0
- lpParts[i] = lpParts[i - 1] + net_width;
- i++;
- // df1
- lpParts[i] = lpParts[i - 1] + drive_width;
- i++;
- // df2
- lpParts[i] = lpParts[i - 1] + drive_width;
- i++;
- // df3
- lpParts[i] = lpParts[i - 1] + drive_width;
- i++;
- // edge
- lpParts[i] = lpParts[i - 1] + drive_width;
-
- window_led_msg = lpParts[window_led_msg_start - 1];
- window_led_msg_end = lpParts[window_led_msg_start - 1 + 1];
- window_led_joys = lpParts[window_led_joy_start - joys];
- window_led_joys_end = lpParts[window_led_joy_start - joys + 1];
- window_led_hd = lpParts[i1];
- window_led_hd_end = lpParts[i1 + 1];
- window_led_drives = lpParts[i1 + 3];
- window_led_drives_end = lpParts[i1 + 3 + 4];
-
- /* Create the parts */
- SendMessage(mon->hStatusWnd, SB_SETPARTS, (WPARAM)num_parts, (LPARAM)lpParts);
- LocalUnlock(hloc);
- LocalFree(hloc);
}
registertouch(mon->hStatusWnd);
}
{
typedef HRESULT(CALLBACK* DWMGETWINDOWATTRIBUTE)(HWND hwnd, DWORD dwAttribute, PVOID pvAttribute, DWORD cbAttribute);
static DWMGETWINDOWATTRIBUTE pDwmGetWindowAttribute;
- static HMODULE dwmapihandle;
RECT r1, r2;
- if (!pDwmGetWindowAttribute && !dwmapihandle && os_vista) {
- dwmapihandle = LoadLibrary(_T("dwmapi.dll"));
+ if (!pDwmGetWindowAttribute && os_vista) {
+ HMODULE dwmapihandle = GetModuleHandle(_T("dwmapi.dll"));
if (dwmapihandle)
pDwmGetWindowAttribute = (DWMGETWINDOWATTRIBUTE)GetProcAddress(dwmapihandle, "DwmGetWindowAttribute");
}
int gap = 0;
int x, y, w, h;
struct MultiDisplay *md;
- int sbheight;
md = getdisplay(&currprefs, mon->monitor_id);
if (mon->monitor_id && fsw) {
}
mon->md = md;
- sbheight = currprefs.win32_statusbar ? getstatuswindowheight(mon->monitor_id) : 0;
-
if (mon->hAmigaWnd) {
RECT r;
int w, h, x, y;
}
#endif
GetWindowRect (mon->hAmigaWnd, &r);
+
+ int sbheight = currprefs.win32_statusbar ? getstatuswindowheight(mon->monitor_id, mon->hAmigaWnd) : 0;
+
x = r.left;
y = r.top;
w = r.right - r.left;
window_led_drives_end = 0;
mon->hMainWnd = NULL;
x = 0; y = 0;
+
+ int sbheight = currprefs.win32_statusbar ? getstatuswindowheight(mon->monitor_id, NULL) : 0;
+
if (borderless)
sbheight = cyborder = 0;
if (currprefs.win32_shutdown_notification && !rp_isactive()) {
typedef BOOL(WINAPI *SHUTDOWNBLOCKREASONCREATE)(HWND, LPCWSTR);
SHUTDOWNBLOCKREASONCREATE pShutdownBlockReasonCreate;
- pShutdownBlockReasonCreate = (SHUTDOWNBLOCKREASONCREATE)GetProcAddress(GetModuleHandle(_T("user32.dll")), "ShutdownBlockReasonCreate");
+ pShutdownBlockReasonCreate = (SHUTDOWNBLOCKREASONCREATE)GetProcAddress(userdll, "ShutdownBlockReasonCreate");
if (pShutdownBlockReasonCreate) {
TCHAR tmp[MAX_DPATH];
WIN32GUI_LoadUIString(IDS_SHUTDOWN_NOTIFICATION, tmp, MAX_DPATH);
#endif
#include "ini.h"
#include "specialmonitors.h"
+#include "gayle.h"
#define GUI_SCALE_DEFAULT 100
#define MIN_GUI_INTERNAL_WIDTH 512
static HWND pages[MAX_C_PAGES];
#define MAX_IMAGETOOLTIPS 10
static HWND guiDlg, panelDlg, ToolTipHWND;
+static struct dlgcontext maindctx;
static HACCEL hAccelTable;
static HWND customDlg;
static int customDlgType;
case WM_INITDIALOG:
{
recursive++;
- scaleresource_setfont(hDlg);
if (!configstore) {
DeleteConfigTree(hDlg);
CreateConfigStore(NULL, FALSE);
{
CHARFORMAT CharFormat;
CharFormat.cbSize = sizeof (CharFormat);
- int my;
-
- scaleresource_getmult (NULL, &my);
SetDlgItemText (hDlg, url->id, url->display);
SendDlgItemMessage (hDlg, url->id, EM_GETCHARFORMAT, 0, (LPARAM)&CharFormat);
{
case WM_INITDIALOG:
recursive++;
- scaleresource_setfont (hDlg);
pages[PATHS_ID] = hDlg;
setac (hDlg, IDC_PATHS_ROM);
setac (hDlg, IDC_PATHS_CONFIG);
{
case WM_INITDIALOG:
{
- scaleresource_setfont (hDlg);
int ids[] = { IDC_DF0TEXTQ, IDC_DF1TEXTQ, -1 };
pages[QUICKSTART_ID] = hDlg;
currentpage = QUICKSTART_ID;
switch( msg )
{
case WM_INITDIALOG:
- scaleresource_setfont (hDlg);
pages[ABOUT_ID] = hDlg;
currentpage = ABOUT_ID;
init_aboutdlg (hDlg);
switch (msg)
{
case WM_INITDIALOG:
- scaleresource_setfont (hDlg);
pages[DISPLAY_ID] = hDlg;
currentpage = DISPLAY_ID;
SendDlgItemMessage (hDlg, IDC_FRAMERATE, TBM_SETPAGESIZE, 0, 1);
switch (msg) {
case WM_INITDIALOG:
{
- scaleresource_setfont(hDlg);
pages[CHIPSET_ID] = hDlg;
currentpage = CHIPSET_ID;
switch (msg) {
case WM_INITDIALOG:
{
- scaleresource_setfont(hDlg);
pages[CHIPSET2_ID] = hDlg;
currentpage = CHIPSET2_ID;
cs_compatible = workprefs.cs_compatible;
case WM_INITDIALOG:
{
recursive++;
- scaleresource_setfont (hDlg);
pages[EXPANSION2_ID] = hDlg;
currentpage = EXPANSION2_ID;
int ids[] = { IDC_SCSIROMFILE, IDC_CPUBOARDROMFILE, -1 };
switch (msg)
{
case WM_INITDIALOG:
- scaleresource_setfont (hDlg);
pages[EXPANSION_ID] = hDlg;
currentpage = EXPANSION_ID;
{
case WM_INITDIALOG:
recursive++;
- scaleresource_setfont (hDlg);
pages[BOARD_ID] = hDlg;
currentpage = BOARD_ID;
setchecked(hDlg, IDC_AUTOCONFIGCUSTOMSORT, workprefs.autoconfig_custom_sort);
{
case WM_INITDIALOG:
recursive++;
- scaleresource_setfont (hDlg);
pages[MEMORY_ID] = hDlg;
currentpage = MEMORY_ID;
SendDlgItemMessage (hDlg, IDC_CHIPMEM, TBM_SETRANGE, TRUE, MAKELONG (MIN_CHIP_MEM, MAX_CHIP_MEM));
{
case WM_INITDIALOG:
{
- scaleresource_setfont (hDlg);
int ids[] = { IDC_ROMFILE, IDC_ROMFILE2, IDC_CARTFILE, -1 };
pages[KICKSTART_ID] = hDlg;
currentpage = KICKSTART_ID;
static void misc_gui_font (HWND hDlg, int fonttype)
{
if (scaleresource_choosefont (hDlg, fonttype))
- gui_size_changed = 1;
+ gui_size_changed = 10;
}
static void values_to_miscdlg_dx(HWND hDlg)
{
double dpix = 1.0, dpiy = 1.0;
+#if 0
previous_dpix = 0;
previous_dpiy = 0;
if (isfullscreen() <= 0) {
scaleresource_getdpimult(&dpix, &dpiy, &previous_dpix, &previous_dpiy);
}
+#endif
gui_width = (int)(GUI_INTERNAL_WIDTH * dpix);
gui_height = (int)(GUI_INTERNAL_HEIGHT * dpiy);
}
}
+static void saveguisize(void)
+{
+ if (gui_fullscreen)
+ return;
+ if (full_property_sheet || isfullscreen() == 0) {
+ regsetint(NULL, _T("GUISizeX"), gui_width);
+ regsetint(NULL, _T("GUISizeY"), gui_height);
+ } else if (isfullscreen() < 0) {
+ regsetint(NULL, _T("GUISizeFWX"), gui_width);
+ regsetint(NULL, _T("GUISizeFWY"), gui_height);
+ } else if (isfullscreen() > 0) {
+ regsetint(NULL, _T("GUISizeFSX"), gui_width);
+ regsetint(NULL, _T("GUISizeFSY"), gui_height);
+ }
+}
+
static void getstoredguisize(void)
{
if (full_property_sheet || isfullscreen () == 0) {
switch (msg)
{
case WM_INITDIALOG:
- scaleresource_setfont (hDlg);
pages[currentpage] = hDlg;
InitializeListView (hDlg);
values_to_miscdlg (hDlg);
scaleresource_setdefaults ();
v = SendDlgItemMessage (hDlg, IDC_GUI_SIZE, CB_GETCURSEL, 0, 0L);
if (v != CB_ERR) {
- double dpix = 1.0, dpiy = 1.0;
if (v == 0) {
v = GUI_SCALE_DEFAULT;
} else {
v--;
v = 200 - v * 10;
}
- if (isfullscreen() <= 0)
- scaleresource_getdpimult(&dpix, &dpiy, &previous_dpix, &previous_dpiy);
- gui_width = (int)(GUI_INTERNAL_WIDTH * dpix * v / 100);
- gui_height = (int)(GUI_INTERNAL_HEIGHT * dpiy * v / 100);
+ gui_width = (int)(GUI_INTERNAL_WIDTH * v / 100);
+ gui_height = (int)(GUI_INTERNAL_HEIGHT * v / 100);
if (gui_width < MIN_GUI_INTERNAL_WIDTH || gui_height < MIN_GUI_INTERNAL_HEIGHT) {
gui_width = MIN_GUI_INTERNAL_WIDTH;
gui_height = MIN_GUI_INTERNAL_HEIGHT;
}
- scaleresource_setmult (guiDlg, gui_width, gui_height, gui_fullscreen);
- gui_size_changed = 1;
+ scaleresource_setsize(gui_width, gui_height, gui_fullscreen);
+ gui_size_changed = 10;
}
break;
case IDC_GUI_FONT:
case IDC_GUI_RESIZE:
gui_resize_enabled = ischecked (hDlg, IDC_GUI_RESIZE);
gui_fullscreen = -1;
- gui_size_changed = 2;
+ gui_size_changed = 10;
break;
case IDC_GUI_FULLSCREEN:
gui_fullscreen = ischecked (hDlg, IDC_GUI_FULLSCREEN);
if (!gui_fullscreen) {
gui_fullscreen = -1;
gui_resize_enabled = false;
+ getstoredguisize();
} else {
gui_resize_enabled = true;
}
- gui_size_changed = 2;
+ gui_size_changed = 10;
break;
case IDC_ASSOCIATE_ON:
for (i = 0; exts[i].ext; i++)
switch (msg) {
case WM_INITDIALOG:
recursive++;
- scaleresource_setfont (hDlg);
pages[CPU_ID] = hDlg;
currentpage = CPU_ID;
SendDlgItemMessage (hDlg, IDC_CACHE, TBM_SETRANGE, TRUE, MAKELONG (MIN_CACHE_SIZE, MAX_CACHE_SIZE));
case WM_INITDIALOG:
{
recursive++;
- scaleresource_setfont (hDlg);
sound_loaddrivesamples ();
SendDlgItemMessage (hDlg, IDC_SOUNDBUFFERRAM, TBM_SETRANGE, TRUE, MAKELONG (MIN_SOUND_MEM, MAX_SOUND_MEM));
SendDlgItemMessage (hDlg, IDC_SOUNDBUFFERRAM, TBM_SETPAGESIZE, 0, 1);
struct hardfiledata *hfd = get_hardfile_data (uci->configoffset);
if (hfd)
hardfile_media_change (hfd, &ci, true, false);
+ pcmcia_disk_reinsert(&workprefs, &uci->ci, false);
}
}
struct hardfiledata *hfd = get_hardfile_data (uci->configoffset);
if (hfd)
hardfile_media_change (hfd, ¤t_hfdlg.ci, true, false);
+ pcmcia_disk_reinsert(&workprefs, &uci->ci, false);
}
}
{
switch (msg) {
case WM_INITDIALOG:
- scaleresource_setfont (hDlg);
clicked_entry = 0;
pages[HARDDISK_ID] = hDlg;
currentpage = HARDDISK_ID;
TCHAR ft35dd[20], ft35hd[20], ft35ddpc[20], ft35hdpc[20], ft525sd[20], ftdis[20], ft35ddescom[20];
int df0texts[] = { IDC_DF0TEXT, IDC_DF1TEXT, IDC_DF2TEXT, IDC_DF3TEXT, -1 };
- scaleresource_setfont (hDlg);
WIN32GUI_LoadUIString (IDS_FLOPPYTYPE35DD, ft35dd, sizeof ft35dd / sizeof (TCHAR));
WIN32GUI_LoadUIString (IDS_FLOPPYTYPE35HD, ft35hd, sizeof ft35hd / sizeof (TCHAR));
WIN32GUI_LoadUIString (IDS_FLOPPYTYPE35DDPC, ft35ddpc, sizeof ft35ddpc / sizeof (TCHAR));
switch (msg)
{
case WM_INITDIALOG:
- scaleresource_setfont (hDlg);
pages[DISK_ID] = hDlg;
currentpage = DISK_ID;
InitializeListView (hDlg);
case WM_INITDIALOG:
{
recursive++;
- scaleresource_setfont (hDlg);
pages[GAMEPORTS_ID] = hDlg;
currentpage = GAMEPORTS_ID;
{
case WM_INITDIALOG:
recursive++;
- scaleresource_setfont (hDlg);
pages[IOPORTS_ID] = hDlg;
currentpage = IOPORTS_ID;
init_portsdlg (hDlg);
return TRUE;
case WM_INITDIALOG:
{
- scaleresource_setfont (hDlg);
inputmap_port_remap = -1;
inputmap_remap_counter = -1;
inputmap_view_offset = 0;
{
case WM_INITDIALOG:
recursive++;
- scaleresource_setfont (hDlg);
pages[INPUT_ID] = hDlg;
currentpage = INPUT_ID;
inputdevice_updateconfig (NULL, &workprefs);
}
firstinit = true;
}
- scaleresource_setfont (hDlg);
pages[HW3D_ID] = hDlg;
currentpage = HW3D_ID;
SendDlgItemMessage (hDlg, IDC_FILTERASPECT, CB_RESETCONTENT, 0, 0);
switch(msg)
{
case WM_INITDIALOG:
- scaleresource_setfont (hDlg);
pages[AVIOUTPUT_ID] = hDlg;
currentpage = AVIOUTPUT_ID;
AVIOutput_GetSettings ();
HWND hDlg = guiDlg;
static HWND hwndTT;
static bool first = true;
- RECT r1c, r1w, r2c, r2w, r3c, r3w;
int w, h, x , y, i, pw, ph;
int fullpanel;
struct newresource *tres;
return NULL;
}
- GetWindowRect (GetDlgItem (hDlg, IDC_PANEL_FRAME), &r1w);
- GetClientRect (GetDlgItem (hDlg, IDC_PANEL_FRAME), &r1c);
- GetWindowRect (hDlg, &r2w);
- GetClientRect (hDlg, &r2c);
- gui_width = r2c.right;
- gui_height = r2c.bottom;
-
fullpanel = ppage[id].fullpanel;
- tres = scaleresource (ppage[id].nres, hDlg, -1, 0, 0, false);
+ tres = scaleresource (ppage[id].nres, &maindctx, hDlg, -1, 0, 0, id + 1);
panelDlg = CreateDialogIndirectParam (tres->inst, tres->resource, hDlg, ppage[id].dlgproc, id);
+
+ //SetWindowRedraw(hDlg, FALSE);
+
+ rescaleresource(tres, &maindctx, hDlg, panelDlg);
+
freescaleresource(tres);
-
- GetWindowRect (hDlg, &r3w);
- GetClientRect (panelDlg, &r3c);
- x = r1w.left - r2w.left;
- y = r1w.top - r2w.top;
- w = r3c.right - r3c.left + 1;
- h = r3c.bottom - r3c.top + 1;
- pw = r1w.right - r1w.left + 1;
- ph = r1w.bottom - r1w.top + 1;
- SetWindowPos (panelDlg, HWND_TOP, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOOWNERZORDER);
- GetWindowRect (panelDlg, &r3w);
- GetClientRect (panelDlg, &r3c);
- x -= r3w.left - r2w.left - 1;
- y -= r3w.top - r2w.top - 1;
- if (!fullpanel) {
- SetWindowPos (panelDlg, HWND_TOP, x + (pw - w) / 2, y + (ph - h) / 2, 0, 0, SWP_NOSIZE | SWP_NOOWNERZORDER);
- }
ShowWindow (GetDlgItem (hDlg, IDC_PANEL_FRAME), SW_HIDE);
ShowWindow (GetDlgItem (hDlg, IDC_PANEL_FRAME_OUTER), !fullpanel ? SW_SHOW : SW_HIDE);
EnumChildWindows (panelDlg, &childenumproc, (LPARAM)ppage[currentpage].nres->tmpl);
SendMessage (panelDlg, WM_NULL, 0, 0);
+ //SetWindowRedraw(hDlg, TRUE);
+ //RedrawWindow(hDlg, NULL, NULL, RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN | RDW_UPDATENOW);
+
hAccelTable = ppage[currentpage].accel;
if (ppage[id].focusid > 0 && action != TVC_BYKEYBOARD) {
if (!gui_size_changed && hGUIWnd != NULL) {
int dx = LOWORD(wParam);
int dy = HIWORD(wParam);
- if (dx != previous_dpix || dy != previous_dpiy) {
- RECT *r = (RECT*)lParam;
- previous_dpix = dx;
- previous_dpiy = dy;
- gui_width = (r->right - r->left);
- gui_height = (r->bottom - r->top);
- gui_size_changed = 1;
- }
+ RECT *const r = (RECT*)lParam;
+ previous_dpix = dx;
+ previous_dpiy = dy;
+ gui_width = (r->right - r->left);
+ gui_height = (r->bottom - r->top);
+ oldwidth = gui_width;
+ oldheight = gui_height;
+ saveguisize();
+ SetWindowPos(hDlg, NULL, r->left, r->top, r->right - r->left, r->bottom - r->top, SWP_NOZORDER | SWP_NOACTIVATE);
+ scaleresource_setsize(gui_width, gui_height, 0);
}
}
break;
return TRUE;
case WM_INITDIALOG:
guiDlg = hDlg;
- scaleresource_setfont (hDlg);
SendMessage (hDlg, WM_SETICON, ICON_SMALL, (LPARAM)LoadIcon (GetModuleHandle (NULL), MAKEINTRESOURCE(IDI_APPICON)));
if (full_property_sheet) {
TCHAR tmp[100];
INT_PTR CustomDialogBox (int templ, HWND hDlg, DLGPROC proc)
{
struct newresource *res, *r;
+ struct dlgcontext dctx;
INT_PTR h = -1;
res = getresource (templ);
if (!res)
return h;
- r = scaleresource (res, hDlg, -1, 0, 0, false);
+ r = scaleresource (res, &dctx, hDlg, -1, 0, 0, -1);
if (r) {
h = DialogBoxIndirect (r->inst, r->resource, hDlg, proc);
freescaleresource (r);
HWND CustomCreateDialog (int templ, HWND hDlg, DLGPROC proc)
{
struct newresource *res, *r;
+ struct dlgcontext dctx;
HWND h = NULL;
res = getresource (templ);
if (!res)
return h;
- r = scaleresource (res, hDlg, -1, 0, 0, false);
+ r = scaleresource (res, &dctx, hDlg, -1, 0, 0, -1);
if (r) {
h = CreateDialogIndirect (r->inst, r->resource, hDlg, proc);
freescaleresource (r);
HWND dhwnd;
int first = 0;
static struct newresource *panelresource;
- struct newresource *tres;
+ struct newresource *tres = NULL;
bool closed = false;
gui_active++;
}
int fmultx = 0, fmulty = 0;
- setdefaultguisize ();
+ setdefaultguisize();
getstoredguisize();
+ scaleresource_setsize(-1, -1, -1);
for (;;) {
int v = 0;
int regexists;
regexists = regqueryint (NULL, _T("GUIResize"), &v);
- gui_fullscreen = false;
+ gui_fullscreen = 0;
gui_resize_allowed = true;
gui_resize_enabled = v != 0;
v = 0;
if (v) {
gui_resize_allowed = false;
gui_resize_enabled = true;
- gui_fullscreen = true;
+ gui_fullscreen = 1;
}
- if (!gui_fullscreen) {
+ if (!gui_fullscreen && !gui_size_changed) {
setdefaultguisize ();
getstoredguisize();
}
+ gui_size_changed = 0;
if (!regexists) {
scaleresource_setdefaults ();
fmultx = 0;
write_log(_T("GUI Fullscreen %dx%d\n"), gui_width, gui_height);
}
}
- scaleresource_setmult (hwnd, gui_width, gui_height, 1);
+ scaleresource_setsize(gui_width, gui_height, 1);
int gw = gui_width;
int gh = gui_height;
getstoredguisize();
gui_width = gw;
gui_height = gh;
- scaleresource_setmult (hwnd, gui_width, gui_height, 1);
+ scaleresource_setsize(gui_width, gui_height, 1);
} else {
- if (fmultx > 0)
- scaleresource_setmult (hwnd, -fmultx, -fmulty, 0);
- else
- scaleresource_setmult (hwnd, gui_width, gui_height, 0);
+ scaleresource_setsize(gui_width, gui_height, 0);
}
if (hwnd != NULL)
}
}
- tres = scaleresource (panelresource, hwnd, gui_resize_enabled, gui_fullscreen, workprefs.win32_gui_alwaysontop || workprefs.win32_main_alwaysontop ? WS_EX_TOPMOST : 0, true);
+ panelresource->width = gui_width;
+ panelresource->height = gui_height;
+ freescaleresource(tres);
+ tres = scaleresource (panelresource, &maindctx, hwnd, gui_resize_enabled, gui_fullscreen, workprefs.win32_gui_alwaysontop || workprefs.win32_main_alwaysontop ? WS_EX_TOPMOST : 0, 0);
HWND phwnd = hwnd;
if (isfullscreen() == 0)
phwnd = 0;
if (isfullscreen() > 0 && currprefs.gfx_api > 1)
phwnd = 0;
- dhwnd = CreateDialogIndirect (tres->inst, tres->resource, phwnd, DialogProc);
+ dhwnd = CreateDialogIndirect(tres->inst, tres->resource, phwnd, DialogProc);
dialog_rect.top = dialog_rect.left = 0;
dialog_rect.right = tres->width;
dialog_rect.bottom = tres->height;
- freescaleresource (tres);
psresult = 0;
if (dhwnd != NULL) {
int dw = GetSystemMetrics(SM_CXSCREEN);
DWORD v;
int w, h;
+ //rescaleresource(dhwnd);
+
getguisize (dhwnd, &w, &h);
write_log (_T("Got GUI size = %dx%d\n"), w, h);
if (w < 100 || h < 100 || (w > 8192 && w > dw + 500) || (h > 8192 && h > dh + 500)) {
}
if (dialogreturn >= 0)
break;
- if (gui_size_changed > 0 && gui_size_changed < 10) {
- if (gui_size_changed == 2) {
- getstoredguisize();
- scaleresource_getmult (&fmultx, &fmulty);
- } else {
- fmultx = fmulty = 0;
+ if (gui_size_changed > 0) {
+ saveguisize();
+ regsetint(NULL, _T("GUIResize"), gui_resize_enabled ? 1 : 0);
+ regsetint(NULL, _T("GUIFullscreen"), gui_fullscreen > 0 ? 1 : 0);
+ if (gui_size_changed < 10) {
+ scaleresource_setsize(gui_width, gui_height, 0);
+ rescaleresource(tres, &maindctx, dhwnd, panelDlg);
+ gui_size_changed = 0;
}
- gui_size_changed = 10;
- SendMessage (dhwnd, WM_COMMAND, IDCANCEL, 0);
+ }
+ if (gui_size_changed >= 10) {
+ SendMessage(dhwnd, WM_COMMAND, IDCANCEL, 0);
+ scaleresource_setsize(-1, -1, -1);
+ }
+ if (gui_fullscreen < 0) {
+ // reset after IDCANCEL which would save coordinates
+ gui_fullscreen = 0;
}
}
psresult = dialogreturn;
gui_size_changed = 10;
}
gui_exit:
+ freescaleresource(tres);
+ tres = NULL;
if (!gui_size_changed)
break;
- if (!gui_fullscreen) {
- if (full_property_sheet || isfullscreen () == 0) {
- regsetint (NULL, _T("GUISizeX"), gui_width);
- regsetint (NULL, _T("GUISizeY"), gui_height);
- } else if (isfullscreen () < 0) {
- regsetint (NULL, _T("GUISizeFWX"), gui_width);
- regsetint (NULL, _T("GUISizeFWY"), gui_height);
- } else if (isfullscreen () > 0) {
- regsetint (NULL, _T("GUISizeFSX"), gui_width);
- regsetint (NULL, _T("GUISizeFSY"), gui_height);
- }
- }
- if (gui_fullscreen < 0)
- gui_fullscreen = 0;
- regsetint (NULL, _T("GUIResize"), gui_resize_enabled ? 1 : 0);
- regsetint (NULL, _T("GUIFullscreen"), gui_fullscreen ? 1 : 0);
- gui_size_changed = 0;
quit_program = 0;
}
UAEREG *read_disk_history (int type);
void write_disk_history (void);
+#define MAX_GUIIDPARAMS 16
+#define MAX_DLGID 100
+
+struct dlgstore
+{
+ RECT r;
+ UINT wc;
+ HWND h;
+};
+
+struct dlgcontext
+{
+ struct dlgstore dstore[MAX_DLGID];
+ int dlgstorecnt;
+};
+
struct newresource
{
LPCDLGTEMPLATEW resource;
int size;
int tmpl;
int width, height;
+ int listviews_id[MAX_GUIIDPARAMS];
+ int setparam_id[MAX_GUIIDPARAMS];
+ int listviewcnt;
+ int setparamcnt;
};
#define GUI_INTERNAL_WIDTH 800
extern struct uae_prefs workprefs;
-extern struct newresource *scaleresource (struct newresource *res, HWND, int, int, DWORD, bool);
+extern struct newresource* scaleresource(struct newresource*, struct dlgcontext *dctx, HWND, int, int, DWORD, int);
+extern void rescaleresource(struct newresource*, struct dlgcontext*, HWND, HWND);
extern void freescaleresource (struct newresource*);
-extern void scaleresource_setmult (HWND hDlg, int w, int h, int fs);
-extern void scaleresource_getmult (int *mx, int *my);
+extern void scaleresource_setsize (int w, int h, int fs);
extern HWND CustomCreateDialog (int templ, HWND hDlg, DLGPROC proc);
extern INT_PTR CustomDialogBox (int templ, HWND hDlg, DLGPROC proc);
extern struct newresource *getresource (int tmpl);
extern void scaleresource_init (const TCHAR*, int);
extern int scaleresource_choosefont (HWND hDlg, int fonttype);
extern void scaleresource_setdefaults (void);
-extern void scaleresource_setfont (HWND hDlg);
-extern void scaleresource_getdpimult (double*, double*, int*, int*);
extern void scalaresource_listview_font_info(int*);
extern int getscaledfontsize(int size);
extern bool show_box_art(const TCHAR*);
#define MAX_GUI_FONTS 2
#define DEFAULT_FONTSIZE 8
-static double multx, multy;
+static float multx, multy;
static int scaleresource_width, scaleresource_height;
+static int scaleresource_reset;
+static int dux, duy;
static TCHAR fontname_gui[32], fontname_list[32];
static int fontsize_gui = DEFAULT_FONTSIZE;
static int fontweight_gui = FW_REGULAR;
static int fontweight_list = FW_REGULAR;
-static int listviewcnt;
-static int listviews_id[16];
-
-static int setparamcnt;
-static int setparam_id[16];
-
static HFONT listviewfont;
static TEXTMETRIC listview_tm;
static const TCHAR *fontprefix;
-#define BASEMULT 1000
-static int baseunitx, baseunity;
-static RECT baserect, baseclientrect;
-static int baseborderwidth, baseborderheight;
-static int basewidth, baseheight;
-static int baseclientwidth, baseclientheight;
-
#include <pshpack2.h>
typedef struct {
WORD dlgVer;
return p;
}
-static void modifytemplate (DLGTEMPLATEEX *d, DLGTEMPLATEEX_END *d2, int id, int fullscreen)
-{
- if (fullscreen) {
- d->cx = scaleresource_width;
- d->cy = scaleresource_height;
- } else {
- d->cx = mmx (d->cx);
- d->cy = mmy (d->cy);
- }
-}
-
static void modifytemplatefont (DLGTEMPLATEEX *d, DLGTEMPLATEEX_END *d2)
{
if (!wcscmp (d2->typeface, wfont_old)) {
}
}
-static void modifyitem (DLGTEMPLATEEX *d, DLGTEMPLATEEX_END *d2, DLGITEMTEMPLATEEX *dt, int id)
+static void modifyitem (struct newresource *nr, DLGTEMPLATEEX *d, DLGTEMPLATEEX_END *d2, DLGITEMTEMPLATEEX *dt, int id)
{
- bool noyscale = false;
int wc = 0;
if (dt->windowClass[0] == 0xffff)
wc = dt->windowClass[1];
- if (multy >= 89 && multy <= 111) {
+ if (wc == 0x0085) {// combo box
+ if (nr->setparamcnt < MAX_GUIIDPARAMS) {
+ nr->setparam_id[nr->setparamcnt] = dt->id;
+ nr->setparamcnt++;
+ }
+ }
+
+ if (dt->windowClass[0] != 0xffff) {
+ if (!_tcsicmp (dt->windowClass, WC_LISTVIEWW) || !_tcsicmp (dt->windowClass, WC_TREEVIEWW)) {
+ if (nr->listviewcnt < MAX_GUIIDPARAMS) {
+ nr->listviews_id[nr->listviewcnt] = dt->id;
+ nr->listviewcnt++;
+ }
+ }
+ }
+
+}
+
+struct rescalestruct
+{
+ HWND main, sub;
+ int dlgid;
+ struct newresource *nr;
+ struct dlgcontext *dctx;
+};
+
+static struct dlgstore dstore_main[MAX_DLGID];
+static int dlgstorecnt_main;
+
+static BOOL CALLBACK rescaleproc(HWND hwnd, LPARAM lp)
+{
+ RECT rs;
+ struct rescalestruct *rss = (struct rescalestruct *)lp;
+ struct newresource *nr = rss->nr;
+ struct dlgcontext *dctx = rss->dctx;
+ HWND parent = GetParent(hwnd);
+
+ // if not parent of sub panel or main panel: skip because for example
+ // combo boxes have child windows that should not be moved or resized.
+ if (parent != rss->main && parent != rss->sub)
+ return TRUE;
+
+ GetClientRect(hwnd, &rs);
+ MapWindowPoints(hwnd, parent, (LPPOINT)&rs, 2);
- if (wc == 0x0080 && dt->cy <= 20) { // button
- noyscale = true;
+ int wc = 0;
+ bool found = false;
+ if (parent == rss->main) {
+ for (int i = 0; i < dlgstorecnt_main; i++) {
+ struct dlgstore *dsptr = &dstore_main[i];
+ if (dsptr->h == hwnd) {
+ rs = dsptr->r;
+ found = true;
+ break;
+ }
}
- if (wc == 0x0085) {// combo box
- noyscale = false;
+ if (!found) {
+ struct dlgstore *dsptr = &dstore_main[dlgstorecnt_main++];
+ dsptr->h = hwnd;
+ dsptr->r = rs;
}
- if (wc == 0x0081 && dt->cy <= 20) { // edit box
- noyscale = true;
+ } else {
+ for (int i = 0; i < dctx->dlgstorecnt; i++) {
+ struct dlgstore *dsptr = &dctx->dstore[i];
+ if (dsptr->h == hwnd) {
+ rs = dsptr->r;
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ struct dlgstore *dsptr = &dctx->dstore[dctx->dlgstorecnt++];
+ dsptr->h = hwnd;
+ dsptr->r = rs;
}
}
- if (!noyscale)
- dt->cy = mmy (dt->cy);
+ int x = rs.left;
+ x *= multx;
+ x /= 100;
- dt->cx = mmx (dt->cx);
- dt->y = mmy (dt->y);
- dt->x = mmx (dt->x);
+ int y = rs.top;
+ y *= multy;
+ y /= 100;
- if (wc == 0x0085) {// combo box
- setparam_id[setparamcnt] = dt->id;
- setparamcnt++;
+ int xe = rs.right;
+ xe *= multx;
+ xe += 99;
+ xe /= 100;
+
+ int ye = rs.bottom;
+ if (wc != 0x85) {
+ ye *= multy;
+ ye += 99;
+ ye /= 100;
+ } else {
+ ye = y + (rs.bottom - rs.top);
}
- if (dt->windowClass[0] != 0xffff) {
- if (!_tcsicmp (dt->windowClass, WC_LISTVIEWW) || !_tcsicmp (dt->windowClass, WC_TREEVIEWW)) {
- listviews_id[listviewcnt] = dt->id;
- listviewcnt++;
- }
+ SetWindowPos(hwnd, HWND_TOP, x, y, xe - x, ye - y, SWP_NOACTIVATE | SWP_NOREDRAW | SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOCOPYBITS | SWP_DEFERERASE);
+
+ return TRUE;
+}
+
+static void openfont(bool force)
+{
+ HDC hdc;
+ int size;
+ int lm = 72;
+
+ if (listviewfont && !force)
+ return;
+ if (listviewfont)
+ DeleteObject(listviewfont);
+
+ hdc = GetDC(NULL);
+
+ if (!dpi_aware_v2) {
+ lm = GetDeviceCaps(hdc, LOGPIXELSY);
}
+ size = -MulDiv(fontsize_list, lm, 72);
+ listviewfont = CreateFont(size, 0, 0, 0, fontweight_list, (fontstyle_list & ITALIC_FONTTYPE) != 0, 0, 0, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, fontname_list);
+ HGDIOBJ o = SelectObject(hdc, listviewfont);
+ memset(&listview_tm, 0, sizeof listview_tm);
+ listview_tm.tmAveCharWidth = 8;
+ GetTextMetrics(hdc, &listview_tm);
+ SelectObject(hdc, o);
+
+ ReleaseDC(NULL, hdc);
}
-static INT_PTR CALLBACK DummyProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+static void scaleresource_setfont(struct newresource *nr, HWND hDlg)
{
- switch(msg)
- {
- case WM_DESTROY:
- PostQuitMessage (0);
- return TRUE;
- case WM_CLOSE:
- DestroyWindow(hDlg);
- return TRUE;
- case WM_INITDIALOG:
- return TRUE;
+ if (nr->listviewcnt) {
+ if (!listviewfont) {
+ openfont(false);
+ if (!listviewfont)
+ return;
+ }
+ for (int i = 0; i < nr->listviewcnt; i++) {
+ HWND hwnd = GetDlgItem(hDlg, nr->listviews_id[i]);
+ if (hwnd)
+ SendMessage(hwnd, WM_SETFONT, WPARAM(listviewfont), FALSE);
+ }
+ }
+ if (os_vista) {
+ for (int i = 0; i < nr->setparamcnt; i++) {
+ HWND hwnd = GetDlgItem(hDlg, nr->setparam_id[i]);
+ if (hwnd) {
+ int v = SendMessage(hwnd, CB_GETITEMHEIGHT, -1, NULL);
+ if (v > 0 && mmy(v) > v)
+ SendMessage(hwnd, CB_SETITEMHEIGHT, -1, mmy(v));
+ }
+ }
}
- return FALSE;
}
-extern int full_property_sheet;
+void rescaleresource(struct newresource *nr, struct dlgcontext *dctx, HWND hwnd, HWND subhwnd)
+{
+ struct rescalestruct rss;
+
+ scaleresource_setfont(nr, subhwnd);
+ scaleresource_setfont(nr, hwnd);
+
+ TITLEBARINFO tbi = { 0 };
+ tbi.cbSize = sizeof(TITLEBARINFO);
+ GetTitleBarInfo(hwnd, &tbi);
+
+ int height = tbi.rcTitleBar.bottom - tbi.rcTitleBar.top;
+
+ RECT rw;
+ GetWindowRect(hwnd, &rw);
+
+ if (scaleresource_reset) {
+ RECT ru = { 0, 0, 8, 8 };
+ MapDialogRect(hwnd, &ru);
+ dux = ru.right;
+ duy = ru.bottom;
+ scaleresource_reset = 0;
+ }
+
+ WINDOWINFO pwi = { 0 };
+ pwi.cbSize = sizeof(WINDOWINFO);
+ GetWindowInfo(hwnd, &pwi);
+
+ SetWindowPos(hwnd, NULL, 0, 0, scaleresource_width, scaleresource_height, SWP_NOMOVE | SWP_NOOWNERZORDER | SWP_NOZORDER | SWP_NOREDRAW | SWP_NOCOPYBITS | SWP_DEFERERASE);
+
+ float neww = scaleresource_width - pwi.cxWindowBorders * 2;
+ float oldw = (530.0 * dux) / 8.0;
+ multx = neww * 100.0 / oldw;
+
+ float newh = scaleresource_height - height - pwi.cyWindowBorders * 2;
+ float oldh = (345.0 * duy) / 8.0;
+ multy = newh * 100.0 / oldh;
+
+ rss.main = hwnd;
+ rss.sub = subhwnd;
+ rss.nr = nr;
+ rss.dctx = dctx;
+ EnumChildWindows(hwnd, rescaleproc, (LPARAM)&rss);
+
+ RECT rf, rpf;
+ HWND pf = GetDlgItem(hwnd, IDC_PANEL_FRAME);
+ GetClientRect(subhwnd, &rpf);
+ GetClientRect(pf, &rf);
+ MapWindowPoints(pf, hwnd, (LPPOINT)& rf, 1);
+ SetWindowPos(subhwnd, HWND_TOP, rf.left, rf.top + (rf.bottom - rpf.bottom) / 2, 0, 0, SWP_NOSIZE | SWP_NOOWNERZORDER);
+
+ RedrawWindow(hwnd, NULL, NULL, RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN);
+}
-static struct newresource *scaleresource2 (struct newresource *res, HWND parent, int resize, int fullscreen, DWORD exstyle, bool main)
+void scaleresource_setsize(int w, int h, int fullscreen)
+{
+ if (w < 0 || h < 0) {
+ scaleresource_reset = 1;
+ for (int i = 0; i < dlgstorecnt_main; i++) {
+ dstore_main[i].h = NULL;
+ }
+ dlgstorecnt_main = 0;
+ return;
+ }
+ scaleresource_width = w;
+ scaleresource_height = h;
+}
+
+static struct newresource *scaleresource2 (struct newresource *res, HWND parent, int resize, int fullscreen, DWORD exstyle, int dlgid)
{
static int main_width, main_height;
DLGTEMPLATEEX_END *d2, *s2;
DLGITEMTEMPLATEEX *dt;
BYTE *p, *p2, *ps, *ps2;
- int i;
struct newresource *ns;
- listviewcnt = 0;
- setparamcnt = 0;
+ res->listviewcnt = 0;
+ res->setparamcnt = 0;
d = (DLGTEMPLATEEX*)res->resource;
d2 = (DLGTEMPLATEEX_END*)res->resource;
return 0;
ns = xcalloc (struct newresource, 1);
+ if (!ns)
+ return 0;
ns->inst = res->inst;
ns->size = res->size;
ns->tmpl = res->tmpl;
memcpy (p, ps2, ns->size - (ps2 - (BYTE*)res->resource));
- modifytemplate(d, d2, ns->tmpl, fullscreen);
-
- for (i = 0; i < d->cDlgItems; i++) {
+ int id2 = 0;
+ for (int i = 0; i < d->cDlgItems; i++) {
dt = (DLGITEMTEMPLATEEX*)p;
- modifyitem (d, d2, dt, ns->tmpl);
+ modifyitem(res, d, d2, dt, ns->tmpl);
p += sizeof (DLGITEMTEMPLATEEX);
p = skiptextone (p);
p = skiptext (p);
return ns;
}
-struct newresource *scaleresource (struct newresource *res, HWND parent, int resize, int fullscreen, DWORD exstyle, bool main)
+struct newresource *scaleresource (struct newresource *res, struct dlgcontext *dctx, HWND parent, int resize, int fullscreen, DWORD exstyle, int dlgid)
{
- return scaleresource2(res, parent, resize, fullscreen, exstyle, main);
+ dctx->dlgstorecnt = 0;
+ return scaleresource2(res, parent, resize, fullscreen, exstyle, dlgid);
}
void freescaleresource (struct newresource *ns)
{
+ if (!ns)
+ return;
xfree ((void*)ns->resource);
xfree (ns);
}
int getscaledfontsize(int size)
{
- HDC hdc = GetDC(NULL);
+ int lm = 72;
+
if (size <= 0)
size = fontsize_gui;
- size = -MulDiv(size, GetDeviceCaps(hdc, LOGPIXELSY), 72);
- ReleaseDC(NULL, hdc);
- return size;
-}
-
-static void openfont (bool force)
-{
- HDC hdc;
- int size;
-
- if (listviewfont && !force)
- return;
- if (listviewfont)
- DeleteObject (listviewfont);
- hdc = GetDC (NULL);
-
- size = -MulDiv (fontsize_list, GetDeviceCaps (hdc, LOGPIXELSY), 72);
- listviewfont = CreateFont (size, 0, 0, 0, fontweight_list, (fontstyle_list & ITALIC_FONTTYPE) != 0, 0, 0, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, fontname_list);
- HGDIOBJ o = SelectObject(hdc, listviewfont);
- memset(&listview_tm, 0, sizeof listview_tm);
- listview_tm.tmAveCharWidth = 8;
- GetTextMetrics(hdc, &listview_tm);
- SelectObject(hdc, o);
-
- ReleaseDC (NULL, hdc);
+ if (!dpi_aware_v2) {
+ HDC hdc = GetDC(NULL);
+ lm = GetDeviceCaps(hdc, LOGPIXELSY);
+ ReleaseDC(NULL, hdc);
+ }
+ size = -MulDiv(size, lm, 72);
+ return size;
}
void scalaresource_listview_font_info(int *w)
*w = listview_tm.tmAveCharWidth;
}
-void scaleresource_setfont (HWND hDlg)
-{
- if (listviewcnt) {
- if (!listviewfont) {
- openfont (false);
- if (!listviewfont)
- return;
- }
- for (int i = 0; i < listviewcnt; i++) {
- SendMessage (GetDlgItem (hDlg, listviews_id[i]), WM_SETFONT, WPARAM(listviewfont), FALSE);
- }
- }
- if (os_vista) {
- for (int i = 0; i < setparamcnt; i++) {
- int v = SendMessage (GetDlgItem (hDlg, setparam_id[i]), CB_GETITEMHEIGHT , -1, NULL);
- if (v > 0 && mmy(v) > v)
- SendMessage (GetDlgItem (hDlg, setparam_id[i]), CB_SETITEMHEIGHT , -1, mmy(v));
- }
- }
-}
-
static void setdeffont (void)
{
_tcscpy (fontname_gui, font_vista_ok ? wfont_vista : wfont_xp);
openfont (true);
}
-static INT_PTR CALLBACK TestProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- if (msg == WM_INITDIALOG) {
- RECT r;
- // there really is no better way?
- r.left = 0;
- r.top = 0;
- r.bottom = BASEMULT;
- r.right = BASEMULT;
- MapDialogRect (hDlg, &r);
- baseunitx = r.right * 4 / BASEMULT;
- baseunity = r.bottom * 8 / BASEMULT;
- GetWindowRect (hDlg, &baserect);
- GetClientRect (hDlg, &baseclientrect);
- }
- return 0;
-}
-
-// horrible or what?
-static void getbaseunits (int fullscreen)
-{
- multx = multy = 100;
- struct newresource *nr, *nr2;
- HWND hwnd;
- nr = getresource (IDD_PANEL);
- if (!nr) {
- write_log (_T("getbaseunits fail!\n"));
- abort();
- }
- nr2 = scaleresource2(nr, NULL, -1, 0, 0, false);
- hwnd = CreateDialogIndirect (nr2->inst, nr2->resource, NULL, TestProc);
- if (hwnd) {
- DestroyWindow (hwnd);
- } else {
- baserect.left = baserect.top = 0;
- baserect.right = 800;
- baserect.bottom = 600;
- baseclientrect.left = baseclientrect.top = 0;
- baseclientrect.right = 800;
- baseclientrect.bottom = 600;
- }
- freescaleresource (nr2);
- freescaleresource (nr);
- basewidth = baserect.right - baserect.left;
- baseheight = baserect.bottom - baserect.top;
- baseclientwidth = baseclientrect.right - baseclientrect.left;
- baseclientheight = baseclientrect.bottom - baseclientrect.top;
- baseborderwidth = basewidth - baseclientwidth;
- baseborderheight = baseheight - baseclientheight;
-
- write_log (_T("GUIBase %dx%d (%dx%d)\n"), basewidth, baseheight, baseunitx, baseunity);
-}
-
void scaleresource_init (const TCHAR *prefix, int fullscreen)
{
if (os_vista)
//write_log (_T("GUI font %s:%d:%d:%d\n"), fontname_gui, fontsize_gui, fontstyle_gui, fontweight_gui);
//write_log (_T("List font %s:%d:%d:%d\n"), fontname_list, fontsize_list, fontstyle_list, fontweight_list);
- getbaseunits (fullscreen);
-
openfont (true);
}
}
#endif
-
-typedef enum MONITOR_DPI_TYPE {
- MDT_EFFECTIVE_DPI = 0,
- MDT_ANGULAR_DPI = 1,
- MDT_RAW_DPI = 2,
- MDT_DEFAULT = MDT_EFFECTIVE_DPI
-} MONITOR_DPI_TYPE;
-typedef HRESULT(CALLBACK* GETDPIFORMONITOR)(HMONITOR, MONITOR_DPI_TYPE, UINT*, UINT*);
-
-void scaleresource_getdpimult (double *dpixmp, double *dpiymp, int *dpixp, int *dpiyp)
-{
- GETDPIFORMONITOR pGetDpiForMonitor;
- POINT pt = { 32000, 32000 };
- HMONITOR mon = MonitorFromPoint(pt, MONITOR_DEFAULTTOPRIMARY);
-
- *dpixmp = 1.0;
- *dpiymp = 1.0;
- *dpixp = 0;
- *dpiyp = 0;
- pGetDpiForMonitor = (GETDPIFORMONITOR)GetProcAddress(GetModuleHandle(_T("Shcore.dll")), "GetDpiForMonitor");
- if (pGetDpiForMonitor) {
- UINT dpix, dpiy;
- if (SUCCEEDED(pGetDpiForMonitor(mon, MDT_EFFECTIVE_DPI, &dpix, &dpiy))) {
- if (dpix > 96)
- *dpixmp = (double)dpix / 96.0;
- if (dpiy > 96)
- *dpiymp = (double)dpiy / 96.0;
- *dpixp = dpix;
- *dpiyp = dpiy;
- }
- }
-}
-
-void scaleresource_setmult (HWND hDlg, int w, int h, int fullscreen)
-{
- if (w < 0) {
- multx = -w;
- multy = -h;
- return;
- }
-
- scaleresource_width = w;
- scaleresource_height = h;
-
- multx = w * 100.0 / basewidth;
- multy = h * 100.0 / baseheight;
-
- if (multx < 50)
- multx = 50;
- if (multy < 50)
- multy = 50;
-
- //write_log (_T("MX=%f MY=%f\n"), multx, multy);
-}
-
-void scaleresource_getmult (int *mx, int *my)
-{
- if (mx)
- *mx = (int)(multx + 0.5);
- if (my)
- *my = (int)(multy + 0.5);
-}
-
-
int scaleresource_choosefont (HWND hDlg, int fonttype)
{
CHOOSEFONT cf = { 0 };
LOGFONT lf = { 0 };
- HDC hdc;
TCHAR *fontname[2];
int *fontsize[2], *fontstyle[2], *fontweight[2];
- int lm;
+ int lm = 72;
fontname[0] = fontname_gui;
fontname[1] = fontname_list;
cf.Flags = CF_FORCEFONTEXIST | CF_INITTOLOGFONTSTRUCT | CF_NOSCRIPTSEL | CF_SCREENFONTS;
cf.lpLogFont = &lf;
cf.nFontType = REGULAR_FONTTYPE;
- cf.iPointSize = *fontsize[fonttype];
- hdc = GetDC (NULL);
- lm = GetDeviceCaps (hdc, LOGPIXELSY);
+ if (!dpi_aware_v2) {
+ HDC hdc = GetDC(NULL);
+ lm = GetDeviceCaps(hdc, LOGPIXELSY);
+ ReleaseDC(NULL, hdc);
+ }
_tcscpy (lf.lfFaceName, fontname[fonttype]);
lf.lfHeight = -MulDiv (*fontsize[fonttype], lm, 72);
lf.lfItalic = (*fontstyle[fonttype] & ITALIC_FONTTYPE) != 0;
if (!ChooseFont (&cf)) {
- ReleaseDC (NULL, hdc);
return 0;
}
_tcscpy (fontname[fonttype], lf.lfFaceName);
*fontsize[fonttype] = lf.lfHeight;
- *fontsize[fonttype] = -MulDiv (*fontsize[fonttype], 72, GetDeviceCaps (hdc, LOGPIXELSY));
+ *fontsize[fonttype] = -MulDiv (*fontsize[fonttype], 72, lm);
*fontstyle[fonttype] = lf.lfItalic ? ITALIC_FONTTYPE : 0;
*fontweight[fonttype] = lf.lfWeight;
- ReleaseDC (NULL, hdc);
-
regsetfont (NULL, fontprefix, fontreg[fonttype], fontname[fonttype], *fontsize[fonttype], *fontstyle[fonttype], *fontweight[fonttype]);
openfont (true);
}
}
+extern int full_property_sheet;
+
bool show_box_art(const TCHAR *path)
{
TCHAR tmp1[MAX_DPATH];