/***************************************************************************************/ /* */ /* SCS editor Version 2 */ /* File : ModulesView.pkg */ /* Version : 28 juin 2000 */ /* Modules Graph structures and related functions */ /* */ /***************************************************************************************/ /* MAT ICI TMP DEBUG fun MAT_DEBUG( str )= _showconsole; _fooS str; str ;; */ /* fun MAT_DEBUG_links( links )= if links == nil then 0 else let links -> [[linkCheck check module] next] in ( /* _fooS "["; _fooI linkCheck; _fooI module; _fooS "]"; */ if check == nil then _fooS "ROOT FOUND 2 !!!" else nil; MAT_DEBUG_links next ) ;; fun MAT_DEBUG_modulesList( modules )= if modules == nil then 0 else let modules -> [[check module links] next] in ( /* _fooS ">"; _fooI module; */ if check == nil then _fooS strcat "ROOT FOUND 1 !!! " itoa sizelist links else nil; MAT_DEBUG_links links; /* _fooS "<"; */ MAT_DEBUG_modulesList next ) ;; fun MAT_DEBUG_testModulesListSize( modules )= if modules == nil then 0 else let modules -> [[_ module links] next] in ( (sizelist links) + MAT_DEBUG_testModulesListSize next ) ;; */ /* ************************************************************** */ /* main structure used to describe current modules graph view */ /* ************************************************************** */ struct ModulesView = [ MODVIEWcontainer : ObjContainer , /* only used to paint container after canceling link creation */ MODVIEWmodules : [[CompCheck Module [[CompCheck CompCheck Module] r1]] r1] , /* associates a module with its representation and a list of links */ MODVIEWreversedModules : [[CompCheck Module [[CompCheck CompCheck Module] r1]] r1] , /* same as above but links are reversed (ie [check1 module1 [link check2 module2]::nil]::nil becomes [check2 module2 [link check1 module1]::nil]::nil */ /* module - links links module - */ MODVIEWlinksCreation : [[ObjNode r1] S] , /* memorizes current link creation status */ MODVIEWpopupMenu : LinksMenu , /* to display events and actions lists on link creation */ MODVIEWrootNode : ObjNode , /* root for all Comps to handle view scrolling */ MODVIEWlinksLines : [AlphaBitmap ObjNode] , /* CompBitmap containing links lines drawing */ MODVIEWhoverModule : Module , /* Module under mouse, only used for module selection reflexe */ MODVIEWselectedLink : CompCheck /* round link selected is memorized */ ] mkModulesView ;; /* ************************************************************** */ /* internal utility functions */ /* ************************************************************** */ fun MODULESVIEW_SearchByModule( moduleView, module )= let moduleView -> [_ module_tested _] in module == module_tested ;; fun MODULESVIEW_SearchByButton( moduleView, btn )= let moduleView -> [btn_tested _ _] in btn == _CONVERTcompCheckToObjNode btn_tested ;; /* ************************************************************** */ /* external usable functions */ /* ************************************************************** */ fun MODULESVIEW_GetModule( moduleView, btn )= let search_in_list moduleView.MODVIEWmodules @MODULESVIEW_SearchByButton btn -> [_ module _] in module ;; fun MODULESVIEW_GetButton( moduleView, module )= let search_in_list moduleView.MODVIEWmodules @MODULESVIEW_SearchByModule module -> [check _ _] in check ;; fun MODULESVIEW_GetNodes( moduleView, modules )= if modules == nil then nil else let modules -> [module next] in (_CONVERTcompCheckToObjNode MODULESVIEW_GetButton moduleView module)::MODULESVIEW_GetNodes moduleView next ;; fun MODULESVIEW_GetModules( moduleView, nodes )= if nodes == nil then nil else let nodes -> [node next] in (MODULESVIEW_GetModule moduleView node)::MODULESVIEW_GetModules moduleView next ;; fun MODULESVIEW_GetLinksByButton( moduleView, btn )= let search_in_list moduleView.MODVIEWmodules @MODULESVIEW_SearchByButton btn -> [_ _ links] in links ;; fun MODULESVIEW_GetLinksByModule( moduleView, module )= let search_in_list moduleView.MODVIEWmodules @MODULESVIEW_SearchByModule module -> [_ _ links] in links ;; fun MODULESVIEW_GetReversedLinksByModule( moduleView, module )= let search_in_list moduleView.MODVIEWreversedModules @MODULESVIEW_SearchByModule module -> [_ _ links] in links ;; fun MODULESVIEW_GetReversedLinksByButton( moduleView, btn )= let search_in_list moduleView.MODVIEWreversedModules @MODULESVIEW_SearchByButton btn -> [_ _ links] in links ;; fun MODULESVIEW_RemModuleFilterLinks( links, deletedModule )= if links == nil then nil else let links -> [[_ _ module] next] in if module == deletedModule then MODULESVIEW_RemModuleFilterLinks next deletedModule else (hd links)::MODULESVIEW_RemModuleFilterLinks next deletedModule ;; /* WARNING: MAT ICI: CompCheck destructions are handled here....... a chger ?? */ fun MODULESVIEW_DestroyLinks( links )= if links == nil then nil else let links -> [[linkCheck _ _] next] in ( MODULESVIEW_DestroyLinks next; _DScompCheck linkCheck ) ;; fun MODULESVIEW_RemModuleFilterModules( modules, deletedModule )= if modules == nil then nil else let modules -> [first next] in let first -> [check module links] in if module == deletedModule then ( /* WARNING: MAT ICI: CompCheck destructions handled here....... a chger ?? */ _DScompCheck check; MODULESVIEW_DestroyLinks links; MODULESVIEW_RemModuleFilterModules next deletedModule ) else [check module MODULESVIEW_RemModuleFilterLinks links deletedModule]::MODULESVIEW_RemModuleFilterModules next deletedModule ;; fun MODULESVIEW_RemModule( moduleView, module )= if moduleView.MODVIEWhoverModule == module then set moduleView.MODVIEWhoverModule = nil else nil; set moduleView.MODVIEWmodules = MODULESVIEW_RemModuleFilterModules moduleView.MODVIEWmodules module; set moduleView.MODVIEWreversedModules = MODULESVIEW_RemModuleFilterModules moduleView.MODVIEWreversedModules module ;; fun MODULESVIEW_MutateModuleReferences( links, module, check )= if links == nil then nil else let links -> [first next] in ( MODULESVIEW_MutateModuleReferences next module check; let first -> [_ oldCheck oldModule] in if oldModule == module then mutate first <- [_ check _] else nil ) ;; fun MODULESVIEW_MutateModuleLinks( modules, module, check )= if modules == nil then nil else let modules -> [first next] in let first -> [oldCheck oldModule links] in ( if oldModule == module then ( _DScompCheck oldCheck; mutate first <- [check _ _] ) else nil; MODULESVIEW_MutateModuleLinks next module check; MODULESVIEW_MutateModuleReferences links module check ) ;; fun MODULESVIEW_MutateModule( moduleView, module, check )= MODULESVIEW_MutateModuleLinks moduleView.MODVIEWmodules module check; MODULESVIEW_MutateModuleLinks moduleView.MODVIEWreversedModules module check; moduleView;; /* fun MODULESVIEW_MutateLinkLinks( links, module, linkCheck )= if links == nil then nil else let links -> [link next] in let link -> [_ check _ destModule] in ( MODULESVIEW_MutateLinkLinks next module linkCheck; if module == nil || module == destModule then mutate link <- [_ linkCheck _ _] else nil ) ;; fun MODULESVIEW_MutateLinkModules( modules, module, linkCheck )= if modules == nil then nil else let modules -> [[_ fromModule links] next] in if fromModule == module then MODULESVIEW_MutateLinkLinks links nil linkCheck else MODULESVIEW_MutateLinkModules next nil linkCheck ;; fun MODULESVIEW_MutateLink( moduleView, module, linkCheck )= MODULESVIEW_MutateLinkModules moduleView.MODVIEWmodules module linkCheck; MODULESVIEW_MutateLinkModules moduleView.MODVIEWreversedModules module linkCheck ;; */ /* Display the site tree window when the modules view background is double-clicked */ fun MODULESVIEW_BgDblClick (cont,param,x,y,b,m) = if b==LBUTTON then GUI_ShowHide POPUPWIN_SITETREE else nil ;;