education: added frames

git-svn-id: trunk@20797 -
This commit is contained in:
mattias 2009-07-06 07:32:11 +00:00
parent 207c9b617f
commit 38f59b66ac
4 changed files with 171 additions and 0 deletions

3
.gitattributes vendored
View File

@ -336,6 +336,9 @@ 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/eduenvoptsframe.lfm svneol=native#text/plain
components/education/eduenvoptsframe.lrs svneol=native#text/plain
components/education/eduenvoptsframe.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

View File

@ -0,0 +1,20 @@
inherited EduEnvFrame: TEduEnvFrame
Height = 268
Width = 359
ClientHeight = 268
ClientWidth = 344
TabOrder = 0
DesignLeft = 358
DesignTop = 198
object EnableCheckBox: TCheckBox[0]
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Owner
Left = 6
Height = 18
Top = 6
Width = 124
BorderSpacing.Around = 6
Caption = 'EnableCheckBox'
TabOrder = 0
end
end

View File

@ -0,0 +1,10 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TEduEnvFrame','FORMDATA',[
'TPF0'#241#12'TEduEnvFrame'#11'EduEnvFrame'#6'Height'#3#12#1#5'Width'#3'g'#1
+#12'ClientHeight'#3#12#1#11'ClientWidth'#3'X'#1#8'TabOrder'#2#0#10'DesignLef'
+'t'#3'f'#1#9'DesignTop'#3#198#0#0#242#2#0#9'TCheckBox'#14'EnableCheckBox'#22
+'AnchorSideLeft.Control'#7#5'Owner'#21'AnchorSideTop.Control'#7#5'Owner'#4'L'
+'eft'#2#6#6'Height'#2#18#3'Top'#2#6#5'Width'#2'|'#20'BorderSpacing.Around'#2
+#6#7'Caption'#6#14'EnableCheckBox'#8'TabOrder'#2#0#0#0#0
]);

View File

@ -0,0 +1,138 @@
{
*****************************************************************************
* *
* 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:
Dialog to setup the education package.
}
unit EduEnvOptsFrame;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, LCLProc, FileUtil, LResources, Forms, Controls, Graphics,
Dialogs, ComCtrls, ExtCtrls, StdCtrls,
LazConfigStorage, IDEOptionsIntf, EduOptions;
const
EnvOptionsEducation = 2000;
type
{ TEduGeneralOptions }
TEduGeneralOptions = class(TEduOptionsNode)
private
FEnabled: boolean;
procedure SetEnabled(const AValue: boolean);
public
destructor Destroy; override;
function Load(Config: TConfigStorage): TModalResult; override;
function Save(Config: TConfigStorage): TModalResult; override;
property Enabled: boolean read FEnabled write SetEnabled;
end;
{ TEduEnvFrame }
TEduEnvFrame = class(TAbstractIDEOptionsEditor)
EnableCheckBox: TCheckBox;
private
public
function GetTitle: String; override;
procedure Setup(ADialog: TAbstractOptionsEditorDialog); override;
procedure ReadSettings(AOptions: TAbstractIDEOptions); override;
procedure WriteSettings(AOptions: TAbstractIDEOptions); override;
class function SupportedOptionsClass: TAbstractIDEOptionsClass; override;
end;
var
EduEnvFrame: TEduEnvFrame;
EduGeneralOptions: TEduGeneralOptions = nil;
procedure Register;
implementation
procedure Register;
begin
RegisterIDEOptionsGroup(EduOptionID,'Education');
RegisterIDEOptionsEditor(EduOptionID,TEduEnvFrame,EduOptionGeneralID);
EduGeneralOptions:=TEduGeneralOptions.Create;
EducationOptions.Root.Add(EduGeneralOptions);
end;
{ TEduEnvFrame }
function TEduEnvFrame.GetTitle: String;
begin
Result:='General';
end;
procedure TEduEnvFrame.Setup(ADialog: TAbstractOptionsEditorDialog);
begin
EnableCheckBox.Caption:='Enable education settings';
end;
procedure TEduEnvFrame.ReadSettings(AOptions: TAbstractIDEOptions);
begin
debugln(['TEduEnvFrame.ReadSettings ',EduGeneralOptions.Enabled]);
EnableCheckBox.Checked:=EduGeneralOptions.Enabled;
end;
procedure TEduEnvFrame.WriteSettings(AOptions: TAbstractIDEOptions);
begin
debugln(['TEduEnvFrame.WriteSettings ',EnableCheckBox.Checked]);
EduGeneralOptions.Enabled:=EnableCheckBox.Checked;
end;
class function TEduEnvFrame.SupportedOptionsClass: TAbstractIDEOptionsClass;
begin
Result := TEduOptions;
end;
{ TEduGeneralOptions }
procedure TEduGeneralOptions.SetEnabled(const AValue: boolean);
begin
if FEnabled=AValue then exit;
FEnabled:=AValue;
Changed;
end;
destructor TEduGeneralOptions.Destroy;
begin
if EduGeneralOptions=Self then EduGeneralOptions:=nil;
inherited Destroy;
end;
function TEduGeneralOptions.Load(Config: TConfigStorage): TModalResult;
begin
Result:=inherited Load(Config);
FEnabled:=Config.GetValue('Enabled',true);
end;
function TEduGeneralOptions.Save(Config: TConfigStorage): TModalResult;
begin
Result:=inherited Save(Config);
Config.SetDeleteValue('Enabled',Enabled,true);
end;
initialization
{$I eduenvoptsframe.lrs}
end.