/***************************************************************************************/ /* */ /* SCS editor Version 2 */ /* File : PopUpCreationTree.pkg */ /* Version : 19 juin 2000 */ /* Popup Modules Creation and Zones Association Tree window specific functions */ /* */ /***************************************************************************************/ fun CREATIONTREE_ClickModuleClass( tree, assoWin, position, btn, mask )= if (_GETcompTreeCount tree position) != 0 then /* not a module but a node */ /* unselect tree selection */ UTILSGUI_UNSETcompTreeClicked tree else nil; _PAINTcontainer assoWin.ASSOcont ;; fun CREATIONTREE_RunModuleEditor( site, module, editorManager )= EDITORSMANAGER_RunEditor editorManager site module ;; fun CREATIONTREE_DblClickModuleClass( tree, assoWin, position, btn, mask )= if (_GETcompTreeCount tree position) != 0 then /* not a module but a node */ ( /* unselect tree selection */ UTILSGUI_UNSETcompTreeClicked tree; _PAINTcontainer assoWin.ASSOcont; nil ) else /* get module classe referenced by position */ let TREE_Val TREE_getNodeFromPosition position @TREE_FirstChild @TREE_NextBrother scs.SCSmoduleClasses -> moduleClassRef in if moduleClassRef == nil then nil else /* create a new module in site */ let SELECT_GetSite -> site in ( MODULE_Create site SITE_GetModuleCurrentBlackBox site [1 1] /* MAT ICI a changer */ moduleClassRef.RMCmoduleClass mkfun3 @CREATIONTREE_RunModuleEditor scsgui.SCSGUIeditorsManager ) ;; fun CREATIONTREE_FillTreeWithModuleClasses( tree, classNode, position )= if classNode == nil then tree else ( let TREE_Val classNode -> moduleClassRef in let moduleClassRef.RMCmoduleClass -> moduleClass in ( if moduleClass == nil then _ADDcompTree tree position [ moduleClassRef.RMCfilename /* MAT ICI ajouter ds ModuleClassInterface.pkg + verifier l'utilisation de scsgui.SCSGUIchannel : doit on utiliser ce channel ou le passer en parametre ?*/ MODULECLASS_GetTreeBitmap scsgui.SCSGUIchannel moduleClass ] else _ADDcompTree tree position [ MODULECLASS_GetFormatedName moduleClass MODULECLASS_GetTreeBitmap scsgui.SCSGUIchannel moduleClass ]; CREATIONTREE_FillTreeWithModuleClasses tree TREE_FirstChild classNode mirror 0::mirror position; let mirror position -> [hdposition nextposition] in CREATIONTREE_FillTreeWithModuleClasses tree TREE_NextBrother classNode mirror (hdposition + 1)::nextposition ); tree ) ;; /* MAT ICI crade */ var CREATIONTREE_State = 0;; fun CREATIONTREE_ExpandTree( tree, classNode, position )= if classNode == nil then tree else ( let TREE_Val classNode -> moduleClassRef in let moduleClassRef.RMCmoduleClass -> moduleClass in if moduleClass == nil then _SETcompTreeState tree position if CREATIONTREE_State then TRE_EXPAND else TRE_SHRINK else nil; CREATIONTREE_ExpandTree tree TREE_FirstChild classNode mirror 0::mirror position; let mirror position -> [hdposition nextposition] in CREATIONTREE_ExpandTree tree TREE_NextBrother classNode mirror (hdposition + 1)::nextposition; tree ) ;; fun CREATIONTREE_Expand(RollOver, param, posx, posy, button, mask)= let param -> [assoWin cont] in ( set CREATIONTREE_State = 1 - CREATIONTREE_State; CREATIONTREE_ExpandTree assoWin.ASSOtree scs.SCSmoduleClasses nil; _PAINTcontainer cont ) ;; fun CREATIONTREE_RebuildClasses(RollOver, param, posx, posy, button, mask)= { let param -> [assoWin cont] in ( /* Open dialog box warning : time consuming process */ SCSGUI_OpenLoadingDialogBox (_locSCS "popupcreationtree-REBUILD" nil); SCSDATA_ReloadMergeAllDMSModuleClass; _RSTcompTree assoWin.ASSOtree; CREATIONTREE_FillTreeWithModuleClasses assoWin.ASSOtree scs.SCSmoduleClasses nil; set CREATIONTREE_State = 0; SCSGUI_CloseLoadingDialogBox; _PAINTcontainer cont ; ) ; };; fun CREATIONTREE_ModuleCreationTree (assoWin, cont)= /* Creates buttons EXPAND REBUILD */ let _GETstringSize scsgui.SCSGUIsmallFont (_locSCS "popupcreationtree-EXPAND" nil) -> [lfont hfont] in let _GETstringSize scsgui.SCSGUIsmallFont (_locSCS "popupcreationtree-REBUILD" nil) -> [lfont2 hfont2] in let _GETcontainerPositionSize assoWin.ASSOcont -> [_ _ wcont hcont] in let 10+max hfont hfont2 -> hbutton in let (wcont-30)/2 -> wbutton in let 10 -> xpos_expand in let xpos_expand+10+wbutton -> xpos_rebuild in ( set assoWin.ASSOup = _CBcompRollOverClick GRAPHICDRESSING_CRcompRollOverWithText assoWin.ASSOchannel assoWin.ASSOcont nil [xpos_expand 40] OBJ_VISIBLE|OBJ_ENABLE|OBJ_MW_FLEX|OBJ_RW_FLEX OBJ_CONTAINER_MOVE|OBJ_KEYBOARD wbutton hbutton scsgui.SCSGUIsmallFont (_locSCS "popupcreationtree-EXPAND" nil) GD_DEFAULT_TEXT_BUTTON_COLOR @CREATIONTREE_Expand [assoWin cont]; set assoWin.ASSOdown = _CBcompRollOverClick GRAPHICDRESSING_CRcompRollOverWithText assoWin.ASSOchannel assoWin.ASSOcont nil [xpos_rebuild 40] OBJ_VISIBLE|OBJ_ENABLE|OBJ_LW_FLEX|OBJ_MW_FLEX OBJ_CONTAINER_MOVE|OBJ_KEYBOARD wbutton hbutton scsgui.SCSGUIsmallFont (_locSCS "popupcreationtree-REBUILD" nil) GD_DEFAULT_TEXT_BUTTON_COLOR @CREATIONTREE_RebuildClasses [assoWin cont]; let THEME_getParamsByTheme GD_THEME "TREE" -> [pathTree _ _ _ _ _ _ _ _ ]in let exec GD_FUNCTIONHANDLER_LOADBITMAP with [pathTree assoWin.ASSOchannel] -> alphaBmp in ( set CREATIONTREE_State = 0; _SETalphaBitmapTransparency alphaBmp 0xffffff; /* MAT ICI TMP pas top a chger */ let THEME_getInfos GD_THEME "TREE_OFFSETS" -> [_ [ty1 [_ [ty2 _]]]] in let atoi ty1 -> ty1 in let atoi ty2 -> ty2 in let GD_COMPTREE_HIGHLIGHT_TRANSPARENCY -> colortransp in let GD_COMPTREE_TEXT_COLOR -> txtcolor in let GD_COMPTREE_HIGHLIGHT_COLOR -> highlightcolor in set assoWin.ASSOtree = GRAPHICDRESSING_CRcompTree assoWin.ASSOchannel assoWin.ASSOcont nil [10 (40+hbutton+10)] OBJ_CBNOPAINT|OBJ_ENABLE|OBJ_VISIBLE|TRE_FIXED_ROOT/*|TRE_HIDDEN_ROOT*//*|TRE_HIGHLIGHT_SELECTED*/|TRE_HIGHLIGHT_CLICKED|OBJ_MW_FLEX|OBJ_MH_FLEX OBJ_CONTAINER_UNCLICK|OBJ_CONTAINER_MOVE|OBJ_KEYBOARD wcont-20 hcont-80 (hcont-80-ty1-ty2)/26 /* MAT ICI encore un pb de decalage par moments */ nil scsgui.SCSGUIsmallFont 40 20 [txtcolor 0 0 nil] [highlightcolor colortransp]; let _CONVERTcompTreeToObjNode assoWin.ASSOtree -> obnode in TOOLTIP_StaticLink assoWin.ASSOcont obnode scsgui.SCSGUIstaticToolTip (_locSCS "LOC_TOOLTIP_CREATION_TREE_Module_Select" nil); _CBcompTreeDblClick assoWin.ASSOtree @CREATIONTREE_DblClickModuleClass assoWin; _CBcompTreeClick assoWin.ASSOtree @CREATIONTREE_ClickModuleClass assoWin; let TREE_Val scs.SCSmoduleClasses -> moduleClassRoot in set moduleClassRoot.RMCfilename = (_locSCS "popupcreationtree-AVAILABLE" nil); CREATIONTREE_FillTreeWithModuleClasses assoWin.ASSOtree scs.SCSmoduleClasses nil; ) ); 1 ;; /* fonctions generiques aux fenetres pop-up */ fun POPUPWIN_CloseCreationTree( rol, cont, posx, posy, btn, mask )= POPUPWIN_WinDestroy cont POPUPWIN_CREATIONTREE ;; fun CREATIONTREE_SiteViewChanged (view, assoWin) = ASSOTREE_Clear assoWin; if SCSGUI_GetCurrentView == MAINWIN_MODULE then CREATIONTREE_ModuleCreationTree assoWin assoWin.ASSOcont else ASSOTREE_CreateTree assoWin; _PAINTcontainer assoWin.ASSOcont; 1 ;; fun CREATIONTREE_SiteSelected (site, param, assoWin) = if (SCSGUI_GetCurrentView != MAINWIN_MODULE) then ( if (param & REFLEX_UNSELECTION) then ASSOTREE_Clear assoWin else if (param & REFLEX_SELECTION) && (SCSGUI_GetCurrentView != MAINWIN_MODULE) then ASSOTREE_CreateTree assoWin else nil; _PAINTcontainer assoWin.ASSOcont; 1 ) else 0 ;; fun CREATIONTREE_OnPreDestroy (cont) = { let _GETcontainerPositionSize cont -> [popx popy popw poph] in { PARAMS_SetI SCSparameters "POPUP_CREATIONTREE_POSITION_X" popx ; PARAMS_SetI SCSparameters "POPUP_CREATIONTREE_POSITION_Y" popy ; PARAMS_SetI SCSparameters "POPUP_CREATIONTREE_WIDTH" popw ; PARAMS_SetI SCSparameters "POPUP_CREATIONTREE_HEIGHT" poph ; } ; 1 ; } ;; fun POPUPWIN_SetCreationTreeCallBacks (cont, assoWin, param) = POPUPWIN_CBpopupPreDestroy @CREATIONTREE_OnPreDestroy assoWin.ASSOcont; REFLEX_CBmoduleModified (mkfun3 @ASSOTREE_ModuleModified assoWin); REFLEX_CBmoduleRemoved (mkfun3 @ASSOTREE_ModuleRemoved assoWin); REFLEX_CBassociationRemoved (mkfun3 @ASSOTREE_AssociationRemoved assoWin); REFLEX_CBassociationAdded (mkfun3 @ASSOTREE_AssociationAdded assoWin); REFLEX_CBsiteSelected (mkfun3 @CREATIONTREE_SiteSelected assoWin); SCSGUI_CBviewChange (mkfun2 @CREATIONTREE_SiteViewChanged assoWin) ;; fun POPUPWIN_CreateCreationTree (Channel, win, code) = let PARAMS_GetI SCSparameters "POPUP_CREATIONTREE_POSITION_X" -> popx in let PARAMS_GetI SCSparameters "POPUP_CREATIONTREE_POSITION_Y" -> popy in let PARAMS_GetI SCSparameters "POPUP_CREATIONTREE_WIDTH" -> popw in let PARAMS_GetI SCSparameters "POPUP_CREATIONTREE_HEIGHT" -> poph in let PARAMS_GetI SCSparameters "POPUP_CREATIONTREE_MIN_WIDTH" -> popminw in let PARAMS_GetI SCSparameters "POPUP_CREATIONTREE_MIN_HEIGHT" -> popminh in let POPUPWIN_CreatePopupWindow Channel win if (popx != nil) then popx else 100 if (popy != nil) then popy else 50 if (popminw != nil) then popminw else 200 if (popminh != nil) then popminh else 343 (_locSCS "popupcreationtree-TITLE" nil) code nil nil -> cont in let THEME_getParamsByTheme GD_THEME "AFFECTED_BUTTON" -> [pathAffect _ _ _ _ _ _ _ _ ]in let exec GD_FUNCTIONHANDLER_LOADBITMAP with [pathAffect Channel] -> alphaStar in ( _SETalphaBitmapTransparency alphaStar 0xffffff; let mkAssociationWin [Channel cont nil nil nil alphaStar nil] -> assoWin in ( POPUPWIN_SetCreationTreeCallBacks cont assoWin code; CREATIONTREE_SiteSelected SELECT_GetSite REFLEX_PRIORITY_ONE|REFLEX_SELECTION assoWin; CREATIONTREE_SiteViewChanged SCSGUI_GetCurrentView assoWin; /* reset previously saved width & height parameters */ if popw != nil then _SIZEEXcontainer cont popx popy popw poph else nil; [cont _locSCS "popupcreationtree-TITLE" nil]; ) ) ;;