/***************************************************************************************/ /* */ /* SCS editor Version 2 */ /* File : MainWindow.pkg */ /* Version : 14 juin 2000 */ /* Main window functions */ /* */ /***************************************************************************************/ fun MAINWIN_Destroy (cont) = _DScontainer cont;; proto WINMANAG_HideWin = fun [I] I;; proto WINMANAG_SetMainTitle = fun [] I;; fun _MAINWIN_WinDestroy (cont, param) = WINMANAG_HideWin param;; fun MAINWIN_SiteSelected (site, param, code) = if (param & REFLEX_SELECTION) then ( SCSGUI_ViewBBChanged; WINMANAG_SetMainTitle ) else nil; 0 ;; fun MAINWIN_ViewChanged (view) = WINMANAG_SetMainTitle; 0 ;; fun MAINWIN_ModuleSelected (modules, priority) = let SITE_GetModuleCurrentBlackBox SELECT_GetSite -> currentBB in let MODULE_GetFather SELECT_GetSite hd modules -> father in if (currentBB == (hd modules)) || (currentBB == father) then nil else ( SITE_SetModuleCurrentBlackBox SELECT_GetSite (if (father == nil) || (MODULE_IsBlackBox hd modules) then hd modules else father); SCSGUI_ViewBBChanged ); 0 ;; fun MAINWIN_SiteModified (site, param, code) = if param == REFLEX_STATUS || param == REFLEX_NAME then WINMANAG_SetMainTitle else nil ;; fun MAINWIN_OnKeyUp(cont, param, scancode) = KEYBOARD_ProcessKeyUpCode scancode 0;; fun MAINWIN_OnKeyDown(cont, param, scancode, asciicode) = KEYBOARD_ProcessKeyDownCode scancode asciicode;; fun MAINWIN_OnWinKeyUp(cont, param, scancode) = KEYBOARD_ProcessKeyUpCode scancode 0;; fun MAINWIN_OnWinKeyDown(cont, param, scancode, asciicode) = KEYBOARD_ProcessKeyDownCode scancode asciicode;; /* repaint all the son containers */ fun MAINWIN_RefreshSons ( contList ) = if contList == nil then nil else let contList -> [first next] in let first -> [_ cont visibility] in if visibility then _PAINTcontainer cont else nil ;; /* repaint the main window */ fun MAINWIN_Refresh ( cont, contList ) = MAINWIN_RefreshSons contList; _PAINTcontainer _SHOWcontainer cont CONTAINER_UNHIDDEN ;; /* define the mainwin callbacks */ fun MAINWIN_SetWinCallBacks (cont, contSon, code) = REFLEX_CBsiteSelected mkfun3 @MAINWIN_SiteSelected code; REFLEX_CBsiteModified mkfun3 @MAINWIN_SiteModified code; REFLEX_CBmoduleSelected @MAINWIN_ModuleSelected; SCSGUI_CBviewChange @MAINWIN_ViewChanged; WINMANAG_SetMainTitle; _CBcontainerPreDestroy contSon @_MAINWIN_WinDestroy code; _CBcontainerKeyDown cont @MAINWIN_OnKeyDown code; _CBcontainerKeyUp cont @MAINWIN_OnKeyUp code; _CBcontainerKeyDown contSon @MAINWIN_OnKeyDown code; _CBcontainerKeyUp contSon @MAINWIN_OnKeyUp code ;; fun MAINWIN_MakeDressing (Channel, cont, x, y, w, h) = let THEME_getParamsByTheme GD_THEME "LISTFRAME" -> [path _ _ _ _ _ _ _ _] in let exec GD_FUNCTIONHANDLER_LOADBITMAP with [path Channel] -> aBmp in let _CRbitmap Channel 30 30 -> bBmp in let _SCPalphaBitmap bBmp 0 0 29 29 aBmp 0 0 29 29 -> _ in let _CRalphaBitmap Channel bBmp nil GD_DEFAULT_TRANSPARENCYCOLOR GD_DEFAULT_TRANSPARENCYCOLOR -> cornerBmp in ( /* top left corner */ _CRcompBitmap Channel cont nil [x y] OBJ_VISIBLE|OBJ_ENABLE|OBJ_RW_FLEX|OBJ_RH_FLEX OBJ_CONTAINER_MOVE cornerBmp 0 0 14 14; /* top right corner */ _CRcompBitmap Channel cont nil [x+w-16 y] OBJ_VISIBLE|OBJ_ENABLE|OBJ_LW_FLEX|OBJ_RH_FLEX OBJ_CONTAINER_MOVE cornerBmp 16 0 14 14; /* bottom right corner */ _CRcompBitmap Channel cont nil [x+w-16 y+h-16] OBJ_VISIBLE|OBJ_ENABLE|OBJ_LW_FLEX|OBJ_LH_FLEX OBJ_CONTAINER_MOVE cornerBmp 16 16 14 14; /* bottom left corner */ _CRcompBitmap Channel cont nil [x y+h-16] OBJ_VISIBLE|OBJ_ENABLE|OBJ_RW_FLEX|OBJ_LH_FLEX OBJ_CONTAINER_MOVE cornerBmp 0 16 15 15; /* Top middle adjustment bar */ let _CRbitmap Channel w-28 7 -> newbmp in let _SCPalphaBitmap newbmp 0 0 w-29 6 cornerBmp 14 1 15 8 -> finalbmp in let _CRalphaBitmap Channel finalbmp nil nil GD_DEFAULT_TRANSPARENCYCOLOR -> babmp in let _CRcompBitmap Channel cont nil [x+14 y+1] OBJ_ENABLE|OBJ_VISIBLE|OBJ_RH_FLEX|OBJ_MW_FLEX OBJ_CONTAINER_MOVE babmp 0 0 w-29 6 -> compBmp in ( _CBcompBitmapResizeResource compBmp @_rflResizeCompBmp [Channel babmp GD_DEFAULT_TRANSPARENCYCOLOR]; _DSbitmap newbmp ); /* Bottom middle adjustment bar */ let _CRbitmap Channel w-28 7 -> newbmp in let _SCPalphaBitmap newbmp 0 0 w-29 6 cornerBmp 14 23 15 29 -> finalbmp in let _CRalphaBitmap Channel finalbmp nil nil GD_DEFAULT_TRANSPARENCYCOLOR -> babmp in let _CRcompBitmap Channel cont nil [x+14 y+h-9] OBJ_ENABLE|OBJ_VISIBLE|OBJ_LH_FLEX|OBJ_MW_FLEX OBJ_CONTAINER_MOVE babmp 0 0 w-29 6 -> compBmp in ( _CBcompBitmapResizeResource compBmp @_rflResizeCompBmp [Channel babmp GD_DEFAULT_TRANSPARENCYCOLOR]; _DSbitmap newbmp ); /* Right middle adjustment bar */ let _CRbitmap Channel 7 h-28 -> newbmp in let _SCPalphaBitmap newbmp 0 0 6 h-29 cornerBmp 23 14 29 15 -> finalbmp in let _CRalphaBitmap Channel finalbmp nil nil GD_DEFAULT_TRANSPARENCYCOLOR -> babmp in let _CRcompBitmap Channel cont nil [x+w-9 y+14] OBJ_ENABLE|OBJ_VISIBLE|OBJ_MH_FLEX|OBJ_LW_FLEX OBJ_CONTAINER_MOVE babmp 0 0 6 h-29 -> compBmp in ( _CBcompBitmapResizeResource compBmp @_rflResizeCompBmp [Channel babmp GD_DEFAULT_TRANSPARENCYCOLOR]; _DSbitmap newbmp ); /* Left middle adjustment bar */ let _CRbitmap Channel 7 h-28 -> newbmp in let _SCPalphaBitmap newbmp 0 0 6 h-29 cornerBmp 1 14 7 15 -> finalbmp in let _CRalphaBitmap Channel finalbmp nil nil GD_DEFAULT_TRANSPARENCYCOLOR -> babmp in let _CRcompBitmap Channel cont nil [x+1 y+14] OBJ_ENABLE|OBJ_VISIBLE|OBJ_MH_FLEX|OBJ_RW_FLEX OBJ_CONTAINER_MOVE babmp 0 0 6 h-29 -> compBmp in ( _CBcompBitmapResizeResource compBmp @_rflResizeCompBmp [Channel babmp GD_DEFAULT_TRANSPARENCYCOLOR]; _DSbitmap newbmp ); 0 ) ;; /* Create the internal container for the main window */ fun MAINWIN_Create (Channel, cont, code) = let _GETcontainerPositionSize cont -> [_ _ sizew sizeh] in let [MAINWIN_mainposx+6 MAINWIN_mainposy+6] -> [posx posy] in let _CRcontainerFromObjCont Channel cont posx posy sizew-(posx*2)-2 sizeh-posy-3*MAINWIN_mainposx-8 CO_CHILDINSIDE|CO_HIDE|CO_NOBORDER (make_rgb 132 132 132) nil -> contSon in ( MAINWIN_SetWinCallBacks cont contSon code; if code == MAINWIN_MODULE then MODULES_Initialize Channel contSon else ZONES_Initialize Channel contSon code; contSon; ) ;; fun _MAINWIN_ResizeAll (w, h, list) = if list == nil then 0 else let list -> [first next] in let first -> [code cont visibility] in ( if ((code < 10) && (cont!=nil) && visibility) then ( let _GETcontainerPositionSize cont -> [x y _ _] in _SIZEEXcontainer cont x y w-2*MAINWIN_mainposx-12 h-MAINWIN_mainposy-3*MAINWIN_mainposx-12; 0 ) else nil; _MAINWIN_ResizeAll w h next ) ;; proto _MAINWIN_OnResize = fun[ObjContainer I I I I]I;; fun _MAINWIN_OnResize (cont, param, flag, w, h) = if (w<=5 && h<=5) then ( EDITORSMANAGER_ControlEditorsBySite scsgui.SCSGUIeditorsManager nil 0 EDITOR_HIDE; _CBcontainerSize cont @_MAINWIN_OnResize 1; 0 ) else ( let scsgui.SCSGUIwindowManager -> wmng in _MAINWIN_ResizeAll w h wmng.WINMANAGwinList ); if param then ( EDITORSMANAGER_ControlEditorsBySite scsgui.SCSGUIeditorsManager nil 0 EDITOR_UNHIDE; _CBcontainerSize cont @_MAINWIN_OnResize 0; 0 ) else nil ;; fun MAINWIN_SetMainCallBacks (cont, param) = _CBcontainerSize cont @_MAINWIN_OnResize 0; _CBcontainerKeyDown cont @MAINWIN_OnWinKeyDown nil; _CBcontainerKeyUp cont @MAINWIN_OnWinKeyUp nil ;; fun MAINWIN_GetWinSize () = let _GETscreenSize -> [screenW screenH] in let PARAMS_GetI SCSparameters "POPUP_MAINWIN_POSITION_X" -> popx in let PARAMS_GetI SCSparameters "POPUP_MAINWIN_POSITION_Y" -> popy in let PARAMS_GetI SCSparameters "POPUP_MAINWIN_WIDTH" -> popw in let PARAMS_GetI SCSparameters "POPUP_MAINWIN_HEIGHT" -> poph in [popx popy popw poph] ;; /* Set a string in title bar comptext and the container name */ fun MAINWIN_SetTitle (s) = _SETcontainerName scsgui.SCSGUIwindowManager.WINMANAGmainCont s; 0 ;; fun MAINWIN_MaxResToolTip (compCheck) = if ((_GETcompCheckState compCheck) == CHK_CHECKED) then (_locSCS "LOC_TOOLTIP_RESWIN" nil) else (_locSCS "LOC_TOOLTIP_MAXWIN" nil) ;; fun MAINWIN_CreateMain (Channel) = let MAINWIN_GetWinSize -> [posx posy sizew sizeh] in let PARAMS_GetI SCSparameters "POPUP_MAINWIN_MIN_WIDTH" -> popminw in let PARAMS_GetI SCSparameters "POPUP_MAINWIN_MIN_HEIGHT" -> popminh in let PARAMS_GetI SCSparameters "POPUP_MAINWIN_WIDTH" -> popw in let PARAMS_GetI SCSparameters "POPUP_MAINWIN_HEIGHT" -> poph in let _GETscreenSize -> [screenw screenh] in let GD_DEFAULT_BACKGROUNDCOLOR -> bgcolor in let GRAPHICDRESSING_CRcontainer Channel nil [posx posy sizew sizeh] [popminw popminh screenw screenh] bgcolor "" scsgui.SCSGUIweightFont [GD_WINDOWS_TITLE_COLOR1 0 1 0x50] GDWIN_SIZEBOX [nil nil @quit] -> [cont compTitle compMin compMax compClose _] in ( MAINWIN_MakeDressing Channel cont MAINWIN_mainposx MAINWIN_mainposy (sizew-2*MAINWIN_mainposx) (sizeh-MAINWIN_mainposy-3*MAINWIN_mainposx); TOOLTIP_StaticLink cont (_CONVERTcompRollOverToObjNode compMin) scsgui.SCSGUIstaticToolTip (_locSCS "LOC_TOOLTIP_MINWIN" nil); TOOLTIP_DynamicLink cont (_CONVERTcompCheckToObjNode compMax) scsgui.SCSGUIstaticToolTip (mkfun1 @MAINWIN_MaxResToolTip compMax); TOOLTIP_StaticLink cont (_CONVERTcompRollOverToObjNode compClose) scsgui.SCSGUIstaticToolTip (_locSCS "LOC_TOOLTIP_CLOSEWIN" nil); MAINWIN_SetMainCallBacks cont nil; [cont compTitle] ) ;;