fix, synchronized edition broken

after a while, due to a shared component.
This commit is contained in:
Basile Burg 2015-04-20 00:59:02 +02:00
parent 6668c04bd3
commit 169c42c2e9
2 changed files with 19 additions and 21 deletions

View File

@ -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}

View File

@ -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;