summaryrefslogtreecommitdiff
path: root/plugins/Watrack/status/i_opt_12.inc
blob: 7414ecf9d7ada75ebbbbe3fc8879a46709b5986d (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
{Templates}

procedure SetScreenLite(Dialog:HWnd);
var
  p:pWideChar;
begin
  Changed:=Changed or DLGED_INIT;

  p:=GetTemplateStr(tmpl_pm    ,0,0);
  SetDlgItemTextW(Dialog,IDC_EDIT_MSG     ,p);
  p:=GetTemplateStr(tmpl_xtitle,0,0);
  SetDlgItemTextW(Dialog,IDC_XSTATUS_TITLE,p);
  p:=GetTemplateStr(tmpl_stext ,0,0);
  SetDlgItemTextW(Dialog,IDC_STATUS_TEXT  ,p);
  p:=GetTemplateStr(tmpl_chat  ,0,0);
  SetDlgItemTextW(Dialog,IDC_EDIT_CHANNEL ,p);

  Changed:=Changed and not DLGED_INIT;
end;

procedure SetTemplateLite(Dialog:HWnd;idc:integer;Tmpl:tTemplateType);
begin
  SetTemplateStr(GetDlgText(Dialog,idc),Tmpl,0,0);
end;

procedure SaveChangesLite(Dialog:HWnd);
begin
  if (Changed and DLGED_BASE)<>0 then
  begin
    if (Changed and DLGED_MSG )<>0 then SetTemplateLite(Dialog,IDC_EDIT_MSG    ,tmpl_pm);
    if (Changed and DLGED_CHNL)<>0 then SetTemplateLite(Dialog,IDC_EDIT_CHANNEL,tmpl_chat);
    if (Changed and DLGED_XTTL)<>0 then
    begin
      SetTemplateLite(Dialog,IDC_XSTATUS_TITLE,tmpl_xtitle);
    end;
    if (Changed and DLGED_STTT)<>0 then
    begin
      SetTemplateLite(Dialog,IDC_STATUS_TEXT,tmpl_stext);
      SetTemplateLite(Dialog,IDC_STATUS_TEXT,tmpl_xtext);
      SetTemplateLite(Dialog,IDC_STATUS_TEXT,tmpl_tunes);
    end;

    Changed:=Changed and (not DLGED_BASE);
    SaveTemplates;
  end;
end;

function DlgProcOptions12(Dialog:HWnd;hMessage:UINT;wParam:WPARAM;lParam:LPARAM):lparam; stdcall;
begin
  result:=0;
  case hMessage of
    WM_INITDIALOG: begin
      TranslateDialogDefault(Dialog);
      SetScreenLite(Dialog);
      result:=0;
      Changed:=0;
    end;

    WM_COMMAND: begin
      if (Changed and DLGED_INIT)=0 then
      begin
        case wParam shr 16 of
          EN_CHANGE: begin
            Changed:=Changed or DLGED_CHGD or DLGED_PACK;
            case loword(wParam) of
              IDC_EDIT_MSG      : Changed:=Changed or DLGED_MSG;
              IDC_XSTATUS_TITLE : Changed:=Changed or DLGED_XTTL;
              IDC_STATUS_TEXT   : Changed:=Changed or DLGED_STTT;
              IDC_EDIT_CHANNEL  : Changed:=Changed or DLGED_CHNL;
            end;
          end;
          BN_CLICKED: begin
            case LoWord(wParam) of
              IDC_CMD_RESET: begin
                SetScreenLite(Dialog);
              end;
              IDC_HELP_COLOR: begin
                ShowColorHelpDlg(Dialog);
                exit;
              end;
              IDC_HELP_FORMAT: begin
                MessageBoxW(0,TranslateW(sFormatHelp),TranslateW('Format text Info'),0);
                exit;
              end;
              IDC_HELP_VARIABLES: begin
                CallService(MS_WAT_MACROHELP,Dialog,0);
                exit;
              end;
            end;
          end;
        else
          exit;
        end;
        SendMessage(GetParent(Dialog),PSM_CHANGED,0,0);
      end;
    end;

    WM_HELP: CallService(MS_WAT_MACROHELP,Dialog,0);

    WM_NOTIFY: begin
      if integer(PNMHdr(lParam)^.code)=PSN_APPLY then
        SaveChangesLite(Dialog);
    end;

  else
    {result:=}DefWindowProc(Dialog,hMessage,wParam,lParam);
  end;
end;