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