diff options
Diffstat (limited to 'gui')
31 files changed, 1778 insertions, 107 deletions
diff --git a/gui/ThemeEngine.h b/gui/ThemeEngine.h index 6fb93d3b46..6e5fd291b7 100644 --- a/gui/ThemeEngine.h +++ b/gui/ThemeEngine.h @@ -35,7 +35,7 @@ #include "graphics/pixelformat.h" -#define SCUMMVM_THEME_VERSION_STR "SCUMMVM_STX0.8.16" +#define SCUMMVM_THEME_VERSION_STR "SCUMMVM_STX0.8.20" class OSystem; diff --git a/gui/ThemeParser.cpp b/gui/ThemeParser.cpp index 8285aff7ca..bd5b406ca8 100644 --- a/gui/ThemeParser.cpp +++ b/gui/ThemeParser.cpp @@ -335,11 +335,15 @@ bool ThemeParser::parserCallback_drawstep(ParserNode *node) { drawstep->drawingCall = getDrawingFunctionCallback(functionName); - if (drawstep->drawingCall == 0) + if (drawstep->drawingCall == 0) { + delete drawstep; return parserError(functionName + " is not a valid drawing function name"); + } - if (!parseDrawStep(node, drawstep, true)) + if (!parseDrawStep(node, drawstep, true)) { + delete drawstep; return false; + } _theme->addDrawStep(getParentNode(node)->values["id"], *drawstep); delete drawstep; @@ -691,7 +695,7 @@ bool ThemeParser::parserCallback_layout(ParserNode *node) { return false; } - Common::parseBool(node->values["center"], center); + (void)Common::parseBool(node->values["center"], center); if (node->values["type"] == "vertical") _theme->getEvaluator()->addLayout(GUI::ThemeLayout::kLayoutVertical, spacing, center); diff --git a/gui/about.cpp b/gui/about.cpp index 03be1f8992..088971f273 100644 --- a/gui/about.cpp +++ b/gui/about.cpp @@ -37,14 +37,16 @@ enum { kScrollMillisPerPixel = 60 }; -// The following commands can be put at the start of a line (all subject to change): -// \C, \L, \R -- set center/left/right alignment -// \c0 - \c4 -- set a custom color: -// 0 normal text (green) -// 1 highlighted text (light green) -// 2 light border (light gray) -// 3 dark border (dark gray) -// 4 background (black) +// Every Line should start with a letter followed by a digit. Currently those can be +// (all subject to change) +// Letter: +// C, L, R -- set center/left/right alignment +// A -- ASCII text to replace the next (latin1) line +// Digit: +// 0 - 2 -- set a custom color: +// 0 normal text +// 1 highlighted text +// 2 disabled text // TODO: Maybe add a tab/indent feature; that is, make it possible to specify // an amount by which that line shall be indented (the indent of course would have // to be considered while performing any word wrapping, too). @@ -54,7 +56,7 @@ enum { static const char *copyright_text[] = { "", -"C0""Copyright (C) 2001-2012 The ScummVM project", +"C0""Copyright (C) 2001-2013 The ScummVM project", "C0""http://www.scummvm.org", "", "C0""ScummVM is the legal property of its developers, whose names are too numerous to list here. Please refer to the COPYRIGHT file distributed with this binary.", @@ -110,16 +112,16 @@ AboutDialog::AboutDialog() const EnginePlugin::List &plugins = EngineMan.getPlugins(); EnginePlugin::List::const_iterator iter = plugins.begin(); for (; iter != plugins.end(); ++iter) { - Common::String str; - str = "C0"; - str += (**iter).getName(); - addLine(str.c_str()); + Common::String str; + str = "C0"; + str += (**iter).getName(); + addLine(str.c_str()); - str = "C2"; - str += (**iter)->getOriginalCopyright(); - addLine(str.c_str()); + str = "C2"; + str += (**iter)->getOriginalCopyright(); + addLine(str.c_str()); - //addLine(""); + //addLine(""); } for (i = 0; i < ARRAYSIZE(gpl_text); i++) @@ -137,9 +139,26 @@ void AboutDialog::addLine(const char *str) { } else { Common::String format(str, 2); str += 2; - + + static Common::String asciiStr; + if (format[0] == 'A') { + bool useAscii = false; +#ifdef USE_TRANSLATION + // We could use TransMan.getCurrentCharset() but rather than compare strings + // it is easier to use TransMan.getCharsetMapping() (non null in case of non + // ISO-8859-1 mapping) + useAscii = (TransMan.getCharsetMapping() != NULL); +#endif + if (useAscii) + asciiStr = str; + return; + } StringArray wrappedLines; - g_gui.getFont().wordWrapText(str, _w - 2 * _xOff, wrappedLines); + if (!asciiStr.empty()) { + g_gui.getFont().wordWrapText(asciiStr, _w - 2 * _xOff, wrappedLines); + asciiStr.clear(); + } else + g_gui.getFont().wordWrapText(str, _w - 2 * _xOff, wrappedLines); for (StringArray::const_iterator i = wrappedLines.begin(); i != wrappedLines.end(); ++i) { _lines.push_back(format + *i); @@ -285,7 +304,7 @@ void AboutDialog::reflowLayout() { int maxW = _w - 2*_xOff; _w = 0; for (i = 0; i < ARRAYSIZE(credits); i++) { - int tmp = g_gui.getStringWidth(credits[i] + 5); + int tmp = g_gui.getStringWidth(credits[i]) + 5; if (_w < tmp && tmp <= maxW) { _w = tmp; } diff --git a/gui/browser.cpp b/gui/browser.cpp index 2b4f254156..84f2d0f747 100644 --- a/gui/browser.cpp +++ b/gui/browser.cpp @@ -32,7 +32,8 @@ namespace GUI { enum { kChooseCmd = 'Chos', - kGoUpCmd = 'GoUp' + kGoUpCmd = 'GoUp', + kHiddenCmd = 'Hidd' }; /* We want to use this as a general directory selector at some point... possible uses @@ -47,6 +48,7 @@ BrowserDialog::BrowserDialog(const char *title, bool dirBrowser) _isDirBrowser = dirBrowser; _fileList = NULL; _currentPath = NULL; + _showHidden = ConfMan.getBool("gui_browser_show_hidden", Common::ConfigManager::kApplicationDomain); // Headline - TODO: should be customizable during creation time new StaticTextWidget(this, "Browser.Headline", title); @@ -61,6 +63,9 @@ BrowserDialog::BrowserDialog(const char *title, bool dirBrowser) _backgroundType = GUI::ThemeEngine::kDialogBackgroundPlain; + // Checkbox for the "show hidden files" state. + _showHiddenWidget = new CheckboxWidget(this, "Browser.Hidden", _("Show hidden files"), _("Show files marked with the hidden attribute"), kHiddenCmd); + // Buttons if (g_system->getOverlayWidth() > 320) new ButtonWidget(this, "Browser.Up", _("Go up"), _("Go to previous directory level"), kGoUpCmd); @@ -132,6 +137,15 @@ void BrowserDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data if (data != (uint32)-1 && _isDirBrowser && !_nodeContent[data].isDirectory()) _fileList->setSelected(-1); break; + case kHiddenCmd: + // Update whether the user wants hidden files to be shown + _showHidden = _showHiddenWidget->getState(); + // We save the state in the application domain to avoid cluttering and + // to prevent odd behavior. + ConfMan.setBool("gui_browser_show_hidden", _showHidden, Common::ConfigManager::kApplicationDomain); + // Update the file listing + updateListing(); + break; default: Dialog::handleCommand(sender, cmd, data); } @@ -145,7 +159,7 @@ void BrowserDialog::updateListing() { ConfMan.set("browser_lastpath", _node.getPath()); // Read in the data from the file system - if (!_node.getChildren(_nodeContent, Common::FSNode::kListAll)) + if (!_node.getChildren(_nodeContent, Common::FSNode::kListAll, _showHidden)) _nodeContent.clear(); else Common::sort(_nodeContent.begin(), _nodeContent.end()); diff --git a/gui/browser.h b/gui/browser.h index e5cc12ad8e..b82fe516f9 100644 --- a/gui/browser.h +++ b/gui/browser.h @@ -29,6 +29,7 @@ namespace GUI { class ListWidget; class StaticTextWidget; +class CheckboxWidget; class CommandSender; class BrowserDialog : public Dialog { @@ -40,6 +41,7 @@ public: virtual int runModal(); #else virtual void open(); + virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data); #endif @@ -48,11 +50,15 @@ public: protected: #ifdef MACOSX const void *_titleRef; + const void *_chooseRef; + const void *_hiddenFilesRef; #else ListWidget *_fileList; StaticTextWidget *_currentPath; Common::FSNode _node; Common::FSList _nodeContent; + bool _showHidden; + CheckboxWidget *_showHiddenWidget; #endif Common::FSNode _choice; bool _isDirBrowser; diff --git a/gui/browser_osx.mm b/gui/browser_osx.mm index b8aa7c50ee..642718df94 100644 --- a/gui/browser_osx.mm +++ b/gui/browser_osx.mm @@ -28,20 +28,86 @@ #include "common/config-manager.h" #include "common/system.h" #include "common/algorithm.h" +#include "common/translation.h" +#include <AppKit/NSNibDeclarations.h> #include <AppKit/NSOpenPanel.h> +#include <AppKit/NSButton.h> #include <Foundation/NSString.h> +#include <Foundation/NSURL.h> + +@interface ShowHiddenFilesController : NSObject { + NSOpenPanel* _panel; +} + +- (id) init; +- (void) dealloc; +- (void) setOpenPanel : (NSOpenPanel*) panel; +- (IBAction) showHiddenFiles : (id) sender; + +@end + +@implementation ShowHiddenFilesController + +- (id) init { + self = [super init]; + _panel = 0; + + return self; +} + +- (void) dealloc { + [_panel release]; + [super dealloc]; +} + +- (void) setOpenPanel : (NSOpenPanel*) panel { + _panel = panel; + [_panel retain]; +} + + +- (IBAction) showHiddenFiles : (id) sender { + if ([sender state] == NSOnState) { + [_panel setShowsHiddenFiles: YES]; + ConfMan.setBool("gui_browser_show_hidden", true, Common::ConfigManager::kApplicationDomain); + } else { + [_panel setShowsHiddenFiles: NO]; + ConfMan.setBool("gui_browser_show_hidden", false, Common::ConfigManager::kApplicationDomain); + } +} + +@end namespace GUI { BrowserDialog::BrowserDialog(const char *title, bool dirBrowser) : Dialog("Browser") { - _titleRef = CFStringCreateWithCString(0, title, CFStringGetSystemEncoding()); + + // remember whether this is a file browser or a directory browser. _isDirBrowser = dirBrowser; + + // Get current encoding +#ifdef USE_TRANSLATION + CFStringRef encStr = CFStringCreateWithCString(NULL, TransMan.getCurrentCharset().c_str(), kCFStringEncodingASCII); + CFStringEncoding stringEncoding = CFStringConvertIANACharSetNameToEncoding(encStr); + CFRelease(encStr); +#else + CFStringEncoding stringEncoding = kCFStringEncodingASCII; +#endif + + // Convert title to NSString + _titleRef = CFStringCreateWithCString(0, title, stringEncoding); + + // Convert button text to NSString + _chooseRef = CFStringCreateWithCString(0, _("Choose"), stringEncoding); + _hiddenFilesRef = CFStringCreateWithCString(0, _("Show hidden files"), stringEncoding); } BrowserDialog::~BrowserDialog() { CFRelease(_titleRef); + CFRelease(_chooseRef); + CFRelease(_hiddenFilesRef); } int BrowserDialog::runModal() { @@ -58,15 +124,45 @@ int BrowserDialog::runModal() { // Temporarily show the real mouse CGDisplayShowCursor(kCGDirectMainDisplay); + NSOpenPanel *panel = [NSOpenPanel openPanel]; + [panel setCanChooseFiles:!_isDirBrowser]; + [panel setCanChooseDirectories:_isDirBrowser]; + [panel setTitle:(NSString *)_titleRef]; + [panel setPrompt:(NSString *)_chooseRef]; + + NSButton *showHiddenFilesButton = 0; + ShowHiddenFilesController *showHiddenFilesController = 0; + if ([panel respondsToSelector:@selector(setShowsHiddenFiles:)]) { + showHiddenFilesButton = [[NSButton alloc] init]; + [showHiddenFilesButton setButtonType:NSSwitchButton]; + [showHiddenFilesButton setTitle:(NSString *)_hiddenFilesRef]; + [showHiddenFilesButton sizeToFit]; + if (ConfMan.getBool("gui_browser_show_hidden", Common::ConfigManager::kApplicationDomain)) { + [showHiddenFilesButton setState:NSOnState]; + [panel setShowsHiddenFiles: YES]; + } else { + [showHiddenFilesButton setState:NSOffState]; + [panel setShowsHiddenFiles: NO]; + } + [panel setAccessoryView:showHiddenFilesButton]; + + showHiddenFilesController = [[ShowHiddenFilesController alloc] init]; + [showHiddenFilesController setOpenPanel:panel]; + [showHiddenFilesButton setTarget:showHiddenFilesController]; + [showHiddenFilesButton setAction:@selector(showHiddenFiles:)]; + } - NSOpenPanel * panel = [NSOpenPanel openPanel]; - [panel setCanChooseDirectories:YES]; - if ([panel runModalForTypes:nil] == NSOKButton) { - const char *filename = [[panel filename] UTF8String]; - _choice = Common::FSNode(filename); - choiceMade = true; + if ([panel runModal] == NSOKButton) { + NSURL *url = [panel URL]; + if ([url isFileURL]) { + const char *filename = [[url path] UTF8String]; + _choice = Common::FSNode(filename); + choiceMade = true; + } } + [showHiddenFilesButton release]; + [showHiddenFilesController release]; // If we were in fullscreen mode, switch back if (wasFullscreen) { diff --git a/gui/credits.h b/gui/credits.h index 37c5a7bd95..81d46b2b73 100644 --- a/gui/credits.h +++ b/gui/credits.h @@ -6,6 +6,7 @@ static const char *credits[] = { "C0""Eugene Sandulenko", "", "C1""PR Office", +"A0""Arnaud Boutonne", "C0""Arnaud Boutonn\351", "C2""Public Relations Officer, Project Administrator", "C0""Eugene Sandulenko", @@ -26,6 +27,7 @@ static const char *credits[] = { "", "C1""Engine Teams", "C1""SCUMM", +"A0""Torbjorn Andersson", "C0""Torbj\366rn Andersson", "C0""James Brown", "C2""(retired)", @@ -66,6 +68,7 @@ static const char *credits[] = { "C2""(retired)", "", "C1""AGOS", +"A0""Torbjorn Andersson", "C0""Torbj\366rn Andersson", "C0""Paul Gilbert", "C0""Travis Howell", @@ -75,6 +78,7 @@ static const char *credits[] = { "C2""(retired)", "", "C1""CGE", +"A0""Arnaud Boutonne", "C0""Arnaud Boutonn\351", "C0""Paul Gilbert", "", @@ -104,6 +108,7 @@ static const char *credits[] = { "C0""Pawel Kolodziejski", "", "C1""DreamWeb", +"A0""Torbjorn Andersson", "C0""Torbj\366rn Andersson", "C0""Bertrand Augereau", "C0""Filippos Karapetis", @@ -112,7 +117,9 @@ static const char *credits[] = { "C0""Willem Jan Palenstijn", "", "C1""Gob", +"A0""Torbjorn Andersson", "C0""Torbj\366rn Andersson", +"A0""Arnaud Boutonne", "C0""Arnaud Boutonn\351", "C0""Sven Hesse", "C0""Eugene Sandulenko", @@ -122,12 +129,19 @@ static const char *credits[] = { "C0""Scott Thomas", "C0""Jordi Vilalta Prat", "", +"C1""Hopkins", +"A0""Arnaud Boutonne", +"C0""Arnaud Boutonn\351", +"C0""Paul Gilbert", +"", "C1""Hugo", +"A0""Arnaud Boutonne", "C0""Arnaud Boutonn\351", "C0""Oystein Eftevaag", "C0""Eugene Sandulenko", "", "C1""Kyra", +"A0""Torbjorn Andersson", "C0""Torbj\366rn Andersson", "C2""VQA Player", "C0""Oystein Eftevaag", @@ -170,6 +184,7 @@ static const char *credits[] = { "C0""Joost Peters", "", "C1""SAGA", +"A0""Torbjorn Andersson", "C0""Torbj\366rn Andersson", "C0""Daniel Balsom", "C2""Original engine reimplementation author (retired)", @@ -191,6 +206,7 @@ static const char *credits[] = { "C0""Lars Skovlund", "", "C1""Sky", +"A0""Robert Goeffringmann", "C0""Robert G\366ffringmann", "C2""(retired)", "C0""Oliver Kiehl", @@ -202,10 +218,12 @@ static const char *credits[] = { "C2""PSX version support", "C0""Thierry Crozat", "C2""Mac version support", +"A0""Robert Goeffringmann", "C0""Robert G\366ffringmann", "C2""(retired)", "", "C1""Sword2", +"A0""Torbjorn Andersson", "C0""Torbj\366rn Andersson", "C0""Fabio Battaglia", "C2""PSX version support", @@ -213,6 +231,7 @@ static const char *credits[] = { "C2""(retired)", "", "C1""Sword25", +"A0""Torbjorn Andersson", "C0""Torbj\366rn Andersson", "C0""Paul Gilbert", "C0""Max Horn", @@ -227,6 +246,7 @@ static const char *credits[] = { "C2""(retired)", "", "C1""Tinsel", +"A0""Torbjorn Andersson", "C0""Torbj\366rn Andersson", "C0""Fabio Battaglia", "C2""PSX version support", @@ -237,7 +257,12 @@ static const char *credits[] = { "C0""Filippos Karapetis", "C0""Joost Peters", "", +"C1""Toltecs", +"C0""Benjamin Haisch", +"C0""Filippos Karapetis", +"", "C1""Tony", +"A0""Arnaud Boutonne", "C0""Arnaud Boutonn\351", "C0""Paul Gilbert", "C0""Alyssa Milburn", @@ -245,11 +270,13 @@ static const char *credits[] = { "C1""Toon", "C0""Sylvain Dupont", "", +"A1""Touche", "C1""Touch\351", "C0""Gregory Montoir", "C2""(retired)", "", "C1""TsAGE", +"A0""Arnaud Boutonne", "C0""Arnaud Boutonn\351", "C0""Paul Gilbert", "", @@ -258,6 +285,7 @@ static const char *credits[] = { "C2""(retired)", "", "C1""Wintermute", +"A0""Einar Johan T. Somaaen", "C0""Einar Johan T. S\370m\345en", "", "", @@ -305,6 +333,7 @@ static const char *credits[] = { "C2""(retired)", "", "C1""PlayStation 2", +"A0""Robert Goeffringmann", "C0""Robert G\366ffringmann", "C2""(retired)", "C0""Max Lingua", @@ -351,6 +380,9 @@ static const char *credits[] = { "C2""Heavily improved de-/encoder for DXA videos", "C0""Jochen Hoenicke", "C2""Speaker & PCjr sound support, AdLib work (retired)", +"A0""Daniel ter Laan", +"C0""Dani\353l ter Laan", +"C2""Restoring original Drascula tracks, and writing convert_dxa.bat", "C0""Chris Page", "C2""Return to launcher, savestate improvements, leak fixes, ... (GSoC 2008 task) (retired)", "C0""Robin Watts", @@ -413,9 +445,11 @@ static const char *credits[] = { "", "C1""Packages", "C1""AmigaOS 4", +"A0""Hans-Joerg Frieden", "C0""Hans-J\366rg Frieden", "C2""(retired)", "C0""Hubert Maier", +"A0""Juha Niemimaki", "C0""Juha Niemim\344ki", "C2""(retired)", "", @@ -445,6 +479,7 @@ static const char *credits[] = { "", "C1""MorphOS", "C0""Fabien Coeurjoly", +"A0""Ruediger Hanke", "C0""R\374diger Hanke", "C2""(retired)", "", @@ -475,15 +510,22 @@ static const char *credits[] = { "C1""Basque", "C0""Mikel Iturbe Urretxa", "", +"C1""Belarusian", +"C0""Ivan Lukyanov", +"", "C1""Catalan", "C0""Jordi Vilalta Prat", "", "C1""Czech", +"A0""Zbynik Schwarz", "C0""Zbyn\354k Schwarz", "", "C1""Danish", "C0""Steffen Nyeland", "", +"C1""Finnish", +"C0""Toni Saarela", +"", "C1""French", "C0""Thierry Crozat", "", @@ -502,10 +544,13 @@ static const char *credits[] = { "C1""Italian", "C0""Matteo Angelino", "", +"A1""Norwegian (Bokmaal)", "C1""Norwegian (Bokm\345l)", +"A0""Einar Johan Somaaen", "C0""Einar Johan S\370m\345en", "", "C1""Norwegian (Nynorsk)", +"A0""Einar Johan Somaaen", "C0""Einar Johan S\370m\345en", "", "C1""Polish", @@ -518,6 +563,7 @@ static const char *credits[] = { "C0""Eugene Sandulenko", "", "C1""Spanish", +"A0""Tomas Maidagan", "C0""Tom\341s Maidagan", "C0""Jordi Vilalta Prat", "", @@ -529,6 +575,7 @@ static const char *credits[] = { "", "", "C1""Websites (design)", +"A0""Dobo Balazs", "C0""Dob\363 Bal\341zs", "C2""Website design", "C0""William Claydon", @@ -557,6 +604,7 @@ static const char *credits[] = { "C2""Sound support for C64 version of MM/Zak, Loom PCE support", "C0""Janne Huttunen", "C2""V3 actor mask support, Dig/FT SMUSH audio", +"A0""Kovacs Endre Janos", "C0""Kov\341cs Endre J\341nos", "C2""Several fixes for Simon1", "C0""Jeroen Janssen", @@ -581,12 +629,14 @@ static const char *credits[] = { "C2""Sound support for Amiga SCUMM V2/V3 games, MM NES support", "C0""Robert Crossfield", "C2""Improved support for Apple II/C64 versions of MM", +"A0""Andreas Roever", "C0""Andreas R\366ver", "C2""Broken Sword I & II MPEG2 cutscene support", "C0""Edward Rudd", "C2""Fixes for playing MP3 versions of MI1/Loom audio", "C0""Daniel Schepler", "C2""Final MI1 CD music support, initial Ogg Vorbis support", +"A0""Andre Souza", "C0""Andr\351 Souza", "C2""SDL-based OpenGL renderer", "C0""Tom Frost", @@ -703,6 +753,7 @@ static const char *credits[] = { "C2""For deep tech details about C64 Zak & MM", "C0""Sarien Team", "C2""Original AGI engine code", +"A0""Jimmi Thogersen", "C0""Jimmi Th\370gersen", "C2""For ScummRev, and much obscure code/documentation", "C0""Tristan", diff --git a/gui/debugger.cpp b/gui/debugger.cpp index 972163df6f..35627dd584 100644 --- a/gui/debugger.cpp +++ b/gui/debugger.cpp @@ -554,4 +554,4 @@ bool Debugger::debuggerCompletionCallback(GUI::ConsoleDialog *console, const cha #endif -} // End of namespace GUI +} // End of namespace GUI diff --git a/gui/debugger.h b/gui/debugger.h index 3a587d2723..b79e8723c1 100644 --- a/gui/debugger.h +++ b/gui/debugger.h @@ -207,6 +207,6 @@ public: }; -} // End of namespace GUI +} // End of namespace GUI #endif diff --git a/gui/fluidsynth-dialog.cpp b/gui/fluidsynth-dialog.cpp new file mode 100644 index 0000000000..662518b557 --- /dev/null +++ b/gui/fluidsynth-dialog.cpp @@ -0,0 +1,366 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include "gui/fluidsynth-dialog.h" +#include "gui/message.h" +#include "gui/widgets/tab.h" +#include "gui/widgets/popup.h" + +#include "common/config-manager.h" +#include "common/translation.h" +#include "common/debug.h" + +namespace GUI { + +enum { + kActivateChorusCmd = 'acho', + kChorusVoiceCountChangedCmd = 'cvcc', + kChorusLevelChangedCmd = 'clec', + kChorusSpeedChangedCmd = 'cspc', + kChorusDepthChangedCmd = 'cdec', + + kActivateReverbCmd = 'arev', + kReverbRoomSizeChangedCmd = 'rrsc', + kReverbDampingChangedCmd = 'rdac', + kReverbWidthChangedCmd = 'rwic', + kReverbLevelChangedCmd = 'rlec', + + kResetSettingsCmd = 'rese' +}; + +enum { + kWaveFormTypeSine = 0, + kWaveFormTypeTriangle = 1 +}; + +enum { + kInterpolationNone = 0, + kInterpolationLinear = 1, + kInterpolation4thOrder = 2, + kInterpolation7thOrder = 3 +}; + +FluidSynthSettingsDialog::FluidSynthSettingsDialog() + : Dialog("FluidSynthSettings") { + _domain = Common::ConfigManager::kApplicationDomain; + + _tabWidget = new TabWidget(this, "FluidSynthSettings.TabWidget"); + + _tabWidget->addTab(_("Reverb")); + + _reverbActivate = new CheckboxWidget(_tabWidget, "FluidSynthSettings_Reverb.EnableTabCheckbox", _("Active"), 0, kActivateReverbCmd); + + _reverbRoomSizeDesc = new StaticTextWidget(_tabWidget, "FluidSynthSettings_Reverb.RoomSizeText", _("Room:")); + _reverbRoomSizeSlider = new SliderWidget(_tabWidget, "FluidSynthSettings_Reverb.RoomSizeSlider", 0, kReverbRoomSizeChangedCmd); + // 0.00 - 1.20, Default: 0.20 + _reverbRoomSizeSlider->setMinValue(0); + _reverbRoomSizeSlider->setMaxValue(120); + _reverbRoomSizeLabel = new StaticTextWidget(_tabWidget, "FluidSynthSettings_Reverb.RoomSizeLabel", "20"); + + _reverbDampingDesc = new StaticTextWidget(_tabWidget, "FluidSynthSettings_Reverb.DampingText", _("Damp:")); + _reverbDampingSlider = new SliderWidget(_tabWidget, "FluidSynthSettings_Reverb.DampingSlider", 0, kReverbDampingChangedCmd); + // 0.00 - 1.00, Default: 0.00 + _reverbDampingSlider->setMinValue(0); + _reverbDampingSlider->setMaxValue(100); + _reverbDampingLabel = new StaticTextWidget(_tabWidget, "FluidSynthSettings_Reverb.DampingLabel", "0"); + + _reverbWidthDesc = new StaticTextWidget(_tabWidget, "FluidSynthSettings_Reverb.WidthText", _("Width:")); + _reverbWidthSlider = new SliderWidget(_tabWidget, "FluidSynthSettings_Reverb.WidthSlider", 0, kReverbWidthChangedCmd); + // 0 - 100, Default: 1 + _reverbWidthSlider->setMinValue(0); + _reverbWidthSlider->setMaxValue(100); + _reverbWidthLabel = new StaticTextWidget(_tabWidget, "FluidSynthSettings_Reverb.WidthLabel", "1"); + + _reverbLevelDesc = new StaticTextWidget(_tabWidget, "FluidSynthSettings_Reverb.LevelText", _("Level:")); + _reverbLevelSlider = new SliderWidget(_tabWidget, "FluidSynthSettings_Reverb.LevelSlider", 0, kReverbLevelChangedCmd); + // 0.00 - 1.00, Default: 0.90 + _reverbLevelSlider->setMinValue(0); + _reverbLevelSlider->setMaxValue(100); + _reverbLevelLabel = new StaticTextWidget(_tabWidget, "FluidSynthSettings_Reverb.LevelLabel", "90"); + + _tabWidget->addTab(_("Chorus")); + + _chorusActivate = new CheckboxWidget(_tabWidget, "FluidSynthSettings_Chorus.EnableTabCheckbox", _("Active"), 0, kActivateChorusCmd); + + _chorusVoiceCountDesc = new StaticTextWidget(_tabWidget, "FluidSynthSettings_Chorus.VoiceCountText", _("N:")); + _chorusVoiceCountSlider = new SliderWidget(_tabWidget, "FluidSynthSettings_Chorus.VoiceCountSlider", 0, kChorusVoiceCountChangedCmd); + // 0-99, Default: 3 + _chorusVoiceCountSlider->setMinValue(0); + _chorusVoiceCountSlider->setMaxValue(99); + _chorusVoiceCountLabel = new StaticTextWidget(_tabWidget, "FluidSynthSettings_Chorus.VoiceCountLabel", "3"); + + _chorusLevelDesc = new StaticTextWidget(_tabWidget, "FluidSynthSettings_Chorus.LevelText", _("Level:")); + _chorusLevelSlider = new SliderWidget(_tabWidget, "FluidSynthSettings_Chorus.LevelSlider", 0, kChorusLevelChangedCmd); + // 0.00 - 1.00, Default: 1.00 + _chorusLevelSlider->setMinValue(0); + _chorusLevelSlider->setMaxValue(100); + _chorusLevelLabel = new StaticTextWidget(_tabWidget, "FluidSynthSettings_Chorus.LevelLabel", "100"); + + _chorusSpeedDesc = new StaticTextWidget(_tabWidget, "FluidSynthSettings_Chorus.SpeedText", _("Speed:")); + _chorusSpeedSlider = new SliderWidget(_tabWidget, "FluidSynthSettings_Chorus.SpeedSlider", 0, kChorusSpeedChangedCmd); + // 0.30 - 5.00, Default: 0.30 + _chorusSpeedSlider->setMinValue(30); + _chorusSpeedSlider->setMaxValue(500); + _chorusSpeedLabel = new StaticTextWidget(_tabWidget, "FluidSynthSettings_Chorus.SpeedLabel", "30"); + + _chorusDepthDesc = new StaticTextWidget(_tabWidget, "FluidSynthSettings_Chorus.DepthText", _("Depth:")); + _chorusDepthSlider = new SliderWidget(_tabWidget, "FluidSynthSettings_Chorus.DepthSlider", 0, kChorusDepthChangedCmd); + // 0.00 - 21.00, Default: 8.00 + _chorusDepthSlider->setMinValue(0); + _chorusDepthSlider->setMaxValue(210); + _chorusDepthLabel = new StaticTextWidget(_tabWidget, "FluidSynthSettings_Chorus.DepthLabel", "80"); + + _chorusWaveFormTypePopUpDesc = new StaticTextWidget(_tabWidget, "FluidSynthSettings_Chorus.WaveFormTypeText", _("Type:")); + _chorusWaveFormTypePopUp = new PopUpWidget(_tabWidget, "FluidSynthSettings_Chorus.WaveFormType"); + + _chorusWaveFormTypePopUp->appendEntry(_("Sine"), kWaveFormTypeSine); + _chorusWaveFormTypePopUp->appendEntry(_("Triangle"), kWaveFormTypeTriangle); + + _tabWidget->addTab(_("Misc")); + + _miscInterpolationPopUpDesc = new StaticTextWidget(_tabWidget, "FluidSynthSettings_Misc.InterpolationText", _("Interpolation:")); + _miscInterpolationPopUp = new PopUpWidget(_tabWidget, "FluidSynthSettings_Misc.Interpolation"); + + _miscInterpolationPopUp->appendEntry(_("None (fastest)"), kInterpolationNone); + _miscInterpolationPopUp->appendEntry(_("Linear"), kInterpolationLinear); + _miscInterpolationPopUp->appendEntry(_("Fourth-order"), kInterpolation4thOrder); + _miscInterpolationPopUp->appendEntry(_("Seventh-order"), kInterpolation7thOrder); + + _tabWidget->setActiveTab(0); + + new ButtonWidget(this, "FluidSynthSettings.ResetSettings", _("Reset"), _("Reset all FluidSynth settings to their default values."), kResetSettingsCmd); + + new ButtonWidget(this, "FluidSynthSettings.Cancel", _("Cancel"), 0, kCloseCmd); + new ButtonWidget(this, "FluidSynthSettings.Ok", _("OK"), 0, kOKCmd); +} + +FluidSynthSettingsDialog::~FluidSynthSettingsDialog() { +} + +void FluidSynthSettingsDialog::open() { + Dialog::open(); + + // Reset result value + setResult(0); + + readSettings(); +} + +void FluidSynthSettingsDialog::close() { + if (getResult()) { + writeSettings(); + } + + Dialog::close(); +} + +void FluidSynthSettingsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) { + switch (cmd) { + case kActivateChorusCmd: + setChorusSettingsState(data); + break; + case kChorusVoiceCountChangedCmd: + _chorusVoiceCountLabel->setLabel(Common::String::format("%d", _chorusVoiceCountSlider->getValue())); + _chorusVoiceCountLabel->draw(); + break; + case kChorusLevelChangedCmd: + _chorusLevelLabel->setLabel(Common::String::format("%d", _chorusLevelSlider->getValue())); + _chorusLevelLabel->draw(); + break; + case kChorusSpeedChangedCmd: + _chorusSpeedLabel->setLabel(Common::String::format("%d", _chorusSpeedSlider->getValue())); + _chorusSpeedLabel->draw(); + break; + case kChorusDepthChangedCmd: + _chorusDepthLabel->setLabel(Common::String::format("%d", _chorusDepthSlider->getValue())); + _chorusDepthLabel->draw(); + break; + case kActivateReverbCmd: + setReverbSettingsState(data); + break; + case kReverbRoomSizeChangedCmd: + _reverbRoomSizeLabel->setLabel(Common::String::format("%d", _reverbRoomSizeSlider->getValue())); + _reverbRoomSizeLabel->draw(); + break; + case kReverbDampingChangedCmd: + _reverbDampingLabel->setLabel(Common::String::format("%d", _reverbDampingSlider->getValue())); + _reverbDampingLabel->draw(); + break; + case kReverbWidthChangedCmd: + _reverbWidthLabel->setLabel(Common::String::format("%d", _reverbWidthSlider->getValue())); + _reverbWidthLabel->draw(); + break; + case kReverbLevelChangedCmd: + _reverbLevelLabel->setLabel(Common::String::format("%d", _reverbLevelSlider->getValue())); + _reverbLevelLabel->draw(); + break; + case kResetSettingsCmd: { + MessageDialog alert(_("Do you really want to reset all FluidSynth settings to their default values?"), _("Yes"), _("No")); + if (alert.runModal() == GUI::kMessageOK) { + resetSettings(); + readSettings(); + draw(); + } + break; + } + case kOKCmd: + setResult(1); + close(); + break; + default: + Dialog::handleCommand(sender, cmd, data); + break; + } +} + +void FluidSynthSettingsDialog::setChorusSettingsState(bool enabled) { + _chorusVoiceCountDesc->setEnabled(enabled); + _chorusVoiceCountSlider->setEnabled(enabled); + _chorusVoiceCountLabel->setEnabled(enabled); + _chorusLevelDesc->setEnabled(enabled); + _chorusLevelSlider->setEnabled(enabled); + _chorusLevelLabel->setEnabled(enabled); + _chorusSpeedDesc->setEnabled(enabled); + _chorusSpeedSlider->setEnabled(enabled); + _chorusSpeedLabel->setEnabled(enabled); + _chorusDepthDesc->setEnabled(enabled); + _chorusDepthSlider->setEnabled(enabled); + _chorusDepthLabel->setEnabled(enabled); + _chorusWaveFormTypePopUpDesc->setEnabled(enabled); + _chorusWaveFormTypePopUp->setEnabled(enabled); +} + +void FluidSynthSettingsDialog::setReverbSettingsState(bool enabled) { + _reverbRoomSizeDesc->setEnabled(enabled); + _reverbRoomSizeSlider->setEnabled(enabled); + _reverbRoomSizeLabel->setEnabled(enabled); + _reverbDampingDesc->setEnabled(enabled); + _reverbDampingSlider->setEnabled(enabled); + _reverbDampingLabel->setEnabled(enabled); + _reverbWidthDesc->setEnabled(enabled); + _reverbWidthSlider->setEnabled(enabled); + _reverbWidthLabel->setEnabled(enabled); + _reverbLevelDesc->setEnabled(enabled); + _reverbLevelSlider->setEnabled(enabled); + _reverbLevelLabel->setEnabled(enabled); +} + +void FluidSynthSettingsDialog::readSettings() { + _chorusVoiceCountSlider->setValue(ConfMan.getInt("fluidsynth_chorus_nr", _domain)); + _chorusVoiceCountLabel->setLabel(Common::String::format("%d", _chorusVoiceCountSlider->getValue())); + _chorusLevelSlider->setValue(ConfMan.getInt("fluidsynth_chorus_level", _domain)); + _chorusLevelLabel->setLabel(Common::String::format("%d", _chorusLevelSlider->getValue())); + _chorusSpeedSlider->setValue(ConfMan.getInt("fluidsynth_chorus_speed", _domain)); + _chorusSpeedLabel->setLabel(Common::String::format("%d", _chorusSpeedSlider->getValue())); + _chorusDepthSlider->setValue(ConfMan.getInt("fluidsynth_chorus_depth", _domain)); + _chorusDepthLabel->setLabel(Common::String::format("%d", _chorusDepthSlider->getValue())); + + Common::String waveForm = ConfMan.get("fluidsynth_chorus_waveform", _domain); + if (waveForm == "sine") { + _chorusWaveFormTypePopUp->setSelectedTag(kWaveFormTypeSine); + } else if (waveForm == "triangle") { + _chorusWaveFormTypePopUp->setSelectedTag(kWaveFormTypeTriangle); + } + + _reverbRoomSizeSlider->setValue(ConfMan.getInt("fluidsynth_reverb_roomsize", _domain)); + _reverbRoomSizeLabel->setLabel(Common::String::format("%d", _reverbRoomSizeSlider->getValue())); + _reverbDampingSlider->setValue(ConfMan.getInt("fluidsynth_reverb_damping", _domain)); + _reverbDampingLabel->setLabel(Common::String::format("%d", _reverbDampingSlider->getValue())); + _reverbWidthSlider->setValue(ConfMan.getInt("fluidsynth_reverb_width", _domain)); + _reverbWidthLabel->setLabel(Common::String::format("%d", _reverbWidthSlider->getValue())); + _reverbLevelSlider->setValue(ConfMan.getInt("fluidsynth_reverb_level", _domain)); + _reverbLevelLabel->setLabel(Common::String::format("%d", _reverbLevelSlider->getValue())); + + Common::String interpolation = ConfMan.get("fluidsynth_misc_interpolation", _domain); + if (interpolation == "none") { + _miscInterpolationPopUp->setSelectedTag(kInterpolationNone); + } else if (interpolation == "linear") { + _miscInterpolationPopUp->setSelectedTag(kInterpolationLinear); + } else if (interpolation == "4th") { + _miscInterpolationPopUp->setSelectedTag(kInterpolation4thOrder); + } else if (interpolation == "7th") { + _miscInterpolationPopUp->setSelectedTag(kInterpolation7thOrder); + } + + // This may trigger redrawing, so don't do it until all sliders have + // their proper values. Otherwise, the dialog may crash because of + // invalid slider values. + _chorusActivate->setState(ConfMan.getBool("fluidsynth_chorus_activate", _domain)); + _reverbActivate->setState(ConfMan.getBool("fluidsynth_reverb_activate", _domain)); +} + +void FluidSynthSettingsDialog::writeSettings() { + ConfMan.setBool("fluidsynth_chorus_activate", _chorusActivate->getState()); + ConfMan.setInt("fluidsynth_chorus_nr", _chorusVoiceCountSlider->getValue(), _domain); + ConfMan.setInt("fluidsynth_chorus_level", _chorusLevelSlider->getValue(), _domain); + ConfMan.setInt("fluidsynth_chorus_speed", _chorusSpeedSlider->getValue(), _domain); + ConfMan.setInt("fluidsynth_chorus_depth", _chorusDepthSlider->getValue(), _domain); + + uint32 waveForm = _chorusWaveFormTypePopUp->getSelectedTag(); + if (waveForm == kWaveFormTypeSine) { + ConfMan.set("fluidsynth_chorus_waveform", "sine", _domain); + } else if (waveForm == kWaveFormTypeTriangle) { + ConfMan.set("fluidsynth_chorus_waveform", "triangle", _domain); + } else { + ConfMan.removeKey("fluidsynth_chorus_waveform", _domain); + } + + ConfMan.setBool("fluidsynth_reverb_activate", _reverbActivate->getState()); + ConfMan.setInt("fluidsynth_reverb_roomsize", _reverbRoomSizeSlider->getValue(), _domain); + ConfMan.setInt("fluidsynth_reverb_damping", _reverbDampingSlider->getValue(), _domain); + ConfMan.setInt("fluidsynth_reverb_width", _reverbWidthSlider->getValue(), _domain); + ConfMan.setInt("fluidsynth_reverb_level", _reverbLevelSlider->getValue(), _domain); + + uint32 interpolation = _miscInterpolationPopUp->getSelectedTag(); + if (interpolation == kInterpolationNone) { + ConfMan.set("fluidsynth_misc_interpolation", "none", _domain); + } else if (interpolation == kInterpolationLinear) { + ConfMan.set("fluidsynth_misc_interpolation", "linear", _domain); + } else if (interpolation == kInterpolation4thOrder) { + ConfMan.set("fluidsynth_misc_interpolation", "4th", _domain); + } else if (interpolation == kInterpolation7thOrder) { + ConfMan.set("fluidsynth_misc_interpolation", "7th", _domain); + } else { + ConfMan.removeKey("fluidsynth_misc_interpolation", _domain); + } + + // The main options dialog is responsible for writing the config file. + // That's why we don't actually flush the settings to the file here. +} + +void FluidSynthSettingsDialog::resetSettings() { + ConfMan.removeKey("fluidsynth_chorus_activate", _domain); + ConfMan.removeKey("fluidsynth_chorus_nr", _domain); + ConfMan.removeKey("fluidsynth_chorus_level", _domain); + ConfMan.removeKey("fluidsynth_chorus_speed", _domain); + ConfMan.removeKey("fluidsynth_chorus_depth", _domain); + ConfMan.removeKey("fluidsynth_chorus_waveform", _domain); + + ConfMan.removeKey("fluidsynth_reverb_activate", _domain); + ConfMan.removeKey("fluidsynth_reverb_roomsize", _domain); + ConfMan.removeKey("fluidsynth_reverb_damping", _domain); + ConfMan.removeKey("fluidsynth_reverb_width", _domain); + ConfMan.removeKey("fluidsynth_reverb_level", _domain); + + ConfMan.removeKey("fluidsynth_misc_interpolation", _domain); +} + +} // End of namespace GUI diff --git a/gui/fluidsynth-dialog.h b/gui/fluidsynth-dialog.h new file mode 100644 index 0000000000..4d74c9f93e --- /dev/null +++ b/gui/fluidsynth-dialog.h @@ -0,0 +1,104 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef FLUIDSYNTH_DIALOG_H +#define FLUIDSYNTH_DIALOG_H + +#include "common/str.h" +#include "gui/dialog.h" + +namespace GUI { + +class TabWidget; +class CheckboxWidget; +class SliderWidget; +class StaticTextWidget; +class PopUpWidget; + +class FluidSynthSettingsDialog : public Dialog { +public: + FluidSynthSettingsDialog(); + ~FluidSynthSettingsDialog(); + + void open(); + void close(); + void handleCommand(CommandSender *sender, uint32 cmd, uint32 data); + +protected: + void setChorusSettingsState(bool enabled); + void setReverbSettingsState(bool enabled); + + void readSettings(); + void writeSettings(); + + void resetSettings(); + +private: + Common::String _domain; + + TabWidget *_tabWidget; + + CheckboxWidget *_chorusActivate; + + StaticTextWidget *_chorusVoiceCountDesc; + SliderWidget *_chorusVoiceCountSlider; + StaticTextWidget *_chorusVoiceCountLabel; + + StaticTextWidget *_chorusLevelDesc; + SliderWidget *_chorusLevelSlider; + StaticTextWidget *_chorusLevelLabel; + + StaticTextWidget *_chorusSpeedDesc; + SliderWidget *_chorusSpeedSlider; + StaticTextWidget *_chorusSpeedLabel; + + StaticTextWidget *_chorusDepthDesc; + SliderWidget *_chorusDepthSlider; + StaticTextWidget *_chorusDepthLabel; + + StaticTextWidget *_chorusWaveFormTypePopUpDesc; + PopUpWidget *_chorusWaveFormTypePopUp; + + CheckboxWidget *_reverbActivate; + + StaticTextWidget *_reverbRoomSizeDesc; + SliderWidget *_reverbRoomSizeSlider; + StaticTextWidget *_reverbRoomSizeLabel; + + StaticTextWidget *_reverbDampingDesc; + SliderWidget *_reverbDampingSlider; + StaticTextWidget *_reverbDampingLabel; + + StaticTextWidget *_reverbWidthDesc; + SliderWidget *_reverbWidthSlider; + StaticTextWidget *_reverbWidthLabel; + + StaticTextWidget *_reverbLevelDesc; + SliderWidget *_reverbLevelSlider; + StaticTextWidget *_reverbLevelLabel; + + StaticTextWidget *_miscInterpolationPopUpDesc; + PopUpWidget *_miscInterpolationPopUp; +}; + +} // End of namespace GUI + +#endif diff --git a/gui/launcher.cpp b/gui/launcher.cpp index 0f4867ced5..4e35b54db8 100644 --- a/gui/launcher.cpp +++ b/gui/launcher.cpp @@ -1128,7 +1128,7 @@ void LauncherDialog::reflowLayout() { if (g_gui.xmlEval()->getVar("Globals.ShowLauncherLogo") == 1 && g_gui.theme()->supportsImages()) { StaticTextWidget *ver = (StaticTextWidget *)findWidget("Launcher.Version"); if (ver) { - ver->setAlign((Graphics::TextAlign)g_gui.xmlEval()->getVar("Launcher.Version.Align", Graphics::kTextAlignCenter)); + ver->setAlign(g_gui.xmlEval()->getWidgetTextHAlign("Launcher.Version")); ver->setLabel(gScummVMVersionDate); } @@ -1139,7 +1139,7 @@ void LauncherDialog::reflowLayout() { } else { StaticTextWidget *ver = (StaticTextWidget *)findWidget("Launcher.Version"); if (ver) { - ver->setAlign((Graphics::TextAlign)g_gui.xmlEval()->getVar("Launcher.Version.Align", Graphics::kTextAlignCenter)); + ver->setAlign(g_gui.xmlEval()->getWidgetTextHAlign("Launcher.Version")); ver->setLabel(gScummVMFullVersion); } diff --git a/gui/module.mk b/gui/module.mk index a435d8cca7..bda3c88cd5 100644 --- a/gui/module.mk +++ b/gui/module.mk @@ -38,5 +38,10 @@ MODULE_OBJS += \ browser.o endif +ifdef USE_FLUIDSYNTH +MODULE_OBJS += \ + fluidsynth-dialog.o +endif + # Include common rules include $(srcdir)/rules.mk diff --git a/gui/options.cpp b/gui/options.cpp index 4868f1876d..a9fdc19274 100644 --- a/gui/options.cpp +++ b/gui/options.cpp @@ -75,6 +75,12 @@ enum { }; #endif +#ifdef USE_FLUIDSYNTH +enum { + kFluidSynthSettingsCmd = 'flst' +}; +#endif + static const char *savePeriodLabels[] = { _s("Never"), _s("every 5 mins"), _s("every 10 mins"), _s("every 15 mins"), _s("every 30 mins"), 0 }; static const int savePeriodValues[] = { 0, 5 * 60, 10 * 60, 15 * 60, 30 * 60, -1 }; static const char *outputRateLabels[] = { _s("<default>"), _s("8 kHz"), _s("11kHz"), _s("22 kHz"), _s("44 kHz"), _s("48 kHz"), 0 }; @@ -863,6 +869,10 @@ void OptionsDialog::addMIDIControls(GuiObject *boss, const Common::String &prefi _midiGainSlider->setMaxValue(1000); _midiGainLabel = new StaticTextWidget(boss, prefix + "mcMidiGainLabel", "1.00"); +#ifdef USE_FLUIDSYNTH + new ButtonWidget(boss, prefix + "mcFluidSynthSettings", _("FluidSynth Settings"), 0, kFluidSynthSettingsCmd); +#endif + _enableMIDISettings = true; } @@ -877,7 +887,7 @@ void OptionsDialog::addMT32Controls(GuiObject *boss, const Common::String &prefi _mt32Checkbox = new CheckboxWidget(boss, prefix + "mcMt32Checkbox", _c("True Roland MT-32 (no GM emulation)", "lowres"), _("Check if you want to use your real hardware Roland-compatible sound device connected to your computer")); // GS Extensions setting - _enableGSCheckbox = new CheckboxWidget(boss, prefix + "mcGSCheckbox", _("Enable Roland GS Mode"), _("Turns off General MIDI mapping for games with Roland MT-32 soundtrack")); + _enableGSCheckbox = new CheckboxWidget(boss, prefix + "mcGSCheckbox", _("Roland GS Device (enable MT-32 mappings)"), _("Check if you want to enable patch mappings to emulate an MT-32 on a Roland GS device")); const MusicPlugin::List p = MusicMan.getPlugins(); // Make sure the null device is the first one in the list to avoid undesired @@ -1231,12 +1241,20 @@ GlobalOptionsDialog::GlobalOptionsDialog() #ifdef SMALL_SCREEN_DEVICE _keysDialog = new KeysDialog(); #endif + +#ifdef USE_FLUIDSYNTH + _fluidSynthSettingsDialog = new FluidSynthSettingsDialog(); +#endif } GlobalOptionsDialog::~GlobalOptionsDialog() { #ifdef SMALL_SCREEN_DEVICE delete _keysDialog; #endif + +#ifdef USE_FLUIDSYNTH + delete _fluidSynthSettingsDialog; +#endif } void GlobalOptionsDialog::open() { @@ -1466,6 +1484,11 @@ void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3 _keysDialog->runModal(); break; #endif +#ifdef USE_FLUIDSYNTH + case kFluidSynthSettingsCmd: + _fluidSynthSettingsDialog->runModal(); + break; +#endif default: OptionsDialog::handleCommand(sender, cmd, data); } diff --git a/gui/options.h b/gui/options.h index def56cfa35..081ef4fea5 100644 --- a/gui/options.h +++ b/gui/options.h @@ -32,6 +32,10 @@ #include "gui/KeysDialog.h" #endif +#ifdef USE_FLUIDSYNTH +#include "gui/fluidsynth-dialog.h" +#endif + namespace GUI { class CheckboxWidget; @@ -208,6 +212,9 @@ protected: #ifdef SMALL_SCREEN_DEVICE KeysDialog *_keysDialog; #endif +#ifdef USE_FLUIDSYNTH + FluidSynthSettingsDialog *_fluidSynthSettingsDialog; +#endif StaticTextWidget *_savePath; ButtonWidget *_savePathClearButton; StaticTextWidget *_themePath; diff --git a/gui/predictivedialog.cpp b/gui/predictivedialog.cpp index ed18847a40..5ce093e054 100644 --- a/gui/predictivedialog.cpp +++ b/gui/predictivedialog.cpp @@ -779,7 +779,7 @@ bool PredictiveDialog::searchWord(const char *const where, const Common::String } void PredictiveDialog::addWord(Dict &dict, const Common::String &word, const Common::String &code) { - char *newLine; + char *newLine = 0; Common::String tmpCode = code + ' '; int line = binarySearch(dict.dictLine, tmpCode, dict.dictLineCount); if (line >= 0) { @@ -856,6 +856,9 @@ void PredictiveDialog::addWord(Dict &dict, const Common::String &word, const Com char **newDictLine = (char **)calloc(1, sizeof(char *) * (dict.dictLineCount + 1)); if (!newDictLine) { warning("Predictive Dialog: cannot allocate memory for index buffer"); + + free(newLine); + return; } newDictLine[dict.dictLineCount] = '\0'; diff --git a/gui/saveload-dialog.cpp b/gui/saveload-dialog.cpp index df8dda7470..c7dd62b6c6 100644 --- a/gui/saveload-dialog.cpp +++ b/gui/saveload-dialog.cpp @@ -35,6 +35,14 @@ namespace GUI { #ifndef DISABLE_SAVELOADCHOOSER_GRID SaveLoadChooserType getRequestedSaveLoadDialog(const MetaEngine &metaEngine) { const Common::String &userConfig = ConfMan.get("gui_saveload_chooser", Common::ConfigManager::kApplicationDomain); + + // Check (and update if necessary) the theme config here. This catches + // resolution changes, which happened after the GUI was closed. This + // should assure that the correct GUI width/height are returned below and + // prevent the logic from picking the grid dialog, even though it is not + // possible to use it. + g_gui.checkScreenChange(); + if (g_gui.getWidth() >= 640 && g_gui.getHeight() >= 400 && metaEngine.hasFeature(MetaEngine::kSavesSupportMetaInfo) && metaEngine.hasFeature(MetaEngine::kSavesSupportThumbnail) diff --git a/gui/themes/default.inc b/gui/themes/default.inc index 7f565eb05d..6d8e6baac7 100644 --- a/gui/themes/default.inc +++ b/gui/themes/default.inc @@ -683,6 +683,7 @@ "<layout type='vertical' center='true' padding='6,6,2,2'> " "<widget name='Version' " "height='Globals.Line.Height' " +"textalign='center' " "/> " "<layout type='horizontal' spacing='5' padding='0,0,0,0'> " "<widget name='SearchDesc' " @@ -740,7 +741,11 @@ "height='Globals.Line.Height' " "/> " "<widget name='List'/> " -"<layout type='horizontal' padding='0,0,8,0'> " +"<layout type='vertical' padding='0,0,8,0'> " +"<widget name='Hidden' " +"type='Checkbox' " +"/> " +"<layout type='horizontal' padding='0,0,0,0'> " "<widget name='Up' " "type='Button' " "/> " @@ -753,6 +758,7 @@ "/> " "</layout> " "</layout> " +"</layout> " "</dialog> " "<dialog name='GlobalOptions' overlays='screen' inset='16' shading='dim'> " "<layout type='vertical' padding='0,0,0,0'> " @@ -891,7 +897,7 @@ "</layout> " "</dialog> " "<dialog name='GlobalOptions_MIDI' overlays='Dialog.GlobalOptions.TabWidget'> " -"<layout type='vertical' padding='16,16,16,16' spacing='8'> " +"<layout type='vertical' padding='16,16,16,16' spacing='6'> " "<layout type='horizontal' padding='0,0,0,0' spacing='6' center='true'> " "<widget name='auPrefGmPopupDesc' " "type='OptionsLabel' " @@ -927,6 +933,10 @@ "height='Globals.Line.Height' " "/> " "</layout> " +"<widget name='mcFluidSynthSettings' " +"width='150' " +"height='Globals.Button.Height' " +"/> " "</layout> " "</dialog> " "<dialog name='GlobalOptions_MT32' overlays='Dialog.GlobalOptions.TabWidget'> " @@ -1359,6 +1369,153 @@ "</layout> " "</layout> " "</dialog> " +"<dialog name='FluidSynthSettings' overlays='GlobalOptions' shading='dim'> " +"<layout type='vertical' padding='0,0,0,0'> " +"<widget name='TabWidget'/> " +"<layout type='horizontal' padding='8,8,8,8'> " +"<space/> " +"<widget name='ResetSettings' " +"type='Button' " +"/> " +"<widget name='Cancel' " +"type='Button' " +"/> " +"<widget name='Ok' " +"type='Button' " +"/> " +"</layout> " +"</layout> " +"</dialog> " +"<dialog name='FluidSynthSettings_Chorus' overlays='Dialog.FluidSynthSettings.TabWidget'> " +"<layout type='vertical' padding='8,8,8,8' spacing='6'> " +"<widget name='EnableTabCheckbox' " +"type='Checkbox' " +"/> " +"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> " +"<widget name='VoiceCountText' " +"type='OptionsLabel' " +"/> " +"<widget name='VoiceCountSlider' " +"type='Slider' " +"/> " +"<widget name='VoiceCountLabel' " +"width='32' " +"height='Globals.Line.Height' " +"/> " +"</layout> " +"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> " +"<widget name='LevelText' " +"type='OptionsLabel' " +"/> " +"<widget name='LevelSlider' " +"type='Slider' " +"/> " +"<widget name='LevelLabel' " +"width='32' " +"height='Globals.Line.Height' " +"/> " +"</layout> " +"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> " +"<widget name='SpeedText' " +"type='OptionsLabel' " +"/> " +"<widget name='SpeedSlider' " +"type='Slider' " +"/> " +"<widget name='SpeedLabel' " +"width='32' " +"height='Globals.Line.Height' " +"/> " +"</layout> " +"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> " +"<widget name='DepthText' " +"type='OptionsLabel' " +"/> " +"<widget name='DepthSlider' " +"type='Slider' " +"/> " +"<widget name='DepthLabel' " +"width='32' " +"height='Globals.Line.Height' " +"/> " +"</layout> " +"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> " +"<widget name='WaveFormTypeText' " +"type='OptionsLabel' " +"/> " +"<widget name='WaveFormType' " +"type='PopUp' " +"/> " +"</layout> " +"</layout> " +"</dialog> " +"<dialog name='FluidSynthSettings_Reverb' overlays='Dialog.FluidSynthSettings.TabWidget'> " +"<layout type='vertical' padding='8,8,8,8' spacing='6'> " +"<widget name='EnableTabCheckbox' " +"type='Checkbox' " +"/> " +"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> " +"<widget name='RoomSizeText' " +"type='OptionsLabel' " +"/> " +"<widget name='RoomSizeSlider' " +"type='Slider' " +"/> " +"<widget name='RoomSizeLabel' " +"width='32' " +"height='Globals.Line.Height' " +"/> " +"</layout> " +"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> " +"<widget name='DampingText' " +"type='OptionsLabel' " +"/> " +"<widget name='DampingSlider' " +"type='Slider' " +"/> " +"<widget name='DampingLabel' " +"width='32' " +"height='Globals.Line.Height' " +"/> " +"</layout> " +"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> " +"<widget name='WidthText' " +"type='OptionsLabel' " +"/> " +"<widget name='WidthSlider' " +"type='Slider' " +"/> " +"<widget name='WidthLabel' " +"width='32' " +"height='Globals.Line.Height' " +"/> " +"</layout> " +"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> " +"<widget name='LevelText' " +"type='OptionsLabel' " +"/> " +"<widget name='LevelSlider' " +"type='Slider' " +"/> " +"<widget name='LevelLabel' " +"width='32' " +"height='Globals.Line.Height' " +"/> " +"</layout> " +"</layout> " +"</dialog> " +"<dialog name='FluidSynthSettings_Misc' overlays='Dialog.FluidSynthSettings.TabWidget'> " +"<layout type='vertical' padding='8,8,8,8' spacing='6'> " +"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> " +"<widget name='InterpolationText' " +"type='OptionsLabel' " +"/> " +"<widget name='Interpolation' " +"type='PopUp' " +"/> " +"</layout> " +"</layout> " +"</dialog> " "<dialog name='SaveLoadChooser' overlays='screen' inset='8' shading='dim'> " "<layout type='vertical' padding='8,8,8,8' center='true'> " "<widget name='Title' height='Globals.Line.Height'/> " @@ -1659,6 +1816,7 @@ "<layout type='vertical' center='true' padding='16,16,8,8'> " "<widget name='Version' " "height='Globals.Line.Height' " +"textalign='center' " "/> " "<layout type='horizontal' spacing='5' padding='10,0,0,0'> " "<widget name='SearchDesc' " @@ -1717,7 +1875,11 @@ "height='Globals.Line.Height' " "/> " "<widget name='List'/> " -"<layout type='horizontal' padding='0,0,16,0'> " +"<layout type='vertical' padding='0,0,16,0'> " +"<widget name='Hidden' " +"type='Checkbox' " +"/> " +"<layout type='horizontal' padding='0,0,0,0'> " "<widget name='Up' " "type='Button' " "/> " @@ -1730,6 +1892,7 @@ "/> " "</layout> " "</layout> " +"</layout> " "</dialog> " "<dialog name='GlobalOptions' overlays='Dialog.Launcher.GameList' shading='dim'> " "<layout type='vertical' padding='0,0,0,0'> " @@ -1905,6 +2068,10 @@ "height='Globals.Line.Height' " "/> " "</layout> " +"<widget name='mcFluidSynthSettings' " +"width='200' " +"height='Globals.Button.Height' " +"/> " "</layout> " "</dialog> " "<dialog name='GlobalOptions_MT32' overlays='Dialog.GlobalOptions.TabWidget'> " @@ -2323,6 +2490,153 @@ "</layout> " "</layout> " "</dialog> " +"<dialog name='FluidSynthSettings' overlays='GlobalOptions' shading='dim'> " +"<layout type='vertical' padding='0,0,0,0'> " +"<widget name='TabWidget'/> " +"<layout type='horizontal' padding='16,16,16,16'> " +"<space/> " +"<widget name='ResetSettings' " +"type='Button' " +"/> " +"<widget name='Cancel' " +"type='Button' " +"/> " +"<widget name='Ok' " +"type='Button' " +"/> " +"</layout> " +"</layout> " +"</dialog> " +"<dialog name='FluidSynthSettings_Chorus' overlays='Dialog.FluidSynthSettings.TabWidget'> " +"<layout type='vertical' padding='16,16,16,16' spacing='8'> " +"<widget name='EnableTabCheckbox' " +"type='Checkbox' " +"/> " +"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> " +"<widget name='VoiceCountText' " +"type='OptionsLabel' " +"/> " +"<widget name='VoiceCountSlider' " +"type='Slider' " +"/> " +"<widget name='VoiceCountLabel' " +"width='32' " +"height='Globals.Line.Height' " +"/> " +"</layout> " +"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> " +"<widget name='LevelText' " +"type='OptionsLabel' " +"/> " +"<widget name='LevelSlider' " +"type='Slider' " +"/> " +"<widget name='LevelLabel' " +"width='32' " +"height='Globals.Line.Height' " +"/> " +"</layout> " +"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> " +"<widget name='SpeedText' " +"type='OptionsLabel' " +"/> " +"<widget name='SpeedSlider' " +"type='Slider' " +"/> " +"<widget name='SpeedLabel' " +"width='32' " +"height='Globals.Line.Height' " +"/> " +"</layout> " +"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> " +"<widget name='DepthText' " +"type='OptionsLabel' " +"/> " +"<widget name='DepthSlider' " +"type='Slider' " +"/> " +"<widget name='DepthLabel' " +"width='32' " +"height='Globals.Line.Height' " +"/> " +"</layout> " +"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> " +"<widget name='WaveFormTypeText' " +"type='OptionsLabel' " +"/> " +"<widget name='WaveFormType' " +"type='PopUp' " +"/> " +"</layout> " +"</layout> " +"</dialog> " +"<dialog name='FluidSynthSettings_Reverb' overlays='Dialog.FluidSynthSettings.TabWidget'> " +"<layout type='vertical' padding='16,16,16,16' spacing='8'> " +"<widget name='EnableTabCheckbox' " +"type='Checkbox' " +"/> " +"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> " +"<widget name='RoomSizeText' " +"type='OptionsLabel' " +"/> " +"<widget name='RoomSizeSlider' " +"type='Slider' " +"/> " +"<widget name='RoomSizeLabel' " +"width='32' " +"height='Globals.Line.Height' " +"/> " +"</layout> " +"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> " +"<widget name='DampingText' " +"type='OptionsLabel' " +"/> " +"<widget name='DampingSlider' " +"type='Slider' " +"/> " +"<widget name='DampingLabel' " +"width='32' " +"height='Globals.Line.Height' " +"/> " +"</layout> " +"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> " +"<widget name='WidthText' " +"type='OptionsLabel' " +"/> " +"<widget name='WidthSlider' " +"type='Slider' " +"/> " +"<widget name='WidthLabel' " +"width='32' " +"height='Globals.Line.Height' " +"/> " +"</layout> " +"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> " +"<widget name='LevelText' " +"type='OptionsLabel' " +"/> " +"<widget name='LevelSlider' " +"type='Slider' " +"/> " +"<widget name='LevelLabel' " +"width='32' " +"height='Globals.Line.Height' " +"/> " +"</layout> " +"</layout> " +"</dialog> " +"<dialog name='FluidSynthSettings_Misc' overlays='Dialog.FluidSynthSettings.TabWidget'> " +"<layout type='vertical' padding='16,16,16,16' spacing='8'> " +"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> " +"<widget name='InterpolationText' " +"type='OptionsLabel' " +"/> " +"<widget name='Interpolation' " +"type='PopUp' " +"/> " +"</layout> " +"</layout> " +"</dialog> " "<dialog name='SaveLoadChooser' overlays='screen' inset='8' shading='dim'> " "<layout type='vertical' padding='8,8,8,32' center='true'> " "<layout type='horizontal' padding='0,0,0,0'> " diff --git a/gui/themes/scummclassic.zip b/gui/themes/scummclassic.zip Binary files differindex 62eae0cd43..297ff20344 100644 --- a/gui/themes/scummclassic.zip +++ b/gui/themes/scummclassic.zip diff --git a/gui/themes/scummclassic/THEMERC b/gui/themes/scummclassic/THEMERC index b8937adcb2..8f40cb2a7e 100644 --- a/gui/themes/scummclassic/THEMERC +++ b/gui/themes/scummclassic/THEMERC @@ -1 +1 @@ -[SCUMMVM_STX0.8.16:ScummVM Classic Theme:No Author] +[SCUMMVM_STX0.8.20:ScummVM Classic Theme:No Author] diff --git a/gui/themes/scummclassic/classic_layout.stx b/gui/themes/scummclassic/classic_layout.stx index 4a6aae00bc..180e8fba74 100644 --- a/gui/themes/scummclassic/classic_layout.stx +++ b/gui/themes/scummclassic/classic_layout.stx @@ -107,6 +107,7 @@ <layout type = 'vertical' center = 'true' padding = '16, 16, 8, 8'> <widget name = 'Version' height = 'Globals.Line.Height' + textalign = 'center' /> <layout type = 'horizontal' spacing = '5' padding = '10, 0, 0, 0'> <widget name = 'SearchDesc' @@ -166,17 +167,22 @@ height = 'Globals.Line.Height' /> <widget name = 'List'/> - <layout type = 'horizontal' padding = '0, 0, 16, 0'> - <widget name = 'Up' - type = 'Button' - /> - <space/> - <widget name = 'Cancel' - type = 'Button' - /> - <widget name = 'Choose' - type = 'Button' + <layout type = 'vertical' padding = '0, 0, 16, 0'> + <widget name = 'Hidden' + type = 'Checkbox' /> + <layout type = 'horizontal' padding = '0, 0, 0, 0'> + <widget name = 'Up' + type = 'Button' + /> + <space/> + <widget name = 'Cancel' + type = 'Button' + /> + <widget name = 'Choose' + type = 'Button' + /> + </layout> </layout> </layout> </dialog> @@ -359,6 +365,10 @@ height = 'Globals.Line.Height' /> </layout> + <widget name = 'mcFluidSynthSettings' + width = '200' + height = 'Globals.Button.Height' + /> </layout> </dialog> @@ -794,6 +804,157 @@ </layout> </dialog> + <dialog name = 'FluidSynthSettings' overlays = 'GlobalOptions' shading = 'dim'> + <layout type = 'vertical' padding = '0, 0, 0, 0'> + <widget name = 'TabWidget'/> + <layout type = 'horizontal' padding = '16, 16, 16, 16'> + <space/> + <widget name = 'ResetSettings' + type = 'Button' + /> + <widget name = 'Cancel' + type = 'Button' + /> + <widget name = 'Ok' + type = 'Button' + /> + </layout> + </layout> + </dialog> + + <dialog name = 'FluidSynthSettings_Chorus' overlays = 'Dialog.FluidSynthSettings.TabWidget'> + <layout type = 'vertical' padding = '16, 16, 16, 16' spacing = '8'> + <widget name = 'EnableTabCheckbox' + type = 'Checkbox' + /> + <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'> + <widget name = 'VoiceCountText' + type = 'OptionsLabel' + /> + <widget name = 'VoiceCountSlider' + type = 'Slider' + /> + <widget name = 'VoiceCountLabel' + width = '32' + height = 'Globals.Line.Height' + /> + </layout> + <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'> + <widget name = 'LevelText' + type = 'OptionsLabel' + /> + <widget name = 'LevelSlider' + type = 'Slider' + /> + <widget name = 'LevelLabel' + width = '32' + height = 'Globals.Line.Height' + /> + </layout> + <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'> + <widget name = 'SpeedText' + type = 'OptionsLabel' + /> + <widget name = 'SpeedSlider' + type = 'Slider' + /> + <widget name = 'SpeedLabel' + width = '32' + height = 'Globals.Line.Height' + /> + </layout> + <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'> + <widget name = 'DepthText' + type = 'OptionsLabel' + /> + <widget name = 'DepthSlider' + type = 'Slider' + /> + <widget name = 'DepthLabel' + width = '32' + height = 'Globals.Line.Height' + /> + </layout> + <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'> + <widget name = 'WaveFormTypeText' + type = 'OptionsLabel' + /> + <widget name = 'WaveFormType' + type = 'PopUp' + /> + </layout> + </layout> + </dialog> + + <dialog name = 'FluidSynthSettings_Reverb' overlays = 'Dialog.FluidSynthSettings.TabWidget'> + <layout type = 'vertical' padding = '16, 16, 16, 16' spacing = '8'> + <widget name = 'EnableTabCheckbox' + type = 'Checkbox' + /> + <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'> + <widget name = 'RoomSizeText' + type = 'OptionsLabel' + /> + <widget name = 'RoomSizeSlider' + type = 'Slider' + /> + <widget name = 'RoomSizeLabel' + width = '32' + height = 'Globals.Line.Height' + /> + </layout> + <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'> + <widget name = 'DampingText' + type = 'OptionsLabel' + /> + <widget name = 'DampingSlider' + type = 'Slider' + /> + <widget name = 'DampingLabel' + width = '32' + height = 'Globals.Line.Height' + /> + </layout> + <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'> + <widget name = 'WidthText' + type = 'OptionsLabel' + /> + <widget name = 'WidthSlider' + type = 'Slider' + /> + <widget name = 'WidthLabel' + width = '32' + height = 'Globals.Line.Height' + /> + </layout> + <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'> + <widget name = 'LevelText' + type = 'OptionsLabel' + /> + <widget name = 'LevelSlider' + type = 'Slider' + /> + <widget name = 'LevelLabel' + width = '32' + height = 'Globals.Line.Height' + /> + </layout> + </layout> + </dialog> + + <dialog name = 'FluidSynthSettings_Misc' overlays = 'Dialog.FluidSynthSettings.TabWidget'> + <layout type = 'vertical' padding = '16, 16, 16, 16' spacing = '8'> + <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'> + <widget name = 'InterpolationText' + type = 'OptionsLabel' + /> + <widget name = 'Interpolation' + type = 'PopUp' + /> + </layout> + </layout> + </dialog> + <dialog name = 'SaveLoadChooser' overlays = 'screen' inset = '8' shading = 'dim'> <layout type = 'vertical' padding = '8, 8, 8, 32' center = 'true'> <layout type = 'horizontal' padding = '0, 0, 0, 0'> diff --git a/gui/themes/scummclassic/classic_layout_lowres.stx b/gui/themes/scummclassic/classic_layout_lowres.stx index 57e149b570..8bb03dea17 100644 --- a/gui/themes/scummclassic/classic_layout_lowres.stx +++ b/gui/themes/scummclassic/classic_layout_lowres.stx @@ -105,6 +105,7 @@ <layout type = 'vertical' center = 'true' padding = '6, 6, 2, 2'> <widget name = 'Version' height = 'Globals.Line.Height' + textalign = 'center' /> <layout type = 'horizontal' spacing = '5' padding = '0, 0, 0, 0'> <widget name = 'SearchDesc' @@ -163,18 +164,22 @@ height = 'Globals.Line.Height' /> <widget name = 'List'/> - <layout type = 'horizontal' padding = '0, 0, 8, 0'> - <widget name = 'Up' - type = 'Button' - /> - <space/> - <widget name = 'Cancel' - type = 'Button' - /> - - <widget name = 'Choose' - type = 'Button' + <layout type = 'vertical' padding = '0, 0, 8, 0'> + <widget name = 'Hidden' + type = 'Checkbox' /> + <layout type = 'horizontal' padding = '0, 0, 0, 0'> + <widget name = 'Up' + type = 'Button' + /> + <space/> + <widget name = 'Cancel' + type = 'Button' + /> + <widget name = 'Choose' + type = 'Button' + /> + </layout> </layout> </layout> </dialog> @@ -321,7 +326,7 @@ </dialog> <dialog name = 'GlobalOptions_MIDI' overlays = 'Dialog.GlobalOptions.TabWidget'> - <layout type = 'vertical' padding = '16, 16, 16, 16' spacing = '8'> + <layout type = 'vertical' padding = '16, 16, 16, 16' spacing = '6'> <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '6' center = 'true'> <widget name = 'auPrefGmPopupDesc' type = 'OptionsLabel' @@ -357,6 +362,10 @@ height = 'Globals.Line.Height' /> </layout> + <widget name = 'mcFluidSynthSettings' + width = '150' + height = 'Globals.Button.Height' + /> </layout> </dialog> @@ -805,6 +814,157 @@ </layout> </dialog> + <dialog name = 'FluidSynthSettings' overlays = 'GlobalOptions' shading = 'dim'> + <layout type = 'vertical' padding = '0, 0, 0, 0'> + <widget name = 'TabWidget'/> + <layout type = 'horizontal' padding = '8, 8, 8, 8'> + <space/> + <widget name = 'ResetSettings' + type = 'Button' + /> + <widget name = 'Cancel' + type = 'Button' + /> + <widget name = 'Ok' + type = 'Button' + /> + </layout> + </layout> + </dialog> + + <dialog name = 'FluidSynthSettings_Chorus' overlays = 'Dialog.FluidSynthSettings.TabWidget'> + <layout type = 'vertical' padding = '8, 8, 8, 8' spacing = '6'> + <widget name = 'EnableTabCheckbox' + type = 'Checkbox' + /> + <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'> + <widget name = 'VoiceCountText' + type = 'OptionsLabel' + /> + <widget name = 'VoiceCountSlider' + type = 'Slider' + /> + <widget name = 'VoiceCountLabel' + width = '32' + height = 'Globals.Line.Height' + /> + </layout> + <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'> + <widget name = 'LevelText' + type = 'OptionsLabel' + /> + <widget name = 'LevelSlider' + type = 'Slider' + /> + <widget name = 'LevelLabel' + width = '32' + height = 'Globals.Line.Height' + /> + </layout> + <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'> + <widget name = 'SpeedText' + type = 'OptionsLabel' + /> + <widget name = 'SpeedSlider' + type = 'Slider' + /> + <widget name = 'SpeedLabel' + width = '32' + height = 'Globals.Line.Height' + /> + </layout> + <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'> + <widget name = 'DepthText' + type = 'OptionsLabel' + /> + <widget name = 'DepthSlider' + type = 'Slider' + /> + <widget name = 'DepthLabel' + width = '32' + height = 'Globals.Line.Height' + /> + </layout> + <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'> + <widget name = 'WaveFormTypeText' + type = 'OptionsLabel' + /> + <widget name = 'WaveFormType' + type = 'PopUp' + /> + </layout> + </layout> + </dialog> + + <dialog name = 'FluidSynthSettings_Reverb' overlays = 'Dialog.FluidSynthSettings.TabWidget'> + <layout type = 'vertical' padding = '8, 8, 8, 8' spacing = '6'> + <widget name = 'EnableTabCheckbox' + type = 'Checkbox' + /> + <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'> + <widget name = 'RoomSizeText' + type = 'OptionsLabel' + /> + <widget name = 'RoomSizeSlider' + type = 'Slider' + /> + <widget name = 'RoomSizeLabel' + width = '32' + height = 'Globals.Line.Height' + /> + </layout> + <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'> + <widget name = 'DampingText' + type = 'OptionsLabel' + /> + <widget name = 'DampingSlider' + type = 'Slider' + /> + <widget name = 'DampingLabel' + width = '32' + height = 'Globals.Line.Height' + /> + </layout> + <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'> + <widget name = 'WidthText' + type = 'OptionsLabel' + /> + <widget name = 'WidthSlider' + type = 'Slider' + /> + <widget name = 'WidthLabel' + width = '32' + height = 'Globals.Line.Height' + /> + </layout> + <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'> + <widget name = 'LevelText' + type = 'OptionsLabel' + /> + <widget name = 'LevelSlider' + type = 'Slider' + /> + <widget name = 'LevelLabel' + width = '32' + height = 'Globals.Line.Height' + /> + </layout> + </layout> + </dialog> + + <dialog name = 'FluidSynthSettings_Misc' overlays = 'Dialog.FluidSynthSettings.TabWidget'> + <layout type = 'vertical' padding = '8, 8, 8, 8' spacing = '6'> + <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'> + <widget name = 'InterpolationText' + type = 'OptionsLabel' + /> + <widget name = 'Interpolation' + type = 'PopUp' + /> + </layout> + </layout> + </dialog> + <dialog name = 'SaveLoadChooser' overlays = 'screen' inset = '8' shading = 'dim'> <layout type = 'vertical' padding = '8, 8, 8, 8' center = 'true'> <widget name = 'Title' height = 'Globals.Line.Height'/> diff --git a/gui/themes/scummmodern.zip b/gui/themes/scummmodern.zip Binary files differindex 38352bcc2f..dbd84992e6 100644 --- a/gui/themes/scummmodern.zip +++ b/gui/themes/scummmodern.zip diff --git a/gui/themes/scummmodern/THEMERC b/gui/themes/scummmodern/THEMERC index 52eb683ebd..f4304622cb 100644 --- a/gui/themes/scummmodern/THEMERC +++ b/gui/themes/scummmodern/THEMERC @@ -1 +1 @@ -[SCUMMVM_STX0.8.16:ScummVM Modern Theme:No Author] +[SCUMMVM_STX0.8.20:ScummVM Modern Theme:No Author] diff --git a/gui/themes/scummmodern/scummmodern_layout.stx b/gui/themes/scummmodern/scummmodern_layout.stx index d99d7416c2..49c13cf1b0 100644 --- a/gui/themes/scummmodern/scummmodern_layout.stx +++ b/gui/themes/scummmodern/scummmodern_layout.stx @@ -180,17 +180,22 @@ height = 'Globals.Line.Height' /> <widget name = 'List'/> - <layout type = 'horizontal' padding = '0, 0, 16, 0'> - <widget name = 'Up' - type = 'Button' - /> - <space/> - <widget name = 'Cancel' - type = 'Button' - /> - <widget name = 'Choose' - type = 'Button' + <layout type = 'vertical' padding = '0, 0, 16, 0'> + <widget name = 'Hidden' + type = 'Checkbox' /> + <layout type = 'horizontal' padding = '0, 0, 0, 0'> + <widget name = 'Up' + type = 'Button' + /> + <space/> + <widget name = 'Cancel' + type = 'Button' + /> + <widget name = 'Choose' + type = 'Button' + /> + </layout> </layout> </layout> </dialog> @@ -373,6 +378,10 @@ height = 'Globals.Line.Height' /> </layout> + <widget name = 'mcFluidSynthSettings' + width = '200' + height = 'Globals.Button.Height' + /> </layout> </dialog> @@ -808,6 +817,157 @@ </layout> </dialog> + <dialog name = 'FluidSynthSettings' overlays = 'GlobalOptions' shading = 'dim'> + <layout type = 'vertical' padding = '0, 0, 0, 0'> + <widget name = 'TabWidget'/> + <layout type = 'horizontal' padding = '16, 16, 16, 16'> + <space/> + <widget name = 'ResetSettings' + type = 'Button' + /> + <widget name = 'Cancel' + type = 'Button' + /> + <widget name = 'Ok' + type = 'Button' + /> + </layout> + </layout> + </dialog> + + <dialog name = 'FluidSynthSettings_Chorus' overlays = 'Dialog.FluidSynthSettings.TabWidget'> + <layout type = 'vertical' padding = '16, 16, 16, 16' spacing = '8'> + <widget name = 'EnableTabCheckbox' + type = 'Checkbox' + /> + <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'> + <widget name = 'VoiceCountText' + type = 'OptionsLabel' + /> + <widget name = 'VoiceCountSlider' + type = 'Slider' + /> + <widget name = 'VoiceCountLabel' + width = '32' + height = 'Globals.Line.Height' + /> + </layout> + <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'> + <widget name = 'LevelText' + type = 'OptionsLabel' + /> + <widget name = 'LevelSlider' + type = 'Slider' + /> + <widget name = 'LevelLabel' + width = '32' + height = 'Globals.Line.Height' + /> + </layout> + <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'> + <widget name = 'SpeedText' + type = 'OptionsLabel' + /> + <widget name = 'SpeedSlider' + type = 'Slider' + /> + <widget name = 'SpeedLabel' + width = '32' + height = 'Globals.Line.Height' + /> + </layout> + <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'> + <widget name = 'DepthText' + type = 'OptionsLabel' + /> + <widget name = 'DepthSlider' + type = 'Slider' + /> + <widget name = 'DepthLabel' + width = '32' + height = 'Globals.Line.Height' + /> + </layout> + <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'> + <widget name = 'WaveFormTypeText' + type = 'OptionsLabel' + /> + <widget name = 'WaveFormType' + type = 'PopUp' + /> + </layout> + </layout> + </dialog> + + <dialog name = 'FluidSynthSettings_Reverb' overlays = 'Dialog.FluidSynthSettings.TabWidget'> + <layout type = 'vertical' padding = '16, 16, 16, 16' spacing = '8'> + <widget name = 'EnableTabCheckbox' + type = 'Checkbox' + /> + <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'> + <widget name = 'RoomSizeText' + type = 'OptionsLabel' + /> + <widget name = 'RoomSizeSlider' + type = 'Slider' + /> + <widget name = 'RoomSizeLabel' + width = '32' + height = 'Globals.Line.Height' + /> + </layout> + <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'> + <widget name = 'DampingText' + type = 'OptionsLabel' + /> + <widget name = 'DampingSlider' + type = 'Slider' + /> + <widget name = 'DampingLabel' + width = '32' + height = 'Globals.Line.Height' + /> + </layout> + <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'> + <widget name = 'WidthText' + type = 'OptionsLabel' + /> + <widget name = 'WidthSlider' + type = 'Slider' + /> + <widget name = 'WidthLabel' + width = '32' + height = 'Globals.Line.Height' + /> + </layout> + <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'> + <widget name = 'LevelText' + type = 'OptionsLabel' + /> + <widget name = 'LevelSlider' + type = 'Slider' + /> + <widget name = 'LevelLabel' + width = '32' + height = 'Globals.Line.Height' + /> + </layout> + </layout> + </dialog> + + <dialog name = 'FluidSynthSettings_Misc' overlays = 'Dialog.FluidSynthSettings.TabWidget'> + <layout type = 'vertical' padding = '16, 16, 16, 16' spacing = '8'> + <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'> + <widget name = 'InterpolationText' + type = 'OptionsLabel' + /> + <widget name = 'Interpolation' + type = 'PopUp' + /> + </layout> + </layout> + </dialog> + <dialog name = 'SaveLoadChooser' overlays = 'screen' inset = '8' shading = 'dim'> <layout type = 'vertical' padding = '8, 8, 8, 32' center = 'true'> <layout type = 'horizontal' padding = '0, 0, 0, 0'> diff --git a/gui/themes/scummmodern/scummmodern_layout_lowres.stx b/gui/themes/scummmodern/scummmodern_layout_lowres.stx index 4fd5bdcf40..9658402f82 100644 --- a/gui/themes/scummmodern/scummmodern_layout_lowres.stx +++ b/gui/themes/scummmodern/scummmodern_layout_lowres.stx @@ -103,6 +103,7 @@ <layout type = 'vertical' center = 'true' padding = '4, 4, 2, 2' spacing = '2'> <widget name = 'Version' height = 'Globals.Line.Height' + textalign = 'center' /> <layout type = 'horizontal' spacing = '5' padding = '0, 0, 2, 2'> <widget name = 'SearchDesc' @@ -161,18 +162,22 @@ height = 'Globals.Line.Height' /> <widget name = 'List'/> - <layout type = 'horizontal' padding = '0, 0, 8, 0'> - <widget name = 'Up' - type = 'Button' - /> - <space/> - <widget name = 'Cancel' - type = 'Button' - /> - - <widget name = 'Choose' - type = 'Button' + <layout type = 'vertical' padding = '0, 0, 8, 0'> + <widget name = 'Hidden' + type = 'Checkbox' /> + <layout type = 'horizontal' padding = '0, 0, 0, 0'> + <widget name = 'Up' + type = 'Button' + /> + <space/> + <widget name = 'Cancel' + type = 'Button' + /> + <widget name = 'Choose' + type = 'Button' + /> + </layout> </layout> </layout> </dialog> @@ -319,7 +324,7 @@ </dialog> <dialog name = 'GlobalOptions_MIDI' overlays = 'Dialog.GlobalOptions.TabWidget'> - <layout type = 'vertical' padding = '16, 16, 16, 16' spacing = '8'> + <layout type = 'vertical' padding = '16, 16, 16, 16' spacing = '7'> <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '6' center = 'true'> <widget name = 'auPrefGmPopupDesc' type = 'OptionsLabel' @@ -355,6 +360,10 @@ height = 'Globals.Line.Height' /> </layout> + <widget name = 'mcFluidSynthSettings' + width = '150' + height = 'Globals.Button.Height' + /> </layout> </dialog> @@ -804,6 +813,157 @@ </layout> </dialog> + <dialog name = 'FluidSynthSettings' overlays = 'GlobalOptions' shading = 'dim'> + <layout type = 'vertical' padding = '0, 0, 0, 0'> + <widget name = 'TabWidget'/> + <layout type = 'horizontal' padding = '8, 8, 8, 8'> + <space/> + <widget name = 'ResetSettings' + type = 'Button' + /> + <widget name = 'Cancel' + type = 'Button' + /> + <widget name = 'Ok' + type = 'Button' + /> + </layout> + </layout> + </dialog> + + <dialog name = 'FluidSynthSettings_Chorus' overlays = 'Dialog.FluidSynthSettings.TabWidget'> + <layout type = 'vertical' padding = '8, 8, 8, 8' spacing = '6'> + <widget name = 'EnableTabCheckbox' + type = 'Checkbox' + /> + <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'> + <widget name = 'VoiceCountText' + type = 'OptionsLabel' + /> + <widget name = 'VoiceCountSlider' + type = 'Slider' + /> + <widget name = 'VoiceCountLabel' + width = '32' + height = 'Globals.Line.Height' + /> + </layout> + <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'> + <widget name = 'LevelText' + type = 'OptionsLabel' + /> + <widget name = 'LevelSlider' + type = 'Slider' + /> + <widget name = 'LevelLabel' + width = '32' + height = 'Globals.Line.Height' + /> + </layout> + <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'> + <widget name = 'SpeedText' + type = 'OptionsLabel' + /> + <widget name = 'SpeedSlider' + type = 'Slider' + /> + <widget name = 'SpeedLabel' + width = '32' + height = 'Globals.Line.Height' + /> + </layout> + <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'> + <widget name = 'DepthText' + type = 'OptionsLabel' + /> + <widget name = 'DepthSlider' + type = 'Slider' + /> + <widget name = 'DepthLabel' + width = '32' + height = 'Globals.Line.Height' + /> + </layout> + <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'> + <widget name = 'WaveFormTypeText' + type = 'OptionsLabel' + /> + <widget name = 'WaveFormType' + type = 'PopUp' + /> + </layout> + </layout> + </dialog> + + <dialog name = 'FluidSynthSettings_Reverb' overlays = 'Dialog.FluidSynthSettings.TabWidget'> + <layout type = 'vertical' padding = '8, 8, 8, 8' spacing = '6'> + <widget name = 'EnableTabCheckbox' + type = 'Checkbox' + /> + <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'> + <widget name = 'RoomSizeText' + type = 'OptionsLabel' + /> + <widget name = 'RoomSizeSlider' + type = 'Slider' + /> + <widget name = 'RoomSizeLabel' + width = '32' + height = 'Globals.Line.Height' + /> + </layout> + <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'> + <widget name = 'DampingText' + type = 'OptionsLabel' + /> + <widget name = 'DampingSlider' + type = 'Slider' + /> + <widget name = 'DampingLabel' + width = '32' + height = 'Globals.Line.Height' + /> + </layout> + <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'> + <widget name = 'WidthText' + type = 'OptionsLabel' + /> + <widget name = 'WidthSlider' + type = 'Slider' + /> + <widget name = 'WidthLabel' + width = '32' + height = 'Globals.Line.Height' + /> + </layout> + <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'> + <widget name = 'LevelText' + type = 'OptionsLabel' + /> + <widget name = 'LevelSlider' + type = 'Slider' + /> + <widget name = 'LevelLabel' + width = '32' + height = 'Globals.Line.Height' + /> + </layout> + </layout> + </dialog> + + <dialog name = 'FluidSynthSettings_Misc' overlays = 'Dialog.FluidSynthSettings.TabWidget'> + <layout type = 'vertical' padding = '8, 8, 8, 8' spacing = '6'> + <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'> + <widget name = 'InterpolationText' + type = 'OptionsLabel' + /> + <widget name = 'Interpolation' + type = 'PopUp' + /> + </layout> + </layout> + </dialog> + <dialog name = 'SaveLoadChooser' overlays = 'screen' inset = '8' shading = 'dim'> <layout type = 'vertical' padding = '8, 8, 8, 8' center = 'true'> <widget name = 'Title' height = 'Globals.Line.Height'/> diff --git a/gui/themes/translations.dat b/gui/themes/translations.dat Binary files differindex 1c3abf84a8..7bd1316208 100644 --- a/gui/themes/translations.dat +++ b/gui/themes/translations.dat diff --git a/gui/widget.cpp b/gui/widget.cpp index 4ffb63e945..c3f10a861f 100644 --- a/gui/widget.cpp +++ b/gui/widget.cpp @@ -593,8 +593,8 @@ void SliderWidget::handleMouseUp(int x, int y, int button, int clickCount) { void SliderWidget::handleMouseWheel(int x, int y, int direction) { if (isEnabled() && !_isDragging) { - // Increment or decrement one position - int newValue = posToValue(valueToPos(_value) - 1 * direction); + // Increment or decrement by one + int newValue = _value - direction; if (newValue < _valueMin) newValue = _valueMin; diff --git a/gui/widgets/list.cpp b/gui/widgets/list.cpp index 13784ddf7f..473d5f04df 100644 --- a/gui/widgets/list.cpp +++ b/gui/widgets/list.cpp @@ -206,6 +206,7 @@ void ListWidget::scrollTo(int item) { if (_currentPos != item) { _currentPos = item; + checkBounds(); scrollBarRecalc(); } } @@ -284,7 +285,7 @@ bool ListWidget::handleKeyDown(Common::KeyState state) { bool dirty = false; int oldSelectedItem = _selectedItem; - if (!_editMode && state.keycode <= Common::KEYCODE_z && isprint((unsigned char)state.ascii)) { + if (!_editMode && state.keycode <= Common::KEYCODE_z && Common::isPrint(state.ascii)) { // Quick selection mode: Go to first list item starting with this key // (or a substring accumulated from the last couple key presses). // Only works in a useful fashion if the list entries are sorted. @@ -467,6 +468,7 @@ void ListWidget::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) { case kSetPositionCmd: if (_currentPos != (int)data) { _currentPos = data; + checkBounds(); draw(); // Scrollbar actions cause list focus (which triggers a redraw) @@ -550,6 +552,13 @@ Common::Rect ListWidget::getEditRect() const { return r; } +void ListWidget::checkBounds() { + if (_currentPos < 0 || _entriesPerPage > (int)_list.size()) + _currentPos = 0; + else if (_currentPos + _entriesPerPage > (int)_list.size()) + _currentPos = _list.size() - _entriesPerPage; +} + void ListWidget::scrollToCurrent() { // Only do something if the current item is not in our view port if (_selectedItem < _currentPos) { @@ -560,11 +569,7 @@ void ListWidget::scrollToCurrent() { _currentPos = _selectedItem - _entriesPerPage + 1; } - if (_currentPos < 0 || _entriesPerPage > (int)_list.size()) - _currentPos = 0; - else if (_currentPos + _entriesPerPage > (int)_list.size()) - _currentPos = _list.size() - _entriesPerPage; - + checkBounds(); _scrollBar->_currentPos = _currentPos; _scrollBar->recalc(); } diff --git a/gui/widgets/list.h b/gui/widgets/list.h index 47613b79f3..d18a82dd3f 100644 --- a/gui/widgets/list.h +++ b/gui/widgets/list.h @@ -145,6 +145,7 @@ protected: void receivedFocusWidget(); void lostFocusWidget(); + void checkBounds(); void scrollToCurrent(); int *_textWidth; diff --git a/gui/widgets/popup.cpp b/gui/widgets/popup.cpp index 1a552e97c0..829a49c53e 100644 --- a/gui/widgets/popup.cpp +++ b/gui/widgets/popup.cpp @@ -388,24 +388,28 @@ void PopUpWidget::handleMouseDown(int x, int y, int button, int clickCount) { if (newSel != -1 && _selectedItem != newSel) { _selectedItem = newSel; sendCommand(kPopUpItemSelectedCmd, _entries[_selectedItem].tag); + draw(); } } } void PopUpWidget::handleMouseWheel(int x, int y, int direction) { - int newSelection = _selectedItem + direction; + if (isEnabled()) { + int newSelection = _selectedItem + direction; - // Skip separator entries - while ((newSelection >= 0) && (newSelection < (int)_entries.size()) && - _entries[newSelection].name.equals("")) { - newSelection += direction; - } + // Skip separator entries + while ((newSelection >= 0) && (newSelection < (int)_entries.size()) && + _entries[newSelection].name.equals("")) { + newSelection += direction; + } - // Just update the selected item when we're in range - if ((newSelection >= 0) && (newSelection < (int)_entries.size()) && - (newSelection != _selectedItem)) { - _selectedItem = newSelection; - draw(); + // Just update the selected item when we're in range + if ((newSelection >= 0) && (newSelection < (int)_entries.size()) && + (newSelection != _selectedItem)) { + _selectedItem = newSelection; + sendCommand(kPopUpItemSelectedCmd, _entries[_selectedItem].tag); + draw(); + } } } |