00001
00002
00003 #include "Iguana/Studio/interface/IgDocument.h"
00004 #include "Iguana/Studio/interface/IgDocumentData.h"
00005 #include "Iguana/Studio/interface/IgStudioDriver.h"
00006 #include "Iguana/Studio/interface/IgPage.h"
00007 #include "Iguana/Studio/interface/IgQHSplitterSite.h"
00008 #include "Iguana/Studio/interface/IgQtAppStatusBarService.h"
00009 #include "Iguana/Framework/interface/IgState.h"
00010 #include "Iguana/Framework/interface/IgPluginLoader.h"
00011 #include <qwidget.h>
00012 #undef emit // zap qt macro
00013 #include <classlib/utils/DebugAids.h>
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 IgDocument::IgDocument (IgStudioDriver *parent)
00026 : m_owner (parent),
00027 m_state (new IgState (parent->state ())),
00028
00029
00030
00031
00032 m_window (new IgQHSplitterSite (m_state, parent->mainSite ())),
00033 m_data (new IgDocumentData (m_state, this)),
00034 m_currentPage (0)
00035 {
00036
00037
00038
00039
00040 setName ("IGUANA Visualization");
00041 IgQtSite::selfFrom (m_window)->show ();
00042 }
00043
00044 IgDocument::~IgDocument (void)
00045 {
00046
00047 delete m_window;
00048 delete m_state;
00049 }
00050
00054 IgStudioDriver *
00055 IgDocument::owner (void) const
00056 { return m_owner; }
00057
00058 IgState *
00059 IgDocument::state (void) const
00060 { return m_state; }
00061
00062 IgDocumentData *
00063 IgDocument::data (void) const
00064 { return m_data; }
00065
00069 IgQtSite *
00070 IgDocument::window (void) const
00071 { return m_window; }
00072
00076 void
00077 IgDocument::setName (const std::string &name)
00078 {
00079
00080
00081
00082 m_owner->mainWindow ()->setName (name.c_str ());
00083 m_owner->mainWindow ()->setCaption (name.c_str ());
00084
00085 }
00086
00087 void
00088 IgDocument::addContentProxy (const std::string &name)
00089 {
00090
00091
00092 IgQtAppStatusBarService::get (m_state)
00093 ->setMessage ("Loading " + name + "...");
00094 IgPluginLoader::get (m_state)->load (m_state, "Data/" + name);
00095 }
00096
00097 void
00098 IgDocument::load (const std::string &name, bool prefix )
00099 {
00100
00101
00102 IgQtAppStatusBarService::get (m_state)
00103 ->setMessage ("Loading " + name + (prefix ? "*..." : "..."));
00104 IgPluginLoader::get (m_state)->load (m_state, name, prefix);
00105 }
00106
00107 void
00108 IgDocument::addPage (IgPage *page)
00109 {
00110 ASSERT (page);
00111 m_pageMap.push_back (page);
00112 m_currentPage = page;
00113 }
00114
00115 IgPage *
00116 IgDocument::currentPage (void)
00117 {
00118 return m_currentPage;
00119 }