mirror of https://github.com/stella-emu/stella.git
Huge GUI-related changes. The GUI in launcher/options/command modes
is now fully navigable via the keyboard be means of 'tab-like' functionality. This means that eventually systems without a keyboard will also be able to navigate the interface without resorting to the buggy joymouse code (which is soon to be removed). Laid the infrastructure for remapping GUI events, whereby (for example) a widget checks for Event::UISelect for 'doing its thing', vs. looking at the Enter/Return key. So widgets now respond to events, and events can (eventually) be remapped to *any* device. Currently, these UI events are as follows: UIUp, UIDown, UILeft, UIRight, UIHome, UIEnd, UIPgUp, UIPgDown, UIPrevDir, UINavNext, UINavPrev, UITabNext, UITabPrev, UISelect At present, they're hardcoded to key events only, so pressing 'Return' will send a UISelect, cursor up a UIUp, etc. When the remapping code is complete, *any* input will be able to send these events, and that remapping will be distinct from emulation mode. So, for example, cursor up in GUI mode might generate a UIUp event, but in emulation mode might generate a left joystick up event. Modified 'tab' key while in emulation mode to only enter the options menu. Once inside the menu, the tab key acts as navigation between elements, and exiting the options menu requires navigating to the 'Exit menu' button. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1100 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
6596cbe94b
commit
e49e1f17e4
|
@ -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.9 2006-03-23 16:16:32 stephena Exp $
|
// $Id: CheatCodeDialog.cxx,v 1.10 2006-05-04 17:45:20 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,15 +35,6 @@
|
||||||
|
|
||||||
#include "bspf.hxx"
|
#include "bspf.hxx"
|
||||||
|
|
||||||
enum {
|
|
||||||
kAddCheatCmd = 'CHTa',
|
|
||||||
kEditCheatCmd = 'CHTe',
|
|
||||||
kAddOneShotCmd = 'CHTo',
|
|
||||||
kCheatAdded = 'CHad',
|
|
||||||
kCheatEdited = 'CHed',
|
|
||||||
kOneShotCheatAdded = 'CHoa',
|
|
||||||
kRemCheatCmd = 'CHTr'
|
|
||||||
};
|
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
CheatCodeDialog::CheatCodeDialog(OSystem* osystem, DialogContainer* parent,
|
CheatCodeDialog::CheatCodeDialog(OSystem* osystem, DialogContainer* parent,
|
||||||
|
@ -51,6 +42,8 @@ CheatCodeDialog::CheatCodeDialog(OSystem* osystem, DialogContainer* parent,
|
||||||
: Dialog(osystem, parent, x, y, w, h)
|
: Dialog(osystem, parent, x, y, w, h)
|
||||||
{
|
{
|
||||||
int xpos, ypos;
|
int xpos, ypos;
|
||||||
|
WidgetArray wid;
|
||||||
|
ButtonWidget* b;
|
||||||
|
|
||||||
// List of cheats, with checkboxes to enable/disable
|
// List of cheats, with checkboxes to enable/disable
|
||||||
xpos = 10; ypos = 10;
|
xpos = 10; ypos = 10;
|
||||||
|
@ -58,14 +51,17 @@ CheatCodeDialog::CheatCodeDialog(OSystem* osystem, DialogContainer* parent,
|
||||||
_w - 25 - kButtonWidth, _h - 50);
|
_w - 25 - kButtonWidth, _h - 50);
|
||||||
myCheatList->setStyle(kXFill);
|
myCheatList->setStyle(kXFill);
|
||||||
myCheatList->setEditable(false);
|
myCheatList->setEditable(false);
|
||||||
myCheatList->setFlags(WIDGET_NODRAW_FOCUS);
|
wid.push_back(myCheatList);
|
||||||
addFocusWidget(myCheatList);
|
|
||||||
|
|
||||||
xpos += myCheatList->getWidth() + 15; ypos = 15;
|
xpos += myCheatList->getWidth() + 15; ypos = 15;
|
||||||
addButton(font, xpos, ypos, "Add", kAddCheatCmd, 0);
|
b = addButton(font, xpos, ypos, "Add", kAddCheatCmd);
|
||||||
myEditButton = addButton(font, xpos, ypos+=20, "Edit", kEditCheatCmd, 0);
|
wid.push_back(b);
|
||||||
myRemoveButton = addButton(font, xpos, ypos+=20, "Remove", kRemCheatCmd, 0);
|
myEditButton = addButton(font, xpos, ypos+=20, "Edit", kEditCheatCmd);
|
||||||
addButton(font, xpos, ypos+=30, "One shot", kAddOneShotCmd, 0);
|
wid.push_back(myEditButton);
|
||||||
|
myRemoveButton = addButton(font, xpos, ypos+=20, "Remove", kRemCheatCmd);
|
||||||
|
wid.push_back(myRemoveButton);
|
||||||
|
b = addButton(font, xpos, ypos+=30, "One shot", kAddOneShotCmd);
|
||||||
|
wid.push_back(b);
|
||||||
|
|
||||||
// Inputbox which will pop up when adding/editing a cheat
|
// Inputbox which will pop up when adding/editing a cheat
|
||||||
StringList labels;
|
StringList labels;
|
||||||
|
@ -76,14 +72,20 @@ CheatCodeDialog::CheatCodeDialog(OSystem* osystem, DialogContainer* parent,
|
||||||
|
|
||||||
// Add OK and Cancel buttons **** FIXME - coordinates
|
// Add OK and Cancel buttons **** FIXME - coordinates
|
||||||
#ifndef MAC_OSX
|
#ifndef MAC_OSX
|
||||||
addButton(font, _w - 2 * (kButtonWidth + 7), _h - 24, "OK", kOKCmd, 0);
|
b = addButton(font, _w - 2 * (kButtonWidth + 7), _h - 24, "OK", kOKCmd);
|
||||||
|
wid.push_back(b);
|
||||||
myCancelButton = addButton(font, _w - (kButtonWidth + 10), _h - 24,
|
myCancelButton = addButton(font, _w - (kButtonWidth + 10), _h - 24,
|
||||||
"Cancel", kCloseCmd, 0);
|
"Cancel", kCloseCmd);
|
||||||
|
wid.push_back(myCancelButton);
|
||||||
#else
|
#else
|
||||||
myCancelButton = addButton(font, _w - 2 * (kButtonWidth + 7), _h - 24,
|
myCancelButton = addButton(font, _w - 2 * (kButtonWidth + 7), _h - 24,
|
||||||
"Cancel", kCloseCmd, 0);
|
"Cancel", kCloseCmd);
|
||||||
addButton(font, _w - (kButtonWidth + 10), _h - 24, "OK", kOKCmd, 0);
|
wid.push_back(myCancelButton);
|
||||||
|
b = addButton(font, _w - (kButtonWidth + 10), _h - 24, "OK", kOKCmd);
|
||||||
|
wid.push_back(b);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
addToFocusList(wid);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -154,6 +156,7 @@ void CheatCodeDialog::editCheat()
|
||||||
|
|
||||||
myCheatInput->setEditString(name, 0);
|
myCheatInput->setEditString(name, 0);
|
||||||
myCheatInput->setEditString(code, 1);
|
myCheatInput->setEditString(code, 1);
|
||||||
|
myCheatInput->setTitle("");
|
||||||
myCheatInput->setFocus(1);
|
myCheatInput->setFocus(1);
|
||||||
myCheatInput->setEmitSignal(kCheatEdited);
|
myCheatInput->setEmitSignal(kCheatEdited);
|
||||||
parent()->addDialog(myCheatInput);
|
parent()->addDialog(myCheatInput);
|
||||||
|
|
|
@ -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.hxx,v 1.5 2006-02-22 17:38:03 stephena Exp $
|
// $Id: CheatCodeDialog.hxx,v 1.6 2006-05-04 17:45:21 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
|
||||||
|
@ -63,6 +63,16 @@ class CheatCodeDialog : public Dialog
|
||||||
ButtonWidget* myEditButton;
|
ButtonWidget* myEditButton;
|
||||||
ButtonWidget* myRemoveButton;
|
ButtonWidget* myRemoveButton;
|
||||||
ButtonWidget* myCancelButton;
|
ButtonWidget* myCancelButton;
|
||||||
|
|
||||||
|
enum {
|
||||||
|
kAddCheatCmd = 'CHTa',
|
||||||
|
kEditCheatCmd = 'CHTe',
|
||||||
|
kAddOneShotCmd = 'CHTo',
|
||||||
|
kCheatAdded = 'CHad',
|
||||||
|
kCheatEdited = 'CHed',
|
||||||
|
kOneShotCheatAdded = 'CHoa',
|
||||||
|
kRemCheatCmd = 'CHTr'
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#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: DataGridOpsWidget.cxx,v 1.3 2006-02-22 17:38:04 stephena Exp $
|
// $Id: DataGridOpsWidget.cxx,v 1.4 2006-05-04 17:45:23 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
|
||||||
|
@ -42,32 +42,32 @@ DataGridOpsWidget::DataGridOpsWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
// Create operations buttons
|
// Create operations buttons
|
||||||
xpos = x; ypos = y;
|
xpos = x; ypos = y;
|
||||||
_zeroButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
|
_zeroButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
|
||||||
"0", kDGZeroCmd, 0);
|
"0", kDGZeroCmd);
|
||||||
|
|
||||||
ypos += bheight + space;
|
ypos += bheight + space;
|
||||||
_invButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
|
_invButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
|
||||||
"Inv", kDGInvertCmd, 0);
|
"Inv", kDGInvertCmd);
|
||||||
|
|
||||||
ypos += bheight + space;
|
ypos += bheight + space;
|
||||||
_incButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
|
_incButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
|
||||||
"++", kDGIncCmd, 0);
|
"++", kDGIncCmd);
|
||||||
|
|
||||||
ypos += bheight + space;
|
ypos += bheight + space;
|
||||||
_shiftLeftButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
|
_shiftLeftButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
|
||||||
"<<", kDGShiftLCmd, 0);
|
"<<", kDGShiftLCmd);
|
||||||
|
|
||||||
// Move to next column, skip a row
|
// Move to next column, skip a row
|
||||||
xpos = x + bwidth + space; ypos = y + bheight + space;
|
xpos = x + bwidth + space; ypos = y + bheight + space;
|
||||||
_negButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
|
_negButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
|
||||||
"Neg", kDGNegateCmd, 0);
|
"Neg", kDGNegateCmd);
|
||||||
|
|
||||||
ypos += bheight + space;
|
ypos += bheight + space;
|
||||||
_decButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
|
_decButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
|
||||||
"--", kDGDecCmd, 0);
|
"--", kDGDecCmd);
|
||||||
|
|
||||||
ypos += bheight + space;
|
ypos += bheight + space;
|
||||||
_shiftRightButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
|
_shiftRightButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
|
||||||
">>", kDGShiftRCmd, 0);
|
">>", kDGShiftRCmd);
|
||||||
|
|
||||||
// Calculate real dimensions
|
// Calculate real dimensions
|
||||||
_w = xpos + bwidth;
|
_w = xpos + bwidth;
|
||||||
|
|
|
@ -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: DataGridWidget.cxx,v 1.7 2006-03-25 00:34:17 stephena Exp $
|
// $Id: DataGridWidget.cxx,v 1.8 2006-05-04 17:45:23 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
|
||||||
|
@ -45,7 +45,8 @@ DataGridWidget::DataGridWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
_selectedItem(0),
|
_selectedItem(0),
|
||||||
_opsWidget(NULL)
|
_opsWidget(NULL)
|
||||||
{
|
{
|
||||||
_flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS;
|
_flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS |
|
||||||
|
WIDGET_WANTS_RAWDATA;
|
||||||
_type = kDataGridWidget;
|
_type = kDataGridWidget;
|
||||||
_editMode = false;
|
_editMode = false;
|
||||||
|
|
||||||
|
|
|
@ -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: DebuggerDialog.cxx,v 1.13 2006-03-23 16:16:32 stephena Exp $
|
// $Id: DebuggerDialog.cxx,v 1.14 2006-05-04 17:45:24 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
|
||||||
|
@ -211,6 +211,7 @@ void DebuggerDialog::addStatusArea()
|
||||||
xpos, ypos, myTiaZoom->getWidth(),
|
xpos, ypos, myTiaZoom->getWidth(),
|
||||||
font.getLineHeight(), "");
|
font.getLineHeight(), "");
|
||||||
myMessageBox->setEditable(false);
|
myMessageBox->setEditable(false);
|
||||||
|
myMessageBox->clearFlags(WIDGET_RETAIN_FOCUS);
|
||||||
myMessageBox->setColor(kTextColorEm);
|
myMessageBox->setColor(kTextColorEm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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: PromptWidget.cxx,v 1.8 2006-03-25 00:34:17 stephena Exp $
|
// $Id: PromptWidget.cxx,v 1.9 2006-05-04 17:45:24 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
|
||||||
|
@ -52,7 +52,7 @@ PromptWidget::PromptWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
_firstTime(true)
|
_firstTime(true)
|
||||||
{
|
{
|
||||||
_flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS |
|
_flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS |
|
||||||
WIDGET_WANTS_TAB;
|
WIDGET_WANTS_TAB | WIDGET_WANTS_RAWDATA;
|
||||||
_type = kPromptWidget;
|
_type = kPromptWidget;
|
||||||
|
|
||||||
_kConsoleCharWidth = font.getMaxCharWidth();
|
_kConsoleCharWidth = font.getMaxCharWidth();
|
||||||
|
|
|
@ -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: RamWidget.cxx,v 1.5 2006-03-29 13:53:00 stephena Exp $
|
// $Id: RamWidget.cxx,v 1.6 2006-05-04 17:45:24 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
|
||||||
|
@ -66,27 +66,27 @@ RamWidget::RamWidget(GuiObject* boss, const GUI::Font& font, int x, int y)
|
||||||
// Create actions buttons to the left of the RAM grid
|
// Create actions buttons to the left of the RAM grid
|
||||||
xpos += lwidth + myRamGrid->getWidth() + 4;
|
xpos += lwidth + myRamGrid->getWidth() + 4;
|
||||||
myUndoButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
|
myUndoButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
|
||||||
"Undo", kUndoCmd, 0);
|
"Undo", kUndoCmd);
|
||||||
myUndoButton->setTarget(this);
|
myUndoButton->setTarget(this);
|
||||||
|
|
||||||
ypos += bheight + 4;
|
ypos += bheight + 4;
|
||||||
myRevertButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
|
myRevertButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
|
||||||
"Rev", kRevertCmd, 0);
|
"Rev", kRevertCmd);
|
||||||
myRevertButton->setTarget(this);
|
myRevertButton->setTarget(this);
|
||||||
|
|
||||||
ypos += 2 * bheight + 2;
|
ypos += 2 * bheight + 2;
|
||||||
mySearchButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
|
mySearchButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
|
||||||
"Srch", kSearchCmd, 0);
|
"Srch", kSearchCmd);
|
||||||
mySearchButton->setTarget(this);
|
mySearchButton->setTarget(this);
|
||||||
|
|
||||||
ypos += bheight + 4;
|
ypos += bheight + 4;
|
||||||
myCompareButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
|
myCompareButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
|
||||||
"Cmp", kCmpCmd, 0);
|
"Cmp", kCmpCmd);
|
||||||
myCompareButton->setTarget(this);
|
myCompareButton->setTarget(this);
|
||||||
|
|
||||||
ypos += bheight + 4;
|
ypos += bheight + 4;
|
||||||
myRestartButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
|
myRestartButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
|
||||||
"Rset", kRestartCmd, 0);
|
"Rset", kRestartCmd);
|
||||||
myRestartButton->setTarget(this);
|
myRestartButton->setTarget(this);
|
||||||
|
|
||||||
// Labels for RAM grid
|
// Labels for RAM grid
|
||||||
|
|
|
@ -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: RomListWidget.cxx,v 1.5 2006-02-22 17:38:04 stephena Exp $
|
// $Id: RomListWidget.cxx,v 1.6 2006-05-04 17:45:24 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
|
||||||
|
@ -71,6 +71,12 @@ void RomListWidget::handleMouseDown(int x, int y, int button, int clickCount)
|
||||||
ListWidget::handleMouseDown(x, y, button, clickCount);
|
ListWidget::handleMouseDown(x, y, button, clickCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
bool RomListWidget::handleEvent(Event::Type e)
|
||||||
|
{
|
||||||
|
return ListWidget::handleEvent(e); // override CheckListWidget::handleEvent()
|
||||||
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void RomListWidget::drawWidget(bool hilite)
|
void RomListWidget::drawWidget(bool hilite)
|
||||||
{
|
{
|
||||||
|
|
|
@ -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: RomListWidget.hxx,v 1.4 2005-09-07 18:34:52 stephena Exp $
|
// $Id: RomListWidget.hxx,v 1.5 2006-05-04 17:45:24 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
|
||||||
|
@ -43,6 +43,7 @@ class RomListWidget : public CheckListWidget
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void handleMouseDown(int x, int y, int button, int clickCount);
|
void handleMouseDown(int x, int y, int button, int clickCount);
|
||||||
|
bool handleEvent(Event::Type e);
|
||||||
|
|
||||||
void drawWidget(bool hilite);
|
void drawWidget(bool hilite);
|
||||||
GUI::Rect getLineRect() const;
|
GUI::Rect getLineRect() const;
|
||||||
|
|
|
@ -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: TiaZoomWidget.cxx,v 1.7 2006-03-25 00:34:17 stephena Exp $
|
// $Id: TiaZoomWidget.cxx,v 1.8 2006-05-04 17:45:24 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
|
||||||
|
@ -34,7 +34,8 @@ TiaZoomWidget::TiaZoomWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
CommandSender(boss),
|
CommandSender(boss),
|
||||||
myMenu(NULL)
|
myMenu(NULL)
|
||||||
{
|
{
|
||||||
_flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS;
|
_flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS |
|
||||||
|
WIDGET_WANTS_RAWDATA;
|
||||||
|
|
||||||
_w = 210;
|
_w = 210;
|
||||||
_h = 120;
|
_h = 120;
|
||||||
|
|
|
@ -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: ToggleWidget.cxx,v 1.3 2006-02-22 17:38:04 stephena Exp $
|
// $Id: ToggleWidget.cxx,v 1.4 2006-05-04 17:45:24 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
|
||||||
|
@ -34,7 +34,8 @@ ToggleWidget::ToggleWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
_currentCol(0),
|
_currentCol(0),
|
||||||
_selectedItem(0)
|
_selectedItem(0)
|
||||||
{
|
{
|
||||||
_flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS;
|
_flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS |
|
||||||
|
WIDGET_WANTS_RAWDATA;
|
||||||
_type = kToggleWidget;
|
_type = kToggleWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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: Event.hxx,v 1.19 2006-01-05 18:53:22 stephena Exp $
|
// $Id: Event.hxx,v 1.20 2006-05-04 17:45:24 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#ifndef EVENT_HXX
|
#ifndef EVENT_HXX
|
||||||
|
@ -26,7 +26,7 @@ class EventStreamer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@author Bradford W. Mott
|
@author Bradford W. Mott
|
||||||
@version $Id: Event.hxx,v 1.19 2006-01-05 18:53:22 stephena Exp $
|
@version $Id: Event.hxx,v 1.20 2006-05-04 17:45:24 stephena Exp $
|
||||||
*/
|
*/
|
||||||
class Event
|
class Event
|
||||||
{
|
{
|
||||||
|
@ -34,7 +34,7 @@ class Event
|
||||||
/**
|
/**
|
||||||
Enumeration of all possible events in Stella, including both
|
Enumeration of all possible events in Stella, including both
|
||||||
console and controller event types as well as events that aren't
|
console and controller event types as well as events that aren't
|
||||||
technically part of the core
|
technically part of the emulation core
|
||||||
*/
|
*/
|
||||||
enum Type
|
enum Type
|
||||||
{
|
{
|
||||||
|
@ -80,6 +80,9 @@ class Event
|
||||||
MenuMode, CmdMenuMode, DebuggerMode, LauncherMode, Fry,
|
MenuMode, CmdMenuMode, DebuggerMode, LauncherMode, Fry,
|
||||||
VolumeDecrease, VolumeIncrease,
|
VolumeDecrease, VolumeIncrease,
|
||||||
|
|
||||||
|
UIUp, UIDown, UILeft, UIRight, UIHome, UIEnd, UIPgUp, UIPgDown,
|
||||||
|
UIPrevDir, UINavNext, UINavPrev, UITabNext, UITabPrev, UISelect,
|
||||||
|
|
||||||
LastType
|
LastType
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -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: EventHandler.cxx,v 1.160 2006-04-05 12:28:37 stephena Exp $
|
// $Id: EventHandler.cxx,v 1.161 2006-05-04 17:45:24 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
@ -187,11 +187,6 @@ void EventHandler::reset(State state)
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void EventHandler::refreshDisplay(bool forceUpdate)
|
void EventHandler::refreshDisplay(bool forceUpdate)
|
||||||
{
|
{
|
||||||
// These are reset each time the display changes size
|
|
||||||
DialogContainer::ourJoyMouse.x_max = myOSystem->frameBuffer().imageWidth();
|
|
||||||
DialogContainer::ourJoyMouse.y_max = myOSystem->frameBuffer().imageHeight();
|
|
||||||
DialogContainer::ourJoyMouse.amt = myOSystem->frameBuffer().zoomLevel() * 3;
|
|
||||||
|
|
||||||
switch(myState)
|
switch(myState)
|
||||||
{
|
{
|
||||||
case S_EMULATE:
|
case S_EMULATE:
|
||||||
|
@ -863,9 +858,6 @@ void EventHandler::handleMouseMotionEvent(SDL_Event& event)
|
||||||
{
|
{
|
||||||
// Take window zooming into account
|
// Take window zooming into account
|
||||||
int x = event.motion.x, y = event.motion.y;
|
int x = event.motion.x, y = event.motion.y;
|
||||||
DialogContainer::ourJoyMouse.x = x;
|
|
||||||
DialogContainer::ourJoyMouse.y = y;
|
|
||||||
|
|
||||||
myOSystem->frameBuffer().translateCoords(&x, &y);
|
myOSystem->frameBuffer().translateCoords(&x, &y);
|
||||||
|
|
||||||
// Determine which mode we're in, then send the event to the appropriate place
|
// Determine which mode we're in, then send the event to the appropriate place
|
||||||
|
@ -1223,8 +1215,8 @@ bool EventHandler::eventStateChange(Event::Type type)
|
||||||
{
|
{
|
||||||
if(myState == S_EMULATE)
|
if(myState == S_EMULATE)
|
||||||
enterMenuMode(S_MENU);
|
enterMenuMode(S_MENU);
|
||||||
else if(myState == S_MENU)
|
// else if(myState == S_MENU) // FIXME - maybe 'tab' should only enter, not exit
|
||||||
leaveMenuMode();
|
// leaveMenuMode();
|
||||||
else
|
else
|
||||||
handled = false;
|
handled = false;
|
||||||
}
|
}
|
||||||
|
@ -1856,6 +1848,79 @@ inline bool EventHandler::eventIsAnalog(Event::Type event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
Event::Type EventHandler::eventForKey(int key, EventMode mode)
|
||||||
|
{
|
||||||
|
// FIXME - eventually make this a one-line inliner in the header
|
||||||
|
|
||||||
|
Event::Type e = Event::NoType;
|
||||||
|
|
||||||
|
// FIXME - eventually this will return the mapped events for
|
||||||
|
// keys either for emulation mode or UI mode. For now, it always
|
||||||
|
// assumes UI mode, and generates the key statically.
|
||||||
|
if(key < 0 || key >= SDLK_LAST)
|
||||||
|
return e;
|
||||||
|
|
||||||
|
switch(key)
|
||||||
|
{
|
||||||
|
case '\n': // enter/return
|
||||||
|
case '\r':
|
||||||
|
e = Event::UISelect;
|
||||||
|
break;
|
||||||
|
case 256+17: // cursor up
|
||||||
|
e = Event::UIUp;
|
||||||
|
break;
|
||||||
|
case 256+18: // cursor down
|
||||||
|
e = Event::UIDown;
|
||||||
|
break;
|
||||||
|
case 256+20: // cursor left
|
||||||
|
e = Event::UILeft;
|
||||||
|
break;
|
||||||
|
case 256+19: // cursor right
|
||||||
|
e = Event::UIRight;
|
||||||
|
break;
|
||||||
|
case 256+24: // Page Up:
|
||||||
|
e = Event::UIPgUp;
|
||||||
|
break;
|
||||||
|
case 256+25: // Page Down
|
||||||
|
e = Event::UIPgDown;
|
||||||
|
break;
|
||||||
|
case 256+22: // Home
|
||||||
|
e = Event::UIHome;
|
||||||
|
break;
|
||||||
|
case 256+23: // End
|
||||||
|
e = Event::UIEnd;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return e; // ... myKeyTable[key];
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
Event::Type EventHandler::eventForJoyButton(int stick, int button,
|
||||||
|
EventMode mode)
|
||||||
|
{
|
||||||
|
// FIXME - do a lookup
|
||||||
|
return Event::NoType;
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
Event::Type EventHandler::eventForJoyAxis(int stick, int axis, int value,
|
||||||
|
EventMode mode)
|
||||||
|
{
|
||||||
|
// FIXME - do a lookup
|
||||||
|
return Event::NoType;
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
Event::Type EventHandler::eventForJoyHat(int stick, int hat, int value,
|
||||||
|
EventMode mode)
|
||||||
|
{
|
||||||
|
// FIXME - do a lookup
|
||||||
|
return Event::NoType;
|
||||||
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
inline bool EventHandler::isJitter(int paddle, int value)
|
inline bool EventHandler::isJitter(int paddle, int value)
|
||||||
{
|
{
|
||||||
|
|
|
@ -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: EventHandler.hxx,v 1.85 2006-04-05 12:28:37 stephena Exp $
|
// $Id: EventHandler.hxx,v 1.86 2006-05-04 17:45:24 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#ifndef EVENTHANDLER_HXX
|
#ifndef EVENTHANDLER_HXX
|
||||||
|
@ -64,6 +64,11 @@ enum {
|
||||||
kActionListSize = 81
|
kActionListSize = 81
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum EventMode {
|
||||||
|
kEmulation,
|
||||||
|
kMenuOverlay
|
||||||
|
};
|
||||||
|
|
||||||
// Joystick related items
|
// Joystick related items
|
||||||
enum {
|
enum {
|
||||||
kNumJoysticks = 8,
|
kNumJoysticks = 8,
|
||||||
|
@ -107,7 +112,7 @@ struct JoyMouse {
|
||||||
mapping can take place.
|
mapping can take place.
|
||||||
|
|
||||||
@author Stephen Anthony
|
@author Stephen Anthony
|
||||||
@version $Id: EventHandler.hxx,v 1.85 2006-04-05 12:28:37 stephena Exp $
|
@version $Id: EventHandler.hxx,v 1.86 2006-05-04 17:45:24 stephena Exp $
|
||||||
*/
|
*/
|
||||||
class EventHandler
|
class EventHandler
|
||||||
{
|
{
|
||||||
|
@ -328,6 +333,11 @@ class EventHandler
|
||||||
|
|
||||||
inline SDL_Joystick* getJoystick(int i) { return ourJoysticks[i].stick; }
|
inline SDL_Joystick* getJoystick(int i) { return ourJoysticks[i].stick; }
|
||||||
|
|
||||||
|
Event::Type eventForKey(int key, EventMode mode);
|
||||||
|
Event::Type eventForJoyButton(int stick, int button, EventMode mode);
|
||||||
|
Event::Type eventForJoyAxis(int stick, int axis, int value, EventMode mode);
|
||||||
|
Event::Type eventForJoyHat(int stick, int hat, int value, EventMode mode);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
Bind a key to an event/action and regenerate the mapping array(s)
|
Bind a key to an event/action and regenerate the mapping array(s)
|
||||||
|
|
|
@ -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: FrameBuffer.cxx,v 1.85 2006-03-25 00:34:17 stephena Exp $
|
// $Id: FrameBuffer.cxx,v 1.86 2006-05-04 17:45:24 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
@ -608,7 +608,7 @@ void FrameBuffer::frameRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kDashLine:
|
case kDashLine:
|
||||||
unsigned int i, skip, lwidth = 1;
|
unsigned int i, skip, lwidth = 0;
|
||||||
|
|
||||||
for(i = x, skip = 1; i < x+w-1; i=i+lwidth+1, ++skip)
|
for(i = x, skip = 1; i < x+w-1; i=i+lwidth+1, ++skip)
|
||||||
{
|
{
|
||||||
|
|
|
@ -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: AboutDialog.cxx,v 1.12 2006-04-05 16:06:59 stephena Exp $
|
// $Id: AboutDialog.cxx,v 1.13 2006-05-04 17:45:25 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
|
||||||
|
@ -36,12 +36,20 @@ AboutDialog::AboutDialog(OSystem* osystem, DialogContainer* parent,
|
||||||
myPage(1),
|
myPage(1),
|
||||||
myNumPages(6)
|
myNumPages(6)
|
||||||
{
|
{
|
||||||
|
WidgetArray wid;
|
||||||
|
|
||||||
// Add Previous, Next and Close buttons
|
// Add Previous, Next and Close buttons
|
||||||
myPrevButton = addButton(font, 10, h - 24, "Previous", kPrevCmd, 'P');
|
myPrevButton = addButton(font, 10, h - 24, "Previous", kPrevCmd);
|
||||||
myNextButton = addButton(font, (kButtonWidth + 15), h - 24,
|
|
||||||
"Next", kNextCmd, 'N');
|
|
||||||
addButton(font, w - (kButtonWidth + 10), h - 24, "Close", kCloseCmd, 'C');
|
|
||||||
myPrevButton->clearFlags(WIDGET_ENABLED);
|
myPrevButton->clearFlags(WIDGET_ENABLED);
|
||||||
|
wid.push_back(myPrevButton);
|
||||||
|
|
||||||
|
myNextButton = addButton(font, (kButtonWidth + 15), h - 24,
|
||||||
|
"Next", kNextCmd);
|
||||||
|
wid.push_back(myNextButton);
|
||||||
|
|
||||||
|
ButtonWidget* b = addButton(font, w - (kButtonWidth + 10), h - 24,
|
||||||
|
"Close", kCloseCmd);
|
||||||
|
wid.push_back(b);
|
||||||
|
|
||||||
myTitle = new StaticTextWidget(this, font, 5, 5, w - 10, font.getFontHeight(),
|
myTitle = new StaticTextWidget(this, font, 5, 5, w - 10, font.getFontHeight(),
|
||||||
"", kTextAlignCenter);
|
"", kTextAlignCenter);
|
||||||
|
@ -52,6 +60,8 @@ AboutDialog::AboutDialog(OSystem* osystem, DialogContainer* parent,
|
||||||
myDesc[i] = new StaticTextWidget(this, font, 10, 18 + (10 * i), w - 20,
|
myDesc[i] = new StaticTextWidget(this, font, 10, 18 + (10 * i), w - 20,
|
||||||
font.getFontHeight(), "", kTextAlignLeft);
|
font.getFontHeight(), "", kTextAlignLeft);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addToFocusList(wid);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -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: AudioDialog.cxx,v 1.18 2006-02-22 17:38:04 stephena Exp $
|
// $Id: AudioDialog.cxx,v 1.19 2006-05-04 17:45:25 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
|
||||||
|
@ -44,6 +44,7 @@ AudioDialog::AudioDialog(OSystem* osystem, DialogContainer* parent,
|
||||||
int xpos, ypos;
|
int xpos, ypos;
|
||||||
int lwidth = font.getStringWidth("Fragment Size: "),
|
int lwidth = font.getStringWidth("Fragment Size: "),
|
||||||
pwidth = font.getStringWidth("4096");
|
pwidth = font.getStringWidth("4096");
|
||||||
|
WidgetArray wid;
|
||||||
|
|
||||||
// Volume
|
// Volume
|
||||||
xpos = (w - lwidth - pwidth - 40) / 2; ypos = 10;
|
xpos = (w - lwidth - pwidth - 40) / 2; ypos = 10;
|
||||||
|
@ -51,6 +52,7 @@ AudioDialog::AudioDialog(OSystem* osystem, DialogContainer* parent,
|
||||||
myVolumeSlider = new SliderWidget(this, font, xpos, ypos, 30, lineHeight,
|
myVolumeSlider = new SliderWidget(this, font, xpos, ypos, 30, lineHeight,
|
||||||
"Volume: ", lwidth, kVolumeChanged);
|
"Volume: ", lwidth, kVolumeChanged);
|
||||||
myVolumeSlider->setMinValue(1); myVolumeSlider->setMaxValue(100);
|
myVolumeSlider->setMinValue(1); myVolumeSlider->setMaxValue(100);
|
||||||
|
wid.push_back(myVolumeSlider);
|
||||||
myVolumeLabel = new StaticTextWidget(this, font,
|
myVolumeLabel = new StaticTextWidget(this, font,
|
||||||
xpos + myVolumeSlider->getWidth() + 4,
|
xpos + myVolumeSlider->getWidth() + 4,
|
||||||
ypos + 1,
|
ypos + 1,
|
||||||
|
@ -68,27 +70,38 @@ AudioDialog::AudioDialog(OSystem* osystem, DialogContainer* parent,
|
||||||
myFragsizePopup->appendEntry("1024", 3);
|
myFragsizePopup->appendEntry("1024", 3);
|
||||||
myFragsizePopup->appendEntry("2048", 4);
|
myFragsizePopup->appendEntry("2048", 4);
|
||||||
myFragsizePopup->appendEntry("4096", 5);
|
myFragsizePopup->appendEntry("4096", 5);
|
||||||
|
wid.push_back(myFragsizePopup);
|
||||||
ypos += lineHeight + 4;
|
ypos += lineHeight + 4;
|
||||||
|
|
||||||
// Stereo sound
|
// Stereo sound
|
||||||
mySoundTypeCheckbox = new CheckboxWidget(this, font, xpos+28, ypos,
|
mySoundTypeCheckbox = new CheckboxWidget(this, font, xpos+28, ypos,
|
||||||
"Stereo mode", 0);
|
"Stereo mode", 0);
|
||||||
|
wid.push_back(mySoundTypeCheckbox);
|
||||||
ypos += lineHeight + 4;
|
ypos += lineHeight + 4;
|
||||||
|
|
||||||
// Enable sound
|
// Enable sound
|
||||||
mySoundEnableCheckbox = new CheckboxWidget(this, font, xpos+28, ypos,
|
mySoundEnableCheckbox = new CheckboxWidget(this, font, xpos+28, ypos,
|
||||||
"Enable sound", kSoundEnableChanged);
|
"Enable sound", kSoundEnableChanged);
|
||||||
|
wid.push_back(mySoundEnableCheckbox);
|
||||||
ypos += lineHeight + 12;
|
ypos += lineHeight + 12;
|
||||||
|
|
||||||
// Add Defaults, OK and Cancel buttons
|
// Add Defaults, OK and Cancel buttons
|
||||||
addButton(font, 10, _h - 24, "Defaults", kDefaultsCmd, 0);
|
ButtonWidget* b;
|
||||||
|
b = addButton(font, 10, _h - 24, "Defaults", kDefaultsCmd);
|
||||||
|
wid.push_back(b);
|
||||||
#ifndef MAC_OSX
|
#ifndef MAC_OSX
|
||||||
addButton(font, _w - 2 * (kButtonWidth + 7), _h - 24, "OK", kOKCmd, 0);
|
b = addButton(font, _w - 2 * (kButtonWidth + 7), _h - 24, "OK", kOKCmd);
|
||||||
addButton(font, _w - (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0);
|
wid.push_back(b);
|
||||||
|
b = addButton(font, _w - (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd);
|
||||||
|
wid.push_back(b);
|
||||||
#else
|
#else
|
||||||
addButton(font, _w - 2 * (kButtonWidth + 7), _h - 24, "Cancel", kCloseCmd, 0);
|
b = addButton(font, _w - 2 * (kButtonWidth + 7), _h - 24, "Cancel", kCloseCmd);
|
||||||
addButton(font, _w - (kButtonWidth + 10), _h - 24, "OK", kOKCmd, 0);
|
wid.push_back(b);
|
||||||
|
b = addButton(font, _w - (kButtonWidth + 10), _h - 24, "OK", kOKCmd);
|
||||||
|
wid.push_back(b);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
addToFocusList(wid);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -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: BrowserDialog.cxx,v 1.18 2006-03-20 13:23:13 stephena Exp $
|
// $Id: BrowserDialog.cxx,v 1.19 2006-05-04 17:45:25 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
|
||||||
|
@ -49,6 +49,7 @@ BrowserDialog::BrowserDialog(GuiObject* boss, const GUI::Font& font,
|
||||||
bwidth = font.getStringWidth("Cancel") + 20,
|
bwidth = font.getStringWidth("Cancel") + 20,
|
||||||
bheight = font.getLineHeight() + 4;
|
bheight = font.getLineHeight() + 4;
|
||||||
int xpos, ypos;
|
int xpos, ypos;
|
||||||
|
ButtonWidget* b;
|
||||||
|
|
||||||
xpos = 10; ypos = 4;
|
xpos = 10; ypos = 4;
|
||||||
_title = new StaticTextWidget(this, font, xpos, ypos,
|
_title = new StaticTextWidget(this, font, xpos, ypos,
|
||||||
|
@ -67,28 +68,33 @@ BrowserDialog::BrowserDialog(GuiObject* boss, const GUI::Font& font,
|
||||||
_w - 2 * xpos, _h - bheight - ypos - 15);
|
_w - 2 * xpos, _h - bheight - ypos - 15);
|
||||||
_fileList->setNumberingMode(kListNumberingOff);
|
_fileList->setNumberingMode(kListNumberingOff);
|
||||||
_fileList->setEditable(false);
|
_fileList->setEditable(false);
|
||||||
_fileList->setFlags(WIDGET_NODRAW_FOCUS);
|
|
||||||
addFocusWidget(_fileList);
|
|
||||||
|
|
||||||
// Buttons
|
// Buttons
|
||||||
xpos = 10; ypos = _h - bheight - 8;
|
xpos = 10; ypos = _h - bheight - 8;
|
||||||
_goUpButton = new ButtonWidget(this, font, xpos, ypos, bwidth, bheight,
|
b = _goUpButton = new ButtonWidget(this, font, xpos, ypos, bwidth, bheight,
|
||||||
"Go up", kGoUpCmd, 0);
|
"Go up", kGoUpCmd);
|
||||||
|
addFocusWidget(b);
|
||||||
#ifndef MAC_OSX
|
#ifndef MAC_OSX
|
||||||
xpos = _w - 2 *(bwidth + 10);
|
xpos = _w - 2 *(bwidth + 10);
|
||||||
new ButtonWidget(this, font, xpos, ypos, bwidth, bheight, "Choose",
|
b = new ButtonWidget(this, font, xpos, ypos, bwidth, bheight, "Choose",
|
||||||
kChooseCmd, 0);
|
kChooseCmd);
|
||||||
|
addFocusWidget(b);
|
||||||
xpos += bwidth + 10;
|
xpos += bwidth + 10;
|
||||||
new ButtonWidget(this, font, xpos, ypos, bwidth, bheight, "Cancel",
|
b = new ButtonWidget(this, font, xpos, ypos, bwidth, bheight, "Cancel",
|
||||||
kCloseCmd, 0);
|
kCloseCmd);
|
||||||
|
addFocusWidget(b);
|
||||||
#else
|
#else
|
||||||
xpos = _w - 2 *(bwidth + 10); ypos = _h - bheight - 8;
|
xpos = _w - 2 *(bwidth + 10); ypos = _h - bheight - 8;
|
||||||
new ButtonWidget(this, font, xpos, ypos, bwidth, bheight, "Cancel",
|
b = new ButtonWidget(this, font, xpos, ypos, bwidth, bheight, "Cancel",
|
||||||
kCloseCmd, 0);
|
kCloseCmd);
|
||||||
|
addFocusWidget(b);
|
||||||
xpos += bwidth + 10;
|
xpos += bwidth + 10;
|
||||||
new ButtonWidget(this, font, xpos, ypos, bwidth, bheight, "Choose",
|
b = new ButtonWidget(this, font, xpos, ypos, bwidth, bheight, "Choose",
|
||||||
kChooseCmd, 0);
|
kChooseCmd);
|
||||||
|
addFocusWidget(b);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
addFocusWidget(_fileList);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -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: CheckListWidget.cxx,v 1.10 2006-02-22 17:38:04 stephena Exp $
|
// $Id: CheckListWidget.cxx,v 1.11 2006-05-04 17:45:25 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
|
||||||
|
@ -41,7 +41,6 @@ CheckListWidget::CheckListWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
t = new CheckboxWidget(boss, font, _x + 2, ypos, "", kCheckActionCmd);
|
t = new CheckboxWidget(boss, font, _x + 2, ypos, "", kCheckActionCmd);
|
||||||
t->setTarget(this);
|
t->setTarget(this);
|
||||||
t->setID(i);
|
t->setID(i);
|
||||||
t->holdFocus(false);
|
|
||||||
ypos += _fontHeight;
|
ypos += _fontHeight;
|
||||||
|
|
||||||
_checkList.push_back(t);
|
_checkList.push_back(t);
|
||||||
|
@ -190,6 +189,23 @@ bool CheckListWidget::getState(int line)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
bool CheckListWidget::handleEvent(Event::Type e)
|
||||||
|
{
|
||||||
|
switch(e)
|
||||||
|
{
|
||||||
|
case Event::UISelect:
|
||||||
|
// Simulate a mouse button click
|
||||||
|
_checkList[ListWidget::getSelected()]->handleMouseUp(0, 0, 1, 0);
|
||||||
|
return true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return ListWidget::handleEvent(e);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void CheckListWidget::handleCommand(CommandSender* sender, int cmd,
|
void CheckListWidget::handleCommand(CommandSender* sender, int cmd,
|
||||||
int data, int id)
|
int data, int id)
|
||||||
|
@ -209,5 +225,6 @@ void CheckListWidget::handleCommand(CommandSender* sender, int cmd,
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ListWidget::handleCommand(sender, cmd, data, id);
|
ListWidget::handleCommand(sender, cmd, data, id);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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: CheckListWidget.hxx,v 1.8 2005-12-09 01:16:13 stephena Exp $
|
// $Id: CheckListWidget.hxx,v 1.9 2006-05-04 17:45:25 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
|
||||||
|
@ -54,6 +54,7 @@ class CheckListWidget : public ListWidget
|
||||||
bool getState(int line);
|
bool getState(int line);
|
||||||
bool getSelectedState() { return getState(_selectedItem); }
|
bool getSelectedState() { return getState(_selectedItem); }
|
||||||
|
|
||||||
|
bool handleEvent(Event::Type e);
|
||||||
void handleCommand(CommandSender* sender, int cmd, int data, int id);
|
void handleCommand(CommandSender* sender, int cmd, int data, int id);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -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: CommandDialog.cxx,v 1.8 2006-02-22 17:38:04 stephena Exp $
|
// $Id: CommandDialog.cxx,v 1.9 2006-05-04 17:45:25 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
|
||||||
|
@ -49,89 +49,73 @@ CommandDialog::CommandDialog(OSystem* osystem, DialogContainer* parent)
|
||||||
ButtonWidget* b;
|
ButtonWidget* b;
|
||||||
|
|
||||||
b = new ButtonWidget(this, font, xoffset, yoffset, buttonWidth, buttonHeight,
|
b = new ButtonWidget(this, font, xoffset, yoffset, buttonWidth, buttonHeight,
|
||||||
"Select", kSelectCmd, 0);
|
"Select", kSelectCmd);
|
||||||
b->setEditable(true);
|
|
||||||
wid.push_back(b);
|
wid.push_back(b);
|
||||||
xoffset += lwidth;
|
xoffset += lwidth;
|
||||||
b = new ButtonWidget(this, font, xoffset, yoffset, buttonWidth, buttonHeight,
|
b = new ButtonWidget(this, font, xoffset, yoffset, buttonWidth, buttonHeight,
|
||||||
"Reset", kResetCmd, 0);
|
"Reset", kResetCmd);
|
||||||
b->setEditable(true);
|
|
||||||
wid.push_back(b);
|
wid.push_back(b);
|
||||||
xoffset += lwidth;
|
xoffset += lwidth;
|
||||||
b = new ButtonWidget(this, font, xoffset, yoffset, buttonWidth, buttonHeight,
|
b = new ButtonWidget(this, font, xoffset, yoffset, buttonWidth, buttonHeight,
|
||||||
"Color TV", kColorCmd, 0);
|
"Color TV", kColorCmd);
|
||||||
b->setEditable(true);
|
|
||||||
wid.push_back(b);
|
wid.push_back(b);
|
||||||
xoffset += lwidth;
|
xoffset += lwidth;
|
||||||
b = new ButtonWidget(this, font, xoffset, yoffset, buttonWidth, buttonHeight,
|
b = new ButtonWidget(this, font, xoffset, yoffset, buttonWidth, buttonHeight,
|
||||||
"B/W TV", kBWCmd, 0);
|
"B/W TV", kBWCmd);
|
||||||
b->setEditable(true);
|
|
||||||
wid.push_back(b);
|
wid.push_back(b);
|
||||||
|
|
||||||
xoffset = 5; yoffset += buttonHeight + 5;
|
xoffset = 5; yoffset += buttonHeight + 5;
|
||||||
|
|
||||||
b = new ButtonWidget(this, font, xoffset, yoffset, buttonWidth, buttonHeight,
|
b = new ButtonWidget(this, font, xoffset, yoffset, buttonWidth, buttonHeight,
|
||||||
"Left Diff A", kLeftDiffACmd, 0);
|
"Left Diff A", kLeftDiffACmd);
|
||||||
b->setEditable(true);
|
|
||||||
wid.push_back(b);
|
wid.push_back(b);
|
||||||
xoffset += lwidth;
|
xoffset += lwidth;
|
||||||
b = new ButtonWidget(this, font, xoffset, yoffset, buttonWidth, buttonHeight,
|
b = new ButtonWidget(this, font, xoffset, yoffset, buttonWidth, buttonHeight,
|
||||||
"Left Diff B", kLeftDiffBCmd, 0);
|
"Left Diff B", kLeftDiffBCmd);
|
||||||
b->setEditable(true);
|
|
||||||
wid.push_back(b);
|
wid.push_back(b);
|
||||||
xoffset += lwidth;
|
xoffset += lwidth;
|
||||||
b = new ButtonWidget(this, font, xoffset, yoffset, buttonWidth, buttonHeight,
|
b = new ButtonWidget(this, font, xoffset, yoffset, buttonWidth, buttonHeight,
|
||||||
"Right Diff A", kRightDiffACmd, 0);
|
"Right Diff A", kRightDiffACmd);
|
||||||
b->setEditable(true);
|
|
||||||
wid.push_back(b);
|
wid.push_back(b);
|
||||||
xoffset += lwidth;
|
xoffset += lwidth;
|
||||||
b = new ButtonWidget(this, font, xoffset, yoffset, buttonWidth, buttonHeight,
|
b = new ButtonWidget(this, font, xoffset, yoffset, buttonWidth, buttonHeight,
|
||||||
"Right Diff B", kRightDiffBCmd, 0);
|
"Right Diff B", kRightDiffBCmd);
|
||||||
b->setEditable(true);
|
|
||||||
wid.push_back(b);
|
wid.push_back(b);
|
||||||
|
|
||||||
xoffset = 5; yoffset += buttonHeight + 5;
|
xoffset = 5; yoffset += buttonHeight + 5;
|
||||||
|
|
||||||
b = new ButtonWidget(this, font, xoffset, yoffset, buttonWidth, buttonHeight,
|
b = new ButtonWidget(this, font, xoffset, yoffset, buttonWidth, buttonHeight,
|
||||||
"Save State", kSaveStateCmd, 0);
|
"Save State", kSaveStateCmd);
|
||||||
b->setEditable(true);
|
|
||||||
wid.push_back(b);
|
wid.push_back(b);
|
||||||
xoffset += lwidth;
|
xoffset += lwidth;
|
||||||
b = new ButtonWidget(this, font, xoffset, yoffset, buttonWidth, buttonHeight,
|
b = new ButtonWidget(this, font, xoffset, yoffset, buttonWidth, buttonHeight,
|
||||||
"State Slot", kStateSlotCmd, 0);
|
"State Slot", kStateSlotCmd);
|
||||||
b->setEditable(true);
|
|
||||||
wid.push_back(b);
|
wid.push_back(b);
|
||||||
xoffset += lwidth;
|
xoffset += lwidth;
|
||||||
b = new ButtonWidget(this, font, xoffset, yoffset, buttonWidth, buttonHeight,
|
b = new ButtonWidget(this, font, xoffset, yoffset, buttonWidth, buttonHeight,
|
||||||
"Load State", kLoadStateCmd, 0);
|
"Load State", kLoadStateCmd);
|
||||||
b->setEditable(true);
|
|
||||||
wid.push_back(b);
|
wid.push_back(b);
|
||||||
xoffset += lwidth;
|
xoffset += lwidth;
|
||||||
b = new ButtonWidget(this, font, xoffset, yoffset, buttonWidth, buttonHeight,
|
b = new ButtonWidget(this, font, xoffset, yoffset, buttonWidth, buttonHeight,
|
||||||
"Snapshot", kSnapshotCmd, 0);
|
"Snapshot", kSnapshotCmd);
|
||||||
b->setEditable(true);
|
|
||||||
wid.push_back(b);
|
wid.push_back(b);
|
||||||
|
|
||||||
xoffset = 5; yoffset += buttonHeight + 5;
|
xoffset = 5; yoffset += buttonHeight + 5;
|
||||||
|
|
||||||
b = new ButtonWidget(this, font, xoffset, yoffset, buttonWidth, buttonHeight,
|
b = new ButtonWidget(this, font, xoffset, yoffset, buttonWidth, buttonHeight,
|
||||||
"NTSC/PAL", kFormatCmd, 0);
|
"NTSC/PAL", kFormatCmd);
|
||||||
b->setEditable(true);
|
|
||||||
wid.push_back(b);
|
wid.push_back(b);
|
||||||
xoffset += lwidth;
|
xoffset += lwidth;
|
||||||
b = new ButtonWidget(this, font, xoffset, yoffset, buttonWidth, buttonHeight,
|
b = new ButtonWidget(this, font, xoffset, yoffset, buttonWidth, buttonHeight,
|
||||||
"Palette", kPaletteCmd, 0);
|
"Palette", kPaletteCmd);
|
||||||
b->setEditable(true);
|
|
||||||
wid.push_back(b);
|
wid.push_back(b);
|
||||||
xoffset += lwidth;
|
xoffset += lwidth;
|
||||||
b = new ButtonWidget(this, font, xoffset, yoffset, buttonWidth, buttonHeight,
|
b = new ButtonWidget(this, font, xoffset, yoffset, buttonWidth, buttonHeight,
|
||||||
"Reload ROM", kReloadRomCmd, 0);
|
"Reload ROM", kReloadRomCmd);
|
||||||
b->setEditable(true);
|
|
||||||
wid.push_back(b);
|
wid.push_back(b);
|
||||||
xoffset += lwidth;
|
xoffset += lwidth;
|
||||||
b = new ButtonWidget(this, font, xoffset, yoffset, buttonWidth, buttonHeight,
|
b = new ButtonWidget(this, font, xoffset, yoffset, buttonWidth, buttonHeight,
|
||||||
"Exit Game", kExitCmd, 0);
|
"Exit Game", kExitCmd);
|
||||||
b->setEditable(true);
|
|
||||||
wid.push_back(b);
|
wid.push_back(b);
|
||||||
|
|
||||||
addToFocusList(wid);
|
addToFocusList(wid);
|
||||||
|
@ -142,100 +126,6 @@ CommandDialog::~CommandDialog()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
void CommandDialog::handleKeyDown(int ascii, int keycode, int modifiers)
|
|
||||||
{
|
|
||||||
bool handled = true;
|
|
||||||
int row = mySelectedItem / kNumRows,
|
|
||||||
col = mySelectedItem - (row * kNumCols);
|
|
||||||
|
|
||||||
// Only detect the cursor keys, otherwise pass to base class
|
|
||||||
switch(ascii)
|
|
||||||
{
|
|
||||||
case kCursorUp:
|
|
||||||
if (row > 0)
|
|
||||||
--row;
|
|
||||||
else if(col > 0)
|
|
||||||
{
|
|
||||||
row = kNumRows - 1;
|
|
||||||
--col;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case kCursorDown:
|
|
||||||
if (row < kNumRows - 1)
|
|
||||||
++row;
|
|
||||||
else if(col < kNumCols - 1)
|
|
||||||
{
|
|
||||||
row = 0;
|
|
||||||
++col;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case kCursorLeft:
|
|
||||||
if (col > 0)
|
|
||||||
--col;
|
|
||||||
else if(row > 0)
|
|
||||||
{
|
|
||||||
col = kNumCols - 1;
|
|
||||||
--row;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case kCursorRight:
|
|
||||||
if (col < kNumCols - 1)
|
|
||||||
++col;
|
|
||||||
else if(row < kNumRows - 1)
|
|
||||||
{
|
|
||||||
col = 0;
|
|
||||||
++row;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
handled = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(handled)
|
|
||||||
{
|
|
||||||
mySelectedItem = row * kNumCols + col;
|
|
||||||
Dialog::setFocus(getFocusList()[mySelectedItem]);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
Dialog::handleKeyDown(ascii, keycode, modifiers);
|
|
||||||
}
|
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
void CommandDialog::handleJoyAxis(int stick, int axis, int value)
|
|
||||||
{
|
|
||||||
if(!parent()->joymouse())
|
|
||||||
return;
|
|
||||||
|
|
||||||
// We make the (hopefully) valid assumption that all joysticks
|
|
||||||
// treat axis the same way. Eventually, we may need to remap
|
|
||||||
// these actions of this assumption is invalid.
|
|
||||||
// TODO - make this work better with analog axes ...
|
|
||||||
int key = -1;
|
|
||||||
if(axis % 2 == 0) // x-direction
|
|
||||||
{
|
|
||||||
if(value < 0)
|
|
||||||
key = kCursorLeft;
|
|
||||||
else if(value > 0)
|
|
||||||
key = kCursorRight;
|
|
||||||
}
|
|
||||||
else // y-direction
|
|
||||||
{
|
|
||||||
if(value < 0)
|
|
||||||
key = kCursorUp;
|
|
||||||
else if(value > 0)
|
|
||||||
key = kCursorDown;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(key != -1)
|
|
||||||
handleKeyDown(key, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void CommandDialog::handleCommand(CommandSender* sender, int cmd,
|
void CommandDialog::handleCommand(CommandSender* sender, int cmd,
|
||||||
int data, int id)
|
int data, int id)
|
||||||
|
|
|
@ -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: CommandDialog.hxx,v 1.4 2006-01-04 01:24:17 stephena Exp $
|
// $Id: CommandDialog.hxx,v 1.5 2006-05-04 17:45:25 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
|
||||||
|
@ -36,12 +36,8 @@ class CommandDialog : public Dialog
|
||||||
~CommandDialog();
|
~CommandDialog();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void handleKeyDown(int ascii, int keycode, int modifiers);
|
|
||||||
virtual void handleJoyAxis(int stick, int axis, int value);
|
|
||||||
virtual void handleCommand(CommandSender* sender, int cmd, int data, int id);
|
virtual void handleCommand(CommandSender* sender, int cmd, int data, int id);
|
||||||
|
|
||||||
virtual bool wantsEvents() { return true; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int mySelectedItem;
|
int mySelectedItem;
|
||||||
|
|
||||||
|
|
|
@ -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: Dialog.cxx,v 1.43 2006-03-02 13:10:53 stephena Exp $
|
// $Id: Dialog.cxx,v 1.44 2006-05-04 17:45:25 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,6 +98,10 @@ void Dialog::releaseFocus()
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void Dialog::addFocusWidget(Widget* w)
|
void Dialog::addFocusWidget(Widget* w)
|
||||||
{
|
{
|
||||||
|
// All focusable widgets should retain focus
|
||||||
|
if(w)
|
||||||
|
w->setFlags(WIDGET_RETAIN_FOCUS);
|
||||||
|
|
||||||
if(_ourFocusList.size() == 0)
|
if(_ourFocusList.size() == 0)
|
||||||
{
|
{
|
||||||
Focus f;
|
Focus f;
|
||||||
|
@ -111,6 +115,10 @@ void Dialog::addFocusWidget(Widget* w)
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void Dialog::addToFocusList(WidgetArray& list, int id)
|
void Dialog::addToFocusList(WidgetArray& list, int id)
|
||||||
{
|
{
|
||||||
|
// All focusable widgets should retain focus
|
||||||
|
for(unsigned int i = 0; i < list.size(); ++i)
|
||||||
|
list[i]->setFlags(WIDGET_RETAIN_FOCUS);
|
||||||
|
|
||||||
id++; // Arrays start at 0, not -1.
|
id++; // Arrays start at 0, not -1.
|
||||||
|
|
||||||
// Make sure the array is large enough
|
// Make sure the array is large enough
|
||||||
|
@ -125,7 +133,7 @@ void Dialog::addToFocusList(WidgetArray& list, int id)
|
||||||
if(id == 0 && _ourFocusList.size() > 0)
|
if(id == 0 && _ourFocusList.size() > 0)
|
||||||
_focusList = _ourFocusList[0].focusList;
|
_focusList = _ourFocusList[0].focusList;
|
||||||
|
|
||||||
if(list.size() > 0 && !(list[0]->getFlags() & WIDGET_NODRAW_FOCUS))
|
if(list.size() > 0)
|
||||||
_ourFocusList[id].focusedWidget = list[0];
|
_ourFocusList[id].focusedWidget = list[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -186,12 +194,6 @@ void Dialog::redrawFocus()
|
||||||
_focusedWidget = Widget::setFocusForChain(this, getFocusList(), _focusedWidget, 0);
|
_focusedWidget = Widget::setFocusForChain(this, getFocusList(), _focusedWidget, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
bool Dialog::wantsEvents()
|
|
||||||
{
|
|
||||||
return _focusedWidget && _focusedWidget->wantsEvents();
|
|
||||||
}
|
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void Dialog::draw()
|
void Dialog::draw()
|
||||||
{
|
{
|
||||||
|
@ -290,41 +292,79 @@ void Dialog::handleKeyDown(int ascii, int keycode, int modifiers)
|
||||||
// Shift-left/shift-right cursor selects next tab
|
// Shift-left/shift-right cursor selects next tab
|
||||||
// Tab sets next widget in current tab
|
// Tab sets next widget in current tab
|
||||||
// Shift-Tab sets previous widget in current tab
|
// Shift-Tab sets previous widget in current tab
|
||||||
//
|
Event::Type e = Event::NoType;
|
||||||
// Widgets are only cycled if currently focused key hasn't claimed
|
|
||||||
// the TAB key
|
// Detect selection of previous and next tab headers and objects
|
||||||
// TODO - figure out workaround for this
|
// For some strange reason, 'tab' needs to be interpreted as keycode,
|
||||||
if(_ourTab && instance()->eventHandler().kbdShift(modifiers))
|
// not ascii??
|
||||||
|
if(instance()->eventHandler().kbdShift(modifiers))
|
||||||
{
|
{
|
||||||
// these key-combos are never passed to the child widget
|
|
||||||
if(ascii == 256+20) // left arrow
|
if(ascii == 256+20) // left arrow
|
||||||
|
e = Event::UITabPrev;
|
||||||
|
else if(ascii == 256+19) // right arrow
|
||||||
|
e = Event::UITabNext;
|
||||||
|
else if(keycode == 9) // tab
|
||||||
|
e = Event::UINavPrev;
|
||||||
|
}
|
||||||
|
else if(keycode == 9) // tab
|
||||||
|
e = Event::UINavNext;
|
||||||
|
|
||||||
|
// Check the keytable now, since we might get one of the above events,
|
||||||
|
// which must always be processed before any widget sees it.
|
||||||
|
bool handled = false;
|
||||||
|
if(e == Event::NoType)
|
||||||
|
e = instance()->eventHandler().eventForKey(ascii, kMenuOverlay);
|
||||||
|
|
||||||
|
switch(e)
|
||||||
|
{
|
||||||
|
case Event::UITabPrev:
|
||||||
|
if(_ourTab)
|
||||||
{
|
{
|
||||||
_ourTab->cycleTab(-1);
|
_ourTab->cycleTab(-1);
|
||||||
return;
|
handled = true;
|
||||||
}
|
}
|
||||||
else if(ascii == 256 + 19) // right arrow
|
break;
|
||||||
|
|
||||||
|
case Event::UITabNext:
|
||||||
|
if(_ourTab)
|
||||||
{
|
{
|
||||||
_ourTab->cycleTab(+1);
|
_ourTab->cycleTab(+1);
|
||||||
return;
|
handled = true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
if(keycode == 9) // tab key
|
case Event::UINavPrev:
|
||||||
|
if(_focusedWidget && !_focusedWidget->wantsTab())
|
||||||
{
|
{
|
||||||
if(_focusedWidget && !(_focusedWidget->getFlags() & WIDGET_WANTS_TAB))
|
|
||||||
{
|
|
||||||
if(instance()->eventHandler().kbdShift(modifiers))
|
|
||||||
_focusedWidget = Widget::setFocusForChain(this, getFocusList(),
|
_focusedWidget = Widget::setFocusForChain(this, getFocusList(),
|
||||||
_focusedWidget, -1);
|
_focusedWidget, -1);
|
||||||
else
|
handled = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Event::UINavNext:
|
||||||
|
if(_focusedWidget && !_focusedWidget->wantsTab())
|
||||||
|
{
|
||||||
_focusedWidget = Widget::setFocusForChain(this, getFocusList(),
|
_focusedWidget = Widget::setFocusForChain(this, getFocusList(),
|
||||||
_focusedWidget, +1);
|
_focusedWidget, +1);
|
||||||
return; // this key-combo is never passed to the child widget
|
handled = true;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
handled = false;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_focusedWidget)
|
// Unless a widget has claimed all responsibility for data, we assume
|
||||||
|
// that if an event exists for the given data, it should have priority.
|
||||||
|
if(!handled && _focusedWidget)
|
||||||
|
{
|
||||||
|
if(_focusedWidget->wantsRaw() || e == Event::NoType)
|
||||||
_focusedWidget->handleKeyDown(ascii, keycode, modifiers);
|
_focusedWidget->handleKeyDown(ascii, keycode, modifiers);
|
||||||
|
else
|
||||||
|
_focusedWidget->handleEvent(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -388,9 +428,18 @@ void Dialog::handleMouseMoved(int x, int y, int button)
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void Dialog::handleJoyDown(int stick, int button)
|
void Dialog::handleJoyDown(int stick, int button)
|
||||||
{
|
{
|
||||||
// Focused widget receives joystick events
|
Event::Type e = Event::NoType; // FIXME - do a lookup
|
||||||
if(_focusedWidget)
|
bool handled = false; // isNavigation(e);
|
||||||
|
|
||||||
|
// Unless a widget has claimed all responsibility for data, we assume
|
||||||
|
// that if an event exists for the given data, it should have priority.
|
||||||
|
if(!handled && _focusedWidget)
|
||||||
|
{
|
||||||
|
if(_focusedWidget->wantsRaw() || e == Event::NoType)
|
||||||
_focusedWidget->handleJoyDown(stick, button);
|
_focusedWidget->handleJoyDown(stick, button);
|
||||||
|
else
|
||||||
|
_focusedWidget->handleEvent(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -404,16 +453,36 @@ void Dialog::handleJoyUp(int stick, int button)
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void Dialog::handleJoyAxis(int stick, int axis, int value)
|
void Dialog::handleJoyAxis(int stick, int axis, int value)
|
||||||
{
|
{
|
||||||
// Focused widget receives joystick events
|
Event::Type e = Event::NoType; // FIXME - do a lookup
|
||||||
if(_focusedWidget)
|
bool handled = false; // isNavigation(e);
|
||||||
|
|
||||||
|
// Unless a widget has claimed all responsibility for data, we assume
|
||||||
|
// that if an event exists for the given data, it should have priority.
|
||||||
|
if(!handled && _focusedWidget)
|
||||||
|
{
|
||||||
|
if(_focusedWidget->wantsRaw() || e == Event::NoType)
|
||||||
_focusedWidget->handleJoyAxis(stick, axis, value);
|
_focusedWidget->handleJoyAxis(stick, axis, value);
|
||||||
|
else
|
||||||
|
_focusedWidget->handleEvent(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool Dialog::handleJoyHat(int stick, int hat, int value)
|
bool Dialog::handleJoyHat(int stick, int hat, int value)
|
||||||
{
|
{
|
||||||
// Focused widget receives joystick events
|
Event::Type e = Event::NoType; // FIXME - do a lookup
|
||||||
return (_focusedWidget && _focusedWidget->handleJoyHat(stick, hat, value));
|
bool handled = false; // isNavigation(e);
|
||||||
|
|
||||||
|
// Unless a widget has claimed all responsibility for data, we assume
|
||||||
|
// that if an event exists for the given data, it should have priority.
|
||||||
|
if(!handled && _focusedWidget)
|
||||||
|
{
|
||||||
|
if(_focusedWidget->wantsRaw() || e == Event::NoType)
|
||||||
|
return _focusedWidget->handleJoyHat(stick, hat, value);
|
||||||
|
else
|
||||||
|
return _focusedWidget->handleEvent(e);
|
||||||
|
}
|
||||||
|
return handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -444,14 +513,14 @@ Widget* Dialog::findWidget(int x, int y)
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
ButtonWidget* Dialog::addButton(const GUI::Font& font, int x, int y,
|
ButtonWidget* Dialog::addButton(const GUI::Font& font, int x, int y,
|
||||||
const string& label, int cmd, char hotkey)
|
const string& label, int cmd)
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
const int w = 6 * font.getMaxCharWidth(),
|
const int w = 6 * font.getMaxCharWidth(),
|
||||||
h = font.getFontHeight() + 6;
|
h = font.getFontHeight() + 6;
|
||||||
|
|
||||||
return new ButtonWidget(this, font, x, y, w, h, label, cmd, hotkey);
|
return new ButtonWidget(this, font, x, y, w, h, label, cmd);
|
||||||
#else
|
#else
|
||||||
return new ButtonWidget(this, font, x, y, kButtonWidth, 16, label, cmd, hotkey);
|
return new ButtonWidget(this, font, x, y, kButtonWidth, 16, label, cmd);
|
||||||
#endif
|
#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: Dialog.hxx,v 1.28 2006-03-02 13:10:53 stephena Exp $
|
// $Id: Dialog.hxx,v 1.29 2006-05-04 17:45:25 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
|
||||||
|
@ -36,7 +36,7 @@ class TabWidget;
|
||||||
This is the base class for all dialog boxes.
|
This is the base class for all dialog boxes.
|
||||||
|
|
||||||
@author Stephen Anthony
|
@author Stephen Anthony
|
||||||
@version $Id: Dialog.hxx,v 1.28 2006-03-02 13:10:53 stephena Exp $
|
@version $Id: Dialog.hxx,v 1.29 2006-05-04 17:45:25 stephena Exp $
|
||||||
*/
|
*/
|
||||||
class Dialog : public GuiObject
|
class Dialog : public GuiObject
|
||||||
{
|
{
|
||||||
|
@ -86,13 +86,10 @@ class Dialog : public GuiObject
|
||||||
virtual void handleCommand(CommandSender* sender, int cmd, int data, int id);
|
virtual void handleCommand(CommandSender* sender, int cmd, int data, int id);
|
||||||
virtual void handleScreenChanged() {}
|
virtual void handleScreenChanged() {}
|
||||||
|
|
||||||
/** The dialog wants all events */
|
|
||||||
virtual bool wantsEvents();
|
|
||||||
|
|
||||||
Widget* findWidget(int x, int y); // Find the widget at pos x,y if any
|
Widget* findWidget(int x, int y); // Find the widget at pos x,y if any
|
||||||
|
|
||||||
ButtonWidget* addButton(const GUI::Font& font, int x, int y,
|
ButtonWidget* addButton(const GUI::Font& font, int x, int y,
|
||||||
const string& label = "", int cmd = 0, char hotkey = 0);
|
const string& label = "", int cmd = 0);
|
||||||
|
|
||||||
void setResult(int result) { _result = result; }
|
void setResult(int result) { _result = result; }
|
||||||
int getResult() const { return _result; }
|
int getResult() const { return _result; }
|
||||||
|
|
|
@ -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: DialogContainer.cxx,v 1.31 2006-03-02 13:10:53 stephena Exp $
|
// $Id: DialogContainer.cxx,v 1.32 2006-05-04 17:45:25 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#include "OSystem.hxx"
|
#include "OSystem.hxx"
|
||||||
|
@ -32,10 +32,6 @@ DialogContainer::DialogContainer(OSystem* osystem)
|
||||||
myTime(0),
|
myTime(0),
|
||||||
myRefreshFlag(false)
|
myRefreshFlag(false)
|
||||||
{
|
{
|
||||||
memset(&ourJoyMouse, 0, sizeof(JoyMouse));
|
|
||||||
ourJoyMouse.delay_time = 25;
|
|
||||||
|
|
||||||
ourEnableJoyMouseFlag = myOSystem->settings().getBool("joymouse");
|
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,6 +69,7 @@ void DialogContainer::updateTime(uInt32 time)
|
||||||
myClickRepeatTime = myTime + kClickRepeatSustainDelay;
|
myClickRepeatTime = myTime + kClickRepeatSustainDelay;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* FIXME - make this similar to the key-repeat code above
|
||||||
if(ourEnableJoyMouseFlag && myCurrentAxisDown.stick != -1 &&
|
if(ourEnableJoyMouseFlag && myCurrentAxisDown.stick != -1 &&
|
||||||
myAxisRepeatTime < myTime)
|
myAxisRepeatTime < myTime)
|
||||||
{
|
{
|
||||||
|
@ -98,10 +95,7 @@ void DialogContainer::updateTime(uInt32 time)
|
||||||
myAxisRepeatTime = myTime + kAxisRepeatSustainDelay / interval;
|
myAxisRepeatTime = myTime + kAxisRepeatSustainDelay / interval;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
// Update joy to mouse events
|
|
||||||
if(ourEnableJoyMouseFlag)
|
|
||||||
handleJoyMouse(time);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -277,17 +271,11 @@ void DialogContainer::handleJoyEvent(int stick, int button, uInt8 state)
|
||||||
// Send the event to the dialog box on the top of the stack
|
// Send the event to the dialog box on the top of the stack
|
||||||
Dialog* activeDialog = myDialogStack.top();
|
Dialog* activeDialog = myDialogStack.top();
|
||||||
|
|
||||||
if(activeDialog->wantsEvents())
|
|
||||||
{
|
|
||||||
if(state == 1)
|
if(state == 1)
|
||||||
activeDialog->handleJoyDown(stick, button);
|
activeDialog->handleJoyDown(stick, button);
|
||||||
else
|
else
|
||||||
activeDialog->handleJoyUp(stick, button);
|
activeDialog->handleJoyUp(stick, button);
|
||||||
}
|
}
|
||||||
else if(ourEnableJoyMouseFlag)
|
|
||||||
myOSystem->eventHandler().createMouseButtonEvent(
|
|
||||||
ourJoyMouse.x, ourJoyMouse.y, state);
|
|
||||||
}
|
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void DialogContainer::handleJoyAxisEvent(int stick, int axis, int value)
|
void DialogContainer::handleJoyAxisEvent(int stick, int axis, int value)
|
||||||
|
@ -305,9 +293,7 @@ void DialogContainer::handleJoyAxisEvent(int stick, int axis, int value)
|
||||||
else
|
else
|
||||||
value = 0;
|
value = 0;
|
||||||
|
|
||||||
if(activeDialog->wantsEvents())
|
// Only stop firing events if it's the current stick
|
||||||
{
|
|
||||||
// Only stop firing events if it's the current key
|
|
||||||
if(myCurrentAxisDown.stick == stick && value == 0)
|
if(myCurrentAxisDown.stick == stick && value == 0)
|
||||||
{
|
{
|
||||||
myCurrentAxisDown.stick = myCurrentAxisDown.axis = -1;
|
myCurrentAxisDown.stick = myCurrentAxisDown.axis = -1;
|
||||||
|
@ -323,40 +309,6 @@ void DialogContainer::handleJoyAxisEvent(int stick, int axis, int value)
|
||||||
}
|
}
|
||||||
activeDialog->handleJoyAxis(stick, axis, value);
|
activeDialog->handleJoyAxis(stick, axis, value);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
if(axis % 2 == 0) // x-direction
|
|
||||||
{
|
|
||||||
if(value != 0)
|
|
||||||
{
|
|
||||||
ourJoyMouse.x_vel = (value > 0) ? 1 : -1;
|
|
||||||
ourJoyMouse.x_down_count = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ourJoyMouse.x_vel = 0;
|
|
||||||
ourJoyMouse.x_down_count = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else // y-direction
|
|
||||||
{
|
|
||||||
value = -value;
|
|
||||||
|
|
||||||
if(value != 0)
|
|
||||||
{
|
|
||||||
ourJoyMouse.y_vel = (-value > 0) ? 1 : -1;
|
|
||||||
ourJoyMouse.y_down_count = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ourJoyMouse.y_vel = 0;
|
|
||||||
ourJoyMouse.y_down_count = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
myCurrentAxisDown.stick = myCurrentAxisDown.axis = -1;
|
|
||||||
myCurrentAxisDown.count = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void DialogContainer::handleJoyHatEvent(int stick, int hat, int value)
|
void DialogContainer::handleJoyHatEvent(int stick, int hat, int value)
|
||||||
|
@ -367,126 +319,8 @@ void DialogContainer::handleJoyHatEvent(int stick, int hat, int value)
|
||||||
// Send the event to the dialog box on the top of the stack
|
// Send the event to the dialog box on the top of the stack
|
||||||
Dialog* activeDialog = myDialogStack.top();
|
Dialog* activeDialog = myDialogStack.top();
|
||||||
|
|
||||||
if(!(activeDialog->wantsEvents() &&
|
// FIXME - add speedup processing, similar to axis events
|
||||||
activeDialog->handleJoyHat(stick, hat, value)))
|
activeDialog->handleJoyHat(stick, hat, value);
|
||||||
{
|
|
||||||
bool handled = true;
|
|
||||||
switch(value)
|
|
||||||
{
|
|
||||||
case kJHatCentered:
|
|
||||||
handleJoyAxisEvent(stick, 0, 0);
|
|
||||||
handleJoyAxisEvent(stick, 1, 0); // axis 0 & 1, 0 ==> OFF
|
|
||||||
break;
|
|
||||||
case kJHatUp:
|
|
||||||
handleJoyAxisEvent(stick, 1, -32767); // axis 1, -value ==> UP
|
|
||||||
break;
|
|
||||||
case kJHatLeft:
|
|
||||||
handleJoyAxisEvent(stick, 0, -32767); // axis 0, -value ==> LEFT
|
|
||||||
break;
|
|
||||||
case kJHatDown:
|
|
||||||
handleJoyAxisEvent(stick, 1, 32767); // axis 1, +value ==> DOWN
|
|
||||||
break;
|
|
||||||
case kJHatRight:
|
|
||||||
handleJoyAxisEvent(stick, 0, 32767); // axis 0, +value ==> RIGHT
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
handled = false;
|
|
||||||
}
|
|
||||||
if(handled)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
void DialogContainer::handleJoyMouse(uInt32 time)
|
|
||||||
{
|
|
||||||
bool mouseAccel = true;//false; // TODO - make this a commandline option
|
|
||||||
int oldX = ourJoyMouse.x, oldY = ourJoyMouse.y;
|
|
||||||
|
|
||||||
if(time >= ourJoyMouse.last_time + ourJoyMouse.delay_time)
|
|
||||||
{
|
|
||||||
ourJoyMouse.last_time = time;
|
|
||||||
if(ourJoyMouse.x_down_count == 1)
|
|
||||||
{
|
|
||||||
ourJoyMouse.x_down_time = time;
|
|
||||||
ourJoyMouse.x_down_count = 2;
|
|
||||||
}
|
|
||||||
if(ourJoyMouse.y_down_count == 1)
|
|
||||||
{
|
|
||||||
ourJoyMouse.y_down_time = time;
|
|
||||||
ourJoyMouse.y_down_count = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(ourJoyMouse.x_vel || ourJoyMouse.y_vel)
|
|
||||||
{
|
|
||||||
if(ourJoyMouse.x_down_count)
|
|
||||||
{
|
|
||||||
if(mouseAccel && time > ourJoyMouse.x_down_time + ourJoyMouse.delay_time * 12)
|
|
||||||
{
|
|
||||||
if(ourJoyMouse.x_vel > 0)
|
|
||||||
ourJoyMouse.x_vel++;
|
|
||||||
else
|
|
||||||
ourJoyMouse.x_vel--;
|
|
||||||
}
|
|
||||||
else if(time > ourJoyMouse.x_down_time + ourJoyMouse.delay_time * 8)
|
|
||||||
{
|
|
||||||
if(ourJoyMouse.x_vel > 0)
|
|
||||||
ourJoyMouse.x_vel = ourJoyMouse.amt;
|
|
||||||
else
|
|
||||||
ourJoyMouse.x_vel = -ourJoyMouse.amt;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(ourJoyMouse.y_down_count)
|
|
||||||
{
|
|
||||||
if(mouseAccel && time > ourJoyMouse.y_down_time + ourJoyMouse.delay_time * 12)
|
|
||||||
{
|
|
||||||
if(ourJoyMouse.y_vel > 0)
|
|
||||||
ourJoyMouse.y_vel++;
|
|
||||||
else
|
|
||||||
ourJoyMouse.y_vel--;
|
|
||||||
}
|
|
||||||
else if(time > ourJoyMouse.y_down_time + ourJoyMouse.delay_time * 8)
|
|
||||||
{
|
|
||||||
if(ourJoyMouse.y_vel > 0)
|
|
||||||
ourJoyMouse.y_vel = ourJoyMouse.amt;
|
|
||||||
else
|
|
||||||
ourJoyMouse.y_vel = -ourJoyMouse.amt;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ourJoyMouse.x += ourJoyMouse.x_vel;
|
|
||||||
ourJoyMouse.y += ourJoyMouse.y_vel;
|
|
||||||
|
|
||||||
if(ourJoyMouse.x < 0)
|
|
||||||
{
|
|
||||||
ourJoyMouse.x = 0;
|
|
||||||
ourJoyMouse.x_vel = -1;
|
|
||||||
ourJoyMouse.x_down_count = 1;
|
|
||||||
}
|
|
||||||
else if(ourJoyMouse.x > ourJoyMouse.x_max)
|
|
||||||
{
|
|
||||||
ourJoyMouse.x = ourJoyMouse.x_max;
|
|
||||||
ourJoyMouse.x_vel = 1;
|
|
||||||
ourJoyMouse.x_down_count = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(ourJoyMouse.y < 0)
|
|
||||||
{
|
|
||||||
ourJoyMouse.y = 0;
|
|
||||||
ourJoyMouse.y_vel = -1;
|
|
||||||
ourJoyMouse.y_down_count = 1;
|
|
||||||
}
|
|
||||||
else if(ourJoyMouse.y > ourJoyMouse.y_max)
|
|
||||||
{
|
|
||||||
ourJoyMouse.y = ourJoyMouse.y_max;
|
|
||||||
ourJoyMouse.y_vel = 1;
|
|
||||||
ourJoyMouse.y_down_count = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(oldX != ourJoyMouse.x || oldY != ourJoyMouse.y)
|
|
||||||
myOSystem->eventHandler().createMouseMotionEvent(ourJoyMouse.x, ourJoyMouse.y);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -500,19 +334,4 @@ void DialogContainer::reset()
|
||||||
|
|
||||||
myCurrentAxisDown.stick = myCurrentAxisDown.axis = -1;
|
myCurrentAxisDown.stick = myCurrentAxisDown.axis = -1;
|
||||||
myCurrentAxisDown.count = 0;
|
myCurrentAxisDown.count = 0;
|
||||||
|
|
||||||
int oldX = ourJoyMouse.x, oldY = ourJoyMouse.y;
|
|
||||||
if(ourJoyMouse.x > ourJoyMouse.x_max)
|
|
||||||
ourJoyMouse.x = ourJoyMouse.x_max;
|
|
||||||
if(ourJoyMouse.y > ourJoyMouse.y_max)
|
|
||||||
ourJoyMouse.y = ourJoyMouse.y_max;
|
|
||||||
|
|
||||||
if(oldX != ourJoyMouse.x || oldY != ourJoyMouse.y)
|
|
||||||
myOSystem->eventHandler().createMouseMotionEvent(ourJoyMouse.x, ourJoyMouse.y);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
bool DialogContainer::ourEnableJoyMouseFlag;
|
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
JoyMouse DialogContainer::ourJoyMouse;
|
|
||||||
|
|
|
@ -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: DialogContainer.hxx,v 1.16 2006-01-09 16:50:01 stephena Exp $
|
// $Id: DialogContainer.hxx,v 1.17 2006-05-04 17:45:25 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#ifndef DIALOG_CONTAINER_HXX
|
#ifndef DIALOG_CONTAINER_HXX
|
||||||
|
@ -37,7 +37,7 @@ typedef FixedStack<Dialog *> DialogStack;
|
||||||
a stack, and handles their events.
|
a stack, and handles their events.
|
||||||
|
|
||||||
@author Stephen Anthony
|
@author Stephen Anthony
|
||||||
@version $Id: DialogContainer.hxx,v 1.16 2006-01-09 16:50:01 stephena Exp $
|
@version $Id: DialogContainer.hxx,v 1.17 2006-05-04 17:45:25 stephena Exp $
|
||||||
*/
|
*/
|
||||||
class DialogContainer
|
class DialogContainer
|
||||||
{
|
{
|
||||||
|
@ -150,13 +150,7 @@ class DialogContainer
|
||||||
*/
|
*/
|
||||||
virtual void initialize() = 0;
|
virtual void initialize() = 0;
|
||||||
|
|
||||||
/**
|
|
||||||
Whether joymouse emulation is enabled
|
|
||||||
*/
|
|
||||||
static bool joymouse() { return ourEnableJoyMouseFlag; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void handleJoyMouse(uInt32);
|
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -211,12 +205,6 @@ class DialogContainer
|
||||||
uInt32 time; // Time
|
uInt32 time; // Time
|
||||||
int count; // How often was it already pressed?
|
int count; // How often was it already pressed?
|
||||||
} myLastClick;
|
} myLastClick;
|
||||||
|
|
||||||
// Whether to enable joymouse emulation
|
|
||||||
static bool ourEnableJoyMouseFlag;
|
|
||||||
|
|
||||||
// Emulation of mouse using joystick axis events
|
|
||||||
static JoyMouse ourJoyMouse;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#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: EditTextWidget.cxx,v 1.14 2006-02-22 17:38:04 stephena Exp $
|
// $Id: EditTextWidget.cxx,v 1.15 2006-05-04 17:45:25 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
|
||||||
|
@ -34,6 +34,7 @@ EditTextWidget::EditTextWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
_type = kEditTextWidget;
|
_type = kEditTextWidget;
|
||||||
|
|
||||||
_editable = true;
|
_editable = true;
|
||||||
|
startEditMode(); // We're always in edit mode
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -105,15 +106,18 @@ void EditTextWidget::lostFocusWidget()
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void EditTextWidget::startEditMode()
|
void EditTextWidget::startEditMode()
|
||||||
{
|
{
|
||||||
|
EditableWidget::startEditMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void EditTextWidget::endEditMode()
|
void EditTextWidget::endEditMode()
|
||||||
{
|
{
|
||||||
|
EditableWidget::endEditMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void EditTextWidget::abortEditMode()
|
void EditTextWidget::abortEditMode()
|
||||||
{
|
{
|
||||||
setEditString(_backupString);
|
setEditString(_backupString);
|
||||||
|
EditableWidget::abortEditMode();
|
||||||
}
|
}
|
||||||
|
|
|
@ -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: EditableWidget.cxx,v 1.17 2006-03-25 00:34:17 stephena Exp $
|
// $Id: EditableWidget.cxx,v 1.18 2006-05-04 17:45:25 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
|
||||||
|
@ -58,6 +58,15 @@ void EditableWidget::setEditString(const string& str)
|
||||||
// Make sure the new string is seen onscreen
|
// Make sure the new string is seen onscreen
|
||||||
setDirty(); draw();
|
setDirty(); draw();
|
||||||
}
|
}
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void EditableWidget::setEditable(bool editable)
|
||||||
|
{
|
||||||
|
_editable = editable;
|
||||||
|
if(_editable)
|
||||||
|
setFlags(WIDGET_WANTS_RAWDATA|WIDGET_RETAIN_FOCUS);
|
||||||
|
else
|
||||||
|
clearFlags(WIDGET_WANTS_RAWDATA|WIDGET_RETAIN_FOCUS);
|
||||||
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool EditableWidget::tryInsertChar(char c, int pos)
|
bool EditableWidget::tryInsertChar(char c, int pos)
|
||||||
|
|
|
@ -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: EditableWidget.hxx,v 1.9 2006-02-22 17:38:04 stephena Exp $
|
// $Id: EditableWidget.hxx,v 1.10 2006-05-04 17:45:25 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
|
||||||
|
@ -46,7 +46,7 @@ class EditableWidget : public Widget, public CommandSender
|
||||||
virtual const string& getEditString() const { return _editString; }
|
virtual const string& getEditString() const { return _editString; }
|
||||||
|
|
||||||
bool isEditable() const { return _editable; }
|
bool isEditable() const { return _editable; }
|
||||||
void setEditable(bool editable) { _editable = editable; }
|
void setEditable(bool editable);
|
||||||
|
|
||||||
virtual bool handleKeyDown(int ascii, int keycode, int modifiers);
|
virtual bool handleKeyDown(int ascii, int keycode, int modifiers);
|
||||||
|
|
||||||
|
@ -54,9 +54,9 @@ class EditableWidget : public Widget, public CommandSender
|
||||||
virtual bool wantsFocus() { return _editable; }
|
virtual bool wantsFocus() { return _editable; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void startEditMode() = 0;
|
virtual void startEditMode() { setFlags(WIDGET_WANTS_RAWDATA); }
|
||||||
virtual void endEditMode() = 0;
|
virtual void endEditMode() { clearFlags(WIDGET_WANTS_RAWDATA); }
|
||||||
virtual void abortEditMode() = 0;
|
virtual void abortEditMode() { clearFlags(WIDGET_WANTS_RAWDATA); }
|
||||||
|
|
||||||
virtual GUI::Rect getEditRect() const = 0;
|
virtual GUI::Rect getEditRect() const = 0;
|
||||||
virtual int getCaretOffset() const;
|
virtual int getCaretOffset() const;
|
||||||
|
|
|
@ -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: EventMappingWidget.cxx,v 1.14 2006-03-05 01:18:42 stephena Exp $
|
// $Id: EventMappingWidget.cxx,v 1.15 2006-05-04 17:45:25 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
|
||||||
|
@ -50,7 +50,6 @@ EventMappingWidget::EventMappingWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
myActionsList->setTarget(this);
|
myActionsList->setTarget(this);
|
||||||
myActionsList->setNumberingMode(kListNumberingOff);
|
myActionsList->setNumberingMode(kListNumberingOff);
|
||||||
myActionsList->setEditable(false);
|
myActionsList->setEditable(false);
|
||||||
myActionsList->setFlags(WIDGET_NODRAW_FOCUS);
|
|
||||||
addFocusWidget(myActionsList);
|
addFocusWidget(myActionsList);
|
||||||
|
|
||||||
// Add remap, erase, cancel and default buttons
|
// Add remap, erase, cancel and default buttons
|
||||||
|
@ -58,19 +57,23 @@ EventMappingWidget::EventMappingWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
myMapButton = new ButtonWidget(boss, font, xpos, ypos, 50, 16,
|
myMapButton = new ButtonWidget(boss, font, xpos, ypos, 50, 16,
|
||||||
"Map", kStartMapCmd);
|
"Map", kStartMapCmd);
|
||||||
myMapButton->setTarget(this);
|
myMapButton->setTarget(this);
|
||||||
|
addFocusWidget(myMapButton);
|
||||||
ypos += 20;
|
ypos += 20;
|
||||||
myEraseButton = new ButtonWidget(boss, font, xpos, ypos, 50, 16,
|
myEraseButton = new ButtonWidget(boss, font, xpos, ypos, 50, 16,
|
||||||
"Erase", kEraseCmd);
|
"Erase", kEraseCmd);
|
||||||
myEraseButton->setTarget(this);
|
myEraseButton->setTarget(this);
|
||||||
|
addFocusWidget(myEraseButton);
|
||||||
ypos += 20;
|
ypos += 20;
|
||||||
myCancelMapButton = new ButtonWidget(boss, font, xpos, ypos, 50, 16,
|
myCancelMapButton = new ButtonWidget(boss, font, xpos, ypos, 50, 16,
|
||||||
"Cancel", kStopMapCmd);
|
"Cancel", kStopMapCmd);
|
||||||
myCancelMapButton->setTarget(this);
|
myCancelMapButton->setTarget(this);
|
||||||
myCancelMapButton->clearFlags(WIDGET_ENABLED);
|
myCancelMapButton->clearFlags(WIDGET_ENABLED);
|
||||||
|
addFocusWidget(myCancelMapButton);
|
||||||
ypos += 30;
|
ypos += 30;
|
||||||
myDefaultsButton = new ButtonWidget(boss, font, xpos, ypos, 50, 16,
|
myDefaultsButton = new ButtonWidget(boss, font, xpos, ypos, 50, 16,
|
||||||
"Defaults", kDefaultsCmd);
|
"Defaults", kDefaultsCmd);
|
||||||
myDefaultsButton->setTarget(this);
|
myDefaultsButton->setTarget(this);
|
||||||
|
addFocusWidget(myDefaultsButton);
|
||||||
|
|
||||||
// Show message for currently selected event
|
// Show message for currently selected event
|
||||||
xpos = 10; ypos = 5 + myActionsList->getHeight() + 3;
|
xpos = 10; ypos = 5 + myActionsList->getHeight() + 3;
|
||||||
|
@ -136,9 +139,9 @@ void EventMappingWidget::startRemapping()
|
||||||
myKeyMapping->setColor(kTextColorEm);
|
myKeyMapping->setColor(kTextColorEm);
|
||||||
myKeyMapping->setLabel(buf.str());
|
myKeyMapping->setLabel(buf.str());
|
||||||
|
|
||||||
// Make sure that this widget receives all events,
|
// Make sure that this widget receives all raw data, before any
|
||||||
// and they aren't handled anywhere else
|
// pre-processing occurs
|
||||||
myActionsList->setFlags(WIDGET_WANTS_EVENTS);
|
myActionsList->setFlags(WIDGET_WANTS_RAWDATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -175,7 +178,7 @@ void EventMappingWidget::stopRemapping()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Widget is now free to process events normally
|
// Widget is now free to process events normally
|
||||||
myActionsList->clearFlags(WIDGET_WANTS_EVENTS);
|
myActionsList->clearFlags(WIDGET_WANTS_RAWDATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -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: EventMappingWidget.hxx,v 1.8 2006-03-02 13:10:53 stephena Exp $
|
// $Id: EventMappingWidget.hxx,v 1.9 2006-05-04 17:45:25 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
|
||||||
|
@ -45,10 +45,10 @@ class EventMappingWidget : public Widget, public CommandSender
|
||||||
int x, int y, int w, int h);
|
int x, int y, int w, int h);
|
||||||
~EventMappingWidget();
|
~EventMappingWidget();
|
||||||
|
|
||||||
virtual bool handleKeyDown(int ascii, int keycode, int modifiers);
|
bool handleKeyDown(int ascii, int keycode, int modifiers);
|
||||||
virtual void handleJoyDown(int stick, int button);
|
void handleJoyDown(int stick, int button);
|
||||||
virtual void handleJoyAxis(int stick, int axis, int value);
|
void handleJoyAxis(int stick, int axis, int value);
|
||||||
virtual bool handleJoyHat(int stick, int hat, int value);
|
bool handleJoyHat(int stick, int hat, int value);
|
||||||
|
|
||||||
bool remapMode() { return myRemapStatus; }
|
bool remapMode() { return myRemapStatus; }
|
||||||
|
|
||||||
|
|
|
@ -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: GameInfoDialog.cxx,v 1.24 2006-03-05 01:18:42 stephena Exp $
|
// $Id: GameInfoDialog.cxx,v 1.25 2006-05-04 17:45:25 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
|
||||||
|
@ -47,6 +47,7 @@ GameInfoDialog::GameInfoDialog(
|
||||||
// The tab widget
|
// The tab widget
|
||||||
xpos = 2; ypos = vBorder;
|
xpos = 2; ypos = vBorder;
|
||||||
myTab = new TabWidget(this, font, xpos, ypos, _w - 2*xpos, _h - 24 - 2*ypos);
|
myTab = new TabWidget(this, font, xpos, ypos, _w - 2*xpos, _h - 24 - 2*ypos);
|
||||||
|
addTabWidget(myTab);
|
||||||
|
|
||||||
// 1) Cartridge properties
|
// 1) Cartridge properties
|
||||||
wid.clear();
|
wid.clear();
|
||||||
|
@ -268,13 +269,20 @@ GameInfoDialog::GameInfoDialog(
|
||||||
"(*) Requires a ROM reload", kTextAlignLeft);
|
"(*) Requires a ROM reload", kTextAlignLeft);
|
||||||
|
|
||||||
// Add Defaults, OK and Cancel buttons
|
// Add Defaults, OK and Cancel buttons
|
||||||
|
ButtonWidget* b;
|
||||||
|
wid.clear();
|
||||||
#ifndef MAC_OSX
|
#ifndef MAC_OSX
|
||||||
addButton(font, _w - 2 * (kButtonWidth + 7), _h - 24, "OK", kOKCmd, 0);
|
b = addButton(font, _w - 2 * (kButtonWidth + 7), _h - 24, "OK", kOKCmd);
|
||||||
addButton(font, _w - (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0);
|
wid.push_back(b);
|
||||||
|
b = addButton(font, _w - (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd);
|
||||||
|
wid.push_back(b);
|
||||||
#else
|
#else
|
||||||
addButton(font, _w - 2 * (kButtonWidth + 7), _h - 24, "Cancel", kCloseCmd, 0);
|
b = addButton(font, _w - 2 * (kButtonWidth + 7), _h - 24, "Cancel", kCloseCmd);
|
||||||
addButton(font, _w - (kButtonWidth + 10), _h - 24, "OK", kOKCmd, 0);
|
wid.push_back(b);
|
||||||
|
b = addButton(font, _w - (kButtonWidth + 10), _h - 24, "OK", kOKCmd);
|
||||||
|
wid.push_back(b);
|
||||||
#endif
|
#endif
|
||||||
|
addToFocusList(wid);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -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: GuiObject.hxx,v 1.19 2006-02-22 17:38:04 stephena Exp $
|
// $Id: GuiObject.hxx,v 1.20 2006-05-04 17:45:25 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
|
||||||
|
@ -31,22 +31,11 @@ class Widget;
|
||||||
|
|
||||||
typedef Common::Array<Widget*> WidgetArray;
|
typedef Common::Array<Widget*> WidgetArray;
|
||||||
|
|
||||||
enum {
|
|
||||||
kCursorUp = 256+17,
|
|
||||||
kCursorDown = 256+18,
|
|
||||||
kCursorRight = 256+19,
|
|
||||||
kCursorLeft = 256+20,
|
|
||||||
kCursorHome = 256+22,
|
|
||||||
kCursorEnd = 256+23,
|
|
||||||
kCursorPgUp = 256+24,
|
|
||||||
kCursorPgDn = 256+25
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This is the base class for all GUI objects/widgets.
|
This is the base class for all GUI objects/widgets.
|
||||||
|
|
||||||
@author Stephen Anthony
|
@author Stephen Anthony
|
||||||
@version $Id: GuiObject.hxx,v 1.19 2006-02-22 17:38:04 stephena Exp $
|
@version $Id: GuiObject.hxx,v 1.20 2006-05-04 17:45:25 stephena Exp $
|
||||||
*/
|
*/
|
||||||
class GuiObject : public CommandReceiver
|
class GuiObject : public CommandReceiver
|
||||||
{
|
{
|
||||||
|
|
|
@ -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: HelpDialog.cxx,v 1.15 2006-02-22 17:38:04 stephena Exp $
|
// $Id: HelpDialog.cxx,v 1.16 2006-05-04 17:45:25 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
|
||||||
|
@ -34,12 +34,20 @@ HelpDialog::HelpDialog(OSystem* osystem, DialogContainer* parent,
|
||||||
myPage(1),
|
myPage(1),
|
||||||
myNumPages(4)
|
myNumPages(4)
|
||||||
{
|
{
|
||||||
|
WidgetArray wid;
|
||||||
|
|
||||||
// Add Previous, Next and Close buttons
|
// Add Previous, Next and Close buttons
|
||||||
myPrevButton = addButton(font, 10, h - 24, "Previous", kPrevCmd, 'P');
|
myPrevButton = addButton(font, 10, h - 24, "Previous", kPrevCmd);
|
||||||
myNextButton = addButton(font, (kButtonWidth + 15), h - 24,
|
|
||||||
"Next", kNextCmd, 'N');
|
|
||||||
addButton(font, w - (kButtonWidth + 10), h - 24, "Close", kCloseCmd, 'C');
|
|
||||||
myPrevButton->clearFlags(WIDGET_ENABLED);
|
myPrevButton->clearFlags(WIDGET_ENABLED);
|
||||||
|
wid.push_back(myPrevButton);
|
||||||
|
|
||||||
|
myNextButton = addButton(font, (kButtonWidth + 15), h - 24,
|
||||||
|
"Next", kNextCmd);
|
||||||
|
wid.push_back(myNextButton);
|
||||||
|
|
||||||
|
ButtonWidget* b = addButton(font, w - (kButtonWidth + 10), h - 24,
|
||||||
|
"Close", kCloseCmd);
|
||||||
|
wid.push_back(b);
|
||||||
|
|
||||||
myTitle = new StaticTextWidget(this, font, 5, 5, w - 10, font.getFontHeight(),
|
myTitle = new StaticTextWidget(this, font, 5, 5, w - 10, font.getFontHeight(),
|
||||||
"", kTextAlignCenter);
|
"", kTextAlignCenter);
|
||||||
|
@ -50,6 +58,8 @@ HelpDialog::HelpDialog(OSystem* osystem, DialogContainer* parent,
|
||||||
myDesc[i] = new StaticTextWidget(this, font, 90, 18 + (10 * i), 160,
|
myDesc[i] = new StaticTextWidget(this, font, 90, 18 + (10 * i), 160,
|
||||||
font.getFontHeight(), "", kTextAlignLeft);
|
font.getFontHeight(), "", kTextAlignLeft);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addToFocusList(wid);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -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: InputDialog.cxx,v 1.13 2006-04-05 12:28:39 stephena Exp $
|
// $Id: InputDialog.cxx,v 1.14 2006-05-04 17:45:25 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#include "OSystem.hxx"
|
#include "OSystem.hxx"
|
||||||
|
@ -42,6 +42,7 @@ InputDialog::InputDialog(OSystem* osystem, DialogContainer* parent,
|
||||||
{
|
{
|
||||||
const int vBorder = 4;
|
const int vBorder = 4;
|
||||||
int xpos, ypos, tabID;
|
int xpos, ypos, tabID;
|
||||||
|
WidgetArray wid;
|
||||||
|
|
||||||
// The tab widget
|
// The tab widget
|
||||||
xpos = 2; ypos = vBorder;
|
xpos = 2; ypos = vBorder;
|
||||||
|
@ -64,13 +65,19 @@ InputDialog::InputDialog(OSystem* osystem, DialogContainer* parent,
|
||||||
myTab->setActiveTab(0);
|
myTab->setActiveTab(0);
|
||||||
|
|
||||||
// Add OK and Cancel buttons
|
// Add OK and Cancel buttons
|
||||||
|
ButtonWidget* b;
|
||||||
#ifndef MAC_OSX
|
#ifndef MAC_OSX
|
||||||
addButton(font, _w - 2 * (kButtonWidth + 7), _h - 24, "OK", kOKCmd, 0);
|
b = addButton(font, _w - 2 * (kButtonWidth + 7), _h - 24, "OK", kOKCmd);
|
||||||
addButton(font, _w - (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0);
|
wid.push_back(b);
|
||||||
|
b = addButton(font, _w - (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd);
|
||||||
|
wid.push_back(b);
|
||||||
#else
|
#else
|
||||||
addButton(font, _w - 2 * (kButtonWidth + 7), _h - 24, "Cancel", kCloseCmd, 0);
|
b = addButton(font, _w - 2 * (kButtonWidth + 7), _h - 24, "Cancel", kCloseCmd);
|
||||||
addButton(font, _w - (kButtonWidth + 10), _h - 24, "OK", kOKCmd, 0);
|
wid.push_back(b);
|
||||||
|
b = addButton(font, _w - (kButtonWidth + 10), _h - 24, "OK", kOKCmd);
|
||||||
|
wid.push_back(b);
|
||||||
#endif
|
#endif
|
||||||
|
addToFocusList(wid);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -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.12 2006-03-23 16:16:33 stephena Exp $
|
// $Id: InputTextDialog.cxx,v 1.13 2006-05-04 17:45:25 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
|
||||||
|
@ -29,10 +29,6 @@
|
||||||
|
|
||||||
#include "bspf.hxx"
|
#include "bspf.hxx"
|
||||||
|
|
||||||
enum {
|
|
||||||
kAcceptCmd = 'ACPT'
|
|
||||||
};
|
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
InputTextDialog::InputTextDialog(GuiObject* boss, const GUI::Font& font,
|
InputTextDialog::InputTextDialog(GuiObject* boss, const GUI::Font& font,
|
||||||
const StringList& labels, int x, int y)
|
const StringList& labels, int x, int y)
|
||||||
|
@ -46,6 +42,7 @@ InputTextDialog::InputTextDialog(GuiObject* boss, const GUI::Font& font,
|
||||||
bwidth = font.getStringWidth(" Cancel "),
|
bwidth = font.getStringWidth(" Cancel "),
|
||||||
bheight = font.getLineHeight() + 2;
|
bheight = font.getLineHeight() + 2;
|
||||||
unsigned int xpos, ypos, i, lwidth = 0, maxIdx = 0;
|
unsigned int xpos, ypos, i, lwidth = 0, maxIdx = 0;
|
||||||
|
WidgetArray wid;
|
||||||
|
|
||||||
// Calculate real dimensions
|
// Calculate real dimensions
|
||||||
_w = fontWidth * 25;
|
_w = fontWidth * 25;
|
||||||
|
@ -63,7 +60,6 @@ InputTextDialog::InputTextDialog(GuiObject* boss, const GUI::Font& font,
|
||||||
lwidth = font.getStringWidth(labels[maxIdx]);
|
lwidth = font.getStringWidth(labels[maxIdx]);
|
||||||
|
|
||||||
// Create editboxes for all labels
|
// Create editboxes for all labels
|
||||||
WidgetArray wid;
|
|
||||||
ypos = lineHeight;
|
ypos = lineHeight;
|
||||||
for(i = 0; i < labels.size(); ++i)
|
for(i = 0; i < labels.size(); ++i)
|
||||||
{
|
{
|
||||||
|
@ -80,24 +76,30 @@ InputTextDialog::InputTextDialog(GuiObject* boss, const GUI::Font& font,
|
||||||
myInput.push_back(w);
|
myInput.push_back(w);
|
||||||
ypos += lineHeight + 5;
|
ypos += lineHeight + 5;
|
||||||
}
|
}
|
||||||
addToFocusList(wid);
|
|
||||||
|
|
||||||
xpos = 10;
|
xpos = 10;
|
||||||
myTitle = new StaticTextWidget(this, font, xpos, ypos, _w - 2*xpos, fontHeight,
|
myTitle = new StaticTextWidget(this, font, xpos, ypos, _w - 2*xpos, fontHeight,
|
||||||
"", kTextAlignCenter);
|
"", kTextAlignCenter);
|
||||||
myTitle->setColor(kTextColorEm);
|
myTitle->setColor(kTextColorEm);
|
||||||
|
|
||||||
|
ButtonWidget* b;
|
||||||
#ifndef MAC_OSX
|
#ifndef MAC_OSX
|
||||||
new ButtonWidget(this, font, _w - 2 * (bwidth + 10), _h - bheight - 10,
|
b = new ButtonWidget(this, font, _w - 2 * (bwidth + 10), _h - bheight - 10,
|
||||||
bwidth, bheight, "OK", kAcceptCmd, 0);
|
bwidth, bheight, "OK", kAcceptCmd);
|
||||||
new ButtonWidget(this, font, _w - (bwidth + 10), _h - bheight - 10,
|
wid.push_back(b);
|
||||||
bwidth, bheight, "Cancel", kCloseCmd, 0);
|
b = new ButtonWidget(this, font, _w - (bwidth + 10), _h - bheight - 10,
|
||||||
|
bwidth, bheight, "Cancel", kCloseCmd);
|
||||||
|
wid.push_back(b);
|
||||||
#else
|
#else
|
||||||
new ButtonWidget(this, font, _w - 2 * (bwidth + 10), _h - bheight - 10,
|
b = new ButtonWidget(this, font, _w - 2 * (bwidth + 10), _h - bheight - 10,
|
||||||
bwidth, bheight, "Cancel", kCloseCmd, 0);
|
bwidth, bheight, "Cancel", kCloseCmd);
|
||||||
new ButtonWidget(this, font, _w - (bwidth + 10), _h - bheight - 10,
|
wid.push_back(b);
|
||||||
bwidth, bheight, "OK", kAcceptCmd, 0);
|
b = new ButtonWidget(this, font, _w - (bwidth + 10), _h - bheight - 10,
|
||||||
|
bwidth, bheight, "OK", kAcceptCmd);
|
||||||
|
wid.push_back(b);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
addToFocusList(wid);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -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.6 2005-12-20 00:56:31 stephena Exp $
|
// $Id: InputTextDialog.hxx,v 1.7 2006-05-04 17:45:25 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
|
||||||
|
@ -56,6 +56,10 @@ class InputTextDialog : public Dialog, public CommandSender
|
||||||
|
|
||||||
bool myErrorFlag;
|
bool myErrorFlag;
|
||||||
int myCmd;
|
int myCmd;
|
||||||
|
|
||||||
|
enum {
|
||||||
|
kAcceptCmd = 'ACPT'
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#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: LauncherDialog.cxx,v 1.53 2006-04-12 13:32:06 stephena Exp $
|
// $Id: LauncherDialog.cxx,v 1.54 2006-05-04 17:45:25 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
|
||||||
|
@ -83,8 +83,7 @@ LauncherDialog::LauncherDialog(OSystem* osystem, DialogContainer* parent,
|
||||||
_w - 20, _h - 28 - bheight - 2*fontHeight);
|
_w - 20, _h - 28 - bheight - 2*fontHeight);
|
||||||
myList->setNumberingMode(kListNumberingOff);
|
myList->setNumberingMode(kListNumberingOff);
|
||||||
myList->setEditable(false);
|
myList->setEditable(false);
|
||||||
myList->setFlags(WIDGET_STICKY_FOCUS);
|
wid.push_back(myList);
|
||||||
//wid.push_back(myList);
|
|
||||||
|
|
||||||
// Add note textwidget to show any notes for the currently selected ROM
|
// Add note textwidget to show any notes for the currently selected ROM
|
||||||
xpos += 5; ypos += myList->getHeight() + 4;
|
xpos += 5; ypos += myList->getHeight() + 4;
|
||||||
|
@ -100,45 +99,37 @@ LauncherDialog::LauncherDialog(OSystem* osystem, DialogContainer* parent,
|
||||||
xpos = 10; ypos += myNote->getHeight() + 4;
|
xpos = 10; ypos += myNote->getHeight() + 4;
|
||||||
#ifndef MAC_OSX
|
#ifndef MAC_OSX
|
||||||
myStartButton = new ButtonWidget(this, font, xpos, ypos, bwidth, bheight,
|
myStartButton = new ButtonWidget(this, font, xpos, ypos, bwidth, bheight,
|
||||||
"Select", kStartCmd, 0);
|
"Select", kStartCmd);
|
||||||
myStartButton->setEditable(true);
|
|
||||||
wid.push_back(myStartButton);
|
wid.push_back(myStartButton);
|
||||||
xpos += bwidth + 8;
|
xpos += bwidth + 8;
|
||||||
myPrevDirButton = new ButtonWidget(this, font, xpos, ypos, bwidth, bheight,
|
myPrevDirButton = new ButtonWidget(this, font, xpos, ypos, bwidth, bheight,
|
||||||
"Go Up", kPrevDirCmd, 0);
|
"Go Up", kPrevDirCmd);
|
||||||
myPrevDirButton->setEditable(true);
|
|
||||||
wid.push_back(myPrevDirButton);
|
wid.push_back(myPrevDirButton);
|
||||||
xpos += bwidth + 8;
|
xpos += bwidth + 8;
|
||||||
myOptionsButton = new ButtonWidget(this, font, xpos, ypos, bwidth, bheight,
|
myOptionsButton = new ButtonWidget(this, font, xpos, ypos, bwidth, bheight,
|
||||||
"Options", kOptionsCmd, 0);
|
"Options", kOptionsCmd);
|
||||||
myOptionsButton->setEditable(true);
|
|
||||||
wid.push_back(myOptionsButton);
|
wid.push_back(myOptionsButton);
|
||||||
xpos += bwidth + 8;
|
xpos += bwidth + 8;
|
||||||
myQuitButton = new ButtonWidget(this, font, xpos, ypos, bwidth, bheight,
|
myQuitButton = new ButtonWidget(this, font, xpos, ypos, bwidth, bheight,
|
||||||
"Quit", kQuitCmd, 0);
|
"Quit", kQuitCmd);
|
||||||
myQuitButton->setEditable(true);
|
|
||||||
wid.push_back(myQuitButton);
|
wid.push_back(myQuitButton);
|
||||||
xpos += bwidth + 8;
|
xpos += bwidth + 8;
|
||||||
mySelectedItem = 0; // Highlight 'Select' button
|
mySelectedItem = 0; // Highlight 'Select' button
|
||||||
#else
|
#else
|
||||||
myQuitButton = new ButtonWidget(this, font, xpos, ypos, bwidth, bheight,
|
myQuitButton = new ButtonWidget(this, font, xpos, ypos, bwidth, bheight,
|
||||||
"Quit", kQuitCmd, 0);
|
"Quit", kQuitCmd);
|
||||||
myQuitButton->setEditable(true);
|
|
||||||
wid.push_back(myQuitButton);
|
wid.push_back(myQuitButton);
|
||||||
xpos += bwidth + 8;
|
xpos += bwidth + 8;
|
||||||
myOptionsButton = new ButtonWidget(this, font, xpos, ypos, bwidth, bheight,
|
myOptionsButton = new ButtonWidget(this, font, xpos, ypos, bwidth, bheight,
|
||||||
"Options", kOptionsCmd, 0);
|
"Options", kOptionsCmd);
|
||||||
myOptionsButton->setEditable(true);
|
|
||||||
wid.push_back(myOptionsButton);
|
wid.push_back(myOptionsButton);
|
||||||
xpos += bwidth + 8;
|
xpos += bwidth + 8;
|
||||||
myPrevDirButton = new ButtonWidget(this, font, xpos, ypos, bwidth, bheight,
|
myPrevDirButton = new ButtonWidget(this, font, xpos, ypos, bwidth, bheight,
|
||||||
"Go Up", kPrevDirCmd, 0);
|
"Go Up", kPrevDirCmd);
|
||||||
myPrevDirButton->setEditable(true);
|
|
||||||
wid.push_back(myPrevDirButton);
|
wid.push_back(myPrevDirButton);
|
||||||
xpos += bwidth + 8;
|
xpos += bwidth + 8;
|
||||||
myStartButton = new ButtonWidget(this, font, xpos, ypos, bwidth, bheight,
|
myStartButton = new ButtonWidget(this, font, xpos, ypos, bwidth, bheight,
|
||||||
"Select", kStartCmd, 0);
|
"Select", kStartCmd);
|
||||||
myStartButton->setEditable(true);
|
|
||||||
wid.push_back(myStartButton);
|
wid.push_back(myStartButton);
|
||||||
xpos += bwidth + 8;
|
xpos += bwidth + 8;
|
||||||
mySelectedItem = 3; // Highlight 'Select' button
|
mySelectedItem = 3; // Highlight 'Select' button
|
||||||
|
@ -418,67 +409,6 @@ string LauncherDialog::MD5FromFile(const string& path)
|
||||||
return md5;
|
return md5;
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
void LauncherDialog::handleKeyDown(int ascii, int keycode, int modifiers)
|
|
||||||
{
|
|
||||||
// Only detect the cursor keys, otherwise pass to base class
|
|
||||||
switch(ascii)
|
|
||||||
{
|
|
||||||
case kCursorLeft:
|
|
||||||
mySelectedItem--;
|
|
||||||
if(mySelectedItem < 0) mySelectedItem = 3;
|
|
||||||
Dialog::setFocus(getFocusList()[mySelectedItem]);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case kCursorRight:
|
|
||||||
mySelectedItem++;
|
|
||||||
if(mySelectedItem > 3) mySelectedItem = 0;
|
|
||||||
Dialog::setFocus(getFocusList()[mySelectedItem]);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ' ': // Used to activate currently focused button
|
|
||||||
case '\n':
|
|
||||||
case '\r':
|
|
||||||
Dialog::handleKeyDown(ascii, keycode, modifiers);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
if(!myList->handleKeyDown(ascii, keycode, modifiers))
|
|
||||||
Dialog::handleKeyDown(ascii, keycode, modifiers);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
void LauncherDialog::handleJoyAxis(int stick, int axis, int value)
|
|
||||||
{
|
|
||||||
if(!parent()->joymouse())
|
|
||||||
return;
|
|
||||||
|
|
||||||
// We make the (hopefully) valid assumption that all joysticks
|
|
||||||
// treat axis the same way. Eventually, we may need to remap
|
|
||||||
// these actions of this assumption is invalid.
|
|
||||||
// TODO - make this work better with analog axes ...
|
|
||||||
int key = -1;
|
|
||||||
if(axis % 2 == 0) // x-direction
|
|
||||||
{
|
|
||||||
if(value < 0)
|
|
||||||
key = kCursorLeft;
|
|
||||||
else if(value > 0)
|
|
||||||
key = kCursorRight;
|
|
||||||
}
|
|
||||||
else // y-direction
|
|
||||||
{
|
|
||||||
if(value < 0)
|
|
||||||
key = kCursorUp;
|
|
||||||
else if(value > 0)
|
|
||||||
key = kCursorDown;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(key != -1)
|
|
||||||
handleKeyDown(key, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void LauncherDialog::handleCommand(CommandSender* sender, int cmd,
|
void LauncherDialog::handleCommand(CommandSender* sender, int cmd,
|
||||||
int data, int id)
|
int data, int id)
|
||||||
|
|
|
@ -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: LauncherDialog.hxx,v 1.20 2006-03-19 23:11:31 stephena Exp $
|
// $Id: LauncherDialog.hxx,v 1.21 2006-05-04 17:45:25 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
|
||||||
|
@ -52,15 +52,11 @@ class LauncherDialog : public Dialog
|
||||||
~LauncherDialog();
|
~LauncherDialog();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void handleKeyDown(int ascii, int keycode, int modifiers);
|
|
||||||
virtual void handleJoyAxis(int stick, int axis, int value);
|
|
||||||
virtual void handleCommand(CommandSender* sender, int cmd, int data, int id);
|
virtual void handleCommand(CommandSender* sender, int cmd, int data, int id);
|
||||||
|
|
||||||
void updateListing(bool fullReload = false);
|
void updateListing(bool fullReload = false);
|
||||||
void loadConfig();
|
void loadConfig();
|
||||||
|
|
||||||
virtual bool wantsEvents() { return true; }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ButtonWidget* myStartButton;
|
ButtonWidget* myStartButton;
|
||||||
ButtonWidget* myPrevDirButton;
|
ButtonWidget* myPrevDirButton;
|
||||||
|
|
|
@ -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: LauncherOptionsDialog.cxx,v 1.16 2006-03-19 20:57:55 stephena Exp $
|
// $Id: LauncherOptionsDialog.cxx,v 1.17 2006-05-04 17:45:25 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
|
||||||
|
@ -39,6 +39,9 @@ LauncherOptionsDialog::LauncherOptionsDialog(
|
||||||
{
|
{
|
||||||
const int vBorder = 4;
|
const int vBorder = 4;
|
||||||
int xpos, ypos, bwidth, bheight;
|
int xpos, ypos, bwidth, bheight;
|
||||||
|
WidgetArray wid;
|
||||||
|
ButtonWidget* b;
|
||||||
|
int tabID;
|
||||||
|
|
||||||
bwidth = font.getStringWidth("Cancel") + 20;
|
bwidth = font.getStringWidth("Cancel") + 20;
|
||||||
bheight = font.getLineHeight() + 4;
|
bheight = font.getLineHeight() + 4;
|
||||||
|
@ -46,14 +49,17 @@ LauncherOptionsDialog::LauncherOptionsDialog(
|
||||||
// The tab widget
|
// The tab widget
|
||||||
xpos = 2; ypos = vBorder;
|
xpos = 2; ypos = vBorder;
|
||||||
myTab = new TabWidget(this, font, xpos, ypos, _w - 2*xpos, _h - 2*bheight - ypos);
|
myTab = new TabWidget(this, font, xpos, ypos, _w - 2*xpos, _h - 2*bheight - ypos);
|
||||||
|
addTabWidget(myTab);
|
||||||
|
|
||||||
// 1) The ROM locations tab
|
// 1) The ROM locations tab
|
||||||
myTab->addTab("ROM Settings");
|
wid.clear();
|
||||||
|
tabID = myTab->addTab("ROM Settings");
|
||||||
|
|
||||||
// ROM path
|
// ROM path
|
||||||
xpos = 15; ypos += 5;
|
xpos = 15; ypos += 5;
|
||||||
new ButtonWidget(myTab, font, xpos, ypos, bwidth, bheight, "Path",
|
b = new ButtonWidget(myTab, font, xpos, ypos, bwidth, bheight, "Path",
|
||||||
kChooseRomDirCmd, 0);
|
kChooseRomDirCmd);
|
||||||
|
wid.push_back(b);
|
||||||
xpos += bwidth + 20;
|
xpos += bwidth + 20;
|
||||||
myRomPath = new StaticTextWidget(myTab, font, xpos, ypos + 3,
|
myRomPath = new StaticTextWidget(myTab, font, xpos, ypos + 3,
|
||||||
_w - xpos - 10, font.getLineHeight(),
|
_w - xpos - 10, font.getLineHeight(),
|
||||||
|
@ -63,22 +69,29 @@ LauncherOptionsDialog::LauncherOptionsDialog(
|
||||||
xpos = 30; ypos += myRomPath->getHeight() + 8;
|
xpos = 30; ypos += myRomPath->getHeight() + 8;
|
||||||
myBrowseCheckbox = new CheckboxWidget(myTab, font, xpos, ypos,
|
myBrowseCheckbox = new CheckboxWidget(myTab, font, xpos, ypos,
|
||||||
"Browse folders", kBrowseDirCmd);
|
"Browse folders", kBrowseDirCmd);
|
||||||
|
wid.push_back(myBrowseCheckbox);
|
||||||
|
|
||||||
// Reload current ROM listing
|
// Reload current ROM listing
|
||||||
xpos += myBrowseCheckbox->getWidth() + 20;
|
xpos += myBrowseCheckbox->getWidth() + 20;
|
||||||
myReloadButton = new ButtonWidget(myTab, font, xpos, ypos-2,
|
myReloadButton = new ButtonWidget(myTab, font, xpos, ypos-2,
|
||||||
font.getStringWidth("Reload ROM Listing") + 20,
|
font.getStringWidth("Reload ROM Listing") + 20,
|
||||||
bheight,
|
bheight,
|
||||||
"Reload ROM Listing", kReloadRomDirCmd, 0);
|
"Reload ROM Listing", kReloadRomDirCmd);
|
||||||
|
// myReloadButton->setEditable(true);
|
||||||
|
wid.push_back(myReloadButton);
|
||||||
|
|
||||||
|
// Add focus widgets for ROM tab
|
||||||
|
addToFocusList(wid, tabID);
|
||||||
|
|
||||||
// 2) The snapshot settings tab
|
// 2) The snapshot settings tab
|
||||||
myTab->addTab(" Snapshot Settings ");
|
wid.clear();
|
||||||
|
tabID = myTab->addTab(" Snapshot Settings ");
|
||||||
|
|
||||||
// Snapshot path
|
// Snapshot path
|
||||||
xpos = 15; ypos = vBorder + 5;
|
xpos = 15; ypos = vBorder + 5;
|
||||||
new ButtonWidget(myTab, font, xpos, ypos, bwidth, bheight, "Path",
|
b = new ButtonWidget(myTab, font, xpos, ypos, bwidth, bheight, "Path",
|
||||||
kChooseSnapDirCmd, 0);
|
kChooseSnapDirCmd);
|
||||||
|
wid.push_back(b);
|
||||||
xpos += bwidth + 20;
|
xpos += bwidth + 20;
|
||||||
mySnapPath = new StaticTextWidget(myTab, font, xpos, ypos + 3,
|
mySnapPath = new StaticTextWidget(myTab, font, xpos, ypos + 3,
|
||||||
_w - xpos - 10, font.getLineHeight(),
|
_w - xpos - 10, font.getLineHeight(),
|
||||||
|
@ -93,31 +106,39 @@ LauncherOptionsDialog::LauncherOptionsDialog(
|
||||||
font.getStringWidth("Save snapshot as: "), 0);
|
font.getStringWidth("Save snapshot as: "), 0);
|
||||||
mySnapTypePopup->appendEntry("romname", 1);
|
mySnapTypePopup->appendEntry("romname", 1);
|
||||||
mySnapTypePopup->appendEntry("md5sum", 2);
|
mySnapTypePopup->appendEntry("md5sum", 2);
|
||||||
|
wid.push_back(mySnapTypePopup);
|
||||||
|
|
||||||
// Snapshot single or multiple saves
|
// Snapshot single or multiple saves
|
||||||
xpos = 30; ypos += mySnapTypePopup->getHeight() + 5;
|
xpos = 30; ypos += mySnapTypePopup->getHeight() + 5;
|
||||||
mySnapSingleCheckbox = new CheckboxWidget(myTab, font, xpos, ypos,
|
mySnapSingleCheckbox = new CheckboxWidget(myTab, font, xpos, ypos,
|
||||||
"Multiple snapshots");
|
"Multiple snapshots");
|
||||||
|
wid.push_back(mySnapSingleCheckbox);
|
||||||
|
|
||||||
|
// Add focus widgets for Snapshot tab
|
||||||
|
addToFocusList(wid, tabID);
|
||||||
|
|
||||||
// Activate the first tab
|
// Activate the first tab
|
||||||
myTab->setActiveTab(0);
|
myTab->setActiveTab(0);
|
||||||
|
|
||||||
// Add OK & Cancel buttons
|
// Add OK & Cancel buttons
|
||||||
|
wid.clear();
|
||||||
#ifndef MAC_OSX
|
#ifndef MAC_OSX
|
||||||
xpos = _w - 2 *(bwidth + 10); ypos = _h - bheight - 8;
|
xpos = _w - 2 *(bwidth + 10); ypos = _h - bheight - 8;
|
||||||
new ButtonWidget(this, font, xpos, ypos, bwidth, bheight, "OK",
|
b = new ButtonWidget(this, font, xpos, ypos, bwidth, bheight, "OK", kOKCmd);
|
||||||
kOKCmd, 0);
|
wid.push_back(b);
|
||||||
xpos += bwidth + 10;
|
xpos += bwidth + 10;
|
||||||
new ButtonWidget(this, font, xpos, ypos, bwidth, bheight, "Cancel",
|
b = new ButtonWidget(this, font, xpos, ypos, bwidth, bheight, "Cancel", kCloseCmd);
|
||||||
kCloseCmd, 0);
|
wid.push_back(b);
|
||||||
#else
|
#else
|
||||||
xpos = _w - 2 *(bwidth + 10); ypos = _h - bheight - 8;
|
xpos = _w - 2 *(bwidth + 10); ypos = _h - bheight - 8;
|
||||||
new ButtonWidget(this, font, xpos, ypos, bwidth, bheight, "Cancel",
|
b = new ButtonWidget(this, font, xpos, ypos, bwidth, bheight, "Cancel", kCloseCmd);
|
||||||
kCloseCmd, 0);
|
wid.push_back(b);
|
||||||
xpos += bwidth + 10;
|
xpos += bwidth + 10;
|
||||||
new ButtonWidget(this, font, xpos, ypos, bwidth, bheight, "OK",
|
b = new ButtonWidget(this, font, xpos, ypos, bwidth, bheight, "OK", kOKCmd);
|
||||||
kOKCmd, 0);
|
wid.push_back(b);
|
||||||
#endif
|
#endif
|
||||||
|
// Add focus widgets for OK/Cancel buttons
|
||||||
|
addToFocusList(wid);
|
||||||
|
|
||||||
// Create file browser dialog
|
// Create file browser dialog
|
||||||
int baseW = instance()->frameBuffer().baseWidth();
|
int baseW = instance()->frameBuffer().baseWidth();
|
||||||
|
|
|
@ -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: ListWidget.cxx,v 1.41 2006-03-19 22:06:20 stephena Exp $
|
// $Id: ListWidget.cxx,v 1.42 2006-05-04 17:45:25 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
|
||||||
|
@ -137,6 +137,9 @@ void ListWidget::recalc()
|
||||||
|
|
||||||
_scrollBar->_numEntries = _list.size();
|
_scrollBar->_numEntries = _list.size();
|
||||||
_scrollBar->_entriesPerPage = _rows;
|
_scrollBar->_entriesPerPage = _rows;
|
||||||
|
|
||||||
|
// Reset to normal data entry
|
||||||
|
abortEditMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -269,48 +272,6 @@ bool ListWidget::handleKeyDown(int ascii, int keycode, int modifiers)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '\n': // enter/return
|
|
||||||
case '\r':
|
|
||||||
if (_selectedItem >= 0)
|
|
||||||
{
|
|
||||||
// override continuous enter keydown
|
|
||||||
if (_editable && (_currentKeyDown != '\n' && _currentKeyDown != '\r'))
|
|
||||||
startEditMode();
|
|
||||||
else
|
|
||||||
sendCommand(kListItemActivatedCmd, _selectedItem, _id);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case kCursorUp:
|
|
||||||
if (_selectedItem > 0)
|
|
||||||
_selectedItem--;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case kCursorDown:
|
|
||||||
if (_selectedItem < (int)_list.size() - 1)
|
|
||||||
_selectedItem++;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case kCursorPgUp:
|
|
||||||
_selectedItem -= _rows - 1;
|
|
||||||
if (_selectedItem < 0)
|
|
||||||
_selectedItem = 0;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case kCursorPgDn:
|
|
||||||
_selectedItem += _rows - 1;
|
|
||||||
if (_selectedItem >= (int)_list.size() )
|
|
||||||
_selectedItem = _list.size() - 1;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case kCursorHome:
|
|
||||||
_selectedItem = 0;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case kCursorEnd:
|
|
||||||
_selectedItem = _list.size() - 1;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
handled = false;
|
handled = false;
|
||||||
}
|
}
|
||||||
|
@ -336,10 +297,79 @@ bool ListWidget::handleKeyUp(int ascii, int keycode, int modifiers)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
bool ListWidget::handleEvent(Event::Type e)
|
||||||
|
{
|
||||||
|
if(_editMode)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
bool handled = true;
|
||||||
|
int oldSelectedItem = _selectedItem;
|
||||||
|
|
||||||
|
switch(e)
|
||||||
|
{
|
||||||
|
case Event::UISelect:
|
||||||
|
if (_selectedItem >= 0)
|
||||||
|
{
|
||||||
|
if (_editable)
|
||||||
|
startEditMode();
|
||||||
|
else
|
||||||
|
sendCommand(kListItemActivatedCmd, _selectedItem, _id);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Event::UIUp:
|
||||||
|
if (_selectedItem > 0)
|
||||||
|
_selectedItem--;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Event::UIDown:
|
||||||
|
if (_selectedItem < (int)_list.size() - 1)
|
||||||
|
_selectedItem++;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Event::UIPgUp:
|
||||||
|
_selectedItem -= _rows - 1;
|
||||||
|
if (_selectedItem < 0)
|
||||||
|
_selectedItem = 0;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Event::UIPgDown:
|
||||||
|
_selectedItem += _rows - 1;
|
||||||
|
if (_selectedItem >= (int)_list.size() )
|
||||||
|
_selectedItem = _list.size() - 1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Event::UIHome:
|
||||||
|
_selectedItem = 0;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Event::UIEnd:
|
||||||
|
_selectedItem = _list.size() - 1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
handled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_selectedItem != oldSelectedItem)
|
||||||
|
{
|
||||||
|
_scrollBar->draw();
|
||||||
|
scrollToSelected();
|
||||||
|
|
||||||
|
sendCommand(kListSelectionChangedCmd, _selectedItem, _id);
|
||||||
|
}
|
||||||
|
|
||||||
|
return handled;
|
||||||
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void ListWidget::lostFocusWidget()
|
void ListWidget::lostFocusWidget()
|
||||||
{
|
{
|
||||||
_editMode = false;
|
_editMode = false;
|
||||||
|
|
||||||
|
// Reset to normal data entry
|
||||||
|
abortEditMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -408,6 +438,9 @@ void ListWidget::startEditMode()
|
||||||
{
|
{
|
||||||
_editMode = true;
|
_editMode = true;
|
||||||
setEditString(_list[_selectedItem]);
|
setEditString(_list[_selectedItem]);
|
||||||
|
|
||||||
|
// Widget gets raw data while editing
|
||||||
|
EditableWidget::startEditMode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -417,16 +450,22 @@ void ListWidget::endEditMode()
|
||||||
if (!_editMode)
|
if (!_editMode)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// send a message that editing finished with a return/enter key press
|
// Send a message that editing finished with a return/enter key press
|
||||||
_editMode = false;
|
_editMode = false;
|
||||||
_list[_selectedItem] = _editString;
|
_list[_selectedItem] = _editString;
|
||||||
sendCommand(kListItemDataChangedCmd, _selectedItem, _id);
|
sendCommand(kListItemDataChangedCmd, _selectedItem, _id);
|
||||||
|
|
||||||
|
// Reset to normal data entry
|
||||||
|
EditableWidget::endEditMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void ListWidget::abortEditMode()
|
void ListWidget::abortEditMode()
|
||||||
{
|
{
|
||||||
// undo any changes made
|
// Undo any changes made
|
||||||
assert(_selectedItem >= 0);
|
assert(_selectedItem >= 0);
|
||||||
_editMode = false;
|
_editMode = false;
|
||||||
|
|
||||||
|
// Reset to normal data entry
|
||||||
|
EditableWidget::abortEditMode();
|
||||||
}
|
}
|
||||||
|
|
|
@ -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: ListWidget.hxx,v 1.17 2006-03-19 22:06:20 stephena Exp $
|
// $Id: ListWidget.hxx,v 1.18 2006-05-04 17:45:25 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
|
||||||
|
@ -67,10 +67,10 @@ class ListWidget : public EditableWidget
|
||||||
virtual void handleMouseWheel(int x, int y, int direction);
|
virtual void handleMouseWheel(int x, int y, int direction);
|
||||||
virtual bool handleKeyDown(int ascii, int keycode, int modifiers);
|
virtual bool handleKeyDown(int ascii, int keycode, int modifiers);
|
||||||
virtual bool handleKeyUp(int ascii, int keycode, int modifiers);
|
virtual bool handleKeyUp(int ascii, int keycode, int modifiers);
|
||||||
|
virtual bool handleEvent(Event::Type e);
|
||||||
virtual void handleCommand(CommandSender* sender, int cmd, int data, int id);
|
virtual void handleCommand(CommandSender* sender, int cmd, int data, int id);
|
||||||
|
|
||||||
virtual GUI::Rect getRect() const;
|
virtual GUI::Rect getRect() const;
|
||||||
virtual bool wantsFocus() { return !isSticky(); }
|
|
||||||
|
|
||||||
void startEditMode();
|
void startEditMode();
|
||||||
void endEditMode();
|
void endEditMode();
|
||||||
|
|
|
@ -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: OptionsDialog.cxx,v 1.38 2006-04-05 12:28:39 stephena Exp $
|
// $Id: OptionsDialog.cxx,v 1.39 2006-05-04 17:45:25 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
|
||||||
|
@ -56,8 +56,8 @@ enum {
|
||||||
kMainMenuHeight = 8 * kRowHeight + 10,
|
kMainMenuHeight = 8 * kRowHeight + 10,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define addBigButton(label, cmd, hotkey) \
|
#define addBigButton(label, cmd) \
|
||||||
new ButtonWidget(this, font, xoffset, yoffset, kBigButtonWidth, 18, label, cmd, hotkey); yoffset += kRowHeight
|
new ButtonWidget(this, font, xoffset, yoffset, kBigButtonWidth, 18, label, cmd); yoffset += kRowHeight
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
OptionsDialog::OptionsDialog(OSystem* osystem, DialogContainer* parent)
|
OptionsDialog::OptionsDialog(OSystem* osystem, DialogContainer* parent)
|
||||||
|
@ -77,26 +77,38 @@ OptionsDialog::OptionsDialog(OSystem* osystem, DialogContainer* parent)
|
||||||
int yoffset = 7;
|
int yoffset = 7;
|
||||||
const int xoffset = (_w - kBigButtonWidth) / 2;
|
const int xoffset = (_w - kBigButtonWidth) / 2;
|
||||||
const GUI::Font& font = instance()->font(); // FIXME - change reference to optionsFont()
|
const GUI::Font& font = instance()->font(); // FIXME - change reference to optionsFont()
|
||||||
|
WidgetArray wid;
|
||||||
ButtonWidget* b = NULL;
|
ButtonWidget* b = NULL;
|
||||||
|
|
||||||
b = addBigButton("Video Settings", kVidCmd, 0);
|
b = addBigButton("Video Settings", kVidCmd);
|
||||||
#ifdef SOUND_SUPPORT
|
wid.push_back(b);
|
||||||
addBigButton("Audio Settings", kAudCmd, 0);
|
|
||||||
#else
|
b = addBigButton("Audio Settings", kAudCmd);
|
||||||
b = addBigButton("Audio Settings", kAudCmd, 0);
|
#ifndef SOUND_SUPPORT
|
||||||
b->clearFlags(WIDGET_ENABLED);
|
b->clearFlags(WIDGET_ENABLED);
|
||||||
#endif
|
#endif
|
||||||
addBigButton("Input Settings", kInptCmd, 0);
|
wid.push_back(b);
|
||||||
addBigButton("Game Properties", kInfoCmd, 0);
|
|
||||||
#ifdef CHEATCODE_SUPPORT
|
b = addBigButton("Input Settings", kInptCmd);
|
||||||
addBigButton("Cheat Code", kCheatCmd, 0);
|
wid.push_back(b);
|
||||||
#else
|
|
||||||
b = addBigButton("Cheat Code", kCheatCmd, 0);
|
b = addBigButton("Game Properties", kInfoCmd);
|
||||||
|
wid.push_back(b);
|
||||||
|
|
||||||
|
b = addBigButton("Cheat Code", kCheatCmd);
|
||||||
|
#ifndef CHEATCODE_SUPPORT
|
||||||
b->clearFlags(WIDGET_ENABLED);
|
b->clearFlags(WIDGET_ENABLED);
|
||||||
#endif
|
#endif
|
||||||
addBigButton("Help", kHelpCmd, 0);
|
wid.push_back(b);
|
||||||
addBigButton("About", kAboutCmd, 0);
|
|
||||||
addBigButton("Exit Menu", kExitCmd, 0);
|
b = addBigButton("Help", kHelpCmd);
|
||||||
|
wid.push_back(b);
|
||||||
|
|
||||||
|
b = addBigButton("About", kAboutCmd);
|
||||||
|
wid.push_back(b);
|
||||||
|
|
||||||
|
b = addBigButton("Exit Menu", kExitCmd);
|
||||||
|
wid.push_back(b);
|
||||||
|
|
||||||
// Set some sane values for the dialog boxes
|
// Set some sane values for the dialog boxes
|
||||||
int fbWidth = osystem->frameBuffer().baseWidth();
|
int fbWidth = osystem->frameBuffer().baseWidth();
|
||||||
|
@ -133,6 +145,8 @@ OptionsDialog::OptionsDialog(OSystem* osystem, DialogContainer* parent)
|
||||||
w = 255; h = 150;
|
w = 255; h = 150;
|
||||||
checkBounds(fbWidth, fbHeight, &x, &y, &w, &h);
|
checkBounds(fbWidth, fbHeight, &x, &y, &w, &h);
|
||||||
myAboutDialog = new AboutDialog(myOSystem, parent, font, x, y, w, h);
|
myAboutDialog = new AboutDialog(myOSystem, parent, font, x, y, w, h);
|
||||||
|
|
||||||
|
addToFocusList(wid);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -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.24 2006-02-22 17:38:04 stephena Exp $
|
// $Id: PopUpWidget.cxx,v 1.25 2006-05-04 17:45:25 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
|
||||||
|
@ -137,25 +137,43 @@ void PopUpDialog::handleKeyDown(int ascii, int keycode, int modifiers)
|
||||||
|
|
||||||
switch (ascii)
|
switch (ascii)
|
||||||
{
|
{
|
||||||
case '\n': // enter/return
|
|
||||||
case '\r':
|
|
||||||
sendSelection();
|
|
||||||
break;
|
|
||||||
case 27: // escape
|
case 27: // escape
|
||||||
cancelSelection();
|
cancelSelection();
|
||||||
break;
|
break;
|
||||||
case 256+17: // up arrow
|
default:
|
||||||
|
{
|
||||||
|
Event::Type e = instance()->eventHandler().eventForKey(ascii,
|
||||||
|
kMenuOverlay);
|
||||||
|
handleEvent(e);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void PopUpDialog::handleEvent(Event::Type e)
|
||||||
|
{
|
||||||
|
switch(e)
|
||||||
|
{
|
||||||
|
case Event::UISelect:
|
||||||
|
sendSelection();
|
||||||
|
break;
|
||||||
|
case Event::UIUp:
|
||||||
|
case Event::UILeft:
|
||||||
moveUp();
|
moveUp();
|
||||||
break;
|
break;
|
||||||
case 256+18: // down arrow
|
case Event::UIDown:
|
||||||
|
case Event::UIRight:
|
||||||
moveDown();
|
moveDown();
|
||||||
break;
|
break;
|
||||||
case 256+22: // home
|
case Event::UIHome:
|
||||||
setSelection(0);
|
setSelection(0);
|
||||||
break;
|
break;
|
||||||
case 256+23: // end
|
case Event::UIEnd:
|
||||||
setSelection(_popUpBoss->_entries.size()-1);
|
setSelection(_popUpBoss->_entries.size()-1);
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -389,8 +407,7 @@ PopUpWidget::PopUpWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
_labelWidth(labelWidth),
|
_labelWidth(labelWidth),
|
||||||
_cmd(cmd)
|
_cmd(cmd)
|
||||||
{
|
{
|
||||||
_flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS |
|
_flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS;
|
||||||
WIDGET_NODRAW_FOCUS;
|
|
||||||
_type = kPopUpWidget;
|
_type = kPopUpWidget;
|
||||||
|
|
||||||
_selectedItem = -1;
|
_selectedItem = -1;
|
||||||
|
@ -424,6 +441,19 @@ void PopUpWidget::handleMouseDown(int x, int y, int button, int clickCount)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
bool PopUpWidget::handleEvent(Event::Type e)
|
||||||
|
{
|
||||||
|
switch(e)
|
||||||
|
{
|
||||||
|
case Event::UISelect:
|
||||||
|
handleMouseDown(0, 0, 1, 0);
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void PopUpWidget::appendEntry(const string& entry, int tag)
|
void PopUpWidget::appendEntry(const string& entry, int tag)
|
||||||
{
|
{
|
||||||
|
|
|
@ -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.hxx,v 1.12 2006-02-22 17:38:04 stephena Exp $
|
// $Id: PopUpWidget.hxx,v 1.13 2006-05-04 17:45:25 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
|
||||||
|
@ -65,6 +65,9 @@ class PopUpWidget : public Widget, public CommandSender
|
||||||
~PopUpWidget();
|
~PopUpWidget();
|
||||||
|
|
||||||
void handleMouseDown(int x, int y, int button, int clickCount);
|
void handleMouseDown(int x, int y, int button, int clickCount);
|
||||||
|
bool handleEvent(Event::Type e);
|
||||||
|
|
||||||
|
bool wantsFocus() { return true; }
|
||||||
|
|
||||||
void appendEntry(const string& entry, int tag = (int)-1);
|
void appendEntry(const string& entry, int tag = (int)-1);
|
||||||
void clearEntries();
|
void clearEntries();
|
||||||
|
@ -75,9 +78,12 @@ class PopUpWidget : public Widget, public CommandSender
|
||||||
/** Select the first entry matching the given tag. */
|
/** Select the first entry matching the given tag. */
|
||||||
void setSelectedTag(int tag);
|
void setSelectedTag(int tag);
|
||||||
|
|
||||||
int getSelected() const { return _selectedItem; }
|
int getSelected() const
|
||||||
int getSelectedTag() const { return (_selectedItem >= 0) ? _entries[_selectedItem].tag : (int)-1; }
|
{ return _selectedItem; }
|
||||||
const string& getSelectedString() const { return (_selectedItem >= 0) ? _entries[_selectedItem].name : EmptyString; }
|
int getSelectedTag() const
|
||||||
|
{ return (_selectedItem >= 0) ? _entries[_selectedItem].tag : (int)-1; }
|
||||||
|
const string& getSelectedString() const
|
||||||
|
{ return (_selectedItem >= 0) ? _entries[_selectedItem].name : EmptyString; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void drawWidget(bool hilite);
|
void drawWidget(bool hilite);
|
||||||
|
@ -106,7 +112,7 @@ class PopUpDialog : public Dialog
|
||||||
void handleMouseDown(int x, int y, int button, int clickCount);
|
void handleMouseDown(int x, int y, int button, int clickCount);
|
||||||
void handleMouseWheel(int x, int y, int direction); // Scroll through entries with scroll wheel
|
void handleMouseWheel(int x, int y, int direction); // Scroll through entries with scroll wheel
|
||||||
void handleMouseMoved(int x, int y, int button); // Redraw selections depending on mouse position
|
void handleMouseMoved(int x, int y, int button); // Redraw selections depending on mouse position
|
||||||
void handleKeyDown(int ascii, int keycode, int modifiers); // Scroll through entries with arrow keys etc.
|
void handleKeyDown(int ascii, int keycode, int modifiers); // Scroll through entries with arrow keys etc
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void drawMenuEntry(int entry, bool hilite);
|
void drawMenuEntry(int entry, bool hilite);
|
||||||
|
@ -122,6 +128,7 @@ class PopUpDialog : public Dialog
|
||||||
private:
|
private:
|
||||||
void sendSelection();
|
void sendSelection();
|
||||||
void cancelSelection();
|
void cancelSelection();
|
||||||
|
void handleEvent(Event::Type e);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
PopUpWidget* _popUpBoss;
|
PopUpWidget* _popUpBoss;
|
||||||
|
|
|
@ -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: StringListWidget.cxx,v 1.6 2006-03-25 00:34:17 stephena Exp $
|
// $Id: StringListWidget.cxx,v 1.7 2006-05-04 17:45:25 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
|
||||||
|
@ -68,7 +68,7 @@ void StringListWidget::drawWidget(bool hilite)
|
||||||
// Draw the selected item inverted, on a highlighted background.
|
// Draw the selected item inverted, on a highlighted background.
|
||||||
if (_selectedItem == pos)
|
if (_selectedItem == pos)
|
||||||
{
|
{
|
||||||
if ((_hasFocus && !_editMode) || isSticky())
|
if (_hasFocus && !_editMode)
|
||||||
fb.fillRect(_x + 1, _y + 1 + _fontHeight * i, _w - 1, _fontHeight, kTextColorHi);
|
fb.fillRect(_x + 1, _y + 1 + _fontHeight * i, _w - 1, _fontHeight, kTextColorHi);
|
||||||
else
|
else
|
||||||
fb.frameRect(_x + 1, _y + 1 + _fontHeight * i, _w - 1, _fontHeight, kTextColorHi);
|
fb.frameRect(_x + 1, _y + 1 + _fontHeight * i, _w - 1, _fontHeight, kTextColorHi);
|
||||||
|
|
|
@ -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: VideoDialog.cxx,v 1.29 2006-03-25 00:34:17 stephena Exp $
|
// $Id: VideoDialog.cxx,v 1.30 2006-05-04 17:45:25 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
|
||||||
|
@ -43,6 +43,7 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
|
||||||
int xpos, ypos;
|
int xpos, ypos;
|
||||||
int lwidth = font.getStringWidth("Dirty Rects: "),
|
int lwidth = font.getStringWidth("Dirty Rects: "),
|
||||||
pwidth = font.getStringWidth("Software");
|
pwidth = font.getStringWidth("Software");
|
||||||
|
WidgetArray wid;
|
||||||
|
|
||||||
// Use dirty rectangle updates
|
// Use dirty rectangle updates
|
||||||
xpos = 5; ypos = 10;
|
xpos = 5; ypos = 10;
|
||||||
|
@ -50,6 +51,7 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
|
||||||
pwidth, lineHeight, "Dirty Rects: ", lwidth);
|
pwidth, lineHeight, "Dirty Rects: ", lwidth);
|
||||||
myDirtyPopup->appendEntry("Yes", 1);
|
myDirtyPopup->appendEntry("Yes", 1);
|
||||||
myDirtyPopup->appendEntry("No", 2);
|
myDirtyPopup->appendEntry("No", 2);
|
||||||
|
wid.push_back(myDirtyPopup);
|
||||||
ypos += lineHeight + 4;
|
ypos += lineHeight + 4;
|
||||||
|
|
||||||
// Video renderer
|
// Video renderer
|
||||||
|
@ -63,6 +65,7 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
|
||||||
#ifdef DISPLAY_OPENGL
|
#ifdef DISPLAY_OPENGL
|
||||||
myRendererPopup->appendEntry("OpenGL", 3);
|
myRendererPopup->appendEntry("OpenGL", 3);
|
||||||
#endif
|
#endif
|
||||||
|
wid.push_back(myRendererPopup);
|
||||||
ypos += lineHeight + 4;
|
ypos += lineHeight + 4;
|
||||||
|
|
||||||
// Video filter
|
// Video filter
|
||||||
|
@ -70,12 +73,14 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
|
||||||
pwidth, lineHeight, "GL Filter: ", lwidth);
|
pwidth, lineHeight, "GL Filter: ", lwidth);
|
||||||
myFilterPopup->appendEntry("Linear", 1);
|
myFilterPopup->appendEntry("Linear", 1);
|
||||||
myFilterPopup->appendEntry("Nearest", 2);
|
myFilterPopup->appendEntry("Nearest", 2);
|
||||||
|
wid.push_back(myFilterPopup);
|
||||||
ypos += lineHeight + 4;
|
ypos += lineHeight + 4;
|
||||||
|
|
||||||
// Aspect ratio
|
// Aspect ratio
|
||||||
myAspectRatioSlider = new SliderWidget(this, font, xpos, ypos, pwidth, lineHeight,
|
myAspectRatioSlider = new SliderWidget(this, font, xpos, ypos, pwidth, lineHeight,
|
||||||
"GL Aspect: ", lwidth, kAspectRatioChanged);
|
"GL Aspect: ", lwidth, kAspectRatioChanged);
|
||||||
myAspectRatioSlider->setMinValue(1); myAspectRatioSlider->setMaxValue(100);
|
myAspectRatioSlider->setMinValue(1); myAspectRatioSlider->setMaxValue(100);
|
||||||
|
wid.push_back(myAspectRatioSlider);
|
||||||
myAspectRatioLabel = new StaticTextWidget(this, font,
|
myAspectRatioLabel = new StaticTextWidget(this, font,
|
||||||
xpos + myAspectRatioSlider->getWidth() + 4,
|
xpos + myAspectRatioSlider->getWidth() + 4,
|
||||||
ypos + 1,
|
ypos + 1,
|
||||||
|
@ -89,6 +94,7 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
|
||||||
myPalettePopup->appendEntry("Standard", 1);
|
myPalettePopup->appendEntry("Standard", 1);
|
||||||
myPalettePopup->appendEntry("Original", 2);
|
myPalettePopup->appendEntry("Original", 2);
|
||||||
myPalettePopup->appendEntry("Z26", 3);
|
myPalettePopup->appendEntry("Z26", 3);
|
||||||
|
wid.push_back(myPalettePopup);
|
||||||
ypos += lineHeight + 4;
|
ypos += lineHeight + 4;
|
||||||
|
|
||||||
// Move over to the next column
|
// Move over to the next column
|
||||||
|
@ -98,6 +104,7 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
|
||||||
myFrameRateSlider = new SliderWidget(this, font, xpos, ypos, 30, lineHeight,
|
myFrameRateSlider = new SliderWidget(this, font, xpos, ypos, 30, lineHeight,
|
||||||
"Framerate: ", lwidth, kFrameRateChanged);
|
"Framerate: ", lwidth, kFrameRateChanged);
|
||||||
myFrameRateSlider->setMinValue(1); myFrameRateSlider->setMaxValue(300);
|
myFrameRateSlider->setMinValue(1); myFrameRateSlider->setMaxValue(300);
|
||||||
|
wid.push_back(myFrameRateSlider);
|
||||||
myFrameRateLabel = new StaticTextWidget(this, font,
|
myFrameRateLabel = new StaticTextWidget(this, font,
|
||||||
xpos + myFrameRateSlider->getWidth() + 4,
|
xpos + myFrameRateSlider->getWidth() + 4,
|
||||||
ypos + 1,
|
ypos + 1,
|
||||||
|
@ -109,6 +116,7 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
|
||||||
myZoomSlider = new SliderWidget(this, font, xpos, ypos, 30, lineHeight,
|
myZoomSlider = new SliderWidget(this, font, xpos, ypos, 30, lineHeight,
|
||||||
"Zoom: ", lwidth, kZoomChanged);
|
"Zoom: ", lwidth, kZoomChanged);
|
||||||
myZoomSlider->setMinValue(0); myZoomSlider->setMaxValue(50);
|
myZoomSlider->setMinValue(0); myZoomSlider->setMaxValue(50);
|
||||||
|
wid.push_back(myZoomSlider);
|
||||||
myZoomLabel = new StaticTextWidget(this, font,
|
myZoomLabel = new StaticTextWidget(this, font,
|
||||||
xpos + myZoomSlider->getWidth() + 4,
|
xpos + myZoomSlider->getWidth() + 4,
|
||||||
ypos + 1,
|
ypos + 1,
|
||||||
|
@ -118,26 +126,36 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
|
||||||
|
|
||||||
myFullscreenCheckbox = new CheckboxWidget(this, font, xpos + 5, ypos,
|
myFullscreenCheckbox = new CheckboxWidget(this, font, xpos + 5, ypos,
|
||||||
"Fullscreen mode");
|
"Fullscreen mode");
|
||||||
|
wid.push_back(myFullscreenCheckbox);
|
||||||
ypos += lineHeight + 4;
|
ypos += lineHeight + 4;
|
||||||
|
|
||||||
myUseDeskResCheckbox = new CheckboxWidget(this, font, xpos + 5, ypos,
|
myUseDeskResCheckbox = new CheckboxWidget(this, font, xpos + 5, ypos,
|
||||||
"Desktop Res in FS");
|
"Desktop Res in FS");
|
||||||
|
wid.push_back(myUseDeskResCheckbox);
|
||||||
ypos += lineHeight + 4;
|
ypos += lineHeight + 4;
|
||||||
|
|
||||||
myTiaDefaultsCheckbox = new CheckboxWidget(this, font, xpos + 5, ypos,
|
myTiaDefaultsCheckbox = new CheckboxWidget(this, font, xpos + 5, ypos,
|
||||||
"Use TIA defaults");
|
"Use TIA defaults");
|
||||||
|
wid.push_back(myTiaDefaultsCheckbox);
|
||||||
ypos += lineHeight + 20;
|
ypos += lineHeight + 20;
|
||||||
|
|
||||||
// Add Defaults, OK and Cancel buttons
|
// Add Defaults, OK and Cancel buttons
|
||||||
addButton(font, 10, _h - 24, "Defaults", kDefaultsCmd, 0);
|
ButtonWidget* b;
|
||||||
|
b = addButton(font, 10, _h - 24, "Defaults", kDefaultsCmd);
|
||||||
|
wid.push_back(b);
|
||||||
#ifndef MAC_OSX
|
#ifndef MAC_OSX
|
||||||
addButton(font, _w - 2 * (kButtonWidth + 7), _h - 24, "OK", kOKCmd, 0);
|
b = addButton(font, _w - 2 * (kButtonWidth + 7), _h - 24, "OK", kOKCmd);
|
||||||
addButton(font, _w - (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0);
|
wid.push_back(b);
|
||||||
|
b = addButton(font, _w - (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd);
|
||||||
|
wid.push_back(b);
|
||||||
#else
|
#else
|
||||||
addButton(font, _w - 2 * (kButtonWidth + 7), _h - 24, "Cancel", kCloseCmd, 0);
|
b = addButton(font, _w - 2 * (kButtonWidth + 7), _h - 24, "Cancel", kCloseCmd);
|
||||||
addButton(font, _w - (kButtonWidth + 10), _h - 24, "OK", kOKCmd, 0);
|
wid.push_back(b);
|
||||||
|
b = addButton(font, _w - (kButtonWidth + 10), _h - 24, "OK", kOKCmd);
|
||||||
|
wid.push_back(b);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
addToFocusList(wid);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -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: Widget.cxx,v 1.43 2006-03-25 00:34:17 stephena Exp $
|
// $Id: Widget.cxx,v 1.44 2006-05-04 17:45:25 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
|
||||||
|
@ -239,7 +239,6 @@ Widget* Widget::setFocusForChain(GuiObject* boss, WidgetArray& arr,
|
||||||
if(tmp->_hasFocus)
|
if(tmp->_hasFocus)
|
||||||
{
|
{
|
||||||
tmp->lostFocus();
|
tmp->lostFocus();
|
||||||
if(!(tmp->_flags & WIDGET_NODRAW_FOCUS))
|
|
||||||
fb.frameRect(x, y, w, h, kBGColor);
|
fb.frameRect(x, y, w, h, kBGColor);
|
||||||
|
|
||||||
tmp->setDirty(); tmp->draw();
|
tmp->setDirty(); tmp->draw();
|
||||||
|
@ -279,7 +278,6 @@ Widget* Widget::setFocusForChain(GuiObject* boss, WidgetArray& arr,
|
||||||
w = rect.width(), h = rect.height();
|
w = rect.width(), h = rect.height();
|
||||||
|
|
||||||
tmp->receivedFocus();
|
tmp->receivedFocus();
|
||||||
if(!(tmp->_flags & WIDGET_NODRAW_FOCUS))
|
|
||||||
fb.frameRect(x, y, w, h, kTextColorEm, kDashLine);
|
fb.frameRect(x, y, w, h, kTextColorEm, kDashLine);
|
||||||
|
|
||||||
tmp->setDirty(); tmp->draw();
|
tmp->setDirty(); tmp->draw();
|
||||||
|
@ -338,12 +336,11 @@ void StaticTextWidget::drawWidget(bool hilite)
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
ButtonWidget::ButtonWidget(GuiObject *boss, const GUI::Font& font,
|
ButtonWidget::ButtonWidget(GuiObject *boss, const GUI::Font& font,
|
||||||
int x, int y, int w, int h,
|
int x, int y, int w, int h,
|
||||||
const string& label, int cmd, uInt8 hotkey)
|
const string& label, int cmd)
|
||||||
: StaticTextWidget(boss, font, x, y, w, h, label, kTextAlignCenter),
|
: StaticTextWidget(boss, font, x, y, w, h, label, kTextAlignCenter),
|
||||||
CommandSender(boss),
|
CommandSender(boss),
|
||||||
_cmd(cmd),
|
_cmd(cmd),
|
||||||
_editable(false),
|
_editable(false)
|
||||||
_hotkey(hotkey)
|
|
||||||
{
|
{
|
||||||
_flags = WIDGET_ENABLED | WIDGET_BORDER | WIDGET_CLEARBG;
|
_flags = WIDGET_ENABLED | WIDGET_BORDER | WIDGET_CLEARBG;
|
||||||
_type = kButtonWidget;
|
_type = kButtonWidget;
|
||||||
|
@ -364,14 +361,11 @@ void ButtonWidget::handleMouseLeft(int button)
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool ButtonWidget::handleKeyDown(int ascii, int keycode, int modifiers)
|
bool ButtonWidget::handleEvent(Event::Type e)
|
||||||
{
|
{
|
||||||
// (De)activate with space or return
|
switch(e)
|
||||||
switch(ascii)
|
|
||||||
{
|
{
|
||||||
case '\n': // enter/return
|
case Event::UISelect:
|
||||||
case '\r':
|
|
||||||
case ' ' : // space
|
|
||||||
// Simulate mouse event
|
// Simulate mouse event
|
||||||
handleMouseUp(0, 0, 1, 0);
|
handleMouseUp(0, 0, 1, 0);
|
||||||
return true;
|
return true;
|
||||||
|
@ -380,14 +374,6 @@ bool ButtonWidget::handleKeyDown(int ascii, int keycode, int modifiers)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
void ButtonWidget::handleJoyDown(int stick, int button)
|
|
||||||
{
|
|
||||||
// Any button activates the button, but only while in joymouse mode
|
|
||||||
if(DialogContainer::joymouse())
|
|
||||||
handleMouseUp(0, 0, 1, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void ButtonWidget::handleMouseUp(int x, int y, int button, int clickCount)
|
void ButtonWidget::handleMouseUp(int x, int y, int button, int clickCount)
|
||||||
{
|
{
|
||||||
|
@ -398,22 +384,6 @@ void ButtonWidget::handleMouseUp(int x, int y, int button, int clickCount)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
bool ButtonWidget::wantsFocus()
|
|
||||||
{
|
|
||||||
return _editable;
|
|
||||||
}
|
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
void ButtonWidget::setEditable(bool editable)
|
|
||||||
{
|
|
||||||
_editable = editable;
|
|
||||||
if(_editable)
|
|
||||||
setFlags(WIDGET_RETAIN_FOCUS);
|
|
||||||
else
|
|
||||||
clearFlags(WIDGET_RETAIN_FOCUS);
|
|
||||||
}
|
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void ButtonWidget::drawWidget(bool hilite)
|
void ButtonWidget::drawWidget(bool hilite)
|
||||||
{
|
{
|
||||||
|
@ -440,7 +410,7 @@ static unsigned int checked_img[8] =
|
||||||
CheckboxWidget::CheckboxWidget(GuiObject *boss, const GUI::Font& font,
|
CheckboxWidget::CheckboxWidget(GuiObject *boss, const GUI::Font& font,
|
||||||
int x, int y, const string& label,
|
int x, int y, const string& label,
|
||||||
int cmd)
|
int cmd)
|
||||||
: ButtonWidget(boss, font, x, y, 16, 16, label, cmd, 0),
|
: ButtonWidget(boss, font, x, y, 16, 16, label, cmd),
|
||||||
_state(false),
|
_state(false),
|
||||||
_editable(true),
|
_editable(true),
|
||||||
_holdFocus(true),
|
_holdFocus(true),
|
||||||
|
@ -450,7 +420,7 @@ CheckboxWidget::CheckboxWidget(GuiObject *boss, const GUI::Font& font,
|
||||||
_boxY(0),
|
_boxY(0),
|
||||||
_textY(0)
|
_textY(0)
|
||||||
{
|
{
|
||||||
_flags = WIDGET_ENABLED | WIDGET_RETAIN_FOCUS;
|
_flags = WIDGET_ENABLED;
|
||||||
_type = kCheckboxWidget;
|
_type = kCheckboxWidget;
|
||||||
|
|
||||||
if(label == "")
|
if(label == "")
|
||||||
|
@ -480,36 +450,10 @@ void CheckboxWidget::handleMouseUp(int x, int y, int button, int clickCount)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
bool CheckboxWidget::handleKeyDown(int ascii, int keycode, int modifiers)
|
|
||||||
{
|
|
||||||
// (De)activate with space or return
|
|
||||||
switch(ascii)
|
|
||||||
{
|
|
||||||
case '\n': // enter/return
|
|
||||||
case '\r':
|
|
||||||
case ' ' : // space
|
|
||||||
// Simulate mouse event
|
|
||||||
handleMouseUp(0, 0, 1, 0);
|
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
bool CheckboxWidget::wantsFocus()
|
|
||||||
{
|
|
||||||
if(!_holdFocus)
|
|
||||||
return false;
|
|
||||||
else
|
|
||||||
return _editable;
|
|
||||||
}
|
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void CheckboxWidget::setEditable(bool editable)
|
void CheckboxWidget::setEditable(bool editable)
|
||||||
{
|
{
|
||||||
_holdFocus = _editable = editable;
|
_editable = editable;
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -553,10 +497,10 @@ void CheckboxWidget::drawWidget(bool hilite)
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
SliderWidget::SliderWidget(GuiObject *boss, const GUI::Font& font,
|
SliderWidget::SliderWidget(GuiObject *boss, const GUI::Font& font,
|
||||||
int x, int y, int w, int h,
|
int x, int y, int w, int h,
|
||||||
const string& label, int labelWidth, int cmd, uInt8 hotkey)
|
const string& label, int labelWidth, int cmd)
|
||||||
: ButtonWidget(boss, font, x, y, w, h, label, cmd, hotkey),
|
: ButtonWidget(boss, font, x, y, w, h, label, cmd),
|
||||||
_value(0),
|
_value(0),
|
||||||
_oldValue(0),
|
_stepValue(5),
|
||||||
_valueMin(0),
|
_valueMin(0),
|
||||||
_valueMax(100),
|
_valueMax(100),
|
||||||
_isDragging(false),
|
_isDragging(false),
|
||||||
|
@ -573,9 +517,36 @@ SliderWidget::SliderWidget(GuiObject *boss, const GUI::Font& font,
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void SliderWidget::setValue(int value)
|
void SliderWidget::setValue(int value)
|
||||||
|
{
|
||||||
|
/*cerr << "SliderWidget::setValue: " << value
|
||||||
|
<< ", max = " << _valueMax
|
||||||
|
<< ", min = " << _valueMin
|
||||||
|
<< endl;*/
|
||||||
|
if(value < _valueMin)
|
||||||
|
value = _valueMin;
|
||||||
|
else if(value > _valueMax)
|
||||||
|
value = _valueMax;
|
||||||
|
|
||||||
|
if(value != _value)
|
||||||
{
|
{
|
||||||
_value = value;
|
_value = value;
|
||||||
setDirty(); draw();
|
setDirty(); draw();
|
||||||
|
sendCommand(_cmd, _value, _id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void SliderWidget::setMinValue(int value)
|
||||||
|
{
|
||||||
|
_valueMin = value;
|
||||||
|
_stepValue = (int) ((_valueMax - _valueMin) * 0.05); // Step at 5% intervals
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void SliderWidget::setMaxValue(int value)
|
||||||
|
{
|
||||||
|
_valueMax = value;
|
||||||
|
_stepValue = (int) ((_valueMax - _valueMin) * 0.05); // Step at 5% intervals
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -584,21 +555,7 @@ void SliderWidget::handleMouseMoved(int x, int y, int button)
|
||||||
// TODO: when the mouse is dragged outside the widget, the slider should
|
// TODO: when the mouse is dragged outside the widget, the slider should
|
||||||
// snap back to the old value.
|
// snap back to the old value.
|
||||||
if(isEnabled() && _isDragging && x >= (int)_labelWidth)
|
if(isEnabled() && _isDragging && x >= (int)_labelWidth)
|
||||||
{
|
setValue(posToValue(x - _labelWidth));
|
||||||
int newValue = posToValue(x - _labelWidth);
|
|
||||||
|
|
||||||
if(newValue < _valueMin)
|
|
||||||
newValue = _valueMin;
|
|
||||||
else if (newValue > _valueMax)
|
|
||||||
newValue = _valueMax;
|
|
||||||
|
|
||||||
if(newValue != _value)
|
|
||||||
{
|
|
||||||
_value = newValue;
|
|
||||||
setDirty(); draw();
|
|
||||||
sendCommand(_cmd, _value, _id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -620,6 +577,38 @@ void SliderWidget::handleMouseUp(int x, int y, int button, int clickCount)
|
||||||
_isDragging = false;
|
_isDragging = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
bool SliderWidget::handleEvent(Event::Type e)
|
||||||
|
{
|
||||||
|
switch(e)
|
||||||
|
{
|
||||||
|
case Event::UILeft:
|
||||||
|
case Event::UIDown:
|
||||||
|
case Event::UIPgDown:
|
||||||
|
setValue(_value - _stepValue);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Event::UIRight:
|
||||||
|
case Event::UIUp:
|
||||||
|
case Event::UIPgUp:
|
||||||
|
setValue(_value + _stepValue);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Event::UIHome:
|
||||||
|
setValue(_valueMin);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Event::UIEnd:
|
||||||
|
setValue(_valueMax);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void SliderWidget::drawWidget(bool hilite)
|
void SliderWidget::drawWidget(bool hilite)
|
||||||
{
|
{
|
||||||
|
|
|
@ -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: Widget.hxx,v 1.49 2006-03-25 00:34:17 stephena Exp $
|
// $Id: Widget.hxx,v 1.50 2006-05-04 17:45:25 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
|
||||||
|
@ -26,6 +26,7 @@ class Dialog;
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
#include "Event.hxx"
|
||||||
#include "OSystem.hxx"
|
#include "OSystem.hxx"
|
||||||
#include "FrameBuffer.hxx"
|
#include "FrameBuffer.hxx"
|
||||||
#include "GuiObject.hxx"
|
#include "GuiObject.hxx"
|
||||||
|
@ -44,10 +45,8 @@ enum {
|
||||||
WIDGET_CLEARBG = 1 << 5,
|
WIDGET_CLEARBG = 1 << 5,
|
||||||
WIDGET_TRACK_MOUSE = 1 << 6,
|
WIDGET_TRACK_MOUSE = 1 << 6,
|
||||||
WIDGET_RETAIN_FOCUS = 1 << 7,
|
WIDGET_RETAIN_FOCUS = 1 << 7,
|
||||||
WIDGET_NODRAW_FOCUS = 1 << 8,
|
WIDGET_WANTS_TAB = 1 << 8,
|
||||||
WIDGET_STICKY_FOCUS = 1 << 9,
|
WIDGET_WANTS_RAWDATA = 1 << 9
|
||||||
WIDGET_WANTS_TAB = 1 << 10,
|
|
||||||
WIDGET_WANTS_EVENTS = 1 << 11
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
@ -75,7 +74,7 @@ enum {
|
||||||
This is the base class for all widgets.
|
This is the base class for all widgets.
|
||||||
|
|
||||||
@author Stephen Anthony
|
@author Stephen Anthony
|
||||||
@version $Id: Widget.hxx,v 1.49 2006-03-25 00:34:17 stephena Exp $
|
@version $Id: Widget.hxx,v 1.50 2006-05-04 17:45:25 stephena Exp $
|
||||||
*/
|
*/
|
||||||
class Widget : public GuiObject
|
class Widget : public GuiObject
|
||||||
{
|
{
|
||||||
|
@ -100,6 +99,7 @@ class Widget : public GuiObject
|
||||||
virtual void handleJoyUp(int stick, int button) {}
|
virtual void handleJoyUp(int stick, int button) {}
|
||||||
virtual void handleJoyAxis(int stick, int axis, int value) {}
|
virtual void handleJoyAxis(int stick, int axis, int value) {}
|
||||||
virtual bool handleJoyHat(int stick, int hat, int value) { return false; }
|
virtual bool handleJoyHat(int stick, int hat, int value) { return false; }
|
||||||
|
virtual bool handleEvent(Event::Type event) { return false; }
|
||||||
|
|
||||||
void draw();
|
void draw();
|
||||||
void receivedFocus();
|
void receivedFocus();
|
||||||
|
@ -107,7 +107,6 @@ class Widget : public GuiObject
|
||||||
void addFocusWidget(Widget* w) { _focusList.push_back(w); }
|
void addFocusWidget(Widget* w) { _focusList.push_back(w); }
|
||||||
|
|
||||||
virtual GUI::Rect getRect() const;
|
virtual GUI::Rect getRect() const;
|
||||||
virtual bool wantsFocus() { return false; }
|
|
||||||
|
|
||||||
/** Set/clear WIDGET_ENABLED flag and immediately redraw */
|
/** Set/clear WIDGET_ENABLED flag and immediately redraw */
|
||||||
void setEnabled(bool e);
|
void setEnabled(bool e);
|
||||||
|
@ -118,8 +117,9 @@ class Widget : public GuiObject
|
||||||
|
|
||||||
bool isEnabled() const { return _flags & WIDGET_ENABLED; }
|
bool isEnabled() const { return _flags & WIDGET_ENABLED; }
|
||||||
bool isVisible() const { return !(_flags & WIDGET_INVISIBLE); }
|
bool isVisible() const { return !(_flags & WIDGET_INVISIBLE); }
|
||||||
bool isSticky() const { return _flags & WIDGET_STICKY_FOCUS; }
|
bool wantsFocus() const { return _flags & WIDGET_RETAIN_FOCUS; }
|
||||||
bool wantsEvents() const { return _flags & WIDGET_WANTS_EVENTS; }
|
bool wantsTab() const { return _flags & WIDGET_WANTS_TAB; }
|
||||||
|
bool wantsRaw() const { return _flags & WIDGET_WANTS_RAWDATA; }
|
||||||
|
|
||||||
void setID(int id) { _id = id; }
|
void setID(int id) { _id = id; }
|
||||||
int getID() { return _id; }
|
int getID() { return _id; }
|
||||||
|
@ -185,7 +185,6 @@ class StaticTextWidget : public Widget
|
||||||
void setLabel(const string& label);
|
void setLabel(const string& label);
|
||||||
void setAlign(TextAlignment align) { _align = align; }
|
void setAlign(TextAlignment align) { _align = align; }
|
||||||
const string& getLabel() const { return _label; }
|
const string& getLabel() const { return _label; }
|
||||||
void setEditable(bool editable);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void drawWidget(bool hilite);
|
void drawWidget(bool hilite);
|
||||||
|
@ -203,19 +202,15 @@ class ButtonWidget : public StaticTextWidget, public CommandSender
|
||||||
public:
|
public:
|
||||||
ButtonWidget(GuiObject* boss, const GUI::Font& font,
|
ButtonWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
int x, int y, int w, int h,
|
int x, int y, int w, int h,
|
||||||
const string& label, int cmd = 0, uInt8 hotkey = 0);
|
const string& label, int cmd = 0);
|
||||||
|
|
||||||
void setCmd(int cmd) { _cmd = cmd; }
|
void setCmd(int cmd) { _cmd = cmd; }
|
||||||
int getCmd() const { return _cmd; }
|
int getCmd() const { return _cmd; }
|
||||||
|
|
||||||
void handleMouseUp(int x, int y, int button, int clickCount);
|
virtual void handleMouseUp(int x, int y, int button, int clickCount);
|
||||||
void handleMouseEntered(int button);
|
virtual void handleMouseEntered(int button);
|
||||||
void handleMouseLeft(int button);
|
virtual void handleMouseLeft(int button);
|
||||||
bool handleKeyDown(int ascii, int keycode, int modifiers);
|
virtual bool handleEvent(Event::Type event);
|
||||||
void handleJoyDown(int stick, int button);
|
|
||||||
|
|
||||||
bool wantsFocus();
|
|
||||||
void setEditable(bool editable);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void drawWidget(bool hilite);
|
void drawWidget(bool hilite);
|
||||||
|
@ -223,7 +218,6 @@ class ButtonWidget : public StaticTextWidget, public CommandSender
|
||||||
protected:
|
protected:
|
||||||
int _cmd;
|
int _cmd;
|
||||||
bool _editable;
|
bool _editable;
|
||||||
uInt8 _hotkey;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -237,10 +231,6 @@ class CheckboxWidget : public ButtonWidget
|
||||||
void handleMouseUp(int x, int y, int button, int clickCount);
|
void handleMouseUp(int x, int y, int button, int clickCount);
|
||||||
virtual void handleMouseEntered(int button) {}
|
virtual void handleMouseEntered(int button) {}
|
||||||
virtual void handleMouseLeft(int button) {}
|
virtual void handleMouseLeft(int button) {}
|
||||||
virtual bool handleKeyDown(int ascii, int keycode, int modifiers);
|
|
||||||
|
|
||||||
bool wantsFocus();
|
|
||||||
void holdFocus(bool status) { _holdFocus = status; }
|
|
||||||
|
|
||||||
void setEditable(bool editable);
|
void setEditable(bool editable);
|
||||||
void setFill(bool fill) { _fillRect = fill; }
|
void setFill(bool fill) { _fillRect = fill; }
|
||||||
|
@ -276,19 +266,20 @@ class SliderWidget : public ButtonWidget
|
||||||
public:
|
public:
|
||||||
SliderWidget(GuiObject *boss, const GUI::Font& font,
|
SliderWidget(GuiObject *boss, const GUI::Font& font,
|
||||||
int x, int y, int w, int h, const string& label = "",
|
int x, int y, int w, int h, const string& label = "",
|
||||||
int labelWidth = 0, int cmd = 0, uInt8 hotkey = 0);
|
int labelWidth = 0, int cmd = 0);
|
||||||
|
|
||||||
void setValue(int value);
|
void setValue(int value);
|
||||||
int getValue() const { return _value; }
|
int getValue() const { return _value; }
|
||||||
|
|
||||||
void setMinValue(int value) { _valueMin = value; }
|
void setMinValue(int value);
|
||||||
int getMinValue() const { return _valueMin; }
|
int getMinValue() const { return _valueMin; }
|
||||||
void setMaxValue(int value) { _valueMax = value; }
|
void setMaxValue(int value);
|
||||||
int getMaxValue() const { return _valueMax; }
|
int getMaxValue() const { return _valueMax; }
|
||||||
|
|
||||||
void handleMouseMoved(int x, int y, int button);
|
virtual void handleMouseMoved(int x, int y, int button);
|
||||||
void handleMouseDown(int x, int y, int button, int clickCount);
|
virtual void handleMouseDown(int x, int y, int button, int clickCount);
|
||||||
void handleMouseUp(int x, int y, int button, int clickCount);
|
virtual void handleMouseUp(int x, int y, int button, int clickCount);
|
||||||
|
virtual bool handleEvent(Event::Type event);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void drawWidget(bool hilite);
|
void drawWidget(bool hilite);
|
||||||
|
@ -297,7 +288,7 @@ class SliderWidget : public ButtonWidget
|
||||||
int posToValue(int pos);
|
int posToValue(int pos);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int _value, _oldValue;
|
int _value, _stepValue;
|
||||||
int _valueMin, _valueMax;
|
int _valueMin, _valueMax;
|
||||||
bool _isDragging;
|
bool _isDragging;
|
||||||
int _labelWidth;
|
int _labelWidth;
|
||||||
|
|
Loading…
Reference in New Issue