/***************************************************************************************/ /* */ /* SCS editor Version 2 */ /* File : ZonesManipulation.pkg */ /* Version : 06 juillet 2000 */ /* Zones Graph zones user interface handling */ /* */ /***************************************************************************************/ fun ZONES_ShowAll (zonesViewed) = _PAINTcontainer zonesViewed.ZONESfather; 1 ;; fun ZONES_Top (zonewin) = _TOPobjNode zonewin ;; fun ZONES_TopZone (zone, zonesViewed) = ZONES_Top ZONES_GetZoneWindow zonesViewed zone; if ZONE_IsPopup zone nil then 1 else let ZONE_GetFather SELECT_GetSite zone -> father in if father == nil then 1 else ZONES_TopZone father zonesViewed ;; /*************************************************************************************** * * Callback for bitmap resize ressource * ***************************************************************************************/ fun ZONES_BitmapResizeResource (object, param, w, h, params) = let param -> [name color Channel colortext bitmap flag] in [ UTILSGUI_CreateRectWithTextAndBitmap Channel color w h name colortext bitmap flag [0 0 w h] ] ;; fun ZONES_ChangeZoneColor (Channel, zonesViewed, zone) = let ZONES_GetZoneView zonesViewed zone -> view in let view.ZVIEWzonewin -> compB in let ZONE_GetSize zone -> [w h] in let _CONVERTcompBitmapToObjNode compB -> obj in ( if (hd SELECT_GetZone REFLEX_PRIORITY_ONE) == zone then if (view.ZVIEWresize == nil) then ( let ZONE_GetStyle zone -> [position _ _] in set view.ZVIEWresize = ZONES_CreateResizeForZone zonesViewed Channel zonesViewed.ZONESfather (_CONVERTcompBitmapToObjNode compB) w h position; ZONES_SetResizeCB view.ZVIEWresize zonesViewed view 1; nil ) else nil else ZONES_ClearResizes view; let ZONE_GetBitmapData zone Channel -> [bitmapZoneAlpha typeBitmap] in let _GETalphaBitmaps bitmapZoneAlpha -> [bitmapFill _] in _CBcompBitmapResizeResource compB @ZONES_BitmapResizeResource [ZONE_GetName zone ZONE_GetColor zone Channel make_rgb 0 0 0 bitmapFill typeBitmap]; /* MAC ICI : cte vieille gruge !!! */ _SIZEobjNode obj w+1 h 0; _SIZEobjNode obj w h 0; _PAINTobjNode obj; ); 1 ;; /*************************************************************************************** * * Callback for zone selection * ***************************************************************************************/ fun ZONES_ZoneSelected (zoneList, param, Channel, zonesViewed) = if (zonesViewed.ZONESview == ZONE_GetSide hd zoneList) then ( if param & REFLEX_UNSELECTION then ( ZONES_ChangeZoneColor Channel zonesViewed hd zoneList ) else if param & REFLEX_SELECTION then ( ZONES_ChangeZoneColor Channel zonesViewed hd zoneList; ZONES_TopZone hd zoneList zonesViewed; ZONES_ShowAll zonesViewed; 1 ) else nil; 1 ) else 0 ;; /************************************************************************************** Callback for bitmap double click to show properties POPUP ***************************************************************************************/ proto WINMANAG_OnlyShow = fun [I] I;; fun ZONES_BitmapDblClick (bit, param, x, y, bt, mask) = WINMANAG_OnlyShow POPUPWIN_PROPERTIES ;; /*************************************************************************************** * * Callback for container mouse move for moving corresponding zone bitmap * ***************************************************************************************/ fun ZONES_SetSizeChange (zone, x, y, initX, initY, resizeCode) = let SELECT_GetSite -> site in if resizeCode == 1 then ZONE_SetPositionAndSizeChange site zone (x - initX) (y - initY) (-(x - initX)) (-(y - initY)) else if resizeCode == 2 then ZONE_SetPositionAndSizeChange site zone (x - initX) 0 (-(x - initX)) (y - initY) else if resizeCode == 3 then ZONE_SetPositionAndSizeChange site zone 0 (y - initY) (x - initX) (-(y - initY)) else if resizeCode == 4 then ZONE_SetSizeChange site zone (x - initX) (y - initY) else nil ;; proto ZONES_ContMove = fun [ObjContainer [Chn ZonesView ObjNode [I I] [I I I I]] I I I] I;; proto ZONES_ContUnClick = fun [ObjContainer [ZonesView [I I I I]] I I I I] I;; fun ZONES_ContMove (cont, param, x, y, bt) = let param -> [Channel zonesViewed father initPos origin] in if (bt&MK_LBUTTON) || (bt&MK_RBUTTON) then let ZONES_GetCurrentSelection zonesViewed -> selected in if selected == nil then 0 else let selected.ZVIEWzone -> zone in let initPos -> [initX initY] in ( if zonesViewed.ZONEScurrentResizeCode then ZONES_SetSizeChange zone x y initX initY zonesViewed.ZONEScurrentResizeCode else ZONE_SetPositionChange SELECT_GetSite zone (x - initX) (y - initY); _CBcontainerCursorMove cont @ZONES_ContMove [Channel zonesViewed father [x y] origin]; let origin -> [oriX oriY _ _] in if (oriX == x) && (oriY == y) then _CBcontainerUnClick cont @ZONES_ContUnClick [zonesViewed nil] else _CBcontainerUnClick cont @ZONES_ContUnClick [zonesViewed origin]; 1 ) else ( ZONES_ContUnClick cont [zonesViewed origin] nil nil nil nil; 0 ) ;; /*************************************************************************************** * * Return current zone real father * * If zone is root or popup then father is nil * ***************************************************************************************/ fun ZONES_GetFather (zone, zonesViewed) = if ZONE_IsPopup zone nil then nil else ZONES_GetZoneWindow zonesViewed ZONE_GetFather SELECT_GetSite zone ;; /*************************************************************************************** * * Callback for container click * * prepare a zone move * ***************************************************************************************/ proto ZONES_ContClick = fun [ObjContainer [Chn ZonesView] I I I I] I;; fun ZONES_ContClick (cont, param, x, y, bt, mask) = let param -> [Channel zonesViewed] in let ZONES_GetCurrentSelection zonesViewed -> view in if view == nil then nil else let ZONES_GetFather view.ZVIEWzone zonesViewed -> father in let ZONE_GetSize view.ZVIEWzone -> [currentW currentH] in let ZONE_GetEdgePositions view.ZVIEWzone -> [currentX _ currentY _ ] in ( _CBcontainerCursorMove cont @ZONES_ContMove [Channel zonesViewed father [x y] [currentX currentY currentW currentH]]; 0 ) ;; /*************************************************************************************** * * Container end cursor move * * possibly end zone move or resize * ***************************************************************************************/ fun ZONES_EndMove (cont, zonesViewed, origin) = let ZONES_GetCurrentSelection zonesViewed -> selection in if selection == nil then nil else ( let ZONES_GetCurrentSelection zonesViewed -> selected in let ZONE_GetEdgePositions selected.ZVIEWzone -> [x _ y _] in if zonesViewed.ZONEScurrentResizeCode then let ZONE_GetSize selected.ZVIEWzone -> [w h] in let origin -> [oldX oldY oldW oldH] in if zonesViewed.ZONEScurrentResizeCode == 4 then if (w != oldW) || (h != oldH) then ZONE_ForceSetSize SELECT_GetSite selected.ZVIEWzone [oldW oldH] else nil else if (w != oldW) || (h != oldH) || (x != oldX) || (y != oldY) then ZONE_ForceSetPositionAndSize SELECT_GetSite selected.ZVIEWzone origin else nil else let origin -> [oldX oldY _ _] in if (x != oldX) || (y != oldY) then ZONE_ForceSetPosition SELECT_GetSite selected.ZVIEWzone [oldX oldY] else nil; 1 ) ;; /*************************************************************************************** * * Callback for container unclick * ***************************************************************************************/ fun ZONES_ContUnClick (cont, param, x, y, bt, mask) = let param -> [zonesViewed origin] in ( if origin != nil then ZONES_EndMove cont zonesViewed origin else nil; ZONES_SetCurrentSelection zonesViewed nil 0; _CBcontainerCursorMove cont nil nil; _CBcontainerUnClick cont @ZONES_ContUnClick [zonesViewed nil] ); 0 ;;