!******************************************************** !* Creating Object Window (COW) system. !* MACRO MODULE m_stopra(); !* This macro module creates a number of rektangels in the active !* module and generate several cre_button part calls 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, ikon1,ikon2,ikon3,ikon4,ikon2_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 bx*32, ! distance between in x-way font*132, ! textfont fpen*32, ! subwindow color tpen*32; ! text color int status; float xo; 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 ikon1:=cre_icon(main_id,vec(10,3),3, path+"/Cow/ico/loggo.xbm",7,1); ikon1:=cre_icon(main_id,vec(90, 3),3, path+"/Cow/ico/ok.xbm",7,1); else ikon1:=cre_icon(main_id,vec(10, 3),3, path+"\Cow\ico\loggo.bmp",7,1); ikon1:=cre_icon(main_id,vec(90,3),3, path+"\Cow\ico\ok.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); edit3:=cre_edit(main_id,vec(85,130),40,20,2,"60",45); edit4:=cre_edit(main_id,vec(85,160),40,20,2,"20",45); edit5:=cre_edit(main_id,vec(85,190),40,20,2,"2",45); edit6:=cre_edit(main_id,vec(85,220),40,20,2,"10",45); edit8:=cre_edit(main_id,vec(85,250),40,20,2," ",45); edit9:=cre_edit(main_id,vec(85,280),40,20,2,"6",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,"Bredd b"," ",""); bid4:=cre_button(main_id,vec(10,160),70,20,0,"Höjd h"," ",""); bid4:=cre_button(main_id,vec(10,190),70,20,0,"Ram r"," ",""); bid4:=cre_button(main_id,vec(10,220),70,20,0,"Del i x-led"," ",""); bid4:=cre_button(main_id,vec(10,250),70,20,0,"Font font"," ",""); 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,340),55,22,3,"Ok","Ok",""); bid2:=cre_button(main_id,vec(70,340),55,22,3,"Avbryt","Avbryt",""); bid3:=cre_button(main_id,vec(135,340),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,"Width b"," ",""); bid4:=cre_button(main_id,vec(10,160),70,20,0,"Heigth h"," ",""); bid4:=cre_button(main_id,vec(10,190),70,20,0,"Frame r"," ",""); bid4:=cre_button(main_id,vec(10,220),70,20,0,"Diff. in x"," ",""); bid4:=cre_button(main_id,vec(10,250),70,20,0,"Font font"," ",""); 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,340),55,22,3,"Ok","Ok",""); bid2:=cre_button(main_id,vec(70,340),55,22,3,"Reject","Reject",""); bid3:=cre_button(main_id,vec(135,340),55,22,3,"Help","Help",""); endif; !* !****Show the main window on screen. !* show_win(main_id); loop: !* !****Wait for input. !* bidx:=wait_win(main_id); if bidx = bid1 then !* !****The Ok button is choisen. !* pos:=get_edit(main_id,edit1); b:=get_edit(main_id,edit3); h:=get_edit(main_id,edit4); r:=get_edit(main_id,edit5); bx:=get_edit(main_id,edit6); font:=get_edit(main_id,edit8); 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 finds(font,"FONT")=0 then font:="""""";endif; xo:=0; if finds(lang,"english")=0 then ! Ok-knapp id:=add_mbs("part","men_button","1", pos+"+vec("+str(xo,4,0)+","+str(0,4,0)+")", b,h,r,chr(34)+"Ok"+chr(34),chr(34)+"Ok"+chr(34), chr(34)+font+chr(34),fpen,tpen); xo:=val(b)+val(bx); ! Avbryt-knapp id:=add_mbs("part","men_button","2", pos+"+vec("+str(xo,4,0)+","+str(0,4,0)+")", b,h,r,chr(34)+"Avbryt"+chr(34),chr(34)+"Avbryt"+chr(34), chr(34)+font+chr(34),fpen,tpen); xo:=(val(b)+val(bx))*2; ! Hjälp-knapp id:=add_mbs("part","men_button","3", pos+"+vec("+str(xo,4,0)+","+str(0,4,0)+")", b,h,r,chr(34)+"Hjälp"+chr(34),chr(34)+"Hjälp"+chr(34), chr(34)+font+chr(34),fpen,tpen); else ! Ok-button id:=add_mbs("part","men_button","1", pos+"+vec("+str(xo,4,0)+","+str(0,4,0)+")", b,h,r,chr(34)+"Ok"+chr(34),chr(34)+"Ok"+chr(34), chr(34)+font+chr(34),fpen,tpen); xo:=val(b)+val(bx); ! Reject-button id:=add_mbs("part","men_button","2", pos+"+vec("+str(xo,4,0)+","+str(0,4,0)+")", b,h,r,chr(34)+"Reject"+chr(34),chr(34)+"Avbryt"+chr(34), chr(34)+font+chr(34),fpen,tpen); xo:=(val(b)+val(bx))*2; ! Help-knapp id:=add_mbs("part","men_button","3", pos+"+vec("+str(xo,4,0)+","+str(0,4,0)+")", b,h,r,chr(34)+"Help"+chr(34),chr(34)+"Hjälp"+chr(34), chr(34)+font+chr(34),fpen,tpen); endif; del_win(main_id); exit(); elif bidx = bid2 then !* !****The Reject button is choisen. !* del_win(main_id); exit(); elif bidx = bid6 then !* !****Some other is choisen. !* part(#40,ma_posw(par,"OK/REJECT","Select base 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