mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-12 05:36:22 +02:00
* Allow minimap to be located at the left of the source editor
This commit is contained in:
parent
084ed1543f
commit
ed74757921
@ -18,6 +18,7 @@ uses
|
||||
|
||||
const
|
||||
DefaultEnabled = True;
|
||||
DefaultAlignLeft = False;
|
||||
|
||||
type
|
||||
|
||||
@ -25,6 +26,7 @@ type
|
||||
|
||||
TMinimapController = Class(TComponent)
|
||||
private
|
||||
FAlignLeft: Boolean;
|
||||
FConfigFrame: TAbstractIDEOptionsEditorClass;
|
||||
FList: TFPList;
|
||||
FEnabled: Boolean;
|
||||
@ -33,6 +35,7 @@ type
|
||||
FMapWidth: Integer;
|
||||
FViewWindowColor: TColor;
|
||||
FViewWindowTextColor: TColor;
|
||||
procedure SetAlignLeft(AValue: Boolean);
|
||||
procedure SetEnabled(AValue: Boolean);
|
||||
procedure SetInitialViewFontSize(AValue: Integer);
|
||||
procedure SetMapWidth(AValue: Integer);
|
||||
@ -52,6 +55,7 @@ type
|
||||
|
||||
Property Enabled : Boolean Read FEnabled Write SetEnabled;
|
||||
Property MapWidth : Integer Read FMapWidth Write SetMapWidth;
|
||||
Property AlignLeft : Boolean Read FAlignLeft Write SetAlignLeft;
|
||||
Property InitialViewFontSize : Integer Read FInitialViewFontSize Write SetInitialViewFontSize;
|
||||
Property ViewWindowColor : TColor Read FViewWindowColor Write SetViewWindowColor;
|
||||
Property ViewWindowTextColor : TColor Read FViewWindowTextColor Write SetViewWindowTextColor;
|
||||
@ -79,6 +83,13 @@ begin
|
||||
SourceEditorManagerIntf.UnRegisterChangeEvent(semEditorCreate,@NewEditorCreated);
|
||||
end;
|
||||
|
||||
procedure TMinimapController.SetAlignLeft(AValue: Boolean);
|
||||
begin
|
||||
if FAlignLeft=AValue then Exit;
|
||||
FAlignLeft:=AValue;
|
||||
FNeedSave:=True;
|
||||
end;
|
||||
|
||||
procedure TMinimapController.SetInitialViewFontSize(AValue: Integer);
|
||||
begin
|
||||
if FInitialViewFontSize=AValue then Exit;
|
||||
@ -109,6 +120,9 @@ end;
|
||||
|
||||
procedure TMinimapController.NewEditorCreated(Sender: TObject);
|
||||
|
||||
var
|
||||
Aligns : Array[Boolean] of TAlign = (alRight,alLeft);
|
||||
|
||||
var
|
||||
Editor : TSourceEditorInterface absolute Sender;
|
||||
EditorWindow : TSourceEditorWindowInterface;
|
||||
@ -121,7 +135,7 @@ begin
|
||||
Panel.FreeNotification(Self);
|
||||
Panel.SourceEditor:=Editor;
|
||||
ConfigPanel(Panel,True);
|
||||
EditorWindow.AddControlToEditor(Editor,Panel,alRight);
|
||||
EditorWindow.AddControlToEditor(Editor,Panel,Aligns[AlignLeft]);
|
||||
end;
|
||||
|
||||
procedure TMinimapController.Notification(AComponent: TComponent;
|
||||
@ -149,6 +163,7 @@ begin
|
||||
FInitialViewFontSize:=DefaultViewFontSize;
|
||||
FViewWindowColor:=DefaultViewWindowColor;
|
||||
FViewWindowTextColor:=DefaultViewWindowTextColor;
|
||||
FAlignLeft:=DefaultAlignLeft;
|
||||
Enabled:=True;
|
||||
end;
|
||||
|
||||
@ -170,6 +185,7 @@ begin
|
||||
with Storage do
|
||||
try
|
||||
Enabled:=GetValue(KeyEnabled,DefaultEnabled);
|
||||
AlignLeft:=GetValue(KeyAlignLeft,DefaultAlignLeft);
|
||||
MapWidth:=GetValue(KeyWidth,DefaultMapWidth);
|
||||
ViewWindowColor:=GetValue(KeyViewWindowColor,DefaultViewWindowColor);
|
||||
ViewWindowTextColor:=GetValue(KeyViewWindowTextColor,DefaultViewWindowTextColor);
|
||||
@ -188,6 +204,7 @@ begin
|
||||
with Storage do
|
||||
try
|
||||
SetDeleteValue(KeyEnabled,Enabled,DefaultEnabled);
|
||||
SetDeleteValue(KeyAlignLeft,AlignLeft,DefaultAlignLeft);
|
||||
SetDeleteValue(KeyWidth,MapWidth,DefaultMapWidth);
|
||||
SetDeleteValue(KeyViewWindowColor,ViewWindowColor,DefaultViewWindowColor);
|
||||
SetDeleteValue(KeyViewWindowTextColor,ViewWindowTextColor,DefaultViewWindowTextColor);
|
||||
|
@ -26,6 +26,7 @@ type
|
||||
cbViewWindow: TColorBox;
|
||||
cbViewText: TColorBox;
|
||||
CDView: TColorDialog;
|
||||
cbAlignLeft: TCheckBox;
|
||||
lblViewWindowColor: TLabel;
|
||||
lblViewWindowTextColor: TLabel;
|
||||
lblMapWidth: TLabel;
|
||||
@ -67,6 +68,7 @@ var
|
||||
begin
|
||||
C:=MiniMapController;
|
||||
cbEnabled.Checked:=C.Enabled;
|
||||
cbAlignLeft.Checked:=C.AlignLeft;
|
||||
seWidth.Value:=C.MapWidth;
|
||||
seInitialFontSize.Value:=C.InitialViewFontSize;
|
||||
cbViewWindow.Selected:=C.ViewWindowColor;
|
||||
@ -80,6 +82,7 @@ var
|
||||
begin
|
||||
C:=MiniMapController;
|
||||
C.Enabled:=cbEnabled.Checked;
|
||||
C.AlignLeft:=cbAlignLeft.Checked;
|
||||
C.MapWidth:=seWidth.Value;
|
||||
C.InitialViewFontSize:=seInitialFontSize.Value;
|
||||
C.ViewWindowColor:=cbViewWindow.Selected;
|
||||
|
@ -8,6 +8,7 @@ const
|
||||
SConfigFile = 'minimap.xml';
|
||||
|
||||
KeyEnabled = 'Enabled';
|
||||
KeyAlignLeft = 'AlignLeft';
|
||||
KeyWidth = 'Width';
|
||||
KeyViewWindowColor = 'ViewWindowColor';
|
||||
KeyViewWindowTextColor = 'ViewWindowTextColor';
|
||||
|
Loading…
Reference in New Issue
Block a user