/***************************************************************************************/ /* */ /* SCS editor Version 2 */ /* File : ZonesView.pkg */ /* Version : 06 juillet 2000 */ /* Zones Graph structures and related functions */ /* */ /***************************************************************************************/ struct ZoneView = [ ZVIEWzone : Zone , /* zone */ ZVIEWzonewin : CompBitmap , /* zone window */ ZVIEWresize : [CompBitmap r1] /* attached resize bitmaps on zone win top left; bottom left; top right; bottom right */ ] mkZoneView ;; struct ZonesView = [ ZONESview : I , /* client or server zone code */ ZONESfather : ObjContainer , /* father container */ ZONESclient : [ZoneView r1] , /* client zones */ ZONESserver : [ZoneView r1] , /* server zones */ ZONESresize : AlphaBitmap , /* bitmap for manual zone resize */ ZONEScurrentNode : ZoneView , /* current selection */ ZONEScurrentResizeCode : I /* current action : move (0) or resize specific code */ ] mkZonesView ;; /*************************************************************************************** * * Clear a zone on zone view * ***************************************************************************************/ fun ZONES_ClearResize (resize, param) = _DScompBitmap resize ;; fun ZONES_ClearResizes (zoneView) = apply_on_list zoneView.ZVIEWresize @ZONES_ClearResize nil; set zoneView.ZVIEWresize = nil ;; fun ZONES_ClearZone (zoneView, param) = _DScompBitmap zoneView.ZVIEWzonewin; set zoneView.ZVIEWzonewin = nil; ZONES_ClearResizes zoneView; 1 ;; fun ZONES_CompareZone (zoneView, zone) = zoneView.ZVIEWzone == zone ;; fun ZONES_SearchZoneViewByZone (zoneViewList, zone) = search_in_list zoneViewList @ZONES_CompareZone zone ;; fun ZONES_GetWindow (zoneViewList, zone) = let ZONES_SearchZoneViewByZone zoneViewList zone -> val in _CONVERTcompBitmapToObjNode val.ZVIEWzonewin ;; fun ZONES_GetResize (zoneViewList, zone) = let ZONES_SearchZoneViewByZone zoneViewList zone -> val in val.ZVIEWresize ;; /*************************************************************************************** * * create zone bitmap on zone view * ***************************************************************************************/ fun ZONES_SetZoneWindow2 (zoneViewList, zone, bit, resize) = if zoneViewList==nil then [(mkZoneView [zone bit resize]) 1] else let zoneViewList -> [first next] in if first.ZVIEWzone == zone then ( ZONES_ClearZone first nil; set first.ZVIEWzonewin = bit; set first.ZVIEWresize = resize; [first 0] ) else ZONES_SetZoneWindow2 next zone bit resize ;; /*************************************************************************************** * * return zone view list of zones according to zone side client or server * ***************************************************************************************/ fun ZONES_GetZonesList (zonesViewed, zone) = if (ZONE_GetSide zone) == SCS_CLIENT then zonesViewed.ZONESclient else zonesViewed.ZONESserver ;; /*************************************************************************************** * * set zone bitmap for zone on zone view * ***************************************************************************************/ fun ZONES_SetZoneWindow (zonesViewed, zone, bit, resize) = let ZONES_GetZonesList zonesViewed zone -> zoneViewList in let ZONES_SetZoneWindow2 zoneViewList zone bit resize -> [view result] in if result == 0 then /* replace */ view else /* new */ ( if (ZONE_GetSide zone) == SCS_CLIENT then set zonesViewed.ZONESclient = view::(zonesViewed.ZONESclient) else set zonesViewed.ZONESserver = view::(zonesViewed.ZONESserver); view ) ;; /*************************************************************************************** * * return current bitmap representation for zone on zone view * ***************************************************************************************/ fun ZONES_GetZoneWindow (zonesViewed, zone) = if zone == nil then nil else ZONES_GetWindow ZONES_GetZonesList zonesViewed zone zone ;; /*************************************************************************************** * * return current resize for zone on zone view * ***************************************************************************************/ fun ZONES_GetZoneResize (zonesViewed, zone) = if zone == nil then nil else ZONES_GetResize ZONES_GetZonesList zonesViewed zone zone ;; /*************************************************************************************** * * return current view data set for zone on zone view * ***************************************************************************************/ fun ZONES_GetZoneView (zonesViewed, zone) = if zone == nil then nil else ZONES_SearchZoneViewByZone ZONES_GetZonesList zonesViewed zone zone ;; /*************************************************************************************** * * set current zone selection for zone view * ***************************************************************************************/ fun ZONES_SetCurrentSelection (zonesViewed, view, resizecode) = set zonesViewed.ZONEScurrentResizeCode = resizecode; set zonesViewed.ZONEScurrentNode = view ;; /*************************************************************************************** * * return zone view current selected zone * ***************************************************************************************/ fun ZONES_GetCurrentSelection (zonesViewed) = zonesViewed.ZONEScurrentNode ;; fun ZONES_CreateResizeForZone (zonesViewed, Channel, fatherCont, objnode, w, h, positionFlag) = let _GETalphaBitmapSize zonesViewed.ZONESresize -> [w1 h1] in (_CRcompBitmap Channel fatherCont objnode [0 0] OBJ_VISIBLE|OBJ_ENABLE|OBJ_RW_FLEX|OBJ_RH_FLEX OBJ_CONTAINER_CLICK|OBJ_CONTAINER_UNCLICK|OBJ_CONTAINER_MOVE|OBJ_KEYBOARD zonesViewed.ZONESresize 0 0 w1 h1):: (_CRcompBitmap Channel fatherCont objnode [0 h-h1] OBJ_VISIBLE|OBJ_ENABLE|OBJ_RW_FLEX|OBJ_RH_FLEX OBJ_CONTAINER_CLICK|OBJ_CONTAINER_UNCLICK|OBJ_CONTAINER_MOVE|OBJ_KEYBOARD zonesViewed.ZONESresize 0 0 w1 h1):: (_CRcompBitmap Channel fatherCont objnode [w-w1 0] OBJ_VISIBLE|OBJ_ENABLE|OBJ_RW_FLEX|OBJ_RH_FLEX OBJ_CONTAINER_CLICK|OBJ_CONTAINER_UNCLICK|OBJ_CONTAINER_MOVE|OBJ_KEYBOARD zonesViewed.ZONESresize 0 0 w1 h1):: (_CRcompBitmap Channel fatherCont objnode [w-w1 h-h1] OBJ_VISIBLE|OBJ_ENABLE|OBJ_RW_FLEX|OBJ_RH_FLEX OBJ_CONTAINER_CLICK|OBJ_CONTAINER_UNCLICK|OBJ_CONTAINER_MOVE|OBJ_KEYBOARD zonesViewed.ZONESresize 0 0 w1 h1):: nil ;; /*************************************************************************************** * * Callback for bitmap click to prepare zone bitmap move * ***************************************************************************************/ fun ZONES_BitmapClick (bit, param, x, y, bt, mask) = let param -> [zonesViewed view resizeCode] in let view.ZVIEWzone -> zone in ( if (bt == 2) && !(ZONE_IsPopup zone nil) then /* work on father if not popup */ ( set zone = ZONE_GetFather SELECT_GetSite zone; set view = ZONES_GetZoneView zonesViewed zone; ) else nil; SELECT_NewZone zone REFLEX_PRIORITY_ONE; ZONES_SetCurrentSelection zonesViewed view resizeCode ) ;; /*************************************************************************************** * * Callback for roll over resize click to prepare zone bitmap resize * ***************************************************************************************/ fun ZONES_ResizeClick (roll, param, x, y, bt, mask) = ZONES_BitmapClick nil param nil nil bt mask ;; fun ZONES_SetResizeCB (newResize, zonesViewed, zoneView, code) = if newResize == nil then 1 else ( _CBcompBitmapClick (hd newResize) @ZONES_ResizeClick [zonesViewed zoneView code]; ZONES_SetResizeCB (tl newResize) zonesViewed zoneView (code+1) ) ;;