From e9a6b95bef8a9898ec73c9ebbd050b4deb33816f Mon Sep 17 00:00:00 2001 From: wp_xyz Date: Mon, 2 Jan 2023 17:46:57 +0100 Subject: [PATCH] fpvectorial: Fix compilation and crash of fpcorelexplorer sample project. --- .../fpcorelexplorer/fpce_mainform.lfm | 22 +++++++------ .../fpcorelexplorer/fpce_mainform.pas | 10 +++--- .../fpcorelexplorer/fpcorelexplorer.lpi | 32 ++++++++----------- 3 files changed, 31 insertions(+), 33 deletions(-) diff --git a/components/fpvectorial/examples/fpcorelexplorer/fpce_mainform.lfm b/components/fpvectorial/examples/fpcorelexplorer/fpce_mainform.lfm index 439c97fe3d..4d51d1eaef 100644 --- a/components/fpvectorial/examples/fpcorelexplorer/fpce_mainform.lfm +++ b/components/fpvectorial/examples/fpcorelexplorer/fpce_mainform.lfm @@ -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 diff --git a/components/fpvectorial/examples/fpcorelexplorer/fpce_mainform.pas b/components/fpvectorial/examples/fpcorelexplorer/fpce_mainform.pas index c10665a06e..1bae564a2c 100644 --- a/components/fpvectorial/examples/fpcorelexplorer/fpce_mainform.pas +++ b/components/fpvectorial/examples/fpcorelexplorer/fpce_mainform.pas @@ -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; diff --git a/components/fpvectorial/examples/fpcorelexplorer/fpcorelexplorer.lpi b/components/fpvectorial/examples/fpcorelexplorer/fpcorelexplorer.lpi index d67307c20f..fa47c7d96b 100644 --- a/components/fpvectorial/examples/fpcorelexplorer/fpcorelexplorer.lpi +++ b/components/fpvectorial/examples/fpcorelexplorer/fpcorelexplorer.lpi @@ -1,11 +1,13 @@ - + - + + + + - <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">