View.Set ("graphics:max,max")
var mx , my , mb : int
var col : int := red %colour
var current_tool : string := "no tool "
var pocahontas_stamp : int := Pic.FileNew ("pocahontas.jpg")
var dora_stamp : int := Pic.FileNew ("dora.jpg")
var cinderella_stamp : int := Pic.FileNew ("cinderella.jpg")
var snowwhite_stamp : int := Pic.FileNew ("snowwhite.jpg")
var font : int := Font.New ("sans serif:14:bold")
%Drawing the Screen
%Tools
Pic.Draw (dora_stamp, 50,40,picCopy) %save)
drawbox (50,40,110,110, black)
Pic.Draw (cinderella_stamp, 50,450,picCopy) %save)
drawbox (50,450,130,530, black)
Pic.Draw (snowwhite_stamp, 50,350,picCopy) %save)
drawbox (35,345,145,430, black)
drawbox (50, 120, 100, 170, black) %load
Font.Draw ("Load", 51, 140, font, white)
drawbox (50, 190, 100, 240, black) % pocahontas
Pic.Draw (pocahontas_stamp, 50, 190, picCopy)
drawbox (50,180,110,259, black)
drawbox (50, 260, 100, 310, black) %save
Font.Draw ("Save", 51, 280, font, red)
%Canvas
drawbox (200, 100, 900, 500, black)
loop
mousewhere (mx, my, mb)
% tool selection
if mb = 1 and mx > 50 and my > 450 and mx < 130 and my < 530 then
current_tool := "cinderella"
if mb = 1 and mx > 35 and my > 345 and mx < 145 and my < 430 then
current_tool := "snowwhite"
if mb = 1 and mx > 50 and my > 40 and mx < 110 and my < 110 then
current_tool := "dora"
elsif mb = 1 and mx > 50 and my > 120 and mx < 100 and my < 170 then % load
Pic.ScreenLoad ("mypic.bmp", 250, 50, picCopy)
elsif mb = 1 and mx > 50 and my > 180 and mx < 110 and my < 259 then
current_tool := "pocahontas"
elsif mb = 1 and mx > 50 and my > 260 and mx < 100 and my < 310 then %save
Pic.ScreenSave (250, 50, 800, 400, "mypic.bmp")
elsif mb = 1 and mx > 200 and my > 100 and mx < 900 and my < 500 then
%user has clicked in canvas
if current_tool = "dora" then
Pic.Draw (dora_stamp, mx - 25, my - 25, picCopy)
elsif current_tool = "pocahontas" then
Pic.Draw (pocahontas_stamp, mx - 25, my - 25, picCopy)
elsif current_tool = "cinderella" then
Pic.Draw (cinderella_stamp, mx - 25, my - 25, picCopy)
elsif current_tool = "snowwhite" then
Pic.Draw (snowwhite_stamp, mx - 25, my - 25, picCopy)
end if
end if
end if
end if
end loop