From 169c42c2e9bbe74efbcd8204c60540f7f22799c1 Mon Sep 17 00:00:00 2001 From: Basile Burg Date: Mon, 20 Apr 2015 00:59:02 +0200 Subject: [PATCH] fix, synchronized edition broken after a while, due to a shared component. --- src/ce_editor.pas | 19 +------------------ src/ce_synmemo.pas | 21 ++++++++++++++++++--- 2 files changed, 19 insertions(+), 21 deletions(-) diff --git a/src/ce_editor.pas b/src/ce_editor.pas index d45f0b5a..eb55d6f6 100644 --- a/src/ce_editor.pas +++ b/src/ce_editor.pas @@ -36,8 +36,6 @@ type private fKeyChanged: boolean; fDoc: TCESynMemo; - // TODO-cbugfix: syncro-edit partially broken, undetermined condition - fSyncEdit: TSynPluginSyncroEdit; fTokList: TLexTokenList; fErrList: TLexErrorList; fModStart: boolean; @@ -90,25 +88,12 @@ end; {$REGION Standard Comp/Obj------------------------------------------------------} constructor TCEEditorWidget.create(aOwner: TComponent); -var - png: TPortableNetworkGraphic; begin inherited; // fTokList := TLexTokenList.Create; fErrList := TLexErrorList.Create; - // completion.OnPaintItem := @completionItemPaint; - fSyncEdit := TSynPluginSyncroEdit.Create(self); - fSyncEdit.CaseSensitive:=true; - png := TPortableNetworkGraphic.Create; - try - png.LoadFromLazarusResource('link_edit'); - fSyncEdit.GutterGlyph.Assign(png); - finally - png.Free; - end; - // {$IFDEF LINUX} PageControl.OnCloseTabClicked := @pageCloseBtnClick; {$ENDIF} @@ -297,11 +282,9 @@ end; procedure TCEEditorWidget.focusedEditorChanged; begin macRecorder.Clear; - fSyncEdit.Clear; if fDoc = nil then exit; // macRecorder.Editor:= fDoc; - fSyncEdit.Editor := fDoc; completion.Editor := fDoc; if (pageControl.ActivePage.Caption = '') then begin @@ -458,7 +441,7 @@ begin // - editor is saved // - gutter is updated (green bar indicating a saved block) // - syncroedit icon is hidden - if fSyncEdit.Active then + if fDoc.syncroEdit.Active then fDoc.Refresh; end; {$ENDREGION} diff --git a/src/ce_synmemo.pas b/src/ce_synmemo.pas index 01164746..44dadd80 100644 --- a/src/ce_synmemo.pas +++ b/src/ce_synmemo.pas @@ -5,8 +5,8 @@ unit ce_synmemo; interface uses - Classes, SysUtils, controls,lcltype, Forms, graphics, ExtCtrls, crc, - SynEditKeyCmds,LazSynEditText, SynEditHighlighter, SynEdit, SynHighlighterLFM, + Classes, SysUtils, controls,lcltype, Forms, graphics, ExtCtrls, crc, SynPluginSyncroEdit, + SynEditKeyCmds, LazSynEditText, SynEditHighlighter, SynEdit, SynHighlighterLFM, SynEditMouseCmds, SynEditFoldedView, ce_common, ce_observer, ce_writableComponent, ce_d2syn, ce_txtsyn; @@ -22,7 +22,7 @@ type AData: Pointer): TRect; override; end; - // Stores the state of a particulat source code folding. + // Stores the state of a particular source code folding. TCEFoldCache = class(TCollectionItem) private fCollapsed: boolean; @@ -94,6 +94,7 @@ type fHintTimer: TIdleTimer; fCanShowHint: boolean; fOldMousePos: TPoint; + fSyncEdit: TSynPluginSyncroEdit; function getMouseFileBytePos: Integer; procedure changeNotify(Sender: TObject); procedure identifierToD2Syn; @@ -132,6 +133,7 @@ type property modified: boolean read fModified; property tempFilename: string read fTempFileName; // + property syncroEdit: TSynPluginSyncroEdit read fSyncEdit; property isDSource: boolean read fIsDSource; property isProjectSource: boolean read fIsConfig; property TextView; @@ -327,6 +329,8 @@ end; {$REGION TCESynMemo ------------------------------------------------------------} constructor TCESynMemo.Create(aOwner: TComponent); +var + png: TPortableNetworkGraphic; begin inherited; // @@ -348,6 +352,17 @@ begin Gutter.CodeFoldPart.MarkupInfo.Foreground := clGray; BracketMatchColor.Foreground:=clRed; // + fSyncEdit := TSynPluginSyncroEdit.Create(self); + fSyncEdit.Editor := self; + fSyncEdit.CaseSensitive := true; + png := TPortableNetworkGraphic.Create; + try + png.LoadFromLazarusResource('link_edit'); + fSyncEdit.GutterGlyph.Assign(png); + finally + png.Free; + end; + // MouseLinkColor.Style:= [fsUnderline]; with MouseActions.Add do begin Command := emcMouseLink;