From 85e58bd658d3b572ed598e0460965d7827f4e901 Mon Sep 17 00:00:00 2001 From: neoraider Date: Tue, 15 Apr 2008 01:04:02 +0000 Subject: zoomedit: * Connected TopView to RenderArea --- src/Instance.cpp | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) (limited to 'src/Instance.cpp') diff --git a/src/Instance.cpp b/src/Instance.cpp index 6d01d99..b54fb32 100644 --- a/src/Instance.cpp +++ b/src/Instance.cpp @@ -17,18 +17,20 @@ * with this program. If not, see . */ +#include "Instance.h" #include #include #include -#include "Instance.h" -#include "Gui/Window.h" -#include "Data/Level.h" +#include +#include +#include +#include namespace ZoomEdit { guint Instance::instances = 0; -Instance::Instance(const Glib::ustring &file) : window(0), levelXml(0), level(0) { +Instance::Instance(const Glib::ustring &file) : window(0), levelXml(0), level(0), view(0) { instances++; #ifdef GLIBMM_EXCEPTIONS_ENABLED @@ -59,6 +61,9 @@ Instance::Instance(const Glib::ustring &file) : window(0), levelXml(0), level(0) window->signal_hide().connect(sigc::mem_fun(this, &Instance::destroy)); + view = new View::TopView(); + window->getRenderArea()->setView(view); + if(file.empty()) createLevel(); else @@ -71,6 +76,9 @@ Instance::~Instance() { if(window) delete window; + if(view) + delete view; + if(level) delete level; @@ -83,8 +91,10 @@ Instance::~Instance() { } void Instance::createLevel() { - if(level) + if(level) { + view->setLevel(0); delete level; + } if(levelXml) delete levelXml; @@ -109,10 +119,13 @@ void Instance::createLevel() { root->add_child("textures"); level = new Data::Level(root); + + view->setLevel(level); } bool Instance::loadLevel(const Glib::ustring &file) { if(level) { + view->setLevel(0); delete level; level = 0; } @@ -131,7 +144,9 @@ bool Instance::loadLevel(const Glib::ustring &file) { level = new Data::Level(doc->get_root_node()); - return (level != 0); + view->setLevel(level); + + return true; } bool Instance::saveLevel(const Glib::ustring &file) { -- cgit v1.2.3