diff --git a/components/education/eduoptions.pas b/components/education/eduoptions.pas index b588815f4a..30a8c25c14 100644 --- a/components/education/eduoptions.pas +++ b/components/education/eduoptions.pas @@ -19,7 +19,7 @@ interface uses Classes, SysUtils, LCLProc, LazConfigStorage, Controls, Forms, BaseIDEIntf, - FileUtil, LazIDEIntf, IDEOptionsIntf, ProjectIntf; + LazFileUtils, LazIDEIntf, IDEOptionsIntf, ProjectIntf; resourcestring EduRSEducation = 'Education'; diff --git a/components/education/eduspeedbuttons.lfm b/components/education/eduspeedbuttons.lfm index 4b97569b2d..68031d50db 100644 --- a/components/education/eduspeedbuttons.lfm +++ b/components/education/eduspeedbuttons.lfm @@ -1,26 +1,28 @@ -inherited EduSpeedButtonsFrame: TEduSpeedButtonsFrame +object EduSpeedButtonsFrame: TEduSpeedButtonsFrame + Left = 0 Height = 483 + Top = 0 Width = 559 ClientHeight = 483 ClientWidth = 559 TabOrder = 0 DesignLeft = 425 DesignTop = 170 - object Panel: TPanel[0] + object Panel: TPanel Left = 0 Height = 483 Top = 0 - Width = 152 + Width = 150 Align = alLeft AutoSize = True ClientHeight = 483 - ClientWidth = 152 + ClientWidth = 150 TabOrder = 1 object ShowSelectionButton: TButton Left = 1 - Height = 29 - Top = 46 - Width = 150 + Height = 27 + Top = 44 + Width = 148 Align = alTop AutoSize = True BorderSpacing.Top = 6 @@ -30,9 +32,9 @@ inherited EduSpeedButtonsFrame: TEduSpeedButtonsFrame end object ShowAllButton: TButton Left = 1 - Height = 29 + Height = 27 Top = 11 - Width = 150 + Width = 148 Align = alTop AutoSize = True BorderSpacing.Top = 10 @@ -42,9 +44,9 @@ inherited EduSpeedButtonsFrame: TEduSpeedButtonsFrame end object HideAllButton: TButton Left = 1 - Height = 29 - Top = 90 - Width = 150 + Height = 27 + Top = 86 + Width = 148 Align = alTop AutoSize = True BorderSpacing.Top = 15 @@ -53,23 +55,22 @@ inherited EduSpeedButtonsFrame: TEduSpeedButtonsFrame TabOrder = 2 end end - object SpeedButtonsGroupBox: TGroupBox[1] - Left = 152 + object SpeedButtonsGroupBox: TGroupBox + Left = 150 Height = 483 Top = 0 - Width = 407 + Width = 409 Align = alClient Caption = 'SpeedButtonsGroupBox' ClientHeight = 464 - ClientWidth = 403 + ClientWidth = 405 TabOrder = 0 object SpeedButtonsTreeView: TTreeView Left = 0 Height = 464 Top = 0 - Width = 403 + Width = 405 Align = alClient - DefaultItemHeight = 19 TabOrder = 0 OnMouseDown = SpeedButtonsTreeViewMouseDown end diff --git a/components/education/eduspeedbuttons.pas b/components/education/eduspeedbuttons.pas index 3a8fab528b..351b73e9dd 100644 --- a/components/education/eduspeedbuttons.pas +++ b/components/education/eduspeedbuttons.pas @@ -105,9 +105,7 @@ begin inherited Destroy; end; - -function TEduSpeedButtonsOptions.GetButtonVisible(ButtonName: string - ): boolean; +function TEduSpeedButtonsOptions.GetButtonVisible(ButtonName: string): boolean; begin Result:=fVisible[ButtonName]='1'; end; @@ -162,28 +160,29 @@ procedure TEduSpeedButtonsOptions.Apply(Enable: boolean); var i: Integer; curButton: TToolButton; + Bar: TToolBar; begin + Bar := GetToolBar('tbStandard'); + if Assigned(Bar) then + for i:=0 to Bar.ButtonCount-1 do begin + curButton:=Bar.Buttons[i]; + if Assigned(curButton) and (curButton.Name <> '') then + curButton.Visible:=(not Enable) or ButtonVisible[curButton.Name]; + end; - for i:=0 to EduSpeedButtonsOptions.GetToolBar('tbStandard').ButtonCount-1 do begin - curButton:=EduSpeedButtonsOptions.GetToolBar('tbStandard').Buttons[i]; - if NOT(curButton.Name = '') then begin - curButton.Visible:=(not Enable) or ButtonVisible[curButton.Name]; - end; - end; - - for i:=0 to EduSpeedButtonsOptions.GetToolBar('tbViewDebug').ButtonCount-1 do begin - curButton:=EduSpeedButtonsOptions.GetToolBar('tbViewDebug').Buttons[i]; - if NOT(curButton.Name = '') then begin - curButton.Visible:=(not Enable) or ButtonVisible[curButton.Name]; - end; - end; + Bar := GetToolBar('tbViewDebug'); + if Assigned(Bar) then + for i:=0 to Bar.ButtonCount-1 do begin + curButton:=Bar.Buttons[i]; + if Assigned(curButton) and (curButton.Name <> '') then + curButton.Visible:=(not Enable) or ButtonVisible[curButton.Name]; + end; end; function TEduSpeedButtonsOptions.GetToolBar(tbName: string): TToolBar; var AComponent: TComponent; begin - if (tbName='tbStandard') or (tbName='tbViewDebug')then begin AComponent:=LazarusIDE.OwningComponent.FindComponent(tbName); if AComponent is TToolBar then @@ -191,7 +190,6 @@ begin else Result:=nil; end; - end; { TEduSpeedButtonsFrame } @@ -353,14 +351,19 @@ var CategoryNode: TTreeNode; curButton: TToolButton; Image: TCustomBitmap; + StandardBar, ViewDebugBar: TToolBar; begin + StandardBar:=EduSpeedButtonsOptions.GetToolBar('tbStandard'); + ViewDebugBar:=EduSpeedButtonsOptions.GetToolBar('tbViewDebug'); + if (StandardBar=Nil) or (ViewDebugBar=Nil) then Exit; + SpeedButtonsTreeView.BeginUpdate; SpeedButtonsTreeView.Items.Clear; if SpeedButtonsTreeView.Images=nil then begin SpeedButtonsTreeView.Images:=TImageList.Create(Self); - SpeedButtonsTreeView.Images.Width:=EduSpeedButtonsOptions.GetToolBar('tbStandard').ButtonWidth; - SpeedButtonsTreeView.Images.Height:=EduSpeedButtonsOptions.GetToolBar('tbStandard').ButtonHeight; + SpeedButtonsTreeView.Images.Width:=StandardBar.ButtonWidth; + SpeedButtonsTreeView.Images.Height:=StandardBar.ButtonHeight; SpeedButtonsTreeView.StateImages:=IDEImages.Images_16; end else @@ -369,9 +372,9 @@ begin HideImgID:=IDEImages.LoadImage(16,'menu_stop'); CategoryNode:=SpeedButtonsTreeView.Items.Add(nil,'Standard Buttons'); - for i:=0 to EduSpeedButtonsOptions.GetToolBar('tbStandard').ButtonCount-1 do begin + for i:=0 to StandardBar.ButtonCount-1 do begin - curButton:=EduSpeedButtonsOptions.GetToolBar('tbStandard').Buttons[i]; + curButton:=StandardBar.Buttons[i]; if NOT(curButton.Name = '') then begin curNode:=SpeedButtonsTreeView.Items.AddChild(CategoryNode,curButton.Name); Image := GetImageForSpeedBtn(curButton.Name); @@ -390,9 +393,9 @@ begin CategoryNode.Expanded:=true; CategoryNode:=SpeedButtonsTreeView.Items.Add(nil,'Debug Buttons'); - for i:=0 to EduSpeedButtonsOptions.GetToolBar('tbViewDebug').ButtonCount-1 do begin + for i:=0 to ViewDebugBar.ButtonCount-1 do begin - curButton:=EduSpeedButtonsOptions.GetToolBar('tbViewDebug').Buttons[i]; + curButton:=ViewDebugBar.Buttons[i]; if NOT(curButton.Name = '') then begin curNode:=SpeedButtonsTreeView.Items.AddChild(CategoryNode,curButton.Name); Image := GetImageForSpeedBtn(curButton.Name);