Skip to content

Commit

Permalink
* [Input Helper] Do NOT Popup when Code Template List is Visible.
Browse files Browse the repository at this point in the history
  • Loading branch information
liuxiao committed Jan 26, 2017
1 parent 90dcc6f commit 03a2c96
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 1 deletion.
28 changes: 28 additions & 0 deletions Bin/PSDeclEx/CnWizIdeUtils.pas
Expand Up @@ -188,6 +188,18 @@ function GetCurrentEditControl: TControl;
function GetStatusBarFromEditor(EditControl: TControl): TStatusBar;
{* 从编辑器控件获得其所属的编辑器窗口的状态栏}

function GetCurrentSyncButton: TControl;
{* 获取当前最前端编辑器的语法编辑按钮,注意语法编辑按钮存在不等于可见}

function GetCurrentSyncButtonVisible: Boolean;
{* 获取当前最前端编辑器的语法编辑按钮是否可见,无按钮或不可见均返回 False}

function GetCodeTemplateListBox: TControl;
{* 返回编辑器中的代码模板自动输入框}

function GetCodeTemplateListBoxVisible: Boolean;
{* 返回编辑器中的代码模板自动输入框是否可见,无或不可见均返回 False}

//==============================================================================
// 组件面板封装类
//==============================================================================
Expand Down Expand Up @@ -471,6 +483,22 @@ function GetStatusBarFromEditor(EditControl: TControl): TStatusBar;
begin
end;

function GetCurrentSyncButton: TControl;
begin
end;

function GetCurrentSyncButtonVisible: Boolean;
begin
end;

function GetCodeTemplateListBox: TControl;
begin
end;

function GetCodeTemplateListBoxVisible: Boolean;
begin
end;

{ TCnPaletteWrapper }

procedure TCnPaletteWrapper.BeginUpdate;
Expand Down
3 changes: 2 additions & 1 deletion Source/IdeEnhancements/CnInputHelper.pas
Expand Up @@ -1268,11 +1268,12 @@ function TCnInputHelper.AcceptDisplay: Boolean;
Result := CurrentIsSource;
{$ENDIF}
end;

begin
Result := Active and IsEditControl(Screen.ActiveControl) and
(not CheckImmRun or not IMMIsActive) and CanPopupInCurrentSourceType and
not IsAutoCompleteActive and not IsReadOnly and not CnOtaIsDebugging and
not IsInIncreSearch and not IsInMacroOp;
not IsInIncreSearch and not IsInMacroOp and not GetCodeTemplateListBoxVisible;
end;

procedure TCnInputHelper.ApplicationMessage(var Msg: TMsg;
Expand Down
4 changes: 4 additions & 0 deletions Source/ScriptWizard/CnScript_CnWizIdeUtils.pas
Expand Up @@ -154,6 +154,8 @@ procedure SIRegister_CnWizIdeUtils(CL: TPSPascalCompiler);
CL.AddDelphiFunction('Function GetStatusBarFromEditor(EditControl: TControl) : TStatusBar');
CL.AddDelphiFunction('Function GetCurrentSyncButton : TControl');
CL.AddDelphiFunction('Function GetCurrentSyncButtonVisible : Boolean');
CL.AddDelphiFunction('Function GetCodeTemplateListBox : TControl');
CL.AddDelphiFunction('Function GetCodeTemplateListBoxVisible : Boolean');
CL.AddDelphiFunction('Function ConvertIDETreeNodeToTreeNode(Node: TObject) : TTreeNode');
CL.AddDelphiFunction('Function ConvertIDETreeNodesToTreeNodes(Nodes: TObject) : TTreeNodes');
SIRegister_TCnPaletteWrapper(CL);
Expand Down Expand Up @@ -400,6 +402,8 @@ procedure RIRegister_CnWizIdeUtils_Routines(S: TPSExec);
S.RegisterDelphiFunction(@GetStatusBarFromEditor, 'GetStatusBarFromEditor', cdRegister);
S.RegisterDelphiFunction(@GetCurrentSyncButton, 'GetCurrentSyncButton', cdRegister);
S.RegisterDelphiFunction(@GetCurrentSyncButtonVisible, 'GetCurrentSyncButtonVisible', cdRegister);
S.RegisterDelphiFunction(@GetCodeTemplateListBox, 'GetCodeTemplateListBox', cdRegister);
S.RegisterDelphiFunction(@GetCodeTemplateListBoxVisible, 'GetCodeTemplateListBoxVisible', cdRegister);
S.RegisterDelphiFunction(@ConvertIDETreeNodeToTreeNode, 'ConvertIDETreeNodeToTreeNode', cdRegister);
S.RegisterDelphiFunction(@ConvertIDETreeNodesToTreeNodes, 'ConvertIDETreeNodesToTreeNodes', cdRegister);
S.RegisterDelphiFunction(@CnPaletteWrapper, 'CnPaletteWrapper', cdRegister);
Expand Down
24 changes: 24 additions & 0 deletions Source/Utils/CnWizIdeUtils.pas
Expand Up @@ -377,6 +377,12 @@ function GetCurrentSyncButton: TControl;
function GetCurrentSyncButtonVisible: Boolean;
{* 获取当前最前端编辑器的语法编辑按钮是否可见,无按钮或不可见均返回 False}

function GetCodeTemplateListBox: TControl;
{* 返回编辑器中的代码模板自动输入框}

function GetCodeTemplateListBoxVisible: Boolean;
{* 返回编辑器中的代码模板自动输入框是否可见,无或不可见均返回 False}

type
TCnSrcEditorPage = (epCode, epDesign, epCPU, epWelcome, epOthers);

Expand Down Expand Up @@ -565,6 +571,7 @@ implementation

const
SSyncButtonName = 'SyncButton';
SCodeTemplateListBoxName = 'CodeTemplateListBox';

{$IFDEF BDS4_UP}
const
Expand Down Expand Up @@ -1953,6 +1960,23 @@ function GetCurrentSyncButtonVisible: Boolean;
Result := Button.Visible;
end;

// 返回编辑器中的代码模板自动输入框
function GetCodeTemplateListBox: TControl;
begin
Result := TControl(Application.FindComponent(SCodeTemplateListBoxName));
end;

// 返回编辑器中的代码模板自动输入框是否可见,无或不可见均返回 False
function GetCodeTemplateListBoxVisible: Boolean;
var
Control: TControl;
begin
Result := False;
Control := GetCodeTemplateListBox;
if Control <> nil then
Result := Control.Visible;
end;

// 取当前编辑窗口顶层页面类型,传入编辑器父控件
function GetCurrentTopEditorPage(AControl: TWinControl): TCnSrcEditorPage;
var
Expand Down

0 comments on commit 03a2c96

Please sign in to comment.