diff options
-rw-r--r-- | Makefile.common | 8 | ||||
-rw-r--r-- | backends/fs/posix/posix-fs.cpp | 3 | ||||
-rw-r--r-- | gui/browser.cpp | 51 | ||||
-rw-r--r-- | gui/browser.h | 45 | ||||
-rw-r--r-- | gui/launcher.cpp | 11 |
5 files changed, 113 insertions, 5 deletions
diff --git a/Makefile.common b/Makefile.common index b17140a930..4309cdcca9 100644 --- a/Makefile.common +++ b/Makefile.common @@ -3,12 +3,15 @@ # common rules, a list of common object files etc. # List of all sub modules -MODULES += common gui scumm simon sound scumm/smush +MODULES += backends/fs/posix common gui scumm simon sound scumm/smush ZIPFILE := scummvm-`date '+%Y-%m-%d'`.zip INCS = scumm/scumm.h common/scummsys.h common/stdafx.h +BACKEND_OBJS = \ + backends/fs/posix/posix-fs.o + COMMON_OBJS = \ common/config-file.o \ common/engine.o \ @@ -21,6 +24,7 @@ COMMON_OBJS = \ common/util.o GUI_OBJS = \ + gui/browser.o \ gui/dialog.o \ gui/launcher.o \ gui/ListWidget.o \ @@ -81,7 +85,7 @@ SMUSH_OBJS = \ SOUND_OBJS = sound/fmopl.o sound/mididrv.o sound/mixer.o -OBJS += $(COMMON_OBJS) $(GUI_OBJS) scumm/libscumm.a simon/libsimon.a $(SOUND_OBJS) +OBJS += $(BACKEND_OBJS) $(COMMON_OBJS) $(GUI_OBJS) scumm/libscumm.a simon/libsimon.a $(SOUND_OBJS) DISTFILES=$(OBJS:.o=.cpp) Makefile scumm.h scummsys.h stdafx.h stdafx.cpp \ debugrl.h NEWS README COPYING \ diff --git a/backends/fs/posix/posix-fs.cpp b/backends/fs/posix/posix-fs.cpp index a9c70673bd..60aa6de59c 100644 --- a/backends/fs/posix/posix-fs.cpp +++ b/backends/fs/posix/posix-fs.cpp @@ -97,6 +97,9 @@ FSList *POSIXFilesystemNode::listDir() const { entry._displayName = dp->d_name; entry._isDirectory = (dp->d_type == DT_DIR); // TODO - add support for symlinks to dirs? + // FIXME - skip any non-directories for now + if (!entry._isDirectory) continue; + entry._path = _path; entry._path += dp->d_name; if (entry._isDirectory) diff --git a/gui/browser.cpp b/gui/browser.cpp new file mode 100644 index 0000000000..dd20b6c01c --- /dev/null +++ b/gui/browser.cpp @@ -0,0 +1,51 @@ +/* ScummVM - Scumm Interpreter + * Copyright (C) 2002 The ScummVM project + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Header$ + */ + +#include "browser.h" +#include "newgui.h" +#include "ListWidget.h" + +#include "backends/fs/fs.h" + +/* We want to use this as a general directory selector at some point... possible uses + * - to select the data dir for a game + * - to select the place where save games are stored + * - others??? + */ + +BrowserDialog::BrowserDialog(NewGui *gui) + : Dialog(gui, 50, 20, 320-2*50, 200-2*20) +{ + // Headline - TODO: should be customizable during creation time + new StaticTextWidget(this, 10, 10, _w-2*10, kLineHeight, + "Select directory with game data", kTextAlignCenter); + + // Add file list + _fileList = new ListWidget(this, 10, 20, _w-2*10, _h-20-24-10); + + // Buttons + addButton(10, _h-24, "Go up", kCloseCmd, 0); + addButton(_w-2*(kButtonWidth+10), _h-24, "Cancel", kCloseCmd, 0); + addButton(_w-(kButtonWidth+10), _h-24, "Choose", kCloseCmd, 0); + + // TODO - populate list item, implement buttons, etc. etc. + // TODO - will the choose button select the directory we are currrently in?!? + // TODO - double clicking an item should traverse into that directory +} diff --git a/gui/browser.h b/gui/browser.h new file mode 100644 index 0000000000..a07f169eb3 --- /dev/null +++ b/gui/browser.h @@ -0,0 +1,45 @@ +/* ScummVM - Scumm Interpreter + * Copyright (C) 2002 The ScummVM project + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Header$ + */ + +#ifndef BROWSER_DIALOG_H +#define BROWSER_DIALOG_H + +#include "dialog.h" +#include "common/str.h" +#include "common/list.h" + +class ListWidget; +class FilesystemNode; +class FSList; + +class BrowserDialog : public Dialog { + typedef ScummVM::String String; + typedef ScummVM::StringList StringList; +public: + BrowserDialog(NewGui *gui); + +protected: + ListWidget *_fileList; + FilesystemNode *_node; + FSList *_content; + +}; + +#endif diff --git a/gui/launcher.cpp b/gui/launcher.cpp index fff6290f3f..2526d0a6ba 100644 --- a/gui/launcher.cpp +++ b/gui/launcher.cpp @@ -20,6 +20,7 @@ #include "stdafx.h" #include "launcher.h" +#include "browser.h" #include "newgui.h" #include "ListWidget.h" @@ -112,7 +113,7 @@ LauncherDialog::LauncherDialog(NewGui *gui, GameDetector &detector) // Two more buttons directly below the list box bw = new ButtonWidget(this, 10, 144, 80, 16, "Add Game...", kAddGameCmd, 'A'); - bw->setEnabled(false); +// bw->setEnabled(false); bw = new ButtonWidget(this, 320-90, 144, 80, 16, "Configure...", kConfigureGameCmd, 'C'); bw->setEnabled(false); } @@ -122,14 +123,18 @@ void LauncherDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat int item; switch (cmd) { - case kAddGameCmd: + case kAddGameCmd: { // TODO: Allow user to add a new game to the list. - // 1) show a file selection dialog (to be implemented!) which lets + // 1) show a dir selection dialog which lets // the user pick the directory the game data resides in. // 2) show the user a list of games to pick from. Initially just show // all known games. But ideally, we would refine this list by checking // which choices are possible. E.g. if we don't find atlantis.000 in that // directory, then it's not FOA etc. + BrowserDialog *browser = new BrowserDialog(_gui); + browser->runModal(); + delete browser; + } break; case kConfigureGameCmd: // Set game specifc options. Most of these should be "optional", i.e. by |