{  This file is part of OptGeo, optical simulation software
    Copyright (C) 2004  Jean-Marie Biansan
        Contact: jeanmarie.biansan@free.fr
    Web site: http://jeanmarie.biansan.free.fr/logiciel.html
 From version 1.25, OptGeo is distribued under the terms of the
 GNU General Public License.

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA}


    unit saisiejoli1;

{$mode objfpc}{$H+}

interface

uses
  LCLIntf, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, Buttons, Colorbox, Spin, ExtCtrls,unit222, LResources,LCLType,
  UChaines;

type

  { Tsaisiefle1 }

  { Tsaisiejoli1 }

  Tsaisiejoli1 = class(TForm)
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    GroupBox2: TGroupBox;
    radioext1: TRadioGroup;
    GroupBox1: TGroupBox;
    SpinEditepaisseur: TSpinEdit;
    spintaille1: TSpinEdit;
    StaticText1: TLabel;
    StaticText3: TLabel;
    GroupBox4: TGroupBox;
    ColorGrid1: TColorBox;
    GroupBox5: TGroupBox;
    StaticText5: TLabel;
    StaticText6: TLabel;
    editx1: TEdit;
    edity1: TEdit;
    boutonsup: TBitBtn;
    log1: TLabel;
    log2: TLabel;
    procedure BitBtn1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure FormShow(Sender: TObject);
  private  encreation:boolean;
    { Déclarations privées }
  public
    { Déclarations publiques }
  end;

var
  saisiejoli: Tsaisiejoli1;


   ra_style:TTypePoint;
   ra_couleur:tcolor;
    ra_taille,ra_epaisseur:integer;
    ra_x1,ra_y1:extended;
implementation





procedure Tsaisiejoli1.BitBtn1Click(Sender: TObject);
begin
 ra_taille:=spintaille1.value;
 ra_epaisseur:=SpinEditepaisseur.value;
 case radioext1.itemindex of
 0: ra_style:=tpcercle;
  1: ra_style:=tpcroixp;
  2: ra_style:=tpcroixx;
  3: ra_style:=tpdisque;
  4: ra_style:=tpcarre;
  5: ra_style:=tpcarreplein;
  6: ra_style:=tptriangle;
  7: ra_style:=tptriangleplein;

 end;



 ra_couleur:=colorgrid1.selected;

 try
 ra_x1:=strtofloat(editx1.text);
 except
 on    EConvertError  do begin
 application.messagebox(pchar(rsValeurInacce44),
 pchar(rsAttention), mb_ok);
 exit;
 end;  end;
 if ((ra_x1<xxmin) or (ra_x1>xxmax)) then begin
 application.messagebox(pchar(rsValeurInacce44),
 pchar(rsattention),mb_ok);
 exit;
 end;

try
 ra_y1:=strtofloat(edity1.text);
 except
 on    EConvertError  do begin
 application.messagebox(pchar(rsValeurInacce43),
 pchar(rsattention),mb_ok);
 exit;
 end;  end;
 if ((ra_y1<yymin) or (ra_y1>yymax)) then begin
 application.messagebox(pchar(rsValeurInacce43),
 pchar(rsattention),mb_ok);
 exit;
 end;






 ReTaillePjolipoint(Listejolipoint,nombrejolipoint,nombrejolipoint+1);

 inc(nombrejolipoint);
if not
(Listejolipoint[-1+nombrejolipoint].create(ra_x1,ra_y1,
ra_taille,ra_epaisseur,
ra_couleur,ra_style)) then begin
ReTaillepjolipoint(Listejolipoint,nombrejolipoint,nombrejolipoint-1);
dec(nombrejolipoint);
application.messagebox(pchar(rsPointTropPet),
pchar(rsattention),mb_ok);

end else
self.modalresult:=mrOk;
Rafraichit;

end;

procedure Tsaisiejoli1.FormCreate(Sender: TObject);
begin
   encreation:=true;
   BITBTN1.CAPTION  :=rsOK;

BITBTN2.CAPTION :=rsAnnuler;


BOUTONSUP.CAPTION :=rsSupprimerCeT3;


CAPTION :=rsAjoutDUnPoin;


GROUPBOX1.CAPTION  :=rsTaille2;

   GROUPBOX2.CAPTION :=rsEpaisseur;


GROUPBOX4.CAPTION :=rsCouleur2;


GROUPBOX5.CAPTION :=rsCoordonnEsDu5;


LOG1.CAPTION  :=rsLog1;

LOG2.CAPTION :=rsLog2;


RADIOEXT1.CAPTION:=rsForme;

STATICTEXT1.CAPTION :=rsEn11000DeLaD;

STATICTEXT3.CAPTION:=rsDeLEspaceDeT;

STATICTEXT5.CAPTION :=rsX;

STATICTEXT6.CAPTION:=rsY;

radioext1.Items[0]:=rsCercle;
radioext1.Items[1]:=rsCroix;
radioext1.Items[2]:=rsCroixX;
radioext1.Items[3]:=rsDisque;
radioext1.Items[4]:=rsCarr;
radioext1.Items[5]:=rsCarrPlein;
radioext1.Items[6]:=rsTriangle;
radioext1.Items[7]:=rsTrianglePlei;



end;

procedure Tsaisiejoli1.FormShow(Sender: TObject);
begin
  //if encreation then begin scalefont(self); encreation:=false; end;
end;

initialization
  {$i saisiejoli1.lrs}


end.
