mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-09 10:19:23 +02:00
fpvectorial: Add sample project to demonstrate usage of debug tree.
This commit is contained in:
parent
52aec8a6a1
commit
07d796bdb3
74
components/fpvectorial/examples/debugtree/debugtree_demo.lpi
Normal file
74
components/fpvectorial/examples/debugtree/debugtree_demo.lpi
Normal file
@ -0,0 +1,74 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="12"/>
|
||||
<PathDelim Value="\"/>
|
||||
<General>
|
||||
<Flags>
|
||||
<MainUnitHasCreateFormStatements Value="False"/>
|
||||
<MainUnitHasTitleStatement Value="False"/>
|
||||
<CompatibilityMode Value="True"/>
|
||||
</Flags>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<Title Value="debugtree_demo"/>
|
||||
<ResourceType Value="res"/>
|
||||
<UseXPManifest Value="True"/>
|
||||
</General>
|
||||
<i18n>
|
||||
<EnableI18N LFM="False"/>
|
||||
</i18n>
|
||||
<BuildModes Count="1">
|
||||
<Item1 Name="default" Default="True"/>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
<Modes Count="1">
|
||||
<Mode0 Name="default"/>
|
||||
</Modes>
|
||||
</RunParams>
|
||||
<RequiredPackages Count="1">
|
||||
<Item1>
|
||||
<PackageName Value="fpvectorialpkg"/>
|
||||
<DefaultFilename Value="..\fpvectorialpkg.lpk" Prefer="True"/>
|
||||
</Item1>
|
||||
</RequiredPackages>
|
||||
<Units Count="1">
|
||||
<Unit0>
|
||||
<Filename Value="debugtree_demo.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit0>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<Target>
|
||||
<Filename Value="debugtree_demo"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<Linking>
|
||||
<Debugging>
|
||||
<DebugInfoType Value="dsDwarf3"/>
|
||||
</Debugging>
|
||||
</Linking>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<Exceptions Count="3">
|
||||
<Item1>
|
||||
<Name Value="EAbort"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<Name Value="ECodetoolError"/>
|
||||
</Item2>
|
||||
<Item3>
|
||||
<Name Value="EFOpenError"/>
|
||||
</Item3>
|
||||
</Exceptions>
|
||||
</Debugging>
|
||||
</CONFIG>
|
100
components/fpvectorial/examples/debugtree/debugtree_demo.pas
Normal file
100
components/fpvectorial/examples/debugtree/debugtree_demo.pas
Normal file
@ -0,0 +1,100 @@
|
||||
program debugtree_demo;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
uses
|
||||
fpvectorial, odtvectorialwriter, fpvutils, fpvectorialpkg;
|
||||
|
||||
{$R *.res}
|
||||
|
||||
type
|
||||
{ TDebugTree }
|
||||
|
||||
TDebugTree = class
|
||||
function DebugAddItem (AStr: string; AParent: Pointer): Pointer;
|
||||
end;
|
||||
|
||||
function TDebugTree.DebugAddItem(AStr: string; AParent: Pointer): Pointer;
|
||||
begin
|
||||
WriteLn(AStr);
|
||||
Result := AParent;
|
||||
end;
|
||||
|
||||
var
|
||||
Vec: TvVectorialDocument;
|
||||
Page: TvTextPageSequence;
|
||||
CurParagraph: TvParagraph;
|
||||
CurList: TvList;
|
||||
DebugTree: TDebugTree;
|
||||
begin
|
||||
Vec := TvVectorialDocument.Create;
|
||||
try
|
||||
// A4 -> 210mm x 297mm
|
||||
Vec.Width := 210;
|
||||
Vec.Height := 297;
|
||||
Vec.AddStandardTextDocumentStyles(vfODT);
|
||||
|
||||
// First page sequence
|
||||
Page := Vec.AddTextPageSequence();
|
||||
// Title
|
||||
CurParagraph := Page.AddParagraph();
|
||||
CurParagraph.Style := Vec.StyleHeading1;
|
||||
CurParagraph.AddText('Lazarus');
|
||||
// paragraph
|
||||
CurParagraph := Page.AddParagraph();
|
||||
CurParagraph.Style := Vec.StyleTextBody;
|
||||
CurParagraph.AddText('Lazarus is a free and open source development tool '
|
||||
+ 'for the Free Pascal compiler, which is also free and open source.');
|
||||
// Title
|
||||
CurParagraph := Page.AddParagraph();
|
||||
CurParagraph.Style := Vec.StyleHeading2;
|
||||
CurParagraph.AddText('Overview');
|
||||
// paragraph
|
||||
CurParagraph := Page.AddParagraph();
|
||||
CurParagraph.Style := Vec.StyleTextBody;
|
||||
CurParagraph.AddText('Lazarus is a free cross-platform visual integrated '
|
||||
+ 'development environment (IDE) for rapid application development (RAD) '
|
||||
+ 'using the Free Pascal compiler supported dialects of Object Pascal. '
|
||||
+ 'Developers use Lazarus to create native code console and graphical user '
|
||||
+ 'interface (GUI) applications for the desktop along with mobile devices, '
|
||||
+ 'web applications, web services, and visual components and function '
|
||||
+ 'libraries (.so, .dll, etc) for use by other programs for any platform '
|
||||
+ 'the Free Pascal compiler supports( Mac, Unix, Linux, Windows, etc).');
|
||||
// Empty line
|
||||
CurParagraph := Page.AddParagraph();
|
||||
CurParagraph.Style := Vec.StyleTextBody;
|
||||
// Lazarus provides a highly visual development environment for the creation of rich user interfaces, application logic, and other supporting code artifacts. Along with the customary project management features, the Lazarus IDE also provides features that includes but are not limited to:
|
||||
|
||||
CurList := Page.AddList();
|
||||
CurList.ListStyle := Vec.StyleBulletList;
|
||||
CurList.Style := Vec.StyleTextBody;
|
||||
CurList.AddParagraph('A What You See Is What You Get (WYSIWYG) visual windows layout designer');
|
||||
CurList.AddParagraph('An extensive set of GUI widgets or visual components such as edit boxes, buttons, dialogs, menus, etc.');
|
||||
CurList.AddParagraph('An extensive set of non visual components for common behaviors such as persistence of application settings');
|
||||
CurList.AddParagraph('A set of data connectivity components for MySQL, PostgresSQL, FireBird, Oracle, SQL Lite, Sybase, and others');
|
||||
CurList.AddParagraph('Data aware widget set that allows the developer to see data in visual components in the designer to assist with development');
|
||||
CurList.AddParagraph('Interactive code debugger');
|
||||
CurList.AddParagraph('Code completion');
|
||||
CurList.AddParagraph('Code templates');
|
||||
CurList.AddParagraph('Syntax highlighting');
|
||||
CurList.AddParagraph('Context sensitive help');
|
||||
CurList.AddParagraph('Text resource manager for internationalization');
|
||||
CurList.AddParagraph('Automatic code formatting');
|
||||
CurList.AddParagraph('The ability to create custom components');
|
||||
|
||||
DebugTree := TDebugTree.Create;
|
||||
try
|
||||
Vec.GenerateDebugTree(@DebugTree.DebugAddItem);
|
||||
finally
|
||||
DebugTree.Free;
|
||||
end;
|
||||
|
||||
Vec.WriteToFile('text_output.odt', vfODT);
|
||||
finally
|
||||
Vec.Free;
|
||||
end;
|
||||
|
||||
Write('Press ENTER to close...');
|
||||
ReadLn;
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user