[Scummvm-cvs-logs] SF.net SVN: scummvm: [27876] scummex/branches/gsoc2007-gameresbrowser

zbychs at users.sourceforge.net zbychs at users.sourceforge.net
Tue Jul 3 02:07:29 CEST 2007


Revision: 27876
          http://scummvm.svn.sourceforge.net/scummvm/?rev=27876&view=rev
Author:   zbychs
Date:     2007-07-02 17:07:28 -0700 (Mon, 02 Jul 2007)

Log Message:
-----------
Working ExplorationTree. Added PanelProvider. Other enchancements.

Modified Paths:
--------------
    scummex/branches/gsoc2007-gameresbrowser/src/gui/ExplorationTree.h
    scummex/branches/gsoc2007-gameresbrowser/src/gui/ImagePresenter.h
    scummex/branches/gsoc2007-gameresbrowser/src/gui/MainForm.cpp
    scummex/branches/gsoc2007-gameresbrowser/src/gui/MainForm.h
    scummex/branches/gsoc2007-gameresbrowser/src/gui/MainForm.wxform
    scummex/branches/gsoc2007-gameresbrowser/src/gui/Test1.cpp
    scummex/branches/gsoc2007-gameresbrowser/src/gui/VirtualNode.cpp
    scummex/branches/gsoc2007-gameresbrowser/src/gui/VirtualNode.h
    scummex/branches/gsoc2007-gameresbrowser/src/plugins/BMPParser.cpp
    scummex/branches/gsoc2007-gameresbrowser/src/plugins/BMPParser.h
    scummex/branches/gsoc2007-gameresbrowser/src/plugins/BitmapPanel.cpp
    scummex/branches/gsoc2007-gameresbrowser/src/plugins/BitmapPanel.h
    scummex/branches/gsoc2007-gameresbrowser/src/plugins/DiskFileProvider.cpp
    scummex/branches/gsoc2007-gameresbrowser/src/plugins/DiskFileProvider.h
    scummex/branches/gsoc2007-gameresbrowser/vc8/Browser/Browser.vcproj
    scummex/branches/gsoc2007-gameresbrowser/vc8/plugins/plugins.vcproj

Added Paths:
-----------
    scummex/branches/gsoc2007-gameresbrowser/src/gui/DirectoryPresenter.cpp
    scummex/branches/gsoc2007-gameresbrowser/src/gui/DirectoryPresenter.h
    scummex/branches/gsoc2007-gameresbrowser/src/gui/ExplorationTree.cpp
    scummex/branches/gsoc2007-gameresbrowser/src/gui/FilePresenter.cpp
    scummex/branches/gsoc2007-gameresbrowser/src/gui/FilePresenter.h
    scummex/branches/gsoc2007-gameresbrowser/src/gui/ImagePresenter.cpp
    scummex/branches/gsoc2007-gameresbrowser/src/gui/PanelProvider.cpp
    scummex/branches/gsoc2007-gameresbrowser/src/gui/PanelProvider.h
    scummex/branches/gsoc2007-gameresbrowser/src/plugins/CoreIntf.cpp
    scummex/branches/gsoc2007-gameresbrowser/src/plugins/CoreIntf.h
    scummex/branches/gsoc2007-gameresbrowser/src/plugins/GUIIntf.cpp
    scummex/branches/gsoc2007-gameresbrowser/src/plugins/GUIIntf.h

Added: scummex/branches/gsoc2007-gameresbrowser/src/gui/DirectoryPresenter.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/gui/DirectoryPresenter.cpp	                        (rev 0)
+++ scummex/branches/gsoc2007-gameresbrowser/src/gui/DirectoryPresenter.cpp	2007-07-03 00:07:28 UTC (rev 27876)
@@ -0,0 +1,147 @@
+/////////////////////////////////////////////////////////////////////////////
+// DirectoryPresenter.cpp
+
+#include "wx/wxprec.h"
+
+#if defined(__BORLANDC__)
+#pragma hdrstop
+#endif
+
+#include "DirectoryPresenter.h"
+#include "ExplorationTree.h"
+#include "VirtualNode.h"
+#include "FilePresenter.h"
+
+#include <iostream>
+
+#include "debugmem.h"
+
+namespace Browser {
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+SLOT_DESCS_EX(DirectoryPresenter)
+    SLOT_DESC(_directorySlot, SLOT_DEFAULT)
+    SLOT_DESC(_nodeSlot, SLOT_DEFAULT)
+END_DESCS
+
+bool DirectoryPresenter::realize(ObjectChain* ochain) {
+    bool res = BObject::realize(ochain);
+    if (!res)
+        return false;
+
+    _inodeprovider = _nodeSlot->getInterface();
+    if (!_inodeprovider) {
+        _realized = false;
+        return false;
+    }
+
+    VirtualNode* node = _inodeprovider->getNode();
+    ExplorationTree::get()->registerDirectoryPresenter(node, this);
+    ExplorationTree::_getTree()->SetItemHasChildren(node, true);
+
+    wxTreeItemId dummyTreeItem = ExplorationTree::_getTree()->
+        AppendItem(node->getTreeItem(), _T("Dummy"), -1, -1, NULL);
+
+    _expanded = false;
+
+    return true;
+}
+
+void DirectoryPresenter::unrealize(ObjectChain* ochain) {
+    if(!isRealized(ochain))
+        return;
+
+    ExplorationTree::get()->unregisterDirectoryPresenter(this);
+
+    deleteKidChains();
+
+    //is this in the right place? after the kids unrealisation? probably.
+    VirtualNode* node = _inodeprovider->getNode();
+    ExplorationTree::_getTree()->DeleteChildren( node->getTreeItem() );
+
+    _directorySlot->releaseInterface();
+    _nodeSlot->releaseInterface();
+
+    BObject::unrealize(ochain);
+}
+
+void DirectoryPresenter::expand() {
+    std::cout << "DirectoryPresenter::expand()" << std::endl;
+
+    if(_expanded)
+        return;
+    _expanded = true;
+
+    _idirectory = _directorySlot->getInterface();
+    if (!_idirectory) {
+        std::cout << "ERROR: DirectoryPresenter::expand(): can't get IDirectory interface." << std::endl;
+        return; //TODO: report error
+    }
+
+    VirtualNode* parent = _inodeprovider->getNode();
+
+    const std::list<IFile*>& files = _idirectory->getFiles();
+    std::list<IFile*>::const_iterator i;
+    for (i = files.begin(); i != files.end(); ++i) {
+        IFile* ifile = *i;
+
+        wxTreeItemId kidTreeItem = ExplorationTree::_getTree()->
+            AppendItem(parent->getTreeItem(),
+            wxString(ifile->getName().c_str(), wxConvUTF8),
+            -1, -1, NULL);
+
+        RCPtr<VirtualFile> virtualFile( new VirtualFile(kidTreeItem, ifile) );
+
+        ExplorationTree::_getTree()->SetItemData(kidTreeItem,
+            new VirtualNodeItemData( virtualFile.get() ) );
+
+        ObjectChain* kidchain = new ObjectChain();
+
+        if ( !kidchain->addObject(virtualFile) ) {
+            ASSERT(false); //failure here virtually impossible
+            delete kidchain;
+            //virtualFile is deleted automatically
+            continue;
+        }
+
+        _kidChains.push_back( kidchain );
+    }
+
+    if (!realizeKidChains()) {
+        deleteKidChains();
+        std::cout << "ERROR: DirectoryPresenter::expand(): can't realize kids." << std::endl;
+        return; //TODO: report error
+    }
+}
+
+void DirectoryPresenter::deleteKidChains() {
+    std::list<ObjectChain*>::const_iterator i;
+    for (i = _kidChains.begin(); i != _kidChains.end(); ++i) {
+        ObjectChain* kidchain = *i;
+        delete kidchain; //unrealize
+    }
+    _kidChains.clear();
+}
+
+bool DirectoryPresenter::realizeKidChains() {
+    bool res = true;
+    std::list<ObjectChain*>::const_iterator i;
+    for (i = _kidChains.begin(); i != _kidChains.end(); ++i) {
+        ObjectChain* kidchain = *i;
+        kidchain->complete();
+
+        RCPtr<FilePresenter> fpres(new FilePresenter());
+        kidchain->addObject(fpres);
+        kidchain->complete();
+
+        res &= kidchain->realize();
+    }
+    return res;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+}


Property changes on: scummex/branches/gsoc2007-gameresbrowser/src/gui/DirectoryPresenter.cpp
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Added: scummex/branches/gsoc2007-gameresbrowser/src/gui/DirectoryPresenter.h
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/gui/DirectoryPresenter.h	                        (rev 0)
+++ scummex/branches/gsoc2007-gameresbrowser/src/gui/DirectoryPresenter.h	2007-07-03 00:07:28 UTC (rev 27876)
@@ -0,0 +1,52 @@
+/////////////////////////////////////////////////////////////////////////////
+// DirectoryPresenter.h
+
+#ifndef _DIRECTORY_PRESENTER_H_
+#define _DIRECTORY_PRESENTER_H_
+
+#include "pinslot.h"
+#include "ochain.h"
+#include "CoreIntf.h"
+
+#include <list>
+
+namespace Browser {
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+class INodeProvider;
+
+class DirectoryPresenter : public BObject {
+    DECLARE_BOBJECT_CLASS(DirectoryPresenter, BObject)
+
+protected:
+    Slot<IDirectory>* _directorySlot;
+    Slot<INodeProvider>* _nodeSlot;
+
+    IDirectory* _idirectory;
+    INodeProvider* _inodeprovider;
+    std::list<ObjectChain*> _kidChains;
+
+    bool _expanded;
+
+public:
+    ASSIGN_GUID("CoreObjects", 1)
+
+    SLOTS_DECL
+
+    virtual bool realize(ObjectChain* ochain);
+    virtual void unrealize(ObjectChain* ochain);
+
+    virtual bool realizeKidChains();
+    virtual void deleteKidChains();
+
+    virtual void expand();
+};
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+}
+
+#endif //_DIRECTORY_PRESENTER_H_


Property changes on: scummex/branches/gsoc2007-gameresbrowser/src/gui/DirectoryPresenter.h
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Added: scummex/branches/gsoc2007-gameresbrowser/src/gui/ExplorationTree.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/gui/ExplorationTree.cpp	                        (rev 0)
+++ scummex/branches/gsoc2007-gameresbrowser/src/gui/ExplorationTree.cpp	2007-07-03 00:07:28 UTC (rev 27876)
@@ -0,0 +1,307 @@
+/////////////////////////////////////////////////////////////////////////////
+// ExplorationTree.cpp
+
+#include "wx/wxprec.h"
+
+#if defined(__BORLANDC__)
+#pragma hdrstop
+#endif
+
+#include "ExplorationTree.h"
+#include "PanelProvider.h"
+#include "DirectoryPresenter.h"
+
+#include "ochain.h"
+
+#include <map>
+#include <list>
+
+#include "debugmem.h"
+
+namespace Browser {
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+// private structs
+
+//information about registered panel
+struct PanelInfo {
+    bool _activated;
+    wxPanel* _page;
+    size_t _pageIdx;
+    PanelProvider* _panelProvider;
+    PanelInfo(PanelProvider* panelProvider)
+        : _panelProvider(panelProvider), _activated(false), _page(NULL), _pageIdx(-1) {}
+};
+
+//collection of registered panels
+struct PanelMap {
+    typedef std::multimap<VirtualNode*, PanelInfo*> panel_map;
+    panel_map _panelInfos;    
+
+    ~PanelMap() {
+        cleanup();
+    }
+
+    void cleanup() {
+        panel_map::iterator i;
+        for (i = _panelInfos.begin(); i != _panelInfos.end(); ++i) {
+            PanelInfo* pinfo = i->second;   
+            if (pinfo->_activated)
+                ExplorationTree::get()->pinfoDeactivate(pinfo);
+            delete pinfo;
+        }
+        _panelInfos.clear();
+    }
+
+    std::list<PanelInfo*> getPanelsFor(VirtualNode* node) {
+        std::list<PanelInfo*> pinfos;
+
+        panel_map::iterator i;
+        i = _panelInfos.find(node);
+        for (; i != _panelInfos.end() && i->first == node; ++i)
+            pinfos.push_back(i->second); 
+
+        return pinfos;
+    }
+
+    void unregisterPanelProvider(PanelProvider* panelProvider) {
+        panel_map::iterator i;
+        for (i = _panelInfos.begin(); i != _panelInfos.end(); ++i) {
+            PanelInfo* pinfo = i->second;   
+            if (pinfo->_panelProvider != panelProvider)
+                continue;
+
+            if (pinfo->_activated)
+                ExplorationTree::get()->pinfoDeactivate(pinfo);
+
+            delete pinfo;
+            _panelInfos.erase(i);
+            return;
+        }
+    }
+
+    void registerPanelProvider(VirtualNode* node, PanelProvider* panelProvider) {
+        _panelInfos.insert( std::make_pair(node, new PanelInfo(panelProvider)) );
+    }
+};
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+//collection of registered directories
+struct DirMap {
+    typedef std::map<VirtualNode*, DirectoryPresenter*> dir_map;
+    dir_map _dirInfos;    
+
+    ~DirMap() {
+        cleanup();
+    }
+
+    void cleanup() {
+        dir_map::iterator i;
+        for (i = _dirInfos.begin(); i != _dirInfos.end(); ++i) {
+            DirectoryPresenter* dir = i->second;
+            ExplorationTree::get()->dirCollapsed(dir);
+        }
+        _dirInfos.clear();
+    }
+
+    DirectoryPresenter* getDirFor(VirtualNode* node) {
+        dir_map::iterator i;
+        i = _dirInfos.find(node);
+        if (i != _dirInfos.end())
+            return i->second; 
+
+        return NULL;
+    }
+
+    void unregisterDirectoryPresenter(DirectoryPresenter* dirPresenter) {
+        dir_map::iterator i;
+        for (i = _dirInfos.begin(); i != _dirInfos.end(); ++i) {
+            DirectoryPresenter* dir = i->second;   
+            if (dir != dirPresenter)
+                continue;
+
+            ExplorationTree::get()->dirCollapsed(dir);
+
+            _dirInfos.erase(i);
+            return;
+        }
+    }
+
+    void registerDirectoryPresenter(VirtualNode* node, DirectoryPresenter* dirPresenter) {
+        _dirInfos.insert( std::make_pair(node, dirPresenter) );
+    }
+};
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+ExplorationTree* ExplorationTree::_instance = NULL;
+//wxPanel* MainPanel::_mainPanel = NULL;
+
+ExplorationTree::ExplorationTree()
+    : _explorationTree(NULL), _panelNotebook(NULL), _activeNode(NULL) {
+    _rootObjectChain = new ObjectChain();
+    _panelMap = new PanelMap();
+    _dirMap = new DirMap();
+}
+
+ExplorationTree::~ExplorationTree() {
+    _dirMap->cleanup();
+    _panelMap->cleanup();
+
+    delete _rootObjectChain; //unrealize
+
+    delete _dirMap;
+    delete _panelMap;
+}
+
+/*static*/ ExplorationTree* ExplorationTree::get() {
+    ASSERT(_instance);
+    return _instance;
+}
+/*static*/ void ExplorationTree::initialize(wxTreeCtrl* explorationTree, wxNotebook* panelNotebook) {
+    ASSERT(!_instance);
+    _instance = new ExplorationTree();
+    _instance->_explorationTree = explorationTree;
+    _instance->_panelNotebook = panelNotebook;
+}
+/*static*/ void ExplorationTree::shutdown() {
+    ASSERT(_instance);
+    delete _instance;
+    _instance = NULL;
+}
+
+/*static*/ wxTreeCtrl* ExplorationTree::_getTree() {
+    return get()->getTree();
+}
+
+wxTreeCtrl* ExplorationTree::getTree() {
+    return _explorationTree;
+}
+
+ObjectChain* ExplorationTree::getRootObjectChain() {
+    return _rootObjectChain;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+void ExplorationTree::pinfoDeactivate(PanelInfo* pinfo) {
+    if (!pinfo->_activated)
+        return;
+
+    //_panelNotebook->GetFirstPage();
+
+    pinfo->_panelProvider->panelDeactivate();
+    _panelNotebook->DeletePage(pinfo->_pageIdx);
+    //WORKAROUND: DeletePage is supposed to have DeletePage(wxWindow*)... but it doesn't.
+    std::list<PanelInfo*> pinfos = _panelMap->getPanelsFor(_activeNode);
+    std::list<PanelInfo*>::iterator i;
+    for (i = pinfos.begin(); i != pinfos.end(); ++i) {
+        PanelInfo* pinfo2 = *i;
+        if (pinfo2->_pageIdx > pinfo->_pageIdx)
+            pinfo2->_pageIdx--;
+    }
+    pinfo->_activated = false;
+    pinfo->_page = NULL;
+    pinfo->_pageIdx = -1;
+}
+
+void ExplorationTree::pinfoActivate(PanelInfo* pinfo) {
+    if (pinfo->_activated)
+        return;
+
+    wxPanel* panel = new wxPanel(_panelNotebook);
+    _panelNotebook->AddPage(panel,
+        wxString(pinfo->_panelProvider->getPanelTitle().c_str(), wxConvUTF8) );
+    pinfo->_activated = true;
+    pinfo->_page = panel;
+    pinfo->_pageIdx = _panelNotebook->GetPageCount() - 1;
+    pinfo->_panelProvider->panelActivate(panel);
+}
+
+void ExplorationTree::nodeDeactivate() {
+    if (_activeNode == NULL)
+        return;
+
+    std::list<PanelInfo*> pinfos = _panelMap->getPanelsFor(_activeNode);
+    std::list<PanelInfo*>::iterator i;
+    for (i = pinfos.begin(); i != pinfos.end(); ++i) {
+        pinfoDeactivate(*i);
+    }
+
+    _activeNode = NULL;
+}
+
+void ExplorationTree::nodeActivated(VirtualNode* activatedNode) {
+    if (activatedNode != _activeNode)
+        nodeDeactivate();
+    _activeNode = activatedNode;
+    if(!_activeNode)
+        return;
+
+    std::list<PanelInfo*> pinfos = _panelMap->getPanelsFor(activatedNode);
+    std::list<PanelInfo*>::iterator i;
+    for (i = pinfos.begin(); i != pinfos.end(); ++i) {
+        pinfoActivate(*i);
+    }
+}
+
+void ExplorationTree::itemActivated(wxTreeItemId item) {
+    VirtualNode* node = VirtualNodeItemData::getNode(item);
+    if(node)
+        nodeActivated(node);
+}
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+void ExplorationTree::dirCollapsed(DirectoryPresenter* dirPresenter) {
+    //nop
+}
+
+void ExplorationTree::dirExpanded(DirectoryPresenter* dirPresenter) {
+    if (!dirPresenter)
+        return;
+
+    dirPresenter->expand();
+}
+
+void ExplorationTree::nodeExpanded(VirtualNode* expandedNode) {
+    if(!expandedNode)
+        return;
+
+    DirectoryPresenter* dirPresenter = _dirMap->getDirFor(expandedNode);
+    dirExpanded(dirPresenter);
+}
+
+void ExplorationTree::itemExpanded(wxTreeItemId item) {
+    VirtualNode* node = VirtualNodeItemData::getNode(item);
+    if(node)
+        nodeExpanded(node);
+}
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+void ExplorationTree::registerPanelProvider(VirtualNode* node, PanelProvider* panelProvider) {
+    _panelMap->registerPanelProvider(node, panelProvider);
+}
+void ExplorationTree::unregisterPanelProvider(PanelProvider* panelProvider) {
+    _panelMap->unregisterPanelProvider(panelProvider);
+}
+
+void ExplorationTree::registerDirectoryPresenter(VirtualNode* node, DirectoryPresenter* dirPresenter) {
+    _dirMap->registerDirectoryPresenter(node, dirPresenter);
+}
+void ExplorationTree::unregisterDirectoryPresenter(DirectoryPresenter* dirPresenter) {
+    _dirMap->unregisterDirectoryPresenter(dirPresenter);
+}
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+}


Property changes on: scummex/branches/gsoc2007-gameresbrowser/src/gui/ExplorationTree.cpp
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Modified: scummex/branches/gsoc2007-gameresbrowser/src/gui/ExplorationTree.h
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/gui/ExplorationTree.h	2007-07-02 23:02:54 UTC (rev 27875)
+++ scummex/branches/gsoc2007-gameresbrowser/src/gui/ExplorationTree.h	2007-07-03 00:07:28 UTC (rev 27876)
@@ -4,23 +4,25 @@
 #ifndef _EXPLORATION_TREE_H_
 #define _EXPLORATION_TREE_H_
 
-#include "wx/wxprec.h"
-
-#if defined(__BORLANDC__)
-#pragma hdrstop
-#endif
-
-#ifndef WX_PRECOMP
 #include <wx/wx.h>
-#endif
 
-#include "ochain.h"
+#include <wx/notebook.h>
+#include <wx/treectrl.h>
+#include <wx/panel.h>
 
 namespace Browser {
 
 /////////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////////
 
+struct PanelInfo;
+struct PanelMap;
+struct DirMap;
+class VirtualNode;
+class PanelProvider;
+class DirectoryPresenter;
+class ObjectChain;
+
 //ExplorationTree's items does not hold any objects by reference. They do however hold
 //them via SetItemData( new VirtualNodeItemData(BObject*) ).
 //ExplorationTree holds objects by reference via _rootObjectChain, though.
@@ -28,52 +30,51 @@
     static ExplorationTree* _instance;
 
     wxTreeCtrl* _explorationTree;
+    wxNotebook* _panelNotebook;
+
     ObjectChain* _rootObjectChain;
 
-    ExplorationTree(wxTreeCtrl* explorationTree)
-        : _explorationTree(explorationTree) {
-        ASSERT(_explorationTree);
-        _rootObjectChain = new ObjectChain();
-    }
+    PanelMap* _panelMap;
+    VirtualNode* _activeNode;
+    DirMap* _dirMap;
 
-    ~ExplorationTree() {
-        delete _rootObjectChain; //unrealize
-    }
+private:
+    ExplorationTree();
+    ~ExplorationTree();
 
 public:
-    static ExplorationTree* get() {
-        ASSERT(_instance);
-        return _instance;
-    }
-    static void initialize(wxTreeCtrl* explorationTree) {
-        ASSERT(!_instance);
-        _instance = new ExplorationTree(explorationTree);
-    }
-    static void shutdown() {
-        ASSERT(_instance);
-        delete _instance;
-    }
+    static ExplorationTree* get();
+    static void initialize(wxTreeCtrl* explorationTree, wxNotebook* panelNotebook);
+    static void shutdown();
 
-    static wxTreeCtrl* _getTree() {
-        return get()->getTree();
-    }
+    static wxTreeCtrl* _getTree();
+    wxTreeCtrl* getTree();
 
-    wxTreeCtrl* getTree() {
-        return _explorationTree;
-    }
+    ObjectChain* getRootObjectChain();
 
-    ObjectChain* getRootObjectChain() {
-        return _rootObjectChain;
-    }
+    void pinfoDeactivate(PanelInfo* pinfo);
+    void pinfoActivate(PanelInfo* pinfo);
+    void nodeDeactivate();
+    void nodeActivated(VirtualNode* activatedNode);
 
-    /*void unrealize() {
-        _rootObjectChain->unrealize();
-    }*/
+    void dirCollapsed(DirectoryPresenter* dirPresenter);
+    void dirExpanded(DirectoryPresenter* dirPresenter);
+    void nodeExpanded(VirtualNode* expandedNode);
+
+    void itemActivated(wxTreeItemId item);
+    void itemExpanded(wxTreeItemId item);
+
+    void registerPanelProvider(VirtualNode* node, PanelProvider* panelProvider);
+    void unregisterPanelProvider(PanelProvider* panelProvider);
+
+    void registerDirectoryPresenter(VirtualNode* node, DirectoryPresenter* dirPresenter);
+    void unregisterDirectoryPresenter(DirectoryPresenter* dirPresenter);
 };
 
 /////////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////////
 
+/*
 class MainPanel {
     static wxPanel *_mainPanel;
 public:
@@ -88,6 +89,7 @@
         _mainPanel = mainPanel;
     }
 };
+*/
 
 /////////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////////

Added: scummex/branches/gsoc2007-gameresbrowser/src/gui/FilePresenter.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/gui/FilePresenter.cpp	                        (rev 0)
+++ scummex/branches/gsoc2007-gameresbrowser/src/gui/FilePresenter.cpp	2007-07-03 00:07:28 UTC (rev 27876)
@@ -0,0 +1,79 @@
+/////////////////////////////////////////////////////////////////////////////
+// FilePresenter.cpp
+
+#include "wx/wxprec.h"
+
+#if defined(__BORLANDC__)
+#pragma hdrstop
+#endif
+
+#include "FilePresenter.h"
+
+#include "CoreIntf.h"
+
+#include <iostream>
+
+#include "debugmem.h"
+
+namespace Browser {
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+PIN_DESCS_EX(FilePresenter)
+    PIN_DESC_r(_panelRecieverPin, PIN_DEFAULT, getPanelRecieverImpl, IPanelRecieverImpl)
+END_DESCS
+
+SLOT_DESCS_EX(FilePresenter)
+    SLOT_DESC(_fileSlot, SLOT_DEFAULT)
+END_DESCS
+
+IPanelRecieverImpl* FilePresenter::getPanelRecieverImpl() {
+    //std::cout << "FilePresenter::getPanelRecieverImpl(): " << std::endl;
+    return new IPanelRecieverImpl(this);
+}
+
+
+std::string FilePresenter::getPanelTitle() {
+
+    IFile* ifile = _fileSlot->getInterface();
+    if(!ifile) {
+        std::cout << "FilePresenter::getPanelTitle(): could not get IFile interface" << std::endl;
+        return "error reading file";
+    }
+
+    std::string name = ifile->getName();
+
+    _fileSlot->releaseInterface();
+
+    return name;
+}
+
+void FilePresenter::panelActivate(wxPanel* panel) {
+    std::cout << "FilePresenter::panelActivate()" << std::endl;
+
+    IFile* ifile = _fileSlot->getInterface();
+    if(!ifile) {
+        std::cout << "FilePresenter::panelActivate(): could not get IFile interface" << std::endl;
+        return;
+    }
+
+    std::string name = ifile->getName();
+    uint32 p = ifile->getStream()->pos();
+    std::string pos = toString(p);
+    uint32 s = ifile->getStream()->size();
+    std::string size = toString(s);
+    std::string text = name + " " + pos + "/" + size;
+    new wxStaticText(panel, wxID_ANY, wxString(text.c_str(), wxConvUTF8));
+
+    _fileSlot->releaseInterface();
+}
+
+void FilePresenter::panelDeactivate() {
+    std::cout << "FilePresenter::panelDeactivate()" << std::endl;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+} // namespace Browser


Property changes on: scummex/branches/gsoc2007-gameresbrowser/src/gui/FilePresenter.cpp
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Added: scummex/branches/gsoc2007-gameresbrowser/src/gui/FilePresenter.h
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/gui/FilePresenter.h	                        (rev 0)
+++ scummex/branches/gsoc2007-gameresbrowser/src/gui/FilePresenter.h	2007-07-03 00:07:28 UTC (rev 27876)
@@ -0,0 +1,45 @@
+/////////////////////////////////////////////////////////////////////////////
+// FilePresenter.h
+
+#ifndef _FILE_PRESENTER_H_
+#define _FILE_PRESENTER_H_
+
+#include <wx/wx.h>
+
+#include "PanelProvider.h"
+#include "CoreIntf.h"
+
+namespace Browser {
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+class FilePresenter : public BObject, public PanelReciever {
+    DECLARE_BOBJECT_CLASS(FilePresenter, BObject)
+
+protected:
+    Slot<IFile>* _fileSlot;
+    Pin<IPanelReciever>* _panelRecieverPin;
+
+    wxBitmap* _bitmap;
+    wxPanel* _bmpPanel;
+
+public:
+    ASSIGN_GUID("CoreObjects", 1)
+
+    PINS_DECL
+    SLOTS_DECL
+
+    virtual std::string getPanelTitle();
+    virtual void panelActivate(wxPanel* panel);
+    virtual void panelDeactivate();
+
+    IPanelRecieverImpl* getPanelRecieverImpl();
+};
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+} // namespace Browser
+
+#endif //_FILE_PRESENTER_H_


Property changes on: scummex/branches/gsoc2007-gameresbrowser/src/gui/FilePresenter.h
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Added: scummex/branches/gsoc2007-gameresbrowser/src/gui/ImagePresenter.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/gui/ImagePresenter.cpp	                        (rev 0)
+++ scummex/branches/gsoc2007-gameresbrowser/src/gui/ImagePresenter.cpp	2007-07-03 00:07:28 UTC (rev 27876)
@@ -0,0 +1,84 @@
+/////////////////////////////////////////////////////////////////////////////
+// ImagePresenter.cpp
+
+#include "wx/wxprec.h"
+
+#if defined(__BORLANDC__)
+#pragma hdrstop
+#endif
+
+#include "ImagePresenter.h"
+
+#include "GUIIntf.h"
+#include "BitmapPanel.h"
+
+#include <iostream>
+
+#include "debugmem.h"
+
+namespace Browser {
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+PIN_DESCS_EX(ImagePresenter)
+    PIN_DESC_r(_panelRecieverPin, PIN_DEFAULT, getPanelRecieverImpl, IPanelRecieverImpl)
+END_DESCS
+
+SLOT_DESCS_EX(ImagePresenter)
+    SLOT_DESC(_imageSlot, SLOT_DEFAULT)
+END_DESCS
+
+IPanelRecieverImpl* ImagePresenter::getPanelRecieverImpl() {
+    //std::cout << "ImagePresenter::getPanelRecieverImpl(): " << std::endl;
+    return new IPanelRecieverImpl(this);
+}
+
+
+ImagePresenter::ImagePresenter()
+: _bitmap(NULL), _bmpPanel(NULL) {}
+
+ImagePresenter::~ImagePresenter() {
+    if(_bitmap)
+        delete _bitmap;
+}
+
+std::string ImagePresenter::getPanelTitle() {
+    return "Image";
+}
+
+void ImagePresenter::panelActivate(wxPanel* panel) {
+    std::cout << "ImagePresenter::panelActivate()" << std::endl;
+
+    if(!_bitmap) {
+        IImage* iimage = _imageSlot->getInterface();
+        if(!iimage) {
+            std::cout << "  -- could not get IImage interface" << std::endl;
+            return;
+        }
+
+        //std::cout << "  -- bitmap: " << bitmap->getBitmap() << std::endl;
+        _bitmap = new wxBitmap(*iimage->getImage());
+        _imageSlot->releaseInterface();
+    }
+
+    _bmpPanel = new BitmapPanel(panel,*_bitmap);
+
+    /*wxSizer* sizer = panel->GetSizer();
+    sizer->Add(bmpPanel, 1, wxALL, 3);
+    sizer->Layout();*/
+}
+
+void ImagePresenter::panelDeactivate() {
+    std::cout << "ImagePresenter::panelDeactivate()" << std::endl;
+
+    if(_bmpPanel) {
+        _bmpPanel->Destroy();
+        _bmpPanel = NULL;
+    }
+}
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+} // namespace Browser


Property changes on: scummex/branches/gsoc2007-gameresbrowser/src/gui/ImagePresenter.cpp
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Modified: scummex/branches/gsoc2007-gameresbrowser/src/gui/ImagePresenter.h
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/gui/ImagePresenter.h	2007-07-02 23:02:54 UTC (rev 27875)
+++ scummex/branches/gsoc2007-gameresbrowser/src/gui/ImagePresenter.h	2007-07-03 00:07:28 UTC (rev 27876)
@@ -4,90 +4,40 @@
 #ifndef _IMAGE_PRESENTER_H_
 #define _IMAGE_PRESENTER_H_
 
-#include "wx/wxprec.h"
-
-#if defined(__BORLANDC__)
-#pragma hdrstop
-#endif
-
-#ifndef WX_PRECOMP
 #include <wx/wx.h>
-#include <wx/dialog.h>
-#endif
 
-#include "BMPParser.h"  //for now - for IImage
-#include "BitmapPanel.h"  //for now - for IImage
-#include "ExplorationTree.h"  //for now - for IImage
+#include "PanelProvider.h"
+#include "GUIIntf.h"
 
-#include <iostream>
-
 namespace Browser {
 
 /////////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////////
 
-class ImagePresenter : public BObject {
+class ImagePresenter : public BObject, public PanelReciever {
     DECLARE_BOBJECT_CLASS(ImagePresenter, BObject)
 
 protected:
     Slot<IImage>* _imageSlot;
+    Pin<IPanelReciever>* _panelRecieverPin;
 
-    //wxPanel* _targetPanel;
     wxBitmap* _bitmap;
+    wxPanel* _bmpPanel;
 
 public:
     ASSIGN_GUID("CoreObjects", 1)
 
-    SLOT_DESCS
-        SLOT_DESC(_imageSlot, SLOT_DEFAULT)
-    END_DESCS
+    PINS_DECL
+    SLOTS_DECL
 
-    ImagePresenter()
-    : _bitmap(NULL) {}
+    ImagePresenter();
+    ~ImagePresenter();
 
-    ~ImagePresenter() {
-        //_targetPanel->SetBackground(wxNullBitmap);
-        if(_bitmap)
-            delete _bitmap;
-    }
+    virtual std::string getPanelTitle();
+    virtual void panelActivate(wxPanel* panel);
+    virtual void panelDeactivate();
 
-    virtual bool realize(ObjectChain* ochain) {
-        std::cout << "ImagePresenter::realize()" << std::endl;
-
-        bool res = BObject::realize(ochain);
-        if (!res)
-            return false;
-
-        wxPanel* _targetPanel = MainPanel::get();
-
-        if(!_bitmap) {
-            IImage* iimage = _imageSlot->getInterface();
-            if(!iimage) {
-                std::cout << "  -- could not get IImage interface" << std::endl;
-                unrealize(ochain);
-                return false;
-            }
-
-            //std::cout << "  -- bitmap: " << bitmap->getBitmap() << std::endl;
-            _bitmap = new wxBitmap(*iimage->getImage());
-            _imageSlot->releaseInterface();
-        }
-        //_targetPanel->SetBackground(_bitmap);
-        //_targetPanel->SetBackgroundColour(wxTheColourDatabase->Find("RED"));
-        wxSizer* sizer = _targetPanel->GetSizer();
-        BitmapPanel* bmpPanel = new BitmapPanel(_targetPanel,*_bitmap);
-        sizer->Add(bmpPanel, 1, wxALL, 3);
-        sizer->Layout();
-
-        return true;
-    }
-
-    virtual void unrealize(ObjectChain* ochain) {
-        if(!isRealized(ochain))
-            return;
-
-        BObject::unrealize(ochain);
-    }
+    IPanelRecieverImpl* getPanelRecieverImpl();
 };
 
 /////////////////////////////////////////////////////////////////////////////

Modified: scummex/branches/gsoc2007-gameresbrowser/src/gui/MainForm.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/gui/MainForm.cpp	2007-07-02 23:02:54 UTC (rev 27875)
+++ scummex/branches/gsoc2007-gameresbrowser/src/gui/MainForm.cpp	2007-07-03 00:07:28 UTC (rev 27876)
@@ -22,10 +22,6 @@
 
 using namespace Browser;
 
-ExplorationTree* ExplorationTree::_instance = NULL;
-wxPanel* MainPanel::_mainPanel = NULL;
-
-
 //Do not add custom headers between
 //Header Include Start and Header Include End
 //wxDev-C++ designer will remove them
@@ -46,6 +42,9 @@
 	EVT_MENU(wxID_EXIT, MainForm::OnExit)
 	EVT_MENU(ID_TEST1, MainForm::OnTest1)
 	EVT_MENU(ID_TEST1_CLEANUP, MainForm::OnTest1Cleanup)
+	
+	EVT_TREE_ITEM_ACTIVATED(ID_BROWSERTREE,MainForm::browserTreeItemActivated)
+	EVT_TREE_ITEM_EXPANDING(ID_BROWSERTREE,MainForm::browserTreeItemExpanding)
 END_EVENT_TABLE()
 ////Event Table End
 
@@ -59,8 +58,8 @@
     mainPanel->SetSize( wxSize(400, 300) );
     Layout();
 
-    ExplorationTree::initialize(browserTree);
-    MainPanel::setMainPanel(mainPanel);
+    ExplorationTree::initialize(browserTree, browserNotebook);
+    //MainPanel::setMainPanel(mainPanel);
 }
 
 MainForm::~MainForm()
@@ -84,6 +83,12 @@
 	WxSplitterWindow1->SetFont(wxFont(8, wxSWISS, wxNORMAL,wxNORMAL, false, wxT("Tahoma")));
 	WxBoxSizer1->Add(WxSplitterWindow1,1,wxALIGN_CENTER | wxEXPAND | wxALL,0);
 
+	browserTree = new wxTreeCtrl(WxSplitterWindow1, ID_BROWSERTREE, wxPoint(5,5), wxSize(185,382), wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT);
+	browserTree->SetFont(wxFont(8, wxSWISS, wxNORMAL,wxNORMAL, false, wxT("Tahoma")));
+
+	mainPanel = new wxPanel(WxSplitterWindow1, ID_MAINPANEL, wxPoint(200,8), wxSize(363,376));
+	mainPanel->SetFont(wxFont(8, wxSWISS, wxNORMAL,wxNORMAL, false, wxT("Tahoma")));
+
 	WxMenuBar1 = new wxMenuBar();
 	wxMenu *ID_FILE_MENU_Mnu_Obj = new wxMenu(0);
 	ID_FILE_MENU_Mnu_Obj->Append(ID_OPEN, wxT("Open..."), wxT(""), wxITEM_NORMAL);
@@ -98,16 +103,14 @@
 	WxMenuBar1->Append(ID_EDIT_MENU_Mnu_Obj, wxT("Edit"));
 	SetMenuBar(WxMenuBar1);
 
-	browserTree = new wxTreeCtrl(WxSplitterWindow1, ID_BROWSERTREE, wxPoint(5,5), wxSize(185,382), wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT);
-	browserTree->SetFont(wxFont(8, wxSWISS, wxNORMAL,wxNORMAL, false, wxT("Tahoma")));
-
-	mainPanel = new wxPanel(WxSplitterWindow1, ID_MAINPANEL, wxPoint(200,8), wxSize(363,376));
-	mainPanel->SetFont(wxFont(8, wxSWISS, wxNORMAL,wxNORMAL, false, wxT("Tahoma")));
-
-	WxBoxSizer2 = new wxBoxSizer(wxVERTICAL);
+	WxBoxSizer2 = new wxBoxSizer(wxHORIZONTAL);
 	mainPanel->SetSizer(WxBoxSizer2);
 	mainPanel->SetAutoLayout(true);
 
+	browserNotebook = new wxNotebook(mainPanel, ID_BROWSERNOTEBOOK, wxPoint(34,45),wxSize(309,337));
+	browserNotebook->SetFont(wxFont(8, wxSWISS, wxNORMAL,wxNORMAL, false, wxT("Tahoma")));
+	WxBoxSizer2->Add(browserNotebook,1,wxEXPAND | wxALL,5);
+
 	WxSplitterWindow1->SplitVertically(browserTree,mainPanel,329);
 
 	SetTitle(wxT("Game Resource Browser"));
@@ -133,3 +136,19 @@
 {
 	Close(true);
 }
+
+/*
+ * browserTreeItemActivated
+ */
+void MainForm::browserTreeItemActivated(wxTreeEvent& event)
+{
+    ExplorationTree::get()->itemActivated(event.GetItem());
+}
+
+/*
+ * browserTreeItemExpanding
+ */
+void MainForm::browserTreeItemExpanding(wxTreeEvent& event)
+{
+    ExplorationTree::get()->itemExpanded(event.GetItem());
+}

Modified: scummex/branches/gsoc2007-gameresbrowser/src/gui/MainForm.h
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/gui/MainForm.h	2007-07-02 23:02:54 UTC (rev 27875)
+++ scummex/branches/gsoc2007-gameresbrowser/src/gui/MainForm.h	2007-07-03 00:07:28 UTC (rev 27876)
@@ -25,9 +25,10 @@
 //Header Include Start and Header Include End.
 //wxDev-C++ designer will remove them. Add custom headers after the block.
 ////Header Include Start
+#include <wx/notebook.h>
+#include <wx/menu.h>
 #include <wx/panel.h>
 #include <wx/treectrl.h>
-#include <wx/menu.h>
 #include <wx/splitter.h>
 #include <wx/sizer.h>
 ////Header Include End
@@ -45,19 +46,22 @@
 	public:
 		MainForm(wxWindow *parent, wxWindowID id = 1, const wxString &title = wxT("Game Resource Browser"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = MainForm_STYLE);
 		virtual ~MainForm();
-	void ExitClick(wxCommandEvent& event);
-	void OnTest1Cleanup(wxCommandEvent& event);
-	void OnTest1(wxCommandEvent& event);
+	    void ExitClick(wxCommandEvent& event);
+	    void OnTest1Cleanup(wxCommandEvent& event);
+	    void OnTest1(wxCommandEvent& event);
+		void browserTreeItemActivated(wxTreeEvent& event);
+		void browserTreeItemExpanding(wxTreeEvent& event);
 		
 	private:
 		//Do not add custom control declarations between
 		//GUI Control Declaration Start and GUI Control Declaration End.
 		//wxDev-C++ will remove them. Add custom code after the block.
 		////GUI Control Declaration Start
+		wxNotebook *browserNotebook;
 		wxBoxSizer *WxBoxSizer2;
+		wxMenuBar *WxMenuBar1;
 		wxPanel *mainPanel;
 		wxTreeCtrl *browserTree;
-		wxMenuBar *WxMenuBar1;
 		wxSplitterWindow *WxSplitterWindow1;
 		wxBoxSizer *WxBoxSizer1;
 		////GUI Control Declaration End
@@ -70,14 +74,15 @@
 		enum
 		{
 			////GUI Enum Control ID Start
-			ID_MAINPANEL = 1017,
-			ID_BROWSERTREE = 1016,
+			ID_BROWSERNOTEBOOK = 1021,
 			ID_FILE_MENU = 1004,
 			ID_OPEN = 1005,
 			ID_EDIT_MENU = 1010,
 			ID_TEST1 = 1011,
 			ID_TEST1_CLEANUP = 1012,
 			
+			ID_MAINPANEL = 1017,
+			ID_BROWSERTREE = 1016,
 			ID_WXSPLITTERWINDOW1 = 1014,
 			////GUI Enum Control ID End
 			ID_DUMMY_VALUE_ //don't remove this value unless you have other enum values

Modified: scummex/branches/gsoc2007-gameresbrowser/src/gui/MainForm.wxform
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/gui/MainForm.wxform	2007-07-02 23:02:54 UTC (rev 27875)
+++ scummex/branches/gsoc2007-gameresbrowser/src/gui/MainForm.wxform	2007-07-03 00:07:28 UTC (rev 27876)
@@ -1,6 +1,6 @@
 object frmNewForm: TfrmNewForm
-  Left = 13
-  Top = 15
+  Left = 8
+  Top = 8
   AutoScroll = False
   BorderIcons = [biSystemMenu, biMinimize]
   Caption = 'Game Resource Browser'
@@ -70,6 +70,8 @@
         Height = 382
         Indent = 19
         TabOrder = 0
+        EVT_TREE_ITEM_ACTIVATED = 'browserTreeItemActivated'
+        EVT_TREE_ITEM_EXPANDING = 'browserTreeItemExpanding'
         Wx_BGColor = clBlack
         Wx_Class = 'wxTreeCtrl'
         Wx_ControlOrientation = wxControlHorizontal
@@ -108,13 +110,30 @@
           Height = 374
           Align = alClient
           TabOrder = 0
-          Orientation = wxVertical
           Wx_Class = 'wxBoxSizer'
           Wx_ControlOrientation = wxControlVertical
           Wx_IDName = 'ID_WXBOXSIZER2'
-          Wx_IDValue = 1018
-          Wx_Alignment = [wxALIGN_CENTER, wxEXPAND]
-          Wx_StretchFactor = 1
+          Wx_IDValue = 1020
+          object browserNotebook: TWxNotebook
+            Left = 34
+            Top = 45
+            Width = 309
+            Height = 337
+            TabOrder = 0
+            Wx_Class = 'wxNotebook'
+            Wx_ControlOrientation = wxControlVertical
+            Wx_EventList.Strings = (
+              'EVT_UPDATE_UI:OnUpdateUI'
+              'EVT_NOTEBOOK_PAGE_CHANGED:OnPageChanged'
+              'EVT_NOTEBOOK_PAGE_CHANGING:OnPageChanging')
+            Wx_IDName = 'ID_BROWSERNOTEBOOK'
+            Wx_IDValue = 1021
+            Wx_Hidden = False
+            Wx_NoteBookStyle = []
+            Wx_GeneralStyle = []
+            Wx_Alignment = [wxEXPAND]
+            Wx_StretchFactor = 1
+          end
         end
       end
     end

Added: scummex/branches/gsoc2007-gameresbrowser/src/gui/PanelProvider.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/gui/PanelProvider.cpp	                        (rev 0)
+++ scummex/branches/gsoc2007-gameresbrowser/src/gui/PanelProvider.cpp	2007-07-03 00:07:28 UTC (rev 27876)
@@ -0,0 +1,69 @@
+/////////////////////////////////////////////////////////////////////////////
+// PanelProvider.cpp
+
+#include "wx/wxprec.h"
+
+#if defined(__BORLANDC__)
+#pragma hdrstop
+#endif
+
+#include "PanelProvider.h"
+#include "ExplorationTree.h"
+
+#include <iostream>
+
+#include "debugmem.h"
+
+namespace Browser {
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+SLOT_DESCS_EX(PanelProvider)
+    SLOT_DESC(_panelRecieverSlot, SLOT_DEFAULT)
+    SLOT_DESC(_nodeSlot, SLOT_DEFAULT)
+END_DESCS
+
+bool PanelProvider::realize(ObjectChain* ochain) {
+    bool res = BObject::realize(ochain);
+    if (!res)
+        return false;
+
+    _ipanelreciever = _panelRecieverSlot->getInterface();
+    _inodeprovider = _nodeSlot->getInterface();
+    if (!_ipanelreciever || !_inodeprovider) {
+        unrealize(ochain);
+        return false;
+    }
+
+    ExplorationTree::get()->registerPanelProvider(_inodeprovider->getNode(), this);
+
+    return true;
+}
+
+void PanelProvider::unrealize(ObjectChain* ochain) {
+    if(!isRealized(ochain))
+        return;
+
+    ExplorationTree::get()->unregisterPanelProvider(this);
+
+    _panelRecieverSlot->releaseInterface();
+    _nodeSlot->releaseInterface();
+
+    BObject::unrealize(ochain);
+}
+
+std::string PanelProvider::getPanelTitle() {
+    return _ipanelreciever->getPanelTitle();
+}
+void PanelProvider::panelActivate(wxPanel* panel) {
+    _ipanelreciever->panelActivate(panel);
+}
+void PanelProvider::panelDeactivate() {
+    _ipanelreciever->panelDeactivate();
+}
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+}


Property changes on: scummex/branches/gsoc2007-gameresbrowser/src/gui/PanelProvider.cpp
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Added: scummex/branches/gsoc2007-gameresbrowser/src/gui/PanelProvider.h
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/gui/PanelProvider.h	                        (rev 0)
+++ scummex/branches/gsoc2007-gameresbrowser/src/gui/PanelProvider.h	2007-07-03 00:07:28 UTC (rev 27876)
@@ -0,0 +1,89 @@
+/////////////////////////////////////////////////////////////////////////////
+// PanelProvider.h
+
+#ifndef _PANEL_PROVIDER_H_
+#define _PANEL_PROVIDER_H_
+
+#include <wx/wx.h>
+
+#include "pinslot.h"
+#include "VirtualNode.h"
+
+namespace Browser {
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+class PanelReciever {
+public:
+    virtual std::string getPanelTitle() = 0;
+    virtual void panelActivate(wxPanel* panel) = 0;
+    virtual void panelDeactivate() = 0;
+};
+
+class IPanelReciever : public IInterface, public PanelReciever {
+public:
+    GUID_FOR(IPanelReciever, "CoreInterfaces", 1);
+};
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+//IPanelRecieverImpl delegates method invocations to the apropraiate PanelReciever (_that)
+class IPanelRecieverImpl : public IPanelReciever {
+protected:
+    PanelReciever* _that;
+public:
+    //inherit guid - it's a concrete implementation of an abstract interface
+    IPanelRecieverImpl(PanelReciever* that)
+        : _that(that) {}
+    virtual std::string getPanelTitle() {
+        return _that->getPanelTitle();
+    }
+    virtual void panelActivate(wxPanel* panel) {
+        _that->panelActivate(panel);
+    }
+    virtual void panelDeactivate() {
+        _that->panelDeactivate();
+    }
+    void release() {
+        delete this;
+    }
+};
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+// How the PanelProvider works:
+//  PanelProvider registers itself in ExplorationTree.
+//  PanelProvider is then delegating PanelReciever methods from ExplorationTree,
+//  via IPanelReciever slot, to the proper object.
+
+class PanelProvider : public BObject, public PanelReciever {
+    DECLARE_BOBJECT_CLASS(PanelProvider, BObject)
+
+protected:
+    Slot<IPanelReciever>* _panelRecieverSlot;
+    Slot<INodeProvider>* _nodeSlot;
+
+    IPanelReciever* _ipanelreciever;
+    INodeProvider* _inodeprovider;
+public:
+    ASSIGN_GUID("CoreObjects", 1)
+
+    SLOTS_DECL
+
+    virtual bool realize(ObjectChain* ochain);
+    virtual void unrealize(ObjectChain* ochain);
+
+    virtual std::string getPanelTitle();
+    virtual void panelActivate(wxPanel* panel);
+    virtual void panelDeactivate();
+};
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+}
+
+#endif //_PANEL_PROVIDER_H_


Property changes on: scummex/branches/gsoc2007-gameresbrowser/src/gui/PanelProvider.h
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Modified: scummex/branches/gsoc2007-gameresbrowser/src/gui/Test1.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/gui/Test1.cpp	2007-07-02 23:02:54 UTC (rev 27875)
+++ scummex/branches/gsoc2007-gameresbrowser/src/gui/Test1.cpp	2007-07-03 00:07:28 UTC (rev 27876)
@@ -16,11 +16,15 @@
 #include "MainForm.h"
 
 #include "plugin.h"
+#include "oregistry.h"
 
 #include "ExplorationTree.h"
 #include "VirtualNode.h"
+
+#include "DirectoryPresenter.h"
 #include "BMPParser.h"
 #include "ImagePresenter.h"
+#include "PanelProvider.h"
 
 #include "debugmem.h"
 
@@ -34,6 +38,7 @@
     PLUGGED_OBJECT(DirectoryPresenter)
     PLUGGED_OBJECT(BMPParser)
     PLUGGED_OBJECT(ImagePresenter)
+    PLUGGED_OBJECT(PanelProvider)
 PLUGIN_END_EX(Test1Plugin)
 
 /////////////////////////////////////////////////////////////////////////////
@@ -47,6 +52,8 @@
 
 void MainForm::OnTest1(wxCommandEvent& event)
 {
+    OnTest1Cleanup(event);
+
     wxTreeItemId rootItem = ExplorationTree::_getTree()->
         AddRoot(_T("RootDirectory"), -1, -1, NULL);
 
@@ -70,6 +77,7 @@
     //rootChain->addObject(pres);
 
     rootChain->complete();
+
     bool res = rootChain->realize();
 
     if (!res) {

Modified: scummex/branches/gsoc2007-gameresbrowser/src/gui/VirtualNode.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/gui/VirtualNode.cpp	2007-07-02 23:02:54 UTC (rev 27875)
+++ scummex/branches/gsoc2007-gameresbrowser/src/gui/VirtualNode.cpp	2007-07-03 00:07:28 UTC (rev 27876)
@@ -43,7 +43,7 @@
 
 
 PIN_DESCS_EX(VirtualNode)
-    PIN_DESC(_nodePin, 0, getNodeProviderImpl, releaseNodeProviderImpl)
+    PIN_DESC(_nodePin, PIN_MULTICAST, getNodeProviderImpl, releaseNodeProviderImpl)
 END_DESCS
 
 INodeProviderImpl* VirtualNode::getNodeProviderImpl() {
@@ -77,7 +77,7 @@
 /////////////////////////////////////////////////////////////////////////////
 
 PIN_DESCS_EX(RootDirectory)
-    PIN_DESC(_directoryPin, PIN_DEFAULT, getDirectoryImpl, releaseDirectoryImpl)
+    PIN_DESC(_directoryPin, PIN_DEFAULT | PIN_MULTICAST, getDirectoryImpl, releaseDirectoryImpl)
 END_DESCS
 
 bool RootDirectory::addFile(std::string name, std::string fullpath) {
@@ -123,89 +123,4 @@
 /////////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////////
 
-bool DirectoryPresenter::realize(ObjectChain* ochain) {
-    bool res = BObject::realize(ochain);
-    if (!res)
-        return false;
-
-    _idirectory = _directorySlot->getInterface();
-    _inodeprovider = _nodeSlot->getInterface();
-    if (!_idirectory || !_inodeprovider) {
-        _directorySlot->releaseInterface();
-        _nodeSlot->releaseInterface();
-        _realized = false;
-        return false;
-    }
-
-    VirtualNode* parent = _inodeprovider->getNode();
-    ExplorationTree::_getTree()->SetItemHasChildren(parent->getTreeItem(), true);
-
-    const std::list<IFile*>& files = _idirectory->getFiles();
-    std::list<IFile*>::const_iterator i;
-    for (i = files.begin(); i != files.end(); ++i) {
-        IFile* ifile = *i;
-
-        wxTreeItemId kidTreeItem = ExplorationTree::_getTree()->
-            AppendItem(parent->getTreeItem(),
-                       wxString(ifile->getName().c_str(), wxConvUTF8),
-                       -1, -1, NULL);
-
-        RCPtr<VirtualFile> virtualFile( new VirtualFile(kidTreeItem, ifile) );
-
-        ExplorationTree::_getTree()->SetItemData(kidTreeItem,
-            new VirtualNodeItemData( virtualFile.get() ) );
-
-        ObjectChain* kidchain = new ObjectChain();
-
-        if ( !kidchain->addObject(virtualFile) ) {
-            delete kidchain;
-            //virtualFile is deleted automatically
-            continue;
-        }
-
-        _kidChains.push_back( kidchain );
-    }
-
-    if (!realizeKidChains()) {
-        unrealize(ochain);
-        return false;
-    }
-
-    return true;
 }
-
-bool DirectoryPresenter::realizeKidChains() {
-    bool res = true;
-    std::list<ObjectChain*>::const_iterator i;
-    for (i = _kidChains.begin(); i != _kidChains.end(); ++i) {
-        ObjectChain* kidchain = *i;
-        kidchain->complete();
-        res &= kidchain->realize();
-    }
-    return res;
-}
-
-void DirectoryPresenter::unrealize(ObjectChain* ochain) {
-    if(!isRealized(ochain))
-        return;
-
-    VirtualNode* parent = _inodeprovider->getNode();
-    ExplorationTree::_getTree()->DeleteChildren( parent->getTreeItem() );
-
-    std::list<ObjectChain*>::const_iterator i;
-    for (i = _kidChains.begin(); i != _kidChains.end(); ++i) {
-        ObjectChain* kidchain = *i;
-        delete kidchain; //unrealize
-    }
-    _kidChains.clear();
-
-    _directorySlot->releaseInterface();
-    _nodeSlot->releaseInterface();
-
-    BObject::unrealize(ochain);
-}
-
-/////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////
-
-}

Modified: scummex/branches/gsoc2007-gameresbrowser/src/gui/VirtualNode.h
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/gui/VirtualNode.h	2007-07-02 23:02:54 UTC (rev 27875)
+++ scummex/branches/gsoc2007-gameresbrowser/src/gui/VirtualNode.h	2007-07-03 00:07:28 UTC (rev 27876)
@@ -4,23 +4,11 @@
 #ifndef _VIRTUAL_NODE_H_
 #define _VIRTUAL_NODE_H_
 
-#include "wx/wxprec.h"
-
-#if defined(__BORLANDC__)
-#pragma hdrstop
-#endif
-
-#ifndef WX_PRECOMP
-#include <wx/wx.h>
-#include <wx/dialog.h>
-#endif
-
-#include <wx/treectrl.h>
-
 #include "pinslot.h"
-#include "DiskFileProvider.h" //temporary - for IFile
-#include "ExplorationTree.h" //temporary - for IFile
 
+#include "CoreIntf.h"
+#include "ExplorationTree.h"
+
 #include <list>
 
 namespace Browser {
@@ -39,10 +27,12 @@
     //virtual ~VirtualNodeItemData() {}
 
     static VirtualNode* getNode(const wxTreeItemId& item) {
-        if(!item.IsOk())
+        if (!item.IsOk())
             return NULL;
         VirtualNodeItemData* data = static_cast<VirtualNodeItemData*>
             (ExplorationTree::_getTree()->GetItemData(item));
+        if (!data)
+            return NULL;
         return data->_node;
     }
 };
@@ -137,15 +127,6 @@
 /////////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////////
 
-class IDirectory : public IInterface {
-public:
-    GUID_FOR(IDirectory, "CoreInterfaces", 1);
-    virtual const std::list<IFile*>& getFiles() = 0;
-};
-
-/////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////
-
 class IDirectoryImpl;
 
 class RootDirectory : public VirtualNode {
@@ -175,34 +156,6 @@
 /////////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////////
 
-class DirectoryPresenter : public BObject {
-    DECLARE_BOBJECT_CLASS(DirectoryPresenter, BObject)
-
-protected:
-    Slot<IDirectory>* _directorySlot;
-    Slot<INodeProvider>* _nodeSlot;
-
-    IDirectory* _idirectory;
-    INodeProvider* _inodeprovider;
-    std::list<ObjectChain*> _kidChains;
-
-public:
-    ASSIGN_GUID("CoreObjects", 1)
-
-    SLOT_DESCS
-        SLOT_DESC(_directorySlot, SLOT_DEFAULT)
-        SLOT_DESC(_nodeSlot, SLOT_DEFAULT)
-    END_DESCS
-
-    virtual bool realize(ObjectChain* ochain);
-    virtual bool realizeKidChains();
-    virtual void unrealize(ObjectChain* ochain);
-
-};
-
-/////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////
-
 }
 
 #endif //_VIRTUAL_NODE_H_

Modified: scummex/branches/gsoc2007-gameresbrowser/src/plugins/BMPParser.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/BMPParser.cpp	2007-07-02 23:02:54 UTC (rev 27875)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/BMPParser.cpp	2007-07-03 00:07:28 UTC (rev 27876)
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// DiskFileProvider.cpp
+// BMPParser.cpp
 
 #include "stdafx.h"
 
@@ -7,6 +7,7 @@
 
 #include <iostream>
 
+#include "wx/image.h"
 #include "wx2scstream.h"
 
 #include "debugmem.h"
@@ -15,31 +16,7 @@
 
 /////////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////////
-// Concrete implementations of the interfaces
 
-class IImageImpl : public IImage {
-protected:
-    wxImage* _image;
-    bool _ownImage;
-public:
-    //inherit guid - it's a concrete implementation of an abstract interface
-    IImageImpl(wxImage* image, bool ownImage = false)
-        : _image(image), _ownImage(ownImage) {}
-
-    virtual wxImage* getImage() {
-        std::cout << "IImageImpl::getImage()" << std::endl;
-        return _image;
-    }
-
-    virtual ~IImageImpl() {
-        if(_ownImage)
-            delete _image;
-    }
-};
-
-/////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////
-
 SLOT_DESCS_EX(BMPParser)
     SLOT_DESC(_fileSlot, SLOT_DEFAULT)
 END_DESCS
@@ -55,6 +32,7 @@
     if(!ifile)
         return NULL;
     
+    ifile->getStream()->seek(0, SEEK_SET);
     wxInputStream* input = new wxScummInputStream(ifile->getStream());
 
     wxImage* image = new wxImage();

Modified: scummex/branches/gsoc2007-gameresbrowser/src/plugins/BMPParser.h
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/BMPParser.h	2007-07-02 23:02:54 UTC (rev 27875)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/BMPParser.h	2007-07-03 00:07:28 UTC (rev 27876)
@@ -4,29 +4,16 @@
 #ifndef _BMPPARSER_H_
 #define _BMPPARSER_H_
 
-#include "stdafx.h"
+#include "pinslot.h"
 
-#include "wx/image.h"
+#include "GUIIntf.h"
+#include "CoreIntf.h"
 
-#include "DiskFileProvider.h"  //for now - just for IFile and SeekableReadStream
-
 namespace Browser {
 
 /////////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////////
-// Interfaces
 
-class IImage : public IInterface {
-public:
-    GUID_FOR(IImage, "Generic", 1)
-    virtual wxImage* getImage() = 0;
-};
-
-/////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////
-
-class IImageImpl;
-
 class BMPParser : public BObject {
     DECLARE_BOBJECT_CLASS(BMPParser, BObject)
 

Modified: scummex/branches/gsoc2007-gameresbrowser/src/plugins/BitmapPanel.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/BitmapPanel.cpp	2007-07-02 23:02:54 UTC (rev 27875)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/BitmapPanel.cpp	2007-07-03 00:07:28 UTC (rev 27876)
@@ -14,10 +14,31 @@
 /////////////////////////////////////////////////////////////////////////////
 
 BEGIN_EVENT_TABLE(BitmapPanel, wxPanel)
+    EVT_PAINT(BitmapPanel::OnPaint)
     //EVT_ERASE_BACKGROUND(BitmapPanel::OnEraseBackground)
-    EVT_PAINT(BitmapPanel::OnPaint)
     //EVT_LEFT_DCLICK(BitmapPanel::OnSave)
 END_EVENT_TABLE()
 
 /////////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////////
+
+BitmapPanel::BitmapPanel(wxPanel *parent, const wxBitmap& bitmap)
+    : wxPanel(parent), _bitmap(bitmap)
+{
+    SetClientSize(bitmap.GetWidth(), bitmap.GetHeight());
+}
+
+void BitmapPanel::OnPaint(wxPaintEvent& WXUNUSED(event))
+{
+    wxPaintDC dc( this );
+    dc.DrawBitmap( _bitmap, 0, 0, true /* use mask */ );
+}
+
+//TODO: draw a checkboard
+/*void BitmapPanel::OnEraseBackground(wxEraseEvent& WXUNUSED(event))
+{
+// do nothing here to be able to see how transparent images are shown
+}*/
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////

Modified: scummex/branches/gsoc2007-gameresbrowser/src/plugins/BitmapPanel.h
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/BitmapPanel.h	2007-07-02 23:02:54 UTC (rev 27875)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/BitmapPanel.h	2007-07-03 00:07:28 UTC (rev 27876)
@@ -23,25 +23,13 @@
 class BitmapPanel : public wxPanel
 {
 public:
-    BitmapPanel(wxPanel *parent, const wxBitmap& bitmap)
-        : wxPanel(parent),
-          _bitmap(bitmap)
-    {
-        SetClientSize(bitmap.GetWidth(), bitmap.GetHeight());
-    }
+    BitmapPanel(wxPanel *parent, const wxBitmap& bitmap);
 
+    void OnPaint(wxPaintEvent& event);
+
     //TODO: draw a checkboard
-    /*void OnEraseBackground(wxEraseEvent& WXUNUSED(event))
-    {
-        // do nothing here to be able to see how transparent images are shown
-    }*/
+    //void OnEraseBackground(wxEraseEvent& event);
 
-    void OnPaint(wxPaintEvent& WXUNUSED(event))
-    {
-        wxPaintDC dc( this );
-        dc.DrawBitmap( _bitmap, 0, 0, true /* use mask */ );
-    }
-
 private:
     wxBitmap _bitmap;
 

Added: scummex/branches/gsoc2007-gameresbrowser/src/plugins/CoreIntf.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/CoreIntf.cpp	                        (rev 0)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/CoreIntf.cpp	2007-07-03 00:07:28 UTC (rev 27876)
@@ -0,0 +1,47 @@
+/////////////////////////////////////////////////////////////////////////////
+// CoreIntf.cpp
+
+#include "stdafx.h"
+
+#include "CoreIntf.h"
+
+#include <iostream>
+
+#include "debugmem.h"
+
+namespace Browser {
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+// Concrete implementations of the interfaces
+
+IStreamImpl::IStreamImpl(Common::SeekableReadStream* stream, bool ownStream /*= false*/)
+    : _stream(stream), _ownStream(ownStream) {}
+
+Common::SeekableReadStream* IStreamImpl::getStream() {
+    std::cout << "IStreamImpl::getStream()" << std::endl;
+    return _stream;
+}
+
+IStreamImpl::~IStreamImpl() {
+    if(_ownStream)
+        delete _stream;
+}
+
+
+IFileImpl::IFileImpl(std::string name, Common::SeekableReadStream* stream, bool ownStream /*= false*/)
+    : _streamImpl(stream,ownStream), _name(name) {}
+
+const std::string& IFileImpl::getName() {
+    std::cout << "IFileImpl::getName() = " << _name << std::endl;
+    return _name;
+}
+
+Common::SeekableReadStream* IFileImpl::getStream() {
+    return _streamImpl.getStream();
+}
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+} // namespace Browser


Property changes on: scummex/branches/gsoc2007-gameresbrowser/src/plugins/CoreIntf.cpp
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Added: scummex/branches/gsoc2007-gameresbrowser/src/plugins/CoreIntf.h
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/CoreIntf.h	                        (rev 0)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/CoreIntf.h	2007-07-03 00:07:28 UTC (rev 27876)
@@ -0,0 +1,72 @@
+/////////////////////////////////////////////////////////////////////////////
+// CoreIntf.h
+
+#ifndef _CORE_INTERFACES_H_
+#define _CORE_INTERFACES_H_
+
+#include "pinslot.h"
+
+#include <list>
+#include "common/stream.h"
+
+namespace Browser {
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+// Interfaces
+
+class IStream : public IInterface {
+public:
+    GUID_FOR(IStream, "CoreInterfaces", 1);
+    virtual Common::SeekableReadStream* getStream() = 0;
+};
+
+class IFile : public IStream {
+public:
+    GUID_FOR(IFile, "CoreInterfaces", 1);
+    virtual const std::string& getName() = 0;
+};
+
+class IDirectory : public IInterface {
+public:
+    GUID_FOR(IDirectory, "CoreInterfaces", 1);
+    virtual const std::list<IFile*>& getFiles() = 0;
+};
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+// Concrete implementations of the interfaces
+
+class IStreamImpl : public IStream {
+protected:
+    Common::SeekableReadStream* _stream;
+    bool _ownStream;
+public:
+    //inherit guid - it's a concrete implementation of an abstract interface
+    IStreamImpl(Common::SeekableReadStream* stream, bool ownStream = false);
+    virtual Common::SeekableReadStream* getStream();
+    virtual ~IStreamImpl();
+};
+
+// Limitation: can't inherit from IFile and IStreamImpl, cause I'll have to inherit
+// virtually from IStream to IStreamImpl and from IStream to IFile. It can't be done,
+// since virtual inheritance disallows casting from virtual base class (here:
+// IInterface) to a derived class (here: IFile).
+// Instead of multiple inheritance - I use encapsulation: _streamImpl member.
+class IFileImpl : public IFile {
+protected:
+    std::string _name;
+    IStreamImpl _streamImpl;
+public:
+    //inherit guid - it's a concrete implementation of an abstract interface
+    IFileImpl(std::string name, Common::SeekableReadStream* stream, bool ownStream = false);
+    virtual const std::string& getName();
+    virtual Common::SeekableReadStream* getStream();
+};
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+} // namespace Browser
+
+#endif // _CORE_INTERFACES_H_


Property changes on: scummex/branches/gsoc2007-gameresbrowser/src/plugins/CoreIntf.h
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Modified: scummex/branches/gsoc2007-gameresbrowser/src/plugins/DiskFileProvider.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/DiskFileProvider.cpp	2007-07-02 23:02:54 UTC (rev 27875)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/DiskFileProvider.cpp	2007-07-03 00:07:28 UTC (rev 27876)
@@ -14,37 +14,7 @@
 
 /////////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////////
-// Concrete implementations of the interfaces
 
-IStreamImpl::IStreamImpl(Common::SeekableReadStream* stream, bool ownStream /*= false*/)
-    : _stream(stream), _ownStream(ownStream) {}
-
-Common::SeekableReadStream* IStreamImpl::getStream() {
-    std::cout << "IStreamImpl::getStream()" << std::endl;
-    return _stream;
-}
-
-IStreamImpl::~IStreamImpl() {
-    if(_ownStream)
-        delete _stream;
-}
-
-
-IFileImpl::IFileImpl(std::string name, Common::SeekableReadStream* stream, bool ownStream /*= false*/)
-    : _streamImpl(stream,ownStream), _name(name) {}
-
-const std::string& IFileImpl::getName() {
-    std::cout << "IFileImpl::getName() = " << _name << std::endl;
-    return _name;
-}
-
-Common::SeekableReadStream* IFileImpl::getStream() {
-    return _streamImpl.getStream();
-}
-
-/////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////
-
 PIN_DESCS_EX(DiskFileProvider)
     PIN_DESC(_filePin, PIN_MULTICAST, getFileImpl, releaseFileImpl)
 END_DESCS

Modified: scummex/branches/gsoc2007-gameresbrowser/src/plugins/DiskFileProvider.h
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/DiskFileProvider.h	2007-07-02 23:02:54 UTC (rev 27875)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/DiskFileProvider.h	2007-07-03 00:07:28 UTC (rev 27876)
@@ -4,33 +4,15 @@
 #ifndef _DISKFILEPROVIDER_H_
 #define _DISKFILEPROVIDER_H_
 
-#include "stdafx.h"
+#include "pinslot.h"
 
-#include "common/stream.h"
+#include "CoreIntf.h"
 
 namespace Browser {
 
 /////////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////////
-// Interfaces
 
-class IStream : public IInterface {
-public:
-    GUID_FOR(IStream, "CoreInterfaces", 1);
-    virtual Common::SeekableReadStream* getStream() = 0;
-};
-
-class IFile : public IStream {
-public:
-    GUID_FOR(IFile, "CoreInterfaces", 1);
-    virtual const std::string& getName() = 0;
-};
-
-/////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////
-
-class IFileImpl;
-
 class DiskFileProvider : public BObject {
     DECLARE_BOBJECT_CLASS(DiskFileProvider, BObject)
 
@@ -59,38 +41,7 @@
 
 /////////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////////
-// Concrete implementations of the interfaces
 
-class IStreamImpl : public IStream {
-protected:
-    Common::SeekableReadStream* _stream;
-    bool _ownStream;
-public:
-    //inherit guid - it's a concrete implementation of an abstract interface
-    IStreamImpl(Common::SeekableReadStream* stream, bool ownStream = false);
-    virtual Common::SeekableReadStream* getStream();
-    virtual ~IStreamImpl();
-};
-
-// Limitation: can't inherit from IFile and IStreamImpl, cause I'll have to inherit
-// virtually from IStream to IStreamImpl and from IStream to IFile. It can't be done,
-// since virtual inheritance disallows casting from virtual base class (here:
-// IInterface) to a derived class (here: IFile).
-// Instead of multiple inheritance - I use encapsulation: _streamImpl member.
-class IFileImpl : public IFile {
-protected:
-    std::string _name;
-    IStreamImpl _streamImpl;
-public:
-    //inherit guid - it's a concrete implementation of an abstract interface
-    IFileImpl(std::string name, Common::SeekableReadStream* stream, bool ownStream = false);
-    virtual const std::string& getName();
-    virtual Common::SeekableReadStream* getStream();
-};
-
-/////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////
-
 } // namespace Browser
 
 #endif // _DISKFILEPROVIDER_H_

Added: scummex/branches/gsoc2007-gameresbrowser/src/plugins/GUIIntf.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/GUIIntf.cpp	                        (rev 0)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/GUIIntf.cpp	2007-07-03 00:07:28 UTC (rev 27876)
@@ -0,0 +1,34 @@
+/////////////////////////////////////////////////////////////////////////////
+// GUIIntf.cpp
+
+#include "stdafx.h"
+
+#include "GUIIntf.h"
+
+#include <iostream>
+
+#include "debugmem.h"
+
+namespace Browser {
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+// Concrete implementations of the interfaces
+
+IImageImpl::IImageImpl(wxImage* image, bool ownImage /*= false*/)
+    : _image(image), _ownImage(ownImage) {}
+
+wxImage* IImageImpl::getImage() {
+    std::cout << "IImageImpl::getImage()" << std::endl;
+    return _image;
+}
+
+IImageImpl::~IImageImpl() {
+    if(_ownImage)
+        delete _image;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+} // namespace Browser


Property changes on: scummex/branches/gsoc2007-gameresbrowser/src/plugins/GUIIntf.cpp
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Added: scummex/branches/gsoc2007-gameresbrowser/src/plugins/GUIIntf.h
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/GUIIntf.h	                        (rev 0)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/GUIIntf.h	2007-07-03 00:07:28 UTC (rev 27876)
@@ -0,0 +1,43 @@
+/////////////////////////////////////////////////////////////////////////////
+// GUIIntf.h
+
+#ifndef _GUI_INTERFACES_H_
+#define _GUI_INTERFACES_H_
+
+#include "pinslot.h"
+
+class wxImage;
+
+namespace Browser {
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+// Interfaces
+
+class IImage : public IInterface {
+public:
+    GUID_FOR(IImage, "GUIInterfaces", 1)
+    virtual wxImage* getImage() = 0;
+};
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+// Concrete implementations of the interfaces
+
+class IImageImpl : public IImage {
+protected:
+    wxImage* _image;
+    bool _ownImage;
+public:
+    //inherit guid - it's a concrete implementation of an abstract interface
+    IImageImpl(wxImage* image, bool ownImage = false);
+    virtual wxImage* getImage();
+    virtual ~IImageImpl();
+};
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+} // namespace Browser
+
+#endif // _GUI_INTERFACES_H_


Property changes on: scummex/branches/gsoc2007-gameresbrowser/src/plugins/GUIIntf.h
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Modified: scummex/branches/gsoc2007-gameresbrowser/vc8/Browser/Browser.vcproj
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/vc8/Browser/Browser.vcproj	2007-07-02 23:02:54 UTC (rev 27875)
+++ scummex/branches/gsoc2007-gameresbrowser/vc8/Browser/Browser.vcproj	2007-07-03 00:07:28 UTC (rev 27876)
@@ -172,14 +172,34 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\src\gui\DirectoryPresenter.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\..\src\gui\ExplorationTree.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\..\src\gui\FilePresenter.cpp"
+				>
+			</File>
+			<File
 				RelativePath="..\..\src\gui\guicon.cpp"
 				>
 			</File>
 			<File
+				RelativePath="..\..\src\gui\ImagePresenter.cpp"
+				>
+			</File>
+			<File
 				RelativePath="..\..\src\gui\MainForm.cpp"
 				>
 			</File>
 			<File
+				RelativePath="..\..\src\gui\PanelProvider.cpp"
+				>
+			</File>
+			<File
 				RelativePath="..\..\src\gui\stdafx.cpp"
 				>
 				<FileConfiguration
@@ -214,10 +234,18 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\src\gui\DirectoryPresenter.h"
+				>
+			</File>
+			<File
 				RelativePath="..\..\src\gui\ExplorationTree.h"
 				>
 			</File>
 			<File
+				RelativePath="..\..\src\gui\FilePresenter.h"
+				>
+			</File>
+			<File
 				RelativePath="..\..\src\gui\guicon.h"
 				>
 			</File>
@@ -230,6 +258,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\src\gui\PanelProvider.h"
+				>
+			</File>
+			<File
 				RelativePath="..\..\src\gui\VirtualNode.h"
 				>
 			</File>

Modified: scummex/branches/gsoc2007-gameresbrowser/vc8/plugins/plugins.vcproj
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/vc8/plugins/plugins.vcproj	2007-07-02 23:02:54 UTC (rev 27875)
+++ scummex/branches/gsoc2007-gameresbrowser/vc8/plugins/plugins.vcproj	2007-07-03 00:07:28 UTC (rev 27876)
@@ -153,10 +153,18 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\src\plugins\CoreIntf.cpp"
+				>
+			</File>
+			<File
 				RelativePath="..\..\src\plugins\DiskFileProvider.cpp"
 				>
 			</File>
 			<File
+				RelativePath="..\..\src\plugins\GUIIntf.cpp"
+				>
+			</File>
+			<File
 				RelativePath="..\..\src\plugins\stdafx.cpp"
 				>
 				<FileConfiguration
@@ -183,10 +191,18 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\src\plugins\CoreIntf.h"
+				>
+			</File>
+			<File
 				RelativePath="..\..\src\plugins\DiskFileProvider.h"
 				>
 			</File>
 			<File
+				RelativePath="..\..\src\plugins\GUIIntf.h"
+				>
+			</File>
+			<File
 				RelativePath="..\..\src\plugins\stdafx.h"
 				>
 			</File>


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