editor, handler for modal begin only if editor visible

This commit is contained in:
Basile Burg 2018-05-06 13:06:29 +02:00
parent 7d7dd7d807
commit d6a1435e7d
3 changed files with 17 additions and 5 deletions

View File

@ -7,6 +7,7 @@ inherited CEEditorWidget: TCEEditorWidget
ClientHeight = 434
ClientWidth = 465
OnShortCut = FormShortCut
OnShow = FormShow
inherited Back: TPanel
Height = 434
Width = 465
@ -20,8 +21,8 @@ inherited CEEditorWidget: TCEEditorWidget
ClientWidth = 465
object editorStatus: TStatusBar[0]
Left = 0
Height = 19
Top = 377
Height = 21
Top = 375
Width = 465
BorderSpacing.Bottom = 2
Panels = <

View File

@ -94,6 +94,7 @@ type
editorStatus: TStatusBar;
mnuEditor: TPopupMenu;
procedure FormShortCut(var Msg: TLMKey; var Handled: Boolean);
procedure FormShow(Sender: TObject);
procedure mnuedDdocTmpClick(Sender: TObject);
procedure mnuedGotolineClick(Sender: TObject);
procedure mnuedNextWarnClick(Sender: TObject);
@ -474,6 +475,7 @@ begin
document.OnCommandProcessed:= @memoCmdProcessed;
//
fDoc := document;
fDoc.Visible:=true;
fDoc.setFocus;
focusedEditorChanged;
updateImperative;
@ -497,6 +499,7 @@ begin
updatePageCaption(pageControl.currentPage);
if document = fDoc then exit;
fDoc := document;
fDoc.Visible:=true;
focusedEditorChanged;
updateImperative;
end;
@ -670,6 +673,7 @@ begin
if fDoc.isNil then exit;
fDoc.hideCallTips;
fDoc.hideDDocs;
fDOc.Visible:=false;
end;
procedure TCEEditorWidget.memoKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
@ -1002,6 +1006,12 @@ begin
end;
end;
procedure TCEEditorWidget.FormShow(Sender: TObject);
begin
if fDoc.isNotNil then
fDoc.Visible:=true;
end;
procedure TCEEditorWidget.mnuedGotolineClick(Sender: TObject);
begin
if fDoc.isNotNil then

View File

@ -1069,8 +1069,6 @@ begin
fAutoCloseCurlyBrace:= autoCloseOnNewLineLexically;
fAutoClosedPairs:= [autoCloseSquareBracket];
application.AddOnDeactivateHandler(@handleModalBeginning);
fDastWorxExename:= exeFullName('dastworx' + exeExt);
fDebugger := EntitiesConnector.getSingleService('ICEDebugger') as ICEDebugger;
@ -1081,7 +1079,6 @@ end;
destructor TCESynMemo.destroy;
begin
application.RemoveOnDeactivateHandler(@handleModalBeginning);
saveCache;
//fIndentGuideMarkup.Free;
@ -1184,6 +1181,8 @@ begin
inherited;
if Value then
begin
application.AddOnDeactivateHandler(@handleModalBeginning);
application.AddOnModalBeginHandler(@handleModalBeginning);
setFocus;
if not fCacheLoaded then
loadCache;
@ -1196,6 +1195,8 @@ begin
fScrollMemo.Visible:=false;
if fCompletion.IsActive then
fCompletion.Deactivate;
application.RemoveOnDeactivateHandler(@handleModalBeginning);
application.RemoveOnModalBeginHandler(@handleModalBeginning);
end;
end;
{$ENDREGION --------------------------------------------------------------------}