File: frmpas2jsbrowserprojectoptions.pp

package info (click to toggle)
lazarus 2.0.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 214,460 kB
  • sloc: pascal: 1,862,622; xml: 265,709; cpp: 56,595; sh: 3,008; java: 609; makefile: 535; perl: 297; sql: 222; ansic: 137
file content (165 lines) | stat: -rw-r--r-- 4,184 bytes parent folder | download | duplicates (2)
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
unit frmpas2jsbrowserprojectoptions;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, ButtonPanel,
  Spin;

type

  { TWebBrowserProjectOptionsForm }

  TWebBrowserProjectOptionsForm = class(TForm)
    BPHelpOptions: TButtonPanel;
    CBCreateHTML: TCheckBox;
    CBUseBrowserApp: TCheckBox;
    CBUseBrowserConsole: TCheckBox;
    CBUseHTTPServer: TCheckBox;
    CBServerURL: TComboBox;
    CBMaintainPage: TCheckBox;
    CBRunOnReady: TCheckBox;
    RBUseURL: TRadioButton;
    RBStartServerAt: TRadioButton;
    SEPort: TSpinEdit;
    procedure CBCreateHTMLChange(Sender: TObject);
    procedure CBUseHTTPServerChange(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure FormShow(Sender: TObject);
  private
    function GetB(AIndex: Integer): Boolean;
    function GetServerPort: Word;
    function GetURL: String;
    procedure SetB(AIndex: Integer; AValue: Boolean);
    procedure SetServerPort(AValue: Word);
    procedure SetURL(AValue: String);
  public
    property CreateHTML : Boolean Index 0 read GetB Write SetB;
    property MaintainHTML : Boolean Index 1 read GetB Write SetB;
    property UseBrowserApp : Boolean Index 2 read GetB Write SetB;
    property UseBrowserConsole : Boolean Index 3 read GetB Write SetB;
    property StartHTTPServer : Boolean Index 4 read GetB Write SetB;
    property UseURL : Boolean Index 5 read GetB Write SetB;
    property UseRunOnReady : Boolean Index 6 read GetB Write SetB;
    Property ServerPort : Word Read GetServerPort Write SetServerPort;
    Property URL : String Read GetURL Write SetURL;
  end;

var
  WebBrowserProjectOptionsForm: TWebBrowserProjectOptionsForm;

implementation

{$R *.lfm}

{ TWebBrowserProjectOptionsForm }

procedure TWebBrowserProjectOptionsForm.CBCreateHTMLChange(Sender: TObject);

  Procedure DOCB(CB : TCheckbox);

  begin
    CB.Enabled:=CBCreateHTML.Checked;
    if not CB.Enabled then
      CB.Checked:=False;
  end;

begin
  DoCB(CBRunOnReady);
  DoCB(CBMaintainPage);
end;

procedure TWebBrowserProjectOptionsForm.CBUseHTTPServerChange(Sender: TObject);

  procedure disen(C : TControl);

  begin
    C.Enabled:=CBUseHTTPServer.Checked;
    if C is TRadioButton then
      if not C.Enabled then
        TRadioButton(C).Checked:=False;
  end;

begin
  disen(RBStartServerAt);
  disen(RBUseURL);
  disen(SEPort);
  disen(CBServerURL);
end;

procedure TWebBrowserProjectOptionsForm.FormCreate(Sender: TObject);
begin
  CBCreateHTMLChange(self);
  CBUseHTTPServerChange(Self);
end;

procedure TWebBrowserProjectOptionsForm.FormShow(Sender: TObject);
begin
  // Need to do this again, in case options were set before show
  CBCreateHTMLChange(self);
  CBUseHTTPServerChange(Self);
end;

function TWebBrowserProjectOptionsForm.GetB(AIndex: Integer): Boolean;
begin
  Case Aindex of
    0 : Result:=CBCreateHTML.Checked;
    1 : Result:=CBMaintainPage.Checked;
    2 : Result:=CBUseBrowserApp.Checked;
    3 : Result:=CBUseBrowserConsole.Checked;
    4 : Result:=RBStartServerAt.Checked;
    5 : Result:=RBUseURL.Checked;
    6 : Result:=CBRunOnReady.Checked;
  else
    Result:=False;
  end;
//  Writeln('Reporting ',AIndex,' : ',Result);
end;

function TWebBrowserProjectOptionsForm.GetServerPort: Word;
begin
  Result:=SEPort.Value;
end;

function TWebBrowserProjectOptionsForm.GetURL: String;
begin
  Result:=CBServerURL.Text;
end;

procedure TWebBrowserProjectOptionsForm.SetB(AIndex: Integer; AValue: Boolean);
begin
  Case Aindex of
    0 : CBCreateHTML.Checked:=AValue;
    1 : CBMaintainPage.Checked:=AValue;
    2 : CBUseBrowserApp.Checked:=AValue;
    3 : CBUseBrowserConsole.Checked:=AValue;
    4 :
      begin
      RBStartServerAt.Checked:=AValue;
      if AValue then
        CBUseHTTPServer.Checked:=true
      end;
    5 :
      begin
      RBUseURL.Checked:=AValue;
      if AValue then
        CBUseHTTPServer.Checked:=true
      end;
    6 : CBRunOnReady.Checked:=Avalue;
  end;
end;

procedure TWebBrowserProjectOptionsForm.SetServerPort(AValue: Word);
begin
  SEPort.Value:=AValue;
end;

procedure TWebBrowserProjectOptionsForm.SetURL(AValue: String);
begin
  CBServerURL.Text:=AValue;
end;

end.