[Scummvm-cvs-logs] SF.net SVN: scummvm: [32869] scummvm/branches/gsoc2008-gui
tanoku at users.sourceforge.net
tanoku at users.sourceforge.net
Tue Jul 1 17:57:30 CEST 2008
Revision: 32869
http://scummvm.svn.sourceforge.net/scummvm/?rev=32869&view=rev
Author: tanoku
Date: 2008-07-01 08:57:30 -0700 (Tue, 01 Jul 2008)
Log Message:
-----------
Rendering pipeline. WIP.
Modified Paths:
--------------
scummvm/branches/gsoc2008-gui/base/main.cpp
scummvm/branches/gsoc2008-gui/gui/InterfaceManager.cpp
scummvm/branches/gsoc2008-gui/gui/InterfaceManager.h
scummvm/branches/gsoc2008-gui/gui/ThemeParser.cpp
scummvm/branches/gsoc2008-gui/gui/ThemeParser.h
scummvm/branches/gsoc2008-gui/gui/object.h
Modified: scummvm/branches/gsoc2008-gui/base/main.cpp
===================================================================
--- scummvm/branches/gsoc2008-gui/base/main.cpp 2008-07-01 14:51:44 UTC (rev 32868)
+++ scummvm/branches/gsoc2008-gui/base/main.cpp 2008-07-01 15:57:30 UTC (rev 32869)
@@ -72,8 +72,10 @@
#if defined LOL
- g_InterfaceManager.runGUI();
- return true;
+// g_InterfaceManager.runGUI();
+ InterfaceManager *manager = new InterfaceManager();
+ manager->openDialog(kDialogLauncher);
+ return (manager.runGUI() != -1);
#else
Modified: scummvm/branches/gsoc2008-gui/gui/InterfaceManager.cpp
===================================================================
--- scummvm/branches/gsoc2008-gui/gui/InterfaceManager.cpp 2008-07-01 14:51:44 UTC (rev 32868)
+++ scummvm/branches/gsoc2008-gui/gui/InterfaceManager.cpp 2008-07-01 15:57:30 UTC (rev 32869)
@@ -30,6 +30,8 @@
#include "common/events.h"
#include "common/config-manager.h"
+#include "gui/launcher.h"
+
#include "gui/InterfaceManager.h"
#include "graphics/VectorRenderer.h"
@@ -73,7 +75,7 @@
_screen(0), _bytesPerPixel(0), _initOk(false), _themeOk(false),
_needThemeLoad(false), _enabled(false) {
_system = g_system;
- _parser = new ThemeParser();
+ _parser = new ThemeParser(this);
for (int i = 0; i < kDrawDataMAX; ++i) {
_widgets[i] = 0;
@@ -276,6 +278,22 @@
_dialogStack[i]->draw();
}
+void InterfaceManager::openDialog(Dialogs dname, Dialog *parent) {
+ Dialog *dlg = 0;
+ switch (dname) {
+ case kDialogLauncher:
+ dlg = new GUI::LauncherDialog;
+ break;
+
+ default:
+ error("Unhandled dialog opening");
+ break;
+ }
+
+ if (dlg)
+ _dialogStack.push(dlg);
+}
+
int InterfaceManager::runGUI() {
init();
@@ -289,8 +307,7 @@
if (!activeDialog)
return 0;
- bool didSaveState = false;
- bool stackChange = true;
+ bool stackChange;
int button;
uint32 time;
Modified: scummvm/branches/gsoc2008-gui/gui/InterfaceManager.h
===================================================================
--- scummvm/branches/gsoc2008-gui/gui/InterfaceManager.h 2008-07-01 14:51:44 UTC (rev 32868)
+++ scummvm/branches/gsoc2008-gui/gui/InterfaceManager.h 2008-07-01 15:57:30 UTC (rev 32869)
@@ -39,8 +39,6 @@
namespace GUI {
-#define g_InterfaceManager (GUI::InterfaceManager::instance())
-
struct WidgetDrawData;
class InterfaceManager;
@@ -64,14 +62,13 @@
}
};
-class InterfaceManager : public Common::Singleton<InterfaceManager> {
+class InterfaceManager {
typedef Common::String String;
typedef GUI::Dialog Dialog;
friend class GUI::Dialog;
friend class GUI::GuiObject;
- friend class Common::Singleton<SingletonBaseType>;
static const char *kDrawDataStrings[];
static const int kMaxDialogDepth = 4;
@@ -82,6 +79,11 @@
kGfxStandard16bit,
kGfxAntialias16bit
};
+
+ enum Dialogs {
+ kDialogLauncher,
+ kDialogMAX
+ };
enum {
kDoubleClickDelay = 500, // milliseconds
@@ -235,6 +237,12 @@
}
bool loadTheme(Common::String themeName);
+ void openDialog(Dialogs dname, Dialog *parent);
+
+ void closeTopDialog() {
+ assert(_dialogStack.empty() == false);
+ delete _dialogStack.pop();
+ }
protected:
template<typename PixelType> void screenInit();
@@ -273,10 +281,6 @@
return _dialogStack.top();
}
- void openDialog(Dialog *dlg) {
- _dialogStack.push(dlg);
- }
-
bool needThemeReload() {
return (_themeOk == false || _needThemeLoad == true);
}
Modified: scummvm/branches/gsoc2008-gui/gui/ThemeParser.cpp
===================================================================
--- scummvm/branches/gsoc2008-gui/gui/ThemeParser.cpp 2008-07-01 14:51:44 UTC (rev 32868)
+++ scummvm/branches/gsoc2008-gui/gui/ThemeParser.cpp 2008-07-01 15:57:30 UTC (rev 32869)
@@ -39,7 +39,7 @@
using namespace Graphics;
using namespace Common;
-ThemeParser::ThemeParser() : XMLParser() {
+ThemeParser::ThemeParser(InterfaceManager *parent) : XMLParser() {
_callbacks["drawstep"] = &ThemeParser::parserCallback_DRAWSTEP;
_callbacks["drawdata"] = &ThemeParser::parserCallback_DRAWDATA;
_callbacks["palette"] = &ThemeParser::parserCallback_palette;
@@ -59,6 +59,7 @@
_defaultStepGlobal = defaultDrawStep();
_defaultStepLocal = 0;
+ _GUI = parent;
}
bool ThemeParser::keyCallback(Common::String keyName) {
@@ -212,7 +213,7 @@
if (!parseDrawStep(stepNode, drawstep, true))
return false;
- g_InterfaceManager.addDrawStep(drawdataNode->values["id"], drawstep);
+ _GUI->addDrawStep(drawdataNode->values["id"], drawstep);
return true;
}
@@ -228,7 +229,7 @@
if (drawdataNode->values.contains("id") == false)
return parserError("DrawData keys must contain an identifier.");
- InterfaceManager::DrawData id = g_InterfaceManager.getDrawDataId(drawdataNode->values["id"]);
+ InterfaceManager::DrawData id = _GUI->getDrawDataId(drawdataNode->values["id"]);
if (id == -1)
return parserError("%s is not a valid DrawData set identifier.", drawdataNode->values["id"].c_str());
@@ -251,7 +252,7 @@
}
}*/
- if (g_InterfaceManager.addDrawData(id, cached) == false)
+ if (_GUI->addDrawData(id, cached) == false)
return parserError("Repeated DrawData: Only one set of Drawing Data for a widget may be specified on each platform.");
if (_defaultStepLocal) {
Modified: scummvm/branches/gsoc2008-gui/gui/ThemeParser.h
===================================================================
--- scummvm/branches/gsoc2008-gui/gui/ThemeParser.h 2008-07-01 14:51:44 UTC (rev 32868)
+++ scummvm/branches/gsoc2008-gui/gui/ThemeParser.h 2008-07-01 15:57:30 UTC (rev 32869)
@@ -36,6 +36,7 @@
#include "common/xmlparser.h"
#include "graphics/VectorRenderer.h"
+#include "gui/InterfaceManager.h"
/**
*********************************************
@@ -307,15 +308,18 @@
using namespace Graphics;
using namespace Common;
+class InterfaceManager;
class ThemeParser : public XMLParser {
typedef void (VectorRenderer::*DrawingFunctionCallback)(const Common::Rect &, const DrawStep &);
typedef bool (ThemeParser::*ParserCallback)();
+ typedef GUI::InterfaceManager InterfaceManager;
public:
- ThemeParser();
+ ThemeParser(InterfaceManager *parent);
protected:
+ InterfaceManager *_GUI;
bool keyCallback(Common::String keyName);
bool parserCallback_DRAWSTEP();
Modified: scummvm/branches/gsoc2008-gui/gui/object.h
===================================================================
--- scummvm/branches/gsoc2008-gui/gui/object.h 2008-07-01 14:51:44 UTC (rev 32868)
+++ scummvm/branches/gsoc2008-gui/gui/object.h 2008-07-01 15:57:30 UTC (rev 32869)
@@ -29,6 +29,7 @@
class CommandReceiver;
class CommandSender;
+class InterfaceManager;
class CommandReceiver {
friend class CommandSender;
@@ -65,6 +66,7 @@
Common::String _name;
Widget *_firstWidget;
+ InterfaceManager *_GUI;
public:
GuiObject(int x, int y, int w, int h) : _x(x), _y(y), _w(w), _h(h), _name(""), _firstWidget(0) { }
@@ -83,6 +85,7 @@
virtual void draw() = 0;
virtual void reflowLayout();
+ virtual void setInterfaceManager(InterfaceManager *manager) { _GUI = manager; }
protected:
virtual void releaseFocus() = 0;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list