Unit repair;

{$mode objfpc}{$H+}

Interface

Uses
  Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
  CheckLst, StdCtrls, Buttons, ComCtrls, CADEngine;

Type

  { TRepairForm }

  TRepairForm = Class(TForm)
    CancelBitBtn: TBitBtn;
    CurrentItemLabel: TLabel;
    ProceedBitBtn: TBitBtn;
    NoCalloutConnectionsCheckBox: TCheckBox;
    ProgressBar: TProgressBar;
    Procedure CancelBitBtnClick(Sender: TObject);
    Procedure ProceedBitBtnClick(Sender: TObject);
  Private
    { private declarations }
  Public
    { public declarations }
  End;

Var
  RepairForm: TRepairForm;

Implementation
Uses Unit1;
{ TRepairForm }

Procedure TRepairForm.ProceedBitBtnClick(Sender: TObject);
Var I:Longint;
    Obj:TVObject;
    Callout:TVCallout;
    Connection:TVConnection;
Begin
  If NoCalloutConnectionsCheckBox.Checked Then Begin
    For I:=0 To Scene.VCalloutList.Count-1 Do Begin
      ProgressBar.Position:=Round(I/Scene.VCalloutList.Count*1000);
      Callout:=Scene.VCalloutList.Objects[I] As TVCallout;
      If Scene.View.IndexOf('DrawCallout '+Callout.Name)<0 Then
         Scene.View.Add('DrawCallout '+Callout.Name);
      CurrentItemLabel.Caption:='Now checking:'+Callout.Name;
    End;
    For I:=0 To Scene.VConnectionList.Count-1 Do Begin
      ProgressBar.Position:=Round(I/Scene.VConnectionList.Count*1000);
      Connection:=Scene.VConnectionList.Objects[I] As TVConnection;
      If Scene.View.IndexOf('DrawConnection '+Connection.Name)<0 Then
         Scene.View.Add('DrawConnection '+Connection.Name);
      CurrentItemLabel.Caption:='Now checking:'+Connection.Name;
    End;

  End;
end;

Procedure TRepairForm.CancelBitBtnClick(Sender: TObject);
Begin
  RepairForm.Close;
end;

Initialization
  {$I repair.lrs}

End.

