IDE: Replace Main Toolbars with a Coolbar. Issue , patch from Balázs Székely.

git-svn-id: trunk@48522 -
This commit is contained in:
juha 2015-03-27 18:34:57 +00:00
parent 2b683add14
commit f61f5b2163
8 changed files with 976 additions and 521 deletions

View File

@ -1870,34 +1870,28 @@ begin
and (pfRunnable in Project1.Flags)
);
// Run
RunSpeedButton.Enabled := CanRun and (not DebuggerIsValid
itmRunMenuRun.Enabled := CanRun and (not DebuggerIsValid
or (dcRun in FDebugger.Commands) or (FDebugger.State = dsIdle));
itmRunMenuRun.Enabled := RunSpeedButton.Enabled;
// Pause
PauseSpeedButton.Enabled := CanRun and DebuggerIsValid
itmRunMenuPause.Enabled := CanRun and DebuggerIsValid
and (dcPause in FDebugger.Commands);
itmRunMenuPause.Enabled := PauseSpeedButton.Enabled;
// Show execution point
itmRunMenuShowExecutionPoint.Enabled := CanRun and DebuggerIsValid
and (FDebugger.State = dsPause);
// Step into
StepIntoSpeedButton.Enabled := CanRun and (not DebuggerIsValid
itmRunMenuStepInto.Enabled := CanRun and (not DebuggerIsValid
or (dcStepInto in FDebugger.Commands) or (FDebugger.State = dsIdle));
itmRunMenuStepInto.Enabled := StepIntoSpeedButton.Enabled;
// Step over
StepOverSpeedButton.Enabled := CanRun and (not DebuggerIsValid
itmRunMenuStepOver.Enabled := CanRun and (not DebuggerIsValid
or (dcStepOver in FDebugger.Commands) or (FDebugger.State = dsIdle));
itmRunMenuStepOver.Enabled := StepOverSpeedButton.Enabled;
// Step out
StepOutSpeedButton.Enabled := CanRun and DebuggerIsValid
itmRunMenuStepOut.Enabled := CanRun and DebuggerIsValid
and (dcStepOut in FDebugger.Commands) and (FDebugger.State = dsPause);
itmRunMenuStepOut.Enabled := StepOutSpeedButton.Enabled;
// Run to cursor
itmRunMenuRunToCursor.Enabled := CanRun and DebuggerIsValid
and (dcRunTo in FDebugger.Commands);
// Stop
itmRunMenuStop.Enabled := CanRun and DebuggerIsValid;
StopSpeedButton.Enabled := itmRunMenuStop.Enabled;
//Attach / Detach
itmRunMenuAttach.Enabled := (not DebuggerIsValid) or (dcAttach in FDebugger.Commands);

View File

@ -45,7 +45,7 @@ uses
DbgIntfDebuggerBase,
// IDE
IDEProcs, DialogProcs, LazarusIDEStrConsts, IDETranslations, LazConf,
IDEOptionDefs, TransferMacros, ModeMatrixOpts, Debugger;
IDEOptionDefs, TransferMacros, ModeMatrixOpts, Debugger, ToolbarData;
const
EnvOptsVersion: integer = 108;
@ -302,6 +302,14 @@ type
FToolBarHighlight: Boolean;
FToolBarRaised: Boolean;
//coolbar
FIDEToolBarList: TIDEToolBarList;
FIDECoolBarVisible: Boolean;
FIDECoolBarWidth: Integer;
FIDECoolBarGrabStyle: Integer;
FIDECoolBarGrabWidth: Integer;
FIDECoolBarBorderStyle: Integer;
// component palette
FComponentPaletteOptions: TCompPaletteOptions;
@ -532,26 +540,18 @@ type
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;
//coolbar
property IDEToolBarList: TIDEToolBarList read FIDEToolBarList;
property IDECoolBarVisible: Boolean read FIDECoolBarVisible
write FIDECoolBarVisible;
property IDECoolBarWidth: Integer read FIDECoolBarWidth
write FIDECoolBarWidth;
property IDECoolBarGrabStyle: Integer read FIDECoolBarGrabStyle
write FIDECoolBarGrabStyle;
property IDECoolBarGrabWidth: Integer read FIDECoolBarGrabWidth
write FIDECoolBarGrabWidth;
property IDECoolBarBorderStyle: Integer read FIDECoolBarBorderStyle
write FIDECoolBarBorderStyle;
// component palette
property ComponentPaletteOptions: TCompPaletteOptions read FComponentPaletteOptions;
@ -866,6 +866,7 @@ constructor TEnvironmentOptions.Create;
var
o: TEnvOptParseType;
c: TMsgWndColor;
IDEToolBar: TIDEToolBar;
begin
inherited Create;
for o:=low(FParseValues) to high(FParseValues) do
@ -936,6 +937,40 @@ begin
FToolBarHighlight := False;
FToolBarRaised := False;
//coolbar
FIDEToolBarList := TIDEToolBarList.Create;
FIDECoolBarVisible := True;
FIDECoolBarWidth := 230;
FIDECoolBarGrabStyle := 4;
FIDECoolBarGrabWidth := 5;
FIDECoolBarBorderStyle := 1;
//standard toolbar defaults
IDEToolBar := FIDEToolBarList.Add;
IDEToolBar.Position := 0;
IDEToolBar.Break := False;
IDEToolBar.ButtonNames.Add('IDEMainMenu/File/itmFileNew/itmFileNewForm');
IDEToolBar.ButtonNames.Add('IDEMainMenu/File/itmFileNew/itmFileNewUnit');
IDEToolBar.ButtonNames.Add('---------------');
IDEToolBar.ButtonNames.Add('IDEMainMenu/File/itmFileOpenSave/itmFileOpen');
IDEToolBar.ButtonNames.Add('IDEMainMenu/File/itmFileOpenSave/itmFileSave');
IDEToolBar.ButtonNames.Add('IDEMainMenu/File/itmFileOpenSave/itmFileSaveAll');
IDEToolBar.ButtonNames.Add('---------------');
IDEToolBar.ButtonNames.Add('IDEMainMenu/View/itmViewMainWindows/itmViewToggleFormUnit');
//debug toolbar defaults
IDEToolBar := FIDEToolBarList.Add;
IDEToolBar.Position := 1;
IDEToolBar.Break := True;
IDEToolBar.ButtonNames.Add('IDEMainMenu/Project/itmProjectAddRemoveSection/itmProjectViewUnits');
IDEToolBar.ButtonNames.Add('IDEMainMenu/Project/itmProjectAddRemoveSection/itmProjectViewForms');
IDEToolBar.ButtonNames.Add('---------------');
IDEToolBar.ButtonNames.Add('IDEMainMenu/Project/itmProjectAddRemoveSection/itmProjectBuildMode');
IDEToolBar.ButtonNames.Add('IDEMainMenu/Run/itmRunnning/itmRunMenuRun');
IDEToolBar.ButtonNames.Add('IDEMainMenu/Run/itmRunnning/itmRunMenuPause');
IDEToolBar.ButtonNames.Add('IDEMainMenu/Run/itmRunnning/itmRunMenuStop');
IDEToolBar.ButtonNames.Add('IDEMainMenu/Run/itmRunnning/itmRunMenuStepOver');
IDEToolBar.ButtonNames.Add('IDEMainMenu/Run/itmRunnning/itmRunMenuStepInto');
IDEToolBar.ButtonNames.Add('IDEMainMenu/Run/itmRunnning/itmRunMenuStepOut');
// component palette
FComponentPaletteOptions:=TCompPaletteOptions.Create;
@ -1044,6 +1079,7 @@ begin
FreeAndNil(FRecentPackageFiles);
FreeAndNil(FObjectInspectorOptions);
FreeAndNil(FComponentPaletteOptions);
FreeAndNil(FIDEToolBarList);
FreeAndNil(FLazarusDirHistory);
FreeAndNil(FCompilerFileHistory);
FreeAndNil(FFPCSourceDirHistory);
@ -1161,6 +1197,7 @@ var
var
Path: String;
SubPath: String;
CurPath: String;
i, j: Integer;
Rec: PIDEOptionsGroupRec;
@ -1168,6 +1205,10 @@ var
EventType: TDBGEventType;
NodeName: String;
mwc: TMsgWndColor;
IDEToolBar: TIDEToolBar;
IDEToolBarCount: Integer;
IDEToolBarButtonsCount: Integer;
IDEToolBarButtonsName: string;
begin
Cfg:=nil;
try
@ -1233,6 +1274,36 @@ begin
FIDENameForDesignedFormList:=XMLConfig.GetValue(
Path+'Desktop/IDENameForDesignedFormList/Value',false);
//Coolbar
SubPath := Path + 'Desktop/IDECoolBar/';
FIDECoolBarVisible := XMLConfig.GetValue(SubPath + 'Visible/Value', True);
FIDECoolBarWidth := XMLConfig.GetValue(SubPath + 'Width/Value', 230);
FIDECoolBarGrabStyle := XMLConfig.GetValue(SubPath + 'GrabStyle/Value', 4);
FIDECoolBarGrabWidth := XMLConfig.GetValue(SubPath + 'GrabWidth/Value', 5);
FIDECoolBarBorderStyle := XMLConfig.GetValue(SubPath + 'BorderStyle/Value', 5);
IDEToolbarCount := XMLConfig.GetValue(SubPath + 'ToolBarCount/Value', 0);
if IDEToolBarCount > 0 then
begin
FIDEToolBarList.Clear;
SubPath := SubPath + 'ToolBar';
for I := 0 to IDEToolbarCount - 1 do
begin
IDEToolBar := FIDEToolBarList.Add;
IDEToolBar.Position := I;
IDEToolBar.Break := XMLConfig.GetValue(
SubPath + IntToStr(I) + '/Break/Value', False);
IDEToolBarButtonsCount := XMLConfig.GetValue(
SubPath + IntToStr(I) + '/ButtonCount/Value', 0);
for J := 0 to IDEToolBarButtonsCount - 1 do
begin
IDEToolBarButtonsName := XMLConfig.GetValue(
SubPath + IntToStr(I) + '/Buttons/Name' + IntToStr(J) + '/Value', '');
if Trim(IDEToolBarButtonsName) <> '' then
IDEToolBar.ButtonNames.Add(IDEToolBarButtonsName);
end;
end;
end;
// Toolbar
FToolBarStandardVisible := XMLConfig.GetValue(
Path+'Desktop/Toolbars/Standarad/ToolBarStandardVisible/Value', True);
@ -1578,6 +1649,7 @@ var
var
Path: String;
SubPath: String;
i, j: Integer;
NodeName: String;
Rec: PIDEOptionsGroupRec;
@ -1660,6 +1732,39 @@ begin
XMLConfig.SetDeleteValue(Path+'Desktop/Toolbars/Common/ToolBarRaised/Value',
FToolBarRaised, False);
//coolbar
SubPath := Path + 'Desktop/IDECoolBar/';
XMLConfig.DeletePath(SubPath);
XMLConfig.SetDeleteValue(SubPath + 'Visible/Value',
FIDECoolBarVisible, True);
XMLConfig.SetDeleteValue(SubPath + 'Width/Value',
FIDECoolBarWidth, 0);
XMLConfig.SetDeleteValue(SubPath + 'GrabStyle/Value',
FIDECoolBarGrabStyle, 4);
XMLConfig.SetDeleteValue(SubPath + 'GrabWidth/Value',
FIDECoolBarGrabWidth, 5);
XMLConfig.SetDeleteValue(SubPath + 'BorderStyle/Value',
FIDECoolBarBorderStyle, 5);
if FIDEToolBarList.Count > 0 then
begin
XMLConfig.SetDeleteValue(SubPath + 'ToolBarCount/Value',
FIDEToolbarList.Count, 0);
SubPath := SubPath + 'ToolBar';
for I := 0 to FIDEToolbarList.Count - 1 do
begin
XMLConfig.SetDeleteValue(SubPath + IntToStr(I) + '/Break/Value',
FIDEToolbarList.Items[I].Break, False);
XMLConfig.SetDeleteValue(SubPath + IntToStr(I) + '/ButtonCount/Value',
FIDEToolbarList.Items[I].ButtonNames.Count, 0);
for J := 0 to FIDEToolbarList.Items[I].ButtonNames.Count - 1 do
begin
XMLConfig.SetDeleteValue(SubPath + IntToStr(I) + '/Buttons/Name' + IntToStr(J) + '/Value',
FIDEToolbarList.Items[I].ButtonNames.Strings[J], '');
end;
end;
end;
// form editor
XMLConfig.SetDeleteValue(Path+'FormEditor/ShowBorderSpacing',
FShowBorderSpacing,false);

View File

@ -1,63 +1,255 @@
object ToolbarOptionsFrame: TToolbarOptionsFrame
Left = 0
Height = 318
Height = 451
Top = 0
Width = 477
ClientHeight = 318
ClientWidth = 477
Width = 520
ClientHeight = 451
ClientWidth = 520
TabOrder = 0
DesignLeft = 421
DesignTop = 303
object gbToolbarOptions: TGroupBox
DesignLeft = 798
DesignTop = 305
object pnTop: TPanel
Left = 0
Height = 162
Top = 0
Width = 477
Anchors = [akTop, akLeft, akRight]
Caption = 'Toolbar options'
ClientHeight = 142
ClientWidth = 473
Height = 218
Top = 25
Width = 520
Align = alTop
BevelOuter = bvNone
ClientHeight = 218
ClientWidth = 520
Constraints.MinHeight = 115
TabOrder = 0
object cbRaisedCheckBox: TCheckBox
Left = 13
Height = 19
Top = 108
Width = 93
Caption = 'Raise toolbars'
object pnButtons: TPanel
Left = 0
Height = 40
Top = 178
Width = 520
Align = alBottom
BevelOuter = bvNone
ClientHeight = 40
ClientWidth = 520
Constraints.MinHeight = 35
TabOrder = 0
object bAdd: TBitBtn
Left = 247
Height = 24
Top = 0
Width = 85
Anchors = [akTop, akRight]
Caption = 'Add'
OnClick = bAddClick
TabOrder = 0
end
object bDelete: TBitBtn
Left = 421
Height = 24
Top = 0
Width = 85
Anchors = [akTop, akRight]
Caption = 'Delete'
OnClick = bDeleteClick
TabOrder = 1
end
object bConfig: TBitBtn
Left = 334
Height = 24
Top = 0
Width = 85
Anchors = [akTop, akRight]
Caption = 'Config'
OnClick = bConfigClick
TabOrder = 2
end
object bDefaultToolbar: TBitBtn
Left = 8
Height = 24
Top = 0
Width = 85
Caption = 'Default'
OnClick = bDefaultToolbarClick
TabOrder = 3
end
end
object cbHighlightCheckBox: TCheckBox
Left = 13
Height = 19
Top = 83
Width = 160
Caption = 'Highlight toolbars buttons'
object sbCoolBar: TScrollBox
Left = 0
Height = 178
Top = 0
Width = 520
HorzScrollBar.Page = 75
VertScrollBar.Page = 25
Align = alClient
BorderStyle = bsNone
ClientHeight = 178
ClientWidth = 520
Constraints.MinHeight = 75
TabOrder = 1
end
object cbViewDebugVisibleCheckBox: TCheckBox
Left = 35
Height = 19
Top = 55
Width = 132
Caption = 'Debug toolbar visible'
TabOrder = 2
end
object cbStandardVisibleCheckBox: TCheckBox
Left = 35
Height = 19
Top = 30
Width = 144
Caption = 'Standard toolbar visible'
TabOrder = 3
end
object cbToolbarsVisibleCheckBox: TCheckBox
Left = 13
Height = 19
Top = 5
Width = 102
Caption = 'Toolbars visible'
OnClick = cbToolbarsVisibleCheckBoxClick
TabOrder = 4
object Coolbar: TCoolBar
Left = 0
Height = 25
Top = 0
Width = 520
AutoSize = True
Bands = <
item
end>
EdgeBorders = [ebRight]
EdgeInner = esNone
EdgeOuter = esNone
FixedSize = True
GrabStyle = gsGripper
GrabWidth = 5
HorizontalSpacing = 1
ShowText = False
OnMouseDown = CoolbarMouseDown
OnResize = CoolbarResize
OnStartDrag = CoolbarStartDrag
end
end
end
object Splitter1: TSplitter
Cursor = crVSplit
Left = 0
Height = 5
Top = 243
Width = 520
Align = alTop
MinSize = 50
ResizeAnchor = akTop
end
object pnBottom: TPanel
Left = 0
Height = 203
Top = 248
Width = 520
Align = alClient
BevelOuter = bvNone
ClientHeight = 203
ClientWidth = 520
TabOrder = 2
object dbGeneralSettings: TDividerBevel
Left = 0
Height = 15
Top = 5
Width = 520
Caption = 'General Toolbars Settings'
Align = alTop
BorderSpacing.Top = 5
BorderSpacing.Bottom = 5
Font.Style = [fsBold]
ParentColor = False
ParentFont = False
end
object gbGrabStyle: TGroupBox
Left = 12
Height = 89
Top = 64
Width = 188
Caption = 'Grab Style'
ClientHeight = 69
ClientWidth = 184
TabOrder = 0
object lbGrabWidth: TLabel
Left = 12
Height = 15
Top = 43
Width = 63
Caption = 'Grab Width:'
ParentColor = False
end
object spGrabWidth: TSpinEdit
AnchorSideTop.Control = lbGrabWidth
AnchorSideTop.Side = asrCenter
Left = 118
Height = 23
Top = 39
Width = 50
MaxValue = 50
MinValue = 1
OnChange = spGrabWidthChange
TabOrder = 0
Value = 5
end
object cbGrabStyle: TComboBox
Left = 11
Height = 23
Top = 5
Width = 157
ItemHeight = 15
ItemIndex = 4
Items.Strings = (
'gsSimple'
'gsDouble'
'gsHorLines'
'gsVerLines'
'gsGripper'
'gsButton'
)
OnChange = cbGrabStyleChange
Style = csDropDownList
TabOrder = 1
Text = 'gsGripper'
end
end
object bDefaultGeneral: TBitBtn
Left = 6
Height = 24
Top = 167
Width = 85
Anchors = [akLeft, akBottom]
Caption = 'Default'
OnClick = bDefaultGeneralClick
TabOrder = 1
end
object cbToolBarVisible: TCheckBox
Left = 12
Height = 19
Top = 32
Width = 108
Caption = 'Toolbar is visible'
TabOrder = 2
end
object gbBorderStyle: TGroupBox
Left = 216
Height = 89
Top = 64
Width = 188
Caption = 'Band Border Style'
ClientHeight = 69
ClientWidth = 184
TabOrder = 3
object cbBorderStyle: TComboBox
Left = 11
Height = 23
Top = 5
Width = 157
ItemHeight = 15
ItemIndex = 1
Items.Strings = (
'None'
'Single'
)
OnChange = cbBorderStyleChange
Style = csDropDownList
TabOrder = 0
Text = 'Single'
end
end
end
object dbAddConfigDelete: TDividerBevel
Left = 0
Height = 15
Top = 5
Width = 520
Caption = 'Add/Config/Delete Toolbar(s)'
Align = alTop
BorderSpacing.Top = 5
BorderSpacing.Bottom = 5
Font.Style = [fsBold]
ParentColor = False
ParentFont = False
end
object imButtons: TImageList
left = 464
top = 96
end
end

View File

@ -28,112 +28,184 @@ unit toolbar_options;
interface
uses
Classes, SysUtils, FileUtil, Forms, ExtCtrls, StdCtrls,
IDEOptionsIntf, LazarusIDEStrConsts, EnvironmentOpts, GraphType;
Classes, SysUtils, Forms, ExtCtrls, ComCtrls, Buttons, Controls, Menus,
Graphics, Dialogs, StdCtrls, DividerBevel, Spin,
LazarusIDEStrConsts, IDEOptionsIntf, EnvironmentOpts, ToolbarData;
type
{ TToolbarOptionsFrame }
TToolbarOptionsFrame = class(TAbstractIDEOptionsEditor)
cbToolbarsVisibleCheckBox: TCheckBox;
cbHighlightCheckBox: TCheckBox;
cbRaisedCheckBox: TCheckBox;
cbStandardVisibleCheckBox: TCheckBox;
cbViewDebugVisibleCheckBox: TCheckBox;
gbToolbarOptions: TGroupBox;
procedure cbToolbarsVisibleCheckBoxClick(Sender: TObject);
bAdd: TBitBtn;
bDefaultGeneral: TBitBtn;
bConfig: TBitBtn;
bDefaultToolbar: TBitBtn;
bDelete: TBitBtn;
cbGrabStyle: TComboBox;
cbBorderStyle: TComboBox;
cbToolBarVisible: TCheckBox;
Coolbar: TCoolBar;
gbGrabStyle: TGroupBox;
gbBorderStyle: TGroupBox;
imButtons: TImageList;
dbAddConfigDelete: TDividerBevel;
dbGeneralSettings: TDividerBevel;
lbGrabWidth: TLabel;
MenuItem1: TMenuItem;
pnBottom: TPanel;
pnTop: TPanel;
pnButtons: TPanel;
sbCoolBar: TScrollBox;
spGrabWidth: TSpinEdit;
Splitter1: TSplitter;
procedure bAddClick(Sender: TObject);
procedure bConfigClick(Sender: TObject);
procedure bDefaultGeneralClick(Sender: TObject);
procedure bDefaultToolbarClick(Sender: TObject);
procedure bDeleteClick(Sender: TObject);
procedure cbBorderStyleChange(Sender: TObject);
procedure cbGrabStyleChange(Sender: TObject);
procedure CoolBarMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: integer);
procedure CoolbarResize(Sender: TObject);
procedure CoolbarStartDrag(Sender: TObject; var DragObject: TDragObject);
procedure spGrabWidthChange(Sender: TObject);
private
FTempList: TIDEToolBarList;
procedure SelectBand(const ID: integer);
function GetSelectedBand: Integer;
procedure ToolBarClick(Sender: TObject);
procedure EnableButtons;
procedure PopulateToolBar;
public
function GetTitle: String; override;
procedure Setup({%H-}ADialog: TAbstractOptionsEditorDialog); override;
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
function GetTitle: string; override;
procedure Setup(ADialog: TAbstractOptionsEditorDialog); override;
procedure ReadSettings(AOptions: TAbstractIDEOptions); override;
procedure WriteSettings(AOptions: TAbstractIDEOptions); override;
class function SupportedOptionsClass: TAbstractIDEOptionsClass; override;
end;
implementation
uses MainBar;
uses MainBar, ToolbarConfig;
{$R *.lfm}
{ TToolbarOptionsFrame }
procedure TToolbarOptionsFrame.cbToolbarsVisibleCheckBoxClick(
Sender: TObject);
function TToolbarOptionsFrame.GetTitle: string;
begin
cbStandardVisibleCheckBox.Enabled := cbToolbarsVisibleCheckBox.Checked;
cbViewDebugVisibleCheckBox.Enabled := cbToolbarsVisibleCheckBox.Checked;
Result := lisCoolbarOptions;
end;
function TToolbarOptionsFrame.GetTitle: String;
procedure TToolbarOptionsFrame.Setup(ADialog: TAbstractOptionsEditorDialog);
begin
Result := lisToolbarOptions;
dbAddConfigDelete.Caption := lisCoolbarAddConfigDelete;
dbGeneralSettings.Caption := lisCoolbarGeneralSettings;
bDefaultToolbar.Caption := lisCoolbarDefault;
bAdd.Caption := lisCoolbarAdd;
bConfig.Caption := lisCoolbarConfig;
bDelete.Caption := lisCoolbarDelete;
cbToolBarVisible.Caption := lisCoolbarVisible;
gbGrabStyle.Caption := lisCoolbarGrabStyle;
cbGrabStyle.Items.Strings[0] := lisCoolbarGrabStyleItem0;
cbGrabStyle.Items.Strings[1] := lisCoolbarGrabStyleItem1;
cbGrabStyle.Items.Strings[2] := lisCoolbarGrabStyleItem2;
cbGrabStyle.Items.Strings[3] := lisCoolbarGrabStyleItem3;
cbGrabStyle.Items.Strings[4] := lisCoolbarGrabStyleItem4;
cbGrabStyle.Items.Strings[5] := lisCoolbarGrabStyleItem5;
lbGrabWidth.Caption := lisCoolbarGrabWidth;
gbBorderStyle.Caption := lisCoolbarBorderStyle;
cbBorderStyle.Items.Strings[0] := lisCoolbarBorderStyleItem0;
cbBorderStyle.Items.Strings[1] := lisCoolbarBorderStyleItem1;
bDefaultGeneral.Caption := lisCoolbarDefault;
end;
procedure TToolbarOptionsFrame.Setup(
ADialog: TAbstractOptionsEditorDialog);
begin
gbToolbarOptions.Caption := lisToolbarOptions;
cbToolbarsVisibleCheckBox.Caption := lisToolbarOptionsToolbarsVisible;
cbStandardVisibleCheckBox.Caption := lisToolbarOptionsStandardVisible;
cbViewDebugVisibleCheckBox.Caption := lisToolbarOptionsViewDebugVisible;
cbHighlightCheckBox.Caption := lisToolbarOptionsHighLight;
cbRaisedCheckBox.Caption := lisToolbarOptionsRaise;
end;
procedure TToolbarOptionsFrame.ReadSettings(
AOptions: TAbstractIDEOptions);
procedure TToolbarOptionsFrame.ReadSettings(AOptions: TAbstractIDEOptions);
var
I, J: integer;
IDEToolBar: TIDEToolBar;
begin
with AOptions as TEnvironmentOptions do
begin
cbToolbarsVisibleCheckBox.Checked := ToolbarVisible;
cbStandardVisibleCheckBox.Enabled := cbToolbarsVisibleCheckBox.Checked;
cbStandardVisibleCheckBox.Checked := ToolBarStandardVisible;
cbViewDebugVisibleCheckBox.Enabled := cbToolbarsVisibleCheckBox.Checked;
cbViewDebugVisibleCheckBox.Checked := ToolBarViewDebugVisible;
cbHighlightCheckBox.Checked := ToolBarHighlight;
cbRaisedCheckBox.Checked := ToolBarRaised;
//read toolbar settings
cbToolBarVisible.Checked := IDECoolBarVisible;
if not (IDECoolBarGrabStyle in [0..5]) then
IDECoolBarGrabStyle := 4;
cbGrabStyle.ItemIndex := IDECoolBarGrabStyle;
Coolbar.GrabStyle := TGrabStyle(IDECoolBarGrabStyle);
if not (IDECoolBarGrabWidth in [1..50]) then
IDECoolBarGrabWidth := 5;
spGrabWidth.Value := IDECoolBarGrabWidth;
Coolbar.GrabWidth := IDECoolBarGrabWidth;
if not (IDECoolBarBorderStyle in [0..1]) then
IDECoolBarBorderStyle := 1;
cbBorderStyle.ItemIndex := IDECoolBarBorderStyle;
Coolbar.BandBorderStyle := TBorderStyle(IDECoolBarBorderStyle);
//read toolbars
FTempList.Clear;
for I := 0 to IDEToolbarList.Count - 1 do
begin
IDEToolBar := FTempList.Add;
IDEToolBar.Position := IDEToolbarList.Items[I].Position;
IDEToolBar.Break := IDEToolbarList.Items[I].Break;
for J := 0 to IDEToolbarList.Items[I].ButtonNames.Count - 1 do
IDEToolBar.ButtonNames.Add(IDEToolbarList.Items[I].ButtonNames.Strings[J]);
end;
FTempList.Sort;
PopulateToolBar;
end;
end;
procedure TToolbarOptionsFrame.WriteSettings(
AOptions: TAbstractIDEOptions);
procedure TToolbarOptionsFrame.WriteSettings(AOptions: TAbstractIDEOptions);
var
I, J: integer;
IDEToolBar: TIDEToolBar;
ToolBar: TToolBar;
begin
with AOptions as TEnvironmentOptions do
begin
//toolbar general visibility
ToolbarVisible := cbToolbarsVisibleCheckBox.Checked;
MainIDEBar.itmViewIDESpeedButtons.Checked := ToolbarVisible;
MainIDEBar.pnlSpeedButtons.Visible := ToolbarVisible;
//write toolbar settings
IDECoolBarVisible := cbToolBarVisible.Checked;
IDECoolBarGrabStyle := cbGrabStyle.ItemIndex;
IDECoolBarGrabWidth := spGrabWidth.Value;
IDECoolBarBorderStyle := cbBorderStyle.ItemIndex;
MainIDEBar.ToolBarsVisibleCount := 0;
//standard
ToolBarStandardVisible := cbStandardVisibleCheckBox.Checked;
MainIDEBar.pnStandard.Visible := ToolBarStandardVisible;
if ToolBarStandardVisible then
MainIDEBar.ToolBarsVisibleCount := MainIDEBar.ToolBarsVisibleCount + 1;
//viewDebug
ToolBarViewDebugVisible := cbViewDebugVisibleCheckBox.Checked;
MainIDEBar.pnViewDebug.Visible := ToolBarViewDebugVisible;
if ToolBarViewDebugVisible then
MainIDEBar.ToolBarsVisibleCount := MainIDEBar.ToolBarsVisibleCount + 1;
//highlight
ToolBarHighlight := cbHighlightCheckBox.Checked;
MainIDEBar.tbStandard.Flat := not ToolBarHighlight;
MainIDEBar.tbViewDebug.Flat := not ToolBarHighlight;
//raised
ToolBarRaised := cbRaisedCheckBox.Checked;
if ToolBarRaised then
//write toolbars
for I := 0 to Coolbar.Bands.Count - 1 do
begin
MainIDEBar.pnStandard.BevelOuter := bvRaised;
MainIDEBar.pnViewDebug.BevelOuter := bvRaised;
end
else
if Coolbar.Bands[I].Control = nil then
Continue;
ToolBar := (Coolbar.Bands[I].Control as TToolBar);
J := FTempList.FindByToolBar(ToolBar);
if J <> -1 then
begin
FTempList.Items[J].Position := Coolbar.Bands[I].Index;
FTempList.Items[J].Break := Coolbar.Bands[I].Break;
end;
end;
FTempList.Sort;
IDEToolbarList.Clear;
for I := 0 to FTempList.Count - 1 do
begin
MainIDEBar.pnStandard.BevelOuter := bvNone;
MainIDEBar.pnViewDebug.BevelOuter := bvNone;
IDEToolBar := IDEToolbarList.Add;
IDEToolBar.Position := FTempList.Items[I].Position;
IDEToolBar.Break := FTempList.Items[I].Break;
for J := 0 to FTempList.Items[I].ButtonNames.Count - 1 do
IDEToolBar.ButtonNames.Add(FTempList.Items[I].ButtonNames.Strings[J]);
end;
end;
MainIDEBar.SetToolbarsPositions;
MainIDEBar.RefreshCoolbar;
end;
class function TToolbarOptionsFrame.SupportedOptionsClass: TAbstractIDEOptionsClass;
@ -141,8 +213,285 @@ begin
Result := TEnvironmentOptions;
end;
procedure TToolbarOptionsFrame.CoolBarMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: integer);
var
ABand: integer;
AGrabber: boolean;
begin
CoolBar.MouseToBandPos(X, Y, ABand, AGrabber);
if ABand < 0 then
Exit;
if CoolBar.Bands.Items[ABand].Color <> clHighlight then
SelectBand(ABand);
end;
procedure TToolbarOptionsFrame.CoolbarResize(Sender: TObject);
begin
Coolbar.AutosizeBands;
end;
procedure TToolbarOptionsFrame.CoolbarStartDrag(Sender: TObject;
var DragObject: TDragObject);
begin
Caption := 'Dragging';
end;
procedure TToolbarOptionsFrame.spGrabWidthChange(Sender: TObject);
begin
CoolBar.GrabWidth := TSpinEdit(Sender).Value;
CoolBar.AutosizeBands;
end;
procedure TToolbarOptionsFrame.cbGrabStyleChange(Sender: TObject);
begin
CoolBar.GrabStyle := TGrabStyle(TComboBox(Sender).ItemIndex);
CoolBar.AutosizeBands;
end;
procedure TToolbarOptionsFrame.cbBorderStyleChange(Sender: TObject);
begin
Coolbar.BandBorderStyle := TBorderStyle(TComboBox(Sender).ItemIndex);
Coolbar.AutosizeBands;
end;
procedure TToolbarOptionsFrame.SelectBand(const ID: integer);
var
I: integer;
begin
for I := 0 to CoolBar.Bands.Count - 1 do
begin
if I <> ID then
CoolBar.Bands.Items[I].Color := clDefault
else
CoolBar.Bands.Items[I].Color := clHighlight;
end;
end;
function TToolbarOptionsFrame.GetSelectedBand: Integer;
var
I: Integer;
begin
Result := -1;
if CoolBar.Bands.Count = 0 then
Exit;
for I := 0 to CoolBar.Bands.Count - 1 do
begin
if CoolBar.Bands.Items[I].Color = clHighlight then
begin
Result := I;
Break;
end;
end;
end;
procedure TToolbarOptionsFrame.ToolBarClick(Sender: TObject);
var
CoolBand: TCoolBand;
begin
CoolBand := Coolbar.Bands.FindBand(Sender as TToolBar);
if CoolBand <> nil then
SelectBand(CoolBand.Index);
end;
procedure TToolbarOptionsFrame.EnableButtons;
var
I: Integer;
Selected: Boolean;
begin
Selected := False;
for I := 0 to Coolbar.Bands.Count - 1 do
begin
if Coolbar.Bands[I].Color = clHighlight then
begin
Selected := True;
Break;
end;
end;
bConfig.Enabled := Selected;
bDelete.Enabled := Selected;
end;
procedure TToolbarOptionsFrame.PopulateToolBar;
var
CoolBand: TCoolBand;
I, J: Integer;
begin
CoolBar.Bands.Clear;
for I := 0 to FTempList.Count - 1 do
begin
//Balazs
CoolBand := CoolBar.Bands.Add;
CoolBand.Break := FTempList.Items[I].Break;
CoolBand.Control := FTempList.Items[I].Toolbar;
CoolBand.Visible := True;
CoolBand.MinWidth := 25;
CoolBand.MinHeight := 22;
CoolBand.FixedSize := True;
FTempList.Items[I].ClearToolbar;
for J := 0 to FTempList.Items[I].ButtonNames.Count - 1 do
FTempList.Items[I].AddCustomItems(J);
end;
if CoolBar.Bands.Count > 0 then
SelectBand(0);
Coolbar.AutosizeBands;
EnableButtons;
end;
constructor TToolbarOptionsFrame.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FTempList := TIDEToolBarList.Create;
end;
destructor TToolbarOptionsFrame.Destroy;
begin
FreeAndNil(FTempList);
inherited Destroy;
end;
procedure TToolbarOptionsFrame.bAddClick(Sender: TObject);
var
CoolBand: TCoolBand;
IDEToolbar: TIDEToolBar;
begin
IDEToolbar := FTempList.Add;
IDEToolbar.Break := False;
IDEToolbar.OnToolBarClick := @ToolBarClick;
CoolBand := CoolBar.Bands.Add;
CoolBand.Break := True;
CoolBand.Control := IDEToolbar.Toolbar;
CoolBand.Visible := True;
CoolBand.MinWidth := 25;
CoolBand.MinHeight := 22;
CoolBand.FixedSize := True;
// AddBand(True, IDEToolbar.Toolbar);
SelectBand(CoolBand.Index);
EnableButtons;
end;
procedure TToolbarOptionsFrame.bConfigClick(Sender: TObject);
var
ToConfig: Integer;
ToolBar: TToolBar;
I: Integer;
begin
ToConfig := GetSelectedBand;
if ToConfig = -1 then
begin
MessageDlg(lisCoolbarSelectToolBar, mtInformation, [mbOk], 0);
Exit;
end;
fToolBarConfig := TfToolBarConfig.Create(Self);
try
ToolBar := (Coolbar.Bands.Items[ToConfig].Control as TToolBar);
if ToolBar <> nil then
begin
ToConfig := FTempList.FindByToolBar(ToolBar);
if ToConfig <> -1 then
begin
fToolBarConfig.LoadSettings(FTempList.Items[ToConfig].ButtonNames);
if fToolBarConfig.ShowModal = mrOK then
begin
FTempList.Items[ToConfig].ClearToolbar;
fToolBarConfig.SaveSettings(FTempList.Items[ToConfig].ButtonNames);
for I := 0 to FTempList.Items[ToConfig].ButtonNames.Count - 1 do
FTempList.Items[ToConfig].AddCustomItems(I);
end;
end;
end;
finally
fToolBarConfig.Free;
end;
Coolbar.AutosizeBands;
end;
procedure TToolbarOptionsFrame.bDeleteClick(Sender: TObject);
var
I: integer;
ToDelete: integer;
begin
if Coolbar.Bands.Count = 1 then
begin
MessageDlg(lisCoolbarDeleteWarning, mtInformation, [mbOk], 0);
Exit;
end;
ToDelete := GetSelectedBand;
if ToDelete > -1 then
begin
if MessageDlg(lisCoolbarDeleteToolBar, mtConfirmation, [mbYes, mbNo], 0) = mrYes then
begin
if ToDelete + 1 < CoolBar.Bands.Count then
SelectBand(ToDelete + 1)
else if ToDelete - 1 >= 0 then
SelectBand(ToDelete - 1);
I := FTempList.FindByToolBar((CoolBar.Bands.Items[ToDelete].Control as TToolBar));
if I <> -1 then
FTempList.Delete(I);
CoolBar.Bands.Delete(ToDelete);
end;
end;
EnableButtons;
end;
procedure TToolbarOptionsFrame.bDefaultGeneralClick(Sender: TObject);
begin
if MessageDlg(lisCoolbarResetDefaults, mtConfirmation, [mbYes, mbNo], 0) = mrYes then
begin
cbGrabStyle.ItemIndex := 4;
spGrabWidth.Value := 5;
BiDiMode := bdLeftToRight;
cbBorderStyle.ItemIndex := 1;
Coolbar.GrabStyle := TGrabStyle(4);
Coolbar.GrabWidth := 5;
Coolbar.BandBorderStyle := bsSingle;
end;
end;
procedure TToolbarOptionsFrame.bDefaultToolbarClick(Sender: TObject);
var
IDEToolBar: TIDEToolBar;
begin
if MessageDlg(lisCoolbarResetDefaults, mtConfirmation, [mbYes, mbNo], 0) = mrYes then
begin
FTempList.Clear;
//standard
IDEToolBar := FTempList.Add;
IDEToolBar.Position := 0;
IDEToolBar.Break := False;
IDEToolBar.ButtonNames.Add('IDEMainMenu/File/itmFileNew/itmFileNewForm');
IDEToolBar.ButtonNames.Add('IDEMainMenu/File/itmFileNew/itmFileNewUnit');
IDEToolBar.ButtonNames.Add('---------------');
IDEToolBar.ButtonNames.Add('IDEMainMenu/File/itmFileOpenSave/itmFileOpen');
IDEToolBar.ButtonNames.Add('IDEMainMenu/File/itmFileOpenSave/itmFileSave');
IDEToolBar.ButtonNames.Add('IDEMainMenu/File/itmFileOpenSave/itmFileSaveAll');
IDEToolBar.ButtonNames.Add('---------------');
IDEToolBar.ButtonNames.Add('IDEMainMenu/View/itmViewMainWindows/itmViewToggleFormUnit');
//debug
IDEToolBar := FTempList.Add;
IDEToolBar.Position := 1;
IDEToolBar.Break := True;
IDEToolBar.ButtonNames.Add('IDEMainMenu/Project/itmProjectAddRemoveSection/itmProjectViewUnits');
IDEToolBar.ButtonNames.Add('IDEMainMenu/Project/itmProjectAddRemoveSection/itmProjectViewForms');
IDEToolBar.ButtonNames.Add('---------------');
IDEToolBar.ButtonNames.Add('IDEMainMenu/Project/itmProjectAddRemoveSection/itmProjectBuildMode');
IDEToolBar.ButtonNames.Add('IDEMainMenu/Run/itmRunnning/itmRunMenuRun');
IDEToolBar.ButtonNames.Add('IDEMainMenu/Run/itmRunnning/itmRunMenuPause');
IDEToolBar.ButtonNames.Add('IDEMainMenu/Run/itmRunnning/itmRunMenuStop');
IDEToolBar.ButtonNames.Add('IDEMainMenu/Run/itmRunnning/itmRunMenuStepOver');
IDEToolBar.ButtonNames.Add('IDEMainMenu/Run/itmRunnning/itmRunMenuStepInto');
IDEToolBar.ButtonNames.Add('IDEMainMenu/Run/itmRunnning/itmRunMenuStepOut');
PopulateToolBar;
end;
end;
initialization
RegisterIDEOptionsEditor(GroupEnvironment, TToolbarOptionsFrame, EnvOptionsToolbar);
end.

View File

@ -5886,6 +5886,59 @@ resourcestring
;
lisUpdateInfo = 'Update info';
//Coolbar
lisCoolbarOptions = 'CoolBar Options';
lisCoolbarDeleteToolBar = 'Are you sure you want to delete the selected toolbar?';
lisCoolbarSelectToolBar = 'Please select a toolbar first!';
lisCoolbarAddSelected = 'Add selected item to toolbar';
lisCoolbarRemoveSelected = 'Remove selected item from toolbar';
lisCoolbarMoveSelectedUp = 'Move selected toolbar item up';
lisCoolbarMoveSelectedDown = 'Move selected toolbar item down';
lisCoolbarAddDivider = 'Add Divider';
lisCoolbarClearSelection = 'Clear selection';
lisCoolbarHelp1 = 'The "Add" button inserts a Menu Item before the ' +
'selected Item of the Toolbar.';
lisCoolbarHelp2 = 'If none is selected, the Item will be appended at the end ' +
'of the Toolbar.';
lisCoolbarHelp3 = 'You may rearrange Toolbar Items with "Move Up" and '+
'"Move Down" buttons.';
lisCoolbarHelp4 = 'Hint: to append an Item at the end, use "Clear selection"';
lisEditorToolbarConfigForm = 'Toolbar Configuration';
lisCoolbarOK = 'OK';
lisCoolbarCancel = 'Cancel';
lisCoolbarMenuTree = 'Available Menu Items';
lisCoolbarToolbar = 'Toolbar Items';
lisCoolbarIDEMainMenu = 'IDE Main Menu';
lisCoolbarSourceTab = 'Source Tab';
lisCoolbarSourceEditor = 'Source Editor';
lisCoolbarMessages = 'Messages';
lisCoolbarCodeExplorer = 'Code Explorer';
lisCoolbarCodeTemplates = 'Code Templates';
lisCoolbarDesigner = 'Designer';
lisCoolbarPackageEditor = 'Package Editor';
lisCoolbarPackageEditorFiles = 'Package Editor Files';
lisCoolbarAddConfigDelete = 'Add/Config/Delete Toolbar(s)';
lisCoolbarGeneralSettings = 'General Coolbar Settings';
lisCoolbarAdd = 'Add';
lisCoolbarConfig = 'Config';
lisCoolbarDelete = 'Delete';
lisCoolbarVisible = 'Coolbar is visible';
lisCoolbarGrabStyle = 'Toolbars Grab Style';
lisCoolbarGrabStyleItem0 = 'Simple';
lisCoolbarGrabStyleItem1 = 'Double';
lisCoolbarGrabStyleItem2 = 'HorLines';
lisCoolbarGrabStyleItem3 = 'VerLines';
lisCoolbarGrabStyleItem4 = 'Gripper';
lisCoolbarGrabStyleItem5 = 'Button';
lisCoolbarGrabWidth = 'Grab width';
lisCoolbarBorderStyle = 'Toolbars Border Style';
lisCoolbarBorderStyleItem0 = 'None';
lisCoolbarBorderStyleItem1 = 'Single';
lisCoolbarDefault = 'Default';
lisCoolbarResetDefaults = 'Reset to default values?';
lisCoolbarDeleteWarning = 'There must be at least one toolbar!';
lismiToolbar = 'Options';
//Debugger Attaching dialog
lisDADRunningProcesses = 'Running Processes';
lisDADImageName = 'Image Name';

View File

@ -322,6 +322,7 @@ type
procedure mnuViewFormsClicked(Sender: TObject);
procedure mnuViewProjectSourceClicked(Sender: TObject);
procedure mnuProjectOptionsClicked(Sender: TObject);
procedure mnuBuildModeClicked(Sender: TObject);
// run menu
procedure mnuCompileProjectClicked(Sender: TObject);
@ -1542,6 +1543,7 @@ begin
// load package configs
HelpBoss.LoadHelpOptions;
MainIDEBar.RefreshCoolbar;
end;
procedure TMainIDE.StartIDE;
@ -2011,198 +2013,36 @@ end;
{------------------------------------------------------------------------------}
procedure TMainIDE.SetupSpeedButtons;
function CreateButton(AToolBar: TToolBar; const AName, APixName: String;
const AOnClick: TNotifyEvent; const AHint: String): TToolButton;
begin
Result := TToolButton.Create(OwningComponent);
with Result do
begin
Name := AName;
Parent := AToolBar;
Enabled := True;
OnClick := AOnClick;
ImageIndex := IDEImages.LoadImage(16, APixName);
Hint := AHint;
end;
end;
function CreateDivider(AToolBar: TToolBar): TToolButton;
begin
Result := TToolButton.Create(OwningComponent);
with Result do
begin
Style := tbsDivider;
AutoSize := True;
Parent := AToolBar;
end;
end;
begin
// Panel for buttons on the left
MainIDEBar.pnlSpeedButtons := TPanel.Create(OwningComponent);
with MainIDEBar.pnlSpeedButtons do
MainIDEBar.MainSplitter := TSplitter.Create(OwningComponent);
MainIDEBar.MainSplitter.Parent := MainIDEBar;
MainIDEBar.MainSplitter.Align := alLeft;
MainIDEBar.MainSplitter.MinSize := 50;
MainIDEBar.MainSplitter.OnMoved := @MainIDEBar.MainSplitterMoved;
MainIDEBar.CoolBar := TCoolBar.Create(OwningComponent);
MainIDEBar.CoolBar.Parent := MainIDEBar;
if EnvironmentOptions.ComponentPaletteVisible then
begin
Name := 'pnlSpeedButtons';
Parent := MainIDEBar;
Align := alLeft;
Caption := '';
BevelOuter := bvNone;
AutoSize := true;
Visible := EnvironmentOptions.ToolbarVisible;
OnMouseDown := @MainIDEBar.pnlSpeedButtonsMouseDown;
Constraints.MinWidth := 5;
end;
//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);
MainIDEBar.OpenFileSpeedBtn := CreateButton(MainIDEBar.tbStandard , 'OpenFileSpeedBtn' , 'laz_open' , @mnuOpenClicked, lisOpen);
MainIDEBar.SaveSpeedBtn := CreateButton(MainIDEBar.tbStandard , 'SaveSpeedBtn' , 'laz_save' , @mnuSaveClicked, lisSave);
MainIDEBar.SaveAllSpeedBtn := CreateButton(MainIDEBar.tbStandard , 'SaveAllSpeedBtn' , 'menu_save_all' , @mnuSaveAllClicked, lisHintSaveAll);
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);
MainIDEBar.BuildModeSpeedButton:= CreateButton(MainIDEBar.tbViewDebug, 'BuildModeSpeedButton', 'menu_compiler_options' , @mnuChgBuildModeClicked, lisChangeBuildMode);
MainIDEBar.RunSpeedButton := CreateButton(MainIDEBar.tbViewDebug, 'RunSpeedButton' , 'menu_run' , @mnuRunProjectClicked, lisRunButtonHint);
MainIDEBar.PauseSpeedButton := CreateButton(MainIDEBar.tbViewDebug, 'PauseSpeedButton' , 'menu_pause' , @mnuPauseProjectClicked, lisPause);
MainIDEBar.StopSpeedButton := CreateButton(MainIDEBar.tbViewDebug, 'StopSpeedButton' , 'menu_stop' , @mnuStopProjectClicked, lisStop);
MainIDEBar.StepIntoSpeedButton := CreateButton(MainIDEBar.tbViewDebug, 'StepIntoSpeedButton', 'menu_stepinto' , @mnuStepIntoProjectClicked, lisHintStepInto);
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 := lisOptions;
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.CoolBar.Align := alLeft;
MainIDEBar.CoolBar.Width := EnvironmentOptions.IDECoolBarWidth;
end
else
MainIDEBar.CoolBar.Align := alClient;
MainIDEBar.CoolBar.Vertical := False;
MainIDEBar.CoolBar.HorizontalSpacing := 1;
MainIDEBar.CoolBar.VerticalSpacing := 3;
MainIDEBar.CoolBar.FixedSize := True;
MainIDEBar.CoolBar.DoubleBuffered := True;
MainIDEBar.CoolBar.EdgeInner := esNone;
MainIDEBar.CoolBar.EdgeOuter := esNone;
MainIDEBar.CoolBar.Visible := EnvironmentOptions.IDECoolBarVisible;
MainIDEBar.CoolBar.OnChange := @MainIDEBar.CoolBarOnChange;
MainIDEBar.CreatePopupMenus(OwningComponent);
MainIDEBar.OpenFileSpeedBtn.Style := tbsDropDown;
MainIDEBar.OpenFileSpeedBtn.DropDownMenu := MainIDEBar.OpenFilePopUpMenu;
MainIDEBar.miOptions.OnClick := @ToolBarOptionsClick;
MainIDEBar.CoolBar.PopupMenu := MainIDEBar.pmOptions;
MainIDEBar.OpenFilePopupMenu.OnPopup := @OpenFilePopupMenuPopup;
MainIDEBar.BuildModeSpeedButton.Style:=tbsDropDown;
MainIDEBar.BuildModeSpeedButton.DropdownMenu:=MainIDEBar.SetBuildModePopupMenu;
MainIDEBar.SetBuildModePopupMenu.OnPopup := @SetBuildModePopupMenuPopup;
end;
@ -2246,10 +2086,6 @@ begin
end;
// update all hints in main ide toolbars
CurShowHint:=EnvironmentOptions.ShowHintsForMainSpeedButtons;
for i:=0 to MainIDEBar.pnlSpeedButtons.ControlCount-1 do begin
AControl:=MainIDEBar.pnlSpeedButtons.Controls[i];
AControl.ShowHint:=CurShowHint;
end;
end;
procedure TMainIDE.SetupObjectInspector;
@ -2862,6 +2698,7 @@ begin
itmProjectViewUnits.OnClick := @mnuViewUnitsClicked;
itmProjectViewForms.OnClick := @mnuViewFormsClicked;
itmProjectViewSource.OnClick := @mnuViewProjectSourceClicked;
itmProjectBuildMode.OnClick := @mnuBuildModeClicked;
end;
end;
@ -3873,16 +3710,34 @@ begin
MainIDEBar.itmViewComponentPalette.Checked:=ComponentPaletteVisible;
MainIDEBar.ComponentPageControl.Visible:=ComponentPaletteVisible;
EnvironmentOptions.ComponentPaletteVisible:=ComponentPaletteVisible;
if ComponentPaletteVisible then
begin
if MainIDEBar.CoolBar.Align = alClient then
begin
MainIDEBar.CoolBar.Width := 230;
EnvironmentOptions.IDECoolBarWidth := 230;
end;
MainIDEBar.CoolBar.Align := alLeft;
MainIDEBar.CoolBar.Vertical := False;
MainIDEBar.MainSplitter.Align := alLeft;
end
else
MainIDEBar.CoolBar.Align := alClient;
MainIDEBar.MainSplitter.Visible := MainIDEBar.Coolbar.Visible and
MainIDEBar.ComponentPageControl.Visible;
end;
procedure TMainIDE.DoToggleViewIDESpeedButtons;
var
SpeedButtonsVisible: boolean;
begin
SpeedButtonsVisible:=not MainIDEBar.pnlSpeedButtons.Visible;
MainIDEBar.itmViewIDESpeedButtons.Checked:=SpeedButtonsVisible;
MainIDEBar.pnlSpeedButtons.Visible:=SpeedButtonsVisible;
EnvironmentOptions.ToolbarVisible := MainIDEBar.pnlSpeedButtons.Visible;
SpeedButtonsVisible := not MainIDEBar.CoolBar.Visible;
MainIDEBar.itmViewIDESpeedButtons.Checked := SpeedButtonsVisible;
MainIDEBar.CoolBar.Visible := SpeedButtonsVisible;
MainIDEBar.MainSplitter.Visible := SpeedButtonsVisible;
EnvironmentOptions.IDECoolBarVisible := SpeedButtonsVisible;
MainIDEBar.MainSplitter.Visible := MainIDEBar.Coolbar.Visible and
MainIDEBar.ComponentPageControl.Visible;
end;
procedure TMainIDE.AllowCompilation(aAllow: Boolean);
@ -3891,8 +3746,6 @@ procedure TMainIDE.AllowCompilation(aAllow: Boolean);
begin
if MainIDEBar=Nil then Exit;
with MainIDEBar do begin
Assert(Assigned(RunSpeedButton), 'TMainIDE.AllowCompilation: RunSpeedButton not assigned!');
RunSpeedButton.Enabled:=aAllow;
itmRunMenuRun.Enabled:=aAllow;
itmRunMenuCompile.Enabled:=aAllow;
itmRunMenuBuild.Enabled:=aAllow;
@ -4310,6 +4163,11 @@ begin
[TProjectIDEOptions, TProjectCompilerOptions], []);
end;
procedure TMainIDE.mnuBuildModeClicked(Sender: TObject);
begin
DoOpenIDEOptions(TCompilerPathOptionsFrame, '', [TProjectCompilerOptions], []);
end;
function TMainIDE.UpdateProjectPOFile(AProject: TProject): TModalResult;
var
Files: TFilenameToPointerTree;
@ -5630,12 +5488,6 @@ begin
MainIDEBar.itmFileExportHtml.Enabled := (SrcEdit<>nil);
if UpdateSaveAll then
MainIDEBar.itmFileSaveAll.Enabled := MainIDEBar.itmProjectSave.Enabled;
// toolbar buttons
MainIDEBar.BuildModeSpeedButton.Visible:=(Project1<>nil)
and (Project1.BuildModes.Count>1);
MainIDEBar.SaveSpeedBtn.Enabled := MainIDEBar.itmFileSave.Enabled;
if UpdateSaveAll then
MainIDEBar.SaveAllSpeedBtn.Enabled := MainIDEBar.itmFileSaveAll.Enabled;
end;
procedure TMainIDE.OnSaveProjectUnitSessionInfo(AUnitInfo: TUnitInfo);
@ -10322,7 +10174,6 @@ begin
UpdateSaveMenuItemsAndButtons(false);
MainIDEBar.itmViewToggleFormUnit.Enabled := Assigned(ActiveUnitInfo.Component)
or (ActiveUnitInfo.ComponentName<>'');
MainIDEBar.ToggleFormSpeedBtn.Enabled := MainIDEBar.itmViewToggleFormUnit.Enabled;
end;
procedure TMainIDE.OnSrcNotebookEditorPlaceBookmark(Sender: TObject; var Mark: TSynEditMark);
@ -11533,7 +11384,6 @@ begin
end;
MainIDEBar.itmViewToggleFormUnit.Enabled := HasResources;
end;
MainIDEBar.ToggleFormSpeedBtn.Enabled := MainIDEBar.itmViewToggleFormUnit.Enabled;
DebugBoss.UpdateButtonsAndMenuItems;
end;
end;

View File

@ -39,61 +39,30 @@ uses
MemCheck,
{$ENDIF}
Classes, SysUtils, LCLProc, Forms, Controls, Buttons, Menus,
ComCtrls, ExtCtrls, Dialogs, LMessages,
ComCtrls, ExtCtrls, LMessages,
// IDEIntf
ProjectIntf, NewItemIntf, MenuIntf, LazIDEIntf, LazFileCache,
EnvironmentOpts, LazarusIDEStrConsts;
EnvironmentOpts, LazarusIDEStrConsts, IDEImagesIntf;
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
pnlSpeedButtons : TPanel;
tbStandard : TToolBar;
NewUnitSpeedBtn : TToolButton;
NewFormSpeedBtn : TToolButton;
tbDivider1 : TToolButton;
OpenFileSpeedBtn : TToolButton;
OpenFilePopUpMenu : TPopupMenu;
SaveSpeedBtn : TToolButton;
SaveAllSpeedBtn : TToolButton;
tbDivider2 : TToolButton;
ToggleFormSpeedBtn : TToolButton;
tbViewDebug : TToolBar;
ViewUnitsSpeedBtn : TToolButton;
ViewFormsSpeedBtn : TToolButton;
tbDivider3 : TToolButton;
BuildModeSpeedButton : TToolButton;
RunSpeedButton : TToolButton;
SetBuildModePopupMenu: TPopupMenu;
PauseSpeedButton : TToolButton;
StopSpeedButton : TToolButton;
StepIntoSpeedButton : TToolButton;
StepOverSpeedButton : TToolButton;
StepOutSpeedButton : TToolButton;
pnStandard: TPanel;
spStandard: TSplitterEx;
pnViewDebug: TPanel;
spViewDebug: TSplitterEx;
//Coolbar and PopUpMenus
CoolBar: TCoolBar;
pmOptions: TPopupMenu;
miOptions: TMenuItem;
miOptions: TMenuItem;
OpenFilePopUpMenu: TPopupMenu;
SetBuildModePopupMenu: TPopupMenu;
NewUnitFormPopupMenu: TPopupMenu;
NewUFSetDefaultMenuItem: TMenuItem;
NewUnitFormPopupMenu : TPopupMenu;
NewUFSetDefaultMenuItem: TMenuItem;
//splitter between the Coolbar and MainMenu
MainSplitter: TSplitter;
// MainMenu
mnuMainMenu: TMainMenu;
//mnuMain: TIDEMenuSection;
// file menu
@ -292,6 +261,7 @@ type
itmProjectViewUnits: TIDEMenuCommand;
itmProjectViewForms: TIDEMenuCommand;
itmProjectViewSource: TIDEMenuCommand;
itmProjectBuildMode: TIDEMenuCommand;
// run menu
//mnuRun: TIDEMenuSection;
@ -390,36 +360,24 @@ type
GlobalMouseSpeedButton: TSpeedButton;
procedure MainIDEBarDropFiles(Sender: TObject;
const FileNames: array of String);
procedure SplitterMouseDown(Sender: TObject; Button: TMouseButton;
{%H-}Shift: TShiftState; X, Y: Integer);
procedure SplitterMouseUp(Sender: TObject; {%H-}Button: TMouseButton;
{%H-}Shift: TShiftState; {%H-}X, {%H-}Y: Integer);
procedure SplitterMouseMove(Sender: TObject; {%H-}Shift: TShiftState; X, Y: Integer);
procedure pnlSpeedButtonsMouseDown(Sender: TObject; Button: TMouseButton;
{%H-}Shift: TShiftState; {%H-}X, {%H-}Y: Integer);
procedure CoolBarOnChange(Sender: TObject);
procedure MainSplitterMoved(Sender: TObject);
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;
procedure RefreshCoolbar;
end;
var
@ -470,7 +428,7 @@ var
begin
Category:=NewIDEItems.FindCategoryByPath(FileDescGroupName,true);
// find default template name
if NewUnitFormPopupMenu.PopupComponent=NewUnitSpeedBtn then begin
if NewUnitFormPopupMenu.PopupComponent.Name = 'itmFileNewUnit' then begin
TemplateName:=EnvironmentOptions.NewUnitTemplate;
if (TemplateName='') or (Category.FindTemplateByName(TemplateName)=nil) then
TemplateName:=FileDescNamePascalUnit;
@ -558,136 +516,89 @@ begin
NewUnitFormPopupMenu:=TPopupMenu.Create(TheOwner);
NewUnitFormPopupMenu.Name:='NewUnitFormPopupMenu';
NewUnitFormPopupMenu.OnPopup:=@NewUnitFormPopupMenuPopup;
NewUnitSpeedBtn.PopupMenu := NewUnitFormPopupMenu;
NewFormSpeedBtn.PopupMenu := NewUnitFormPopupMenu;
NewUFSetDefaultMenuItem:=TMenuItem.Create(TheOwner);
NewUFSetDefaultMenuItem.Name:='NewUFSetDefaultMenuItem';
NewUFSetDefaultMenuItem.Caption:=lisSetDefault;
NewUnitFormPopupMenu.Items.Add(NewUFSetDefaultMenuItem);
end;
procedure TMainIDEBar.SplitterMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if Button = mbLeft then
pmOptions := TPopupMenu.Create(TheOwner);
pmOptions.Images := IDEImages.Images_16;
miOptions := TMenuItem.Create(TheOwner);
with MainIDEBar.miOptions do
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;
Name := 'miToolbarOption';
Caption := lisOptions;
Enabled := True;
Visible := True;
ImageIndex := IDEImages.LoadImage(16, 'menu_environment_options');
end;
MainIDEBar.pmOptions.Items.Add(MainIDEBar.miOptions);
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);
procedure TMainIDEBar.RefreshCoolbar;
var
I: Integer;
I, J: Integer;
CoolBand: TCoolBand;
begin
for I := Low(Row) to High(Row) do
EnvironmentOptions.IDEToolBarList.Sort;
//read general settings
if not (EnvironmentOptions.IDECoolBarGrabStyle in [0..5]) then
EnvironmentOptions.IDECoolBarGrabStyle := 4;
Coolbar.GrabStyle := TGrabStyle(EnvironmentOptions.IDECoolBarGrabStyle);
if not (EnvironmentOptions.IDECoolBarGrabWidth in [1..50]) then
EnvironmentOptions.IDECoolBarGrabWidth := 5;
Coolbar.GrabWidth := EnvironmentOptions.IDECoolBarGrabWidth;
Coolbar.BandBorderStyle := TBorderStyle(EnvironmentOptions.IDECoolBarBorderStyle);
//read toolbars
CoolBar.Bands.Clear;
for I := 0 to EnvironmentOptions.IDEToolBarList.Count - 1 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;
CoolBand := CoolBar.Bands.Add;
CoolBand.Break := EnvironmentOptions.IDEToolBarList.Items[I].Break;
CoolBand.Control := EnvironmentOptions.IDEToolBarList.Items[I].Toolbar;
CoolBand.MinWidth := 25;
CoolBand.MinHeight := 22;
CoolBand.FixedSize := True;
EnvironmentOptions.IDEToolBarList.Items[I].ClearToolbar;
for J := 0 to EnvironmentOptions.IDEToolBarList.Items[I].ButtonNames.Count - 1 do
EnvironmentOptions.IDEToolBarList.Items[I].AddCustomItems(J);
end;
CoolBar.AutosizeBands;
CoolBar.Visible := EnvironmentOptions.IDECoolBarVisible;
itmViewIDESpeedButtons.Checked := CoolBar.Visible;
MainSplitter.Align := alLeft;
MainSplitter.Visible := MainIDEBar.Coolbar.Visible and
MainIDEBar.ComponentPageControl.Visible;
end;
procedure TMainIDEBar.SetPosition(var Row: array of TPanel; const PanelTop: Integer);
var
I: Integer;
procedure TMainIDEBar.MainSplitterMoved(Sender: TObject);
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;
EnvironmentOptions.IDECoolBarWidth := CoolBar.Width;
end;
procedure TMainIDEBar.SetToolbarsPositions;
procedure TMainIDEBar.CoolBarOnChange(Sender: TObject);
var
I: Integer;
Len: Integer;
TopRow, BottomRow: array of TPanel;
I, J: integer;
ToolBar: TToolBar;
begin
TopRow := nil;
BottomRow := nil;
for I := 0 to pnlSpeedButtons.ControlCount - 1 do
for I := 0 to Coolbar.Bands.Count - 1 do
begin
if not (pnlSpeedButtons.Controls[I] is TPanel) then
if Coolbar.Bands[I].Control = nil then
Continue;
if pnlSpeedButtons.Controls[I].Top <= pnlSpeedButtons.Controls[I].Height div 2 then
ToolBar := (Coolbar.Bands[I].Control as TToolBar);
J := EnvironmentOptions.IDEToolBarList.FindByToolBar(ToolBar);
if J <> -1 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);
EnvironmentOptions.IDEToolBarList.Items[J].Position := Coolbar.Bands[I].Index;
EnvironmentOptions.IDEToolBarList.Items[J].Break := Coolbar.Bands[I].Break;
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;
EnvironmentOptions.IDEToolBarList.Sort;
end;
end.

View File

@ -770,7 +770,7 @@ begin
CreateMenuItem(ParentMI,itmViewComponentPalette,'itmViewComponentPalette',lisMenuViewComponentPalette, '',
true, EnvironmentOptions.ComponentPaletteVisible);
CreateMenuItem(ParentMI,itmViewIDESpeedButtons,'itmViewIDESpeedButtons',lisMenuViewIDESpeedButtons, '',
true, EnvironmentOptions.ToolbarVisible);
true, EnvironmentOptions.IDECoolBarVisible);
end;
end;
@ -891,6 +891,7 @@ begin
CreateMenuItem(ParentMI,itmProjectViewUnits,'itmProjectViewUnits',lisMenuViewUnits, 'menu_view_units');
CreateMenuItem(ParentMI,itmProjectViewForms,'itmProjectViewForms',lisMenuViewForms, 'menu_view_forms');
CreateMenuItem(ParentMI,itmProjectViewSource,'itmProjectViewSource',lisMenuViewProjectSource, 'menu_project_viewsource');
CreateMenuItem(ParentMI,itmProjectBuildMode,'itmProjectBuildMode',lisChangeBuildMode, 'menu_compiler_options');
end;
end;