* Some fixes after remarks by Martin

This commit is contained in:
Michaël Van Canneyt 2024-09-27 00:08:32 +02:00
parent 623f913154
commit 0079fe5992
3 changed files with 34 additions and 3 deletions

View File

@ -155,6 +155,7 @@ begin
If aFull then
aPanel.ViewFontSize:=InitialViewFontSize;
end;
constructor TMinimapController.Create(aOwner: TComponent);
begin
Inherited;
@ -228,7 +229,6 @@ var
I : Integer;
begin
Writeln('ReconfigurePanels');
For I:=0 to FList.Count-1 do
ConfigPanel(TMiniMapControl(Flist[i]),False);
end;

View File

@ -14,7 +14,7 @@ unit PnlMiniMap;
interface
uses
Classes, SysUtils, Controls, ExtCtrls, SynEdit, SrcEditorIntf, Graphics,
Classes, SysUtils, Controls, ExtCtrls, SynEdit, SrcEditorIntf, Graphics, lclType,
SynEditMarkupSpecialLine, SynEditTypes, SynEditMiscClasses, SynEditMarkupBracket;
Const
@ -62,6 +62,8 @@ Type
implementation
uses SynEditKeyCmds;
{ TMiniMapControl }
procedure TMiniMapControl.HandleLineMarkup(Sender: TObject; Line: integer;
@ -161,6 +163,16 @@ end;
procedure TMiniMapControl.ConfigMiniEdit;
Procedure AddKey(aCommand : TSynEditorCommand; aShortCut : TShortCut);
begin
With FMiniSynEdit.Keystrokes.Add do
begin
Command:=aCommand;
ShortCut:=aShortCut;
end;
end;
var
I : integer;
@ -172,6 +184,7 @@ begin
Align:=alClient;
ParentColor:=False;
ParentFont:=False;
Font.Name := 'Courier New';
Font.Pitch := fpFixed;
Font.Quality := fqNonAntialiased;
@ -199,11 +212,28 @@ begin
LineHighlightColor.Foreground := clNone;
end;
SourceEditorManagerIntf.GetEditorControlSettings(FMiniSynEdit);
// FMiniSynEdit.SelectionMode:=;
FMiniSynEdit.Keystrokes.Clear;
AddKey(ecUp,KeyToShortCut(VK_UP,[]));
AddKey(ecScrollUp,KeyToShortCut(VK_UP,[ssCtrl]));
AddKey(ecDown,KeyToShortCut(VK_DOWN,[ssCtrl]));
AddKey(ecPageDown,KeyToShortCut(VK_NEXT,[]));
AddKey(ecPageBottom,KeyToShortCut(VK_NEXT,[ssCtrl]));
AddKey(ecPageUp,KeyToShortCut(VK_PRIOR,[]));
AddKey(ecPageTop,KeyToShortCut(VK_PRIOR,[ssCtrl]));
AddKey(ecEditorTop,KeyToShortCut(VK_HOME,[]));
AddKey(ecEditorBottom,KeyToShortCut(VK_END,[]));
FMiniSynEdit.Font.Size:=FViewFontSize;
FMiniSynEdit.ReadOnly := True;
FMiniSynEdit.Gutter.Visible := False;
FMiniSynEdit.OnClick := @HandleClick;
FMiniSynEdit.OnSpecialLineMarkup := @HandleLineMarkup;
FMiniSynEdit.Options:=[eoNoCaret,eoNoSelection];
FMiniSynEdit.Options2:=[];
FMiniSynEdit.BookMarkOptions.EnableKeys:=False;
FMiniSynEdit.BookMarkOptions.GlyphsVisible:=False;
FMiniSynEdit.BookMarkOptions.DrawBookmarksFirst:=False;
For I:=0 to FMiniSynEdit.Gutter.Parts.Count-1 do
FMiniSynEdit.Gutter.Parts[I].Visible:=True;
// FMiniSynEdit.Gutter.Parts[4].Visible := False; // code folding disabled.
@ -238,6 +268,7 @@ begin
exit;
FMiniSynedit.UnShareTextBuffer;
FSourceSynEdit.UnRegisterStatusChangedHandler(@HandleStatusChange);
SourceEditorManagerIntf.UnRegisterChangeEvent(semEditorDestroy, @HandleEditorDestroy);
FSourceSynEdit:=nil;
FSourceEditor:=nil;
end;

View File

@ -23,7 +23,7 @@ begin
MiniMapController.ConfigFrame:=TMiniMapConfigFrame;
MiniMapController.LoadConfig;
// add IDE options frame
MiniMapOptionsFrameID:=RegisterIDEOptionsEditor(GroupEnvironment,TMiniMapConfigFrame,
MiniMapOptionsFrameID:=RegisterIDEOptionsEditor(GroupEditor,TMiniMapConfigFrame,
MiniMapOptionsFrameID)^.Index;
end;