/***
@author	8boomgaa
@date	2010/03/05
@descr	creates a window within you can choose a tao marker
*/

/**
@form	gui_choose_tao_marker_window(+Number)
@descr	opens a windows in which you can choose a tao marker
*/
gui_choose_tao_marker_window:-
	free(@tao_marker_choice),
	new(@tao_marker_choice,dialog('Choose a tao marker')),
	file(taomarker,black,TaoMarkerBlack),
	file(taomarker,yellow,TaoMarkerYellow),
	file(taomarker,red,TaoMarkerRed),
	file(taomarker,green,TaoMarkerGreen),
	file(taomarker,blue,TaoMarkerBlue),
	send(@tao_marker_choice,append,new(YellowTaoMarker,bitmap(TaoMarkerYellow))),
	send(@tao_marker_choice,append,new(RedTaoMarker,bitmap(TaoMarkerRed)),right),
	send(@tao_marker_choice,append,new(GreenTaoMarker,bitmap(TaoMarkerGreen)),right),
	send(@tao_marker_choice,append,new(BlueTaoMarker,bitmap(TaoMarkerBlue)),right),
	send(@tao_marker_choice,append,new(BlackTaoMarker,bitmap(TaoMarkerBlack)),right),
	send(YellowTaoMarker, recogniser, click_gesture(left, '', single, message(@prolog, tao_marker_clicked, 'yellow'))),
	send(RedTaoMarker, recogniser, click_gesture(left, '', single, message(@prolog, tao_marker_clicked, 'red'))),
	send(GreenTaoMarker, recogniser, click_gesture(left, '', single, message(@prolog, tao_marker_clicked, 'green'))),
	send(BlueTaoMarker, recogniser, click_gesture(left, '', single, message(@prolog, tao_marker_clicked, 'blue'))),
	send(BlackTaoMarker, recogniser, click_gesture(left, '', single, message(@prolog, tao_marker_clicked, 'black'))),
	send(@tao_marker_choice,open).

/**
@form	tao_marker_clicked(+Color, +Number)
@descr	is executed on click on tao marker and sends an output
*/
tao_marker_clicked(Color):-
	write_ln(Color),
	tao_marker_color2list(Color,List),
	markerChosen(List),
	write_ln(List),
	send(@tao_marker_choice,destroy).

tao_marker_color2list('yellow',[1,0,0,0,0]).
tao_marker_color2list('red',[0,1,0,0,0]).
tao_marker_color2list('green',[0,0,1,0,0]).
tao_marker_color2list('blue',[0,0,0,1,0]).
tao_marker_color2list('black',[0,0,0,0,1]).
