return d3d->vblank;
}
+static void xD3D11_initvals(HWND ahwnd, int monid, int w_w, int w_h, int t_w, int t_h, int depth, int *freq, int mmulth, int mmultv)
+{
+ struct d3d11struct *d3d = &d3d11data[monid];
+
+ d3d->m_bitmapWidth = t_w;
+ d3d->m_bitmapHeight = t_h;
+ d3d->m_screenWidth = w_w;
+ d3d->m_screenHeight = w_h;
+ d3d->dmultxh = mmulth;
+ d3d->dmultxv = mmultv;
+}
+
static int xxD3D11_init2(HWND ahwnd, int monid, int w_w, int w_h, int t_w, int t_h, int depth, int *freq, int mmulth, int mmultv)
{
struct d3d11struct *d3d = &d3d11data[monid];
return 0;
}
- d3d->m_bitmapWidth = t_w;
- d3d->m_bitmapHeight = t_h;
- d3d->m_screenWidth = w_w;
- d3d->m_screenHeight = w_h;
+ xD3D11_initvals(ahwnd, monid, w_w, w_h, t_w, t_h, depth, freq, mmulth, mmultv);
+
d3d->ahwnd = ahwnd;
+
d3d->texformat = DXGI_FORMAT_B8G8R8A8_UNORM;
d3d->scrformat = DXGI_FORMAT_B8G8R8A8_UNORM;
- d3d->dmultxh = mmulth;
- d3d->dmultxv = mmultv;
HMONITOR winmon;
struct MultiDisplay *md = NULL;
*errp = 1;
return _T("D3D11 FAILED TO INIT");
}
- int v = xxD3D11_init(ahwnd, monid, w_w, w_h, depth, freq, mmulth, mmultv);
- if (v > 0) {
+ if (!D3D_isenabled(monid)) {
+ int v = xxD3D11_init(ahwnd, monid, w_w, w_h, depth, freq, mmulth, mmultv);
+ if (v > 0) {
+ return NULL;
+ }
+ xD3D11_free(monid, true);
+ *errp = 1;
+ if (v <= 0) {
+ return _T("");
+ }
+ return _T("D3D11 INITIALIZATION ERROR");
+ } else {
+ struct d3d11struct *d3d = &d3d11data[monid];
+ xD3D11_initvals(ahwnd, monid, w_w, w_h, w_w, w_h, depth, freq, mmulth, mmultv);
+ d3d->fsresizedo = true;
return NULL;
}
- xD3D11_free(monid, true);
- *errp = 1;
- if (v <= 0) {
- return _T("");
- }
- return _T("D3D11 INITIALIZATION ERROR");
}
static void setpsbuffer(struct d3d11struct *d3d, ID3D11Buffer *psbuffer)
{
struct gdistruct *gdi = &gdidata[monid];
- setupscenecoords(gdi, monid);
+ if (gdi->bm.hbm) {
+ setupscenecoords(gdi, monid);
+ }
return gdi->bm.hbm != NULL;
}
if (vidinfo->host_mode != vidinfo->ohost_mode || state->RGBFormat != vidinfo->orgbformat) {
write_log (_T("RTG conversion: Depth=%d HostRGBF=%d P96RGBF=%d Mode=%d/%d\n"),
picasso_vidinfo[monid].pixbytes, vidinfo->host_mode, state->RGBFormat, vidinfo->picasso_convert[0], vidinfo->picasso_convert[1]);
+ if (vidinfo->host_mode != vidinfo->ohost_mode && currprefs.win32_rtgmatchdepth) {
+ state->ModeChanged = true;
+ }
vidinfo->ohost_mode = vidinfo->host_mode;
vidinfo->orgbformat = state->RGBFormat;
}
gfx_set_picasso_modeinfo(monid, state->RGBFormat);
set_gc_called = 0;
}
+
if((vidinfo->width == state->Width) &&
(vidinfo->height == state->Height) &&
(vidinfo->depth == (state->GC_Depth >> 3)) &&
trap_put_long(ctx, AmigaBoardInfo + PSSO_BoardInfo_ModeInfo, modeinfo);
trap_put_word(ctx, AmigaBoardInfo + PSSO_BoardInfo_Border, border);
- state->Width = trap_get_word(ctx, modeinfo + PSSO_ModeInfo_Width);
+ uae_u16 w = trap_get_word(ctx, modeinfo + PSSO_ModeInfo_Width);
+ if (w != state->Width) {
+ state->ModeChanged = true;
+ }
+ state->Width = w;
state->VirtualWidth = state->Width; /* in case SetPanning doesn't get called */
- state->Height = trap_get_word(ctx, modeinfo + PSSO_ModeInfo_Height);
+ uae_u16 h = trap_get_word(ctx, modeinfo + PSSO_ModeInfo_Height);
+ if (h != state->Height) {
+ state->ModeChanged = true;
+ }
+ state->Height = h;
state->VirtualHeight = state->Height; /* in case SetPanning doesn't get called */
- state->GC_Depth = trap_get_byte(ctx, modeinfo + PSSO_ModeInfo_Depth);
+ uae_u8 d = trap_get_byte(ctx, modeinfo + PSSO_ModeInfo_Depth);
+ if (d != state->GC_Depth) {
+ state->ModeChanged = true;
+ }
+ state->GC_Depth = d;
state->GC_Flags = trap_get_byte(ctx, modeinfo + PSSO_ModeInfo_Flags);
state->HLineDBL = 1;
int XYOffset;
bool dualclut, advDragging;
int HLineDBL, VLineDBL;
+ bool ModeChanged;
};
extern void InitPicasso96(int monid);
COMBOBOX IDC_PORT3_JOYSSUB,16,190,24,130,CBS_DROPDOWNLIST | NOT WS_VISIBLE | WS_VSCROLL | WS_TABSTOP
END
-IDD_CONTRIBUTORS DIALOGEX 0, 0, 530, 345
-STYLE DS_LOCALEDIT | DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION
+IDD_CONTRIBUTORS DIALOGEX 0, 0, 398, 293
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_CENTERMOUSE | WS_POPUP | WS_VISIBLE | WS_CAPTION
CAPTION "UAE Authors and Contributors..."
FONT 8, "MS Sans Serif", 0, 0, 0x0
BEGIN
- DEFPUSHBUTTON "Ok",ID_OK,238,324,53,14
- CONTROL "",IDC_CONTRIBUTORS,"SysListView32",LVS_REPORT | LVS_ALIGNLEFT | LVS_NOSCROLL | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,10,7,510,312
+ DEFPUSHBUTTON "Ok",ID_OK,172,273,53,14
+ CONTROL "",IDC_CONTRIBUTORS,"SysListView32",LVS_REPORT | LVS_ALIGNLEFT | LVS_NOSCROLL | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,7,384,260
END
-IDD_ERRORLOG DIALOGEX 0, 0, 530, 345
-STYLE DS_LOCALEDIT | DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION
+IDD_ERRORLOG DIALOGEX 0, 0, 398, 293
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_CENTERMOUSE | WS_POPUP | WS_VISIBLE | WS_CAPTION
CAPTION "Configuration error log"
FONT 8, "MS Sans Serif", 0, 0, 0x0
BEGIN
- DEFPUSHBUTTON "OK",IDOK,176,322,65,15
- PUSHBUTTON "Clear log",IDC_ERRORLOGCLEAR,288,322,65,15
- CONTROL "",IDC_ERRORLOGMESSAGE,"SysListView32",LVS_REPORT | LVS_ALIGNLEFT | LVS_NOSCROLL | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,10,515,306
+ DEFPUSHBUTTON "OK",IDOK,125,269,65,15
+ PUSHBUTTON "Clear log",IDC_ERRORLOGCLEAR,208,269,65,15
+ CONTROL "",IDC_ERRORLOGMESSAGE,"SysListView32",LVS_REPORT | LVS_ALIGNLEFT | LVS_NOSCROLL | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,4,6,389,254
END
IDD_ABOUT DIALOGEX 0, 0, 396, 316
END
IDD_HARDFILE DIALOGEX 0, 0, 397, 292
-STYLE DS_LOCALEDIT | DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_CENTER | DS_CENTERMOUSE | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_CENTERMOUSE | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_ACCEPTFILES
CAPTION "Hardfile Settings"
FONT 8, "MS Sans Serif", 0, 0, 0x0
PUSHBUTTON "Eject",IDC_FS_SELECT_EJECT,258,90,62,15
END
-IDD_SETINFO DIALOGEX 0, 0, 397, 132
-STYLE DS_LOCALEDIT | DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_CENTER | DS_CENTERMOUSE | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+IDD_SETINFO DIALOGEX 0, 0, 397, 119
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_CENTERMOUSE | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Additional Information Settings"
FONT 8, "MS Sans Serif", 0, 0, 0x0
BEGIN
EDITTEXT IDC_CONFIGTAGS,46,74,249,15,ES_AUTOHSCROLL
CONTROL "Ignore link",IDC_CONFIGNOLINK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,305,37,58,12
CONTROL "Autoload",IDC_CONFIGAUTO,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,305,56,51,12
- PUSHBUTTON "OK",IDOK,146,102,48,15
- PUSHBUTTON "Cancel",IDCANCEL,201,102,48,15
+ PUSHBUTTON "OK",IDOK,147,97,48,15
+ PUSHBUTTON "Cancel",IDCANCEL,202,97,48,15
END
IDD_CHIPSET DIALOGEX 0, 0, 396, 316
PUSHBUTTON "Delete",IDC_FILTERPRESETDELETE,325,280,55,14
END
-IDD_HARDDRIVE DIALOGEX 0, 0, 397, 219
-STYLE DS_LOCALEDIT | DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_CENTER | DS_CENTERMOUSE | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+IDD_HARDDRIVE DIALOGEX 0, 0, 397, 208
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Harddrive Settings"
FONT 8, "MS Sans Serif", 0, 0, 0x0
BEGIN
END
IDD_PROGRESSBAR DIALOGEX 0, 0, 396, 58
-STYLE DS_LOCALEDIT | DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_CENTERMOUSE | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Processing..."
FONT 8, "MS Sans Serif", 0, 0, 0x0
BEGIN
COMBOBOX IDC_RTG_SCALE_ASPECTRATIO,282,227,84,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
END
-IDD_INPUTMAP DIALOGEX 0, 0, 421, 341
-STYLE DS_LOCALEDIT | DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+IDD_INPUTMAP DIALOGEX 0, 0, 421, 293
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_MODALFRAME | DS_CENTERMOUSE | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Input Remap"
FONT 8, "MS Sans Serif", 0, 0, 0x0
BEGIN
DEFPUSHBUTTON "OK",IDOK,147,51,58,14,NOT WS_VISIBLE
- CONTROL "",IDC_INPUTMAPLIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,1,1,418,257
- EDITTEXT IDC_INPUTMAPOUT,1,261,418,14,ES_AUTOHSCROLL | ES_READONLY | WS_DISABLED
- EDITTEXT IDC_INPUTMAPOUTM,1,277,418,29,ES_MULTILINE | ES_READONLY | WS_DISABLED
- COMBOBOX IDC_INPUTMAPADD,2,309,247,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
- PUSHBUTTON "Add Event",IDC_INPUTMAP_CUSTOM,253,308,79,14
- PUSHBUTTON "Autofire",IDC_INPUTMAP_SPECIALS,338,308,79,14
- PUSHBUTTON "Test",IDC_INPUTMAP_TEST,1,325,80,14
- PUSHBUTTON "Remap",IDC_INPUTMAP_CAPTURE,85,325,80,14
- PUSHBUTTON "Delete",IDC_INPUTMAP_DELETE,169,325,80,14
- PUSHBUTTON "Delete all",IDC_INPUTMAP_DELETEALL,253,325,80,14
- PUSHBUTTON "Exit",IDC_INPUTMAP_EXIT,338,325,79,14
+ CONTROL "",IDC_INPUTMAPLIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,1,1,418,206
+ EDITTEXT IDC_INPUTMAPOUT,1,211,418,14,ES_AUTOHSCROLL | ES_READONLY | WS_DISABLED
+ EDITTEXT IDC_INPUTMAPOUTM,1,227,418,29,ES_MULTILINE | ES_READONLY | WS_DISABLED
+ COMBOBOX IDC_INPUTMAPADD,2,259,247,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+ PUSHBUTTON "Add Event",IDC_INPUTMAP_CUSTOM,253,258,79,14
+ PUSHBUTTON "Autofire",IDC_INPUTMAP_SPECIALS,338,258,79,14
+ PUSHBUTTON "Test",IDC_INPUTMAP_TEST,1,275,80,14
+ PUSHBUTTON "Remap",IDC_INPUTMAP_CAPTURE,85,275,80,14
+ PUSHBUTTON "Delete",IDC_INPUTMAP_DELETE,169,275,80,14
+ PUSHBUTTON "Delete all",IDC_INPUTMAP_DELETEALL,253,275,80,14
+ PUSHBUTTON "Exit",IDC_INPUTMAP_EXIT,338,275,79,14
END
IDD_INFOBOX DIALOGEX 0, 0, 420, 68
-STYLE DS_LOCALEDIT | DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_MODALFRAME | DS_CENTERMOUSE | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Scanning ROM image files..."
FONT 8, "MS Sans Serif", 0, 0, 0x0
BEGIN
- DEFPUSHBUTTON "OK",IDOK,113,51,58,14,NOT WS_VISIBLE
- PUSHBUTTON "Cancel",IDCANCEL,180,51,58,14
+ DEFPUSHBUTTON "OK",IDOK,147,51,58,14,NOT WS_VISIBLE
+ PUSHBUTTON "Cancel",IDCANCEL,214,51,58,14
CTEXT "",IDC_INFOBOX_TEXT1,4,7,412,11,SS_CENTERIMAGE | SS_SUNKEN | WS_TABSTOP
CTEXT "",IDC_INFOBOX_TEXT2,4,21,412,11,SS_CENTERIMAGE | SS_SUNKEN | WS_TABSTOP
CTEXT "",IDC_INFOBOX_TEXT3,4,35,412,11,SS_CENTERIMAGE | SS_SUNKEN | WS_TABSTOP
END
IDD_LIST DIALOGEX 0, 0, 316, 206
-STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
+STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | DS_CENTERMOUSE | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Options"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
END
IDD_TAPEDRIVE DIALOGEX 0, 0, 395, 97
-STYLE DS_LOCALEDIT | DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_CENTER | DS_CENTERMOUSE | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_CENTERMOUSE | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Tape Drive Settings"
FONT 8, "MS Sans Serif", 0, 0, 0x0
BEGIN
END
IDD_DISKINFO DIALOGEX 0, 0, 491, 323
-STYLE DS_LOCALEDIT | DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_CENTERMOUSE | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Disk image information"
FONT 8, "MS Sans Serif", 0, 0, 0x0
BEGIN
END
IDD_CHSQUERY DIALOGEX 0, 0, 396, 85
-STYLE DS_LOCALEDIT | DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_CENTER | DS_CENTERMOUSE | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_CENTERMOUSE | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "CHS Geometry"
FONT 8, "MS Sans Serif", 0, 0, 0x0
BEGIN
#define _WIN32_WINNT 0x0A00
#include <windows.h>
+#include <windowsx.h>
#include <commctrl.h>
#include <commdlg.h>
#include <shellapi.h>
}
#endif
-static void resizing(struct AmigaMonitor *mon, WPARAM mode, RECT *r)
+static bool hasresizelimit(struct AmigaMonitor *mon)
+{
+ if (!mon->ratio_sizing || !mon->ratio_width || !mon->ratio_height)
+ return false;
+ return true;
+}
+
+static void doresizing(struct AmigaMonitor *mon, WPARAM mode, RECT *r)
{
int nw = (r->right - r->left) + mon->ratio_adjust_x;
int nh = (r->bottom - r->top) + mon->ratio_adjust_y;
- if (!mon->ratio_sizing || !mon->ratio_width || !mon->ratio_height)
+ if (!hasresizelimit(mon))
return;
if (mode == WMSZ_BOTTOM || mode == WMSZ_TOP) {
}
}
+static int canstretch(struct AmigaMonitor *mon)
+{
+ if (isfullscreen() != 0)
+ return 0;
+ if (!WIN32GFX_IsPicassoScreen(mon)) {
+ if (!currprefs.gfx_windowed_resize)
+ return 0;
+ if (currprefs.gf[GF_NORMAL].gfx_filter_autoscale == AUTOSCALE_RESIZE)
+ return 0;
+ return 1;
+ } else {
+ if (currprefs.win32_rtgallowscaling || currprefs.gf[GF_RTG].gfx_filter_autoscale)
+ return 1;
+ }
+ return 0;
+}
+
+static void getsizemove(AmigaMonitor *mon)
+{
+ mon->ratio_width = mon->amigawin_rect.right - mon->amigawinclip_rect.left;
+ mon->ratio_height = mon->amigawin_rect.bottom - mon->amigawinclip_rect.top;
+ mon->ratio_adjust_x = mon->ratio_width - (mon->mainwin_rect.right - mon->mainwin_rect.left);
+ mon->ratio_adjust_y = mon->ratio_height - (mon->mainwin_rect.bottom - mon->mainwin_rect.top);
+ mon->ratio_sizing = (GetAsyncKeyState(VK_CONTROL) & 0x8000) != 0;
+}
+
+static int setsizemove(AmigaMonitor *mon, HWND hWnd)
+{
+ if (isfullscreen() > 0)
+ return 0;
+ if (mon->in_sizemove > 0)
+ return 0;
+ int iconic = IsIconic(hWnd);
+ if (mon->hAmigaWnd && hWnd == mon->hMainWnd && !iconic) {
+ //write_log (_T("WM_WINDOWPOSCHANGED MAIN\n"));
+ GetWindowRect(mon->hMainWnd, &mon->mainwin_rect);
+ updatewinrect(mon, false);
+ updatemouseclip(mon);
+ if (minimized) {
+ unsetminimized(mon->monitor_id);
+ winuae_active(mon, mon->hAmigaWnd, minimized);
+ }
+ if (isfullscreen() == 0) {
+ static int store_xy;
+ RECT rc2;
+ if (GetWindowRect(mon->hMainWnd, &rc2)) {
+ DWORD left = rc2.left - mon->win_x_diff;
+ DWORD top = rc2.top - mon->win_y_diff;
+ DWORD width = rc2.right - rc2.left;
+ DWORD height = rc2.bottom - rc2.top;
+ if (store_xy++) {
+ if (!mon->monitor_id) {
+ regsetint(NULL, _T("MainPosX"), left);
+ regsetint(NULL, _T("MainPosY"), top);
+ } else {
+ TCHAR buf[100];
+ _stprintf(buf, _T("MainPosX_%d"), mon->monitor_id);
+ regsetint(NULL, buf, left);
+ _stprintf(buf, _T("MainPosY_%d"), mon->monitor_id);
+ regsetint(NULL, buf, top);
+ }
+ }
+ changed_prefs.gfx_monitor[mon->monitor_id].gfx_size_win.x = left;
+ changed_prefs.gfx_monitor[mon->monitor_id].gfx_size_win.y = top;
+ if (canstretch(mon)) {
+ int w = mon->mainwin_rect.right - mon->mainwin_rect.left;
+ int h = mon->mainwin_rect.bottom - mon->mainwin_rect.top;
+ if (w != changed_prefs.gfx_monitor[mon->monitor_id].gfx_size_win.width + mon->window_extra_width ||
+ h != changed_prefs.gfx_monitor[mon->monitor_id].gfx_size_win.height + mon->window_extra_height) {
+ changed_prefs.gfx_monitor[mon->monitor_id].gfx_size_win.width = w - mon->window_extra_width;
+ changed_prefs.gfx_monitor[mon->monitor_id].gfx_size_win.height = h - mon->window_extra_height;
+ set_config_changed();
+ }
+ if (mon->hStatusWnd)
+ SendMessage(mon->hStatusWnd, WM_SIZE, SIZE_RESTORED, MAKELONG(w, h));
+ }
+ }
+ return 0;
+ }
+ }
+ return 1;
+}
+
+static int HitTestToSizingEdge(WPARAM wHitTest)
+{
+ switch (wHitTest)
+ {
+ case HTLEFT: return WMSZ_LEFT;
+ case HTRIGHT: return WMSZ_RIGHT;
+ case HTTOP: return WMSZ_TOP;
+ case HTTOPLEFT: return WMSZ_TOPLEFT;
+ case HTTOPRIGHT: return WMSZ_TOPRIGHT;
+ case HTBOTTOM: return WMSZ_BOTTOM;
+ case HTBOTTOMLEFT: return WMSZ_BOTTOMLEFT;
+ case HTBOTTOMRIGHT: return WMSZ_BOTTOMRIGHT;
+ case HTCAPTION: return -1;
+ }
+ return 0;
+}
+
+static int inresizing;
+static int nSizingEdge;
+static POINT ptResizePos;
+static RECT rcResizeStartWindowRect;
+
+static void StartCustomResize(AmigaMonitor *mon, HWND hWindow, int nEdge, int x, int y)
+{
+ inresizing = TRUE;
+ SetCapture(hWindow);
+ nSizingEdge = nEdge;
+ ptResizePos.x = x;
+ ptResizePos.y = y;
+ GetWindowRect(hWindow, &rcResizeStartWindowRect);
+ getsizemove(mon);
+}
+
+static void CustomResizeMouseMove(AmigaMonitor *mon, HWND hWindow)
+{
+ POINT pt;
+ GetCursorPos(&pt);
+ if (pt.x != ptResizePos.x || pt.y != ptResizePos.y) {
+ RECT r;
+ GetWindowRect(hWindow, &r);
+ int x = r.left;
+ int y = r.top;
+ int w = r.right - r.left;
+ int h = r.bottom - r.top;
+ int dx = pt.x - ptResizePos.x;
+ int dy = pt.y - ptResizePos.y;
+ bool changed = true;
+ switch (nSizingEdge)
+ {
+ case WMSZ_TOP:
+ y = pt.y;
+ h -= dy;
+ break;
+ case WMSZ_BOTTOM:
+ h += dy;
+ break;
+ case WMSZ_LEFT:
+ x = pt.x;
+ w -= dx;
+ break;
+ case WMSZ_RIGHT:
+ w += dx;
+ break;
+ case WMSZ_TOPLEFT:
+ x = pt.x;
+ w -= dx;
+ y = pt.y;
+ h -= dy;
+ break;
+ case WMSZ_TOPRIGHT:
+ w += dx;
+ y = pt.y;
+ h -= dy;
+ break;
+ case WMSZ_BOTTOMLEFT:
+ x = pt.x;
+ w -= dx;
+ h += dy;
+ break;
+ case WMSZ_BOTTOMRIGHT:
+ w += dx;
+ h += dy;
+ break;
+ case -1:
+ x += dx;
+ y += dy;
+ break;
+ default:
+ changed = false;
+ break;
+ }
+ if (changed) {
+ RECT r2;
+ r2.left = x;
+ r2.top = y;
+ r2.right = x + w;
+ r2.bottom = y + h;
+ doresizing(mon, nSizingEdge, &r2);
+ SetWindowPos(hWindow, NULL, r2.left, r2.top, r2.right - r2.left, r2.bottom - r2.top, 0);
+ }
+ ptResizePos.x = pt.x;
+ ptResizePos.y = pt.y;
+ }
+}
+
+static void EndCustomResize(HWND hWindow, BOOL bCanceled)
+{
+ inresizing = false;
+ ReleaseCapture();
+ if (bCanceled) {
+ SetWindowPos(hWindow, NULL, rcResizeStartWindowRect.left, rcResizeStartWindowRect.top,
+ rcResizeStartWindowRect.right - rcResizeStartWindowRect.left, rcResizeStartWindowRect.bottom - rcResizeStartWindowRect.top,
+ SWP_NOZORDER | SWP_NOACTIVATE);
+ }
+}
+
+
#define MSGDEBUG 1
static LRESULT CALLBACK AmigaWindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
}
return 0;
case WM_SIZING:
- resizing(mon, wParam, (RECT*)lParam);
+ doresizing(mon, wParam, (RECT*)lParam);
return TRUE;
case WM_ACTIVATE:
//write_log(_T("WM_ACTIVATE %p %x\n"), hWnd, wParam);
case WM_KEYDOWN:
if (!hGUIWnd) {
- if (dinput_wmkey((uae_u32)lParam)) {
- inputdevice_add_inputcode(AKS_ENTERGUI, 1, NULL);
+ if (inresizing) {
+ if (wParam == VK_ESCAPE) {
+ EndCustomResize(hWnd, TRUE);
+ return 0;
+ }
+ } else {
+ if (dinput_wmkey((uae_u32)lParam)) {
+ inputdevice_add_inputcode(AKS_ENTERGUI, 1, NULL);
+ }
}
} else {
int scancode = (lParam >> 16) & 0xff;
return 0;
case WM_LBUTTONUP:
- if (!rp_mouseevent(-32768, -32768, 0, 1)) {
- if (dinput_winmouse() >= 0 && isfocus()) {
- if (log_winmouse)
- write_log(_T("WM_LBUTTONUP\n"));
- setmousebuttonstate(dinput_winmouse(), 0, 0);
+ if (inresizing) {
+ EndCustomResize(hWnd, FALSE);
+ return 0;
+ } else {
+ if (!rp_mouseevent(-32768, -32768, 0, 1)) {
+ if (dinput_winmouse() >= 0 && isfocus()) {
+ if (log_winmouse)
+ write_log(_T("WM_LBUTTONUP\n"));
+ setmousebuttonstate(dinput_winmouse(), 0, 0);
+ }
}
+ return 0;
}
- return 0;
+ break;
case WM_LBUTTONDOWN:
case WM_LBUTTONDBLCLK:
if (!rp_mouseevent(-32768, -32768, 1, 1)) {
case WM_MOUSEMOVE:
{
- int wm = dinput_winmouse();
-
- monitor_off = 0;
- if (!mouseinside) {
- //write_log(_T("mouseinside\n"));
- TRACKMOUSEEVENT tme = { 0 };
- mouseinside = true;
- tme.cbSize = sizeof tme;
- tme.dwFlags = TME_LEAVE;
- tme.hwndTrack = mon->hAmigaWnd;
- TrackMouseEvent(&tme);
- }
+ if (inresizing) {
+ CustomResizeMouseMove(mon, hWnd);
+ } else {
+ int wm = dinput_winmouse();
+
+ monitor_off = 0;
+ if (!mouseinside) {
+ //write_log(_T("mouseinside\n"));
+ TRACKMOUSEEVENT tme = { 0 };
+ mouseinside = true;
+ tme.cbSize = sizeof tme;
+ tme.dwFlags = TME_LEAVE;
+ tme.hwndTrack = mon->hAmigaWnd;
+ TrackMouseEvent(&tme);
+ }
- mx = (signed short)LOWORD(lParam);
- my = (signed short)HIWORD(lParam);
+ mx = (signed short)LOWORD(lParam);
+ my = (signed short)HIWORD(lParam);
- if (log_winmouse)
- write_log (_T("WM_MOUSEMOVE MON=%d NUM=%d ACT=%d FOCUS=%d CLIP=%d FS=%d %dx%d %dx%d\n"),
- mon->monitor_id, wm, mouseactive, focus, mon_cursorclipped, isfullscreen (), mx, my, mon->mouseposx, mon->mouseposy);
+ if (log_winmouse)
+ write_log (_T("WM_MOUSEMOVE MON=%d NUM=%d ACT=%d FOCUS=%d CLIP=%d FS=%d %dx%d %dx%d\n"),
+ mon->monitor_id, wm, mouseactive, focus, mon_cursorclipped, isfullscreen (), mx, my, mon->mouseposx, mon->mouseposy);
- if (rp_mouseevent(mx, my, -1, -1))
- return 0;
+ if (rp_mouseevent(mx, my, -1, -1))
+ return 0;
- mx -= mon->mouseposx;
- my -= mon->mouseposy;
+ mx -= mon->mouseposx;
+ my -= mon->mouseposy;
- if (recapture && isfullscreen() <= 0) {
- enablecapture(mon->monitor_id);
- return 0;
- }
+ if (recapture && isfullscreen() <= 0) {
+ enablecapture(mon->monitor_id);
+ return 0;
+ }
- if (wm < 0 && (istablet || currprefs.input_tablet >= TABLET_MOUSEHACK)) {
- /* absolute */
- setmousestate(0, 0, mx, 1);
- setmousestate(0, 1, my, 1);
- return 0;
- }
- if (wm >= 0) {
- if (istablet || currprefs.input_tablet >= TABLET_MOUSEHACK) {
+ if (wm < 0 && (istablet || currprefs.input_tablet >= TABLET_MOUSEHACK)) {
/* absolute */
- setmousestate(dinput_winmouse(), 0, mx, 1);
- setmousestate(dinput_winmouse(), 1, my, 1);
+ setmousestate(0, 0, mx, 1);
+ setmousestate(0, 1, my, 1);
return 0;
}
- if (!focus || !mouseactive)
- return DefWindowProc(hWnd, message, wParam, lParam);
- /* relative */
- int mxx = (mon->amigawinclip_rect.left - mon->amigawin_rect.left) + (mon->amigawinclip_rect.right - mon->amigawinclip_rect.left) / 2;
- int myy = (mon->amigawinclip_rect.top - mon->amigawin_rect.top) + (mon->amigawinclip_rect.bottom - mon->amigawinclip_rect.top) / 2;
- mx = mx - mxx;
- my = my - myy;
- setmousestate(dinput_winmouse(), 0, mx, 0);
- setmousestate(dinput_winmouse(), 1, my, 0);
- } else if (isfocus() < 0 && (istablet || currprefs.input_tablet >= TABLET_MOUSEHACK)) {
- setmousestate(0, 0, mx, 1);
- setmousestate(0, 1, my, 1);
- }
- if (mon_cursorclipped || mouseactive)
- setcursor(mon, LOWORD(lParam), HIWORD(lParam));
- return 0;
+ if (wm >= 0) {
+ if (istablet || currprefs.input_tablet >= TABLET_MOUSEHACK) {
+ /* absolute */
+ setmousestate(dinput_winmouse(), 0, mx, 1);
+ setmousestate(dinput_winmouse(), 1, my, 1);
+ return 0;
+ }
+ if (!focus || !mouseactive)
+ return DefWindowProc(hWnd, message, wParam, lParam);
+ /* relative */
+ int mxx = (mon->amigawinclip_rect.left - mon->amigawin_rect.left) + (mon->amigawinclip_rect.right - mon->amigawinclip_rect.left) / 2;
+ int myy = (mon->amigawinclip_rect.top - mon->amigawin_rect.top) + (mon->amigawinclip_rect.bottom - mon->amigawinclip_rect.top) / 2;
+ mx = mx - mxx;
+ my = my - myy;
+ setmousestate(dinput_winmouse(), 0, mx, 0);
+ setmousestate(dinput_winmouse(), 1, my, 0);
+ } else if (isfocus() < 0 && (istablet || currprefs.input_tablet >= TABLET_MOUSEHACK)) {
+ setmousestate(0, 0, mx, 1);
+ setmousestate(0, 1, my, 1);
+ }
+ if (mon_cursorclipped || mouseactive)
+ setcursor(mon, LOWORD(lParam), HIWORD(lParam));
+ return 0;
+ }
}
break;
return DefWindowProc (hWnd, message, wParam, lParam);
}
-static int canstretch(struct AmigaMonitor *mon)
-{
- if (isfullscreen () != 0)
- return 0;
- if (!WIN32GFX_IsPicassoScreen(mon)) {
- if (!currprefs.gfx_windowed_resize)
- return 0;
- if (currprefs.gf[GF_NORMAL].gfx_filter_autoscale == AUTOSCALE_RESIZE)
- return 0;
- return 1;
- } else {
- if (currprefs.win32_rtgallowscaling || currprefs.gf[GF_RTG].gfx_filter_autoscale)
- return 1;
- }
- return 0;
-}
-
static void plot (LPDRAWITEMSTRUCT lpDIS, int x, int y, int dx, int dy, int idx)
{
COLORREF rgb;
case WM_ENTERSIZEMOVE:
mon->in_sizemove++;
- mon->ratio_width = mon->amigawin_rect.right - mon->amigawinclip_rect.left;
- mon->ratio_height = mon->amigawin_rect.bottom - mon->amigawinclip_rect.top;
- mon->ratio_adjust_x = mon->ratio_width - (mon->mainwin_rect.right - mon->mainwin_rect.left);
- mon->ratio_adjust_y = mon->ratio_height - (mon->mainwin_rect.bottom - mon->mainwin_rect.top);
- mon->ratio_sizing = (GetAsyncKeyState(VK_CONTROL) & 0x8000) != 0;
+ getsizemove(mon);
break;
case WM_EXITSIZEMOVE:
case WM_WINDOWPOSCHANGED:
{
- if (isfullscreen () > 0)
- break;
- if (mon->in_sizemove > 0)
- break;
- int iconic = IsIconic (hWnd);
- if (mon->hAmigaWnd && hWnd == mon->hMainWnd && !iconic) {
- //write_log (_T("WM_WINDOWPOSCHANGED MAIN\n"));
- GetWindowRect(mon->hMainWnd, &mon->mainwin_rect);
- updatewinrect(mon, false);
- updatemouseclip(mon);
- if (minimized) {
- unsetminimized(mon->monitor_id);
- winuae_active(mon, mon->hAmigaWnd, minimized);
- }
- if (isfullscreen() == 0) {
- static int store_xy;
- RECT rc2;
- if (GetWindowRect (mon->hMainWnd, &rc2)) {
- DWORD left = rc2.left - mon->win_x_diff;
- DWORD top = rc2.top - mon->win_y_diff;
- DWORD width = rc2.right - rc2.left;
- DWORD height = rc2.bottom - rc2.top;
- if (store_xy++) {
- if (!mon->monitor_id) {
- regsetint(NULL, _T("MainPosX"), left);
- regsetint(NULL, _T("MainPosY"), top);
- } else {
- TCHAR buf[100];
- _stprintf(buf, _T("MainPosX_%d"), mon->monitor_id);
- regsetint(NULL, buf, left);
- _stprintf(buf, _T("MainPosY_%d"), mon->monitor_id);
- regsetint(NULL, buf, top);
- }
- }
- changed_prefs.gfx_monitor[mon->monitor_id].gfx_size_win.x = left;
- changed_prefs.gfx_monitor[mon->monitor_id].gfx_size_win.y = top;
- if (canstretch(mon)) {
- int w = mon->mainwin_rect.right - mon->mainwin_rect.left;
- int h = mon->mainwin_rect.bottom - mon->mainwin_rect.top;
- if (w != changed_prefs.gfx_monitor[mon->monitor_id].gfx_size_win.width + mon->window_extra_width ||
- h != changed_prefs.gfx_monitor[mon->monitor_id].gfx_size_win.height + mon->window_extra_height) {
- changed_prefs.gfx_monitor[mon->monitor_id].gfx_size_win.width = w - mon->window_extra_width;
- changed_prefs.gfx_monitor[mon->monitor_id].gfx_size_win.height = h - mon->window_extra_height;
- set_config_changed();
- }
- }
- }
- if (mon->hStatusWnd)
- SendMessage(mon->hStatusWnd, WM_SIZE, wParam, lParam);
- return 0;
- }
- }
+ setsizemove(mon, hWnd);
}
break;
}
break;
}
-
+
+ case WM_NCLBUTTONDOWN:
+ {
+ switch (wParam)
+ {
+ case HTLEFT:
+ case HTRIGHT:
+ case HTTOP:
+ case HTTOPLEFT:
+ case HTTOPRIGHT:
+ case HTBOTTOM:
+ case HTBOTTOMLEFT:
+ case HTBOTTOMRIGHT:
+ case HTCAPTION:
+ if (canstretch(mon)) {
+ SetForegroundWindow(hWnd);
+ StartCustomResize(mon, hWnd, HitTestToSizingEdge(wParam), GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
+ return 0;
+ }
+ break;
+ }
+ break;
+ }
+ case WM_CANCELMODE:
+ if (inresizing) {
+ EndCustomResize(hWnd, FALSE);
+ }
+ break;
+
default:
break;
}
if (scalemode == AUTOSCALE_INTEGER || scalemode == AUTOSCALE_INTEGER_AUTOSCALE) {
- int maxw = gmc->gfx_size.width;
- int maxh = gmc->gfx_size.height;
+ int maxw = isfullscreen() < 0 ? deskw : gmc->gfx_size.width;
+ int maxh = isfullscreen() < 0 ? deskh : gmc->gfx_size.height;
float mult = 1.0f;
bool ok = true;
#endif
#include "statusline.h"
#include "devices.h"
+#ifdef WITH_MIDIEMU
+#include "midiemu.h"
+#endif
#include "darkmode.h"
mon->in_sizemove = 0;
updatewinfsmode(mon->monitor_id, &currprefs);
-#ifdef D3D
- gfx_lock();
- D3D_free(mon->monitor_id, false);
- gfx_unlock();
-#endif
int init_round = 0;
ret = -2;
void gfx_set_picasso_modeinfo(int monid, RGBFTYPE rgbfmt)
{
struct AmigaMonitor *mon = &AMonitors[monid];
+ struct picasso96_state_struct *state = &picasso96_state[mon->monitor_id];
int need;
if (!mon->screen_is_picasso)
return;
if (need > 0) {
open_screen(mon);
} else if (need < 0) {
- struct picasso96_state_struct *state = &picasso96_state[mon->monitor_id];
struct winuae_currentmode *wc = &mon->currentmode;
- if (state->Width != wc->native_width || state->Width != wc->current_width ||
- state->Height != wc->native_height || state->Height != wc->current_height) {
+ if (state->ModeChanged) {
open_windows(mon, true, true);
}
}
+ state->ModeChanged = false;
#ifdef RETROPLATFORM
rp_set_hwnd(mon->hAmigaWnd);
#endif
if (mon->hStatusWnd) {
ShowWindow(mon->hStatusWnd, SW_HIDE);
DestroyWindow(mon->hStatusWnd);
+ mon->hStatusWnd = NULL;
}
if (currprefs.win32_statusbar == 0 || mon->monitor_id > 0)
return;
#endif
GetWindowRect (mon->hAmigaWnd, &r);
- int sbheight = currprefs.win32_statusbar ? getstatuswindowheight(mon->monitor_id, mon->hAmigaWnd) : 0;
+ int sbheight = currprefs.win32_statusbar && !currprefs.win32_borderless ? getstatuswindowheight(mon->monitor_id, mon->hAmigaWnd) : 0;
int dpi = getdpiforwindow(mon->hAmigaWnd);
x = r.left;
return 1;
}
+ gfx_lock();
+ D3D_free(mon->monitor_id, false);
+ gfx_unlock();
+
if (fsw && !borderless)
borderless = 1;
window_led_drives = 0;
mon->hMainWnd = NULL;
x = 0; y = 0;
- int sbheight = currprefs.win32_statusbar ? getstatuswindowheight(mon->monitor_id, NULL) : 0;
+ int sbheight = currprefs.win32_statusbar && !currprefs.win32_borderless ? getstatuswindowheight(mon->monitor_id, NULL) : 0;
if (borderless)
sbheight = cyborder = 0;
}
S2X_free(mon->monitor_id);
- for (int i = 0; i < MAX_AMIGAMONITORS; i++) {
- oldtex_w[i] = oldtex_h[i] = -1;
+ if (!D3D_isenabled(mon->monitor_id)) {
+ for (int i = 0; i < MAX_AMIGAMONITORS; i++) {
+ oldtex_w[i] = oldtex_h[i] = -1;
+ }
}
if (mon->currentmode.flags & DM_D3D) {
int fmh = mon->screen_is_picasso ? 1 : currprefs.gf[ad->gf_index].gfx_filter_filtermodeh + 1;
}
static const int defaultaspectratios[] = {
- 5, 4, 4, 3, 16, 10, 15, 9, 27, 16, 128, 75, 16, 9, 256, 135, 21, 9, 16, 3,
+ 5, 4, 4, 3, 16, 10, 15, 9, 27, 16, 128, 75, 16, 9, 256, 135, 21, 9, 32, 9, 16, 3,
-1
};
static int getaspectratioindex (int ar)
static INT_PTR commonproc2(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam, bool *handled)
{
+ if (dialog_inhibit) {
+ *handled = true;
+ return FALSE;
+ }
+
if (msg == WM_INITDIALOG) {
darkmode_initdialog(hDlg);
} else if (msg == WM_CTLCOLORDLG || msg == WM_CTLCOLORSTATIC) {
static INT_PTR commonproc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam, bool *handled)
{
*handled = false;
+
+ if (dialog_inhibit) {
+ *handled = true;
+ return FALSE;
+ }
+
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_PTR CALLBACK StringBoxDialogProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- if (dialog_inhibit)
- return 0;
-
bool handled;
INT_PTR v = commonproc(hDlg, msg, wParam, lParam, &handled);
if (handled) {
static HWND infoboxhwnd;
static INT_PTR CALLBACK InfoBoxDialogProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- if (dialog_inhibit)
- return 0;
-
bool handled;
INT_PTR v = commonproc(hDlg, msg, wParam, lParam, &handled);
if (handled) {
{
static int recursive = 0;
- if (dialog_inhibit)
- return 0;
-
bool handled;
INT_PTR v = commonproc(hDlg, msg, wParam, lParam, &handled);
if (handled) {
case IDOK:
customdialogactive = -1;
DestroyWindow(hDlg);
+ recursive = 0;
return TRUE;
case IDCANCEL:
customdialogactive = 0;
DestroyWindow(hDlg);
+ recursive = 0;
return TRUE;
case IDC_CONFIGAUTO:
if (configtypepanel > 0) {
static int recursive;
static struct ConfigStruct *config;
- if (dialog_inhibit)
- return 0;
-
bool handled;
INT_PTR vv = commonproc2(hDlg, msg, wParam, lParam, &handled);
if (handled) {
{
TCHAR *err;
- if (dialog_inhibit)
- return 0;
-
bool handled;
INT_PTR v = commonproc(hDlg, msg, wParam, lParam, &handled);
if (handled) {
static INT_PTR CALLBACK ContributorsProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- if (dialog_inhibit)
- return 0;
-
bool handled;
INT_PTR v = commonproc(hDlg, msg, wParam, lParam, &handled);
if (handled) {
int val, selpath = 0;
TCHAR tmp[MAX_DPATH];
- if (dialog_inhibit)
- return 0;
-
bool handled;
INT_PTR vv = commonproc2(hDlg, msg, wParam, lParam, &handled);
if (handled) {
static int doinit;
int val;
- if (dialog_inhibit)
- return 0;
-
bool handled;
INT_PTR vv = commonproc2(hDlg, msg, wParam, lParam, &handled);
if (handled) {
{
static HFONT font1, font2;
- if (dialog_inhibit)
- return 0;
-
bool handled;
INT_PTR vv = commonproc2(hDlg, msg, wParam, lParam, &handled);
if (handled) {
pages[ABOUT_ID] = hDlg;
currentpage = ABOUT_ID;
- if (!font1) {
- font1 = CreateFont(-getscaledfontsize(60), 0, 0, 0, 0,
- 0, FALSE, FALSE, DEFAULT_CHARSET, 0, 0,
- PROOF_QUALITY, FF_DONTCARE, _T("Segoe UI"));
- }
- if (!font2) {
- font2 = CreateFont(-getscaledfontsize(32), 0, 0, 0, 0,
- 0, FALSE, FALSE, DEFAULT_CHARSET, 0, 0,
- PROOF_QUALITY, FF_DONTCARE, _T("Segoe UI"));
- }
+ font1 = CreateFont(getscaledfontsize(60), 0, 0, 0, 0,
+ 0, FALSE, FALSE, DEFAULT_CHARSET, 0, 0,
+ PROOF_QUALITY, FF_DONTCARE, _T("Segoe UI"));
+ font2 = CreateFont(getscaledfontsize(32), 0, 0, 0, 0,
+ 0, FALSE, FALSE, DEFAULT_CHARSET, 0, 0,
+ PROOF_QUALITY, FF_DONTCARE, _T("Segoe UI"));
HWND hwnd = GetDlgItem(hDlg, IDC_RICHEDIT1);
SendMessage(hwnd, WM_SETFONT, (WPARAM)font1, 0);
hwnd = GetDlgItem(hDlg, urls[i].id);
SendMessage(hwnd, WM_SETFONT, (WPARAM)font2, 0);
SetWindowText(hwnd, urls[i].display);
- } break;
+ }
return TRUE;
}
case WM_COMMAND:
case WM_MOUSEMOVE:
url_handler(hDlg, msg, wParam, lParam);
break;
+ case WM_DESTROY:
+ DeleteObject(font1);
+ font1 = NULL;
+ DeleteObject(font2);
+ font2 = NULL;
+ break;
}
return FALSE;
{
static int recursive = 0;
- if (dialog_inhibit)
- return 0;
-
bool handled;
INT_PTR vv = commonproc2(hDlg, msg, wParam, lParam, &handled);
if (handled) {
static int recursive = 0;
TCHAR buffer[MAX_DPATH], tmp[MAX_DPATH];
- if (dialog_inhibit)
- return 0;
-
bool handled;
INT_PTR vv = commonproc2(hDlg, msg, wParam, lParam, &handled);
if (handled) {
static int recursive = 0;
TCHAR tmp[MAX_DPATH];
- if (dialog_inhibit)
- return 0;
-
bool handled;
INT_PTR vv = commonproc2(hDlg, msg, wParam, lParam, &handled);
if (handled) {
TCHAR tmp[MAX_DPATH];
static int recursive = 0;
- if (dialog_inhibit)
- return 0;
-
bool handled;
INT_PTR vv = commonproc2(hDlg, msg, wParam, lParam, &handled);
if (handled) {
static int recursive = 0;
static int enumerated;
- if (dialog_inhibit)
- return 0;
-
bool handled;
INT_PTR vv = commonproc2(hDlg, msg, wParam, lParam, &handled);
if (handled) {
static int recursive = 0;
static int selected = -1;
- if (dialog_inhibit)
- return 0;
-
bool handled;
INT_PTR vv = commonproc2(hDlg, msg, wParam, lParam, &handled);
if (handled) {
static int recursive = 0;
int v;
- if (dialog_inhibit)
- return 0;
-
bool handled;
INT_PTR vv = commonproc2(hDlg, msg, wParam, lParam, &handled);
if (handled) {
static int recursive;
TCHAR tmp[MAX_DPATH];
- if (dialog_inhibit)
- return 0;
-
bool handled;
INT_PTR vv = commonproc2(hDlg, msg, wParam, lParam, &handled);
if (handled) {
static int recursive = 0;
int idx;
- if (dialog_inhibit)
- return 0;
-
bool handled;
INT_PTR vv = commonproc2(hDlg, msg, wParam, lParam, &handled);
if (handled) {
int numdevs;
int card, i;
- if (dialog_inhibit)
- return 0;
-
bool handled;
INT_PTR vv = commonproc2(hDlg, msg, wParam, lParam, &handled);
if (handled) {
{
static int recursive = 0;
- if (dialog_inhibit)
- return 0;
-
bool handled;
INT_PTR v = commonproc(hDlg, msg, wParam, lParam, &handled);
if (handled) {
case IDOK:
customdialogactive = -1;
DestroyWindow(hDlg);
+ recursive = 0;
return TRUE;
case IDCANCEL:
customdialogactive = 0;
DestroyWindow(hDlg);
+ recursive = 0;
return TRUE;
}
}
int posn, readonly;
TCHAR tmp[MAX_DPATH];
- if (dialog_inhibit)
- return 0;
-
bool handled;
INT_PTR v = commonproc(hDlg, msg, wParam, lParam, &handled);
if (handled) {
case IDOK:
customdialogactive = -1;
DestroyWindow(hDlg);
+ recursive = 0;
return TRUE;
case IDCANCEL:
customdialogactive = 0;
DestroyWindow(hDlg);
+ recursive = 0;
return TRUE;
}
current_tapedlg.ci.readonly = !ischecked (hDlg, IDC_TAPE_RW);
static int recursive = 0;
int posn;
- if (dialog_inhibit)
- return 0;
-
bool handled;
INT_PTR v = commonproc(hDlg, msg, wParam, lParam, &handled);
if (handled) {
case IDOK:
customdialogactive = -1;
DestroyWindow(hDlg);
+ recursive = 0;
return TRUE;
case IDCANCEL:
customdialogactive = 0;
DestroyWindow(hDlg);
+ recursive = 0;
return TRUE;
case IDC_HDF_CONTROLLER:
posn = gui_get_string_cursor(hdmenutable, hDlg, IDC_HDF_CONTROLLER);
int v;
int *p;
- if (dialog_inhibit)
- return 0;
-
bool handled;
INT_PTR vv = commonproc(hDlg, msg, wParam, lParam, &handled);
if (handled) {
case IDOK:
customdialogactive = -1;
DestroyWindow(hDlg);
+ recursive = 0;
return TRUE;
case IDCANCEL:
customdialogactive = 0;
DestroyWindow(hDlg);
+ recursive = 0;
return TRUE;
case IDC_HDF_PHYSGEOMETRY:
current_hfdlg.ci.physical_geometry = ischecked(hDlg, IDC_HDF_PHYSGEOMETRY);
int posn;
static int oposn;
- if (dialog_inhibit)
- return 0;
-
bool handled;
INT_PTR vv = commonproc(hDlg, msg, wParam, lParam, &handled);
if (handled) {
case IDOK:
customdialogactive = -1;
DestroyWindow(hDlg);
+ recursive = 0;
return TRUE;
case IDCANCEL:
customdialogactive = 0;
DestroyWindow(hDlg);
+ recursive = 0;
return TRUE;
case IDC_HDF_PHYSGEOMETRY:
current_hfdlg.ci.physical_geometry = ischecked(hDlg, IDC_HDF_PHYSGEOMETRY);
/* harddisk parent view */
static INT_PTR CALLBACK HarddiskDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- if (dialog_inhibit)
- return 0;
-
bool handled;
INT_PTR vv = commonproc2(hDlg, msg, wParam, lParam, &handled);
if (handled) {
static TCHAR diskname[40] = { _T("") };
static int dropopen;
- if (dialog_inhibit)
- return 0;
-
bool handled;
INT_PTR vv = commonproc2(hDlg, msg, wParam, lParam, &handled);
if (handled) {
static int entry;
TCHAR tmp[MAX_DPATH];
- if (dialog_inhibit)
- return 0;
-
bool handled;
INT_PTR vv = commonproc2(hDlg, msg, wParam, lParam, &handled);
if (handled) {
xSendDlgItemMessage (hDlg, IDC_MIDIOUTLIST, CB_RESETCONTENT, 0, 0L);
xSendDlgItemMessage (hDlg, IDC_MIDIOUTLIST, CB_ADDSTRING, 0, (LPARAM)szNone.c_str());
for (port = 0; port < MAX_MIDI_PORTS && midioutportinfo[port]; port++) {
- xSendDlgItemMessage (hDlg, IDC_MIDIOUTLIST, CB_ADDSTRING, 0, (LPARAM)midioutportinfo[port]->name);
+ TCHAR *n = midioutportinfo[port]->label ? midioutportinfo[port]->label : midioutportinfo[port]->name;
+ xSendDlgItemMessage (hDlg, IDC_MIDIOUTLIST, CB_ADDSTRING, 0, (LPARAM)n);
}
ew (hDlg, IDC_MIDIOUTLIST, port > 0);
xSendDlgItemMessage (hDlg, IDC_MIDIINLIST, CB_RESETCONTENT, 0, 0L);
xSendDlgItemMessage (hDlg, IDC_MIDIINLIST, CB_ADDSTRING, 0, (LPARAM)szNone.c_str());
for (port = 0; port < MAX_MIDI_PORTS && midiinportinfo[port]; port++) {
- xSendDlgItemMessage (hDlg, IDC_MIDIINLIST, CB_ADDSTRING, 0, (LPARAM)midiinportinfo[port]->name);
+ TCHAR *n = midiinportinfo[port]->label ? midiinportinfo[port]->label : midiinportinfo[port]->name;
+ xSendDlgItemMessage (hDlg, IDC_MIDIINLIST, CB_ADDSTRING, 0, (LPARAM)n);
}
bNoMidiIn = port == 0;
ew (hDlg, IDC_MIDIINLIST, port > 0);
static int first;
int temp;
- if (dialog_inhibit)
- return 0;
-
bool handled;
INT_PTR vv = commonproc2(hDlg, msg, wParam, lParam, &handled);
if (handled) {
{
static int recursive = 0;
- if (dialog_inhibit)
- return 0;
-
bool handled;
INT_PTR vv = commonproc2(hDlg, msg, wParam, lParam, &handled);
if (handled) {
{
if (msg == WM_INPUT) {
handle_rawinput (lParam);
- DefWindowProc (hDlg, msg, wParam, lParam);
+ DefWindowProc(hDlg, msg, wParam, lParam);
}
}
case IDOK:
customdialogactive = -1;
DestroyWindow(hDlg);
+ recursive = 0;
return TRUE;
case IDCANCEL:
customdialogactive = 0;
DestroyWindow(hDlg);
+ recursive = 0;
return TRUE;
}
recursive--;
static INT_PTR CALLBACK InputMapDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- if (dialog_inhibit)
- return 0;
-
bool handled;
INT_PTR v = commonproc(hDlg, msg, wParam, lParam, &handled);
if (handled) {
static INT_PTR CALLBACK QualifierProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- if (dialog_inhibit)
- return 0;
-
bool handled;
INT_PTR v = commonproc(hDlg, msg, wParam, lParam, &handled);
if (handled) {
case IDOK:
customdialogactive = -1;
DestroyWindow(hDlg);
+ recursive = 0;
return TRUE;
case IDCANCEL:
customdialogactive = 0;
DestroyWindow(hDlg);
+ recursive = 0;
return TRUE;
}
recursive--;
int items = 0, entry = 0;
static int recursive;
- if (dialog_inhibit)
- return 0;
-
bool handled;
INT_PTR vv = commonproc2(hDlg, msg, wParam, lParam, &handled);
if (handled) {
static int filteroverlaypos = -1;
static bool firstinit;
- if (dialog_inhibit)
- return 0;
-
bool handled;
INT_PTR vv = commonproc2(hDlg, msg, wParam, lParam, &handled);
if (handled) {
static int recursive = 0;
TCHAR tmp[1000];
- if (dialog_inhibit)
- return 0;
-
bool handled;
INT_PTR vv = commonproc2(hDlg, msg, wParam, lParam, &handled);
if (handled) {
return ret;
}
+static int HitTestToSizingEdge(WPARAM wHitTest)
+{
+ switch (wHitTest)
+ {
+ case HTLEFT: return WMSZ_LEFT;
+ case HTRIGHT: return WMSZ_RIGHT;
+ case HTTOP: return WMSZ_TOP;
+ case HTTOPLEFT: return WMSZ_TOPLEFT;
+ case HTTOPRIGHT: return WMSZ_TOPRIGHT;
+ case HTBOTTOM: return WMSZ_BOTTOM;
+ case HTBOTTOMLEFT: return WMSZ_BOTTOMLEFT;
+ case HTBOTTOMRIGHT: return WMSZ_BOTTOMRIGHT;
+ }
+ return 0;
+}
+
+
+static bool gui_resizing;
+static int nSizingEdge;
+static POINT ptResizePos;
+static RECT rcResizeStartWindowRect;
+
+static void StartCustomResize(HWND hWindow, int nEdge, int x, int y)
+{
+ gui_resizing = TRUE;
+ SetCapture(hWindow);
+ nSizingEdge = nEdge;
+ ptResizePos.x = x;
+ ptResizePos.y = y;
+ GetWindowRect(hWindow, &rcResizeStartWindowRect);
+}
+
+static void CustomResizeMouseMove(HWND hWindow)
+{
+ POINT pt;
+ GetCursorPos(&pt);
+ if (pt.x != ptResizePos.x || pt.y != ptResizePos.y) {
+ int x = rcResizeStartWindowRect.left;
+ int y = rcResizeStartWindowRect.top;
+ int w, h;
+ int dx = pt.x - ptResizePos.x;
+ int dy = pt.y - ptResizePos.y;
+ getguisize(hWindow, &w, &h);
+ switch (nSizingEdge)
+ {
+ case WMSZ_TOP:
+ y = pt.y;
+ h -= dy;
+ gui_size_changed = -1;
+ break;
+ case WMSZ_BOTTOM:
+ h += dy;
+ gui_size_changed = -1;
+ break;
+ case WMSZ_LEFT:
+ x = pt.x;
+ w -= dx;
+ gui_size_changed = -1;
+ break;
+ case WMSZ_RIGHT:
+ w += dx;
+ gui_size_changed = -1;
+ break;
+ case WMSZ_TOPLEFT:
+ x = pt.x;
+ w -= dx;
+ y = pt.y;
+ h -= dy;
+ gui_size_changed = -1;
+ break;
+ case WMSZ_TOPRIGHT:
+ w += dx;
+ y = pt.y;
+ h -= dy;
+ gui_size_changed = -1;
+ break;
+ case WMSZ_BOTTOMLEFT:
+ x = pt.x;
+ w -= dx;
+ h += dy;
+ gui_size_changed = -1;
+ break;
+ case WMSZ_BOTTOMRIGHT:
+ w += dx;
+ h += dy;
+ gui_size_changed = -1;
+ break;
+ }
+ if (gui_size_changed < 0) {
+ gui_width = w;
+ gui_height = h;
+ SetWindowPos(hWindow, NULL, x, y,w, h, 0);
+ }
+ ptResizePos.x = pt.x;
+ ptResizePos.y = pt.y;
+ }
+}
+
+static void EndCustomResize(HWND hWindow, BOOL bCanceled)
+{
+ gui_resizing = false;
+ ReleaseCapture();
+ if (bCanceled) {
+ SetWindowPos(hWindow, NULL, rcResizeStartWindowRect.left, rcResizeStartWindowRect.top,
+ rcResizeStartWindowRect.right - rcResizeStartWindowRect.left, rcResizeStartWindowRect.bottom - rcResizeStartWindowRect.top,
+ SWP_NOZORDER | SWP_NOACTIVATE);
+ }
+}
+
static int dialogreturn;
static int devicechangetimer = -1;
static INT_PTR CALLBACK DialogProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
static int recursive = 0;
static int oldwidth, oldheight;
- if (dialog_inhibit)
- return 0;
-
bool handled;
INT_PTR vv = commonproc2(hDlg, msg, wParam, lParam, &handled);
if (handled) {
return FALSE;
}
break;
+
+ case WM_NCLBUTTONDOWN:
+ switch (wParam)
+ {
+ case HTLEFT:
+ case HTRIGHT:
+ case HTTOP:
+ case HTTOPLEFT:
+ case HTTOPRIGHT:
+ case HTBOTTOM:
+ case HTBOTTOMLEFT:
+ case HTBOTTOMRIGHT:
+ if (gui_resize_enabled)
+ {
+ SetForegroundWindow(hDlg);
+ StartCustomResize(hDlg, HitTestToSizingEdge(wParam), GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
+ return 0;
+ }
+ break;
+ }
+ break;
+
+ case WM_MOUSEMOVE:
+ if (gui_resizing)
+ {
+ CustomResizeMouseMove(hDlg);
+ }
+ break;
+ case WM_LBUTTONUP:
+ if (gui_resizing) {
+ EndCustomResize(hDlg, FALSE);
+ return 0;
+ }
+ break;
+ case WM_CANCELMODE:
+ if (gui_resizing) {
+ EndCustomResize(hDlg, FALSE);
+ }
+ break;
+ case WM_KEYDOWN:
+ if (gui_resizing && wParam == VK_ESCAPE)
+ {
+ EndCustomResize(hDlg, TRUE);
+ return 0;
+ }
+ break;
case WM_DEVICECHANGE:
{
DEV_BROADCAST_HDR *pBHdr = (DEV_BROADCAST_HDR *)lParam;
break;
}
}
- return 1;
+ return customdialogactive;
}
static int init_page (int tmpl, int icon, int title,
}
if (dialogreturn >= 0)
break;
- if (gui_size_changed > 0) {
+ if (gui_size_changed) {
saveguisize();
regsetint(NULL, _T("GUIResize"), gui_resize_enabled ? 1 : 0);
regsetint(NULL, _T("GUIFullscreen"), gui_fullscreen > 0 ? 1 : 0);
size.cy = res->height;
}
+ HMONITOR monitor = 0;
+ MONITORINFO mon_info;
+
if (tmpl->x == CW_USEDEFAULT16)
{
pos.x = pos.y = CW_USEDEFAULT;
}
else
{
- HMONITOR monitor = 0;
- MONITORINFO mon_info;
-
mon_info.cbSize = sizeof(mon_info);
if (tmpl->style & DS_CENTER)
{
}
}
+ if (tmpl->style & (DS_CENTER | DS_CENTERMOUSE)) {
+ POINT pos2 = pos;
+ pos2.x += size.cx / 2;
+ pos2.y += size.cy / 2;
+ monitor = MonitorFromPoint(pos, MONITOR_DEFAULTTOPRIMARY);
+ GetMonitorInfoW(monitor, &mon_info);
+ if (pos.x + size.cx > mon_info.rcWork.right) {
+ pos.x = mon_info.rcWork.right - size.cx;
+ }
+ if (pos.y + size.cy > mon_info.rcWork.bottom) {
+ pos.y = mon_info.rcWork.bottom - size.cy;
+ }
+ if (pos.x < mon_info.rcWork.left) {
+ pos.x = mon_info.rcWork.left;
+ }
+ if (pos.y < mon_info.rcWork.top) {
+ pos.y = mon_info.rcWork.top;
+ }
+ }
+
res->unitx = MulDiv(8, xBaseUnit, 4);
res->unity = MulDiv(8, yBaseUnit, 8);