IDE: Layout improvements for BuildModes manager. Issue #28296, patch from Alexey Torgashin.

git-svn-id: trunk@49347 -
This commit is contained in:
juha 2015-06-16 11:32:45 +00:00
parent 8bbae227d3
commit e0a68da24d
3 changed files with 228 additions and 189 deletions

View File

@ -1,158 +1,22 @@
object BuildModesForm: TBuildModesForm object BuildModesForm: TBuildModesForm
Left = 335 Left = 396
Height = 366 Height = 354
Top = 486 Top = 484
Width = 612 Width = 612
ActiveControl = BuildModesStringGrid
BorderIcons = [biSystemMenu]
Caption = 'BuildModesForm' Caption = 'BuildModesForm'
ClientHeight = 366 ClientHeight = 354
ClientWidth = 612 ClientWidth = 612
OnCreate = FormCreate OnCreate = FormCreate
OnDestroy = FormDestroy OnDestroy = FormDestroy
OnShow = FormShow OnShow = FormShow
Position = poScreenCenter Position = poScreenCenter
LCLVersion = '1.5' LCLVersion = '1.5'
object BuildModesGroupBox: TGroupBox
Left = 6
Height = 305
Top = 6
Width = 600
Align = alTop
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Around = 6
Caption = 'BuildModesGroupBox'
ClientHeight = 286
ClientWidth = 596
TabOrder = 0
object BuildModesStringGrid: TStringGrid
AnchorSideTop.Control = AddSpeedButton
AnchorSideTop.Side = asrBottom
Left = 0
Height = 254
Top = 32
Width = 596
Align = alBottom
Anchors = [akTop, akLeft, akRight, akBottom]
AutoFillColumns = True
BorderSpacing.Top = 10
ColCount = 3
Columns = <
item
ButtonStyle = cbsCheckboxColumn
MaxSize = 50
Title.Caption = 'Active'
Width = 197
end
item
ButtonStyle = cbsCheckboxColumn
MaxSize = 50
Title.Caption = 'InSession'
Width = 197
end
item
MaxSize = 500
SizePriority = 100
Title.Caption = 'Title'
Width = 198
end>
FixedCols = 0
Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goEditing, goSmoothScroll]
TabOrder = 0
OnCheckboxToggled = BuildModesCheckboxToggled
OnDrawCell = BuildModesStringGridDrawCell
OnSelection = BuildModesStringGridSelection
OnValidateEntry = BuildModesStringGridValidateEntry
ColWidths = (
197
197
198
)
end
object AddSpeedButton: TSpeedButton
AnchorSideLeft.Control = BuildModesGroupBox
AnchorSideTop.Control = BuildModesGroupBox
Left = 0
Height = 22
Top = 0
Width = 23
OnClick = AddSpeedButtonClick
ShowHint = True
ParentShowHint = False
end
object DeleteSpeedButton: TSpeedButton
AnchorSideLeft.Control = AddSpeedButton
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = BuildModesGroupBox
Left = 23
Height = 22
Top = 0
Width = 23
OnClick = DeleteSpeedButtonClick
ShowHint = True
ParentShowHint = False
end
object MoveUpSpeedButton: TSpeedButton
AnchorSideLeft.Control = DeleteSpeedButton
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = BuildModesGroupBox
Left = 46
Height = 22
Top = 0
Width = 23
OnClick = MoveUpSpeedButtonClick
ShowHint = True
ParentShowHint = False
end
object MoveDownSpeedButton: TSpeedButton
AnchorSideLeft.Control = MoveUpSpeedButton
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = BuildModesGroupBox
Left = 69
Height = 22
Top = 0
Width = 23
OnClick = MoveDownSpeedButtonClick
ShowHint = True
ParentShowHint = False
end
object DiffSpeedButton: TSpeedButton
AnchorSideLeft.Control = MoveDownSpeedButton
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = BuildModesGroupBox
Left = 102
Height = 22
Top = 0
Width = 23
BorderSpacing.Left = 10
OnClick = DiffSpeedButtonClick
ShowHint = True
ParentShowHint = False
end
object NoteLabel: TLabel
AnchorSideTop.Control = DiffSpeedButton
AnchorSideTop.Side = asrCenter
Left = 160
Height = 15
Top = 4
Width = 62
Caption = 'NoteLabel'
ParentColor = False
end
object btnCreateDefaultModes: TButton
Left = 374
Height = 27
Top = -3
Width = 216
Anchors = [akTop, akRight]
AutoSize = True
Caption = 'Create Debug and Release modes'
OnClick = btnCreateDefaultModesClick
TabOrder = 1
end
end
object ButtonPanel1: TButtonPanel object ButtonPanel1: TButtonPanel
Left = 6 Left = 6
Height = 36 Height = 29
Top = 324 Top = 319
Width = 600 Width = 600
OKButton.Name = 'OKButton' OKButton.Name = 'OKButton'
OKButton.DefaultCaption = True OKButton.DefaultCaption = True
@ -164,11 +28,175 @@ object BuildModesForm: TBuildModesForm
CancelButton.Name = 'CancelButton' CancelButton.Name = 'CancelButton'
CancelButton.DefaultCaption = True CancelButton.DefaultCaption = True
CancelButton.OnClick = CancelButtonClick CancelButton.OnClick = CancelButtonClick
TabOrder = 1 TabOrder = 2
ShowButtons = [pbOK, pbCancel, pbHelp] ShowButtons = [pbOK, pbCancel, pbHelp]
ShowBevel = False
end
object ToolBar1: TToolBar
AnchorSideLeft.Control = cbDebugReleaseProject
AnchorSideTop.Control = cbDebugReleaseProject
AnchorSideTop.Side = asrBottom
Left = 6
Height = 28
Top = 37
Width = 154
Align = alNone
BorderSpacing.Top = 9
ButtonHeight = 26
ButtonWidth = 26
Caption = 'ToolBar1'
EdgeBorders = []
EdgeInner = esNone
EdgeOuter = esNone
Images = ImageList1
ParentShowHint = False
ShowHint = True
TabOrder = 0
object ToolButtonAdd: TToolButton
Left = 1
Top = 0
Caption = 'ToolButtonAdd'
OnClick = AddSpeedButtonClick
end
object ToolButtonDelete: TToolButton
Left = 27
Top = 0
Caption = 'ToolButtonDelete'
OnClick = DeleteSpeedButtonClick
end
object ToolButtonMoveUp: TToolButton
Left = 58
Top = 0
Caption = 'ToolButtonMoveUp'
OnClick = MoveUpSpeedButtonClick
end
object ToolButtonMoveDown: TToolButton
Left = 84
Top = 0
Caption = 'ToolButtonMoveDown'
OnClick = MoveDownSpeedButtonClick
end
object ToolButton5: TToolButton
Left = 110
Height = 26
Top = 0
Width = 5
Caption = 'ToolButton5'
Style = tbsDivider
end
object ToolButtonDiff: TToolButton
Left = 115
Top = 0
Caption = 'ToolButtonDiff'
OnClick = DiffSpeedButtonClick
end
object ToolButton1: TToolButton
Left = 53
Height = 26
Top = 0
Width = 5
Caption = 'ToolButton1'
Style = tbsDivider
end
end
object NoteLabel: TLabel
AnchorSideLeft.Control = ToolBar1
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = ToolBar1
AnchorSideTop.Side = asrCenter
Left = 166
Height = 17
Top = 43
Width = 56
BorderSpacing.Left = 6
Caption = 'NoteLabel'
Font.Color = clMaroon
Font.Style = [fsItalic]
ParentColor = False
ParentFont = False
end
object BuildModesStringGrid: TStringGrid
AnchorSideLeft.Control = ToolBar1
AnchorSideTop.Control = ToolBar1
AnchorSideTop.Side = asrBottom
Left = 6
Height = 244
Top = 71
Width = 602
Anchors = [akTop, akLeft, akRight, akBottom]
AutoFillColumns = True
BorderSpacing.Top = 6
ColCount = 3
Columns = <
item
ButtonStyle = cbsCheckboxColumn
MaxSize = 50
Title.Caption = 'Active'
Width = 199
end
item
ButtonStyle = cbsCheckboxColumn
MaxSize = 50
Title.Caption = 'InSession'
Width = 199
end
item
MaxSize = 500
SizePriority = 100
Title.Caption = 'Title'
Width = 200
end>
FixedCols = 0
Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goEditing, goRowSelect, goThumbTracking, goSmoothScroll]
TabOrder = 1
OnCheckboxToggled = BuildModesCheckboxToggled
OnDrawCell = BuildModesStringGridDrawCell
OnSelection = BuildModesStringGridSelection
OnValidateEntry = BuildModesStringGridValidateEntry
ColWidths = (
199
199
200
)
end
object cbDebugReleaseProject: TCheckBox
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Owner
Left = 6
Height = 22
Top = 6
Width = 310
BorderSpacing.Left = 6
BorderSpacing.Top = 6
Caption = 'Create Debug and Release modes for new projects'
OnClick = cbDebugReleaseProjectClick
ParentShowHint = False
ShowHint = True
TabOrder = 3
end
object btnCreateDefaultModes: TButton
AnchorSideLeft.Control = cbDebugReleaseProject
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = cbDebugReleaseProject
AnchorSideTop.Side = asrCenter
Left = 322
Height = 29
Top = 3
Width = 162
AutoSize = True
BorderSpacing.Left = 6
Caption = 'Create now for this project'
OnClick = btnCreateDefaultModesClick
ParentShowHint = False
ShowHint = True
TabOrder = 4
end end
object BuildModesPopupMenu: TPopupMenu object BuildModesPopupMenu: TPopupMenu
left = 208 left = 168
top = 88 top = 260
end
object ImageList1: TImageList
left = 240
top = 280
end end
end end

View File

@ -30,31 +30,35 @@ unit BuildModesManager;
interface interface
uses uses
Classes, SysUtils, Forms, Controls, Dialogs, StdCtrls, Grids, Buttons, Menus, Classes, SysUtils, Forms, Controls, Dialogs, StdCtrls, Grids, Menus, ComCtrls,
ButtonPanel, LCLProc, Graphics, IDEOptionsIntf, IDEDialogs, TransferMacros, ButtonPanel, LCLProc, IDEOptionsIntf, IDEDialogs, TransferMacros, Project,
Project, CompOptsIntf, CompilerOptions, Compiler_ModeMatrix, CompOptsIntf, CompilerOptions, Compiler_ModeMatrix, BuildModeDiffDlg, LazarusIDEStrConsts;
BuildModeDiffDlg, LazarusIDEStrConsts;
type type
{ TBuildModesForm } { TBuildModesForm }
TBuildModesForm = class(TForm) TBuildModesForm = class(TForm)
AddSpeedButton: TSpeedButton;
DeleteSpeedButton: TSpeedButton;
DiffSpeedButton: TSpeedButton;
MoveDownSpeedButton: TSpeedButton;
MoveUpSpeedButton: TSpeedButton;
BuildModesGroupBox: TGroupBox;
BuildModesPopupMenu: TPopupMenu;
BuildModesStringGrid: TStringGrid;
btnCreateDefaultModes: TButton; btnCreateDefaultModes: TButton;
BuildModesStringGrid: TStringGrid;
cbDebugReleaseProject: TCheckBox;
ImageList1: TImageList;
BuildModesPopupMenu: TPopupMenu;
ButtonPanel1: TButtonPanel; ButtonPanel1: TButtonPanel;
NoteLabel: TLabel; NoteLabel: TLabel;
ToolBar1: TToolBar;
ToolButton1: TToolButton;
ToolButton5: TToolButton;
ToolButtonAdd: TToolButton;
ToolButtonDelete: TToolButton;
ToolButtonDiff: TToolButton;
ToolButtonMoveDown: TToolButton;
ToolButtonMoveUp: TToolButton;
procedure btnCreateDefaultModesClick(Sender: TObject); procedure btnCreateDefaultModesClick(Sender: TObject);
procedure BuildModesStringGridDrawCell(Sender: TObject; procedure BuildModesStringGridDrawCell(Sender: TObject;
aCol, aRow: Integer; aRect: TRect; {%H-}aState: TGridDrawState); aCol, aRow: Integer; aRect: TRect; {%H-}aState: TGridDrawState);
procedure CancelButtonClick(Sender: TObject); procedure CancelButtonClick(Sender: TObject);
procedure cbDebugReleaseProjectClick(Sender: TObject);
procedure FormCreate(Sender: TObject); procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject); procedure FormDestroy(Sender: TObject);
procedure DiffSpeedButtonClick(Sender: TObject); procedure DiffSpeedButtonClick(Sender: TObject);
@ -204,17 +208,21 @@ end;
procedure TBuildModesForm.FormShow(Sender: TObject); procedure TBuildModesForm.FormShow(Sender: TObject);
begin begin
// options dialog // options dialog
BuildModesGroupBox.Caption:=lisBuildModes;
DoShowSession; DoShowSession;
// modes // modes
FillBuildModesGrid; FillBuildModesGrid;
UpdateBuildModeButtons; UpdateBuildModeButtons;
AddSpeedButton.LoadGlyphFromResourceName(HInstance, 'laz_add'); ImageList1.AddResourceName(HInstance, 'laz_add');
DeleteSpeedButton.LoadGlyphFromResourceName(HInstance, 'laz_delete'); ImageList1.AddResourceName(HInstance, 'laz_delete');
MoveUpSpeedButton.LoadGlyphFromResourceName(HInstance, 'arrow_up'); ImageList1.AddResourceName(HInstance, 'arrow_up');
MoveDownSpeedButton.LoadGlyphFromResourceName(HInstance, 'arrow_down'); ImageList1.AddResourceName(HInstance, 'arrow_down');
DiffSpeedButton.LoadGlyphFromResourceName(HInstance, 'menu_tool_diff'); ImageList1.AddResourceName(HInstance, 'menu_tool_diff');
ToolButtonAdd.ImageIndex:=0;
ToolButtonDelete.ImageIndex:=1;
ToolButtonMoveUp.ImageIndex:=2;
ToolButtonMoveDown.ImageIndex:=3;
ToolButtonDiff.ImageIndex:=4;
end; end;
procedure TBuildModesForm.DiffSpeedButtonClick(Sender: TObject); procedure TBuildModesForm.DiffSpeedButtonClick(Sender: TObject);
@ -522,23 +530,23 @@ begin
Identifier:=''; Identifier:='';
end; end;
// Dialog caption // Dialog caption
if Project1<>nil then Caption:=Format(lisBuildMode, [Identifier]);
Caption:=Format(dlgProjectOptionsFor,[Project1.GetTitleOrName])
+ ', '+copy(Identifier,1,12)
else
Caption:='No project';
// Buttons // Buttons
AddSpeedButton.Hint:=Format(lisAddNewBuildModeCopyingSettingsFrom, [Identifier]); ToolButtonAdd.Hint:=Format(lisAddNewBuildModeCopyingSettingsFrom, [Identifier]);
DeleteSpeedButton.Enabled:=(CurMode<>nil) and (fBuildModes.Count>1); ToolButtonDelete.Enabled:=(CurMode<>nil) and (fBuildModes.Count>1);
DeleteSpeedButton.Hint:=Format(lisDeleteMode, [Identifier]); ToolButtonDelete.Hint:=Format(lisDeleteMode, [Identifier]);
MoveUpSpeedButton.Enabled:=(CurMode<>nil) and (i>0); ToolButtonMoveUp.Enabled:=(CurMode<>nil) and (i>0);
MoveUpSpeedButton.Hint:=Format(lisMoveOnePositionUp, [Identifier]); ToolButtonMoveUp.Hint:=Format(lisMoveOnePositionUp, [Identifier]);
MoveDownSpeedButton.Enabled:=i<BuildModesStringGrid.RowCount-2; ToolButtonMoveDown.Enabled:=i<BuildModesStringGrid.RowCount-2;
MoveDownSpeedButton.Hint:=Format(lisMoveOnePositionDown, [Identifier]); ToolButtonMoveDown.Hint:=Format(lisMoveOnePositionDown, [Identifier]);
DiffSpeedButton.Hint:=lisShowDifferencesBetweenModes; ToolButtonDiff.Hint:=lisShowDifferencesBetweenModes;
NoteLabel.Caption:=''; NoteLabel.Caption:='';
btnCreateDefaultModes.Caption:=lisCreateDebugAndReleaseModes; // ToDo: Save in Environment options and use for new projects.
btnCreateDefaultModes.Hint:=''; cbDebugReleaseProject.Caption:=lisCreateDebugAndReleaseModesNewProj;
cbDebugReleaseProject.Hint:='Under Construction ...'; // Remove this when implemented.
btnCreateDefaultModes.Caption:=lisCreateNowForThisProject;
btnCreateDefaultModes.Hint:=''; // ToDo: Figure out a good hint.
btnCreateDefaultModes.Visible := (fBuildModes.Find(DebugModeName)=Nil) btnCreateDefaultModes.Visible := (fBuildModes.Find(DebugModeName)=Nil)
and (fBuildModes.Find(ReleaseModeName)=Nil); and (fBuildModes.Find(ReleaseModeName)=Nil);
end; end;
@ -605,6 +613,11 @@ begin
; ;
end; end;
procedure TBuildModesForm.cbDebugReleaseProjectClick(Sender: TObject);
begin
(Sender as TCheckBox).Checked := False;
end;
procedure TBuildModesForm.BuildModesStringGridDrawCell(Sender: TObject; procedure TBuildModesForm.BuildModesStringGridDrawCell(Sender: TObject;
aCol, aRow: Integer; aRect: TRect; aState: TGridDrawState); aCol, aRow: Integer; aRect: TRect; aState: TGridDrawState);
begin begin

View File

@ -5524,8 +5524,7 @@ resourcestring
lisCanNotCompileProject = 'Cannot compile project'; lisCanNotCompileProject = 'Cannot compile project';
lisTheProjectHasNoMainSourceFile = 'The project has no main source file.'; lisTheProjectHasNoMainSourceFile = 'The project has no main source file.';
lisInvalidMacroTheNameIsAKeyword = 'Invalid macro name "%s". The name ' lisInvalidMacroTheNameIsAKeyword = 'Invalid macro name "%s". The name is a keyword.';
+'is a keyword.';
lisTheMacroDoesNotBeginWith = 'The macro "%s" does not begin with "%s".'; lisTheMacroDoesNotBeginWith = 'The macro "%s" does not begin with "%s".';
lisRenameTo = 'Rename to %s'; lisRenameTo = 'Rename to %s';
lisAddValueToMacro = 'Add value to macro %s'; lisAddValueToMacro = 'Add value to macro %s';
@ -5540,8 +5539,7 @@ resourcestring
lisDlgDefines = 'Defines ...'; lisDlgDefines = 'Defines ...';
lisWithIncludes2 = ', with includes '; lisWithIncludes2 = ', with includes ';
lisParsed = ', parsed '; lisParsed = ', parsed ';
lisCreatingFileIndexOfFPCSources = lisCreatingFileIndexOfFPCSources = 'Creating file index of FPC sources %s ...';
'Creating file index of FPC sources %s ...';
lisTheFileIndexIsNeededForFunctionsLikeFindDeclaratio = 'The file index is ' lisTheFileIndexIsNeededForFunctionsLikeFindDeclaratio = 'The file index is '
+'needed for functions like find declaration. While scanning you can edit ' +'needed for functions like find declaration. While scanning you can edit '
+'sources and compile, but functions like find declaration will show unit-' +'sources and compile, but functions like find declaration will show unit-'
@ -5554,15 +5552,15 @@ resourcestring
'The default mode must be stored in project, not in session.'; 'The default mode must be stored in project, not in session.';
lisThereMustBeAtLeastOneBuildMode = 'There must be at least one build mode.'; lisThereMustBeAtLeastOneBuildMode = 'There must be at least one build mode.';
lisDuplicateEntry = 'Duplicate entry'; lisDuplicateEntry = 'Duplicate entry';
lisThereIsAlreadyABuildModeWithThisName = 'There is already a build mode ' lisThereIsAlreadyABuildModeWithThisName = 'There is already a build mode with this name.';
+'with this name.'; lisAddNewBuildModeCopyingSettingsFrom = 'Add new build mode, copying settings from "%s"';
lisAddNewBuildModeCopyingSettingsFrom = 'Add new build mode, copying '
+'settings from "%s"';
lisDeleteMode = 'Delete mode "%s"'; lisDeleteMode = 'Delete mode "%s"';
lisMoveOnePositionUp = 'Move "%s" one position up'; lisMoveOnePositionUp = 'Move "%s" one position up';
lisMoveOnePositionDown = 'Move "%s" one position down'; lisMoveOnePositionDown = 'Move "%s" one position down';
lisShowDifferencesBetweenModes = 'Show differences between modes ...'; lisShowDifferencesBetweenModes = 'Show differences between modes ...';
lisCreateDebugAndReleaseModes = 'Create Debug and Release modes'; lisBuildMode = 'Build Mode: %s';
lisCreateDebugAndReleaseModesNewProj = 'Create Debug and Release modes for new projects';
lisCreateNowForThisProject = 'Create now for this project';
lisChangeBuildMode = 'Change build mode'; lisChangeBuildMode = 'Change build mode';
lisWarningThisIsTheMainUnitTheNewMainUnitWillBePas = '%sWarning: This is ' lisWarningThisIsTheMainUnitTheNewMainUnitWillBePas = '%sWarning: This is '
+'the main unit. The new main unit will be %s.pas.'; +'the main unit. The new main unit will be %s.pas.';