summaryrefslogtreecommitdiff
path: root/plugins/Watrack/stat/stat_opt.inc
blob: 8d8bed6bb5d41c478c524c944cb3b00767681d99 (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
58
59
60
61
62
{statistic load/save options}
const
  opt_ModStatus :PAnsiChar = 'module/statistic';

  opt_StatName  :PAnsiChar = 'report/statname';
  opt_RepName   :PAnsiChar = 'report/repname';
  opt_TmplName  :PAnsiChar = 'report/tmplname';
  opt_SortMode  :PAnsiChar = 'report/sortmode';
  opt_ReportMask:PAnsiChar = 'report/reportmask';
  opt_ReportItem:PAnsiChar = 'report/reportitems';
  opt_Direction :PAnsiChar = 'report/direction';
  opt_RunReport :PAnsiChar = 'report/runreport';
  opt_AddExt    :PAnsiChar = 'report/addext';
  opt_AutoSort  :PAnsiChar = 'report/autosort';
  opt_LastSort  :PAnsiChar = 'report/lastsort';

function GetModStatus:integer;
begin
  result:=DBReadByte(0,PluginShort,opt_ModStatus,1);
end;

procedure SetModStatus(stat:integer);
begin
  DBWriteByte(0,PluginShort,opt_ModStatus,stat);
end;

procedure loadstat;
begin
  ReportName :=DBReadString(0,PluginShort,opt_RepName ,nil);
  StatName   :=DBReadString(0,PluginShort,opt_StatName,nil);
  TmplName   :=DBReadString(0,PluginShort,opt_TmplName,nil);
  DoAddExt   :=DBReadByte  (0,PluginShort,opt_AddExt    ,BST_CHECKED);
  RunReport  :=DBReadByte  (0,PluginShort,opt_RunReport ,BST_UNCHECKED);
  Direction  :=DBReadByte  (0,PluginShort,opt_Direction ,smDirect);
  SortMode   :=DBReadByte  (0,PluginShort,opt_SortMode  ,stArtist);
  ReportItems:=DBReadWord  (0,PluginShort,opt_ReportItem,10);
  ReportMask :=DBReadWord  (0,PluginShort,opt_ReportMask,$FFFF);
  AutoSort   :=DBReadByte  (0,PluginShort,opt_AutoSort  ,1);
  LastSort   :=DBReadDWord (0,PluginShort,opt_LastSort  ,0);
end;

procedure savestat;
begin
  DBWriteString(0,PluginShort,opt_RepName ,ReportName);
  DBWriteString(0,PluginShort,opt_StatName,StatName);
  DBWriteString(0,PluginShort,opt_TmplName,TmplName);
  DBWriteByte  (0,PluginShort,opt_AddExt     ,DoAddExt);
  DBWriteByte  (0,PluginShort,opt_RunReport  ,RunReport);
  DBWriteByte  (0,PluginShort,opt_Direction  ,Direction);
  DBWriteByte  (0,PluginShort,opt_SortMode   ,SortMode);
  DBWriteWord  (0,PluginShort,opt_ReportItem ,ReportItems);
  DBWriteWord  (0,PluginShort,opt_ReportMask ,ReportMask);
  DBWriteByte  (0,PluginShort,opt_AutoSort   ,AutoSort);
//  DBWriteDWord (0,PluginShort,opt_LastSort   ,LastSort);
end;

procedure FreeStat;
begin
  mFreeMem(ReportName);
  mFreeMem(StatName);
  mFreeMem(TmplName);
end;