Handling of Cell destruction in CellViewer.
* Change: In bootstrap, in socInstaler.sh, use the current version of rapidjson. * Change: In Hurricane, in FileWriteGzStream, complie to the latest rapidjson headers organization. * New: In Hurricane, in Cell, emit a new signal CellDestroyed toward the observers (i.e. the CellViewer(s)), from _preDestroy(). * Change: In Hurricane, in CellViewer, in CellObserver::notify(), manage the CellDestroyed case. Do not forget to remove the deleted Cell from the viewer's history.
This commit is contained in:
parent
4f709c8cae
commit
f28daec401
|
@ -155,8 +155,8 @@ class Command ( object ):
|
|||
class GitRepository ( object ):
|
||||
|
||||
@staticmethod
|
||||
def getLocalRepository ( gitRepository ):
|
||||
localRepo = gitRepository.split( '/' )[-1]
|
||||
def getLocalRepository ( url ):
|
||||
localRepo = url.split( '/' )[-1]
|
||||
if localRepo.endswith('.git'):
|
||||
localRepo = localRepo[:-4]
|
||||
return localRepo
|
||||
|
@ -421,8 +421,8 @@ try:
|
|||
for gitSupport in gitSupports:
|
||||
if conf.rmSource: gitSupport.removeLocalRepo()
|
||||
gitSupport.clone()
|
||||
if gitSupport.url.endswith('rapidjson'):
|
||||
gitSupport.checkout( 'a1c4f32' )
|
||||
#if gitSupport.url.endswith('rapidjson'):
|
||||
# gitSupport.checkout( 'a1c4f32' )
|
||||
|
||||
if conf.rmSource: gitCoriolis.removeLocalRepo()
|
||||
gitCoriolis.clone ()
|
||||
|
|
|
@ -930,6 +930,8 @@ void Cell::_postCreate()
|
|||
void Cell::_preDestroy()
|
||||
// ********************
|
||||
{
|
||||
notify( Flags::CellDestroyed );
|
||||
|
||||
while ( _slaveEntityMap.size() ) {
|
||||
_slaveEntityMap.begin()->second->destroy();
|
||||
}
|
||||
|
|
|
@ -84,6 +84,7 @@ class Cell : public Entity {
|
|||
// Flags set for Observers.
|
||||
, CellAboutToChange = 0x00000100
|
||||
, CellChanged = 0x00000200
|
||||
, CellDestroyed = 0x00000400
|
||||
// Cell states
|
||||
, Terminal = 0x00001000
|
||||
, FlattenLeaf = 0x00002000
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#define HURRICANE_FILEWRITEGZSTREAM_H
|
||||
|
||||
#include "rapidjson/rapidjson.h"
|
||||
#include "rapidjson/filewritestream.h"
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
|
|
@ -65,13 +65,21 @@ namespace Hurricane {
|
|||
void CellObserver::notify ( unsigned int flags )
|
||||
{
|
||||
CellViewer* viewer = getOwner();
|
||||
switch ( flags & (Cell::Flags::CellAboutToChange|Cell::Flags::CellChanged) ) {
|
||||
switch ( flags & (Cell::Flags::CellAboutToChange
|
||||
|Cell::Flags::CellChanged
|
||||
|Cell::Flags::CellDestroyed) ) {
|
||||
case Cell::Flags::CellAboutToChange:
|
||||
viewer->emitCellAboutToChange();
|
||||
break;
|
||||
case Cell::Flags::CellChanged:
|
||||
viewer->emitCellChanged();
|
||||
break;
|
||||
case Cell::Flags::CellDestroyed:
|
||||
viewer->emitCellAboutToChange();
|
||||
viewer->removeHistory( viewer->getCell() );
|
||||
viewer->setCell( NULL );
|
||||
viewer->emitCellChanged();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -567,6 +575,12 @@ namespace Hurricane {
|
|||
_cellHistory.pop_front ();
|
||||
_cellHistory.push_back ( activeState );
|
||||
|
||||
rebuildHistory ();
|
||||
}
|
||||
|
||||
|
||||
void CellViewer::rebuildHistory ()
|
||||
{
|
||||
list< shared_ptr<CellWidget::State> >::iterator istate = _cellHistory.begin();
|
||||
for ( size_t i=0 ; i<CellHistorySize ; i++ ) {
|
||||
if ( istate != _cellHistory.end() ) {
|
||||
|
@ -584,6 +598,20 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
void CellViewer::removeHistory ( Cell* cell )
|
||||
{
|
||||
Name cellName = (cell) ? cell->getName() : "empty";
|
||||
|
||||
list< shared_ptr<CellWidget::State> >::iterator istate
|
||||
= find_if( _cellHistory.begin(), _cellHistory.end(), CellWidget::FindStateName(cellName) );
|
||||
|
||||
if (istate != _cellHistory.end()) {
|
||||
_cellHistory.remove ( *istate );
|
||||
rebuildHistory ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CellViewer::setState ( shared_ptr<CellWidget::State>& state )
|
||||
{
|
||||
static bool isEmitter = false;
|
||||
|
@ -616,12 +644,14 @@ namespace Hurricane {
|
|||
= find_if( _cellHistory.begin(), _cellHistory.end(), CellWidget::FindStateName(cellName) );
|
||||
|
||||
if (istate != _cellHistory.end()) {
|
||||
cerr << "CellViewer::setCell() " << (*istate)->getCell() << endl;
|
||||
|
||||
(*istate)->getCell()->addObserver( getCellObserver() );
|
||||
emit stateChanged ( *istate );
|
||||
return;
|
||||
}
|
||||
|
||||
cell->addObserver( getCellObserver() );
|
||||
if (cell) cell->addObserver( getCellObserver() );
|
||||
_cellWidget->setCell( cell );
|
||||
}
|
||||
|
||||
|
|
|
@ -135,6 +135,7 @@ namespace Hurricane {
|
|||
void changeSelectionMode ();
|
||||
void setShowSelection ( bool );
|
||||
void setState ( shared_ptr<CellWidget::State>& );
|
||||
void removeHistory ( Cell* );
|
||||
void openHistoryCell ();
|
||||
void openDesignBlob ();
|
||||
void saveDesignBlob ();
|
||||
|
@ -160,6 +161,7 @@ namespace Hurricane {
|
|||
void createMenus ();
|
||||
void refreshTitle ();
|
||||
void refreshHistory ();
|
||||
void rebuildHistory ();
|
||||
private:
|
||||
QString _getAbsWidgetPath ( const QString& relPath ) const;
|
||||
QMenu* _getParentMenu ( const QString& ) const;
|
||||
|
|
Loading…
Reference in New Issue