/***************************************************************************************/ /* */ /* SCS editor Version 2 */ /* File : SelectionInterface.pkg */ /* Version : 15 Juin 2000 */ /* Selection functions */ /* */ /***************************************************************************************/ fun SELECT_GetSelection2 (priority) = let SELECT_GetSelectListsByPriority scs.SCSselectLists priority -> selectLists in if selectLists.SELECTmodules != nil then SELECT_MODULE else if selectLists.SELECTzones != nil then SELECT_ZONE else if selectLists.SELECTlinks != nil then SELECT_LINK else if selectLists.SELECTassociations != nil then SELECT_ASSOCIATION else SELECT_NONE ;; /**************************************************************************************** return current selection type ****************************************************************************************/ fun SELECT_GetSelection () = let SELECT_GetSelection2 REFLEX_PRIORITY_THREE -> result in if result == SELECT_NONE then let SELECT_GetSelection2 REFLEX_PRIORITY_TWO -> result in if result == SELECT_NONE then [REFLEX_PRIORITY_ONE SELECT_GetSelection2 REFLEX_PRIORITY_ONE] else [REFLEX_PRIORITY_TWO result] else [REFLEX_PRIORITY_THREE result] ;; fun SELECT_ClearSpecific (priority, type) = let SELECT_GetSelectListsByPriority scs.SCSselectLists priority -> selectLists in if type == SELECT_MODULE then SELECT_Clear selectLists selectLists.SELECTmodules @SELECT_SetModuleList @REFLEX_ModuleSelected priority else if type == SELECT_ZONE then SELECT_Clear selectLists selectLists.SELECTzones @SELECT_SetZoneList @REFLEX_ZoneSelected priority else if type == SELECT_LINK then SELECT_Clear selectLists selectLists.SELECTlinks @SELECT_SetLinkList @REFLEX_LinkSelected priority else if type == SELECT_ASSOCIATION then SELECT_Clear selectLists selectLists.SELECTassociations @SELECT_SetAssociationList @REFLEX_AssociationSelected priority else nil ;; fun SELECT_ClearSelection (priority, typeSelection) = let SELECT_GetSelection -> [prevPriority prevSelection] in if prevPriority > priority then ( SELECT_ClearSpecific prevPriority prevSelection; SELECT_ClearSelection priority typeSelection; 1 ) else if prevSelection != typeSelection && prevPriority == priority then ( SELECT_ClearSpecific prevPriority prevSelection; 1 ) else 0 ;; /**************************************************************************************** MODULE SELECTION FUNCTIONS ****************************************************************************************/ fun SELECT_NewModule (moduleList, priority) = let SELECT_ClearSelection priority SELECT_MODULE -> forceSelection in let SELECT_GetSelectListsByPriority scs.SCSselectLists priority -> selectLists in SELECT_New selectLists selectLists.SELECTmodules moduleList @SELECT_SetModuleList @REFLEX_ModuleSelected priority forceSelection ;; fun SELECT_AddModule (moduleList, priority) = let SELECT_GetSelectListsByPriority scs.SCSselectLists priority -> selectLists in if (selectLists.SELECTmodules) == nil /* probably another selection */ then SELECT_NewModule moduleList priority else let SELECT_ClearSelection priority SELECT_MODULE -> forceSelection in SELECT_Add selectLists selectLists.SELECTmodules moduleList @SELECT_SetModuleList @REFLEX_ModuleSelected priority forceSelection ;; fun SELECT_RemoveModule (moduleList, newModuleList, priority) = let SELECT_GetSelectListsByPriority scs.SCSselectLists priority -> selectLists in if (selectLists.SELECTmodules) == nil /* probably another selection */ then SELECT_NewModule newModuleList priority else ( SELECT_Remove selectLists selectLists.SELECTmodules moduleList @SELECT_SetModuleList @REFLEX_ModuleSelected priority; if (selectLists.SELECTmodules) == nil then /* empty selection -> replace */ SELECT_NewModule newModuleList priority else nil ) ;; fun SELECT_ClearModule (priority) = let SELECT_GetSelectListsByPriority scs.SCSselectLists priority -> selectLists in SELECT_Clear selectLists selectLists.SELECTmodules @SELECT_SetModuleList @REFLEX_ModuleSelected priority ;; fun SELECT_GetModule (priority) = let SELECT_GetSelectListsByPriority scs.SCSselectLists priority -> selectLists in selectLists.SELECTmodules ;; /**************************************************************************************** ZONE SELECTION FUNCTIONS ****************************************************************************************/ fun SELECT_NewZone (zone, priority) = let SELECT_ClearSelection priority SELECT_ZONE -> forceSelection in let SELECT_GetSelectListsByPriority scs.SCSselectLists priority -> selectLists in SELECT_New selectLists selectLists.SELECTzones zone::nil @SELECT_SetZoneList @REFLEX_ZoneSelected priority forceSelection ;; fun SELECT_RemoveZone (zoneList, newZone, priority) = let SELECT_GetSelectListsByPriority scs.SCSselectLists priority -> selectLists in if (selectLists.SELECTzones) == nil /* probably another selection */ then SELECT_NewZone newZone priority else ( SELECT_Remove selectLists selectLists.SELECTzones zoneList @SELECT_SetZoneList @REFLEX_ZoneSelected priority; if (selectLists.SELECTzones) == nil then /* empty selection -> replace */ SELECT_NewZone newZone priority else nil ) ;; fun SELECT_ClearZone (priority) = let SELECT_GetSelectListsByPriority scs.SCSselectLists priority -> selectLists in SELECT_Clear selectLists selectLists.SELECTzones @SELECT_SetZoneList @REFLEX_ZoneSelected priority ;; fun SELECT_GetZone (priority) = let SELECT_GetSelectListsByPriority scs.SCSselectLists priority -> selectLists in selectLists.SELECTzones ;; /**************************************************************************************** LINK SELECTION FUNCTIONS ****************************************************************************************/ fun SELECT_NewLink (linkList, priority) = let SELECT_ClearSelection priority SELECT_LINK -> forceSelection in let SELECT_GetSelectListsByPriority scs.SCSselectLists priority -> selectLists in SELECT_New selectLists selectLists.SELECTlinks linkList @SELECT_SetLinkList @REFLEX_LinkSelected priority forceSelection ;; fun SELECT_RemoveLink (linkList, priority) = let SELECT_GetSelectListsByPriority scs.SCSselectLists priority -> selectLists in if (selectLists.SELECTlinks) == nil /* probably another selection */ then nil else ( SELECT_Remove selectLists selectLists.SELECTlinks linkList @SELECT_SetLinkList @REFLEX_LinkSelected priority; let SELECT_GetSelection -> [newPriority newType] in if newType == SELECT_MODULE then /* force reselection for module ! */ let SELECT_GetSelectListsByPriority scs.SCSselectLists newPriority -> selectLists in SELECT_New selectLists selectLists.SELECTmodules selectLists.SELECTmodules @SELECT_SetModuleList @REFLEX_ModuleSelected newPriority 1 else nil ) ;; fun SELECT_DestroyLink (linkList) = SELECT_RemoveLink linkList REFLEX_PRIORITY_TWO; SELECT_RemoveLink linkList REFLEX_PRIORITY_THREE ;; fun SELECT_ClearLink (priority) = let SELECT_GetSelectListsByPriority scs.SCSselectLists priority -> selectLists in SELECT_Clear selectLists selectLists.SELECTlinks @SELECT_SetLinkList @REFLEX_LinkSelected priority ;; fun SELECT_GetLink (priority) = let SELECT_GetSelectListsByPriority scs.SCSselectLists priority -> selectLists in selectLists.SELECTlinks ;; /**************************************************************************************** ASSOCIATION SELECTION FUNCTIONS ****************************************************************************************/ fun SELECT_NewAssociation (association, priority) = let SELECT_ClearSelection priority SELECT_ASSOCIATION -> forceSelection in let SELECT_GetSelectListsByPriority scs.SCSselectLists priority -> selectLists in SELECT_New selectLists selectLists.SELECTassociations association::nil @SELECT_SetAssociationList @REFLEX_AssociationSelected priority forceSelection ;; fun SELECT_RemoveAssociation (associationList, priority) = let SELECT_GetSelectListsByPriority scs.SCSselectLists priority -> selectLists in if (selectLists.SELECTassociations) == nil /* probably another selection */ then nil else SELECT_Remove selectLists selectLists.SELECTassociations associationList @SELECT_SetAssociationList @REFLEX_AssociationSelected priority ;; fun SELECT_ClearAssociation (priority) = let SELECT_GetSelectListsByPriority scs.SCSselectLists priority -> selectLists in SELECT_Clear selectLists selectLists.SELECTassociations @SELECT_SetAssociationList @REFLEX_AssociationSelected priority ;; fun SELECT_GetAssociation (priority) = let SELECT_GetSelectListsByPriority scs.SCSselectLists priority -> selectLists in selectLists.SELECTassociations ;; /**************************************************************************************** SITE SELECTION FUNCTIONS ****************************************************************************************/ fun SELECT_ClearAllButSite () = SELECT_ClearAssociation REFLEX_PRIORITY_TWO; SELECT_ClearLink REFLEX_PRIORITY_THREE; SELECT_ClearLink REFLEX_PRIORITY_TWO; SELECT_ClearZone REFLEX_PRIORITY_ONE; SELECT_ClearModule REFLEX_PRIORITY_ONE; 0 ;; proto SCSGUI_ForceEltSelection = fun [] I;; fun SELECT_NewSite (site) = if scs.SCSselectSite == site then nil else ( if scs.SCSselectSite == nil then nil else ( SELECT_ClearAllButSite; REFLEX_SiteSelected scs.SCSselectSite REFLEX_UNSELECTION ); set scs.SCSselectSite = site; REFLEX_SiteSelected site REFLEX_SELECTION; SCSGUI_ForceEltSelection /* MAC ICI crade : le problème c que l'on à pas de before select et de after select et pas d'ordre non plus sur l'appel des CB.... */ ) ;; fun SELECT_ClearSite () = if scs.SCSselectSite == nil then nil else ( SELECT_ClearAllButSite; REFLEX_SiteSelected scs.SCSselectSite REFLEX_UNSELECTION ); set scs.SCSselectSite = nil ;; fun SELECT_GetSite () = scs.SCSselectSite ;; fun SCSPREF_FlushCurrentSite()= if scs.SCSselectSite == nil then nil else ( SELECT_ClearAllButSite; REFLEX_SiteSelected scs.SCSselectSite REFLEX_UNSELECTION ); REFLEX_SiteSelected scs.SCSselectSite REFLEX_SELECTION; SCSGUI_ForceEltSelection /* MAC ICI crade : le problème c que l'on à pas de before select et de after select et pas d'ordre non plus sur l'appel des CB.... */ ;;