1 | //kt -- Modified with SourceScanner on 8/7/2007
|
---|
2 | unit fxBroker;
|
---|
3 |
|
---|
4 | interface
|
---|
5 |
|
---|
6 | uses
|
---|
7 | Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
---|
8 | StdCtrls, DateUtils, ORNet, ORFn, rMisc, ComCtrls, Buttons, ExtCtrls,
|
---|
9 | ORCtrls, ORSystem, DKLang;
|
---|
10 |
|
---|
11 | type
|
---|
12 | TfrmBroker = class(TForm)
|
---|
13 | pnlTop: TORAutoPanel;
|
---|
14 | lblMaxCalls: TLabel;
|
---|
15 | txtMaxCalls: TCaptionEdit;
|
---|
16 | cmdPrev: TBitBtn;
|
---|
17 | cmdNext: TBitBtn;
|
---|
18 | udMax: TUpDown;
|
---|
19 | memData: TRichEdit;
|
---|
20 | lblCallID: TStaticText;
|
---|
21 | btnRLT: TButton;
|
---|
22 | DKLanguageController1: TDKLanguageController;
|
---|
23 | btnClear: TBitBtn;
|
---|
24 | lblStoredCallsNum: TLabel;
|
---|
25 | cboJumpTo: TComboBox;
|
---|
26 | procedure cmdPrevClick(Sender: TObject);
|
---|
27 | procedure cmdNextClick(Sender: TObject);
|
---|
28 | procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
---|
29 | procedure FormResize(Sender: TObject);
|
---|
30 | procedure FormCreate(Sender: TObject);
|
---|
31 | procedure FormKeyUp(Sender: TObject; var Key: Word;
|
---|
32 | Shift: TShiftState);
|
---|
33 | procedure btnRLTClick(Sender: TObject);
|
---|
34 | procedure btnClearClick(Sender: TObject);
|
---|
35 | procedure cboJumpToDropDown(Sender: TObject);
|
---|
36 | procedure cboJumpToChange(Sender: TObject);
|
---|
37 | private
|
---|
38 | { Private declarations }
|
---|
39 | FRetained: Integer;
|
---|
40 | FCurrent: Integer;
|
---|
41 | procedure UpdateDisplay; //kt added
|
---|
42 | public
|
---|
43 | { Public declarations }
|
---|
44 | end;
|
---|
45 |
|
---|
46 | procedure ShowBroker;
|
---|
47 |
|
---|
48 | implementation
|
---|
49 |
|
---|
50 | {$R *.DFM}
|
---|
51 |
|
---|
52 | procedure ShowBroker;
|
---|
53 | var
|
---|
54 | frmBroker: TfrmBroker;
|
---|
55 | begin
|
---|
56 | frmBroker := TfrmBroker.Create(Application);
|
---|
57 | try
|
---|
58 | ResizeAnchoredFormToFont(frmBroker);
|
---|
59 | with frmBroker do
|
---|
60 | begin
|
---|
61 | FRetained := RetainedRPCCount - 1;
|
---|
62 | FCurrent := FRetained;
|
---|
63 | UpdateDisplay; //kt
|
---|
64 | { //kt moved to UpdateDisplay
|
---|
65 | LoadRPCData(memData.Lines, FCurrent);
|
---|
66 | memData.SelStart := 0;
|
---|
67 | // lblCallID.Caption := 'Last Call Minus: ' + IntToStr(FRetained - FCurrent); <-- original line. //kt 8/7/2007
|
---|
68 | lblCallID.Caption := DKLangConstW('fxBroker_Last_Call_Minusx') + IntToStr(HigherOf(FRetained - FCurrent,0)); //kt added 8/7/2007
|
---|
69 | lblStoredCallsNum.Caption := DKLangConstW('fxBroker_Stored_Calls') + IntToStr(RetainedRPCCount); //kt added 4/15/10
|
---|
70 | }
|
---|
71 | ShowModal;
|
---|
72 | end;
|
---|
73 | finally
|
---|
74 | frmBroker.Release;
|
---|
75 | end;
|
---|
76 | end;
|
---|
77 |
|
---|
78 | procedure TfrmBroker.cmdPrevClick(Sender: TObject);
|
---|
79 | begin
|
---|
80 | FCurrent := HigherOf(FCurrent - 1, 0);
|
---|
81 | UpdateDisplay; //kt
|
---|
82 | { //kt moved to UpdateDisplay
|
---|
83 | LoadRPCData(memData.Lines, FCurrent);
|
---|
84 | memData.SelStart := 0;
|
---|
85 | //lblCallID.Caption := 'Last Call Minus: ' + IntToStr(FRetained - FCurrent); <-- original line. //kt 8/7/2007
|
---|
86 | lblCallID.Caption := DKLangConstW('fxBroker_Last_Call_Minusx') + IntToStr(HigherOf(FRetained - FCurrent,0)); //kt added 8/7/2007
|
---|
87 | lblStoredCallsNum.Caption := DKLangConstW('fxBroker_Stored_Calls') + IntToStr(RetainedRPCCount); //kt added 4/15/10
|
---|
88 | }
|
---|
89 | end;
|
---|
90 |
|
---|
91 | procedure TfrmBroker.cmdNextClick(Sender: TObject);
|
---|
92 | begin
|
---|
93 | FRetained := RetainedRPCCount - 1; //kt added line 4/15/10
|
---|
94 | FCurrent := LowerOf(FCurrent + 1, FRetained);
|
---|
95 | UpdateDisplay; //kt
|
---|
96 | { //kt moved to UpdateDisplay
|
---|
97 | LoadRPCData(memData.Lines, FCurrent);
|
---|
98 | memData.SelStart := 0;
|
---|
99 | //lblCallID.Caption := 'Last Call Minus: ' + IntToStr(FRetained - FCurrent); <-- original line. //kt 8/7/2007
|
---|
100 | lblCallID.Caption := DKLangConstW('fxBroker_Last_Call_Minusx') + IntToStr(HigherOf(FRetained - FCurrent,0)); //kt added 8/7/2007
|
---|
101 | lblStoredCallsNum.Caption := DKLangConstW('fxBroker_Stored_Calls') + IntToStr(RetainedRPCCount); //kt added 4/15/10
|
---|
102 | }
|
---|
103 | end;
|
---|
104 |
|
---|
105 | procedure TfrmBroker.UpdateDisplay; //kt added
|
---|
106 | begin
|
---|
107 | FRetained := RetainedRPCCount - 1; //kt added line 4/15/10
|
---|
108 | LoadRPCData(memData.Lines, FCurrent);
|
---|
109 | memData.SelStart := 0;
|
---|
110 | //lblCallID.Caption := 'Last Call Minus: ' + IntToStr(FRetained - FCurrent); <-- original line. //kt 8/7/2007
|
---|
111 | lblCallID.Caption := DKLangConstW('fxBroker_Last_Call_Minusx') + IntToStr(HigherOf(FRetained - FCurrent,0)); //kt added 8/7/2007
|
---|
112 | lblStoredCallsNum.Caption := DKLangConstW('fxBroker_Stored_Calls') + IntToStr(RetainedRPCCount); //kt added 4/15/10
|
---|
113 | end;
|
---|
114 |
|
---|
115 | procedure TfrmBroker.cboJumpToDropDown(Sender: TObject);
|
---|
116 | //kt added entire function
|
---|
117 | var i : integer;
|
---|
118 | s : string;
|
---|
119 | Info : TStringList; //Not owned here...
|
---|
120 | begin
|
---|
121 | cboJumpTo.Items.Clear;
|
---|
122 | for i := 0 to RetainedRPCCount - 1 do begin
|
---|
123 | Info := AccessRPCData(i);
|
---|
124 | if Info.Count < 2 then continue;
|
---|
125 | s := Info.Strings[1];
|
---|
126 | s := piece(s,'Called at: ',2);
|
---|
127 | s := s + ': ' + Info.Strings[0];
|
---|
128 | cboJumpTo.Items.Insert(0,s);
|
---|
129 | end;
|
---|
130 | end;
|
---|
131 |
|
---|
132 | procedure TfrmBroker.cboJumpToChange(Sender: TObject);
|
---|
133 | //kt added function
|
---|
134 | begin
|
---|
135 | if cboJumpTo.Items.count > 0 then begin
|
---|
136 | FCurrent := (cboJumpTo.Items.count-1) - cboJumpTo.ItemIndex;
|
---|
137 | UpdateDisplay; //kt
|
---|
138 | end;
|
---|
139 | end;
|
---|
140 |
|
---|
141 |
|
---|
142 | procedure TfrmBroker.FormClose(Sender: TObject; var Action: TCloseAction);
|
---|
143 | begin
|
---|
144 | SetRetainedRPCMax(StrToIntDef(txtMaxCalls.Text, 5))
|
---|
145 | end;
|
---|
146 |
|
---|
147 | procedure TfrmBroker.FormResize(Sender: TObject);
|
---|
148 | begin
|
---|
149 | Refresh;
|
---|
150 | end;
|
---|
151 |
|
---|
152 | procedure TfrmBroker.FormCreate(Sender: TObject);
|
---|
153 | begin
|
---|
154 | udMax.Position := GetRPCMax;
|
---|
155 | end;
|
---|
156 |
|
---|
157 | procedure TfrmBroker.FormKeyUp(Sender: TObject; var Key: Word;
|
---|
158 | Shift: TShiftState);
|
---|
159 | begin
|
---|
160 | if Key = VK_ESCAPE then
|
---|
161 | begin
|
---|
162 | Key := 0;
|
---|
163 | Close;
|
---|
164 | end;
|
---|
165 | end;
|
---|
166 |
|
---|
167 | procedure TfrmBroker.btnRLTClick(Sender: TObject);
|
---|
168 | var
|
---|
169 | startTime, endTime: tDateTime;
|
---|
170 | clientVer, serverVer, diffDisplay: string;
|
---|
171 | theDiff: integer;
|
---|
172 | disclaimer : string; //kt
|
---|
173 | const
|
---|
174 | TX_OPTION = 'OR CPRS GUI CHART';
|
---|
175 | //disclaimer = 'NOTE: Strictly relative indicator:'; <-- original line. //kt 8/7/2007
|
---|
176 | begin
|
---|
177 | disclaimer := DKLangConstW('fxBroker_NOTEx_Strictly_relative_indicatorx'); //kt added 8/7/2007
|
---|
178 |
|
---|
179 | clientVer := clientVersion(Application.ExeName); // Obtain before starting.
|
---|
180 |
|
---|
181 | // Check time lapse between a standard RPC call:
|
---|
182 | startTime := now;
|
---|
183 | serverVer := serverVersion(TX_OPTION, clientVer);
|
---|
184 | endTime := now;
|
---|
185 | theDiff := milliSecondsBetween(endTime, startTime);
|
---|
186 | diffDisplay := intToStr(theDiff);
|
---|
187 |
|
---|
188 | // Show the results:
|
---|
189 | //infoBox('Lapsed time (milliseconds) = ' + diffDisplay + '.', disclaimer, MB_OK); <-- original line. //kt 8/7/2007
|
---|
190 | infoBox(DKLangConstW('fxBroker_Lapsed_time_xmillisecondsx_x') + diffDisplay + '.', disclaimer, MB_OK); //kt added 8/7/2007
|
---|
191 |
|
---|
192 | end;
|
---|
193 |
|
---|
194 | procedure TfrmBroker.btnClearClick(Sender: TObject);
|
---|
195 | //kt added entire function
|
---|
196 | begin
|
---|
197 | ORNet.RPCCallsClear;
|
---|
198 | memData.Lines.Clear; //kt 4/15/10
|
---|
199 | cboJumpTo.Text := '-- Select a call to jump to --';
|
---|
200 | FCurrent := 0;
|
---|
201 | FRetained := RetainedRPCCount - 1;
|
---|
202 | cmdNextClick(Sender);
|
---|
203 | end;
|
---|
204 |
|
---|
205 |
|
---|
206 | end.
|
---|