#!/usr/bin/perl

use Tk;
use Tk::LabEntry;
use FileHandle;
use strict;

my @dataR = ();
my @dataV = ();
my $pi = 3.1415926535897931;

open SUB, "|./sub";

my $sx = 0.1;
my $sy = 0.1;
my $theta = 0;
my $pts = 250;

my $mw = new MainWindow;
$mw->configure(-title=>"PMC Demo");
$mw->Button(-text => "Quit", 
	    -command => sub {syswrite SUB, "Q\n"; exit(0)} )->pack();
$mw->Button(-text => "Learn", 
	    -command => sub {syswrite SUB, "L\n"} )->pack();
$mw->Button(-text => "Animated Learn", 
	    -command => sub {syswrite SUB, "AL\n"} )->pack();
$mw->Button(-text => "Save Datas", 
	    -command => sub {syswrite SUB, "SDB\n"} )->pack();
$mw->Button(-text => "Clear", 
	    -command => sub {syswrite SUB, "CL\n"} )->pack();
$mw->Button(-text => "Reset NN", 
	    -command => sub {syswrite SUB, "RNN\n"} )->pack();
$mw->Button(-text => "Place red point", 
	    -command => sub {syswrite SUB, "CR\n"} )->pack();
$mw->Button(-text => "Place green point", 
	    -command => sub {syswrite SUB, "CG\n"} )->pack();
$mw->Button(-text => "Place Gaussian\ndistribution\nof red points", 
	    -command => sub {
		syswrite SUB, "CRG\n$sx\n$sy\n$theta\n$pts\n";
	    } )->pack();
$mw->Button(-text => "Place Gaussian\ndistributions\nof green points", 
	    -command => sub {
		syswrite SUB, "CGG\n$sx\n$sy\n$theta\n$pts\n";
	    } )->pack();
$mw->LabEntry(-label => "'X' size of Gaussian", 
	      -textvariable => \$sx)->pack(-side => "top");
$mw->LabEntry(-label => "'Y' size of Gaussian", 
	      -textvariable => \$sy)->pack(-side => "top");
$mw->LabEntry(-label => "Angle of gaussian", 
	      -textvariable => \$theta)->pack(-side => "top");
$mw->LabEntry(-label => "Number of points", 
	      -textvariable => \$pts)->pack(-side => "top");

MainLoop;

