Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

OSGQSceneGraphView_qt.cpp

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002  *                                OpenSG                                     *
00003  *                                                                           *
00004  *                                                                           *
00005  *             Copyright (C) 2000-2002 by the OpenSG Forum                   *
00006  *                                                                           *
00007  *                            www.opensg.org                                 *
00008  *                                                                           *
00009  *   contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de          *
00010  *                                                                           *
00011 \*---------------------------------------------------------------------------*/
00012 /*---------------------------------------------------------------------------*\
00013  *                                License                                    *
00014  *                                                                           *
00015  * This library is free software; you can redistribute it and/or modify it   *
00016  * under the terms of the GNU Library General Public License as published    *
00017  * by the Free Software Foundation, version 2.                               *
00018  *                                                                           *
00019  * This library is distributed in the hope that it will be useful, but       *
00020  * WITHOUT ANY WARRANTY; without even the implied warranty of                *
00021  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         *
00022  * Library General Public License for more details.                          *
00023  *                                                                           *
00024  * You should have received a copy of the GNU Library General Public         *
00025  * License along with this library; if not, write to the Free Software       *
00026  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                 *
00027  *                                                                           *
00028 \*---------------------------------------------------------------------------*/
00029 /*---------------------------------------------------------------------------*\
00030  *                                Changes                                    *
00031  *                                                                           *
00032  *                                                                           *
00033  *                                                                           *
00034  *                                                                           *
00035  *                                                                           *
00036  *                                                                           *
00037 \*---------------------------------------------------------------------------*/
00038 
00039 #include "OSGQSceneGraphView_qt.h"
00040 
00041 #include "OSGQNodeTreeView_qt.h"
00042 #include "OSGQFieldContainerView_qt.h"
00043 #include "OSGQWidgetFunctions.h"
00044 
00045 #include <OSGSimpleAttachments.h>
00046 #include <OSGLog.h>
00047 #include <OSGFieldContainerFactory.h>
00048 #include <OSGThreadManager.h>
00049 
00050 #include <qsplitter.h>
00051 #include <qlayout.h>
00052 #include <qcombobox.h>
00053 #include <qlabel.h>
00054 #include <qlineedit.h>
00055 #include <qpushbutton.h>
00056 #include <qstring.h>
00057 
00058 OSG_USING_NAMESPACE
00059 
00060 #ifdef __sgi
00061 #pragma set woff 1174
00062 #endif
00063 
00064 namespace
00065 {
00066     static Char8 cvsid_cpp[] = "@(#)$Id: OSGQSceneGraphView_qt.cpp,v 1.3 2003/05/11 10:33:26 dirk Exp $";
00067     static Char8 cvsid_hpp[] = OSGQSCENEGRAPHVIEW_HEADER_CVSID;
00068 //    static Char8 cvsid_inl[] = OSGQSCENEGRAPHVIEW_INLINE_CVSID;
00069 }
00070 
00071 #ifdef __sgi
00072 #pragma reset woff 1174
00073 #endif
00074 
00075 QSceneGraphView::QSceneGraphView(QWidget *parent, const char *name)
00076     : Inherited           (parent, name  ),
00077       _pRootFC            (NullFC        ),
00078       _pSelectedFC        (NullFC        ),
00079       _uiAspect           (0             ),
00080       _history            (              ),
00081       _uiMaxHistorySize   (10            ),
00082       _currentHistoryEntry(_history.end()),
00083       _bRestoringHistory  (false         ),
00084       _pGlobalLayout      (NULL          ),
00085       _pSplitter          (NULL          ),
00086       _pVBoxLeft          (NULL          ),
00087       _pCBAspect          (NULL          ),
00088       _pTreeView          (NULL          ),
00089       _pLabelRawAddress   (NULL          ),
00090       _pLERawAddress      (NULL          ),
00091       _pPBUpdate          (NULL          ),
00092       _pHBoxHistoryButtons(NULL          ),
00093       _pPBBackward        (NULL          ),
00094       _pPBForward         (NULL          ),
00095       _pVBoxRight         (NULL          ),
00096       _pFCView            (NULL          ),
00097       _pHBoxFCHeader      (NULL          ),
00098       _pLabelFCName       (NULL          ),
00099       _pPBShowTypeColumn  (NULL          )
00100 {
00101     _uiAspect  = Thread::getCurrent()->getAspect();
00102     _pTreeView = new QNodeTreeView *[ThreadManager::getNumAspects()];
00103 
00104     createChildWidgets();
00105     connectChildWidgets();
00106 }
00107 
00108 QSceneGraphView::QSceneGraphView(const FieldContainerPtr &pRoot,
00109                                        QWidget           *parent, 
00110                                  const char              *name)
00111     : Inherited           (parent, name  ),
00112       _pRootFC            (NullFC        ),
00113       _pSelectedFC        (NullFC        ),
00114       _uiAspect           (0             ),
00115       _history            (              ),
00116       _uiMaxHistorySize   (10            ),
00117       _currentHistoryEntry(_history.end()),
00118       _bRestoringHistory  (false         ),
00119       _pGlobalLayout      (NULL          ),
00120       _pSplitter          (NULL          ),
00121       _pVBoxLeft          (NULL          ),
00122       _pCBAspect          (NULL          ),
00123       _pTreeView          (NULL          ),
00124       _pLabelRawAddress   (NULL          ),
00125       _pLERawAddress      (NULL          ),
00126       _pPBUpdate          (NULL          ),
00127       _pHBoxHistoryButtons(NULL          ),
00128       _pPBBackward        (NULL          ),
00129       _pPBForward         (NULL          ),
00130       _pVBoxRight         (NULL          ),
00131       _pFCView            (NULL          ),
00132       _pHBoxFCHeader      (NULL          ),
00133       _pLabelFCName       (NULL          ),
00134       _pPBShowTypeColumn  (NULL          )
00135 {
00136     _uiAspect  = Thread::getCurrent()->getAspect();
00137     _pTreeView = new QNodeTreeView *[ThreadManager::getNumAspects()];
00138     
00139     createChildWidgets();
00140     connectChildWidgets();
00141 
00142     setRoot(pRoot);
00143 }
00144 
00145 QSceneGraphView::~QSceneGraphView(void)
00146 {
00147 }
00148 
00149 void
00150 QSceneGraphView::setRoot(const FieldContainerPtr &pRootFC)
00151 {
00152     doSetRoot(pRootFC);
00153 
00154     if(!_bRestoringHistory)
00155         appendHistoryEntry();
00156 }
00157  
00158 void
00159 QSceneGraphView::showAspect(UInt32 uiAspect)
00160 {
00161     if(_pCBAspect->currentItem() != uiAspect)
00162         _pCBAspect->setCurrentItem(uiAspect);
00163 }
00164 
00165 void
00166 QSceneGraphView::onAspectSelected(int index)
00167 {
00168     doShowAspect(index);
00169 
00170     if(!_bRestoringHistory)
00171         appendHistoryEntry();
00172 }
00173 
00174 void
00175 QSceneGraphView::onUpdateClicked(void)
00176 {
00177     SNOTICE << "onUpdateClicked" << endLog;
00178 
00179     UInt32            uiNumAspects = ThreadManager::the()->getNumAspects();
00180     FieldContainerPtr pFC          = _pSelectedFC;
00181 
00182     for(UInt32 i = 0; i < uiNumAspects; ++i)
00183     {
00184         _pTreeView[i]->rereadTree();
00185     }
00186     
00187     _pTreeView[_uiAspect]->setSelectedFC(pFC);
00188 }
00189 
00190 void
00191 QSceneGraphView::onForwardClicked(void)
00192 {
00193     selectNextHistoryEntry();
00194 }
00195 
00196 void
00197 QSceneGraphView::onBackwardClicked(void)
00198 {
00199     selectPrevHistoryEntry();
00200 }
00201 
00202 void
00203 QSceneGraphView::onRawAddressEntered(void)
00204 {
00205     SNOTICE << "onRawAddressEntered" << endLog;
00206 
00207     typedef std::vector<FieldContainerPtr>      FieldContainerStore;
00208     typedef FieldContainerStore::const_iterator FieldContainerStoreConstIt;
00209 
00210     void           *pAddress   = NULL;
00211     FieldContainer *pAddressFC = NULL;
00212 
00213     FieldContainerPtr pFC      = NullFC;
00214     UInt32            uiAspect = 0;
00215 
00216     FieldDataTraits<void *>::getFromString(pAddress, _pLERawAddress->text());
00217 
00218     if(pAddress == NULL)
00219     {
00220         std::cout << _pLERawAddress->text().latin1() << std::endl;
00221         FWARNING(("Raw Address '%s' not understood\n",
00222             _pLERawAddress->text().latin1()));
00223         return;
00224     }
00225     
00226     pAddressFC = reinterpret_cast<FieldContainer *>(pAddress);
00227 
00228     const FieldContainerStore *pFCStore = 
00229         FieldContainerFactory::the()->getFieldContainerStore();
00230 
00231     FieldContainerStoreConstIt fcStoreIter  = pFCStore->begin();
00232     FieldContainerStoreConstIt fcStoreEnd   = pFCStore->end  ();
00233     
00234     UInt32                     uiNumAspects = ThreadManager::getNumAspects();
00235     bool                       bFoundFC     = false;
00236 
00237     SNOTICE << "FCStore.size() == " << pFCStore->size() << " ";
00238 
00239     for(; (fcStoreIter != fcStoreEnd) && !bFoundFC; ++fcStoreIter)
00240     {
00241         PNOTICE << ".";
00242 
00243         for(UInt32 uiAsp=0; (uiAsp < uiNumAspects) && !bFoundFC; ++uiAsp)
00244         {
00245             FieldContainer *pTestFC = (*fcStoreIter).getAspectCPtr(uiAsp);
00246 
00247             if(pTestFC == pAddressFC)
00248             {
00249                 SNOTICE << "onRawAddressEntered: found valid FieldContainer."
00250                      << endLog;
00251 
00252                 pFC      = *fcStoreIter;
00253                 uiAspect = uiAsp;
00254 
00255                 bFoundFC = true;
00256 
00257                 break;
00258             }
00259         }
00260     }
00261 
00262     PNOTICE << endLog;
00263 
00264     if(!bFoundFC)
00265     {
00266         SWARNING << "Could NOT find a FieldContainer at address: "
00267                  << pAddress
00268                  << endLog;
00269         
00270         return;
00271     }
00272 
00273     _pTreeView[uiAspect]->setSelectedFC(pFC);
00274     
00275     showAspect(uiAspect);
00276 }
00277 
00278 
00279 void
00280 QSceneGraphView::onFieldClicked(FieldContainerPtr OSG_CHECK_ARG(pFC),
00281                                 UInt32            OSG_CHECK_ARG(uiFieldId),
00282                                 UInt32            OSG_CHECK_ARG(uiIndex),  
00283                                 ButtonState       OSG_CHECK_ARG(button)    )
00284 {
00285 }
00286 
00287 void
00288 QSceneGraphView::onFieldDoubleClicked(FieldContainerPtr pFC,     
00289                                       UInt32            uiFieldId,
00290                                       UInt32            uiIndex, 
00291                                       ButtonState       button    )
00292 {
00293     Field *pField = pFC->getField(uiFieldId);
00294 
00295     switch(button)
00296     {
00297     case LeftButton: 
00298         {
00299         if(isSFFieldContainerPtr(pField))
00300         {
00301             SFFieldContainerPtr *pSFFCPtr = 
00302                 reinterpret_cast<SFFieldContainerPtr *>(pField);
00303                 
00304             _pTreeView[_uiAspect]->setSelectedFC(pSFFCPtr->getValue()       );
00305         }
00306         else if(isMFFieldContainerPtr(pField))
00307         {
00308             MFFieldContainerPtr *pMFFCPtr =
00309                 reinterpret_cast<MFFieldContainerPtr *>(pField);
00310 
00311             _pTreeView[_uiAspect]->setSelectedFC((*pMFFCPtr)[uiIndex]);
00312         }
00313         
00314         }
00315         break;
00316     case RightButton:
00317         {
00318             _pFCView->beginEdit(uiFieldId, uiIndex);
00319         }
00320         break;
00321     default:
00322         break;
00323     }
00324 }
00325 
00326 void
00327 QSceneGraphView::onSelectionChanged(QListViewItem *pItem)
00328 {
00329     QSceneGraphItem *pSGItem = QSceneGraphItem::dcast(pItem);
00330 
00331     if(pSGItem)
00332     {
00333         AttachmentContainerPtr pAttCon   = 
00334             AttachmentContainerPtr::dcast(pSGItem->getFC());
00335         const FieldContainerType &fcType = pSGItem->getFC()->getType();
00336 
00337         if((pAttCon != NullFC) && (getName(pAttCon) != NULL))
00338         {
00339             _pLabelFCName->setText(QString(fcType.getCName() ) +
00340                                    QString(": "              ) +
00341                                    QString(getName(pAttCon)  )  );
00342         }
00343         else
00344         {
00345             _pLabelFCName->setText(QString(fcType.getCName())  );
00346         }
00347 
00348         _pFCView->setFieldContainer(pSGItem->getFC());
00349 
00350         _pSelectedFC = pSGItem->getFC();
00351 
00352         if(!_bRestoringHistory)
00353             appendHistoryEntry();
00354     }      
00355 }
00356 
00357 void
00358 QSceneGraphView::createChildWidgets(void)
00359 {
00360     UInt32  numAspects = ThreadManager::getNumAspects();
00361     QString strAspect;
00362 
00363     _pGlobalLayout = new QHBoxLayout(this, 10, 5, 
00364                                      "QSceneGraphView::_pGlobalLayout");
00365 
00366     _pSplitter     = new QSplitter  (Horizontal, this, 
00367                                      "QSceneGraphView::_pSplitter");
00368 
00369     QWidget *pSplitterHelper1 = new QWidget(_pSplitter, "pSplitterHelper1");
00370     QWidget *pSplitterHelper2 = new QWidget(_pSplitter, "pSplitterHelper2");
00371 
00372     _pVBoxLeft = new QVBoxLayout(pSplitterHelper1, 5, 5, 
00373                                  "QSceneGraphView::_pVBoxLeft");
00374     
00375     _pCBAspect = new QComboBox  (false, pSplitterHelper1, 
00376                                  "QSceneGraphView::_pCBAspect");
00377     
00378     for(UInt32 i=0; i < numAspects; ++i)
00379     {
00380         strAspect.setNum(i);
00381 
00382         _pCBAspect->insertItem("Aspect " + strAspect);
00383     }
00384 
00385     _pVBoxLeft->addWidget(_pCBAspect);
00386 
00387     _pHBoxHistoryButtons = new QHBoxLayout(
00388         NULL, 0, 5, "QSceneGraphView::_pHBoxHistoryButtons");
00389     _pPBBackward         = new QPushButton("<<", pSplitterHelper1, 
00390                                            "QSceneGraphView::_pPBBackward");
00391     _pPBBackward->setEnabled(false);
00392     _pHBoxHistoryButtons->addWidget(_pPBBackward);
00393 
00394     _pPBForward          = new QPushButton(">>", pSplitterHelper1,
00395                                            "QSceneGraphView::_pPBForward");
00396     _pPBForward->setEnabled(false);
00397     _pHBoxHistoryButtons->addWidget(_pPBForward);
00398 
00399     _pVBoxLeft->addLayout(_pHBoxHistoryButtons);
00400 
00401     for(UInt32 i=0; i < numAspects; ++i)
00402     {
00403         _pTreeView[i] = new QNodeTreeView(pSplitterHelper1, 
00404                                           "QSceneGraphView::_pTreeView");
00405 
00406         _pTreeView[i]->setAspect(i);
00407 
00408         if(i != _uiAspect)
00409         {
00410             _pTreeView[i]->hide();
00411         }
00412         else
00413         {
00414             _pTreeView[i]->show();
00415         }
00416 
00417         _pVBoxLeft->addWidget(_pTreeView[i]);
00418     }
00419 
00420     _pLabelRawAddress  = new QLabel("Display FC at address:", pSplitterHelper1,
00421                                     "QSceneGraphView::_pLabelRawAddress");
00422     _pVBoxLeft->addWidget(_pLabelRawAddress);
00423 
00424     _pLERawAddress     = new QLineEdit(pSplitterHelper1, 
00425                                        "QSceneGraphView::_pLERawAddress");
00426     _pVBoxLeft->addWidget(_pLERawAddress);
00427 
00428     _pPBUpdate         = new QPushButton("Update", pSplitterHelper1,
00429                                          "QSceneGraphView::_pPBUpdate");
00430     _pVBoxLeft->addWidget(_pPBUpdate);
00431 
00432     _pVBoxRight        = new QVBoxLayout(pSplitterHelper2, 5, 5, 
00433                                          "QSceneGraphView::_pVBoxRight");
00434 
00435     _pHBoxFCHeader     = new QHBoxLayout(NULL, 0, 5, 
00436                                          "QSceneGraphView::_pHBoxFCHeader");
00437     _pLabelFCName      = new QLabel(pSplitterHelper2, 
00438                                     "QSceneGraphView::_pLabelFCName");
00439     _pHBoxFCHeader->addWidget(_pLabelFCName);
00440     
00441     _pPBShowTypeColumn = new QPushButton("Show Types", pSplitterHelper2,
00442                                         "QSceneGraphView::_pPBShowTypeColumn");
00443     _pPBShowTypeColumn->setToggleButton(true);
00444     _pPBShowTypeColumn->setOn          (true);
00445     _pHBoxFCHeader->addWidget(_pPBShowTypeColumn);
00446 
00447     _pVBoxRight->addLayout(_pHBoxFCHeader);
00448 
00449     _pFCView           = new QFieldContainerView(pSplitterHelper2, 
00450                                                  "QSceneGraphView::_pFCView");
00451     _pVBoxRight->addWidget   (_pFCView  );
00452 
00453     _pGlobalLayout->addWidget(_pSplitter);
00454 }
00455 
00456 void
00457 QSceneGraphView::connectChildWidgets(void)
00458 {
00459     connect(_pCBAspect,     SIGNAL(highlighted         (int )),
00460             this,           SLOT  (onAspectSelected    (int )));
00461 
00462     connect(_pPBForward,    SIGNAL(clicked             (void)),
00463             this,           SLOT  (onForwardClicked    (void)));
00464 
00465     connect(_pPBBackward,   SIGNAL(clicked             (void)),
00466             this,           SLOT  (onBackwardClicked   (void)));
00467 
00468     connect(_pLERawAddress, SIGNAL(returnPressed       (void)),
00469             this,           SLOT  (onRawAddressEntered (void)));
00470 
00471     connect(_pPBUpdate,     SIGNAL(clicked             (void)),
00472             this,           SLOT  (onUpdateClicked     (void)));
00473 
00474     connect(_pFCView, SIGNAL(clicked       (FieldContainerPtr, UInt32, 
00475                                             UInt32,            ButtonState)),
00476             this,     SLOT  (onFieldClicked(FieldContainerPtr, UInt32, 
00477                                             UInt32,            ButtonState)));
00478 
00479     connect(_pFCView, 
00480             SIGNAL(doubleClicked       (FieldContainerPtr, UInt32, 
00481                                         UInt32,            ButtonState)),
00482             this,     
00483             SLOT  (onFieldDoubleClicked(FieldContainerPtr, UInt32, 
00484                                         UInt32,            ButtonState))
00485            );
00486 
00487     connect(_pPBShowTypeColumn, SIGNAL(toggled             (bool)),
00488             _pFCView,           SLOT  (setShowTypeColumn   (bool)));
00489 
00490     connect(_pTreeView[_uiAspect],
00491             SIGNAL(selectionChanged  (QListViewItem *)),
00492             this,
00493             SLOT  (onSelectionChanged(QListViewItem *)));
00494 }
00495 
00496 void
00497 QSceneGraphView::doSetRoot(const FieldContainerPtr &pRootFC)
00498 {
00499     UInt32 uiNumAspects = ThreadManager::getNumAspects();
00500 
00501     _pRootFC = pRootFC;
00502 
00503     for(UInt32 i=0; i < uiNumAspects; ++i)
00504         _pTreeView[i]->setRoot(pRootFC);
00505 }
00506 
00507 void
00508 QSceneGraphView::doShowAspect(UInt32 uiAspect)
00509 {
00510     disconnect(_pTreeView[_uiAspect],
00511                SIGNAL(selectionChanged  (QListViewItem *)),
00512                this,
00513                SLOT  (onSelectionChanged(QListViewItem *)));
00514 
00515     _pTreeView[_uiAspect]->hide();
00516 
00517     _uiAspect = uiAspect;
00518 
00519     _pTreeView[uiAspect]->setSelectedFC(_pSelectedFC);
00520     _pTreeView[uiAspect]->show         (            );
00521 
00522     _pFCView->setAspect(uiAspect);
00523 
00524     connect(_pTreeView[uiAspect], SIGNAL(selectionChanged  (QListViewItem *)),
00525             this,                 SLOT  (onSelectionChanged(QListViewItem *)));
00526 }
00527 
00528 void
00529 QSceneGraphView::appendHistoryEntry(void)
00530 {
00531     SNOTICE << "QSceneGraphView::appendHistoryEntry "
00532             << "_history.size(): " << _history.size();
00533     
00534     if(_uiMaxHistorySize == 0)
00535     {
00536         PNOTICE << " _uiMaxHistorySize == 0" << endLog;
00537         return;
00538     }
00539 
00540     if(_history.size() == 0)
00541     {
00542         PNOTICE << " _history.size() == 0" << endLog;
00543 
00544         _history.push_back(HistoryEntry(_pRootFC, _pSelectedFC, _uiAspect));
00545         
00546         _currentHistoryEntry = _history.begin();
00547     }
00548     else
00549     {
00550         HistoryListIt histIter = _currentHistoryEntry;
00551 
00552         if( ((*_currentHistoryEntry)._pRootFC     == _pRootFC    ) &&
00553             ((*_currentHistoryEntry)._pSelectedFC == _pSelectedFC) &&
00554             ((*_currentHistoryEntry)._uiAspect    == _uiAspect   )   )
00555         {
00556             PNOTICE << " _currentHistoryEntry == \"internal state\"" << endLog;
00557             return;
00558         }
00559 
00560         PNOTICE << " deleting obsolete parts of history and adding new" 
00561                 << endLog;
00562 
00563         _history.erase(++histIter, _history.end());
00564 
00565         while(_history.size() >= _uiMaxHistorySize)
00566         {
00567             _history.pop_front();
00568         }
00569 
00570         _history.push_back(HistoryEntry(_pRootFC, _pSelectedFC, _uiAspect));
00571     
00572         _currentHistoryEntry = --(_history.end());
00573     }
00574 
00575     enableHistoryButtons();
00576 }
00577 
00578 void
00579 QSceneGraphView::selectPrevHistoryEntry(void)
00580 {
00581     SNOTICE << "select PREV history:\n "
00582             << "CURRENT: " << _currentHistoryEntry->_pRootFC
00583             << " "         << _currentHistoryEntry->_pSelectedFC
00584             << " "         << _currentHistoryEntry->_uiAspect;
00585 
00586     HistoryListIt histIter = _currentHistoryEntry;
00587 
00588     if((_history.size() == 0) || (histIter == _history.begin()))
00589         return;
00590 
00591     --histIter;
00592 
00593     PNOTICE << "\n NEW: " << histIter->_pRootFC
00594             << " "        << histIter->_pSelectedFC
00595             << " "        << histIter->_uiAspect
00596             << endLog;
00597 
00598     _bRestoringHistory = true;
00599 
00600     if((*histIter)._pRootFC != _pRootFC)
00601         doSetRoot((*histIter)._pRootFC);
00602 
00603     if((*histIter)._pSelectedFC != _pSelectedFC)
00604         _pTreeView[_uiAspect]->setSelectedFC((*histIter)._pSelectedFC);
00605 
00606     if((*histIter)._uiAspect != _uiAspect)
00607         showAspect((*histIter)._uiAspect);
00608 
00609     _currentHistoryEntry = histIter;
00610     
00611     enableHistoryButtons();
00612 
00613     _bRestoringHistory = false;
00614 }
00615 
00616 void
00617 QSceneGraphView::selectNextHistoryEntry(void)
00618 {
00619     SNOTICE << "select NEXT history:\n "
00620             << "CURRENT: " << _currentHistoryEntry->_pRootFC
00621             << " "         << _currentHistoryEntry->_pSelectedFC
00622             << " "         << _currentHistoryEntry->_uiAspect;
00623 
00624     HistoryListIt histIter = _currentHistoryEntry;
00625 
00626     if((_history.size() == 0) || (++histIter == _history.end()))
00627         return;
00628 
00629     PNOTICE << "\n NEW: " << histIter->_pRootFC
00630             << " "        << histIter->_pSelectedFC
00631             << " "        << histIter->_uiAspect
00632             << endLog;
00633 
00634     _bRestoringHistory = true;
00635 
00636     if((*histIter)._pRootFC != _pRootFC)
00637         doSetRoot((*histIter)._pRootFC);
00638 
00639     if((*histIter)._pSelectedFC != _pSelectedFC)
00640         _pTreeView[_uiAspect]->setSelectedFC((*histIter)._pSelectedFC);
00641 
00642     if((*histIter)._uiAspect != _uiAspect)
00643         showAspect((*histIter)._uiAspect);
00644 
00645     _currentHistoryEntry = histIter;
00646 
00647     enableHistoryButtons();
00648 
00649     _bRestoringHistory = false;
00650 }
00651 
00652 void
00653 QSceneGraphView::enableHistoryButtons(void)
00654 {
00655     if(_history.size() <= 1)
00656     {
00657         _pPBBackward->setEnabled(false);
00658         _pPBForward ->setEnabled(false);
00659     }
00660     else if(_currentHistoryEntry == _history.begin())
00661     {
00662         _pPBBackward->setEnabled(false);
00663         _pPBForward ->setEnabled(true );
00664     }
00665     else if(_currentHistoryEntry == (--_history.end()))
00666     {
00667         _pPBBackward->setEnabled(true );
00668         _pPBForward ->setEnabled(false);
00669     }
00670     else
00671     {
00672         _pPBBackward->setEnabled(true );
00673         _pPBForward ->setEnabled(true );
00674     }
00675 }
00676 
00677 QSceneGraphView::HistoryEntry::HistoryEntry(
00678     const FieldContainerPtr &pRootFC, const FieldContainerPtr &pSelectedFC,
00679           UInt32             uiAspect                                      )
00680     : _pRootFC    (pRootFC    ),
00681       _pSelectedFC(pSelectedFC),
00682       _uiAspect   (uiAspect   )
00683 {
00684 }
00685 
00686 #include "OSGQSceneGraphView_qt_moc.cpp"
00687 

Generated on Thu Aug 25 04:08:59 2005 for OpenSG by  doxygen 1.4.3