@@ -106,8 +106,9 @@ TDelphiAIDevChatView = class(TDockableForm)
106
106
FbtnUseCurrentUnitCodeWidth: Integer;
107
107
FbtnCodeOnlyWidth: Integer;
108
108
FbtnDefaultsQuestionsWidth: Integer;
109
- procedure ReadFromFile ;
110
- procedure WriteToFile ;
109
+ FQuestionOnShow: string;
110
+ procedure FillMemoReturnWithFile ;
111
+ procedure SaveMemoReturnInFile ;
111
112
procedure InitializeRichEditReturn ;
112
113
procedure ProcessSend ;
113
114
procedure AddResponseSimple (const AString: string);
@@ -125,9 +126,11 @@ TDelphiAIDevChatView = class(TDockableForm)
125
126
procedure AddItemsPopupMenuQuestion ;
126
127
procedure DoProcessClickInItemDefaultQuestions (ACodeOnly: Boolean; AQuestion: string);
127
128
procedure ProcessWordWrap ;
129
+ procedure ConfScreenOnCreate ;
128
130
public
129
131
constructor Create(AOwner: TComponent); override;
130
132
destructor Destroy; override;
133
+ property QuestionOnShow: string write FQuestionOnShow;
131
134
end ;
132
135
133
136
var
@@ -186,15 +189,15 @@ constructor TDelphiAIDevChatView.Create(AOwner: TComponent);
186
189
FChat := TDelphiAIDevChat.Create;
187
190
FSettings := FChat.Settings.GetInstance;
188
191
FPopupMenuQuestions := TDelphiAIDevDefaultsQuestionsPopupMenu.Create;
192
+ FQuestionOnShow := ' ' ;
189
193
190
- pnWait.Visible := False;
191
- FbtnUseCurrentUnitCodeWidth := btnUseCurrentUnitCode.Width;
192
- FbtnCodeOnlyWidth := btnCodeOnly.Width;
193
- FbtnDefaultsQuestionsWidth := btnDefaultsQuestions.Width;
194
+ Self.ConfScreenOnCreate;
195
+ Self.FillMemoReturnWithFile; // //
194
196
end ;
195
197
196
198
destructor TDelphiAIDevChatView.Destroy;
197
199
begin
200
+ Self.SaveMemoReturnInFile; // //
198
201
FPopupMenuQuestions.Free;
199
202
FChat.Free;
200
203
inherited ;
@@ -204,49 +207,65 @@ procedure TDelphiAIDevChatView.FormShow(Sender: TObject);
204
207
begin
205
208
Self.ConfScreenOnShow;
206
209
Self.InitializeRichEditReturn;
207
- Self.ReadFromFile ;
210
+ // // Self.FillMemoReturnWithFile ;
208
211
Self.ProcessWordWrap;
209
- // Self.GetSelectedBlockForQuestion;
210
212
211
213
Self.AddItemsPopupMenuQuestion;
214
+
212
215
TUtils.MemoFocusOnTheEnd(mmQuestion);
213
216
end ;
214
217
215
- procedure TDelphiAIDevChatView.AddItemsPopupMenuQuestion ;
218
+ procedure TDelphiAIDevChatView.FormActivate (Sender: TObject) ;
216
219
begin
217
- FPopupMenuQuestions
218
- .ProcessClickInItem(DoProcessClickInItemDefaultQuestions)
219
- .CreateMenus(pMenuQuestions);
220
+ Self.ConfLabelCurrentAI;
221
+
222
+ if not FQuestionOnShow.Trim.IsEmpty then
223
+ begin
224
+ mmQuestion.Lines.Clear;
225
+ mmQuestion.Lines.Add(FQuestionOnShow);
226
+ FQuestionOnShow := ' ' ;
227
+ end ;
220
228
end ;
221
229
222
- procedure TDelphiAIDevChatView.DoProcessClickInItemDefaultQuestions (
223
- ACodeOnly: Boolean; AQuestion: string);
230
+ procedure TDelphiAIDevChatView.ConfScreenOnCreate ;
224
231
begin
225
- if ACodeOnly then
226
- btnCodeOnly.ImageIndex := CodeOnly_ImageIndex_ON
227
- else
228
- btnCodeOnly.ImageIndex := CodeOnly_ImageIndex_OFF;
232
+ mmReturn.Lines.Clear;
229
233
230
- mmQuestion.Lines.Add(AQuestion);
234
+ pnWait.Visible := False;
235
+ FbtnUseCurrentUnitCodeWidth := btnUseCurrentUnitCode.Width;
236
+ FbtnCodeOnlyWidth := btnCodeOnly.Width;
237
+ FbtnDefaultsQuestionsWidth := btnDefaultsQuestions.Width;
238
+
239
+ ShapeCommands.Left := 0 ;
240
+ ShapeCommands.Top := 0 ;
241
+ ShapeCommands.Width := ShapeCommands.Parent.Width;
242
+ ShapeCommands.Height := ShapeCommands.Parent.Height;
231
243
end ;
232
244
233
245
procedure TDelphiAIDevChatView.ConfScreenOnShow ;
234
246
begin
235
247
TUtilsOTA.IDEThemingAll(TDelphiAIDevChatView, Self);
236
- Self.Constraints.MinWidth := 150 ;
237
- Self.Constraints.MinHeight := 150 ;
238
-
239
248
btnMoreActions.Font.Color := TUtilsOTA.ActiveThemeColorDefault;
240
249
241
- ShapeCommands.Left := 0 ;
242
- ShapeCommands.Top := 0 ;
243
- ShapeCommands.Width := ShapeCommands.Parent.Width;
244
- ShapeCommands.Height := ShapeCommands.Parent.Height;
250
+ Self.Constraints.MinWidth := 200 ;
251
+ Self.Constraints.MinHeight := 300 ;
245
252
end ;
246
253
247
- procedure TDelphiAIDevChatView.FormActivate (Sender: TObject) ;
254
+ procedure TDelphiAIDevChatView.AddItemsPopupMenuQuestion ;
248
255
begin
249
- Self.ConfLabelCurrentAI;
256
+ FPopupMenuQuestions
257
+ .ProcessClickInItem(DoProcessClickInItemDefaultQuestions)
258
+ .CreateMenus(pMenuQuestions);
259
+ end ;
260
+
261
+ procedure TDelphiAIDevChatView.DoProcessClickInItemDefaultQuestions (ACodeOnly: Boolean; AQuestion: string);
262
+ begin
263
+ if ACodeOnly then
264
+ btnCodeOnly.ImageIndex := CodeOnly_ImageIndex_ON
265
+ else
266
+ btnCodeOnly.ImageIndex := CodeOnly_ImageIndex_OFF;
267
+
268
+ mmQuestion.Lines.Add(AQuestion);
250
269
end ;
251
270
252
271
procedure TDelphiAIDevChatView.mmQuestionChange (Sender: TObject);
@@ -268,7 +287,7 @@ procedure TDelphiAIDevChatView.mmQuestionKeyDown(Sender: TObject; var Key: Word;
268
287
269
288
procedure TDelphiAIDevChatView.mmQuestionKeyUp (Sender: TObject; var Key: Word; Shift: TShiftState);
270
289
begin
271
- if (ssCtrl in Shift)and (Key = 65 )then
290
+ if (ssCtrl in Shift)and (Key = 65 ) then
272
291
begin
273
292
mmQuestion.SelectAll;
274
293
Key := 0 ;
@@ -277,7 +296,7 @@ procedure TDelphiAIDevChatView.mmQuestionKeyUp(Sender: TObject; var Key: Word; S
277
296
278
297
procedure TDelphiAIDevChatView.FormClose (Sender: TObject; var Action: TCloseAction);
279
298
begin
280
- Self.WriteToFile ;
299
+ // // Self.SaveMemoReturnInFile ;
281
300
Self.WaitingFormOFF;
282
301
end ;
283
302
@@ -323,20 +342,20 @@ procedure TDelphiAIDevChatView.FormResize(Sender: TObject);
323
342
end ;
324
343
end ;
325
344
326
- procedure TDelphiAIDevChatView.ReadFromFile ;
345
+ procedure TDelphiAIDevChatView.FillMemoReturnWithFile ;
327
346
begin
328
347
if (FileExists(TUtils.GetPathFileChat))then
329
348
mmReturn.Lines.LoadFromFile(TUtils.GetPathFileChat)
330
349
end ;
331
350
332
- procedure TDelphiAIDevChatView.SelectAll1Click (Sender: TObject) ;
351
+ procedure TDelphiAIDevChatView.SaveMemoReturnInFile ;
333
352
begin
334
- mmReturn.SelectAll ;
353
+ mmReturn.Lines.SaveToFile(TUtils.GetPathFileChat) ;
335
354
end ;
336
355
337
- procedure TDelphiAIDevChatView.WriteToFile ;
356
+ procedure TDelphiAIDevChatView.SelectAll1Click (Sender: TObject) ;
338
357
begin
339
- mmReturn.Lines.SaveToFile(TUtils.GetPathFileChat) ;
358
+ mmReturn.SelectAll ;
340
359
end ;
341
360
342
361
procedure TDelphiAIDevChatView.cBoxSizeFontKeyPress (Sender: TObject; var Key: Char);
@@ -678,7 +697,7 @@ procedure TDelphiAIDevChatView.btnMoreActionsClick(Sender: TObject);
678
697
679
698
procedure TDelphiAIDevChatView.InitializeRichEditReturn ;
680
699
begin
681
- mmReturn.Lines.Clear;
700
+ // mmReturn.Lines.Clear;
682
701
mmReturn.SelAttributes.Name := ' Courier New' ;
683
702
mmReturn.SelAttributes.Size := 10 ;
684
703
0 commit comments