Source file: /~heha/hsn/WdxInfoPacker64.zip/MonDialogue.pas

{$D-,O+,Q-,R-,S-}
unit MonDialogue;

interface

uses Windows, SysUtils, Controls, Forms, ExtCtrls,
     Dialogs,Graphics,
     IniFiles, StdCtrls,Menus, Classes, ComCtrls,
     AddSchemeComment,
     langage,IniFile_Class,shellApi,lcltype;
const WDX_VERSION_INFO_='1.4.1';
type
 TPagesDlg= class(TForm)

    Panel1: TPanel;
    Panel2: TPanel;
    Button1: TButton;
    Button2: TButton;
    Button3: TButton;
    PageControl1: TPageControl;
    TabSheet1: TTabSheet;
    Label1: TLabel;
    Label2: TLabel;
    ListBox1: TListBox;
    Button4: TButton;
    Button5: TButton;
    ComboBox1: TComboBox;

    GroupBox1: TGroupBox;
    GroupBox2: TGroupBox;
    Button9: TButton;
    TabSheet2: TTabSheet;
    Button10: TButton;
    Button8: TButton;
    Button7: TButton;
    Button6: TButton;
    Button11: TButton;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    Label7: TLabel;
    Label8: TLabel;
    Label9: TLabel;
    Label10: TLabel;
    Label11: TLabel;
    Label12: TLabel;
    PopupMenu1: TPopupMenu;

    Edit1: TEdit;
    Edit2: TEdit;
    CheckBox9: TCheckBox;
    CheckBox10: TCheckBox;
    CheckBox11: TCheckBox;
    CheckBox8: TCheckBox;
    CheckBox7: TCheckBox;
    CheckBox6: TCheckBox;
    CheckBox5: TCheckBox;
    CheckBox4: TCheckBox;
    CheckBox3: TCheckBox;
    CheckBox2: TCheckBox;
    CheckBox1: TCheckBox;
    Edit9: TEdit;
    Edit8: TEdit;
    Edit7: TEdit;
    Edit6: TEdit;
    Edit5: TEdit;
    Edit4: TEdit;
    Edit3: TEdit;
    Edit10: TEdit;

    CheckBox12: TCheckBox;
    Edit11: TEdit;
    CheckBox13: TCheckBox;
    CheckBox14: TCheckBox;
    CheckBox15: TCheckBox;
    TabSheet3: TTabSheet;
    OpenDialog1: TOpenDialog;
    ListBox2: TListBox;
    Label14: TLabel;
    Button14: TButton;
    Label15: TLabel;
    GroupBox3: TGroupBox;
    Label16: TLabel;
    Label17: TLabel;
    Label18: TLabel;
    Label19: TLabel;
    Label20: TLabel;
    Label22: TLabel;
    Label23: TLabel;
    Label24: TLabel;
    Label25: TLabel;
    Label26: TLabel;
    Edit13: TEdit;
    Edit12: TEdit;
    Label13: TLabel;
    Button12: TButton;
    Label21: TLabel;
    CheckBox16: TCheckBox;
    Edit14: TEdit;
    CheckBox17: TCheckBox;
    Edit15: TEdit;
    Label27: TLabel;
    Edit16: TEdit;
    Label28: TLabel;
    Edit17: TEdit;
    RadioButton1: TRadioButton;
    RadioButton2: TRadioButton;
    CheckBox18: TCheckBox;
    Edit18: TEdit;
    Edit19: TEdit;
    Label29: TLabel;
    Label30: TLabel;
    Label31: TLabel;
    Label32: TLabel;
    CheckBox19: TCheckBox;
    Edit20: TEdit;
    CheckBox20: TCheckBox;
    Edit21: TEdit;
    Label33: TLabel;
    CheckBox21: TCheckBox;
    Label34: TLabel;
    procedure FormCreate(Sender: TObject);
    procedure ComboBox1Change(Sender: TObject);
    procedure ListBox1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure CheckBox12Click(Sender: TObject);
    procedure CheckBox13Click(Sender: TObject);
    procedure CheckBox14Click(Sender: TObject);
    procedure CheckBox15Click(Sender: TObject);
    procedure Button5Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure Button9Click(Sender: TObject);
    procedure Button10Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button7Click(Sender: TObject);
    procedure Button8Click(Sender: TObject);
    procedure Button6Click(Sender: TObject);
    procedure Button11Click(Sender: TObject);
    procedure TabSheet2Show(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure Button12Click(Sender: TObject);
    procedure TabSheet3Show(Sender: TObject);
    procedure ListBox2Click(Sender: TObject);
    procedure Button14Click(Sender: TObject);
    procedure RadioButton2Click(Sender: TObject);
    procedure RadioButton1Click(Sender: TObject);

    procedure FormKeyPress(Sender: TObject; var Key: Char);
    procedure Label31Click(Sender: TObject);
    procedure Label10Click(Sender: TObject);
    procedure Label8Click(Sender: TObject);
    procedure TabSheet1Show(Sender: TObject);
    procedure CheckBox21Click(Sender: TObject);
    procedure CheckBox1Click(Sender: TObject);
    procedure CheckBox2Click(Sender: TObject);
    procedure CheckBox3Click(Sender: TObject);
    procedure CheckBox4Click(Sender: TObject);
    procedure CheckBox6Click(Sender: TObject);
    procedure CheckBox19Click(Sender: TObject);
    procedure CheckBox7Click(Sender: TObject);
    procedure CheckBox9Click(Sender: TObject);
    procedure CheckBox17Click(Sender: TObject);
    procedure CheckBox18Click(Sender: TObject);
    procedure CheckBox8Click(Sender: TObject);
    procedure CheckBox16Click(Sender: TObject);
    procedure CheckBox20Click(Sender: TObject);
    procedure TabSheet1Exit(Sender: TObject);

    procedure Edit1MouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);

  private
  WdxInfoPackerIni:TMyIni;
  SchemeIni:TSchema;
  TC_COL:TC_Custom;
  ok4Click:boolean;
  Lng:TMonLangage;
  reCreatePopup:boolean;
  selfPath:string;
  CommentList:THashedStringList;
  procedure InitPopup;
  procedure RefreshLangue(Lng:TMonLangage);
  procedure InitForm;
  procedure AfficheSchema(Sch:TSchema);
  procedure ClearAllForScheme;
  procedure VerifyeditBox;
  procedure resetToWhite;
  function FindTheBestIni(IniParDef:pchar):pchar;
  procedure checkComment(s:string);

 end;
  type MonDial=Class
  public
  PagesDlg:TPagesDlg;
  function CreerMonDialogue(DefaultIni:pchar):integer;
  end;
  type TColor = -(COLOR_ENDCOLORS + 1)..$02FFFFFF;

implementation
uses Thread_IniPop,someStuff;
{$R *.dfm}

var DefIni,ContPlug:array[0..MAX_PATH] of char;
    My_Menu:IniPop;
    PosCounter:integer;
function MonDial.CreerMonDialogue(DefaultIni:pchar):integer;
begin

lstrcpyn(DefIni,DefaultIni,sizeof(DefIni));
lstrcpyn(ContPlug,pchar(ExtractFilePath(DefIni)+'contplug.ini'),sizeof(ContPlug));
PagesDlg:=TPagesDlg.Create(application);
result:=PagesDlg.ShowModal;
//PagesDlg.Free;
end;

procedure TPagesDlg.FormCreate(Sender: TObject);
begin
     self.KeyPreview:=true;
     ok4Click:=false;
     WdxInfoPackerIni:=TMyIni.Create;
     SchemeIni:=TSchema.Create;
     TC_COL:=TC_Custom.Create;
     CommentList:=THashedStringList.Create;
     Fillchar(WdxInfoPackerIni.MyIni.PathToIni,sizeof(WdxInfoPackerIni.MyIni.PathToIni),#0);
     strlcat(WdxInfoPackerIni.MyIni.PathToIni,FindTheBestIni(DefIni),sizeof(WdxInfoPackerIni.MyIni.PathToIni)-1);
     InitForm;
end;

function TPagesDlg.FindTheBestIni(IniParDef:pchar):pchar;
var path:string; ModName: array[0..260] of Char;AllTest:boolean;
const Res:array[0..260] of Char = '';
begin
  Res[0]:=#0;
  AllTest:=false;
  if not AllTest then begin
  //Test1 : .\PluginName.ini (relative to the directory where Wincmd.ini is located)
  path:=ExtractFilePath(IniParDef)+'WdxInfoPacker.ini';
  if not (FileIsReadOnly(path)) then begin
     lstrcpyn(Res,pchar(path),sizeof(Res));
  end;
  //Test2 : .\PluginName\PluginName.ini (relative to the directory where Wincmd.ini is located)
  path:=ExtractFilePath(IniParDef)+'WdxInfoPacker\WdxInfoPacker.ini';
  if not (FileIsReadOnly(path)) then begin
     lstrcpyn(Res,pchar(path),sizeof(Res));
  end;
  //Test3 : .\PluginName.ini (relative to the directory where the plugin is located)
  ModName[0]:=#0;
  SetString(path, ModName,Windows.GetModuleFileName(HInstance, ModName, SizeOf(ModName)));
  selfPath:=path;
  path:=ExtractFilePath(path)+'WdxInfoPacker.ini';
  if not (FileIsReadOnly(path)) then begin
     lstrcpyn(Res,pchar(path),sizeof(Res));
  end;
  //Test4 : .\PluginName.ini (relative to the directory where Total Commander is located)
  Fillchar(ModName,sizeof(ModName),#0);
  SetString(path, ModName,Windows.GetModuleFileName(0, ModName, SizeOf(ModName)));
  path:=ExtractFilePath(path)+'WdxInfoPacker.ini';
  if not (FileIsReadOnly(path)) then begin
     lstrcpyn(Res,pchar(path),sizeof(Res));
  end;
  if Res[0]=#0 then AllTest:=true;
  end;
  if AllTest then begin //We'll use wincmd.ini folder , it must be writable
     Path:=ExtractFilePath(IniParDef)+'WdxInfoPacker.ini';
     lstrcpyn(Res,pchar(path),sizeof(Res));
  end;
  result:=Res;
end;

procedure TPagesDlg.InitForm;
var List:Tstringlist;
s:string;
i:integer;
begin

  Self.Visible:=false;
  reCreatePopup:=true;
   label34.caption:='';
   label34.Color:=Self.Color;
   Label34.Hint:='';
  //  Self.resetToWhite;
  LNG:=TMonLangage.Create;
  List:=TStringList.create;
  WdxInfoPackerIni.LoadIniValue;
  Fillchar(SchemeIni.Scheme.PathToSchemeFile ,sizeof(SchemeIni.Scheme.PathToSchemeFile),#0);
  if WdxInfoPackerIni.UseAnotherFileForScheme<>'-1' then begin
        if pos(':\',WdxInfoPackerIni.UseAnotherFileForScheme)=0 then s:=ExtractFilePath(WdxInfoPackerIni.MyIni.PathToIni)+WdxInfoPackerIni.UseAnotherFileForScheme
        else s:=WdxInfoPackerIni.UseAnotherFileForScheme;
  end else begin
     s:=ExtractFilePath(WdxInfoPackerIni.MyIni.PathToIni)+'Scheme.ini';
  end;
  strlcat(SchemeIni.Scheme.PathToSchemeFile,pchar(s),sizeof(SchemeIni.Scheme.PathToSchemeFile)-1);
  With WdxInfoPackerIni.MyIni do begin
  if WdxInfoPackerIni.MyIni.RememberLast then CheckBox13.Checked:=true;
  if WdxInfoPackerIni.MyIni.CheckBeforeSave then CheckBox14.Checked:=true;
  if WdxInfoPackerIni.MyIni.Assoc then CheckBox15.Checked:=true;
  if WdxInfoPackerIni.MyIni.MaskEditBox then CheckBox21.Checked:=true;
  if WdxInfoPackerIni.MyIni.VerifyWdx then begin
     CheckBox12.Checked:=true;
     WdxInfoPackerIni.CheckPluginFolder;
  end;
  if WdxInfoPackerIni.MyIni.KnownPlugin then begin
     Edit11.Text:=WdxInfoPackerIni.MyIni.WdxFolder;
  end else begin
      WdxInfoPackerIni.FindPlugin;
      KnownPlugin:=true;
      Edit11.Text:=WdxFolder;
  end;
  Run:=false;
  end;
  List.Clear;
  LNG.ListAvailableLanguage(WdxInfoPackerIni.MyIni.PathToIni,List);
  if WdxInfoPackerIni.MyIni.language <>'' then begin
   LNG.loadLanguage(WdxInfoPackerIni.MyIni.language)
  end else begin
   LNG.loadLanguage(pchar(List[0]));
  end;
  RefreshLangue(LNG);
  ComboBox1.Items:=List;
  List.Clear;
  List.Add('__'+LNG.Langue.EmptyScheme+'__');
  SchemeIni.DeleteScheme('RunTemp');

  SchemeIni.ListAvailableScheme(List);
  SchemeIni.ListAvailableSchemeComment(CommentList);
  if List.Count <2 then begin
     s:='You have no predefine Scheme, Go on the 2nd page to create new one'+slinebreak+
	'that you will be able to use after, see the readme for more informations';
     MessageBox(GetActiveWindow, pchar(s),'Warning',MB_OK);
  end else begin
   ListBox1.clear;
   ListBox1.Items:=List;
   if ((WdxInfoPackerIni.MyIni.LastScheme <>'') and (WdxInfoPackerIni.MyIni.RememberLast=true)) then begin
    i:=0;
    List.Find(WdxInfoPackerIni.MyIni.LastScheme,i);
    ListBox1.Selected[i]:=true;
    checkComment(ListBox1.Items[i]);
   end else ListBox1.Selected[0]:=true;
  end;

  List.clear;
  List.free;

  WdxInfoPackerIni.SaveIniValue;
  ok4Click:=true;
end;


procedure TPagesDlg.Button6Click(Sender: TObject); //Save a scheme
var overwrite:boolean;
outbuf:array[0..20] of char;
i:integer;
outbufptr:pchar;
begin
  if Edit1.text<>'' then begin
  overwrite:=true;
  if (((CheckBox9.Checked=true) AND (RadioButton1.Checked=false) AND (RadioButton2.Checked=false))) then begin
        MessageBox(GetActiveWindow,'You have to specified a position for the counter !','Warning',mb_ok or mb_iconwarning);
        overwrite:=false;
  end;
  if WdxInfoPackerIni.MyIni.CheckBeforeSave then begin
     if SchemeIni.SchemeExist(pchar(Edit1.text)) then begin
        if idok <>MessageBox(GetActiveWindow,'A Scheme with the same name already exist, overwrite?','Warning',MB_OKCANCEL or MB_ICONWARNING) then begin
	   overwrite:=false;
        end;
     end;
  end;
  if overwrite then begin
     outbufptr:=outbuf;
     if CheckBox1.Checked then begin outbufptr^:='a'; inc(outbufptr); end;
     if CheckBox2.Checked then begin outbufptr^:='b'; inc(outbufptr); end;
     if CheckBox3.Checked then begin outbufptr^:='c'; inc(outbufptr); end;
     if CheckBox4.Checked then begin outbufptr^:='d'; inc(outbufptr); end;
     if CheckBox5.Checked then begin outbufptr^:='e'; inc(outbufptr); end;
     if CheckBox6.Checked then begin outbufptr^:='f'; inc(outbufptr); end;
     if CheckBox7.Checked then begin outbufptr^:='g'; inc(outbufptr); end;
     if CheckBox8.Checked then begin outbufptr^:='h'; inc(outbufptr); end;
     if CheckBox16.Checked then begin outbufptr^:='i'; inc(outbufptr); end;
     if CheckBox17.Checked then begin outbufptr^:='j'; inc(outbufptr); end;
     if CheckBox19.Checked then begin outbufptr^:='k'; inc(outbufptr); end;
     if CheckBox20.Checked then begin outbufptr^:='l'; inc(outbufptr); end;
     outbufptr^:=#0;
     With SchemeIni do begin
	  SetUse(outbuf);
	  SetExtension(pchar(Edit2.text));
             SetDivider(pchar(Edit10.text));
             Setheader(pchar(Edit3.Text));
             Setbefore(pchar(Edit4.Text));
             Setname(pchar(Edit5.Text));
             Setbetween(pchar(Edit6.Text));
             Setwdxinfo(pchar(Edit7.Text));
	     Setafter(pchar(Edit8.Text));
             Setfooter(pchar(Edit9.Text));
             SetDirectoryText(pchar(Edit20.Text));
             SetCounter(CheckBox9.Checked);
             SetDoNotWrite(CheckBox10.Checked);
             SetSaveLog(CheckBox11.Checked);
             SetListExtension(pchar(Edit14.Text));
             SetAdditionalText(pchar(Edit15.Text));
             SetCounterPos(PosCounter);
             if(Edit17.Text='') then
                SetCounterLength(0)
             Else SetCounterLength(strtoint(Edit17.Text));
	     if(Edit16.text='') then
                SetIntervalNbr(0)
	     Else SetIntervalNbr(strtoint(Edit16.text));
              if(Edit21.Text='') then
                SetRecursionDepth(0)
             Else SetRecursionDepth(strtoint(Edit21.Text));
	     SetStrReplace(CheckBox18.Checked,pchar(Edit18.text),pchar(edit19.text));
             DeleteScheme(pchar(Edit1.text)); //pour etre sur de tt effacer
             SaveScheme(pchar(Edit1.text));
	end;
     end;
     Self.Hide;
     InitForm;
     Self.Show;
     for i:=0 to ListBox1.Count-1 do begin
      if Edit1.Text=ListBox1.Items[i] then begin
       ListBox1.Selected[i]:=true;
       checkComment(ListBox1.Items[i]);
      end;
     end;
  end else MessageBox(GetActiveWindow,'Give a name to the Scheme first!','Error',MB_OK or MB_ICONERROR);
end;

procedure TPagesDlg.RefreshLangue(Lng:TMonLangage);
begin
  TabSheet1.Caption:=Lng.Langue.TabSheet1;
  TabSheet2.Caption:=Lng.Langue.TabSheet2;
  TabSheet3.Caption:=Lng.Langue.TabSheet3;

  CheckBox1.Caption:=Lng.Langue.CheckBox1;
  CheckBox2.Caption:=Lng.Langue.CheckBox2;
  CheckBox3.Caption:=Lng.Langue.CheckBox3;
  CheckBox4.Caption:=Lng.Langue.CheckBox4;
  CheckBox5.Caption:=Lng.Langue.CheckBox5;
  CheckBox6.Caption:=Lng.Langue.CheckBox6;
  CheckBox7.Caption:=Lng.Langue.CheckBox7;
  CheckBox8.Caption:=Lng.Langue.CheckBox8;
  CheckBox9.Caption:=Lng.Langue.CheckBox9;
  CheckBox10.Caption:=Lng.Langue.CheckBox10;
  CheckBox11.Caption:=Lng.Langue.CheckBox11;
  CheckBox12.Caption:=Lng.Langue.CheckBox12;
  CheckBox13.Caption:=Lng.Langue.CheckBox13;
  CheckBox14.Caption:=Lng.Langue.CheckBox14;
  CheckBox15.Caption:=Lng.Langue.CheckBox15;
  CheckBox16.Caption:=Lng.Langue.CheckBox16;
  CheckBox17.Caption:=Lng.Langue.CheckBox17;
  CheckBox18.Caption:=Lng.Langue.CheckBox18;
  CheckBox19.Caption:=Lng.Langue.CheckBox19;
  CheckBox20.Caption:=Lng.Langue.CheckBox20;
  CheckBox21.Caption:=Lng.Langue.CheckBox21;

  Button1.Caption:=Lng.Langue.Button1;
  Button2.Caption:=Lng.Langue.Button2;
  Button3.Caption:=Lng.Langue.Button3;
  Button4.Caption:=Lng.Langue.Button4;
  Button5.Caption:=Lng.Langue.Button5;
  Button6.Caption:=Lng.Langue.Button6;
  Button7.Caption:=Lng.Langue.Button7;
  Button8.Caption:=Lng.Langue.Button8;
  Button9.Caption:=Lng.Langue.Button9;
  Button10.Caption:=Lng.Langue.Button10;

  Button12.Caption:=Lng.Langue.Button9;
  Button14.Caption:=Lng.Langue.Button14;

  Label1.Caption:=Lng.Langue.Label1;
  Label2.Caption:=Lng.Langue.Label2;
  Label3.Caption:=Lng.Langue.Label3;
  label4.Caption:=Lng.Langue.Label4;
  label5.Caption:=Lng.Langue.Label5;
  label6.Caption:=Lng.Langue.Label6;
  label7.Caption:=Lng.Langue.Label7;
  label8.Caption:=Lng.Langue.Label8;
  label9.Caption:=Lng.Langue.Label9;
  label10.Caption:=Lng.Langue.Label10;
  label11.Caption:=Lng.Langue.Label11;
  label12.Caption:=Lng.Langue.Label12;

  label13.Caption:=Lng.Langue.Label13;
  label14.Caption:=Lng.Langue.Label14;
  label15.Caption:=Lng.Langue.Label11;

  label16.Caption:=Lng.Langue.CheckBox2;
  label17.Caption:=Lng.Langue.CheckBox3;
  label18.Caption:=Lng.Langue.CheckBox4;
  label19.Caption:=Lng.Langue.CheckBox5;
  label20.Caption:=Lng.Langue.CheckBox6;

  label21.Caption:=Lng.Langue.label21;
  label27.Caption:=Lng.Langue.label27;
  label28.Caption:=Lng.Langue.label28;
  label29.Caption:=Lng.Langue.label29;
  label30.Caption:=Lng.Langue.label30;
  label31.Caption:=Lng.Langue.label31;
  label32.Caption:=Lng.Langue.label31;

  label33.Caption:=Lng.Langue.label33;

  ComboBox1.Text:=Lng.Langue.ComboBox1;
//  ComboBox1.Items.Add(Lng.Langue.ComboBox1);
 ComboBox1.AutoComplete:=false;
{  RadioButton1.Enabled:=true;
  RadioButton2.Enabled:=true;
  }
  RadioButton1.Caption:=lng.Langue.Radio1;
  RadioButton2.Caption:=lng.Langue.Radio2;
  GroupBox1.Caption:=Lng.Langue.GroupBox1;
  GroupBox2.Caption:=Lng.Langue.GroupBox2;
  GroupBox3.Caption:=Lng.Langue.GroupBox3;
//  GroupBox4.Caption:=Lng.Langue.GroupBox4	;
end;

var SpecialScheme:boolean=false;
procedure TPagesDlg.ComboBox1Change(Sender: TObject);//Language Selection
var LNG:TMonLangage;
s:string;
begin
  LNG:=TMonLangage.Create;
  s:=ComboBox1.Items[ComboBox1.itemindex];
if length(s)>2 then begin
  WdxInfoPackerIni.SetLanguage(pchar(s));
  LNG.loadLanguage(WdxInfoPackerIni.MyIni.language);
  RefreshLangue(LNG);
end;
  LNG.Free;
end;

procedure TPagesDlg.ListBox1Click(Sender: TObject);//Scheme Selection
var s:string;
i:integer;
begin
i:=ListBox1.itemindex;
if i=-1 then i:=1;
  s:=ListBox1.Items[i];
  SchemeIni.LoadScheme(pchar(s));
  AfficheSchema(SchemeIni);
  if WdxInfoPackerIni.MyIni.RememberLast then begin
     WdxInfoPackerIni.SetLastScheme(pchar(s));
  end;
  checkComment(s);
end;

procedure TPagesDlg.AfficheSchema(Sch:TSchema);//Display Scheme info on the 2nd tab
var s:string;
l1:tstringlist;
begin
    ClearAllForScheme;
    if ListBox1.itemIndex >0 then begin
     Edit1.Text:=ListBox1.Items[ListBox1.itemIndex];
    end;
    Edit2.Text:=Sch.Scheme.Extension;
    Edit3.Text:=Sch.Scheme.Header;
    Edit4.Text:=Sch.Scheme.Before;
    Edit5.Text:=Sch.Scheme.name;
    Edit6.Text:=Sch.Scheme.Between;
    Edit7.Text:=Sch.Scheme.WdxInfo;
    Edit8.Text:=Sch.Scheme.After;
    Edit9.Text:=Sch.Scheme.Footer;
    Edit10.text:=Sch.Scheme.Divider;
    Edit14.text:=Sch.Scheme.ListExtension;
    Edit15.Text:=Sch.Scheme.AdditionnalText;
    Edit20.Text:=Sch.Scheme.DirectoryText;
    if (Sch.Scheme.CounterLength>0) then
        Edit17.Text:=inttostr(Sch.Scheme.CounterLength)
    Else Edit17.Text:='';
    if (Sch.Scheme.recursionDepth>0) then
        Edit21.Text:=inttostr(Sch.Scheme.recursionDepth)
    Else Edit21.Text:='';

    if (Sch.Scheme.IntervalNbr>0) then
        Edit16.Text:=inttostr(Sch.Scheme.IntervalNbr)
    Else Edit16.text:='1';
    s:=Sch.Scheme.Use;
  if pos('a',S)<>0 then CheckBox1.Checked:=true;
  if pos('b',s)<>0 then CheckBox2.Checked:=true;
  if pos('c',s)<>0 then CheckBox3.Checked:=true;
  if pos('d',s)<>0 then CheckBox4.Checked:=true;
  if pos('e',s)<>0 then CheckBox5.Checked:=true;
  if pos('f',s)<>0 then CheckBox6.Checked:=true;
  if pos('g',s)<>0 then CheckBox7.Checked:=true;
  if pos('h',s)<>0 then CheckBox8.Checked:=true;
  if pos('i',s)<>0 then CheckBox16.Checked:=true;
  if pos('j',s)<>0 then CheckBox17.Checked:=true;
  if pos('k',s)<>0 then CheckBox19.Checked:=true;
  if pos('l',s)<>0 then CheckBox20.Checked:=true;
  if Sch.Scheme.StrReplace then CheckBox18.Checked:=true;

  l1:=tstringlist.create;
  split('|',Sch.scheme.StrReplaceValue,l1);

  if  l1.count=2 then begin
      edit18.Text:=l1[0];
      edit19.Text:=l1[1];
  end;
  l1.free;
  if Sch.Scheme.Counter then CheckBox9.Checked:=true;
  if Sch.Scheme.DoNotWrite then CheckBox10.Checked:=true;
  if Sch.Scheme.SaveLog then CheckBox11.Checked:=true;
  if Sch.Scheme.ExtendedScheme then SpecialScheme:=true;
  if ((Sch.Scheme.CounterPos=1)or (Sch.Scheme.CounterPos=0)) then RadioButton1.Checked:=true;
  if (Sch.Scheme.CounterPos=2) then RadioButton2.Checked:=true;

  if Sch.Scheme.ExtendedScheme=true then begin
   Edit1.Color:=clRed;
   Edit1.Hint:='It''s an extended scheme, it will not be saved in the GUI';
   Edit1.ShowHint:=true;
   Button6.Enabled:=false;
  end;
  if Sch.Scheme.ExtendedScheme=false then begin
     Edit1.Color:=$FFFFFF;
     Edit1.Hint:=Lng.Langue.Edit1Hint;
     Edit1.ShowHint:=true;
     Button6.Enabled:=true;
    end;

end;

procedure TPagesDlg.ClearAllForScheme; //Reset the 2nd Tab display
begin
    Edit1.Text:='';
    Edit2.Text:='';
    Edit3.Text:='';
    Edit4.Text:='';
    Edit5.Text:='';
    Edit6.Text:='';
    Edit7.Text:='';
    Edit8.Text:='';
    Edit9.Text:='';
    Edit10.text:='';
    Edit14.text:='';
    Edit15.Text:='';
    Edit16.Text:='';
    Edit17.Text:='';
    Edit18.Text:='';
    Edit19.Text:='';
    Edit20.Text:='';
    Edit21.Text:='';
    CheckBox1.Checked:=False;
    CheckBox2.Checked:=False;
    CheckBox3.Checked:=False;
    CheckBox4.Checked:=False;
    CheckBox5.Checked:=False;
    CheckBox6.Checked:=False;
    CheckBox7.Checked:=False;
    CheckBox8.Checked:=False;
    CheckBox9.Checked:=False;
    CheckBox10.Checked:=False;
    CheckBox11.Checked:=False;
    CheckBox16.Checked:=false;
    CheckBox17.Checked:=false;
    CheckBox18.Checked:=false;
    CheckBox19.Checked:=false;
    CheckBox20.Checked:=false;

    RadioButton1.Checked:=false;
    RadioButton2.Checked:=false;

    if Button6.Enabled=false then begin
     Edit1.Color:=$FFFFFF;
     Edit1.Hint:=Lng.Langue.Edit1Hint;
     Edit1.ShowHint:=false;
     Button6.Enabled:=true;
    end;

end;
procedure TPagesDlg.Button2Click(Sender: TObject);//Main Form Cancel button
begin
Self.Close;
end;

procedure TPagesDlg.Button3Click(Sender: TObject); //About Button
var s:string;
begin
s:='Coded by Franck8244 (on TC Board)'+sLineBreak+sLineBreak+
    selfPath+sLineBreak+sLineBreak+
    'IniFiles:'+ sLineBreak+
    WdxInfoPackerIni.MyIni.PathToIni+
    sLineBreak+
    SchemeIni.Scheme.PathToSchemeFile+sLineBreak+sLineBreak+
    'This plugin has the IAL'+#174 +' ;) (-Icfu Approved Label-)';
    MessageBox(GetActiveWindow,pchar(s),'Wdx Info Packer v'+WDX_VERSION_INFO_,mb_iconinformation);
end;

procedure TPagesDlg.CheckBox13Click(Sender: TObject);//Rememberlast
begin
  WdxInfoPackerIni.MyIni.RememberLast:=CheckBox13.Checked;
end;

procedure TPagesDlg.CheckBox14Click(Sender: TObject);//Check scheme name before saving
begin
WdxInfoPackerIni.MyIni.CheckBeforeSave:=CheckBox14.Checked;
end;

procedure TPagesDlg.CheckBox15Click(Sender: TObject);//Allow selecting extension in TC dialog
begin
WdxInfoPackerIni.MyIni.Assoc:=(CheckBox15.Checked);
end;

procedure TPagesDlg.CheckBox12Click(Sender: TObject);//Verify Wdx at startup
begin
WdxInfoPackerIni.MyIni.VerifyWdx:=(CheckBox12.Checked);
end;

procedure TPagesDlg.Button5Click(Sender: TObject);//Remove a scheme from the list on the 1st Tab
var s:string;
i:integer;
begin
i:=ListBox1.itemindex;
if i=-1 then i:=0;
  s:=ListBox1.Items[i];
  SchemeIni.DeleteScheme(pchar(s));
  Self.Hide;
  InitForm;
  Self.Show;
end;

procedure TPagesDlg.Button4Click(Sender: TObject);//Edit a scheme (selected in the listbox
var i:integer;
begin
  i:=ListBox1.ItemIndex;
  if i>=0 then begin TabSheet2.show;
  end else MessageBox(GetActiveWindow,'Select a Scheme first','Warning',MB_ICONWARNING or MB_OK);
end;

procedure TPagesDlg.Button9Click(Sender: TObject);//Choose wdx fodler and search in it
begin
  With WdxInfoPackerIni do begin
       SetWdxFolder;
       CheckPluginFolder;
       Edit11.Text:=MyIni.WdxFolder;
       reCreatePopup:=true;
  end;
  Self.BringToFront;
end;

procedure TPagesDlg.Button10Click(Sender: TObject);//Check Now for wdx in folder...
var final:string;
begin
      	if length(Edit11.Text)>0 then begin
		final:=getExtendedPath(pchar(Edit11.Text));
        	StrLCopy(WdxInfoPackerIni.MyIni.WdxFolder,pchar(final),sizeof(WdxInfoPackerIni.MyIni.WdxFolder));
		WdxInfoPackerIni.CheckPluginFolder;
	end else begin
	     WdxInfoPackerIni.SetWdxFolder;
	     Edit11.Text:=WdxInfoPackerIni.MyIni.WdxFolder;
	     WdxInfoPackerIni.CheckPluginFolder;
	end;
        reCreatePopup:=true;
	WdxInfoPackerIni.SaveIniValue;
end;

procedure TPagesDlg.Button1Click(Sender: TObject);//OK button on the Main Form
var i:integer;
outbuf:array[0..20] of char;
tmp1,tmp2,tmp3:boolean;
begin
  i:=ListBox1.ItemIndex;
  if i>=0 then begin //If a scheme is selected in the listbox
    fillchar(outbuf,sizeof(outbuf),#0);
    if CheckBox1.Checked then strlcat(outbuf,'a',sizeof(outbuf)-1);
    if CheckBox2.Checked then strlcat(outbuf,'b',sizeof(outbuf)-1);
    if CheckBox3.Checked then strlcat(outbuf,'c',sizeof(outbuf)-1);
    if CheckBox4.Checked then strlcat(outbuf,'d',sizeof(outbuf)-1);
    if CheckBox5.Checked then strlcat(outbuf,'e',sizeof(outbuf)-1);
    if CheckBox6.Checked then strlcat(outbuf,'f',sizeof(outbuf)-1);
    if CheckBox7.Checked then strlcat(outbuf,'g',sizeof(outbuf)-1);
    if CheckBox8.Checked then strlcat(outbuf,'h',sizeof(outbuf)-1);
    if CheckBox16.Checked then strlcat(outbuf,'i',sizeof(outbuf)-1);
    if CheckBox17.Checked then strlcat(outbuf,'j',sizeof(outbuf)-1);
    if CheckBox19.Checked then strlcat(outbuf,'k',sizeof(outbuf)-1);
    if CheckBox20.Checked then strlcat(outbuf,'l',sizeof(outbuf)-1);
    tmp1:=CheckBox9.Checked;
    tmp2:=CheckBox10.Checked;
    tmp3:=CheckBox11.Checked;
    With SchemeIni do begin //save into a tmp scheme
        SetUse(outbuf);
        SetExtension(pchar(Edit2.text));
	SetDivider(pchar(Edit10.text));
        Setheader(pchar(Edit3.Text));
        Setbefore(pchar(Edit4.Text));
        Setname(pchar(Edit5.Text));
        Setbetween(pchar(Edit6.Text));
        Setwdxinfo(pchar(Edit7.Text));
        Setafter(pchar(Edit8.Text));
        Setfooter(pchar(Edit9.Text));
        SetDirectoryText(pchar(Edit20.Text));
        SetListExtension(pchar(Edit14.Text));
	SetAdditionalText(pchar(Edit15.Text));
	SetCounterPos(PosCounter);
        if(Edit17.Text='') then
                SetCounterLength(0)
        Else SetCounterLength(strtoint(Edit17.Text));

        if(Edit16.text='') then
                SetIntervalNbr(0)
        Else SetIntervalNbr(strtoint(Edit16.text));
        if(Edit21.Text='') then
                SetRecursionDepth(0)
        Else SetRecursionDepth(strtoint(Edit21.Text));
        SetCounter(tmp1);
        SetDoNotWrite(tmp2);
        SetSaveLog(tmp3);
        if SpecialScheme then SaveSpecialScheme(pchar(Edit1.text),pchar('RunTemp'))
        else SaveScheme(pchar('RunTemp'));
    end;
    WdxInfoPackerIni.MyIni.VerifyWdx:=CheckBox12.Checked;
    WdxInfoPackerIni.MyIni.RememberLast:=CheckBox13.Checked;
    WdxInfoPackerIni.MyIni.CheckBeforeSave:=CheckBox14.Checked;
    WdxInfoPackerIni.MyIni.Assoc:=CheckBox15.Checked;
    WdxInfoPackerIni.MyIni.Run:=true;
    WdxInfoPackerIni.MyIni.MaskEditBox:=CheckBox21.Checked;
    WdxInfoPackerIni.SaveIniValue;
    Self.Close;
  end else MessageBox(GetActiveWindow,'Select a Scheme to Use','Warning',MB_ICONWARNING or MB_OK);
end;



procedure TPagesDlg.Button7Click(Sender: TObject);//Remove value in the WdxINformation editbox
begin
Edit7.clear;
end;

procedure TPagesDlg.Button8Click(Sender : TObject);//Clear All the 2nd tab
begin
ClearAllForScheme;
end;

procedure TPagesDlg.InitPopup; //Init the popup menu containing wdx list (in a separate thread : Thread_IniPop.pas)
begin
//  My_Menu:=IniPop.Create(PopupMenu1,WdxInfoPackerIni.MyIni.PathToIni,Edit7,WdxInfoPackerIni.MyIni.Wdx_lng,ContPlug,  WdxInfoPackerIni.CountknownPlugin);
if reCreatePopup then begin
  My_Menu:=IniPop.Create(PopupMenu1,WdxInfoPackerIni,Edit7,Button11,ContPlug);
  reCreatePopup:=false;
end;
end;

procedure TPagesDlg.Button11Click(Sender: TObject);//Popup the menu
begin
PopupMenu1.Popup(Mouse.CursorPos.X,Mouse.CursorPos.y);
end;

procedure TPagesDlg.TabSheet2Show(Sender: TObject);
//var i:integer;
begin
InitPopup;
end;


procedure TPagesDlg.FormClose(Sender: TObject; var Action: TCloseAction);//Close the form & free it
begin
WdxInfoPackerIni.SaveIniValue;
 self.resetToWhite;
Action := caFree;
end;

procedure TPagesDlg.Button12Click(Sender: TObject);//Choose TC ini files
var s:string;
begin
  if OpenDialog1.Execute then begin
     s:=OpenDialog1.Filename;
     WdxInfoPackerIni.SetTCIni(pchar(s));
     Edit12.Text:=WdxInfoPackerIni.MyIni.TCIni;
     TC_COL.Init(WdxInfoPackerIni.MyIni.TCIni);
     ListBox2.Items:=TC_COL.Column_Info.List;
  end;
end;

procedure TPagesDlg.TabSheet3Show(Sender: TObject);
begin
  Edit12.Text:=WdxInfoPackerIni.MyIni.TCIni;
  TC_COL.Init(WdxInfoPackerIni.MyIni.TCIni);
  ListBox2.Items:=TC_COL.Column_Info.List;
end;

procedure TPagesDlg.ListBox2Click(Sender: TObject);//Select a column to import on Tab 3
var Val:TStringList;
begin
Val:=TStringList.Create;
Val.Clear;
Edit13.text:=ListBox2.Items[ListBox2.itemindex];
Val:=TC_COL.GetValue(ListBox2.itemindex);
  Label22.Caption:=Val[0];
  Label23.Caption:=Val[1];
  Label24.Caption:=Val[2];
  Label25.Caption:=Val[3];
  Label26.Caption:=Val[4];
Val.Free;
end;

procedure TPagesDlg.Button14Click(Sender: TObject);//Import selected column in a scheme
var over:boolean;
i:integer;
s:string;
begin
  ClearAllForScheme ;
  over:=true;
  if Edit13.Text<>'' then begin
  if WdxInfoPackerIni.MyIni.CheckBeforeSave then begin
     if SchemeIni.SchemeExist(pchar(Edit13.text)) then begin
        if idyes<>MessageBox(GetActiveWindow,'A Scheme with the same name already exist, overwrite?','Warning',MB_OKCANCEL or mb_iconquestion) then begin
           over:=false;
        end;
     end;
  end;
  if over then begin
  SchemeIni.ClearMe ;
  s:='%P%N;'+label22.Caption;
  SchemeIni.SetBefore(pchar(s));
  SchemeIni.Setname(pchar(label23.Caption));
  SchemeIni.SetBetween(pchar(label24.Caption));
  SchemeIni.SetWdxInfo(pchar(label25.Caption));
  SchemeIni.SetAfter(pchar(label26.Caption));
  SchemeIni.DeleteScheme(pchar(Edit13.text));
  SchemeIni.SaveScheme(pchar(Edit13.text));
  end;
  Self.Hide;
  InitForm;

  Self.Show;
  for i:=0 to ListBox1.Count-1 do begin
     if Edit13.Text=ListBox1.Items[i] then ListBox1.Selected[i]:=true ;
  end;
  s:='';
  s:=ListBox1.Items[ListBox1.itemIndex];
  SchemeIni.LoadScheme(pchar(s));
  AfficheSchema(SchemeIni);
  end else MessageBox(GetActiveWindow,'Select a column to import...','Warning',MB_ICONWARNING or MB_OK);
end;

procedure TPagesDlg.RadioButton2Click(Sender: TObject);
begin
PosCounter:=2;
end;

procedure TPagesDlg.RadioButton1Click(Sender: TObject);
begin
PosCounter:=1;
end;


procedure TPagesDlg.FormKeyPress(Sender: TObject; var Key: Char);
var test:integer;
begin
        if key = #27 then Close;
        if ((key = #13) and (ok4Click=true)) then  begin
          test:=PageControl1.ActivePageIndex;
          if test=0 then begin
                Button1.Click;
          end
          else if test=1 then begin
                button6.Click;
                Button1.Click;
          end;

        end
end;

procedure TPagesDlg.Label31Click(Sender: TObject);
begin
ShellExecute(self.WindowHandle,'open','http://fgartemann.free.fr/TC_Plugins/Wcx_WdxInfoPacker/Help/',nil,nil, SW_SHOWNORMAL);
end;

procedure TPagesDlg.Label10Click(Sender: TObject);
begin
ShellExecute(self.WindowHandle,'open',pchar('http://'+label10.Caption),nil,nil, SW_SHOWNORMAL);
end;

procedure TPagesDlg.Label8Click(Sender: TObject);
begin
ShellExecute(self.WindowHandle,'open',pchar('mailto:'+label8.Caption),nil,nil, SW_SHOWNORMAL);
end;

procedure TPagesDlg.TabSheet1Show(Sender: TObject);
var i,j:integer;
s:string;
begin
ListBox1.SetFocus;
j:=ListBox1.Items.Count;
if j>0 then begin
i:=ListBox1.itemindex;
if i=-1 then i:=0;
  s:=ListBox1.Items[i];
  SchemeIni.LoadScheme(pchar(s));
  AfficheSchema(SchemeIni);
end;
end;
procedure TPagesDlg.CheckBox21Click(Sender: TObject);
begin
 WdxInfoPackerIni.MyIni.MaskEditBox:=CheckBox21.Checked ;
end;

procedure TPagesDlg.resetToWhite;
begin
 Edit3.Color:=$FFFFFF;
 Edit4.Color:=$FFFFFF;
 Edit5.Color:=$FFFFFF;
 Edit6.Color:=$FFFFFF;
 Edit8.Color:=$FFFFFF;
 Edit20.Color:=$FFFFFF;
 Edit9.Color:=$FFFFFF;
 Edit17.Color:=$FFFFFF;
 Edit15.Color:=$FFFFFF;
 Edit16.Color:=$FFFFFF;
 Edit18.Color:=$FFFFFF;
 Edit19.Color:=$FFFFFF;
 Edit10.Color:=$FFFFFF;
 Edit14.Color:=$FFFFFF;
 Edit21.Color:=$FFFFFF;

 Edit3.Enabled:=true;
 Edit4.Enabled:=true;
 Edit5.Enabled:=true;
 Edit6.Enabled:=true;
 Edit8.Enabled:=true;
 Edit20.Enabled:=true;
 Edit9.Enabled:=true;
 Edit17.Enabled:=true;
 Edit15.Enabled:=true;
 Edit16.Enabled:=true;
 Edit18.Enabled:=true;
 Edit19.Enabled:=true;
 Edit10.Enabled:=true;
 Edit14.Enabled:=true;
 Edit21.Enabled:=true;
 RadioButton1.Enabled:=true;
 RadioButton2.Enabled:=true;
end;

procedure TPagesDlg.CheckBox1Click(Sender: TObject);
begin
 if ((not CheckBox1.Checked) and (WdxInfoPackerIni.MyIni.MaskEditBox=true)) then begin
  Edit3.Color:=Self.Color;
  if ((WdxInfoPackerIni.MyIni.DisableEditBoxCompletly=true)) then Edit3.enabled:=false;
 end else begin
   Edit3.Color:=$FFFFFF;
   if ((WdxInfoPackerIni.MyIni.DisableEditBoxCompletly=true)) then Edit3.enabled:=true;
 end;
end;
procedure TPagesDlg.CheckBox2Click(Sender: TObject);
begin
 if ((not CheckBox2.Checked) and (WdxInfoPackerIni.MyIni.MaskEditBox=true)) then begin
  Edit4.Color:=Self.Color;
  if ((WdxInfoPackerIni.MyIni.DisableEditBoxCompletly=true)) then Edit4.enabled:=false;
 end else begin
  Edit4.Color:=$FFFFFF;
  if ((WdxInfoPackerIni.MyIni.DisableEditBoxCompletly=true)) then Edit4.enabled:=true;
 end;
end;

procedure TPagesDlg.CheckBox3Click(Sender: TObject);
begin
if ((not CheckBox3.Checked) and (WdxInfoPackerIni.MyIni.MaskEditBox=true)) then begin
 Edit5.Color:=Self.Color;
 if ((WdxInfoPackerIni.MyIni.DisableEditBoxCompletly=true)) then Edit5.enabled:=false;
end else begin
 Edit5.Color:=$FFFFFF;
  if ((WdxInfoPackerIni.MyIni.DisableEditBoxCompletly=true)) then Edit5.enabled:=true;
end;
end;

procedure TPagesDlg.CheckBox4Click(Sender: TObject);
begin
if ((not CheckBox4.Checked) and (WdxInfoPackerIni.MyIni.MaskEditBox=true)) then begin
 Edit6.Color:=Self.Color;
  if ((WdxInfoPackerIni.MyIni.DisableEditBoxCompletly=true)) then Edit6.enabled:=false;
end else begin
 Edit6.Color:=$FFFFFF;
  if ((WdxInfoPackerIni.MyIni.DisableEditBoxCompletly=true)) then Edit6.enabled:=true;
end;
end;

procedure TPagesDlg.CheckBox6Click(Sender: TObject);
begin
if ((not CheckBox6.Checked) and (WdxInfoPackerIni.MyIni.MaskEditBox=true)) then begin
 Edit8.Color:=Self.Color;
 if ((WdxInfoPackerIni.MyIni.DisableEditBoxCompletly=true)) then Edit8.enabled:=false;
end else begin
 Edit8.Color:=$FFFFFF;
 if ((WdxInfoPackerIni.MyIni.DisableEditBoxCompletly=true)) then Edit8.enabled:=true;
end;
end;

procedure TPagesDlg.CheckBox19Click(Sender: TObject);
begin
if ((not CheckBox19.Checked) and (WdxInfoPackerIni.MyIni.MaskEditBox=true)) then begin
 Edit20.Color:=Self.Color;
  if ((WdxInfoPackerIni.MyIni.DisableEditBoxCompletly=true)) then Edit20.enabled:=false;
end else begin
 Edit20.Color:=$FFFFFF;
 if ((WdxInfoPackerIni.MyIni.DisableEditBoxCompletly=true)) then Edit20.enabled:=true;
end;
end;

procedure TPagesDlg.CheckBox7Click(Sender: TObject);
begin
if ((not CheckBox7.Checked) and (WdxInfoPackerIni.MyIni.MaskEditBox=true)) then begin
 Edit9.Color:=Self.Color;
  if ((WdxInfoPackerIni.MyIni.DisableEditBoxCompletly=true)) then Edit9.enabled:=false;
end else begin
 Edit9.Color:=$FFFFFF;
  if ((WdxInfoPackerIni.MyIni.DisableEditBoxCompletly=true)) then Edit9.enabled:=true;
end;
end;

procedure TPagesDlg.CheckBox9Click(Sender: TObject);
begin
if ((not CheckBox9.Checked) and (WdxInfoPackerIni.MyIni.MaskEditBox=true)) then begin
 Edit17.Color:=Self.Color;
  if ((WdxInfoPackerIni.MyIni.DisableEditBoxCompletly=true)) then begin
   Edit17.enabled:=false;
   RadioButton1.Enabled:=false;
   RadioButton2.Enabled:=false;
  end;
end else begin
 Edit17.Color:=$FFFFFF;
  if ((WdxInfoPackerIni.MyIni.DisableEditBoxCompletly=true)) then begin
   Edit17.enabled:=true;
   RadioButton1.Enabled:=true;
   RadioButton2.Enabled:=true;
  end;
end;
end;

procedure TPagesDlg.CheckBox17Click(Sender: TObject);
begin
if ((not CheckBox17.Checked) and (WdxInfoPackerIni.MyIni.MaskEditBox=true)) then begin
 Edit15.Color:=Self.Color;
 Edit16.Color:=Self.Color;
  if ((WdxInfoPackerIni.MyIni.DisableEditBoxCompletly=true)) then Edit15.enabled:=false;
   if ((WdxInfoPackerIni.MyIni.DisableEditBoxCompletly=true)) then Edit6.enabled:=false;
end else begin
 Edit15.Color:=$FFFFFF;
 Edit16.Color:=$FFFFFF;
  if ((WdxInfoPackerIni.MyIni.DisableEditBoxCompletly=true)) then Edit15.enabled:=true;
   if ((WdxInfoPackerIni.MyIni.DisableEditBoxCompletly=true)) then Edit16.enabled:=true;
end;
end;

procedure TPagesDlg.CheckBox18Click(Sender: TObject);
begin
if ((not CheckBox18.Checked) and (WdxInfoPackerIni.MyIni.MaskEditBox=true)) then begin
 Edit18.Color:=Self.Color;
 Edit19.Color:=Self.Color;
  if ((WdxInfoPackerIni.MyIni.DisableEditBoxCompletly=true)) then Edit18.enabled:=false;
   if ((WdxInfoPackerIni.MyIni.DisableEditBoxCompletly=true)) then Edit9.enabled:=false;
end else begin
 Edit18.Color:=$FFFFFF;
 Edit19.Color:=$FFFFFF;
  if ((WdxInfoPackerIni.MyIni.DisableEditBoxCompletly=true)) then Edit18.enabled:=true;
   if ((WdxInfoPackerIni.MyIni.DisableEditBoxCompletly=true)) then Edit19.enabled:=true;
end;
end;

procedure TPagesDlg.CheckBox8Click(Sender: TObject);
begin
if ((not CheckBox8.Checked) and (WdxInfoPackerIni.MyIni.MaskEditBox=true)) then begin
 Edit10.Color:=Self.Color;
  if ((WdxInfoPackerIni.MyIni.DisableEditBoxCompletly=true)) then Edit10.enabled:=false;
end else begin
 Edit10.Color:=$FFFFFF;
 if ((WdxInfoPackerIni.MyIni.DisableEditBoxCompletly=true)) then Edit10.enabled:=true;
end;
end;

procedure TPagesDlg.CheckBox16Click(Sender: TObject);
begin
if ((not CheckBox16.Checked) and (WdxInfoPackerIni.MyIni.MaskEditBox=true)) then begin
 Edit14.Color:=Self.Color;
  if ((WdxInfoPackerIni.MyIni.DisableEditBoxCompletly=true)) then Edit14.enabled:=false;
end
else begin
 Edit14.Color:=$FFFFFF;
  if ((WdxInfoPackerIni.MyIni.DisableEditBoxCompletly=true)) then Edit14.enabled:=true;
end;
end;

procedure TPagesDlg.CheckBox20Click(Sender: TObject);
begin
if ((not CheckBox20.Checked) and (WdxInfoPackerIni.MyIni.MaskEditBox=true)) then begin
 Edit21.Color:=Self.Color;
  if ((WdxInfoPackerIni.MyIni.DisableEditBoxCompletly=true)) then Edit21.enabled:=false;
end
else begin
 Edit21.Color:=$FFFFFF;
  if ((WdxInfoPackerIni.MyIni.DisableEditBoxCompletly=true)) then Edit21.enabled:=true;
end;
end;

procedure TPagesDlg.VerifyeditBox;
begin
if ((not CheckBox1.Checked)) then begin
 Edit3.Color:=Self.Color;
 if ((WdxInfoPackerIni.MyIni.DisableEditBoxCompletly=true)) then Edit3.enabled:=false;
end else begin
 Edit3.Color:=$FFFFFF;
 if ((WdxInfoPackerIni.MyIni.DisableEditBoxCompletly=true)) then Edit3.enabled:=true;
end;
if ((not CheckBox2.Checked)) then begin
 Edit4.Color:=Self.Color;
 if ((WdxInfoPackerIni.MyIni.DisableEditBoxCompletly=true)) then Edit4.enabled:=false;
end else begin
 Edit4.Color:=$FFFFFF;
 if ((WdxInfoPackerIni.MyIni.DisableEditBoxCompletly=true)) then Edit4.enabled:=true;
end;

if not CheckBox3.Checked then begin
 Edit5.Color:=Self.Color;
  if ((WdxInfoPackerIni.MyIni.DisableEditBoxCompletly=true)) then Edit5.enabled:=false;
end else begin
 Edit5.Color:=$FFFFFF;
  if ((WdxInfoPackerIni.MyIni.DisableEditBoxCompletly=true)) then Edit5.enabled:=true;
end;
if not CheckBox4.Checked then begin
 Edit6.Color:=Self.Color;
  if ((WdxInfoPackerIni.MyIni.DisableEditBoxCompletly=true)) then Edit6.enabled:=false;
end else begin
 Edit6.Color:=$FFFFFF;
  if ((WdxInfoPackerIni.MyIni.DisableEditBoxCompletly=true)) then Edit6.enabled:=true;
end;
if not CheckBox6.Checked then begin
 Edit8.Color:=Self.Color;
  if ((WdxInfoPackerIni.MyIni.DisableEditBoxCompletly=true)) then Edit8.enabled:=false;
end else begin
 Edit8.Color:=$FFFFFF;
  if ((WdxInfoPackerIni.MyIni.DisableEditBoxCompletly=true)) then Edit8.enabled:=true;
end;
if not CheckBox19.Checked then begin
 Edit20.Color:=Self.Color;
  if ((WdxInfoPackerIni.MyIni.DisableEditBoxCompletly=true)) then Edit20.enabled:=false;
end else begin
 Edit20.Color:=$FFFFFF;
  if ((WdxInfoPackerIni.MyIni.DisableEditBoxCompletly=true)) then Edit20.enabled:=true;
end;
if not CheckBox7.Checked then begin
 Edit9.Color:=Self.Color;
  if ((WdxInfoPackerIni.MyIni.DisableEditBoxCompletly=true)) then Edit9.enabled:=false;
end else begin
 Edit9.Color:=$FFFFFF;
  if ((WdxInfoPackerIni.MyIni.DisableEditBoxCompletly=true)) then Edit9.enabled:=true;
end;
if not CheckBox9.Checked then begin
 Edit17.Color:=Self.Color;
 if ((WdxInfoPackerIni.MyIni.DisableEditBoxCompletly=true)) then begin
  Edit17.enabled:=false;
  RadioButton1.Enabled:=false;
  RadioButton2.Enabled:=false;
 end;
end else begin
 Edit17.Color:=$FFFFFF;
 if ((WdxInfoPackerIni.MyIni.DisableEditBoxCompletly=true)) then begin
  Edit17.enabled:=true;
  RadioButton1.Enabled:=true;
  RadioButton2.Enabled:=true;
 end;
end;
if not CheckBox17.Checked then begin
 Edit15.Color:=Self.Color;
 Edit16.Color:=Self.Color;
  if ((WdxInfoPackerIni.MyIni.DisableEditBoxCompletly=true)) then Edit15.enabled:=false;
   if ((WdxInfoPackerIni.MyIni.DisableEditBoxCompletly=true)) then Edit16.enabled:=false;
end else begin
 Edit15.Color:=$FFFFFF;
 Edit16.Color:=$FFFFFF;
  if ((WdxInfoPackerIni.MyIni.DisableEditBoxCompletly=true)) then Edit15.enabled:=true;
   if ((WdxInfoPackerIni.MyIni.DisableEditBoxCompletly=true)) then Edit16.enabled:=true;

end;
if not CheckBox18.Checked then begin
 Edit18.Color:=Self.Color;
 Edit19.Color:=Self.Color;
 if ((WdxInfoPackerIni.MyIni.DisableEditBoxCompletly=true)) then Edit18.enabled:=false;
 if ((WdxInfoPackerIni.MyIni.DisableEditBoxCompletly=true)) then Edit19.enabled:=false;
end else begin
 Edit18.Color:=$FFFFFF;
 Edit19.Color:=$FFFFFF;
 if ((WdxInfoPackerIni.MyIni.DisableEditBoxCompletly=true)) then Edit18.enabled:=true;
 if ((WdxInfoPackerIni.MyIni.DisableEditBoxCompletly=true)) then Edit19.enabled:=true;
end;
if not CheckBox8.Checked then begin
 Edit10.Color:=Self.Color;
 if ((WdxInfoPackerIni.MyIni.DisableEditBoxCompletly=true)) then Edit10.enabled:=false;
end else begin
 Edit10.Color:=$FFFFFF;
 if ((WdxInfoPackerIni.MyIni.DisableEditBoxCompletly=true)) then Edit10.enabled:=true;
end;
if not CheckBox16.Checked then begin
 Edit14.Color:=Self.Color;
 if ((WdxInfoPackerIni.MyIni.DisableEditBoxCompletly=true)) then Edit14.enabled:=false;
end else begin
 Edit14.Color:=$FFFFFF;
 if ((WdxInfoPackerIni.MyIni.DisableEditBoxCompletly=true)) then Edit14.enabled:=true;
end;
if not CheckBox20.Checked then begin
 Edit21.Color:=Self.Color;
  if ((WdxInfoPackerIni.MyIni.DisableEditBoxCompletly=true)) then Edit21.enabled:=false;
end else begin
 Edit21.Color:=$FFFFFF;
  if ((WdxInfoPackerIni.MyIni.DisableEditBoxCompletly=true)) then Edit21.enabled:=true;
end;
end;

procedure TPagesDlg.TabSheet1Exit(Sender: TObject);
begin
resetToWhite;
if ((WdxInfoPackerIni.MyIni.MaskEditBox=true) or
 (WdxInfoPackerIni.MyIni.DisableEditBoxCompletly=true)) then VerifyEditBox;
end;

procedure TPagesDlg.Edit1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
var editComment:myEditComment;
p:pchar;
begin
 case Button of
  mbRight:begin
   if Edit1.Text <>'' then begin
    editComment:=myEditComment.Create;
    p:=editComment.CreerMyEditComment(pchar(Lng.Langue.formTitle+Edit1.Text),pchar(Button1.caption),pchar(Button2.caption),SchemeIni.Scheme.DisplayComment);
    strlcopy(SchemeIni.Scheme.DisplayComment,p,sizeof(SchemeIni.Scheme.DisplayComment)-1);
   end;
  end;
 end;
end;


procedure TPagesDlg.checkComment(s:string);
begin
  if CommentList.Values[s]<>'' then begin
   label34.Color:=$FFFFFF;
   Label34.Caption := StringReplace(CommentList.Values[s],'\n', #10,[rfReplaceAll, rfIgnoreCase]);
   Label34.Hint:=Lng.Langue.LabelCommentHint;
  end else begin
   label34.caption:='';
   label34.Color:=Self.Color;
   Label34.Hint:='';
  end;
end;

end.

Detected encoding: ASCII (7 bit)2