mirror of https://github.com/stella-emu/stella.git
Yet more OpenGL positioning fixes.
Fixed compile warning in converting integer values to hex strings in the debugger. The resulting code was actually causing crashes in the RIOT tab of the debugger. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1572 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
b62755ce70
commit
843c85c56b
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: CheatCodeDialog.cxx,v 1.20 2008-08-04 20:12:23 stephena Exp $
|
// $Id: CheatCodeDialog.cxx,v 1.21 2008-12-24 01:20:05 stephena Exp $
|
||||||
//
|
//
|
||||||
// Based on code from ScummVM - Scumm Interpreter
|
// Based on code from ScummVM - Scumm Interpreter
|
||||||
// Copyright (C) 2002-2004 The ScummVM project
|
// Copyright (C) 2002-2004 The ScummVM project
|
||||||
|
@ -124,12 +124,7 @@ void CheatCodeDialog::saveConfig()
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void CheatCodeDialog::addCheat()
|
void CheatCodeDialog::addCheat()
|
||||||
{
|
{
|
||||||
// Center input dialog over entire screen
|
myCheatInput->show(); // Center input dialog over entire screen
|
||||||
const GUI::Rect& screen = instance().frameBuffer().screenRect();
|
|
||||||
uInt32 x = (screen.width() - myCheatInput->getWidth()) >> 1;
|
|
||||||
uInt32 y = (screen.height() - myCheatInput->getHeight()) >> 1;
|
|
||||||
myCheatInput->show(x, y);
|
|
||||||
|
|
||||||
myCheatInput->setEditString("", 0);
|
myCheatInput->setEditString("", 0);
|
||||||
myCheatInput->setEditString("", 1);
|
myCheatInput->setEditString("", 1);
|
||||||
myCheatInput->setTitle("");
|
myCheatInput->setTitle("");
|
||||||
|
@ -148,12 +143,7 @@ void CheatCodeDialog::editCheat()
|
||||||
const string& name = list[idx]->name();
|
const string& name = list[idx]->name();
|
||||||
const string& code = list[idx]->code();
|
const string& code = list[idx]->code();
|
||||||
|
|
||||||
// Center input dialog over entire screen
|
myCheatInput->show(); // Center input dialog over entire screen
|
||||||
const GUI::Rect& screen = instance().frameBuffer().screenRect();
|
|
||||||
uInt32 x = (screen.width() - myCheatInput->getWidth()) >> 1;
|
|
||||||
uInt32 y = (screen.height() - myCheatInput->getHeight()) >> 1;
|
|
||||||
myCheatInput->show(x, y);
|
|
||||||
|
|
||||||
myCheatInput->setEditString(name, 0);
|
myCheatInput->setEditString(name, 0);
|
||||||
myCheatInput->setEditString(code, 1);
|
myCheatInput->setEditString(code, 1);
|
||||||
myCheatInput->setTitle("");
|
myCheatInput->setTitle("");
|
||||||
|
@ -171,12 +161,7 @@ void CheatCodeDialog::removeCheat()
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void CheatCodeDialog::addOneShotCheat()
|
void CheatCodeDialog::addOneShotCheat()
|
||||||
{
|
{
|
||||||
// Center input dialog over entire screen
|
myCheatInput->show(); // Center input dialog over entire screen
|
||||||
const GUI::Rect& screen = instance().frameBuffer().screenRect();
|
|
||||||
uInt32 x = (screen.width() - myCheatInput->getWidth()) >> 1;
|
|
||||||
uInt32 y = (screen.height() - myCheatInput->getHeight()) >> 1;
|
|
||||||
myCheatInput->show(x, y);
|
|
||||||
|
|
||||||
myCheatInput->setEditString("One-shot cheat", 0);
|
myCheatInput->setEditString("One-shot cheat", 0);
|
||||||
myCheatInput->setEditString("", 1);
|
myCheatInput->setEditString("", 1);
|
||||||
myCheatInput->setTitle("");
|
myCheatInput->setTitle("");
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: FrameBufferGL.cxx,v 1.122 2008-12-23 18:54:05 stephena Exp $
|
// $Id: FrameBufferGL.cxx,v 1.123 2008-12-24 01:20:06 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#ifdef DISPLAY_OPENGL
|
#ifdef DISPLAY_OPENGL
|
||||||
|
@ -246,6 +246,9 @@ bool FrameBufferGL::setVidMode(VideoMode& mode)
|
||||||
{
|
{
|
||||||
cerr << "setVidMode: w = " << mode.screen_w << ", h = " << mode.screen_h << endl;
|
cerr << "setVidMode: w = " << mode.screen_w << ", h = " << mode.screen_h << endl;
|
||||||
|
|
||||||
|
//mode.screen_w = 1600;
|
||||||
|
//mode.screen_h = 1000;
|
||||||
|
|
||||||
bool inUIMode =
|
bool inUIMode =
|
||||||
myOSystem->eventHandler().state() == EventHandler::S_LAUNCHER ||
|
myOSystem->eventHandler().state() == EventHandler::S_LAUNCHER ||
|
||||||
myOSystem->eventHandler().state() == EventHandler::S_DEBUGGER;
|
myOSystem->eventHandler().state() == EventHandler::S_DEBUGGER;
|
||||||
|
@ -295,7 +298,7 @@ cerr << "setVidMode: w = " << mode.screen_w << ", h = " << mode.screen_h << endl
|
||||||
// Now re-calculate the dimensions
|
// Now re-calculate the dimensions
|
||||||
mode.image_w = (Uint16) (stretchFactor * mode.image_w);
|
mode.image_w = (Uint16) (stretchFactor * mode.image_w);
|
||||||
mode.image_h = (Uint16) (stretchFactor * mode.image_h);
|
mode.image_h = (Uint16) (stretchFactor * mode.image_h);
|
||||||
// if(!fullScreen()) mode.screen_w = mode.image_w;
|
if(!fullScreen()) mode.screen_w = mode.image_w;
|
||||||
mode.image_x = (mode.screen_w - mode.image_w) >> 1;
|
mode.image_x = (mode.screen_w - mode.image_w) >> 1;
|
||||||
mode.image_y = (mode.screen_h - mode.image_h) >> 1;
|
mode.image_y = (mode.screen_h - mode.image_h) >> 1;
|
||||||
|
|
||||||
|
@ -758,15 +761,15 @@ void FBSurfaceGL::setHeight(uInt32 h)
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void FBSurfaceGL::translateCoords(Int32& x, Int32& y) const
|
void FBSurfaceGL::translateCoords(Int32& x, Int32& y) const
|
||||||
{
|
{
|
||||||
// TODO - this doesn't work if aspect ratio is used
|
#if 1
|
||||||
x -= myXOrig;
|
x = x - myXOrig;
|
||||||
y -= myYOrig;
|
y = y - myYOrig;
|
||||||
|
#else
|
||||||
/*
|
|
||||||
// Wow, what a mess :)
|
// Wow, what a mess :)
|
||||||
x = (Int32) ((x - myImageDim.x) / myWidthScaleFactor);
|
const GUI::Rect& image = myFB.imageRect();
|
||||||
y = (Int32) ((y - myImageDim.y) / myHeightScaleFactor);
|
x = (Int32) ((x - myXOrig - image.x()) / myWidthScaleFactor);
|
||||||
*/
|
y = (Int32) ((y - myXOrig - image.y()) / myHeightScaleFactor);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: Debugger.cxx,v 1.128 2008-05-30 19:07:55 stephena Exp $
|
// $Id: Debugger.cxx,v 1.129 2008-12-24 01:20:06 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#include "bspf.hxx"
|
#include "bspf.hxx"
|
||||||
|
@ -363,9 +363,9 @@ const string Debugger::run(const string& command)
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
const string Debugger::valueToString(int value, BaseFormat outputBase)
|
string Debugger::valueToString(int value, BaseFormat outputBase)
|
||||||
{
|
{
|
||||||
char rendered[32];
|
char buf[32];
|
||||||
|
|
||||||
if(outputBase == kBASE_DEFAULT)
|
if(outputBase == kBASE_DEFAULT)
|
||||||
outputBase = myParser->base();
|
outputBase = myParser->base();
|
||||||
|
@ -374,32 +374,34 @@ const string Debugger::valueToString(int value, BaseFormat outputBase)
|
||||||
{
|
{
|
||||||
case kBASE_2:
|
case kBASE_2:
|
||||||
if(value < 0x100)
|
if(value < 0x100)
|
||||||
sprintf(rendered, Debugger::to_bin_8(value));
|
Debugger::to_bin(value, 8, buf);
|
||||||
else
|
else
|
||||||
sprintf(rendered, Debugger::to_bin_16(value));
|
Debugger::to_bin(value, 16, buf);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kBASE_10:
|
case kBASE_10:
|
||||||
if(value < 0x100)
|
if(value < 0x100)
|
||||||
sprintf(rendered, "%3d", value);
|
sprintf(buf, "%3d", value);
|
||||||
else
|
else
|
||||||
sprintf(rendered, "%5d", value);
|
sprintf(buf, "%5d", value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kBASE_16_4:
|
case kBASE_16_4:
|
||||||
sprintf(rendered, Debugger::to_hex_4(value));
|
strcpy(buf, Debugger::to_hex_4(value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kBASE_16:
|
case kBASE_16:
|
||||||
default:
|
default:
|
||||||
if(value < 0x100)
|
if(value < 0x100)
|
||||||
sprintf(rendered, Debugger::to_hex_8(value));
|
sprintf(buf, "%02x", value);
|
||||||
|
else if(value < 0x10000)
|
||||||
|
sprintf(buf, "%04x", value);
|
||||||
else
|
else
|
||||||
sprintf(rendered, Debugger::to_hex_16(value));
|
sprintf(buf, "%08x", value);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return string(rendered);
|
return string(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: Debugger.hxx,v 1.96 2008-11-30 17:28:03 stephena Exp $
|
// $Id: Debugger.hxx,v 1.97 2008-12-24 01:20:06 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#ifndef DEBUGGER_HXX
|
#ifndef DEBUGGER_HXX
|
||||||
|
@ -70,7 +70,7 @@ typedef uInt16 (Debugger::*DEBUGGER_WORD_METHOD)();
|
||||||
for all debugging operations in Stella (parser, 6502 debugger, etc).
|
for all debugging operations in Stella (parser, 6502 debugger, etc).
|
||||||
|
|
||||||
@author Stephen Anthony
|
@author Stephen Anthony
|
||||||
@version $Id: Debugger.hxx,v 1.96 2008-11-30 17:28:03 stephena Exp $
|
@version $Id: Debugger.hxx,v 1.97 2008-12-24 01:20:06 stephena Exp $
|
||||||
*/
|
*/
|
||||||
class Debugger : public DialogContainer
|
class Debugger : public DialogContainer
|
||||||
{
|
{
|
||||||
|
@ -198,7 +198,7 @@ class Debugger : public DialogContainer
|
||||||
*/
|
*/
|
||||||
int stringToValue(const string& stringval)
|
int stringToValue(const string& stringval)
|
||||||
{ return myParser->decipher_arg(stringval); }
|
{ return myParser->decipher_arg(stringval); }
|
||||||
const string valueToString(int value, BaseFormat outputBase = kBASE_DEFAULT);
|
string valueToString(int value, BaseFormat outputBase = kBASE_DEFAULT);
|
||||||
|
|
||||||
/** Convenience methods to convert to/from base values */
|
/** Convenience methods to convert to/from base values */
|
||||||
static char* to_hex_4(int i)
|
static char* to_hex_4(int i)
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: RiotDebug.cxx,v 1.7 2008-11-02 16:46:05 stephena Exp $
|
// $Id: RiotDebug.cxx,v 1.8 2008-12-24 01:20:06 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
@ -53,13 +53,13 @@ const DebuggerState& RiotDebug::getState()
|
||||||
myState.TIMCLKS = timClocks();
|
myState.TIMCLKS = timClocks();
|
||||||
|
|
||||||
// Controller port pins
|
// Controller port pins
|
||||||
Controller& port0 = myConsole.controller(Controller::Left);
|
const Controller& port0 = myConsole.controller(Controller::Left);
|
||||||
myState.P0_PIN1 = port0.myDigitalPinState[Controller::One];
|
myState.P0_PIN1 = port0.myDigitalPinState[Controller::One];
|
||||||
myState.P0_PIN2 = port0.myDigitalPinState[Controller::Two];
|
myState.P0_PIN2 = port0.myDigitalPinState[Controller::Two];
|
||||||
myState.P0_PIN3 = port0.myDigitalPinState[Controller::Three];
|
myState.P0_PIN3 = port0.myDigitalPinState[Controller::Three];
|
||||||
myState.P0_PIN4 = port0.myDigitalPinState[Controller::Four];
|
myState.P0_PIN4 = port0.myDigitalPinState[Controller::Four];
|
||||||
myState.P0_PIN6 = port0.myDigitalPinState[Controller::Six];
|
myState.P0_PIN6 = port0.myDigitalPinState[Controller::Six];
|
||||||
Controller& port1 = myConsole.controller(Controller::Right);
|
const Controller& port1 = myConsole.controller(Controller::Right);
|
||||||
myState.P1_PIN1 = port1.myDigitalPinState[Controller::One];
|
myState.P1_PIN1 = port1.myDigitalPinState[Controller::One];
|
||||||
myState.P1_PIN2 = port1.myDigitalPinState[Controller::Two];
|
myState.P1_PIN2 = port1.myDigitalPinState[Controller::Two];
|
||||||
myState.P1_PIN3 = port1.myDigitalPinState[Controller::Three];
|
myState.P1_PIN3 = port1.myDigitalPinState[Controller::Three];
|
||||||
|
@ -92,13 +92,13 @@ void RiotDebug::saveOldState()
|
||||||
myOldState.TIMCLKS = timClocks();
|
myOldState.TIMCLKS = timClocks();
|
||||||
|
|
||||||
// Controller port pins
|
// Controller port pins
|
||||||
Controller& port0 = myConsole.controller(Controller::Left);
|
const Controller& port0 = myConsole.controller(Controller::Left);
|
||||||
myOldState.P0_PIN1 = port0.myDigitalPinState[Controller::One];
|
myOldState.P0_PIN1 = port0.myDigitalPinState[Controller::One];
|
||||||
myOldState.P0_PIN2 = port0.myDigitalPinState[Controller::Two];
|
myOldState.P0_PIN2 = port0.myDigitalPinState[Controller::Two];
|
||||||
myOldState.P0_PIN3 = port0.myDigitalPinState[Controller::Three];
|
myOldState.P0_PIN3 = port0.myDigitalPinState[Controller::Three];
|
||||||
myOldState.P0_PIN4 = port0.myDigitalPinState[Controller::Four];
|
myOldState.P0_PIN4 = port0.myDigitalPinState[Controller::Four];
|
||||||
myOldState.P0_PIN6 = port0.myDigitalPinState[Controller::Six];
|
myOldState.P0_PIN6 = port0.myDigitalPinState[Controller::Six];
|
||||||
Controller& port1 = myConsole.controller(Controller::Right);
|
const Controller& port1 = myConsole.controller(Controller::Right);
|
||||||
myOldState.P1_PIN1 = port1.myDigitalPinState[Controller::One];
|
myOldState.P1_PIN1 = port1.myDigitalPinState[Controller::One];
|
||||||
myOldState.P1_PIN2 = port1.myDigitalPinState[Controller::Two];
|
myOldState.P1_PIN2 = port1.myDigitalPinState[Controller::Two];
|
||||||
myOldState.P1_PIN3 = port1.myDigitalPinState[Controller::Three];
|
myOldState.P1_PIN3 = port1.myDigitalPinState[Controller::Three];
|
||||||
|
@ -314,7 +314,7 @@ string RiotDebug::toString()
|
||||||
{
|
{
|
||||||
// TODO: keyboard controllers?
|
// TODO: keyboard controllers?
|
||||||
|
|
||||||
const RiotState& state = (RiotState&) getState();
|
const RiotState& state = (RiotState&) getState();
|
||||||
const RiotState& oldstate = (RiotState&) getOldState();
|
const RiotState& oldstate = (RiotState&) getOldState();
|
||||||
string ret;
|
string ret;
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: ContextMenu.cxx,v 1.7 2008-12-23 18:54:05 stephena Exp $
|
// $Id: ContextMenu.cxx,v 1.8 2008-12-24 01:20:06 stephena Exp $
|
||||||
//
|
//
|
||||||
// Based on code from ScummVM - Scumm Interpreter
|
// Based on code from ScummVM - Scumm Interpreter
|
||||||
// Copyright (C) 2002-2004 The ScummVM project
|
// Copyright (C) 2002-2004 The ScummVM project
|
||||||
|
@ -98,12 +98,6 @@ void ContextMenu::show(uInt32 x, uInt32 y, int item)
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void ContextMenu::center()
|
void ContextMenu::center()
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
const GUI::Rect& screen = instance().frameBuffer().screenRect();
|
|
||||||
uInt32 x = (screen.width() - getWidth()) >> 1;
|
|
||||||
uInt32 y = (screen.height() - getHeight()) >> 1;
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Make sure the menu is exactly where it should be, in case the image
|
// Make sure the menu is exactly where it should be, in case the image
|
||||||
// offset has changed
|
// offset has changed
|
||||||
const GUI::Rect& image = instance().frameBuffer().imageRect();
|
const GUI::Rect& image = instance().frameBuffer().imageRect();
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: InputTextDialog.cxx,v 1.23 2008-12-23 18:54:05 stephena Exp $
|
// $Id: InputTextDialog.cxx,v 1.24 2008-12-24 01:20:06 stephena Exp $
|
||||||
//
|
//
|
||||||
// Based on code from ScummVM - Scumm Interpreter
|
// Based on code from ScummVM - Scumm Interpreter
|
||||||
// Copyright (C) 2002-2004 The ScummVM project
|
// Copyright (C) 2002-2004 The ScummVM project
|
||||||
|
@ -35,6 +35,7 @@ InputTextDialog::InputTextDialog(GuiObject* boss, const GUI::Font& font,
|
||||||
const StringList& labels)
|
const StringList& labels)
|
||||||
: Dialog(&boss->instance(), &boss->parent(), 0, 0, 16, 16),
|
: Dialog(&boss->instance(), &boss->parent(), 0, 0, 16, 16),
|
||||||
CommandSender(boss),
|
CommandSender(boss),
|
||||||
|
myEnableCenter(false),
|
||||||
myErrorFlag(false),
|
myErrorFlag(false),
|
||||||
myXOrig(0),
|
myXOrig(0),
|
||||||
myYOrig(0)
|
myYOrig(0)
|
||||||
|
@ -97,11 +98,22 @@ InputTextDialog::~InputTextDialog()
|
||||||
myInput.clear();
|
myInput.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void InputTextDialog::show()
|
||||||
|
{
|
||||||
|
// Make sure position is set *after* the dialog is added, since the surface
|
||||||
|
// may not exist before then
|
||||||
|
myEnableCenter = true;
|
||||||
|
parent().addDialog(this);
|
||||||
|
center();
|
||||||
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void InputTextDialog::show(uInt32 x, uInt32 y)
|
void InputTextDialog::show(uInt32 x, uInt32 y)
|
||||||
{
|
{
|
||||||
// Make sure position is set *after* the dialog is added, since the surface
|
// Make sure position is set *after* the dialog is added, since the surface
|
||||||
// may not exist before then
|
// may not exist before then
|
||||||
|
myEnableCenter = false;
|
||||||
parent().addDialog(this);
|
parent().addDialog(this);
|
||||||
myXOrig = x;
|
myXOrig = x;
|
||||||
myYOrig = y;
|
myYOrig = y;
|
||||||
|
@ -111,17 +123,22 @@ void InputTextDialog::show(uInt32 x, uInt32 y)
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void InputTextDialog::center()
|
void InputTextDialog::center()
|
||||||
{
|
{
|
||||||
// Make sure the menu is exactly where it should be, in case the image
|
if(!myEnableCenter)
|
||||||
// offset has changed
|
{
|
||||||
const GUI::Rect& image = instance().frameBuffer().imageRect();
|
// Make sure the menu is exactly where it should be, in case the image
|
||||||
uInt32 x = image.x() + myXOrig;
|
// offset has changed
|
||||||
uInt32 y = image.y() + myYOrig;
|
const GUI::Rect& image = instance().frameBuffer().imageRect();
|
||||||
uInt32 tx = image.x() + image.width();
|
uInt32 x = image.x() + myXOrig;
|
||||||
uInt32 ty = image.y() + image.height();
|
uInt32 y = image.y() + myYOrig;
|
||||||
if(x + _w > tx) x -= (x + _w - tx);
|
uInt32 tx = image.x() + image.width();
|
||||||
if(y + _h > ty) y -= (y + _h - ty);
|
uInt32 ty = image.y() + image.height();
|
||||||
|
if(x + _w > tx) x -= (x + _w - tx);
|
||||||
|
if(y + _h > ty) y -= (y + _h - ty);
|
||||||
|
|
||||||
surface().setPos(x, y);
|
surface().setPos(x, y);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Dialog::center();
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: InputTextDialog.hxx,v 1.12 2008-12-23 18:54:05 stephena Exp $
|
// $Id: InputTextDialog.hxx,v 1.13 2008-12-24 01:20:06 stephena Exp $
|
||||||
//
|
//
|
||||||
// Based on code from ScummVM - Scumm Interpreter
|
// Based on code from ScummVM - Scumm Interpreter
|
||||||
// Copyright (C) 2002-2004 The ScummVM project
|
// Copyright (C) 2002-2004 The ScummVM project
|
||||||
|
@ -38,6 +38,9 @@ class InputTextDialog : public Dialog, public CommandSender
|
||||||
const StringList& labels);
|
const StringList& labels);
|
||||||
virtual ~InputTextDialog();
|
virtual ~InputTextDialog();
|
||||||
|
|
||||||
|
/** Place the input dialog onscreen and center it */
|
||||||
|
void show();
|
||||||
|
|
||||||
/** Show input dialog onscreen at the specified coordinates */
|
/** Show input dialog onscreen at the specified coordinates */
|
||||||
void show(uInt32 x, uInt32 y);
|
void show(uInt32 x, uInt32 y);
|
||||||
|
|
||||||
|
@ -59,6 +62,7 @@ class InputTextDialog : public Dialog, public CommandSender
|
||||||
InputWidget myInput;
|
InputWidget myInput;
|
||||||
StaticTextWidget* myTitle;
|
StaticTextWidget* myTitle;
|
||||||
|
|
||||||
|
bool myEnableCenter;
|
||||||
bool myErrorFlag;
|
bool myErrorFlag;
|
||||||
int myCmd;
|
int myCmd;
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: PopUpWidget.cxx,v 1.42 2008-07-25 12:41:41 stephena Exp $
|
// $Id: PopUpWidget.cxx,v 1.43 2008-12-24 01:20:06 stephena Exp $
|
||||||
//
|
//
|
||||||
// Based on code from ScummVM - Scumm Interpreter
|
// Based on code from ScummVM - Scumm Interpreter
|
||||||
// Copyright (C) 2002-2004 The ScummVM project
|
// Copyright (C) 2002-2004 The ScummVM project
|
||||||
|
@ -81,10 +81,11 @@ void PopUpWidget::handleMouseDown(int x, int y, int button, int clickCount)
|
||||||
if(isEnabled())
|
if(isEnabled())
|
||||||
{
|
{
|
||||||
// Add menu just underneath parent widget
|
// Add menu just underneath parent widget
|
||||||
|
const GUI::Rect& image = instance().frameBuffer().imageRect();
|
||||||
uInt32 tx, ty;
|
uInt32 tx, ty;
|
||||||
dialog().surface().getPos(tx, ty);
|
dialog().surface().getPos(tx, ty);
|
||||||
tx += getAbsX() + _labelWidth;
|
tx += getAbsX() + _labelWidth - image.x();
|
||||||
ty += getAbsY() + getHeight();
|
ty += getAbsY() + getHeight() - image.y();
|
||||||
myMenu->show(tx, ty, myMenu->getSelected());
|
myMenu->show(tx, ty, myMenu->getSelected());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue