made sure dialogs fit into 2x zoom and 0.8 aspect ration (=512 pixel)

This commit is contained in:
thrust26 2018-01-31 15:24:20 +01:00
parent 87c59db4e0
commit 1c4345eff3
8 changed files with 54 additions and 16 deletions

View File

@ -28,7 +28,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ConfigPathDialog::ConfigPathDialog(
OSystem& osystem, DialogContainer& parent,
const GUI::Font& font, GuiObject* boss)
const GUI::Font& font, GuiObject* boss, int max_w, int max_h)
: Dialog(osystem, parent, font, "Configure paths"),
CommandSender(boss),
myFont(font),
@ -48,7 +48,7 @@ ConfigPathDialog::ConfigPathDialog(
ButtonWidget* b;
// Set real dimensions
_w = 64 * fontWidth + HBORDER*2;
_w = std::min(64 * fontWidth + HBORDER*2, max_w);
_h = 9 * (lineHeight + V_GAP) + VBORDER;
xpos = HBORDER; ypos = VBORDER;

View File

@ -35,7 +35,7 @@ class ConfigPathDialog : public Dialog, public CommandSender
{
public:
ConfigPathDialog(OSystem& osystem, DialogContainer& parent,
const GUI::Font& font, GuiObject* boss);
const GUI::Font& font, GuiObject* boss, int max_w, int max_h);
virtual ~ConfigPathDialog();
private:

View File

@ -30,6 +30,8 @@
#include "ContextMenu.hxx"
#include "PopUpWidget.hxx"
#include "Settings.hxx"
#include "Console.hxx"
#include "Vec.hxx"
@ -813,16 +815,20 @@ Widget* Dialog::TabFocus::getNewFocus()
bool Dialog::getResizableBounds(uInt32& w, uInt32& h) const
{
const GUI::Rect& r = instance().frameBuffer().imageRect();
bool ntsc = instance().console().about().InitialFrameRate == "60";
uInt32 aspect = instance().settings().getInt(ntsc ?"tia.aspectn" : "tia.aspectp");
if(r.width() <= FrameBuffer::kFBMinW || r.height() <= FrameBuffer::kFBMinH)
{
w = uInt32(0.8 * FrameBuffer::kTIAMinW) * 2;
w = uInt32(aspect * FrameBuffer::kTIAMinW) * 2 / 100;
h = FrameBuffer::kTIAMinH * 2;
return false;
}
else
{
w = std::max(uInt32(0.8 * r.width()), uInt32(FrameBuffer::kFBMinW));
h = std::max(uInt32(0.8 * r.height()), uInt32(FrameBuffer::kFBMinH));
w = std::max(uInt32(aspect * r.width() / 100), uInt32(FrameBuffer::kFBMinW));
h = std::max(uInt32(aspect * r.height() / 100), uInt32(FrameBuffer::kFBMinH));
return true;
}
}

View File

@ -37,6 +37,7 @@
#include "AboutDialog.hxx"
#include "OptionsDialog.hxx"
#include "Launcher.hxx"
#include "Settings.hxx"
#ifdef CHEATCODE_SUPPORT
#include "CheatCodeDialog.hxx"
@ -48,7 +49,8 @@
OptionsDialog::OptionsDialog(OSystem& osystem, DialogContainer& parent,
GuiObject* boss, int max_w, int max_h, stellaMode mode)
: Dialog(osystem, parent),
myMode(mode)
myMode(mode),
_boss(boss)
{
const GUI::Font& font = instance().frameBuffer().font();
initTitle(font, "Options");
@ -131,8 +133,8 @@ OptionsDialog::OptionsDialog(OSystem& osystem, DialogContainer& parent,
myAudioDialog = make_unique<AudioDialog>(osystem, parent, font);
myInputDialog = make_unique<InputDialog>(osystem, parent, font, max_w, max_h);
myUIDialog = make_unique<UIDialog>(osystem, parent, font);
mySnapshotDialog = make_unique<SnapshotDialog>(osystem, parent, font);
myConfigPathDialog = make_unique<ConfigPathDialog>(osystem, parent, font, boss);
mySnapshotDialog = make_unique<SnapshotDialog>(osystem, parent, font, max_w, max_h);
myConfigPathDialog = make_unique<ConfigPathDialog>(osystem, parent, font, boss, max_w, max_h);
myRomAuditDialog = make_unique<RomAuditDialog>(osystem, parent, font, max_w, max_h);
myGameInfoDialog = make_unique<GameInfoDialog>(osystem, parent, font, this);
#ifdef CHEATCODE_SUPPORT
@ -190,6 +192,15 @@ void OptionsDialog::handleCommand(CommandSender* sender, int cmd,
switch(cmd)
{
case kVidCmd:
// This dialog is resizable under certain conditions, so we need
// to re-create it as necessary
if(myMode != launcher)
{
uInt32 w = 0, h = 0;
getResizableBounds(w, h);
myVideoDialog = make_unique<VideoDialog>(instance(), parent(), instance().frameBuffer().font(), w, h);
}
myVideoDialog->open();
break;
@ -206,10 +217,29 @@ void OptionsDialog::handleCommand(CommandSender* sender, int cmd,
break;
case kSnapCmd:
// This dialog is resizable under certain conditions, so we need
// to re-create it as necessary
if(myMode != launcher)
{
uInt32 w = 0, h = 0;
getResizableBounds(w, h);
mySnapshotDialog = make_unique<SnapshotDialog>(instance(), parent(), instance().frameBuffer().font(), w, h);
}
mySnapshotDialog->open();
break;
case kCfgPathsCmd:
// This dialog is resizable under certain conditions, so we need
// to re-create it as necessary
if(myMode != launcher)
{
uInt32 w = 0, h = 0;
getResizableBounds(w, h);
myConfigPathDialog = make_unique<ConfigPathDialog>(instance(), parent(),
instance().frameBuffer().font(), _boss, w, h);
}
myConfigPathDialog->open();
break;

View File

@ -85,6 +85,8 @@ class OptionsDialog : public Dialog
// Indicates if this dialog is used for global (vs. in-game) settings
stellaMode myMode;
GuiObject* _boss;
enum {
kVidCmd = 'VIDO',
kAudCmd = 'AUDO',

View File

@ -26,7 +26,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SnapshotDialog::SnapshotDialog(OSystem& osystem, DialogContainer& parent,
const GUI::Font& font)
const GUI::Font& font, int max_w, int max_h)
: Dialog(osystem, parent, font, "Snapshot settings"),
myFont(font)
{
@ -43,7 +43,7 @@ SnapshotDialog::SnapshotDialog(OSystem& osystem, DialogContainer& parent,
ButtonWidget* b;
// Set real dimensions
_w = 64 * fontWidth + HBORDER * 2;
_w = std::min(max_w, 64 * fontWidth + HBORDER * 2);
_h = 10 * (lineHeight + 4) + VBORDER + _th;
xpos = HBORDER; ypos = VBORDER + _th;

View File

@ -34,7 +34,7 @@ class SnapshotDialog : public Dialog
{
public:
SnapshotDialog(OSystem& osystem, DialogContainer& parent,
const GUI::Font& font);
const GUI::Font& font, int max_w, int max_h);
virtual ~SnapshotDialog();
private:

View File

@ -55,8 +55,8 @@ VideoDialog::VideoDialog(OSystem& osystem, DialogContainer& parent,
VariantList items;
// Set real dimensions
_w = std::min(57 * fontWidth + HBORDER * 2, max_w);
_h = std::min((16-2) * (lineHeight + VGAP) + 14 + _th, max_h);
_w = std::min(55 * fontWidth + HBORDER * 2 + 8, max_w);
_h = std::min(14 * (lineHeight + VGAP) + 14 + _th, max_h);
// The tab widget
xpos = 2; ypos = 4;
@ -141,7 +141,7 @@ VideoDialog::VideoDialog(OSystem& osystem, DialogContainer& parent,
"(*) Requires application restart");
// Move over to the next column
xpos += myFrameRate->getWidth() + 28;
xpos += myFrameRate->getWidth() + 16;
ypos = VBORDER;
// Fullscreen
@ -236,7 +236,7 @@ VideoDialog::VideoDialog(OSystem& osystem, DialogContainer& parent,
CREATE_CUSTOM_SLIDERS(Fringe, "Fringing ");
CREATE_CUSTOM_SLIDERS(Bleed, "Bleeding ");
xpos += myTVContrast->getWidth() + 40;
xpos += myTVContrast->getWidth() + 30;
ypos = VBORDER;
lwidth = font.getStringWidth("Intensity ");