[Scummvm-cvs-logs] CVS: scummvm/gui browser.cpp,1.26,1.27 browser.h,1.16,1.17 launcher.cpp,1.111,1.112 launcher.h,1.21,1.22 options.cpp,1.72,1.73 options.h,1.25,1.26
Torbjörn Andersson
eriktorbjorn at users.sourceforge.net
Sun Apr 10 07:34:07 CEST 2005
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/sound mididrv.cpp,1.60,1.61 mididrv.h,1.42,1.43 module.mk,1.19,1.20
- Next message: [Scummvm-cvs-logs] CVS: scummvm/doc 05_01.tex,1.20,1.21 07.tex,1.6,1.7 08.tex,1.12,1.13
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/gui
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11090/gui
Modified Files:
browser.cpp browser.h launcher.cpp launcher.h options.cpp
options.h
Log Message:
Applied patch #1175374 ("FluidSynth MIDI driver"), with a few documentation
changes. There are a few things that could use a bit more work, and I've
only tested it on my Linux box. I have verified that ScummVM still compiles
when it's disabled, though, so it shouldn't break anything too badly.
Index: browser.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/browser.cpp,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- browser.cpp 10 Jan 2005 22:05:37 -0000 1.26
+++ browser.cpp 10 Apr 2005 14:33:43 -0000 1.27
@@ -34,16 +34,16 @@
* other operating systems.
*/
-BrowserDialog::BrowserDialog(const char *title)
+DirBrowserDialog::DirBrowserDialog(const char *title)
: Dialog(20, 10, 320 -2 * 20, 200 - 2 * 10) {
_titleRef = CFStringCreateWithCString(0, title, CFStringGetSystemEncoding());
}
-BrowserDialog::~BrowserDialog() {
+DirBrowserDialog::~DirBrowserDialog() {
CFRelease(_titleRef);
}
-int BrowserDialog::runModal() {
+int DirBrowserDialog::runModal() {
NavDialogRef dialogRef;
WindowRef windowRef = 0;
NavDialogCreationOptions options;
@@ -125,7 +125,7 @@
kGoUpCmd = 'GoUp'
};
-BrowserDialog::BrowserDialog(const char *title)
+DirBrowserDialog::DirBrowserDialog(const char *title)
: Dialog(20, 10, 320 -2 * 20, 200 - 2 * 10)
{
@@ -150,7 +150,7 @@
addButton(_w - (kButtonWidth+10), _h - 24, "Choose", kChooseCmd, 0);
}
-void BrowserDialog::open() {
+void DirBrowserDialog::open() {
// If no node has been set, or the last used one is now invalid,
// go back to the root/default dir.
if (!_node.isValid()) {
@@ -164,7 +164,7 @@
Dialog::open();
}
-void BrowserDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
+void DirBrowserDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
switch (cmd) {
case kChooseCmd: {
// If nothing is selected in the list widget, choose the current dir.
@@ -193,7 +193,7 @@
}
}
-void BrowserDialog::updateListing() {
+void DirBrowserDialog::updateListing() {
// Update the path display
_currentPath->setLabel(_node.path());
@@ -216,4 +216,106 @@
#endif // MACOSX
+FileBrowserDialog::FileBrowserDialog(const char *title)
+ : Dialog(20, 10, 320 -2 * 20, 200 - 2 * 10)
+ {
+
+ _fileList = NULL;
+ _currentPath = NULL;
+
+ // Headline - TODO: should be customizable during creation time
+ new StaticTextWidget(this, 10, 8, _w - 2 * 10, kLineHeight, title, kTextAlignCenter);
+
+ // Current path - TODO: handle long paths ?
+ _currentPath = new StaticTextWidget(this, 10, 20, _w - 2 * 10, kLineHeight,
+ "DUMMY", kTextAlignLeft);
+
+ // Add file list
+ _fileList = new ListWidget(this, 10, 34, _w - 2 * 10, _h - 34 - 24 - 10);
+ _fileList->setNumberingMode(kListNumberingOff);
+ _fileList->setEditable(false);
+
+ // Buttons
+ addButton(10, _h - 24, "Go up", kGoUpCmd, 0);
+ addButton(_w - 2 * (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0);
+ addButton(_w - (kButtonWidth+10), _h - 24, "Choose", kChooseCmd, 0);
+}
+
+void FileBrowserDialog::open() {
+ // If no node has been set, or the last used one is now invalid,
+ // go back to the root/default dir.
+ if (!_node.isValid()) {
+ _node = FilesystemNode();
+ }
+
+ // Alway refresh file list
+ updateListing();
+
+ // Call super implementation
+ Dialog::open();
+}
+
+void FileBrowserDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
+ switch (cmd) {
+ case kChooseCmd: {
+ int selection = _fileList->getSelected();
+ if (selection < 0)
+ break;
+ if (_nodeContent[selection].isDirectory()) {
+ _node = _nodeContent[selection];
+ updateListing();
+ } else {
+ _choice = _nodeContent[selection];
+ setResult(1);
+ close();
+ }
+ }
+ break;
+ case kGoUpCmd:
+ _node = _node.getParent();
+ updateListing();
+ break;
+ case kListItemActivatedCmd:
+ case kListItemDoubleClickedCmd:
+ if (_nodeContent[data].isDirectory()) {
+ _node = _nodeContent[data];
+ updateListing();
+ } else {
+ _choice = _nodeContent[data];
+ setResult(1);
+ close();
+ }
+ break;
+ default:
+ Dialog::handleCommand(sender, cmd, data);
+ }
+}
+
+void FileBrowserDialog::updateListing() {
+ // Update the path display
+ _currentPath->setLabel(_node.path());
+
+ // Read in the data from the file system
+ _nodeContent = _node.listDir(AbstractFilesystemNode::kListAll);
+ _nodeContent.sort();
+
+ // Populate the ListWidget
+ Common::StringList list;
+ int size = _nodeContent.size();
+ int i;
+
+ for (i = 0; i < size; i++) {
+ if (_nodeContent[i].isDirectory())
+ list.push_back(_nodeContent[i].displayName() + "/");
+ else
+ list.push_back(_nodeContent[i].displayName());
+ }
+
+ _fileList->setList(list);
+ _fileList->scrollTo(0);
+
+ // Finally, redraw
+ draw();
+}
+
} // End of namespace GUI
Index: browser.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/browser.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- browser.h 6 Apr 2005 15:21:32 -0000 1.16
+++ browser.h 10 Apr 2005 14:33:44 -0000 1.17
@@ -34,14 +34,16 @@
class ListWidget;
class StaticTextWidget;
-class BrowserDialog : public Dialog {
+// TODO: Common parent class for DirBrowserDialog and FileBrowserDialog
+
+class DirBrowserDialog : public Dialog {
typedef Common::String String;
typedef Common::StringList StringList;
public:
- BrowserDialog(const char *title);
+ DirBrowserDialog(const char *title);
#ifdef MACOSX
- ~BrowserDialog();
+ ~DirBrowserDialog();
virtual int runModal();
#else
virtual void open();
@@ -50,13 +52,12 @@
const FilesystemNode &getResult() { return _choice; }
-
protected:
#ifdef MACOSX
CFStringRef _titleRef;
#else
ListWidget *_fileList;
- StaticTextWidget*_currentPath;
+ StaticTextWidget *_currentPath;
FilesystemNode _node;
FSList _nodeContent;
#endif
@@ -67,6 +68,29 @@
#endif
};
+// TODO: MACOSX version
+
+class FileBrowserDialog : public Dialog {
+ typedef Common::String String;
+ typedef Common::StringList StringList;
+public:
+ FileBrowserDialog(const char *title);
+
+ virtual void open();
+ virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
+
+ const FilesystemNode &getResult() { return _choice; }
+
+protected:
+ ListWidget *_fileList;
+ StaticTextWidget *_currentPath;
+ FilesystemNode _node;
+ FSList _nodeContent;
+ FilesystemNode _choice;
+
+ void updateListing();
+};
+
} // End of namespace GUI
#endif
Index: launcher.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/launcher.cpp,v
retrieving revision 1.111
retrieving revision 1.112
diff -u -d -r1.111 -r1.112
--- launcher.cpp 29 Jan 2005 18:04:34 -0000 1.111
+++ launcher.cpp 10 Apr 2005 14:33:44 -0000 1.112
@@ -349,7 +349,7 @@
// Change path for the game
case kCmdGameBrowser: {
- BrowserDialog *_browser = new BrowserDialog("Select additional game directory");
+ DirBrowserDialog *_browser = new DirBrowserDialog("Select additional game directory");
if (_browser->runModal() > 0) {
// User made his choice...
FilesystemNode dir(_browser->getResult());
@@ -366,7 +366,7 @@
// Change path for extra game data (eg, using sword cutscenes when playing via CD)
case kCmdExtraBrowser: {
- BrowserDialog *_browser = new BrowserDialog("Select additional game directory");
+ DirBrowserDialog *_browser = new DirBrowserDialog("Select additional game directory");
if (_browser->runModal() > 0) {
// User made his choice...
FilesystemNode dir(_browser->getResult());
@@ -377,7 +377,7 @@
}
// Change path for stored save game (perm and temp) data
case kCmdSaveBrowser: {
- BrowserDialog *_browser = new BrowserDialog("Select directory for saved games");
+ DirBrowserDialog *_browser = new DirBrowserDialog("Select directory for saved games");
if (_browser->runModal() > 0) {
// User made his choice...
FilesystemNode dir(_browser->getResult());
@@ -449,7 +449,7 @@
updateButtons();
// Create file browser dialog
- _browser = new BrowserDialog("Select directory with game data");
+ _browser = new DirBrowserDialog("Select directory with game data");
}
void LauncherDialog::selectGame(const String &name) {
Index: launcher.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/launcher.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- launcher.h 5 Jan 2005 01:42:52 -0000 1.21
+++ launcher.h 10 Apr 2005 14:33:44 -0000 1.22
@@ -28,7 +28,7 @@
namespace GUI {
-class BrowserDialog;
+class DirBrowserDialog;
class ListWidget;
class LauncherDialog : public Dialog {
@@ -47,7 +47,7 @@
Widget *_removeButton;
StringList _domains;
GameDetector &_detector;
- BrowserDialog *_browser;
+ DirBrowserDialog *_browser;
void updateListing();
void updateButtons();
Index: options.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/options.cpp,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -d -r1.72 -r1.73
--- options.cpp 31 Mar 2005 05:35:03 -0000 1.72
+++ options.cpp 10 Apr 2005 14:33:44 -0000 1.73
@@ -50,7 +50,7 @@
namespace GUI {
// TODO - allow changing options for:
-// - the save path (use _browser!)
+// - the save path (use _dirBrowser!)
// - music & graphics driver (but see also the comments on EditGameDialog
// for some techincal difficulties with this)
// - default volumes (sfx/speech/music)
@@ -60,6 +60,7 @@
kMusicVolumeChanged = 'muvc',
kSfxVolumeChanged = 'sfvc',
kSpeechVolumeChanged = 'vcvc',
+ kChooseSoundFontCmd = 'chsf',
kChooseSaveDirCmd = 'chos',
kChooseExtraDirCmd = 'chex'
};
@@ -343,18 +344,24 @@
_midiPopUp->appendEntry(md->description, md->id);
md++;
}
+
+ // SoundFont
+ new ButtonWidget(boss, x, yoffset, kButtonWidth + 14, 16, "SoundFont: ", kChooseSoundFontCmd, 0);
+ _soundFont = new StaticTextWidget(boss, x + kButtonWidth + 20, yoffset + 3, _w - (x + kButtonWidth + 20) - 10, kLineHeight, "None", kTextAlignLeft);
+
+ yoffset += 18;
// Multi midi setting
_multiMidiCheckbox = new CheckboxWidget(boss, x, yoffset, w, 16, "Mixed Adlib/MIDI mode");
- yoffset += 16;
+ yoffset += 15;
// Native mt32 setting
_mt32Checkbox = new CheckboxWidget(boss, x, yoffset, w, 16, "True Roland MT-32 (disable GM emulation)");
- yoffset += 16;
+ yoffset += 15;
// Subtitles on/off
_subCheckbox = new CheckboxWidget(boss, x, yoffset, w, 16, "Display subtitles");
- yoffset += 16;
+ yoffset += 15;
_enableAudioSettings = true;
@@ -448,8 +455,9 @@
addButton(_w - 2 * (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0);
addButton(_w - (kButtonWidth + 10), _h - 24, "OK", kOKCmd, 0);
- // Create file browser dialog
- _browser = new BrowserDialog("Select directory for savegames");
+ // Create file browser dialogs
+ _dirBrowser = new DirBrowserDialog("Select directory for savegames");
+ _fileBrowser = new FileBrowserDialog("Select SoundFont");
#ifdef _WIN32_WCE
_keysDialog = new CEKeysDialog();
@@ -457,7 +465,8 @@
}
GlobalOptionsDialog::~GlobalOptionsDialog() {
- delete _browser;
+ delete _dirBrowser;
+ delete _fileBrowser;
#ifdef _WIN32_WCE
delete _keysDialog;
@@ -471,6 +480,7 @@
// Set _savePath to the current save path
Common::String dir(ConfMan.get("savepath", _domain));
Common::String extraPath(ConfMan.get("extrapath", _domain));
+ Common::String soundFont(ConfMan.get("soundfont", _domain));
if (!dir.isEmpty()) {
_savePath->setLabel(dir);
@@ -486,6 +496,12 @@
} else {
_extraPath->setLabel(extraPath);
}
+
+ if (soundFont.isEmpty() || !ConfMan.hasKey("soundfont", _domain)) {
+ _soundFont->setLabel("None");
+ } else {
+ _soundFont->setLabel(soundFont);
+ }
#endif
}
@@ -497,6 +513,10 @@
String extraPath = _extraPath->getLabel();
if (!extraPath.isEmpty() && (extraPath != "None"))
ConfMan.set("extrapath", extraPath, _domain);
+
+ String soundFont = _soundFont->getLabel();
+ if (!soundFont.isEmpty() && (soundFont != "None"))
+ ConfMan.set("soundfont", soundFont, _domain);
}
OptionsDialog::close();
}
@@ -504,20 +524,27 @@
void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
switch (cmd) {
case kChooseSaveDirCmd:
- if (_browser->runModal() > 0) {
+ if (_dirBrowser->runModal() > 0) {
// User made his choice...
- FilesystemNode dir(_browser->getResult());
+ FilesystemNode dir(_dirBrowser->getResult());
_savePath->setLabel(dir.path());
// TODO - we should check if the directory is writeable before accepting it
}
break;
case kChooseExtraDirCmd:
- if (_browser->runModal() > 0) {
+ if (_dirBrowser->runModal() > 0) {
// User made his choice...
- FilesystemNode dir(_browser->getResult());
+ FilesystemNode dir(_dirBrowser->getResult());
_extraPath->setLabel(dir.path());
}
break;
+ case kChooseSoundFontCmd:
+ if (_fileBrowser->runModal() > 0) {
+ // User made his choice...
+ FilesystemNode file(_fileBrowser->getResult());
+ _soundFont->setLabel(file.path());
+ }
+ break;
#ifdef _WIN32_WCE
case kChooseKeyMappingCmd:
_keysDialog->runModal();
Index: options.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/options.h,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- options.h 20 Feb 2005 00:17:21 -0000 1.25
+++ options.h 10 Apr 2005 14:33:44 -0000 1.26
@@ -32,7 +32,8 @@
namespace GUI {
-class BrowserDialog;
+class DirBrowserDialog;
+class FileBrowserDialog;
class CheckboxWidget;
class PopUpWidget;
class SliderWidget;
@@ -55,6 +56,8 @@
/** Config domain this dialog is used to edit. */
String _domain;
+ StaticTextWidget *_soundFont;
+
int addGraphicControls(GuiObject *boss, int yoffset);
int addMIDIControls(GuiObject *boss, int yoffset);
int addVolumeControls(GuiObject *boss, int yoffset);
@@ -109,7 +112,8 @@
void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
protected:
- BrowserDialog *_browser;
+ DirBrowserDialog *_dirBrowser;
+ FileBrowserDialog *_fileBrowser;
#ifdef _WIN32_WCE
CEKeysDialog *_keysDialog;
#endif
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/sound mididrv.cpp,1.60,1.61 mididrv.h,1.42,1.43 module.mk,1.19,1.20
- Next message: [Scummvm-cvs-logs] CVS: scummvm/doc 05_01.tex,1.20,1.21 07.tex,1.6,1.7 08.tex,1.12,1.13
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list