summaryrefslogtreecommitdiff
path: root/docview/src/HelpBookmark.pas
blob: 8420322fef45e92af978c0115d8910331a509280 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
unit HelpBookmark;

{$mode objfpc}{$H+}

interface

uses
  Classes,
  SysUtils,
  HelpFile,
  HelpTopic;

type
  TBookmark = class(TObject)
  private
    FContentsTopic: TTopic;
    FName: string;
  public
    constructor Create;
    constructor Load(var F: TextFile; HelpFile: THelpFile);
    procedure   Save(var F: TextFile);
    property    Name: string read FName write FName;
    property    ContentsTopic: TTopic read FContentsTopic write FContentsTopic;
  end;


implementation

{ TBookmark }

constructor TBookmark.Create;
begin
  inherited Create;
  ContentsTopic:= nil;
end;

constructor TBookmark.Load(var F: TextFile; HelpFile: THelpFile);
var
  s: string;
  ContentsTopicIndex: integer;
begin
  inherited Create;
  ReadLn(F, FName);
  ReadLn(F, s);
  ContentsTopicIndex := StrToInt(s);
  ContentsTopic := HelpFile.Topics[ContentsTopicIndex];
end;

procedure TBookmark.Save(var F: TextFile);
begin
  writeLn( F, Name );
  writeLn( F, IntToStr( ContentsTopic.Index ) );
end;


end.