mirror of https://gitlab.com/basile.b/dexed.git
added support for MouseLinks: <Ctrl>+Move, <Ctrl>+<mbLeft>, invoke dcd find symbol loc
This commit is contained in:
parent
19c2afe9d9
commit
eb7f061480
|
@ -39,6 +39,7 @@ type
|
|||
procedure memoKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||
procedure memoMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||||
procedure memoChange(Sender: TObject);
|
||||
procedure memoCtrlClick(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||||
procedure memoMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
|
||||
function getEditor(index: NativeInt): TCESynMemo;
|
||||
function getEditorCount: NativeInt;
|
||||
|
@ -194,6 +195,7 @@ begin
|
|||
memo.OnKeyPress := @memoKeyPress;
|
||||
memo.OnMouseDown := @memoMouseDown;
|
||||
memo.OnMouseMove := @memoMouseMove;
|
||||
memo.OnClickLink := @memoCtrlClick;
|
||||
//
|
||||
pageControl.ActivePage := sheet;
|
||||
end;
|
||||
|
@ -241,6 +243,11 @@ procedure TCEEditorWidget.memoChange(Sender: TObject);
|
|||
begin
|
||||
end;
|
||||
|
||||
procedure TCEEditorWidget.memoCtrlClick(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||||
begin
|
||||
getSymbolLoc;
|
||||
end;
|
||||
|
||||
procedure TCEEditorWidget.getSymbolLoc;
|
||||
var
|
||||
str: TMemoryStream;
|
||||
|
@ -263,7 +270,10 @@ begin
|
|||
if fname <> ftempname then if fileExists(fname) then
|
||||
CEMainForm.openFile(fname);
|
||||
if srcpos <> -1 then
|
||||
fDoc.SelStart := srcpos; // fDoc probably not be updated
|
||||
begin
|
||||
fDoc.SelStart := srcpos;
|
||||
fDoc.SelectWord;
|
||||
end;
|
||||
finally
|
||||
str.Free;
|
||||
end;
|
||||
|
|
|
@ -5,9 +5,9 @@ unit ce_synmemo;
|
|||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, SynEdit, SynMemo, ce_d2syn, ce_txtsyn ,SynEditHighlighter,
|
||||
Classes, SysUtils, SynEdit, ce_d2syn, ce_txtsyn ,SynEditHighlighter,
|
||||
controls, lcltype, LazSynEditText, SynEditKeyCmds, SynHighlighterLFM, SynEditMouseCmds,
|
||||
ce_common, ce_observer;
|
||||
ce_common, ce_observer, ce_dcd;
|
||||
|
||||
type
|
||||
|
||||
|
@ -16,16 +16,16 @@ type
|
|||
fPos: Integer;
|
||||
fMax: Integer;
|
||||
fList: TFPList;
|
||||
fMemo: TSynMemo;
|
||||
fMemo: TCustomSynEdit;
|
||||
public
|
||||
constructor create(aMemo: TSynMemo);
|
||||
constructor create(aMemo: TCustomSynEdit);
|
||||
destructor destroy; override;
|
||||
procedure store;
|
||||
procedure back;
|
||||
procedure next;
|
||||
end;
|
||||
|
||||
TCESynMemo = class(TSynMemo)
|
||||
TCESynMemo = class(TSynEdit)
|
||||
private
|
||||
fFilename: string;
|
||||
fModified: boolean;
|
||||
|
@ -78,7 +78,7 @@ uses
|
|||
graphics, ce_interfaces;
|
||||
|
||||
{$REGION TCESynMemoPositions ---------------------------------------------------}
|
||||
constructor TCESynMemoPositions.create(aMemo: TSynMemo);
|
||||
constructor TCESynMemoPositions.create(aMemo: TCustomSynEdit);
|
||||
begin
|
||||
fList := TFPList.Create;
|
||||
fMax := 20;
|
||||
|
@ -95,32 +95,38 @@ end;
|
|||
procedure TCESynMemoPositions.back;
|
||||
begin
|
||||
Inc(fPos);
|
||||
{$WARNINGS OFF}
|
||||
{$HINTS OFF}
|
||||
if fPos < fList.Count then
|
||||
fMemo.CaretY := NativeInt(fList.Items[fPos])
|
||||
{$WARNINGS ON}
|
||||
{$HINTS ON}
|
||||
else Dec(fPos);
|
||||
end;
|
||||
|
||||
procedure TCESynMemoPositions.next;
|
||||
begin
|
||||
Dec(fPos);
|
||||
{$WARNINGS OFF}
|
||||
{$HINTS OFF}
|
||||
if fPos > -1 then
|
||||
fMemo.CaretY := NativeInt(fList.Items[fPos])
|
||||
{$WARNINGS ON}
|
||||
{$HINTS ON}
|
||||
else Inc(fPos);
|
||||
end;
|
||||
|
||||
procedure TCESynMemoPositions.store;
|
||||
var
|
||||
delta: NativeInt;
|
||||
const
|
||||
thresh = 6;
|
||||
begin
|
||||
fPos := 0;
|
||||
{$WARNINGS OFF}
|
||||
{$HINTS OFF}{$WARNINGS OFF}
|
||||
if fList.Count > 0 then
|
||||
if NativeInt(fList.Items[fPos]) = fMemo.CaretY then
|
||||
exit;
|
||||
begin
|
||||
delta := fMemo.CaretY - NativeInt(fList.Items[fPos]);
|
||||
if (delta > -thresh) and (delta < thresh) then exit;
|
||||
end;
|
||||
fList.Insert(0, Pointer(NativeInt(fMemo.CaretY)));
|
||||
{$WARNINGS ON}
|
||||
{$HINTS ON}{$WARNINGS ON}
|
||||
while fList.Count > fMax do
|
||||
fList.Delete(fList.Count-1);
|
||||
end;
|
||||
|
@ -144,7 +150,7 @@ begin
|
|||
fStoredFontSize := Font.Size;
|
||||
|
||||
MouseOptions := MouseOptions +
|
||||
[emAltSetsColumnMode, emDragDropEditing, emCtrlWheelZoom];
|
||||
[emAltSetsColumnMode, emDragDropEditing, emCtrlWheelZoom, emShowCtrlMouseLinks];
|
||||
Gutter.LineNumberPart.ShowOnlyLineNumbersMultiplesOf := 5;
|
||||
Gutter.LineNumberPart.MarkupInfo.Foreground := clGray;
|
||||
Gutter.SeparatorPart.LineOffset := 1;
|
||||
|
@ -152,6 +158,13 @@ begin
|
|||
Gutter.SeparatorPart.MarkupInfo.Foreground := clGray;
|
||||
Gutter.CodeFoldPart.MarkupInfo.Foreground := clGray;
|
||||
//
|
||||
MouseLinkColor.Style:= [fsUnderline];
|
||||
with MouseActions.Add do begin
|
||||
Command := emcMouseLink;
|
||||
shift := [ssCtrl];
|
||||
ShiftMask := [ssCtrl];
|
||||
end;
|
||||
//
|
||||
Highlighter := D2Syn;
|
||||
D2Syn.FoldKinds := [fkBrackets, fkComments1, fkComments2, fkStrings];
|
||||
//
|
||||
|
|
Loading…
Reference in New Issue