Skip to content

Commit 144738c

Browse files
committed
bk/2024-06-14-1055
1 parent fb23394 commit 144738c

2 files changed

Lines changed: 132 additions & 125 deletions

File tree

Src/Chat/DelphiCopilot.Chat.View.dfm

Lines changed: 112 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ object DelphiCopilotChatView: TDelphiCopilotChatView
1818
OnActivate = FormActivate
1919
OnClose = FormClose
2020
OnShow = FormShow
21+
DesignSize = (
22+
975
23+
661)
2124
PixelsPerInch = 96
2225
TextHeight = 13
2326
object pnBack: TPanel
@@ -36,10 +39,6 @@ object DelphiCopilotChatView: TDelphiCopilotChatView
3639
Padding.Top = 15
3740
ParentBackground = False
3841
TabOrder = 0
39-
ExplicitWidth = 958
40-
DesignSize = (
41-
956
42-
661)
4342
object Splitter1: TSplitter
4443
Left = 18
4544
Top = 523
@@ -62,6 +61,8 @@ object DelphiCopilotChatView: TDelphiCopilotChatView
6261
Margins.Right = 0
6362
ParentCustomHint = False
6463
Align = alClient
64+
BevelInner = bvNone
65+
BevelOuter = bvNone
6566
Ctl3D = True
6667
Font.Charset = ANSI_CHARSET
6768
Font.Color = clWindow
@@ -77,10 +78,8 @@ object DelphiCopilotChatView: TDelphiCopilotChatView
7778
PopupMenu = PopupMenu1
7879
ScrollBars = ssVertical
7980
ShowHint = True
80-
TabOrder = 2
81+
TabOrder = 1
8182
Zoom = 100
82-
ExplicitLeft = 15
83-
ExplicitTop = 12
8483
end
8584
object pnBackQuestion: TPanel
8685
Left = 18
@@ -96,8 +95,6 @@ object DelphiCopilotChatView: TDelphiCopilotChatView
9695
Padding.Top = 5
9796
ParentBackground = False
9897
TabOrder = 0
99-
ExplicitLeft = 10
100-
ExplicitWidth = 948
10198
object pnBackBtnSend: TPanel
10299
Left = 856
103100
Top = 5
@@ -112,7 +109,6 @@ object DelphiCopilotChatView: TDelphiCopilotChatView
112109
Padding.Left = 3
113110
ParentBackground = False
114111
TabOrder = 0
115-
ExplicitLeft = 866
116112
object btnSend: TButton
117113
AlignWithMargins = True
118114
Left = 3
@@ -128,7 +124,6 @@ object DelphiCopilotChatView: TDelphiCopilotChatView
128124
Caption = 'Send'
129125
TabOrder = 0
130126
OnClick = btnSendClick
131-
ExplicitWidth = 69
132127
end
133128
end
134129
object mmQuestion: TMemo
@@ -152,106 +147,6 @@ object DelphiCopilotChatView: TDelphiCopilotChatView
152147
OnChange = mmQuestionChange
153148
OnKeyDown = mmQuestionKeyDown
154149
OnKeyUp = mmQuestionKeyUp
155-
ExplicitWidth = 866
156-
end
157-
end
158-
object pnCommands: TPanel
159-
Left = 850
160-
Top = 0
161-
Width = 79
162-
Height = 24
163-
Anchors = [akTop, akRight]
164-
BevelOuter = bvNone
165-
ParentBackground = False
166-
TabOrder = 1
167-
ExplicitLeft = 860
168-
object ShapeCommands: TShape
169-
Left = 0
170-
Top = 0
171-
Width = 79
172-
Height = 24
173-
Brush.Style = bsClear
174-
Pen.Color = 12615680
175-
end
176-
object btnCopy: TSpeedButton
177-
AlignWithMargins = True
178-
Left = 27
179-
Top = 0
180-
Width = 22
181-
Height = 24
182-
Cursor = crHandPoint
183-
Hint = 'Copy'
184-
Margins.Left = 0
185-
Margins.Top = 0
186-
Margins.Bottom = 0
187-
Align = alLeft
188-
Flat = True
189-
Glyph.Data = {
190-
8E010000424D8E010000000000008E0000002800000010000000100000000100
191-
08000000000000010000210B0000210B0000160000001600000000000000FFFF
192-
FF00FF00FF00FBFBFB00F7F7F700F3F3F300EAEAEA00E6E6E600E2E2E200DEDE
193-
DE00DADADA00D2D2D200CECECE00B5B5B500ADADAD00A0A0A000949494008C8C
194-
8C00838383007F7F7F0073737300FFFFFF0002020202020F1414141414141414
195-
140202020202020F0506060606060608140202020202020F0608090909090909
196-
140202020202020F050B0B0B0B0B0B091402020F1414140F04090909090A0809
197-
1302020F0506060F04080909090907091202020F0608090F030B0B0B0B0B0B08
198-
1102020F050B0B0F03060607080605071102020F0409090F0101010303070C0D
199-
1002020F0408090F01010103030F0F0F0F02020F030B0B0F01010101010F0E0F
200-
0202020F0306060F0F0F0F0F0F0F0F020202020F0101010303070C0D10020202
201-
0202020F01010103030F0F0F0F0202020202020F01010101010F0E0F02020202
202-
0202020F0F0F0F0F0F0F0F02020202020202}
203-
OnClick = btnCopyClick
204-
ExplicitLeft = 50
205-
ExplicitHeight = 26
206-
end
207-
object btnInsertAtCursor: TSpeedButton
208-
AlignWithMargins = True
209-
Left = 2
210-
Top = 0
211-
Width = 22
212-
Height = 24
213-
Cursor = crHandPoint
214-
Hint = 'Insert Selected Text at Cursor'
215-
Margins.Left = 2
216-
Margins.Top = 0
217-
Margins.Bottom = 0
218-
Align = alLeft
219-
Flat = True
220-
Glyph.Data = {
221-
8A010000424D8A010000000000008A0000002800000010000000100000000100
222-
08000000000000010000120B0000120B0000150000001500000000000000FFFF
223-
FF00FF00FF00EFEFEF00EDEDED00ECECEC00EBEBEB00E9E9E900E7E7E700E5E5
224-
E500E3E3E300E1E1E100E0E0E000DEDEDE00DCDCDC00DBDBDB00D8D8D800ADAD
225-
AD008C8C8C007878780064646400020202020202020202020202020202021313
226-
13131313130202020202020202020507090C0E10120202020202020202020406
227-
080A0D0F12020202020202020202030507090B0E120202020202020202021212
228-
1212121212020202020202020202020202020202020214021213131313130202
229-
02020202021414021207090C0E10020202020202141114021206080A0D0F0202
230-
0202020202141402120507090B0E020202020202020214021213131313131313
231-
13131313130202020202020202020507090C0E10120202020202020202020406
232-
080A0D0F12020202020202020202030507090B0E120202020202020202021212
233-
1212121212020202020202020202}
234-
OnClick = btnInsertAtCursorClick
235-
ExplicitLeft = 1
236-
ExplicitHeight = 26
237-
end
238-
object btnMoreActions: TSpeedButton
239-
AlignWithMargins = True
240-
Left = 52
241-
Top = 0
242-
Width = 22
243-
Height = 24
244-
Cursor = crHandPoint
245-
Hint = 'More actions...'
246-
Margins.Left = 0
247-
Margins.Top = 0
248-
Margins.Bottom = 0
249-
Align = alLeft
250-
Caption = '...'
251-
Flat = True
252-
PopupMenu = PopupMenu1
253-
ExplicitLeft = 65
254-
ExplicitHeight = 22
255150
end
256151
end
257152
object pnBackStatusBar: TPanel
@@ -267,9 +162,7 @@ object DelphiCopilotChatView: TDelphiCopilotChatView
267162
BevelOuter = bvNone
268163
Padding.Top = 3
269164
ParentBackground = False
270-
TabOrder = 3
271-
ExplicitLeft = 10
272-
ExplicitWidth = 948
165+
TabOrder = 2
273166
object lbCurrentAI: TLabel
274167
Left = 0
275168
Top = 3
@@ -333,7 +226,111 @@ object DelphiCopilotChatView: TDelphiCopilotChatView
333226
item
334227
Width = 50
335228
end>
336-
ExplicitLeft = 958
229+
end
230+
object pnCommands: TPanel
231+
Left = 936
232+
Top = 8
233+
Width = 26
234+
Height = 66
235+
Margins.Left = 0
236+
Margins.Top = 0
237+
Margins.Right = 0
238+
Margins.Bottom = 0
239+
Anchors = [akTop, akRight]
240+
BevelOuter = bvNone
241+
ParentBackground = False
242+
TabOrder = 3
243+
object ShapeCommands: TShape
244+
Left = 1
245+
Top = 0
246+
Width = 24
247+
Height = 65
248+
Brush.Style = bsClear
249+
Pen.Color = clGray
250+
Pen.Style = psInsideFrame
251+
end
252+
object btnCopy: TSpeedButton
253+
AlignWithMargins = True
254+
Left = 0
255+
Top = 20
256+
Width = 26
257+
Height = 20
258+
Cursor = crHandPoint
259+
Hint = 'Copy'
260+
Margins.Left = 0
261+
Margins.Top = 0
262+
Margins.Right = 0
263+
Margins.Bottom = 0
264+
Align = alTop
265+
Flat = True
266+
Glyph.Data = {
267+
8E010000424D8E010000000000008E0000002800000010000000100000000100
268+
08000000000000010000210B0000210B0000160000001600000000000000FFFF
269+
FF00FF00FF00FBFBFB00F7F7F700F3F3F300EAEAEA00E6E6E600E2E2E200DEDE
270+
DE00DADADA00D2D2D200CECECE00B5B5B500ADADAD00A0A0A000949494008C8C
271+
8C00838383007F7F7F0073737300FFFFFF0002020202020F1414141414141414
272+
140202020202020F0506060606060608140202020202020F0608090909090909
273+
140202020202020F050B0B0B0B0B0B091402020F1414140F04090909090A0809
274+
1302020F0506060F04080909090907091202020F0608090F030B0B0B0B0B0B08
275+
1102020F050B0B0F03060607080605071102020F0409090F0101010303070C0D
276+
1002020F0408090F01010103030F0F0F0F02020F030B0B0F01010101010F0E0F
277+
0202020F0306060F0F0F0F0F0F0F0F020202020F0101010303070C0D10020202
278+
0202020F01010103030F0F0F0F0202020202020F01010101010F0E0F02020202
279+
0202020F0F0F0F0F0F0F0F02020202020202}
280+
OnClick = btnCopyClick
281+
ExplicitTop = 22
282+
ExplicitWidth = 23
283+
end
284+
object btnInsertAtCursor: TSpeedButton
285+
AlignWithMargins = True
286+
Left = 0
287+
Top = 0
288+
Width = 26
289+
Height = 20
290+
Cursor = crHandPoint
291+
Hint = 'Insert Selected Text at Cursor'
292+
Margins.Left = 0
293+
Margins.Top = 0
294+
Margins.Right = 0
295+
Margins.Bottom = 0
296+
Align = alTop
297+
Flat = True
298+
Glyph.Data = {
299+
8A010000424D8A010000000000008A0000002800000010000000100000000100
300+
08000000000000010000120B0000120B0000150000001500000000000000FFFF
301+
FF00FF00FF00EFEFEF00EDEDED00ECECEC00EBEBEB00E9E9E900E7E7E700E5E5
302+
E500E3E3E300E1E1E100E0E0E000DEDEDE00DCDCDC00DBDBDB00D8D8D800ADAD
303+
AD008C8C8C007878780064646400020202020202020202020202020202021313
304+
13131313130202020202020202020507090C0E10120202020202020202020406
305+
080A0D0F12020202020202020202030507090B0E120202020202020202021212
306+
1212121212020202020202020202020202020202020214021213131313130202
307+
02020202021414021207090C0E10020202020202141114021206080A0D0F0202
308+
0202020202141402120507090B0E020202020202020214021213131313131313
309+
13131313130202020202020202020507090C0E10120202020202020202020406
310+
080A0D0F12020202020202020202030507090B0E120202020202020202021212
311+
1212121212020202020202020202}
312+
OnClick = btnInsertAtCursorClick
313+
ExplicitLeft = 2
314+
ExplicitWidth = 21
315+
end
316+
object btnMoreActions: TSpeedButton
317+
AlignWithMargins = True
318+
Left = 0
319+
Top = 40
320+
Width = 26
321+
Height = 20
322+
Cursor = crHandPoint
323+
Hint = 'More actions...'
324+
Margins.Left = 0
325+
Margins.Top = 0
326+
Margins.Right = 0
327+
Margins.Bottom = 0
328+
Align = alTop
329+
Caption = '...'
330+
Flat = True
331+
PopupMenu = PopupMenu1
332+
ExplicitWidth = 23
333+
end
337334
end
338335
object ImageList1: TImageList
339336
Left = 96

Src/Chat/DelphiCopilot.Chat.View.pas

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,6 @@ TDelphiCopilotChatView = class(TDockableForm)
4242
pnBackBtnSend: TPanel;
4343
btnSend: TButton;
4444
mmQuestion: TMemo;
45-
pnCommands: TPanel;
46-
btnCopy: TSpeedButton;
47-
btnInsertAtCursor: TSpeedButton;
48-
btnMoreActions: TSpeedButton;
49-
ShapeCommands: TShape;
5045
N1: TMenuItem;
5146
mmReturn: TRichEdit;
5247
Splitter1: TSplitter;
@@ -59,6 +54,11 @@ TDelphiCopilotChatView = class(TDockableForm)
5954
pnBackStatusBar: TPanel;
6055
lbCurrentAI: TLabel;
6156
StatusBar1: TStatusBar;
57+
pnCommands: TPanel;
58+
btnCopy: TSpeedButton;
59+
btnInsertAtCursor: TSpeedButton;
60+
btnMoreActions: TSpeedButton;
61+
ShapeCommands: TShape;
6262
procedure FormShow(Sender: TObject);
6363
procedure cBoxSizeFontKeyPress(Sender: TObject; var Key: Char);
6464
procedure Cut1Click(Sender: TObject);
@@ -92,6 +92,7 @@ TDelphiCopilotChatView = class(TDockableForm)
9292
procedure WaitingFormOFF;
9393
procedure WaitingFormON;
9494
procedure ConfLabelCurrentAI;
95+
procedure ConfScreenOnShow;
9596
public
9697
constructor Create(AOwner: TComponent); override;
9798
destructor Destroy; override;
@@ -157,17 +158,26 @@ destructor TDelphiCopilotChatView.Destroy;
157158
end;
158159

159160
procedure TDelphiCopilotChatView.FormShow(Sender: TObject);
161+
begin
162+
Self.ConfScreenOnShow;
163+
Self.InitializeRichEditReturn;
164+
Self.ReadFromFile;
165+
Self.GetSelectedBlockForQuestion;
166+
167+
TUtils.MemoFocusOnTheEnd(mmQuestion);
168+
end;
169+
procedure TDelphiCopilotChatView.ConfScreenOnShow;
160170
begin
161171
TUtilsOTA.IDEThemingAll(TDelphiCopilotChatView, Self);
162172
Self.Constraints.MinWidth := 150;
163173
Self.Constraints.MinHeight := 150;
164174

165-
Self.InitializeRichEditReturn;
166-
Self.ReadFromFile;
167-
Self.GetSelectedBlockForQuestion;
168175
btnMoreActions.Font.Color := TUtilsOTA.ActiveThemeColorDefault;
169176

170-
TUtils.MemoFocusOnTheEnd(mmQuestion);
177+
ShapeCommands.Left := 0;
178+
ShapeCommands.Top := 0;
179+
ShapeCommands.Width := ShapeCommands.Parent.Width;
180+
ShapeCommands.Height := ShapeCommands.Parent.Height;
171181
end;
172182

173183
procedure TDelphiCopilotChatView.FormActivate(Sender: TObject);
@@ -181,7 +191,7 @@ procedure TDelphiCopilotChatView.GetSelectedBlockForQuestion;
181191
begin
182192
LBlockTextSelect := TUtilsOTA.GetBlockTextSelect;
183193
if not LBlockTextSelect.Trim.IsEmpty then
184-
mmQuestion.Text := LBlockTextSelect;
194+
mmQuestion.Text := LBlockTextSelect.Trim;
185195
end;
186196

187197
procedure TDelphiCopilotChatView.mmQuestionChange(Sender: TObject);

0 commit comments

Comments
 (0)