unit Unit7;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, StdCtrls,
  SynEdit;



type

  { TForm7 }

  TForm7 = class(TForm)
    Button1: TButton;
    Edit1: TEdit;
    Label1: TLabel;
    ListBox1: TListBox;
    Panel1: TPanel;
    Panel2: TPanel;
    Panel3: TPanel;
    Splitter1: TSplitter;
    SynEdit1: TSynEdit;
    procedure Button1Click(Sender: TObject);
    procedure Edit1Change(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
    procedure ListBox1Click(Sender: TObject);
    procedure LSL(list1: TStringList);

  private

  public

  end;

var
  Form7: TForm7;
  list1: TStringList;
  list2: TStringList;
  n: Integer;
implementation
uses
  Unit1, form7_fun_unit7, Str_Unit7;
{$R *.lfm}

{ TForm7 }
procedure TForm7.LSL(list1: TStringList);
var l1, i: integer;
begin
  l1:= list1.Count;
  i:=0;
  ListBox1.Items.Clear;
  while(i<l1) do
  begin
   ListBox1.Items.Add(list1.Strings[i]);
   i:=i+1;
  end;

end;
procedure TForm7.Button1Click(Sender: TObject);
var i, con: integer;
    str: String;
begin
  con:= Form7.SynEdit1.Lines.Count;
  for i := 0 to con do
  begin
   str:= Form7.SynEdit1.Lines.Strings[i];
   Form1.SynEdit1.Lines.Add(str);
  end;
  Close;
end;

procedure TForm7.Edit1Change(Sender: TObject);
var i:Integer;
    str:String;
begin
 i:=0;
 str:=Edit1.Text;
 list2.Clear;
 while(i<n) do
  begin
   if list1.Strings[i].IndexOf(str)>=0 then list2.Add(list1.Strings[i]);
   i:=i+1;
  end;
  LSL(list2);
  if str='' then LSL(list1);
end;

procedure TForm7.FormCreate(Sender: TObject);
var i: integer;
begin
  list1:= TStringList.Create;
  list2:= TStringList.Create;
  for i:=1 to mas_n do
  list1.Add(st_it[i]);

  n:= list1.Count;
  LSL(list1);
end;

procedure TForm7.FormDestroy(Sender: TObject);
begin
   list1.Destroy;
   list2.Destroy;
end;

procedure TForm7.ListBox1Click(Sender: TObject);
var selid: integer;
    str: String;
begin
  SynEdit1.Clear;
  selid:=ListBox1.ItemIndex;
  if selid>=0 then str:= ListBox1.Items.Strings[selid];
  if  str = st_it[1] then form7_fun_unit7.show_shablon1();
  if  str = st_it[2] then form7_fun_unit7.show_shablon2();
  if  str = st_it[3] then form7_fun_unit7.show_shablon3();
  if  str = st_it[4] then form7_fun_unit7.show_shablon4();
  if  str = st_it[5] then form7_fun_unit7.show_shablon5();
end;








end.

