Win32: implement support for full-screen graphics window.

pull/200/head
whitequark 2017-02-06 15:09:09 +00:00
parent d77f617dc4
commit 2e15f60ef6
3 changed files with 26 additions and 7 deletions

View File

@ -61,6 +61,7 @@ Other new features:
* In expressions, numbers can contain the digit group separator, "_".
* The "=" key is bound to "Zoom In", like "+" key.
* The numpad decimal separator key is bound to "." regardless of locale.
* On Windows, full-screen mode is implemented.
Bugs fixed:
* A point in 3d constrained to any line whose length is free no longer

View File

@ -81,10 +81,8 @@ const GraphicsWindow::MenuEntry GraphicsWindow::menu[] = {
{ 1, NULL, Command::NONE, 0, TN, NULL },
{ 1, N_("Dimensions in &Inches"), Command::UNITS_INCHES, 0, TR, mView },
{ 1, N_("Dimensions in &Millimeters"), Command::UNITS_MM, 0, TR, mView },
#if defined(__unix__) || defined(__APPLE__)
{ 1, NULL, Command::NONE, 0, TN, NULL },
{ 1, N_("&Full Screen"), Command::FULL_SCREEN, C|F(11), TC, mView },
#endif
{ 0, N_("&New Group"), Command::NONE, 0, TN, NULL },
{ 1, N_("Sketch In &3d"), Command::GROUP_3D, S|'3', TN, mGrp },
@ -685,9 +683,7 @@ void GraphicsWindow::EnsureValidActives() {
CheckMenuByCmd(Command::SHOW_TOOLBAR, /*checked=*/SS.showToolbar);
CheckMenuByCmd(Command::PERSPECTIVE_PROJ, /*checked=*/SS.usePerspectiveProj);
CheckMenuByCmd(Command::SHOW_GRID,/*checked=*/SS.GW.showSnapGrid);
#if defined(__unix__) || defined(__APPLE__)
CheckMenuByCmd(Command::FULL_SCREEN, /*checked=*/FullScreenIsActive());
#endif
if(change) SS.ScheduleShowTW();
}

View File

@ -850,12 +850,34 @@ void SolveSpace::InvalidateGraphics()
void SolveSpace::ToggleFullScreen()
{
// Implement me
static WINDOWPLACEMENT wp;
wp.length = sizeof(wp);
DWORD dwStyle = GetWindowLong(GraphicsWnd, GWL_STYLE);
if(dwStyle & WS_OVERLAPPEDWINDOW) {
MONITORINFO mi;
mi.cbSize = sizeof(mi);
if(GetWindowPlacement(GraphicsWnd, &wp) &&
GetMonitorInfo(MonitorFromWindow(GraphicsWnd, MONITOR_DEFAULTTOPRIMARY), &mi)) {
SetWindowLong(GraphicsWnd, GWL_STYLE, dwStyle & ~WS_OVERLAPPEDWINDOW);
SetWindowPos(GraphicsWnd, HWND_TOP,
mi.rcMonitor.left, mi.rcMonitor.top,
mi.rcMonitor.right - mi.rcMonitor.left,
mi.rcMonitor.bottom - mi.rcMonitor.top,
SWP_NOOWNERZORDER | SWP_FRAMECHANGED);
}
} else {
SetWindowLong(GraphicsWnd, GWL_STYLE, dwStyle | WS_OVERLAPPEDWINDOW);
SetWindowPlacement(GraphicsWnd, &wp);
SetWindowPos(GraphicsWnd, NULL, 0, 0, 0, 0,
SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER |
SWP_NOOWNERZORDER | SWP_FRAMECHANGED);
}
}
bool SolveSpace::FullScreenIsActive()
{
// Implement me
return false;
return GetWindowLong(GraphicsWnd, GWL_STYLE) & WS_OVERLAPPEDWINDOW;
}
void SolveSpace::InvalidateText()