summaryrefslogtreecommitdiff
path: root/plugins/Watrack/i_options.inc
blob: 060751966cd1c54985fa7d319e92fd955681f7fd (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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
{Database options}
const
  DefaultXStatus = $080B; // TV + Music
const
  defhotkey    = (HOTKEYF_CONTROL+HOTKEYF_ALT  )*256+VK_F5;
  definshotkey = (HOTKEYF_CONTROL+HOTKEYF_SHIFT)*256+VK_F7;

const
  defcoverpaths = 'cover.jpg'#13#10'..\cover.jpg'#13#10'*.jpg'#13#10'..\*.jpg';

const
  WATFormats:PAnsiChar = 'formats/';
const
  WATPlayers   :PAnsiChar = 'players/';

const
  opt_disable  :PAnsiChar = 'disableplugin';

  opt_InsHotKey :PAnsiChar = 'inshotkey';
  opt_HotKey    :PAnsiChar = 'hotkey';
  opt_Timer     :PAnsiChar = 'timer';
  opt_UserCP    :PAnsiChar = 'usercp';
  opt_CheckTime :PAnsiChar = 'checktime';
  opt_coverpaths:PAnsiChar = 'coverpaths';
  opt_Implantant:PAnsiChar = 'useimplantant';
  opt_MTHCheck  :PAnsiChar = 'mthcheck';
  opt_KeepOld   :PAnsiChar = 'keepold';
  opt_mmkeyemu  :PAnsiChar = 'mmkeyemu';
  opt_CheckAll  :PAnsiChar = 'checkall';

  opt_ThTimeout :PAnsiChar = 'thtimeout';

procedure _loadopt;
begin
  DisablePlugin:=DBReadByte(0,PluginShort,opt_disable,0);
  if DisablePlugin<>dsPermanent then
    DisablePlugin:=dsEnabled;

  inshotkey    :=DBReadWord(0,PluginShort,opt_InsHotKey ,definshotkey);
  globhotkey   :=DBReadWord(0,PluginShort,opt_HotKey    ,defhotkey);
  CheckTime    :=DBReadByte(0,PluginShort,opt_CheckTime ,BST_CHECKED);
  UseImplant   :=DBReadByte(0,PluginShort,opt_Implantant,BST_UNCHECKED);
  MTHCheck     :=DBReadByte(0,PluginShort,opt_MTHCheck  ,BST_CHECKED);
  KeepOld      :=DBReadByte(0,PluginShort,opt_KeepOld   ,BST_UNCHECKED);
  CheckAll     :=DBReadByte(0,PluginShort,opt_CheckAll  ,BST_UNCHECKED);
  mTimer       :=DBReadWord(0,PluginShort,opt_Timer     ,3000);
  if mTimer<500 then
    mTimer:=mTimer*1000;
  UserCP       :=DBReadWord(0,PluginShort,opt_UserCP    ,CP_ACP);
  CoverPaths   :=DBReadUnicode(0,PluginShort,opt_coverpaths,defcoverpaths);

  mmkeyemu     :=DBReadByte (0,PluginShort,opt_mmkeyemu  ,BST_UNCHECKED);

  TimeoutForThread:=DBReadByte(0,PluginShort,opt_ThTimeout,SysWin.ThreadTimeout);
end;

procedure _saveopt;
begin
  DBWriteWord(0,PluginShort,opt_InsHotKey ,inshotkey);
  DBWriteWord(0,PluginShort,opt_HotKey    ,globhotkey);
  DBWriteByte(0,PluginShort,opt_ThTimeout ,TimeoutForThread);
  DBWriteByte(0,PluginShort,opt_CheckTime ,CheckTime);
  DBWriteByte(0,PluginShort,opt_Implantant,UseImplant);
  DBWriteByte(0,PluginShort,opt_MTHCheck  ,MTHCheck);
  DBWriteByte(0,PluginShort,opt_KeepOld   ,KeepOld);
  DBWriteByte(0,PluginShort,opt_CheckAll  ,CheckAll);
  DBWriteWord(0,PluginShort,opt_Timer     ,mTimer);
  DBWriteWord(0,PluginShort,opt_UserCP    ,UserCP);

  DBWriteUnicode(0,PluginShort,opt_coverpaths,CoverPaths);

  DBWriteByte (0,PluginShort,opt_mmkeyemu  ,mmkeyemu);
end;

function enumwp(desc:PAnsiChar;lParam:LPARAM):bool; stdcall;
var
  i:integer;
  buf:array [0..63] of AnsiChar;
begin
  i:=CallService(MS_WAT_PLAYER,WAT_ACT_GETSTATUS,tlparam(desc));
  if i=WAT_RES_ENABLED then
    i:=1
  else
    i:=0;
  StrCopy(StrCopyE(buf,WATPlayers),desc);
  DBWriteByte(0,PluginShort,buf,i);
  result:=true;
end;

procedure WritePlayers;
begin
  EnumPlayers(@enumwp,0);
end;

function enumrp(desc:PAnsiChar;lParam:LPARAM):bool; stdcall;
var
  i:integer;
  buf:array [0..63] of AnsiChar;
begin
  StrCopy(StrCopyE(buf,WATPlayers),desc);
  i:=DBReadByte(0,PluginShort,buf,1);
  if i=1 then
    i:=WAT_ACT_ENABLE
  else
    i:=WAT_ACT_DISABLE;
  CallService(MS_WAT_PLAYER,i,tlparam(desc));
  result:=true;
end;

procedure ReadPlayers;
begin
  EnumPlayers(@enumrp,0);
{!!  p:=DBReadString(0,PluginShort,opt_DefPlayer,nil);
  CallService(MS_WAT_PLAYER,WAT_ACT_SETACTIVE,dword(p));
  mFreeMem(p);
}
end;

function enumwf(ext:PAnsiChar;lParam:LPARAM):bool; stdcall;
var
  i:integer;
  buf:array [0..63] of AnsiChar;
begin
  i:=CallService(MS_WAT_FORMAT,WAT_ACT_GETSTATUS,tlparam(ext));
  if i=WAT_RES_ENABLED then
    i:=1
  else
    i:=0;
  StrCopy(StrCopyE(buf,WATFormats),ext);
  DBWriteByte(0,PluginShort,buf,i);
  result:=true;
end;

procedure WriteFormats;
begin
  EnumFormats(@enumwf,0);
end;

function enumrf(ext:PAnsiChar;lParam:LPARAM):bool; stdcall;
var
  i:integer;
  buf:array [0..63] of AnsiChar;
begin
  StrCopy(StrCopyE(buf,WATFormats),ext);
  i:=DBReadByte(0,PluginShort,buf,1);
  if i=1 then
    i:=WAT_ACT_ENABLE
  else
    i:=WAT_ACT_DISABLE;
  CallService(MS_WAT_FORMAT,i,tlparam(ext));
  result:=true;
end;

procedure ReadFormats;
begin
  EnumFormats(@enumrf,0);
end;

procedure saveopt;
begin
  _saveopt;
  WriteFormats;
  WritePlayers;
end;

procedure loadopt;
begin
  _loadopt;
  ReadPlayers;
  ReadFormats;
end;