2005-02-27 23:41:19 +00:00
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// SSSS tt lll lll
|
|
|
|
// SS SS tt ll ll
|
|
|
|
// SS tttttt eeee ll ll aaaa
|
|
|
|
// SSSS tt ee ee ll ll aa
|
|
|
|
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
|
|
|
// SS SS tt ee ll ll aa aa
|
|
|
|
// SSSS ttt eeeee llll llll aaaaa
|
|
|
|
//
|
2014-01-12 17:23:42 +00:00
|
|
|
// Copyright (c) 1995-2014 by Bradford W. Mott, Stephen Anthony
|
2010-04-10 21:37:23 +00:00
|
|
|
// and the Stella Team
|
2005-02-27 23:41:19 +00:00
|
|
|
//
|
2010-01-10 03:23:32 +00:00
|
|
|
// See the file "License.txt" for information on usage and redistribution of
|
2005-02-27 23:41:19 +00:00
|
|
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
|
|
|
//
|
2009-05-13 13:55:40 +00:00
|
|
|
// $Id$
|
2005-03-10 22:59:40 +00:00
|
|
|
//
|
|
|
|
// Based on code from ScummVM - Scumm Interpreter
|
|
|
|
// Copyright (C) 2002-2004 The ScummVM project
|
2005-02-27 23:41:19 +00:00
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
#ifndef DIALOG_HXX
|
|
|
|
#define DIALOG_HXX
|
|
|
|
|
2008-06-13 13:14:52 +00:00
|
|
|
class FBSurface;
|
2005-03-11 23:36:30 +00:00
|
|
|
class OSystem;
|
2005-05-04 19:04:47 +00:00
|
|
|
class DialogContainer;
|
2005-08-10 12:23:42 +00:00
|
|
|
class TabWidget;
|
2005-02-27 23:41:19 +00:00
|
|
|
|
2005-03-10 22:59:40 +00:00
|
|
|
#include "Command.hxx"
|
|
|
|
#include "Widget.hxx"
|
|
|
|
#include "GuiObject.hxx"
|
2012-01-14 22:00:54 +00:00
|
|
|
#include "StellaKeys.hxx"
|
2005-02-27 23:41:19 +00:00
|
|
|
|
2005-03-10 22:59:40 +00:00
|
|
|
#include "bspf.hxx"
|
2005-02-27 23:41:19 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
This is the base class for all dialog boxes.
|
|
|
|
|
|
|
|
@author Stephen Anthony
|
2009-05-13 13:55:40 +00:00
|
|
|
@version $Id$
|
2005-02-27 23:41:19 +00:00
|
|
|
*/
|
2005-03-11 23:36:30 +00:00
|
|
|
class Dialog : public GuiObject
|
2005-02-27 23:41:19 +00:00
|
|
|
{
|
2005-05-04 19:04:47 +00:00
|
|
|
friend class DialogContainer;
|
2005-03-14 04:08:15 +00:00
|
|
|
|
2005-02-27 23:41:19 +00:00
|
|
|
public:
|
2005-05-10 19:20:45 +00:00
|
|
|
Dialog(OSystem* instance, DialogContainer* parent,
|
2014-03-02 02:02:00 +00:00
|
|
|
int x, int y, int w, int h);
|
2005-02-27 23:41:19 +00:00
|
|
|
|
2005-03-10 22:59:40 +00:00
|
|
|
virtual ~Dialog();
|
2005-02-27 23:41:19 +00:00
|
|
|
|
2013-04-24 20:30:16 +00:00
|
|
|
void open(bool refresh = true);
|
|
|
|
void close(bool refresh = true);
|
|
|
|
|
2005-03-10 22:59:40 +00:00
|
|
|
bool isVisible() const { return _visible; }
|
2005-02-27 23:41:19 +00:00
|
|
|
|
OK, some huge changes across the board, so lets see if I get it all:
After much request, added ability to access the settings menu from the
ROM browser dialog. This menu now contains almost all items that can
be selected in Stella, and can be accessed in-game as before.
Completely removed pause functionality from the core code. It made
sense back when Stella was a single-mode program: there were two modes;
emulation and pause. Now that there are other event modes, the
EventHandler state machine is getting too complicated. If you want to
pause, you can simply enter one of the in-game menus. Related to this,
when the app is minimized, Stella enters the menu dialog state.
Previously, minimizing the app caused a pause, but since there was no
onscreen feedback, many people assumed the app locked up.
Added centering to all Dialog boxes, which is done dynamically, as they're
placed on the dialog stack to be drawn to the screen.
Cleaned up the API of Console/FrameBuffer/OSystem classes wrt to palettes
and timing. Parts of each were being done in different classes; now it
should be more consistent.
Started infrastructure for user-selectable UI palettes. For now, there's
no way to change it in the GUI, and it defaults to the normal palette.
Eventually, there will be several choices selectable from an in-game
menu.
Removed '-channels' commandline argument, since that feature can be
set from the ROM properties.
Added '128' to the choices for fragment size in AudioDialog.
Tweaked the OpenGL dynamic loading code to test both the given GL
lib, and if that fails to use auto-detection. It seems in the OSX port,
the first approach works for some people, and not the other (and vice-versa),
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1255 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2006-12-30 22:26:29 +00:00
|
|
|
virtual void center();
|
2005-03-10 22:59:40 +00:00
|
|
|
virtual void drawDialog();
|
2005-03-15 22:28:05 +00:00
|
|
|
virtual void loadConfig() {}
|
|
|
|
virtual void saveConfig() {}
|
2005-03-26 19:26:48 +00:00
|
|
|
virtual void setDefaults() {}
|
2005-02-27 23:41:19 +00:00
|
|
|
|
2005-08-10 12:23:42 +00:00
|
|
|
void addFocusWidget(Widget* w);
|
First pass at adding a cart-specific bankswitch/info tab to the
debugger. In the process, I had to spend several days extending
the UI/dialog class to actually contain multiple tabs. This was
harder than expected, and it still isn't quite finished. In many
ways, we're beginning to reach the limits of the current code; it
was never designed for a full-fledged, graphically rich UI.
For now the tab is empty, but eventually it will contain general
info about the ROM bankswitch type (size, virtual layout, etc),
but also cart-specific info, including the ability to change
banks, which can be vary greatly among the different schemes.
Eventually, it may even allow to see/modify very cart-specific
info (like display RAM in DPC, etc).
Better handle errors in opening the serial port (AtariVox support)
for Windows and OSX.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2678 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2013-03-31 00:10:05 +00:00
|
|
|
void addToFocusList(WidgetArray& list);
|
|
|
|
void addToFocusList(WidgetArray& list, TabWidget* w, int tabId);
|
|
|
|
void addBGroupToFocusList(WidgetArray& list) { _buttonGroup = list; }
|
2005-08-10 12:23:42 +00:00
|
|
|
void redrawFocus();
|
First pass at adding a cart-specific bankswitch/info tab to the
debugger. In the process, I had to spend several days extending
the UI/dialog class to actually contain multiple tabs. This was
harder than expected, and it still isn't quite finished. In many
ways, we're beginning to reach the limits of the current code; it
was never designed for a full-fledged, graphically rich UI.
For now the tab is empty, but eventually it will contain general
info about the ROM bankswitch type (size, virtual layout, etc),
but also cart-specific info, including the ability to change
banks, which can be vary greatly among the different schemes.
Eventually, it may even allow to see/modify very cart-specific
info (like display RAM in DPC, etc).
Better handle errors in opening the serial port (AtariVox support)
for Windows and OSX.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2678 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2013-03-31 00:10:05 +00:00
|
|
|
void addTabWidget(TabWidget* w);
|
2006-11-28 21:48:56 +00:00
|
|
|
void addOKWidget(Widget* w) { _okWidget = w; }
|
|
|
|
void addCancelWidget(Widget* w) { _cancelWidget = w; }
|
Removed the ability to emulate the mouse cursor with the joystick while
in GUI menu mode. The code was too troublesome to fix, and navigating
a GUI with a joystick simulating a mouse is a broken concept anyway.
In place of joy-is-mouse navigation, added the ability to use the cursor
keys or joysticks axes to 'tab' between different focused objects in
GUI mode. This is much more intuitive, and is how navigation works in
a mouse-less, game console based system. Also, any joystick button (or
enter/space keys) activate the currently focused item.
For now, only the CommandDialog can be accessed this way. It really
only makes sense here anyway, since many GUI objects in the other menus
really need access to a keyboard and mouse, and if you have those, one
can already navigate the menu.
Overall, this should make arcade cabinet style access much easier. One
can map the CommandDialog to a joystick button, navigate with the joystick
axes, and select an item with any joystick button. So Stella can be
started, play a game, and then exit, all by just using the joystick. It
also solves quite a few usability problems for the WinCE and PSP ports.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@918 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-12-19 02:19:49 +00:00
|
|
|
void setFocus(Widget* w);
|
2005-08-10 12:23:42 +00:00
|
|
|
|
2013-05-02 18:03:35 +00:00
|
|
|
FBSurface& surface() const { return *_surface; }
|
2008-06-13 13:14:52 +00:00
|
|
|
|
2005-03-10 22:59:40 +00:00
|
|
|
protected:
|
|
|
|
virtual void draw();
|
2005-03-12 01:47:15 +00:00
|
|
|
void releaseFocus();
|
2005-02-27 23:41:19 +00:00
|
|
|
|
2012-01-14 22:00:54 +00:00
|
|
|
virtual void handleKeyDown(StellaKey key, StellaMod modifiers, char ascii);
|
|
|
|
virtual void handleKeyUp(StellaKey key, StellaMod modifiers, char ascii);
|
2005-03-10 22:59:40 +00:00
|
|
|
virtual void handleMouseDown(int x, int y, int button, int clickCount);
|
|
|
|
virtual void handleMouseUp(int x, int y, int button, int clickCount);
|
|
|
|
virtual void handleMouseWheel(int x, int y, int direction);
|
|
|
|
virtual void handleMouseMoved(int x, int y, int button);
|
More cleanups to the UI.
Context menus, both as right-mouse button popups and those part of
PopupWidgets now have arrows that support scrolling, without having to
continuously click the mouse button. The scroll arrow color also
changes to disabled when they reach the upper or lower range.
Also, the maximum number of items shown in a ContextMenu is now 16,
which looks quite a bit nicer than showing 30 or so all at once.
ScrollBarWidget now looks a little nicer, as the scroll bar is a little
wider, and the arrows are larger (same ones from ContextMenu). As well,
click and hold works on the scroll buttons, even during mouse movement.
This means you no longer have to hold the mouse completely still to
get continuous mouse click events.
Dialogs can now register whether they want to receive continuous mouse
click events (aka, click and hold of a mouse button). Most dialogs
don't need it, and some even work incorrectly when it's activated.
This fixes a bug in ContextMenu, where click and hold on a PopupWidget
would continuously open and close the list of items.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2080 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-07-30 17:25:28 +00:00
|
|
|
virtual bool handleMouseClicks(int x, int y, int button);
|
2005-05-26 15:43:44 +00:00
|
|
|
virtual void handleJoyDown(int stick, int button);
|
|
|
|
virtual void handleJoyUp(int stick, int button);
|
2005-12-07 20:46:49 +00:00
|
|
|
virtual void handleJoyAxis(int stick, int axis, int value);
|
2006-03-02 13:10:53 +00:00
|
|
|
virtual bool handleJoyHat(int stick, int hat, int value);
|
2005-07-05 15:25:45 +00:00
|
|
|
virtual void handleCommand(CommandSender* sender, int cmd, int data, int id);
|
2005-12-24 22:09:36 +00:00
|
|
|
|
2005-03-10 22:59:40 +00:00
|
|
|
Widget* findWidget(int x, int y); // Find the widget at pos x,y if any
|
2005-02-27 23:41:19 +00:00
|
|
|
|
2009-01-06 23:02:18 +00:00
|
|
|
void addOKCancelBGroup(WidgetArray& wid, const GUI::Font& font,
|
|
|
|
const string& okText = "",
|
|
|
|
const string& cancelText = "");
|
2008-03-23 16:22:46 +00:00
|
|
|
|
2013-06-17 15:57:41 +00:00
|
|
|
void processCancelWithoutWidget(bool state) { _processCancel = state; }
|
|
|
|
|
2005-08-10 12:23:42 +00:00
|
|
|
private:
|
First pass at adding a cart-specific bankswitch/info tab to the
debugger. In the process, I had to spend several days extending
the UI/dialog class to actually contain multiple tabs. This was
harder than expected, and it still isn't quite finished. In many
ways, we're beginning to reach the limits of the current code; it
was never designed for a full-fledged, graphically rich UI.
For now the tab is empty, but eventually it will contain general
info about the ROM bankswitch type (size, virtual layout, etc),
but also cart-specific info, including the ability to change
banks, which can be vary greatly among the different schemes.
Eventually, it may even allow to see/modify very cart-specific
info (like display RAM in DPC, etc).
Better handle errors in opening the serial port (AtariVox support)
for Windows and OSX.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2678 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2013-03-31 00:10:05 +00:00
|
|
|
void buildCurrentFocusList(int tabID = -1);
|
2011-05-10 15:04:19 +00:00
|
|
|
bool handleNavEvent(Event::Type e);
|
2013-03-31 20:54:14 +00:00
|
|
|
void getTabIdForWidget(Widget* w);
|
First pass at adding a cart-specific bankswitch/info tab to the
debugger. In the process, I had to spend several days extending
the UI/dialog class to actually contain multiple tabs. This was
harder than expected, and it still isn't quite finished. In many
ways, we're beginning to reach the limits of the current code; it
was never designed for a full-fledged, graphically rich UI.
For now the tab is empty, but eventually it will contain general
info about the ROM bankswitch type (size, virtual layout, etc),
but also cart-specific info, including the ability to change
banks, which can be vary greatly among the different schemes.
Eventually, it may even allow to see/modify very cart-specific
info (like display RAM in DPC, etc).
Better handle errors in opening the serial port (AtariVox support)
for Windows and OSX.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2678 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2013-03-31 00:10:05 +00:00
|
|
|
bool cycleTab(int direction);
|
2005-08-10 12:23:42 +00:00
|
|
|
|
2005-03-10 22:59:40 +00:00
|
|
|
protected:
|
|
|
|
Widget* _mouseWidget;
|
|
|
|
Widget* _focusedWidget;
|
2005-04-24 01:57:47 +00:00
|
|
|
Widget* _dragWidget;
|
2006-11-28 21:48:56 +00:00
|
|
|
Widget* _okWidget;
|
|
|
|
Widget* _cancelWidget;
|
2005-03-10 22:59:40 +00:00
|
|
|
bool _visible;
|
2013-06-17 15:57:41 +00:00
|
|
|
bool _processCancel;
|
2005-03-10 22:59:40 +00:00
|
|
|
|
|
|
|
private:
|
First pass at adding a cart-specific bankswitch/info tab to the
debugger. In the process, I had to spend several days extending
the UI/dialog class to actually contain multiple tabs. This was
harder than expected, and it still isn't quite finished. In many
ways, we're beginning to reach the limits of the current code; it
was never designed for a full-fledged, graphically rich UI.
For now the tab is empty, but eventually it will contain general
info about the ROM bankswitch type (size, virtual layout, etc),
but also cart-specific info, including the ability to change
banks, which can be vary greatly among the different schemes.
Eventually, it may even allow to see/modify very cart-specific
info (like display RAM in DPC, etc).
Better handle errors in opening the serial port (AtariVox support)
for Windows and OSX.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2678 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2013-03-31 00:10:05 +00:00
|
|
|
struct Focus {
|
|
|
|
Widget* widget;
|
|
|
|
WidgetArray list;
|
|
|
|
|
|
|
|
Focus(Widget* w = 0);
|
|
|
|
virtual ~Focus();
|
|
|
|
};
|
|
|
|
typedef Common::Array<Focus> FocusList;
|
|
|
|
|
|
|
|
struct TabFocus {
|
|
|
|
TabWidget* widget;
|
|
|
|
FocusList focus;
|
|
|
|
uInt32 currentTab;
|
|
|
|
|
|
|
|
TabFocus(TabWidget* w = 0);
|
|
|
|
virtual ~TabFocus();
|
|
|
|
|
|
|
|
void appendFocusList(WidgetArray& list);
|
|
|
|
void saveCurrentFocus(Widget* w);
|
|
|
|
Widget* getNewFocus();
|
|
|
|
};
|
|
|
|
typedef Common::Array<TabFocus> TabFocusList;
|
|
|
|
|
|
|
|
Focus _myFocus; // focus for base dialog
|
|
|
|
TabFocusList _myTabList; // focus for each tab (if any)
|
|
|
|
|
|
|
|
WidgetArray _buttonGroup;
|
2008-06-13 13:14:52 +00:00
|
|
|
FBSurface* _surface;
|
2005-08-10 12:23:42 +00:00
|
|
|
|
First pass at adding a cart-specific bankswitch/info tab to the
debugger. In the process, I had to spend several days extending
the UI/dialog class to actually contain multiple tabs. This was
harder than expected, and it still isn't quite finished. In many
ways, we're beginning to reach the limits of the current code; it
was never designed for a full-fledged, graphically rich UI.
For now the tab is empty, but eventually it will contain general
info about the ROM bankswitch type (size, virtual layout, etc),
but also cart-specific info, including the ability to change
banks, which can be vary greatly among the different schemes.
Eventually, it may even allow to see/modify very cart-specific
info (like display RAM in DPC, etc).
Better handle errors in opening the serial port (AtariVox support)
for Windows and OSX.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2678 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2013-03-31 00:10:05 +00:00
|
|
|
int _tabID;
|
2005-03-10 22:59:40 +00:00
|
|
|
};
|
2005-02-27 23:41:19 +00:00
|
|
|
|
|
|
|
#endif
|