/***************************************************************************************/ /* */ /* SCS editor Version 2 */ /* File : SiteTree.pkg */ /* Version : 14 septembre 2000 */ /* Site Tree specific functions */ /* */ /***************************************************************************************/ /* traitements des reflexes declenches de l'exterieur */ fun SITETREE_ModuleModified( module, param )= let param -> [modification tree] in if modification == REFLEX_NAME then let MODULE_GetName module -> name in let TREE_getPositionFromNode SELECT_GetSite @MODULE_GetFather @MODULE_GetFirstSon @MODULE_GetNextBrother module -> position in _SETcompTreeValue tree position [name MODULE_GetTreeBitmap scsgui.SCSGUIchannel module] else nil ;; fun SITETREE_ModulesModified( modules, param, cont, tree )= apply_on_list modules @SITETREE_ModuleModified [param tree]; _PAINTcontainer cont; 0 ;; fun SITETREE_ZoneModified( zone, param )= let param -> [modification tree] in if modification == REFLEX_NAME || modification == REFLEX_COLOR then let ZONE_GetName zone -> name in let TREE_getPositionFromNode SELECT_GetSite @ZONE_GetFather @ZONE_GetFirstSon @ZONE_GetNextBrother zone -> position in _SETcompTreeValue tree position [name UTILSGUI_CreateRect scsgui.SCSGUIchannel ZONE_GetColor zone ZONE_TREE_SIZE ZONE_TREE_SIZE] else nil ;; fun SITETREE_ZonesModified( zones, param, cont, tree )= apply_on_list zones @SITETREE_ZoneModified [param tree]; _PAINTcontainer cont; 1 ;; /* gestion de la suppression... le probleme est que l'arbre de donnees contient toujours les elements au moment du reflexe ainsi on observe un decalage des position dans l'arbre graphique au fur et a mesure de la suppresion des elements dans le cas d'une multi-selection d'ou le traitement qui suit pour pallier ceci (on part du principe que la selection n'intervient que sur un seul niveau dans l'arbre, si ca se trouve ca marche aussi pour des selections plus generales mais ca m'etonnerait.) */ fun SITETREE_FilterPosition( position1, numberOfPrevious )= if (position1 == nil) || (numberOfPrevious == 0) then position1 else let position1 -> [first next] in if next != nil then first::SITETREE_FilterPosition next numberOfPrevious else (first-numberOfPrevious)::nil ;; fun SITETREE_IsPreviousPosition( position1, position2 )= if (position1 == nil) || (position2 == nil) then 0 else let position1 -> [first1 next1] in let position2 -> [first2 next2] in if next2 == nil then if first2 <= first1 then 1 else 0 else if first1 != first2 then 0 else SITETREE_IsPreviousPosition next1 next2 ;; fun SITETREE_CountPreviousPositions( position, previous_positions )= if previous_positions == nil then 0 else let previous_positions -> [first next] in (SITETREE_IsPreviousPosition position first) + (SITETREE_CountPreviousPositions position next) ;; fun SITETREE_RecomputePosition( position, previous_positions )= if previous_positions == nil then position else let previous_positions -> [first next] in SITETREE_RecomputePosition SITETREE_FilterPosition position first next ;; fun SITETREE_RemoveModules( modules, tree, previous_positions )= if modules == nil then nil else let modules -> [module next] in let TREE_getPositionFromNode SELECT_GetSite @MODULE_GetFather @MODULE_GetFirstSon @MODULE_GetNextBrother module -> position in ( _DELcompTree tree SITETREE_FilterPosition position SITETREE_CountPreviousPositions position previous_positions; SITETREE_RemoveModules next tree position::previous_positions ); 1 ;; fun SITETREE_ModulesRemoved( modules, param, cont, tree )= /* apply_on_list modules @SITETREE_ModuleRemoved tree; */ SITETREE_RemoveModules modules tree nil; _PAINTcontainer cont; 1 ;; fun SITETREE_ZoneRemoved( zone, tree )= let TREE_getPositionFromNode SELECT_GetSite @ZONE_GetFather @ZONE_GetFirstSon @ZONE_GetNextBrother zone -> position in _DELcompTree tree position; 1 ;; fun SITETREE_ZonesRemoved( zones, param, cont, tree )= apply_on_list zones @SITETREE_ZoneRemoved tree; _PAINTcontainer cont; 1 ;; fun SITETREE_ModuleAdded( module, tree )= let TREE_getPositionFromNode SELECT_GetSite @MODULE_GetFather @MODULE_GetFirstSon @MODULE_GetNextBrother module -> position in _ADDcompTree tree position [MODULE_GetName module MODULE_GetTreeBitmap scsgui.SCSGUIchannel module]; 1 ;; fun SITETREE_ModulesAdded( modules, param, cont, tree )= apply_on_list modules @SITETREE_ModuleAdded tree; _PAINTcontainer cont; 1 ;; fun SITETREE_ZoneAdded( zone, tree )= let TREE_getPositionFromNode SELECT_GetSite @ZONE_GetFather @ZONE_GetFirstSon @ZONE_GetNextBrother zone -> position in _ADDcompTree tree position [ZONE_GetName zone UTILSGUI_CreateRect scsgui.SCSGUIchannel ZONE_GetColor zone ZONE_TREE_SIZE ZONE_TREE_SIZE]; 1 ;; fun SITETREE_ZonesAdded( zones, param, cont, tree )= apply_on_list zones @SITETREE_ZoneAdded tree; _PAINTcontainer cont; 1 ;;