/****************************************************************************/ /****************************************************************************/ /** **/ /** GGD.pkg **/ /** GenericGraphicDressing **/ /** **/ /** routines génériques pour le graphicdressing **/ /** **/ /** Auteur : Loïc Berthelot, dec 2000 **/ /** **/ /** ver 0.1 **/ /** **/ /****************************************************************************/ /****************************************************************************/ typeof ggd_cont = ObjContainer;; typeof ggd_root = ObjNode;; typeof ggd_ch = Chn;; var ggd_txtColor = 0xffffff;; var ggd_bkgColor = 10724259;;/*0xbfb8bf;;*/ var ggd_selectColor = 0xff0000;; var ggd_transCoeff = 70;; var ggd_borderColor = 0x000000;; var ggd_3DborderColor1 = 0x000000;; var ggd_3DborderColor2 = 0x606060;; var ggd_3DborderColor3 = 0xd0d0d0;; var ggd_3DborderColor4 = 0xffffff;; fun ggd_setCont (cont) = set ggd_cont = cont; 1;; fun ggd_setCh (ch) = set ggd_ch = ch; 1;; fun ggd_setRoot (root) = set ggd_root = root; 1;; fun ggd_CRroot ( Channel, cont )= let _CRalphaBitmap Channel _CRbitmap Channel 1 1 nil nil nil -> alphaBmp in let _CONVERTcompBitmapToObjNode _CRcompBitmap Channel cont nil [0 0] OBJ_VISIBLE|OBJ_ENABLE nil alphaBmp 0 0 0 0 -> root in ( ggd_setRoot root; root; );; /***************************************/ /* */ /* F O N T */ /* */ /***************************************/ typeof ggd_fontID = S;; var ggd_fontSize = 12;; var ggd_fontName = "Arial";; var ggd_fontFlag = 0;; typeof ggd_font = ObjFont;; /* identifiant size name flag color */ typeof ggd_fontStack = [[S I S I I] r1];; fun ggd_DSfont (f, z) = _DSfont f;; fun ggd_CRfont (id, size, name, flag, color) = ggd_DSfont ggd_font nil; set ggd_fontID = id; set ggd_fontSize = size; set ggd_fontName = name; set ggd_fontFlag = flag; set ggd_font = _CRfont _channel ggd_fontSize 0 ggd_fontFlag ggd_fontName; set ggd_txtColor = color; ggd_font;; fun ggd_PUSHfont () = set ggd_fontStack = [ggd_fontID ggd_fontSize ggd_fontName ggd_fontFlag ggd_txtColor]::ggd_fontStack; 1;; fun ggd_fontByfont (el, id) = let el -> [elid _ _ _ _] in (!strcmp elid id);; fun ggd_SETfont (id) = let search_in_list ggd_fontStack @ggd_fontByfont id -> el in if (el == nil) then nil else ( ggd_DSfont ggd_font nil; let el -> [id size name flag color] in ggd_CRfont id size name flag color; 1; );; fun ggd_POPfont () = ggd_DSfont ggd_font nil; let hd ggd_fontStack -> [id size name flag color] in let ggd_CRfont id size name flag color -> newfont in ( set ggd_fontStack = endlist ggd_fontStack 1; newfont; );; /***************************************/ /* */ /* I N I T */ /* */ /***************************************/ fun ggd_init (ch) = set ggd_ch = ch; ggd_CRfont nil 14 "Arial" 0 0xffffff; 1;; fun ggd_close() = ggd_DSfont ggd_font nil; 1;; /********************************************************/ /* */ /* ggd_ADDborder [AlphaBitmap I I I I I] I */ /* */ /********************************************************/ fun ggd_ADDborder (alpha, x, y, w, h, color) = let _GETalphaBitmaps alpha -> [bmp _] in let if (color == nil) then ggd_borderColor else color -> color in ( _DRAWline bmp x y (x+w-1) y DRAW_SOLID 1 color; _DRAWline bmp (x+w-1) y (x+w-1) (y+h-1) DRAW_SOLID 1 color; _DRAWline bmp x (y+h-1) (x+w-1) (y+h-1) DRAW_SOLID 1 color; _DRAWline bmp x y x (y+h-1) DRAW_SOLID 1 color; ); 1;; /********************************************************/ /* */ /* ggd_ADD3Dborder [AlphaBitmap I I I I [I I I I]] I */ /* */ /********************************************************/ fun ggd_ADD3Dborder (alpha, x, y, w, h, tuplecolor) = let _GETalphaBitmaps alpha -> [bmp _] in let if (tuplecolor == nil) then [ggd_3DborderColor1 ggd_3DborderColor2 ggd_3DborderColor3 ggd_3DborderColor4] else tuplecolor -> [color1 color2 color3 color4] in ( _DRAWline bmp x y (x+w-1) y DRAW_SOLID 1 color1; _DRAWline bmp x y x (y+h-1) DRAW_SOLID 1 color3; _DRAWline bmp (x+1) (y+1) (x+w-1) (y+1) DRAW_SOLID 1 color2; _DRAWline bmp (x+1) (y+1) (x+1) (y+h-1) DRAW_SOLID 1 color4; _DRAWline bmp (x+w-1) (y+1) (x+w-1) (y+h-1) DRAW_SOLID 1 color1; _DRAWline bmp (x+1) (y+h-1) (x+w-1) (y+h-1) DRAW_SOLID 1 color3; _DRAWline bmp (x+w-2) (y+2) (x+w-2) (y+h-2) DRAW_SOLID 1 color2; _DRAWline bmp (x+2) (y+h-2) (x+w-2) (y+h-2) DRAW_SOLID 1 color4; ); 1;; /*******************************************************************/ /* */ /* ggd_CRframe [I I I I I I S] [AlphaBitmap CompBitmap */ /* */ /*******************************************************************/ fun ggd_CRframe (x, y, w, h, flags, color, fln) = let if (flags == nil) then OBJ_ENABLE|OBJ_VISIBLE else flags -> flags in let if (fln == nil) then let _CRbitmap ggd_ch w h -> newBmp in let _FILLbitmap newBmp color -> newBmp in let _CRalphaBitmap ggd_ch newBmp nil nil nil -> alpha in ( _DSbitmap newBmp; alpha; ) else let _LDalphaBitmap ggd_ch (_checkpack fln) -> alpha in let _GETalphaBitmapSize alpha -> [aw ah] in let _CRbitmap _channel w h -> newBmp in let _SCPalphaBitmap newBmp 0 0 (w-1) (h-1) alpha 0 0 (aw-1) (ah-1) -> newBmp in let _CRalphaBitmap _channel newBmp nil nil nil -> newAlpha in ( _DSbitmap newBmp; _DSalphaBitmap alpha; newAlpha; ) -> alpha in let _CRcompBitmap ggd_ch ggd_cont ggd_root [x y] flags /*filtre flags*/nil alpha 0 0 w h -> compBmp in [alpha compBmp];; fun ggd_CRframeAlpha (x, y, w, h, flags, color, alpha) = let if (flags == nil) then OBJ_ENABLE|OBJ_VISIBLE else flags -> flags in let if (alpha == nil) then let _CRbitmap ggd_ch w h -> newBmp in let _FILLbitmap newBmp color -> newBmp in let _CRalphaBitmap ggd_ch newBmp nil nil nil -> alpha in ( _DSbitmap newBmp; alpha; ) else alpha -> alpha in let _CRcompBitmap ggd_ch ggd_cont ggd_root [x y] flags /*filtre flags*/nil alpha 0 0 w h -> compBmp in [alpha compBmp];; fun ggd_CRbitmap (x, y, flags, alpha) = let _GETalphaBitmapSize alpha -> [alphaW alphaH] in let if (flags == nil) then OBJ_ENABLE|OBJ_VISIBLE else flags -> flags in let _CRcompBitmap ggd_ch ggd_cont ggd_root [x y] flags nil alpha 0 0 alphaW alphaH -> cbmp in [alpha cbmp];; /****************************************************************************/ /* */ /* ggd_CRcont [I I I I I S] [ObjContainer S funmin funmax funclose [I I I I]]*/ /* */ /****************************************************************************/ fun ggd_CRcont (possize, minmaxsize, flags, t) = let if (flags == nil) then GDWIN_BORDERS|GDWIN_TITLE_BAR|GDWIN_CLOSE_BUTTON else flags -> flags in let GRAPHICDRESSING_CRcontainer ggd_ch nil possize minmaxsize ggd_bkgColor t ggd_font [ggd_txtColor 0 0 0] flags [nil nil nil] -> [cont title minb maxb closeb clientarea] in ( set ggd_cont = cont; [cont title minb maxb closeb clientarea]; );; fun ggd_CRchildCont (father, x, y, w, h, flags) = let if (flags == nil) then CO_NOBORDER|CO_NOCAPTION|CO_CHILDINSIDE else flags -> flags in let _CRcontainerFromObjCont ggd_ch father x y w h flags ggd_bkgColor "" -> cont in ( set ggd_cont = cont; cont; );; /********************************************************************/ /* */ /* ggd_CRtext [I I I I I S] CompText */ /* */ /********************************************************************/ fun gCR_CRtext (x, y, w, h, flags, t) = let if (flags == nil) then OBJ_ENABLE|OBJ_VISIBLE|CT_WORDWRAP|CT_MULTIEDITLINE else flags -> flags in GRAPHICDRESSING_CRcompText ggd_ch ggd_cont ggd_root [x y] flags /*filtrage flags*/OBJ_CONTAINER_MOVE w h t ggd_font [ggd_txtColor 0 0 0 ] [ggd_selectColor ggd_transCoeff];; /********************************************************/ /* */ /* ggd_CRlabel [I I I I I S] CompText */ /* */ /********************************************************/ fun ggd_CRlabel (x, y, w, h, flags, t) = let if (flags == nil) then OBJ_ENABLE|OBJ_VISIBLE|CT_WORDWRAP|CT_LABEL else flags -> flags in GRAPHICDRESSING_CRcompText ggd_ch ggd_cont /*obj père*/ggd_root [x y] flags /*filtrage flags*/OBJ_CONTAINER_MOVE w h t ggd_font [ggd_txtColor 0 0 0 ] [ ggd_selectColor ggd_transCoeff];; /********************************************************************/ /* */ /* ggd_CRline [I I I I I S] CompText */ /* */ /********************************************************************/ fun ggd_CRline (x, y, w, h, flags, t) = let if (flags == nil) then OBJ_ENABLE|OBJ_VISIBLE|CT_EDITLINE else flags -> flags in GRAPHICDRESSING_CRcompText ggd_ch ggd_cont /*obj père*/ggd_root [x y] flags /*filtrage flags*/OBJ_CONTAINER_MOVE w h t ggd_font [ggd_txtColor 0 0 0] [ggd_selectColor ggd_transCoeff];; /********************************************************/ /* */ /* ggd_setCompText [CompText S] I */ /* */ /********************************************************/ fun ggd_SETcompText (objText, text) = _SETcompText objText text ggd_font [ggd_txtColor 0 0 nil] CT_NOCHANGE; 1;; /********************************************************/ /* */ /* ggd_CRlist [I I I I I] CompList */ /* */ /********************************************************/ fun gCR_List (x, y, w, h, flags) = let if (flags == nil) then OBJ_ENABLE|OBJ_VISIBLE|LST_HIGHLIGHT_CLICKED|LST_LEFT else flags -> flags in GRAPHICDRESSING_CRcompList ggd_ch ggd_cont /*obj père*/ ggd_root [x y] flags /* filtrage flags*/OBJ_CONTAINER_MOVE w h /*nbr d'items visibles à la fois*/ /*(h / gLib2d_dftSizeFont)*/8 LST_VERTICAL ggd_font 0 [ggd_txtColor 0 0 0] [ggd_selectColor ggd_transCoeff];; /********************************************************************/ /* */ /* ggd_CRtoolTip [ObjNode S S] EMtoolTip */ /* */ /********************************************************************/ fun ggd_CRtoolTip (objnode, text, fln) = let if (fln == nil) then [nil 0 0] else let _LDalphaBitmap _channel (_checkpack fln) -> alpha in let _GETalphaBitmapSize alpha -> [alphaW alphaH] in [alpha alphaW alphaH] -> [alpha w h] in _CR_TOOLTIP ggd_ch ggd_cont objnode ggd_font [ggd_txtColor nil ggd_selectColor ggd_transCoeff] ggd_bkgColor alpha [5 0 w h] text nil 1500;; /********************************************************************/ /* */ /* ggd_CRrollOverMini [[I I] I AlphaBitmap] CompRollOver */ /* */ /********************************************************************/ fun ggd_CRrollOverMini (coord, flags, icone) = let if (flags == nil) then OBJ_VISIBLE|OBJ_ENABLE else flags -> flags in GRAPHICDRESSING_CRcompRollOverMini ggd_ch ggd_cont ggd_root coord flags nil icone;; /********************************************************************/ /* */ /* ggd_CRrollOverMiddle [[I I] I AlphaBitmap] CompRollOver */ /* */ /********************************************************************/ fun ggd_CRrollOverMiddle (coord, flags, icone) = let if (flags == nil) then OBJ_VISIBLE|OBJ_ENABLE else flags -> flags in GRAPHICDRESSING_CRcompRollOverMiddle ggd_ch ggd_cont ggd_root coord flags nil icone;; /********************************************************************/ /* */ /* ggd_CRrollOverMaxi [[I I] I AlphaBitmap] CompRollOver */ /* */ /********************************************************************/ fun ggd_CRrollOverMaxi(coord, flags, icone) = let if (flags == nil) then OBJ_VISIBLE|OBJ_ENABLE else flags -> flags in GRAPHICDRESSING_CRcompRollOverMaxi ggd_ch ggd_cont ggd_root coord flags nil icone;; /********************************************************************/ /* */ /* ggd_CRrollOverText [[I I] I I I S] CompRollOver */ /* */ /********************************************************************/ fun ggd_CRrollOverText (coord, w, h, flags, t) = let if (flags == nil) then OBJ_VISIBLE|OBJ_ENABLE else flags -> flags in GRAPHICDRESSING_CRcompRollOverWithText ggd_ch ggd_cont ggd_root coord flags nil w h ggd_font t ggd_txtColor;; /*********************************************************************/ /* */ /* ggd_CRrollOverCustom [[I I] I I I I S] [AlphaBitmap CompRollOver] */ /* */ /*********************************************************************/ fun ggd_CRrollOverCustom (coord, w, h, flags, color, alphafln) = let if (flags == nil) then OBJ_VISIBLE|OBJ_ENABLE|ROL_MASK else flags -> flags in let if (alphafln != nil) then _LDalphaBitmap ggd_ch _checkpack alphafln else let _CRbitmap _channel w h -> newBmp in let _FILLbitmap newBmp color -> newBmp in let _CRalphaBitmap ggd_ch newBmp nil nil nil -> alpha in ( _DSbitmap newBmp; ggd_ADDborder alpha 0 0 w (h/4) 0; ggd_ADDborder alpha 0 (h/4) w (h/4) (make_rgb 255 0 0); ggd_ADD3Dborder alpha 0 h/2 w (h/4) nil; alpha; ) -> alpha in let _CRcompRollOver ggd_ch ggd_cont ggd_root coord flags nil alpha -> roll in [alpha roll];; fun ggd_CRrollOverCustomAlpha (coord, flags, alpha) = let if (flags == nil) then OBJ_VISIBLE|OBJ_ENABLE|ROL_MASK else flags -> flags in _CRcompRollOver ggd_ch ggd_cont ggd_root coord flags nil alpha;; /********************************************************************/ /* */ /* ggd_CRcheckMini [[I I] I AlphaBitmap] CompCheck */ /* */ /********************************************************************/ fun ggd_CRcheckMini (coord, flags, icone) = let if (flags == nil) then OBJ_ENABLE|OBJ_VISIBLE|ROL_MASK else flags -> flags in GRAPHICDRESSING_CRcompCheckMini ggd_ch ggd_cont ggd_root coord flags nil icone;; /********************************************************************/ /* */ /* ggd_CRcheckMiddle [[I I] I AlphaBitmap] CompCheck */ /* */ /********************************************************************/ fun ggd_CRcheckMiddle (coord, flags, icone) = let if (flags == nil) then OBJ_ENABLE|OBJ_VISIBLE|ROL_MASK else flags -> flags in GRAPHICDRESSING_CRcompCheckMiddle ggd_ch ggd_cont ggd_root coord flags nil icone;; /********************************************************************/ /* */ /* ggd_CRcheckMaxi [[I I] I AlphaBitmap] CompCheck */ /* */ /********************************************************************/ fun ggd_CRcheckMaxi (coord, flags, icone) = let if (flags == nil) then OBJ_ENABLE|OBJ_VISIBLE|ROL_MASK else flags -> flags in GRAPHICDRESSING_CRcompCheckMaxi ggd_ch ggd_cont ggd_root coord flags nil icone;; /**********************************************************************/ /* */ /* ggd_CRcombo [I I I I I] CompCombo */ /* */ /**********************************************************************/ fun ggd_CRcombo (x, y, w, h, flags) = let if (flags == nil) then OBJ_ENABLE|OBJ_VISIBLE else flags -> flags in GRAPHICDRESSING_CRcompCombo ggd_ch ggd_cont /*obj père*/ggd_root [x y] flags /*filtres*/OBJ_CONTAINER_CLICK|OBJ_CONTAINER_MOVE w h ggd_font [ggd_txtColor nil 0 0] [ggd_selectColor ggd_transCoeff] 0;; /**********************************************************************/ /* */ /* ggd_CRtree [I I I I I I] CompTree */ /* */ /**********************************************************************/ fun ggd_CRtree (x, y, w, h, flags) = let if (flags == nil) then OBJ_VISIBLE|OBJ_ENABLE|TRE_HIGHLIGHT_CLICKED else flags -> flags in GRAPHICDRESSING_CRcompTree ggd_ch ggd_cont /*obj père*/ggd_root [x y] flags /*filtres*/OBJ_CONTAINER_MOVE /* taille */w h /* nbr d'items visibles */ ((h / ggd_fontSize) - 10) /* direction (non utilisée à l'heure actuelle (dec 2000)) */ 0 ggd_font /* taille réservée pour imgs */0 /* décalage entre éléments */ 25 [ggd_txtColor nil nil nil] [ggd_selectColor ggd_transCoeff];;