summaryrefslogtreecommitdiff
path: root/plugins/Watrack/HlpDlg.pas
blob: c420345bd41b6c140b9c4a4a083620ca2bf23bf8 (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
{help dialogs}
unit HlpDlg;

interface

uses windows;

const
  sFormatHelp:PWideChar = 'Text format codes'#13#10'{b}text{/b}'#9'bold'#13#10+
  '{i}text{/i}'#9'italic'#13#10'{u}text{/u}'#9'undeline'#13#10+
  '{cf##}text{/cf}'#9'text color'#13#10'{bg##}text{/bg}'#9+
  'background color'#13#10'text - user text'#13#10+
  '## - color number (1-16)'#13#10'Color 0 is background color'#13#10+
  'Color 17 is default text color';

function ShowColorHelpDlg(parent:HWND):integer;

implementation

uses messages,m_api;

{$include res\i_const.inc}

const
  colors:array [0..15] of dword = (
    $00FFFFFF,$00000000,$007F0000,$00009300,
    $000000FF,$0000007F,$009C009C,$00007FFC,
    $0000FFFF,$0000FC00,$00939300,$00FFFF00,
    $00FC0000,$00FF00FF,$007F7F7F,$00D2D2D2
   );

const
  COLORDLG = 'COLOR';

function ColorHelpDlg(Dialog:HWnd;hMessage,wParam,lParam:DWord):integer; stdcall;
var
  ps:tPaintStruct;
  br:hBrush;
  dc:hDC;
  rc:tRect;
  i,j:integer;
begin
  case hMessage of
    WM_INITDIALOG: begin
      TranslateDialogDefault(Dialog);
    end;
    WM_COMMAND:
      if (wParam shr 16)=BN_CLICKED then
        case loword(wParam) of
          IDOK, IDCANCEL: DestroyWindow(Dialog);
        end;
    WM_PAINT: begin
      dc:=BeginPaint(Dialog,ps);
      SetBkColor(dc,GetSysColor(COLOR_BTNFACE));
      for i:=0 to 1 do
      begin
        for j:=0 to 7 do
        begin
          with rc do
          begin
            left  :=32+i*66;
            top   :=10+j*18;
            right :=56+i*66;
            bottom:=24+j*18;
          end;
          br:=CreateSolidBrush(colors[i*8+j]);
          Rectangle(dc,rc.left-1,rc.top-1,rc.right+1,rc.bottom+1);
          FillRect(dc,rc,br);
          DeleteObject(br);
        end;
      end;
      EndPaint(Dialog,ps);
    end;
  end;
  result:=0;
end;

function ShowColorHelpDlg(parent:HWND):integer;
begin
  result:=CreateDialogW(hInstance,COLORDLG,parent,@ColorHelpDlg);
end;

end.