mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-11 09:39:11 +02:00
IDE: Configurable IDE toolbars. Issue #27603, patch from Balázs Székely.
git-svn-id: trunk@48246 -
This commit is contained in:
parent
0074f7e9ab
commit
af15b183a7
@ -228,6 +228,7 @@ const
|
||||
EnvOptionsFiles = 100;
|
||||
EnvOptionsDesktop = 200;
|
||||
EnvOptionsWindow = 300;
|
||||
EnvOptionsToolbar = 325;
|
||||
EnvOptionsCompPalette = 350;
|
||||
EnvOptionsFormEd = 400;
|
||||
EnvOptionsOI = 500;
|
||||
|
@ -273,7 +273,6 @@ type
|
||||
FIDENameForDesignedFormList: boolean;
|
||||
|
||||
// main buttons
|
||||
FIDESpeedButtonsVisible: boolean;
|
||||
FShowButtonGlyphs: TApplicationShowGlyphs;
|
||||
FShowMenuGlyphs: TApplicationShowGlyphs;
|
||||
|
||||
@ -292,6 +291,17 @@ type
|
||||
FCompletionWindowWidth: Integer;
|
||||
FCompletionWindowHeight: Integer;
|
||||
|
||||
//toolbars
|
||||
FToolbarVisible: Boolean;
|
||||
FToolBarStandardVisible: Boolean;
|
||||
FToolBarStandardLeft: Integer;
|
||||
FToolBarStandardTop: Integer;
|
||||
FToolBarViewDebugVisible: Boolean;
|
||||
FToolBarViewDebugLeft: Integer;
|
||||
FToolBarViewDebugTop: Integer;
|
||||
FToolBarHighlight: Boolean;
|
||||
FToolBarRaised: Boolean;
|
||||
|
||||
// component palette
|
||||
FComponentPaletteOptions: TCompPaletteOptions;
|
||||
|
||||
@ -513,9 +523,6 @@ type
|
||||
write FIDEProjectDirectoryInIdeTitle;
|
||||
property ComponentPaletteVisible: boolean read FComponentPaletteVisible
|
||||
write FComponentPaletteVisible;
|
||||
property IDESpeedButtonsVisible: boolean read FIDESpeedButtonsVisible
|
||||
write FIDESpeedButtonsVisible;
|
||||
|
||||
property CompletionWindowWidth: Integer read FCompletionWindowWidth
|
||||
write FCompletionWindowWidth;
|
||||
property CompletionWindowHeight: Integer read FCompletionWindowHeight
|
||||
@ -524,6 +531,27 @@ type
|
||||
// window menu list
|
||||
property IDENameForDesignedFormList: boolean read FIDENameForDesignedFormList
|
||||
write FIDENameForDesignedFormList;
|
||||
|
||||
//toolbars option
|
||||
property ToolbarVisible: boolean read FToolbarVisible
|
||||
write FToolbarVisible;
|
||||
property ToolBarStandardVisible: Boolean read FToolBarStandardVisible
|
||||
write FToolBarStandardVisible;
|
||||
property ToolBarStandardLeft: Integer read FToolBarStandardLeft
|
||||
write FToolBarStandardLeft;
|
||||
property ToolBarStandardTop: Integer read FToolBarStandardTop
|
||||
write FToolBarStandardTop;
|
||||
property ToolBarViewDebugVisible: Boolean read FToolBarViewDebugVisible
|
||||
write FToolBarViewDebugVisible;
|
||||
property ToolBarViewDebugLeft: Integer read FToolBarViewDebugLeft
|
||||
write FToolBarViewDebugLeft;
|
||||
property ToolBarViewDebugTop: Integer read FToolBarViewDebugTop
|
||||
write FToolBarViewDebugTop;
|
||||
property ToolBarHighlight: Boolean read FToolBarHighlight
|
||||
write FToolBarHighlight;
|
||||
property ToolBarRaised: Boolean read FToolBarRaised
|
||||
write FToolBarRaised;
|
||||
|
||||
// component palette
|
||||
property ComponentPaletteOptions: TCompPaletteOptions read FComponentPaletteOptions;
|
||||
|
||||
@ -866,7 +894,6 @@ begin
|
||||
FIDETitleIncludesBuildMode:=false;
|
||||
FIDEProjectDirectoryInIdeTitle:=false;
|
||||
FComponentPaletteVisible:=true;
|
||||
FIDESpeedButtonsVisible:=true;
|
||||
|
||||
// window menu
|
||||
FIDENameForDesignedFormList:=false;
|
||||
@ -899,6 +926,16 @@ begin
|
||||
FCompletionWindowWidth := 320;
|
||||
FCompletionWindowHeight := 6;
|
||||
|
||||
FToolbarVisible := False;
|
||||
FToolBarStandardVisible := False;
|
||||
FToolBarStandardLeft := 0;
|
||||
FToolBarStandardTop := 0;
|
||||
FToolBarViewDebugVisible := False;
|
||||
FToolBarViewDebugLeft := 0;
|
||||
FToolBarViewDebugTop := 26;
|
||||
FToolBarHighlight := False;
|
||||
FToolBarRaised := False;
|
||||
|
||||
// component palette
|
||||
FComponentPaletteOptions:=TCompPaletteOptions.Create;
|
||||
|
||||
@ -1187,8 +1224,6 @@ begin
|
||||
Path+'Desktop/IDEProjectDirectoryInIdeTitle/Value',false);
|
||||
FComponentPaletteVisible:=XMLConfig.GetValue(
|
||||
Path+'Desktop/ComponentPaletteVisible/Value',true);
|
||||
FIDESpeedButtonsVisible:=XMLConfig.GetValue(
|
||||
Path+'Desktop/IDESpeedButtonsVisible/Value',true);
|
||||
FCompletionWindowWidth:=XMLConfig.GetValue(
|
||||
Path+'Desktop/CompletionWindowWidth/Value', 320);
|
||||
FCompletionWindowHeight:=XMLConfig.GetValue(
|
||||
@ -1198,6 +1233,28 @@ begin
|
||||
FIDENameForDesignedFormList:=XMLConfig.GetValue(
|
||||
Path+'Desktop/IDENameForDesignedFormList/Value',false);
|
||||
|
||||
// Toolbar
|
||||
FToolBarStandardVisible := XMLConfig.GetValue(
|
||||
Path+'Desktop/Toolbars/Standarad/ToolBarStandardVisible/Value', True);
|
||||
FToolBarStandardLeft := XMLConfig.GetValue(
|
||||
Path+'Desktop/Toolbars/Standarad/ToolBarStandardLeft/Value', 0);
|
||||
FToolBarStandardTop := XMLConfig.GetValue(
|
||||
Path+'Desktop/Toolbars/Standarad/ToolBarStandardTop/Value', 0);
|
||||
|
||||
FToolBarViewDebugVisible :=XMLConfig.GetValue(
|
||||
Path+'Desktop/Toolbars/ViewDebug/ToolBarViewDebugVisible/Value', True);
|
||||
FToolBarViewDebugLeft := XMLConfig.GetValue(
|
||||
Path+'Desktop/Toolbars/Standarad/ToolBarViewDebugLeft/Value', 0);
|
||||
FToolBarViewDebugTop := XMLConfig.GetValue(
|
||||
Path+'Desktop/Toolbars/Standarad/ToolBarViewDebugTop/Value', 26);
|
||||
|
||||
FToolbarVisible := XMLConfig.GetValue(
|
||||
Path+'Desktop/Toolbars/Common/ToolbarVisible/Value', True);
|
||||
FToolBarHighlight := XMLConfig.GetValue(
|
||||
Path+'Desktop/Toolbars/Common/ToolBarHighlight/Value', False);
|
||||
FToolBarRaised := XMLConfig.GetValue(
|
||||
Path+'Desktop/Toolbars/Common/ToolBarRaised/Value', False);
|
||||
|
||||
// form editor
|
||||
FShowGrid:=XMLConfig.GetValue(
|
||||
Path+'FormEditor/ShowGrid',true);
|
||||
@ -1572,8 +1629,6 @@ begin
|
||||
FIDEProjectDirectoryInIdeTitle,false);
|
||||
XMLConfig.SetDeleteValue(Path+'Desktop/ComponentPaletteVisible/Value',
|
||||
FComponentPaletteVisible,true);
|
||||
XMLConfig.SetDeleteValue(Path+'Desktop/IDESpeedButtonsVisible/Value',
|
||||
FIDESpeedButtonsVisible,true);
|
||||
XMLConfig.SetDeleteValue(Path+'Desktop/CompletionWindowWidth/Value',
|
||||
FCompletionWindowWidth, 320);
|
||||
XMLConfig.SetDeleteValue(Path+'Desktop/CompletionWindowHeight/Value',
|
||||
@ -1582,6 +1637,29 @@ begin
|
||||
// Window menu
|
||||
XMLConfig.SetDeleteValue(Path+'Desktop/IDENameForDesignedFormList/Value',
|
||||
FIDENameForDesignedFormList,false);
|
||||
|
||||
// toolbar
|
||||
XMLConfig.SetDeleteValue(Path+'Desktop/Toolbars/Standarad/ToolBarStandardVisible/Value',
|
||||
FToolBarStandardVisible, True);
|
||||
XMLConfig.SetDeleteValue(Path+'Desktop/Toolbars/Standarad/ToolBarStandardLeft/Value',
|
||||
FToolBarStandardLeft, 0);
|
||||
XMLConfig.SetDeleteValue(Path+'Desktop/Toolbars/Standarad/ToolBarStandardTop/Value',
|
||||
FToolBarStandardTop, 0);
|
||||
|
||||
XMLConfig.SetDeleteValue(Path+'Desktop/Toolbars/ViewDebug/ToolBarViewDebugVisible/Value',
|
||||
FToolBarViewDebugVisible, True);
|
||||
XMLConfig.SetDeleteValue(Path+'Desktop/Toolbars/Standarad/ToolBarViewDebugLeft/Value',
|
||||
FToolBarViewDebugLeft, 0);
|
||||
XMLConfig.SetDeleteValue(Path+'Desktop/Toolbars/Standarad/ToolBarViewDebugTop/Value',
|
||||
FToolBarViewDebugTop, 26);
|
||||
|
||||
XMLConfig.SetDeleteValue(Path+'Desktop/Toolbars/Common/ToolbarVisible/Value',
|
||||
FToolbarVisible, True);
|
||||
XMLConfig.SetDeleteValue(Path+'Desktop/Toolbars/Common/ToolBarHighlight/Value',
|
||||
FToolBarHighlight, False);
|
||||
XMLConfig.SetDeleteValue(Path+'Desktop/Toolbars/Common/ToolBarRaised/Value',
|
||||
FToolBarRaised, False);
|
||||
|
||||
// form editor
|
||||
XMLConfig.SetDeleteValue(Path+'FormEditor/ShowBorderSpacing',
|
||||
FShowBorderSpacing,false);
|
||||
|
@ -5715,6 +5715,15 @@ resourcestring
|
||||
lisUnableToCreateNewFileBecauseThereIsAlreadyADirecto = 'Unable to create '
|
||||
+'new file, because there is already a directory with this name.';
|
||||
|
||||
//Toolbar options
|
||||
lisToolbarOptions = 'Toolbar Options';
|
||||
lisToolbarOptionsToolbarsVisible = 'Toolbars visible';
|
||||
lisToolbarOptionsStandardVisible = 'Standard toolbar visible';
|
||||
lisToolbarOptionsViewDebugVisible = 'Debug toolbar visible';
|
||||
lisToolbarOptionsHighLight = 'Highlight toolbars buttons';
|
||||
lisToolbarOptionsRaise = 'Raise toolbars';
|
||||
miToolbar = 'Options';
|
||||
|
||||
// File Filters - Environment options
|
||||
lisFileFiltersTitle ='These are file filters that will appear in all File Open dialogs';
|
||||
lisFileFilters = 'File Filters';
|
||||
|
149
ide/main.pp
149
ide/main.pp
@ -114,7 +114,7 @@ uses
|
||||
// environment option frames
|
||||
editor_general_options, componentpalette_options, formed_options, OI_options,
|
||||
MsgWnd_Options, files_options, desktop_options, window_options,
|
||||
Backup_Options, naming_options, fpdoc_options,
|
||||
Backup_Options, naming_options, fpdoc_options, toolbar_options,
|
||||
editor_display_options, editor_keymapping_options, editor_mouseaction_options,
|
||||
editor_mouseaction_options_advanced, editor_color_options, editor_markup_options,
|
||||
editor_markup_userdefined, editor_codetools_options, editor_codefolding_options,
|
||||
@ -155,7 +155,7 @@ uses
|
||||
UseUnitDlg, FindOverloadsDlg, EditorFileManager,
|
||||
CleanDirDlg, CodeContextForm, AboutFrm, CompatibilityRestrictions,
|
||||
RestrictionBrowser, ProjectWizardDlg, IDECmdLine, IDEGuiCmdLine, CodeExplOpts,
|
||||
EditorMacroListViewer, SourceFileManager,
|
||||
EditorMacroListViewer, SourceFileManager, ToolWin,
|
||||
// main ide
|
||||
MainBar, MainIntf, MainBase;
|
||||
|
||||
@ -388,6 +388,7 @@ type
|
||||
procedure SetBuildModePopupMenuPopup(Sender: TObject);
|
||||
procedure mnuChgBuildModeClicked(Sender: TObject);
|
||||
procedure mnuSetBuildModeClick(Sender: TObject); // event for drop down items
|
||||
procedure ToolBarOptionsClick(Sender: TObject);
|
||||
private
|
||||
fBuilder: TLazarusBuilder;
|
||||
procedure AllowCompilation(aAllow: Boolean);
|
||||
@ -2024,19 +2025,10 @@ procedure TMainIDE.SetupSpeedButtons;
|
||||
end;
|
||||
end;
|
||||
|
||||
function CreateToolBar(AName: String): TToolBar;
|
||||
begin
|
||||
Result := TToolBar.Create(OwningComponent);
|
||||
Result.Name := AName;
|
||||
Result.Parent := MainIDEBar.pnlSpeedButtons;
|
||||
Result.Images := IDEImages.Images_16;
|
||||
Result.AutoSize := true;
|
||||
end;
|
||||
|
||||
begin
|
||||
// Panel for buttons on the left
|
||||
MainIDEBar.pnlSpeedButtons := TPanel.Create(OwningComponent);
|
||||
with MainIDEBar.pnlSpeedButtons do
|
||||
with MainIDEBar.pnlSpeedButtons do
|
||||
begin
|
||||
Name := 'pnlSpeedButtons';
|
||||
Parent := MainIDEBar;
|
||||
@ -2044,12 +2036,48 @@ begin
|
||||
Caption := '';
|
||||
BevelOuter := bvNone;
|
||||
AutoSize := true;
|
||||
Visible := EnvironmentOptions.IDESpeedButtonsVisible;
|
||||
Visible := EnvironmentOptions.ToolbarVisible;
|
||||
OnMouseDown := @MainIDEBar.pnlSpeedButtonsMouseDown;
|
||||
Constraints.MinWidth := 5;
|
||||
end;
|
||||
|
||||
MainIDEBar.tbViewDebug := CreateToolBar('tbViewDebug');
|
||||
MainIDEBar.tbStandard := CreateToolBar('tbStandard');
|
||||
//panel for Standar toolbar
|
||||
MainIDEBar.pnStandard := TPanel.Create(OwningComponent);
|
||||
with MainIDEBar.pnStandard do
|
||||
begin
|
||||
Name := 'pnStandard';
|
||||
Parent := MainIDEBar.pnlSpeedButtons;
|
||||
Align := alNone;
|
||||
Left := EnvironmentOptions.ToolBarStandardLeft;
|
||||
Top := EnvironmentOptions.ToolBarStandardTop;
|
||||
Height := 25;
|
||||
Constraints.MaxHeight := 25;
|
||||
Caption := '';
|
||||
if EnvironmentOptions.ToolBarRaised then
|
||||
BevelOuter := bvRaised
|
||||
else
|
||||
BevelOuter := bvNone;
|
||||
AutoSize := True;
|
||||
DoubleBuffered := True;
|
||||
Visible := EnvironmentOptions.ToolBarStandardVisible;
|
||||
if Visible then
|
||||
MainIDEBar.ToolBarsVisibleCount := MainIDEBar.ToolBarsVisibleCount + 1;
|
||||
end;
|
||||
|
||||
//Standard toolbar
|
||||
MainIDEBar.tbStandard := TToolBar.Create(OwningComponent);
|
||||
with MainIDEBar.tbStandard do
|
||||
begin
|
||||
Name := 'tbStandard';
|
||||
Parent := MainIDEBar.pnStandard;
|
||||
Align := alClient;
|
||||
Flat := not EnvironmentOptions.ToolBarHighlight;
|
||||
EdgeBorders := EdgeBorders - [ebTop];
|
||||
Images := IDEImages.Images_16;
|
||||
AutoSize := True;
|
||||
end;
|
||||
|
||||
//buttons for standard toolbar
|
||||
MainIDEBar.NewUnitSpeedBtn := CreateButton(MainIDEBar.tbStandard , 'NewUnitSpeedBtn' , 'item_unit' , @mnuNewUnitClicked, lisMenuNewUnit);
|
||||
MainIDEBar.NewFormSpeedBtn := CreateButton(MainIDEBar.tbStandard , 'NewFormSpeedBtn' , 'item_form' , @mnuNewFormClicked, lisMenuNewForm);
|
||||
MainIDEBar.tbDivider1 := CreateDivider(MainIDEBar.tbStandard);
|
||||
@ -2059,6 +2087,58 @@ begin
|
||||
MainIDEBar.tbDivider2 := CreateDivider(MainIDEBar.tbStandard);
|
||||
MainIDEBar.ToggleFormSpeedBtn := CreateButton(MainIDEBar.tbStandard , 'ToggleFormSpeedBtn' , 'menu_view_toggle_form_unit', @mnuToggleFormUnitCLicked, lisHintToggleFormUnit);
|
||||
|
||||
//splitter for Standard toolbar
|
||||
MainIDEBar.spStandard := TSplitterEx.Create(OwningComponent);
|
||||
with MainIDEBar.spStandard do
|
||||
begin
|
||||
Name := 'spStandard';
|
||||
Parent := MainIDEBar.pnStandard;
|
||||
Align := alLeft;
|
||||
ResizeStyle := rsNone;
|
||||
Cursor := crDefault;
|
||||
DoubleBuffered := True;
|
||||
OnMouseDown := @MainIDEBar.SplitterMouseDown;
|
||||
OnMouseMove := @MainIDEBar.SplitterMouseMove;
|
||||
OnMouseUp := @MainIDEBar.SplitterMouseUp;
|
||||
end;
|
||||
|
||||
|
||||
//panel for ViewDebug toolbar
|
||||
MainIDEBar.pnViewDebug := TPanel.Create(OwningComponent);
|
||||
with MainIDEBar.pnViewDebug do
|
||||
begin
|
||||
Name := 'pnViewDebug';
|
||||
Parent := MainIDEBar.pnlSpeedButtons;
|
||||
Align := alNone;
|
||||
Left := EnvironmentOptions.ToolBarViewDebugLeft;
|
||||
Top := EnvironmentOptions.ToolBarViewDebugTop;
|
||||
Height := 25;
|
||||
Constraints.MaxHeight := 25;
|
||||
Caption := '';
|
||||
if EnvironmentOptions.ToolBarRaised then
|
||||
BevelOuter := bvRaised
|
||||
else
|
||||
BevelOuter := bvNone;
|
||||
AutoSize := True;
|
||||
DoubleBuffered := True;
|
||||
Visible := EnvironmentOptions.ToolBarViewDebugVisible;
|
||||
if Visible then
|
||||
MainIDEBar.ToolBarsVisibleCount := MainIDEBar.ToolBarsVisibleCount + 1;
|
||||
end;
|
||||
|
||||
//ViewDebug toolbar
|
||||
MainIDEBar.tbViewDebug := TToolBar.Create(OwningComponent);
|
||||
with MainIDEBar.tbViewDebug do
|
||||
begin
|
||||
Name := 'tbViewDebug';
|
||||
Parent := MainIDEBar.pnViewDebug;
|
||||
Align := alClient;
|
||||
Flat := not EnvironmentOptions.ToolBarHighlight;
|
||||
EdgeBorders := EdgeBorders - [ebTop];
|
||||
Images := IDEImages.Images_16;
|
||||
AutoSize := True;
|
||||
end;
|
||||
|
||||
MainIDEBar.ViewUnitsSpeedBtn := CreateButton(MainIDEBar.tbViewDebug, 'ViewUnitsSpeedBtn' , 'menu_view_units' , @mnuViewUnitsClicked, lisHintViewUnits);
|
||||
MainIDEBar.ViewFormsSpeedBtn := CreateButton(MainIDEBar.tbViewDebug, 'ViewFormsSpeedBtn' , 'menu_view_forms' , @mnuViewFormsClicked, lisHintViewForms);
|
||||
MainIDEBar.tbDivider3 := CreateDivider(MainIDEBar.tbViewDebug);
|
||||
@ -2070,6 +2150,38 @@ begin
|
||||
MainIDEBar.StepOverSpeedButton := CreateButton(MainIDEBar.tbViewDebug, 'StepOverpeedButton' , 'menu_stepover' , @mnuStepOverProjectClicked, lisHintStepOver);
|
||||
MainIDEBar.StepOutSpeedButton := CreateButton(MainIDEBar.tbViewDebug, 'StepOutSpeedButton' , 'menu_stepout' , @mnuStepOutProjectClicked, lisHintStepOut);
|
||||
|
||||
//splitter for ViewDebug toolbar
|
||||
MainIDEBar.spViewDebug := TSplitterEx.Create(OwningComponent);
|
||||
with MainIDEBar.spViewDebug do
|
||||
begin
|
||||
Name := 'spViewDebug';
|
||||
Parent := MainIDEBar.pnViewDebug;
|
||||
Align := alLeft;
|
||||
ResizeStyle := rsNone;
|
||||
Cursor := crDefault;
|
||||
DoubleBuffered := True;
|
||||
OnMouseDown := @MainIDEBar.SplitterMouseDown;
|
||||
OnMouseMove := @MainIDEBar.SplitterMouseMove;
|
||||
OnMouseUp := @MainIDEBar.SplitterMouseUp;
|
||||
end;
|
||||
|
||||
MainIDEBar.pmOptions := TPopupMenu.Create(OwningComponent);
|
||||
MainIDEBar.pmOptions.Images := IDEImages.Images_16;
|
||||
MainIDEBar.miOptions := TMenuItem.Create(OwningComponent);
|
||||
with MainIDEBar.miOptions do
|
||||
begin
|
||||
Name := 'miToolbarOption';
|
||||
Caption := miToolbar;
|
||||
OnClick := @ToolBarOptionsClick;
|
||||
Enabled := True;
|
||||
Visible := True;
|
||||
ImageIndex := IDEImages.LoadImage(16, 'menu_environment_options');
|
||||
end;
|
||||
MainIDEBar.pmOptions.Items.Add(MainIDEBar.miOptions);
|
||||
MainIDEBar.spStandard.PopupMenu := MainIDEBar.pmOptions;
|
||||
MainIDEBar.spViewDebug.PopupMenu := MainIDEBar.pmOptions;
|
||||
MainIDEBar.pnlSpeedButtons.PopupMenu := MainIDEBar.pmOptions;
|
||||
|
||||
MainIDEBar.CreatePopupMenus(OwningComponent);
|
||||
|
||||
MainIDEBar.OpenFileSpeedBtn.Style := tbsDropDown;
|
||||
@ -3757,7 +3869,7 @@ begin
|
||||
SpeedButtonsVisible:=not MainIDEBar.pnlSpeedButtons.Visible;
|
||||
MainIDEBar.itmViewIDESpeedButtons.Checked:=SpeedButtonsVisible;
|
||||
MainIDEBar.pnlSpeedButtons.Visible:=SpeedButtonsVisible;
|
||||
EnvironmentOptions.IDESpeedButtonsVisible:=MainIDEBar.pnlSpeedButtons.Visible;
|
||||
EnvironmentOptions.ToolbarVisible := MainIDEBar.pnlSpeedButtons.Visible;
|
||||
end;
|
||||
|
||||
procedure TMainIDE.AllowCompilation(aAllow: Boolean);
|
||||
@ -12745,6 +12857,11 @@ begin
|
||||
DoFindDeclarationAtCursor;
|
||||
end;
|
||||
|
||||
procedure TMainIDE.ToolBarOptionsClick(Sender: TObject);
|
||||
begin
|
||||
DoOpenIDEOptions(TToolbarOptionsFrame, '', [], []);
|
||||
end;
|
||||
|
||||
|
||||
initialization
|
||||
{$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('main.pp: initialization');{$ENDIF}
|
||||
|
152
ide/mainbar.pas
152
ide/mainbar.pas
@ -47,6 +47,14 @@ uses
|
||||
type
|
||||
{ TMainIDEBar }
|
||||
|
||||
TSplitterEx = class(TSplitter)
|
||||
published
|
||||
property OnMouseDown;
|
||||
property OnMouseMove;
|
||||
property OnMouseUp;
|
||||
property OnDblClick;
|
||||
end;
|
||||
|
||||
TMainIDEBar = class(TForm)
|
||||
|
||||
// the speedbuttons panel for frequently used IDE functions
|
||||
@ -73,6 +81,12 @@ type
|
||||
StepIntoSpeedButton : TToolButton;
|
||||
StepOverSpeedButton : TToolButton;
|
||||
StepOutSpeedButton : TToolButton;
|
||||
pnStandard: TPanel;
|
||||
spStandard: TSplitterEx;
|
||||
pnViewDebug: TPanel;
|
||||
spViewDebug: TSplitterEx;
|
||||
pmOptions: TPopupMenu;
|
||||
miOptions: TMenuItem;
|
||||
|
||||
NewUnitFormPopupMenu : TPopupMenu;
|
||||
NewUFSetDefaultMenuItem: TMenuItem;
|
||||
@ -376,21 +390,36 @@ type
|
||||
GlobalMouseSpeedButton: TSpeedButton;
|
||||
procedure MainIDEBarDropFiles(Sender: TObject;
|
||||
const FileNames: array of String);
|
||||
procedure SplitterMouseDown(Sender: TObject; Button: TMouseButton;
|
||||
Shift: TShiftState; X, Y: Integer);
|
||||
procedure SplitterMouseUp(Sender: TObject; Button: TMouseButton;
|
||||
Shift: TShiftState; X, Y: Integer);
|
||||
procedure SplitterMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
|
||||
procedure pnlSpeedButtonsMouseDown(Sender: TObject; Button: TMouseButton;
|
||||
Shift: TShiftState; X, Y: Integer);
|
||||
private
|
||||
FOldWindowState: TWindowState;
|
||||
FOnActive: TNotifyEvent;
|
||||
FToolBarsVisibleCount: Integer;
|
||||
FdX, FdY: Integer;
|
||||
FDragging: Boolean;
|
||||
procedure NewUFDefaultClick(Sender: TObject);
|
||||
procedure NewUnitFormPopupMenuPopup(Sender: TObject);
|
||||
procedure SortToolbars(var Row: array of TPanel);
|
||||
procedure SetPosition(var Row: array of TPanel; const PanelTop: Integer);
|
||||
protected
|
||||
procedure DoActive;
|
||||
procedure WndProc(var Message: TLMessage); override;
|
||||
public
|
||||
property ToolBarsVisibleCount: Integer read FToolBarsVisibleCount
|
||||
write FToolBarsVisibleCount;
|
||||
constructor Create(TheOwner: TComponent); override;
|
||||
procedure HideIDE;
|
||||
procedure UnhideIDE;
|
||||
procedure CreatePopupMenus(TheOwner: TComponent);
|
||||
property OnActive: TNotifyEvent read FOnActive write FOnActive;
|
||||
procedure UpdateDockCaption({%H-}Exclude: TControl); override;
|
||||
procedure SetToolbarsPositions;
|
||||
end;
|
||||
|
||||
var
|
||||
@ -537,5 +566,128 @@ begin
|
||||
NewUnitFormPopupMenu.Items.Add(NewUFSetDefaultMenuItem);
|
||||
end;
|
||||
|
||||
procedure TMainIDEBar.SplitterMouseDown(Sender: TObject; Button: TMouseButton;
|
||||
Shift: TShiftState; X, Y: Integer);
|
||||
begin
|
||||
if Button = mbLeft then
|
||||
begin
|
||||
if ToolBarsVisibleCount <= 1 then
|
||||
Exit;
|
||||
(Sender as TSplitterEx).Cursor := crDrag;
|
||||
(Sender as TSplitterEx).Parent.BringToFront;
|
||||
FdX := X;
|
||||
FdY := Y;
|
||||
FDragging := True;
|
||||
end;
|
||||
if Button = mbRight then
|
||||
pmOptions.PopUp;
|
||||
end;
|
||||
|
||||
procedure TMainIDEBar.SplitterMouseMove(Sender: TObject; Shift: TShiftState; X,
|
||||
Y: Integer);
|
||||
begin
|
||||
if FDragging then
|
||||
begin
|
||||
with ((Sender as TSplitterEx).Parent as TControl) do
|
||||
begin
|
||||
Left := X - FdX + Left;
|
||||
Top := Y - FdY + Top;
|
||||
if (X - FdX + Left >= -5) and (X - FdX + Left <= pnlSpeedButtons.Width - 100) and
|
||||
(Y - FdY + Top >= -5) and (X - FdY + Top <= pnlSpeedButtons.Height) then
|
||||
begin
|
||||
(Sender as TSplitterEx).Cursor := crDrag;
|
||||
pnlSpeedButtons.AutoSize := True;
|
||||
end
|
||||
else
|
||||
begin
|
||||
(Sender as TSplitterEx).Cursor := crNoDrop;
|
||||
pnlSpeedButtons.AutoSize := False;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainIDEBar.SplitterMouseUp(Sender: TObject; Button: TMouseButton;
|
||||
Shift: TShiftState; X, Y: Integer);
|
||||
begin
|
||||
if FDragging then
|
||||
begin
|
||||
FDragging := False;
|
||||
SetToolbarsPositions;
|
||||
pnlSpeedButtons.AutoSize := True;
|
||||
(Sender as TSplitterEx).Cursor := crDefault;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainIDEBar.pnlSpeedButtonsMouseDown(Sender: TObject;
|
||||
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||||
begin
|
||||
if Button = mbRight then
|
||||
pmOptions.PopUp;
|
||||
end;
|
||||
|
||||
procedure TMainIDEBar.SortToolbars(var Row: array of TPanel);
|
||||
var
|
||||
I: Integer;
|
||||
begin
|
||||
for I := Low(Row) to High(Row) do
|
||||
begin
|
||||
(Row[I] as TPanel).Top := Top;
|
||||
if I = 0 then
|
||||
(Row[I] as TPanel).Left := 0
|
||||
else
|
||||
(Row[I] as TPanel).Left := (Row[I - 1] as TPanel).Left + (Row[I - 1] as TPanel).Width + 1;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainIDEBar.SetPosition(var Row: array of TPanel; const PanelTop: Integer);
|
||||
var
|
||||
I: Integer;
|
||||
begin
|
||||
for I := Low(Row) to High(Row) do
|
||||
begin
|
||||
(Row[I] as TPanel).Top := PanelTop;
|
||||
if I = 0 then
|
||||
(Row[I] as TPanel).Left := 0
|
||||
else
|
||||
(Row[I] as TPanel).Left := (Row[I - 1] as TPanel).Left + (Row[I - 1] as TPanel).Width + 1;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainIDEBar.SetToolbarsPositions;
|
||||
var
|
||||
I: Integer;
|
||||
Len: Integer;
|
||||
TopRow, BottomRow: array of TPanel;
|
||||
begin
|
||||
TopRow := nil;
|
||||
BottomRow := nil;
|
||||
for I := 0 to pnlSpeedButtons.ControlCount - 1 do
|
||||
begin
|
||||
if not (pnlSpeedButtons.Controls[I] is TPanel) then
|
||||
Continue;
|
||||
if pnlSpeedButtons.Controls[I].Top <= pnlSpeedButtons.Controls[I].Height div 2 then
|
||||
begin
|
||||
Len := Length(TopRow);
|
||||
SetLength(TopRow, Len + 1);
|
||||
TopRow[Len] := (pnlSpeedButtons.Controls[I] as TPanel);
|
||||
end
|
||||
else
|
||||
begin
|
||||
Len := Length(BottomRow);
|
||||
SetLength(BottomRow, Len + 1);
|
||||
BottomRow[Len] := (pnlSpeedButtons.Controls[I] as TPanel);
|
||||
end
|
||||
end;
|
||||
SortToolbars(TopRow);
|
||||
SortToolbars(BottomRow);
|
||||
SetPosition(TopRow, 0);
|
||||
SetPosition(BottomRow, 26);
|
||||
EnvironmentOptions.ToolBarStandardLeft := pnStandard.Left;
|
||||
EnvironmentOptions.ToolBarStandardTop := pnStandard.Top;
|
||||
EnvironmentOptions.ToolBarViewDebugLeft := pnViewDebug.Left;
|
||||
EnvironmentOptions.ToolBarViewDebugTop := pnViewDebug.Top;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
|
@ -770,7 +770,7 @@ begin
|
||||
CreateMenuItem(ParentMI,itmViewComponentPalette,'itmViewComponentPalette',lisMenuViewComponentPalette, '',
|
||||
true, EnvironmentOptions.ComponentPaletteVisible);
|
||||
CreateMenuItem(ParentMI,itmViewIDESpeedButtons,'itmViewIDESpeedButtons',lisMenuViewIDESpeedButtons, '',
|
||||
true, EnvironmentOptions.IDESpeedButtonsVisible);
|
||||
true, EnvironmentOptions.ToolbarVisible);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user