mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-28 19:20:33 +02:00
educationlaz: fixed compilation
git-svn-id: trunk@44086 -
This commit is contained in:
parent
d683f4106d
commit
e2ece1726a
@ -1,5 +1,7 @@
|
||||
inherited EduCompPaletteFrame: TEduCompPaletteFrame
|
||||
object EduCompPaletteFrame: TEduCompPaletteFrame
|
||||
Left = 0
|
||||
Height = 409
|
||||
Top = 0
|
||||
Width = 480
|
||||
ClientHeight = 409
|
||||
ClientWidth = 480
|
||||
@ -7,39 +9,37 @@ inherited EduCompPaletteFrame: TEduCompPaletteFrame
|
||||
TabOrder = 0
|
||||
DesignLeft = 286
|
||||
DesignTop = 126
|
||||
object ComponentsGroupBox: TGroupBox[0]
|
||||
AnchorSideTop.Control = Owner
|
||||
AnchorSideBottom.Control = Owner
|
||||
object ComponentsGroupBox: TGroupBox
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 169
|
||||
Left = 153
|
||||
Height = 397
|
||||
Top = 6
|
||||
Width = 305
|
||||
Width = 321
|
||||
Align = alClient
|
||||
Anchors = [akTop, akBottom]
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'ComponentsGroupBox'
|
||||
ClientHeight = 378
|
||||
ClientWidth = 301
|
||||
ClientHeight = 380
|
||||
ClientWidth = 317
|
||||
TabOrder = 0
|
||||
object ComponentsTreeView: TTreeView
|
||||
Left = 0
|
||||
Height = 378
|
||||
Height = 380
|
||||
Top = 0
|
||||
Width = 301
|
||||
Width = 317
|
||||
Align = alClient
|
||||
DefaultItemHeight = 19
|
||||
DefaultItemHeight = 18
|
||||
ReadOnly = True
|
||||
TabOrder = 0
|
||||
OnMouseDown = ComponentsTreeViewMouseDown
|
||||
Options = [tvoAutoItemHeight, tvoHideSelection, tvoKeepCollapsedNodes, tvoReadOnly, tvoShowButtons, tvoShowLines, tvoShowRoot, tvoToolTips]
|
||||
end
|
||||
end
|
||||
object LeftPanel: TPanel[1]
|
||||
object LeftPanel: TPanel
|
||||
Left = 0
|
||||
Height = 409
|
||||
Top = 0
|
||||
Width = 163
|
||||
Width = 147
|
||||
Align = alLeft
|
||||
AutoSize = True
|
||||
ChildSizing.LeftRightSpacing = 6
|
||||
@ -47,13 +47,13 @@ inherited EduCompPaletteFrame: TEduCompPaletteFrame
|
||||
ChildSizing.HorizontalSpacing = 6
|
||||
ChildSizing.VerticalSpacing = 6
|
||||
ClientHeight = 409
|
||||
ClientWidth = 163
|
||||
ClientWidth = 147
|
||||
TabOrder = 1
|
||||
object ShowAllButton: TButton
|
||||
Left = 7
|
||||
Height = 29
|
||||
Top = 77
|
||||
Width = 149
|
||||
Height = 27
|
||||
Top = 73
|
||||
Width = 133
|
||||
Align = alTop
|
||||
AutoSize = True
|
||||
Caption = 'ShowAllButton'
|
||||
@ -62,9 +62,9 @@ inherited EduCompPaletteFrame: TEduCompPaletteFrame
|
||||
end
|
||||
object HideAllButton: TButton
|
||||
Left = 7
|
||||
Height = 29
|
||||
Top = 136
|
||||
Width = 149
|
||||
Height = 27
|
||||
Top = 130
|
||||
Width = 133
|
||||
Align = alTop
|
||||
AutoSize = True
|
||||
BorderSpacing.Top = 30
|
||||
@ -74,9 +74,9 @@ inherited EduCompPaletteFrame: TEduCompPaletteFrame
|
||||
end
|
||||
object ShowMinimalButton: TButton
|
||||
Left = 7
|
||||
Height = 29
|
||||
Height = 27
|
||||
Top = 7
|
||||
Width = 149
|
||||
Width = 133
|
||||
Align = alTop
|
||||
AutoSize = True
|
||||
Caption = 'ShowMinimalButton'
|
||||
@ -85,9 +85,9 @@ inherited EduCompPaletteFrame: TEduCompPaletteFrame
|
||||
end
|
||||
object ShowExtendedButton: TButton
|
||||
Left = 7
|
||||
Height = 29
|
||||
Top = 42
|
||||
Width = 149
|
||||
Height = 27
|
||||
Top = 40
|
||||
Width = 133
|
||||
Align = alTop
|
||||
AutoSize = True
|
||||
Caption = 'ShowExtendedButton'
|
||||
|
@ -62,14 +62,16 @@ type
|
||||
private
|
||||
HideImgID: LongInt;
|
||||
ShowImgID: LongInt;
|
||||
fCompNameToImgIndex: TStringToPointerTree; // Component.ClassName to index+1 in TreeViews.Images
|
||||
procedure FillComponentTreeView;
|
||||
procedure SaveFillComponentTreeView;
|
||||
procedure ShowHideAll(aShow: boolean);
|
||||
procedure ShowSelected(extended: boolean);
|
||||
public
|
||||
destructor Destroy; override;
|
||||
function GetTitle: String; override;
|
||||
procedure ReadSettings(AOptions: TAbstractIDEOptions); override;
|
||||
procedure Setup(ADialog: TAbstractOptionsEditorDialog); override;
|
||||
procedure Setup({%H-}ADialog: TAbstractOptionsEditorDialog); override;
|
||||
class function SupportedOptionsClass: TAbstractIDEOptionsClass; override;
|
||||
procedure WriteSettings(AOptions: TAbstractIDEOptions); override;
|
||||
end;
|
||||
@ -137,9 +139,52 @@ begin
|
||||
ShowSelected(false);
|
||||
end;
|
||||
|
||||
|
||||
|
||||
procedure TEduCompPaletteFrame.FillComponentTreeView;
|
||||
|
||||
function GetIconCopy(ResName: string): TCustomBitMap;
|
||||
var
|
||||
ResHandle: TLResource;
|
||||
begin
|
||||
Result := nil;
|
||||
// prevent raising exception and speedup a bit search/load
|
||||
ResHandle := LazarusResources.Find(ResName);
|
||||
if ResHandle <> nil then
|
||||
Result := CreateBitmapFromLazarusResource(ResHandle)
|
||||
else
|
||||
if FindResource(HInstance, PChar(ResName), PChar(RT_BITMAP)) <> 0 then
|
||||
begin
|
||||
Result := TBitmap.Create;
|
||||
Result.LoadFromResourceName(HInstance, ResName);
|
||||
Result.Transparent := True;
|
||||
end
|
||||
else
|
||||
if FindResource(HInstance, PChar(ResName), PChar(RT_RCDATA)) <> 0 then
|
||||
Result := CreateBitmapFromResourceName(HInstance, ResName);
|
||||
end;
|
||||
|
||||
function GetCompImgIndex(ResName: string): integer;
|
||||
var
|
||||
Img: TCustomBitmap;
|
||||
begin
|
||||
if fCompNameToImgIndex=nil then
|
||||
fCompNameToImgIndex:=TStringToPointerTree.Create(false);
|
||||
if fCompNameToImgIndex.Contains(ResName) then begin
|
||||
Result:=PtrUInt(fCompNameToImgIndex[ResName])-1;
|
||||
end else begin
|
||||
// load
|
||||
Img:=GetIconCopy(ResName);
|
||||
if Img=nil then
|
||||
Img:=GetIconCopy('unregisteredcomponent');
|
||||
if Img<>nil then begin
|
||||
Result:=ComponentsTreeView.Images.Add(Img,nil);
|
||||
Img.Free;
|
||||
end else begin
|
||||
Result:=-1;
|
||||
end;
|
||||
fCompNameToImgIndex[ResName]:=Pointer(PtrUInt(Result+1));
|
||||
end;
|
||||
end;
|
||||
|
||||
var
|
||||
i: Integer;
|
||||
Page: TBaseComponentPage;
|
||||
@ -147,8 +192,6 @@ var
|
||||
Comp: TRegisteredComponent;
|
||||
PageNode: TTreeNode;
|
||||
CompNode: TTreeNode;
|
||||
ResHandle: TLResource;
|
||||
Image: TCustomBitmap;
|
||||
CompName: String;
|
||||
begin
|
||||
ComponentsTreeView.BeginUpdate;
|
||||
@ -170,15 +213,7 @@ begin
|
||||
Comp:=Page[j];
|
||||
CompName:=Comp.ComponentClass.ClassName;
|
||||
CompNode:=ComponentsTreeView.Items.AddChild(PageNode,CompName);
|
||||
ResHandle := LazarusResources.Find(CompName);
|
||||
if ResHandle <> nil then
|
||||
Image := CreateBitmapFromResourceName(HInstance, ResHandle)
|
||||
else
|
||||
Image := nil;
|
||||
if Image = nil then
|
||||
Image := CreateBitmapFromResourceName(HInstance, 'default');
|
||||
CompNode.ImageIndex:=ComponentsTreeView.Images.Add(Image,nil);
|
||||
Image.Free;
|
||||
CompNode.ImageIndex:=GetCompImgIndex(CompName);
|
||||
CompNode.SelectedIndex:=CompNode.ImageIndex;
|
||||
if EduComponentPaletteOptions.ComponentVisible[CompName] then
|
||||
CompNode.StateIndex:=ShowImgID
|
||||
@ -316,6 +351,12 @@ begin
|
||||
ComponentsTreeView.EndUpdate;
|
||||
end;
|
||||
|
||||
destructor TEduCompPaletteFrame.Destroy;
|
||||
begin
|
||||
FreeAndNil(fCompNameToImgIndex);
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
function TEduCompPaletteFrame.GetTitle: String;
|
||||
begin
|
||||
Result:=ersEduCompPaletteTitle;
|
||||
@ -363,7 +404,7 @@ begin
|
||||
if AValue then
|
||||
fVisible[ComponentName]:='1'
|
||||
else
|
||||
fVisible.Delete(ComponentName);
|
||||
fVisible.Remove(ComponentName);
|
||||
end;
|
||||
|
||||
procedure TEduComponentPaletteOptions.VoteForVisible(
|
||||
|
@ -55,7 +55,7 @@ type
|
||||
ShowAllChildsButton: TButton;
|
||||
procedure FrameClick(Sender: TObject);
|
||||
procedure MenusTreeViewMouseDown(Sender: TObject; Button: TMouseButton;
|
||||
Shift: TShiftState; X, Y: Integer);
|
||||
{%H-}Shift: TShiftState; X, Y: Integer);
|
||||
procedure ShowAllButtonClick(Sender: TObject);
|
||||
procedure ShowAllChildsButtonClick(Sender: TObject);
|
||||
private
|
||||
@ -71,7 +71,7 @@ type
|
||||
public
|
||||
function GetTitle: String; override;
|
||||
procedure ReadSettings(AOptions: TAbstractIDEOptions); override;
|
||||
procedure Setup(ADialog: TAbstractOptionsEditorDialog); override;
|
||||
procedure Setup({%H-}ADialog: TAbstractOptionsEditorDialog); override;
|
||||
class function SupportedOptionsClass: TAbstractIDEOptionsClass; override;
|
||||
procedure WriteSettings(AOptions: TAbstractIDEOptions); override;
|
||||
end;
|
||||
@ -328,7 +328,7 @@ begin
|
||||
if AValue then
|
||||
fHidden[MenuPath]:='1'
|
||||
else
|
||||
fHidden.Delete(MenuPath);
|
||||
fHidden.Remove(MenuPath);
|
||||
end;
|
||||
|
||||
constructor TEduMenuOptions.Create;
|
||||
|
@ -44,8 +44,8 @@ type
|
||||
TFileDescSingleFileProgram = class(TProjectFileDescriptor)
|
||||
public
|
||||
constructor Create; override;
|
||||
function CreateSource(const Filename, SourceName,
|
||||
ResourceName: string): string; override;
|
||||
function CreateSource(const {%H-}Filename, SourceName,
|
||||
{%H-}ResourceName: string): string; override;
|
||||
function GetLocalizedName: string; override;
|
||||
function GetLocalizedDescription: string; override;
|
||||
end;
|
||||
@ -95,7 +95,7 @@ type
|
||||
public
|
||||
function GetTitle: String; override;
|
||||
procedure ReadSettings(AOptions: TAbstractIDEOptions); override;
|
||||
procedure Setup(ADialog: TAbstractOptionsEditorDialog); override;
|
||||
procedure Setup({%H-}ADialog: TAbstractOptionsEditorDialog); override;
|
||||
class function SupportedOptionsClass: TAbstractIDEOptionsClass; override;
|
||||
procedure WriteSettings(AOptions: TAbstractIDEOptions); override;
|
||||
end;
|
||||
@ -149,7 +149,6 @@ begin
|
||||
end;
|
||||
|
||||
constructor TEduNewPrgOptions.Create;
|
||||
const le = LineEnding;
|
||||
begin
|
||||
inherited Create;
|
||||
Name:='NewProgram';
|
||||
|
@ -83,7 +83,7 @@ type
|
||||
public
|
||||
function GetTitle: String; override;
|
||||
procedure ReadSettings(AOptions: TAbstractIDEOptions); override;
|
||||
procedure Setup(ADialog: TAbstractOptionsEditorDialog); override;
|
||||
procedure Setup({%H-}ADialog: TAbstractOptionsEditorDialog); override;
|
||||
class function SupportedOptionsClass: TAbstractIDEOptionsClass; override;
|
||||
procedure WriteSettings(AOptions: TAbstractIDEOptions); override;
|
||||
end;
|
||||
|
@ -56,7 +56,7 @@ type
|
||||
procedure ShowAllButtonClick(Sender: TObject);
|
||||
procedure ShowSelectionButtonClick(Sender: TObject);
|
||||
procedure SpeedButtonsTreeViewMouseDown(Sender: TObject;
|
||||
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||||
Button: TMouseButton; {%H-}Shift: TShiftState; X, Y: Integer);
|
||||
procedure FrameClick(Sender: TObject);
|
||||
private
|
||||
HideImgID: LongInt;
|
||||
@ -69,7 +69,7 @@ type
|
||||
public
|
||||
function GetTitle: String; override;
|
||||
procedure ReadSettings(AOptions: TAbstractIDEOptions); override;
|
||||
procedure Setup(ADialog: TAbstractOptionsEditorDialog); override;
|
||||
procedure Setup({%H-}ADialog: TAbstractOptionsEditorDialog); override;
|
||||
class function SupportedOptionsClass: TAbstractIDEOptionsClass; override;
|
||||
procedure WriteSettings(AOptions: TAbstractIDEOptions); override;
|
||||
end;
|
||||
@ -118,7 +118,7 @@ begin
|
||||
if AValue then
|
||||
fVisible[ButtonName]:='1'
|
||||
else
|
||||
fVisible.Delete(ButtonName);
|
||||
fVisible.Remove(ButtonName);
|
||||
end;
|
||||
|
||||
function TEduSpeedButtonsOptions.Load(Config: TConfigStorage): TModalResult;
|
||||
|
Loading…
Reference in New Issue
Block a user