unit ChildForm;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ecSyntMemo, ecPopupCtrl, Menus;

type
  TEditorForm = class(TForm)
    Editor: TSyntaxMemo;
    TemplatePopup1: TTemplatePopup;
    PopupMenu1: TPopupMenu;
    Copy2: TMenuItem;
    Cut2: TMenuItem;
    Paste2: TMenuItem;
    Delete2: TMenuItem;
    N7: TMenuItem;
    ogglebookmarks1: TMenuItem;
    Bookmark01: TMenuItem;
    Bookmark11: TMenuItem;
    Bookmark21: TMenuItem;
    Bookmark31: TMenuItem;
    Bookmark41: TMenuItem;
    Bookmark51: TMenuItem;
    Bookmark61: TMenuItem;
    Bookmark71: TMenuItem;
    Bookmark81: TMenuItem;
    Bookmark91: TMenuItem;
    Gotobookmarks1: TMenuItem;
    Bookmark02: TMenuItem;
    Bookmark12: TMenuItem;
    Bookmark22: TMenuItem;
    Bookmark32: TMenuItem;
    Bookmark42: TMenuItem;
    Bookmark52: TMenuItem;
    Bookmark62: TMenuItem;
    Bookmark72: TMenuItem;
    Bookmark82: TMenuItem;
    Bookmark92: TMenuItem;
    N6: TMenuItem;
    SyntaxHighlignting1: TMenuItem;
    EditorProperties2: TMenuItem;
    procedure EditorSetBookmark(Snder: TObject; Bookmark: TBookmark;
      var Accept: Boolean);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure FormActivate(Sender: TObject);
    procedure Bookmark91Click(Sender: TObject);
    procedure Bookmark92Click(Sender: TObject);
    procedure PopupMenu1Popup(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  EditorForm: TEditorForm;

implementation

uses MDIForm;

{$R *.dfm}

procedure TEditorForm.EditorSetBookmark(Snder: TObject;
  Bookmark: TBookmark; var Accept: Boolean);
begin
  with Bookmark do
   if (BmIndex >= 0) and (BmIndex < 10) then
    begin
     ImageIndex := 13 + BmIndex;
     Hint := 'Bookmark ' + IntToStr(BmIndex);
    end;
end;

procedure TEditorForm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  Action := caFree;
end;

procedure TEditorForm.FormActivate(Sender: TObject);
begin
  MDIMain.ChildChanged;
end;

procedure TEditorForm.Bookmark91Click(Sender: TObject);
begin
  Editor.ToggleBookmark((Sender as TComponent).Tag);
end;

procedure TEditorForm.Bookmark92Click(Sender: TObject);
begin
  Editor.GotoBookmark((Sender as TComponent).Tag);
end;

procedure TEditorForm.PopupMenu1Popup(Sender: TObject);
var i, j: integer;
begin
  for i := 0 to 9 do
   for j := 1 to 2 do
    (FindComponent('Bookmark'+IntToStr(i)+IntToStr(j)) as TMenuItem).Checked :=
      Editor.Bookmarks[i] <> -1;
end;

end.
