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

View File

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

View File

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