<?xml version="1.0" encoding="utf-8"?>
<CrossEngineApp Version="1">
  <Options>object ProjOption: TProjectOptions
  Title = 'SmiGenGui'
  AppName = 'SmiGenGui'
  Language = 'PASCAL'
  AppIcon.Data = {
[encoded data, 24771 characters]
    000000000000000000000000000000000000
  }
  AppAutor = 'Copyright(c) 2021-2023 Alexey Kuryakin kouriakine@mail.ru'
  MinVMajor = 2
  MinVMinor = 1
  MinVRevision = 2
  ExternalPath = '$DIESELPASCAL_EXTERNAL;$DIESEL_LOCALSET_DIR/external;$DIESEL_EXE_DIR/external;'
  AutoCreateExternal.Strings = (
    'dpGuiResMain'
    'dpGuiResTools'
    'dpAntiZombie'
  )
end
</Options>
  <Metadata>
    <SmiGenGui ImageIndex="2">
      <Object ClassName=""/>
      <Code>program SmiGenGui;

uses dpCmdArgs,dpSystem,dpSysUtils,dpWindows,dpVbs,dpCrwDaqSys,dpDaqConfig,
     dpGuiResMain,dpGuiResTools,dpTask,Main;

begin
  InitGuiResMain;  // Init GUI Resources - Main
  InitGuiResTools; // Init GUI Resources - Tools
  SetCrwDaqChildTitle('SMI Generic GUI');
  if InstanceRunning(GetCrwDaqChildTitle,true) then begin
   AppActivateByTitle(GetCrwDaqChildTitle);
   Application.Terminate;
   Exit;
  end;
  MainForm := TMainForm.Create(Application);
end.
</Code>
      <Child>
        <dpFormSmiActionParameters ImageIndex="1">
          <Object ClassName="TFormSmiActionParameters">object FormSmiActionParameters: TForm
  Left = 260
  Height = 180
  Top = 134
  Width = 320
  Caption = 'FormSmiActionParameters'
  ClientHeight = 180
  ClientWidth = 320
  Constraints.MinHeight = 180
  Constraints.MinWidth = 320
  DoubleBuffered = True
  OnCreate = FormCreate
  OnDestroy = FormDestroy
  ParentDoubleBuffered = False
  LCLVersion = '2.0.10.0'
  object PanelContent: TPanel
    Left = 0
    Height = 180
    Top = 0
    Width = 320
    Align = alClient
    BorderWidth = 4
    ClientHeight = 180
    ClientWidth = 320
    TabOrder = 0
    object PanelButtons: TPanel
      Left = 5
      Height = 50
      Top = 125
      Width = 310
      Align = alBottom
      BorderWidth = 4
      ClientHeight = 50
      ClientWidth = 310
      TabOrder = 1
      object BitBtnOk: TBitBtn
        Left = 4
        Height = 42
        Top = 4
        Width = 131
        Default = True
        DefaultCaption = True
        Kind = bkOK
        ModalResult = 1
        TabOrder = 0
      end
      object BitBtnCancel: TBitBtn
        Left = 176
        Height = 42
        Top = 4
        Width = 131
        Anchors = [akTop, akRight]
        Cancel = True
        DefaultCaption = True
        Kind = bkCancel
        ModalResult = 2
        TabOrder = 1
      end
    end
    object PanelParameters: TPanel
      Left = 5
      Height = 120
      Top = 5
      Width = 310
      Align = alClient
      BorderWidth = 4
      ClientHeight = 120
      ClientWidth = 310
      TabOrder = 0
      object LabelParameters: TLabel
        Left = 5
        Height = 15
        Top = 5
        Width = 300
        Align = alTop
        Caption = 'Edit Action Parameters:'
        ParentColor = False
      end
      object StringGridParameters: TStringGrid
        Left = 5
        Height = 95
        Top = 20
        Width = 300
        Align = alClient
        AutoFillColumns = True
        ColCount = 3
        DefaultColWidth = 96
        FixedCols = 2
        Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goColSizing, goEditing, goSmoothScroll, goFixedColSizing]
        RowCount = 2
        TabOrder = 0
        ColWidths = (
          96
          96
          104
        )
      end
    end
  end
end
</Object>
          <Code>unit dpFormSmiActionParameters;

interface

uses dpCmdArgs,dpSystem,dpSysUtils,dpVbs,dpWindows,dpGuiUtils,dpCrwDaqSys,
     dpDaqConfig,dpAntiZombie,dpGuiResMain,dpGuiResTools,dpTask,dpSmiGenGui;

type
  TFormSmiActionParameters = class(TForm)
    PanelContent: TPanel;
    PanelParameters: TPanel;
    LabelParameters: TLabel;
    StringGridParameters: TStringGrid;
    PanelButtons: TPanel;
    BitBtnOk: TBitBtn;
    BitBtnCancel: TBitBtn;
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
  private
  protected
  public
   procedure LocateToControl(Sender: TObject);
   function  EditActionParameters(Sender:TObject; Obj,State,Action,Params:String):String;
  end;

var FormSmiActionParameters: TFormSmiActionParameters = nil;

function  InitFormSmiActionParameters:TFormSmiActionParameters;
procedure FreeFormSmiActionParameters;
procedure HideFormSmiActionParameters;

function EditSmiActionParameters(Sender:TObject; Obj,State,Action,Params:String):String;

implementation

function InitFormSmiActionParameters:TFormSmiActionParameters;
begin
 if (FormSmiActionParameters=nil)
 then FormSmiActionParameters:=TFormSmiActionParameters.Create(Application);
 Result:=FormSmiActionParameters;
end;

procedure FreeFormSmiActionParameters;
begin
 if (FormSmiActionParameters&lt;&gt;nil) then begin
  FormSmiActionParameters.Free;
  FormSmiActionParameters:=nil;
 end;
end;

procedure HideFormSmiActionParameters;
begin
 if (FormSmiActionParameters&lt;&gt;nil)
 then FormSmiActionParameters.Hide;
end;

function EditSmiActionParameters(Sender:TObject; Obj,State,Action,Params:String):String;
begin
 Result:='';
 Action:=Trim(Action); if (Action='') then Exit;
 try
  Result:=InitFormSmiActionParameters.EditActionParameters(Sender,Obj,State,Action,Params);
 except
  on E:Exception do BugReport(E,nil,'EditSmiActionParameters');
 end;
end;

procedure TFormSmiActionParameters.FormCreate(Sender: TObject);
begin
 try
  SetDefaultFontName(Font);
  StringGridParameters.Font.Size:=14;
  Caption:='SMI Object Action`s Parameters';
  StringGridParameters.Font.Style:=StringGridParameters.Font.Style+[fsBold];
  SetDefaultSansFontName(LabelParameters.Font);
  LabelParameters.Font.Size:=10;
  if (FormSmiActionParameters=nil) then FormSmiActionParameters:=Self;
 except
  on E:Exception do BugReport(E,Self,'FormCreate');
 end;
end;

procedure TFormSmiActionParameters.FormDestroy(Sender: TObject);
begin
 if (FormSmiActionParameters=Self) then FormSmiActionParameters:=nil;
end;

procedure TFormSmiActionParameters.LocateToControl(Sender: TObject);
var Control:TControl; P:TPoint;
begin
 if not (Sender is TControl) then Exit;
 Control:=TControl(Sender);
 P.X:=0; P.Y:=Control.Height;
 P:=Control.ClientToScreen(P);
 Left:=P.X; Top:=P.Y;
end;

function TFormSmiActionParameters.EditActionParameters(Sender:TObject; Obj,State,Action,Params:String):String;
var i,n,m,errors:Integer; f:Double; pars,p,sname,stype,sdata,msg:String;
begin
 Result:=''; pars:=''; errors:=0;
 n:=WordCount(Params,'/'); if (n=0) then Exit;
 Action:=Trim(Action); if (Action='') then Exit;
 Params:=Trim(Params); if (Params='') then Exit;
 try
  Obj:=Trim(Obj); State:=Trim(State);
  LabelParameters.Caption:='Edit Parameters';
  if (Obj&lt;&gt;'') then LabelParameters.Caption:=LabelParameters.Caption+' of '+Obj;
  if (State&lt;&gt;'') then LabelParameters.Caption:=LabelParameters.Caption+' State '+State;
  if (Action&lt;&gt;'') then LabelParameters.Caption:=LabelParameters.Caption+' Action '+Action;
  StringGridParameters.RowCount:=1+n;
  StringGridParameters.ColCount:=3;
  StringGridParameters.FixedCols:=2;
  StringGridParameters.FixedRows:=1;
  StringGridParameters.Cells[0,0]:='Name';
  StringGridParameters.Cells[1,0]:='Type';
  StringGridParameters.Cells[2,0]:='Value';
  if (Sender&lt;&gt;nil) then LocateToControl(Sender);
  for i:=1 to n do begin
   p:=ExtractWord(i,Params,'/');
   sname:=UpperCase(ExtractWord(1,p,'( )'));
   stype:=UpperCase(ExtractWord(2,p,'( )'));
   sdata:=SkipWords(1,p,'=');
   StringGridParameters.Cells[0,i]:=sname;
   StringGridParameters.Cells[1,i]:=stype;
   StringGridParameters.Cells[2,i]:=sdata;
  end;
  if (ShowModal&lt;&gt;mrOk) then Exit;
  for i:=1 to n do begin
   sname:=StringGridParameters.Cells[0,i];
   stype:=StringGridParameters.Cells[1,i];
   sdata:=StringGridParameters.Cells[2,i];
   if SameText(stype,'I') then begin
    if not TryStrToInt(sdata,m) then errors:=errors+1;
   end;
   if SameText(stype,'F') then begin
    if not TryStrToFloat(sdata,f) then errors:=errors+1;
   end;
   if SameText(stype,'S') then begin
    if (sdata='') then errors:=errors+1;
    sdata:=StrToHex(sdata);
   end;
   p:=sname+' '+stype+' '+sdata;
   if (pars='') then pars:=p else pars:=pars+'/'+p;
  end;
  if (errors&lt;&gt;0) then begin
   msg:='Invalid Action`s Parameters Editing of '+Obj+'/'+State+'/'+Action;
   LogEvents(Now,msg);
   ShowMessage(msg);
   Exit;
  end;
  Result:=pars;
 except
  on E:Exception do BugReport(E,Self,'EditActionParameters');
 end;
end;

end.
</Code>
        </dpFormSmiActionParameters>
        <dpFormSmiActionSelector ImageIndex="1">
          <Object ClassName="TFormSmiActionSelector">object FormSmiActionSelector: TForm
  Left = 260
  Height = 150
  Top = 134
  Width = 280
  Caption = 'FormSmiActionSelector'
  ClientHeight = 150
  ClientWidth = 280
  Constraints.MinHeight = 150
  Constraints.MinWidth = 280
  DoubleBuffered = True
  OnCreate = FormCreate
  OnDestroy = FormDestroy
  ParentDoubleBuffered = False
  LCLVersion = '2.0.10.0'
  object PanelContent: TPanel
    Left = 0
    Height = 150
    Top = 0
    Width = 280
    Align = alClient
    BorderWidth = 4
    ClientHeight = 150
    ClientWidth = 280
    TabOrder = 0
    object PanelButtons: TPanel
      Left = 5
      Height = 50
      Top = 95
      Width = 270
      Align = alBottom
      BorderWidth = 4
      ClientHeight = 50
      ClientWidth = 270
      TabOrder = 0
      object BitBtnOk: TBitBtn
        Left = 4
        Height = 42
        Top = 4
        Width = 131
        Default = True
        DefaultCaption = True
        Kind = bkOK
        ModalResult = 1
        TabOrder = 0
      end
      object BitBtnCancel: TBitBtn
        Left = 136
        Height = 42
        Top = 4
        Width = 131
        Anchors = [akTop, akRight]
        Cancel = True
        DefaultCaption = True
        Kind = bkCancel
        ModalResult = 2
        TabOrder = 1
      end
    end
    object PanelSelector: TPanel
      Left = 5
      Height = 90
      Top = 5
      Width = 270
      Align = alClient
      BorderWidth = 4
      ClientHeight = 90
      ClientWidth = 270
      TabOrder = 1
      object LabelSelector: TLabel
        Left = 5
        Height = 15
        Top = 5
        Width = 260
        Align = alTop
        Caption = 'LabelSelector'
        ParentColor = False
      end
      object ListBoxSelector: TListBox
        Left = 5
        Height = 65
        Top = 20
        Width = 260
        Align = alClient
        ItemHeight = 0
        OnDblClick = ListBoxSelectorDblClick
        TabOrder = 0
      end
    end
  end
end
</Object>
          <Code>unit dpFormSmiActionSelector;

interface

uses dpCmdArgs,dpSystem,dpSysUtils,dpVbs,dpWindows,dpGuiUtils,dpCrwDaqSys,
     dpDaqConfig,dpAntiZombie,dpGuiResMain,dpGuiResTools,dpTask,dpSmiGenGui;

type
  TFormSmiActionSelector = class(TForm)
    PanelContent: TPanel;
    PanelSelector: TPanel;
    LabelSelector: TLabel;
    ListBoxSelector: TListBox;
    PanelButtons: TPanel;
    BitBtnOk: TBitBtn;
    BitBtnCancel: TBitBtn;
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
    procedure ListBoxSelectorDblClick(Sender: TObject);
  private
  protected
  public
   procedure LocateToControl(Sender: TObject);
   function  ActionSelector(Sender:TObject; Obj,State,Actions:String):String;
  end;

var FormSmiActionSelector: TFormSmiActionSelector = nil;

function  InitFormSmiActionSelector:TFormSmiActionSelector;
procedure FreeFormSmiActionSelector;
procedure HideFormSmiActionSelector;

function SmiActionSelector(Sender:TObject; Obj,State,Actions:String):String;

implementation

function InitFormSmiActionSelector:TFormSmiActionSelector;
begin
 if (FormSmiActionSelector=nil)
 then FormSmiActionSelector:=TFormSmiActionSelector.Create(Application);
 Result:=FormSmiActionSelector;
end;

procedure FreeFormSmiActionSelector;
begin
 if (FormSmiActionSelector&lt;&gt;nil) then begin
  FormSmiActionSelector.Free;
  FormSmiActionSelector:=nil;
 end;
end;

procedure HideFormSmiActionSelector;
begin
 if (FormSmiActionSelector&lt;&gt;nil)
 then FormSmiActionSelector.Hide;
end;

function SmiActionSelector(Sender:TObject; Obj,State,Actions:String):String;
begin
 Result:='';
 Actions:=Trim(Actions); if (Actions='') then Exit;
 try
  Result:=InitFormSmiActionSelector.ActionSelector(Sender,Obj,State,Actions);
 except
  on E:Exception do BugReport(E,nil,'SmiActionSelector');
 end;
end;

procedure TFormSmiActionSelector.FormCreate(Sender: TObject);
begin
 try
  SetDefaultFontName(Font);
  ListBoxSelector.Font.Size:=14;
  Caption:='SMI Object Action`s Selector';
  ListBoxSelector.Font.Style:=ListBoxSelector.Font.Style+[fsBold];
  SetDefaultSansFontName(LabelSelector.Font);
  LabelSelector.Font.Size:=10;
  if (FormSmiActionSelector=nil) then FormSmiActionSelector:=Self;
 except
  on E:Exception do BugReport(E,Self,'FormCreate');
 end;
end;

procedure TFormSmiActionSelector.FormDestroy(Sender: TObject);
begin
 if (FormSmiActionSelector=Self) then FormSmiActionSelector:=nil;
end;

procedure TFormSmiActionSelector.ListBoxSelectorDblClick(Sender: TObject);
begin
 ModalResult:=mrOk;
end;

procedure TFormSmiActionSelector.LocateToControl(Sender: TObject);
var Control:TControl; P:TPoint;
begin
 if not (Sender is TControl) then Exit;
 Control:=TControl(Sender);
 P.X:=0; P.Y:=Control.Height;
 P:=Control.ClientToScreen(P);
 Left:=P.X; Top:=P.Y;
end;

function TFormSmiActionSelector.ActionSelector(Sender:TObject; Obj,State,Actions:String):String;
begin
 Result:='';
 Actions:=Trim(Actions); if (Actions='') then Exit;
 try
  Obj:=Trim(Obj); State:=Trim(State);
  LabelSelector.Caption:='Run Action`s';
  if (Obj&lt;&gt;'') then LabelSelector.Caption:=LabelSelector.Caption+' of '+Obj;
  if (State&lt;&gt;'') then LabelSelector.Caption:=LabelSelector.Caption+' State '+State;
  ListBoxSelector.Items.Text:=Actions;
  ListBoxSelector.ItemIndex:=-1;
  if (Sender&lt;&gt;nil) then LocateToControl(Sender);
  if (ShowModal&lt;&gt;mrOk) then Exit;
  if (ListBoxSelector.ItemIndex&lt;0) then Exit;
  Result:=ListBoxSelector.Items.Strings[ListBoxSelector.ItemIndex];
 except
  on E:Exception do BugReport(E,Self,'ActionSelector');
 end;
end;

end.
</Code>
        </dpFormSmiActionSelector>
        <dpFormSmiObjectParameters ImageIndex="1">
          <Object ClassName="TFormSmiObjectParameters">object FormSmiObjectParameters: TForm
  Left = 260
  Height = 180
  Top = 134
  Width = 320
  Caption = 'FormSmiObjectParameters'
  ClientHeight = 180
  ClientWidth = 320
  Constraints.MinHeight = 180
  Constraints.MinWidth = 320
  DoubleBuffered = True
  OnCreate = FormCreate
  OnDestroy = FormDestroy
  ParentDoubleBuffered = False
  LCLVersion = '2.0.10.0'
  object PanelContent: TPanel
    Left = 0
    Height = 180
    Top = 0
    Width = 320
    Align = alClient
    BorderWidth = 4
    ClientHeight = 180
    ClientWidth = 320
    TabOrder = 0
    object PanelButtons: TPanel
      Left = 5
      Height = 50
      Top = 125
      Width = 310
      Align = alBottom
      BorderWidth = 4
      ClientHeight = 50
      ClientWidth = 310
      TabOrder = 1
      object BitBtnClose: TBitBtn
        Left = 176
        Height = 42
        Top = 4
        Width = 131
        Anchors = [akTop, akRight]
        DefaultCaption = True
        Kind = bkClose
        ModalResult = 11
        TabOrder = 0
      end
    end
    object PanelParameters: TPanel
      Left = 5
      Height = 120
      Top = 5
      Width = 310
      Align = alClient
      BorderWidth = 4
      ClientHeight = 120
      ClientWidth = 310
      TabOrder = 0
      object LabelParameters: TLabel
        Left = 5
        Height = 15
        Top = 5
        Width = 300
        Align = alTop
        Caption = 'View Object State Parameters:'
        ParentColor = False
      end
      object StringGridParameters: TStringGrid
        Left = 5
        Height = 95
        Top = 20
        Width = 300
        Align = alClient
        AutoFillColumns = True
        Color = clInfoBk
        ColCount = 3
        DefaultColWidth = 96
        FixedCols = 2
        Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goColSizing, goSmoothScroll, goFixedColSizing]
        RowCount = 2
        TabOrder = 0
        ColWidths = (
          96
          96
          104
        )
      end
    end
  end
end
</Object>
          <Code>unit dpFormSmiObjectParameters;

interface

uses dpCmdArgs,dpSystem,dpSysUtils,dpVbs,dpWindows,dpGuiUtils,dpCrwDaqSys,
     dpDaqConfig,dpAntiZombie,dpGuiResMain,dpGuiResTools,dpTask,dpSmiGenGui;

type
  TFormSmiObjectParameters = class(TForm)
    PanelContent: TPanel;
    PanelButtons: TPanel;
    PanelParameters: TPanel;
    BitBtnClose: TBitBtn;
    LabelParameters: TLabel;
    StringGridParameters: TStringGrid;
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
  private
    myObjectName : String;
    myStateName  : String;
    procedure SetObjectName(aObjectName:String);
    procedure SetStateName(aStateName:String);
  protected
  public
    property ObjectName : String read myObjectName write SetObjectName;
    property StateName  : String read myStateName  write SetStateName;
  public
    procedure RegisterMe(aObjectName:String);
    procedure UnRegisterMe;
  public
    procedure LocateToControl(Sender: TObject);
    function  UpdateObjectParameters(Sender:TObject; State,Params:String):TFormSmiObjectParameters;
   end;

var ListOfFormSmiObjectParameters: TStringList = nil;

function  FindFormSmiObjectParameters(ObjectName:String):TFormSmiObjectParameters;
function  InitFormSmiObjectParameters(ObjectName:String):TFormSmiObjectParameters;
procedure FreeFormSmiObjectParameters(ObjectName:String);
procedure HideFormSmiObjectParameters(ObjectName:String);

function  UpdateObjectObjectParameters(Sender: TObject; ObjectName,StateName,Params:String):TFormSmiObjectParameters;

implementation

function FindFormSmiObjectParameters(ObjectName:String):TFormSmiObjectParameters;
var i:Integer; Obj:TObject;
begin
 Result:=nil;
 try
  if (ListOfFormSmiObjectParameters=nil) then begin
   ListOfFormSmiObjectParameters:=TStringList.Create;
   ListOfFormSmiObjectParameters.Sorted:=true;
  end;
  ObjectName:=Trim(ObjectName); if (ObjectName='') then Exit;
  i:=ListOfFormSmiObjectParameters.IndexOf(ObjectName);
  if (i&gt;=0) then begin
   Obj:=ListOfFormSmiObjectParameters.Objects[i];
   if (Obj&lt;&gt;nil) and (Obj is TFormSmiObjectParameters)
   then Result:=TFormSmiObjectParameters(Obj);
  end;
 except
  on E:Exception do BugReport(E,nil,'FindFormSmiObjectParameters');
 end;
end;

function InitFormSmiObjectParameters(ObjectName:String):TFormSmiObjectParameters;
begin
 Result:=nil;
 try
  Result:=FindFormSmiObjectParameters(ObjectName);
  ObjectName:=Trim(ObjectName); if (ObjectName='') then Exit;
  if (Result=nil) then begin
   Result:=TFormSmiObjectParameters.Create(Application);
   Result.RegisterMe(ObjectName);
  end;
  if (Result&lt;&gt;nil) then Result.Show;
 except
  on E:Exception do BugReport(E,nil,'InitFormSmiObjectParameters');
 end;
end;

procedure FreeFormSmiObjectParameters(ObjectName:String);
var i:Integer; Obj:TObject;
begin
 try
  if (ListOfFormSmiObjectParameters=nil) then Exit;
  ObjectName:=Trim(ObjectName); if (ObjectName='') then Exit;
  if SameText(ObjectName,'*') then begin
   for i:=ListOfFormSmiObjectParameters.Count-1 downto 0 do begin
    Obj:=ListOfFormSmiObjectParameters.Objects[i];
    ListOfFormSmiObjectParameters.Delete(i);
    if (Obj&lt;&gt;nil) then Obj.Free;
   end;
  end else begin
   i:=ListOfFormSmiObjectParameters.IndexOf(ObjectName);
   if (i&gt;=0) then begin
    Obj:=ListOfFormSmiObjectParameters.Objects[i];
    ListOfFormSmiObjectParameters.Delete(i);
    if (Obj&lt;&gt;nil) then Obj.Free;
   end;
  end;
 except
  on E:Exception do BugReport(E,nil,'FreeFormSmiObjectParameters');
 end;
end;

procedure HideFormSmiObjectParameters(ObjectName:String);
var i:Integer; Obj:TObject;
begin
 try
  if (ListOfFormSmiObjectParameters=nil) then Exit;
  ObjectName:=Trim(ObjectName); if (ObjectName='') then Exit;
  if SameText(ObjectName,'*') then begin
   for i:=ListOfFormSmiObjectParameters.Count-1 downto 0 do begin
    Obj:=ListOfFormSmiObjectParameters.Objects[i];
    if (Obj is TForm) then TForm(Obj).Hide;
   end;
  end else begin
   i:=ListOfFormSmiObjectParameters.IndexOf(ObjectName);
   if (i&gt;=0) then begin
    Obj:=ListOfFormSmiObjectParameters.Objects[i];
    if (Obj is TForm) then TForm(Obj).Hide;
   end;
  end;
 except
  on E:Exception do BugReport(E,nil,'HideFormSmiObjectParameters');
 end;
end;

function UpdateObjectObjectParameters(Sender: TObject; ObjectName,StateName,Params:String):TFormSmiObjectParameters;
begin
 Result:=nil;
 try
  Result:=FindFormSmiObjectParameters(ObjectName);
  if (Result&lt;&gt;nil) then Result:=Result.UpdateObjectParameters(Sender,StateName,Params);
 except
  on E:Exception do BugReport(E,nil,'UpdateObjectObjectParameters');
 end;
end;

procedure TFormSmiObjectParameters.FormCreate(Sender: TObject);
begin
 try
  SetDefaultFontName(Font);
  StringGridParameters.Font.Size:=14;
  StringGridParameters.Font.Style:=StringGridParameters.Font.Style+[fsBold];
  SetDefaultSansFontName(LabelParameters.Font);
  LabelParameters.Font.Size:=10;
  ObjectName:='UNKNOWN';
  StateName:='DEAD';
  StringGridParameters.RowCount:=1;
  StringGridParameters.ColCount:=3;
  StringGridParameters.FixedCols:=2;
  StringGridParameters.FixedRows:=1;
  StringGridParameters.Cells[0,0]:='Name';
  StringGridParameters.Cells[1,0]:='Type';
  StringGridParameters.Cells[2,0]:='Value';
 except
  on E:Exception do BugReport(E,Self,'FormCreate');
 end;
end;

procedure TFormSmiObjectParameters.FormDestroy(Sender: TObject);
begin
 try
  UnRegisterMe;
  myObjectName:='';
  myStateName:='';
 except
  on E:Exception do BugReport(E,Self,'FormDestroy');
 end;
end;

procedure TFormSmiObjectParameters.SetStateName(aStateName:String);
begin
 myStateName:=Trim(aStateName);
 LabelParameters.Caption:='Parameters of '+ObjectName+' State '+StateName;
end;

procedure TFormSmiObjectParameters.SetObjectName(aObjectName:String);
begin
 myObjectName:=Trim(aObjectName);
 Caption:='Parameters of '+ObjectName;
end;

procedure TFormSmiObjectParameters.RegisterMe(aObjectName:String);
var i:Integer;
begin
 try
  ObjectName:=aObjectName; StateName:='DEAD';
  if (ListOfFormSmiObjectParameters=nil) then Exit;
  i:=ListOfFormSmiObjectParameters.IndexOf(ObjectName);
  if (i&lt;0) then ListOfFormSmiObjectParameters.AddObject(ObjectName,Self);
 except
  on E:Exception do BugReport(E,Self,'RegisterMe');
 end;
end;

procedure TFormSmiObjectParameters.UnRegisterMe;
var i:Integer;
begin
 try
  if (ListOfFormSmiObjectParameters=nil) then Exit;
  i:=ListOfFormSmiObjectParameters.IndexOf(ObjectName);
  if (i&gt;=0) then ListOfFormSmiObjectParameters.Delete(i);
 except
  on E:Exception do BugReport(E,Self,'UnRegisterMe');
 end;
end;

procedure TFormSmiObjectParameters.LocateToControl(Sender: TObject);
var Control:TControl; P:TPoint;
begin
 if not (Sender is TControl) then Exit;
 Control:=TControl(Sender);
 P.X:=0; P.Y:=Control.Height;
 P:=Control.ClientToScreen(P);
 Left:=P.X; Top:=P.Y;
end;

function TFormSmiObjectParameters.UpdateObjectParameters(Sender:TObject; State,Params:String):TFormSmiObjectParameters;
var i,n:Integer; p,sname,stype,sdata:String;
begin
 Result:=nil;
 n:=WordCount(Params,'/'); if (n=0) then Exit;
 Params:=Trim(Params); if (Params='') then Exit;
 try
  StateName:=State;
  StringGridParameters.RowCount:=1+n;
  if (Sender&lt;&gt;nil) then LocateToControl(Sender);
  for i:=1 to n do begin
   p:=ExtractWord(i,Params,'/');
   sname:=UpperCase(ExtractWord(1,p,'( )'));
   stype:=UpperCase(ExtractWord(2,p,'( )'));
   sdata:=SkipWords(1,p,'=');
   if SameText(stype,'S') then sdata:=HexToStr(sdata);
   StringGridParameters.Cells[0,i]:=sname;
   StringGridParameters.Cells[1,i]:=stype;
   StringGridParameters.Cells[2,i]:=sdata;
  end;
  Result:=Self;
 except
  on E:Exception do BugReport(E,Self,'UpdateObjectParameters');
 end;
end;

initialization

 FindFormSmiObjectParameters('');

end.
</Code>
        </dpFormSmiObjectParameters>
        <dpFsmUtils ImageIndex="2">
          <Object ClassName=""/>
          <Code>unit dpFsmUtils;

interface

uses  dpCmdArgs,dpSystem,dpSysUtils,dpVbs,dpWindows,dpGuiUtils,dpCrwDaqSys,
      dpDaqConfig,dpAntiZombie,dpGuiResMain,dpGuiResTools,dpTask,dpColors;

 /////////////////////////////////////////////////
 // Constants for FsmManager. ////////////////////
 /////////////////////////////////////////////////
const
 fsm_scalar_type_list  = 'int,float,string';    // FSM scalar type list
 fsm_sym_declaration   = 'declaration';         // FSM Entity    symbol - property declaration
 fsm_sym_associated    = 'associated';          // FSM Object    symbol - option   /associated
 fsm_sym_is_of_class   = 'is_of_class';         // FSM Object    symbol - property is_of_class
 fsm_sym_catalog       = 'catalog';             // FSM Entity    symbol - property catalog
 fsm_sym_initial_state = 'initial_state';       // FSM Object    symbol - option   /initial_state
 fsm_sym_dead_state    = 'dead_state';          // FSM Object    symbol - option   /dead_state
 fsm_sym_cookie        = 'cookie';              // FSM Entity    symbol - property cookie
 fsm_sym_color         = 'color';               // FSM State     symbol - option   !color: name
 fsm_sym_visible       = 'visible';             // FSM Action    symbol - option   !visible: 1
 fsm_sym_defaultcolor  = 'defaultcolor';        // FSM State     symbol - option   !defaultcolor: name
 fsm_sym_union         = 'union';               // FSM ObjectSet symbol - option   union
 fsm_sym_unionlist     = 'unionlist';           // FSM ObjectSet symbol - property UnionList
 fsm_sym_unionmode     = 'unionmode';           // FSM ObjectSet symbol - property UnionMode
 fsm_sym_panel         = 'panel';               // FSM Entity    symbol - cookie   panel
 fsm_sym_title         = 'title';               // FSM Entity    symbol - cookie   title
 fsm_sym_hint          = 'hint';                // FSM Entity    symbol - cookie   hint
 fsm_sym_body          = 'body';                // FSM Entity    symbol - property body
 fsm_sym_void          = 'void';                // FSM Entity    symbol - property void
 fsm_sym_parameters    = 'parameters';          // FSM Entity    symbol - !parameters:

function fsm_normalize_params(arg:String; var params:String):Integer;

implementation

function is_iparam(s:String):Boolean;
var i:Integer;
begin
 Result:=false;
 if (s='') then Exit;
 Result:=TryStrToInt(s,i);
end;

function is_fparam(s:String):Boolean;
var f:Double;
begin
 Result:=false;
 if (s='') then Exit;
 Result:=TryStrToFloat(s,f);
end;

function is_sparam(s:String):Boolean;
begin
 Result:=false;
 if (s='') then Exit;
 if (StrFetch(s,1)=QuoteMark) then begin
  if (StrFetch(s,Length(s))&lt;&gt;QuoteMark) then Exit;
  if (Length(s)&lt;2) then Exit;
 end else begin
  if (WordCount(s,' '+vbCrLf+vbTab)&gt;1) then Exit;
 end;
 Result:=true;
end;

function is_name(s:String):Boolean;
begin
 Result:=false;
 if (s='') then Exit;
 Result:=ExecRegExpr('^[_a-zA-Z]+[_0-9a-zA-Z]*$',s);
end;

{
Convert comma separated params to normalized CRLF text of lines: (int|float|string) name = value.
}
function fsm_normalize_params(arg:String; var params:String):Integer;
var errors,i,p,typ:Integer; c,cbeg,cend:Char;
    wt,wn,wv,line,delims:String; IsQuoted:Boolean;
    lines:TStringList;
 procedure ClearLocals;
 begin
  wt:=''; wn:=''; wv:=''; line:=''; delims:='';
 end;
begin
 ClearLocals;
 delims:=' '+vbCrLf+vbTab;
 errors:=0; params:=''; arg:=Trim(arg);
 // Remove brackets () if one exists
 cbeg:=StrFetch(arg,1); cend:=StrFetch(arg,Length(arg)); // 1st/last char
 if (cbeg='(') then arg:=Copy(arg,2,Length(arg)-1);      // Remove lead (
 if (cend=')') then arg:=Copy(arg,1,Length(arg)-1);      // Remove tail )
 if (cbeg='(') and (cend&lt;&gt;')') then errors:=errors+1;    // Unbalanced ()
 if (cend=')') and (cbeg&lt;&gt;'(') then errors:=errors+1;    // Unbalanced ()
 // Replace comma (,) to LineEnding, if one is not quoted
 i:=1; IsQuoted:=false;
 while (i&lt;=Length(arg)) do begin
  c:=StrFetch(arg,i);
  if (c=QuoteMark) then IsQuoted:=not IsQuoted else
  if (c=',') and not IsQuoted then arg:=Copy(arg,1,i-1)+LineEnding+Copy(arg,i+1,MaxInt);
  i:=i+1;
 end;
 // Process text lines
 lines:=TStringList.Create;
 try
  lines.Text:=AdjustLineBreaks(arg);
  for i:=0 to lines.Count-1 do begin
   line:=Trim(lines.Strings[i]);
   if (line&lt;&gt;'') then begin
    wv:=''; wn:='';
    p:=Pos('=',line);
    if (p&gt;0) then begin
     wv:=Trim(Copy(line,p+1,MaxInt));
     line:=Trim(Copy(line,1,p-1));
    end;
    wt:=ExtractWord(1,line,delims);
    typ:=WordIndex(LowerCase(wt),fsm_scalar_type_list,',');
    if (typ&gt;0) then begin
     wt:=LowerCase(wt);
     wn:=UpperCase(ExtractWord(2,line,delims));
     if (WordCount(line,delims)&lt;&gt;2) then errors:=errors+1;
    end else begin
     wn:=UpperCase(wt);
     wt:=''; // To be defined indirect from data value
     if (typ=0) then if is_iparam(wv) then begin typ:=1; wt:=ExtractWord(typ,fsm_scalar_type_list,','); end;
     if (typ=0) then if is_fparam(wv) then begin typ:=2; wt:=ExtractWord(typ,fsm_scalar_type_list,','); end;
     if (typ=0) then if is_sparam(wv) then begin typ:=3; wt:=ExtractWord(typ,fsm_scalar_type_list,','); end;
     if (typ=0) then if (wv='') then begin typ:=3; wt:=ExtractWord(typ,fsm_scalar_type_list,','); end;
     if (WordCount(line,delims)&lt;&gt;1) then errors:=errors+1;
    end;
    if (typ=0) then errors:=errors+1;
    if (typ=1) and (wv='') then wv:='0';
    if (typ=2) and (wv='') then wv:='0.0';
    if (typ=3) and (wv='') then wv:=AnsiQuotedStr('',QuoteMark);
    if not is_name(wt) then errors:=errors+1;
    if not is_name(wn) then errors:=errors+1;
    if (typ=1) then if not is_iparam(wv) then errors:=errors+1;
    if (typ=2) then if not is_fparam(wv) then errors:=errors+1;
    if (typ=3) then if not is_sparam(wv) then errors:=errors+1;
    if (errors=0) then begin
     if (typ=3) and (StrFetch(wv,1)&lt;&gt;QuoteMark) then wv:=AnsiQuotedStr(wv,QuoteMark);
     line:=wt+' '+wn+' = '+wv;
     if (params='')
     then params:=line
     else params:=params+LineEnding+line;
    end;
   end;
  end;
 finally
  ClearLocals;
  lines.Free;
 end;
 Result:=errors;
end;


end.
</Code>
        </dpFsmUtils>
        <dpSmiGenGui ImageIndex="2">
          <Object ClassName=""/>
          <Code>////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2020 Alexey Kuryakin kouriakine@mail.ru under LGPL license.  //
////////////////////////////////////////////////////////////////////////////////

unit dpSmiGenGui; // Diesel Pascal routines for SMI Generic GUI.

interface

uses dpCmdArgs,dpSystem,dpSysUtils,dpWindows,dpVbs,dpCrwDaqSys,dpTask,
     dpFormSmiActionSelector,dpFormSmiActionParameters,dpFormSmiObjectParameters;

type
 TSmiGenGui = class(TObject)
 private
  myGuiPid         : Integer;                    // PID of SMI Generic GUI
  myObjectList     : TStringList;                // Object list to monitor
  myDomainList     : TStringList;                // List of available domains
  myDomainNode     : TStringList;                // List of avail DOMAIN=NODE
  myDomObjList     : TStringList;                // List of objects in domain
  mySelObjList     : TStringList;                // List of selected objects
  myMonitorOut     : TStringList;                // monObjects.exe lines list
  InStringList     : TStringList;                // Uses inside MonitorReader
  StateColList     : TStringList;                // List of state colors
  myMonObjectsTid  : Integer;                    // Monitor Objects - task id
  myDnsRunningAns  : String;                     // Last DnsRunning Answer
  myScrollBox      : TScrollBox;                 // Container for objects
  myTimeTicks      : Integer;                    // Time tick counter
  myLineCount      : Integer;                    // Count of income lines
  myExecTasks      : array[0..255] of Boolean;   // List of Exec tid's
  myOrigPath       : String;                     // Original PATH value
 private
  function  GetMonObjectsPid:Integer;
  function  GetDIM_DNS_NODE:String;
  procedure SetDIM_DNS_NODE(aNode:String);
 public
  property  guiPID         : Integer     read myGuiPid;
  property  objectList     : TStringList read myObjectList;
  property  domainList     : TStringList read myDomainList;
  property  domainNode     : TStringList read myDomainNode;
  property  DomObjList     : TStringList read myDomObjList;
  property  SelObjList     : TStringList read mySelObjList;
  property  MonitorOut     : TStringList read myMonitorOut;
  property  MonObjectsTid  : Integer     read myMonObjectsTid;
  property  MonObjectsPid  : Integer     read GetMonObjectsPid;
  property  DIM_DNS_NODE   : String      read GetDIM_DNS_NODE  write SetDIM_DNS_NODE;
  property  DnsRunningAns  : String      read myDnsRunningAns;
  property  ScrollBox      : TScrollBox  read myScrollBox      write myScrollBox;
  property  TimeTicks      : Integer     read myTimeTicks;
  property  LineCount      : Integer     read myLineCount;
 public                                          // Uses directories and file names:
  function  DimSiteFile(FileName:String):String; // Resource\DimSite\FileName
  function  SmiSiteFile(FileName:String):String; // Resource\SmiSite\FileName
  function  DimSiteBinDir:String;                // Resource\DimSite\dim\bin
  function  SmiSiteBinDir:String;                // Resource\SmiSite\smi\bin
  function  DimSiteBinExe(Exe:String):String;    // Resource\DimSite\dim\bin\Exe
  function  SmiSiteBinExe(Exe:String):String;    // Resource\SmiSite\smi\bin\Exe
  function  dnsRunningExe:String;                // Resource\SmiSite\smi\bin\dnsRunning.exe
  function  getDomainsExe:String;                // Resource\SmiSite\smi\bin\getDomains.exe
  function  monObjectsExe:String;                // Resource\SmiSite\smi\bin\monObjects.exe
  function  tellMonObjectsExe:String;            // Resource\SmiSite\smi\bin\tellMonObjects.exe
  function  getDomainObjectsExe:String;          // Resource\SmiSite\smi\bin\getDomainObjects.exe
  function  getDomainObjectSetsExe:String;       // Resource\SmiSite\smi\bin\getDomainObjectSets.exe
  function  getSetObjectsExe:String;             // Resource\SmiSite\smi\bin\getSetObjects.exe
  function  getSmiGuiTcl:String;                 // Resource\SmiSite\smi\bin\smiGUI.tcl
  function  CheckExecutables(Verbose:Boolean=false):Boolean; // Check exe file existance
  function  QuotedIfNeeded(url:String; Quote:Char='"'; Needed:Boolean=false):String;
  function  FitExeName(Exe:String):String;       // Drop .exe from filename in UNIX
  function  ComposeCmd(exe,arg:String):String;   // Compose command line from exe and arg
  function  SearchPath:String;                   // PATH with DIM/SMI bin dirs
  procedure SetupPath(Up:Boolean);               // Set DIM/SMI search path UP/DOWN
  function  DefExecTimeout:Integer;              // Default timeout for Exec
 public
  constructor Create;
  destructor  Destroy;
 public
  procedure Reset;
  procedure ClearExecTasks;
  function  PollTasks:Integer;
  function  ListTerminalCommands:String;
  function  Exec(exe:String; arg:String=''; timeout:Integer=0;
                 BuffSizeKb:Integer=0; HomeDir:String=''; cp:Integer=0):String;
  function  IsDnsRunning:Boolean;
  function  UpdateDomainList:Integer;
  function  UpdateDomObjList(Domain:String; Exclude:String):Integer;
  procedure UpdateObjectsPanelPosition;
  procedure RegisterObject(name:String);
  procedure RemoveObject(name:String);
  procedure RegisterMonitorObjects(Delay:Integer);
  procedure RemoveMonitorObjects;
  procedure DispatchAction(objectname,action,parameters:String);
  function  StartMonitoring:Boolean;
  procedure StopMonitoring;
  procedure PollMonitoring;
  procedure MonitorReader(inString:String);
  procedure Trouble(Msg:String);
  procedure Success(Msg:String);
  procedure SmiRunLog(When:Double; What:String);
  procedure SmlLog(When:Double; What:String);
  function  IsMonitoring:Boolean;
  function  IsMonitorRunning:Boolean;
  function  GetStateColor(ObjectName,StateName:String; Def:TColor):TColor;
  procedure HandleTimeTick;
  procedure RunWebBrowser(url:String);
  procedure RunPdfViewer(url:String);
  procedure RunSmiGuiTcl;
  procedure RunDimTree;
  procedure BrowseHelp;
  procedure BrowseSite;
  function  ListSmiCommands(Mode:Integer=3):String;
  function  ValidatePathName(arg:String; Mode:Integer=7):String;
  function  ListSmiSmlSamples:String;
  function  SmiDataDir(SubDir:String):String;
  function  SmiDataSamplesDir:String;
  function  SmiDataLogDir:String;
  function  RunLister(aFile:String):String;
  function  RunTextEditor(aFile,aEditor:String):String;
  function  RunTextViewer(aFile,aViewer:String):String;
  function  ListTextEditors:String;
  function  ListTextViewers:String;
  function  XCopyFile(src,dst:String):Boolean;
  function  ListFonts(Filter:String):String;
  procedure ApplyXTermFont(var exe,arg:String);
 end;
 TSmiObjectTuple = class(TObject)
 private
  myObjectName : String;
  myPanelSheet : TPanel;
  myLabelTitle : TLabel;
  myPanelState : TPanel;
  myPanelQuery : TPanel;
  myParamsList : TStringList;
  myActionList : TStringList;
  myActionPara : TStringList;
 private
  procedure FreeControls;
  procedure InitControls;
  function  GetStateName:String;
  procedure SetStateName(aStateName:String);
 public
  property StateName  : String      read GetStateName write SetStateName;
  property ObjectName : String      read myObjectName;
  property PanelSheet : TPanel      read myPanelSheet;
  property LabelTitle : TLabel      read myLabelTitle;
  property PanelState : TPanel      read myPanelState;
  property PanelQuery : TPanel      read myPanelQuery;
  property ParamsList : TStringList read myParamsList;
  property ActionList : TStringList read myActionList;
  property ActionPara : TStringList read myActionPara;
 public
  constructor Create(aObjectName:String);
  destructor  Destroy;
 public
  procedure ParamsListAdd(line:String);
  procedure ActionListAdd(line:String);
  procedure ActionParaAdd(action,line:String);
 public
  procedure UpdatePanelPosition;
  function  FindTuple(Sender: TObject):TSmiObjectTuple;
  procedure OnLabelTitleClick(Sender: TObject);
  procedure OnPanelStateClick(Sender: TObject);
  procedure OnPanelQueryClick(Sender: TObject);
  function  GetParamsForAction(action:String):String;
  procedure ApplyAction(action:String);
  function  ParamsSlashList:String;
  function  Description:String;
 end;

function SmiGenGui:TSmiGenGui;

//////////////////////////////////// Exec params:
const MinExecBuffKb  = 1;         // Minimal Exec buffer, kB
const MaxExecBuffKb  = 1024*64;   // Maximal Exec buffer, kB
const DefExecBuffKb  = 256;       // Default Exec buffer init value, kB
const MinExecTimeOut = 1000;      // Minimal Exec timeout, ms
const MaxExecTimeout = 1000*60*5; // Maximal Exec timeout, ms
const TheExecTimeout = 1000*7;    // Default Exec timeout init value, ms

implementation

uses Main;

var TheSmiGenGui:TSmiGenGui=nil;

function SmiGenGui:TSmiGenGui;
begin
 if (TheSmiGenGui=nil) then TheSmiGenGui:=TSmiGenGui.Create;
 Result:=TheSmiGenGui;
end;

 ////////////////////////////
 // TSmiGenGui implementation
 ////////////////////////////

function TSmiGenGui.GetMonObjectsPid:Integer;
begin
 if (MonObjectsTid&lt;&gt;0)
 then Result:=task_pid(MonObjectsTid)
 else Result:=0;
end;

function TSmiGenGui.GetDIM_DNS_NODE:String;
begin
 Result:=GetEnv('DIM_DNS_NODE');
end;

procedure TSmiGenGui.SetDIM_DNS_NODE(aNode:String);
begin
 SetEnv('DIM_DNS_NODE',Trim(aNode));
end;

function TSmiGenGui.DefExecTimeout:Integer;
begin
 if (MainForm=nil)
 then Result:=TheExecTimeout
 else Result:=MainForm.SmiRunTimeout;
 Result:=iMin(MaxExecTimeout,Result);
 Result:=iMax(MinExecTimeout,Result);
end;

function TSmiGenGui.QuotedIfNeeded(url:String; Quote:Char='"'; Needed:Boolean=false):String;
begin
 url:=Trim(url);
 if IsWindows then Needed:=true;
 if (url&lt;&gt;'') and Needed and (Pos(Quote,url)=0) then
 if (Pos(' ',url)+Pos(vbTab,url)&gt;0) then url:=AnsiQuotedStr(url,Quote);
 Result:=url;
end;

 // UNIX executable files has no .exe extension.
function TSmiGenGui.FitExeName(Exe:String):String;
begin
 Exe:=Trim(Exe); if (Exe='') then Exit;
 if IsUnix and SameText(ExtractFileExt(Exe),'.exe')
 then Exe:=ReplaceFileExt(Exe,'');
 Result:=Exe;
end;

function TSmiGenGui.ComposeCmd(exe,arg:String):String;
const ShortNames=false;
begin
 if ShortNames and IsWindows and not IsEmptyStr(ExtractFileDir(exe)) then begin
  if not IsEmptyStr(FileSearch(ExtractFileName(exe),GetEnv('PATH'),false))
  then exe:=ExtractFileName(exe);
 end;
 Result:=Trim(ValidatePathName(exe,1+2+8)+' '+Trim(arg));
end;

function TSmiGenGui.DimSiteFile(FileName:String=''):String;
begin
 Result:='';
 FileName:=Trim(FileName);
 if IsUnix then Result:='/opt/dimsite';
 if IsWindows then begin
  Result:=CRW_DAQ_SYS_HOME_DIR;
  if (Result='') then Result:=ExpEnv('%CommonProgramFiles%\CRW-DAQ');
  if not DirectoryExists(Result) then Result:='';
  if (Result&lt;&gt;'') then Result:=AddPathDelim(Result)+'Resource\DimSite';
 end;
 if (Result&lt;&gt;'') and (FileName&lt;&gt;'') then Result:=AddPathDelim(Result)+FileName;
 if (Result&lt;&gt;'') then Result:=ExpandFileName(Result);
end;

function TSmiGenGui.SmiSiteFile(FileName:String=''):String;
begin
 Result:='';
 FileName:=Trim(FileName);
 if IsUnix then Result:='/opt/smisite';
 if IsWindows then begin
  Result:=CRW_DAQ_SYS_HOME_DIR;
  if (Result='') then Result:=ExpEnv('%CommonProgramFiles%\CRW-DAQ');
  if not DirectoryExists(Result) then Result:='';
  if (Result&lt;&gt;'') then Result:=AddPathDelim(Result)+'Resource\SmiSite';
 end;
 if (Result&lt;&gt;'') and (FileName&lt;&gt;'') then Result:=AddPathDelim(Result)+FileName;
 if (Result&lt;&gt;'') then Result:=ExpandFileName(Result);
end;

function TSmiGenGui.DimSiteBinDir:String;
begin
 if IsUnix
 then Result:='/opt/dim'
 else Result:=DimSiteFile('dim\bin');
end;

function TSmiGenGui.SmiSiteBinDir:String;
begin
 if IsUnix
 then Result:='/opt/smi'
 else Result:=SmiSiteFile('smi\bin');
end;

function TSmiGenGui.DimSiteBinExe(Exe:String):String;
begin
 Result:='';
 Exe:=FitExeName(Exe); if (Length(Exe)=0) then Exit;
 Result:=DimSiteBinDir; if (Length(Result)=0) then Exit;
 Result:=AddPathDelim(Result)+Exe;
end;

function TSmiGenGui.SmiSiteBinExe(Exe:String):String;
begin
 Result:='';
 Exe:=FitExeName(Exe); if (Length(Exe)=0) then Exit;
 Result:=SmiSiteBinDir; if (Length(Result)=0) then Exit;
 Result:=AddPathDelim(Result)+Exe;
end;

function TSmiGenGui.dnsRunningExe:String;
begin
 Result:=SmiSiteBinExe('dnsRunning.exe');
end;

function TSmiGenGui.getDomainsExe:String;
begin
 Result:=SmiSiteBinExe('getDomains.exe');
end;

function TSmiGenGui.monObjectsExe:String;
begin
 Result:=SmiSiteBinExe('monObjects.exe');
end;

function TSmiGenGui.tellMonObjectsExe:String;
begin
 Result:=SmiSiteBinExe('tellMonObjects.exe');
end;

function TSmiGenGui.getDomainObjectsExe:String;
begin
 Result:=SmiSiteBinExe('getDomainObjects.exe');
end;

function TSmiGenGui.getDomainObjectSetsExe:String;
begin
 Result:=SmiSiteBinExe('getDomainObjectSets.exe');
end;

function TSmiGenGui.getSetObjectsExe:String;
begin
 Result:=SmiSiteBinExe('getSetObjects.exe');
end;

function TSmiGenGui.getSmiGuiTcl:String;
begin
 Result:=SmiSiteBinExe('smiGUI.tcl');
end;

function TSmiGenGui.CheckExecutables(Verbose:Boolean=false):Boolean;
 procedure Check(exe,name:String);
 begin
  if (exe='') or not FileExists(exe) then begin
   if Verbose then Trouble('Not found: '+FitExeName(name));
   Result:=false;
  end;
 end;
begin
 Result:=true;
 Check(dnsRunningExe,'dnsRunning.exe');
 Check(getDomainsExe,'getDomains.exe');
 Check(monObjectsExe,'monObjects.exe');
 Check(tellMonObjectsExe,'tellMonObjects.exe');
 Check(getDomainObjectsExe,'getDomainObjects.exe');
 //Check(getDomainObjectSetsExe,'getDomainObjectSets.exe');
 //Check(getSetObjectsExe,'getSetObjects.exe');
end;

function TSmiGenGui.SearchPath:String;
begin
 Result:=GetEnv('PATH');
 if DirectoryExists(AddPathDelim(SmiSiteBinDir))
 then Result:=Result+PathSep+SmiSiteBinDir;
 if DirectoryExists(AddPathDelim(DimSiteBinDir))
 then Result:=Result+PathSep+DimSiteBinDir;
end;

procedure TSmiGenGui.SetupPath(Up:Boolean);
begin
 if Up then begin
  if (myOrigPath='') then begin
   myOrigPath:=GetEnv('PATH'); LogEvents(Now,'Orig PATH='+GetEnv('PATH'));
   if SetEnv('PATH',SearchPath) then LogEvents(Now,'Work PATH='+GetEnv('PATH'));
  end;
 end else begin
  if (myOrigPath&lt;&gt;'') then begin
   if SetEnv('PATH',myOrigPath) then LogEvents(Now,'Back PATH='+GetEnv('PATH'));
  end;
 end;
end;

constructor TSmiGenGui.Create;
begin
 inherited Create;
 myGuiPid:=GetProcessId;
 myObjectList:=TStringList.Create;
 myDomainList:=TStringList.Create; myDomainList.Sorted:=true;
 myDomainNode:=TStringList.Create; myDomainNode.Sorted:=true;
 myDomObjList:=TStringList.Create; myDomObjList.Sorted:=true;
 mySelObjList:=TStringList.Create;
 myMonitorOut:=TStringList.Create;
 InStringList:=TStringList.Create;
 StateColList:=TStringList.Create;
 myOrigPath:='';
 myMonObjectsTid:=0;
 myDnsRunningAns:='';
 myScrollBox:=nil;
 myTimeTicks:=0;
 myLineCount:=0;
 ClearExecTasks;
 SetupPath(true);
 CheckExecutables(true);
 if (TheSmiGenGui=nil) then TheSmiGenGui:=Self;
end;

destructor TSmiGenGui.Destroy;
begin
 if (TheSmiGenGui=Self) then TheSmiGenGui:=nil;
 StopMonitoring;
 ClearExecTasks;
 SetupPath(false);
 myOrigPath:='';
 myDnsRunningAns:='';
 myObjectList.Free;
 myDomainList.Free;
 myDomainNode.Free;
 myDomObjList.Free;
 mySelObjList.Free;
 myMonitorOut.Free;
 InStringList.Free;
 StateColList.Free;
 inherited Destroy;
end;

procedure TSmiGenGui.ClearExecTasks;
var i:Integer;
begin
 for i:=0 to 255 do myExecTasks[i]:=false;
end;

procedure TSmiGenGui.Reset;
begin
 try
  StopMonitoring;
  ObjectList.Clear;
  DomainList.Clear;
  DomainNode.Clear;
  DomObjList.Clear;
  SelObjList.Clear;
  MonitorOut.Clear;
  myDnsRunningAns:='';
  HideFormSmiActionSelector;
  HideFormSmiActionParameters;
  HideFormSmiObjectParameters('*');
 except
  on E:Exception do BugReport(E,Self,'Reset');
 end;
end;

function TSmiGenGui.Exec(exe:String; arg:String=''; timeout:Integer=0;
            BuffSizeKb:Integer=0; HomeDir:String=''; cp:Integer=0):String;
var tid:Integer; cmd,msg,dir:String;
begin
 Result:='';
 try
  exe:=Trim(exe);
  arg:=Trim(arg);
  if (exe='') then Exit;
  if IsUnix and (WordCount(exe,' ')&gt;1) then begin
   arg:=Trim(SkipWords(1,exe,' ')+' '+arg);
   exe:=ExtractWord(1,exe,' ');
  end;
  if IsUnix then ApplyXTermFont(exe,arg);
  cmd:=ComposeCmd(exe,arg);
  if (timeout&gt;=0) then begin
   if (timeout&lt;MinExecTimeOut) then timeout:=DefExecTimeOut;
   if (timeout&gt;MaxExecTimeOut) then timeout:=MaxExecTimeOut;
   if (BuffSizeKb&lt;MinExecBuffKb) then BuffSizeKb:=DefExecBuffKb;
   if (BuffSizeKb&gt;MaxExecBuffKb) then BuffSizeKb:=MaxExecBuffKb;
  end else BuffSizeKb:=0;
  tid:=task_init(cmd);
  if (tid&lt;&gt;0) then begin
   if (timeout&gt;=0)
   then task_ctrl(tid,'Display=SW_HIDE')
   else task_ctrl(tid,'Display=SW_SHOW');
   if IsWindows and (cp=0) then cp:=WinApi.GetACP;
   if IsWindows and (cp&lt;&gt;0) then task_ctrl(tid,'CodePage='+IntToStr(cp));
   if (BuffSizeKb&gt;0) then task_ctrl(tid,'StdInPipeSize='+IntToStr(1024*BuffSizeKb));
   if (BuffSizeKb&gt;0) then task_ctrl(tid,'StdOutPipeSize='+IntToStr(1024*BuffSizeKb));
   if (HomeDir&lt;&gt;'') and DirectoryExists(HomeDir) then task_ctrl(tid,'HomeDir='+HomeDir);
   if (HomeDir&lt;&gt;'') and DirectoryExists(HomeDir) then dir:=HomeDir else dir:=GetCurrentDir;
   if task_run(tid) then begin
    if (timeout&gt;=0) then begin
     task_wait(tid,timeout);
     Result:=task_recv(tid,MaxInt);
     if task_wait(tid,0) then task_kill(tid,1,0,1000);
     if task_wait(tid,0) then task_kill(tid,0,0,0);
    end else begin
     Result:='PID '+IntToStr(task_pid(tid))+' started';
    end;
    msg:=FormatVar('Exec[%d]: ',task_pid(tid))+cmd+EOL+'at '+ValidatePathName(dir,8);
    Success(msg);
    SmlLog(Now,msg);
    SmiRunLog(Now,msg);
   end else begin
    msg:='Could not Exec: '+cmd;
    Trouble(msg);
    SmlLog(Now,msg);
    SmiRunLog(Now,msg);
   end;
   if (timeout&gt;=0) then task_free(tid) else myExecTasks[tid]:=true;
  end else begin
   msg:='Could not create task: '+cmd;
   Trouble(msg);
   SmlLog(Now,msg);
   SmiRunLog(Now,msg);
  end;
 except
  on E:Exception do BugReport(E,Self,'Exec');
 end;
end;

 // Free terminated tasks
function TSmiGenGui.PollTasks:Integer;
var tid,cod,pid:Integer; cmd,msg:String;
begin
 Result:=0;
 for tid:=task_ref_min to task_ref_max do begin
  if not myExecTasks[tid] then continue;
  if (task_ref(tid)=nil) then continue;
  if (tid=MonObjectsTid) then continue;
  if (task_pid(tid)=0) then continue;
  if task_wait(tid,0) then continue;
  pid:=task_pid(tid);
  cod:=task_result(tid);
  cmd:=task_ctrl(tid,'CmdLine');
  if task_free(tid) then begin
   msg:=FormatVar('End task[%d]: ',tid)+cmd;
   msg:=msg+EOL+FormatVar('PID %d ',pid)+FormatVar('exit code %d',cod);
   SmiRunLog(Now,msg); SmlLog(Now,msg);
   myExecTasks[tid]:=false;
   Success(msg);
   Inc(Result);
  end;
 end;
end;

function TSmiGenGui.ListTerminalCommands:String;
begin
 Result:=EOL;
 if IsWindows then begin
  Result:=Result+'cmd /c'+EOL;
  Result:=Result+'cmd /k'+EOL;
 end;
 if IsUnix then begin
  Result:=Result+'xterm -e'+EOL;
  Result:=Result+'xterm -hold -e'+EOL;
  Result:=Result+'fly-term -e'+EOL;
  Result:=Result+'fly-term -hold -e'+EOL;
 end;
end;

function TSmiGenGui.IsDnsRunning:Boolean;
begin
 myDnsRunningAns:=Exec(dnsRunningExe);
 Result:=SameText(Trim(DnsRunningAns),'YES');
end;

function TSmiGenGui.UpdateDomainList:Integer;
var List:TStringList; i:Integer; dom,node:String;
begin
 Result:=0;
 try
  DomainList.Clear;
  DomainNode.Clear;
  List:=TStringList.Create;
  try
   List.Text:=Exec(getDomainsExe);
   for i:=0 to List.Count-1 do begin
    dom:=Trim(ExtractWord(1,List.Strings[i],'/'));
    node:=Trim(SkipWords(1,List.Strings[i],'/'));
    if (dom='') or (node='') then continue;
    if (DomainList.IndexOf(dom)&gt;=0) then continue;
    DomainNode.Values[dom]:=node;
    DomainList.Add(dom);
   end;
   Result:=DomainList.Count;
  finally
   List.Free;
  end;
 except
  on E:Exception do BugReport(E,Self,'UpdateDomainList');
 end;
end;

function TSmiGenGui.UpdateDomObjList(Domain:String; Exclude:String):Integer;
var List:TStringList; i,n:Integer; dom,obj:String;
begin
 Result:=0;
 try
  DomObjList.Clear;
  List:=TStringList.Create;
  try
   for n:=0 to DomainList.Count-1 do begin
    dom:=DomainList.Strings[n];
    if SameText(Domain,'*') or SameText(Domain,dom) then begin
     List.Text:=Exec(getDomainObjectsExe,dom);
     for i:=0 to List.Count-1 do begin
      obj:=Trim(List.Strings[i]);
      if (Pos('::',obj)=0) then continue;
      if (DomObjList.IndexOf(obj)&gt;=0) then continue;
      if (Exclude&lt;&gt;'') and (Pos(Exclude,obj)&gt;0) then continue;
      DomObjList.Add(obj);
     end;
    end;
   end;
   Result:=DomObjList.Count;
  finally
   List.Free;
  end;
 except
  on E:Exception do BugReport(E,Self,'UpdateDomObjList');
 end;
end;

procedure TSmiGenGui.UpdateObjectsPanelPosition;
var i:Integer;
begin
 for i:=0 to ObjectList.Count-1 do
 if (ObjectList.Objects[i] is TSmiObjectTuple) then
 TSmiObjectTuple(ObjectList.Objects[i]).UpdatePanelPosition;
end;

procedure TSmiGenGui.RegisterObject(name:String);
var i:Integer;
begin
 name:=Trim(name); if (name='') then Exit;
 if (ObjectList.IndexOf(name)&lt;0) then begin
  ObjectList.Add(name);
  i:=ObjectList.IndexOf(name);
  ObjectList.Objects[i]:=TSmiObjectTuple.Create(name);
  Exec(tellMonObjectsExe,FormatVar(' %d',guiPID)+FormatVar(' register/%s',name));
  Success(FormatVar('Registered object %s.',name));
 end else begin
  Trouble(FormatVar('Object %s is already registered.',name));
 end;
end;

procedure TSmiGenGui.RemoveObject(name:String);
var i:Integer;
begin
 name:=Trim(name); if (name='') then Exit;
 i:=ObjectList.IndexOf(name);
 if (i&gt;=0) then begin
  Exec(tellMonObjectsExe,FormatVar(' %d',guiPID)+FormatVar(' remove/%s',name));
  ObjectList.Objects[i].Free;
  ObjectList.Delete(i);
  UpdateObjectsPanelPosition;
  Success(FormatVar('Removed object %s.',name));
 end else begin
  Trouble(FormatVar('Non-existing object %s can not be removed.',name));
 end;
end;

procedure TSmiGenGui.RegisterMonitorObjects(Delay:Integer);
var i:Integer;
begin
 if IsMonitoring then
 try
  if (Delay&gt;0) then Sleep(Delay);
  for i:=0 to SelObjList.Count-1 do RegisterObject(SelObjList.Strings[i]);
 except
  on E:Exception do BugReport(E,Self,'RegisterMonitorObjects');
 end;
end;

procedure TSmiGenGui.RemoveMonitorObjects;
var i:Integer;
begin
 try
  for i:=ObjectList.Count-1 downto 0 do RemoveObject(ObjectList.Strings[i]);
 except
  on E:Exception do BugReport(E,Self,'RemoveMonitorObjects');
 end;
end;

procedure TSmiGenGui.DispatchAction(objectname,action,parameters:String);
var actionString,cmd:String;
begin
 try
  actionString:=action;
  if (parameters&lt;&gt;'') then actionString:=actionString+'/'+parameters;
  cmd:='command/'+objectname+'/'+actionString;
  Exec(tellMonObjectsExe,FormatVar(' %d',guiPID)+FormatVar(' "%s"',cmd));
 except
  on E:Exception do BugReport(E,Self,'DispatchAction');
 end;
end;

function TSmiGenGui.StartMonitoring:Boolean;
var tid:Integer; cmd:String;
begin
 Result:=false;
 try
  StopMonitoring;
  cmd:=monObjectsExe+FormatVar(' %d',GuiPid);
  tid:=task_init(cmd);
  myMonObjectsTid:=tid;
  task_ctrl(tid,'StdOutPipeSize='+IntToStr(1024*256));
  task_ctrl(tid,'StdInPipeSize='+IntToStr(1024*256));
  task_ctrl(tid,'HomeDir='+GetEnv('Temp'));
  task_ctrl(tid,'Display=SW_HIDE');
  if task_run(tid) then begin
   Success(FormatVar('Run[%d]: ',task_pid(tid))+cmd+EOL+'SMI FSM monitor started.');
   RegisterMonitorObjects(1000);
   Result:=true;
  end else begin
   Trouble('Could not run: '+cmd+EOL+'SMI FSM monitor failed.');
   StopMonitoring;
  end;
 except
  on E:Exception do BugReport(E,Self,'StartMonitoring');
 end;
end;

procedure TSmiGenGui.StopMonitoring;
var tid,pid,cod:Integer;
begin
 tid:=myMonObjectsTid;
 myMonObjectsTid:=0;
 myTimeTicks:=0;
 myLineCount:=0;
 if (tid&lt;&gt;0) then
 try
  RemoveMonitorObjects;
  Exec(tellMonObjectsExe,FormatVar(' %d',guiPID)+' exit/');
  if task_wait(tid,0) then task_kill(tid,1,0,500);
  if task_wait(tid,0) then task_kill(tid,0,0,0);
  cod:=task_result(tid);
  pid:=task_pid(tid);
  task_free(tid);
  Success(FormatVar('Stop[%d]',pid)+FormatVar(' with code %d',cod)+EOL+'SMI FSM monitor stopped.');
 except
  on E:Exception do BugReport(E,Self,'StopMonitoring');
 end;
end;

procedure TSmiGenGui.PollMonitoring;
var tid,i:Integer; lines:String;
begin
 tid:=myMonObjectsTid;
 if (tid&lt;&gt;0) then
 try
  if task_wait(tid,0) then begin
   if task_rxcount(tid)&gt;0 then begin
    lines:=task_recv(tid,MaxInt);
    if (Length(lines)&gt;0) then StringsAppendFromText(MonitorOut,lines);
    for i:=0 to MonitorOut.Count-1 do MonitorReader(MonitorOut.Strings[i]);
   end;
  end;
 except
  on E:Exception do BugReport(E,Self,'PollMonitoring');
 end;
end;

procedure TSmiGenGui.MonitorReader(inString:String);
var inTime,inType,inName,inState,inAction,line,pars:String;
    i,nState,nAction,nPars,iObj:Integer; tuple:TSmiObjectTuple;
begin
 if (Length(inString)&gt;0) then
 try
  myLineCount:=myLineCount+1;
  InStringList.Text:=StringReplace(inString,'/',EOL,rfReplaceAll);
  try
   inState:=''; inAction:='';
   nState:=0; nAction:=0; nPars:=0;
   inTime:=StrLineFetch(InStringList,0);
   inType:=StrLineFetch(InStringList,1);
   inName:=StrLineFetch(InStringList,2);
   // Handle *time-tick
   if SameText(inType,'*time-tick') then begin
    HandleTimeTick;
   end else
   // Handle *object
   if SameText(inType,'*object') then begin
    iObj:=ObjectList.IndexOf(inName);
    if (iObj&gt;=0) then
    if (ObjectList.Objects[iObj] is TSmiObjectTuple) then begin
     tuple:=TSmiObjectTuple(ObjectList.Objects[iObj]);
     for i:=3 to InStringList.Count-1 do begin
      line:=StrLineFetch(InStringList,i);
      if SameText(line,'*state') then begin
       if (nState=0) then begin
        inState:=StrLineFetch(InStringList,i+1);
        tuple.StateName:=inState;
        tuple.ParamsList.Clear;
        tuple.ActionList.Clear;
        tuple.ActionPara.Clear;
       end;
       nState:=nState+1;
      end else
      if SameText(line,'*end_state') then begin
       nState:=nState-1;
      end else
      if SameText(line,'*action') then begin
       if (nAction=0) then begin
        inAction:=StrLineFetch(InStringList,i+1);
        tuple.ActionListAdd(inAction);
       end;
       nAction:=nAction+1;
      end else
      if SameText(line,'*end_action') then begin
       inAction:='';
       nAction:=nAction-1;
      end else
      if SameText(line,'*pars') then begin
       nPars:=nPars+1;
      end;
      if SameText(line,'*end_pars') then begin
       nPars:=nPars-1;
      end else
      if (line&lt;&gt;'') and (StrFetch(line,1)&lt;&gt;'*') then begin
       if (nState=1) and (nAction=0) and (nPars=1) then tuple.ParamsListAdd(line);
       if (nState=0) and (nAction=1) and (nPars=1) then tuple.ActionParaAdd(inAction,line);
      end;
     end;
    end;
    if (tuple.ParamsList.Count&gt;0) then begin
     pars:=StringReplace(tuple.ParamsList.Text,EOL,'/',rfReplaceAll);
     UpdateObjectObjectParameters(nil,tuple.ObjectName,tuple.StateName,pars);
    end;
    if (nPars&lt;&gt;0) then Trouble(FormatVar('MonitorReader : Unbalanced *pars |%d|',nPars));
    if (nState&lt;&gt;0) then Trouble(FormatVar('MonitorReader : Unbalanced *state |%d|',nState));
    if (nAction&lt;&gt;0) then Trouble(FormatVar('MonitorReader : Unbalanced *action |%d|',nAction));
   end else
   Trouble(FormatVar('MonitorReader : Unknown Type |%s|',inType));
  finally
   InStringList.Clear;
  end;
 except
  on E:Exception do BugReport(E,Self,'MonitorReader');
 end;
end;

function DecodeColor(s:String):TColor; // #RRGGBB
var r,g,b:Integer;
begin
 r:=StrToIntDef('$'+Copy(s,2,2),0);
 g:=StrToIntDef('$'+Copy(s,4,2),0);
 b:=StrToIntDef('$'+Copy(s,6,2),0);
 Result:=RgbToColor(r,g,b);
end;

function TSmiGenGui.GetStateColor(ObjectName,StateName:String; Def:TColor):TColor;
var lhcbgreen,lhcbblue,lhcbyellow,lhcborange,lhcbred,lhcbsilver:TColor; i:Integer;
 procedure AddColor(id:String; col:TColor);
 begin
  StateColList.AddObject(id,TObject(col));
 end;
begin
 Result:=Def;
 if StateColList.Count=0 then begin
  StateColList.Sorted:=true;
  lhcbgreen  := DecodeColor('#00CC99');
  lhcbblue   := DecodeColor('#0099FF');
  lhcbyellow := DecodeColor('#FFFF66');
  lhcborange := DecodeColor('#FF9900');
  lhcbred    := DecodeColor('#FF0000');
  lhcbsilver := clSilver;
  AddColor('UNKNOWN',     lhcborange );
  AddColor('NOT_READY',   lhcbyellow );
  AddColor('READY',       lhcbblue   );
  AddColor('RUNNING',     lhcbgreen  );
  AddColor('OFF',         lhcbblue   );
  AddColor('ON',          lhcbgreen  );
  AddColor('ERROR',       lhcbred    );
  AddColor('PAUSED',      lhcbblue   );
  AddColor('CONFIGURING', lhcbyellow );
  AddColor('RAMPING',     lhcborange );
  AddColor('STANBY',      lhcbblue   );
  AddColor('EMERGENCY',   lhcbred    );
  AddColor('&amp;BUSY',       lhcbyellow );
  AddColor('&amp;DEAD',       lhcbsilver );
  AddColor('BUSY',        lhcbyellow );
  AddColor('DEAD',        lhcbsilver );
 end;
 i:=StateColList.IndexOf(StateName);
 if (i&gt;=0) then Result:=TColor(StateColList.Objects[i]);
end;

procedure TSmiGenGui.Trouble(Msg:String);
begin
 LogEvents(Now,Msg);
end;

procedure TSmiGenGui.Success(Msg:String);
begin
 LogEvents(Now,Msg);
end;

procedure TSmiGenGui.SmiRunLog(When:Double; What:String);
begin
 if (MainForm&lt;&gt;nil) then MainForm.SmiRunLog(When,What);
end;

procedure TSmiGenGui.SmlLog(When:Double; What:String);
begin
 if (MainForm&lt;&gt;nil) then MainForm.LogSml(When,What);
end;

function TSmiGenGui.IsMonitoring:Boolean;
begin
 Result:=(myMonObjectsTid&lt;&gt;0);
end;

function TSmiGenGui.IsMonitorRunning:Boolean;
begin
 Result:=(myMonObjectsTid&lt;&gt;0) and task_wait(myMonObjectsTid,0);
end;

procedure TSmiGenGui.HandleTimeTick;
begin
 myTimeTicks:=myTimeTicks+1;
end;

procedure TSmiGenGui.RunWebBrowser(url:String);
begin
 url:=Trim(url);
 if (url='') then Exit;
 url:=ValidatePathName(url,8);
 if (CRW_DAQ_SYS_EXE_PID&lt;&gt;0) then begin
  MainForm.PostCommandToCrwDaq('@run WebBrowser '+url);
 end else begin
  if IsWindows
  then Exec('grun','-7 unix start "WebBrowser" '+url,-1)
  else Exec('firefox',url,-1);
 end;
end;

procedure TSmiGenGui.RunPdfViewer(url:String);
begin
 url:=Trim(url);
 if (url='') then Exit;
 url:=ValidatePathName(url,8);
 if (CRW_DAQ_SYS_EXE_PID&lt;&gt;0) then begin
  MainForm.PostCommandToCrwDaq('@run PdfViewer '+url);
 end else begin
  if IsWindows
  then Exec('grun','-7 unix start "PdfViewer" '+url,-1)
  else Exec('fly-open','-e '+url,-1);
 end;
end;

procedure TSmiGenGui.RunSmiGuiTcl;
var url:String;
begin
 url:=getSmiGuiTcl;
 url:=Trim(url);
 if (url='') then Exit;
 url:=ValidatePathName(url,8);
 if (CRW_DAQ_SYS_EXE_PID&lt;&gt;0) then begin
  MainForm.PostCommandToCrwDaq('@run -sw7 unix start "TclScript" '+url);
 end  else begin
  if IsWindows
  then Exec('grun','-7 unix start "TclScript" '+url,-1)
  else Exec(url,'',-1);
 end;
end;

procedure TSmiGenGui.RunDimTree;
var url:String;
begin
 url:=DimSiteFile('dim/bin/DIMTree.exe');
 url:=Trim(url);
 if (url='') then Exit;
 url:=ValidatePathName(url,8);
 if (CRW_DAQ_SYS_EXE_PID&lt;&gt;0) then begin
  MainForm.PostCommandToCrwDaq('@run '+url);
 end else begin
  if IsWindows
  then Exec('grun',url,-1)
  else Exec('wine',url,-1);
 end;
end;

procedure TSmiGenGui.BrowseHelp;
begin
 RunWebBrowser(SmiSiteFile('readme.htm'));
end;

procedure TSmiGenGui.BrowseSite;
begin
 RunWebBrowser('http://smi.web.cern.ch');
end;

function TSmiGenGui.ListSmiCommands(Mode:Integer=3):String;
var List:TStringList; path:String;
 procedure ListAdd(line:String);
 var i:Integer; item:String;
 begin
  for i:=1 to WordCount(line,' ') do begin
   item:=ExtractWord(i,line,' ');
   if (FileSearch(item,path,false)&lt;&gt;'')
   or (IsWindows and (FileSearch(item+'.exe',path,false)&lt;&gt;'')) then
   if (List.IndexOf(item)&lt;0) then List.Add(item);
  end;
 end;
begin
 List:=TStringList.Create;
 try
  path:=SearchPath;
  try
   List.Sorted:=true;
   // DIM commands
   if HasFlags(Mode,1) then begin
    ListAdd('checkDimServers DimBridge dim_get_service_names testClient');
    ListAdd('checkDns dim_get_services dimtree test_server did testServer');
    ListAdd('dim_send_command webDid dimStat dim_get_service dns test_client');
    ListAdd('dimstatgui.desktop dns-exec.desktop webdid-stop.desktop');
    ListAdd('dim-cpl.desktop dns-stop.desktop dimmonitor.desktop dimtree.desktop');
    ListAdd('did-exec.desktop did-stop.desktop webdid-exec.desktop');
   end;
   // SMI Commands
   if HasFlags(Mode,2) then begin
    ListAdd('getObjectState monObjectState smi_change_option smiKill smiTrans');
    ListAdd('dnsDebugging getDimVersions getSetObjects smiChangeOption smiPreproc');
    ListAdd('dnsExists getDomainObjects getSmiVersions listDomain proxyExists');
    ListAdd('smiGen smi_send_command tclTkGUI-Builder shellcmd smiGUI.tcl smiSM');
    ListAdd('dnsRunning getDomainObjectSets monObjects smiGUI smiSendCommand');
    ListAdd('tellMonObjects domainExists getDomains monObjectsServiceName');
   end;
   Result:=List.Text;
  finally
   List.Free;
  end;
 except
  on E:Exception do BugReport(E,nil,'ListSmiCommands');
 end;
end;

function TSmiGenGui.ValidatePathName(arg:String; Mode:Integer=7):String;
begin
 if HasFlags(Mode,1) then arg:=Trim(arg);
 if HasFlags(Mode,2) and (arg&lt;&gt;'') and (PathDelim&lt;&gt;'\')
 then arg:=StringReplace(arg,'\',PathDelim,rfReplaceAll);
 if HasFlags(Mode,2) and (arg&lt;&gt;'') and (PathDelim&lt;&gt;'/')
 then arg:=StringReplace(arg,'/',PathDelim,rfReplaceAll);
 if HasFlags(Mode,4) and IsUnix then arg:=LowerCase(arg);
 if HasFlags(Mode,8) and IsWindows then arg:=QuotedIfNeeded(arg);
 Result:=arg;
end;

function TSmiGenGui.ListSmiSmlSamples:String;
var List:TStringList; i:Integer; SmlSamples,SamplesDir,cmd,exe,arg,ans:String;
 procedure CopyIt(Src,Dst:String);
 begin
  Src:=ValidatePathName(Src);
  Dst:=ValidatePathName(Dst);
  if (Src&lt;&gt;'') and (Dst&lt;&gt;'') and FileExists(Src) then begin
   if DirectoryExists(Dst)
   then Dst:=AddPathDelim(Dst)+ExtractFileName(Src);
   if XCopyFile(Src,Dst)
   then LogEvents(Now,'Succeed Copy '+Src+' =&gt; '+Dst)
   else LogEvents(Now,'Fail on Copy '+Src+' =&gt; '+Dst);
  end;
 end;
begin
 Result:='';
 try
  List:=TStringList.Create;
  try
   ans:='';
   if (CRW_DAQ_SYS_HOME_DIR&lt;&gt;'') then begin
    Result:=Result+CRW_DAQ_SYS_HOME_DIR+'\Demo\DEMO_SMITEST\Config\test.sml'+EOL;
    Result:=Result+CRW_DAQ_SYS_HOME_DIR+'\Demo\DEMO_SMITEST\Config\run_con.sml'+EOL;
   end;
   //////////////////////////////
   List.Clear; //////////////////
   SamplesDir:=SmiDataSamplesDir;
   SmlSamples:=SmiSiteFile('sml_samples');
   GetFileList(SmlSamples,'*.sml',List);
   for i:=0 to List.Count-1 do begin
    CopyIt(AddPathDelim(SmlSamples)+List.Strings[i],SamplesDir);
   end;
   CopyIt(SmiSiteFile('smi\src\examples\run_control\run_con.sml'),SamplesDir);
   CopyIt(SmiSiteFile('smi\src\examples\run_control\test_whens.sml'),SamplesDir);
   /////////////////////////////////////
   List.Clear; /////////////////////////
   GetFileList(SamplesDir,'*.sml',List);
   for i:=0 to List.Count-1 do begin
    if IsEmptyStr(ExtractFilePath(List.Strings[i]))
    then List.Strings[i]:=AddPathDelim(SamplesDir)+List.Strings[i];
    exe:=FileSearch('unix.exe',GetEnv('PATH'),false);
    arg:='fixeol '+ValidatePathName(List.Strings[i],1+2+8);
    cmd:=ComposeCmd(exe,arg);
    ans:=Exec(exe,arg);
    LogEvents(Now,Trim(cmd+EOL+ans));
   end;
   Result:=Result+List.Text;
  finally
   List.Free;
  end;
  Result:=ValidatePathName(Result);
 except
  on E:Exception do BugReport(E,Self,'ListSmiSmlSamples');
 end;
end;

function TSmiGenGui.SmiDataDir(SubDir:String):String;
var dir,appdir:String;
begin
 Result:='';
 try
  //if (CRW_DAQ_SYS_HOME_DIR&lt;&gt;'') then begin
  // dir:=ValidatePathName(CRW_DAQ_SYS_HOME_DIR+'\Demo\DEMO_SMITEST\Config');
  // if DirectoryExists(dir) then Result:=dir;
  //end;
  appdir:=GetAppDataDir(false,true);
  if (Result='') and (appdir&lt;&gt;'') and (SubDir&lt;&gt;'') then begin
   dir:=AddPathDelim(appdir)+SubDir;
   if not DirectoryExists(dir) then
   if MakeDir(dir) then LogEvents(Now,'MkDir '+dir);
   Result:=dir;
  end;
  if (Result='') and (appdir&lt;&gt;'') then Result:=appdir;
  Result:=ValidatePathName(Result);
 except
  on E:Exception do BugReport(E,Self,'SmiSmlDataDir');
 end;
end;

function TSmiGenGui.SmiDataSamplesDir:String;
begin
 Result:=SmiDataDir('samples');
end;

function TSmiGenGui.SmiDataLogDir:String;
begin
 Result:=SmiDataDir('log');
end;

function TSmiGenGui.RunLister(aFile:String):String;
begin
 Result:='';
 try
  if IsWindows
  then Result:=Exec('grun','-7 unix start "Lister" lister '+QuotedIfNeeded(aFile),-1)
  else Result:=Exec('okular',aFile,-1);
 except
  on E:Exception do BugReport(E,Self,'RunLister');
 end;
end;

function TSmiGenGui.RunTextEditor(aFile,aEditor:String):String;
begin
 Result:='';
 if not IsEmptyStr(aEditor) then
 try
  if IsWindows
  then Result:=Exec('grun','-7 unix start "Editor" '+aEditor+' '+QuotedIfNeeded(aFile),-1)
  else Result:=Exec(aEditor,aFile,-1);
 except
  on E:Exception do BugReport(E,Self,'RunTextEditor');
 end;
end;

function TSmiGenGui.RunTextViewer(aFile,aViewer:String):String;
begin
 Result:='';
 if not IsEmptyStr(aViewer) then
 try
  if IsWindows
  then Result:=Exec('grun','-7 unix start "Viewer" '+aViewer+' '+QuotedIfNeeded(aFile),-1)
  else Result:=Exec(aViewer,aFile,-1);
 except
  on E:Exception do BugReport(E,Self,'RunTextViewer');
 end;
end;

function TSmiGenGui.ListTextEditors:String;
var i:Integer; Editor,Editors:String;
begin
 Result:=''; Editors:='';
 if IsUnix then Editors:='kate geany atom';
 if IsWindows then Editors:='notepad akelpad notepad++';
 for i:=1 to WordCount(Editors,' ') do begin
  Editor:=ExtractWord(i,Editors,' ');
  if (FileSearch(Editor,GetEnv('PATH'),false)&lt;&gt;'') or IsWindows
  then Result:=Result+Editor+EOL;
 end;
end;

function TSmiGenGui.ListTextViewers:String;
var i:Integer; Viewer,Viewers:String;
begin
 Result:=''; Viewers:='';
 if IsUnix then Viewers:='okular evince cr3 firefox gv mupdf qpdfview';
 if IsWindows then Viewers:='lister wintail LogViewer TxtViewer WebViewer HtmViewer';
 for i:=1 to WordCount(Viewers,' ') do begin
  Viewer:=ExtractWord(i,Viewers,' ');
  if (FileSearch(Viewer,GetEnv('PATH'),false)&lt;&gt;'') or IsWindows
  then Result:=Result+Viewer+EOL;
 end;
 if IsUnix then Result:=Result+'xterm -hold -e tail -f'+EOL;
 if IsUnix then Result:=Result+'xterm -e tail -f'+EOL;
 if IsWindows then Result:=Result+'unix tail -f'+EOL;
end;

function TSmiGenGui.XCopyFile(src,dst:String):Boolean;
var exe,arg,cmd,ans:String;
begin
 Result:=false;
 if not IsEmptyStr(src) then
 if not IsEmptyStr(dst) then
 try
  cmd:=''; exe:=''; arg:=''; ans:='';
  src:=ValidatePathName(src,1+2);
  dst:=ValidatePathName(dst,1+2);
  if not FileExists(src) then begin
   LogEvents(Now,'File not found: '+src);
   Exit;
  end;
  if IsUnix then begin
   exe:=FileSearch('cp',GetEnv('PATH'),false);
   arg:='-u '+src+' '+dst;
  end;
  if IsWindows then begin
   src:=ValidatePathName(src,8);
   dst:=ValidatePathName(dst,8);
   exe:='xcopy';
   arg:='/D /V /C /H /F /Y '+src+' '+dst;
  end;
  cmd:=ComposeCmd(exe,arg);
  ans:=Exec(exe,arg,0,0,'',WinApi.GetOEMCP);
  Result:=not IsEmptyStr(arg);
  LogEvents(Now,Trim(cmd+EOL+ans));
 except
  on E:Exception do BugReport(E,Self,'FileCopyUpdate');
 end;
end;

function TSmiGenGui.ListFonts(Filter:String):String;
var List:TStringList; i:Integer; Item:String;
begin
 Result:='';
 try
  List:=TStringList.Create;
  List.Sorted:=true;
  try
   Filter:=UpperCase(Trim(Filter));
   for i:=0 to Screen.Fonts.Count-1 do begin
    Item:=Trim(Screen.Fonts.Strings[i]);
    if (Filter='') or (Pos(Filter,UpperCase(Item))&gt;0)
    then List.Add(Item);
   end;
   Result:=List.Text;
  finally
   List.Free;
  end;
 except
  on E:Exception do BugReport(E,Self,'ListFonts');
 end;
end;

procedure TSmiGenGui.ApplyXTermFont(var exe,arg:String);
var fa,fs:String;
begin
 if (MainForm=nil) then Exit;
 if (WordCount(exe,' ')&gt;1) then Exit;
 if not SameText(ExtractFileName(exe),'xterm') then Exit;
 fa:=Trim(MainForm.ComboBoxXTermFontName.Text); if (fa&lt;&gt;'') then fa:='-fa '+QuotedIfNeeded(fa,'''',true);
 fs:=Trim(MainForm.ComboBoxXTermFontSize.Text); if (fs&lt;&gt;'') then fs:='-fs '+fs;
 arg:=Trim(fa+' '+fs+' '+arg);
end;

 /////////////////////////////////
 // TSmiObjectTuple implementation
 /////////////////////////////////

constructor TSmiObjectTuple.Create(aObjectName:String);
begin
 inherited Create;
 myObjectName:=aObjectName;
 myPanelSheet:=nil;
 myLabelTitle:=nil;
 myPanelState:=nil;
 myPanelQuery:=nil;
 myParamsList:=TStringList.Create;
 myActionList:=TStringList.Create;
 myActionPara:=TStringList.Create;
 InitControls;
end;

destructor TSmiObjectTuple.Destroy;
begin
 FreeControls;
 myObjectName:='';
 myParamsList.Free;
 myActionList.Free;
 myActionPara.Free;
 inherited Destroy;
end;

procedure TSmiObjectTuple.FreeControls;
begin
 myObjectName:='';
 myParamsList.Clear;
 myActionList.Clear;
 myActionPara.Clear;
 if (myPanelQuery&lt;&gt;nil) then begin myPanelQuery.Free; myPanelQuery:=nil; end;
 if (myPanelState&lt;&gt;nil) then begin myPanelState.Free; myPanelState:=nil; end;
 if (myLabelTitle&lt;&gt;nil) then begin myLabelTitle.Free; myLabelTitle:=nil; end;
 if (myPanelSheet&lt;&gt;nil) then begin myPanelSheet.Free; myPanelSheet:=nil; end;
end;

procedure TSmiObjectTuple.InitControls;
const qWidth=30;
begin
 if (SmiGenGui.ScrollBox=nil) then Exit;
 try
  // PanelSheet
  myPanelSheet:=TPanel.Create(SmiGenGui.ScrollBox.Owner);
  PanelSheet.Parent:=SmiGenGui.ScrollBox;
  PanelSheet.BevelInner:=bvLowered;
  PanelSheet.Caption:='';
  UpdatePanelPosition;
  // LabelTitle
  myLabelTitle:=TLabel.Create(SmiGenGui.ScrollBox.Owner);
  LabelTitle.Parent:=PanelSheet;
  LabelTitle.Top:=4;
  LabelTitle.Left:=8;
  LabelTitle.Caption:=ObjectName;
  LabelTitle.Font.Style:=LabelTitle.Font.Style+[fsBold];
  LabelTitle.Font.Size:=14;
  LabelTitle.Cursor:=crHandPoint;
  LabelTitle.OnClick:=@OnLabelTitleClick;
  LabelTitle.Hint:='Name of SMI FSM Object.'+EOL+'Click to view Params.';
  // PanelState
  myPanelState:=TPanel.Create(SmiGenGui.ScrollBox.Owner);
  PanelState.Parent:=PanelSheet;
  PanelState.BevelInner:=bvLowered;
  PanelState.Top:=2;
  PanelState.Left:=(PanelSheet.Width div 2)+4;
  PanelState.Width:=(PanelSheet.Width div 2)-qWidth-8;
  PanelState.Height:=PanelSheet.Height-4;
  PanelState.Caption:='DEAD';
  PanelState.Color:=clBtnFace;
  PanelState.Font.Style:=PanelState.Font.Style+[fsBold];
  PanelState.Font.Size:=14;
  PanelState.Color:=clBtnFace;
  PanelState.Cursor:=crHandPoint;
  PanelState.OnClick:=@OnPanelStateClick;
  PanelState.Hint:='State of SMI FSM Object.'+EOL+'Click to call Actions.';
  // PanelQuery
  myPanelQuery:=TPanel.Create(SmiGenGui.ScrollBox.Owner);
  PanelQuery.Parent:=PanelSheet;
  PanelQuery.BevelInner:=bvLowered;
  PanelQuery.Top:=2;
  PanelQuery.Left:=(PanelState.Left+PanelState.Width)+2;
  PanelQuery.Width:=qWidth;
  PanelQuery.Height:=PanelSheet.Height-4;
  PanelQuery.Caption:='?';
  PanelQuery.Color:=clBtnFace;
  PanelQuery.Font.Style:=PanelQuery.Font.Style+[fsBold];
  PanelQuery.Font.Size:=14;
  PanelQuery.Color:=clBtnFace;
  PanelQuery.Cursor:=crHandPoint;
  PanelQuery.OnClick:=@OnPanelQueryClick;
  PanelQuery.Hint:='View SMI FSM Object Properties.';
 except
  on E:Exception do BugReport(E,Self,'InitControls');
 end;
end;

function  TSmiObjectTuple.GetStateName:String;
begin
 Result:='';
 if (Self=nil) then Exit;
 if (LabelTitle=nil) then Exit;
 Result:=PanelState.Caption;
end;

procedure  TSmiObjectTuple.SetStateName(aStateName:String);
begin
 if (Self=nil) then Exit;
 if (LabelTitle=nil) then Exit;
 PanelState.Caption:=Trim(aStateName);
 PanelState.Color:=SmiGenGui.GetStateColor(ObjectName,StateName,clBtnFace);
end;

procedure TSmiObjectTuple.ParamsListAdd(line:String);
begin
 if (Self=nil) then Exit;
 line:=Trim(line); if (line='') then Exit;
 if (Pos('=',line)&lt;2) then Exit;
 ParamsList.Add(line);
end;

procedure TSmiObjectTuple.ActionListAdd(line:String);
begin
 if (Self=nil) then Exit;
 line:=Trim(line); if (line='') then Exit;
 ActionList.Add(line);
end;

procedure TSmiObjectTuple.ActionParaAdd(action,line:String);
var pars:String;
begin
 if (Self=nil) then Exit;
 line:=Trim(line); if (line='') then Exit;
 action:=Trim(action); if (action='') then Exit;
 pars:=ActionPara.Values[action];
 if (pars='') then pars:=line else pars:=pars+'/'+line;
 ActionPara.Values[action]:=pars;
end;

procedure TSmiObjectTuple.UpdatePanelPosition;
var Index:Integer;
begin
 if (Self=nil) then Exit;
 if (PanelSheet=nil) then Exit;
 try
  Index:=SmiGenGui.ObjectList.IndexOf(ObjectName);
  PanelSheet.Left:=8;
  PanelSheet.Width:=700;
  PanelSheet.Height:=30;
  PanelSheet.Top:=8+Index*(PanelSheet.Height+2);
 except
  on E:Exception do BugReport(E,Self,'UpdatePanelPosition');
 end;
end;

function TSmiObjectTuple.FindTuple(Sender: TObject):TSmiObjectTuple;
var i:Integer; tuple:TSmiObjectTuple;
begin
 Result:=nil;
 if (Self=nil) then Exit;
 if (Sender=nil) then Exit;
 for i:=0 to SmiGenGui.ObjectList.Count-1 do begin
  if not (SmiGenGui.ObjectList.Objects[i] is TSmiObjectTuple) then continue;
  tuple:=TSmiObjectTuple(SmiGenGui.ObjectList.Objects[i]);
  if (Sender=tuple.PanelSheet) then Result:=tuple;
  if (Sender=tuple.LabelTitle) then Result:=tuple;
  if (Sender=tuple.PanelState) then Result:=tuple;
  if (Sender=tuple.PanelQuery) then Result:=tuple;
  if (Result&lt;&gt;nil) then break;
 end;
end;

procedure TSmiObjectTuple.OnLabelTitleClick(Sender: TObject);
var tuple:TSmiObjectTuple;
begin
 try
  tuple:=FindTuple(Sender);
  if (tuple=nil) then Exit;
  if (tuple.ParamsList.Count=0) then begin
   ShowMessage(FormatVar('SMI Object %s Has No Parameters.',tuple.ObjectName));
   Exit;
  end;
  InitFormSmiObjectParameters(tuple.ObjectName);
  UpdateObjectObjectParameters(tuple.LabelTitle,tuple.ObjectName,tuple.StateName,tuple.ParamsSlashList)
 except
  on E:Exception do BugReport(E,Self,'OnLabelTitleClick');
 end;
end;

procedure TSmiObjectTuple.OnPanelQueryClick(Sender: TObject);
var tuple:TSmiObjectTuple;
begin
 try
  tuple:=FindTuple(Sender);
  if (tuple=nil) then Exit;
  ShowMessage(tuple.Description);
 except
  on E:Exception do BugReport(E,Self,'OnPanelQueryClick');
 end;
end;

procedure TSmiObjectTuple.OnPanelStateClick(Sender: TObject);
var tuple:TSmiObjectTuple; action:String;
begin
 try
  tuple:=FindTuple(Sender);
  if (tuple=nil) then Exit;
  if (tuple.ActionList.Count=0) then begin
   ShowMessage(FormatVar('SMI Object %s Has No Actions for State '+tuple.StateName,tuple.ObjectName));
   Exit;
  end;
  if (FormSmiActionSelector=nil) then begin
   InitFormSmiActionSelector;
   if (FormSmiActionSelector&lt;&gt;nil) then
   FormSmiActionSelector.Width:=tuple.PanelState.Width-8;
  end;
  action:=Trim(SmiActionSelector(tuple.PanelState,tuple.ObjectName,tuple.StateName,tuple.ActionList.Text));
  if (action&lt;&gt;'') then tuple.ApplyAction(action);
 except
  on E:Exception do BugReport(E,Self,'OnStateClick');
 end;
end;

function TSmiObjectTuple.GetParamsForAction(Action:String):String;
var Params:String;
begin
 Result:='';
 if (Self=nil) then Exit;
 action:=Trim(action); if (action='') then Exit;
 Params:=ActionPara.Values[Action];
 if (Params='') then Exit;
 if (FormSmiActionParameters=nil) then begin
  InitFormSmiActionParameters;
  if (FormSmiActionParameters&lt;&gt;nil) then
  FormSmiActionParameters.Width:=PanelState.Width-8;
 end;
 Params:=Trim(EditSmiActionParameters(PanelState,ObjectName,StateName,Action,Params));
 Result:=Params;
end;

procedure TSmiObjectTuple.ApplyAction(action:String);
var params:String;
begin
 try
  params:=GetParamsForAction(action);
  if (ActionPara.Values[Action]&lt;&gt;'') and (params='') then Exit;
  LogEvents(Now,'Action '+ObjectName+'/'+action);
  SmiGenGui.DispatchAction(ObjectName,action,params);
 except
  on E:Exception do BugReport(E,Self,'ApplyAction');
 end;
end;

function TSmiObjectTuple.ParamsSlashList:String;
begin
 Result:=StringReplace(Trim(ParamsList.Text),EOL,'/',rfReplaceAll);
end;

function TSmiObjectTuple.Description:String;
var List:TStringList; i:Integer; action:String;
begin
 Result:='';
 try
  List:=TStringList.Create;
  try
   List.Add('Object: '+ObjectName);
   List.Add('State:  '+StateName);
   List.Add('Params: '+ParamsSlashList);
   for i:=0 to ActionList.Count-1 do begin
    action:=ActionList.Strings[i];
    if (Trim(ActionPara.Values[action])&lt;&gt;'') then
    action:=action+' Params '+Trim(ActionPara.Values[action]);
    List.Add('Action: '+action);
   end;
   Result:=List.Text;
  finally
   List.Free;
  end;
 except
  on E:Exception do BugReport(E,Self,'Description');
 end;
end;

end.
</Code>
        </dpSmiGenGui>
        <Main ImageIndex="1">
          <Object ClassName="TMainForm">object MainForm: TForm
  Left = 267
  Height = 620
  Top = 127
  Width = 800
  BorderWidth = 4
  Caption = 'MainForm'
  ClientHeight = 620
  ClientWidth = 800
  Constraints.MinHeight = 620
  Constraints.MinWidth = 800
  Font.CharSet = RUSSIAN_CHARSET
  Font.Color = clBlack
  Font.Height = -13
  Font.Name = 'PT Mono'
  Font.Pitch = fpFixed
  Font.Quality = fqDraft
  OnCreate = FormCreate
  OnDestroy = FormDestroy
  OnResize = FormResize
  ShowHint = True
  LCLVersion = '2.2.6.0'
  object PanelMain: TPanel
    Left = 4
    Height = 612
    Top = 4
    Width = 792
    Align = alClient
    BorderWidth = 4
    ClientHeight = 612
    ClientWidth = 792
    TabOrder = 0
    object PageControlMain: TPageControl
      Left = 5
      Height = 602
      Top = 5
      Width = 782
      ActivePage = TabSheetSmiHelp
      Align = alClient
      Images = DataModuleGuiResMain.ImageListMain32x32
      TabIndex = 6
      TabOrder = 0
      object TabSheetSmi: TTabSheet
        Caption = ' SMI '
        ClientHeight = 558
        ClientWidth = 772
        ImageIndex = 228
        object PanelSmiContent: TPanel
          Left = 0
          Height = 504
          Top = 54
          Width = 772
          Align = alClient
          BorderWidth = 4
          ClientHeight = 504
          ClientWidth = 772
          TabOrder = 0
          object GroupBoxSmiDomains: TGroupBox
            Left = 5
            Height = 417
            Top = 82
            Width = 762
            Align = alClient
            Caption = 'Domains and Objects'
            ClientHeight = 415
            ClientWidth = 760
            TabOrder = 0
            object LabelSmiDomainList: TLabel
              Left = 8
              Height = 15
              Top = 0
              Width = 96
              Caption = 'Domain List:'
              ParentColor = False
            end
            object ListBoxSmiDomainList: TListBox
              Left = 4
              Height = 370
              Top = 20
              Width = 164
              Anchors = [akTop, akLeft, akBottom]
              ItemHeight = 0
              OnClick = ListBoxDomainListClick
              Sorted = True
              TabOrder = 0
              TopIndex = -1
            end
            object LabelSmiDomainHost: TLabel
              Left = 4
              Height = 15
              Top = 394
              Width = 40
              Anchors = [akLeft, akBottom]
              Caption = 'Host:'
              ParentColor = False
            end
            object ListBoxSmiDomObjList: TListBox
              Left = 172
              Height = 370
              Top = 20
              Width = 244
              Anchors = [akTop, akLeft, akBottom]
              ItemHeight = 0
              MultiSelect = True
              Sorted = True
              TabOrder = 1
              TopIndex = -1
            end
            object LabelSmiDomObjList: TLabel
              Left = 176
              Height = 15
              Top = 0
              Width = 88
              Caption = 'ObjectList:'
              ParentColor = False
            end
            object BitBtnSmiSelObjSelect: TBitBtn
              Left = 420
              Height = 70
              Hint = 'Select objects, i.e. copy selection from ObjectList to SelectedObjects list.'
              Top = 104
              Width = 63
              Caption = 'Select'
              Layout = blGlyphTop
              Images = DataModuleGuiResMain.ImageListMain32x32
              ImageIndex = 14
              OnClick = BitBtnSelObjSelectClick
              TabOrder = 2
            end
            object ListBoxSmiSelObjList: TListBox
              Left = 488
              Height = 390
              Top = 20
              Width = 244
              Anchors = [akTop, akLeft, akRight, akBottom]
              ItemHeight = 0
              TabOrder = 3
              TopIndex = -1
            end
            object LabelSmiSelObjList: TLabel
              Left = 492
              Height = 15
              Top = 0
              Width = 136
              Caption = 'Selected Objects:'
              ParentColor = False
            end
            object BitBtnSmiSelObjListMoveUp: TBitBtn
              Left = 436
              Height = 62
              Hint = 'Move selected object Up.'
              Top = 36
              Width = 43
              Caption = 'Up'
              Layout = blGlyphTop
              Images = DataModuleGuiResMain.ImageListMain32x32
              ImageIndex = 61
              OnClick = BitBtnSelObjListMoveUpClick
              TabOrder = 4
            end
            object BitBtnSmiSelObjListMoveDown: TBitBtn
              Left = 436
              Height = 62
              Hint = 'Move selected object Down.'
              Top = 180
              Width = 43
              Caption = 'Down'
              Layout = blGlyphBottom
              Images = DataModuleGuiResMain.ImageListMain32x32
              ImageIndex = 62
              OnClick = BitBtnSelObjListMoveDownClick
              TabOrder = 5
            end
            object CheckBoxSmiDomObjListSkipAmp: TCheckBox
              Left = 364
              Height = 21
              Top = 0
              Width = 96
              Alignment = taLeftJustify
              BidiMode = bdRightToLeft
              Caption = 'Skip &amp;&amp;Obj'
              Checked = True
              ParentBidiMode = False
              State = cbChecked
              TabOrder = 6
            end
            object BitBtnSmiTclTkGui: TBitBtn
              Left = 420
              Height = 66
              Hint = 'Run Tcl/Tk SMI Generic GUI.'
              Top = 252
              Width = 63
              Caption = 'Tcl/Tk'
              Layout = blGlyphTop
              Images = DataModuleGuiResTools.ImageListTools32x32
              ImageIndex = 31
              OnClick = BitBtnSmiTclTkGuiClick
              TabOrder = 7
            end
            object BitBtnSmiRunDimTree: TBitBtn
              Left = 420
              Height = 66
              Top = 324
              Width = 63
              Caption = 'DIM Tree'
              Layout = blGlyphTop
              Images = DataModuleGuiResMain.ImageListMain32x32
              ImageIndex = 228
              OnClick = BitBtnSmiRunDimTreeClick
              TabOrder = 8
            end
          end
          object GroupBoxSmiDimDnsNode: TGroupBox
            Left = 5
            Height = 77
            Top = 5
            Width = 762
            Align = alTop
            Caption = 'DIM DNS NODE for connection'
            ClientHeight = 75
            ClientWidth = 760
            TabOrder = 1
            object ComboBoxSmiDimDnsNode: TComboBox
              Left = 4
              Height = 27
              Top = 0
              Width = 333
              ItemHeight = 0
              Items.Strings = (
                'localhost'
                '127.0.0.1'
              )
              TabOrder = 0
            end
            object LabelSmiDimDnsStatusTitle: TLabel
              Left = 13
              Height = 15
              Top = 32
              Width = 56
              Caption = 'Status:'
              ParentColor = False
            end
            object LabelSmiDimDnsStatusValue: TLabel
              Left = 85
              Height = 15
              Top = 32
              Width = 72
              Caption = 'UNDEFINED'
              ParentColor = False
            end
            object BitBtnSmiDimDnsRefresh: TBitBtn
              Left = 352
              Height = 58
              Hint = 'Refresh DNS.'#13#10'Stop SMI Monitoring.'#13#10'Clear Selected Objects.'#13#10'Rebuild SMI DomainList and ObjectList.'
              Top = -1
              Width = 175
              Caption = 'Refresh DNS'
              Images = DataModuleGuiResTools.ImageListTools48x48
              ImageIndex = 55
              OnClick = BitBtnDimDnsRefreshClick
              TabOrder = 1
            end
            object BitBtnSmiStartMonitoring: TBitBtn
              Left = 532
              Height = 58
              Hint = 'Start Monitoring of SMI FSM Selected Objects.'
              Top = 0
              Width = 203
              Caption = 'Start Monitor'
              Images = DataModuleGuiResTools.ImageListTools48x48
              ImageIndex = 173
              OnClick = BitBtnStartMonitoringClick
              TabOrder = 2
            end
          end
        end
        object PanelSmiTitle: TPanel
          Left = 0
          Height = 54
          Top = 0
          Width = 772
          Align = alTop
          ClientHeight = 54
          ClientWidth = 772
          TabOrder = 1
          object BitBtnSmiHelp: TBitBtn
            Left = 4
            Height = 46
            Hint = 'Browse SMI Help.'
            Top = 4
            Width = 99
            Caption = 'Help'
            Images = DataModuleGuiResTools.ImageListTools32x32
            ImageIndex = 31
            OnClick = BitBtnSmiHelpClick
            TabOrder = 0
          end
          object LabelSmiTitle: TLabel
            Left = 160
            Height = 15
            Top = 0
            Width = 120
            Caption = 'SMI Generic GUI'
            ParentColor = False
          end
          object BitBtnSmiWebSite: TBitBtn
            Left = 644
            Height = 46
            Hint = 'Browse SMI home Web site.'
            Top = 4
            Width = 99
            Caption = 'Site'
            Layout = blGlyphRight
            Images = DataModuleGuiResTools.ImageListTools32x32
            ImageIndex = 31
            OnClick = BitBtnSmiWebSiteClick
            TabOrder = 1
          end
        end
      end
      object TabSheetFsm: TTabSheet
        Caption = ' FSM '
        ClientHeight = 558
        ClientWidth = 772
        ImageIndex = 164
        object PanelFsmButtons: TPanel
          Left = 0
          Height = 50
          Top = 508
          Width = 772
          Align = alBottom
          BorderWidth = 4
          TabOrder = 0
        end
        object PanelFsmMonitor: TPanel
          Left = 0
          Height = 508
          Top = 0
          Width = 772
          Align = alClient
          BorderWidth = 4
          ClientHeight = 508
          ClientWidth = 772
          TabOrder = 1
          object LabelFsmMonitor: TLabel
            Left = 5
            Height = 15
            Top = 5
            Width = 762
            Align = alTop
            Caption = 'SMI FSM Monitor:'
            ParentColor = False
          end
          object ScrollBoxFsmObjectList: TScrollBox
            Left = 5
            Height = 466
            Top = 20
            Width = 762
            HorzScrollBar.Page = 1
            VertScrollBar.Page = 1
            Align = alClient
            TabOrder = 0
          end
          object StatusBarFsmObjectList: TStatusBar
            Left = 5
            Height = 17
            Top = 486
            Width = 762
            Panels = &lt;&gt;
          end
        end
      end
      object TabSheetMain: TTabSheet
        Caption = 'Out'
        ClientHeight = 558
        ClientWidth = 772
        ImageIndex = 165
        object PanelFsmOutContent: TPanel
          Left = 0
          Height = 492
          Top = 0
          Width = 772
          Align = alClient
          BorderWidth = 8
          ClientHeight = 492
          ClientWidth = 772
          TabOrder = 0
          object LabelFsmOut: TLabel
            Left = 9
            Height = 15
            Top = 9
            Width = 754
            Align = alTop
            Caption = 'SMI FSM monitor output:'
            ParentColor = False
          end
          object MemoFsmOut: TMemo
            Left = 9
            Height = 425
            Top = 24
            Width = 754
            Align = alClient
            Color = clInfoBk
            ReadOnly = True
            ScrollBars = ssAutoBoth
            TabOrder = 0
            WordWrap = False
          end
          object PanelFsmOutParams: TPanel
            Left = 9
            Height = 34
            Top = 449
            Width = 754
            Align = alBottom
            BevelOuter = bvNone
            BorderStyle = bsSingle
            ClientHeight = 32
            ClientWidth = 752
            TabOrder = 1
            object CheckBoxFsmOutPrint: TCheckBox
              Left = 12
              Height = 21
              Top = 4
              Width = 248
              Caption = 'Print SMI FSM monitor output'
              TabOrder = 0
            end
            object BitBtnFsmOutClear: TBitBtn
              Left = 468
              Height = 30
              Hint = 'Clear SMI monitor output.'
              Top = 0
              Width = 283
              Anchors = [akTop, akRight]
              Caption = 'Clear monitor output'
              Images = DataModuleGuiResMain.ImageListMain16x16
              ImageIndex = 47
              OnClick = BitBtnFsmOutClearClick
              TabOrder = 1
            end
          end
        end
        object PanelMainButtons: TPanel
          Left = 0
          Height = 66
          Top = 492
          Width = 772
          Align = alBottom
          BorderWidth = 8
          ClientHeight = 66
          ClientWidth = 772
          TabOrder = 1
          object LabeMainSendUserCmnd: TLabel
            Left = 8
            Height = 15
            Top = 11
            Width = 160
            Anchors = [akLeft, akBottom]
            Caption = 'User command to send'
            ParentColor = False
          end
          object EditMainSendUserCmnd: TEdit
            Left = 8
            Height = 27
            Hint = 'Input command to send to CRW-DAQ console.'
            Top = 23
            Width = 366
            Anchors = [akLeft, akRight, akBottom]
            TabOrder = 0
            Text = '@echo Hello, CRW-DAQ'
          end
          object BitBtnMainSendUserCmnd: TBitBtn
            Left = 382
            Height = 46
            Top = 12
            Width = 91
            Action = ActionMainSendUserCmnd
            Anchors = [akRight, akBottom]
            Images = DataModuleGuiResMain.ImageListMain32x32
            ImageIndex = 59
            TabOrder = 1
          end
          object BitBtnMainRunCrw32Ini: TBitBtn
            Left = 476
            Height = 46
            Top = 12
            Width = 91
            Action = ActionMainExecUserCmnd
            Anchors = [akRight, akBottom]
            Images = DataModuleGuiResMain.ImageListMain32x32
            ImageIndex = 114
            TabOrder = 2
          end
          object BitBtnMainProgramExit: TBitBtn
            Left = 572
            Height = 46
            Top = 12
            Width = 91
            Action = ActionMainProgramExit
            Anchors = [akRight, akBottom]
            ModalResult = 11
            Images = DataModuleGuiResMain.ImageListMain32x32
            ImageIndex = 113
            TabOrder = 3
          end
          object BitBtnMainParentShow: TBitBtn
            Left = 668
            Height = 46
            Top = 12
            Width = 91
            Action = ActionMainParentShow
            Anchors = [akRight, akBottom]
            ModalResult = 11
            Images = DataModuleGuiResMain.ImageListMain32x32
            ImageIndex = 234
            TabOrder = 4
          end
        end
      end
      object TabSheetSml: TTabSheet
        Caption = ' SML '
        ClientHeight = 558
        ClientWidth = 772
        ImageIndex = 288
        OnEnter = TabSheetSmlEnter
        object PanelSmlContent: TPanel
          Left = 0
          Height = 558
          Top = 0
          Width = 772
          Align = alClient
          BorderWidth = 4
          ClientHeight = 558
          ClientWidth = 772
          TabOrder = 0
          object GroupBoxSmlFile: TGroupBox
            Left = 5
            Height = 85
            Top = 5
            Width = 762
            Align = alTop
            Caption = ' SML File to SOBJ File Translation with smiTrans.exe: '
            ClientHeight = 69
            ClientWidth = 760
            TabOrder = 0
            object ComboBoxSmlFile: TComboBox
              Left = 8
              Height = 27
              Top = 4
              Width = 608
              Anchors = [akTop, akLeft, akRight]
              ItemHeight = 0
              TabOrder = 0
            end
            object BitBtnSmlFileOpen: TBitBtn
              Left = 620
              Height = 30
              Top = 0
              Width = 135
              Action = ActionSmlFileOpen
              Anchors = [akTop, akRight]
              Images = DataModuleGuiResMain.ImageListMain16x16
              ImageIndex = 3
              TabOrder = 1
            end
            object BitBtnSmlFileCompile: TBitBtn
              Left = 8
              Height = 30
              Top = 32
              Width = 179
              Action = ActionSmlFileCompile
              Caption = 'Compile SML=&gt;SOBJ'
              Images = DataModuleGuiResMain.ImageListMain16x16
              ImageIndex = 37
              TabOrder = 2
            end
            object BitBtnSmlFileEdit: TBitBtn
              Left = 384
              Height = 30
              Top = 32
              Width = 91
              Action = ActionSmlFileEdit
              Images = DataModuleGuiResMain.ImageListMain16x16
              ImageIndex = 53
              TabOrder = 5
            end
            object BitBtnSmlFileView: TBitBtn
              Left = 188
              Height = 30
              Top = 32
              Width = 91
              Action = ActionSmiFileView
              Layout = blGlyphRight
              Images = DataModuleGuiResMain.ImageListMain16x16
              ImageIndex = 164
              TabOrder = 3
            end
            object BitBtnSObjFileView: TBitBtn
              Left = 280
              Height = 30
              Top = 32
              Width = 103
              Action = ActionSobjFileView
              Images = DataModuleGuiResMain.ImageListMain16x16
              ImageIndex = 164
              TabOrder = 4
            end
            object ComboBoxSmlEditor: TComboBox
              Left = 508
              Height = 27
              Hint = 'Editor uses to edit SML file.'
              Top = 32
              Width = 108
              Anchors = [akTop, akLeft, akRight]
              ItemHeight = 0
              ItemIndex = 0
              Items.Strings = (
                'notepad'
                'akelpad'
                'notepad++'
              )
              TabOrder = 6
              Text = 'notepad'
            end
            object LabelSmiSmEditWith: TLabel
              Left = 480
              Height = 15
              Top = 40
              Width = 23
              Caption = 'with'
              Font.CharSet = RUSSIAN_CHARSET
              Font.Color = clBlack
              Font.Height = -12
              Font.Name = 'PT Sans'
              Font.Pitch = fpVariable
              Font.Quality = fqDraft
              ParentColor = False
              ParentFont = False
            end
            object BitBtnSmlFileFixEol: TBitBtn
              Left = 620
              Height = 30
              Top = 32
              Width = 59
              Action = ActionSmlFileFixEol
              Anchors = [akTop, akRight]
              Images = DataModuleGuiResMain.ImageListMain16x16
              ImageIndex = 253
              TabOrder = 7
            end
            object ComboBoxSmlFileFixEol: TComboBox
              Left = 680
              Height = 27
              Hint = 'You can fix SML file EOL, UTF8 or BOTH.'
              Top = 32
              Width = 76
              Anchors = [akTop, akRight]
              ItemHeight = 0
              ItemIndex = 1
              Items.Strings = (
                'NO'
                'EOL'
                'UTF8'
                'BOTH'
              )
              Style = csDropDownList
              TabOrder = 8
              Text = 'EOL'
            end
          end
          object GroupBoxSmlResult: TGroupBox
            Left = 5
            Height = 337
            Top = 216
            Width = 762
            Align = alClient
            Caption = ' SML Result Log: '
            ClientHeight = 321
            ClientWidth = 760
            TabOrder = 1
            object MemoSmlResult: TMemo
              Left = 0
              Height = 321
              Top = 0
              Width = 760
              Align = alClient
              Color = clInfoBk
              HideSelection = False
              ReadOnly = True
              ScrollBars = ssAutoBoth
              TabOrder = 0
              WordWrap = False
            end
          end
          object GroupBoxSmiSmRun: TGroupBox
            Left = 5
            Height = 69
            Hint = 'smiSM debug level option.'
            Top = 90
            Width = 762
            Align = alTop
            Caption = ' Run SOBJ file with smiSM.exe State Manager server: '
            ClientHeight = 53
            ClientWidth = 760
            TabOrder = 2
            object LabelSmiSmDomain: TLabel
              Left = 8
              Height = 15
              Top = 4
              Width = 80
              Caption = 'SMI Domain'
              ParentColor = False
            end
            object ComboBoxSmiSmDomain: TComboBox
              Left = 8
              Height = 27
              Hint = 'Domain Name uses to run smiSM.'
              Top = 20
              Width = 96
              ItemHeight = 0
              ItemIndex = 0
              Items.Strings = (
                'TEST'
                'DEMO'
              )
              TabOrder = 0
              Text = 'TEST'
            end
            object LabelSmiSmDns: TLabel
              Left = 112
              Height = 15
              Top = 4
              Width = 56
              Caption = 'DIM DNS'
              ParentColor = False
            end
            object ComboBoxSmiSmDns: TComboBox
              Left = 112
              Height = 27
              Hint = 'DIM DNS NODE uses for smiSM.'
              Top = 20
              Width = 124
              ItemHeight = 0
              Items.Strings = (
                'localhost'
                '127.0.0.1'
              )
              TabOrder = 1
            end
            object LabelSmiSmOptions: TLabel
              Left = 328
              Height = 15
              Top = 4
              Width = 104
              Caption = 'Other Options'
              ParentColor = False
            end
            object ComboBoxSmiSmOptions: TComboBox
              Left = 436
              Height = 27
              Top = 24
              Width = 116
              Anchors = [akTop, akLeft, akRight]
              ItemHeight = 0
              Items.Strings = (
                '-loopMaxChanges 25'
                '-loopMaxChangesFatal 5000'
                '-loopMinDuration -1'
              )
              TabOrder = 5
            end
            object BitBtnSmiSmRun: TBitBtn
              Left = 552
              Height = 54
              Top = -4
              Width = 123
              Action = ActionSmiSmRun
              Anchors = [akTop, akRight]
              Images = DataModuleGuiResMain.ImageListMain32x32
              ImageIndex = 114
              TabOrder = 7
            end
            object BitBtnSmiSmList: TBitBtn
              Left = 680
              Height = 26
              Top = -4
              Width = 75
              Action = ActionSmiSmList
              Anchors = [akTop, akRight]
              Images = DataModuleGuiResMain.ImageListMain16x16
              ImageIndex = 36
              TabOrder = 8
            end
            object BitBtnSmiSmKill: TBitBtn
              Left = 680
              Height = 26
              Top = 24
              Width = 75
              Action = ActionSmiSmKill
              Anchors = [akTop, akRight]
              Images = DataModuleGuiResMain.ImageListMain16x16
              ImageIndex = 23
              TabOrder = 9
            end
            object LabelSmiSmDebugLevel: TLabel
              Left = 248
              Height = 17
              Top = 4
              Width = 70
              Caption = 'Debug Level'
              Font.CharSet = RUSSIAN_CHARSET
              Font.Color = clBlack
              Font.Height = -13
              Font.Name = 'PT Sans'
              Font.Pitch = fpVariable
              Font.Quality = fqDraft
              ParentColor = False
              ParentFont = False
            end
            object ComboBoxSmiSmDebugLevel: TComboBox
              Left = 244
              Height = 27
              Top = 20
              Width = 72
              DropDownCount = 16
              ItemHeight = 0
              ItemIndex = 3
              Items.Strings = (
                '-d 0'
                '-d 1'
                '-d 2'
                '-d 3'
                '-d 4'
                '-d 5'
                '-d 6'
                '-d 7'
                '-d 8'
                '-d 9'
              )
              Style = csDropDownList
              TabOrder = 2
              Text = '-d 3'
            end
            object CheckBoxSmiSmOptionT: TCheckBox
              Left = 324
              Height = 21
              Hint = 'smiSM option -t - new time format.'
              Top = 20
              Width = 40
              Caption = '-t'
              Checked = True
              State = cbChecked
              TabOrder = 3
            end
            object CheckBoxSmiSmOptionU: TCheckBox
              Left = 376
              Height = 21
              Hint = 'smiSM Option -u - unlocked IF''s.'
              Top = 20
              Width = 40
              Caption = '-u'
              TabOrder = 4
            end
            object BitBtnSmiSmOptionsHelp: TBitBtn
              Left = 436
              Height = 28
              Top = -4
              Width = 115
              Action = ActionSmiSmOptionsHelp
              Images = DataModuleGuiResMain.ImageListMain16x16
              ImageIndex = 21
              TabOrder = 6
            end
          end
          object GroupBoxSmiSmLogFile: TGroupBox
            Left = 5
            Height = 57
            Top = 159
            Width = 762
            Align = alTop
            Caption = ' State Manager process (smiSM) terminal mode and Log File: '
            ClientHeight = 41
            ClientWidth = 760
            TabOrder = 3
            object CheckBoxSmiSmLogFile: TCheckBox
              Left = 132
              Height = 21
              Hint = 'Flag to use smiSM Log File.'
              Top = 8
              Width = 80
              Caption = 'Use Log'
              OnChange = CheckBoxSmiSmLogFileChange
              TabOrder = 0
            end
            object BitBtnSmiSmViewLog: TBitBtn
              Left = 216
              Height = 30
              Top = 4
              Width = 99
              Action = ActionSmiSmViewLog
              Images = DataModuleGuiResMain.ImageListMain16x16
              ImageIndex = 164
              TabOrder = 1
            end
            object ComboBoxSmiSmLogViewer: TComboBox
              Left = 364
              Height = 27
              Hint = 'Viewer uses to open smiSM Log File.'
              Top = 4
              Width = 128
              Anchors = [akTop, akLeft, akRight]
              ItemHeight = 0
              ItemIndex = 1
              Items.Strings = (
                'lister'
                'wintail'
                'LogViewer'
                'TxtViewer'
                'WebViewer'
                'HtmViewer'
              )
              TabOrder = 2
              Text = 'wintail'
            end
            object LabelSmiSmLogViewerWith: TLabel
              Left = 324
              Height = 15
              Top = 14
              Width = 32
              Caption = 'with'
              ParentColor = False
            end
            object BitBtnSmiSmDeleteLog: TBitBtn
              Left = 496
              Height = 30
              Top = 4
              Width = 159
              Action = ActionSmiSmDeleteLog
              Anchors = [akTop, akRight]
              Images = DataModuleGuiResMain.ImageListMain16x16
              ImageIndex = 47
              TabOrder = 3
            end
            object BitBtnSmiSmKillAll: TBitBtn
              Left = 656
              Height = 30
              Top = 4
              Width = 99
              Action = ActionSmiSmKillAll
              Anchors = [akTop, akRight]
              Images = DataModuleGuiResMain.ImageListMain16x16
              ImageIndex = 115
              TabOrder = 4
            end
            object ComboBoxSmiRunTerm: TComboBox
              Left = 4
              Height = 27
              Hint = 'Terminal program to run smiSM process.'
              Top = 4
              Width = 124
              ItemHeight = 0
              ItemIndex = 0
              Items.Strings = (
                ''
                'xterm -e'
                'xterm -hold -e'
                'fly-term -e'
                'fly-term -hold -e'
                'cmd /c'
                'cmd /k'
              )
              Style = csDropDownList
              TabOrder = 5
            end
          end
        end
      end
      object TabSheetDaq: TTabSheet
        Caption = 'DAQ '
        ClientHeight = 558
        ClientWidth = 772
        ImageIndex = 111
        object PanelDaq: TPanel
          Left = 0
          Height = 558
          Top = 0
          Width = 772
          Align = alClient
          BorderWidth = 4
          ClientHeight = 558
          ClientWidth = 772
          TabOrder = 0
          object PanelDaqButtons: TPanel
            Left = 5
            Height = 178
            Top = 5
            Width = 762
            Align = alTop
            BorderWidth = 4
            ClientHeight = 178
            ClientWidth = 762
            TabOrder = 0
            object GroupBoxSmlParser: TGroupBox
              Left = 5
              Height = 168
              Top = 5
              Width = 117
              Align = alLeft
              Caption = ' SML Parser: '
              ClientHeight = 152
              ClientWidth = 115
              TabOrder = 0
              object BitBtnSmlCodeClear: TBitBtn
                Left = 4
                Height = 30
                Top = 0
                Width = 107
                Action = ActionSmlCodeClear
                Images = DataModuleGuiResMain.ImageListMain16x16
                ImageIndex = 23
                TabOrder = 0
              end
              object BitBtnSmlCodeParse: TBitBtn
                Left = 4
                Height = 30
                Top = 32
                Width = 107
                Action = ActionSmlCodeParse
                Images = DataModuleGuiResMain.ImageListMain16x16
                ImageIndex = 158
                TabOrder = 1
              end
              object BitBtnSmlMakeDaqCfg: TBitBtn
                Left = 4
                Height = 30
                Top = 64
                Width = 107
                Action = ActionSmlMakeDaqCfg
                Images = DataModuleGuiResMain.ImageListMain16x16
                ImageIndex = 241
                TabOrder = 2
              end
              object BitBtnSmlMakeDaqCrc: TBitBtn
                Left = 4
                Height = 30
                Hint = 'Make CRC text for DAQ.'
                Top = 96
                Width = 107
                Action = ActionSmlMakeDaqCrc
                Images = DataModuleGuiResMain.ImageListMain16x16
                ImageIndex = 246
                TabOrder = 3
              end
            end
            object PageControlSmlSelector: TPageControl
              Left = 122
              Height = 168
              Top = 5
              Width = 635
              ActivePage = TabSheetSmlSelectObjects
              Align = alClient
              Images = DataModuleGuiResMain.ImageListMain16x16
              TabIndex = 0
              TabOrder = 1
              OnChange = PageControlSmlSelectorChange
              object TabSheetSmlSelectObjects: TTabSheet
                Caption = 'Select: Objects '
                ClientHeight = 164
                ClientWidth = 625
                ImageIndex = 253
                object PanelSmlSelectObjects: TPanel
                  Left = 0
                  Height = 164
                  Top = 0
                  Width = 625
                  Align = alClient
                  BorderWidth = 4
                  ClientHeight = 164
                  ClientWidth = 625
                  TabOrder = 0
                  object ListBoxSmlAllObjectList: TListBox
                    Left = 5
                    Height = 154
                    Top = 5
                    Width = 240
                    Align = alLeft
                    ItemHeight = 0
                    MultiSelect = True
                    Sorted = True
                    TabOrder = 0
                    TopIndex = -1
                  end
                  object BitBtnSmlObjectSelect: TBitBtn
                    Left = 248
                    Height = 42
                    Top = 0
                    Width = 131
                    Action = ActionSmlObjectSelect
                    Layout = blGlyphRight
                    Images = DataModuleGuiResMain.ImageListMain32x32
                    ImageIndex = 14
                    TabOrder = 1
                  end
                  object LabelSmlMainObject: TLabel
                    Left = 248
                    Height = 15
                    Top = 44
                    Width = 88
                    Caption = 'Main Object'
                    ParentColor = False
                  end
                  object ComboBoxSmlMainObject: TComboBox
                    Left = 248
                    Height = 31
                    Hint = 'Main SML Object.'
                    Top = 60
                    Width = 128
                    DropDownCount = 16
                    ItemHeight = 0
                    Style = csDropDownList
                    TabOrder = 2
                  end
                  object LabelSmlLeadObject: TLabel
                    Left = 248
                    Height = 15
                    Top = 92
                    Width = 88
                    Caption = 'Lead Object'
                    ParentColor = False
                  end
                  object ComboBoxSmlLeadObject: TComboBox
                    Left = 248
                    Height = 31
                    Hint = 'Lead SML Object.'
                    Top = 105
                    Width = 128
                    DropDownCount = 16
                    ItemHeight = 0
                    Style = csDropDownList
                    TabOrder = 3
                  end
                  object ListBoxSmlSelObjectList: TListBox
                    Left = 380
                    Height = 154
                    Top = 5
                    Width = 240
                    Align = alRight
                    ItemHeight = 0
                    TabOrder = 4
                    TopIndex = -1
                  end
                end
              end
              object TabSheetSmlSelectObjectParams: TTabSheet
                Caption = 'Parameters '
                ClientHeight = 164
                ClientWidth = 625
                ImageIndex = 254
                object PanelSmlSelectObjectParams: TPanel
                  Left = 0
                  Height = 164
                  Top = 0
                  Width = 625
                  Align = alClient
                  BorderWidth = 4
                  ClientHeight = 160
                  ClientWidth = 621
                  TabOrder = 0
                  object ListBoxSmlAllObjectParamList: TListBox
                    Left = 5
                    Height = 150
                    Top = 5
                    Width = 240
                    Align = alLeft
                    ItemHeight = 0
                    MultiSelect = True
                    Sorted = True
                    TabOrder = 0
                    TopIndex = -1
                  end
                  object ListBoxSmlSelObjectParamList: TListBox
                    Left = 376
                    Height = 150
                    Top = 5
                    Width = 240
                    Align = alRight
                    ItemHeight = 0
                    TabOrder = 1
                    TopIndex = -1
                  end
                  object BitBtnSmlObjectParamSelect: TBitBtn
                    Left = 248
                    Height = 42
                    Top = 4
                    Width = 131
                    Action = ActionSmlObjectParamSelect
                    Layout = blGlyphRight
                    Images = DataModuleGuiResMain.ImageListMain32x32
                    ImageIndex = 14
                    TabOrder = 2
                  end
                end
              end
              object TabSheetSmlSelectObjectsets: TTabSheet
                Caption = 'ObjectSets '
                ClientHeight = 164
                ClientWidth = 625
                ImageIndex = 257
                object PanelSmlSelectObjectsets: TPanel
                  Left = 0
                  Height = 164
                  Top = 0
                  Width = 625
                  Align = alClient
                  BorderWidth = 4
                  ClientHeight = 160
                  ClientWidth = 621
                  TabOrder = 0
                  object ListBoxSmlAllObjectsetList: TListBox
                    Left = 5
                    Height = 150
                    Top = 5
                    Width = 240
                    Align = alLeft
                    ItemHeight = 0
                    MultiSelect = True
                    Sorted = True
                    TabOrder = 0
                    TopIndex = -1
                  end
                  object BitBtnSmlObjectsetSelect: TBitBtn
                    Left = 248
                    Height = 42
                    Top = 4
                    Width = 131
                    Action = ActionSmlObjectsetSelect
                    Layout = blGlyphRight
                    Images = DataModuleGuiResMain.ImageListMain32x32
                    ImageIndex = 14
                    TabOrder = 1
                  end
                  object ListBoxSmlSelObjectsetList: TListBox
                    Left = 376
                    Height = 150
                    Top = 5
                    Width = 240
                    Align = alRight
                    ItemHeight = 0
                    TabOrder = 2
                    TopIndex = -1
                  end
                end
              end
            end
          end
          object PanelDaqTabs: TPanel
            Left = 5
            Height = 370
            Top = 183
            Width = 762
            Align = alClient
            BorderWidth = 4
            ClientHeight = 370
            ClientWidth = 762
            TabOrder = 1
            object PageControlDaq: TPageControl
              Left = 5
              Height = 360
              Top = 5
              Width = 752
              ActivePage = TabSheetDaqParams
              Align = alClient
              Images = DataModuleGuiResMain.ImageListMain32x32
              TabIndex = 0
              TabOrder = 0
              object TabSheetDaqParams: TTabSheet
                Caption = 'Parameters '
                ClientHeight = 356
                ClientWidth = 742
                ImageIndex = 161
                object PanelSmlDaqParameters: TPanel
                  Left = 0
                  Height = 356
                  Top = 0
                  Width = 742
                  Align = alClient
                  BorderWidth = 4
                  ClientHeight = 356
                  ClientWidth = 742
                  TabOrder = 0
                  object GroupBoxSmlDaqCommonParams: TGroupBox
                    Left = 5
                    Height = 64
                    Top = 5
                    Width = 732
                    Align = alTop
                    Caption = ' SMI &amp;&amp; DAQ General Parameters: '
                    ClientHeight = 62
                    ClientWidth = 730
                    TabOrder = 0
                    object ComboBoxSmlDaqDomain: TComboBox
                      Left = 116
                      Height = 27
                      Hint = 'SMI Domain name.'
                      Top = 16
                      Width = 96
                      DropDownCount = 16
                      ItemHeight = 0
                      ItemIndex = 0
                      Items.Strings = (
                        'DEMO'
                        'TEST'
                      )
                      OnChange = ComboBoxSmlDaqDomainChange
                      TabOrder = 0
                      Text = 'DEMO'
                    end
                    object LabelSmlDaqDomain: TLabel
                      Left = 116
                      Height = 15
                      Hint = 'SMI domain name.'
                      Top = 0
                      Width = 80
                      Caption = 'SMI Domain'
                      ParentColor = False
                    end
                    object LabelSmlDaqPrefix: TLabel
                      Left = 4
                      Height = 15
                      Hint = 'SmiTagPrefix - common prefix for SMI tags.'
                      Top = 0
                      Width = 96
                      Caption = 'SmiTagPrefix'
                      ParentColor = False
                    end
                    object ComboBoxSmiTagPrefix: TComboBox
                      Left = 4
                      Height = 27
                      Hint = 'SMI tag prefix for DAQ tags.'
                      Top = 16
                      Width = 96
                      DropDownCount = 16
                      ItemHeight = 0
                      ItemIndex = 0
                      Items.Strings = (
                        'SMI.'
                      )
                      OnChange = ComboBoxSmiTagPrefixChange
                      TabOrder = 1
                      Text = 'SMI.'
                    end
                    object LabelSmlDaqGuiCtrlDevice: TLabel
                      Left = 252
                      Height = 15
                      Top = 0
                      Width = 176
                      Caption = 'DAQ GUI Control Device'
                      ParentColor = False
                    end
                    object ComboBoxSmlDaqGuiCtrlDevice: TComboBox
                      Left = 252
                      Height = 27
                      Top = 16
                      Width = 184
                      DropDownCount = 16
                      ItemHeight = 0
                      ItemIndex = 0
                      Items.Strings = (
                        '&amp;SMITEST.MAIN.CTRL'
                      )
                      TabOrder = 2
                      Text = '&amp;SMITEST.MAIN.CTRL'
                    end
                    object LabelSmlDaqGuiCtrlWindow: TLabel
                      Left = 440
                      Height = 15
                      Top = 0
                      Width = 176
                      Caption = 'DAQ GUI Control Window'
                      ParentColor = False
                    end
                    object ComboBoxSmlDaqGuiCtrlWindow: TComboBox
                      Left = 440
                      Height = 27
                      Top = 16
                      Width = 184
                      DropDownCount = 16
                      ItemHeight = 0
                      ItemIndex = 0
                      Items.Strings = (
                        'SMITEST.MAIN.CTRL'
                      )
                      TabOrder = 3
                      Text = 'SMITEST.MAIN.CTRL'
                    end
                    object BitBtnSmlDaqGuiCtrlDeviceUpdate: TBitBtn
                      Left = 216
                      Height = 30
                      Top = 12
                      Width = 35
                      Action = ActionSmlDaqGuiCtrlDeviceUpdate
                      Images = DataModuleGuiResMain.ImageListMain16x16
                      ImageIndex = 60
                      TabOrder = 4
                    end
                    object LabelSmlDaqGuiFifoSizeKb: TLabel
                      Left = 636
                      Height = 17
                      Top = 0
                      Width = 63
                      Caption = 'FifoSize, kB'
                      Font.CharSet = RUSSIAN_CHARSET
                      Font.Color = clBlack
                      Font.Height = -13
                      Font.Name = 'PT Sans'
                      Font.Pitch = fpVariable
                      Font.Quality = fqDraft
                      ParentColor = False
                      ParentFont = False
                    end
                    object SpinEditSmlDaqGuiFifoSizeKb: TSpinEdit
                      Left = 636
                      Height = 25
                      Top = 16
                      Width = 66
                      MaxValue = 65536
                      MinValue = 16
                      TabOrder = 5
                      Value = 128
                    end
                  end
                  object GroupBoxSmlDaqGuiGeom: TGroupBox
                    Left = 5
                    Height = 109
                    Hint = 'Host Server/Time display height.'
                    Top = 69
                    Width = 732
                    Align = alTop
                    Caption = ' SMI &amp;&amp; DAQ GUI Geometry: '
                    ClientHeight = 107
                    ClientWidth = 730
                    TabOrder = 1
                    object SpinEditSmlDaqGuiWidth: TSpinEdit
                      Left = 136
                      Height = 25
                      Hint = 'Width of SMI FSM GUI.'
                      Top = 16
                      Width = 66
                      MaxValue = 10000
                      MinValue = 200
                      TabOrder = 2
                      Value = 1270
                    end
                    object LabelSmlDaqGuiWidth: TLabel
                      Left = 136
                      Height = 17
                      Top = 0
                      Width = 32
                      Caption = 'Width'
                      Font.CharSet = RUSSIAN_CHARSET
                      Font.Color = clBlack
                      Font.Height = -13
                      Font.Name = 'PT Sans'
                      Font.Pitch = fpVariable
                      Font.Quality = fqDraft
                      ParentColor = False
                      ParentFont = False
                    end
                    object LabelSmlDaqGuiHeight: TLabel
                      Left = 208
                      Height = 17
                      Top = 0
                      Width = 37
                      Caption = 'Height'
                      Font.CharSet = RUSSIAN_CHARSET
                      Font.Color = clBlack
                      Font.Height = -13
                      Font.Name = 'PT Sans'
                      Font.Pitch = fpVariable
                      Font.Quality = fqDraft
                      ParentColor = False
                      ParentFont = False
                    end
                    object SpinEditSmlDaqGuiHeight: TSpinEdit
                      Left = 208
                      Height = 25
                      Hint = 'Height of SMI FSM GUI.'
                      Top = 16
                      Width = 66
                      MaxValue = 10000
                      MinValue = 200
                      TabOrder = 3
                      Value = 600
                    end
                    object LabelSmlDaqGuiLogoLeft: TLabel
                      Left = 4
                      Height = 17
                      Top = 0
                      Width = 21
                      Caption = 'Left'
                      Font.CharSet = RUSSIAN_CHARSET
                      Font.Color = clBlack
                      Font.Height = -13
                      Font.Name = 'PT Sans'
                      Font.Pitch = fpVariable
                      Font.Quality = fqDraft
                      ParentColor = False
                      ParentFont = False
                    end
                    object SpinEditSmlDaqGuiLeft: TSpinEdit
                      Left = 4
                      Height = 25
                      Hint = 'Left of SMI FSM GUI.'
                      Top = 16
                      Width = 58
                      MaxValue = 10000
                      TabOrder = 0
                      Value = 10
                    end
                    object LabelSmlDaqGuiTop: TLabel
                      Left = 68
                      Height = 17
                      Top = 0
                      Width = 19
                      Caption = 'Top'
                      Font.CharSet = RUSSIAN_CHARSET
                      Font.Color = clBlack
                      Font.Height = -13
                      Font.Name = 'PT Sans'
                      Font.Pitch = fpVariable
                      Font.Quality = fqDraft
                      ParentColor = False
                      ParentFont = False
                    end
                    object SpinEditSmlDaqGuiTop: TSpinEdit
                      Left = 68
                      Height = 25
                      Hint = 'Top of SMI FSM GUI.'
                      Top = 16
                      Width = 58
                      MaxValue = 10000
                      TabOrder = 1
                      Value = 10
                    end
                    object LabelSmlDaqGuiBtnWidth: TLabel
                      Left = 284
                      Height = 17
                      Top = 0
                      Width = 114
                      Caption = 'Button Width, Height'
                      Font.CharSet = RUSSIAN_CHARSET
                      Font.Color = clBlack
                      Font.Height = -13
                      Font.Name = 'PT Sans'
                      Font.Pitch = fpVariable
                      Font.Quality = fqDraft
                      ParentColor = False
                      ParentFont = False
                    end
                    object SpinEditSmlDaqGuiBtnWidth: TSpinEdit
                      Left = 284
                      Height = 25
                      Hint = 'SMI Object/State Buttons Width.'
                      Top = 16
                      Width = 58
                      MaxValue = 10000
                      MinValue = 50
                      TabOrder = 4
                      Value = 185
                    end
                    object SpinEditSmlDaqGuiBtnHeight: TSpinEdit
                      Left = 348
                      Height = 25
                      Hint = 'SMI Object/State Buttons Height.'
                      Top = 16
                      Width = 58
                      MaxValue = 10000
                      MinValue = 10
                      TabOrder = 5
                      Value = 35
                    end
                    object SpinEditSmlDaqGuiBtnDx: TSpinEdit
                      Left = 412
                      Height = 25
                      Hint = 'Horizontal margin between buttons.'
                      Top = 16
                      Width = 46
                      TabOrder = 6
                      Value = 5
                    end
                    object SpinEditSmlDaqGuiBtnDy: TSpinEdit
                      Left = 464
                      Height = 25
                      Hint = 'Vertical margin between buttons.'
                      Top = 16
                      Width = 46
                      TabOrder = 7
                      Value = 5
                    end
                    object LabelSmlDaqGuiBtnDxDy: TLabel
                      Left = 412
                      Height = 17
                      Top = 0
                      Width = 74
                      Caption = 'Button dX, dY'
                      Font.CharSet = RUSSIAN_CHARSET
                      Font.Color = clBlack
                      Font.Height = -13
                      Font.Name = 'PT Sans'
                      Font.Pitch = fpVariable
                      Font.Quality = fqDraft
                      ParentColor = False
                      ParentFont = False
                    end
                    object LabelSmlDaqGuiBtnDate: TLabel
                      Left = 4
                      Height = 17
                      Top = 44
                      Width = 102
                      Caption = 'Host Width, Height'
                      Font.CharSet = RUSSIAN_CHARSET
                      Font.Color = clBlack
                      Font.Height = -13
                      Font.Name = 'PT Sans'
                      Font.Pitch = fpVariable
                      Font.Quality = fqDraft
                      ParentColor = False
                      ParentFont = False
                    end
                    object SpinEditSmlDaqGuiBtnBorder: TSpinEdit
                      Left = 516
                      Height = 25
                      Hint = 'Buttons Border Width.'
                      Top = 16
                      Width = 50
                      MaxValue = 10
                      TabOrder = 8
                      Value = 2
                    end
                    object LabelSmlDaqGuiBtnBorder: TLabel
                      Left = 516
                      Height = 17
                      Top = 0
                      Width = 37
                      Caption = 'Border'
                      Font.CharSet = RUSSIAN_CHARSET
                      Font.Color = clBlack
                      Font.Height = -13
                      Font.Name = 'PT Sans'
                      Font.Pitch = fpVariable
                      Font.Quality = fqDraft
                      ParentColor = False
                      ParentFont = False
                    end
                    object SpinEditSmlDaqGuiHostTimeWidth: TSpinEdit
                      Left = 4
                      Height = 25
                      Hint = 'Host Server/Time display width.'
                      Top = 60
                      Width = 58
                      MaxValue = 1000
                      MinValue = 100
                      TabOrder = 9
                      Value = 170
                    end
                    object SpinEditSmlDaqGuiHostTimeHeight: TSpinEdit
                      Left = 68
                      Height = 25
                      Hint = 'Host Server/Time display height.'
                      Top = 60
                      Width = 58
                      MaxValue = 200
                      MinValue = 10
                      TabOrder = 10
                      Value = 18
                    end
                    object SpinEditSmlDaqGuiDnsWidth: TSpinEdit
                      Left = 136
                      Height = 25
                      Hint = 'Width of DNS label.'
                      Top = 60
                      Width = 66
                      MaxValue = 1000
                      MinValue = 10
                      TabOrder = 11
                      Value = 45
                    end
                    object SpinEditSmlDaqGuiDomainWidth: TSpinEdit
                      Left = 208
                      Height = 25
                      Hint = 'Width of Domain Status.'
                      Top = 60
                      Width = 66
                      MinValue = 10
                      TabOrder = 12
                      Value = 100
                    end
                    object LabelSmlDaqGuiDnsWidth: TLabel
                      Left = 136
                      Height = 17
                      Top = 44
                      Width = 128
                      Caption = 'Width of DNS, DOMAIN'
                      Font.CharSet = RUSSIAN_CHARSET
                      Font.Color = clBlack
                      Font.Height = -13
                      Font.Name = 'PT Sans'
                      Font.Pitch = fpVariable
                      Font.Quality = fqDraft
                      ParentColor = False
                      ParentFont = False
                    end
                    object LabelSmlDaqGuiParWidth: TLabel
                      Left = 284
                      Height = 17
                      Top = 44
                      Width = 116
                      Caption = 'Params Width, Height'
                      Font.CharSet = RUSSIAN_CHARSET
                      Font.Color = clBlack
                      Font.Height = -13
                      Font.Name = 'PT Sans'
                      Font.Pitch = fpVariable
                      Font.Quality = fqDraft
                      ParentColor = False
                      ParentFont = False
                    end
                    object SpinEditSmlDaqGuiParWidth: TSpinEdit
                      Left = 284
                      Height = 25
                      Hint = 'SMI Object/State Buttons Width.'
                      Top = 60
                      Width = 58
                      MaxValue = 10000
                      MinValue = 50
                      TabOrder = 13
                      Value = 185
                    end
                    object SpinEditSmlDaqGuiParHeight: TSpinEdit
                      Left = 348
                      Height = 25
                      Hint = 'SMI Object/State Buttons Height.'
                      Top = 60
                      Width = 58
                      MaxValue = 10000
                      MinValue = 10
                      TabOrder = 14
                      Value = 18
                    end
                    object LabelSmlDaqGuiParDxDy: TLabel
                      Left = 412
                      Height = 17
                      Top = 44
                      Width = 76
                      Caption = 'Params dX, dY'
                      Font.CharSet = RUSSIAN_CHARSET
                      Font.Color = clBlack
                      Font.Height = -13
                      Font.Name = 'PT Sans'
                      Font.Pitch = fpVariable
                      Font.Quality = fqDraft
                      ParentColor = False
                      ParentFont = False
                    end
                    object SpinEditSmlDaqGuiParDx: TSpinEdit
                      Left = 412
                      Height = 25
                      Hint = 'Horizontal margin between buttons.'
                      Top = 60
                      Width = 46
                      TabOrder = 15
                      Value = 5
                    end
                    object SpinEditSmlDaqGuiParDy: TSpinEdit
                      Left = 464
                      Height = 25
                      Hint = 'Vertical margin between buttons.'
                      Top = 60
                      Width = 46
                      TabOrder = 16
                      Value = 2
                    end
                    object LabelSmlDaqGuiParBorder: TLabel
                      Left = 516
                      Height = 17
                      Top = 44
                      Width = 37
                      Caption = 'Border'
                      Font.CharSet = RUSSIAN_CHARSET
                      Font.Color = clBlack
                      Font.Height = -13
                      Font.Name = 'PT Sans'
                      Font.Pitch = fpVariable
                      Font.Quality = fqDraft
                      ParentColor = False
                      ParentFont = False
                    end
                    object SpinEditSmlDaqGuiParBorder: TSpinEdit
                      Left = 516
                      Height = 25
                      Hint = 'Buttons Border Width.'
                      Top = 60
                      Width = 50
                      MaxValue = 10
                      TabOrder = 17
                      Value = 1
                    end
                  end
                end
              end
              object TabSheetDaqFonts: TTabSheet
                Caption = 'Fonts '
                ClientHeight = 356
                ClientWidth = 742
                ImageIndex = 1
                object PanelSmiDaqFonts: TPanel
                  Left = 0
                  Height = 356
                  Top = 0
                  Width = 742
                  Align = alClient
                  BorderWidth = 4
                  ClientHeight = 352
                  ClientWidth = 738
                  TabOrder = 0
                  object GroupBoxSmlDaqGuiFonts: TGroupBox
                    Left = 5
                    Height = 193
                    Top = 5
                    Width = 728
                    Align = alTop
                    Caption = ' SMI &amp;&amp; DAQ GUI Fonts: '
                    ClientHeight = 177
                    ClientWidth = 726
                    TabOrder = 0
                    object ComboBoxSmlDaqGuiTitleFont: TComboBox
                      Left = 180
                      Height = 27
                      Hint = 'Font uses for FSM Titles.'
                      Top = 0
                      Width = 542
                      Anchors = [akTop, akLeft, akRight]
                      DropDownCount = 32
                      ItemHeight = 0
                      ItemIndex = 1
                      Items.Strings = (
                        'Name:PT_Mono\Size:16\Color:Black\Style:[Bold]'
                        'Name:PT_Mono\Size:14\Color:Black\Style:[Bold]'
                        'Name:PT_Mono\Size:12\Color:Black\Style:[Bold]'
                        'Name:PT_Mono\Size:10\Color:Black\Style:[Bold]'
                        'Name:PT_Mono\Size:8\Color:Black\Style:[Bold]'
                        'Name:PT_Sans\Size:16\Color:Black\Style:[Bold]'
                        'Name:PT_Sans\Size:14\Color:Black\Style:[Bold]'
                        'Name:PT_Sans\Size:12\Color:Black\Style:[Bold]'
                        'Name:PT_Sans\Size:10\Color:Black\Style:[Bold]'
                        'Name:PT_Sans\Size:8\Color:Black\Style:[Bold]'
                        'Name:PT_Sans_Narrow\Size:16\Color:Black\Style:[Bold]'
                        'Name:PT_Sans_Narrow\Size:14\Color:Black\Style:[Bold]'
                        'Name:PT_Sans_Narrow\Size:12\Color:Black\Style:[Bold]'
                        'Name:PT_Sans_Narrow\Size:10\Color:Black\Style:[Bold]'
                        'Name:PT_Sans_Narrow\Size:8\Color:Black\Style:[Bold]'
                        'Name:PT_Mono\Size:16\Color:Black\Style:[]'
                        'Name:PT_Mono\Size:14\Color:Black\Style:[]'
                        'Name:PT_Mono\Size:12\Color:Black\Style:[]'
                        'Name:PT_Mono\Size:10\Color:Black\Style:[]'
                        'Name:PT_Mono\Size:8\Color:Black\Style:[]'
                        'Name:PT_Sans\Size:16\Color:Black\Style:[]'
                        'Name:PT_Sans\Size:14\Color:Black\Style:[]'
                        'Name:PT_Sans\Size:12\Color:Black\Style:[]'
                        'Name:PT_Sans\Size:10\Color:Black\Style:[]'
                        'Name:PT_Sans\Size:8\Color:Black\Style:[]'
                        'Name:PT_Sans_Narrow\Size:16\Color:Black\Style:[]'
                        'Name:PT_Sans_Narrow\Size:14\Color:Black\Style:[]'
                        'Name:PT_Sans_Narrow\Size:12\Color:Black\Style:[]'
                        'Name:PT_Sans_Narrow\Size:10\Color:Black\Style:[]'
                        'Name:PT_Sans_Narrow\Size:8\Color:Black\Style:[]'
                      )
                      TabOrder = 1
                      Text = 'Name:PT_Mono\Size:14\Color:Black\Style:[Bold]'
                    end
                    object LabelSmlDaqGuiTitleFont: TLabel
                      Left = 4
                      Height = 1
                      Hint = 'Font uses for FSM Title.'
                      Top = 4
                      Width = 1
                      Color = clDefault
                      ParentColor = False
                      Transparent = False
                    end
                    object ComboBoxSmlDaqGuiStateFont: TComboBox
                      Left = 180
                      Height = 27
                      Hint = 'Font uses for FSM States.'
                      Top = 28
                      Width = 542
                      Anchors = [akTop, akLeft, akRight]
                      DropDownCount = 32
                      ItemHeight = 0
                      ItemIndex = 2
                      Items.Strings = (
                        'Name:PT_Mono\Size:16\Color:Black\Style:[Bold]'
                        'Name:PT_Mono\Size:14\Color:Black\Style:[Bold]'
                        'Name:PT_Mono\Size:12\Color:Black\Style:[Bold]'
                        'Name:PT_Mono\Size:10\Color:Black\Style:[Bold]'
                        'Name:PT_Mono\Size:8\Color:Black\Style:[Bold]'
                        'Name:PT_Sans\Size:16\Color:Black\Style:[Bold]'
                        'Name:PT_Sans\Size:14\Color:Black\Style:[Bold]'
                        'Name:PT_Sans\Size:12\Color:Black\Style:[Bold]'
                        'Name:PT_Sans\Size:10\Color:Black\Style:[Bold]'
                        'Name:PT_Sans\Size:8\Color:Black\Style:[Bold]'
                        'Name:PT_Sans_Narrow\Size:16\Color:Black\Style:[Bold]'
                        'Name:PT_Sans_Narrow\Size:14\Color:Black\Style:[Bold]'
                        'Name:PT_Sans_Narrow\Size:12\Color:Black\Style:[Bold]'
                        'Name:PT_Sans_Narrow\Size:10\Color:Black\Style:[Bold]'
                        'Name:PT_Sans_Narrow\Size:8\Color:Black\Style:[Bold]'
                        'Name:PT_Mono\Size:16\Color:Black\Style:[]'
                        'Name:PT_Mono\Size:14\Color:Black\Style:[]'
                        'Name:PT_Mono\Size:12\Color:Black\Style:[]'
                        'Name:PT_Mono\Size:10\Color:Black\Style:[]'
                        'Name:PT_Mono\Size:8\Color:Black\Style:[]'
                        'Name:PT_Sans\Size:16\Color:Black\Style:[]'
                        'Name:PT_Sans\Size:14\Color:Black\Style:[]'
                        'Name:PT_Sans\Size:12\Color:Black\Style:[]'
                        'Name:PT_Sans\Size:10\Color:Black\Style:[]'
                        'Name:PT_Sans\Size:8\Color:Black\Style:[]'
                        'Name:PT_Sans_Narrow\Size:16\Color:Black\Style:[]'
                        'Name:PT_Sans_Narrow\Size:14\Color:Black\Style:[]'
                        'Name:PT_Sans_Narrow\Size:12\Color:Black\Style:[]'
                        'Name:PT_Sans_Narrow\Size:10\Color:Black\Style:[]'
                        'Name:PT_Sans_Narrow\Size:8\Color:Black\Style:[]'
                      )
                      TabOrder = 3
                      Text = 'Name:PT_Mono\Size:12\Color:Black\Style:[Bold]'
                    end
                    object ComboBoxSmlDaqGuiParamFont: TComboBox
                      Left = 180
                      Height = 27
                      Hint = 'Font uses for FSM Parameters.'
                      Top = 56
                      Width = 542
                      Anchors = [akTop, akLeft, akRight]
                      DropDownCount = 32
                      ItemHeight = 0
                      ItemIndex = 3
                      Items.Strings = (
                        'Name:PT_Mono\Size:16\Color:Black\Style:[Bold]'
                        'Name:PT_Mono\Size:14\Color:Black\Style:[Bold]'
                        'Name:PT_Mono\Size:12\Color:Black\Style:[Bold]'
                        'Name:PT_Mono\Size:10\Color:Black\Style:[Bold]'
                        'Name:PT_Mono\Size:8\Color:Black\Style:[Bold]'
                        'Name:PT_Sans\Size:16\Color:Black\Style:[Bold]'
                        'Name:PT_Sans\Size:14\Color:Black\Style:[Bold]'
                        'Name:PT_Sans\Size:12\Color:Black\Style:[Bold]'
                        'Name:PT_Sans\Size:10\Color:Black\Style:[Bold]'
                        'Name:PT_Sans\Size:8\Color:Black\Style:[Bold]'
                        'Name:PT_Sans_Narrow\Size:16\Color:Black\Style:[Bold]'
                        'Name:PT_Sans_Narrow\Size:14\Color:Black\Style:[Bold]'
                        'Name:PT_Sans_Narrow\Size:12\Color:Black\Style:[Bold]'
                        'Name:PT_Sans_Narrow\Size:10\Color:Black\Style:[Bold]'
                        'Name:PT_Sans_Narrow\Size:8\Color:Black\Style:[Bold]'
                        'Name:PT_Mono\Size:16\Color:Black\Style:[]'
                        'Name:PT_Mono\Size:14\Color:Black\Style:[]'
                        'Name:PT_Mono\Size:12\Color:Black\Style:[]'
                        'Name:PT_Mono\Size:10\Color:Black\Style:[]'
                        'Name:PT_Mono\Size:8\Color:Black\Style:[]'
                        'Name:PT_Sans\Size:16\Color:Black\Style:[]'
                        'Name:PT_Sans\Size:14\Color:Black\Style:[]'
                        'Name:PT_Sans\Size:12\Color:Black\Style:[]'
                        'Name:PT_Sans\Size:10\Color:Black\Style:[]'
                        'Name:PT_Sans\Size:8\Color:Black\Style:[]'
                        'Name:PT_Sans_Narrow\Size:16\Color:Black\Style:[]'
                        'Name:PT_Sans_Narrow\Size:14\Color:Black\Style:[]'
                        'Name:PT_Sans_Narrow\Size:12\Color:Black\Style:[]'
                        'Name:PT_Sans_Narrow\Size:10\Color:Black\Style:[]'
                        'Name:PT_Sans_Narrow\Size:8\Color:Black\Style:[]'
                      )
                      TabOrder = 5
                      Text = 'Name:PT_Mono\Size:10\Color:Black\Style:[Bold]'
                    end
                    object BitBtnSmlDaqGuiTitleFont: TBitBtn
                      Left = 4
                      Height = 26
                      Hint = 'Choose font uses for SMI GUI Title.'
                      Top = 0
                      Width = 174
                      Caption = 'FSM Title Font &gt;&gt;'
                      Images = DataModuleGuiResMain.ImageListMain16x16
                      ImageIndex = 35
                      OnClick = ActionSmlDaqFontDialogExecute
                      TabOrder = 0
                    end
                    object BitBtnSmlDaqGuiStateFont: TBitBtn
                      Left = 4
                      Height = 26
                      Hint = 'Choose font uses for SMI GUI State Buttons.'
                      Top = 28
                      Width = 174
                      Caption = 'FSM State Font &gt;&gt;'
                      Glyph.Data = {
[encoded data, 11481 characters]
                        AB00ABABAB00ABABAB00ABABAB00ABABAB00ABABAB00ABABAB00
                      }
                      Images = DataModuleGuiResMain.ImageListMain16x16
                      ImageIndex = 35
                      OnClick = ActionSmlDaqFontDialogExecute
                      TabOrder = 2
                    end
                    object BitBtnSmlDaqGuiParamFont: TBitBtn
                      Left = 4
                      Height = 26
                      Hint = 'Choose font uses for SMI GUI Parameters.'
                      Top = 56
                      Width = 174
                      Caption = 'FSM Param Font &gt;&gt;'
                      Glyph.Data = {
[encoded data, 11481 characters]
                        AB00ABABAB00ABABAB00ABABAB00ABABAB00ABABAB00ABABAB00
                      }
                      Images = DataModuleGuiResMain.ImageListMain16x16
                      ImageIndex = 35
                      OnClick = ActionSmlDaqFontDialogExecute
                      TabOrder = 4
                    end
                    object BitBtnSmlDaqGuiMenusFont: TBitBtn
                      Left = 4
                      Height = 26
                      Hint = 'Choose font uses for SMI GUI Action Menu`s.'
                      Top = 112
                      Width = 174
                      Caption = 'FSM Menus Font &gt;&gt;'
                      Glyph.Data = {
[encoded data, 11481 characters]
                        AB00ABABAB00ABABAB00ABABAB00ABABAB00ABABAB00ABABAB00
                      }
                      Images = DataModuleGuiResMain.ImageListMain16x16
                      ImageIndex = 35
                      OnClick = ActionSmlDaqFontDialogExecute
                      TabOrder = 8
                    end
                    object ComboBoxSmlDaqGuiMenusFont: TComboBox
                      Left = 180
                      Height = 27
                      Hint = 'Font uses for FSM Menus.'
                      Top = 112
                      Width = 542
                      Anchors = [akTop, akLeft, akRight]
                      DropDownCount = 32
                      ItemHeight = 0
                      ItemIndex = 0
                      Items.Strings = (
                        'Name:PT_Mono\Size:16\Color:Black\Style:[Bold]'
                        'Name:PT_Mono\Size:14\Color:Black\Style:[Bold]'
                        'Name:PT_Mono\Size:12\Color:Black\Style:[Bold]'
                        'Name:PT_Mono\Size:10\Color:Black\Style:[Bold]'
                        'Name:PT_Mono\Size:8\Color:Black\Style:[Bold]'
                        'Name:PT_Sans\Size:16\Color:Black\Style:[Bold]'
                        'Name:PT_Sans\Size:14\Color:Black\Style:[Bold]'
                        'Name:PT_Sans\Size:12\Color:Black\Style:[Bold]'
                        'Name:PT_Sans\Size:10\Color:Black\Style:[Bold]'
                        'Name:PT_Sans\Size:8\Color:Black\Style:[Bold]'
                        'Name:PT_Sans_Narrow\Size:16\Color:Black\Style:[Bold]'
                        'Name:PT_Sans_Narrow\Size:14\Color:Black\Style:[Bold]'
                        'Name:PT_Sans_Narrow\Size:12\Color:Black\Style:[Bold]'
                        'Name:PT_Sans_Narrow\Size:10\Color:Black\Style:[Bold]'
                        'Name:PT_Sans_Narrow\Size:8\Color:Black\Style:[Bold]'
                        'Name:PT_Mono\Size:16\Color:Black\Style:[]'
                        'Name:PT_Mono\Size:14\Color:Black\Style:[]'
                        'Name:PT_Mono\Size:12\Color:Black\Style:[]'
                        'Name:PT_Mono\Size:10\Color:Black\Style:[]'
                        'Name:PT_Mono\Size:8\Color:Black\Style:[]'
                        'Name:PT_Sans\Size:16\Color:Black\Style:[]'
                        'Name:PT_Sans\Size:14\Color:Black\Style:[]'
                        'Name:PT_Sans\Size:12\Color:Black\Style:[]'
                        'Name:PT_Sans\Size:10\Color:Black\Style:[]'
                        'Name:PT_Sans\Size:8\Color:Black\Style:[]'
                        'Name:PT_Sans_Narrow\Size:16\Color:Black\Style:[]'
                        'Name:PT_Sans_Narrow\Size:14\Color:Black\Style:[]'
                        'Name:PT_Sans_Narrow\Size:12\Color:Black\Style:[]'
                        'Name:PT_Sans_Narrow\Size:10\Color:Black\Style:[]'
                        'Name:PT_Sans_Narrow\Size:8\Color:Black\Style:[]'
                      )
                      TabOrder = 9
                      Text = 'Name:PT_Mono\Size:16\Color:Black\Style:[Bold]'
                    end
                    object BitBtnSmlDaqGuiLabelFont: TBitBtn
                      Left = 4
                      Height = 26
                      Hint = 'Choose font uses for SMI GUI Parameters.'
                      Top = 84
                      Width = 174
                      Caption = 'FSM Label Font &gt;&gt;'
                      Glyph.Data = {
[encoded data, 11481 characters]
                        AB00ABABAB00ABABAB00ABABAB00ABABAB00ABABAB00ABABAB00
                      }
                      Images = DataModuleGuiResMain.ImageListMain16x16
                      ImageIndex = 35
                      OnClick = ActionSmlDaqFontDialogExecute
                      TabOrder = 6
                    end
                    object ComboBoxSmlDaqGuiLabelFont: TComboBox
                      Left = 180
                      Height = 27
                      Hint = 'Font uses for FSM Labels.'
                      Top = 84
                      Width = 542
                      Anchors = [akTop, akLeft, akRight]
                      DropDownCount = 32
                      ItemHeight = 0
                      ItemIndex = 23
                      Items.Strings = (
                        'Name:PT_Mono\Size:16\Color:Black\Style:[Bold]'
                        'Name:PT_Mono\Size:14\Color:Black\Style:[Bold]'
                        'Name:PT_Mono\Size:12\Color:Black\Style:[Bold]'
                        'Name:PT_Mono\Size:10\Color:Black\Style:[Bold]'
                        'Name:PT_Mono\Size:8\Color:Black\Style:[Bold]'
                        'Name:PT_Sans\Size:16\Color:Black\Style:[Bold]'
                        'Name:PT_Sans\Size:14\Color:Black\Style:[Bold]'
                        'Name:PT_Sans\Size:12\Color:Black\Style:[Bold]'
                        'Name:PT_Sans\Size:10\Color:Black\Style:[Bold]'
                        'Name:PT_Sans\Size:8\Color:Black\Style:[Bold]'
                        'Name:PT_Sans_Narrow\Size:16\Color:Black\Style:[Bold]'
                        'Name:PT_Sans_Narrow\Size:14\Color:Black\Style:[Bold]'
                        'Name:PT_Sans_Narrow\Size:12\Color:Black\Style:[Bold]'
                        'Name:PT_Sans_Narrow\Size:10\Color:Black\Style:[Bold]'
                        'Name:PT_Sans_Narrow\Size:8\Color:Black\Style:[Bold]'
                        'Name:PT_Mono\Size:16\Color:Black\Style:[]'
                        'Name:PT_Mono\Size:14\Color:Black\Style:[]'
                        'Name:PT_Mono\Size:12\Color:Black\Style:[]'
                        'Name:PT_Mono\Size:10\Color:Black\Style:[]'
                        'Name:PT_Mono\Size:8\Color:Black\Style:[]'
                        'Name:PT_Sans\Size:16\Color:Black\Style:[]'
                        'Name:PT_Sans\Size:14\Color:Black\Style:[]'
                        'Name:PT_Sans\Size:12\Color:Black\Style:[]'
                        'Name:PT_Sans\Size:10\Color:Black\Style:[]'
                        'Name:PT_Sans\Size:8\Color:Black\Style:[]'
                        'Name:PT_Sans_Narrow\Size:16\Color:Black\Style:[]'
                        'Name:PT_Sans_Narrow\Size:14\Color:Black\Style:[]'
                        'Name:PT_Sans_Narrow\Size:12\Color:Black\Style:[]'
                        'Name:PT_Sans_Narrow\Size:10\Color:Black\Style:[]'
                        'Name:PT_Sans_Narrow\Size:8\Color:Black\Style:[]'
                      )
                      TabOrder = 7
                      Text = 'Name:PT_Sans\Size:10\Color:Black\Style:[]'
                    end
                    object BitBtnSmlDaqGuiDomainFont: TBitBtn
                      Left = 4
                      Height = 26
                      Hint = 'Choose font uses for SMI GUI Action Menu`s.'
                      Top = 140
                      Width = 174
                      Caption = 'FSM DomainFont &gt;&gt;'
                      Glyph.Data = {
[encoded data, 11481 characters]
                        AB00ABABAB00ABABAB00ABABAB00ABABAB00ABABAB00ABABAB00
                      }
                      Images = DataModuleGuiResMain.ImageListMain16x16
                      ImageIndex = 35
                      OnClick = ActionSmlDaqFontDialogExecute
                      TabOrder = 10
                    end
                    object ComboBoxSmlDaqGuiDomainFont: TComboBox
                      Left = 180
                      Height = 27
                      Hint = 'Font uses for FSM Domain.'
                      Top = 140
                      Width = 542
                      Anchors = [akTop, akLeft, akRight]
                      DropDownCount = 32
                      ItemHeight = 0
                      ItemIndex = 29
                      Items.Strings = (
                        'Name:PT_Mono\Size:16\Color:Black\Style:[Bold]'
                        'Name:PT_Mono\Size:14\Color:Black\Style:[Bold]'
                        'Name:PT_Mono\Size:12\Color:Black\Style:[Bold]'
                        'Name:PT_Mono\Size:10\Color:Black\Style:[Bold]'
                        'Name:PT_Mono\Size:8\Color:Black\Style:[Bold]'
                        'Name:PT_Sans\Size:16\Color:Black\Style:[Bold]'
                        'Name:PT_Sans\Size:14\Color:Black\Style:[Bold]'
                        'Name:PT_Sans\Size:12\Color:Black\Style:[Bold]'
                        'Name:PT_Sans\Size:10\Color:Black\Style:[Bold]'
                        'Name:PT_Sans\Size:8\Color:Black\Style:[Bold]'
                        'Name:PT_Sans_Narrow\Size:16\Color:Black\Style:[Bold]'
                        'Name:PT_Sans_Narrow\Size:14\Color:Black\Style:[Bold]'
                        'Name:PT_Sans_Narrow\Size:12\Color:Black\Style:[Bold]'
                        'Name:PT_Sans_Narrow\Size:10\Color:Black\Style:[Bold]'
                        'Name:PT_Sans_Narrow\Size:8\Color:Black\Style:[Bold]'
                        'Name:PT_Mono\Size:16\Color:Black\Style:[]'
                        'Name:PT_Mono\Size:14\Color:Black\Style:[]'
                        'Name:PT_Mono\Size:12\Color:Black\Style:[]'
                        'Name:PT_Mono\Size:10\Color:Black\Style:[]'
                        'Name:PT_Mono\Size:8\Color:Black\Style:[]'
                        'Name:PT_Sans\Size:16\Color:Black\Style:[]'
                        'Name:PT_Sans\Size:14\Color:Black\Style:[]'
                        'Name:PT_Sans\Size:12\Color:Black\Style:[]'
                        'Name:PT_Sans\Size:10\Color:Black\Style:[]'
                        'Name:PT_Sans\Size:8\Color:Black\Style:[]'
                        'Name:PT_Sans_Narrow\Size:16\Color:Black\Style:[]'
                        'Name:PT_Sans_Narrow\Size:14\Color:Black\Style:[]'
                        'Name:PT_Sans_Narrow\Size:12\Color:Black\Style:[]'
                        'Name:PT_Sans_Narrow\Size:10\Color:Black\Style:[]'
                        'Name:PT_Sans_Narrow\Size:8\Color:Black\Style:[]'
                      )
                      TabOrder = 11
                      Text = 'Name:PT_Sans_Narrow\Size:8\Color:Black\Style:[]'
                    end
                  end
                end
              end
              object TabSheetDaqCfg: TTabSheet
                Caption = 'CFG '
                ClientHeight = 356
                ClientWidth = 742
                ImageIndex = 241
                object PanelDaqCfgButtons: TPanel
                  Left = 700
                  Height = 356
                  Top = 0
                  Width = 42
                  Align = alRight
                  BorderWidth = 4
                  ClientHeight = 352
                  ClientWidth = 38
                  TabOrder = 0
                  object BitBtnDaqCfgSelectAll: TBitBtn
                    Left = 4
                    Height = 30
                    Hint = 'Select all CFG text.'
                    Top = 4
                    Width = 31
                    Images = DataModuleGuiResMain.ImageListMain16x16
                    ImageIndex = 33
                    OnClick = BitBtnDaqCfgSelectAllClick
                    TabOrder = 0
                  end
                  object BitBtnDaqCfgUnselect: TBitBtn
                    Left = 4
                    Height = 30
                    Hint = 'Unselect CFG text.'
                    Top = 36
                    Width = 31
                    Images = DataModuleGuiResMain.ImageListMain16x16
                    ImageIndex = 34
                    OnClick = BitBtnDaqCfgUnselectClick
                    TabOrder = 1
                  end
                  object BitBtnDaqCfgCopyToClipboard: TBitBtn
                    Left = 4
                    Height = 30
                    Hint = 'Copy CFG selected text to Clipboard.'
                    Top = 72
                    Width = 31
                    Images = DataModuleGuiResMain.ImageListMain16x16
                    ImageIndex = 49
                    OnClick = BitBtnDaqCfgCopyToClipboardClick
                    TabOrder = 2
                  end
                  object BitBtnDaqCfgSaveAs: TBitBtn
                    Left = 4
                    Height = 30
                    Hint = 'Save CFG to file.'
                    Top = 108
                    Width = 31
                    Images = DataModuleGuiResMain.ImageListMain16x16
                    ImageIndex = 6
                    OnClick = BitBtnDaqCfgSaveAsClick
                    TabOrder = 3
                  end
                end
                object PanelDaqCfgMemo: TPanel
                  Left = 0
                  Height = 356
                  Top = 0
                  Width = 700
                  Align = alClient
                  BorderWidth = 4
                  ClientHeight = 352
                  ClientWidth = 696
                  TabOrder = 1
                  object MemoDaqCfg: TMemo
                    Left = 5
                    Height = 342
                    Top = 5
                    Width = 686
                    Align = alClient
                    Color = clInfoBk
                    HideSelection = False
                    ReadOnly = True
                    ScrollBars = ssAutoBoth
                    TabOrder = 0
                    WordWrap = False
                  end
                end
              end
              object TabSheetDaqCrc: TTabSheet
                Caption = 'CRC '
                ClientHeight = 356
                ClientWidth = 742
                ImageIndex = 246
                object PanelDaqCrcButtons: TPanel
                  Left = 700
                  Height = 356
                  Top = 0
                  Width = 42
                  Align = alRight
                  BorderWidth = 4
                  ClientHeight = 352
                  ClientWidth = 38
                  TabOrder = 0
                  object BitBtnDaqCrcSelectAll: TBitBtn
                    Left = 4
                    Height = 30
                    Hint = 'Select all CRC text.'
                    Top = 4
                    Width = 31
                    Images = DataModuleGuiResMain.ImageListMain16x16
                    ImageIndex = 33
                    OnClick = BitBtnDaqCrcSelectAllClick
                    TabOrder = 0
                  end
                  object BitBtnDaqCrcUnselect: TBitBtn
                    Left = 4
                    Height = 30
                    Hint = 'Unselect CRC text.'
                    Top = 36
                    Width = 31
                    Images = DataModuleGuiResMain.ImageListMain16x16
                    ImageIndex = 34
                    OnClick = BitBtnDaqCrcUnselectClick
                    TabOrder = 1
                  end
                  object BitBtnDaqCrcCopyToClipboard: TBitBtn
                    Left = 4
                    Height = 30
                    Hint = 'Copy CRC selected text to Clipboard.'
                    Top = 72
                    Width = 31
                    Images = DataModuleGuiResMain.ImageListMain16x16
                    ImageIndex = 25
                    OnClick = BitBtnDaqCrcCopyToClipboardClick
                    TabOrder = 2
                  end
                  object BitBtnDaqCrcSaveAs: TBitBtn
                    Left = 4
                    Height = 30
                    Hint = 'Save CRC to file.'
                    Top = 108
                    Width = 31
                    Images = DataModuleGuiResMain.ImageListMain16x16
                    ImageIndex = 6
                    OnClick = BitBtnDaqCrcSaveAsClick
                    TabOrder = 3
                  end
                end
                object PanelDaqCrcMemo: TPanel
                  Left = 0
                  Height = 356
                  Top = 0
                  Width = 700
                  Align = alClient
                  BorderWidth = 4
                  ClientHeight = 352
                  ClientWidth = 696
                  TabOrder = 1
                  object MemoDaqCrc: TMemo
                    Left = 5
                    Height = 342
                    Top = 5
                    Width = 686
                    Align = alClient
                    Color = clInfoBk
                    ScrollBars = ssAutoBoth
                    TabOrder = 0
                    WordWrap = False
                  end
                end
              end
            end
          end
        end
      end
      object TabSheetSmiRun: TTabSheet
        Caption = 'Run '
        ClientHeight = 558
        ClientWidth = 772
        ImageIndex = 114
        OnEnter = TabSheetSmiRunEnter
        object GroupBoxSmiRunCmd: TGroupBox
          Left = 0
          Height = 558
          Top = 0
          Width = 772
          Align = alClient
          Caption = ' Run SMI or DIM command(s)'
          ClientHeight = 542
          ClientWidth = 770
          TabOrder = 0
          object PanelSmiRunParams: TPanel
            Left = 0
            Height = 102
            Top = 0
            Width = 770
            Align = alTop
            BorderWidth = 4
            ClientHeight = 102
            ClientWidth = 770
            TabOrder = 0
            OnClick = PanelSmiRunParamsClick
            object ComboBoxSmiRunDns: TComboBox
              Left = 144
              Height = 27
              Top = 4
              Width = 200
              DropDownCount = 32
              ItemHeight = 0
              TabOrder = 0
            end
            object LabelSmiRunDns: TLabel
              Left = 8
              Height = 15
              Top = 12
              Width = 128
              Caption = 'Use DIM_DNS_NODE'
              ParentColor = False
            end
            object ComboBoxSmiRunCmd: TComboBox
              Left = 144
              Height = 27
              Top = 32
              Width = 616
              Anchors = [akTop, akLeft, akRight]
              DropDownCount = 32
              ItemHeight = 0
              TabOrder = 3
              Text = 'dnsRunning'
            end
            object BitBtnSmiRunCommand: TBitBtn
              Left = 4
              Height = 30
              Top = 32
              Width = 135
              Action = ActionSmiRunCmd
              Images = DataModuleGuiResMain.ImageListMain16x16
              ImageIndex = 64
              TabOrder = 2
            end
            object SpinEditSmiRunTimeout: TSpinEdit
              Left = 488
              Height = 25
              Top = 4
              Width = 50
              MaxValue = 300
              MinValue = 1
              TabOrder = 1
              Value = 7
            end
            object LabelSmiRunTimeout: TLabel
              Left = 356
              Height = 15
              Top = 12
              Width = 128
              Caption = 'Run Timeout, sec'
              ParentColor = False
            end
            object BitBtnSmiStartCmd: TBitBtn
              Left = 4
              Height = 30
              Top = 64
              Width = 135
              Action = ActionSmiStartCmd
              Images = DataModuleGuiResMain.ImageListMain16x16
              ImageIndex = 159
              TabOrder = 4
            end
            object LabelSmiStartTerm: TLabel
              Left = 148
              Height = 15
              Top = 72
              Width = 104
              Caption = 'with Terminal'
              ParentColor = False
            end
            object ComboBoxSmiStartTerm: TComboBox
              Left = 256
              Height = 27
              Top = 64
              Width = 504
              Anchors = [akTop, akLeft, akRight]
              ItemHeight = 0
              TabOrder = 5
            end
            object LabelSmiRunLogHistory: TLabel
              Left = 548
              Height = 15
              Top = 12
              Width = 88
              Caption = 'Log History'
              ParentColor = False
            end
            object ComboBoxSmiRunLogHistory: TComboBox
              Left = 644
              Height = 27
              Hint = 'History limit of Log texts, in lines'
              Top = 4
              Width = 116
              ItemHeight = 0
              ItemIndex = 4
              Items.Strings = (
                '1'
                '10'
                '100'
                '1000'
                '10000'
                '100000'
                '1000000'
                '10000000'
                '100000000'
              )
              TabOrder = 6
              Text = '10000'
            end
          end
          object PanelSmiRunLogo: TPanel
            Left = 0
            Height = 440
            Top = 102
            Width = 728
            Align = alClient
            BorderWidth = 4
            ClientHeight = 440
            ClientWidth = 728
            TabOrder = 1
            object MemoSmiRunLog: TMemo
              Left = 5
              Height = 430
              Top = 5
              Width = 718
              Align = alClient
              Color = clInfoBk
              HideSelection = False
              ReadOnly = True
              ScrollBars = ssAutoBoth
              TabOrder = 0
              WordWrap = False
            end
          end
          object PanelSmiRunLogButtons: TPanel
            Left = 728
            Height = 440
            Top = 102
            Width = 42
            Align = alRight
            BorderWidth = 4
            ClientHeight = 440
            ClientWidth = 42
            TabOrder = 2
            object BitBtnSmiRunLogSelAll: TBitBtn
              Left = 4
              Height = 30
              Top = 4
              Width = 33
              Action = ActionSmiRunLogSelAll
              Images = DataModuleGuiResMain.ImageListMain16x16
              ImageIndex = 33
              TabOrder = 0
            end
            object BitBtnSmiRunLogSelNon: TBitBtn
              Left = 4
              Height = 30
              Top = 36
              Width = 33
              Action = ActionSmiRunLogSelNon
              Images = DataModuleGuiResMain.ImageListMain16x16
              ImageIndex = 34
              TabOrder = 1
            end
            object BitBtnSmiRunLogClear: TBitBtn
              Left = 4
              Height = 30
              Top = 68
              Width = 33
              Action = ActionSmiRunLogClear
              Images = DataModuleGuiResMain.ImageListMain16x16
              ImageIndex = 23
              TabOrder = 2
            end
            object BitBtnSmiRunLogCopy: TBitBtn
              Left = 4
              Height = 30
              Top = 100
              Width = 33
              Action = ActionSmiRunLogCopy
              Images = DataModuleGuiResMain.ImageListMain16x16
              ImageIndex = 25
              TabOrder = 3
            end
          end
        end
      end
      object TabSheetSmiHelp: TTabSheet
        Caption = 'Help '
        ClientHeight = 558
        ClientWidth = 772
        ImageIndex = 124
        object PanelSmiHelp: TPanel
          Left = 0
          Height = 558
          Top = 0
          Width = 772
          Align = alClient
          BorderWidth = 4
          ClientHeight = 558
          ClientWidth = 772
          TabOrder = 0
          object GroupBoxSmiHelp: TGroupBox
            Left = 5
            Height = 221
            Top = 5
            Width = 762
            Align = alTop
            Caption = ' Help on SMI and DIM '
            ClientHeight = 205
            ClientWidth = 760
            TabOrder = 0
            object BitBtnSmiHelpDimIndex: TBitBtn
              Left = 4
              Height = 46
              Top = 4
              Width = 207
              Caption = ' Browse index.html '
              Images = DataModuleGuiResMain.ImageListMain32x32
              ImageIndex = 228
              OnClick = BitBtnSmiHelpDimIndexClick
              TabOrder = 0
            end
            object BitBtnSmiHelpDimWebCernCh: TBitBtn
              Left = 212
              Height = 46
              Top = 4
              Width = 207
              Caption = 'See dim.web.cern.ch'
              Images = DataModuleGuiResMain.ImageListMain32x32
              ImageIndex = 179
              OnClick = BitBtnSmiHelpDimWebCernChClick
              TabOrder = 1
            end
            object BitBtnSmiHelpResourceDimSite: TBitBtn
              Left = 420
              Height = 46
              Top = 4
              Width = 207
              Caption = 'Resource\DimSite'
              Images = DataModuleGuiResMain.ImageListMain32x32
              ImageIndex = 211
              OnClick = BitBtnSmiHelpResourceDimSiteClick
              TabOrder = 2
            end
            object BitBtnSmiHelpDimSiteReadmeHtm: TBitBtn
              Left = 4
              Height = 46
              Top = 52
              Width = 207
              Caption = ' Browse readme.htm '
              Images = DataModuleGuiResMain.ImageListMain32x32
              ImageIndex = 228
              OnClick = BitBtnSmiHelpDimSiteReadmeHtmClick
              TabOrder = 3
            end
            object BitBtnSmiHelpDimManRuPdf: TBitBtn
              Left = 212
              Height = 46
              Top = 52
              Width = 207
              Caption = 'View dim_man_ru.pdf'
              Images = DataModuleGuiResMain.ImageListMain32x32
              ImageIndex = 228
              OnClick = BitBtnSmiHelpDimManRuPdfClick
              TabOrder = 4
            end
            object BitBtnSmiHelpDimOverview: TBitBtn
              Left = 420
              Height = 46
              Top = 52
              Width = 207
              Caption = '   dim_overview.pdf'
              Images = DataModuleGuiResMain.ImageListMain32x32
              ImageIndex = 228
              OnClick = BitBtnSmiHelpDimOverviewClick
              TabOrder = 5
            end
            object BitBtnSmiHelpIndex: TBitBtn
              Left = 4
              Height = 46
              Top = 104
              Width = 207
              Caption = ' Browse index.html '
              Images = DataModuleGuiResTools.ImageListTools32x32
              ImageIndex = 31
              OnClick = BitBtnSmiHelpIndexClick
              TabOrder = 6
            end
            object BitBtnSmiHelpSmiWebCernCh: TBitBtn
              Left = 212
              Height = 46
              Top = 104
              Width = 207
              Caption = 'See smi.web.cern.ch'
              Images = DataModuleGuiResMain.ImageListMain32x32
              ImageIndex = 179
              OnClick = BitBtnSmiHelpSmiWebCernChClick
              TabOrder = 7
            end
            object BitBtnSmiHelpResourceSmiSite: TBitBtn
              Left = 420
              Height = 46
              Top = 104
              Width = 207
              Caption = 'Resource\SmiSite'
              Images = DataModuleGuiResMain.ImageListMain32x32
              ImageIndex = 211
              OnClick = BitBtnSmiHelpResourceSmiSiteClick
              TabOrder = 8
            end
            object BitBtnSmiHelpSmiSiteReadmeHtm: TBitBtn
              Left = 4
              Height = 46
              Top = 152
              Width = 207
              Caption = ' Browse readme.htm '
              Images = DataModuleGuiResTools.ImageListTools32x32
              ImageIndex = 31
              OnClick = BitBtnSmiHelpSmiSiteReadmeHtmClick
              TabOrder = 9
            end
            object BitBtnSmiHelpSmiManRuPdf: TBitBtn
              Left = 212
              Height = 46
              Top = 152
              Width = 207
              Caption = 'View smi_man_ru.pdf'
              Images = DataModuleGuiResTools.ImageListTools32x32
              ImageIndex = 31
              OnClick = BitBtnSmiHelpSmiManRuPdfClick
              TabOrder = 10
            end
            object BitBtnSmiHelpSmiOverview: TBitBtn
              Left = 420
              Height = 46
              Top = 152
              Width = 207
              Caption = '   smi_overview.pdf'
              Images = DataModuleGuiResTools.ImageListTools32x32
              ImageIndex = 31
              OnClick = BitBtnSmiHelpSmiOverviewClick
              TabOrder = 11
            end
          end
          object GroupBoxSmiDisplayOptions: TGroupBox
            Left = 5
            Height = 53
            Top = 226
            Width = 762
            Align = alTop
            Caption = ' Display Options '
            ClientHeight = 37
            ClientWidth = 760
            TabOrder = 1
            object LabelXTermFontName: TLabel
              Left = 8
              Height = 15
              Top = 12
              Width = 120
              Caption = 'xterm Font Name'
              ParentColor = False
            end
            object ComboBoxXTermFontName: TComboBox
              Left = 136
              Height = 27
              Hint = 'Font Name uses for xterm.'
              Top = 4
              Width = 168
              ItemHeight = 0
              ItemIndex = 0
              Items.Strings = (
                ''
                'PT Mono'
                'Monospace'
              )
              Style = csDropDownList
              TabOrder = 0
            end
            object LabelXTermFontSize: TLabel
              Left = 312
              Height = 15
              Top = 12
              Width = 56
              Caption = 'Size,pt'
              ParentColor = False
            end
            object ComboBoxXTermFontSize: TComboBox
              Left = 372
              Height = 27
              Hint = 'Font Size uses for xterm.'
              Top = 4
              Width = 64
              ItemHeight = 0
              ItemIndex = 0
              Items.Strings = (
                ''
                '8'
                '9'
                '10'
                '11'
                '12'
                '14'
                '16'
                '18'
                '20'
                '22'
                '24'
                '26'
                '28'
                '30'
                '32'
              )
              Style = csDropDownList
              TabOrder = 1
            end
          end
        end
      end
      object TabSheetLogEvents: TTabSheet
        BorderWidth = 8
        Caption = 'Log  '
        ClientHeight = 558
        ClientWidth = 772
        ImageIndex = 168
        object PanelLogEventsContent: TPanel
          Left = 0
          Height = 496
          Top = 0
          Width = 772
          Align = alClient
          BorderWidth = 8
          ClientHeight = 496
          ClientWidth = 772
          TabOrder = 0
          object LabelLogEvents: TLabel
            Left = 9
            Height = 15
            Top = 9
            Width = 754
            Align = alTop
            Caption = 'Event log (list of events occurred):'
            ParentColor = False
          end
          object MemoLogEvents: TMemo
            Left = 9
            Height = 446
            Top = 24
            Width = 754
            Align = alClient
            Color = clInfoBk
            ReadOnly = True
            ScrollBars = ssAutoBoth
            TabOrder = 0
            WordWrap = False
          end
          object StatusBarLogEvents: TStatusBar
            Left = 9
            Height = 17
            Top = 470
            Width = 754
            Panels = &lt;&gt;
          end
        end
        object PanelLogEventsButtons: TPanel
          Left = 0
          Height = 62
          Top = 496
          Width = 772
          Align = alBottom
          BorderWidth = 8
          ClientHeight = 62
          ClientWidth = 772
          TabOrder = 1
          object BitBtnLogEventsTest: TBitBtn
            Left = 477
            Height = 46
            Hint = 'Raise exception for test.'
            Top = 8
            Width = 91
            Anchors = [akTop, akRight]
            Caption = ' Test'
            Images = DataModuleGuiResMain.ImageListMain32x32
            ImageIndex = 115
            OnClick = BitBtnLogEventsTestClick
            TabOrder = 0
          end
          object BitBtnLogEventsClear: TBitBtn
            Left = 573
            Height = 46
            Top = 8
            Width = 91
            Action = ActionMainLogEventsClear
            Anchors = [akTop, akRight]
            Images = DataModuleGuiResMain.ImageListMain32x32
            ImageIndex = 119
            TabOrder = 1
          end
          object BitBtnLogEventsGoBack: TBitBtn
            Left = 669
            Height = 46
            Top = 8
            Width = 91
            Action = ActionMainLogEventsGoBack
            Anchors = [akTop, akRight]
            Images = DataModuleGuiResMain.ImageListMain32x32
            ImageIndex = 59
            TabOrder = 2
          end
          object LabelMainListSysInfo: TLabel
            Left = 8
            Height = 15
            Top = 8
            Width = 88
            Caption = 'Info topic:'
            ParentColor = False
          end
          object ComboBoxMainListSysInfo: TComboBox
            Left = 8
            Height = 27
            Top = 28
            Width = 182
            DropDownCount = 24
            ItemHeight = 0
            ItemIndex = 0
            Items.Strings = (
              'list environ'
              'list session'
              'list modules 0'
              'list process 0 0 *'
              'list windows 0 * *'
            )
            TabOrder = 3
            Text = 'list environ'
          end
          object LabelMainListSysInfoTimeOut: TLabel
            Left = 190
            Height = 15
            Top = 8
            Width = 56
            Caption = 'TimeOut'
            ParentColor = False
          end
          object SpinEditMainListSysInfoTimeOut: TSpinEdit
            Left = 190
            Height = 25
            Hint = 'Timeout for execution, sec.'
            Top = 26
            Width = 54
            MaxValue = 60
            MinValue = 1
            TabOrder = 4
            Value = 5
          end
          object BitBtnMainListSysInfo: TBitBtn
            Left = 246
            Height = 46
            Top = 8
            Width = 91
            Action = ActionMainListSysInfo
            Images = DataModuleGuiResMain.ImageListMain32x32
            ImageIndex = 124
            TabOrder = 5
          end
        end
      end
    end
  end
  object TimerLogEventsUpdater: TTimer
    OnTimer = TimerLogEventsUpdaterTimer
    Left = 620
  end
  object ActionListMain: TActionList
    Images = DataModuleGuiResMain.ImageListMain32x32
    Left = 548
    object ActionMainProgramExit: TAction
      Caption = 'Exit'
      Hint = 'Exit program.'
      ImageIndex = 113
      OnExecute = ActionMainExitExecute
    end
    object ActionMainParentShow: TAction
      Caption = 'Show'
      Hint = 'Open (activate) patent Crw32 program window.'
      ImageIndex = 234
      OnExecute = ActionMainParentShowExecute
    end
    object ActionMainFormShow: TAction
      Caption = 'Show MainForm'
      ImageIndex = 164
      OnExecute = ActionMainFormShowExecute
    end
    object ActionMainSendUserCmnd: TAction
      Caption = 'Send'
      Hint = 'Send command to CRW-DAQ  console.'
      ImageIndex = 59
      OnExecute = ActionMainSendUserCmndExecute
    end
    object ActionMainExecUserCmnd: TAction
      Caption = 'Exec'
      Hint = 'Run command from Crw32.ini list.'
      ImageIndex = 114
      OnExecute = ActionMainExecUserCmndExecute
    end
    object ActionMainLogEventsClear: TAction
      Caption = 'Clear'
      Hint = 'Clear event log.'
      ImageIndex = 119
      OnExecute = ActionMainLogEventsClearExecute
    end
    object ActionMainLogEventsGoBack: TAction
      Caption = 'Back'
      Hint = 'Go back to main page.'
      ImageIndex = 59
      OnExecute = ActionMainLogEventsGoBackExecute
    end
    object ActionSmlFileOpen: TAction
      Caption = 'SML Open …'
      ImageIndex = 3
      OnExecute = ActionSmlFileOpenExecute
    end
    object ActionSmlFileCompile: TAction
      Caption = 'Compile SML =&gt; SOBJ'
      Hint = 'Compile SML file with smiTrans.exe to SOBJ object file.'
      ImageIndex = 37
      OnExecute = ActionSmlFileCompileExecute
    end
    object ActionSmlFileFixEol: TAction
      Caption = 'Fix'
      Hint = 'Fix file EOL (end of line markes) and/or UTF8.'
      ImageIndex = 253
      OnExecute = ActionSmlFileFixEolExecute
    end
    object ActionSmlFileEdit: TAction
      Caption = 'Edit SML'
      Hint = 'Edit SML file.'
      ImageIndex = 53
      OnExecute = ActionSmlFileEditExecute
    end
    object ActionSmiFileView: TAction
      Caption = 'View SML'
      Hint = 'View SML file.'
      ImageIndex = 164
      OnExecute = ActionSmiFileViewExecute
    end
    object ActionSobjFileView: TAction
      Caption = 'View SOBJ'
      Hint = 'View SOBJ file.'
      ImageIndex = 164
      OnExecute = ActionSobjFileViewExecute
    end
    object ActionSmiSmRun: TAction
      Caption = 'Run smiSM'
      Hint = 'Run smiSM.exe State Manager Server.'
      ImageIndex = 64
      OnExecute = ActionSmiSmRunExecute
    end
    object ActionSmiSmList: TAction
      Caption = 'List'
      Hint = 'List running SMI Domains.'
      ImageIndex = 36
      OnExecute = ActionSmiSmListExecute
    end
    object ActionSmiSmKill: TAction
      Caption = 'Kill'
      Hint = 'Kill SMI Domain selected in SML Result Log.'
      ImageIndex = 23
      OnExecute = ActionSmiSmKillExecute
    end
    object ActionSmiSmKillAll: TAction
      Caption = 'Kill ALL'
      Hint = 'Kill ALL smiSM processes.'
      ImageIndex = 115
      OnExecute = ActionSmiSmKillAllExecute
    end
    object ActionSmiSmOptionsHelp: TAction
      Caption = 'Help'
      Hint = 'Help on smiSM runtime options.'
      ImageIndex = 21
      OnExecute = ActionSmiSmOptionsHelpExecute
    end
    object ActionSmiSmViewLog: TAction
      Caption = 'View Log'
      Hint = 'View smiSM Log file.'
      ImageIndex = 164
      OnExecute = ActionSmiSmViewLogExecute
    end
    object ActionSmiSmDeleteLog: TAction
      Caption = 'Delete Log File'
      Hint = 'Delete Log File created by smiSM.'
      ImageIndex = 47
      OnExecute = ActionSmiSmDeleteLogExecute
    end
    object ActionSmlCodeParse: TAction
      Caption = 'Parse SML'
      Hint = 'Parse SML file.'
      ImageIndex = 158
      OnExecute = ActionSmlCodeParseExecute
    end
    object ActionSmlCodeClear: TAction
      Caption = 'Clear All'
      Hint = 'Clear SML Parser Code.'
      ImageIndex = 23
      OnExecute = ActionSmlCodeClearExecute
    end
    object ActionSmlObjectSelect: TAction
      Caption = 'Select'
      Hint = 'Select SML Object item.'
      ImageIndex = 14
      OnExecute = ActionSmlObjectSelectExecute
    end
    object ActionSmlMakeDaqCfg: TAction
      Caption = 'Make CFG'
      Hint = 'Make CFG text for DAQ.'
      ImageIndex = 241
      OnExecute = ActionSmlMakeDaqCfgExecute
    end
    object ActionSmlMakeDaqCrc: TAction
      Caption = 'Make CRC'
      ImageIndex = 246
      OnExecute = ActionSmlMakeDaqCrcExecute
    end
    object ActionSmlDaqGuiCtrlDeviceUpdate: TAction
      Hint = 'Generate SMI DAQ GUI Control Device and Window Name.'
      ImageIndex = 60
      OnExecute = ActionSmlDaqGuiCtrlDeviceUpdateExecute
    end
    object ActionSmlObjectsetSelect: TAction
      Caption = 'Select'
      Hint = 'Select SML Objectset items.'
      ImageIndex = 14
      OnExecute = ActionSmlObjectsetSelectExecute
    end
    object ActionSmlDaqFontDialog: TAction
      Caption = '&lt;&lt;'
      Hint = 'Choose font uses for SMI GUI.'
      ImageIndex = 35
      OnExecute = ActionSmlDaqFontDialogExecute
    end
    object ActionSmlObjectParamSelect: TAction
      Caption = 'Select'
      Hint = 'Select SML Object Parameters.'
      ImageIndex = 14
      OnExecute = ActionSmlObjectParamSelectExecute
    end
    object ActionMainListSysInfo: TAction
      Caption = 'Info'
      Hint = 'Print system information on specified topic.'
      ImageIndex = 124
      OnExecute = ActionMainListSysInfoExecute
    end
    object ActionSmiRunCmd: TAction
      Caption = 'Run Command'
      Hint = 'Run specified SMI or DIM command.'
      ImageIndex = 64
      OnExecute = ActionSmiRunCmdExecute
    end
    object ActionSmiStartCmd: TAction
      Caption = 'Start Process'
      Hint = 'Start SMI or DIM command as separated process.'
      ImageIndex = 159
      OnExecute = ActionSmiStartCmdExecute
    end
    object ActionSmiRunLogSelAll: TAction
      Hint = 'Select All.'
      ImageIndex = 33
      OnExecute = ActionSmiRunLogSelAllExecute
    end
    object ActionSmiRunLogSelNon: TAction
      Hint = 'Unselect.'
      ImageIndex = 34
      OnExecute = ActionSmiRunLogSelNonExecute
    end
    object ActionSmiRunLogClear: TAction
      Hint = 'Clear.'
      ImageIndex = 23
      OnExecute = ActionSmiRunLogClearExecute
    end
    object ActionSmiRunLogCopy: TAction
      Hint = 'Copy.'
      ImageIndex = 25
      OnExecute = ActionSmiRunLogCopyExecute
    end
  end
  object TrayIconMain: TTrayIcon
    PopUpMenu = PopupMenuTray
    Icon.Data = {
[encoded data, 6035 characters]
      000000000000000000000000000000000000
    }
    OnClick = TrayIconMainClick
    OnDblClick = TrayIconMainDblClick
    Left = 656
  end
  object PopupMenuTray: TPopupMenu
    Images = DataModuleGuiResMain.ImageListMain32x32
    Left = 692
    object MenuItemTrayFormShow: TMenuItem
      Action = ActionMainFormShow
    end
    object MenuItemTrayParentShow: TMenuItem
      Action = ActionMainParentShow
    end
    object N1: TMenuItem
      Caption = '-'
    end
    object MenuItemTrayProgramExit: TMenuItem
      Action = ActionMainProgramExit
    end
  end
  object TimerSmiMonitoring: TTimer
    Interval = 50
    OnTimer = TimerMonitoringTimer
    Left = 584
  end
  object OpenDialogSmlFile: TOpenDialog
    Title = 'Open SML file...'
    DefaultExt = '.sml'
    Filter = 'SML files|*.sml|All files|*.*'
    Left = 728
  end
  object SaveDialogSmlDaq: TSaveDialog
    Title = 'Save file as ...'
    DefaultExt = '.cfg'
    Filter = 'CFG files|*.cfg|ALL files|*.*'
    Left = 764
  end
  object FontDialogSmlDaqFont: TFontDialog
    MinFontSize = 0
    MaxFontSize = 0
    PreviewText = 'Params 0123456789'
    Left = 512
  end
  object TimerPollTasks: TTimer
    OnTimer = TimerPollTasksTimer
    Left = 476
  end
end
</Object>
          <Code>unit Main;

uses  dpCmdArgs,dpSystem,dpSysUtils,dpVbs,dpWindows,dpGuiUtils,dpCrwDaqSys,
      dpDaqConfig,dpAntiZombie,dpGuiResMain,dpGuiResTools,dpTask,dpSmiGenGui,
      dpColors,dpFsmUtils,dpCrcUtils;

type
  TMainForm = class(TForm)
    TimerLogEventsUpdater: TTimer;
    ActionListMain: TActionList;
    ActionMainProgramExit: TAction;
    ActionMainParentShow: TAction;
    ActionMainFormShow: TAction;
    ActionMainSendUserCmnd: TAction;
    ActionMainExecUserCmnd: TAction;
    ActionMainLogEventsClear: TAction;
    ActionMainLogEventsGoBack: TAction;
    // TrayIcon
    TrayIconMain: TTrayIcon;
    PopupMenuTray: TPopupMenu;
    MenuItemTrayFormShow: TMenuItem;
    MenuItemTrayParentShow: TMenuItem;
    MenuItemTrayProgramExit: TMenuItem;
    MenuItemTrayProgramExitSeparator: TMenuItem;
    // Main Panel
    PanelMain: TPanel;
    // SmiTabSheet
    TabSheetSmi: TTabSheet;
    PanelSmiContent: TPanel;
    PanelSmiTitle: TPanel;
    GroupBoxSmiDomains: TGroupBox;
    LabelSmiDomainList: TLabel;
    ListBoxSmiDomainList: TListBox;
    LabelSmiDomainHost: TLabel;
    ListBoxSmiDomObjList: TListBox;
    LabelSmiDomObjList: TLabel;
    BitBtnSmiSelObjSelect: TBitBtn;
    ListBoxSmiSelObjList: TListBox;
    GroupBoxSmiDimDnsNode: TGroupBox;
    ComboBoxSmiDimDnsNode: TComboBox;
    LabelSmiDimDnsStatusTitle: TLabel;
    LabelSmiDimDnsStatusValue: TLabel;
    BitBtnSmiDimDnsRefresh: TBitBtn;
    LabelSmiSelObjList: TLabel;
    BitBtnSmiSelObjListMoveUp: TBitBtn;
    BitBtnSmiSelObjListMoveDown: TBitBtn;
    CheckBoxSmiDomObjListSkipAmp: TCheckBox;
    BitBtnSmiStartMonitoring: TBitBtn;
    TimerSmiMonitoring: TTimer;
    BitBtnSmiHelp: TBitBtn;
    LabelSmiTitle: TLabel;
    BitBtnSmiWebSite: TBitBtn;
    // Fsm TabSheet
    TabSheetFsm: TTabSheet;
    PanelFsmButtons: TPanel;
    PanelFsmMonitor: TPanel;
    LabelFsmMonitor: TLabel;
    ScrollBoxFsmObjectList: TScrollBox;
    StatusBarFsmObjectList: TStatusBar;
    // Main TabSheet
    TabSheetMain: TTabSheet;
    PageControlMain: TPageControl;
    PanelFsmOutContent: TPanel;
    PanelMainButtons: TPanel;
    LabeMainSendUserCmnd: TLabel;
    EditMainSendUserCmnd: TEdit;
    BitBtnMainSendUserCmnd: TBitBtn;
    BitBtnMainRunCrw32Ini: TBitBtn;
    BitBtnMainProgramExit: TBitBtn;
    BitBtnMainParentShow: TBitBtn;
    LabelFsmOut: TLabel;
    MemoFsmOut: TMemo;
    PanelFsmOutParams: TPanel;
    CheckBoxFsmOutPrint: TCheckBox;
    // LogEvents TabSheet
    TabSheetLogEvents: TTabSheet;
    PanelLogEventsContent: TPanel;
    LabelLogEvents: TLabel;
    MemoLogEvents: TMemo;
    StatusBarLogEvents: TStatusBar;
    PanelLogEventsButtons: TPanel;
    BitBtnLogEventsTest: TBitBtn;
    BitBtnLogEventsClear: TBitBtn;
    BitBtnLogEventsGoBack: TBitBtn;
    BitBtnSmiTclTkGui: TBitBtn;
    BitBtnFsmOutClear: TBitBtn;
    TabSheetSml: TTabSheet;
    PanelSmlContent: TPanel;
    GroupBoxSmlFile: TGroupBox;
    ComboBoxSmlFile: TComboBox;
    BitBtnSmlFileOpen: TBitBtn;
    ActionSmlFileOpen: TAction;
    OpenDialogSmlFile: TOpenDialog;
    BitBtnSmlFileCompile: TBitBtn;
    ActionSmlFileCompile: TAction;
    GroupBoxSmlResult: TGroupBox;
    MemoSmlResult: TMemo;
    BitBtnSmlFileEdit: TBitBtn;
    ActionSmlFileEdit: TAction;
    ActionSmiFileView: TAction;
    BitBtnSmlFileView: TBitBtn;
    ActionSobjFileView: TAction;
    BitBtnSObjFileView: TBitBtn;
    GroupBoxSmiSmRun: TGroupBox;
    LabelSmiSmDomain: TLabel;
    ComboBoxSmiSmDomain: TComboBox;
    LabelSmiSmDns: TLabel;
    ComboBoxSmiSmDns: TComboBox;
    LabelSmiSmOptions: TLabel;
    ComboBoxSmiSmOptions: TComboBox;
    BitBtnSmiSmRun: TBitBtn;
    ActionSmiSmRun: TAction;
    BitBtnSmiSmList: TBitBtn;
    ActionSmiSmList: TAction;
    ActionSmiSmKill: TAction;
    BitBtnSmiSmKill: TBitBtn;
    ComboBoxSmlEditor: TComboBox;
    LabelSmiSmEditWith: TLabel;
    TabSheetSmiHelp: TTabSheet;
    PanelSmiHelp: TPanel;
    LabelSmiSmDebugLevel: TLabel;
    ComboBoxSmiSmDebugLevel: TComboBox;
    CheckBoxSmiSmOptionT: TCheckBox;
    CheckBoxSmiSmOptionU: TCheckBox;
    BitBtnSmiSmOptionsHelp: TBitBtn;
    ActionSmiSmOptionsHelp: TAction;
    GroupBoxSmiSmLogFile: TGroupBox;
    CheckBoxSmiSmLogFile: TCheckBox;
    ActionSmiSmViewLog: TAction;
    BitBtnSmiSmViewLog: TBitBtn;
    ComboBoxSmiSmLogViewer: TComboBox;
    LabelSmiSmLogViewerWith: TLabel;
    ActionSmiSmDeleteLog: TAction;
    BitBtnSmiSmDeleteLog: TBitBtn;
    TabSheetDaq: TTabSheet;
    PanelDaq: TPanel;
    PanelDaqButtons: TPanel;
    PanelDaqTabs: TPanel;
    PageControlDaq: TPageControl;
    TabSheetDaqCfg: TTabSheet;
    GroupBoxSmlParser: TGroupBox;
    ActionSmlCodeParse: TAction;
    ActionSmlCodeClear: TAction;
    BitBtnSmlCodeClear: TBitBtn;
    BitBtnSmlCodeParse: TBitBtn;
    ActionSmlObjectSelect: TAction;
    ActionSmlMakeDaqCfg: TAction;
    BitBtnSmlMakeDaqCfg: TBitBtn;
    TabSheetDaqParams: TTabSheet;
    PanelSmlDaqParameters: TPanel;
    GroupBoxSmlDaqCommonParams: TGroupBox;
    ComboBoxSmlDaqDomain: TComboBox;
    LabelSmlDaqDomain: TLabel;
    LabelSmlDaqPrefix: TLabel;
    ComboBoxSmiTagPrefix: TComboBox;
    LabelSmlDaqGuiCtrlDevice: TLabel;
    ComboBoxSmlDaqGuiCtrlDevice: TComboBox;
    ActionSmlDaqGuiCtrlDeviceUpdate: TAction;
    LabelSmlDaqGuiCtrlWindow: TLabel;
    ComboBoxSmlDaqGuiCtrlWindow: TComboBox;
    BitBtnSmlDaqGuiCtrlDeviceUpdate: TBitBtn;
    ActionSmlObjectsetSelect: TAction;
    PanelDaqCfgButtons: TPanel;
    BitBtnDaqCfgSelectAll: TBitBtn;
    BitBtnDaqCfgUnselect: TBitBtn;
    BitBtnDaqCfgCopyToClipboard: TBitBtn;
    BitBtnDaqCfgSaveAs: TBitBtn;
    SaveDialogSmlDaq: TSaveDialog;
    TabSheetDaqCrc: TTabSheet;
    PanelDaqCrcButtons: TPanel;
    BitBtnDaqCrcSelectAll: TBitBtn;
    BitBtnDaqCrcUnselect: TBitBtn;
    BitBtnDaqCrcCopyToClipboard: TBitBtn;
    BitBtnDaqCrcSaveAs: TBitBtn;
    PanelDaqCrcMemo: TPanel;
    MemoDaqCrc: TMemo;
    PanelDaqCfgMemo: TPanel;
    MemoDaqCfg: TMemo;
    ActionSmlMakeDaqCrc: TAction;
    BitBtnSmlMakeDaqCrc: TBitBtn;
    FontDialogSmlDaqFont: TFontDialog;
    ActionSmlDaqFontDialog: TAction;
    GroupBoxSmlDaqGuiGeom: TGroupBox;
    SpinEditSmlDaqGuiWidth: TSpinEdit;
    LabelSmlDaqGuiWidth: TLabel;
    LabelSmlDaqGuiHeight: TLabel;
    SpinEditSmlDaqGuiHeight: TSpinEdit;
    LabelSmlDaqGuiLogoLeft: TLabel;
    SpinEditSmlDaqGuiLeft: TSpinEdit;
    LabelSmlDaqGuiTop: TLabel;
    SpinEditSmlDaqGuiTop: TSpinEdit;
    LabelSmlDaqGuiBtnWidth: TLabel;
    SpinEditSmlDaqGuiBtnWidth: TSpinEdit;
    SpinEditSmlDaqGuiBtnHeight: TSpinEdit;
    SpinEditSmlDaqGuiBtnDx: TSpinEdit;
    SpinEditSmlDaqGuiBtnDy: TSpinEdit;
    LabelSmlDaqGuiBtnDxDy: TLabel;
    LabelSmlDaqGuiBtnDate: TLabel;
    SpinEditSmlDaqGuiBtnBorder: TSpinEdit;
    LabelSmlDaqGuiBtnBorder: TLabel;
    SpinEditSmlDaqGuiHostTimeWidth: TSpinEdit;
    SpinEditSmlDaqGuiHostTimeHeight: TSpinEdit;
    SpinEditSmlDaqGuiDnsWidth: TSpinEdit;
    SpinEditSmlDaqGuiDomainWidth: TSpinEdit;
    LabelSmlDaqGuiDnsWidth: TLabel;
    PageControlSmlSelector: TPageControl;
    TabSheetSmlSelectObjects: TTabSheet;
    PanelSmlSelectObjects: TPanel;
    ListBoxSmlAllObjectList: TListBox;
    BitBtnSmlObjectSelect: TBitBtn;
    LabelSmlMainObject: TLabel;
    ComboBoxSmlMainObject: TComboBox;
    LabelSmlLeadObject: TLabel;
    ComboBoxSmlLeadObject: TComboBox;
    ListBoxSmlSelObjectList: TListBox;
    TabSheetSmlSelectObjectsets: TTabSheet;
    PanelSmlSelectObjectsets: TPanel;
    ListBoxSmlAllObjectsetList: TListBox;
    BitBtnSmlObjectsetSelect: TBitBtn;
    ListBoxSmlSelObjectsetList: TListBox;
    TabSheetSmlSelectObjectParams: TTabSheet;
    PanelSmlSelectObjectParams: TPanel;
    ListBoxSmlAllObjectParamList: TListBox;
    ListBoxSmlSelObjectParamList: TListBox;
    BitBtnSmlObjectParamSelect: TBitBtn;
    ActionSmlObjectParamSelect: TAction;
    LabelSmlDaqGuiParWidth: TLabel;
    SpinEditSmlDaqGuiParWidth: TSpinEdit;
    SpinEditSmlDaqGuiParHeight: TSpinEdit;
    LabelSmlDaqGuiParDxDy: TLabel;
    SpinEditSmlDaqGuiParDx: TSpinEdit;
    SpinEditSmlDaqGuiParDy: TSpinEdit;
    LabelSmlDaqGuiParBorder: TLabel;
    SpinEditSmlDaqGuiParBorder: TSpinEdit;
    LabelSmlDaqGuiFifoSizeKb: TLabel;
    SpinEditSmlDaqGuiFifoSizeKb: TSpinEdit;
    TabSheetDaqFonts: TTabSheet;
    PanelSmiDaqFonts: TPanel;
    GroupBoxSmlDaqGuiFonts: TGroupBox;
    ComboBoxSmlDaqGuiTitleFont: TComboBox;
    LabelSmlDaqGuiTitleFont: TLabel;
    ComboBoxSmlDaqGuiStateFont: TComboBox;
    ComboBoxSmlDaqGuiParamFont: TComboBox;
    BitBtnSmlDaqGuiTitleFont: TBitBtn;
    BitBtnSmlDaqGuiStateFont: TBitBtn;
    BitBtnSmlDaqGuiParamFont: TBitBtn;
    BitBtnSmlDaqGuiMenusFont: TBitBtn;
    ComboBoxSmlDaqGuiMenusFont: TComboBox;
    BitBtnSmlDaqGuiLabelFont: TBitBtn;
    ComboBoxSmlDaqGuiLabelFont: TComboBox;
    BitBtnSmlDaqGuiDomainFont: TBitBtn;
    ComboBoxSmlDaqGuiDomainFont: TComboBox;
    ActionMainListSysInfo: TAction;
    LabelMainListSysInfo: TLabel;
    ComboBoxMainListSysInfo: TComboBox;
    LabelMainListSysInfoTimeOut: TLabel;
    SpinEditMainListSysInfoTimeOut: TSpinEdit;
    BitBtnMainListSysInfo: TBitBtn;
    BitBtnSmiRunDimTree: TBitBtn;
    GroupBoxSmiHelp: TGroupBox;
    BitBtnSmiHelpDimIndex: TBitBtn;
    BitBtnSmiHelpDimWebCernCh: TBitBtn;
    BitBtnSmiHelpResourceDimSite: TBitBtn;
    BitBtnSmiHelpDimSiteReadmeHtm: TBitBtn;
    BitBtnSmiHelpDimManRuPdf: TBitBtn;
    BitBtnSmiHelpDimOverview: TBitBtn;
    BitBtnSmiHelpIndex: TBitBtn;
    BitBtnSmiHelpSmiWebCernCh: TBitBtn;
    BitBtnSmiHelpResourceSmiSite: TBitBtn;
    BitBtnSmiHelpSmiSiteReadmeHtm: TBitBtn;
    BitBtnSmiHelpSmiManRuPdf: TBitBtn;
    BitBtnSmiHelpSmiOverview: TBitBtn;
    TabSheetSmiRun: TTabSheet;
    GroupBoxSmiRunCmd: TGroupBox;
    PanelSmiRunParams: TPanel;
    PanelSmiRunLogo: TPanel;
    MemoSmiRunLog: TMemo;
    ComboBoxSmiRunDns: TComboBox;
    LabelSmiRunDns: TLabel;
    ComboBoxSmiRunCmd: TComboBox;
    BitBtnSmiRunCommand: TBitBtn;
    SpinEditSmiRunTimeout: TSpinEdit;
    LabelSmiRunTimeout: TLabel;
    ActionSmiRunCmd: TAction;
    BitBtnSmiStartCmd: TBitBtn;
    ActionSmiStartCmd: TAction;
    TimerPollTasks: TTimer;
    LabelSmiStartTerm: TLabel;
    ComboBoxSmiStartTerm: TComboBox;
    PanelSmiRunLogButtons: TPanel;
    ActionSmiRunLogSelAll: TAction;
    BitBtnSmiRunLogSelAll: TBitBtn;
    ActionSmiRunLogSelNon: TAction;
    BitBtnSmiRunLogSelNon: TBitBtn;
    ActionSmiRunLogClear: TAction;
    BitBtnSmiRunLogClear: TBitBtn;
    ActionSmiRunLogCopy: TAction;
    BitBtnSmiRunLogCopy: TBitBtn;
    ActionSmiSmKillAll: TAction;
    BitBtnSmiSmKillAll: TBitBtn;
    ActionSmlFileFixEol: TAction;
    BitBtnSmlFileFixEol: TBitBtn;
    ComboBoxSmlFileFixEol: TComboBox;
    LabelSmiRunLogHistory: TLabel;
    ComboBoxSmiRunLogHistory: TComboBox;
    ComboBoxSmiRunTerm: TComboBox;
    GroupBoxSmiDisplayOptions: TGroupBox;
    LabelXTermFontName: TLabel;
    ComboBoxXTermFontName: TComboBox;
    LabelXTermFontSize: TLabel;
    ComboBoxXTermFontSize: TComboBox;
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
    procedure TrayIconMainClick(Sender: TObject);
    procedure TrayIconMainDblClick(Sender: TObject);
    procedure TimerLogEventsUpdaterTimer(Sender: TObject);
    procedure ActionMainExitExecute(Sender: TObject);
    procedure ActionMainParentShowExecute(Sender: TObject);
    procedure ActionMainFormShowExecute(Sender: TObject);
    procedure ActionMainSendUserCmndExecute(Sender: TObject);
    procedure ActionMainExecUserCmndExecute(Sender: TObject);
    procedure ActionMainLogEventsClearExecute(Sender: TObject);
    procedure ActionMainLogEventsGoBackExecute(Sender: TObject);
    procedure ActionMainListSysInfoExecute(Sender: TObject);
    procedure BitBtnLogEventsTestClick(Sender: TObject);
    procedure BitBtnDimDnsRefreshClick(Sender: TObject);
    procedure ListBoxDomainListClick(Sender: TObject);
    procedure BitBtnSelObjSelectClick(Sender: TObject);
    procedure BitBtnSelObjListMoveUpClick(Sender: TObject);
    procedure BitBtnSelObjListMoveDownClick(Sender: TObject);
    procedure BitBtnStartMonitoringClick(Sender: TObject);
    procedure TimerMonitoringTimer(Sender: TObject);
    procedure BitBtnSmiHelpClick(Sender: TObject);
    procedure BitBtnSmiWebSiteClick(Sender: TObject);
    procedure BitBtnSmiTclTkGuiClick(Sender: TObject);
    procedure BitBtnFsmOutClearClick(Sender: TObject);
    procedure ActionSmlFileOpenExecute(Sender: TObject);
    procedure ActionSmlFileCompileExecute(Sender: TObject);
    procedure ActionSmlFileEditExecute(Sender: TObject);
    procedure ActionSmiFileViewExecute(Sender: TObject);
    procedure ActionSobjFileViewExecute(Sender: TObject);
    procedure ActionSmiSmRunExecute(Sender: TObject);
    procedure TabSheetSmlEnter(Sender: TObject);
    procedure ActionSmiSmListExecute(Sender: TObject);
    procedure ActionSmiSmKillExecute(Sender: TObject);
    procedure BitBtnSmiHelpSmiWebCernChClick(Sender: TObject);
    procedure BitBtnSmiHelpIndexClick(Sender: TObject);
    procedure BitBtnSmiHelpDimIndexClick(Sender: TObject);
    procedure BitBtnSmiHelpDimWebCernChClick(Sender: TObject);
    procedure BitBtnSmiHelpResourceDimSiteClick(Sender: TObject);
    procedure BitBtnSmiHelpResourceSmiSiteClick(Sender: TObject);
    procedure BitBtnSmiHelpDimSiteReadmeHtmClick(Sender: TObject);
    procedure BitBtnSmiHelpDimManRuPdfClick(Sender: TObject);
    procedure BitBtnSmiHelpSmiSiteReadmeHtmClick(Sender: TObject);
    procedure BitBtnSmiHelpSmiManRuPdfClick(Sender: TObject);
    procedure BitBtnSmiHelpDimOverviewClick(Sender: TObject);
    procedure BitBtnSmiHelpSmiOverviewClick(Sender: TObject);
    procedure ActionSmiSmOptionsHelpExecute(Sender: TObject);
    procedure ActionSmiSmViewLogExecute(Sender: TObject);
    procedure ActionSmiSmDeleteLogExecute(Sender: TObject);
    procedure ActionSmlCodeParseExecute(Sender: TObject);
    procedure ActionSmlCodeClearExecute(Sender: TObject);
    procedure ActionSmlObjectSelectExecute(Sender: TObject);
    procedure ActionSmlMakeDaqCfgExecute(Sender: TObject);
    procedure ActionSmlDaqGuiCtrlDeviceUpdateExecute(Sender: TObject);
    procedure ActionSmlObjectsetSelectExecute(Sender: TObject);
    procedure BitBtnDaqCfgSelectAllClick(Sender: TObject);
    procedure BitBtnDaqCfgUnselectClick(Sender: TObject);
    procedure BitBtnDaqCfgCopyToClipboardClick(Sender: TObject);
    procedure BitBtnDaqCfgSaveAsClick(Sender: TObject);
    procedure BitBtnDaqCrcSelectAllClick(Sender: TObject);
    procedure BitBtnDaqCrcUnselectClick(Sender: TObject);
    procedure BitBtnDaqCrcCopyToClipboardClick(Sender: TObject);
    procedure BitBtnDaqCrcSaveAsClick(Sender: TObject);
    procedure ActionSmlMakeDaqCrcExecute(Sender: TObject);
    procedure ActionSmlDaqFontDialogExecute(Sender: TObject);
    procedure FormResize(Sender: TObject);
    procedure ActionSmlObjectParamSelectExecute(Sender: TObject);
    procedure PageControlSmlSelectorChange(Sender: TObject);
    procedure BitBtnSmiRunDimTreeClick(Sender: TObject);
    procedure TabSheetSmiRunEnter(Sender: TObject);
    procedure ActionSmiRunCmdExecute(Sender: TObject);
    procedure ActionSmiStartCmdExecute(Sender: TObject);
    procedure TimerPollTasksTimer(Sender: TObject);
    procedure ActionSmiRunLogSelAllExecute(Sender: TObject);
    procedure ActionSmiRunLogSelNonExecute(Sender: TObject);
    procedure ActionSmiRunLogClearExecute(Sender: TObject);
    procedure ActionSmiRunLogCopyExecute(Sender: TObject);
    procedure ActionSmiSmKillAllExecute(Sender: TObject);
    procedure ActionSmlFileFixEolExecute(Sender: TObject);
    procedure CheckBoxSmiSmLogFileChange(Sender: TObject);
  private
    mySmlCode : TStringList;
    mySmlDecl : TStringList;
    myObjPars : TStringList;
  protected
  public
    procedure ShowTrayIcon;
    procedure AdjustComponents;
    procedure BugReport(E:Exception; Sender:TObject; Where:String);
    procedure SendCommandToCrwDaq(S:String; Activate:Boolean=true);
    procedure PostCommandToCrwDaq(S:String);
    procedure SmiHelp;
    procedure SmiSite;
    procedure DimDnsRefresh;
    procedure UpdateDnsStatus;
    procedure UpdateDomainList;
    procedure UpdateDomObjList(dom:String);
    procedure UpdateDomainHost;
    procedure SelObjListSelect;
    procedure SelObjListMoveUp;
    procedure SelObjListMoveDown;
    procedure StartMonitoring;
    procedure DoMonitoring;
    function  SmlFile:String;
    function  SmiFile:String;
    function  SobjFile:String;
    function  SmiSmExe:String;
    function  SmiTransExe:String;
    function  SmiSmLogFile:String;
    function  TextEditorExe:String;
    function  DimSendCommandExe:String;
    procedure LogSml(When:Double; Msg:String);
    function  SmiTagPrefix:String;
    function  SmlDaqDomain:String;
    function  SmlDaqMainObject:String;
    function  SmlDaqLeadObject:String;
  public
    function  SmlDaqGuiTitleFont:String;
    function  SmlDaqGuiStateFont:String;
    function  SmlDaqGuiParamFont:String;
    function  SmlDaqGuiLabelFont:String;
    function  SmlDaqGuiMenusFont:String;
    function  SmlDaqGuiDomainFont:String;
    function  SmlDaqGuiLeft:Integer;
    function  SmlDaqGuiTop:Integer;
    function  SmlDaqGuiWidth:Integer;
    function  SmlDaqGuiHeight:Integer;
    function  SmlDaqGuiBtnWidth:Integer;
    function  SmlDaqGuiBtnHeight:Integer;
    function  SmlDaqGuiBtnDx:Integer;
    function  SmlDaqGuiBtnDy:Integer;
    function  SmlDaqGuiBtnBorder:Integer;
    function  SmlDaqGuiHostTimeWidth:Integer;
    function  SmlDaqGuiHostTimeHeight:Integer;
    function  SmlDaqGuiDnsWidth:Integer;
    function  SmlDaqGuiDomainWidth:Integer;
    function  SmlDaqGuiParWidth:Integer;
    function  SmlDaqGuiParHeight:Integer;
    function  SmlDaqGuiParDx:Integer;
    function  SmlDaqGuiParDy:Integer;
    function  SmlDaqGuiParBorder:Integer;
    function  SmlDaqGuiFifoSizeKb:Integer;
    function  SmiRunTimeout:Integer;
  public
    property  SmlCode : TStringList read mySmlCode;
    property  SmlDecl : TStringList read mySmlDecl;
  public
    function  GetObjectParams(obj:String):String;
    function  DeclareObjectParams(cfg:TStrings; obj,pars:String):String;
    procedure UpdateSmlSelectorSize;
    function  MX(nL,nBW,nBD,nPW,nPD,nTW:Integer):Integer; // MarkupX
    function  MY(nT,nBH,nBD,nPH,nPD,nTH:Integer):Integer; // MarkupY
  public
    procedure SmiRunLog(When:Double; What:String);
    procedure SmiRunCmd(timeout:Integer);
    procedure ApplyHistoryLimit(Memo:TMemo);
  end;

var MainForm: TMainForm = nil;

implementation

procedure TMainForm.FormCreate(Sender: TObject);
begin
 try
  defIpcInit;
  defParamsInit;
  SetDefaultFontName(Font);
  InitAntiZombie(1000,true);
  Caption:=GetCrwDaqChildTitle;
  FormCenterToScreen(Self,0,0);
  SetButtonCursorToHandPoint(Self);
  StatusBarLogEvents.Font.Size:=10;
  PageControlMain.ActivePage:=TabSheetSmi;
  LogEvents(Now,GetBriefEngineScriptInfo);
  LogEvents(Now,'Start.');
  AdjustComponents;
  ShowTrayIcon;
  if (CRW_DAQ_SYS_EXE_PID=0) then begin
   ActionMainParentShow.Enabled:=false;
   ActionMainSendUserCmnd.Enabled:=false;
   //RaiseException('Parent Crw32.exe process is not specified.');
  end;
 except
  on E:Exception do Self.BugReport(E,Self,'FormCreate');
 end;
end;

procedure TMainForm.FormDestroy(Sender: TObject);
begin
 SmlCode.Clear;
 SmiGenGui.StopMonitoring;
 SmiGenGui.Reset;
end;

procedure TMainForm.ShowTrayIcon;
begin
 Application.Title:=GetScriptName;
 TrayIconMain.Visible:=true;
 TrayIconMain.Hint:=GetScriptName+EOL+Caption;
 MenuItemTrayFormShow.Caption:=FormatVar('Show Window [%s]',Caption);
 MenuItemTrayProgramExit.Caption:=FormatVar('Exit from [%s]',Caption);
 MenuItemTrayParentShow.Caption:=FormatVar('Show Parent Window [%s]',ParentCrwDaqTitle);
 HideApplicationIconFromTaskBar(true);
end;

procedure TMainForm.AdjustComponents;
var i:Integer;
begin
 mySmlCode:=TStringList.Create;
 mySmlDecl:=TStringList.Create;
 myObjPars:=TStringList.Create;
 SmiGenGui.ScrollBox:=ScrollBoxFsmObjectList;
 MemoLogEvents.Font.Size:=10;
 MemoFsmOut.Font.Size:=10;
 LabelSmiTitle.Font.Size:=36;
 LabelSmiTitle.Font.Style:=PanelSmiTitle.Font.Style+[fsBold];
 LabelSmiDimDnsStatusValue.Font.Style:=LabelSmiDimDnsStatusValue.Font.Style+[fsBold];
 LabelSmiDimDnsStatusValue.Font.Color:=clMaroon;
 if (ComboBoxSmiDimDnsNode.Text='') then ComboBoxSmiDimDnsNode.Text:=SmiGenGui.DIM_DNS_NODE;
 ComboBoxSmiDimDnsNode.Items.Text:='localhost'+EOL+'127.0.0.1'+EOL+GetHostName+EOL;
 ComboBoxSmiSmDns.Items.Text:=ComboBoxSmiDimDnsNode.Items.Text;
 SetDefaultSansFontName(BitBtnSmiSelObjSelect.Font);
 BitBtnSmiSelObjSelect.Font.Size:=10;
 //SetDefaultNarrowFontName(LabelDomainHost.Font);
 LabelSmiDomainHost.Font.Size:=10;
 CheckBoxSmiDomObjListSkipAmp.Font.Size:=10;
 EditMainSendUserCmnd.Font.Size:=10;
 StatusBarFsmObjectList.Font.Size:=10;
 EditMainSendUserCmnd.Text:='@run -sw7 unix '+SmiGenGui.getSmiGuiTcl;
 //SetDefaultSansFontName(BitBtnSmiTclTkGui.Font);
 BitBtnSmiTclTkGui.Font.Size:=10;
 ComboBoxSmlFile.Items.Clear;
 ComboBoxSmlFile.Items.Text:=SmiGenGui.ListSmiSmlSamples;
 OpenDialogSmlFile.InitialDir:=SmiGenGui.SmiDataSamplesDir;
 ComboBoxSmlEditor.Items.Text:=SmiGenGui.ListTextEditors;
 ComboBoxSmlEditor.ItemIndex:=iMin(0,ComboBoxSmlEditor.Items.Count-1);
 ComboBoxSmiSmLogViewer.Items.Text:=SmiGenGui.ListTextViewers;
 ComboBoxSmiSmLogViewer.ItemIndex:=iMin(0,ComboBoxSmiSmLogViewer.Items.Count-1);
 SetDefaultSansFontName(LabelSmiSmEditWith.Font); LabelSmiSmEditWith.Font.Size:=9;
 SetDefaultSansFontName(ComboBoxSmlEditor.Font); ComboBoxSmlEditor.Font.Size:=9;
 SetDefaultSansFontName(LabelSmiSmDebugLevel.Font); LabelSmiSmDebugLevel.Font.Size:=9;
 ComboBoxSmiSmDebugLevel.Font.Size:=9;
 ComboBoxSmiSmOptions.Font.Size:=9;
 ComboBoxSmiSmDomain.Font.Size:=9;
 ComboBoxSmiSmDns.Font.Size:=9;
 FontDialogSmlDaqFont.Font.Assign(Font);
 ActionSmlCodeClear.Execute;
 UpdateSmlSelectorSize;
 SetDefaultSansFontName(LabelMainListSysInfoTimeOut.Font);
 SetDefaultSansFontName(BitBtnSmiRunDimTree.Font);
 ComboBoxSmiRunCmd.Items.Text:=SmiGenGui.ListSmiCommands;
 ComboBoxSmiRunTerm.Items.Text:=SmiGenGui.ListTerminalCommands;
 ComboBoxSmiRunTerm.ItemIndex:=iMin(1,ComboBoxSmiRunTerm.Items.Count-1);
 if IsWindows then ComboBoxSmiRunTerm.Enabled:=false;
 if IsWindows then ComboBoxSmiRunTerm.ItemIndex:=0;
 ComboBoxSmiStartTerm.Items.Text:=SmiGenGui.ListTerminalCommands;
 ComboBoxSmiStartTerm.ItemIndex:=iMin(2,ComboBoxSmiStartTerm.Items.Count-1);
 ComboBoxXTermFontName.Items.Text:=EOL+Trim(SmiGenGui.ListFonts('Mono'));
 i:=iMax(0,ComboBoxXTermFontName.Items.IndexOf('PT Mono'));
 ComboBoxXTermFontName.ItemIndex:=i;
 i:=iMax(0,ComboBoxXTermFontSize.Items.IndexOf('10'));
 ComboBoxXTermFontSize.ItemIndex:=i;
end;

procedure TMainForm.BugReport(E:Exception; Sender:TObject; Where:String);
begin
 SystemBugReport(E,Sender,Where);
 PageControlMain.ActivePage:=TabSheetLogEvents;
end;

procedure TMainForm.SendCommandToCrwDaq(S:String; Activate:Boolean=true);
begin
 try
  if (CRW_DAQ_SYS_EXE_PID=0)
  then RaiseException('Parent Crw32.exe process is not specified.');
  S:=Trim(S); if (S='') then Exit;
  if (CRW_DAQ_SYS_EXE_PID=0) then Exit;
  if Activate then AppActivateByTitle(ParentCrwDaqTitle);
  if (Send2CrwDaq(CRW_DAQ_SYS_EXE_PID,S,Handle)=0)
  then LogEvents(Now,'Sent command: '+S)
  else LogEvents(Now,'Fail command: '+S);
 except
  on E:Exception do Self.BugReport(E,Self,'SendCommandToCrwDaq');
 end;
end;

procedure TMainForm.PostCommandToCrwDaq(S:String);
begin
 SendCommandToCrwDaq(S,false);
end;

procedure UpdateListBoxScrollWidth(ListBox:TListBox; Canvas:TCanvas; Margin:Integer=10);
var i,sw:Integer;
begin
 sw:=0;
 if (ListBox is TListBox) and  (Canvas is TCanvas) then begin
  for i:=0 to ListBox.Count-1 do sw:=iMax(sw,Canvas.TextWidth(ListBox.Items.Strings[i]));
  if (sw&gt;=ListBox.Width) then ListBox.ScrollWidth:=sw+Margin else ListBox.ScrollWidth:=0;
 end;
end;

function TMainForm.SmlFile:String;
begin
 Result:=SmiGenGui.ValidatePathName(ComboBoxSmlFile.Text);
end;

function TMainForm.SmiFile:String;
begin
 Result:=ReplaceFileExt(SmlFile,'.smi');
end;

function TMainForm.SobjFile:String;
begin
 Result:=ReplaceFileExt(SmlFile,'.sobj');
end;

function TMainForm.SmiSmExe:String;
begin
 Result:=SmiGenGui.SmiSiteBinExe('smiSM.exe');
end;

function TMainForm.SmiTransExe:String;
begin
 Result:=SmiGenGui.SmiSiteBinExe('smiTrans.exe');
end;

function TMainForm.DimSendCommandExe:String;
begin
 Result:=SmiGenGui.DimSiteBinExe('dim_send_command.exe');
end;

function TMainForm.SmiSmLogFile:String;
begin
 Result:=SmiGenGui.SmiDataLogDir;
 Result:=Result+'\smiSM_'+Trim(ComboBoxSmiSmDomain.Text)+'_';
 Result:=Result+'dns_'+Trim(StringReplace(Trim(ComboBoxSmiSmDns.Text),'.','_',rfReplaceAll))+'_';
 Result:=Result+Trim(StringReplace(ExtractFileName(SmlFile),'.','_',rfReplaceAll));
 Result:=Trim(StringReplace(Result,'-','_',rfReplaceAll));
 if (ExtractFileExt(Result)&lt;&gt;'')
 then Result:=ReplaceFileExt(Result,'.log')
 else Result:=Result+'.log';
 Result:=SmiGenGui.ValidatePathName(Result);
end;


function TMainForm.TextEditorExe:String;
begin
 Result:=Trim(ComboBoxSmlEditor.Text);
 if IsWindows then begin
  if SameText(Result,'notepad++') then Result:='grun -h unix '+Result;
  if (Result='') then Result:='notepad.exe';
 end;
 if IsUnix then begin
  Result:=SmiGenGui.FitExeName(Result);
  if (Result='') then Result:='kate';
 end;
end;

procedure TMainForm.LogSml(When:Double; Msg:String);
begin
 if (Msg&lt;&gt;'') then
 try
  try
   MemoSmlResult.Lines.BeginUpdate;
   AddTextAsEventLog(MemoSmlResult.Lines,When,Msg);
  finally
   MemoSmlResult.Lines.EndUpdate;
  end;
  MemoSmlResult.SelStart:=MaxInt;
 except
  on E:Exception do BugReport(E,Self,'SmlLog');
 end;
end;

function TMainForm.SmiTagPrefix:String;
begin
 Result:=UpperCase(Trim(ComboBoxSmiTagPrefix.Text));
end;

function TMainForm.SmlDaqDomain:String;
begin
 Result:=UpperCase(Trim(ComboBoxSmlDaqDomain.Text));
end;

function TMainForm.SmlDaqMainObject:String;
begin
 Result:=UpperCase(Trim(ComboBoxSmlMainObject.Text));
end;

function TMainForm.SmlDaqLeadObject:String;
begin
 Result:=UpperCase(Trim(ComboBoxSmlLeadObject.Text));
end;

function TMainForm.SmlDaqGuiTitleFont:String;
begin
 Result:=Trim(ComboBoxSmlDaqGuiTitleFont.Text);
end;

function TMainForm.SmlDaqGuiStateFont:String;
begin
 Result:=Trim(ComboBoxSmlDaqGuiStateFont.Text);
end;

function TMainForm.SmlDaqGuiParamFont:String;
begin
 Result:=Trim(ComboBoxSmlDaqGuiParamFont.Text);
end;

function TMainForm.SmlDaqGuiLabelFont:String;
begin
 Result:=Trim(ComboBoxSmlDaqGuiLabelFont.Text);
end;

function TMainForm.SmlDaqGuiDomainFont:String;
begin
 Result:=Trim(ComboBoxSmlDaqGuiDomainFont.Text);
end;

function TMainForm.SmlDaqGuiMenusFont:String;
begin
 Result:=Trim(ComboBoxSmlDaqGuiMenusFont.Text);
end;

function TMainForm.SmlDaqGuiLeft:Integer;
begin
 Result:=SpinEditSmlDaqGuiLeft.Value;
end;

function TMainForm.SmlDaqGuiTop:Integer;
begin
 Result:=SpinEditSmlDaqGuiTop.Value;
end;

function TMainForm.SmlDaqGuiWidth:Integer;
begin
 Result:=SpinEditSmlDaqGuiWidth.Value;
end;

function TMainForm.SmlDaqGuiHeight:Integer;
begin
 Result:=SpinEditSmlDaqGuiHeight.Value;
end;

function TMainForm.SmlDaqGuiBtnWidth:Integer;
begin
 Result:=SpinEditSmlDaqGuiBtnWidth.Value;
end;

function TMainForm.SmlDaqGuiBtnHeight:Integer;
begin
 Result:=SpinEditSmlDaqGuiBtnHeight.Value;
end;

function TMainForm.SmlDaqGuiBtnDx:Integer;
begin
 Result:=SpinEditSmlDaqGuiBtnDx.Value;
end;

function TMainForm.SmlDaqGuiBtnDy:Integer;
begin
 Result:=SpinEditSmlDaqGuiBtnDy.Value;
end;

function TMainForm.SmlDaqGuiBtnBorder:Integer;
begin
 Result:=SpinEditSmlDaqGuiBtnBorder.Value;
end;

function TMainForm.SmlDaqGuiHostTimeWidth:Integer;
begin
 Result:=SpinEditSmlDaqGuiHostTimeWidth.Value;
end;

function TMainForm.SmlDaqGuiHostTimeHeight:Integer;
begin
 Result:=SpinEditSmlDaqGuiHostTimeHeight.Value;
end;

function TMainForm.SmlDaqGuiDnsWidth:Integer;
begin
 Result:=SpinEditSmlDaqGuiDnsWidth.Value;
end;

function TMainForm.SmlDaqGuiDomainWidth:Integer;
begin
 Result:=SpinEditSmlDaqGuiDomainWidth.Value;
end;

function TMainForm.SmlDaqGuiParWidth:Integer;
begin
 Result:=SpinEditSmlDaqGuiParWidth.Value;
end;

function TMainForm.SmlDaqGuiParHeight:Integer;
begin
 Result:=SpinEditSmlDaqGuiParHeight.Value;
end;

function TMainForm.SmlDaqGuiParDx:Integer;
begin
 Result:=SpinEditSmlDaqGuiParDx.Value;
end;

function TMainForm.SmlDaqGuiParDy:Integer;
begin
 Result:=SpinEditSmlDaqGuiParDy.Value;
end;

function TMainForm.SmlDaqGuiParBorder:Integer;
begin
 Result:=SpinEditSmlDaqGuiParBorder.Value;
end;

function TMainForm.SmlDaqGuiFifoSizeKb:Integer;
begin
 Result:=SpinEditSmlDaqGuiFifoSizeKb.Value;
end;

procedure TMainForm.UpdateSmlSelectorSize;
var w,l:Integer;
begin
 try
  w:=(PanelSmlSelectObjects.Width div 2)-(BitBtnSmlObjectSelect.Width div 2)-9;
  ListBoxSmlAllObjectList.Width:=w;
  ListBoxSmlSelObjectList.Width:=w;
  l:=ListBoxSmlAllObjectList.Left+ListBoxSmlAllObjectList.Width+4;
  BitBtnSmlObjectSelect.Left:=l;
  LabelSmlMainObject.Left:=l;
  ComboBoxSmlMainObject.Left:=l;
  LabelSmlLeadObject.Left:=l;
  ComboBoxSmlLeadObject.Left:=l;
  //
  w:=(PanelSmlSelectObjectParams.Width div 2)-(BitBtnSmlObjectParamSelect.Width div 2)-9;
  ListBoxSmlAllObjectParamList.Width:=w;
  ListBoxSmlSelObjectParamList.Width:=w;
  l:=ListBoxSmlAllObjectParamList.Left+ListBoxSmlAllObjectParamList.Width+4;
  BitBtnSmlObjectParamSelect.Left:=l;
  //
  w:=(PanelSmlSelectObjectsets.Width div 2)-(BitBtnSmlObjectsetSelect.Width div 2)-9;
  ListBoxSmlAllObjectsetList.Width:=w;
  ListBoxSmlSelObjectsetList.Width:=w;
  l:=ListBoxSmlAllObjectsetList.Left+ListBoxSmlAllObjectsetList.Width+4;
  BitBtnSmlObjectsetSelect.Left:=l;
 except
  on E:Exception do BugReport(E,Self,'UpdateSmlSelectorSize');
 end;
end;

function TMainForm.SmiRunTimeout:Integer;
begin
 Result:=SpinEditMainListSysInfoTimeOut.Value*1000;
 Result:=iMin(MaxExecTimeout,Result);
 Result:=iMax(MinExecTimeout,Result);
end;

procedure TMainForm.SmiHelp;
begin
 SmiGenGui.BrowseHelp;
end;

procedure TMainForm.SmiSite;
begin
 SmiGenGui.BrowseSite;
end;

procedure TMainForm.DimDnsRefresh;
begin
 try
  SmiGenGui.Reset;
  SmiGenGui.DIM_DNS_NODE:=Trim(ComboBoxSmiDimDnsNode.Text);
  UpdateDnsStatus;
  UpdateDomainList;
  UpdateDomainHost;
  SelObjListSelect;
 except
  on E:Exception do BugReport(E,Self,'DimDnsRefresh');
 end;
end;

procedure TMainForm.UpdateDnsStatus;
var IsDns:Boolean; DnsStatus:String;
begin
 try
  IsDns:=false;
  DnsStatus:='UNDEFINED';
  if (SmiGenGui.DIM_DNS_NODE&lt;&gt;'') then begin
   IsDns:=SmiGenGui.IsDnsRunning;
   if IsDns then DnsStatus:='RUNNING' else
   if (SmiGenGui.DnsRunningAns&lt;&gt;'') then DnsStatus:='UNAVAILABLE';
  end;
  if IsDns
  then LabelSmiDimDnsStatusValue.Font.Color:=clGreen
  else LabelSmiDimDnsStatusValue.Font.Color:=clMaroon;
  LabelSmiDimDnsStatusValue.Caption:=DnsStatus;
 except
  on E:Exception do BugReport(E,Self,'UpdateDnsStatus');
 end;
end;

procedure TMainForm.UpdateDomainList;
begin
 try
  SmiGenGui.UpdateDomainList;
  LabelSmiDomainHost.Caption:='Host: ';
  ListBoxSmiDomainList.Items.Text:=SmiGenGui.DomainList.Text;
  LabelSmiDomainList.Caption:=FormatVar('DomainList[%d]:',SmiGenGui.DomainList.Count);
  UpdateListBoxScrollWidth(ListBoxSmiDomainList,Canvas);
  ListBoxSmiDomObjList.Clear;
  ListBoxSmiSelObjList.Clear;
 except
  on E:Exception do BugReport(E,Self,'UpdateDomainList');
 end;
end;

procedure TMainForm.UpdateDomObjList(dom:String);
var Ign:String;
begin
 try
  if CheckBoxSmiDomObjListSkipAmp.Checked then Ign:='&amp;' else Ign:='';
  SmiGenGui.UpdateDomObjList(dom,Ign);
  ListBoxSmiDomObjList.Items.Text:=SmiGenGui.DomObjList.Text;
  LabelSmiDomObjList.Caption:=FormatVar('ObjectList[%d]:',SmiGenGui.DomObjList.Count);
  UpdateListBoxScrollWidth(ListBoxSmiDomObjList,Canvas);
 except
  on E:Exception do BugReport(E,Self,'UpdateDomObjList');
 end;
end;

procedure TMainForm.UpdateDomainHost;
var i:Integer; dom,host:String;
begin
 try
  dom:=''; host:='';
  i:=ListBoxSmiDomainList.ItemIndex;
  if (i&gt;=0) and (i&lt;ListBoxSmiDomainList.Items.Count)
  then dom:=ListBoxSmiDomainList.Items.Strings[i];
  if (dom&lt;&gt;'') then host:=SmiGenGui.DomainNode.Values[dom];
  LabelSmiDomainHost.Caption:='Host: '+host;
  UpdateDomObjList(dom);
 except
  on E:Exception do BugReport(E,Self,'UpdateDomainHost');
 end;
end;

procedure TMainForm.SelObjListSelect;
var i:Integer; obj:String;
begin
 try
  for i:=0 to ListBoxSmiDomObjList.Count-1 do begin
   if not ListBoxSmiDomObjList.Selected[i] then continue;
   obj:=ListBoxSmiDomObjList.Items.Strings[i];
   if (SmiGenGui.SelObjList.IndexOf(obj)&lt;0) then SmiGenGui.SelObjList.Add(obj);
  end;
  for i:=0 to ListBoxSmiDomObjList.Count-1 do ListBoxSmiDomObjList.Selected[i]:=false;
  ListBoxSmiSelObjList.Items.Text:=SmiGenGui.SelObjList.Text;
  UpdateListBoxScrollWidth(ListBoxSmiSelObjList,Canvas);
  LabelSmiSelObjList.Caption:=FormatVar('SelectedObjects[%d]:',SmiGenGui.SelObjList.Count);
 except
  on E:Exception do BugReport(E,Self,'SelObjSelect');
 end;
end;

procedure ListBoxMove(ListBox:TListBox; Target:TStrings; Step:Integer);
var i:Integer; item:String;
begin
 if (Step=0) then Exit;
 if (ListBox=nil) then Exit;
 if (ListBox.Items.Count&lt;2) then Exit;
 i:=ListBox.ItemIndex; if (i&lt;0) then Exit;
 if (i+Step&gt;=0) and (i+Step&lt;=ListBox.Count-1) then begin
  item:=ListBox.Items.Strings[i];
  ListBox.Items.Delete(i);
  ListBox.Items.Insert(i+Step,item);
  Target.Text:=ListBox.Items.Text;
  ListBox.ItemIndex:=i+Step;
 end;
end;

procedure TMainForm.SelObjListMoveUp;
begin
 try
  ListBoxMove(ListBoxSmiSelObjList,SmiGenGui.SelObjList,-1);
 except
  on E:Exception do BugReport(E,Self,'SelObjListMoveUp');
 end;
end;

procedure TMainForm.SelObjListMoveDown;
begin
 try
  ListBoxMove(ListBoxSmiSelObjList,SmiGenGui.SelObjList,+1);
 except
  on E:Exception do BugReport(E,Self,'SelObjListMoveDown');
 end;
end;

procedure TMainForm.StartMonitoring;
begin
 try
  SmiGenGui.SelObjList.Text:=ListBoxSmiSelObjList.Items.Text;
  if SmiGenGui.SelObjList.Count&gt;0 then
  SmiGenGui.StartMonitoring;
 except
  on E:Exception do BugReport(E,Self,'StartMonitor');
 end;
end;

var LastTimeTicks:Integer=-1;
var LastLineCount:Integer=-1;

procedure TMainForm.DoMonitoring;
 procedure UpdateState(Mon:Boolean; n:Integer);
 begin
  ListBoxSmiDomainList.Enabled:=not Mon;
  ListBoxSmiDomObjList.Enabled:=not Mon;
  ListBoxSmiSelObjList.Enabled:=not Mon;
  BitBtnSmiSelObjSelect.Enabled:=not Mon;
  BitBtnSmiSelObjListMoveUp.Enabled:=not Mon;
  BitBtnSmiSelObjListMoveDown.Enabled:=not Mon;
  BitBtnSmiStartMonitoring.Enabled:=(n&gt;0) and not Mon;
 end;
begin
 try
  if SmiGenGui.IsMonitoring then begin
   SmiGenGui.PollMonitoring;
   if CheckBoxFsmOutPrint.Checked then begin
    if (SmiGenGui.MonitorOut.Count&gt;0) then begin
     StringsAppendFromStrings(MemoFsmOut.Lines,SmiGenGui.MonitorOut);
     MemoFsmOut.SelStart:=MaxInt;
    end;
   end else begin
    //if (MemoMainExecUserCmnd.Lines.Count&gt;0)
    //then MemoMainExecUserCmnd.Lines.Clear;
   end;
   SmiGenGui.MonitorOut.Clear;
   UpdateState(true,0);
  end else begin
   UpdateState(false,SmiGenGui.SelObjList.Count);
  end;
  if (LastTimeTicks&lt;&gt;SmiGenGui.TimeTicks)
  or (LastLineCount&lt;&gt;SmiGenGui.LineCount) then
  StatusBarFsmObjectList.SimpleText:=
  FormatVar('TimeTicks: %d  ',SmiGenGui.TimeTicks)+
  FormatVar('LineCount: %d  ',SmiGenGui.LineCount);
 except
  on E:Exception do BugReport(E,Self,'DoMonitoring');
 end;
end;

procedure TMainForm.TrayIconMainClick(Sender: TObject);
begin
 ActionMainFormShow.Execute;
end;

procedure TMainForm.TrayIconMainDblClick(Sender: TObject);
begin
 ActionMainFormShow.Execute;
end;

procedure TMainForm.TimerLogEventsUpdaterTimer(Sender: TObject);
begin
 try
  MoveBugReportListToLogger(nil);
  MoveLogEventsListToLoggerMemo(MemoLogEvents);
  if (PageControlMain.ActivePage=TabSheetLogEvents) then
  StatusBarLogEvents.SimpleText:=DateTimePrompt(Now)+GetHeapStatusBrief
   +FormatVar('. Events: %d',LogCountTotal)
   +FormatVar(', Bugs: %d',BugCountTotal)+'.';
  HandlePendingHideApplicationIconFromTaskBar;
 except
  on E:Exception do Self.BugReport(E,Self,'TimerLogEventsUpdaterTimer');
 end;
end;

procedure TMainForm.ActionMainExitExecute(Sender: TObject);
begin
  Application.Terminate;
end;

procedure TMainForm.ActionMainParentShowExecute(Sender: TObject);
begin
  AppActivateByTitle(ParentCrwDaqTitle);
end;

procedure TMainForm.ActionMainFormShowExecute(Sender: TObject);
begin
 ShowAndActivateFormByReference(Self,SW_SHOW);
end;

procedure TMainForm.ActionMainSendUserCmndExecute(Sender: TObject);
begin
  try
   if (CRW_DAQ_SYS_EXE_PID=0)
   then RaiseException('Parent Crw32.exe process is not specified.');
   EditMainSendUserCmnd.Text:=Trim(EditMainSendUserCmnd.Text);
   if (Pos('@',EditMainSendUserCmnd.Text)&lt;&gt;1)
   then RaiseException('Invalid format of command.');
   SendCommandToCrwDaq(EditMainSendUserCmnd.Text);
  except
   on E:Exception do Self.BugReport(E,Self,'ActionMainSendUserCmndExecute');
  end;
end;

procedure TMainForm.ActionMainExecUserCmndExecute(Sender: TObject);
var tid:Integer;
begin
 try
  tid:=task_init(GetComSpec+' /k ver');
  task_ctrl(tid,'HomeDir='+GetEnv('Temp'));
  task_ctrl(tid,'Display=SW_SHOWMINNOACTIVE');
  task_ctrl(tid,'StdInPipeSize='+IntToStr(1024*64));
  task_ctrl(tid,'StdOutPipeSize='+IntToStr(1024*64));
  task_ctrl(tid,'ProcessPriority='+IntToStr(8));
  task_ctrl(tid,'CodePage='+IntToStr(WinApi.GetOEMCP));
  if task_run(tid) then begin
   task_send(tid,'echo Привет'+EOL);
   task_send(tid,'dir '+AddPathDelim(GetEnv('SystemDrive'))+EOL);
   MemoFsmOut.Lines.Add(FormatVar('task_pid = %d',task_pid(tid)));
   MemoFsmOut.Lines.Add(FormatVar('task_appname = %s',task_ctrl(tid,'AppName')));
   MemoFsmOut.Lines.Add(FormatVar('task_cmdline = %s',task_ctrl(tid,'CmdLine')));
   MemoFsmOut.Lines.Add(FormatVar('task_exename = %s',task_ctrl(tid,'ExeName')));
   MemoFsmOut.Lines.Add(FormatVar('task_homedir = %s',task_ctrl(tid,'HomeDir')));
   MemoFsmOut.Lines.Add(FormatVar('task_display = %s',task_ctrl(tid,'Display')));
   MemoFsmOut.Lines.Add(FormatVar('task_stdinpipesize = %s',task_ctrl(tid,'StdInPipeSize')));
   MemoFsmOut.Lines.Add(FormatVar('task_priority = %s',task_ctrl(tid,'ProcessPriority')));
   MemoFsmOut.Lines.Add(FormatVar('task_codepage = %s',task_ctrl(tid,'CodePage')));
   //task_send(tid,'exit'+EOL);
  end;
  task_wait(tid,1000);
  StringsAppendFromText(MemoFsmOut.Lines,task_recv(tid,MaxInt));
  task_kill(tid,1,0,100);
  task_wait(tid,10000);
  task_free(tid);
  MemoFsmOut.Lines.Add(IntToStr(Ord(FileExists(SmiGenGui.TellMonObjectsExe)))+' '+SmiGenGui.TellMonObjectsExe);
  MemoFsmOut.Lines.Add(IntToStr(Ord(FileExists(SmiGenGui.MonObjectsExe)))+' '+SmiGenGui.MonObjectsExe);
  MemoFsmOut.Lines.Add(IntToStr(WinApi.GetACP)+' '+IntToStr(WinApi.GetOEMCP));
  MemoFsmOut.Lines.Add(IntToStr(TEncoding().Ansi.CodePage)+' '+IntToStr(TEncoding().Ascii.CodePage));
  MemoFsmOut.Lines.Add(IntToStr(TEncoding().SystemEncoding.CodePage)+' '+IntToStr(TEncoding().Default.CodePage));
  MemoFsmOut.Lines.Add(IntToStr(TEncoding().Utf7.CodePage)+' '+IntToStr(TEncoding().Utf8.CodePage));
  MemoFsmOut.Lines.Add(IntToStr(TEncoding().Unicode.CodePage)+' '+IntToStr(TEncoding().Utf8.CodePage));
  SmiGenGui.DIM_DNS_NODE:='localhost';
  MemoFsmOut.Lines.Add('dnsRunning -&gt; '+SmiGenGui.Exec(SmiGenGui.dnsRunningExe));
  if SmiGenGui.IsDnsRunning
  then MemoFsmOut.Lines.Add('DIM_DNS_NODE '+SmiGenGui.DIM_DNS_NODE+' IS RUNNING')
  else MemoFsmOut.Lines.Add('DIM_DNS_NODE '+SmiGenGui.DIM_DNS_NODE+' IS NOT RUNNING');
  if SmiGenGui.UpdateDomainList&gt;0 then MemoFsmOut.Lines.Add(SmiGenGui.DomainList.CommaText);
  if SmiGenGui.UpdateDomainList&gt;0 then MemoFsmOut.Lines.Add(SmiGenGui.DomainNode.CommaText);
  if SmiGenGui.UpdateDomObjList('*','&amp;')&gt;0 then MemoFsmOut.Lines.Add(SmiGenGui.DomObjList.CommaText);
  MemoFsmOut.Lines.Add(ScrollBoxFsmObjectList.Parent.Name);
  MemoFsmOut.Lines.Add(ScrollBoxFsmObjectList.Owner.Name);
  //MemoMainExecUserCmnd.Lines.Text:=DateTimePrompt(Now)+'Exec user command:'+EOL
  // +'ListOfProcesses:'+EOL
  // +'****************'+EOL
  // +GetListOfProcesses(0,0,'')+EOL;
 except
  on E:Exception do Self.BugReport(E,Self,'ActionMainExecUserCmndExecute');
 end;
end;

procedure TMainForm.ActionMainLogEventsClearExecute(Sender: TObject);
begin
  MemoLogEvents.Lines.Clear;
  LogCountTotal:=0; BugCountTotal:=0;
  LogEvents(Now,GetBriefEngineScriptInfo);
  LogEvents(Now,'Start.');
end;

procedure TMainForm.ActionMainLogEventsGoBackExecute(Sender: TObject);
begin
  if SmiGenGui.IsMonitoring
  then PageControlMain.ActivePage:=TabSheetFsm
  else PageControlMain.ActivePage:=TabSheetSmi;
end;

procedure TMainForm.ActionMainListSysInfoExecute(Sender: TObject);
var What,Info:String; Timeout:Integer;
begin
 Timeout:=SmiRunTimeOut;
 What:=Trim(ComboBoxMainListSysInfo.Text);
 Info:=ListSysInfoAsText(What,Timeout);
 LogEvents(Now,What);
 LogEvents(0,Info);
end;

var BugTestNum:Integer=0;

procedure TMainForm.BitBtnLogEventsTestClick(Sender: TObject);
begin
 try
  Inc(BugTestNum);
  RaiseException('This is exception test '+IntToStr(BugTestNum));
 except
  on E:Exception do Self.BugReport(E,Self,'BitBtnLogEventsTestClick');
 end;
end;

procedure TMainForm.BitBtnDimDnsRefreshClick(Sender: TObject);
begin
  DimDnsRefresh;
end;

procedure TMainForm.ListBoxDomainListClick(Sender: TObject);
begin
  UpdateDomainHost;
end;

procedure TMainForm.BitBtnSelObjSelectClick(Sender: TObject);
begin
  SelObjListSelect;
end;

procedure TMainForm.BitBtnSelObjListMoveUpClick(Sender: TObject);
begin
  SelObjListMoveUp
end;

procedure TMainForm.BitBtnSelObjListMoveDownClick(Sender: TObject);
begin
  SelObjListMoveDown;
end;

procedure TMainForm.BitBtnStartMonitoringClick(Sender: TObject);
begin
  StartMonitoring;
  if SmiGenGui.IsMonitoring then PageControlMain.ActivePage:=TabSheetFsm;
end;

procedure TMainForm.TimerMonitoringTimer(Sender: TObject);
begin
 DoMonitoring;
end;

procedure TMainForm.BitBtnSmiHelpClick(Sender: TObject);
begin
 SmiHelp;
end;

procedure TMainForm.BitBtnSmiWebSiteClick(Sender: TObject);
begin
 SmiSite;
end;

procedure TMainForm.BitBtnSmiTclTkGuiClick(Sender: TObject);
begin
 SmiGenGui.RunSmiGuiTcl;
end;

procedure TMainForm.BitBtnFsmOutClearClick(Sender: TObject);
begin
 if (MemoFsmOut.Lines.Count&gt;0)
 then MemoFsmOut.Lines.Clear;
end;

procedure TMainForm.ActionSmlFileOpenExecute(Sender: TObject);
begin
 try
  OpenDialogSmlFile.FileName:=Trim(ComboBoxSmlFile.Text);
  if OpenDialogSmlFile.Execute then begin
   ComboBoxSmlFile.Text:=OpenDialogSmlFile.FileName;
  end;
 except
  on E:Exception do Self.BugReport(E,Self,'ActionSmlFileOpenExecute');
 end;
end;

procedure TMainForm.ActionSmlFileFixEolExecute(Sender: TObject);
var cmd,exe,arg,dir,ans:String; Mode:Integer;
begin
 try
  if not FileExists(SmlFile) then begin
   LogSml(Now,'SML file not found '+SmlFile);
   Exit;
  end;
  Mode:=iMax(0,ComboBoxSmlFileFixEol.ItemIndex);
  // Fix SmlFile EOL
  if HasFlags(Mode,1) then begin
   exe:='unix';
   dir:=ExtractFileDir(SmlFile);
   arg:='fixeol '+ExtractFileName(SmlFile);
   cmd:=SmiGenGui.ComposeCmd(exe,arg);
   ans:=SmiGenGui.Exec(exe,arg,0,0,dir);
   LogSml(Now,Trim(cmd+EOL+ans));
   LogEvents(Now,Trim(cmd+EOL+ans));
  end;
  // Fix SmlFile UTF8
  if HasFlags(Mode,2) then begin
   // TODO
  end;
 except
  on E:Exception do Self.BugReport(E,Self,'ActionSmlFileFixEolExecute');
 end;
end;

procedure TMainForm.CheckBoxSmiSmLogFileChange(Sender: TObject);
var n:Integer;
begin
 if CheckBoxSmiSmLogFile.Checked then n:=0 else n:=1;
 ComboBoxSmiRunTerm.ItemIndex:=iMin(n,ComboBoxSmiRunTerm.Items.Count-1);
 ComboBoxSmiRunTerm.Enabled:=(n&gt;0);
end;

procedure TMainForm.ActionSmlFileCompileExecute(Sender: TObject);
var cmd,arg,dir,res:String;
begin
 try
  if not FileExists(SmlFile) then begin
   LogSml(Now,'SML file not found '+SmlFile);
   Exit;
  end;
  if FileExists(SmiFile) then DeleteFile(SmiFile);
  if FileExists(SobjFile) then DeleteFile(SobjFile);
  if not CopyFile(SmlFile,SmiFile,false) then RaiseException('Could not copy SML file.');
  cmd:=SmiTransExe;
  dir:=ExtractFileDir(SmlFile);
  arg:=ExtractFileName(SmiFile);
  res:=SmiGenGui.Exec(cmd,arg,0,0,dir);
  LogSml(Now,'cd '+dir+EOL+SmiGenGui.ComposeCmd(cmd,arg));
  if (res&lt;&gt;'') then LogSml(Now,res);
  if FileExists(SobjFile)
  then LogSml(Now,'Success:'+EOL+SmlFile+EOL+'compiled to'+EOL+SobjFile)
  else LogSml(Now,'Failure:'+EOL+'Error compile:'+SmlFile);
  if FileExists(SmiFile) then DeleteFile(SmiFile);
 except
  on E:Exception do Self.BugReport(E,Self,'ActionSmlFileCompileExecute');
 end;
end;

procedure TMainForm.ActionSmlFileEditExecute(Sender: TObject);
var cmd:String;
begin
 try
  if not FileExists(SmlFile) then begin
   LogSml(Now,'SML file not found '+SmlFile);
   Exit;
  end;
  if (CRW_DAQ_SYS_EXE_PID&lt;&gt;0) then begin
   cmd:='@run '+TextEditorExe+' '+SmlFile;
   LogSml(Now,'Send command:'+EOL+cmd);
   PostCommandToCrwDaq(cmd);
  end else begin
   LogSml(Now,SmiGenGui.RunTextEditor(SmlFile,TextEditorExe));
  end;
 except
  on E:Exception do Self.BugReport(E,Self,'ActionSmlFileEditExecute');
 end;
end;

procedure TMainForm.ActionSmiFileViewExecute(Sender: TObject);
var cmd:String;
begin
 try
  if not FileExists(SmlFile) then begin
   LogSml(Now,'SML file not found '+SmlFile);
   Exit;
  end;
  if (CRW_DAQ_SYS_EXE_PID&lt;&gt;0) then begin
   cmd:='@run lister '+SmiGenGui.ValidatePathName(SmlFile,8);
   LogSml(Now,'Send command:'+EOL+cmd);
   PostCommandToCrwDaq(cmd);
  end else begin
   LogSml(Now,SmiGenGui.RunLister(SmlFile));
  end;
 except
  on E:Exception do Self.BugReport(E,Self,'ActionSmiFileViewExecute');
 end;
end;

procedure TMainForm.ActionSobjFileViewExecute(Sender: TObject);
var cmd:String;
begin
 try
  if not FileExists(SmlFile) then begin
   LogSml(Now,'SML file not found '+SmlFile);
   Exit;
  end;
  if not FileExists(SobjFile) then begin
   LogSml(Now,'SOBJ file not found '+SobjFile);
   Exit;
  end;
  if (CRW_DAQ_SYS_EXE_PID&lt;&gt;0) then begin
   cmd:='@run lister '+SmiGenGui.ValidatePathName(SobjFile,8);
   LogSml(Now,'Send command:'+EOL+cmd);
   PostCommandToCrwDaq(cmd);
  end else begin
   LogSml(Now,SmiGenGui.RunLister(SobjFile));
  end;
 except
  on E:Exception do Self.BugReport(E,Self,'ActionSobjFileViewExecute');
 end;
end;

procedure TMainForm.ActionSmiSmRunExecute(Sender: TObject);
var cmd,exe,arg,dom,dns,opt,term:String;
begin
 try
  if not FileExists(SmlFile) then begin
   LogSml(Now,'SML file not found '+SmlFile);
   Exit;
  end;
  if not FileExists(SobjFile) then begin
   LogSml(Now,'SOBJ file not found '+SobjFile);
   Exit;
  end;
  dom:=Trim(ComboBoxSmiSmDomain.Text);
  if IsEmptyStr(dom) then begin
   LogSml(Now,'SMI Domain is empty');
   Exit;
  end;
  dns:=Trim(ComboBoxSmiSmDns.Text);
  if IsEmptyStr(dns) then begin
   LogSml(Now,'DIM DNS is empty');
   Exit;
  end;
  opt:=Trim(ComboBoxSmiSmDebugLevel.Text);
  if CheckBoxSmiSmOptionT.Checked then opt:=opt+' -t';
  if CheckBoxSmiSmOptionU.Checked then opt:=opt+' -u';
  opt:=Trim(opt+' '+Trim(ComboBoxSmiSmOptions.Text));
  exe:=SmiGenGui.ValidatePathName(SmiSmExe,8);
  arg:=dom+' '+SmiGenGui.ValidatePathName(SobjFile,8)+' -dns '+dns+' '+opt;
  cmd:=SmiGenGui.ComposeCmd(exe,arg);
  if (CRW_DAQ_SYS_EXE_PID&lt;&gt;0) then begin
   if CheckBoxSmiSmLogFile.Checked then begin
    if IsWindows then begin
     cmd:='/sw7 unix '+cmd+' &gt; '+SmiGenGui.ValidatePathName(SmiSmLogFile,8);
    end;
    if IsUnix then begin
     cmd:='xterm -l -lf '+SmiSmLogFile+' -e '+cmd;
    end;
   end;
   cmd:='@run '+cmd;
   LogSml(Now,'Send command:'+EOL+cmd);
   PostCommandToCrwDaq(cmd);
  end else begin
   term:=Trim(ComboBoxSmiRunTerm.Text);
   if not IsEmptyStr(term) then begin
    arg:=SkipWords(1,term,' ')+' '+exe+' '+arg;
    exe:=ExtractWord(1,term,' ');
    cmd:=SmiGenGui.ComposeCmd(exe,arg);
   end else
   if CheckBoxSmiSmLogFile.Checked then begin
    if IsWindows then begin
     exe:='unix';
     arg:=cmd+' &gt; '+SmiGenGui.ValidatePathName(SmiSmLogFile,8);
    end;
    if IsUnix then begin
     exe:='xterm';
     arg:='-l -lf '+SmiSmLogFile+' -e '+cmd;
    end;
    cmd:=SmiGenGui.ComposeCmd(exe,arg);
   end;
   LogSml(Now,cmd+EOL+SmiGenGui.Exec(exe,arg,-1));
  end;
  Sleep(1000);
  ActionSmiSmList.Execute;
 except
  on E:Exception do Self.BugReport(E,Self,'ActionSmiFileViewExecute');
 end;
end;

procedure TMainForm.TabSheetSmlEnter(Sender: TObject);
begin
 ComboBoxSmiSmDns.Text:=Trim(ComboBoxSmiDimDnsNode.Text);
end;

procedure TMainForm.ActionSmiSmListExecute(Sender: TObject);
var dns,old,list,cmd,exe,arg,ans:String;
begin
 try
  dns:=Trim(ComboBoxSmiSmDns.Text);
  if IsEmptyStr(dns) then begin
   LogSml(Now,'DIM DNS is empty');
   Exit;
  end;
  if (dns&lt;&gt;'') then begin
   if IsUnix then begin
    exe:='pgrep';
    arg:='-ax smiSM';
   end;
   if IsWindows then begin
    exe:='wmic';
    arg:='process where name="smiSM.exe" get ProcessId,Name,CommandLine';
   end;
   cmd:=SmiGenGui.ComposeCmd(exe,arg);
   ans:=SmiGenGui.Exec(exe,arg);
   if IsWindows then begin
     // wmic output contains \0 and \r\r\n
    ans:=StringReplace(ans,Chr(0),'',rfReplaceAll);
    ans:=StringReplace(ans,vbCR,vbLF,rfReplaceAll);
    ans:=StringReplace(ans,vbLF,EOL,rfReplaceAll);
    ans:=StringReplace(ans,EOL+EOL,EOL,rfReplaceAll);
    ans:=StringReplace(ans,EOL+EOL,EOL,rfReplaceAll);
    ans:=StringReplace(ans,EOL+EOL,EOL,rfReplaceAll);
    ans:=AdjustLineBreaks(ans);
   end;
   if IsEmptyStr(ans)
   then LogSml(Now,'Local smiSM processes is not found on '+GetHostName)
   else LogSml(Now,'List of running smiSM processes on '+GetHostName+':'+EOL+ans);
  end;
  old:=GetEnv('DIM_DNS_NODE');
  try
   SetEnv('DIM_DNS_NODE',dns);
   list:=SmiGenGui.Exec(SmiGenGui.getDomainsExe);
   list:=ReplaceRegExpr('(?im)/.*?$',list,'',false);
   if IsEmptyStr(list)
   then LogSml(Now,'SML Domains is not found on DNS '+dns)
   else LogSml(Now,'List of running SMI Domains with DNS '+dns+':'+EOL+List);
  finally
   SetEnv('DIM_DNS_NODE',old);
  end;
 except
  on E:Exception do Self.BugReport(E,Self,'ActionSmiSmListExecute');
 end;
end;

procedure TMainForm.ActionSmiSmKillExecute(Sender: TObject);
var old,dns,dom,exe,cmd,arg,ans:String; UseSmiKill:Boolean;
begin
 try
  dns:=Trim(ComboBoxSmiSmDns.Text);
  if IsEmptyStr(dns) then begin
   LogSml(Now,'DIM DNS is empty');
   Exit;
  end;
  dom:=ExtractWord(1,MemoSmlResult.SelText,'/ '+vbTab+vbCrLf+EOL);
  if IsEmptyStr(dom) then begin
   LogSml(Now,'SMI Domain is not selected in SML Result Log');
   Exit;
  end;
  old:=GetEnv('DIM_DNS_NODE');
  try
   UseSmiKill:=false; ans:='';
   SetEnv('DIM_DNS_NODE',dns);
   exe:=SmiGenGui.SmiSiteBinExe('smi_kill.exe');
   if not FileExists(exe) then exe:=SmiGenGui.SmiSiteBinExe('smiKill.exe');
   if UseSmiKill and FileExists(exe) then begin
    arg:=dom;
    if IsUnix then begin
     arg:='DIM_DNS_NODE='+dns+' '+exe+' '+dom;
     exe:='env';
    end;
    if IsWindows then begin
     arg:='-7w '+SmiGenGui.ComposeCmd(exe,arg);
     exe:='grun';
    end;
    cmd:=SmiGenGui.ComposeCmd(exe,arg);
    if not RunCommand(cmd,ans) then ans:='' else
    if IsEmptyStr(ans) then ans:='Killed domain: '+dom else ans:=Trim(ans);
   end else begin
    exe:=DimSendCommandExe;
    arg:=dom+'_SMI/EXIT 0 -dns '+dns+' -i';
    cmd:=SmiGenGui.ComposeCmd(exe,arg);
    ans:=SmiGenGui.Exec(exe,arg);
   end;
   LogSml(Now,'Run: '+cmd);
   SmiRunLog(Now,'Run: '+cmd);
   if IsEmptyStr(ans) then ans:='Failed: '+cmd;
   LogSml(Now,ans);
   SmiRunLog(Now,ans);
   Sleep(1000); // Give a process time to die
   SmiGenGui.PollTasks; ActionSmiSmList.Execute;
  finally
   SetEnv('DIM_DNS_NODE',old);
  end;
 except
  on E:Exception do Self.BugReport(E,Self,'ActionSmiSmKillExecute');
 end;
end;

procedure TMainForm.BitBtnSmiHelpSmiWebCernChClick(Sender: TObject);
begin
 SmiGenGui.RunWebBrowser('https://smi.web.cern.ch');
end;

procedure TMainForm.BitBtnSmiHelpIndexClick(Sender: TObject);
begin
 SmiGenGui.RunWebBrowser(SmiGenGui.SmiSiteFile('smi.web.cern.ch\index.html'));
end;

procedure TMainForm.BitBtnSmiHelpDimIndexClick(Sender: TObject);
begin
 SmiGenGui.RunWebBrowser(SmiGenGui.DimSiteFile('dim.web.cern.ch\index.html'));
end;

procedure TMainForm.BitBtnSmiHelpDimWebCernChClick(Sender: TObject);
begin
 SmiGenGui.RunWebBrowser('https://dim.web.cern.ch');
end;

procedure TMainForm.BitBtnSmiHelpResourceDimSiteClick(Sender: TObject);
begin
 SmiGenGui.RunWebBrowser(SmiGenGui.DimSiteFile('.'));
end;

procedure TMainForm.BitBtnSmiHelpResourceSmiSiteClick(Sender: TObject);
begin
 SmiGenGui.RunWebBrowser(SmiGenGui.SmiSiteFile('.'));
end;

procedure TMainForm.BitBtnSmiHelpDimSiteReadmeHtmClick(Sender: TObject);
begin
 SmiGenGui.RunWebBrowser(SmiGenGui.DimSiteFile('readme.htm'));
end;

procedure TMainForm.BitBtnSmiHelpDimManRuPdfClick(Sender: TObject);
begin
 SmiGenGui.RunPdfViewer(SmiGenGui.DimSiteFile('dim_man_ru.pdf'));
end;

procedure TMainForm.BitBtnSmiHelpSmiSiteReadmeHtmClick(Sender: TObject);
begin
 SmiGenGui.RunWebBrowser(SmiGenGui.SmiSiteFile('readme.htm'));
end;

procedure TMainForm.BitBtnSmiHelpSmiManRuPdfClick(Sender: TObject);
begin
 SmiGenGui.RunPdfViewer(SmiGenGui.SmiSiteFile('smi_man_ru.pdf'));
end;

procedure TMainForm.BitBtnSmiHelpDimOverviewClick(Sender: TObject);
begin
 SmiGenGui.RunPdfViewer(SmiGenGui.DimSiteFile('dim_overview.pdf'));
end;

procedure TMainForm.BitBtnSmiHelpSmiOverviewClick(Sender: TObject);
begin
 SmiGenGui.RunPdfViewer(SmiGenGui.SmiSiteFile('smi_overview.pdf'));
end;

procedure TMainForm.ActionSmiSmOptionsHelpExecute(Sender: TObject);
begin
 SmiGenGui.RunWebBrowser(SmiGenGui.SmiSiteFile('smi.web.cern.ch\SMRunTimeOptions.html'));
 LogSml(Now,'smiSM usage:'+EOL+SmiGenGui.Exec(SmiGenGui.SmiSiteBinExe('smiSM.exe')));
end;

procedure TMainForm.ActionSmiSmViewLogExecute(Sender: TObject);
var LogFile,Viewer,cmd:String;
begin
 try
  if not CheckBoxSmiSmLogFile.Checked then begin
   LogSml(Now,'Log file not uses');
   Exit;
  end;
  LogFile:=SmiSmLogFile;
  if not FileExists(LogFile) then begin
   LogSml(Now,'Not found Log File '+LogFile);
   Exit;
  end;
  Viewer:=Trim(ComboBoxSmiSmLogViewer.Text);
  if (CRW_DAQ_SYS_EXE_PID&lt;&gt;0) then begin
   cmd:='@run '+Viewer+' '+SmiGenGui.ValidatePathName(LogFile,8);
   LogSml(Now,'Send command:'+EOL+cmd);
   PostCommandToCrwDaq(cmd);
  end else begin
   LogSml(Now,SmiGenGui.RunTextViewer(LogFile,Viewer));
  end;
 except
  on E:Exception do Self.BugReport(E,Self,'ActionSmiSmViewLogExecute');
 end;
end;

procedure TMainForm.ActionSmiSmDeleteLogExecute(Sender: TObject);
var LogFile:String;
begin
 try
  if not CheckBoxSmiSmLogFile.Checked then begin
   LogSml(Now,'Log file not uses');
   Exit;
  end;
  LogFile:=SmiSmLogFile;
  if not FileExists(LogFile) then begin
   LogSml(Now,'Not found Log File '+LogFile);
   Exit;
  end;
  if DeleteFile(LogFile)
  then LogSml(Now,'Deleted Log File '+LogFile)
  else LogSml(Now,'Could not delete Log File '+LogFile);
 except
  on E:Exception do Self.BugReport(E,Self,'ActionSmiSmViewLogExecute');
 end;
end;

procedure TMainForm.ActionSmlCodeParseExecute(Sender: TObject);
var i,p:Integer; rexlinecomm,rexdecltype,rexdeclname:TRegExpr;
    textline,sline,comm,sn,sv,st,decltype,declname,declargs,declopts:String;
    delims,context,cobj,csta,cact,cfun,cobjset,cpar,delim,cn,cp,obj:String;
begin
 try
  if not FileExists(SmlFile) then begin
   LogSml(Now,'SML file not found '+SmlFile);
   PageControlMain.ActivePage:=TabSheetSml;
   Exit;
  end;
  delims:=' '+vbTab+vbCrLf;
  ActionSmlCodeClear.Execute;
  SmlCode.LoadFromFile(SmlFile);
  SmlCode.ConvertAnsiToUTF8;
  SmlCode.Text:=ReplaceRegExpr('(?s)[,]\s*[\r\n]\s*',SmlCode.Text,',',false);
  cobj:=''; csta:=''; cact:=''; cfun:=''; cobjset:=''; cpar:='';
  context:='domain '+SmlDaqDomain;
  rexlinecomm:=TRegExpr.Create;
  rexdecltype:=TRegExpr.Create;
  rexdeclname:=TRegExpr.Create;
  try
   rexlinecomm.Expression:='(?i)^(.*?)([!#].*)$';
   rexdecltype.Expression:='(?i)^\s*\b(class|object|state|action|objectset|function|parameters)\b\s*(:)(.*)$';
   rexdeclname.Expression:='(?i)^\s*\b([a-zA-Z_\&amp;]+[\w\&amp;:\.\-]*)\b(.*)$';
   for i:=0 to SmlCode.Count-1 do begin
    textline:=SmlCode.Strings[i];
    sline:=textline; comm:=''; sn:=''; sv:='';
    if rexlinecomm.Exec(textline) then begin
     sline:=rexlinecomm.Match[1];
     comm:=rexlinecomm.Match[2];
    end;
    decltype:=''; declargs:=''; declname:=''; declopts:='';
    if rexdecltype.Exec(sline) then begin
     decltype:=rexdecltype.match[1];
     declargs:=rexdecltype.match[3];
    end;
    if rexdeclname.Exec(declargs) then begin
     declname:=rexdeclname.match[1];
     declopts:=rexdeclname.match[2];
    end;
    if (decltype&lt;&gt;'') then begin
     if SameText(decltype,'class') then begin
      if (declname&lt;&gt;'') then begin
       cobj:=declname;
       SmlDecl.Values[declname]:=Trim(decltype+' '+declopts);
      end;
      cobjset:=''; csta:=''; cact:=''; cfun:=''; cpar:='';
      context:=Trim(decltype+' '+declname);
     end else
     if SameText(decltype,'object') then begin
      if (declname&lt;&gt;'') then begin
       cobj:=declname;
       SmlDecl.Values[declname]:=Trim(decltype+' '+declopts);
       ListBoxSmlAllObjectList.Items.Add(declname);
       delim:=' '+vbTab;
       p:=WordIndex('is_of_class',declopts,delim);
       if (p&gt;0) and (WordCount(declopts,delim)&gt;p) then begin
        cn:=ExtractWord(p+1,declopts,delim); // class name
        cp:=myObjPars.Values[cn]; // class parameters
        if (cp&lt;&gt;'') then myObjPars.Values[cobj]:=cp;
       end;
      end;
      cobjset:=''; csta:=''; cact:=''; cfun:=''; cpar:='';
      SmlDecl.Values[declname]:=Trim(decltype+' '+declopts);
      context:=decltype+' '+declname;
     end else
     if SameText(decltype,'state') then begin
      if (declname&lt;&gt;'') then begin
       csta:=declname;
      end;
      cobjset:=''; cact:=''; cfun:=''; cpar:='';
      context:=Trim(decltype+' '+declname);
     end else
     if SameText(decltype,'action') then begin
      if (declname&lt;&gt;'') then begin
       cact:=declname;
      end;
      cobjset:=''; cfun:=''; cpar:='';
      context:=Trim(decltype+' '+declname);
     end else
     if SameText(decltype,'objectset') then begin
      if (declname&lt;&gt;) then begin
       cobjset:=declname;
       SmlDecl.Values[declname]:=Trim(decltype+' '+declopts);
       ListBoxSmlAllObjectsetList.Items.Add(declname);
      end;
      cobj:=''; csta:=''; cact:=''; cfun:=''; cpar:='';
      context:=Trim(decltype+' '+declname);
     end else
     if SameText(decltype,'function') then begin
      if (declname&lt;&gt;) then begin
       cfun:=declname;
       SmlDecl.Values[declname]:=Trim(decltype+' '+declopts);
      end;
      cobjset:=''; csta:=''; cact:=''; cpar:='';
      context:=Trim(decltype+' '+declname);
     end else
     if SameText(decltype,'parameters') then begin
      st:=ExtractWord(1,context,delims);
      sn:=ExtractWord(2,context,delims);
      if (sn&lt;&gt;'') then
      if SameText(st,'class') or SameText(st,'object') then
      if (fsm_normalize_params(declargs,sv)=0) then begin
       sv:=StringReplace(Trim(sv),EOL,',',rfReplaceAll);
       myObjPars.Values[sn]:=sv;
      end;
      csta:=''; cact:=''; cpar:='';
     end else
     begin
      LogSml(Now,'Invalid declaration: '+sline);
      RaiseException('Invalid declaration: '+sline);
     end;
    end;
   end;
   // Update ListBoxSmlAllObjectParamList
   for i:=0 to ListBoxSmlAllObjectList.Count-1 do begin
    obj:=ListBoxSmlAllObjectList.Items.Strings[i];
    DeclareObjectParams(ListBoxSmlAllObjectParamList.Items,obj,GetObjectParams(obj));
   end;
   ListBoxSmlAllObjectParamList.Sorted:=false;
   for i:=0 to ListBoxSmlAllObjectParamList.Count-1 do begin
    p:=Pos('::',ListBoxSmlAllObjectParamList.Items.Strings[i]);
    if (p&gt;0) then ListBoxSmlAllObjectParamList.Items.Strings[i]:=Copy(ListBoxSmlAllObjectParamList.Items.Strings[i],p+2,MaxInt);
   end;
   ListBoxSmlAllObjectParamList.Sorted:=true;
  finally
   rexlinecomm.Free;
   rexdecltype.Free;
   rexdeclname.Free;
  end;
  PageControlDaq.ActivePage:=TabSheetDaqParams;
 except
  on E:Exception do Self.BugReport(E,Self,'ActionSmlCodeParseExecute');
 end;
end;

procedure TMainForm.ActionSmlCodeClearExecute(Sender: TObject);
begin
 try
  SmlCode.Clear;
  SmlDecl.Clear;
  myObjPars.Clear;
  MemoDaqCfg.Clear;
  ListBoxSmlAllObjectList.Clear;
  ListBoxSmlSelObjectList.Clear;
  ListBoxSmlAllObjectsetList.Clear;
  ListBoxSmlSelObjectsetList.Clear;
  ComboBoxSmlMainObject.Items.Clear;
  ComboBoxSmlLeadObject.Items.Clear;
  ListBoxSmlAllObjectParamList.Clear;
  ListBoxSmlSelObjectParamList.Clear;
  PageControlDaq.ActivePage:=TabSheetDaqParams;
  PageControlSmlSelector.ActivePage:=TabSheetSmlSelectObjects;
 except
  on E:Exception do Self.BugReport(E,Self,'ActionSmlCodeClearExecute');
 end;
end;

procedure ComboBoxUpdateItems(ComboBox:TComboBox; Items:String);
var i:Integer; item:String;
begin
 if (ComboBox&lt;&gt;nil) then begin
  if (ComboBox.ItemIndex&gt;=0)
  then item:=ComboBox.Items.Strings[ComboBox.ItemIndex]
  else item:='';
  ComboBox.Items.Text:=Items;
  if (item&lt;&gt;'') then i:=ComboBox.Items.IndexOf(item) else i:=-1;
  if (i&gt;=0) then ComboBox.ItemIndex:=i;
 end;
end;

procedure TMainForm.ActionSmlObjectSelectExecute(Sender: TObject);
var i:Integer; item:String;
begin
 try
  for i:=0 to ListBoxSmlAllObjectList.Count-1 do begin
   if ListBoxSmlAllObjectList.Selected[i] then begin
    item:=ListBoxSmlAllObjectList.Items.Strings[i];
    if (item&lt;&gt;'') then
    if (ListBoxSmlSelObjectList.Items.IndexOf(item)&lt;0)
    then ListBoxSmlSelObjectList.Items.Add(item);
   end;
  end;
  ComboBoxUpdateItems(ComboBoxSmlMainObject,ListBoxSmlSelObjectList.Items.Text);
  ComboBoxUpdateItems(ComboBoxSmlLeadObject,ListBoxSmlSelObjectList.Items.Text);
 except
  on E:Exception do Self.BugReport(E,Self,'ActionSmlObjectSelectExecute');
 end;
end;

function TMainForm.GetObjectParams(obj:String):String;
var n:Integer;
begin
 Result:='';
 obj:=Trim(obj);
 if (obj='') then Exit;
 Result:=myObjPars.Values[obj];
 if (Result&lt;&gt;'') then Exit;
 n:=WordIndex('is_of_class',SmlDecl.Values[obj],' '+vbTab);
 if (n&gt;0) then obj:=ExtractWord(n+1,SmlDecl.Values[obj],' '+vbTab) else Exit;
 Result:=myObjPars.Values[obj];
end;

function TMainForm.DeclareObjectParams(cfg:TStrings; obj,pars:String):String;
var iw,p:Integer; par,pt,pn,pv,decl:String;
begin
 Result:='';
 if (obj&lt;&gt;'') and (pars&lt;&gt;'') then
 for iw:=1 to WordCount(pars,',') do begin
  par:=ExtractWord(iw,pars,',');
  p:=Pos('=',par);
  if (p=0) then continue;
  pv:=Trim(Copy(par,p+1,MaxInt));
  if (StrFetch(pv,1)='"') then pv:=AnsiDequotedStr(pv,'"');
  par:=Copy(par,1,p-1);
  pt:=ExtractWord(1,par,' '+vbTab);
  pn:=ExtractWord(2,par,' '+vbTab);
  if SameText(pt,'int')    then pt:='integer' else
  if SameText(pt,'float')  then pt:='real'    else
  if SameText(pt,'string') then pt:='string'  else pt:='';
  if (pt='') then continue;
  decl:=SmiTagPrefix+SmlDaqDomain+'::'+obj+'#'+pn+' = '+pt+' '+pv;
  if (cfg&lt;&gt;nil) then cfg.Add(decl);
  Result:=Result+decl+EOL;
 end;
end;


procedure TMainForm.ActionSmlMakeDaqCfgExecute(Sender: TObject);
var i,nm,nl:Integer; obj,dev,win,pnm,pty,pvl:String; cfg:TStrings;
begin
 try
  if (SmlDaqDomain='') then begin
   ShowMessage('Error: SML Domain is empty.');
   Exit;
  end;
  if (ListBoxSmlSelObjectList.Count=0) then begin
   ShowMessage('Error: Not found selected objects.');
   Exit;
  end;
  try
   MemoDaqCfg.Lines.BeginUpdate;
   cfg:=MemoDaqCfg.Lines;
   cfg.Clear;
   dev:=Trim(ComboBoxSmlDaqGuiCtrlDevice.Text);
   win:=Trim(ComboBoxSmlDaqGuiCtrlWindow.Text);
   // [&amp;Device]
   cfg.Add('['+dev+']');
   cfg.Add(';--------------- Memory buffers -----');
   cfg.Add('StdInFifo      = '+IntToStr(SmlDaqGuiFifoSizeKb)+' ; StdIn  Console size, kB');
   cfg.Add('StdOutFifo     = '+IntToStr(SmlDaqGuiFifoSizeKb)+' ; StdOut Console size, kB');
   cfg.Add('StdInPipeSize  = '+IntToStr(SmlDaqGuiFifoSizeKb)+' ; StdIn  process pipe size, kB');
   cfg.Add('StdOutPipeSize = '+IntToStr(SmlDaqGuiFifoSizeKb)+' ; StdOut process pipe size, kB');
   NiceFormatByPattern(cfg,' = ',nl);
   NiceFormatByPattern(cfg,' ; ',nl);
   nl:=cfg.Count;
   cfg.Add(';------------- SMIUISRV server parameters -----------------------');
   cfg.Add('SMIUISRV_EXE = ~~\Resource\DaqSite\SmiServer\SmiuiSrv.exe       ; Location of executable file SMIUISRV.EXE');
   cfg.Add('SMIUISRV_ARG = -auto -dom '+SmlDaqDomain+' -sleep 1000          ; Command line arguments for  SMIUISRV.EXE');
   cfg.Add('SMIUISRV_DNS = [&amp;DimSrv] DIM_DNS_NODE %DIM_DNS_NODE% localhost  ; DIM_DNS_NODE uses to launch SMIUISRV.EXE');
   cfg.Add('SMIUISRV_FSM = -name '+ExtractWord(1,dev,'&amp; .')+' -dom '+SmlDaqDomain+' -sml '+ExtractFileName(SmlFile)+' ; Command line to initialize FSM Manager');
   cfg.Add('SMIUISRV_WDT = 10                        ; Task watchdog time, sec for SMIUISRV.EXE');
   cfg.Add('SMIUISRV_SWM = 0                         ; ShowWindow display mode for SMIUISRV.EXE');
   cfg.Add('SmiTagPrefix = '+SmiTagPrefix+'          ; Common Prefix for all SMI related tags');
   cfg.Add('SmiMenuFont  = '+SmlDaqGuiMenusFont+'    ; Font uses for State/Action Menu`s');
   cfg.Add(';----------------------------------------------------------------');
   cfg.Add('[]');
   cfg.Add('');
   NiceFormatByPattern(cfg,' = ',nl);
   NiceFormatByPattern(cfg,' ; ',nl);
   nl:=cfg.Count;
   // TagList
   cfg.Add('[TagList]');
   cfg.Add(';------------------------------------');
   cfg.Add(SmiTagPrefix+'HOSTNAME    = string  -');
   cfg.Add(SmiTagPrefix+'DATETIME    = string  -');
   cfg.Add(SmiTagPrefix+'DNS_NODE    = string  -');
   cfg.Add(SmiTagPrefix+'DNS_TASK    = string  -');
   cfg.Add(SmiTagPrefix+'DNS_PID     = integer 0');
   cfg.Add(SmiTagPrefix+'DNS_VERSION = integer 0');
   cfg.Add(';------------------------------------');
   cfg.Add(SmiTagPrefix+SmlDaqDomain+'.SMI_MESSAGE       = string  -');
   cfg.Add(SmiTagPrefix+SmlDaqDomain+'.USER_MESSAGE      = string  -');
   cfg.Add(SmiTagPrefix+SmlDaqDomain+'.DOMAIN_NAME       = string  -');
   cfg.Add(SmiTagPrefix+SmlDaqDomain+'.NUMBER_OF_OBJECTS = integer 0');
   // Object tags
   //////////////
   for i:=0 to ListBoxSmlSelObjectList.Count-1 do begin
    obj:=ListBoxSmlSelObjectList.Items.Strings[i];
    cfg.Add(';------------------------------------');
    cfg.Add(SmiTagPrefix+SmlDaqDomain+'::'+obj+'.OBJECT_NAME  = string  -');
    cfg.Add(SmiTagPrefix+SmlDaqDomain+'::'+obj+'.OBJECT_TITLE = string  -');
    cfg.Add(SmiTagPrefix+SmlDaqDomain+'::'+obj+'.OBJECT_PARAM = string  -');
    cfg.Add(SmiTagPrefix+SmlDaqDomain+'::'+obj+'.STATE_NAME   = string  -');
    cfg.Add(SmiTagPrefix+SmlDaqDomain+'::'+obj+'.STATE_TITLE  = string  -');
    cfg.Add(SmiTagPrefix+SmlDaqDomain+'::'+obj+'.BUSY_ACTION  = string  -');
    DeclareObjectParams(cfg,obj,GetObjectParams(obj));
   end;
   // Objectset tags
   /////////////////
   for i:=0 to ListBoxSmlSelObjectsetList.Count-1 do begin
    obj:=ListBoxSmlSelObjectsetList.Items.Strings[i];
    cfg.Add(';------------------------------------');
    cfg.Add(SmiTagPrefix+SmlDaqDomain+'::'+obj+'.OBJECTSET_LIST  = string  -');
    cfg.Add(SmiTagPrefix+SmlDaqDomain+'::'+obj+'.OBJECTSET_NAME  = string  -');
    cfg.Add(SmiTagPrefix+SmlDaqDomain+'::'+obj+'.OBJECTSET_TITLE = string  -');
   end;
   // Object Parameter tags
   ////////////////////////
   nm:=0;
   for i:=0 to ListBoxSmlSelObjectParamList.Count-1 do begin
    pnm:=ListBoxSmlSelObjectParamList.Items.Names[i];
    pty:=ExtractWord(1,ListBoxSmlSelObjectParamList.Items.Values[pnm],' '+vbTab);
    pty:=ExtractWord(WordIndex(pty,fsm_scalar_type_list,','),'integer,real,string',',');
    pvl:=Trim(SkipWords(1,ListBoxSmlSelObjectParamList.Items.Values[pnm],' '+vbTab));
    if (StrFetch(pvl,1)=QuoteMark) then pvl:=AnsiDequotedStr(pvl,QuoteMark);
    pnm:=Trim(pnm);
    obj:=ExtractFileDir(pnm);
    if (pnm='') or (pty='') or (obj='') then continue;
    pnm:=StringReplace(pnm,DirectorySeparator,'.',rfReplaceAll);
    if (nm=0) then cfg.Add(';------------------------------------'); inc(nm);
    cfg.Add(SmiTagPrefix+SmlDaqDomain+'::'+pnm+' = '+FormatVar('%-7s',pty)+' '+pvl);
   end;
   cfg.Add(';------------------------------------');
   cfg.Add('[]');
   cfg.Add('');
   // Nice format [TagList]
   ////////////////////////
   NiceFormatByPattern(cfg,'=',nl);
   // Window sensor links
   //////////////////////
   cfg.Add('['+Trim(win)+']');
   cfg.Add('Link sensor '+SmiTagPrefix+'HOSTNAME with tag '+SmiTagPrefix+'HOSTNAME device '+dev);
   cfg.Add('Link sensor '+SmiTagPrefix+'DATETIME with tag '+SmiTagPrefix+'DATETIME device '+dev);
   cfg.Add('Link sensor '+SmiTagPrefix+'DNS_VERSION with tag '+SmiTagPrefix+'DNS_VERSION device '+dev);
   cfg.Add('Link sensor '+SmiTagPrefix+SmlDaqDomain+'.LOGO with tag '+SmiTagPrefix+SmlDaqDomain+'.NUMBER_OF_OBJECTS device '+dev);
   cfg.Add('Link sensor '+SmiTagPrefix+SmlDaqDomain+'.DOMAIN_NAME with tag '+SmiTagPrefix+SmlDaqDomain+'.DOMAIN_NAME device '+dev);
   for i:=0 to ListBoxSmlSelObjectList.Count-1 do begin
    obj:=ListBoxSmlSelObjectList.Items.Strings[i];
    cfg.Add('Link sensor '+SmiTagPrefix+SmlDaqDomain+'::'+obj+'.OBJECT_NAME with tag '+SmiTagPrefix+SmlDaqDomain+'::'+obj+'.OBJECT_TITLE device '+dev);
    cfg.Add('Link sensor '+SmiTagPrefix+SmlDaqDomain+'::'+obj+'.STATE_NAME with tag '+SmiTagPrefix+SmlDaqDomain+'::'+obj+'.STATE_TITLE device '+dev);
   end;
   for i:=0 to ListBoxSmlSelObjectParamList.Count-1 do begin
    pnm:=ListBoxSmlSelObjectParamList.Items.Names[i];
    pnm:=StringReplace(pnm,DirectorySeparator,'.',rfReplaceAll);
    cfg.Add('Link sensor '+SmiTagPrefix+SmlDaqDomain+'::'+pnm+' with tag '+SmiTagPrefix+SmlDaqDomain+'::'+pnm+' device '+dev);
   end;
   cfg.Add('[]');
   // Nice format of [window]
   NiceFormatByPattern(cfg,' with tag ');
   NiceFormatByPattern(cfg,' device ');
  finally
   MemoDaqCfg.Lines.EndUpdate;
  end;
  PageControlDaq.ActivePage:=TabSheetDaqCfg;
 except
  on E:Exception do Self.BugReport(E,Self,'ActionSmlMakeDaqCfgExecute');
 end;
end;

procedure TMainForm.ActionSmlDaqGuiCtrlDeviceUpdateExecute(Sender: TObject);
var dev,win:String;
begin
 try
  dev:='&amp;'+SmiTagPrefix+SmlDaqDomain+'.GUI.CTRL';
  ComboBoxSmlDaqGuiCtrlDevice.Text:=dev;
  if (ComboBoxSmlDaqGuiCtrlDevice.Items.IndexOf(dev)&lt;0)
  then ComboBoxSmlDaqGuiCtrlDevice.Items.Add(dev);
  win:=SmiTagPrefix+SmlDaqDomain+'.GUI.CTRL';
  ComboBoxSmlDaqGuiCtrlWindow.Text:=win;
  if (ComboBoxSmlDaqGuiCtrlWindow.Items.IndexOf(win)&lt;0)
  then ComboBoxSmlDaqGuiCtrlWindow.Items.Add(win);
 except
  on E:Exception do Self.BugReport(E,Self,'ActionSmlDaqGuiCtrlDeviceUpdateExecute');
 end;
end;

procedure TMainForm.ActionSmlObjectsetSelectExecute(Sender: TObject);
var i:Integer; item:String;
begin
 try
  for i:=0 to ListBoxSmlAllObjectsetList.Count-1 do begin
   if ListBoxSmlAllObjectsetList.Selected[i] then begin
    item:=ListBoxSmlAllObjectsetList.Items.Strings[i];
    if (item&lt;&gt;'') then
    if (ListBoxSmlSelObjectsetList.Items.IndexOf(item)&lt;0)
    then ListBoxSmlSelObjectsetList.Items.Add(item);
   end;
  end;
 except
  on E:Exception do Self.BugReport(E,Self,'ActionSmlObjectsetSelectExecute');
 end;
end;

procedure TMainForm.BitBtnDaqCfgSelectAllClick(Sender: TObject);
begin
 MemoDaqCfg.SelectAll;
end;

procedure TMainForm.BitBtnDaqCfgUnselectClick(Sender: TObject);
begin
 MemoDaqCfg.SelLength:=0;
end;

procedure TMainForm.BitBtnDaqCfgCopyToClipboardClick(Sender: TObject);
var sel:String;
begin
 sel:=MemoDaqCfg.SelText;
 if (sel&lt;&gt;'') then Clipboard.AsText:=sel;
end;

procedure TMainForm.BitBtnDaqCfgSaveAsClick(Sender: TObject);
var fn:String; mb,mr:Integer;
begin
 try
  if not FileExists(SmlFile) then begin
   LogSml(Now,'SML file not found '+SmlFile);
   PageControlMain.ActivePage:=TabSheetSml;
   Exit;
  end;
  if (SmlDaqDomain='') then begin
   ShowMessage('Error: SML Domain is empty.');
   Exit;
  end;
  if (MemoDaqCfg.Lines.Count=0) then begin
   ShowMessage('Error: DAQ CFG text is empty.');
   Exit;
  end;
  fn:=SmiTagPrefix+SmlDaqDomain;
  fn:=fn+'_'+ExtractFileName(SmlFile);
  fn:=StringReplace(fn,'.','_',rfReplaceAll);
  fn:=AnsiLowerCase(ReplaceFileExt(fn,'.cfg'));
  SaveDialogSmlDaq.FileName:=fn;
  SaveDialogSmlDaq.DefaultExt:='.cfg';
  SaveDialogSmlDaq.InitialDir:=ExtractFileDir(SmlFile);
  SaveDialogSmlDaq.Filter:='CFG files|*.cfg|ALL files|*.*';
  if SaveDialogSmlDaq.Execute then begin
   fn:=SaveDialogSmlDaq.FileName;
   if FileExists(fn) then begin
    mb:=MB_YESNO+MB_ICONQUESTION;
    mr:=MessageBox('File is already exists:'+EOL+'Overwrite this file?',
                   'Your Confirmation Required...',mb);
    if (mr&lt;&gt;IDYES) then Exit;
   end;
   FileWriteAsText(fn,MemoDaqCfg.Lines.Text,ioModeAnsi);
  end;
 except
  on E:Exception do Self.BugReport(E,Self,'BitBtnDaqCfgSaveAsClick');
 end;
end;

procedure TMainForm.BitBtnDaqCrcSelectAllClick(Sender: TObject);
begin
 MemoDaqCrc.SelectAll;
end;

procedure TMainForm.BitBtnDaqCrcUnselectClick(Sender: TObject);
begin
 MemoDaqCrc.SelLength:=0;
end;

procedure TMainForm.BitBtnDaqCrcCopyToClipboardClick(Sender: TObject);
var sel:String;
begin
 sel:=MemoDaqCrc.SelText;
 if (sel&lt;&gt;'') then Clipboard.AsText:=sel;
end;

procedure TMainForm.BitBtnDaqCrcSaveAsClick(Sender: TObject);
var fn:String; mb,mr:Integer;
begin
 try
  if not FileExists(SmlFile) then begin
   LogSml(Now,'SML file not found '+SmlFile);
   PageControlMain.ActivePage:=TabSheetSml;
   Exit;
  end;
  if (SmlDaqDomain='') then begin
   ShowMessage('Error: SML Domain is empty.');
   Exit;
  end;
  if (MemoDaqCrc.Lines.Count=0) then begin
   ShowMessage('Error: DAQ CRC text is empty.');
   Exit;
  end;
  fn:=SmiTagPrefix+SmlDaqDomain;
  fn:=fn+'_'+ExtractFileName(SmlFile);
  fn:=StringReplace(fn,'.','_',rfReplaceAll);
  fn:=AnsiLowerCase(ReplaceFileExt(fn,'.crc'));
  SaveDialogSmlDaq.FileName:=fn;
  SaveDialogSmlDaq.DefaultExt:='.crc';
  SaveDialogSmlDaq.InitialDir:=ExtractFileDir(SmlFile);
  if DirectoryExists(ExtractFileDir(SmlFile)+'\..\Circuits')
  then SaveDialogSmlDaq.InitialDir:=ExtractFileDir(SmlFile)+'\..\Circuits';
  SaveDialogSmlDaq.Filter:='CRC files|*.crc|ALL files|*.*';
  if SaveDialogSmlDaq.Execute then begin
   fn:=SaveDialogSmlDaq.FileName;
   if FileExists(fn) then begin
    mb:=MB_YESNO+MB_ICONQUESTION;
    mr:=MessageBox('File is already exists:'+EOL+'Overwrite this file?',
                   'Your Confirmation Required...',mb);
    if (mr&lt;&gt;IDYES) then Exit;
   end;
   FileWriteAsText(fn,MemoDaqCrc.Lines.Text,ioModeAnsi);
  end;
 except
  on E:Exception do Self.BugReport(E,Self,'BitBtnDaqCrcSaveAsClick');
 end;
end;

function TMainForm.MX(nL,nBW,nBD,nPW,nPD,nTW:Integer):Integer;
begin
 Result:=SmlDaqGuiLeft*nL
        +SmlDaqGuiBtnWidth*nBW+SmlDaqGuiBtnDx*nBD
        +SmlDaqGuiParWidth*nPW+SmlDaqGuiParDx*nPD
        +SmlDaqGuiHostTimeWidth*nTW;
end;

function TMainForm.MY(nT,nBH,nBD,nPH,nPD,nTH:Integer):Integer;
begin
 Result:=SmlDaqGuiTop*nT
        +SmlDaqGuiBtnHeight*nBH+SmlDaqGuiBtnDy*nBD
        +SmlDaqGuiParHeight*nPH+SmlDaqGuiParDy*nPD
        +SmlDaqGuiHostTimeHeight*nTH;
end;

procedure TMainForm.ActionSmlMakeDaqCrcExecute(Sender: TObject);
var i,onum,pnum,btnx,btny,parx,pary:Integer; crc:TCrcMaker;
    pre,dom,obj,dev,win,mainobj,leadobj,pn,pa,pt,pv,fmt:String;
begin
 try
  if (SmlDaqDomain='') then begin
   ShowMessage('Error: SML Domain is empty.');
   Exit;
  end;
  if (ListBoxSmlSelObjectList.Count=0) then begin
   ShowMessage('Error: Not found selected objects.');
   Exit;
  end;
  try
   crc:=TCrcMaker.Create;
   pre:=SmiTagPrefix;
   dom:=SmlDaqDomain;
   dev:=Trim(ComboBoxSmlDaqGuiCtrlDevice.Text);
   win:=Trim(ComboBoxSmlDaqGuiCtrlWindow.Text);
   mainobj:=Trim(ComboBoxSmlMainObject.Text);
   leadobj:=Trim(ComboBoxSmlLeadObject.Text);
   // LOGO
   crc.AddSensor(pre+dom+'.LOGO');
   crc.AddPos(MX(1,0,0,0,0,0),MY(1,0,0,0,0,0));
   crc.AddLed(0,0,0,'*',SmlDaqGuiTitleFont);
   crc.AddTagEval('('+crc.UndotLowerName(ReplaceFileExt(crc.SensorName,'.number_of_objects'))+'=v)*0');
   crc.AddPainter('(_cl_=clGray*gt(v,0)+clRed*le(v,0))');
   crc.AddPainter('(glBorderBevel='+IntToStr(SmlDaqGuiBtnBorder)+')+(glBorderColor=_cl_)');
   crc.AddPainter('[Painter(v).GuiLib.SimpleBorder]');
   crc.AddTag(1,0,'..\Bitmaps\'+crc.UndotLowerName(crc.SensorName)+'.bmp','');
   crc.AddHint(crc.SensorName+' - Демонстрационная система для иллюстрации технологии SMI.');
   crc.Add('[]');
   crc.Add('');
   // MAIN OBJECT
   if (SmlDaqMainObject&lt;&gt;'') then begin
    // MAIN_OBJECT_NAME
    crc.AddSensor(pre+'label.MAIN_OBJECT_NAME');
    crc.AddPos(MX(1,1,1,0,0,0), MY(1,0,0,0,0,0));
    crc.AddLed(0, 0, 0, '*', SmlDaqGuiTitleFont);
    crc.AddTag(1, 0, crc.StdBarBmp(MX(0,1,0,0,0,0),MY(0,0,0,0,0,1),24,'Silver'), 'Главный+Объект');
    crc.AddHint('Главный Объект Управления.');
    crc.Add('[]');
    crc.Add('');
    // MAIN_STATE_NAME
    crc.AddSensor(pre+'label.MAIN_STATE_NAME');
    crc.AddPos(MX(1,2,2,0,0,0), MY(1,0,0,0,0,0));
    crc.AddLed(0, 0, 0, '*', SmlDaqGuiTitleFont);
    crc.AddTag(1, 0, crc.StdBarBmp(MX(0,1,0,0,0,0),MY(0,0,0,0,0,1),24,'Silver'),'Состояние');
    crc.AddHint('Состояние Главного Объекта Управления.');
    crc.Add('[]');
    crc.Add('');
    //
    crc.AddSensor(pre+dom+'::'+SmlDaqMainObject+'.OBJECT_NAME');
    crc.AddPos(MX(1,1,1,0,0,0), MY(1,0,0,0,1,1));
    crc.AddLed(1, 0, 0, '*', SmlDaqGuiStateFont);
    crc.AddPainter('(_cl_=linkedtagcolor())+(_cl_=_cl_+clSilver*eq(_cl_,0))+(glBarColor=_cl_)');
    crc.AddPainter('[Painter(v).GuiLib.SimpleBar]');
    crc.AddPainter('(glBorderBevel='+IntToStr(SmlDaqGuiBtnBorder)+')+(glBorderColor=clGray)');
    crc.AddPainter('[Painter(v).GuiLib.SimpleBorder]');
    crc.AddTag(1, 0, crc.StdBarBmp(MX(0,1,0,0,0,0),MY(0,1,0,0,0,0),24,'Silver'),'');
    crc.AddHint(crc.SensorName+' - Имя Объекта.');
    crc.Add('[]');
    crc.Add('');
    //
    crc.AddSensor(pre+dom+'::'+SmlDaqMainObject+'.STATE_NAME');
    crc.AddPos(MX(1,2,2,0,0,0), MY(1,0,0,0,1,1));
    crc.AddLed(1, 0, 0, '*', SmlDaqGuiStateFont);
    crc.AddPainter('(_cl_=linkedtagcolor())+(_cl_=_cl_+clSilver*eq(_cl_,0))+(glBarColor=_cl_)');
    crc.AddPainter('[Painter(v).GuiLib.SimpleBar]');
    crc.AddPainter('(glBorderBevel='+IntToStr(SmlDaqGuiBtnBorder)+')+(glBorderColor=clGray)');
    crc.AddPainter('[Painter(v).GuiLib.SimpleBorder]');
    crc.AddTag(1, 0, crc.StdBarBmp(MX(0,1,0,0,0,0),MY(0,1,0,0,0,0),24,'Silver'),'');
    crc.AddHint(crc.SensorName+' - Состояние Объекта.');
    crc.Add('[]');
    crc.Add('');
   end;
   // LEAD OBJECT
   if (SmlDaqLeadObject&lt;&gt;'') then begin
    // LEAD_OBJECT_NAME
    crc.AddSensor(pre+'label.LEAD_OBJECT_NAME');
    crc.AddPos(MX(2,3,3,0,0,0), MY(1,0,0,0,0,0));
    crc.AddLed(0, 0, 0, '*', SmlDaqGuiTitleFont);
    crc.AddTag(1, 0, crc.StdBarBmp(MX(0,1,0,0,0,0),MY(0,0,0,0,0,1),24,'Silver'), 'Ведущий+Объект');
    crc.AddHint('Ведущий Объект Управления.');
    crc.Add('[]');
    crc.Add('');
    // LEAD_STATE_NAME
    crc.AddSensor(pre+'label.LEAD_STATE_NAME');
    crc.AddPos(MX(2,4,4,0,0,0), MY(1,0,0,0,0,0));
    crc.AddLed(0, 0, 0, '*', SmlDaqGuiTitleFont);
    crc.AddTag(1, 0, crc.StdBarBmp(MX(0,1,0,0,0,0),MY(0,0,0,0,0,1),24,'Silver'),'Состояние');
    crc.AddHint('Состояние Ведущего Объекта Управления.');
    crc.Add('[]');
    crc.Add('');
    //
    crc.AddSensor(pre+dom+'::'+SmlDaqLeadObject+'.OBJECT_NAME');
    crc.AddPos(MX(2,3,3,0,0,0), MY(1,0,0,0,1,1));
    crc.AddLed(1, 0, 0, '*', SmlDaqGuiStateFont);
    crc.AddPainter('(_cl_=linkedtagcolor())+(_cl_=_cl_+clSilver*eq(_cl_,0))+(glBarColor=_cl_)');
    crc.AddPainter('[Painter(v).GuiLib.SimpleBar]');
    crc.AddPainter('(glBorderBevel='+IntToStr(SmlDaqGuiBtnBorder)+')+(glBorderColor=clGray)');
    crc.AddPainter('[Painter(v).GuiLib.SimpleBorder]');
    crc.AddTag(1, 0, crc.StdBarBmp(MX(0,1,0,0,0,0),MY(0,1,0,0,0,0),24,'Silver'),'');
    crc.AddHint(crc.SensorName+' - Имя Объекта.');
    crc.Add('[]');
    crc.Add('');
    //
    crc.AddSensor(pre+dom+'::'+SmlDaqLeadObject+'.STATE_NAME');
    crc.AddPos(MX(2,4,4,0,0,0), MY(1,0,0,0,1,1));
    crc.AddLed(1, 0, 0, '*', SmlDaqGuiStateFont);
    crc.AddPainter('(_cl_=linkedtagcolor())+(_cl_=_cl_+clSilver*eq(_cl_,0))+(glBarColor=_cl_)');
    crc.AddPainter('[Painter(v).GuiLib.SimpleBar]');
    crc.AddPainter('(glBorderBevel='+IntToStr(SmlDaqGuiBtnBorder)+')+(glBorderColor=clGray)');
    crc.AddPainter('[Painter(v).GuiLib.SimpleBorder]');
    crc.AddTag(1, 0, crc.StdBarBmp(MX(0,1,0,0,0,0),MY(0,1,0,0,0,0),24,'Silver'),'');
    crc.AddHint(crc.SensorName+' - Состояние Объекта.');
    crc.Add('[]');
    crc.Add('');
   end;
   // DNS
   crc.AddSensor(pre+'label.DNS');
   crc.AddPos(SmlDaqGuiWidth-MX(2,0,0,0,0,1)-SmlDaqGuiDomainWidth, MY(1,0,0,0,0,0));
   crc.AddLed(0, 0, 0, '*', SmlDaqGuiStateFont);
   crc.AddTag(1, 0, crc.StdBarBmp(SmlDaqGuiDnsWidth,MY(0,0,0,0,0,1),24,'Silver'),'DNS');
   crc.AddHint(pre+'DNS_VERSION - Индикатор версии и статуса DIM DNS.');
   crc.Add('[]');
   crc.Add('');
   // DNS_VERSION
   crc.AddSensor(pre+'DNS_VERSION');
   crc.AddPos(SmlDaqGuiWidth-MX(2,0,0,0,0,1)-SmlDaqGuiDomainWidth+SmlDaqGuiDnsWidth, MY(1,0,0,0,0,0));
   crc.AddLed(4, 0, 0, '*', SmlDaqGuiStateFont);
   crc.AddPainter('(_cl_=linkedtagcolor())+(_cl_=_cl_+clSilver*eq(_cl_,0))+(glBarColor=_cl_)');
   crc.AddPainter('[Painter(v).GuiLib.SimpleBar]');
   crc.AddPainter('(glBorderBevel='+IntToStr(SmlDaqGuiParBorder)+')+(glBorderColor=clGray)');
   crc.AddPainter('[Painter(v).GuiLib.SimpleBorder]');
   crc.AddTag(1, 0, crc.StdBarBmp(SmlDaqGuiDomainWidth-SmlDaqGuiDnsWidth,SmlDaqGuiHostTimeHeight,24,'Silver'),'');
   crc.AddHint(crc.SensorName+' - Индикатор версии и статуса DIM DNS.');
   crc.Add('[]');
   crc.Add('');
   //
   crc.AddSensor(pre+'label.'+dom+'.DOMAIN_NAME');
   crc.AddPos(SmlDaqGuiWidth-MX(2,0,0,0,0,1)-SmlDaqGuiDomainWidth, MY(1,0,0,0,0,1));
   crc.AddLed(0, 0, 0, '*', SmlDaqGuiStateFont);
   crc.AddTag(1, 0, crc.StdBarBmp(SmlDaqGuiDomainWidth,MY(0,0,0,0,0,1),24,'Silver'),'ДОМЕН+SMI');
   crc.AddHint(pre+dom+'.DOMAIN_NAME - Имя Домена.');
   crc.Add('[]');
   crc.Add('');
   // DOMAIN_NAME
   crc.AddSensor(pre+dom+'.DOMAIN_NAME');
   crc.AddPos(SmlDaqGuiWidth-MX(2,0,0,0,0,1)-SmlDaqGuiDomainWidth, MY(1,0,0,0,0,2));
   crc.AddLed(4, 0, 0, '*', SmlDaqGuiDomainFont);
   crc.AddPainter('(_cl_=linkedtagcolor())+(_cl_=_cl_+clSilver*eq(_cl_,0))+(glBarColor=_cl_)');
   crc.AddPainter('[Painter(v).GuiLib.SimpleBar]');
   crc.AddPainter('(glBorderBevel='+IntToStr(SmlDaqGuiParBorder)+')+(glBorderColor=clGray)');
   crc.AddPainter('[Painter(v).GuiLib.SimpleBorder]');
   crc.AddTag(1, 0, crc.StdBarBmp(SmlDaqGuiDomainWidth,MY(0,0,0,0,0,1),24,'Silver'),'');
   crc.AddHint(crc.SensorName+' - Имя Домена.');
   crc.Add('[]');
   crc.Add('');
   // label.HOSTTIME
   crc.AddSensor(pre+'label.HOSTTIME');
   crc.AddPos(SmlDaqGuiWidth-MX(1,0,0,0,0,1), MY(1,0,0,0,0,0));
   crc.AddLed(0, 0, 0, '*', SmlDaqGuiStateFont);
   crc.AddTag(1, 0, crc.StdBarBmp(MX(0,0,0,0,0,1),MY(0,0,0,0,0,1),24,'Silver'),'СЕРВЕР/ВРЕМЯ');
   crc.AddHint(pre+'HOSTTIME - Имя и Дата-Время этого Компьютера.');
   crc.Add('[]');
   crc.Add('');
   // HOSTNAME
   crc.AddSensor(pre+'HOSTNAME');
   crc.AddPos(SmlDaqGuiWidth-MX(1,0,0,0,0,1), MY(1,0,0,0,0,1));
   crc.AddLed(1, 0, 0, '*', SmlDaqGuiParamFont);
   crc.AddPainter('(_dt_=msecnow()-linkedtagtimer())+(_cl_=linkedtagcolor())+(_cl_=_cl_+clSilver*eq(_cl_,0))+(_cl_=_cl_*lt(_dt_,5000)+clRed*ge(_dt_,5000))+(glBarColor=_cl_)');
   crc.AddPainter('[Painter(v).GuiLib.SimpleBar]');
   crc.AddPainter('(glBorderBevel='+IntToStr(SmlDaqGuiParBorder)+')+(glBorderColor=clGray)');
   crc.AddPainter('[Painter(v).GuiLib.SimpleBorder]');
   crc.AddTag(1, 0, crc.StdBarBmp(MX(0,0,0,0,0,1),MY(0,0,0,0,0,1),24,'Silver'),'');
   crc.AddHint(crc.SensorName+' - Имя этого Компьютера.');
   crc.Add('[]');
   crc.Add('');
   // DATETIME
   crc.AddSensor(pre+'DATETIME');
   crc.AddPos(SmlDaqGuiWidth-MX(1,0,0,0,0,1), MY(1,0,0,0,0,2));
   crc.AddLed(1, 0, 0, '*', SmlDaqGuiParamFont);
   crc.AddPainter('(_dt_=msecnow()-linkedtagtimer())+(_cl_=linkedtagcolor())+(_cl_=_cl_+clSilver*eq(_cl_,0))+(_cl_=_cl_*lt(_dt_,5000)+clRed*ge(_dt_,5000))+(glBarColor=_cl_)');
   crc.AddPainter('[Painter(v).GuiLib.SimpleBar]');
   crc.AddPainter('(glBorderBevel='+IntToStr(SmlDaqGuiParBorder)+')+(glBorderColor=clGray)');
   crc.AddPainter('[Painter(v).GuiLib.SimpleBorder]');
   crc.AddTag(1, 0, crc.StdBarBmp(MX(0,0,0,0,0,1),MY(0,0,0,0,0,1),24,'Silver'), '');
   crc.AddHint(crc.SensorName+' - Дата и Время по часам этого Компьютера.');
   crc.Add('[]');
   crc.Add('');
   // Separator1
   crc.AddSensor(pre+'line.VerSeparator1');
   crc.AddPos(MX(1,2,2,0,0,0), MY(1,1,1,0,1,1));
   crc.AddTag(1, 0,crc.StdBarBmp(SmlDaqGuiBtnBorder,SmlDaqGuiHeight-MY(2,1,1,0,1,1),4,'Gray'), '');
   crc.AddHint(crc.SensorName+' - Вертикальный разделитель 1.');
   crc.Add('[]');
   crc.Add('');
   // Objects
   onum:=0; btnx:=0; btny:=MY(2,1,1,0,2,2);
   for i:=0 to ListBoxSmlSelObjectList.Count-1 do begin
    obj:=Trim(ListBoxSmlSelObjectList.Items.Strings[i]);
    if SameText(obj,mainobj) then continue;
    if SameText(obj,leadobj) then continue;
    if IsEmptyStr(obj) then continue;
    if (onum=0) then begin
     crc.AddSensor(pre+'label.OBJECT_NAME');
     crc.AddPos(btnx+MX(1,0,0,0,0,0), MY(2,1,1,0,1,1));
     crc.AddLed(0, 0, 0, '*', SmlDaqGuiTitleFont);
     crc.AddTag(1, 0, crc.StdBarBmp(MX(0,1,0,0,0,0),MY(0,0,0,0,0,1),24,'Silver'), 'Объект');
     crc.AddHint('Колонка - Имя Объектов Управления.');
     crc.Add('[]');
     crc.Add('');
     crc.AddSensor(pre+'label.STATE_NAME');
     crc.AddPos(MX(1,1,1,0,0,0), MY(2,1,1,0,1,1));
     crc.AddLed(0, 0, 0, '*', SmlDaqGuiTitleFont);
     crc.AddTag(1, 0, crc.StdBarBmp(MX(0,1,0,0,0,0),MY(0,0,0,0,0,1),24,'Silver'), 'Состояние');
     crc.AddHint('Колонка - Состояние Объектов Управления.');
     crc.Add('[]');
     crc.Add('');
    end;
    crc.AddSensor(pre+dom+'::'+obj+'.OBJECT_NAME');
    crc.AddPos(btnx+MX(1,0,0,0,0,0),btny);
    crc.AddLed(1, 0, 0, '*', SmlDaqGuiStateFont);
    crc.AddPainter('(_cl_=linkedtagcolor())+(_cl_=_cl_+clSilver*eq(_cl_,0))+(glBarColor=_cl_)');
    crc.AddPainter('[Painter(v).GuiLib.SimpleBar]');
    crc.AddPainter('(glBorderBevel='+IntToStr(SmlDaqGuiBtnBorder)+')+(glBorderColor=clGray)');
    crc.AddPainter('[Painter(v).GuiLib.SimpleBorder]');
    crc.AddTag(1, 0, crc.StdBarBmp(MX(0,1,0,0,0,0),MY(0,1,0,0,0,0),24,'Silver'), '');
    crc.AddHint(crc.SensorName+' - Имя Объекта.');
    crc.Add('[]');
    crc.Add('');
    crc.AddSensor(pre+dom+'::'+obj+'.STATE_NAME');
    crc.AddPos(btnx+MX(1,1,1,0,0,0), btny);
    crc.AddLed(1, 0, 0, '*', SmlDaqGuiStateFont);
    crc.AddPainter('(_cl_=linkedtagcolor())+(_cl_=_cl_+clSilver*eq(_cl_,0))+(glBarColor=_cl_)');
    crc.AddPainter('[Painter(v).GuiLib.SimpleBar]');
    crc.AddPainter('(glBorderBevel='+IntToStr(SmlDaqGuiBtnBorder)+')+(glBorderColor=clGray)');
    crc.AddPainter('[Painter(v).GuiLib.SimpleBorder]');
    crc.AddTag(1, 0, crc.StdBarBmp(MX(0,1,0,0,0,0),MY(0,1,0,0,0,0),24,'Silver'), '');
    crc.AddHint(crc.SensorName+' - Состояние Объекта.');
    crc.Add('[]');
    crc.Add('');
    inc(onum);
    inc(btny,MY(0,1,1,0,0,0));
   end;
   // Parameters
   pnum:=0; parx:=0; pary:=btny+MY(1,0,0,0,0,0);
   for i:=0 to ListBoxSmlSelObjectParamList.Count-1 do begin
    pn:=ListBoxSmlSelObjectParamList.Items.Names[i];
    pa:=ListBoxSmlSelObjectParamList.Items.Values[pn];
    pt:=ExtractWord(1,pa,' '+vbTab);
    pv:=SkipWords(1,pa,' '+vbTab);
    pn:=Trim(pn);
    obj:=Copy(pn,1,Pos('#',pn)-1);
    if (obj='') or (pt='') then continue;
    if (pnum=0) then begin
     crc.AddSensor(pre+'label#NAME');
     crc.AddPos(parx+MX(1,0,0,0,0,0), pary);
     crc.AddLed(0, 0, 0, '*', SmlDaqGuiTitleFont);
     crc.AddTag(1, 0, crc.StdBarBmp(MX(0,0,0,1,0,0),MY(0,0,0,1,0,0),24,'Silver'), 'Параметр');
     crc.AddHint('Колонка - Имя Параметра Объекта Управления.');
     crc.Add('[]');
     crc.Add('');
     crc.AddSensor(pre+'label#VALUE');
     crc.AddPos(parx+MX(1,0,0,1,1,0), pary);
     crc.AddLed(0, 0, 0, '*', SmlDaqGuiTitleFont);
     crc.AddTag(1, 0, crc.StdBarBmp(MX(0,0,0,1,0,0),MY(0,0,0,1,0,0),24,'Silver'), 'Значение');
     crc.AddHint('Колонка - Значение Параметра Объекта Управления.');
     crc.Add('[]');
     crc.Add('');
     inc(pary,MY(0,0,0,1,1,0));
    end;
    inc(pnum);
    crc.AddSensor(pre+dom+'::'+pn+'.NAME');
    crc.AddPos(parx+MX(1,0,0,0,0,0), pary);
    crc.AddLed(0, 0, 0, '*', SmlDaqGuiLabelFont);
    crc.AddTag(1, 0, crc.StdBarBmp(MX(0,0,0,1,0,0),MY(0,0,0,1,0,0),24,'Silver'), pn);
    crc.AddHint(crc.SensorName+' - Имя Параметра Объекта Управления.');
    crc.Add('[]');
    crc.Add('');
    fmt:='*';
    if SameText(pt,'real') then fmt:='%g';
    if SameText(pt,'string') then fmt:='%s';
    if SameText(pt,'integer') then fmt:='%d';
    crc.AddSensor(pre+dom+'::'+pn);
    crc.AddPos(parx+MX(1,0,0,1,1,0), pary);
    crc.AddLed(1, 0, 0, fmt, SmlDaqGuiParamFont);
    crc.AddPainter('(_cl_=linkedtagcolor())+(_cl_=_cl_+clSilver*eq(_cl_,0))+(glBarColor=_cl_)');
    crc.AddPainter('[Painter(v).GuiLib.SimpleBar]');
    crc.AddPainter('(glBorderBevel='+IntToStr(SmlDaqGuiParBorder)+')+(glBorderColor=clGray)');
    crc.AddPainter('[Painter(v).GuiLib.SimpleBorder]');
    crc.AddTag(1, 0, crc.StdBarBmp(MX(0,0,0,1,0,0),MY(0,0,0,1,0,0),24,'Silver'), '');
    crc.AddHint(crc.SensorName+' - Значение Параметра Объекта Управления.');
    crc.Add('[]');
    crc.Add('');
    inc(pary,MY(0,0,0,1,1,0));
   end;
   // Horizontal separator 1.
   crc.AddSensor(pre+'line.HorSeparator1');
   crc.AddPos(MX(1,0,0,0,0,0), MY(1,1,1,0,1,1));
   crc.AddTag(1, 0, crc.StdBarBmp(SmlDaqGuiWidth-MX(2,0,0,0,0,0),SmlDaqGuiBtnBorder,4,'Gray'), '');
   crc.AddHint(crc.SensorName+' - Горизонтальный разделитель 1.');
   crc.Add('[]');
   crc.Add('');
   // Done.
   MemoDaqCrc.Lines.Text:=crc.Lines.Text;
  finally
   crc.Free;
  end;
  PageControlDaq.ActivePage:=TabSheetDaqCrc;
 except
  on E:Exception do Self.BugReport(E,Self,'ActionSmlMakeDaqCrcExecute');
 end;
end;

procedure TMainForm.ActionSmlDaqFontDialogExecute(Sender: TObject);
var cb:TComboBox;
begin
 if (Sender=BitBtnSmlDaqGuiTitleFont) then Sender:=ComboBoxSmlDaqGuiTitleFont;
 if (Sender=BitBtnSmlDaqGuiStateFont) then Sender:=ComboBoxSmlDaqGuiStateFont;
 if (Sender=BitBtnSmlDaqGuiParamFont) then Sender:=ComboBoxSmlDaqGuiParamFont;
 if (Sender=BitBtnSmlDaqGuiLabelFont) then Sender:=ComboBoxSmlDaqGuiLabelFont;
 if (Sender=BitBtnSmlDaqGuiMenusFont) then Sender:=ComboBoxSmlDaqGuiMenusFont;
 if (Sender=BitBtnSmlDaqGuiDomainFont) then Sender:=ComboBoxSmlDaqGuiDomainFont;
 if (Sender is TComboBox) then
 try
  cb:=TComboBox(Sender);
  GetSetFontParams(FontDialogSmlDaqFont.Font,Trim(cb.Text));
  if not FontDialogSmlDaqFont.Execute then Exit;
  cb.Text:=GetSetFontParams(FontDialogSmlDaqFont.Font,'');
 except
  on E:Exception do Self.BugReport(E,Self,'ActionSmlDaqFontDialogExecute');
 end;
end;

procedure TMainForm.FormResize(Sender: TObject);
begin
 UpdateSmlSelectorSize;
end;

procedure TMainForm.ActionSmlObjectParamSelectExecute(Sender: TObject);
var i:Integer; item:String;
begin
 try
  for i:=0 to ListBoxSmlAllObjectParamList.Count-1 do begin
   if ListBoxSmlAllObjectParamList.Selected[i] then begin
    item:=ListBoxSmlAllObjectParamList.Items.Strings[i];
    if (item&lt;&gt;'') then
    if (ListBoxSmlSelObjectParamList.Items.IndexOf(item)&lt;0)
    then ListBoxSmlSelObjectParamList.Items.Add(item);
   end;
  end;
 except
  on E:Exception do Self.BugReport(E,Self,'ActionSmlObjectParamSelectExecute');
 end;
end;

procedure TMainForm.PageControlSmlSelectorChange(Sender: TObject);
begin
 UpdateSmlSelectorSize;
end;

procedure TMainForm.BitBtnSmiRunDimTreeClick(Sender: TObject);
begin
 SmiGenGui.RunDimTree;
end;

procedure TMainForm.TabSheetSmiRunEnter(Sender: TObject);
begin
 if (ComboBoxSmiRunDns.Items.Count=0)
 then ComboBoxSmiRunDns.Items.Text:=ComboBoxSmiDimDnsNode.Items.Text;
 if (ComboBoxSmiRunDns.Text='')
 then ComboBoxSmiRunDns.Text:=Trim(SmiGenGui.DIM_DNS_NODE);
 if (ComboBoxSmiRunDns.Text='')
 then ComboBoxSmiRunDns.Text:='localhost';
end;

procedure TMainForm.SmiRunLog(When:Double; What:String);
var n:Integer;
begin
 if (What&lt;&gt;'') then
 try
  n:=0;
  MemoSmiRunLog.Lines.BeginUpdate;
  try
   n:=AddTextAsEventLog(MemoSmiRunLog.Lines,When,What);
  finally
   MemoSmiRunLog.Lines.EndUpdate;
  end;
  if (n&gt;0) then MemoSmiRunLog.SelStart:=MaxInt;
 except
  on E:Exception do Self.BugReport(E,Self,'SmiRunLog');
 end;
end;

procedure TMainForm.SmiRunCmd(timeout:Integer);
var dns,cmd,exe,arg,ans,term:String;
begin
 try
  dns:=GetEnv('DIM_DNS_NODE');
  SetEnv('DIM_DNS_NODE',Trim(ComboBoxSmiRunDns.Text));
  try
   cmd:=ExtractWord(1,ComboBoxSmiRunCmd.Text,' ');
   arg:=Trim(SkipWords(1,ComboBoxSmiRunCmd.Text,' '));
   exe:=FileSearch(cmd,GetEnv('PATH'),false);
   if (exe='') and IsWindows
   then exe:=FileSearch(cmd+'.exe',GetEnv('PATH'),false);
   if (timeout&gt;=0) then term:='' else term:=Trim(ComboBoxSmiStartTerm.Text);
   if FileExists(exe) then begin
    if SameText(ExtractFileExt(exe),'.desktop') then begin
     arg:=Trim('-e '+exe+' '+arg);
     exe:='fly-open';
    end;
    if (term&lt;&gt;'') then begin
     if IsWindows then exe:=SmiGenGui.QuotedIfNeeded(exe);
     arg:=Trim(SkipWords(1,term,' ')+' '+exe+' '+arg);
     exe:=ExtractWord(1,term,' ');
    end;
    ans:=SmiGenGui.Exec(exe,arg,timeout);
    SmiRunLog(Now,Trim(exe+' '+arg)+EOL+ans);
   end else SmiRunLog(Now,'Could not find '+cmd)
  finally
   SetEnv('DIM_DNS_NODE',dns);
  end;
 except
  on E:Exception do Self.BugReport(E,Self,'SmiRunCmd');
 end;
end;

procedure TMainForm.ActionSmiRunCmdExecute(Sender: TObject);
begin
 SmiRunCmd(SmiRunTimeout);
end;

procedure TMainForm.ActionSmiStartCmdExecute(Sender: TObject);
begin
 SmiRunCmd(-1);
end;

procedure TMainForm.ApplyHistoryLimit(Memo:TMemo);
var History,GrowLim:Integer;
begin
 History:=StrToIntDef(Trim(ComboBoxSmiRunLogHistory.Text),0);
 GrowLim:=History+(History div 4); // History grow limit
 if (History&lt;=0) or (Memo=nil) then Exit;
 if (Memo.Lines.Count&lt;GrowLim) then Exit;
 Memo.Lines.BeginUpdate;
 try
  while (Memo.Lines.Count&gt;History) do Memo.Lines.Delete(0);
 finally
  Memo.Lines.EndUpdate;
 end;
end;

procedure TMainForm.TimerPollTasksTimer(Sender: TObject);
begin
 try
  SmiGenGui.PollTasks;
  ApplyHistoryLimit(MemoSmlResult);
  ApplyHistoryLimit(MemoSmiRunLog);
  ApplyHistoryLimit(MemoLogEvents);
 except
  on E:Exception do Self.BugReport(E,Self,'TimerPollTasksTimer');
 end;
end;

procedure TMainForm.ActionSmiRunLogSelAllExecute(Sender: TObject);
begin
 MemoSmiRunLog.SetFocus;
 MemoSmiRunLog.SelectAll;
end;

procedure TMainForm.ActionSmiRunLogSelNonExecute(Sender: TObject);
begin
 MemoSmiRunLog.SetFocus;
 MemoSmiRunLog.SelLength:=0;
end;

procedure TMainForm.ActionSmiRunLogClearExecute(Sender: TObject);
begin
 if (MemoSmiRunLog.SelLength&gt;0)
 then MemoSmiRunLog.ClearSelection
 else MemoSmiRunLog.Clear;
end;

procedure TMainForm.ActionSmiRunLogCopyExecute(Sender: TObject);
begin
 if (MemoSmiRunLog.SelLength&gt;0)
 then Clipboard.AsText:=MemoSmiRunLog.SelText
 else Clipboard.AsText:=MemoSmiRunLog.Lines.Text;
end;

procedure TMainForm.ActionSmiSmKillAllExecute(Sender: TObject);
var cmd,exe,arg,ans:String;
begin
 if IsUnix then begin
  exe:='pkill';
  arg:='-e smiSM';
  cmd:=SmiGenGui.ComposeCmd(exe,arg);
  ans:=SmiGenGui.Exec(exe,arg);
  LogSml(Now,Trim(cmd+EOL+ans));
  LogEvents(Now,Trim(cmd+EOL+ans));
 end;
 if IsWindows then begin
  exe:='taskkill';
  arg:='/im smiSM.exe';
  cmd:=SmiGenGui.ComposeCmd(exe,arg);
  ans:=SmiGenGui.Exec(exe,arg,0,0,'',WinApi.GetOEMCP);
  LogSml(Now,Trim(cmd+EOL+ans));
  LogEvents(Now,Trim(cmd+EOL+ans));
  arg:='/f /im smiSM.exe';
  cmd:=SmiGenGui.ComposeCmd(exe,arg);
  ans:=SmiGenGui.Exec(exe,arg,0,0,'',WinApi.GetOEMCP);
  LogSml(Now,Trim(cmd+EOL+ans));
  LogEvents(Now,Trim(cmd+EOL+ans));
 end;
 ActionSmiSmList.Execute;
end;

end.
</Code>
        </Main>
      </Child>
    </SmiGenGui>
  </Metadata>
</CrossEngineApp>
