added a dummy global options dialog; PopUpWidget tweaks
svn-id: r5919
This commit is contained in:
parent
f6de146c5e
commit
2af8f20344
7 changed files with 188 additions and 38 deletions
|
@ -25,22 +25,22 @@
|
|||
|
||||
/* TODO:
|
||||
* - draw an (unselectable) sepeator line for items that start with a '-'
|
||||
* - handle looong lists by allowing scrolling (a lot of work if done right,
|
||||
* - handle long lists by allowing scrolling (a lot of work if done right,
|
||||
* so I will probably only implement if we really need it)
|
||||
* - ...
|
||||
*/
|
||||
|
||||
#define UP_DOWN_BOX_HEIGHT 10
|
||||
|
||||
// Down arrow
|
||||
static uint32 down_arrow[8] = {
|
||||
// Little up/down arrow
|
||||
static uint32 up_down_arrows[8] = {
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00100010,
|
||||
0x00110110,
|
||||
0x00011100,
|
||||
0x00011100,
|
||||
0x00001000,
|
||||
0x00011100,
|
||||
0x00111110,
|
||||
0x00000000,
|
||||
0x00111110,
|
||||
0x00011100,
|
||||
0x00001000,
|
||||
};
|
||||
|
||||
|
@ -81,7 +81,7 @@ PopUpDialog::PopUpDialog(PopUpWidget *boss, int clickX, int clickY)
|
|||
_x = _popUpBoss->_boss->getX() + _popUpBoss->_x;
|
||||
_y = _popUpBoss->_boss->getY() + _popUpBoss->_y - _popUpBoss->_selectedItem * kLineHeight;
|
||||
_h = _popUpBoss->_entries.size() * kLineHeight + 2;
|
||||
_w = _popUpBoss->_w;
|
||||
_w = _popUpBoss->_w - 10;
|
||||
|
||||
// Copy the selection index
|
||||
_selection = _popUpBoss->_selectedItem;
|
||||
|
@ -98,7 +98,11 @@ PopUpDialog::PopUpDialog(PopUpWidget *boss, int clickX, int clickY)
|
|||
void PopUpDialog::drawDialog()
|
||||
{
|
||||
// Draw the menu border
|
||||
_gui->box(_x, _y, _w, _h);
|
||||
// _gui->box(_x, _y, _w, _h);
|
||||
_gui->hline(_x, _y, _x+_w-1, _gui->_color);
|
||||
_gui->hline(_x, _y+_h-1, _x+_w-1, _gui->_shadowcolor);
|
||||
_gui->vline(_x, _y, _y+_h-1, _gui->_color);
|
||||
_gui->vline(_x+_w-1, _y, _y+_h-1, _gui->_shadowcolor);
|
||||
|
||||
// Draw the entries
|
||||
int count = _popUpBoss->_entries.size();
|
||||
|
@ -177,9 +181,9 @@ void PopUpDialog::drawMenuEntry(int entry, bool hilite)
|
|||
{
|
||||
// Draw one entry of the popup menu, including selection
|
||||
assert(entry >= 0);
|
||||
int x = _x + 2;
|
||||
int y = _y + 2 + kLineHeight * entry;
|
||||
int w = _w - 4;
|
||||
int x = _x + 1;
|
||||
int y = _y + 1 + kLineHeight * entry;
|
||||
int w = _w - 2;
|
||||
|
||||
_gui->fillRect(x, y, w, kLineHeight,
|
||||
hilite ? _gui->_textcolorhi : _gui->_bgcolor);
|
||||
|
@ -252,7 +256,7 @@ void PopUpWidget::drawWidget(bool hilite)
|
|||
gui->vline(_x+_w-1, _y, _y+_h-1, gui->_shadowcolor);
|
||||
|
||||
// Draw an arrow pointing down at the right end to signal this is a dropdown/popup
|
||||
gui->drawBitmap(down_arrow, _x+_w - 10, _y+1, hilite ? gui->_textcolorhi : gui->_textcolor);
|
||||
gui->drawBitmap(up_down_arrows, _x+_w - 10, _y+2, hilite ? gui->_textcolorhi : gui->_textcolor);
|
||||
|
||||
// Draw the selected entry, if any
|
||||
if (_selectedItem >= 0) {
|
||||
|
|
|
@ -22,11 +22,11 @@
|
|||
#include "launcher.h"
|
||||
#include "browser.h"
|
||||
#include "chooser.h"
|
||||
#include "newgui.h"
|
||||
#include "message.h"
|
||||
#include "newgui.h"
|
||||
#include "options.h"
|
||||
#include "EditTextWidget.h"
|
||||
#include "ListWidget.h"
|
||||
#include "PopUpWidget.h"
|
||||
|
||||
#include "backends/fs/fs.h"
|
||||
#include "common/config-file.h"
|
||||
|
@ -87,8 +87,7 @@ protected:
|
|||
};
|
||||
|
||||
EditGameDialog::EditGameDialog(NewGui *gui, Config &config, const String &domain)
|
||||
// : Dialog(gui, 8, 50, 320-2*8, 200-2*40), _config(config), _domain(domain)
|
||||
: Dialog(gui, 8, 30, 320-2*8, 200-2*30), _config(config), _domain(domain)
|
||||
: Dialog(gui, 8, 50, 320-2*8, 200-2*40), _config(config), _domain(domain)
|
||||
{
|
||||
// Determine the description string
|
||||
String gameid(_config.get("gameid", _domain));
|
||||
|
@ -132,15 +131,6 @@ EditGameDialog::EditGameDialog(NewGui *gui, Config &config, const String &domain
|
|||
// Load in settings for the checkboxs
|
||||
_fullscreenCheckbox->setState(_config.getBool("fullscreen", false, _domain));
|
||||
_AmigaPalCheckbox->setState(_config.getBool("amiga", false, _domain));
|
||||
|
||||
// FIXME HACK - add a dummy popup widget here, for debugging.
|
||||
// Note: this isn't useful at all right now...
|
||||
PopUpWidget *foo;
|
||||
foo = new PopUpWidget(this, 15, 102, 200, kLineHeight);
|
||||
foo->appendEntry("Foo");
|
||||
foo->appendEntry("Bar");
|
||||
foo->appendEntry("Baz", 'QUUX');
|
||||
foo->setSelected(0);
|
||||
}
|
||||
|
||||
void EditGameDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data)
|
||||
|
@ -445,11 +435,8 @@ void LauncherDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat
|
|||
// - music & graphics driver (but see also the comments on EditGameDialog
|
||||
// for some techincal difficulties with this)
|
||||
// - default volumes (sfx/master/music)
|
||||
// -
|
||||
//
|
||||
// We also allow the global save game path to be set here.
|
||||
MessageDialog alert(_gui, "Global game options dialog not yet implemented!");
|
||||
alert.runModal();
|
||||
GlobalOptionsDialog options(_gui);
|
||||
options.runModal();
|
||||
}
|
||||
break;
|
||||
case kStartCmd:
|
||||
|
|
|
@ -9,6 +9,7 @@ MODULE_OBJS = \
|
|||
gui/ListWidget.o \
|
||||
gui/message.o \
|
||||
gui/newgui.o \
|
||||
gui/options.o \
|
||||
gui/PopUpWidget.o \
|
||||
gui/ScrollBarWidget.o \
|
||||
gui/widget.o \
|
||||
|
|
|
@ -477,15 +477,15 @@ void NewGui::blitToBuffer(int x, int y, int w, int h, byte *buf, int pitch)
|
|||
//
|
||||
// Draw an 8x8 bitmap at location (x,y)
|
||||
//
|
||||
void NewGui::drawBitmap(uint32 bitmap[8], int x, int y, int16 color)
|
||||
void NewGui::drawBitmap(uint32 *bitmap, int x, int y, int16 color, int h)
|
||||
{
|
||||
int16 *ptr = getBasePtr(x, y);
|
||||
|
||||
for (int y2 = 0; y2 < 8; y2++) {
|
||||
for (y = 0; y < h; y++) {
|
||||
uint32 mask = 0xF0000000;
|
||||
for (int x2 = 0; x2 < 8; x2++) {
|
||||
if (bitmap[y2] & mask)
|
||||
ptr[x2] = color;
|
||||
for (x = 0; x < 8; x++) {
|
||||
if (bitmap[y] & mask)
|
||||
ptr[x] = color;
|
||||
mask >>= 4;
|
||||
}
|
||||
ptr += _screenPitch;
|
||||
|
|
|
@ -140,7 +140,7 @@ public:
|
|||
void blitFromBuffer(int x, int y, int w, int h, const byte *buf, int pitch);
|
||||
void blitToBuffer(int x, int y, int w, int h, byte *buf, int pitch);
|
||||
|
||||
void drawBitmap(uint32 bitmap[8], int x, int y, int16 color);
|
||||
void drawBitmap(uint32 *bitmap, int x, int y, int16 color, int h = 8);
|
||||
|
||||
void addDirtyRect(int x, int y, int w, int h);
|
||||
};
|
||||
|
|
116
gui/options.cpp
Normal file
116
gui/options.cpp
Normal file
|
@ -0,0 +1,116 @@
|
|||
/* ScummVM - Scumm Interpreter
|
||||
* Copyright (C) 2002 The ScummVM project
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Header$
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "options.h"
|
||||
#include "newgui.h"
|
||||
#include "PopUpWidget.h"
|
||||
|
||||
#include "common/config-file.h"
|
||||
//#include "common/engine.h"
|
||||
//#include "common/gameDetector.h"
|
||||
|
||||
// TODO - allow changing options for:
|
||||
// - the save path (use _browser!)
|
||||
// - music & graphics driver (but see also the comments on EditGameDialog
|
||||
// for some techincal difficulties with this)
|
||||
// - default volumes (sfx/master/music)
|
||||
|
||||
enum {
|
||||
kOKCmd = 'OK '
|
||||
};
|
||||
|
||||
GlobalOptionsDialog::GlobalOptionsDialog(NewGui *gui)
|
||||
: Dialog(gui, 10, 30, 320-2*10, 200-2*30)
|
||||
{
|
||||
// The GFX mode popup & a label
|
||||
// TODO - add an API to query the list of available GFX modes, and to get/set the mode
|
||||
new StaticTextWidget(this, 10, 10+1, 90, kLineHeight, "Graphics: ", kTextAlignRight);
|
||||
PopUpWidget *gfxPopUp;
|
||||
gfxPopUp = new PopUpWidget(this, 100, 10, 200, kLineHeight);
|
||||
gfxPopUp->appendEntry("Normal (no scaling)");
|
||||
gfxPopUp->appendEntry("2x");
|
||||
gfxPopUp->appendEntry("3x");
|
||||
gfxPopUp->appendEntry("2xSAI");
|
||||
gfxPopUp->appendEntry("Super2xSAI");
|
||||
gfxPopUp->appendEntry("AuperEagle");
|
||||
gfxPopUp->appendEntry("AdvMAME2x");
|
||||
gfxPopUp->setSelected(0);
|
||||
|
||||
// The MIDI mode popup & a label
|
||||
// TODO - add an API to query the list of available MIDI drivers
|
||||
new StaticTextWidget(this, 10, 26+1, 90, kLineHeight, "MIDI driver: ", kTextAlignRight);
|
||||
PopUpWidget *midiPopUp;
|
||||
midiPopUp = new PopUpWidget(this, 100, 26, 200, kLineHeight);
|
||||
midiPopUp->appendEntry("None");
|
||||
midiPopUp->appendEntry("Adlib");
|
||||
midiPopUp->appendEntry("CoreAudio");
|
||||
midiPopUp->appendEntry("QuickTime");
|
||||
midiPopUp->setSelected(0);
|
||||
|
||||
|
||||
//
|
||||
// Sound controllers
|
||||
//
|
||||
const int yoffset = 45;
|
||||
new StaticTextWidget(this, 10, yoffset+10, 90, 16, "Master volume: ", kTextAlignRight);
|
||||
new StaticTextWidget(this, 10, yoffset+26, 90, 16, "Music volume: ", kTextAlignRight);
|
||||
new StaticTextWidget(this, 10, yoffset+42, 90, 16, "SFX volume: ", kTextAlignRight);
|
||||
|
||||
SliderWidget *masterVolumeSlider, *musicVolumeSlider, *sfxVolumeSlider;
|
||||
|
||||
masterVolumeSlider = new SliderWidget(this, 110, yoffset+8, 80, 12, "Volume1", 0);
|
||||
musicVolumeSlider = new SliderWidget(this, 110, yoffset+24, 80, 12, "Volume2", 0);
|
||||
sfxVolumeSlider = new SliderWidget(this, 110, yoffset+40, 80, 12, "Volume3", 0);
|
||||
|
||||
masterVolumeSlider->setMinValue(0); masterVolumeSlider->setMaxValue(255);
|
||||
musicVolumeSlider->setMinValue(0); musicVolumeSlider->setMaxValue(255);
|
||||
sfxVolumeSlider->setMinValue(0); sfxVolumeSlider->setMaxValue(255);
|
||||
|
||||
Widget *masterVolumeLabel, *musicVolumeLabel, *sfxVolumeLabel;
|
||||
|
||||
masterVolumeLabel = new StaticTextWidget(this, 200, yoffset+10, 24, 16, "100%", kTextAlignLeft);
|
||||
musicVolumeLabel = new StaticTextWidget(this, 200, yoffset+26, 24, 16, "100%", kTextAlignLeft);
|
||||
sfxVolumeLabel = new StaticTextWidget(this, 200, yoffset+42, 24, 16, "100%", kTextAlignLeft);
|
||||
|
||||
masterVolumeLabel->setFlags(WIDGET_CLEARBG);
|
||||
musicVolumeLabel->setFlags(WIDGET_CLEARBG);
|
||||
sfxVolumeLabel->setFlags(WIDGET_CLEARBG);
|
||||
|
||||
|
||||
// Add OK & Cancel buttons
|
||||
addButton(_w-2*(kButtonWidth+10), _h-24, "Cancel", kCloseCmd, 0);
|
||||
addButton(_w-(kButtonWidth+10), _h-24, "OK", kOKCmd, 0);
|
||||
}
|
||||
|
||||
GlobalOptionsDialog::~GlobalOptionsDialog()
|
||||
{
|
||||
}
|
||||
|
||||
void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data)
|
||||
{
|
||||
if (cmd == kOKCmd) {
|
||||
// TODO Write back changes made to config object
|
||||
setResult(1);
|
||||
close();
|
||||
} else {
|
||||
Dialog::handleCommand(sender, cmd, data);
|
||||
}
|
||||
}
|
42
gui/options.h
Normal file
42
gui/options.h
Normal file
|
@ -0,0 +1,42 @@
|
|||
/* ScummVM - Scumm Interpreter
|
||||
* Copyright (C) 2002 The ScummVM project
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Header$
|
||||
*/
|
||||
|
||||
#ifndef OPTIONS_DIALOG_H
|
||||
#define OPTIONS_DIALOG_H
|
||||
|
||||
#include "dialog.h"
|
||||
#include "common/str.h"
|
||||
#include "common/list.h"
|
||||
|
||||
|
||||
class GlobalOptionsDialog : public Dialog {
|
||||
typedef ScummVM::String String;
|
||||
public:
|
||||
GlobalOptionsDialog(NewGui *gui);
|
||||
~GlobalOptionsDialog();
|
||||
|
||||
// void open();
|
||||
// void close();
|
||||
void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
|
||||
|
||||
protected:
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue