summaryrefslogtreecommitdiff
path: root/plugins/Watrack/templates/i_tmpl_dlg.inc
blob: 185f91d608cacba30edf989d857c1a6d047ee0df (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
{}
function DlgProcOptions(Dialog:HWnd;hMessage:UINT;wParam:WPARAM;lParam:LPARAM):integer; stdcall;
begin
  result:=0;
  case hMessage of
    WM_INITDIALOG: begin
      TranslateDialogDefault(Dialog);

      if not isVarsInstalled then
        ShowWindow(GetDlgItem(Dialog,IDC_VAR_HELP),SW_HIDE)
      else
        SendDlgItemMessage(Dialog,IDC_VAR_HELP,BM_SETIMAGE,IMAGE_ICON,
          CallService(MS_VARS_GETSKINITEM,0,VSI_HELPICON));

      SendDlgItemMessage(Dialog,IDC_MACRO_HELP,BM_SETIMAGE,IMAGE_ICON,
          CallService(MS_SKIN_LOADICON,SKINICON_OTHER_HELP,0));

      MakeHint(Dialog,IDC_REPLACESPC,
        'Replaces "_" (underscores) globally in pasted os status text,'+
        ' sometimes may be useful');
      CheckDlgButton(Dialog,IDC_REPLACESPC,ReplaceSpc);

      CheckDlgButton(Dialog,IDC_LOCASE,LoCaseType);
      
      CheckDlgButton(Dialog,IDC_FSIZEBYTE,ord(FSizeMode=1));
      CheckDlgButton(Dialog,IDC_FSIZEKILO,ord(FSizeMode=1024));
      CheckDlgButton(Dialog,IDC_FSIZEMEGA,ord(FSizeMode=1024*1024));
      
      SetDlgItemInt (Dialog,IDC_PRECISION,FSPrecision,false);
      CheckDlgButton(Dialog,IDC_POSTNONE ,ord(FSizePost=0));
      CheckDlgButton(Dialog,IDC_POSTSMALL,ord(FSizePost=1));
      CheckDlgButton(Dialog,IDC_POSTMIX  ,ord(FSizePost=2));
      CheckDlgButton(Dialog,IDC_POSTLARGE,ord(FSizePost=3));

      CheckDlgButton(Dialog,IDC_ALLCAP  ,ord(PlayerCaps=2));
      CheckDlgButton(Dialog,IDC_SMALLCAP,ord(PlayerCaps=1));
      CheckDlgButton(Dialog,IDC_MIXCAP  ,ord(PlayerCaps=0));

      CheckDlgButton(Dialog,IDC_WRITECBR1,ord(WriteCBR=0));
      CheckDlgButton(Dialog,IDC_WRITECBR2,ord(WriteCBR<>0));

      SetDlgItemTextW(Dialog,IDC_EXPORT_TEXT,ExportText);
    end;

    WM_COMMAND: begin
      if (wParam shr 16)=BN_CLICKED then
      begin
        case loword(wParam) of
          IDC_VAR_HELP  : ShowVarHelp     (Dialog);
          IDC_MACRO_HELP: CallService(MS_WAT_MACROHELP,Dialog,0);
          IDC_ALLCAP: begin
            CheckDlgButton(Dialog,IDC_ALLCAP  ,BST_CHECKED);
            CheckDlgButton(Dialog,IDC_SMALLCAP,BST_UNCHECKED);
            CheckDlgButton(Dialog,IDC_MIXCAP  ,BST_UNCHECKED);
          end;
          IDC_SMALLCAP: begin
            CheckDlgButton(Dialog,IDC_ALLCAP  ,BST_UNCHECKED);
            CheckDlgButton(Dialog,IDC_SMALLCAP,BST_CHECKED);
            CheckDlgButton(Dialog,IDC_MIXCAP  ,BST_UNCHECKED);
          end;
          IDC_MIXCAP: begin
            CheckDlgButton(Dialog,IDC_ALLCAP  ,BST_UNCHECKED);
            CheckDlgButton(Dialog,IDC_SMALLCAP,BST_UNCHECKED);
            CheckDlgButton(Dialog,IDC_MIXCAP  ,BST_CHECKED);
          end;
        end;
      end;
      if ((wParam shr 16)=EN_CHANGE) or ((wParam shr 16)=BN_CLICKED) then
        SendMessage(GetParent(Dialog),PSM_CHANGED,0,0);
      result:=1;
    end;

    WM_NOTIFY: begin
      if integer(PNMHdr(lParam)^.code)=PSN_APPLY then
      begin
        ReplaceSpc:=IsDlgButtonChecked(Dialog,IDC_REPLACESPC);
        LoCaseType:=IsDlgButtonChecked(Dialog,IDC_LOCASE);
        if IsDlgButtonChecked(Dialog,IDC_WRITECBR1)=BST_CHECKED then
          WriteCBR:=0
        else //if IsDlgButtonChecked(Dialog,IDC_WRITECBR2)=BST_CHECKED then
          WriteCBR:=1;
        if IsDlgButtonChecked(Dialog,IDC_FSIZEBYTE)=BST_CHECKED then
          FSizeMode:=1
        else if IsDlgButtonChecked(Dialog,IDC_FSIZEKILO)=BST_CHECKED then
          FSizeMode:=1024
        else// if IsDlgButtonChecked(Dialog,IDC_FSIZEMEGA)=BST_CHECKED then
          FSizeMode:=1024*1024;

        if IsDlgButtonChecked(Dialog,IDC_MIXCAP)=BST_CHECKED then
          PlayerCaps:=0
        else if IsDlgButtonChecked(Dialog,IDC_SMALLCAP)=BST_CHECKED then
          PlayerCaps:=1
        else// if IsDlgButtonChecked(Dialog,IDC_ALLCAP)=BST_CHECKED then
          PlayerCaps:=2;

        if IsDlgButtonChecked(Dialog,IDC_POSTNONE)=BST_CHECKED then
          FSizePost:=0
        else if IsDlgButtonChecked(Dialog,IDC_POSTSMALL)=BST_CHECKED then
          FSizePost:=1
        else if IsDlgButtonChecked(Dialog,IDC_POSTMIX)=BST_CHECKED then
          FSizePost:=2
        else// if IsDlgButtonChecked(Dialog,IDC_POSTLARGE)=BST_CHECKED then
          FSizePost:=3;
        FSPrecision:=GetDlgItemInt(Dialog,IDC_PRECISION,pbool(nil)^,false);
        if FSPrecision>3 then
          FSPrecision:=3;

        mFreeMem(ExportText);
        ExportText:=GetDlgText(Dialog,IDC_EXPORT_TEXT);

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