/* Module 'newsHTML' - by iri : http://www.irizone.net */
/* version 1.0 - juillet 2004 - copyleft iri */
typeof t_head = ObjText;;
typeof t_foot = ObjText;;
typeof t_file = ObjText;;
typeof t_news = ObjText;;
var bgcolor = 0xffffff;;
var text = 0;;
var link = 0xff0000;;
var vlink = 0xff;;
var alink = 0xff;;
fun cbText(t, u)=
let _GETtext t_file -> string in
_SETtext t_news _getpack _checkpack string;
0;;
fun _paintE(win, u)=
_PAINTrectangle win 90 55 15 15 DRAW_SOLID 1 0 DRAW_SOLID bgcolor;
_PAINTrectangle win 170 55 15 15 DRAW_SOLID 1 0 DRAW_SOLID text;
_PAINTrectangle win 250 55 15 15 DRAW_SOLID 1 0 DRAW_SOLID link;
_PAINTrectangle win 330 55 15 15 DRAW_SOLID 1 0 DRAW_SOLID vlink;
_PAINTrectangle win 410 55 15 15 DRAW_SOLID 1 0 DRAW_SOLID alink;;
fun _endColor1(a)= if a != nil then set bgcolor = a else nil;;
fun _endColor2(a)= if a != nil then set text = a else nil;;
fun _endColor3(a)= if a != nil then set link = a else nil;;
fun _endColor4(a)= if a != nil then set vlink = a else nil;;
fun _endColor5(a)= if a != nil then set alink = a else nil;;
fun is_in_box(x, y, bx, by, bw, bh)=
(x >= bx) && (x <= (bx+bw)) && (y >= by) && (y <= (by+bh));;
/* fun [ObjWin Chn I I I] I */
fun _clickE(win, ch, x, y, btn)=
if is_in_box x y 90 55 15 15 then
_CRcolorMap ch win 100 100 "Choose color ?" @_endColor1 bgcolor
else
nil;
if is_in_box x y 170 55 15 15 then
_CRcolorMap ch win 100 100 "Choose color ?" @_endColor2 text
else
nil;
if is_in_box x y 250 55 15 15 then
_CRcolorMap ch win 100 100 "Choose color ?" @_endColor3 link
else
nil;
if is_in_box x y 330 55 15 15 then
_CRcolorMap ch win 100 100 "Choose color ?" @_endColor4 vlink
else
nil;
if is_in_box x y 410 55 15 15 then
_CRcolorMap ch win 100 100 "Choose color ?" @_endColor5 alink
else
nil;
0;;
/* fun [[S r1]] I */
fun setData(data, msg)=
let lineextr data -> [Phead[Pfoot[Pbgcolor[Ptext[Plink[Pvlink[Palink[_[Pfile _]]]]]]]]] in
(
_SETtext t_head Phead;
_SETtext t_foot Pfoot;
_SETtext t_file Pfile;
cbText nil nil;
/* if msg != nil then _SETtext t_news msg else nil; */
set bgcolor = if Pbgcolor != nil then atoi Pbgcolor else bgcolor;
set text = if Ptext != nil then atoi Ptext else text;
set link = if Plink != nil then atoi Plink else link;
set vlink = if Pvlink != nil then atoi Pvlink else vlink;
set alink = if Palink != nil then atoi Palink else alink;
);;
/* fun [ObjWin fun [S] I] I */
fun _destroyE(a, f)=
exec f with [nil nil];;
/* fun [] S */
fun getData()=
if !strcmp _GETtext t_head "" then _showconsole else nil;
linebuild (_GETtext t_head)::
(_GETtext t_foot)::
(itoa bgcolor)::
(itoa text)::
(itoa link)::
(itoa vlink)::
(itoa alink)::
(_GETtext t_file)::
nil;;
/* fun [ObjButton [fun [S] I ObjWin]] I */
fun cbOk(btn, p)=
let p -> [f win] in
(
_DSwindow win;
exec f with [getData _GETtext t_news]
);;
/* fun [Chn ObjWin I I I I S I] I */
fun iniWinAdmin(ch, daddy, x, y, w, h, title, end, data, msg, flag)=
let _CRwindow ch daddy x y w h if flag then
WN_CHILDINSIDE|WN_NOCAPTION|WN_NOBORDER /* editeur */
else
WN_MENU+WN_MINBOX /* client */
title -> win in
(
/* intitulés des champs */
_CRtext ch win 5 5 80 20 ET_BORDER "Title :";
_CRtext ch win 5 30 80 20 ET_BORDER "Link :";
_CRtext ch win 5 80 80 20 ET_BORDER "File :";
_CRtext ch win 5 105 w-10 20 ET_BORDER "News :";
/* intitulés des pastilles de couleur */
_CRtext ch win 5 55 80 20 ET_BORDER "Bgcolor :";
_CRtext ch win 110 55 50 20 ET_BORDER "text :";
_CRtext ch win 190 55 50 20 ET_BORDER "link :";
_CRtext ch win 270 55 50 20 ET_BORDER "vlink :";
_CRtext ch win 350 55 50 20 ET_BORDER "alink :";
/* champs éditables */
set t_head = _CReditLine ch win 90 5 w-95 20 ET_DOWN "";
set t_foot = _CReditLine ch win 90 30 w-95 20 ET_DOWN "";
set t_file = _CReditLine ch win 90 80 w-95 20 ET_DOWN "";
set t_news = _CReditText ch win 5 130 w-10 99 ET_DOWN|ET_VSCROLL|ET_AHSCROLL "";
/* affichage des paramètres actuelles */
setData data msg;
/* bouton de validation */
_CBbutton _CRbutton ch win 5 235 w-10 20 0 "OK" @cbOk [end win];
/* définitions des callbacks nécessaires */
_CBtext t_file @cbText 0;
_CBwinPaint win @_paintE nil;
_CBwinClick win @_clickE ch;
_CBwinDestroy win @_destroyE end;
0
);;