unit Unit7;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
  StdCtrls, Buttons, ExtCtrls, CADEngine;

type

  { TRenameForm }

  TRenameForm = class(TForm)
    Bevel1: TBevel;
    CancelBitBtn: TBitBtn;
    DiagLabel: TLabel;
    OkBitBtn: TBitBtn;
    NewNameEdit: TEdit;
    procedure NewNameEditChange(Sender: TObject);
  private
    { private declarations }
  public
    { public declarations }
    Scene:TVScene;
  end;

var
  RenameForm: TRenameForm;

implementation

{ TRenameForm }


procedure TRenameForm.NewNameEditChange(Sender: TObject);
Var I:Longint;
    ItemType:String;
Begin
  ItemType:='';
  If Scene.VCurlList.IndexOf(NewNameEdit.Text)>=0 Then ItemType:='curl';
  If Scene.VObjectList.IndexOf(NewNameEdit.Text)>=0 Then ItemType:='object';
  If Scene.VConnectionList.IndexOf(NewNameEdit.Text)>=0 Then ItemType:='connection';
  If Scene.VCalloutList.IndexOf(NewNameEdit.Text)>=0 Then ItemType:='callout';
  If Scene.VTemplateList.IndexOf(NewNameEdit.Text)>=0 Then ItemType:='template';
  If Scene.VGroupList.IndexOf(NewNameEdit.Text)>=0 Then ItemType:='group';
  If ItemType='' Then Begin
    OkBitBtn.Enabled:=True;
    DiagLabel.Caption:='This name is free';
    DiagLabel.Font.Color:=clGreen;
  end Else Begin
    OkBitBtn.Enabled:=False;
    DiagLabel.Caption:='This name belongs to '+ItemType;
    DiagLabel.Font.Color:=clRed;
  end;
end;

initialization
  {$I unit7.lrs}

end.

