diff --git a/.gitattributes b/.gitattributes index 8da1a854c5..f256a84daa 100644 --- a/.gitattributes +++ b/.gitattributes @@ -335,8 +335,13 @@ components/editortoolbar/toolbar.lrs svneol=native#text/pascal components/education/README.txt svneol=native#text/plain components/education/educationlaz.lpk svneol=native#text/plain components/education/educationlaz.pas svneol=native#text/plain +components/education/eduoptions.pas svneol=native#text/plain components/education/eduoptionsdlg.lfm svneol=native#text/plain +components/education/eduoptionsdlg.lrs svneol=native#text/plain components/education/eduoptionsdlg.pas svneol=native#text/plain +components/education/edupkgsystem.lfm svneol=native#text/plain +components/education/edupkgsystem.lrs svneol=native#text/plain +components/education/edupkgsystem.pas svneol=native#text/plain components/filebrowser/frmconfigfilebrowser.lfm svneol=native#text/plain components/filebrowser/frmconfigfilebrowser.lrs svneol=native#text/pascal components/filebrowser/frmconfigfilebrowser.pp svneol=native#text/plain diff --git a/components/education/educationlaz.lpk b/components/education/educationlaz.lpk index 09e885ee9e..26d67b5a48 100644 --- a/components/education/educationlaz.lpk +++ b/components/education/educationlaz.lpk @@ -6,7 +6,7 @@ - + @@ -15,7 +15,7 @@ - + @@ -25,6 +25,14 @@ + + + + + + + + diff --git a/components/education/educationlaz.pas b/components/education/educationlaz.pas index 309d2c7059..20a974d739 100644 --- a/components/education/educationlaz.pas +++ b/components/education/educationlaz.pas @@ -7,7 +7,7 @@ unit EducationLaz; interface uses - EduOptionsDlg, LazarusPackageIntf; + EduOptionsDlg, EduOptions, LazarusPackageIntf; implementation diff --git a/components/education/eduoptions.pas b/components/education/eduoptions.pas new file mode 100644 index 0000000000..359a415ef0 --- /dev/null +++ b/components/education/eduoptions.pas @@ -0,0 +1,160 @@ +{ + ***************************************************************************** + * * + * This file is part of the EducationLaz package * + * * + * See the file COPYING.modifiedLGPL.txt, included in this distribution, * + * for details about the copyright. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * * + ***************************************************************************** + + Author: Mattias Gaertner + + Abstract: + Options. +} +unit EduOptions; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils, LazConfigStorage, Controls, Forms; + +type + + { TEduOptionsNode } + + TEduOptionsNode = class + private + FChilds: TFPList; // list of TEduOptionsNode + FName: string; + FNextSibling: TEduOptionsNode; + FParent: TEduOptionsNode; + FPrevSibling: TEduOptionsNode; + function GetChildCount: integer; + function GetChilds(Index: integer): TEduOptionsNode; + procedure SetName(const AValue: string); + public + constructor Create; + destructor Destroy; override; + procedure Clear; virtual; + procedure Delete(Index: integer); virtual; + procedure Remove(Index: integer); virtual; + function GetCaption: string; virtual; + function Load(Config: TConfigStorage): TModalResult; virtual; + function Save(Config: TConfigStorage): TModalResult; virtual; + public + property Name: string read FName write SetName; + property Parent: TEduOptionsNode read FParent; + property NextSibling: TEduOptionsNode read FNextSibling; + property PrevSibling: TEduOptionsNode read FPrevSibling; + property ChildCount: integer read GetChildCount; + property Childs[Index: integer]: TEduOptionsNode read GetChilds; default; + end; + +implementation + +{ TEduOptionsNode } + +procedure TEduOptionsNode.SetName(const AValue: string); +begin + if FName=AValue then exit; + FName:=AValue; +end; + +function TEduOptionsNode.GetChilds(Index: integer): TEduOptionsNode; +begin + Result:=TEduOptionsNode(fChilds[Index]); +end; + +function TEduOptionsNode.GetChildCount: integer; +begin + Result:=fChilds.Count; +end; + +constructor TEduOptionsNode.Create; +begin + fChilds:=TFPList.Create; +end; + +destructor TEduOptionsNode.Destroy; +begin + Clear; + FreeAndNil(fChilds); + inherited Destroy; +end; + +procedure TEduOptionsNode.Clear; +begin + while ChildCount>0 do Delete(ChildCount-1); +end; + +procedure TEduOptionsNode.Delete(Index: integer); +var + Child: TEduOptionsNode; +begin + Child:=Childs[Index]; + Remove(Index); + Child.Free; +end; + +procedure TEduOptionsNode.Remove(Index: integer); +var + Child: TEduOptionsNode; +begin + Child:=Childs[Index]; + fChilds.Delete(Index); + Child.FParent:=nil; + if Child.FPrevSibling<>nil then + Child.FPrevSibling.FNextSibling:=FNextSibling; + if Child.FNextSibling<>nil then + Child.FNextSibling.FPrevSibling:=FPrevSibling; + Child.FPrevSibling:=nil; + Child.FNextSibling:=nil; +end; + +function TEduOptionsNode.GetCaption: string; +begin + Result:=Name; +end; + +function TEduOptionsNode.Load(Config: TConfigStorage): TModalResult; +var + i: Integer; + Child: TEduOptionsNode; +begin + for i:=0 to ChildCount-1 do begin + Child:=Childs[i]; + if (Child.Name='') or (not IsValidIdent(Child.Name)) then continue; + Config.AppendBasePath(Child.Name); + Result:=Child.Load(Config); + if Result<>mrOK then exit; + Config.UndoAppendBasePath; + end; + Result:=mrOk; +end; + +function TEduOptionsNode.Save(Config: TConfigStorage): TModalResult; +var + i: Integer; + Child: TEduOptionsNode; +begin + for i:=0 to ChildCount-1 do begin + Child:=Childs[i]; + if (Child.Name='') or (not IsValidIdent(Child.Name)) then continue; + Config.AppendBasePath(Child.Name); + Result:=Child.Save(Config); + if Result<>mrOK then exit; + Config.UndoAppendBasePath; + end; + Result:=mrOk; +end; + +end. + diff --git a/components/education/eduoptionsdlg.lfm b/components/education/eduoptionsdlg.lfm index bcc12c7779..57da9bc734 100644 --- a/components/education/eduoptionsdlg.lfm +++ b/components/education/eduoptionsdlg.lfm @@ -1,7 +1,7 @@ object EduOptionsDialog: TEduOptionsDialog - Left = 298 + Left = 305 Height = 382 - Top = 170 + Top = 160 Width = 554 Caption = 'EduOptionsDialog' ClientHeight = 382 diff --git a/components/education/eduoptionsdlg.lrs b/components/education/eduoptionsdlg.lrs new file mode 100644 index 0000000000..725ba5f9b2 --- /dev/null +++ b/components/education/eduoptionsdlg.lrs @@ -0,0 +1,15 @@ +{ This is an automatically generated lazarus resource file } + +LazarusResources.Add('TEduOptionsDialog','FORMDATA',[ + 'TPF0'#17'TEduOptionsDialog'#16'EduOptionsDialog'#4'Left'#3'1'#1#6'Height'#3 + +'~'#1#3'Top'#3#160#0#5'Width'#3'*'#2#7'Caption'#6#16'EduOptionsDialog'#12'Cl' + +'ientHeight'#3'~'#1#11'ClientWidth'#3'*'#2#8'OnCreate'#7#10'FormCreate'#10'L' + +'CLVersion'#6#6'0.9.27'#0#12'TButtonPanel'#12'ButtonPanel1'#4'Left'#2#6#6'He' + +'ight'#2'!'#3'Top'#3'W'#1#5'Width'#3#30#2#8'TabOrder'#2#0#11'ShowButtons'#11 + +#4'pbOK'#8'pbCancel'#6'pbHelp'#0#0#0#9'TTreeView'#14'FramesTreeView'#4'Left' + +#2#6#6'Height'#3'K'#1#3'Top'#2#6#5'Width'#3#186#0#5'Align'#7#6'alLeft'#20'Bo' + +'rderSpacing.Around'#2#6#17'DefaultItemHeight'#2#19#8'TabOrder'#2#1#0#0#6'TP' + +'anel'#10'FramePanel'#4'Left'#3#198#0#6'Height'#3'Q'#1#3'Top'#2#0#5'Width'#3 + +'d'#1#5'Align'#7#8'alClient'#7'Caption'#6#10'FramePanel'#8'TabOrder'#2#2#0#0 + +#0 +]); diff --git a/components/education/edupkgsystem.lfm b/components/education/edupkgsystem.lfm new file mode 100644 index 0000000000..c6d360934d --- /dev/null +++ b/components/education/edupkgsystem.lfm @@ -0,0 +1,50 @@ +object EduPkgSystemFrame: TEduPkgSystemFrame + Left = 0 + Height = 300 + Top = 0 + Width = 400 + ChildSizing.LeftRightSpacing = 6 + ChildSizing.TopBottomSpacing = 6 + ChildSizing.HorizontalSpacing = 6 + ChildSizing.VerticalSpacing = 6 + ChildSizing.Layout = cclLeftToRightThenTopToBottom + ChildSizing.ControlsPerLine = 1 + ClientHeight = 300 + ClientWidth = 400 + OnClick = FrameClick + TabOrder = 0 + DesignLeft = 297 + DesignTop = 171 + object HideCreatePackageCheckBox: TCheckBox + Left = 6 + Height = 18 + Top = 6 + Width = 256 + Caption = 'HideCreatePackageCheckBox' + TabOrder = 0 + end + object HideOpenPackageCheckBox: TCheckBox + Left = 6 + Height = 18 + Top = 30 + Width = 256 + Caption = 'HideOpenPackageCheckBox' + TabOrder = 1 + end + object HidePackageGraphCheckBox: TCheckBox + Left = 6 + Height = 18 + Top = 54 + Width = 256 + Caption = 'HidePackageGraphCheckBox' + TabOrder = 2 + end + object HideConfigureInstalledPkgsCheckBox: TCheckBox + Left = 6 + Height = 18 + Top = 78 + Width = 256 + Caption = 'HideConfigureInstalledPkgsCheckBox' + TabOrder = 3 + end +end diff --git a/components/education/edupkgsystem.lrs b/components/education/edupkgsystem.lrs new file mode 100644 index 0000000000..d577db0df9 --- /dev/null +++ b/components/education/edupkgsystem.lrs @@ -0,0 +1,20 @@ +{ This is an automatically generated lazarus resource file } + +LazarusResources.Add('TEduPkgSystemFrame','FORMDATA',[ + 'TPF0'#18'TEduPkgSystemFrame'#17'EduPkgSystemFrame'#4'Left'#2#0#6'Height'#3',' + +#1#3'Top'#2#0#5'Width'#3#144#1#28'ChildSizing.LeftRightSpacing'#2#6#28'Child' + +'Sizing.TopBottomSpacing'#2#6#29'ChildSizing.HorizontalSpacing'#2#6#27'Child' + +'Sizing.VerticalSpacing'#2#6#18'ChildSizing.Layout'#7#29'cclLeftToRightThenT' + +'opToBottom'#27'ChildSizing.ControlsPerLine'#2#1#12'ClientHeight'#3','#1#11 + +'ClientWidth'#3#144#1#7'OnClick'#7#10'FrameClick'#8'TabOrder'#2#0#10'DesignL' + +'eft'#3')'#1#9'DesignTop'#3#171#0#0#9'TCheckBox'#25'HideCreatePackageCheckBo' + +'x'#4'Left'#2#6#6'Height'#2#18#3'Top'#2#6#5'Width'#3#0#1#7'Caption'#6#25'Hid' + +'eCreatePackageCheckBox'#8'TabOrder'#2#0#0#0#9'TCheckBox'#23'HideOpenPackage' + +'CheckBox'#4'Left'#2#6#6'Height'#2#18#3'Top'#2#30#5'Width'#3#0#1#7'Caption'#6 + +#23'HideOpenPackageCheckBox'#8'TabOrder'#2#1#0#0#9'TCheckBox'#24'HidePackage' + +'GraphCheckBox'#4'Left'#2#6#6'Height'#2#18#3'Top'#2'6'#5'Width'#3#0#1#7'Capt' + +'ion'#6#24'HidePackageGraphCheckBox'#8'TabOrder'#2#2#0#0#9'TCheckBox"HideCon' + +'figureInstalledPkgsCheckBox'#4'Left'#2#6#6'Height'#2#18#3'Top'#2'N'#5'Width' + +#3#0#1#7'Caption'#6'"HideConfigureInstalledPkgsCheckBox'#8'TabOrder'#2#3#0#0 + +#0 +]); diff --git a/components/education/edupkgsystem.pas b/components/education/edupkgsystem.pas new file mode 100644 index 0000000000..ab066a4db0 --- /dev/null +++ b/components/education/edupkgsystem.pas @@ -0,0 +1,56 @@ +{ + ***************************************************************************** + * * + * This file is part of the EducationLaz package * + * * + * See the file COPYING.modifiedLGPL.txt, included in this distribution, * + * for details about the copyright. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * * + ***************************************************************************** + + Author: Mattias Gaertner + + Abstract: + Options for Lazarus package system. +} +unit EduPkgSystem; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils, FileUtil, LResources, Forms, Controls, StdCtrls; + +type + + { TEduPkgSystemFrame } + + TEduPkgSystemFrame = class(TFrame) + HideCreatePackageCheckBox: TCheckBox; + HideOpenPackageCheckBox: TCheckBox; + HidePackageGraphCheckBox: TCheckBox; + HideConfigureInstalledPkgsCheckBox: TCheckBox; + procedure FrameClick(Sender: TObject); + private + public + end; + +implementation + +{ TEduPkgSystemFrame } + +procedure TEduPkgSystemFrame.FrameClick(Sender: TObject); +begin + HideCreatePackageCheckBox.Caption:='Hide items to create new packages'; +end; + +initialization + {$I edupkgsystem.lrs} + +end. +