fpvectorial: Fix compilation and crash of fpcorelexplorer sample project.

This commit is contained in:
wp_xyz 2023-01-02 17:46:57 +01:00
parent 19662131eb
commit e9a6b95bef
3 changed files with 31 additions and 33 deletions

View File

@ -6,12 +6,12 @@ object formCorelExplorer: TformCorelExplorer
Caption = 'FP Corel Explorer'
ClientHeight = 345
ClientWidth = 466
LCLVersion = '0.9.31'
LCLVersion = '2.3.0.0'
object Label1: TLabel
Left = 8
Height = 18
Height = 15
Top = 40
Width = 158
Width = 133
Caption = 'Location of the Input file:'
ParentColor = False
end
@ -28,34 +28,36 @@ object formCorelExplorer: TformCorelExplorer
object shellInput: TShellTreeView
Left = 8
Height = 272
Top = 64
Top = 65
Width = 224
FileSortType = fstFoldersFirst
ReadOnly = True
TabOrder = 0
OnSelectionChanged = shellInputSelectionChanged
Options = [tvoAutoItemHeight, tvoHideSelection, tvoKeepCollapsedNodes, tvoReadOnly, tvoShowButtons, tvoShowLines, tvoShowRoot, tvoToolTips, tvoThemedDraw]
ObjectTypes = [otFolders, otNonFolders]
end
object labelFilename: TLabel
Left = 256
Height = 18
Height = 15
Top = 65
Width = 62
Width = 51
Caption = 'Filename:'
ParentColor = False
end
object labelVersion: TLabel
Left = 256
Height = 18
Height = 15
Top = 88
Width = 52
Width = 41
Caption = 'Version:'
ParentColor = False
end
object labelSize: TLabel
Left = 256
Height = 18
Height = 15
Top = 112
Width = 32
Width = 23
Caption = 'Size:'
ParentColor = False
end

View File

@ -53,6 +53,7 @@ var
lFormat: TvVectorialFormat;
lChunk, lCurChunk: TCDRChunk;
Str: string;
path: String;
begin
// First check the in input
if not CheckInput() then Exit;
@ -60,9 +61,10 @@ begin
// Now read the data from the input file
Reader := TvCDRVectorialReader.Create;
try
Reader.ExploreFromFile(shellInput.GetSelectedNodePath(), lChunk);
path := shellInput.GetPathFromNode(shellInput.Selected);
Reader.ExploreFromFile(path, lChunk);
labelFilename.Caption := 'Filename: ' + shellInput.GetSelectedNodePath();
labelFilename.Caption := 'Filename: ' + path;
if (lChunk.ChildChunks <> nil) and (lChunk.ChildChunks.First <> nil) then
begin
// Version Chunk
@ -71,7 +73,7 @@ begin
labelVersion.Caption := 'Version: ' + Str;
// Main data
lCurChunk := TCDRChunk(lChunk.ChildChunks.Items[1]);
lCurChunk := TCDRChunk(lChunk.ChildChunks.Items[0]); // wp: was [1]
//labelSize.Caption := 'Size: ' + ;
end;
finally
@ -83,7 +85,7 @@ function TformCorelExplorer.CheckInput(): Boolean;
var
lPath: String;
begin
lPath := shellInput.GetSelectedNodePath();
lPath := shellInput.GetPathFromNode(shellInput.Selected);
Result := (ExtractFileExt(lPath) = STR_CORELDRAW_EXTENSION);
end;

View File

@ -1,11 +1,13 @@
<?xml version="1.0"?>
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="9"/>
<Version Value="12"/>
<PathDelim Value="\"/>
<General>
<Flags>
<CompatibilityMode Value="True"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="fpcorelexplorer"/>
<UseXPManifest Value="True"/>
<Icon Value="0"/>
@ -13,21 +15,17 @@
<i18n>
<EnableI18N LFM="False"/>
</i18n>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1">
<Item1 Name="default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
</local>
<FormatVersion Value="2"/>
<Modes Count="1">
<Mode0 Name="default"/>
</Modes>
</RunParams>
<RequiredPackages Count="2">
<Item1>
@ -42,14 +40,13 @@
<Unit0>
<Filename Value="fpcorelexplorer.lpr"/>
<IsPartOfProject Value="True"/>
<UnitName Value="fpcorelexplorer"/>
</Unit0>
<Unit1>
<Filename Value="fpce_mainform.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="formCorelExplorer"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="fpce_mainform"/>
</Unit1>
</Units>
</ProjectOptions>
@ -64,18 +61,15 @@
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Linking>
<Debugging>
<DebugInfoType Value="dsDwarf3"/>
</Debugging>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
<Other>
<CompilerMessages>
<UseMsgFile Value="True"/>
</CompilerMessages>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
<Debugging>
<Exceptions Count="4">