Umiestnenie súboru www.TrSek.com/cover/koupy/enigma_crypter.pas{ ENIGMA.PAS Copyright (c) Petr Koupy }
{ }
{ Program slou¾í k ¹ifrování a de¹ifrování textu pomocí ¹ifry Enigma}
{ pou¾ívané bìhem druhé svìtové války. Konkrétnì se jedná o základní}
{ verzi se tøemi scramblery, kterou na zaèátku války pou¾ívaly }
{ jednotky Wehrmacht a Luftwaffe. Program pou¾ívá stejný vnitøní }
{ mechanismus, tak¾e je s prvotní verzí Enigmy kompatibilní }
{(doká¾e de¹ifrovat nìmecké váleèné depe¹e z poèátku války). }
{ Kompatibilita není zaji¹tìna pro pozdìj¹í verze Enigmy, které }
{ mìly více scramblerù a jiné vnitøní zapojení. }
{ }
{ Program vznikl v rámci práce Dìjiny kryptologie do soutì¾e SOÈ. }
{ }
{ Datum:01.03.2007 http://www.trsek.com }
Memo2.Clear;
Gauge1.Progress:=0;
z:=0;
for x:=0 to Memo1.Lines.Count do
begin
retezec:=Memo1.Lines[x];
for y:=1 to Length(retezec) do
begin
z:=z+1;
end;
end;
Gauge1.MaxValue:=z;
//zaèátek registrace vstupního nastavení
case ComboBox1.ItemIndex of
0: scrambler1:=I;
1: scrambler1:=II;
2: scrambler1:=III;
end;
case ComboBox2.ItemIndex of
0: begin scrambler2:=I; skok2:=skok_I; end;
1: begin scrambler2:=II; skok2:=skok_II; end;
2: begin scrambler2:=III; skok2:=skok_III; end;
end;
case ComboBox3.ItemIndex of
0: begin scrambler3:=I; skok3:=skok_I; end;
1: begin scrambler3:=II; skok3:=skok_II; end;
2: begin scrambler3:=III; skok3:=skok_III; end;
end;
rotor1:=ComboBox4.ItemIndex+1;
rotor2:=ComboBox5.ItemIndex+1;
rotor3:=ComboBox6.ItemIndex+1;
if rotor2=skok2-1 then hacek:=true else hacek:=false;
//konec registrace vstupního nastavení
//zaèátek (de)‘ifrováni
for x:=0 to Memo1.Lines.Count-1 do //postupné zpracování øádkù
begin
vstupnitext:=Memo1.Lines[x]; //naètení x-tého øádku vstupního textu
vystupnitext:=''; //vynulování výstupního øádku z minulého cyklu
for y:=1 to Length(vstupnitext) do //postupné zpracování znakù v øádku
begin
Application.ProcessMessages; //vypoèetní prostor pro jiné aplikace
//uspání cyklu pøi snížení rychlosti
if (ScrollBar1.Position<491) AND (stop=false) then
begin
zpozdeni:=500-ScrollBar1.Position;
Sleep(zpozdeni);
Edit2.Enabled:=true;
Edit3.Enabled:=true;
Edit4.Enabled:=true;
end
else
begin
Edit2.Enabled:=false;
Edit3.Enabled:=false;
Edit4.Enabled:=false;
end;
znak:=vstupnitext[y]; //naètení y-tého znaku øádku vstupního textu
//pøièítání hodnoty stavového proužku od 0% do 100%
if stop=false then Gauge1.Progress:=Gauge1.Progress+1
else Gauge1.Progress:=0;
//zji‘tìní místa znaku v abecedì
for z:=1 to Length(ABC) do
begin
if znak=ABC[z] then misto:=z;
end;
//první zámìna znaku podle propojovací desky
if ComboBox7.ItemIndex=misto-1 then misto:=ComboBox8.ItemIndex+1 else
begin if ComboBox8.ItemIndex=misto-1 then misto:=ComboBox7.ItemIndex+1; end;
if ComboBox9.ItemIndex=misto-1 then misto:=ComboBox10.ItemIndex+1 else
begin if ComboBox10.ItemIndex=misto-1 then misto:=ComboBox9.ItemIndex+1; end;
if ComboBox11.ItemIndex=misto-1 then misto:=ComboBox12.ItemIndex+1 else
begin if ComboBox12.ItemIndex=misto-1 then misto:=ComboBox11.ItemIndex+1; end;
if ComboBox13.ItemIndex=misto-1 then misto:=ComboBox14.ItemIndex+1 else
begin if ComboBox14.ItemIndex=misto-1 then misto:=ComboBox13.ItemIndex+1; end;
if ComboBox15.ItemIndex=misto-1 then misto:=ComboBox16.ItemIndex+1 else
begin if ComboBox16.ItemIndex=misto-1 then misto:=ComboBox15.ItemIndex+1; end;
if ComboBox17.ItemIndex=misto-1 then misto:=ComboBox18.ItemIndex+1 else
begin if ComboBox18.ItemIndex=misto-1 then misto:=ComboBox17.ItemIndex+1; end;
//rotace scramblerù s uplatnìním double-step mechanismu
rotor3:=(rotor3+1) mod 26;
if rotor3=0 then rotor3:=26;
if rotor3=skok3 then rotor2:=(rotor2+1) mod 26;
if (rotor3=skok3+1) AND (rotor2=skok2-1) then
begin
rotor2:=(rotor2+1) mod 26;
rotor1:=(rotor1+1) mod 26;
hacek:=false;
end;
if rotor2=0 then rotor2:=26;
if rotor2=skok2-1 then hacek:=true;
if (rotor2=skok2) AND (hacek=true) then
begin
rotor1:=(rotor1+1) mod 26;
hacek:=false;
end;
if rotor1=0 then rotor1:=26;
if Edit2.Enabled=true then Edit2.Text:=ComboBox4.Items[rotor1-1];
if Edit3.Enabled=true then Edit3.Text:=ComboBox5.Items[rotor2-1];
if Edit4.Enabled=true then Edit4.Text:=ComboBox6.Items[rotor3-1];
//výstup pravého scrambleru
temp3:=scrambler3[(rotor3-1+misto) mod 26];
if temp3='' then temp3:=scrambler3[26];
//zji‘tìní místa výstupu pravého scrambleru v abecedì
for z:=1 to Length(ABC) do
begin
if temp3=ABC[z] then misto:=z;
end;
//výstup prostøedního scrambleru
temp2:=scrambler2[(((((26-rotor3+1) mod 26)+misto) mod 26)+rotor2-1) mod 26];
if temp2='' then temp2:=scrambler2[26];
//zji‘tìní místa výstupu prostøedního scrambleru v abecedì
for z:=1 to Length(ABC) do
begin
if temp2=ABC[z] then misto:=z;
end;
//výstup levého scrambleru
temp1:=scrambler1[(((((26-rotor2+1) mod 26)+misto) mod 26)+rotor1-1) mod 26];
if temp1='' then temp1:=scrambler1[26];
//zji‘tìní místa výstupu levého scrambleru v abecedì
for z:=1 to Length(ABC) do
begin
if temp1=ABC[z] then misto:=z;
end;
//výstup reflektoru
tempR:=R[(((26-rotor1+1) mod 26)+misto) mod 26];
if tempR='' then tempR:=R[26];
for z:=1 to Length(ABC) do
begin
if tempR=ABC[z] then misto:=z;
end;
tempR:=ABC[(misto+rotor1-1) mod 26];
if tempR='' then tempR:=ABC[26];
//zji‘tìní místa výstupu reflektoru v levém scrambleru
for z:=1 to Length(scrambler1) do
begin
if tempR=scrambler1[z] then misto:=z;
end;
//výstup levého scrambleru zpátky
temp1:=ABC[(((((26-rotor1+1) mod 26)+misto) mod 26)+rotor2-1) mod 26];
if temp1='' then temp1:=ABC[26];
//zji‘tìní místa výstupu levého scrambleru v prostøedním scrambleru
for z:=1 to Length(scrambler2) do
begin
if temp1=scrambler2[z] then misto:=z;
end;
//výstup prostøedního scrambleru zpátky
temp2:=ABC[(((((26-rotor2+1) mod 26)+misto) mod 26)+rotor3-1) mod 26];
if temp2='' then temp2:=ABC[26];
//zji‘tìní místa výstupu prostøedního scrambleru v pravém scrambleru
for z:=1 to Length(scrambler3) do
begin
if temp2=scrambler3[z] then misto:=z;
end;
//výstup pravého scrambleru zpátky
temp3:=ABC[((((26-rotor3+1) mod 26)+misto) mod 26) mod 26];
if temp3='' then temp3:=ABC[26];
//zji‘tìní místa výstupu pravého scrambleru v abecedì
for z:=1 to Length(ABC) do
begin
if temp3=ABC[z] then misto:=z;
end;
//druhá zámìna znaku podle propojovací desky
if ComboBox7.ItemIndex=misto-1 then misto:=ComboBox8.ItemIndex+1 else
begin if ComboBox8.ItemIndex=misto-1 then misto:=ComboBox7.ItemIndex+1; end;
if ComboBox9.ItemIndex=misto-1 then misto:=ComboBox10.ItemIndex+1 else
begin if ComboBox10.ItemIndex=misto-1 then misto:=ComboBox9.ItemIndex+1; end;
if ComboBox11.ItemIndex=misto-1 then misto:=ComboBox12.ItemIndex+1 else
begin if ComboBox12.ItemIndex=misto-1 then misto:=ComboBox11.ItemIndex+1; end;
if ComboBox13.ItemIndex=misto-1 then misto:=ComboBox14.ItemIndex+1 else
begin if ComboBox14.ItemIndex=misto-1 then misto:=ComboBox13.ItemIndex+1; end;
if ComboBox15.ItemIndex=misto-1 then misto:=ComboBox16.ItemIndex+1 else
begin if ComboBox16.ItemIndex=misto-1 then misto:=ComboBox15.ItemIndex+1; end;
if ComboBox17.ItemIndex=misto-1 then misto:=ComboBox18.ItemIndex+1 else
begin if ComboBox18.ItemIndex=misto-1 then misto:=ComboBox17.ItemIndex+1; end;
temp3:=ABC[misto];
//zji‘tìní identity výstupního znaku
for z:=1 to Length(ABC) do
begin
if temp3=ABC[z] then znak:=ABC[z];
end;
//pøipojení výstupního znaku k výstupnímu øádku
vystupnitext:=vystupnitext+znak;
if (ScrollBar1.Position<491) AND (stop=false) then
begin
Memo2.Lines[x]:='';
Memo2.Lines[x]:=vystupnitext;
vkladani:=true;
end else vkladani:=false;
end;
if ((ScrollBar1.Position<491) OR (vkladani=false)) AND (stop=false) then
begin
Memo2.Lines[x]:='';
vkladani:=true;
end;
if stop=false then Memo2.Lines.Add(vystupnitext) else Memo2.Lines.Clear;
end;
//konec (de)‘ifrováni
Button1.Enabled:=true;
Button2.Enabled:=true;
Button3.Enabled:=true;
Button5.Enabled:=true;
Button6.Enabled:=true;
ComboBox1.Enabled:=true;
ComboBox2.Enabled:=true;
ComboBox3.Enabled:=true;
ComboBox4.Enabled:=true;
ComboBox5.Enabled:=true;
ComboBox6.Enabled:=true;
CheckBox1.Enabled:=true;
CheckBox2.Enabled:=true;
CheckBox3.Enabled:=true;
CheckBox4.Enabled:=true;
CheckBox5.Enabled:=true;
CheckBox6.Enabled:=true;
if CheckBox1.Checked=true then begin ComboBox7.Enabled:=true; ComboBox8.Enabled:=true; end;
if CheckBox2.Checked=true then begin ComboBox9.Enabled:=true; ComboBox10.Enabled:=true; end;
if CheckBox3.Checked=true then begin ComboBox11.Enabled:=true; ComboBox12.Enabled:=true; end;
if CheckBox4.Checked=true then begin ComboBox13.Enabled:=true; ComboBox14.Enabled:=true; end;
if CheckBox5.Checked=true then begin ComboBox15.Enabled:=true; ComboBox16.Enabled:=true; end;
if CheckBox6.Checked=true then begin ComboBox17.Enabled:=true; ComboBox18.Enabled:=true; end;
Memo1.ReadOnly:=false;
Memo1.PopupMenu:=PopupMenu1;
Memo2.PopupMenu:=PopupMenu3;
Edit1.PopupMenu:=PopupMenu5;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
PopupMenu2.Popup(Form1.Left+Button2.Left+4, Form1.Top+Button2.Top+42);
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
PopupMenu4.Popup(Form1.Left+Button3.Left+4, Form1.Top+Button3.Top+42);
end;
procedure TForm1.Button5Click(Sender: TObject);
begin
Form2.Visible:=true;
Form1.Enabled:=false;
end;
procedure TForm1.Button6Click(Sender: TObject);
begin
Form3.Visible:=true;
Form1.Enabled:=false;
end;
procedure TForm1.CheckBox1Click(Sender: TObject);
begin
if CheckBox1.Checked=true then
begin
ComboBox7.Enabled:=true;
ComboBox8.Enabled:=true;
if manual=false then
begin
Button1.Enabled:=false;
klic2[10]:='?';
klic2[11]:='>';
klic2[12]:='?';
end else Button1.Enabled:=true;
Edit1.Text:=klic1+klic2;
end
else
begin
ComboBox7.Enabled:=false;
ComboBox8.Enabled:=false;
ComboBox7.ItemIndex:=-1;
ComboBox8.ItemIndex:=-1;
klic2[10]:='n';
klic2[11]:='/';
klic2[12]:='a';
Edit1.Text:=klic1+klic2;
deska:=0;
if ((ComboBox9.ItemIndex>-1) AND (ComboBox10.ItemIndex>-1) AND (CheckBox2.Checked=true)) OR
((ComboBox9.ItemIndex=-1) AND (ComboBox10.ItemIndex=-1) AND (CheckBox2.Checked=false))
then deska:=deska+1;
if ((ComboBox11.ItemIndex>-1) AND (ComboBox12.ItemIndex>-1) AND (CheckBox3.Checked=true)) OR
((ComboBox11.ItemIndex=-1) AND (ComboBox12.ItemIndex=-1) AND (CheckBox3.Checked=false))
then deska:=deska+1;
if ((ComboBox13.ItemIndex>-1) AND (ComboBox14.ItemIndex>-1) AND (CheckBox4.Checked=true)) OR
((ComboBox13.ItemIndex=-1) AND (ComboBox14.ItemIndex=-1) AND (CheckBox4.Checked=false))
then deska:=deska+1;
if ((ComboBox15.ItemIndex>-1) AND (ComboBox16.ItemIndex>-1) AND (CheckBox5.Checked=true)) OR
((ComboBox15.ItemIndex=-1) AND (ComboBox16.ItemIndex=-1) AND (CheckBox5.Checked=false))
then deska:=deska+1;
if ((ComboBox17.ItemIndex>-1) AND (ComboBox18.ItemIndex>-1) AND (CheckBox6.Checked=true)) OR
((ComboBox17.ItemIndex=-1) AND (ComboBox18.ItemIndex=-1) AND (CheckBox6.Checked=false))
then deska:=deska+1;
if ((CheckBox2.Checked=false) AND (CheckBox3.Checked=false) AND
(CheckBox4.Checked=false) AND (CheckBox5.Checked=false) AND
(CheckBox6.Checked=false)) OR (deska=5)
then Button1.Enabled:=true
else Button1.Enabled:=false;
end;
end;
procedure TForm1.CheckBox2Click(Sender: TObject);
begin
if CheckBox2.Checked=true then
begin
ComboBox9.Enabled:=true;
ComboBox10.Enabled:=true;
if manual=false then
begin
Button1.Enabled:=false;
klic2[15]:='?';
klic2[16]:='>';
klic2[17]:='?';
end else Button1.Enabled:=true;
Edit1.Text:=klic1+klic2;
end
else
begin
ComboBox9.Enabled:=false;
ComboBox10.Enabled:=false;
ComboBox9.ItemIndex:=-1;
ComboBox10.ItemIndex:=-1;
klic2[15]:='n';
klic2[16]:='/';
klic2[17]:='a';
Edit1.Text:=klic1+klic2;
deska:=0;
if ((ComboBox7.ItemIndex>-1) AND (ComboBox8.ItemIndex>-1) AND (CheckBox1.Checked=true)) OR
((ComboBox7.ItemIndex=-1) AND (ComboBox8.ItemIndex=-1) AND (CheckBox1.Checked=false))
then deska:=deska+1;
if ((ComboBox11.ItemIndex>-1) AND (ComboBox12.ItemIndex>-1) AND (CheckBox3.Checked=true)) OR
((ComboBox11.ItemIndex=-1) AND (ComboBox12.ItemIndex=-1) AND (CheckBox3.Checked=false))
then deska:=deska+1;
if ((ComboBox13.ItemIndex>-1) AND (ComboBox14.ItemIndex>-1) AND (CheckBox4.Checked=true)) OR
((ComboBox13.ItemIndex=-1) AND (ComboBox14.ItemIndex=-1) AND (CheckBox4.Checked=false))
then deska:=deska+1;
if ((ComboBox15.ItemIndex>-1) AND (ComboBox16.ItemIndex>-1) AND (CheckBox5.Checked=true)) OR
((ComboBox15.ItemIndex=-1) AND (ComboBox16.ItemIndex=-1) AND (CheckBox5.Checked=false))
then deska:=deska+1;
if ((ComboBox17.ItemIndex>-1) AND (ComboBox18.ItemIndex>-1) AND (CheckBox6.Checked=true)) OR
((ComboBox17.ItemIndex=-1) AND (ComboBox18.ItemIndex=-1) AND (CheckBox6.Checked=false))
then deska:=deska+1;
if ((CheckBox1.Checked=false) AND (CheckBox3.Checked=false) AND
(CheckBox4.Checked=false) AND (CheckBox5.Checked=false) AND
(CheckBox6.Checked=false)) OR (deska=5)
then Button1.Enabled:=true
else Button1.Enabled:=false;
end;
end;
procedure TForm1.CheckBox3Click(Sender: TObject);
begin
if CheckBox3.Checked=true then
begin
ComboBox11.Enabled:=true;
ComboBox12.Enabled:=true;
if manual=false then
begin
Button1.Enabled:=false;
klic2[20]:='?';
klic2[21]:='>';
klic2[22]:='?';
end else Button1.Enabled:=true;
Edit1.Text:=klic1+klic2;
end
else
begin
ComboBox11.Enabled:=false;
ComboBox12.Enabled:=false;
ComboBox11.ItemIndex:=-1;
ComboBox12.ItemIndex:=-1;
klic2[20]:='n';
klic2[21]:='/';
klic2[22]:='a';
Edit1.Text:=klic1+klic2;
deska:=0;
if ((ComboBox7.ItemIndex>-1) AND (ComboBox8.ItemIndex>-1) AND (CheckBox1.Checked=true)) OR
((ComboBox7.ItemIndex=-1) AND (ComboBox8.ItemIndex=-1) AND (CheckBox1.Checked=false))
then deska:=deska+1;
if ((ComboBox9.ItemIndex>-1) AND (ComboBox10.ItemIndex>-1) AND (CheckBox2.Checked=true)) OR
((ComboBox9.ItemIndex=-1) AND (ComboBox10.ItemIndex=-1) AND (CheckBox2.Checked=false))
then deska:=deska+1;
if ((ComboBox13.ItemIndex>-1) AND (ComboBox14.ItemIndex>-1) AND (CheckBox4.Checked=true)) OR
((ComboBox13.ItemIndex=-1) AND (ComboBox14.ItemIndex=-1) AND (CheckBox4.Checked=false))
then deska:=deska+1;
if ((ComboBox15.ItemIndex>-1) AND (ComboBox16.ItemIndex>-1) AND (CheckBox5.Checked=true)) OR
((ComboBox15.ItemIndex=-1) AND (ComboBox16.ItemIndex=-1) AND (CheckBox5.Checked=false))
then deska:=deska+1;
if ((ComboBox17.ItemIndex>-1) AND (ComboBox18.ItemIndex>-1) AND (CheckBox6.Checked=true)) OR
((ComboBox17.ItemIndex=-1) AND (ComboBox18.ItemIndex=-1) AND (CheckBox6.Checked=false))
then deska:=deska+1;
if ((CheckBox1.Checked=false) AND (CheckBox2.Checked=false) AND
(CheckBox4.Checked=false) AND (CheckBox5.Checked=false) AND
(CheckBox6.Checked=false)) OR (deska=5)
then Button1.Enabled:=true
else Button1.Enabled:=false;
end;
end;
procedure TForm1.CheckBox4Click(Sender: TObject);
begin
if CheckBox4.Checked=true then
begin
ComboBox13.Enabled:=true;
ComboBox14.Enabled:=true;
if manual=false then
begin
Button1.Enabled:=false;
klic2[25]:='?';
klic2[26]:='>';
klic2[27]:='?';
end else Button1.Enabled:=true;
Edit1.Text:=klic1+klic2;
end
else
begin
ComboBox13.Enabled:=false;
ComboBox14.Enabled:=false;
ComboBox13.ItemIndex:=-1;
ComboBox14.ItemIndex:=-1;
klic2[25]:='n';
klic2[26]:='/';
klic2[27]:='a';
Edit1.Text:=klic1+klic2;
deska:=0;
if ((ComboBox7.ItemIndex>-1) AND (ComboBox8.ItemIndex>-1) AND (CheckBox1.Checked=true)) OR
((ComboBox7.ItemIndex=-1) AND (ComboBox8.ItemIndex=-1) AND (CheckBox1.Checked=false))
then deska:=deska+1;
if ((ComboBox9.ItemIndex>-1) AND (ComboBox10.ItemIndex>-1) AND (CheckBox2.Checked=true)) OR
((ComboBox9.ItemIndex=-1) AND (ComboBox10.ItemIndex=-1) AND (CheckBox2.Checked=false))
then deska:=deska+1;
if ((ComboBox11.ItemIndex>-1) AND (ComboBox12.ItemIndex>-1) AND (CheckBox3.Checked=true)) OR
((ComboBox11.ItemIndex=-1) AND (ComboBox12.ItemIndex=-1) AND (CheckBox3.Checked=false))
then deska:=deska+1;
if ((ComboBox15.ItemIndex>-1) AND (ComboBox16.ItemIndex>-1) AND (CheckBox5.Checked=true)) OR
((ComboBox15.ItemIndex=-1) AND (ComboBox16.ItemIndex=-1) AND (CheckBox5.Checked=false))
then deska:=deska+1;
if ((ComboBox17.ItemIndex>-1) AND (ComboBox18.ItemIndex>-1) AND (CheckBox6.Checked=true)) OR
((ComboBox17.ItemIndex=-1) AND (ComboBox18.ItemIndex=-1) AND (CheckBox6.Checked=false))
then deska:=deska+1;
if ((CheckBox1.Checked=false) AND (CheckBox2.Checked=false) AND
(CheckBox3.Checked=false) AND (CheckBox5.Checked=false) AND
(CheckBox6.Checked=false)) OR (deska=5)
then Button1.Enabled:=true
else Button1.Enabled:=false;
end;
end;
procedure TForm1.CheckBox5Click(Sender: TObject);
begin
if CheckBox5.Checked=true then
begin
ComboBox15.Enabled:=true;
ComboBox16.Enabled:=true;
if manual=false then
begin
Button1.Enabled:=false;
klic2[30]:='?';
klic2[31]:='>';
klic2[32]:='?';
end else Button1.Enabled:=true;
Edit1.Text:=klic1+klic2;
end
else
begin
ComboBox15.Enabled:=false;
ComboBox16.Enabled:=false;
ComboBox15.ItemIndex:=-1;
ComboBox16.ItemIndex:=-1;
klic2[30]:='n';
klic2[31]:='/';
klic2[32]:='a';
Edit1.Text:=klic1+klic2;
deska:=0;
if ((ComboBox7.ItemIndex>-1) AND (ComboBox8.ItemIndex>-1) AND (CheckBox1.Checked=true)) OR
((ComboBox7.ItemIndex=-1) AND (ComboBox8.ItemIndex=-1) AND (CheckBox1.Checked=false))
then deska:=deska+1;
if ((ComboBox9.ItemIndex>-1) AND (ComboBox10.ItemIndex>-1) AND (CheckBox2.Checked=true)) OR
((ComboBox9.ItemIndex=-1) AND (ComboBox10.ItemIndex=-1) AND (CheckBox2.Checked=false))
then deska:=deska+1;
if ((ComboBox11.ItemIndex>-1) AND (ComboBox12.ItemIndex>-1) AND (CheckBox3.Checked=true)) OR
((ComboBox11.ItemIndex=-1) AND (ComboBox12.ItemIndex=-1) AND (CheckBox3.Checked=false))
then deska:=deska+1;
if ((ComboBox13.ItemIndex>-1) AND (ComboBox14.ItemIndex>-1) AND (CheckBox4.Checked=true)) OR
((ComboBox13.ItemIndex=-1) AND (ComboBox14.ItemIndex=-1) AND (CheckBox4.Checked=false))
then deska:=deska+1;
if ((ComboBox17.ItemIndex>-1) AND (ComboBox18.ItemIndex>-1) AND (CheckBox6.Checked=true)) OR
((ComboBox17.ItemIndex=-1) AND (ComboBox18.ItemIndex=-1) AND (CheckBox6.Checked=false))
then deska:=deska+1;
if ((CheckBox1.Checked=false) AND (CheckBox2.Checked=false) AND
(CheckBox3.Checked=false) AND (CheckBox4.Checked=false) AND
(CheckBox6.Checked=false)) OR (deska=5)
then Button1.Enabled:=true
else Button1.Enabled:=false;
end;
end;
procedure TForm1.CheckBox6Click(Sender: TObject);
begin
if CheckBox6.Checked=true then
begin
ComboBox17.Enabled:=true;
ComboBox18.Enabled:=true;
if manual=false then
begin
Button1.Enabled:=false;
klic2[35]:='?';
klic2[36]:='>';
klic2[37]:='?';
end else Button1.Enabled:=true;
Edit1.Text:=klic1+klic2;
end
else
begin
ComboBox17.Enabled:=false;
ComboBox18.Enabled:=false;
ComboBox17.ItemIndex:=-1;
ComboBox18.ItemIndex:=-1;
klic2[35]:='n';
klic2[36]:='/';
klic2[37]:='a';
Edit1.Text:=klic1+klic2;
deska:=0;
if ((ComboBox7.ItemIndex>-1) AND (ComboBox8.ItemIndex>-1) AND (CheckBox1.Checked=true)) OR
((ComboBox7.ItemIndex=-1) AND (ComboBox8.ItemIndex=-1) AND (CheckBox1.Checked=false))
then deska:=deska+1;
if ((ComboBox9.ItemIndex>-1) AND (ComboBox10.ItemIndex>-1) AND (CheckBox2.Checked=true)) OR
((ComboBox9.ItemIndex=-1) AND (ComboBox10.ItemIndex=-1) AND (CheckBox2.Checked=false))
then deska:=deska+1;
if ((ComboBox11.ItemIndex>-1) AND (ComboBox12.ItemIndex>-1) AND (CheckBox3.Checked=true)) OR
((ComboBox11.ItemIndex=-1) AND (ComboBox12.ItemIndex=-1) AND (CheckBox3.Checked=false))
then deska:=deska+1;
if ((ComboBox13.ItemIndex>-1) AND (ComboBox14.ItemIndex>-1) AND (CheckBox4.Checked=true)) OR
((ComboBox13.ItemIndex=-1) AND (ComboBox14.ItemIndex=-1) AND (CheckBox4.Checked=false))
then deska:=deska+1;
if ((ComboBox15.ItemIndex>-1) AND (ComboBox16.ItemIndex>-1) AND (CheckBox5.Checked=true)) OR
((ComboBox15.ItemIndex=-1) AND (ComboBox16.ItemIndex=-1) AND (CheckBox5.Checked=false))
then deska:=deska+1;
if ((CheckBox1.Checked=false) AND (CheckBox2.Checked=false) AND
(CheckBox3.Checked=false) AND (CheckBox4.Checked=false) AND
(CheckBox5.Checked=false)) OR (deska=5)
then Button1.Enabled:=true
else Button1.Enabled:=false;
end;
end;
procedure TForm1.ComboBox10Change(Sender: TObject);
begin
if (ComboBox10.ItemIndex=ComboBox7.ItemIndex) OR
(ComboBox10.ItemIndex=ComboBox8.ItemIndex) OR
(ComboBox10.ItemIndex=ComboBox9.ItemIndex) OR
(ComboBox10.ItemIndex=ComboBox11.ItemIndex) OR
(ComboBox10.ItemIndex=ComboBox12.ItemIndex) OR
(ComboBox10.ItemIndex=ComboBox13.ItemIndex) OR
(ComboBox10.ItemIndex=ComboBox14.ItemIndex) OR
(ComboBox10.ItemIndex=ComboBox15.ItemIndex) OR
(ComboBox10.ItemIndex=ComboBox16.ItemIndex) OR
(ComboBox10.ItemIndex=ComboBox17.ItemIndex) OR
(ComboBox10.ItemIndex=ComboBox18.ItemIndex)
then begin ComboBox10.ItemIndex:=-1; klic2[17]:='?'; Edit1.Text:=klic1+klic2; Button1.Enabled:=false; end
else begin if (ComboBox9.ItemIndex>-1) AND
(((ComboBox7.ItemIndex=-1) AND (ComboBox8.ItemIndex=-1) AND (CheckBox1.Checked=false)) OR
((ComboBox7.ItemIndex>-1) AND (ComboBox8.ItemIndex>-1) AND (CheckBox1.Checked=true))) AND
(((ComboBox11.ItemIndex=-1) AND (ComboBox12.ItemIndex=-1) AND (CheckBox3.Checked=false)) OR
((ComboBox11.ItemIndex>-1) AND (ComboBox12.ItemIndex>-1) AND (CheckBox3.Checked=true))) AND
(((ComboBox13.ItemIndex=-1) AND (ComboBox14.ItemIndex=-1) AND (CheckBox4.Checked=false)) OR
((ComboBox13.ItemIndex>-1) AND (ComboBox14.ItemIndex>-1) AND (CheckBox4.Checked=true))) AND
(((ComboBox15.ItemIndex=-1) AND (ComboBox16.ItemIndex=-1) AND (CheckBox5.Checked=false)) OR
((ComboBox15.ItemIndex>-1) AND (ComboBox16.ItemIndex>-1) AND (CheckBox5.Checked=true))) AND
(((ComboBox17.ItemIndex=-1) AND (ComboBox18.ItemIndex=-1) AND (CheckBox6.Checked=false)) OR
((ComboBox17.ItemIndex>-1) AND (ComboBox18.ItemIndex>-1) AND (CheckBox6.Checked=true)))
then Button1.Enabled:=true;
vymena:=ComboBox10.Items[ComboBox10.ItemIndex];
klic2[17]:=vymena[1];
Edit1.Text:=klic1+klic2;
end;
end;
procedure TForm1.ComboBox11Change(Sender: TObject);
begin
if (ComboBox11.ItemIndex=ComboBox7.ItemIndex) OR
(ComboBox11.ItemIndex=ComboBox8.ItemIndex) OR
(ComboBox11.ItemIndex=ComboBox9.ItemIndex) OR
(ComboBox11.ItemIndex=ComboBox10.ItemIndex) OR
(ComboBox11.ItemIndex=ComboBox12.ItemIndex) OR
(ComboBox11.ItemIndex=ComboBox13.ItemIndex) OR
(ComboBox11.ItemIndex=ComboBox14.ItemIndex) OR
(ComboBox11.ItemIndex=ComboBox15.ItemIndex) OR
(ComboBox11.ItemIndex=ComboBox16.ItemIndex) OR
(ComboBox11.ItemIndex=ComboBox17.ItemIndex) OR
(ComboBox11.ItemIndex=ComboBox18.ItemIndex)
then begin ComboBox11.ItemIndex:=-1; klic2[20]:='?'; Edit1.Text:=klic1+klic2; Button1.Enabled:=false; end
else begin if (ComboBox12.ItemIndex>-1) AND
(((ComboBox7.ItemIndex=-1) AND (ComboBox8.ItemIndex=-1) AND (CheckBox1.Checked=false)) OR
((ComboBox7.ItemIndex>-1) AND (ComboBox8.ItemIndex>-1) AND (CheckBox1.Checked=true))) AND
(((ComboBox9.ItemIndex=-1) AND (ComboBox10.ItemIndex=-1) AND (CheckBox2.Checked=false)) OR
((ComboBox9.ItemIndex>-1) AND (ComboBox10.ItemIndex>-1) AND (CheckBox2.Checked=true))) AND
(((ComboBox13.ItemIndex=-1) AND (ComboBox14.ItemIndex=-1) AND (CheckBox4.Checked=false)) OR
((ComboBox13.ItemIndex>-1) AND (ComboBox14.ItemIndex>-1) AND (CheckBox4.Checked=true))) AND
(((ComboBox15.ItemIndex=-1) AND (ComboBox16.ItemIndex=-1) AND (CheckBox5.Checked=false)) OR
((ComboBox15.ItemIndex>-1) AND (ComboBox16.ItemIndex>-1) AND (CheckBox5.Checked=true))) AND
(((ComboBox17.ItemIndex=-1) AND (ComboBox18.ItemIndex=-1) AND (CheckBox6.Checked=false)) OR
((ComboBox17.ItemIndex>-1) AND (ComboBox18.ItemIndex>-1) AND (CheckBox6.Checked=true)))
then Button1.Enabled:=true;
vymena:=ComboBox11.Items[ComboBox11.ItemIndex];
klic2[20]:=vymena[1];
Edit1.Text:=klic1+klic2;
end;
end;
procedure TForm1.ComboBox12Change(Sender: TObject);
begin
if (ComboBox12.ItemIndex=ComboBox7.ItemIndex) OR
(ComboBox12.ItemIndex=ComboBox8.ItemIndex) OR
(ComboBox12.ItemIndex=ComboBox9.ItemIndex) OR
(ComboBox12.ItemIndex=ComboBox10.ItemIndex) OR
(ComboBox12.ItemIndex=ComboBox11.ItemIndex) OR
(ComboBox12.ItemIndex=ComboBox13.ItemIndex) OR
(ComboBox12.ItemIndex=ComboBox14.ItemIndex) OR
(ComboBox12.ItemIndex=ComboBox15.ItemIndex) OR
(ComboBox12.ItemIndex=ComboBox16.ItemIndex) OR
(ComboBox12.ItemIndex=ComboBox17.ItemIndex) OR
(ComboBox12.ItemIndex=ComboBox18.ItemIndex)
then begin ComboBox12.ItemIndex:=-1; klic2[22]:='?'; Edit1.Text:=klic1+klic2; Button1.Enabled:=false; end
else begin if (ComboBox11.ItemIndex>-1) AND
(((ComboBox7.ItemIndex=-1) AND (ComboBox8.ItemIndex=-1) AND (CheckBox1.Checked=false)) OR
((ComboBox7.ItemIndex>-1) AND (ComboBox8.ItemIndex>-1) AND (CheckBox1.Checked=true))) AND
(((ComboBox9.ItemIndex=-1) AND (ComboBox10.ItemIndex=-1) AND (CheckBox2.Checked=false)) OR
((ComboBox9.ItemIndex>-1) AND (ComboBox10.ItemIndex>-1) AND (CheckBox2.Checked=true))) AND
(((ComboBox13.ItemIndex=-1) AND (ComboBox14.ItemIndex=-1) AND (CheckBox4.Checked=false)) OR
((ComboBox13.ItemIndex>-1) AND (ComboBox14.ItemIndex>-1) AND (CheckBox4.Checked=true))) AND
(((ComboBox15.ItemIndex=-1) AND (ComboBox16.ItemIndex=-1) AND (CheckBox5.Checked=false)) OR
((ComboBox15.ItemIndex>-1) AND (ComboBox16.ItemIndex>-1) AND (CheckBox5.Checked=true))) AND
(((ComboBox17.ItemIndex=-1) AND (ComboBox18.ItemIndex=-1) AND (CheckBox6.Checked=false)) OR
((ComboBox17.ItemIndex>-1) AND (ComboBox18.ItemIndex>-1) AND (CheckBox6.Checked=true)))
then Button1.Enabled:=true;
vymena:=ComboBox12.Items[ComboBox12.ItemIndex];
klic2[22]:=vymena[1];
Edit1.Text:=klic1+klic2;
end;
end;
procedure TForm1.ComboBox13Change(Sender: TObject);
begin
if (ComboBox13.ItemIndex=ComboBox7.ItemIndex) OR
(ComboBox13.ItemIndex=ComboBox8.ItemIndex) OR
(ComboBox13.ItemIndex=ComboBox9.ItemIndex) OR
(ComboBox13.ItemIndex=ComboBox10.ItemIndex) OR
(ComboBox13.ItemIndex=ComboBox11.ItemIndex) OR
(ComboBox13.ItemIndex=ComboBox12.ItemIndex) OR
(ComboBox13.ItemIndex=ComboBox14.ItemIndex) OR
(ComboBox13.ItemIndex=ComboBox15.ItemIndex) OR
(ComboBox13.ItemIndex=ComboBox16.ItemIndex) OR
(ComboBox13.ItemIndex=ComboBox17.ItemIndex) OR
(ComboBox13.ItemIndex=ComboBox18.ItemIndex)
then begin ComboBox13.ItemIndex:=-1; klic2[25]:='?'; Edit1.Text:=klic1+klic2; Button1.Enabled:=false; end
else begin if (ComboBox14.ItemIndex>-1) AND
(((ComboBox7.ItemIndex=-1) AND (ComboBox8.ItemIndex=-1) AND (CheckBox1.Checked=false)) OR
((ComboBox7.ItemIndex>-1) AND (ComboBox8.ItemIndex>-1) AND (CheckBox1.Checked=true))) AND
(((ComboBox9.ItemIndex=-1) AND (ComboBox10.ItemIndex=-1) AND (CheckBox2.Checked=false)) OR
((ComboBox9.ItemIndex>-1) AND (ComboBox10.ItemIndex>-1) AND (CheckBox2.Checked=true))) AND
(((ComboBox11.ItemIndex=-1) AND (ComboBox12.ItemIndex=-1) AND (CheckBox3.Checked=false)) OR
((ComboBox11.ItemIndex>-1) AND (ComboBox12.ItemIndex>-1) AND (CheckBox3.Checked=true))) AND
(((ComboBox15.ItemIndex=-1) AND (ComboBox16.ItemIndex=-1) AND (CheckBox5.Checked=false)) OR
((ComboBox15.ItemIndex>-1) AND (ComboBox16.ItemIndex>-1) AND (CheckBox5.Checked=true))) AND
(((ComboBox17.ItemIndex=-1) AND (ComboBox18.ItemIndex=-1) AND (CheckBox6.Checked=false)) OR
((ComboBox17.ItemIndex>-1) AND (ComboBox18.ItemIndex>-1) AND (CheckBox6.Checked=true)))
then Button1.Enabled:=true;
vymena:=ComboBox13.Items[ComboBox13.ItemIndex];
klic2[25]:=vymena[1];
Edit1.Text:=klic1+klic2;
end;
end;
procedure TForm1.ComboBox14Change(Sender: TObject);
begin
if (ComboBox14.ItemIndex=ComboBox7.ItemIndex) OR
(ComboBox14.ItemIndex=ComboBox8.ItemIndex) OR
(ComboBox14.ItemIndex=ComboBox9.ItemIndex) OR
(ComboBox14.ItemIndex=ComboBox10.ItemIndex) OR
(ComboBox14.ItemIndex=ComboBox11.ItemIndex) OR
(ComboBox14.ItemIndex=ComboBox12.ItemIndex) OR
(ComboBox14.ItemIndex=ComboBox13.ItemIndex) OR
(ComboBox14.ItemIndex=ComboBox15.ItemIndex) OR
(ComboBox14.ItemIndex=ComboBox16.ItemIndex) OR
(ComboBox14.ItemIndex=ComboBox17.ItemIndex) OR
(ComboBox14.ItemIndex=ComboBox18.ItemIndex)
then begin ComboBox14.ItemIndex:=-1; klic2[27]:='?'; Edit1.Text:=klic1+klic2; Button1.Enabled:=false; end
else begin if (ComboBox13.ItemIndex>-1) AND
(((ComboBox7.ItemIndex=-1) AND (ComboBox8.ItemIndex=-1) AND (CheckBox1.Checked=false)) OR
((ComboBox7.ItemIndex>-1) AND (ComboBox8.ItemIndex>-1) AND (CheckBox1.Checked=true))) AND
(((ComboBox9.ItemIndex=-1) AND (ComboBox10.ItemIndex=-1) AND (CheckBox2.Checked=false)) OR
((ComboBox9.ItemIndex>-1) AND (ComboBox10.ItemIndex>-1) AND (CheckBox2.Checked=true))) AND
(((ComboBox11.ItemIndex=-1) AND (ComboBox12.ItemIndex=-1) AND (CheckBox3.Checked=false)) OR
((ComboBox11.ItemIndex>-1) AND (ComboBox12.ItemIndex>-1) AND (CheckBox3.Checked=true))) AND
(((ComboBox15.ItemIndex=-1) AND (ComboBox16.ItemIndex=-1) AND (CheckBox5.Checked=false)) OR
((ComboBox15.ItemIndex>-1) AND (ComboBox16.ItemIndex>-1) AND (CheckBox5.Checked=true))) AND
(((ComboBox17.ItemIndex=-1) AND (ComboBox18.ItemIndex=-1) AND (CheckBox6.Checked=false)) OR
((ComboBox17.ItemIndex>-1) AND (ComboBox18.ItemIndex>-1) AND (CheckBox6.Checked=true)))
then Button1.Enabled:=true;
vymena:=ComboBox14.Items[ComboBox14.ItemIndex];
klic2[27]:=vymena[1];
Edit1.Text:=klic1+klic2;
end;
end;
procedure TForm1.ComboBox15Change(Sender: TObject);
begin
if (ComboBox15.ItemIndex=ComboBox7.ItemIndex) OR
(ComboBox15.ItemIndex=ComboBox8.ItemIndex) OR
(ComboBox15.ItemIndex=ComboBox9.ItemIndex) OR
(ComboBox15.ItemIndex=ComboBox10.ItemIndex) OR
(ComboBox15.ItemIndex=ComboBox11.ItemIndex) OR
(ComboBox15.ItemIndex=ComboBox12.ItemIndex) OR
(ComboBox15.ItemIndex=ComboBox13.ItemIndex) OR
(ComboBox15.ItemIndex=ComboBox14.ItemIndex) OR
(ComboBox15.ItemIndex=ComboBox16.ItemIndex) OR
(ComboBox15.ItemIndex=ComboBox17.ItemIndex) OR
(ComboBox15.ItemIndex=ComboBox18.ItemIndex)
then begin ComboBox15.ItemIndex:=-1; klic2[30]:='?'; Edit1.Text:=klic1+klic2; Button1.Enabled:=false; end
else begin if (ComboBox16.ItemIndex>-1) AND
(((ComboBox7.ItemIndex=-1) AND (ComboBox8.ItemIndex=-1) AND (CheckBox1.Checked=false)) OR
((ComboBox7.ItemIndex>-1) AND (ComboBox8.ItemIndex>-1) AND (CheckBox1.Checked=true))) AND
(((ComboBox9.ItemIndex=-1) AND (ComboBox10.ItemIndex=-1) AND (CheckBox2.Checked=false)) OR
((ComboBox9.ItemIndex>-1) AND (ComboBox10.ItemIndex>-1) AND (CheckBox2.Checked=true))) AND
(((ComboBox11.ItemIndex=-1) AND (ComboBox12.ItemIndex=-1) AND (CheckBox3.Checked=false)) OR
((ComboBox11.ItemIndex>-1) AND (ComboBox12.ItemIndex>-1) AND (CheckBox3.Checked=true))) AND
(((ComboBox13.ItemIndex=-1) AND (ComboBox14.ItemIndex=-1) AND (CheckBox4.Checked=false)) OR
((ComboBox13.ItemIndex>-1) AND (ComboBox14.ItemIndex>-1) AND (CheckBox4.Checked=true))) AND
(((ComboBox17.ItemIndex=-1) AND (ComboBox18.ItemIndex=-1) AND (CheckBox6.Checked=false)) OR
((ComboBox17.ItemIndex>-1) AND (ComboBox18.ItemIndex>-1) AND (CheckBox6.Checked=true)))
then Button1.Enabled:=true;
vymena:=ComboBox15.Items[ComboBox15.ItemIndex];
klic2[30]:=vymena[1];
Edit1.Text:=klic1+klic2;
end;
end;
procedure TForm1.ComboBox16Change(Sender: TObject);
begin
if (ComboBox16.ItemIndex=ComboBox7.ItemIndex) OR
(ComboBox16.ItemIndex=ComboBox8.ItemIndex) OR
(ComboBox16.ItemIndex=ComboBox9.ItemIndex) OR
(ComboBox16.ItemIndex=ComboBox10.ItemIndex) OR
(ComboBox16.ItemIndex=ComboBox11.ItemIndex) OR
(ComboBox16.ItemIndex=ComboBox12.ItemIndex) OR
(ComboBox16.ItemIndex=ComboBox13.ItemIndex) OR
(ComboBox16.ItemIndex=ComboBox14.ItemIndex) OR
(ComboBox16.ItemIndex=ComboBox15.ItemIndex) OR
(ComboBox16.ItemIndex=ComboBox17.ItemIndex) OR
(ComboBox16.ItemIndex=ComboBox18.ItemIndex)
then begin ComboBox16.ItemIndex:=-1; klic2[32]:='?'; Edit1.Text:=klic1+klic2; Button1.Enabled:=false; end
else begin if (ComboBox15.ItemIndex>-1) AND
(((ComboBox7.ItemIndex=-1) AND (ComboBox8.ItemIndex=-1) AND (CheckBox1.Checked=false)) OR
((ComboBox7.ItemIndex>-1) AND (ComboBox8.ItemIndex>-1) AND (CheckBox1.Checked=true))) AND
(((ComboBox9.ItemIndex=-1) AND (ComboBox10.ItemIndex=-1) AND (CheckBox2.Checked=false)) OR
((ComboBox9.ItemIndex>-1) AND (ComboBox10.ItemIndex>-1) AND (CheckBox2.Checked=true))) AND
(((ComboBox11.ItemIndex=-1) AND (ComboBox12.ItemIndex=-1) AND (CheckBox3.Checked=false)) OR
((ComboBox11.ItemIndex>-1) AND (ComboBox12.ItemIndex>-1) AND (CheckBox3.Checked=true))) AND
(((ComboBox13.ItemIndex=-1) AND (ComboBox14.ItemIndex=-1) AND (CheckBox4.Checked=false)) OR
((ComboBox13.ItemIndex>-1) AND (ComboBox14.ItemIndex>-1) AND (CheckBox4.Checked=true))) AND
(((ComboBox17.ItemIndex=-1) AND (ComboBox18.ItemIndex=-1) AND (CheckBox6.Checked=false)) OR
((ComboBox17.ItemIndex>-1) AND (ComboBox18.ItemIndex>-1) AND (CheckBox6.Checked=true)))
then Button1.Enabled:=true;
vymena:=ComboBox16.Items[ComboBox16.ItemIndex];
klic2[32]:=vymena[1];
Edit1.Text:=klic1+klic2;
end;
end;
procedure TForm1.ComboBox17Change(Sender: TObject);
begin
if (ComboBox17.ItemIndex=ComboBox7.ItemIndex) OR
(ComboBox17.ItemIndex=ComboBox8.ItemIndex) OR
(ComboBox17.ItemIndex=ComboBox9.ItemIndex) OR
(ComboBox17.ItemIndex=ComboBox10.ItemIndex) OR
(ComboBox17.ItemIndex=ComboBox11.ItemIndex) OR
(ComboBox17.ItemIndex=ComboBox12.ItemIndex) OR
(ComboBox17.ItemIndex=ComboBox13.ItemIndex) OR
(ComboBox17.ItemIndex=ComboBox14.ItemIndex) OR
(ComboBox17.ItemIndex=ComboBox15.ItemIndex) OR
(ComboBox17.ItemIndex=ComboBox16.ItemIndex) OR
(ComboBox17.ItemIndex=ComboBox18.ItemIndex)
then begin ComboBox17.ItemIndex:=-1; klic2[35]:='?'; Edit1.Text:=klic1+klic2; Button1.Enabled:=false; end
else begin if (ComboBox18.ItemIndex>-1) AND
(((ComboBox7.ItemIndex=-1) AND (ComboBox8.ItemIndex=-1) AND (CheckBox1.Checked=false)) OR
((ComboBox7.ItemIndex>-1) AND (ComboBox8.ItemIndex>-1) AND (CheckBox1.Checked=true))) AND
(((ComboBox9.ItemIndex=-1) AND (ComboBox10.ItemIndex=-1) AND (CheckBox2.Checked=false)) OR
((ComboBox9.ItemIndex>-1) AND (ComboBox10.ItemIndex>-1) AND (CheckBox2.Checked=true))) AND
(((ComboBox11.ItemIndex=-1) AND (ComboBox12.ItemIndex=-1) AND (CheckBox3.Checked=false)) OR
((ComboBox11.ItemIndex>-1) AND (ComboBox12.ItemIndex>-1) AND (CheckBox3.Checked=true))) AND
(((ComboBox13.ItemIndex=-1) AND (ComboBox14.ItemIndex=-1) AND (CheckBox4.Checked=false)) OR
((ComboBox13.ItemIndex>-1) AND (ComboBox14.ItemIndex>-1) AND (CheckBox4.Checked=true))) AND
(((ComboBox15.ItemIndex=-1) AND (ComboBox16.ItemIndex=-1) AND (CheckBox5.Checked=false)) OR
((ComboBox15.ItemIndex>-1) AND (ComboBox16.ItemIndex>-1) AND (CheckBox5.Checked=true)))
then Button1.Enabled:=true;
vymena:=ComboBox17.Items[ComboBox17.ItemIndex];
klic2[35]:=vymena[1];
Edit1.Text:=klic1+klic2;
end;
end;
procedure TForm1.ComboBox18Change(Sender: TObject);
begin
if (ComboBox18.ItemIndex=ComboBox7.ItemIndex) OR
(ComboBox18.ItemIndex=ComboBox8.ItemIndex) OR
(ComboBox18.ItemIndex=ComboBox9.ItemIndex) OR
(ComboBox18.ItemIndex=ComboBox10.ItemIndex) OR
(ComboBox18.ItemIndex=ComboBox11.ItemIndex) OR
(ComboBox18.ItemIndex=ComboBox12.ItemIndex) OR
(ComboBox18.ItemIndex=ComboBox13.ItemIndex) OR
(ComboBox18.ItemIndex=ComboBox14.ItemIndex) OR
(ComboBox18.ItemIndex=ComboBox15.ItemIndex) OR
(ComboBox18.ItemIndex=ComboBox16.ItemIndex) OR
(ComboBox18.ItemIndex=ComboBox17.ItemIndex)
then begin ComboBox18.ItemIndex:=-1; klic2[37]:='?'; Edit1.Text:=klic1+klic2; Button1.Enabled:=false; end
else begin if (ComboBox17.ItemIndex>-1) AND
(((ComboBox7.ItemIndex=-1) AND (ComboBox8.ItemIndex=-1) AND (CheckBox1.Checked=false)) OR
((ComboBox7.ItemIndex>-1) AND (ComboBox8.ItemIndex>-1) AND (CheckBox1.Checked=true))) AND
(((ComboBox9.ItemIndex=-1) AND (ComboBox10.ItemIndex=-1) AND (CheckBox2.Checked=false)) OR
((ComboBox9.ItemIndex>-1) AND (ComboBox10.ItemIndex>-1) AND (CheckBox2.Checked=true))) AND
(((ComboBox11.ItemIndex=-1) AND (ComboBox12.ItemIndex=-1) AND (CheckBox3.Checked=false)) OR
((ComboBox11.ItemIndex>-1) AND (ComboBox12.ItemIndex>-1) AND (CheckBox3.Checked=true))) AND
(((ComboBox13.ItemIndex=-1) AND (ComboBox14.ItemIndex=-1) AND (CheckBox4.Checked=false)) OR
((ComboBox13.ItemIndex>-1) AND (ComboBox14.ItemIndex>-1) AND (CheckBox4.Checked=true))) AND
(((ComboBox15.ItemIndex=-1) AND (ComboBox16.ItemIndex=-1) AND (CheckBox5.Checked=false)) OR
((ComboBox15.ItemIndex>-1) AND (ComboBox16.ItemIndex>-1) AND (CheckBox5.Checked=true)))
then Button1.Enabled:=true;
vymena:=ComboBox18.Items[ComboBox18.ItemIndex];
klic2[37]:=vymena[1];
Edit1.Text:=klic1+klic2;
end;
end;
procedure TForm1.ComboBox1Change(Sender: TObject);
begin
if ComboBox1.ItemIndex=ComboBox2.ItemIndex then
begin
ComboBox2.ItemIndex:=poradi1;
menic:=ComboBox5.ItemIndex;
ComboBox5.ItemIndex:=ComboBox4.ItemIndex;
ComboBox4.ItemIndex:=menic;
end;
if ComboBox1.ItemIndex=ComboBox3.ItemIndex then
begin
ComboBox3.ItemIndex:=poradi1;
menic:=ComboBox6.ItemIndex;
ComboBox6.ItemIndex:=ComboBox4.ItemIndex;
ComboBox4.ItemIndex:=menic;
end;
poradi1:=ComboBox1.ItemIndex;
poradi2:=ComboBox2.ItemIndex;
poradi3:=ComboBox3.ItemIndex;
klic1:=ComboBox1.Items[poradi1]+'-'+ComboBox2.Items[poradi2]+'-'+ComboBox3.Items[poradi3];
vymena:=ComboBox4.Items[ComboBox4.ItemIndex];
klic2[3]:=vymena[1];
vymena:=ComboBox4.Items[ComboBox5.ItemIndex];
klic2[5]:=vymena[1];
vymena:=ComboBox4.Items[ComboBox6.ItemIndex];
klic2[7]:=vymena[1];
Edit1.Text:=klic1+klic2;
Edit2.Text:=ComboBox4.Items[ComboBox4.ItemIndex];
Edit3.Text:=ComboBox5.Items[ComboBox5.ItemIndex];
Edit4.Text:=ComboBox6.Items[ComboBox6.ItemIndex];
end;
procedure TForm1.ComboBox2Change(Sender: TObject);
begin
if ComboBox2.ItemIndex=ComboBox1.ItemIndex then
begin
ComboBox1.ItemIndex:=poradi2;
menic:=ComboBox4.ItemIndex;
ComboBox4.ItemIndex:=ComboBox5.ItemIndex;
ComboBox5.ItemIndex:=menic;
end;
if ComboBox2.ItemIndex=ComboBox3.ItemIndex then
begin
ComboBox3.ItemIndex:=poradi2;
menic:=ComboBox6.ItemIndex;
ComboBox6.ItemIndex:=ComboBox5.ItemIndex;
ComboBox5.ItemIndex:=menic;
end;
poradi1:=ComboBox1.ItemIndex;
poradi2:=ComboBox2.ItemIndex;
poradi3:=ComboBox3.ItemIndex;
klic1:=ComboBox1.Items[poradi1]+'-'+ComboBox2.Items[poradi2]+'-'+ComboBox3.Items[poradi3];
vymena:=ComboBox4.Items[ComboBox4.ItemIndex];
klic2[3]:=vymena[1];
vymena:=ComboBox4.Items[ComboBox5.ItemIndex];
klic2[5]:=vymena[1];
vymena:=ComboBox4.Items[ComboBox6.ItemIndex];
klic2[7]:=vymena[1];
Edit1.Text:=klic1+klic2;
Edit2.Text:=ComboBox4.Items[ComboBox4.ItemIndex];
Edit3.Text:=ComboBox5.Items[ComboBox5.ItemIndex];
Edit4.Text:=ComboBox6.Items[ComboBox6.ItemIndex];
end;
procedure TForm1.ComboBox3Change(Sender: TObject);
begin
if ComboBox3.ItemIndex=ComboBox1.ItemIndex then
begin
ComboBox1.ItemIndex:=poradi3;
menic:=ComboBox4.ItemIndex;
ComboBox4.ItemIndex:=ComboBox6.ItemIndex;
ComboBox6.ItemIndex:=menic;
end;
if ComboBox3.ItemIndex=ComboBox2.ItemIndex then
begin
ComboBox2.ItemIndex:=poradi3;
menic:=ComboBox5.ItemIndex;
ComboBox5.ItemIndex:=ComboBox6.ItemIndex;
ComboBox6.ItemIndex:=menic;
end;
poradi1:=ComboBox1.ItemIndex;
poradi2:=ComboBox2.ItemIndex;
poradi3:=ComboBox3.ItemIndex;
klic1:=ComboBox1.Items[poradi1]+'-'+ComboBox2.Items[poradi2]+'-'+ComboBox3.Items[poradi3];
vymena:=ComboBox4.Items[ComboBox4.ItemIndex];
klic2[3]:=vymena[1];
vymena:=ComboBox4.Items[ComboBox5.ItemIndex];
klic2[5]:=vymena[1];
vymena:=ComboBox4.Items[ComboBox6.ItemIndex];
klic2[7]:=vymena[1];
Edit1.Text:=klic1+klic2;
Edit2.Text:=ComboBox4.Items[ComboBox4.ItemIndex];
Edit3.Text:=ComboBox5.Items[ComboBox5.ItemIndex];
Edit4.Text:=ComboBox6.Items[ComboBox6.ItemIndex];
end;
procedure TForm1.ComboBox4Change(Sender: TObject);
begin
vymena:=ComboBox4.Items[ComboBox4.ItemIndex];
klic2[3]:=vymena[1];
Edit1.Text:=klic1+klic2;
Edit2.Text:=ComboBox4.Items[ComboBox4.ItemIndex];
end;
procedure TForm1.ComboBox5Change(Sender: TObject);
begin
vymena:=ComboBox5.Items[ComboBox5.ItemIndex];
klic2[5]:=vymena[1];
Edit1.Text:=klic1+klic2;
Edit3.Text:=ComboBox5.Items[ComboBox5.ItemIndex];
end;
procedure TForm1.ComboBox6Change(Sender: TObject);
begin
vymena:=ComboBox6.Items[ComboBox6.ItemIndex];
klic2[7]:=vymena[1];
Edit1.Text:=klic1+klic2;
Edit4.Text:=ComboBox6.Items[ComboBox6.ItemIndex];
end;
procedure TForm1.ComboBox7Change(Sender: TObject);
begin
if (ComboBox7.ItemIndex=ComboBox8.ItemIndex) OR
(ComboBox7.ItemIndex=ComboBox9.ItemIndex) OR
(ComboBox7.ItemIndex=ComboBox10.ItemIndex) OR
(ComboBox7.ItemIndex=ComboBox11.ItemIndex) OR
(ComboBox7.ItemIndex=ComboBox12.ItemIndex) OR
(ComboBox7.ItemIndex=ComboBox13.ItemIndex) OR
(ComboBox7.ItemIndex=ComboBox14.ItemIndex) OR
(ComboBox7.ItemIndex=ComboBox15.ItemIndex) OR
(ComboBox7.ItemIndex=ComboBox16.ItemIndex) OR
(ComboBox7.ItemIndex=ComboBox17.ItemIndex) OR
(ComboBox7.ItemIndex=ComboBox18.ItemIndex)
then begin ComboBox7.ItemIndex:=-1; klic2[10]:='?'; Edit1.Text:=klic1+klic2; Button1.Enabled:=false; end
else begin if (ComboBox8.ItemIndex>-1) AND
(((ComboBox9.ItemIndex=-1) AND (ComboBox10.ItemIndex=-1) AND (CheckBox2.Checked=false)) OR
((ComboBox9.ItemIndex>-1) AND (ComboBox10.ItemIndex>-1) AND (CheckBox2.Checked=true))) AND
(((ComboBox11.ItemIndex=-1) AND (ComboBox12.ItemIndex=-1) AND (CheckBox3.Checked=false)) OR
((ComboBox11.ItemIndex>-1) AND (ComboBox12.ItemIndex>-1) AND (CheckBox3.Checked=true))) AND
(((ComboBox13.ItemIndex=-1) AND (ComboBox14.ItemIndex=-1) AND (CheckBox4.Checked=false)) OR
((ComboBox13.ItemIndex>-1) AND (ComboBox14.ItemIndex>-1) AND (CheckBox4.Checked=true))) AND
(((ComboBox15.ItemIndex=-1) AND (ComboBox16.ItemIndex=-1) AND (CheckBox5.Checked=false)) OR
((ComboBox15.ItemIndex>-1) AND (ComboBox16.ItemIndex>-1) AND (CheckBox5.Checked=true))) AND
(((ComboBox17.ItemIndex=-1) AND (ComboBox18.ItemIndex=-1) AND (CheckBox6.Checked=false)) OR
((ComboBox17.ItemIndex>-1) AND (ComboBox18.ItemIndex>-1) AND (CheckBox6.Checked=true)))
then Button1.Enabled:=true;
vymena:=ComboBox7.Items[ComboBox7.ItemIndex];
klic2[10]:=vymena[1];
Edit1.Text:=klic1+klic2;
end;
end;
procedure TForm1.ComboBox8Change(Sender: TObject);
begin
if (ComboBox8.ItemIndex=ComboBox7.ItemIndex) OR
(ComboBox8.ItemIndex=ComboBox9.ItemIndex) OR
(ComboBox8.ItemIndex=ComboBox10.ItemIndex) OR
(ComboBox8.ItemIndex=ComboBox11.ItemIndex) OR
(ComboBox8.ItemIndex=ComboBox12.ItemIndex) OR
(ComboBox8.ItemIndex=ComboBox13.ItemIndex) OR
(ComboBox8.ItemIndex=ComboBox14.ItemIndex) OR
(ComboBox8.ItemIndex=ComboBox15.ItemIndex) OR
(ComboBox8.ItemIndex=ComboBox16.ItemIndex) OR
(ComboBox8.ItemIndex=ComboBox17.ItemIndex) OR
(ComboBox8.ItemIndex=ComboBox18.ItemIndex)
then begin ComboBox8.ItemIndex:=-1; klic2[12]:='?'; Edit1.Text:=klic1+klic2; Button1.Enabled:=false; end
else begin if (ComboBox7.ItemIndex>-1) AND
(((ComboBox9.ItemIndex=-1) AND (ComboBox10.ItemIndex=-1) AND (CheckBox2.Checked=false)) OR
((ComboBox9.ItemIndex>-1) AND (ComboBox10.ItemIndex>-1) AND (CheckBox2.Checked=true))) AND
(((ComboBox11.ItemIndex=-1) AND (ComboBox12.ItemIndex=-1) AND (CheckBox3.Checked=false)) OR
((ComboBox11.ItemIndex>-1) AND (ComboBox12.ItemIndex>-1) AND (CheckBox3.Checked=true))) AND
(((ComboBox13.ItemIndex=-1) AND (ComboBox14.ItemIndex=-1) AND (CheckBox4.Checked=false)) OR
((ComboBox13.ItemIndex>-1) AND (ComboBox14.ItemIndex>-1) AND (CheckBox4.Checked=true))) AND
(((ComboBox15.ItemIndex=-1) AND (ComboBox16.ItemIndex=-1) AND (CheckBox5.Checked=false)) OR
((ComboBox15.ItemIndex>-1) AND (ComboBox16.ItemIndex>-1) AND (CheckBox5.Checked=true))) AND
(((ComboBox17.ItemIndex=-1) AND (ComboBox18.ItemIndex=-1) AND (CheckBox6.Checked=false)) OR
((ComboBox17.ItemIndex>-1) AND (ComboBox18.ItemIndex>-1) AND (CheckBox6.Checked=true)))
then Button1.Enabled:=true;
vymena:=ComboBox8.Items[ComboBox8.ItemIndex];
klic2[12]:=vymena[1];
Edit1.Text:=klic1+klic2;
end;
end;
procedure TForm1.ComboBox9Change(Sender: TObject);
begin
if (ComboBox9.ItemIndex=ComboBox7.ItemIndex) OR
(ComboBox9.ItemIndex=ComboBox8.ItemIndex) OR
(ComboBox9.ItemIndex=ComboBox10.ItemIndex) OR
(ComboBox9.ItemIndex=ComboBox11.ItemIndex) OR
(ComboBox9.ItemIndex=ComboBox12.ItemIndex) OR
(ComboBox9.ItemIndex=ComboBox13.ItemIndex) OR
(ComboBox9.ItemIndex=ComboBox14.ItemIndex) OR
(ComboBox9.ItemIndex=ComboBox15.ItemIndex) OR
(ComboBox9.ItemIndex=ComboBox16.ItemIndex) OR
(ComboBox9.ItemIndex=ComboBox17.ItemIndex) OR
(ComboBox9.ItemIndex=ComboBox18.ItemIndex)
then begin ComboBox9.ItemIndex:=-1; klic2[15]:='?'; Edit1.Text:=klic1+klic2; Button1.Enabled:=false; end
else begin if (ComboBox10.ItemIndex>-1) AND
(((ComboBox7.ItemIndex=-1) AND (ComboBox8.ItemIndex=-1) AND (CheckBox1.Checked=false)) OR
((ComboBox7.ItemIndex>-1) AND (ComboBox8.ItemIndex>-1) AND (CheckBox1.Checked=true))) AND
(((ComboBox11.ItemIndex=-1) AND (ComboBox12.ItemIndex=-1) AND (CheckBox3.Checked=false)) OR
((ComboBox11.ItemIndex>-1) AND (ComboBox12.ItemIndex>-1) AND (CheckBox3.Checked=true))) AND
(((ComboBox13.ItemIndex=-1) AND (ComboBox14.ItemIndex=-1) AND (CheckBox4.Checked=false)) OR
((ComboBox13.ItemIndex>-1) AND (ComboBox14.ItemIndex>-1) AND (CheckBox4.Checked=true))) AND
(((ComboBox15.ItemIndex=-1) AND (ComboBox16.ItemIndex=-1) AND (CheckBox5.Checked=false)) OR
((ComboBox15.ItemIndex>-1) AND (ComboBox16.ItemIndex>-1) AND (CheckBox5.Checked=true))) AND
(((ComboBox17.ItemIndex=-1) AND (ComboBox18.ItemIndex=-1) AND (CheckBox6.Checked=false)) OR
((ComboBox17.ItemIndex>-1) AND (ComboBox18.ItemIndex>-1) AND (CheckBox6.Checked=true)))
then Button1.Enabled:=true;
vymena:=ComboBox9.Items[ComboBox9.ItemIndex];
klic2[15]:=vymena[1];
Edit1.Text:=klic1+klic2;
end;
end;
procedure TForm1.Koprovat1Click(Sender: TObject);
begin
if Memo1.SelLength=0 then
begin
Memo1.SelectAll;
Memo1.CopyToClipboard;
end
else Memo1.CopyToClipboard;
end;
procedure TForm1.Koprovat2Click(Sender: TObject);
begin
Memo1.CopyToClipboard;
end;
procedure TForm1.Koprovat3Click(Sender: TObject);
begin
if Memo2.SelLength=0 then
begin
Memo2.SelectAll;
Memo2.CopyToClipboard;
end
else Memo2.CopyToClipboard;
end;
procedure TForm1.Koprovat4Click(Sender: TObject);
begin
Memo2.CopyToClipboard;
end;
procedure TForm1.Koprovat5Click(Sender: TObject);
begin
Edit1.CopyToClipboard;
end;
procedure TForm1.Memo1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if (Key=VK_BACK) OR (Key=VK_RETURN)then kontrola:=true
else kontrola:=false;
end;
procedure TForm1.Memo1KeyPress(Sender: TObject; var Key: Char);
begin
if (Key in ['a'..'z']) OR (Key in ['A'..'Z']) then Key:=UpCase(Key)
else begin if kontrola=false then Key:=#0 end;
end;
procedure TForm1.Odstranit1Click(Sender: TObject);
begin
Memo1.SelText:='';
Gauge1.Progress:=0;
end;
procedure TForm1.Odstranit2Click(Sender: TObject);
begin
Memo2.Lines.Clear;
Gauge1.Progress:=0;
end;
procedure TForm1.Otevt1Click(Sender: TObject);
var p, q: integer;
vlozit, uprava: string;
begin
if OpenDialog1.Execute then
begin
Gauge1.Progress:=0;
Memo1.Lines.Clear;
Memo2.Lines.Clear;
Memo5.Lines.Clear;
Memo6.Text:='1';
Memo5.Lines.LoadFromFile(OpenDialog1.FileName);
for p:=0 to Memo5.Lines.Count-1 do
begin
vlozit:=Memo5.Lines[p];
uprava:='';
for q:=1 to Length(vlozit) do
begin
if (vlozit[q] in ['a'..'z']) OR (vlozit[q] in ['A'..'Z']) then
begin
vlozit[q]:=UpCase(vlozit[q]);
uprava:=uprava+vlozit[q];
end
else
case vlozit[q] of
'ì': uprava:=uprava+'E'; 'Ì': uprava:=uprava+'E'; '‘': uprava:=uprava+'S';
'Š': uprava:=uprava+'S'; 'è': uprava:=uprava+'C'; 'È': uprava:=uprava+'C';
'ø': uprava:=uprava+'R'; 'Ø': uprava:=uprava+'R'; 'ž': uprava:=uprava+'Z';
'Ž': uprava:=uprava+'Z'; 'ý': uprava:=uprava+'Y'; 'Ý': uprava:=uprava+'Y';
'á': uprava:=uprava+'A'; 'Á': uprava:=uprava+'A'; 'í': uprava:=uprava+'I';
'Í': uprava:=uprava+'I'; 'é': uprava:=uprava+'E'; 'É': uprava:=uprava+'E';
'ú': uprava:=uprava+'U'; 'Ú': uprava:=uprava+'U'; 'ù': uprava:=uprava+'U';
'Ù': uprava:=uprava+'U'; 'ï': uprava:=uprava+'D'; 'Ï': uprava:=uprava+'D';
'ò': uprava:=uprava+'N'; 'Ò': uprava:=uprava+'N'; 'ť': uprava:=uprava+'T';
'Ť': uprava:=uprava+'T'; '1': uprava:=uprava+'JEDNA'; '2': uprava:=uprava+'DVA';
'3': uprava:=uprava+'TRI'; '4': uprava:=uprava+'CTYRI'; '5': uprava:=uprava+'PET';
'6': uprava:=uprava+'SEST'; '7': uprava:=uprava+'SEDM'; '8': uprava:=uprava+'OSM';
'9': uprava:=uprava+'DEVET'; '0': uprava:=uprava+'NULA'; '+': uprava:=uprava+'PLUS';
'-': uprava:=uprava+'MINUS'; '*': uprava:=uprava+'KRAT'; '/': uprava:=uprava+'DELENO';
'@': uprava:=uprava+'ZAVINAC'; '%': uprava:=uprava+'PROCENT';
end;
end;
Memo6.Lines.Add(uprava);
end;
Memo6.Lines.Delete(0);
Memo1.Text:=Memo6.Text;
end;
end;
procedure TForm1.ScrollBar1Change(Sender: TObject);
var rychlost: real;
prevod: string;
begin
if ScrollBar1.Position>490 then
begin
Label15.Caption:='CPU limit';
Label15.Font.Color:=clLime;
Edit2.Enabled:=false;
Edit3.Enabled:=false;
Edit4.Enabled:=false;
end
else
begin
rychlost:=1000 div (500-ScrollBar1.Position);
str(rychlost:2:0,prevod);
Label15.Caption:=prevod+' zn/s';
Label15.Font.Color:=clYellow;
Edit2.Enabled:=true;
Edit3.Enabled:=true;
Edit4.Enabled:=true;
end;
end;
procedure TForm1.SpeedButton1Click(Sender: TObject);
var vlozit, testovac: string;
spravne, z, y, x: integer;
prenos: char;
begin
if (Button1.Enabled=false) AND (ComboBox1.Enabled=false) then MessageDlg('Chyba: Nelze naèíst', mtcustom,[mbOK],0)
else
begin
if OpenDialog2.Execute then
begin
manual:=true;
testovac:='';
Gauge1.Progress:=0;
Memo5.Lines.Clear;
Memo5.Lines.LoadFromFile(OpenDialog2.FileName);
begin
if Memo5.Lines[0]='' then vlozit:='0' else vlozit:=Memo5.Lines[0];
if ((vlozit[1]='I') AND (vlozit[2]='-') AND (vlozit[3]='I') AND (vlozit[4]='I') AND
(vlozit[5]='-') AND (vlozit[6]='I') AND (vlozit[7]='I') AND (vlozit[8]='I'))
then begin ComboBox1.ItemIndex:=0; ComboBox2.ItemIndex:=1; ComboBox3.ItemIndex:=2; spravne:=1 end
else
if ((vlozit[1]='I') AND (vlozit[2]='-') AND (vlozit[3]='I') AND (vlozit[4]='I') AND
(vlozit[5]='I') AND (vlozit[6]='-') AND (vlozit[7]='I') AND (vlozit[8]='I'))
then begin ComboBox1.ItemIndex:=0; ComboBox2.ItemIndex:=2; ComboBox3.ItemIndex:=1; spravne:=1 end
else
if ((vlozit[1]='I') AND (vlozit[2]='I') AND (vlozit[3]='-') AND (vlozit[4]='I') AND
(vlozit[5]='-') AND (vlozit[6]='I') AND (vlozit[7]='I') AND (vlozit[8]='I'))
then begin ComboBox1.ItemIndex:=1; ComboBox2.ItemIndex:=0; ComboBox3.ItemIndex:=2; spravne:=1 end
else
if ((vlozit[1]='I') AND (vlozit[2]='I') AND (vlozit[3]='-') AND (vlozit[4]='I') AND
(vlozit[5]='I') AND (vlozit[6]='I') AND (vlozit[7]='-') AND (vlozit[8]='I'))
then begin ComboBox1.ItemIndex:=1; ComboBox2.ItemIndex:=2; ComboBox3.ItemIndex:=0; spravne:=1 end
else
if ((vlozit[1]='I') AND (vlozit[2]='I') AND (vlozit[3]='I') AND (vlozit[4]='-') AND
(vlozit[5]='I') AND (vlozit[6]='I') AND (vlozit[7]='-') AND (vlozit[8]='I'))
then begin ComboBox1.ItemIndex:=2; ComboBox2.ItemIndex:=1; ComboBox3.ItemIndex:=0; spravne:=1 end
else
if ((vlozit[1]='I') AND (vlozit[2]='I') AND (vlozit[3]='I') AND (vlozit[4]='-') AND
(vlozit[5]='I') AND (vlozit[6]='-') AND (vlozit[7]='I') AND (vlozit[8]='I'))
then begin ComboBox1.ItemIndex:=2; ComboBox2.ItemIndex:=0; ComboBox3.ItemIndex:=1; spravne:=1 end
else spravne:=0;
end;
if ((vlozit[9]=';') AND (vlozit[10]=' ') AND (vlozit[16]=';') AND (vlozit[17]=' ') AND
(vlozit[21]=';') AND (vlozit[22]=' ') AND (vlozit[26]=';') AND (vlozit[27]=' ') AND
(vlozit[31]=';') AND (vlozit[32]=' ') AND (vlozit[36]=';') AND (vlozit[37]=' ') AND
(vlozit[41]=';') AND (vlozit[42]=' ') AND (vlozit[12]='-') AND (vlozit[14]='-') AND
((vlozit[19]='/') OR (vlozit[19]='>')) AND ((vlozit[24]='/') OR (vlozit[24]='>')) AND
((vlozit[29]='/') OR (vlozit[29]='>')) AND ((vlozit[34]='/') OR (vlozit[34]='>')) AND
((vlozit[39]='/') OR (vlozit[39]='>')) AND ((vlozit[44]='/') OR (vlozit[44]='>')))
then spravne:=spravne+1;
if (vlozit[11] in ['A'..'Z']) AND (vlozit[13] in ['A'..'Z']) AND (vlozit[15] in ['A'..'Z']) then
begin
prenos:=vlozit[11];
for z:=1 to Length(ABC) do
begin
if prenos=ABC[z] then ComboBox4.ItemIndex:=z-1;
end;
prenos:=vlozit[13];
for z:=1 to Length(ABC) do
begin
if prenos=ABC[z] then ComboBox5.ItemIndex:=z-1;
end;
prenos:=vlozit[15];
for z:=1 to Length(ABC) do
begin
if prenos=ABC[z] then ComboBox6.ItemIndex:=z-1;
end;
spravne:=spravne+1;
end;
if ((vlozit[18] in ['A'..'Z']) AND (vlozit[19]='>') AND (vlozit[20] in ['A'..'Z'])) then
begin
prenos:=vlozit[18];
for z:=1 to Length(ABC) do
begin
if prenos=ABC[z] then begin ComboBox7.ItemIndex:=z-1; testovac:=testovac+prenos; end;
end;
prenos:=vlozit[20];
for z:=1 to Length(ABC) do
begin
if prenos=ABC[z] then begin ComboBox8.ItemIndex:=z-1; testovac:=testovac+prenos; end;
end;
CheckBox1.Checked:=true;
spravne:=spravne+1;
end
else if ((vlozit[18]='n') AND (vlozit[19]='/') AND (vlozit[20]='a')) then
begin
ComboBox7.Enabled:=false;
ComboBox7.Enabled:=false;
CheckBox1.Checked:=false;
spravne:=spravne+1;
end;
if ((vlozit[23] in ['A'..'Z']) AND (vlozit[24]='>') AND (vlozit[25] in ['A'..'Z'])) then
begin
prenos:=vlozit[23];
for z:=1 to Length(ABC) do
begin
if prenos=ABC[z] then begin ComboBox9.ItemIndex:=z-1; testovac:=testovac+prenos; end;
end;
prenos:=vlozit[25];
for z:=1 to Length(ABC) do
begin
if prenos=ABC[z] then begin ComboBox10.ItemIndex:=z-1; testovac:=testovac+prenos; end;
end;
CheckBox2.Checked:=true;
spravne:=spravne+1;
end
else if ((vlozit[23]='n') AND (vlozit[24]='/') AND (vlozit[25]='a')) then
begin
ComboBox9.Enabled:=false;
ComboBox10.Enabled:=false;
CheckBox2.Checked:=false;
spravne:=spravne+1;
end;
if ((vlozit[28] in ['A'..'Z']) AND (vlozit[29]='>') AND (vlozit[30] in ['A'..'Z'])) then
begin
prenos:=vlozit[28];
for z:=1 to Length(ABC) do
begin
if prenos=ABC[z] then begin ComboBox11.ItemIndex:=z-1; testovac:=testovac+prenos; end;
end;
prenos:=vlozit[30];
for z:=1 to Length(ABC) do
begin
if prenos=ABC[z] then begin ComboBox12.ItemIndex:=z-1; testovac:=testovac+prenos; end;
end;
CheckBox3.Checked:=true;
spravne:=spravne+1;
end
else if ((vlozit[28]='n') AND (vlozit[29]='/') AND (vlozit[30]='a')) then
begin
ComboBox11.Enabled:=false;
ComboBox12.Enabled:=false;
CheckBox3.Checked:=false;
spravne:=spravne+1;
end;
if ((vlozit[33] in ['A'..'Z']) AND (vlozit[34]='>') AND (vlozit[35] in ['A'..'Z'])) then
begin
prenos:=vlozit[33];
for z:=1 to Length(ABC) do
begin
if prenos=ABC[z] then begin ComboBox13.ItemIndex:=z-1; testovac:=testovac+prenos; end;
end;
prenos:=vlozit[35];
for z:=1 to Length(ABC) do
begin
if prenos=ABC[z] then begin ComboBox14.ItemIndex:=z-1; testovac:=testovac+prenos; end;
end;
CheckBox4.Checked:=true;
spravne:=spravne+1;
end
else if ((vlozit[33]='n') AND (vlozit[34]='/') AND (vlozit[35]='a')) then
begin
ComboBox13.Enabled:=false;
ComboBox14.Enabled:=false;
CheckBox4.Checked:=false;
spravne:=spravne+1;
end;
if ((vlozit[38] in ['A'..'Z']) AND (vlozit[39]='>') AND (vlozit[40] in ['A'..'Z'])) then
begin
prenos:=vlozit[38];
for z:=1 to Length(ABC) do
begin
if prenos=ABC[z] then begin ComboBox15.ItemIndex:=z-1; testovac:=testovac+prenos; end;
end;
prenos:=vlozit[40];
for z:=1 to Length(ABC) do
begin
if prenos=ABC[z] then begin ComboBox16.ItemIndex:=z-1; testovac:=testovac+prenos; end;
end;
CheckBox5.Checked:=true;
spravne:=spravne+1;
end
else if ((vlozit[38]='n') AND (vlozit[39]='/') AND (vlozit[40]='a')) then
begin
ComboBox15.Enabled:=false;
ComboBox16.Enabled:=false;
CheckBox5.Checked:=false;
spravne:=spravne+1;
end;
if ((vlozit[43] in ['A'..'Z']) AND (vlozit[44]='>') AND (vlozit[45] in ['A'..'Z'])) then
begin
prenos:=vlozit[43];
for z:=1 to Length(ABC) do
begin
if prenos=ABC[z] then begin ComboBox17.ItemIndex:=z-1; testovac:=testovac+prenos; end;
end;
prenos:=vlozit[45];
for z:=1 to Length(ABC) do
begin
if prenos=ABC[z] then begin ComboBox18.ItemIndex:=z-1; testovac:=testovac+prenos; end;
end;
CheckBox6.Checked:=true;
spravne:=spravne+1;
end
else if ((vlozit[43]='n') AND (vlozit[44]='/') AND (vlozit[45]='a')) then
begin
ComboBox17.Enabled:=false;
ComboBox18.Enabled:=false;
CheckBox6.Checked:=false;
spravne:=spravne+1;
end;
x:=0;
for y:=1 to Length(testovac) do
begin
for z:=1 to Length(testovac) do
begin
if testovac[y]=testovac[z] then x:=x+1;
end;
end;
if x=Length(testovac) then spravne:=spravne+1;
if spravne=10 then
begin
Edit1.Text:=Memo5.Lines[0];
for z:=1 to 8 do klic1[z]:=Edit1.Text[z];
for z:=1 to 38 do klic2[z]:=Edit1.Text[z+8];
end
else
begin
ComboBox1.ItemIndex:=0; ComboBox2.ItemIndex:=1; ComboBox3.ItemIndex:=2;
ComboBox4.ItemIndex:=0; ComboBox5.ItemIndex:=0; ComboBox6.ItemIndex:=0;
ComboBox7.ItemIndex:=-1; ComboBox8.ItemIndex:=-1; ComboBox9.ItemIndex:=-1;
ComboBox10.ItemIndex:=-1; ComboBox11.ItemIndex:=-1; ComboBox12.ItemIndex:=-1;
ComboBox13.ItemIndex:=-1; ComboBox14.ItemIndex:=-1; ComboBox15.ItemIndex:=-1;
ComboBox16.ItemIndex:=-1; ComboBox17.ItemIndex:=-1; ComboBox18.ItemIndex:=-1;
CheckBox1.Checked:=false; CheckBox2.Checked:=false; CheckBox3.Checked:=false;
CheckBox4.Checked:=false; CheckBox5.Checked:=false; CheckBox6.Checked:=false;
Edit1.Text:='I-II-III; A-A-A; n/a; n/a; n/a; n/a; n/a; n/a';
klic1:='I-II-III';
klic2:='; A-A-A; n/a; n/a; n/a; n/a; n/a; n/a';
MessageDlg('Chyba: Po‘kozený soubor klíèe', mtcustom,[mbOK],0);
end;
manual:=false;
Edit2.Text:=ComboBox4.Items[ComboBox4.ItemIndex];
Edit3.Text:=ComboBox5.Items[ComboBox5.ItemIndex];
Edit4.Text:=ComboBox6.Items[ComboBox6.ItemIndex];
end;
end;
end;
procedure TForm1.SpeedButton2Click(Sender: TObject);
begin
if (Button1.Enabled=false) AND (ComboBox1.Enabled=false) then MessageDlg('Chyba: Nelze uložit', mtcustom,[mbOK],0)
else
begin
if (Button1.Enabled=false) AND (ComboBox1.Enabled=true) then MessageDlg('Chyba: Neúplný klíè', mtcustom,[mbOK],0)
else
begin
if SaveDialog2.Execute then
begin
Memo5.Lines[0]:=Edit1.Text;
Memo5.Lines.SaveToFile(SaveDialog2.FileName);
end;
end;
end;
end;
procedure TForm1.Uloit1Click(Sender: TObject);
begin
if SaveDialog1.Execute then
begin
Memo2.Lines.SaveToFile(SaveDialog1.FileName);
end;
end;
procedure TForm1.Uloiz1Click(Sender: TObject);
begin
if SaveDialog1.Execute then
begin
Memo1.Lines.SaveToFile(SaveDialog1.FileName);
end;
end;
procedure TForm1.Vloit1Click(Sender: TObject);
var p, q: integer;
vlozit, uprava: string;
begin
Memo3.Lines.Clear;
Memo4.Text:='1';
Memo3.PasteFromClipboard;
for p:=0 to Memo3.Lines.Count-1 do
begin
vlozit:=Memo3.Lines[p];
uprava:='';
for q:=1 to Length(vlozit) do
begin
if (vlozit[q] in ['a'..'z']) OR (vlozit[q] in ['A'..'Z']) then
begin
vlozit[q]:=UpCase(vlozit[q]);
uprava:=uprava+vlozit[q];
end
else
case vlozit[q] of
'ì': uprava:=uprava+'E'; 'Ì': uprava:=uprava+'E'; '‘': uprava:=uprava+'S';
'Š': uprava:=uprava+'S'; 'è': uprava:=uprava+'C'; 'È': uprava:=uprava+'C';
'ø': uprava:=uprava+'R'; 'Ø': uprava:=uprava+'R'; 'ž': uprava:=uprava+'Z';
'Ž': uprava:=uprava+'Z'; 'ý': uprava:=uprava+'Y'; 'Ý': uprava:=uprava+'Y';
'á': uprava:=uprava+'A'; 'Á': uprava:=uprava+'A'; 'í': uprava:=uprava+'I';
'Í': uprava:=uprava+'I'; 'é': uprava:=uprava+'E'; 'É': uprava:=uprava+'E';
'ú': uprava:=uprava+'U'; 'Ú': uprava:=uprava+'U'; 'ù': uprava:=uprava+'U';
'Ù': uprava:=uprava+'U'; 'ï': uprava:=uprava+'D'; 'Ï': uprava:=uprava+'D';
'ò': uprava:=uprava+'N'; 'Ò': uprava:=uprava+'N'; 'ť': uprava:=uprava+'T';
'Ť': uprava:=uprava+'T'; '1': uprava:=uprava+'JEDNA'; '2': uprava:=uprava+'DVA';
'3': uprava:=uprava+'TRI'; '4': uprava:=uprava+'CTYRI'; '5': uprava:=uprava+'PET';
'6': uprava:=uprava+'SEST'; '7': uprava:=uprava+'SEDM'; '8': uprava:=uprava+'OSM';
'9': uprava:=uprava+'DEVET'; '0': uprava:=uprava+'NULA'; '+': uprava:=uprava+'PLUS';
'-': uprava:=uprava+'MINUS'; '*': uprava:=uprava+'KRAT'; '/': uprava:=uprava+'DELENO';
'@': uprava:=uprava+'ZAVINAC'; '%': uprava:=uprava+'PROCENT';
end;
end;
Memo4.Lines.Add(uprava);
end;
Memo4.Lines.Delete(0);
Memo4.SelectAll;
Memo4.CopyToClipboard;
if uprava<>'' then Memo1.PasteFromClipboard;
Gauge1.Progress:=0;
end;
procedure TForm1.Vloit2Click(Sender: TObject);
var p, q: integer;
vlozit, uprava: string;
begin
Memo3.Lines.Clear;
Memo4.Text:='1';
Memo3.PasteFromClipboard;
for p:=0 to Memo3.Lines.Count-1 do
begin
vlozit:=Memo3.Lines[p];
uprava:='';
for q:=1 to Length(vlozit) do
begin
if (vlozit[q] in ['a'..'z']) OR (vlozit[q] in ['A'..'Z']) then
begin
vlozit[q]:=UpCase(vlozit[q]);
uprava:=uprava+vlozit[q];
end
else
case vlozit[q] of
'ì': uprava:=uprava+'E'; 'Ì': uprava:=uprava+'E'; '‘': uprava:=uprava+'S';
'Š': uprava:=uprava+'S'; 'è': uprava:=uprava+'C'; 'È': uprava:=uprava+'C';
'ø': uprava:=uprava+'R'; 'Ø': uprava:=uprava+'R'; 'ž': uprava:=uprava+'Z';
'Ž': uprava:=uprava+'Z'; 'ý': uprava:=uprava+'Y'; 'Ý': uprava:=uprava+'Y';
'á': uprava:=uprava+'A'; 'Á': uprava:=uprava+'A'; 'í': uprava:=uprava+'I';
'Í': uprava:=uprava+'I'; 'é': uprava:=uprava+'E'; 'É': uprava:=uprava+'E';
'ú': uprava:=uprava+'U'; 'Ú': uprava:=uprava+'U'; 'ù': uprava:=uprava+'U';
'Ù': uprava:=uprava+'U'; 'ï': uprava:=uprava+'D'; 'Ï': uprava:=uprava+'D';
'ò': uprava:=uprava+'N'; 'Ò': uprava:=uprava+'N'; 'ť': uprava:=uprava+'T';
'Ť': uprava:=uprava+'T'; '1': uprava:=uprava+'JEDNA'; '2': uprava:=uprava+'DVA';
'3': uprava:=uprava+'TRI'; '4': uprava:=uprava+'CTYRI'; '5': uprava:=uprava+'PET';
'6': uprava:=uprava+'SEST'; '7': uprava:=uprava+'SEDM'; '8': uprava:=uprava+'OSM';
'9': uprava:=uprava+'DEVET'; '0': uprava:=uprava+'NULA'; '+': uprava:=uprava+'PLUS';
'-': uprava:=uprava+'MINUS'; '*': uprava:=uprava+'KRAT'; '/': uprava:=uprava+'DELENO';
'@': uprava:=uprava+'ZAVINAC'; '%': uprava:=uprava+'PROCENT';
end;
end;
Memo4.Lines.Add(uprava);
end;
Memo4.Lines.Delete(0);
Memo4.SelectAll;
Memo4.CopyToClipboard;
if uprava<>'' then Memo1.PasteFromClipboard;
Gauge1.Progress:=0;
end;
procedure TForm1.VybratVe1Click(Sender: TObject);
begin
Memo1.SelectAll;
end;
procedure TForm1.Vybratve2Click(Sender: TObject);
begin
Memo2.SelectAll;
end;
procedure TForm1.Vyjmout1Click(Sender: TObject);
begin
if Memo1.SelLength=0 then
begin
Memo1.SelectAll;
Memo1.CutToClipboard;
end
else Memo1.CutToClipboard;
Gauge1.Progress:=0;
end;
procedure TForm1.Vymazat1Click(Sender: TObject);
begin
if Memo1.SelLength=0 then Memo1.Clear
else Memo1.SelText:='';
Gauge1.Progress:=0;
end;
procedure TForm1.Vzjmout1Click(Sender: TObject);
begin
Memo1.CutToClipboard;
Gauge1.Progress:=0;
end;