IDE: improve the new Example manager GUI.

git-svn-id: trunk@32814 -
This commit is contained in:
juha 2011-10-11 07:45:04 +00:00
parent 55247419c8
commit 166844b8e5
3 changed files with 101 additions and 73 deletions

View File

@ -420,6 +420,7 @@ resourcestring
lisMenuBuildLazarusProf = 'Build Lazarus with profile: %s';
lisMenuConfigureBuildLazarus = 'Configure "Build Lazarus" ...';
lisRootDirectoryForProjects = 'Root directory for projects';
lisMenuGeneralOptions = 'Options ...';
lisMenuEditCodeTemplates = 'Code Templates ...';
lisMenuCodeToolsDefinesEditor = 'CodeTools defines editor ...';
@ -2846,7 +2847,6 @@ resourcestring
lisLazBuildBuildSynEdit = 'Build SynEdit';
lisLazBuildBuildCodeTools = 'Build CodeTools';
lisLazBuildBuildIDE = 'Build IDE';
lisLazBuildBuildExamples = 'Build examples';
lisLazBuildOptions = 'Options:';
lisLazBuildTargetOS = 'Target OS:';
lisLazBuildTargetCPU = 'Target CPU:';

View File

@ -1,74 +1,39 @@
object ManageExamplesForm: TManageExamplesForm
Left = 389
Left = 378
Height = 416
Top = 162
Width = 768
Top = 161
Width = 790
Caption = 'ManageExamplesForm'
ClientHeight = 416
ClientWidth = 768
ClientWidth = 790
Position = poDesktopCenter
LCLVersion = '0.9.31'
object SettingsGroupBox: TGroupBox
Left = 0
Height = 80
Top = 0
Width = 768
Align = alTop
Caption = 'Settings'
ClientHeight = 63
ClientWidth = 764
TabOrder = 0
object RootDirectoryEdit: TDirectoryEdit
AnchorSideLeft.Control = RootDirectoryLabel
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = RootDirectoryLabel
AnchorSideTop.Side = asrCenter
Left = 101
Height = 23
Top = 9
Width = 480
ShowHidden = False
ButtonWidth = 23
NumGlyphs = 0
BorderSpacing.Left = 7
MaxLength = 0
TabOrder = 0
OnChange = RootDirectoryEditChange
end
object RootDirectoryLabel: TLabel
Left = 6
Height = 16
Top = 12
Width = 88
Caption = 'Root directory'
ParentColor = False
end
end
object ProjectsGroupBox: TGroupBox
AnchorSideLeft.Control = SettingsGroupBox
AnchorSideTop.Control = SettingsGroupBox
AnchorSideLeft.Control = RootRadioGroup
AnchorSideTop.Control = RootDirectoryEdit
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = ActionGroupBox
AnchorSideBottom.Control = ButtonPanel1
Left = 0
Height = 290
Top = 80
Width = 549
Left = 1
Height = 227
Top = 143
Width = 564
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Top = 13
Caption = 'Projects'
ClientHeight = 273
ClientWidth = 545
TabOrder = 1
ClientHeight = 210
ClientWidth = 560
TabOrder = 0
object ProjectsListBox: TListBox
Left = 0
Height = 273
Height = 210
Top = 0
Width = 545
Width = 560
Align = alClient
ItemHeight = 0
MultiSelect = True
OnSelectionChange = ProjectsListBoxSelectionChange
ScrollWidth = 541
ScrollWidth = 556
TabOrder = 0
TopIndex = -1
end
@ -77,7 +42,7 @@ object ManageExamplesForm: TManageExamplesForm
Left = 6
Height = 34
Top = 376
Width = 756
Width = 778
OKButton.Name = 'OKButton'
OKButton.DefaultCaption = True
HelpButton.Name = 'HelpButton'
@ -86,27 +51,26 @@ object ManageExamplesForm: TManageExamplesForm
CloseButton.DefaultCaption = True
CancelButton.Name = 'CancelButton'
CancelButton.DefaultCaption = True
TabOrder = 2
TabOrder = 1
ShowButtons = [pbClose, pbHelp]
end
object ActionGroupBox: TGroupBox
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = SettingsGroupBox
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = SettingsGroupBox
AnchorSideTop.Control = ProjectsGroupBox
AnchorSideRight.Control = RootRadioGroup
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = ProjectsGroupBox
AnchorSideBottom.Side = asrBottom
Left = 552
Height = 290
Top = 80
Left = 568
Height = 227
Top = 143
Width = 216
Anchors = [akTop, akRight, akBottom]
BorderSpacing.Left = 3
Caption = 'Action'
ClientHeight = 273
ClientHeight = 210
ClientWidth = 212
TabOrder = 3
TabOrder = 2
object Label1: TLabel
AnchorSideTop.Side = asrBottom
AnchorSideRight.Side = asrBottom
@ -160,4 +124,44 @@ object ManageExamplesForm: TManageExamplesForm
TabOrder = 3
end
end
object RootRadioGroup: TRadioGroup
Left = 1
Height = 97
Top = 5
Width = 783
Anchors = [akTop, akLeft, akRight]
AutoFill = True
BorderSpacing.Top = 5
Caption = 'Root directory for projects'
ChildSizing.LeftRightSpacing = 6
ChildSizing.TopBottomSpacing = 6
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
ChildSizing.EnlargeVertical = crsHomogenousChildResize
ChildSizing.ShrinkHorizontal = crsScaleChilds
ChildSizing.ShrinkVertical = crsScaleChilds
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 2
Columns = 2
OnClick = RootRadioGroupClick
TabOrder = 3
end
object RootDirectoryEdit: TDirectoryEdit
AnchorSideLeft.Control = RootRadioGroup
AnchorSideTop.Control = RootRadioGroup
AnchorSideTop.Side = asrBottom
AnchorSideRight.Side = asrBottom
Left = 4
Height = 23
Top = 107
Width = 743
ShowHidden = False
ButtonWidth = 23
NumGlyphs = 0
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 3
BorderSpacing.Top = 5
MaxLength = 0
TabOrder = 4
OnChange = RootDirectoryEditChange
end
end

View File

@ -18,26 +18,27 @@ type
OpenSelectedButton: TBitBtn;
Label1: TLabel;
ProjectsListBox: TListBox;
RootRadioGroup: TRadioGroup;
SelectAllButton: TBitBtn;
ButtonPanel1: TButtonPanel;
RootDirectoryEdit: TDirectoryEdit;
ActionGroupBox: TGroupBox;
RootDirectoryLabel: TLabel;
SelectNoneButton: TBitBtn;
SettingsGroupBox: TGroupBox;
ProjectsGroupBox: TGroupBox;
procedure BuildAllSelectedButtonClick(Sender: TObject);
procedure OpenSelectedButtonClick(Sender: TObject);
procedure ProjectsListBoxSelectionChange(Sender: TObject; User: boolean);
procedure RootDirectoryEditChange(Sender: TObject);
procedure RootRadioGroupClick(Sender: TObject);
procedure SelectAllButtonClick(Sender: TObject);
procedure SelectNoneButtonClick(Sender: TObject);
procedure ShowPathCheckBoxChange(Sender: TObject);
private
fOtherPathIndex: Integer;
fSelectedFilename: string;
fChangingSelections: Boolean;
fUpdating: Boolean;
fIdleConnected: boolean;
fSelectedFilename: string;
procedure FillProjectList(Immediately: boolean);
procedure SetIdleConnected(const AValue: boolean);
procedure OnIdle(Sender: TObject; var Done: Boolean);
@ -57,16 +58,10 @@ implementation
function ShowManageExamplesDlg: TModalResult;
var
theForm: TManageExamplesForm;
path: String;
begin
Result:=mrCancel;
theForm:=TManageExamplesForm.Create(Nil);
try
path:=EnvironmentOptions.LazarusDirectory+'examples';
if DirectoryExistsUTF8(path) then begin
theForm.RootDirectoryEdit.Text:=path;
theForm.FillProjectList(False);
end;
Result:=theForm.ShowModal;
if Result=mrYes then
MainIDEInterface.DoOpenProjectFile(theForm.fSelectedFilename,
@ -105,10 +100,30 @@ end;
{ TManageExamplesForm }
constructor TManageExamplesForm.Create(AnOwner: TComponent);
var
path: String;
begin
inherited Create(AnOwner);
fChangingSelections:=False;
fUpdating:=False;
Caption:=lisKMExampleProjects;
RootRadioGroup.Caption:=lisRootDirectoryForProjects;
// Add some paths for example projects
RootRadioGroup.Items.Add(EnvironmentOptions.LazarusDirectory); // Lazarus root
path:=EnvironmentOptions.LazarusDirectory+'examples';
if DirectoryExistsUTF8(path) then // Select this one
RootRadioGroup.ItemIndex:=RootRadioGroup.Items.Add(path);
path:=EnvironmentOptions.LazarusDirectory+'components/codetools/examples/';
if DirectoryExistsUTF8(path) then
RootRadioGroup.Items.Add(path);
fOtherPathIndex:=RootRadioGroup.Items.Add('Other');
RootDirectoryEdit.Text:=RootRadioGroup.Items[RootRadioGroup.ItemIndex];
FillProjectList(False);
OpenSelectedButton.Caption:=lisExamplesOpenFirstSelected;
BuildAllSelectedButton.Caption:=lisExamplesBuildAllSelected;
@ -159,7 +174,6 @@ end;
procedure TManageExamplesForm.OnIdle(Sender: TObject; var Done: Boolean);
begin
if Done then ;
IdleConnected:=false;
FillProjectList(true);
end;
@ -169,6 +183,16 @@ begin
FillProjectList(False);
end;
procedure TManageExamplesForm.RootRadioGroupClick(Sender: TObject);
begin
if RootRadioGroup.ItemIndex=fOtherPathIndex then
RootDirectoryEdit.Enabled:=True
else begin
RootDirectoryEdit.Enabled:=False;
RootDirectoryEdit.Text:=RootRadioGroup.Items[RootRadioGroup.ItemIndex];
end;
end;
procedure TManageExamplesForm.ShowPathCheckBoxChange(Sender: TObject);
begin
FillProjectList(False);