!******************************************************** !* Creating Object Window (COW) system. !* MACRO MODULE m_icon(); !* This macro module creates an rektangel in the active !* module and generate a cre_icon part call in a MBS-file. !* It demonstrates the use of parameters, constants and !* variables as well as macros and 'add_mbs' calls. !* !* The module was originally created interactively but !* comments and small changes have been added later !* through the MBS-editor. !* !* This program is done for both english and swedish users with !* Linux or WIN95 VARKON system. !* This version of (COW) is a demo with no connection of !* objects to the created windows. !* !* (C) AB Daterra 1997 !* Thomas Hellner !* !******************************************************** INT main_id,hor_streck,ver_streck,rubr1,rubr2,rubr3, bidx,bid1,bid2,bid3,bid4,bid5,bid6,bid7,bid8,bid9,bid10, edit1,edit2,edit3,edit4,edit5,edit6,edit7,edit8,edit9,edit10, icon1,icon2,icon3,icon4,icon2_status; CONSTANT VECTOR main_pos = vec(125,10); CONSTANT FLOAT main_dx= 260,main_dy= 380; CONSTANT STRING BIG_FONT = "-adobe-courier-bold-r-normal--24-240-75-75-m-150-iso8859-1"; CONSTANT STRING MED_FONT = "-adobe-courier-bold-r-normal--18-180-75-75-m-110-iso8859-1"; string errm*32; ref id; STRING bidn*32, ! bidd number pos*132, ! windowcorner uper left b*32, ! windowwidth in pixels h*32, ! windowheight in pixels r*32, ! framethicknes in pixels icon*132, ! iconfile fpen*32, ! iconcol tpen*32; ! textcolor int status; string pm1*132, pm2*132, par*132, doc*132, lang*132, path*132; BEGINMODULE par:="vec(0,0)"; !* !****Declare and get some environment parameters. !* lang:=get_environment("VARKON_INI"); doc:=get_environment("VARKON_PRD"); path:=get_environment("VARKON_PRD"); !* !****Create the main window. !* main_id:=cre_win(main_pos,main_dx,main_dy,"**** COW ****"); !* !****Create the company loggo in the main window. !* if finds(act_ostype(),"WIN")=0 then icon1:=cre_icon(main_id,vec(10,3),3, path+"/Cow/ico/loggo.xbm",7,1); icon1:=cre_icon(main_id,vec(90, 3),3, path+"/Cow/ico/icon.xbm",7,1); else icon1:=cre_icon(main_id,vec(10, 3),3, path+"\Cow\ico\loggo.bmp",7,1); icon1:=cre_icon(main_id,vec(90, 3),3, path+"\Cow\ico\icon.bmp",7,1); endif; !* !****Create the company name in the main window. !* bid5:=cre_button(main_id,vec(60,77),200,15,0, " ** AB DATERRA ** "," "); !* !****Create edit areas for input values in the main window. !* edit1:=cre_edit(main_id,vec(85,100),160,20,2," ",45); edit2:=cre_edit(main_id,vec(85,130),40,20,2,"1",45); edit3:=cre_edit(main_id,vec(85,160),40,20,2,"64",45); edit4:=cre_edit(main_id,vec(85,190),40,20,2,"64",45); edit5:=cre_edit(main_id,vec(85,220),40,20,2,"2",45); edit6:=cre_edit(main_id,vec(85,250),160,20,2,path+"/Cow/ico/icon.xbm",45); edit9:=cre_edit(main_id,vec(85,280),40,20,2,"5",45); edit10:=cre_edit(main_id,vec(85,310),40,20,2,"1",45); !* !****Create text for the edit areas off input values in the main window. !* if finds(lang,"english")=0 then bid6:=cre_button(main_id,vec(10,100),70,20,2,"Position"," P1 ",""); bid4:=cre_button(main_id,vec(10,130),70,20,0,"Id hid"," ",""); bid4:=cre_button(main_id,vec(10,160),70,20,0,"Bredd b"," ",""); bid4:=cre_button(main_id,vec(10,190),70,20,0,"Höjd h"," ",""); bid4:=cre_button(main_id,vec(10,220),70,20,0,"Ram r"," ",""); bid4:=cre_button(main_id,vec(10,250),70,20,0,"Icon ikon"," ",""); bid4:=cre_button(main_id,vec(10,280),70,20,0,"Pen fpen"," ",""); bid4:=cre_button(main_id,vec(10,310),70,20,0,"Text tpen"," ",""); bid1:=cre_button(main_id,vec(5,350),55,22,3,"Ok","Ok",""); bid2:=cre_button(main_id,vec(70,350),55,22,3,"Avbryt","Avbryt",""); bid3:=cre_button(main_id,vec(135,350),55,22,3,"Hjälp","Hjälp",""); else bid6:=cre_button(main_id,vec(10,100),70,20,2,"Position"," P1 ",""); bid4:=cre_button(main_id,vec(10,130),70,20,0,"Id hid"," ",""); bid4:=cre_button(main_id,vec(10,160),70,20,0,"Width b"," ",""); bid4:=cre_button(main_id,vec(10,190),70,20,0,"Heigth h"," ",""); bid4:=cre_button(main_id,vec(10,220),70,20,0,"Frame r"," ",""); bid4:=cre_button(main_id,vec(10,250),70,20,0,"Icon icon"," ",""); bid4:=cre_button(main_id,vec(10,280),70,20,0,"Pen fpen"," ",""); bid4:=cre_button(main_id,vec(10,310),70,20,0,"Text tpen"," ",""); !* !****Create the Ok/Reject/Help buttons in the main window. !* bid1:=cre_button(main_id,vec(5,350),55,22,3,"Ok","Ok",""); bid2:=cre_button(main_id,vec(70,350),55,22,3,"Reject","Reject",""); bid3:=cre_button(main_id,vec(135,350),55,22,3,"Help","Help",""); endif; !* !****Show the main window on screen. !* show_win(main_id); loop: bidx:=wait_win(main_id); !* !****Wait for input. !* if bidx = bid1 then !* !****The Ok button is choisen. !* pos:=get_edit(main_id,edit1); icon:=get_edit(main_id,edit2); b:=get_edit(main_id,edit3); h:=get_edit(main_id,edit4); r:=get_edit(main_id,edit5); icon:=get_edit(main_id,edit6); fpen:=get_edit(main_id,edit9); tpen:=get_edit(main_id,edit10); !* !****Check indata. !* part(#10,m_error(lang,pos,b,h,r,"1","1",errm)); if finds(errm,"0")=0 then goto loop;endif; if test_file(icon,"R") = 0 then exit("Can't open icon file !"); endif; id:=add_mbs("part","men_icon","1", pos,b,h,r,chr(34)+icon+chr(34),fpen,tpen); del_win(main_id); exit(); elif bidx = bid2 then !* !****The Reject button is choisen. !* del_win(main_id); exit(); elif bidx = bid3 then !* !****The Help button is choisen. !* if finds(act_ostype(),"WIN")=0 then part(#20,m_help(doc+"/Cow/doc/cre_icon.doc")); else part(#30,m_help(doc+"\Cow\doc\cre_icon.doc")); endif; goto loop; elif bidx = bid6 then !* !****Some other is choisen. !* part(#40,ma_posw(par,"Icon","Select position",status)); if status = 0 then del_win(main_id,edit1); edit1:=cre_edit(main_id,vec(85,100),160,20,2,par,132); pos:=get_edit(main_id,edit1); show_win(main_id); endif; goto loop; else goto loop; endif; ENDMODULE