TestEGr 1.5c5 :
- migliorata gestione albero oggetti - aggiunta possibilità di comandi interattivi con registrazione
This commit is contained in:
+38
-4
@@ -26,6 +26,8 @@ using namespace std ;
|
||||
//----------------------------------------------------------------------------
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
//--------------------------- Constants --------------------------------------
|
||||
@@ -68,6 +70,7 @@ CTestEGrDlg::ClearTree( void)
|
||||
RevertOldIdOnTree() ;
|
||||
|
||||
// svuoto l'albero
|
||||
m_Tree.SelectItem( NULL) ;
|
||||
m_Tree.DeleteAllItems() ;
|
||||
OutData( "") ;
|
||||
|
||||
@@ -217,19 +220,50 @@ CTestEGrDlg::OnTreeSelChanged( NMHDR* pNMHDR, LRESULT* pResult)
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void
|
||||
bool
|
||||
CTestEGrDlg::SelectIdOnTree( int nId, HTREEITEM hParent)
|
||||
{
|
||||
HTREEITEM hItem ;
|
||||
if ( hParent == nullptr)
|
||||
hItem = m_Tree.GetRootItem() ;
|
||||
else
|
||||
hItem = m_Tree.GetChildItem( hParent) ;
|
||||
while ( hItem != nullptr) {
|
||||
// verifico se ha l'Id cercato
|
||||
int nData = int( m_Tree.GetItemData( hItem)) ;
|
||||
if ( nId == nData) {
|
||||
m_Tree.SelectItem( hItem) ;
|
||||
return true ;
|
||||
}
|
||||
// se ci sono dei figli, li analizzo
|
||||
if ( m_Tree.ItemHasChildren( hItem)) {
|
||||
if ( SelectIdOnTree( nId, hItem))
|
||||
return true ;
|
||||
}
|
||||
// passo al successivo fratello
|
||||
hItem = m_Tree.GetNextSiblingItem( hItem) ;
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
CTestEGrDlg::RevertOldIdOnTree( void)
|
||||
{
|
||||
// verifiche sul DB geometrico
|
||||
if ( m_pGeomDB == nullptr)
|
||||
return GDB_ID_NULL ;
|
||||
// salvo il vecchio Id
|
||||
int nOLd = m_nOldIdTree ;
|
||||
// se non nullo...
|
||||
if ( m_nOldIdTree != GDB_ID_NULL) {
|
||||
// verifiche sul DB geometrico
|
||||
if ( m_pGeomDB == nullptr)
|
||||
return ;
|
||||
// ripristino il modo e lo stato precedente dell'oggetto
|
||||
m_pGeomDB->RevertMode( m_nOldIdTree) ;
|
||||
m_pGeomDB->RevertStatus( m_nOldIdTree) ;
|
||||
// annullo oggetto da ripristinare
|
||||
m_nOldIdTree = GDB_ID_NULL ;
|
||||
}
|
||||
return nOLd ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user