259 lines
5.9 KiB
ObjectPascal
259 lines
5.9 KiB
ObjectPascal
unit UInit;
|
|
|
|
interface
|
|
|
|
uses
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
Dialogs, Menus, ExtCtrls;
|
|
|
|
type
|
|
// T_APoints = array of TPoint;
|
|
|
|
|
|
T_Relais = record
|
|
P,Pd:TPoint;
|
|
modele,nom : string;
|
|
EtatB : boolean;
|
|
Select,Visible:boolean;
|
|
Fonction : integer;
|
|
AppPot : array [0..3] of integer;
|
|
tpo,tpr:longword;
|
|
end;
|
|
|
|
T_Connect = record
|
|
P:TPoint;
|
|
Select:boolean;
|
|
AppaPotentiel : integer;
|
|
Parcouru :integer;
|
|
end;
|
|
|
|
T_Contact = record
|
|
P,Pd:TPoint;
|
|
modele,nom : string;
|
|
Select, visible : boolean;
|
|
EtatI, EtatP, EtatF : boolean;
|
|
Manuel : boolean;
|
|
Fonction : integer;
|
|
Parcouru :integer;
|
|
cl0,cl1,cl2:TColor;
|
|
end;
|
|
|
|
T_Segment = record
|
|
P1,P2:TPoint;
|
|
Select1,Select2 : boolean;
|
|
Cote1,Cote2 : string;
|
|
AppaBranche : integer;
|
|
end;
|
|
|
|
T_Alim = record
|
|
P:TPoint;
|
|
modele : string;
|
|
Select:boolean;
|
|
Parcouru :integer;
|
|
end;
|
|
|
|
T_Compo = record
|
|
P:TPoint;
|
|
modele : string;
|
|
Select:boolean;
|
|
AppPot : array [0..3] of integer;
|
|
end;
|
|
|
|
T_Lampe = record
|
|
P,Pd:TPoint;
|
|
modele,nom : string;
|
|
Clr0,Clr1:TColor;
|
|
EtatB : boolean;
|
|
AppPot : array [0..3] of integer;
|
|
Select,Visible:boolean;
|
|
end;
|
|
|
|
T_Branche = record
|
|
AppaPotentiel : integer;
|
|
EtatP, EtatF : boolean;
|
|
CompSegments :array of integer;
|
|
Cote1,Cote2 : string;
|
|
Courant:integer;
|
|
Parcouru :integer;
|
|
end;
|
|
|
|
T_Potentiel = record
|
|
CompBranches :array of integer;
|
|
Rp,Rm,PRp,PRm,Np,Nm:integer;
|
|
end;
|
|
|
|
T_Fonction = record
|
|
nom,comp : string;
|
|
x:integer;
|
|
EtatP, EtatF : boolean;
|
|
end;
|
|
|
|
procedure Initialisation;
|
|
|
|
var
|
|
ClrFd : TColor=clWhite; // couleur de fond
|
|
ClrGr : TColor=$00C8C8C8; // couleur grille
|
|
Zoom : Real;
|
|
Facteur,sbx,sby : Integer;
|
|
Nb_Relais, Nb_Connect, Nb_Contact, Nb_Segment, Nb_Alim, Nb_Compo, Nb_Lampe : Integer;
|
|
Nb_Branche, Nb_Potentiel, Nb_Fonction : Integer;
|
|
|
|
L_Relais : array of T_Relais;
|
|
L_Connect : array of T_Connect;
|
|
L_Contact : array of T_Contact;
|
|
L_Compo : array of T_Compo;
|
|
L_Segment : array of T_Segment;
|
|
L_Alim : array of T_Alim;
|
|
L_Branche : array of T_Branche;
|
|
L_Potentiel : array of T_Potentiel;
|
|
L_Fonction : array of T_Fonction;
|
|
L_Lampe : array of T_Lampe;
|
|
|
|
// L_ContactX : array[0 .. 15] of T_APoints;
|
|
L_ContactX : array[0 .. 15] of array of TPoint;
|
|
L_CompoX : array[0 .. 4] of array of TPoint;
|
|
L_RelaisX : array[0 .. 14] of array of TPoint;
|
|
L_LampeX : array[0 .. 4] of array of TPoint;
|
|
|
|
dX, dY,fX, fY: double;
|
|
|
|
CompoEnCours,sss,EtatF:string;
|
|
NumeroEnCours:integer;
|
|
EnCours,pulse:boolean;
|
|
|
|
bEdit,bRelier,bLier,bExec,bExec2:boolean;
|
|
bSelectionner,bSelection: boolean;
|
|
|
|
gtm: LongInt;
|
|
bct:boolean;
|
|
gtc,gtc1:cardinal;
|
|
|
|
implementation
|
|
|
|
uses unit1, UDessin;
|
|
|
|
procedure Initialisation;
|
|
var i:integer;
|
|
begin
|
|
bRelier:=false;
|
|
bExec:=false;
|
|
bExec2:=false;
|
|
Zoom:=1;
|
|
Facteur:=16;
|
|
|
|
CompoEnCours:='';
|
|
NumeroEnCours:=-1;
|
|
EnCours:=false;
|
|
//Deplacer:=false;
|
|
|
|
Nb_relais:=0; Nb_Connect:=0;Nb_Contact:=0; Nb_Segment:=0; Nb_Alim:=0; Nb_Compo:=0;
|
|
Nb_Branche:=0; Nb_Potentiel:=0; Nb_Fonction:=0; Nb_Lampe:=0;
|
|
|
|
With Form1 do begin
|
|
//Pnl_Haut.Align:=alTop;
|
|
Pnl_Editer.Align:=alTop;
|
|
Pnl_Composants.Align:=alTop;
|
|
Pnl_Image.Align:=alClient;
|
|
Image.Align:=alClient;
|
|
Image.Canvas.Font.Name:='Arial';
|
|
Pnl_Editer.Visible:=false;
|
|
Pnl_Composants.Visible:=false;
|
|
end;
|
|
Affichage;
|
|
// affecte les connexions aux composants
|
|
for i:=1 to 17 do begin
|
|
setlength(L_ContactX[i],2);
|
|
if (i=1) or (i=2) or (i=10) or (i=13) or (i=14) or (i=15) or (i=16) or (i=17) then begin
|
|
L_ContactX[i,0]:=Point(-1,0);
|
|
L_ContactX[i,1]:=Point(1,0);
|
|
end;
|
|
if (i=3) or (i=11) then begin
|
|
L_ContactX[i,0]:=Point(-1,1);
|
|
L_ContactX[i,1]:=Point(1,1);
|
|
end;
|
|
if (i=4) or (i=12) then begin
|
|
L_ContactX[i,0]:=Point(-1,1);
|
|
L_ContactX[i,1]:=Point(1,1);
|
|
end;
|
|
if (i=7) then begin
|
|
L_ContactX[i,0]:=Point(1,-1);
|
|
L_ContactX[i,1]:=Point(0,1);
|
|
end;
|
|
if (i=8) then begin
|
|
L_ContactX[i,0]:=Point(-1,-1);
|
|
L_ContactX[i,1]:=Point(0,1);
|
|
end;
|
|
if (i=9) then begin
|
|
setlength(L_ContactX[i],3);
|
|
L_ContactX[i,0]:=Point(0,1);
|
|
L_ContactX[i,1]:=Point(1,-1);
|
|
L_ContactX[i,2]:=Point(-1,-1);
|
|
end;
|
|
if (i=5) then begin
|
|
setlength(L_ContactX[i],3);
|
|
L_ContactX[i,0]:=Point(-1,1);
|
|
L_ContactX[i,1]:=Point(1,0);
|
|
L_ContactX[i,2]:=Point(1,1);
|
|
end;
|
|
if (i=6) then begin
|
|
setlength(L_ContactX[i],3);
|
|
L_ContactX[i,0]:=Point(1,1);
|
|
L_ContactX[i,1]:=Point(-1,0);
|
|
L_ContactX[i,2]:=Point(-1,1);
|
|
end;
|
|
end; // ContactX
|
|
|
|
for i:=1 to 1 do begin
|
|
setlength(L_CompoX[i],2);
|
|
if (i=1) then begin
|
|
L_CompoX[i,0]:=Point(-1,0);
|
|
L_CompoX[i,1]:=Point(1,0);
|
|
end;
|
|
end; // CompoX
|
|
|
|
for i:=1 to 2 do begin
|
|
setlength(L_LampeX[i],2);
|
|
if (i=1) then begin
|
|
L_LampeX[i,0]:=Point(-1,0);
|
|
L_LampeX[i,1]:=Point(1,0);
|
|
end;
|
|
if (i=2) then begin
|
|
L_LampeX[i,0]:=Point(0,-1);
|
|
L_LampeX[i,1]:=Point(0,1);
|
|
end;
|
|
end; // LampeX
|
|
|
|
for i:=1 to 14 do begin
|
|
setlength(L_RelaisX[i],2);
|
|
if (i=1) or (i=4) or (i=7) then begin
|
|
L_RelaisX[i,0]:=Point(-1,0);
|
|
L_RelaisX[i,1]:=Point(1,0);
|
|
end;
|
|
if (i=2) or (i=5) or (i=8) then begin
|
|
L_RelaisX[i,0]:=Point(-1,0);
|
|
L_RelaisX[i,1]:=Point(-1,1);
|
|
end;
|
|
if (i=3) or (i=6) or (i=9) then begin
|
|
L_RelaisX[i,0]:=Point(1,0);
|
|
L_RelaisX[i,1]:=Point(1,1);
|
|
end;
|
|
if (i=10) then begin // basculeur
|
|
setlength(L_RelaisX[i],4);
|
|
L_RelaisX[i,0]:=Point(-2,0);
|
|
L_RelaisX[i,1]:=Point(-2,1);
|
|
L_RelaisX[i,2]:=Point(2,0);
|
|
L_RelaisX[i,3]:=Point(2,1);
|
|
end;
|
|
if (i=11) or (i=12) then begin // basculeur
|
|
setlength(L_RelaisX[i],4);
|
|
L_RelaisX[i,0]:=Point(-1,-1);
|
|
L_RelaisX[i,1]:=Point(1,-1);
|
|
L_RelaisX[i,2]:=Point(-1,1);
|
|
L_RelaisX[i,3]:=Point(1,1);
|
|
end;
|
|
end; // RelaisX
|
|
end;
|
|
|
|
|
|
end.
|