unit ObjectMetadataForm;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, TextEditor, Vcl.StdCtrls, Vcl.ExtCtrls;

type
  TObjectMetadataFrm = class(TForm)
    Shape1: TShape;
    Label1: TLabel;
    Shape2: TShape;
    Label2: TLabel;
    Label3: TLabel;
    btnOk: TButton;
    btnCancel: TButton;
    teTitle: TTextEditor;
    teDescr: TTextEditor;
  private
    { Private declarations }
  public
    { Public declarations }
  end;

function SetMetadata(AOwnerDialog: TCustomForm; ADrawable: TObject): Boolean;

implementation

uses
  VisCtl;

{$R *.dfm}

function SetMetadata(AOwnerDialog: TCustomForm; ADrawable: TObject): Boolean;
begin
  var frm := TObjectMetadataFrm.Create(AOwnerDialog);
  try
    var LDrawable := ADrawable as TVisObj;
    frm.teTitle.PlainText := LDrawable.Title;
    frm.teDescr.PlainText := LDrawable.Description;
    Result := frm.ShowModal = mrOk;
    if Result then
    begin
      LDrawable.Title := frm.teTitle.PlainText;
      LDrawable.Description := frm.teDescr.PlainText;
      if Assigned(VisObjListChanged) then
        VisObjListChanged(frm);
    end;
  finally
    frm.Free;
  end;
end;

end.
