EgtMachKernel 1.6k5 :
- aggiunta gestione DB lavorazioni.
This commit is contained in:
+36
-7
@@ -347,7 +347,7 @@ ToolsMgr::AddTool( const string& sName, int nType)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ToolsMgr::CopyTool( const std::string& sSource, const std::string& sName)
|
||||
ToolsMgr::CopyTool( const string& sSource, const string& sName)
|
||||
{
|
||||
// verifico unicità del nome
|
||||
if ( m_suData.find( sName) != m_suData.end())
|
||||
@@ -362,10 +362,10 @@ ToolsMgr::CopyTool( const std::string& sSource, const std::string& sName)
|
||||
tData.m_sName = sName ;
|
||||
CreateEgtUUID( tData.m_Uuid) ;
|
||||
// salvo i dati del nuovo utensile
|
||||
m_bModified = true ;
|
||||
if ( ! m_utData.emplace( tData.m_Uuid, tData).second ||
|
||||
! m_suData.emplace( tData.m_sName, tData.m_Uuid).second)
|
||||
return false ;
|
||||
m_bModified = true ;
|
||||
// lo rendo il nuovo utensile corrente
|
||||
m_bCurrTool = true ;
|
||||
m_tdCurrTool = tData ;
|
||||
@@ -490,6 +490,17 @@ ToolsMgr::SaveCurrTool( void)
|
||||
auto iIter = m_utData.find( m_tdCurrTool.m_Uuid) ;
|
||||
if ( iIter == m_utData.end())
|
||||
return false ;
|
||||
// se cambiato nome, devo aggiornare tabella relativa
|
||||
if ( m_tdCurrTool.m_sName != iIter->second.m_sName) {
|
||||
// cerco l'utensile nell'elenco dei nomi
|
||||
auto iNameIter = m_suData.find( iIter->second.m_sName) ;
|
||||
if ( iNameIter != m_suData.end()) {
|
||||
// rimuovo vecchio nome
|
||||
m_suData.erase( iNameIter) ;
|
||||
// inserisco nuovo
|
||||
m_suData.emplace( m_tdCurrTool.m_sName, m_tdCurrTool.m_Uuid) ;
|
||||
}
|
||||
}
|
||||
// eseguo salvataggio
|
||||
m_bModified = true ;
|
||||
iIter->second = m_tdCurrTool ;
|
||||
@@ -498,7 +509,7 @@ ToolsMgr::SaveCurrTool( void)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ToolsMgr::IsCurrToolModified( void)
|
||||
ToolsMgr::IsCurrToolModified( void) const
|
||||
{
|
||||
// verifico validità utensile corrente
|
||||
if ( ! m_bCurrTool)
|
||||
@@ -508,7 +519,14 @@ ToolsMgr::IsCurrToolModified( void)
|
||||
if ( iIter == m_utData.end())
|
||||
return false ;
|
||||
// eseguo confronto
|
||||
return ! SameTool( m_tdCurrTool, iIter->second) ;
|
||||
return ( ! SameTool( m_tdCurrTool, iIter->second)) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ToolsMgr::SetCurrToolParam( int nType, bool bVal)
|
||||
{
|
||||
return ( m_bCurrTool ? m_tdCurrTool.SetParam( nType, bVal) : false) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -529,16 +547,27 @@ ToolsMgr::SetCurrToolParam( int nType, double dVal)
|
||||
bool
|
||||
ToolsMgr::SetCurrToolParam( int nType, const string& sVal)
|
||||
{
|
||||
// deve esistere utensile corrente
|
||||
if ( ! m_bCurrTool)
|
||||
return false ;
|
||||
// non è possibile cambiare UUID
|
||||
if ( nType == TPA_UUID)
|
||||
return false ;
|
||||
// è possibile cambiare il nome, solo se il nuovo non è già presente nel DB
|
||||
// è possibile cambiare il nome, solo se il nuovo non è già presente nel DB (escluso utensile corrente)
|
||||
if ( nType == TPA_NAME) {
|
||||
if ( GetTool( sVal) != nullptr)
|
||||
const ToolData* pTdata = GetTool( sVal) ;
|
||||
if ( pTdata != nullptr && pTdata->m_Uuid != m_tdCurrTool.m_Uuid)
|
||||
return false ;
|
||||
}
|
||||
// eseguo
|
||||
return ( m_bCurrTool ? m_tdCurrTool.SetParam( nType, sVal) : false) ;
|
||||
return m_tdCurrTool.SetParam( nType, sVal) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ToolsMgr::GetCurrToolParam( int nType, bool& bVal) const
|
||||
{
|
||||
return ( m_bCurrTool ? m_tdCurrTool.GetParam( nType, bVal) : false) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user