Apophysis-AV/Forms/FlameComment.pas

77 lines
1.9 KiB
ObjectPascal
Raw Normal View History

{ Apophysis AV "Phoenix Edition" Copyright (C) 2021-2022 Alice V. Koryagina }
unit FlameComment;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs,
Vcl.StdCtrls, Vcl.Buttons, Translation;
type
TCommentForm = class(TForm)
memComment: TMemo;
btnOK: TButton;
btnCancel: TButton;
btnCopy: TSpeedButton;
btnPaste: TSpeedButton;
btnCut: TSpeedButton;
btnUndo: TSpeedButton;
procedure FormCreate(Sender: TObject);
procedure memCommentKeyPress(Sender: TObject; var Key: Char);
procedure btnUndoClick(Sender: TObject);
procedure btnCopyClick(Sender: TObject);
procedure btnPasteClick(Sender: TObject);
procedure btnCutClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
CommentForm: TCommentForm;
implementation
{$R *.dfm}
procedure TCommentForm.btnCopyClick(Sender: TObject);
begin
memComment.CopyToClipboard;
end;
procedure TCommentForm.btnCutClick(Sender: TObject);
begin
memComment.CutToClipboard;
end;
procedure TCommentForm.btnPasteClick(Sender: TObject);
begin
memComment.PasteFromClipboard;
end;
procedure TCommentForm.btnUndoClick(Sender: TObject);
begin
if memComment.CanUndo then memComment.Undo;
end;
procedure TCommentForm.FormCreate(Sender: TObject);
begin
btnOK.Caption := TextByKey('common-ok');
btnCancel.Caption := TextByKey('common-cancel');
self.Caption := TextByKey('editor-common-editcomment');
btnCopy.Hint := TextByKey('common-copy');
btnPaste.Hint := TextByKey('common-paste');
btnUndo.Hint := TextByKey('common-undo');
btnCut.Hint := TextByKey('common-cut');
end;
procedure TCommentForm.memCommentKeyPress(Sender: TObject; var Key: Char);
begin
if (Key = '<') or (Key = '>') then Key := #0; // prevent XML-scanner errors
end;
end.