mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 07:49:27 +02:00
educationlaz: added options base class
git-svn-id: trunk@20640 -
This commit is contained in:
parent
a3500f17a9
commit
4d5cecc70f
5
.gitattributes
vendored
5
.gitattributes
vendored
@ -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
|
||||
|
@ -6,7 +6,7 @@
|
||||
<CompilerOptions>
|
||||
<Version Value="8"/>
|
||||
<SearchPaths>
|
||||
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)/"/>
|
||||
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<Other>
|
||||
<CompilerPath Value="$(CompPath)"/>
|
||||
@ -15,7 +15,7 @@
|
||||
<Description Value="IDE package for training, courses and education."/>
|
||||
<License Value="LGPL-2 or any later"/>
|
||||
<Version Major="1" Release="1"/>
|
||||
<Files Count="2">
|
||||
<Files Count="4">
|
||||
<Item1>
|
||||
<Filename Value="eduoptionsdlg.pas"/>
|
||||
<HasRegisterProc Value="True"/>
|
||||
@ -25,6 +25,14 @@
|
||||
<Filename Value="README.txt"/>
|
||||
<Type Value="Text"/>
|
||||
</Item2>
|
||||
<Item3>
|
||||
<Filename Value="eduoptions.pas"/>
|
||||
<UnitName Value="EduOptions"/>
|
||||
</Item3>
|
||||
<Item4>
|
||||
<Filename Value="edupkgsystem.pas"/>
|
||||
<UnitName Value="EduPkgSystem"/>
|
||||
</Item4>
|
||||
</Files>
|
||||
<i18n>
|
||||
<OutDir Value="languages"/>
|
||||
|
@ -7,7 +7,7 @@ unit EducationLaz;
|
||||
interface
|
||||
|
||||
uses
|
||||
EduOptionsDlg, LazarusPackageIntf;
|
||||
EduOptionsDlg, EduOptions, LazarusPackageIntf;
|
||||
|
||||
implementation
|
||||
|
||||
|
160
components/education/eduoptions.pas
Normal file
160
components/education/eduoptions.pas
Normal file
@ -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.
|
||||
|
@ -1,7 +1,7 @@
|
||||
object EduOptionsDialog: TEduOptionsDialog
|
||||
Left = 298
|
||||
Left = 305
|
||||
Height = 382
|
||||
Top = 170
|
||||
Top = 160
|
||||
Width = 554
|
||||
Caption = 'EduOptionsDialog'
|
||||
ClientHeight = 382
|
||||
|
15
components/education/eduoptionsdlg.lrs
Normal file
15
components/education/eduoptionsdlg.lrs
Normal file
@ -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
|
||||
]);
|
50
components/education/edupkgsystem.lfm
Normal file
50
components/education/edupkgsystem.lfm
Normal file
@ -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
|
20
components/education/edupkgsystem.lrs
Normal file
20
components/education/edupkgsystem.lrs
Normal file
@ -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
|
||||
]);
|
56
components/education/edupkgsystem.pas
Normal file
56
components/education/edupkgsystem.pas
Normal file
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user