summaryrefslogtreecommitdiff
path: root/plugins/Watrack/popup/pop_opt.inc
blob: 591063923e8993fa1901a4161bd478ef2a9970fe (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
{Popup options saving-loading}

const
  defPopupTitle    = 'Now listening to';
  defPopupText     = '%artist% - %title%';
  defAltPopupTitle = 'Now ?ifgreater(%width%,0,watching,listening to)';
  defAltPopupText  = '%artist% - %title%'#13#10'?iflonger(%album%,0, (from "%album%"),)';
const
  opt_ModStatus  :PAnsiChar = 'module/popups';

  opt_PopUpFile   :PAnsiChar = 'popup/file';
  opt_PopUpAction :PAnsiChar = 'popup/action';
  opt_PopUpFore   :PAnsiChar = 'popup/fore';
  opt_PopUpBack   :PAnsiChar = 'popup/back';
  opt_PopUpPause  :PAnsiChar = 'popup/time';
  opt_PopUpDelay  :PAnsiChar = 'popup/delay';
  opt_PopUpColor  :PAnsiChar = 'popup/color';
  opt_ByRequest   :PAnsiChar = 'popup/byrequest';
  opt_PopTitle    :PAnsiChar = 'popup/poptitle';
  opt_PopText     :PAnsiChar = 'popup/poptext';
  opt_PopUpButtons:PAnsiChar = 'popup/usebuttons';

  spref = 'strings/';

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 loadpopup;
var
  def1,def2:pWideChar;
begin
  PopUpButtons:=DBReadByte (0,PluginShort,opt_PopUpButtons,BST_CHECKED);
  PopUpFile   :=DBReadByte (0,PluginShort,opt_PopUpFile   ,BST_CHECKED);
  PopUpPause  :=DBReadByte (0,PluginShort,opt_PopUpPause  ,0);
  PopUpDelay  :=DBReadByte (0,PluginShort,opt_PopUpDelay  ,0);
  PopUpAction :=DBReadWord (0,PluginShort,opt_PopUpAction ,0);
  PopUpColor  :=DBReadByte (0,PluginShort,opt_PopUpColor  ,0);
  PopUpFore   :=DBReadDWord(0,PluginShort,opt_PopUpFore   ,GetSysColor(COLOR_BTNTEXT));
  PopUpBack   :=DBReadDWord(0,PluginShort,opt_PopUpBack   ,GetSysColor(COLOR_BTNFACE));
  PopRequest  :=DBReadByte (0,PluginShort,opt_ByRequest   ,BST_UNCHECKED);
  if isVarsInstalled then
  begin
    def1:=defAltPopupTitle;
    def2:=defAltPopupText;
  end
  else
  begin
    def1:=defPopupTitle;
    def2:=defPopupText;
  end;
  PopTitle:=DBReadUnicode(0,PluginShort,opt_PopTitle,def1);
  PopText :=DBReadUnicode(0,PluginShort,opt_PopText ,def2);
end;

procedure savepopup;
begin
  DBWriteByte   (0,PluginShort,opt_PopUpButtons,PopUpButtons);
  DBWriteByte   (0,PluginShort,opt_PopUpFile   ,PopUpFile);
  DBWriteByte   (0,PluginShort,opt_PopUpPause  ,PopUpPause);
  DBWriteByte   (0,PluginShort,opt_PopUpDelay  ,PopUpDelay);
  DBWriteWord   (0,PluginShort,opt_PopUpAction ,PopUpAction);
  DBWriteByte   (0,PluginShort,opt_PopUpColor  ,PopUpColor);
  DBWriteDWord  (0,PluginShort,opt_PopUpFore   ,PopUpFore);
  DBWriteDWord  (0,PluginShort,opt_PopUpBack   ,PopUpBack);
  DBWriteByte   (0,PluginShort,opt_ByRequest   ,PopRequest);
  DBWriteUnicode(0,PluginShort,opt_PopTitle,PopTitle);
  DBWriteUnicode(0,PluginShort,opt_PopText ,PopText);
end;

procedure freepopup;
begin
  mFreeMem(PopTitle);
  mFreeMem(PopText);
end;