/***************************************************************************************/ /* */ /* SCS editor Version 2 */ /* File : ModulesCreation.pkg */ /* Version : 27 juin 2000 */ /* Modules Graph creation functions */ /* */ /***************************************************************************************/ /* ************************************************************** */ /* internal creation utilities functions */ /* ************************************************************** */ /* Module CompCheck graphical resource creation */ fun MODULES_CreateButtonResourceCopyIcone( destination, destX, destY, source, srcW, srcH, name, textColor, textHeight )= _CPbitmap16 destination destX destY source 0 0 srcW srcH nil; _DRAWrectangleText destination scsgui.SCSGUIsmallFont destX-srcW/4 destY+srcH 3*srcW/2 textHeight textColor TD_TOP|TD_CENTER name ;; fun MODULES_CreateButtonResourceSelected( resource, bitmap, width, height, name, color )= let _GETbitmapSize resource -> [Width Height] in let 3*Width/4 - width/2 -> deltaX in let Width/4 - width/2 - 1 -> deltaY in let Height/3 -> stepY in let Height/3-height-deltaY -> textHeight in ( /* cursor out, selected */ MODULES_CreateButtonResourceCopyIcone resource deltaX deltaY bitmap width height name color textHeight; /* cursor in, selected */ MODULES_CreateButtonResourceCopyIcone resource deltaX stepY+deltaY bitmap width height name color textHeight; /* click in, selected */ MODULES_CreateButtonResourceCopyIcone resource deltaX 2*stepY+deltaY bitmap width height name color textHeight ) ;; fun MODULES_CreateButtonResourceUnselected( resource, bitmap, width, height, name, color )= let _GETbitmapSize resource -> [Width Height] in let Width/4 - width/2 -> deltaX in let Width/4 - width/2 - 1 -> deltaY in let Height/3 -> stepY in let Height/3-height-deltaY -> textHeight in ( /* cursor out, unclicked */ MODULES_CreateButtonResourceCopyIcone resource deltaX deltaY bitmap width height name color textHeight; /* cursor in, unclicked */ MODULES_CreateButtonResourceCopyIcone resource deltaX stepY+deltaY bitmap width height name color textHeight; /* cursor in, clicked */ MODULES_CreateButtonResourceCopyIcone resource deltaX 2*stepY+deltaY bitmap width height name color textHeight ) ;; fun MODULES_CreateButtonResource( Channel, name, bitmap, flags, backgroundColor )= let THEME_getParamsByTheme GD_THEME "MODULE_BITMAP" -> [pathModule _ _ _ _ _ _ _ _ ]in let exec GD_FUNCTIONHANDLER_LOADBITMAP with [pathModule Channel] -> alphaBmp in let _GETalphaBitmaps alphaBmp -> [rgb _] in let _GETalphaBitmapSize alphaBmp -> [width height] in let _CRbitmap Channel width height -> newrgb in let THEME_getInfos GD_THEME "MODULES_GRAPH_SECONDARY_COLOR" -> [c1 [c2 [c3 _]]] in let make_rgb atoi c1 atoi c2 atoi c3 -> GraphSeccolor in let THEME_getInfos GD_THEME "MODULES_GRAPH_PRIMARY_COLOR" -> [c4 [c5 [c6 _]]] in let make_rgb atoi c4 atoi c5 atoi c6 -> GraphPrimcolor in ( _CPbitmap16 newrgb 0 0 rgb 0 0 width height nil; MODULES_CreateButtonResourceUnselected newrgb bitmap IconesWidth IconesHeight name GraphSeccolor; /* MAT ICI remonter */ MODULES_CreateButtonResourceSelected newrgb bitmap IconesWidth IconesHeight name GraphPrimcolor; /* MAT ICI remonter */ _CRalphaBitmap Channel newrgb nil nil nil ) ;; fun MODULES_BuildInLinksList( links )= if links == nil then nil else let links -> [link next] in let LINK_GetSource link -> source in let LINK_GetEvent link -> event in let LINK_GetAction link -> action in strcat strcatn " "::(source.MODname)::"."::event::" -> "::action::"\n"::nil MODULES_BuildInLinksList next ;; fun MODULES_BuildOutLinksList( links )= if links == nil then nil else let links -> [link next] in let LINK_GetDestination link -> destination in let LINK_GetEvent link -> event in let LINK_GetAction link -> action in strcat strcatn " "::event::" -> "::(destination.MODname)::"."::action::"\n"::nil MODULES_BuildInLinksList next ;; fun MODULES_ChangeTooltip( module )= /* MAT ICI, ne sert plus a rien des qu'il y a trop de liens, c'est illisible.... mais ça marche !!! let MODULE_GetIncomingLinks module -> links in let MODULES_BuildInLinksList links -> ininfos in let MODULES_BuildOutLinksList links -> outinfos in strcatn (MODULE_GetName module)::"\n":: (strcat "\nIncoming links :\n" if ininfos == nil then " -\n" else ininfos):: (strcat "\nOutgoing links :\n" if outinfos == nil then " -\n" else outinfos):: nil */ MODULE_GetName module ;; /* Creation of a CompCheck per module */ fun MODULES_CreateButton( Channel, cont, ModulesViewed, name, bitmap, position, module )= let THEME_getInfos GD_THEME "MODULES_GRAPH_PRIMARY_COLOR" -> [c4 [c5 [c6 _]]] in let make_rgb atoi c4 atoi c5 atoi c6 -> GraphPrimcolor in let ModulesViewed.MODVIEWlinksLines -> [_ parent] in let _CRcompCheck Channel cont parent position OBJ_VISIBLE|OBJ_DISABLE OBJ_CONTAINER_CLICK|OBJ_CONTAINER_UNCLICK|OBJ_CONTAINER_MOVE|OBJ_CONTAINER_KEYDOWN|OBJ_CONTAINER_DBLCLICK MODULES_CreateButtonResource Channel name bitmap nil GraphPrimcolor -> check in ( _CBcompCheckCursorMoveIn check @MODULESMOVE_SetModule [cont ModulesViewed module]; _CBcompCheckCursorMoveOut check @MODULESMOVE_UnsetModule [cont ModulesViewed module]; TOOLTIP_DynamicLink cont (_CONVERTcompCheckToObjNode check) scsgui.SCSGUIdynamicToolTip mkfun1 @MODULES_ChangeTooltip module; check ) ;; /* ************************************************************** */ /* external usable functions */ /* ************************************************************** */ fun MODULES_CreateModule( Channel, cont, ModulesViewed, module )= let _GETalphaBitmaps MODULE_GetBitmap Channel module -> [bitmap _] in if bitmap != nil then let MODULE_GetName module -> name in let MODULE_GetPosition module -> position in MODULES_CreateButton Channel cont ModulesViewed name bitmap position module else nil /* MAT ICI gerer un bitmap par defaut au lieu de zapper le module */ ;;