//---------------------------------------------------------------------------- // EgalTech 2014-2014 //---------------------------------------------------------------------------- // File : EGkGdbFunct.h Data : 13.03.14 Versione : 1.5c6 // Contenuto : Funzioni generali per DB geometrico. // // // // Modifiche : 13.03.14 DS Creazione modulo. // // //---------------------------------------------------------------------------- #pragma once #include "/EgtDev/Include/EGkGdbConst.h" //----------------- Funzioni per livello di oggetti ---------------------------- // per combinare il livello del padre con il proprio inline int CalcLevel( int nObjLevel, int nParentLevel) { // se oggetto Temp tale rimane if ( nObjLevel == GDB_LV_TEMP) return GDB_LV_TEMP ; // altrimenti puņ dipendere dal padre return (( nParentLevel == GDB_LV_USER) ? nObjLevel : nParentLevel) ; } //----------------- Funzioni per modo di oggetti ------------------------------- // per combinare il modo del padre con il proprio inline int CalcMode( int nObjMode, int nParentMode) { // se oggetto HIDDEN tale rimane if ( nObjMode == GDB_MD_HIDDEN) return GDB_MD_HIDDEN ; // altrimenti puņ dipendere dal padre return (( nParentMode == GDB_MD_STD) ? nObjMode : nParentMode) ; } //----------------- Funzioni per stato di oggetti ------------------------------ // per combinare lo stato del padre con il proprio inline int CalcStatus( int nObjStat, int nParentStat) { // se oggetto OFF tale rimane if ( nObjStat == GDB_ST_OFF) return GDB_ST_OFF ; // altrimenti puņ dipendere dal padre return (( nParentStat == GDB_ST_ON) ? nObjStat : nParentStat) ; } //------------------------------------------------------------------------------ // per combinare lo stato con il modo inline int AdjustStatusWithMode( int nObjStat, int nObjMode) { // se oggetto OFF tale rimane if ( nObjStat == GDB_ST_OFF) return GDB_ST_OFF ; // altrimenti puņ dipendere dal modo switch ( nObjMode) { default : /* GDB_MD_STD */ return nObjStat ; case GDB_MD_LOCKED : return GDB_ST_ON ; case GDB_MD_HIDDEN : return GDB_ST_OFF ; } } //----------------- Funzioni per marcatura di oggetti -------------------------- // per combinare la marcatura del padre con la propria inline int CalcMark( int nObjMark, int nParentMark) { // se oggetto e padre OFF tale rimane if ( nObjMark == GDB_MK_OFF && nParentMark == GDB_MK_OFF) return GDB_MK_OFF ; return ( nParentMark != GDB_MK_OFF ? nParentMark : nObjMark) ; } // ovviamente la marcatura si combina con lo stato, nel senso che un oggetto // non visibile non viene nemmeno marcato