Merged revision(s) 49559-49560 #a931d80679-#a931d80679 from trunk:

Examples: fix memoryleak in ResExplorer
........
Examples: ResExplorer: clear contents of the pagecontrol if there is nothing to be shown or when opening another file.
........

git-svn-id: branches/fixes_1_4@49562 -
This commit is contained in:
maxim 2015-07-22 21:20:50 +00:00
parent 2e38b8eedd
commit f189317ad2
2 changed files with 26 additions and 10 deletions

View File

@ -3,14 +3,14 @@ object reMainForm: TreMainForm
Height = 605
Top = 242
Width = 768
ActiveControl = StringGrid1
Caption = 'reMainForm'
ClientHeight = 585
ClientWidth = 768
Menu = MainMenu1
OnCreate = FormCreate
OnDestroy = FormDestroy
Position = poScreenCenter
LCLVersion = '1.3'
LCLVersion = '1.5'
object TreeView1: TTreeView
Left = 0
Height = 506
@ -35,11 +35,11 @@ object reMainForm: TreMainForm
TabOrder = 1
object tabString: TTabSheet
Caption = 'String'
ClientHeight = 480
ClientHeight = 478
ClientWidth = 467
object StringGrid1: TStringGrid
Left = 0
Height = 480
Height = 478
Top = 0
Width = 467
Align = alClient
@ -56,11 +56,11 @@ object reMainForm: TreMainForm
end
object tabImage: TTabSheet
Caption = 'Image'
ClientHeight = 480
ClientWidth = 469
ClientHeight = 478
ClientWidth = 467
object Image1: TImage
Left = 0
Height = 477
Height = 478
Top = 0
Width = 467
Align = alClient
@ -128,14 +128,15 @@ object reMainForm: TreMainForm
end
object ToolButton3: TToolButton
Left = 176
Height = 22
Top = 2
Width = 10
Width = 8
AutoSize = True
Caption = 'ToolButton3'
Style = tbsSeparator
end
object ToolButton4: TToolButton
Left = 186
Left = 184
Top = 2
Action = hlpAbout
AutoSize = True

View File

@ -45,6 +45,7 @@ type
procedure fileExitExecute(Sender: TObject);
procedure fileOpenExecute(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure HeaderControl1SectionResize(HeaderControl: TCustomHeaderControl;
Section: THeaderSection);
procedure hlpAboutExecute(Sender: TObject);
@ -52,6 +53,7 @@ type
procedure TreeView1Click(Sender: TObject);
private
Res:TResources;
procedure ClearDisplay;
procedure LoadVersionResource(V:TVersionResource);
procedure LoadBitmapResource(B:TBitmapResource);
procedure LoadGroupIconResource(G:TGroupIconResource);
@ -105,6 +107,11 @@ begin
Splitter1ChangeBounds(nil);
end;
procedure TreMainForm.FormDestroy(Sender: TObject);
begin
if Assigned(Res) then Res.Free;
end;
procedure TreMainForm.HeaderControl1SectionResize(
HeaderControl: TCustomHeaderControl; Section: THeaderSection);
begin
@ -131,6 +138,7 @@ var
begin
if Assigned(TreeView1.Selected) and Assigned(TreeView1.Selected.Data) then
begin
ClearDisplay;
ResItem:=TAbstractResource(TreeView1.Selected.Data);
HeaderControl1.Sections[1].Text:=ResItem.ClassName + ' : ' + ResItem.Name.Name;
if ResItem is TVersionResource then
@ -146,6 +154,12 @@ begin
end;
end;
procedure TreMainForm.ClearDisplay;
begin
StringGrid1.Clean;
Image1.Picture.Clear;
end;
procedure TreMainForm.LoadVersionResource(V: TVersionResource);
var
i,j, k:integer;
@ -201,8 +215,9 @@ begin
Reader:=TElfResourceReader.Create;
TreeView1.Items.Clear;
ClearDisplay;
if Assigned(Res) then
Res.Free;
FreeAndNil(Res);
if not Assigned(Reader) then exit;