mirror of https://github.com/stella-emu/stella.git
Yet more fixes for the ROM launcher and browser. Make sure the directory
is redrawn, even if it's empty in rom browse mode. Disable the 'Go Up' buttons when there's no parent directory (wasn't absolutely necessary, but it gives some nice visual feedback). git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1059 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
893644c703
commit
8cff84b4d2
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: FSNode.cxx,v 1.4 2006-03-08 20:03:03 stephena Exp $
|
// $Id: FSNode.cxx,v 1.5 2006-03-19 22:06:20 stephena Exp $
|
||||||
//
|
//
|
||||||
// Based on code from ScummVM - Scumm Interpreter
|
// Based on code from ScummVM - Scumm Interpreter
|
||||||
// Copyright (C) 2002-2004 The ScummVM project
|
// Copyright (C) 2002-2004 The ScummVM project
|
||||||
|
@ -112,3 +112,9 @@ FilesystemNode FilesystemNode::getParent() const
|
||||||
else
|
else
|
||||||
return AbstractFilesystemNode::wrap(node);
|
return AbstractFilesystemNode::wrap(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
bool FilesystemNode::hasParent() const
|
||||||
|
{
|
||||||
|
return _realNode->parent() != 0;
|
||||||
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: FSNode.hxx,v 1.8 2005-12-09 01:16:13 stephena Exp $
|
// $Id: FSNode.hxx,v 1.9 2006-03-19 22:06:20 stephena Exp $
|
||||||
//
|
//
|
||||||
// Based on code from ScummVM - Scumm Interpreter
|
// Based on code from ScummVM - Scumm Interpreter
|
||||||
// Copyright (C) 2002-2004 The ScummVM project
|
// Copyright (C) 2002-2004 The ScummVM project
|
||||||
|
@ -184,6 +184,7 @@ class FilesystemNode : public AbstractFilesystemNode
|
||||||
FilesystemNode &operator =(const FilesystemNode &node);
|
FilesystemNode &operator =(const FilesystemNode &node);
|
||||||
|
|
||||||
FilesystemNode getParent() const;
|
FilesystemNode getParent() const;
|
||||||
|
bool hasParent() const;
|
||||||
|
|
||||||
virtual string displayName() const { return _realNode->displayName(); }
|
virtual string displayName() const { return _realNode->displayName(); }
|
||||||
virtual bool isValid() const { return _realNode->isValid(); }
|
virtual bool isValid() const { return _realNode->isValid(); }
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: BrowserDialog.cxx,v 1.15 2006-03-08 20:03:03 stephena Exp $
|
// $Id: BrowserDialog.cxx,v 1.16 2006-03-19 22:06:20 stephena Exp $
|
||||||
//
|
//
|
||||||
// Based on code from ScummVM - Scumm Interpreter
|
// Based on code from ScummVM - Scumm Interpreter
|
||||||
// Copyright (C) 2002-2004 The ScummVM project
|
// Copyright (C) 2002-2004 The ScummVM project
|
||||||
|
@ -30,11 +30,6 @@
|
||||||
|
|
||||||
#include "bspf.hxx"
|
#include "bspf.hxx"
|
||||||
|
|
||||||
enum {
|
|
||||||
kChooseCmd = 'CHOS',
|
|
||||||
kGoUpCmd = 'GOUP'
|
|
||||||
};
|
|
||||||
|
|
||||||
/* We want to use this as a general directory selector at some point... possible uses
|
/* 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 data dir for a game
|
||||||
* - to select the place where save games are stored
|
* - to select the place where save games are stored
|
||||||
|
@ -77,8 +72,8 @@ BrowserDialog::BrowserDialog(GuiObject* boss, const GUI::Font& font,
|
||||||
|
|
||||||
// Buttons
|
// Buttons
|
||||||
xpos = 10; ypos = _h - bheight - 8;
|
xpos = 10; ypos = _h - bheight - 8;
|
||||||
new ButtonWidget(this, font, xpos, ypos, bwidth, bheight, "Go up",
|
_goUpButton = new ButtonWidget(this, font, xpos, ypos, bwidth, bheight,
|
||||||
kGoUpCmd, 0);
|
"Go up", kGoUpCmd, 0);
|
||||||
#ifndef MAC_OSX
|
#ifndef MAC_OSX
|
||||||
xpos = _w - 2 *(bwidth + 10);
|
xpos = _w - 2 *(bwidth + 10);
|
||||||
new ButtonWidget(this, font, xpos, ypos, bwidth, bheight, "Choose",
|
new ButtonWidget(this, font, xpos, ypos, bwidth, bheight, "Choose",
|
||||||
|
@ -179,6 +174,9 @@ void BrowserDialog::updateListing()
|
||||||
if(size > 0)
|
if(size > 0)
|
||||||
_fileList->setSelected(0);
|
_fileList->setSelected(0);
|
||||||
|
|
||||||
|
// Only hilite the 'up' button if there's a parent directory
|
||||||
|
_goUpButton->setEnabled(_node.hasParent());
|
||||||
|
|
||||||
// Finally, redraw
|
// Finally, redraw
|
||||||
setDirty(); draw();
|
setDirty(); draw();
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: BrowserDialog.hxx,v 1.7 2006-02-22 17:38:04 stephena Exp $
|
// $Id: BrowserDialog.hxx,v 1.8 2006-03-19 22:06:20 stephena Exp $
|
||||||
//
|
//
|
||||||
// Based on code from ScummVM - Scumm Interpreter
|
// Based on code from ScummVM - Scumm Interpreter
|
||||||
// Copyright (C) 2002-2004 The ScummVM project
|
// Copyright (C) 2002-2004 The ScummVM project
|
||||||
|
@ -23,6 +23,7 @@
|
||||||
#define BROWSER_DIALOG_HXX
|
#define BROWSER_DIALOG_HXX
|
||||||
|
|
||||||
class GuiObject;
|
class GuiObject;
|
||||||
|
class ButtonWidget;
|
||||||
class StaticTextWidget;
|
class StaticTextWidget;
|
||||||
class StringListWidget;
|
class StringListWidget;
|
||||||
|
|
||||||
|
@ -51,12 +52,19 @@ class BrowserDialog : public Dialog, public CommandSender
|
||||||
StringListWidget* _fileList;
|
StringListWidget* _fileList;
|
||||||
StaticTextWidget* _currentPath;
|
StaticTextWidget* _currentPath;
|
||||||
StaticTextWidget* _title;
|
StaticTextWidget* _title;
|
||||||
|
ButtonWidget* _goUpButton;
|
||||||
|
|
||||||
FilesystemNode _node;
|
FilesystemNode _node;
|
||||||
FSList _nodeContent;
|
FSList _nodeContent;
|
||||||
FilesystemNode _choice;
|
FilesystemNode _choice;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int _cmd;
|
int _cmd;
|
||||||
|
|
||||||
|
enum {
|
||||||
|
kChooseCmd = 'CHOS',
|
||||||
|
kGoUpCmd = 'GOUP'
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: LauncherDialog.cxx,v 1.49 2006-03-19 20:57:55 stephena Exp $
|
// $Id: LauncherDialog.cxx,v 1.50 2006-03-19 22:06:20 stephena Exp $
|
||||||
//
|
//
|
||||||
// Based on code from ScummVM - Scumm Interpreter
|
// Based on code from ScummVM - Scumm Interpreter
|
||||||
// Copyright (C) 2002-2004 The ScummVM project
|
// Copyright (C) 2002-2004 The ScummVM project
|
||||||
|
@ -191,8 +191,6 @@ void LauncherDialog::enableButtons(bool enable)
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void LauncherDialog::updateListing(bool fullReload)
|
void LauncherDialog::updateListing(bool fullReload)
|
||||||
{
|
{
|
||||||
enableButtons(false);
|
|
||||||
|
|
||||||
// Start with empty list
|
// Start with empty list
|
||||||
myGameList->clear();
|
myGameList->clear();
|
||||||
|
|
||||||
|
@ -216,9 +214,16 @@ void LauncherDialog::updateListing(bool fullReload)
|
||||||
myCurrentDir = romdir;
|
myCurrentDir = romdir;
|
||||||
|
|
||||||
loadDirListing();
|
loadDirListing();
|
||||||
|
|
||||||
|
// Only hilite the 'up' button if there's a parent directory
|
||||||
|
FilesystemNode dir(myCurrentDir);
|
||||||
|
myPrevDirButton->setEnabled(dir.hasParent());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// Disable buttons, pending a reload from disk
|
||||||
|
enableButtons(false);
|
||||||
|
|
||||||
// Figure out if the ROM dir has changed since we last accessed it.
|
// Figure out if the ROM dir has changed since we last accessed it.
|
||||||
// If so, we do a full reload from disk (takes quite some time).
|
// If so, we do a full reload from disk (takes quite some time).
|
||||||
// Otherwise, we can use the cache file (which is much faster).
|
// Otherwise, we can use the cache file (which is much faster).
|
||||||
|
@ -231,6 +236,9 @@ void LauncherDialog::updateListing(bool fullReload)
|
||||||
loadListFromCache();
|
loadListFromCache();
|
||||||
else // we have no other choice
|
else // we have no other choice
|
||||||
loadListFromDisk();
|
loadListFromDisk();
|
||||||
|
|
||||||
|
// Re-enable buttons
|
||||||
|
enableButtons(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now fill the list widget with the contents of the GameList
|
// Now fill the list widget with the contents of the GameList
|
||||||
|
@ -245,8 +253,6 @@ void LauncherDialog::updateListing(bool fullReload)
|
||||||
buf << myGameList->size() << " items found";
|
buf << myGameList->size() << " items found";
|
||||||
myRomCount->setLabel(buf.str());
|
myRomCount->setLabel(buf.str());
|
||||||
|
|
||||||
enableButtons(true);
|
|
||||||
|
|
||||||
// Restore last selection
|
// Restore last selection
|
||||||
if(!myList->getList().isEmpty())
|
if(!myList->getList().isEmpty())
|
||||||
{
|
{
|
||||||
|
@ -275,6 +281,8 @@ void LauncherDialog::updateListing(bool fullReload)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
myList->setSelected(-1); // redraw the empty list
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: ListWidget.cxx,v 1.40 2006-02-22 17:38:04 stephena Exp $
|
// $Id: ListWidget.cxx,v 1.41 2006-03-19 22:06:20 stephena Exp $
|
||||||
//
|
//
|
||||||
// Based on code from ScummVM - Scumm Interpreter
|
// Based on code from ScummVM - Scumm Interpreter
|
||||||
// Copyright (C) 2002-2004 The ScummVM project
|
// Copyright (C) 2002-2004 The ScummVM project
|
||||||
|
@ -67,7 +67,7 @@ ListWidget::~ListWidget()
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void ListWidget::setSelected(int item)
|
void ListWidget::setSelected(int item)
|
||||||
{
|
{
|
||||||
assert(item >= -1 && item < (int)_list.size());
|
assert(item >= -2 && item < (int)_list.size());
|
||||||
|
|
||||||
if(isEnabled())
|
if(isEnabled())
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: ListWidget.hxx,v 1.16 2006-02-22 17:38:04 stephena Exp $
|
// $Id: ListWidget.hxx,v 1.17 2006-03-19 22:06:20 stephena Exp $
|
||||||
//
|
//
|
||||||
// Based on code from ScummVM - Scumm Interpreter
|
// Based on code from ScummVM - Scumm Interpreter
|
||||||
// Copyright (C) 2002-2004 The ScummVM project
|
// Copyright (C) 2002-2004 The ScummVM project
|
||||||
|
@ -52,7 +52,7 @@ class ListWidget : public EditableWidget
|
||||||
int currentPos() const { return _currentPos; }
|
int currentPos() const { return _currentPos; }
|
||||||
|
|
||||||
int getSelected() const { return _selectedItem; }
|
int getSelected() const { return _selectedItem; }
|
||||||
void setSelected(int item);
|
void setSelected(int item); // Use '-1' to indicate a redraw of an empty list
|
||||||
|
|
||||||
int getHighlighted() const { return _highlightedItem; }
|
int getHighlighted() const { return _highlightedItem; }
|
||||||
void setHighlighted(int item);
|
void setHighlighted(int item);
|
||||||
|
|
Loading…
Reference in New Issue