Partial implemntattion fo new Display Menu
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@7816 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: 92bdda5565a283524d032d8b28f6cef44596ff76 Former-commit-id: cdb38d0af753f37e6e395344b1d1f1f3b82a1b95
This commit is contained in:
parent
111721b6a1
commit
1eeabd3da6
3 changed files with 84 additions and 262 deletions
|
@ -425,10 +425,6 @@ bool GfScrInitSDL2(int nWinWidth, int nWinHeight, int nFullScreen)
|
|||
std::string(GfParmGetStr(hparmScreen, pszScrPropSec, GFSCR_ATT_STEREOVISION,
|
||||
GFSCR_VAL_NO))
|
||||
== GFSCR_VAL_YES;
|
||||
bool bTryBestVInitMode =
|
||||
std::string(GfParmGetStr(hparmScreen, pszScrPropSec, GFSCR_ATT_VINIT,
|
||||
GFSCR_VAL_VINIT_BEST))
|
||||
== GFSCR_VAL_VINIT_BEST;
|
||||
|
||||
if(bFullScreen)
|
||||
bfVideoMode |= SDL_WINDOW_FULLSCREEN;
|
||||
|
@ -438,88 +434,6 @@ bool GfScrInitSDL2(int nWinWidth, int nWinHeight, int nFullScreen)
|
|||
// and setup GL Major/Minor before window creation
|
||||
// SDL_GL_SetSwapInterval(1) for for vsync (may have to go AFTER window creation)
|
||||
|
||||
if (bTryBestVInitMode)
|
||||
{
|
||||
GfLogInfo("Trying 'best possible mode' for video initialization.\n");
|
||||
|
||||
// Detect best supported features for the specified frame buffer specs.
|
||||
// Warning: Restarts the game if the frame buffer specs changed since last call.
|
||||
// If specified and possible, setup the best possible settings.
|
||||
if (GfglFeatures::self().checkBestSupport(nWinWidth, nWinHeight, nTotalDepth,
|
||||
bAlphaChannel, bFullScreen, bBumpMap, bStereo,nAniFilt,hparmScreen))
|
||||
{
|
||||
// Load Open GL user settings from the config file.
|
||||
GfglFeatures::self().loadSelection();
|
||||
|
||||
// Setup the video mode parameters.
|
||||
const int nColorDepth =
|
||||
GfglFeatures::self().getSelected(GfglFeatures::ColorDepth);
|
||||
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, nColorDepth/3);
|
||||
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, nColorDepth/3);
|
||||
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, nColorDepth/3);
|
||||
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, nColorDepth);
|
||||
|
||||
const int nAlphaDepth =
|
||||
GfglFeatures::self().getSelected(GfglFeatures::AlphaDepth);
|
||||
SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, nAlphaDepth);
|
||||
|
||||
const int nDoubleBuffer =
|
||||
GfglFeatures::self().isSelected(GfglFeatures::DoubleBuffer) ? 1 : 0;
|
||||
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, nDoubleBuffer);
|
||||
|
||||
const int nMultiSampling =
|
||||
GfglFeatures::self().isSelected(GfglFeatures::MultiSampling) ? 1 : 0;
|
||||
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, nMultiSampling);
|
||||
if (nMultiSampling)
|
||||
{
|
||||
const int nMaxMultiSamples =
|
||||
GfglFeatures::self().getSelected(GfglFeatures::MultiSamplingSamples);
|
||||
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, nMaxMultiSamples);
|
||||
}
|
||||
|
||||
const int nStereoVision =
|
||||
GfglFeatures::self().isSelected(GfglFeatures::StereoVision) ? 1 : 0;
|
||||
SDL_GL_SetAttribute(SDL_GL_STEREO, nStereoVision);
|
||||
|
||||
// Try the video mode with these parameters : should always work
|
||||
// (unless you downgraded you hardware / OS and didn't clear your config file).
|
||||
PScreenSurface = gfScrCreateWindow(nWinWidth, nWinHeight, nTotalDepth,bfVideoMode);
|
||||
}
|
||||
|
||||
// If best mode not supported, or test actually failed,
|
||||
// revert to a supported mode (restart the game).
|
||||
if (!PScreenSurface)
|
||||
{
|
||||
GfLogWarning("Failed to setup best supported video mode "
|
||||
"whereas previously detected !\n");
|
||||
GfLogWarning("Tip: You should remove your %s%s file and restart,\n",
|
||||
GfLocalDir(), GFSCR_CONF_FILE);
|
||||
GfLogWarning(" if something changed in your OS"
|
||||
" or video hardware/driver configuration.\n");
|
||||
|
||||
// If testing new screen specs, remember that the test failed
|
||||
// in order to revert to the previous validated specs on restart.
|
||||
if (std::string(pszScrPropSec) == GFSCR_SECT_INTESTPROPS)
|
||||
{
|
||||
GfParmSetStr(hparmScreen, pszScrPropSec, GFSCR_ATT_TESTSTATE,
|
||||
GFSCR_VAL_FAILED);
|
||||
}
|
||||
|
||||
// Force compatible video init. mode if not testing a new video mode.
|
||||
else
|
||||
{
|
||||
GfLogWarning("Falling back to a more compatible default mode ...\n");
|
||||
GfParmSetStr(hparmScreen, pszScrPropSec, GFSCR_ATT_VINIT,
|
||||
GFSCR_VAL_VINIT_COMPATIBLE);
|
||||
}
|
||||
GfParmWriteFile(NULL, hparmScreen, "Screen");
|
||||
GfParmReleaseHandle(hparmScreen);
|
||||
|
||||
// And restart the game.
|
||||
GfuiApp().restart(); // Never returns.
|
||||
}
|
||||
}
|
||||
|
||||
// Video initialization with generic compatible settings.
|
||||
if (!PScreenSurface)
|
||||
{
|
||||
|
@ -591,14 +505,10 @@ bool GfScrInitSDL2(int nWinWidth, int nWinHeight, int nFullScreen)
|
|||
|
||||
// If we get here, that's because we succeeded in getting a valid video mode :-)
|
||||
|
||||
// If 'compatible mode' selected, detect only standard Open GL features
|
||||
// and load OpenGL settings from the config file.
|
||||
if (!bTryBestVInitMode)
|
||||
{
|
||||
GfglFeatures::self().detectStandardSupport();
|
||||
GfglFeatures::self().dumpSupport();
|
||||
GfglFeatures::self().loadSelection();
|
||||
}
|
||||
GfglFeatures::self().detectStandardSupport();
|
||||
GfglFeatures::self().dumpSupport();
|
||||
GfglFeatures::self().loadSelection();
|
||||
|
||||
|
||||
// Save view geometry and screen center.
|
||||
GfViewWidth = nWinWidth;
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include <sstream>
|
||||
|
||||
#include <tgfclient.h>
|
||||
#include <graphic.h>
|
||||
|
||||
#include "legacymenu.h"
|
||||
#include "displayconfig.h"
|
||||
|
@ -29,8 +30,8 @@
|
|||
|
||||
// Some consts.
|
||||
static const char* ADisplayModes[DisplayMenu::nDisplayModes] = { "Full-screen", "Windowed" };
|
||||
static const char* AVideoDetectModes[DisplayMenu::nVideoDetectModes] = { "Auto", "Manual" };
|
||||
static const char* AVideoInitModes[DisplayMenu::nVideoInitModes] = { "Compatible", "Best possible" };
|
||||
static const char* MonitorTypes[DisplayMenu::nDisplayTypes] = { "None", "4:3", "16:9", "21:9" };
|
||||
static const char* SpansplitValues[] = { GR_VAL_NO, GR_VAL_YES };
|
||||
#ifndef NoMaxRefreshRate
|
||||
static const int AMaxRefreshRates[] = { 0, 30, 40, 50, 60, 75, 85, 100, 120, 150, 200 };
|
||||
static const int NMaxRefreshRates = sizeof(AMaxRefreshRates) / sizeof(AMaxRefreshRates[0]);
|
||||
|
@ -39,6 +40,9 @@ static const int NMaxRefreshRates = sizeof(AMaxRefreshRates) / sizeof(AMaxRefres
|
|||
// The unique DisplayMenu instance.
|
||||
static DisplayMenu* PDisplayMenu = 0;
|
||||
|
||||
static int sBezelCompID;
|
||||
static int sArcRatioID;
|
||||
|
||||
|
||||
// Call-backs ================================================================
|
||||
void DisplayMenu::onActivate(void *pDisplayMenu)
|
||||
|
@ -53,14 +57,6 @@ void DisplayMenu::onActivate(void *pDisplayMenu)
|
|||
pMenu->updateControls();
|
||||
}
|
||||
|
||||
void DisplayMenu::onChangeColorDepth(tComboBoxInfo *pInfo)
|
||||
{
|
||||
// Get the DisplayMenu instance from call-back user data.
|
||||
DisplayMenu* pMenu = static_cast<DisplayMenu*>(pInfo->userData);
|
||||
|
||||
pMenu->setColorDepthIndex(pInfo->nPos);
|
||||
}
|
||||
|
||||
void DisplayMenu::onChangeDisplayMode(tComboBoxInfo *pInfo)
|
||||
{
|
||||
// Get the DisplayMenu instance from call-back user data.
|
||||
|
@ -77,20 +73,33 @@ void DisplayMenu::onChangeScreenSize(tComboBoxInfo *pInfo)
|
|||
pMenu->setScreenSizeIndex(pInfo->nPos);
|
||||
}
|
||||
|
||||
void DisplayMenu::onChangeVideoDetectMode(tComboBoxInfo *pInfo)
|
||||
void DisplayMenu::onChangeMonitorType(tComboBoxInfo *pInfo)
|
||||
{
|
||||
// Get the DisplayMenu instance from call-back user data.
|
||||
DisplayMenu* pMenu = static_cast<DisplayMenu*>(pInfo->userData);
|
||||
|
||||
pMenu->setVideoDetectMode((EVideoDetectMode)pInfo->nPos);
|
||||
pMenu->setMonitorType((EDisplayType)pInfo->nPos);
|
||||
}
|
||||
|
||||
void DisplayMenu::onChangeVideoInitMode(tComboBoxInfo *pInfo)
|
||||
void DisplayMenu::onChangeArcRatio(void *pDisplayMenu)
|
||||
{
|
||||
// Get the DisplayMenu instance from call-back user data.
|
||||
DisplayMenu* pMenu = static_cast<DisplayMenu*>(pInfo->userData);
|
||||
printf("DisplayMenu::onChangeArcRatio() \n");
|
||||
DisplayMenu* pMenu = static_cast<DisplayMenu*>(pDisplayMenu);
|
||||
//printf("this = %p \n", this);
|
||||
printf("pMenu->getMenuHandle() = %p \n", pMenu->getMenuHandle());
|
||||
printf("PDisplayMenu->getMenuHandle() = %p \n", PDisplayMenu->getMenuHandle());
|
||||
|
||||
char* val = GfuiEditboxGetString(PDisplayMenu->getMenuHandle(), sArcRatioID);
|
||||
sscanf(val, "%g", &pMenu->_fArcRatio);
|
||||
if (PDisplayMenu->_fArcRatio > 2.0f)
|
||||
PDisplayMenu->_fArcRatio = 2.0f;
|
||||
else if (PDisplayMenu->_fArcRatio < 0.0f)
|
||||
PDisplayMenu->_fArcRatio = 0.0f;
|
||||
|
||||
char buf[32];
|
||||
sprintf(buf, "%g", PDisplayMenu->_fArcRatio);
|
||||
GfuiEditboxSetString(PDisplayMenu->getMenuHandle(), sArcRatioID, buf);
|
||||
|
||||
pMenu->setVideoInitMode((EVideoInitMode)pInfo->nPos);
|
||||
}
|
||||
|
||||
#ifndef NoMaxRefreshRate
|
||||
|
@ -133,18 +142,10 @@ void DisplayMenu::onCancel(void *pDisplayMenu)
|
|||
|
||||
void DisplayMenu::updateControls()
|
||||
{
|
||||
resetColorDepths();
|
||||
|
||||
int nControlId = getDynamicControlId("DisplayModeCombo");
|
||||
GfuiComboboxSetSelectedIndex(getMenuHandle(), nControlId, _eDisplayMode);
|
||||
|
||||
resetScreenSizes();
|
||||
|
||||
nControlId = getDynamicControlId("VideoDetectModeCombo");
|
||||
GfuiComboboxSetSelectedIndex(getMenuHandle(), nControlId, _eVideoDetectMode);
|
||||
|
||||
nControlId = getDynamicControlId("VideoInitModeCombo");
|
||||
GfuiComboboxSetSelectedIndex(getMenuHandle(), nControlId, _eVideoInitMode);
|
||||
|
||||
#ifndef NoMaxRefreshRate
|
||||
nControlId = getDynamicControlId("MaxRefreshRateCombo");
|
||||
|
@ -170,15 +171,6 @@ void DisplayMenu::loadSettings()
|
|||
const char* pszScrPropSec =
|
||||
GfParmExistsSection(hScrConfParams, GFSCR_SECT_INTESTPROPS)
|
||||
? GFSCR_SECT_INTESTPROPS : GFSCR_SECT_VALIDPROPS;
|
||||
|
||||
// Video detection mode : Auto or Manual.
|
||||
const char *pszVideoDetectMode =
|
||||
GfParmGetStr(hScrConfParams, pszScrPropSec, GFSCR_ATT_VDETECT, GFSCR_VAL_VDETECT_AUTO);
|
||||
_eVideoDetectMode =
|
||||
strcmp(pszVideoDetectMode, GFSCR_VAL_VDETECT_AUTO) ? eManual : eAuto;
|
||||
|
||||
// Color depth (bits per pixel, alpha included).
|
||||
_nColorDepth = (int)GfParmGetNum(hScrConfParams, pszScrPropSec, GFSCR_ATT_BPP, NULL, 32);
|
||||
|
||||
// Display mode : Full-screen or Windowed.
|
||||
const char *pszFullScreen =
|
||||
|
@ -188,12 +180,6 @@ void DisplayMenu::loadSettings()
|
|||
// Screen / window size.
|
||||
_nScreenWidth = (int)GfParmGetNum(hScrConfParams, pszScrPropSec, GFSCR_ATT_WIN_X, NULL, 800);
|
||||
_nScreenHeight = (int)GfParmGetNum(hScrConfParams, pszScrPropSec, GFSCR_ATT_WIN_Y, NULL, 600);
|
||||
|
||||
// Video initialization mode : Compatible or Best.
|
||||
const char *pszVideoInitMode =
|
||||
GfParmGetStr(hScrConfParams, pszScrPropSec, GFSCR_ATT_VINIT, GFSCR_VAL_VINIT_COMPATIBLE);
|
||||
_eVideoInitMode =
|
||||
strcmp(pszVideoInitMode, GFSCR_VAL_VINIT_COMPATIBLE) ? eBestPossible : eCompatible;
|
||||
|
||||
#ifndef NoMaxRefreshRate
|
||||
// Max. refresh rate (Hz).
|
||||
|
@ -219,29 +205,14 @@ void DisplayMenu::storeSettings() const
|
|||
|
||||
GfParmSetNum(hScrConfParams, GFSCR_SECT_INTESTPROPS, GFSCR_ATT_WIN_X, (char*)NULL, _nScreenWidth);
|
||||
GfParmSetNum(hScrConfParams, GFSCR_SECT_INTESTPROPS, GFSCR_ATT_WIN_Y, (char*)NULL, _nScreenHeight);
|
||||
GfParmSetNum(hScrConfParams, GFSCR_SECT_INTESTPROPS, GFSCR_ATT_BPP, (char*)NULL, _nColorDepth);
|
||||
#ifndef NoMaxRefreshRate
|
||||
GfParmSetNum(hScrConfParams, GFSCR_SECT_INTESTPROPS, GFSCR_ATT_MAXREFRESH, (char*)NULL, _nMaxRefreshRate);
|
||||
#endif
|
||||
|
||||
const char* pszVDetectMode =
|
||||
(_eVideoDetectMode == eAuto) ? GFSCR_VAL_VDETECT_AUTO : GFSCR_VAL_VDETECT_MANUAL;
|
||||
GfParmSetStr(hScrConfParams, GFSCR_SECT_INTESTPROPS, GFSCR_ATT_VDETECT, pszVDetectMode);
|
||||
|
||||
const char* pszVInitMode =
|
||||
(_eVideoInitMode == eCompatible) ? GFSCR_VAL_VINIT_COMPATIBLE : GFSCR_VAL_VINIT_BEST;
|
||||
GfParmSetStr(hScrConfParams, GFSCR_SECT_INTESTPROPS, GFSCR_ATT_VINIT, pszVInitMode);
|
||||
#endif
|
||||
|
||||
const char* pszDisplMode =
|
||||
(_eDisplayMode == eFullScreen) ? GFSCR_VAL_YES : GFSCR_VAL_NO;
|
||||
GfParmSetStr(hScrConfParams, GFSCR_SECT_INTESTPROPS, GFSCR_ATT_FSCR, pszDisplMode);
|
||||
|
||||
// Deselect anti-aliasing from the Open GL settings if 'compatible' mode selected
|
||||
// for the video initialization (anti-aliasing not supported in this mode).
|
||||
if (_eVideoInitMode == eCompatible)
|
||||
GfParmSetStr(hScrConfParams, GFSCR_SECT_GLSELFEATURES, GFSCR_ATT_MULTISAMPLING,
|
||||
GFSCR_ATT_MULTISAMPLING_DISABLED);
|
||||
|
||||
// Write and release screen config params file.
|
||||
GfParmWriteFile(NULL, hScrConfParams, "Screen");
|
||||
GfParmReleaseHandle(hScrConfParams);
|
||||
|
@ -257,59 +228,6 @@ void DisplayMenu::setDisplayMode(EDisplayMode eMode)
|
|||
}
|
||||
}
|
||||
|
||||
void DisplayMenu::setColorDepthIndex(int nIndex)
|
||||
{
|
||||
if (_nColorDepth != _aColorDepths[nIndex])
|
||||
{
|
||||
_nColorDepth = _aColorDepths[nIndex];
|
||||
|
||||
resetScreenSizes();
|
||||
}
|
||||
}
|
||||
|
||||
void DisplayMenu::resetColorDepths()
|
||||
{
|
||||
// Determine possible / supported color depths
|
||||
// (possible, or only supported ones, whether auto. or manual video features detection mode).
|
||||
int nDefColorDepths;
|
||||
int* aDefColorDepths = GfScrGetDefaultColorDepths(&nDefColorDepths);
|
||||
if (_aColorDepths && _aColorDepths != aDefColorDepths)
|
||||
free(_aColorDepths);
|
||||
if (_eVideoDetectMode == eAuto)
|
||||
_aColorDepths = GfScrGetSupportedColorDepths(&_nNbColorDepths);
|
||||
else
|
||||
{
|
||||
_aColorDepths = aDefColorDepths;
|
||||
_nNbColorDepths = nDefColorDepths;
|
||||
}
|
||||
|
||||
// Update combo-box with new possible color depths.
|
||||
const int nComboId = getDynamicControlId("ColorDepthCombo");
|
||||
GfuiComboboxClear(getMenuHandle(), nComboId);
|
||||
std::ostringstream ossColorDepth;
|
||||
for (int nColorDepthInd = 0; nColorDepthInd < _nNbColorDepths; nColorDepthInd++)
|
||||
{
|
||||
ossColorDepth.str("");
|
||||
ossColorDepth << _aColorDepths[nColorDepthInd];
|
||||
GfuiComboboxAddText(getMenuHandle(), nComboId, ossColorDepth.str().c_str());
|
||||
}
|
||||
|
||||
// Try and find the closest color depth to the current choice in the new list.
|
||||
int nColorDepthIndex = _nNbColorDepths-1; // Defaults to the max possible value.
|
||||
for (int nDepthInd = 0; nDepthInd < _nNbColorDepths; nDepthInd++)
|
||||
if (_nColorDepth == _aColorDepths[nDepthInd])
|
||||
{
|
||||
nColorDepthIndex = nDepthInd;
|
||||
break;
|
||||
}
|
||||
|
||||
// Store the new current color depth (in case it changed).
|
||||
_nColorDepth = _aColorDepths[nColorDepthIndex];
|
||||
|
||||
// Select the found one in the combo-box.
|
||||
GfuiComboboxSetSelectedIndex(getMenuHandle(), nComboId, nColorDepthIndex);
|
||||
}
|
||||
|
||||
void DisplayMenu::resetScreenSizes()
|
||||
{
|
||||
// Determine possible / supported screen sizes for the current display mode, color depth,
|
||||
|
@ -318,15 +236,16 @@ void DisplayMenu::resetScreenSizes()
|
|||
tScreenSize* aDefScreenSizes = GfScrGetDefaultSizes(&nDefScreenSizes);
|
||||
if (_aScreenSizes && _aScreenSizes != aDefScreenSizes)
|
||||
free(_aScreenSizes);
|
||||
if (_eVideoDetectMode == eAuto)
|
||||
_aScreenSizes =
|
||||
GfScrGetSupportedSizes(_nColorDepth, _eDisplayMode == eFullScreen, &_nNbScreenSizes);
|
||||
if (_eVideoDetectMode == eManual || _aScreenSizes == (tScreenSize*)-1 || _aScreenSizes == 0)
|
||||
|
||||
_aScreenSizes =
|
||||
GfScrGetSupportedSizes(32, _eDisplayMode == eFullScreen, &_nNbScreenSizes);
|
||||
if (_eDisplayMode != eFullScreen || _aScreenSizes == (tScreenSize*)-1 || _aScreenSizes == 0)
|
||||
{
|
||||
_aScreenSizes = aDefScreenSizes;
|
||||
_nNbScreenSizes = nDefScreenSizes;
|
||||
}
|
||||
|
||||
|
||||
// Update combo-box with new possible sizes.
|
||||
const int nComboId = getDynamicControlId("ScreenSizeCombo");
|
||||
GfuiComboboxClear(getMenuHandle(), nComboId);
|
||||
|
@ -377,20 +296,28 @@ void DisplayMenu::setScreenSizeIndex(int nIndex)
|
|||
_nScreenHeight = _aScreenSizes[nIndex].height;
|
||||
}
|
||||
|
||||
void DisplayMenu::setVideoDetectMode(EVideoDetectMode eMode)
|
||||
void DisplayMenu::setMonitorType(EDisplayType eType)
|
||||
{
|
||||
if (_eVideoDetectMode != eMode)
|
||||
if (_eDisplayType != eType)
|
||||
{
|
||||
_eVideoDetectMode = eMode;
|
||||
|
||||
resetColorDepths();
|
||||
resetScreenSizes();
|
||||
_eDisplayType = eType;
|
||||
}
|
||||
}
|
||||
|
||||
void DisplayMenu::setVideoInitMode(EVideoInitMode eMode)
|
||||
void DisplayMenu::setArcRatio(float ratio)
|
||||
{
|
||||
_eVideoInitMode = eMode;
|
||||
printf("DisplayMenu::setArcRatio() \n");
|
||||
printf("this = %p \n", this);
|
||||
|
||||
_fArcRatio = ratio;
|
||||
if (_fArcRatio > 2.0f)
|
||||
{
|
||||
_fArcRatio = 2.0f;
|
||||
}
|
||||
else if (_fArcRatio < 0.0f)
|
||||
{
|
||||
_fArcRatio = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef NoMaxRefreshRate
|
||||
|
@ -405,28 +332,21 @@ DisplayMenu::DisplayMenu()
|
|||
{
|
||||
_nNbScreenSizes = -1;
|
||||
_aScreenSizes = 0;
|
||||
|
||||
_nNbColorDepths = -1;
|
||||
_aColorDepths = 0;
|
||||
|
||||
_nColorDepth = 24;
|
||||
_eDisplayMode = eWindowed;
|
||||
_nScreenWidth = 800;
|
||||
_nScreenHeight = 600;
|
||||
_eVideoDetectMode = eAuto;
|
||||
_eVideoInitMode = eCompatible;
|
||||
_eDisplayType = eNone;
|
||||
_fArcRatio = 1.0f;
|
||||
_fBezelComp = 110.0f;
|
||||
_fScreenDist = 1.0f;
|
||||
#ifndef NoMaxRefreshRate
|
||||
_nMaxRefreshRate = 0;
|
||||
#endif
|
||||
printf("this = %p \n", this);
|
||||
}
|
||||
|
||||
DisplayMenu::~DisplayMenu()
|
||||
{
|
||||
int nDefColorDepths;
|
||||
int* aDefColorDepths = GfScrGetDefaultColorDepths(&nDefColorDepths);
|
||||
if (_aColorDepths && _aColorDepths != aDefColorDepths)
|
||||
free(_aColorDepths);
|
||||
|
||||
int nDefScreenSizes;
|
||||
tScreenSize* aDefScreenSizes = GfScrGetDefaultSizes(&nDefScreenSizes);
|
||||
if (_aScreenSizes && _aScreenSizes != aDefScreenSizes)
|
||||
|
@ -447,22 +367,25 @@ bool DisplayMenu::initialize(void *pPreviousMenu)
|
|||
|
||||
createComboboxControl("ScreenSizeCombo", this, onChangeScreenSize);
|
||||
|
||||
createComboboxControl("ColorDepthCombo", this, onChangeColorDepth);
|
||||
|
||||
const int nDisplayModeComboId =
|
||||
createComboboxControl("DisplayModeCombo", this, onChangeDisplayMode);
|
||||
|
||||
const int nDisplayTypeComboId =
|
||||
createComboboxControl("MonitorTypeCombo", this, onChangeMonitorType);
|
||||
|
||||
const int nSpanSplitsComboId =
|
||||
createComboboxControl("SpanSplitsCombo", this, NULL);
|
||||
|
||||
sBezelCompID = createEditControl("bezelcompedit", this, NULL, NULL);
|
||||
createEditControl("screendistedit", this, NULL, NULL);
|
||||
sArcRatioID = createEditControl("arcratioedit", this, NULL, onChangeArcRatio);
|
||||
|
||||
|
||||
#ifndef NoMaxRefreshRate
|
||||
const int nMaxRefRateComboId =
|
||||
createComboboxControl("MaxRefreshRateCombo", this, onChangeMaxRefreshRate);
|
||||
#endif
|
||||
|
||||
const int nVideoDetectComboId =
|
||||
createComboboxControl("VideoDetectModeCombo", this, onChangeVideoDetectMode);
|
||||
|
||||
const int nVideoInitComboId =
|
||||
createComboboxControl("VideoInitModeCombo", this, onChangeVideoInitMode);
|
||||
|
||||
createButtonControl("ApplyButton", this, onAccept);
|
||||
createButtonControl("CancelButton", this, onCancel);
|
||||
|
||||
|
@ -483,15 +406,13 @@ bool DisplayMenu::initialize(void *pPreviousMenu)
|
|||
for (int nDispModeInd = 0; nDispModeInd < nDisplayModes; nDispModeInd++)
|
||||
GfuiComboboxAddText(getMenuHandle(), nDisplayModeComboId, ADisplayModes[nDispModeInd]);
|
||||
|
||||
// 3) Video detection modes combo.
|
||||
for (int nVDetectModeInd = 0; nVDetectModeInd < nVideoDetectModes; nVDetectModeInd++)
|
||||
GfuiComboboxAddText(getMenuHandle(), nVideoDetectComboId, AVideoDetectModes[nVDetectModeInd]);
|
||||
// 3) Monitor type combo.
|
||||
for (int nDisplayTypeInd = 0; nDisplayTypeInd < nDisplayTypes; nDisplayTypeInd++)
|
||||
GfuiComboboxAddText(getMenuHandle(), nDisplayTypeComboId, MonitorTypes[nDisplayTypeInd]);
|
||||
|
||||
// 4) Video initialization modes combo.
|
||||
for (int nVInitModeInd = 0; nVInitModeInd < nVideoInitModes; nVInitModeInd++)
|
||||
GfuiComboboxAddText(getMenuHandle(), nVideoInitComboId, AVideoInitModes[nVInitModeInd]);
|
||||
for (int index = 0; index < 2; index++)
|
||||
GfuiComboboxAddText(getMenuHandle(), nSpanSplitsComboId, SpansplitValues[index]);
|
||||
|
||||
// 5) Screen sizes combo : not constant, as depends on selected color depth and display mode.
|
||||
|
||||
#ifndef NoMaxRefreshRate
|
||||
// 6) Max refresh rate combo.
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#define _DISPLAYCONFIG_H_
|
||||
|
||||
#include <tgfclient.h>
|
||||
#include <gui.h>
|
||||
|
||||
#include "confscreens.h"
|
||||
|
||||
|
@ -38,14 +39,13 @@ public:
|
|||
bool initialize(void* pPreviousMenu);
|
||||
|
||||
enum EDisplayMode { eFullScreen = 0, eWindowed = 1, nDisplayModes };
|
||||
enum EVideoDetectMode { eAuto = 0, eManual = 1, nVideoDetectModes };
|
||||
enum EVideoInitMode { eCompatible = 0, eBestPossible = 1, nVideoInitModes };
|
||||
enum EDisplayType { eNone = 0, e4by3, e16by9, e21by9, nDisplayTypes };
|
||||
enum ESpanSplit { eDisabled = 0, eEnabled = 1, nSpanSplits };
|
||||
|
||||
void setDisplayMode(EDisplayMode eMode);
|
||||
void setColorDepthIndex(int nIndex);
|
||||
void setScreenSizeIndex(int nIndex);
|
||||
void setVideoDetectMode(EVideoDetectMode eMode);
|
||||
void setVideoInitMode(EVideoInitMode eMode);
|
||||
void setMonitorType(EDisplayType eType);
|
||||
void setArcRatio(float ratio);
|
||||
#ifndef NoMaxRefreshRate
|
||||
void setMaxRefreshRateIndex(int nIndex);
|
||||
#endif
|
||||
|
@ -62,15 +62,13 @@ protected:
|
|||
// Control callback functions (must be static).
|
||||
static void onActivate(void *pDisplayMenu);
|
||||
static void onChangeScreenSize(tComboBoxInfo *pInfo);
|
||||
static void onChangeColorDepth(tComboBoxInfo *pInfo);
|
||||
static void onChangeDisplayMode(tComboBoxInfo *pInfo);
|
||||
static void onChangeVideoDetectMode(tComboBoxInfo *pInfo);
|
||||
static void onChangeVideoInitMode(tComboBoxInfo *pInfo);
|
||||
static void onChangeMonitorType(tComboBoxInfo *pInfo);
|
||||
static void onChangeArcRatio(void *pDisplayMenu);
|
||||
#ifndef NoMaxRefreshRate
|
||||
static void onChangeMaxRefreshRate(tComboBoxInfo *pInfo);
|
||||
#endif
|
||||
|
||||
static void onGarage(void *pDisplayMenu);
|
||||
static void onAccept(void *pDisplayMenu);
|
||||
static void onCancel(void *pDisplayMenu);
|
||||
|
||||
|
@ -80,25 +78,18 @@ private:
|
|||
int _nNbScreenSizes;
|
||||
tScreenSize* _aScreenSizes;
|
||||
|
||||
//! Possible color depths (bits per pixel).
|
||||
int _nNbColorDepths;
|
||||
int* _aColorDepths;
|
||||
|
||||
//! Currently selected color depth (inside _aColorDepths).
|
||||
int _nColorDepth;
|
||||
|
||||
//! Currently selected display mode.
|
||||
EDisplayMode _eDisplayMode;
|
||||
|
||||
//! Currently selected screen size.
|
||||
int _nScreenWidth;
|
||||
int _nScreenHeight;
|
||||
|
||||
//! Currently selected video features detection mode.
|
||||
EVideoDetectMode _eVideoDetectMode;
|
||||
|
||||
//! Currently selected video initialization mode.
|
||||
EVideoInitMode _eVideoInitMode;
|
||||
EDisplayType _eDisplayType;
|
||||
float _fArcRatio;
|
||||
float _fBezelComp;
|
||||
float _fScreenDist;
|
||||
|
||||
|
||||
#ifndef NoMaxRefreshRate
|
||||
//! Currently selected max. refresh rate (Hz).
|
||||
|
|
Loading…
Reference in a new issue