win32: make custom rom dialog resizable, reactivate splitter

This commit is contained in:
OV2 2018-06-24 16:18:50 +02:00
parent 44eb9c7926
commit dfaae04670
3 changed files with 104 additions and 19 deletions

View File

@ -383,6 +383,11 @@
#define IDC_SLIDER_VOLUME_TURBO 3020
#define IDC_EDIT_VOLUME_TURBO 3021
#define IDC_STATIC_CONTAINER 3022
#define IDC_STATIC_MEMORY_TYPE 3023
#define IDC_STATIC_INTERLEAVE_MODE 3024
#define IDC_STATIC_VIDEO_SYSTEM 3025
#define IDC_STATIC_HEADER 3026
#define IDC_ROM_SPLITTER 3027
#define ID_FILE_EXIT 40001
#define ID_WINDOW_HIDEMENUBAR 40004
#define ID_FILE_AVI_RECORDING 40005
@ -530,9 +535,9 @@
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 158
#define _APS_NEXT_RESOURCE_VALUE 159
#define _APS_NEXT_COMMAND_VALUE 40178
#define _APS_NEXT_CONTROL_VALUE 3023
#define _APS_NEXT_CONTROL_VALUE 3028
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@ -124,11 +124,11 @@ BEGIN
END
IDD_OPEN_ROM DIALOGEX 0, 0, 430, 223
STYLE DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_CENTER | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CLIPCHILDREN | WS_CAPTION | WS_SYSMENU
STYLE DS_SETFONT | DS_SETFOREGROUND | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CLIPCHILDREN | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
CAPTION "Open ROM"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
CONTROL "Tree1",IDC_ROM_DIR,"SysTreeView32",TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | TVS_DISABLEDRAGDROP | TVS_SHOWSELALWAYS | TVS_NOTOOLTIPS | WS_BORDER | WS_TABSTOP,4,4,154,192,WS_EX_CLIENTEDGE
CONTROL "Tree1",IDC_ROM_DIR,"SysTreeView32",TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | TVS_DISABLEDRAGDROP | TVS_SHOWSELALWAYS | TVS_NOTOOLTIPS | WS_BORDER | WS_HSCROLL | WS_TABSTOP,4,4,154,192,WS_EX_CLIENTEDGE
CONTROL "List1",IDC_ROMLIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | LVS_OWNERDATA | WS_TABSTOP,161,4,266,192,WS_EX_CLIENTEDGE
COMBOBOX IDC_MEM_TYPE,5,208,66,57,CBS_DROPDOWNLIST | WS_TABSTOP
COMBOBOX IDC_INTERLEAVE,85,208,89,64,CBS_DROPDOWNLIST | WS_TABSTOP
@ -136,10 +136,10 @@ BEGIN
COMBOBOX IDC_HEADER,256,208,73,44,CBS_DROPDOWNLIST | WS_TABSTOP
DEFPUSHBUTTON "&Open ROM",IDOK,335,205,44,15
PUSHBUTTON "&Cancel",IDCANCEL,380,205,44,15
LTEXT "Interleave Mode:",IDC_STATIC,85,198,69,8,NOT WS_GROUP
LTEXT "Memory Type:",IDC_STATIC,5,198,58,10,NOT WS_GROUP
LTEXT "Video System:",IDC_STATIC,181,198,54,8,NOT WS_GROUP
LTEXT "Header:",IDC_STATIC,256,198,54,8,NOT WS_GROUP
LTEXT "Interleave Mode:",IDC_STATIC_INTERLEAVE_MODE,85,198,69,8,NOT WS_GROUP
LTEXT "Memory Type:",IDC_STATIC_MEMORY_TYPE,5,198,58,10,NOT WS_GROUP
LTEXT "Video System:",IDC_STATIC_VIDEO_SYSTEM,181,198,54,8,NOT WS_GROUP
LTEXT "Header:",IDC_STATIC_HEADER,256,198,54,8,NOT WS_GROUP
END
IDD_NPOPTIONS DIALOGEX 0, 0, 187, 161
@ -179,7 +179,7 @@ BEGIN
CONTROL "Stretch Image",IDC_STRETCH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,52,60,10
CONTROL "Maintain Aspect Ratio",IDC_ASPECT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,63,85,10
COMBOBOX IDC_ASPECTDROP,104,63,63,41,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "Integer Scaling", IDC_INTEGERSCALING, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 11, 74, 75, 10
CONTROL "Integer Scaling",IDC_INTEGERSCALING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,74,75,10
CONTROL "Bilinear Filtering",IDC_BILINEAR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,85,75,10
CONTROL "Show Frame Rate",IDC_SHOWFPS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,96,73,10
CONTROL "Automatic",IDC_AUTOFRAME,"Button",BS_AUTORADIOBUTTON,11,145,43,8
@ -190,7 +190,7 @@ BEGIN
CONTROL "",IDC_SPIN_MAX_SKIP_DISP_FIXED,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,169,158,11,13
COMBOBOX IDC_FILTERBOX,186,17,153,90,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_FILTERBOX2,217,33,122,90,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "NTSC Filter Scanlines", IDC_NTSCSCANLINES, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 186, 47, 85, 10
CONTROL "NTSC Filter Scanlines",IDC_NTSCSCANLINES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,186,47,85,10
LTEXT "Resolution",IDC_CURRMODE,187,76,41,8
COMBOBOX IDC_RESOLUTION,234,74,105,95,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "Enable Triple Buffering",IDC_DBLBUFFER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,88,87,10
@ -544,14 +544,15 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSM
CAPTION "Shader Paramaters"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "OK", IDOK, 144, 184, 50, 14
PUSHBUTTON "Cancel", IDCANCEL, 198, 184, 50, 14
LTEXT "", IDC_STATIC_CONTAINER, 7, 35, 282, 142, WS_BORDER
SCROLLBAR IDC_SCROLLBAR_PARAMS, 289, 35, 12, 142, SBS_VERT
PUSHBUTTON "Apply", IDAPPLY, 253, 184, 50, 14
LTEXT "Changing these parameters will create a new ""custom_shader_params.glslp"" file in the snes9x directory that contains the parameters and references to your currently loaded shader. This will then be used as your current OpenGL shader.", IDC_STATIC, 7, 7, 295, 28
DEFPUSHBUTTON "OK",IDOK,144,184,50,14
PUSHBUTTON "Cancel",IDCANCEL,198,184,50,14
LTEXT "",IDC_STATIC_CONTAINER,7,35,282,142,WS_BORDER
SCROLLBAR IDC_SCROLLBAR_PARAMS,289,35,12,142,SBS_VERT
PUSHBUTTON "Apply",IDAPPLY,253,184,50,14
LTEXT "Changing these parameters will create a new ""custom_shader_params.glslp"" file in the snes9x directory that contains the parameters and references to your currently loaded shader. This will then be used as your current OpenGL shader.",IDC_STATIC,7,7,295,28
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
@ -727,6 +728,11 @@ BEGIN
0
END
IDD_OPEN_ROM AFX_DIALOG_LAYOUT
BEGIN
0
END
/////////////////////////////////////////////////////////////////////////////
//

View File

@ -5954,6 +5954,71 @@ INT_PTR CALLBACK DlgMultiROMProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lPar
return false;
}
void MoveControlY(HWND hDlg, HWND hCtrl, unsigned int newY)
{
RECT ctrlRect;
GetWindowRect(hCtrl, &ctrlRect);
POINT pt;
pt.x = ctrlRect.left;
pt.y = ctrlRect.top;
ScreenToClient(hDlg, &pt);
MoveWindow(hCtrl, pt.x, newY, ctrlRect.right - ctrlRect.left, ctrlRect.bottom - ctrlRect.top, FALSE);
}
void MoveOpenRomWindows(HWND hDlg, unsigned int newWidth, int newHeight)
{
RECT rectRomList, rectDirList, rectSplitter, rectStatic, rectCombo, rectOk, rectCancel;
HWND romList = GetDlgItem(hDlg, IDC_ROMLIST);
HWND dirList = GetDlgItem(hDlg, IDC_ROM_DIR);
HWND splitter = GetDlgItem(hDlg, IDC_ROM_SPLITTER);
HWND memStatic = GetDlgItem(hDlg, IDC_STATIC_MEMORY_TYPE);
HWND memCombo = GetDlgItem(hDlg, IDC_MEM_TYPE);
HWND okButton = GetDlgItem(hDlg, IDOK);
HWND cancelButton = GetDlgItem(hDlg, IDCANCEL);
GetWindowRect(romList, &rectRomList);
GetWindowRect(dirList, &rectDirList);
GetWindowRect(splitter, &rectSplitter);
GetWindowRect(memStatic, &rectStatic);
GetWindowRect(memCombo, &rectCombo);
GetWindowRect(okButton, &rectOk);
GetWindowRect(cancelButton, &rectCancel);
unsigned int comboTop = newHeight - (rectCombo.bottom - rectCombo.top) - 5;
unsigned int staticTop = comboTop - (rectStatic.bottom - rectStatic.top);
unsigned int newListHeight = staticTop - 15;
POINT pt;
pt.x = rectRomList.left;
pt.y = rectRomList.top;
ScreenToClient(hDlg, &pt);
unsigned int newListWidth = newWidth - pt.x - 5;
unsigned int buttonTop = newHeight - (rectOk.bottom - rectOk.top) - 5;
unsigned int buttonLeft = newWidth - (rectOk.right - rectOk.left) - (rectCancel.right - rectCancel.left) - 5;
unsigned int buttonCancelLeft = buttonLeft + (rectOk.right - rectOk.left);
// only change width / height
SetWindowPos(romList, 0, 0, 0, newListWidth, newListHeight, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOREDRAW | SWP_NOZORDER);
SetWindowPos(dirList, 0, 0, 0, rectDirList.right - rectDirList.left, newListHeight, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOREDRAW | SWP_NOZORDER);
SetWindowPos(splitter, 0, 0, 0, rectSplitter.right - rectSplitter.left, newListHeight, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOREDRAW | SWP_NOZORDER);
// only change y pos
MoveControlY(hDlg, memStatic, staticTop);
MoveControlY(hDlg, GetDlgItem(hDlg, IDC_STATIC_INTERLEAVE_MODE), staticTop);
MoveControlY(hDlg, GetDlgItem(hDlg, IDC_STATIC_VIDEO_SYSTEM), staticTop);
MoveControlY(hDlg, GetDlgItem(hDlg, IDC_STATIC_HEADER), staticTop);
MoveControlY(hDlg, memCombo, comboTop);
MoveControlY(hDlg, GetDlgItem(hDlg, IDC_INTERLEAVE), comboTop);
MoveControlY(hDlg, GetDlgItem(hDlg, IDC_VIDEO_MODE), comboTop);
MoveControlY(hDlg, GetDlgItem(hDlg, IDC_HEADER), comboTop);
// only change position
SetWindowPos(okButton, 0, buttonLeft, buttonTop, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOREDRAW | SWP_NOZORDER);
SetWindowPos(cancelButton, 0, buttonCancelLeft, buttonTop, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOREDRAW | SWP_NOZORDER);
}
INT_PTR CALLBACK DlgOpenROMProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
int rv=0;
@ -5969,6 +6034,10 @@ INT_PTR CALLBACK DlgOpenROMProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lPara
static HWND dirList = NULL;
switch(msg)
{
case WM_SIZE:
MoveOpenRomWindows(hDlg, LOWORD(lParam), HIWORD(lParam));
RedrawWindow(hDlg, NULL, NULL, RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN);
break;
case WM_INITDIALOG:
WinRefreshDisplay();
{
@ -5991,8 +6060,8 @@ INT_PTR CALLBACK DlgOpenROMProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lPara
wcex.lpszClassName=tempclassname;
wcex.hbrBackground=(HBRUSH)GetStockObject(LTGRAY_BRUSH);
wcex.hCursor=LoadCursor(NULL, IDC_SIZEWE);
/// wcex.hCursor=LoadCursor(NULL, MAKEINTRESOURCE(IDC_SIZEWE));
/// ATOM aSplitter=RegisterClassEx(&wcex);
wcex.hCursor=LoadCursor(NULL, MAKEINTRESOURCE(IDC_SIZEWE));
ATOM aSplitter=RegisterClassEx(&wcex);
GetWindowRect(dirList, &treeRect);
GetWindowRect(romList, &listRect);
POINT p;
@ -6002,7 +6071,7 @@ INT_PTR CALLBACK DlgOpenROMProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lPara
p.x=treeRect.right;
p.y=treeRect.top;
ScreenToClient(hDlg, &p);
hSplit=CreateWindow(TEXT("S9xSplitter"), TEXT(""),WS_CHILD|WS_VISIBLE , p.x, p.y, listRect.left-treeRect.right , listRect.bottom-listRect.top, hDlg,NULL, g_hInst,0);
hSplit=CreateWindow(TEXT("S9xSplitter"), TEXT(""),WS_CHILD|WS_VISIBLE , p.x, p.y, listRect.left-treeRect.right , listRect.bottom-listRect.top, hDlg, (HMENU)IDC_ROM_SPLITTER, g_hInst,0);
LVCOLUMN col;
static const LPTSTR temp1 = ROM_COLUMN_FILENAME;
@ -6289,6 +6358,10 @@ INT_PTR CALLBACK DlgOpenROMProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lPara
nextInvalidatedROMCounter = 0;
SetTimer(hDlg,42,600,NULL);
RECT clientRect;
GetClientRect(hDlg, &clientRect);
PostMessage(hDlg, WM_SIZE, SIZE_RESTORED, MAKELPARAM(clientRect.right, clientRect.bottom));
return true; //true sets the keyboard focus, in case we need this elsewhere
}
case WM_TIMER:
@ -6734,6 +6807,7 @@ INT_PTR CALLBACK DlgOpenROMProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lPara
}
default:return false;
}
return false;
}
LRESULT CALLBACK DlgChildSplitProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{