#include "gayle.h"
#define GUI_SCALE_DEFAULT 100
-#define MIN_GUI_INTERNAL_WIDTH 512
-#define MIN_GUI_INTERNAL_HEIGHT 400
+
#define ARCHIVE_STRING _T("*.zip;*.7z;*.rar;*.lha;*.lzh;*.lzx")
#define DISK_FORMAT_STRING _T("(*.adf;*.adz;*.gz;*.dms;*.ipf;*.scp;*.fdi;*.exe)\0*.adf;*.adz;*.gz;*.dms;*.ipf;*.scp;*.fdi;*.exe;*.ima;*.wrp;*.dsq;*.st;*.raw;") ARCHIVE_STRING _T("\0")
-#define ROM_FORMAT_STRING _T("(*.rom;*.roz;*.a500;*.a600;*.a1200;*.a4000)\0*.rom;*.roz;*.a500;*.a600;*.a1200;*.a4000;") ARCHIVE_STRING _T("\0")
+#define ROM_FORMAT_STRING _T("(*.rom;*.roz;*.bin;*.a500;*.a600;*.a1200;*.a4000)\0*.rom;*.roz;*.bin;*.a500;*.a600;*.a1200;*.a4000;") ARCHIVE_STRING _T("\0")
#define USS_FORMAT_STRING_RESTORE _T("(*.uss)\0*.uss;*.gz;") ARCHIVE_STRING _T("\0")
#define USS_FORMAT_STRING_SAVE _T("(*.uss)\0*.uss\0")
#define HDF_FORMAT_STRING _T("(*.hdf;*.vhd;*.rdf;*.hdz;*.rdz;*.chd)\0*.hdf;*.vhd;*.rdf;*.hdz;*.rdz;*.chd\0")
return table[posn];
}
+static void commonproc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ if (msg == WM_DPICHANGED) {
+ RECT *const r = (RECT *)lParam;
+ SetWindowPos(hDlg, NULL, r->left, r->top, r->right - r->left, r->bottom - r->top, SWP_NOZORDER | SWP_NOACTIVATE);
+ }
+}
+
static int stringboxdialogactive;
static INT_PTR CALLBACK StringBoxDialogProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
}
break;
}
+ commonproc(hDlg, msg, wParam, lParam);
return FALSE;
}
}
break;
}
+ commonproc(hDlg, msg, wParam, lParam);
return FALSE;
}
static bool scan_rom_hook (const TCHAR *name, int line)
return ret;
}
-static void box_art_check(struct uae_prefs *p)
+static void box_art_check(struct uae_prefs *p, const TCHAR *config)
{
TCHAR tmp1[MAX_DPATH];
if (cfgfile_detect_art(p, tmp1)) {
- show_box_art(tmp1);
+ show_box_art(tmp1, config);
} else {
- show_box_art(NULL);
+ show_box_art(NULL, NULL);
}
}
TCHAR tmp1[MAX_DPATH], tmp2[MAX_DPATH];
TCHAR fname[MAX_DPATH], cname[MAX_DPATH];
+ error_log(NULL);
_tcscpy (fname, filename);
cname[0] = 0;
if (!zfile_exists (fname)) {
return v;
if (cname[0])
_tcscpy(config_filename, cname);
- box_art_check(p);
+ box_art_check(p, fname);
for (i = 1; i <= 2; i++) {
if (type != i) {
size = sizeof (ct);
}
static int gui_width, gui_height;
-static int gui_fullscreen;
+int gui_fullscreen;
+static RECT gui_fullscreen_rect;
static bool gui_resize_enabled;
static bool gui_resize_allowed;
recursive--;
break;
}
+ commonproc(hDlg, msg, wParam, lParam);
return FALSE;
}
} else {
SetDlgItemText (hDlg, IDC_EDITDESCRIPTION, config->Description);
}
- show_box_art(config && config->Artpath[0] ? config->Artpath : NULL);
+ if (config && config->Artpath[0]) {
+ show_box_art(config->Artpath, config->Name);
+ } else {
+ show_box_art(NULL, NULL);
+ }
}
static void DeleteConfigTree (HWND hDlg)
case WM_USER + 1:
if (config) {
- show_box_art(config && config->Artpath[0] ? config->Artpath : NULL);
+ if (config->Artpath[0]) {
+ show_box_art(config->Artpath, config->Name);
+ } else {
+ show_box_art(NULL, NULL);
+ }
}
break;
SendDlgItemMessage (hDlg, IDC_ERRORLOGMESSAGE, EM_SETCHARFORMAT, SCF_ALL, (LPARAM) & CharFormat);
return TRUE;
}
+ commonproc(hDlg, msg, wParam, lParam);
return FALSE;
}
SendDlgItemMessage (hDlg, IDC_CONTRIBUTORS, EM_SETCHARFORMAT, SCF_ALL, (LPARAM) & CharFormat);
return TRUE;
}
+ commonproc(hDlg, msg, wParam, lParam);
return FALSE;
}
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 = 10;
break;
recursive--;
break;
}
+ commonproc(hDlg, msg, wParam, lParam);
return FALSE;
}
recursive--;
break;
}
+ commonproc(hDlg, msg, wParam, lParam);
return FALSE;
}
recursive--;
break;
}
+ commonproc(hDlg, msg, wParam, lParam);
return FALSE;
}
break;
}
+ commonproc(hDlg, msg, wParam, lParam);
return FALSE;
}
recursive--;
break;
}
+ commonproc(hDlg, msg, wParam, lParam);
return FALSE;
}
break;
}
handlerawinput (hDlg, msg, wParam, lParam);
+ commonproc(hDlg, msg, wParam, lParam);
return FALSE;
}
recursive--;
break;
}
+ commonproc(hDlg, msg, wParam, lParam);
return FALSE;
}
HWND hDlg = guiDlg;
static HWND hwndTT;
static bool first = true;
- int w, h, x , y, i, pw, ph;
int fullpanel;
struct newresource *tres;
DestroyWindow (ToolTipHWND);
ToolTipHWND = NULL;
}
- for (i = 0; ToolTipHWNDS2[i].hwnd; i++) {
+ for (int i = 0; ToolTipHWNDS2[i].hwnd; i++) {
DestroyWindow (ToolTipHWNDS2[i].hwnd);
ToolTipHWNDS2[i].hwnd = NULL;
}
owner = GetDesktopWindow ();
if (gui_fullscreen) {
- x = y = 0;
+ x = gui_fullscreen_rect.left;
+ y = gui_fullscreen_rect.top;
} else {
if (isfullscreen () == 0) {
regqueryint (NULL, _T("GUIPosX"), &x);
return ret;
}
-#ifndef WM_DPICHANGED
-#define WM_DPICHANGED 0x02E0
-#endif
-
static int dialogreturn;
static int devicechangetimer = -1;
static INT_PTR CALLBACK DialogProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
case WM_DPICHANGED:
{
- if (!gui_size_changed && hGUIWnd != NULL) {
+ if (!gui_size_changed && hGUIWnd) {
int dx = LOWORD(wParam);
int dy = HIWORD(wParam);
RECT *const r = (RECT*)lParam;
case WM_MOVE:
move_box_art_window();
return TRUE;
+ case WM_SIZE:
+ if (!gui_size_changed && hGUIWnd && (wParam == SIZE_MAXIMIZED || wParam == SIZE_RESTORED)) {
+ getguisize(hDlg, &gui_width, &gui_height);
+ oldwidth = gui_width;
+ oldheight = gui_height;
+ saveguisize();
+ gui_size_changed = 1;
+ return 0;
+ }
+ break;
case WM_SIZING:
{
- close_box_art_window();
if (!recursive && gui_resize_enabled) {
RECT *r = (RECT*)lParam;
if (r->right - r->left < MIN_GUI_INTERNAL_WIDTH)
devicechangetimer = 0;
addnotifications (hDlg, TRUE, TRUE);
updatePanel (-1, 0);
- show_box_art(NULL);
+ show_box_art(NULL, NULL);
DestroyWindow(hDlg);
if (dialogreturn < 0) {
dialogreturn = 0;
}
int fmultx = 0, fmulty = 0;
+ bool boxart_reopen = false;
setdefaultguisize();
getstoredguisize();
scaleresource_setsize(-1, -1, -1);
if (first)
write_log (_T("Entering GUI idle loop\n"));
+ memset(&gui_fullscreen_rect, 0, sizeof(RECT));
if (gui_fullscreen) {
gui_width = GetSystemMetrics(SM_CXSCREEN);
gui_height = GetSystemMetrics(SM_CYSCREEN);
gui_height = h;
write_log(_T("GUI Fullscreen %dx%d\n"), gui_width, gui_height);
}
+ } else {
+ int x = 0, y = 0, w = 0, h = 0;
+ regqueryint(NULL, _T("GUIPosX"), &x);
+ regqueryint(NULL, _T("GUIPosY"), &y);
+ regqueryint(NULL, _T("GUISizeX"), &w);
+ regqueryint(NULL, _T("GUISizeY"), &h);
+ POINT pt;
+ pt.x = x + w / 2;
+ pt.y = y + h / 2;
+ HMONITOR mon = MonitorFromPoint(pt, MONITOR_DEFAULTTOPRIMARY);
+ MONITORINFO mi;
+ mi.cbSize = sizeof(mi);
+ if (GetMonitorInfo(mon, &mi)) {
+ RECT *r = &mi.rcWork;
+ gui_fullscreen_rect = *r;
+ gui_width = r->right - r->left;
+ gui_height = r->bottom - r->top;
+ }
}
scaleresource_setsize(gui_width, gui_height, 1);
int gw = gui_width;
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);
+ tres = scaleresource (panelresource, &maindctx, hwnd, gui_resize_enabled && gui_resize_allowed, gui_fullscreen, workprefs.win32_gui_alwaysontop || workprefs.win32_main_alwaysontop ? WS_EX_TOPMOST : 0, 0);
HWND phwnd = hwnd;
if (isfullscreen() == 0)
phwnd = 0;
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 (currentpage == LOADSAVE_ID) {
// update boxart
SendMessage(pages[LOADSAVE_ID], WM_USER + 1, 0, 0);
+ boxart_reopen = false;
+ }
+ if (boxart_reopen) {
+ reset_box_art_window();
+ boxart_reopen = false;
}
if (devicechangetimer < 0)
SetTimer(dhwnd, 4, 2000, NULL);
scaleresource_setsize(gui_width, gui_height, 0);
rescaleresource(tres, &maindctx, dhwnd, panelDlg);
gui_size_changed = 0;
+ reset_box_art_window();
+ } else {
+ close_box_art_window();
+ boxart_reopen = true;
}
}
if (gui_size_changed >= 10) {
if (resize > 0) {
d->style &= ~DS_MODALFRAME;
- d->style |= WS_THICKFRAME;
+ d->style |= WS_THICKFRAME | WS_MAXIMIZEBOX;
} else if (resize == 0) {
d->style |= DS_MODALFRAME;
d->style &= ~WS_THICKFRAME;
static int imagemode;
static bool imagemodereset;
static int lastimage;
-static TCHAR image_path[MAX_DPATH];
+static TCHAR image_path[MAX_DPATH], config_path[MAX_DPATH];
static int image_coords[MAX_VISIBLE_IMAGES + 1];
int max_visible_boxart_images = MAX_VISIBLE_IMAGES;
int stored_boxart_window_width = 400;
+int stored_boxart_window_width_fsgui = 33;
+int calculated_boxart_window_width;
+static int stored_boxart_window_height;
static void boxart_init(void)
{
static DWMGETWINDOWATTRIBUTE pDwmGetWindowAttribute;
static HMODULE dwmapihandle;
-static void getpos(RECT *r)
+extern int gui_fullscreen;
+
+void getextendedframebounds(HWND hwnd, RECT *r)
{
- RECT r1, r2;
+ r->left = r->right = 0;
+ r->top = r->bottom = 0;
if (!pDwmGetWindowAttribute && !dwmapihandle && os_vista) {
dwmapihandle = LoadLibrary(_T("dwmapi.dll"));
if (dwmapihandle)
pDwmGetWindowAttribute = (DWMGETWINDOWATTRIBUTE)GetProcAddress(dwmapihandle, "DwmGetWindowAttribute");
}
+ if (pDwmGetWindowAttribute) {
+ pDwmGetWindowAttribute(hwnd, DWMWA_EXTENDED_FRAME_BOUNDS, r, sizeof(RECT));
+ }
+}
+
+static void getpos(RECT *r)
+{
+ RECT r1, r2;
GetWindowRect(hGUIWnd, &r1);
- r2 = r1;
- if (pDwmGetWindowAttribute) {
- pDwmGetWindowAttribute(hGUIWnd, DWMWA_EXTENDED_FRAME_BOUNDS, &r2, sizeof(r2));
+ calculated_boxart_window_width = stored_boxart_window_width;
+ if (gui_fullscreen && stored_boxart_window_width_fsgui >= 10 && stored_boxart_window_width_fsgui <= 90) {
+ calculated_boxart_window_width = (r1.right - r1.left) * stored_boxart_window_width_fsgui / 100;
+ }
+
+ if (gui_fullscreen && (r1.right - r1.left) - calculated_boxart_window_width >= MIN_GUI_INTERNAL_WIDTH) {
+ HMONITOR mon = MonitorFromRect(&r1, MONITOR_DEFAULTTOPRIMARY);
+ MONITORINFO mi;
+ mi.cbSize = sizeof(mi);
+ if (GetMonitorInfo(mon, &mi)) {
+ RECT r = mi.rcWork;
+ if (r1.right + calculated_boxart_window_width > r.right) {
+ r1.right -= calculated_boxart_window_width - (r.right - r1.right);
+ SetWindowPos(hGUIWnd, NULL, r1.left, r1.top, r1.right - r1.left, r1.bottom - r1.top, SWP_NOZORDER | SWP_NOACTIVATE);
+ }
+ }
}
+ r2 = r1;
+ getextendedframebounds(hGUIWnd, &r2);
+
r->left = r1.right - ((r2.left - r1.left) + (r1.right - r2.right));
r->top = r1.top;
r->bottom = r1.bottom;
- r->right = r->left + stored_boxart_window_width;
+ r->right = r->left + calculated_boxart_window_width;
}
void move_box_art_window(void)
DWORD exstyle = GetWindowLong(hGUIWnd, GWL_EXSTYLE);
DWORD style = GetWindowLong(hGUIWnd, GWL_STYLE);
- style &= ~(WS_VISIBLE);
+ style &= ~(WS_VISIBLE | WS_MINIMIZEBOX | WS_MAXIMIZEBOX);
+ stored_boxart_window_height = r.bottom - r.top;
boxarthwnd = CreateWindowEx(exstyle | WS_EX_NOACTIVATE,
_T("BoxArt"), _T("WinUAE"),
style,
r.left, r.top,
- stored_boxart_window_width, r.bottom - r.top,
+ calculated_boxart_window_width, r.bottom - r.top,
hGUIWnd, NULL, hInst, NULL);
if (boxarthwnd) {
RECT r;
InsertMenu(menu, -1, MF_BYPOSITION, 1, _T("Open Game Folder"));
}
} else {
+ GetWindowRect(hGUIWnd, &r);
+ if (stored_boxart_window_height != r.bottom - r.top) {
+ stored_boxart_window_height = r.bottom - r.top;
+ SetWindowPos(boxarthwnd, HWND_TOPMOST, 0, 0, calculated_boxart_window_width, stored_boxart_window_height, SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOZORDER | SWP_NOMOVE);
+ GetClientRect(boxarthwnd, &r);
+ boxart_window_width = r.right - r.left;
+ boxart_window_height = r.bottom - r.top;
+ }
move_box_art_window();
}
extern int full_property_sheet;
-bool show_box_art(const TCHAR *path)
+bool show_box_art(const TCHAR *path, const TCHAR *configpath)
{
TCHAR tmp1[MAX_DPATH];
if (!open_box_art_window())
return false;
- if (path != image_path)
+ if (path != image_path) {
_tcscpy(image_path, path);
+ _tcscpy(config_path, configpath);
+ }
+
+ int len = _tcslen(config_path);
+ if (len > 4 && !_tcsicmp(config_path + len - 4, _T(".uae")))
+ config_path[len - 4] = 0;
+ if (_tcslen(config_path) > 0)
+ SetWindowText(boxarthwnd, config_path);
if (max_visible_boxart_images < 1 || max_visible_boxart_images > 3)
max_visible_boxart_images = 2;
{
max_visible_boxart_images = cnt;
regsetint(NULL, _T("ArtImageCount"), max_visible_boxart_images);
- show_box_art(image_path);
+ show_box_art(image_path, config_path);
+}
+
+void reset_box_art_window(void)
+{
+ if (!image_path[0])
+ return;
+ show_box_art(image_path, config_path);
}
LRESULT CALLBACK BoxArtWindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
return FALSE;
}
break;
+ case WM_DPICHANGED:
+ {
+ 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 FALSE;
+ }
+ break;
}
return DefWindowProc(hWnd, message, wParam, lParam);
}