/***************************************************************************************/ /* */ /* SCS editor Version 2 */ /* File : Selection.pkg */ /* Version : 15 Juin 2000 */ /* Selection struct and functions */ /* */ /***************************************************************************************/ var SELECT_NONE = 0;; var SELECT_MODULE = 1;; var SELECT_ZONE = 2;; var SELECT_LINK = 3;; var SELECT_ASSOCIATION = 4;; struct SelectLists = [ SELECTpriority : I , /* selection priority */ SELECTmodules : [Module r1] , /* list of selected modules and selection priority */ SELECTzones : [Zone r1] , /* list of selected zones and selection priority */ SELECTlinks : [Link r1] , /* list of selected links and selection priority */ SELECTassociations : [Association r1] /* list of selected associations and selection priority */ ] mkSelectLists ;; /**************************************************************************************** ****************************************************************************************/ fun SELECT_GetSelectListsByPriority (selectLists, priority) = if selectLists == nil then nil else let hd selectLists -> selectList in if priority == selectList.SELECTpriority then selectList else SELECT_GetSelectListsByPriority (tl selectLists) priority ;; fun SELECT_SetModuleList (selectLists, moduleList) = set selectLists.SELECTmodules = moduleList; 0 ;; fun SELECT_SetZoneList (selectLists, zoneList) = set selectLists.SELECTzones = zoneList; 0 ;; fun SELECT_SetLinkList (selectLists, linkList) = set selectLists.SELECTlinks = linkList; 0 ;; fun SELECT_SetAssociationList (selectLists, associationList) = set selectLists.SELECTassociations = associationList; 0 ;; fun SELECT_New (selectLists, oldlist, newlist, functionSet, functionReflex, priority, forceSelection) = let search_all_in_and_not_in_list oldlist newlist -> [inList notInList] in let search_all_in_and_not_in_list newlist inList -> [inList2 notInList2] in ( exec functionSet with [selectLists newlist]; if notInList == nil then nil else exec functionReflex with [notInList REFLEX_UNSELECTION|priority]; if forceSelection then exec functionReflex with [newlist REFLEX_SELECTION|priority] else if notInList2 == nil then nil else exec functionReflex with [notInList2 REFLEX_SELECTION|priority]; ); 0 ;; fun SELECT_Add (selectLists, oldlist, newlist, functionSet, functionReflex, priority, forceSelection) = let search_all_in_and_not_in_list newlist oldlist -> [inList notInList] in if forceSelection then exec functionReflex with [newlist REFLEX_SELECTION|priority] else if notInList == nil then nil else ( exec functionSet with [selectLists listcat notInList oldlist]; exec functionReflex with [notInList REFLEX_SELECTION|priority] ); 0 ;; fun SELECT_Remove (selectLists, oldlist, newlist, functionSet, functionReflex, priority) = let search_all_in_and_not_in_list oldlist newlist -> [inList notInList] in if inList == nil then nil else ( exec functionSet with [selectLists notInList]; exec functionReflex with [inList REFLEX_UNSELECTION|priority] ); 0 ;; fun SELECT_Clear (selectLists, oldlist, functionSet, functionReflex, priority) = if oldlist == nil then nil else ( exec functionSet with [selectLists nil]; exec functionReflex with [oldlist REFLEX_UNSELECTION|priority] ); 0 ;;