@@ -8,12 +8,13 @@ interface
8
8
Winapi.Windows,
9
9
Vcl.Menus,
10
10
ToolsAPI,
11
- DelphiAIDev.Utils.CnWizard;
11
+ DelphiAIDev.Utils.CnWizard,
12
+ DelphiAIDev.Chat.View ;
12
13
13
14
type
14
15
TDelphiAIDevIDEShortcuts = class (TNotifierObject, IOTAKeyboardBinding)
15
16
private
16
- // procedure KeyProcBlockReturn(const Context: IOTAKeyContext; KeyCode: TShortcut; var BindingResult: TKeyBindingResult);
17
+ procedure KeyProcBlockReturn (const Context: IOTAKeyContext; KeyCode: TShortcut; var BindingResult: TKeyBindingResult);
17
18
procedure KeyProcBlockReturnAndAlt (const Context: IOTAKeyContext; KeyCode: TShortcut; var BindingResult: TKeyBindingResult);
18
19
protected
19
20
function GetBindingType : TBindingType;
@@ -37,8 +38,8 @@ implementation
37
38
38
39
procedure RegisterSelf ;
39
40
begin
40
- if Index < 0 then
41
- Index := TUtilsOTA.GetIOTAKeyboardServices.AddKeyboardBinding(TDelphiAIDevIDEShortcuts.New);
41
+ // if Index < 0 then
42
+ // Index := TUtilsOTA.GetIOTAKeyboardServices.AddKeyboardBinding(TDelphiAIDevIDEShortcuts.New);
42
43
end ;
43
44
44
45
procedure UnRegisterSelf ;
@@ -81,19 +82,32 @@ procedure TDelphiAIDevIDEShortcuts.BindKeyboard(const BindingServices: IOTAKeyBi
81
82
if TUtilsOTA.CurrentProjectIsDelphiAIDeveloperDPROJ then
82
83
Exit;
83
84
84
- // BindingServices.AddKeyBinding([Shortcut(VK_RETURN, [])], Self.KeyProcBlockReturn, nil);
85
+ Exit;
86
+ BindingServices.AddKeyBinding([Shortcut(VK_RETURN, [])], Self.KeyProcBlockReturn, nil );
85
87
BindingServices.AddKeyBinding([Shortcut(VK_RETURN, [ssAlt])], Self.KeyProcBlockReturnAndAlt, nil );
86
88
end ;
87
89
88
- // procedure TDelphiAIDevIDEShortcuts.KeyProcBlockReturn(const Context: IOTAKeyContext; KeyCode: TShortcut; var BindingResult: TKeyBindingResult);
89
- // begin
90
- // TUtils.AddLog(GetCurrentLineOrBlock(CnOtaGetTopMostEditView));
91
- // BindingResult := krNextProc; //krUnhandled;
92
- // end;
90
+ procedure TDelphiAIDevIDEShortcuts.KeyProcBlockReturn (const Context: IOTAKeyContext; KeyCode: TShortcut; var BindingResult: TKeyBindingResult);
91
+ begin
92
+ Exit;
93
+
94
+ TUtils.AddLog(GetCurrentLineOrBlock(CnOtaGetTopMostEditView));
95
+ BindingResult := krNextProc; // krUnhandled;
96
+ end ;
93
97
94
98
procedure TDelphiAIDevIDEShortcuts.KeyProcBlockReturnAndAlt (const Context: IOTAKeyContext; KeyCode: TShortcut; var BindingResult: TKeyBindingResult);
99
+ var
100
+ LTextCurrentLineOrBlock: string;
95
101
begin
96
- TUtils.AddLog(' Enter and Alt' + GetCurrentLineOrBlock(CnOtaGetTopMostEditView));
102
+ // TUtils.AddLog('Enter and Alt' + GetCurrentLineOrBlock(CnOtaGetTopMostEditView));
103
+
104
+ LTextCurrentLineOrBlock := GetCurrentLineOrBlock(CnOtaGetTopMostEditView);
105
+ if LTextCurrentLineOrBlock.Trim.IsEmpty then
106
+ Exit;
107
+
108
+ DelphiAIDev.Chat.View .DelphiAIDevChatView.QuestionOnShow := LTextCurrentLineOrBlock;
109
+ DelphiAIDev.Chat.View .DelphiAIDevChatViewShowDockableForm;
110
+
97
111
BindingResult := krNextProc; // krUnhandled;
98
112
end ;
99
113
0 commit comments