[Scummvm-cvs-logs] CVS: scummvm/gui browser.cpp,NONE,1.1 browser.h,NONE,1.1 launcher.cpp,1.12,1.13

Max Horn fingolfin at users.sourceforge.net
Thu Nov 14 05:47:04 CET 2002


Update of /cvsroot/scummvm/scummvm/gui
In directory usw-pr-cvs1:/tmp/cvs-serv19980/gui

Modified Files:
	launcher.cpp 
Added Files:
	browser.cpp browser.h 
Log Message:
added completly useless non functional browser dialog skeleton. Just to show Endy I really have started working on it finally <g>

--- NEW FILE: browser.cpp ---
/* 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: /cvsroot/scummvm/scummvm/gui/browser.cpp,v 1.1 2002/11/14 13:46:35 fingolfin Exp $
 */

#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
}

--- NEW FILE: browser.h ---
/* 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: /cvsroot/scummvm/scummvm/gui/browser.h,v 1.1 2002/11/14 13:46:35 fingolfin Exp $
 */

#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

Index: launcher.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/launcher.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- launcher.cpp	13 Nov 2002 20:23:24 -0000	1.12
+++ launcher.cpp	14 Nov 2002 13:46:35 -0000	1.13
@@ -20,6 +20,7 @@
 
 #include "stdafx.h"
 #include "launcher.h"
+#include "browser.h"
 #include "newgui.h"
 #include "ListWidget.h"
 
@@ -112,7 +113,7 @@
 
 	// 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 @@
 	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 





More information about the Scummvm-git-logs mailing list