summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitattributes2
-rw-r--r--CHANGELOG.txt27
-rw-r--r--docs/INSTALL.txt28
-rw-r--r--docs/branching_model/branching_model.infbin0 -> 19175 bytes
-rw-r--r--docs/branching_model/branching_model.ipf644
-rw-r--r--docs/fpGUIHelpIntegration.txt34
-rw-r--r--docs/fpc_lang_ref.ipf5655
-rw-r--r--docs/fpgui-docs-project.xml55
-rw-r--r--docs/xml/corelib/fpg_base.xml65
-rw-r--r--docs/xml/corelib/fpg_command_intf.xml10
-rw-r--r--docs/xml/gui/fpg_button.xml14
-rw-r--r--docs/xml/gui/fpg_colormapping.xml2
-rw-r--r--docs/xml/gui/fpg_dialogs.xml2
-rw-r--r--docs/xml/gui/fpg_form.xml2
-rw-r--r--docs/xml/gui/fpg_grid.xml54
-rw-r--r--docs/xml/gui/fpg_hyperlink.xml2
-rw-r--r--docs/xml/gui/fpg_tree.xml50
-rw-r--r--docview/TODO.txt2
-rw-r--r--docview/docs/codepage_2_unicode_mapping/readme.txt (renamed from docview/docs/codepage_2_unicode_mapping/reame.txt)0
-rw-r--r--docview/docs/docview.ipf147
-rw-r--r--docview/src/HelpBitmap.pas340
-rw-r--r--docview/src/HelpFile.pas25
-rw-r--r--docview/src/HelpTopic.pas6
-rw-r--r--docview/src/NewViewConstantsUnit.pas37
-rw-r--r--docview/src/docview.lpi62
-rw-r--r--docview/src/docview.lpr9
-rw-r--r--docview/src/docview.rc8
-rw-r--r--docview/src/dvHelpers.pas3
-rw-r--r--docview/src/dvconstants.pas13
-rw-r--r--docview/src/frm_bookmarks.pas312
-rw-r--r--docview/src/frm_main.pas182
-rw-r--r--docview/src/frm_note.pas17
-rw-r--r--docview/src/lzwdecompress.pas263
-rw-r--r--examples/apps/debugserver/fpgDebugServer.lpi2
-rw-r--r--examples/apps/docedit/docedit.lpi22
-rw-r--r--examples/apps/docedit/frm_main.pas4
-rw-r--r--examples/apps/ide/src/builderthread.pas18
-rw-r--r--examples/apps/ide/src/filemonitor.pas16
-rw-r--r--examples/apps/ide/src/fpg_textedit.pas47
-rw-r--r--examples/apps/ide/src/frm_configureide.pas16
-rw-r--r--examples/apps/ide/src/frm_debug.pas16
-rw-r--r--examples/apps/ide/src/frm_find.pas21
-rw-r--r--examples/apps/ide/src/frm_main.pas203
-rw-r--r--examples/apps/ide/src/frm_procedurelist.pas29
-rw-r--r--examples/apps/ide/src/frm_projectoptions.pas16
-rw-r--r--examples/apps/ide/src/ideconst.pas16
-rw-r--r--examples/apps/ide/src/ideimages.pas16
-rw-r--r--examples/apps/ide/src/idemacros.pas16
-rw-r--r--examples/apps/ide/src/ideutils.pas20
-rw-r--r--examples/apps/ide/src/maximus.lpr16
-rw-r--r--examples/apps/ide/src/maximus.project33
-rw-r--r--examples/apps/ide/src/project.pas17
-rw-r--r--examples/apps/ide/src/stringhelpers.pas16
-rw-r--r--examples/apps/ide/src/templates/default/program.pas11
-rw-r--r--examples/apps/ide/src/templates/default/unit.pas9
-rw-r--r--examples/apps/ide/src/templates/fpgui/mainform.pas45
-rw-r--r--examples/apps/ide/src/templates/fpgui/program.pas31
-rw-r--r--examples/apps/ide/src/templates/fpgui/program_all_in_one.pas55
-rw-r--r--examples/apps/ide/src/templates/fpgui/simpleform.pas45
-rw-r--r--examples/apps/ide/src/templates/fptest/program.pas30
-rw-r--r--examples/apps/ide/src/templates/fptest/testunit.pas39
-rw-r--r--examples/apps/ide/src/unitlist.pas16
-rw-r--r--examples/corelib/aggcanvas/agg_canvas_test.lpi71
-rw-r--r--examples/corelib/aggcanvas/agg_canvas_test.lpr389
-rw-r--r--examples/corelib/aggcanvas/arial.ttfbin0 -> 275572 bytes
-rw-r--r--examples/corelib/aggcanvas/arialbd.ttfbin0 -> 286620 bytes
-rw-r--r--examples/corelib/aggcanvas/extrafpc.cfg5
-rw-r--r--examples/corelib/aggcanvas/times.ttfbin0 -> 409280 bytes
-rw-r--r--examples/corelib/aggcanvas/timesi.ttfbin0 -> 248368 bytes
-rw-r--r--examples/gui/command_interface/commands.pas18
-rw-r--r--examples/gui/command_interface/frm_main.pas23
-rw-r--r--examples/gui/reporting/u_demo.pas51
-rw-r--r--examples/gui/sprites/background.bmpbin0 -> 439262 bytes
-rw-r--r--examples/gui/sprites/ide_icon48x48.bmpbin6966 -> 0 bytes
-rw-r--r--examples/gui/sprites/splash_logo.bmpbin439262 -> 0 bytes
-rw-r--r--examples/gui/sprites/spritedemo.lpr5
-rw-r--r--examples/gui/sprites/ufo.bmpbin0 -> 5598 bytes
-rw-r--r--examples/gui/stdimages/stdimglist.lpi18
-rw-r--r--examples/gui/stdimages/stdimglist.lpr4
-rw-r--r--images/reporting/close.bmp (renamed from images/reporting/fermer.bmp)bin822 -> 822 bytes
-rw-r--r--images/reporting/first.bmp (renamed from images/reporting/debut.bmp)bin822 -> 822 bytes
-rw-r--r--images/reporting/last.bmp (renamed from images/reporting/fin.bmp)bin822 -> 822 bytes
-rw-r--r--images/reporting/next.bmp (renamed from images/reporting/suivant.bmp)bin822 -> 822 bytes
-rw-r--r--images/reporting/previous.bmp (renamed from images/reporting/precedent.bmp)bin822 -> 822 bytes
-rw-r--r--images/reporting/print.bmp (renamed from images/reporting/imprimer.bmp)bin822 -> 822 bytes
-rw-r--r--images/reporting/printer.bmp (renamed from images/reporting/imprimante.bmp)bin1254 -> 1254 bytes
-rw-r--r--prototypes/keyboard_symbols.txt37
-rw-r--r--src/VERSION_FILE.inc2
-rw-r--r--src/corelib/fpg_base.pas14
-rw-r--r--src/corelib/fpg_imgfmt_bmp.pas242
-rw-r--r--src/corelib/fpg_imgfmt_png.pas16
-rw-r--r--src/corelib/fpg_main.pas21
-rw-r--r--src/corelib/fpg_utils.pas6
-rw-r--r--src/corelib/fpg_widget.pas2
-rw-r--r--src/corelib/gdi/fpgui_toolkit.lpk7
-rw-r--r--src/corelib/render/software/Agg2D.pas103
-rw-r--r--src/corelib/stdimages.inc192
-rw-r--r--src/corelib/x11/fpg_utils_impl.inc6
-rw-r--r--src/corelib/x11/fpgui_toolkit.lpk2
-rw-r--r--src/gui/fpg_button.pas12
-rw-r--r--src/gui/fpg_menu.pas6
-rw-r--r--src/gui/fpg_tree.pas111
-rw-r--r--src/reportengine/u_reportimages.pas442
-rw-r--r--src/reportengine/u_visu.pas4
-rw-r--r--tools/imageconvert/frm_main.pas28
-rw-r--r--tools/imageconvert/imgcnv.lpi2
106 files changed, 9713 insertions, 1039 deletions
diff --git a/.gitattributes b/.gitattributes
index 5da8054b..cfc91c5c 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -25,3 +25,5 @@
*.res binary
*.tar.gz binary
*.wav binary
+*.pdf binary
+
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index f6667de3..2edd6a61 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -2,6 +2,33 @@
Release notes for fpGUI
=======================
+v1.0 (2013-04-09)
+ - Docview improvements: Bookmark maintenance, keyboard shortcuts,
+ image support in INF files, cross link support.
+ - Many improvements to the experimental Maximus IDE.
+ - More widget themeing improvements.
+ - Keyboard shortcut handling improvements.
+ - AggPas 2D graphics library merged into fpGUI as a new
+ cross-platform graphics backend. This is the first step in
+ adding AggPas support, and this is still work in progress, but
+ most functionality works already. Also added some 64-bit fixes
+ to the AggPas code.
+ - Many PDF report engine improvements. Also enhanced the look and
+ functionality of the Print Preview dialog.
+ - Lots more documentation added. This is an ongoing task.
+ - Big improvements to the TextEdit widget, that is used by Maximus
+ and the Nanoedit example project.
+ - Many improvements to the RichView component and it's supported
+ syntax - used by Docview. This widget is now also useable
+ in other projects, not just Docview.
+ - Improved fpGUI language translations.
+ - The UI Designer (forms designer) has also seen many improvements,
+ like new widgets added to the palette, more published properties
+ added to the Object Inspector window etc.
+ - Many, many more bug fixes and improvements. For a full list run:
+ git log v1.0...v0.8
+
+
v0.8 (2011-12-02)
- New widget demos and many improvements to existing demos.
- New application examples
diff --git a/docs/INSTALL.txt b/docs/INSTALL.txt
index 978cf247..806b7d82 100644
--- a/docs/INSTALL.txt
+++ b/docs/INSTALL.txt
@@ -35,9 +35,9 @@ makes the search paths for you applications a little easier to setup.
Building fpGUI using Lazarus
============================
-I use a Lazarus feature call Packages that compiles the required
-units and keeps track of the compiled units and paths when creating
-applications.
+I use a Lazarus feature call Packages that compiles the required
+units and keeps track of the compiled units and paths when creating
+applications.
* Start Lazarus
* Select Components->Open Package File (*.lpk) and select the
@@ -138,9 +138,9 @@ a separate install - but included on the install DVD).
An example workflow to work with any fpgui app is:
a) launch X11 (Applications -> Utilities)
b) start the X11 console xterm (Cmd+N or from the X11 menu)
-c) type the path to your fpgui application ( example: cd
-./Documents/fpgui/examples/apps if you put fpgui in your Documents
-folder)
+c) change to the directory of the fpGUI application. For example:
+ cd ./Documents/fpgui/examples/apps
+ if you put fpgui in your Documents folder.
d) type ./appname to start the application "appname"
* Apparently starting fpGUI apps from an icon on the desktop requires that you
@@ -149,23 +149,21 @@ d) type ./appname to start the application "appname"
from a X11 console, then it runs first time.
* This issue is more about FPC then fpGUI specific, but it's handy to know. In
- many standard Xcode + X11 installation, the linker could not find the X11
+ many standard Xcode + X11 installation, the linker can't find the X11
libraries. So changing the fpc.cfg by adding
-Fl/usr/X11/lib
in the search library path solved the problem. Mac usually doesn't let you
- choose the path during installation, so probably other Snow Leopard users
- will have to double check the correct X11 library path.
+ choose the path during installation, so probably other OSX users will
+ have to double check the correct X11 library path.
- * Compiling from the command line, the compiler cannot create the
+ * Compiling from the command line, the compiler cannot create the
sub-directory "units" used by most demos inluded with fpGUI. So remember to
- create such a directory if the compiler fails. When using Lazarus IDE to
- compile fpGUI projects, the IDE normally creates the missing unit output
- path for you.
+ create such a directory if the compiler fails. The compiler output will
+ clearly state such a situation. When using Lazarus or Maximus IDE to compile
+ fpGUI projects, the IDE will creates the missing unit output path for you.
=================[ END ]===================
-
-
diff --git a/docs/branching_model/branching_model.inf b/docs/branching_model/branching_model.inf
new file mode 100644
index 00000000..6f03331c
--- /dev/null
+++ b/docs/branching_model/branching_model.inf
Binary files differ
diff --git a/docs/branching_model/branching_model.ipf b/docs/branching_model/branching_model.ipf
new file mode 100644
index 00000000..da500297
--- /dev/null
+++ b/docs/branching_model/branching_model.ipf
@@ -0,0 +1,644 @@
+.* Created by Graeme Geldenhuys <graemeg@gmail.com> - 2013-04-08
+.* This document is encoded as IBM code page 850.
+.*
+:userdoc.
+:docprof toc=123.
+:title.fpGUI Branching Model
+
+:h1.fpGUI branching model
+:p.In this post I present the development model that I've introduced for all of
+my projects (both at work and private) about a year ago, and which has turned
+out to be very successful. I've been meaning to write about it for a while now,
+but I've never really found the time to do so thoroughly, until now. I won't
+talk about any of the projects' details, merely about the branching strategy
+and release management.
+
+:cgraphic.
+ :hp2.Time increases to the right:ehp2.
+
+ 0.1 0.2 1.0 1.5
+ master ÍÍÍoÍÍÍÍÍÍÍoÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍoÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍoÍÍÍÍÍÍÍÍ>
+ \Ä, / / /
+ | \ / / /
+ hotfixes ÄÄÄÄ|ÄÄÄoÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ/ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ/ÄÄÄÄÄÄÄÄÄÄÄ>
+ | \ / /
+ | \ / /
+ release ÄÄÄÄ|ÄÄÄÄÄÄ\ÄÄÄÄÄÄÄÄÄÄÄÄÄoÍÍÍoÍÍÍoÍÍÍoÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄoÄÄÄÄÄÄÄÄÄÄÄÄÄÄ>
+ branches | \ / \ \ / \
+ \ \ / \ \ / \
+ develop ÍÍÍÍÍÍoÍÍÍoÍÍÍoÍÍÍÍÍÍÍoÍÍÍÍÍÍÍÍÍoÍÍÍÍÍÍÍoÍÍÍÍÍoÍÍÍoÍÍÍÍÍoÍÍÍoÍÍÍÍÍÍÍ>
+ \Ä, / \ / /
+ | \ / \ / /
+ feature1 ÄÄÄÄÄÄÄ|ÄÄÄoÍÍÍoÍÍÍoÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄoÍÍÍoÍÍÍoÄÄÄ/ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ>
+ | /
+ \ /
+ feature2 ÄÄÄÄÄÄÄÄÄoÍÍÍoÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍoÍÍÍÍÍÍÍÍÍÍoÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ>
+
+
+
+ :hp2.Key::ehp2.
+ ÍÍÍ and diagonal lines represent active development
+ ÄÄÄ represents no development, just time that has passed
+ o is a commit in the repository
+ 0.1 Numbers above the master branch is release tags
+:ecgraphic.
+
+:p.
+Here is an :link reftype=hd res=123.alternative overview graph:elink., which
+hides the "time has passed" lines.
+
+:p.
+It focuses around Git [http://git-scm.com/] as the tool for the versioning of all of our source code.
+
+.* -------------------------------------
+:h2 res=123 hide.Alternative overview graph
+:cgraphic.
+ :hp2.Time increases to the right:ehp2.
+
+ 0.1 0.2 1.0 1.5
+ master ÍÍÍoÍÍÍÍÍÍÍoÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍoÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍoÍÍÍÍÍÍÍÍ>
+ \Ä, / / /
+ | \ / / /
+ hotfixes | o / /
+ | \ / /
+ | \ / /
+ release | \ oÍÍÍoÍÍÍoÍÍÍo o
+ branches | \ / \ \ / \
+ \ \ / \ \ / \
+ develop ÍÍÍÍÍÍoÍÍÍoÍÍÍoÍÍÍÍÍÍÍoÍÍÍÍÍÍÍÍÍoÍÍÍÍÍÍÍoÍÍÍÍÍoÍÍÍoÍÍÍÍÍoÍÍÍoÍÍÍÍÍÍÍ>
+ \Ä, / \ / /
+ | \ / \ / /
+ feature1 | oÍÍÍoÍÍÍo oÍÍÍoÍÍÍo /
+ | /
+ \ /
+ feature2 oÍÍÍoÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍoÍÍÍÍÍÍÍÍÍÍo
+
+
+
+ :hp2.Key::ehp2.
+ ÍÍÍ and diagonal lines represent active development
+ o is a commit in the repository
+ 0.1 Numbers above the master branch is release tags
+:ecgraphic.
+
+.* -------------------------------------
+:h2.Why Git?
+:p.
+For a thorough discussion on the pros and cons of Git compared to centralized
+source code control systems, see [http://whygitisbetterthanx.com/] the web [http://git.or.cz/gitwiki/GitSvnComparsion]. There are plenty of flame wars going
+on there. As a developer, I prefer Git above all other tools around today. Git
+really changed the way developers think of merging and branching. From the
+classic CVS/Subversion world I came from, merging/branching has always been
+considered a bit scary ("beware of merge conflicts, they bite you!") and
+something you only do every once in a while.
+
+:p.
+But with Git, these actions are extremely cheap and simple, and they are
+considered one of the core parts of your daily workflow, really. For example,
+in CVS/Subversion books, branching and merging is first discussed in the later
+chapters (for advanced users), while in every Git book, it's already covered
+in chapter 3 (basics).
+
+:p.
+As a consequence of its simplicity and repetitive nature, branching and merging
+are no longer something to be afraid of. Version control tools are supposed to
+assist in branching/merging more than anything else.
+
+:p.
+Enough about the tools, let's head onto the development model. The model that
+I'm going to present here is essentially no more than a set of procedures that
+every team member has to follow in order to come to a managed software
+development process.
+
+.* -------------------------------------
+:h2.Decentralised but centralised
+:p.
+The repository setup that we use and that works well with this branching model,
+is that with a central "truth" repo. Note that this repo is only considered to
+be the central one (since Git is a DVCS, there is no such thing as a central
+repo at a technical level). We will refer to this repo as origin, since this
+name is familiar to all Git users.
+
+.* :artwork align=center name='centr-decentr.bmp'.
+:cgraphic.
+ ÚÄÄÄÄÄÄÄÄÄÄ¿ ÚÄÄÄÄÄÄÄÄÄÄ¿
+ ³ ³ ³ ³
+ ³ alice ³<ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ>³ david ³
+ ³ ³ ³ ³
+ ³ ³<ÄÄÄÄ¿ ÚÄÄÄÄÄÄ>³ ³
+ ÀÄÄÄÄÄÄÄÄÄÄÙ ³ ³ ÀÄÄÄÄÄÄÄÄÄÄÙ
+ ^ ³ ÚÄÄÄÄÄÄÄÄÄÄ¿ ³ ^
+ ³ ÀÄÄÄÄ>³ ³<ÄÄÄÄÄÙ ³
+ ³ ³ origin ³ ³
+ ³ ³ ³ ³
+ ³ ÚÄÄÄÄ>³ ³<ÄÄÄÄÄ¿ ³
+ v ³ ÀÄÄÄÄÄÄÄÄÄÄÙ ³ v
+ ÚÄÄÄÄÄÄÄÄÄÄ¿ ³ ³ ÚÄÄÄÄÄÄÄÄÄÄ¿
+ ³ ³<ÄÄÄÄÙ ÀÄÄÄÄÄÄ>³ ³
+ ³ bob ³ ³ clair ³
+ ³ ³<ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ>³ ³
+ ³ ³ ³ ³
+ ÀÄÄÄÄÄÄÄÄÄÄÙ ÀÄÄÄÄÄÄÄÄÄÄÙ
+:ecgraphic.
+
+:p.
+Each developer pulls and pushes to origin. But besides the centralized push-pull
+ relationships, each developer may also pull changes from other peers to form
+sub teams. For example, this might be useful to work together with two or more
+developers on a big new feature, before pushing the work in progress to origin
+prematurely. In the figure above, there are subteams of Alice and Bob, Alice
+and David, and Clair and David.
+
+:p.
+Technically, this means nothing more than that Alice has defined a Git remote,
+named bob, pointing to Bob's repository, and vice versa.
+
+
+.* -------------------------------------
+:h2.The main branches
+:p.
+At the core, the development model is greatly inspired by existing models out
+there. The central repo holds two main branches with an infinite lifetime:
+
+:ul compact.
+:li.master
+:li.develop
+:eul.
+
+:cgraphic.
+ (1) (2) (3)
+ master ÄÄÄAÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄFÄÄÄÄÄÄÄIÄÄÄÄÄÄÄÄÄÄÄÄ>
+ \ / /
+ develop ÄÄÄÄÄBÄÄÄCÄÄÄDÄÄÄEÄÄÄGÄÄÄHÄÄÄJÄÄÄKÄÄÄÄÄÄ>
+ (4)
+
+
+ 1) Initial production version
+ 2) Next production version
+ 3) Next production version
+ 4) Work in progress on "next release"
+:ecgraphic.
+
+.* :cgraphic.
+.* develop master
+.* | |
+.* | o Initial production version
+.* | /|
+.* | ,-------------' |
+.* |/ |
+.* o |
+.* | |
+.* o |
+.* | |
+.* o |
+.* | |
+.* o |
+.* |\ |
+.* | `-------------, |
+.* o \|
+.* | o Next production version
+.* o |
+.* |\ |
+.* | `-------------, |
+.* o \|
+.* | o Next production version
+.* Work in o |
+.* progress on | |
+.* "next release" | |
+.* | |
+.* v v
+.* :ecgraphic.
+
+:p.
+The :hp8.master:ehp8. branch at :hp8.origin:ehp8. should be familiar to every Git user. Parallel to
+the :hp8.master:ehp8. branch, another branch exists called :hp8.develop:ehp8..
+
+:p.
+We consider :hp8.origin/master:ehp8. to be the main branch where the source code of HEAD
+always reflects a production-ready state.
+
+:p.
+We consider :hp8.origin/develop:ehp8. to be the main branch where the source code of HEAD
+always reflects a state with the latest delivered development changes for the
+next release. Some would call this the "integration branch". This is where any
+automatic nightly builds are built from.
+
+:p.
+When the source code in the :hp8.develop:ehp8. branch reaches a stable point and is ready
+to be released, all of the changes should be merged back into :hp8.master:ehp8. somehow
+and then tagged with a release number. How this is done in detail will be
+discussed further on.
+
+:p.
+Therefore, each time when changes are merged back into :hp8.master:ehp8., this is a new
+production release by :hp1.definition:ehp1.. We tend to be very strict at this, so that
+theoretically, we could use a Git hook script to automatically build and
+roll-out our software to our production servers everytime there was a commit
+on :hp8.master:ehp8..
+
+
+.* -------------------------------------
+:h2.Supporting branches
+:p.
+Next to the main branches master and develop, our development model uses a
+variety of supporting branches to aid parallel development between team members,
+ease tracking of features, prepare for production releases and to assist in
+quickly fixing live production problems. Unlike the main branches, these
+branches always have a limited life time, since they will be removed eventually.
+
+:p.
+The different types of branches we may use are:
+
+:ul compact.
+:li.Feature branches
+:li.Release branches
+:li.Hotfix branches
+:eul.
+
+:p.
+Each of these branches have a specific purpose and are bound to strict rules
+as to which branches may be their originating branch and which branches must
+be their merge targets. We will walk through them in a minute.
+
+:p.
+By no means are these branches "special" from a technical perspective. The
+branch types are categorized by how we use them. They are of course plain old
+Git branches.
+
+.* -------------------------------------
+:h2.Feature branches
+.* :artwork align=center name='feature-branch.bmp'.
+:cgraphic.
+ develop ÄÄÄAÄÄÄBÄÄÄGÄÄÄHÄÄÄÄÄÄÄIÄÄÄJÄÄÄ>
+ \ /
+ feature ÄÄÄÄÄÄÄÄÄCÄÄÄDÄÄÄEÄÄÄFÄÄÄÄÄÄÄÄÄ>
+ branches
+:ecgraphic.
+
+
+.* :cgraphic.
+.* feature
+.* branches develop
+.* | |
+.* | o
+.* | |
+.* | o
+.* | /|
+.* | ,-------------' |
+.* |/ o
+.* o |
+.* | |
+.* o o
+.* | |
+.* o |
+.* |\ |
+.* | `-------------, |
+.* | \|
+.* | o
+.* | |
+.* | |
+.* v v
+.* :ecgraphic.
+
+:p.
+May branch off from: :hp8.develop:ehp8.
+.br
+Must merge back into: :hp8.develop:ehp8.
+.br
+Branch naming convention: anything except :hp8.master:ehp8., :hp8.develop:ehp8.,
+:hp8.release-*:ehp8., or :hp8.hotfix-*:ehp8.
+
+:p.
+Feature branches (or sometimes called topic branches) are used to develop new
+features for the upcoming or a distant future release. When starting development
+of a feature, the target release in which this feature will be incorporated may
+well be unknown at that point. The essence of a feature branch is that it
+exists as long as the feature is in development, but will eventually be merged
+back into develop (to definitely add the new feature to the upcoming release)
+or discarded (in case of a disappointing experiment).
+
+:p.
+Feature branches typically exist in developer repos only, not in :hp8.origin:ehp8..
+
+:h3.Creating a feature branch
+:p.
+When starting work on a new feature, branch off from the develop branch.
+
+:lm margin=5.
+:xmp.
+$ git checkout -b myfeature develop
+Switched to a new branch "myfeature"
+:exmp.
+:lm margin=1.
+
+:h3.Incorporating a finished feature on develop
+:p.
+Finished features may be merged into the develop branch definitely add them to
+the upcoming release:
+
+:lm margin=5.
+:xmp.
+$ git checkout develop
+Switched to branch 'develop'
+$ git merge --no-ff myfeature
+Updating ea1b82a..05e9557
+(Summary of changes)
+$ git branch -d myfeature
+Deleted branch myfeature (was 05e9557).
+$ git push origin develop
+:exmp.
+:lm margin=1.
+
+:p.
+The :hp2.--no-ff:ehp2. flag causes the merge to always create a new commit object, even
+if the merge could be performed with a fast-forward. This avoids losing
+information about the historical existence of a feature branch and groups
+together all commits that together added the feature. Compare:
+
+:cgraphic.
+
+ :hp2.git merge --no--ff:ehp2.
+
+ develop ÄÄÄAÄÄÄBÄÄÄÄÄÄÄÄÄÄÄFÄÄÄÄÄÄÄ>
+ \ /
+ feature ÄÄÄÄÄÄÄÄÄCÄÄÄDÄÄÄEÄÄÄÄÄÄÄÄÄ>
+ branches
+
+
+ :hp2.git merge:ehp2.
+ (plain)
+
+ develop ÄÄÄAÄÄÄBÄÄÄCÄÄÄDÄÄÄEÄÄÄFÄÄÄ>
+
+
+ where C, D and E are the feature commits
+:ecgraphic.
+
+:p.
+In the latter case, it is impossible to see from the Git history which of the
+commit objects together have implemented a feature -- you would have to manually
+read all the log messages. Reverting a whole feature (i.e. a group of commits),
+is a true headache in the latter situation, whereas it is easily done if the
+:hp2.--no-ff:ehp2. flag was used.
+
+:p.
+Yes, it will create a few more (empty) commit objects, but the gain is much
+bigger that that cost.
+
+:p.
+Unfortunately, I have not found a way to make :hp2.--no-ff:ehp2. the default behaviour of
+:hp2.git merge:ehp2. yet, but it really should be.
+
+
+.* -------------------------------------
+:h2.Release branches
+:p.
+May branch off from: :hp8.develop:ehp8.
+.br
+Must merge back into: :hp8.develop:ehp8. and :hp8.master:ehp8.
+.br
+Branch naming convention: :hp8.release-*:ehp8.
+
+:p.
+Release branches support preparation of a new production release. They allow
+for last-minute dotting of i's and crossing t's. Furthermore, they allow for
+minor bug fixes and preparing meta-data for a release (version number, build
+dates, etc.). By doing all of this work on a release branch, the :hp8.develop:ehp8. branch
+is cleared to receive features for the next big release.
+
+:p.
+The key moment to branch off a new release branch from :hp8.develop:ehp8. is when develop
+(almost) reflects the desired state of the new release. At least all features
+that are targeted for the release-to-be-built must be merged in to develop at
+this point in time. All features targeted at future releases may not -- they must
+wait until after the release branch is branched off.
+
+:p.
+It is exactly at the start of a release branch that the upcoming release gets
+assigned a version number -- not any earlier. Up until that moment, the :hp8.develop:ehp8.
+branch reflected changes for the "next release", but it is unclear whether
+that "next release" will eventually become 0.3 or 1.0, until the release branch
+is started. That decision is made on the start of the release branch and is
+carried out by the project's rules on version number bumping.
+
+:h3.Creating a release branch
+:p.
+Release branches are created from the develop branch. For example, say version
+1.1.5 is the current production release and we have a big release coming up.
+The state of develop is ready for the "next release" and we have decided that
+this will become version 1.2 (rather than 1.1.6 or 2.0). So we branch off and
+give the release branch a name reflecting the new version number:
+
+:lm margin=5.
+:xmp.
+$ git checkout -b release-1.2 develop
+Switched to a new branch "release-1.2"
+$ ./bump-version.sh 1.2
+Files modified successfully, version bumped to 1.2.
+$ git commit -a -m "Bumped version number to 1.2"
+[release-1.2 74d9424] Bumped version number to 1.2
+1 files changed, 1 insertions(+), 1 deletions(-)
+:exmp.
+:lm margin=1.
+
+:p.
+After creating a new branch and switching to it, we bump the version number.
+Here, :hp2.bump-version.sh:ehp2. is a fictional shell script that changes some files in
+the working copy to reflect the new version. (This can of course be a manual
+change -- the point being that some files change.) Then, the bumped version number
+is committed.
+
+:p.
+This new branch may exist there for a while, until the release may be rolled
+out definitely. During that time, bug fixes may be applied in this branch
+(rather than on the :hp8.develop:ehp8. branch). Adding large new features here is strictly
+prohibited. They must be merged into :hp8.develop:ehp8., and therefore, wait for the next
+big release.
+
+:h3.Finishing a release branch
+:p.
+When the state of the release branch is ready to become a real release, some
+actions need to be carried out. First, the release branch is merged into :hp8.master:ehp8.
+(since every commit on :hp8.master:ehp8. is a new release by definition, remember). Next,
+that commit on :hp8.master:ehp8. must be tagged for easy future reference to this
+historical version. Finally, the changes made on the release branch need to be
+merged back into :hp8.develop:ehp8., so that future releases also contain these bug fixes.
+
+:p.
+The first two steps in Git:
+
+:lm margin=5.
+:xmp.
+$ git checkout master
+Switched to branch 'master'
+$ git merge --no-ff release-1.2
+Merge made by recursive.
+(Summary of changes)
+$ git tag -a 1.2
+:exmp.
+:lm margin=1.
+
+:p.
+The release is now done, and tagged for future reference. You might as well
+use the -s or -u <key> flags to sign your tag cryptographically.
+
+:p.
+To keep the changes made in the release branch, we need to merge those back
+into :hp8.develop:ehp8., though. In Git:
+
+:lm margin=5.
+:xmp.
+$ git checkout develop
+Switched to branch 'develop'
+$ git merge --no-ff release-1.2
+Merge made by recursive.
+(Summary of changes)
+:exmp.
+:lm margin=1.
+
+:p.
+This step may well lead to a merge conflict (probably even, since we have
+changed the version number). If so, fix it and commit.
+
+:p.
+Now we are really done and the release branch may be removed, since we don't
+need it anymore:
+
+:lm margin=5.
+:xmp.
+$ git branch -d release-1.2
+Deleted branch release-1.2 (was ff452fe).
+:exmp.
+:lm margin=1.
+
+
+
+.* -------------------------------------
+:h2.Hotfix branches
+:p.
+May branch off from: :hp8.master:ehp8.
+.br
+Must merge back into: :hp8.develop:ehp8. and :hp8.master:ehp8.
+.br
+Branch naming convention: :hp8.hotfix-*:ehp8.
+
+:p.
+Hotfix branches are very much like release branches in that they are also meant
+to prepare for a new production release, albeit unplanned. They arise from the
+necessity to act immediately upon an undesired state of a live production version.
+When a critical bug in a production version must be resolved immediately, a
+hotfix branch may be branched off from the corresponding tag on the master
+branch that marks the production version.
+
+:p.
+The essence is that work of team members (on the :hp8.develop:ehp8. branch) can continue,
+while another person is preparing a quick production fix.
+
+
+:h3.Creating the hotfix branch
+:p.
+Hotfix branches are created from the :hp8.master:ehp8. branch. For example, say version
+1.2 is the current production release running live and causing troubles due
+to a severe bug. But changes on :hp8.develop:ehp8. are yet unstable. We may then branch
+off a hotfix branch and start fixing the problem:
+
+:lm margin=5.
+:xmp.
+$ git checkout -b hotfix-1.2.1 master
+Switched to a new branch "hotfix-1.2.1"
+$ ./bump-version.sh 1.2.1
+Files modified successfully, version bumped to 1.2.1.
+$ git commit -a -m "Bumped version number to 1.2.1"
+[hotfix-1.2.1 41e61bb] Bumped version number to 1.2.1
+1 files changed, 1 insertions(+), 1 deletions(-)
+:exmp.
+:lm margin=1.
+
+:p.
+Don't forget to bump the version number after branching off!
+
+:p.
+Then, fix the bug and commit the fix in one or more separate commits.
+
+:lm margin=5.
+:xmp.
+$ git commit -m "Fixed severe production problem"
+[hotfix-1.2.1 abbe5d6] Fixed severe production problem
+5 files changed, 32 insertions(+), 17 deletions(-)
+:exmp.
+:lm margin=1.
+
+
+:h3.Finishing a hotfix branch
+:p.
+When finished, the bugfix needs to be merged back into :hp8.master:ehp8., but also needs
+to be merged back into :hp8.develop:ehp8., in order to safeguard that the bugfix is
+included in the next release as well. This is completely similar to how
+release branches are finished.
+
+:p.
+First, update :hp8.master:ehp8. and tag the release.
+
+:lm margin=5.
+:xmp.
+$ git checkout master
+Switched to branch 'master'
+$ git merge --no-ff hotfix-1.2.1
+Merge made by recursive.
+(Summary of changes)
+$ git tag -a 1.2.1
+:exmp.
+:lm margin=1.
+
+:p.
+You might as well use the -s or -u <key> flags to sign your tag cryptographically.
+
+:p.
+Next, include the bugfix in :hp8.develop:ehp8., too:
+
+:lm margin=5.
+:xmp.
+$ git checkout develop
+Switched to branch 'develop'
+$ git merge --no-ff hotfix-1.2.1
+Merge made by recursive.
+(Summary of changes)
+:exmp.
+:lm margin=1.
+
+:p.
+The one exception to the rule here is that, :hp2.when a release branch currently
+exists, the hotfix changes need to be merged into that release branch, instead
+of develop:ehp2.. Back-merging the bugfix into the release branch will eventually
+result in the bugfix being merged into :hp8.develop:ehp8. too, when the release branch is
+finished. (If work in :hp8.develop:ehp8. immediately requires this bugfix and cannot wait
+for the release branch to be finished, you may safely merge the bugfix into
+:hp8.develop:ehp8. now already as well.)
+
+:p.
+Finally, remove the temporary branch:
+
+:lm margin=5.
+:xmp.
+$ git branch -d hotfix-1.2.1
+Deleted branch hotfix-1.2.1 (was abbe5d6).
+:exmp.
+:lm margin=1.
+
+
+:h2.Summary
+:p.
+While there is nothing really shocking new to this branching model, the "big
+picture" figure that this post began with has turned out to be tremendously
+useful in our projects. It forms an elegant mental model that is easy to
+comprehend and allows team members to develop a shared understanding of the
+branching and releasing processes.
+
+:p.
+This document is based on an article found at http://nvie.com/posts/a-successful-git-branching-model/
+
+
+
+
+:euserdoc.
+
diff --git a/docs/fpGUIHelpIntegration.txt b/docs/fpGUIHelpIntegration.txt
index fc22a7fc..7e0fdc2a 100644
--- a/docs/fpGUIHelpIntegration.txt
+++ b/docs/fpGUIHelpIntegration.txt
@@ -1,15 +1,31 @@
-Setup for Integrated Help under Lazarus
----------------------------------------
-For the Integrated Help to work, the fpGUIHelpIntegration package has been
+ Setting up for Integrated Help under your IDE
+ =============================================
+
+
+INF help using DocView (preferred)
+----------------------------------
+
+Please see the website for detailed instructions on how to do this.
+
+ htpp://fpgui.sourceforge.net/docview_ide_integration.shtml
+
+
+
+HTML help using Lazarus IDE
+---------------------------
+
+For the Integrated Help to work, the fpGUIHelpIntegration package has been
setup to find the help in the /docs/html directory.
Installation:
----------------
-1) Open fpGUIHelpIntegration.lpk package with Lazarus.
-2) Click Compile
-3) Click Install
+
+ 1) Open fpGUIHelpIntegration.lpk package with Lazarus.
+
+ 2) Click Compile
+
+ 3) Click Install
+
-Regards,
- - Graeme Geldenhuys -
+ ==============[ END ]===============
diff --git a/docs/fpc_lang_ref.ipf b/docs/fpc_lang_ref.ipf
new file mode 100644
index 00000000..c6440957
--- /dev/null
+++ b/docs/fpc_lang_ref.ipf
@@ -0,0 +1,5655 @@
+:userdoc.
+:title.Free Pascal&colon. Language Reference guide
+:docprof toc=123456.
+.* ==============================================================
+.* Custom symbols
+.nameit symbol='fpc' text='Free Pascal'
+.nameit symbol='delphi' text='Delphi'
+.nameit symbol='tp' text='Turbo Pascal'
+.nameit symbol='fpcversion' text='2&per.4'
+.nameit symbol='date' text='December 2009'
+.nameit symbol='progref' text='Programmer&apos.s Guide [ http://www.freepascal.org/docs.var ]'
+.nameit symbol='ra' text='â–º'
+.nameit symbol='la' text='â—„'
+.nameit symbol='dar' text='â–¼'
+.nameit symbol='uar' text='^'
+.nameit symbol='linux' text='Linux'
+.* ==============================================================
+:h1.Free Pascal&colon. Language Reference guide
+:p.
+:hp2.Language Reference guide for Free Pascal version &fpcversion. :ehp2.
+
+:p.
+Document version &fpcversion. (r617)
+.br
+&date.
+
+:p.
+:p.
+:p.
+:p.
+Written by :hp1.Michael van Canneyt:ehp1.
+.br
+LaTeX to IPF conversion by :hp1.Graeme Geldenhuys:ehp1.
+:p.
+:p.
+:p.
+:note.:color fc=red.Please switch DocView to using the UTF-8 text encoding for this document.:color fc=default.
+
+.* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+.* % About this guide
+.* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+:h2.About this guide
+:p.
+This document serves as the reference for the Pascal langauge as implemented
+by the &fpc. compiler. It describes all Pascal constructs supported by
+&fpc., and lists all supported data types. It does not, however, give a
+detailed explanation of the Pascal language: it is not a tutorial.
+The aim is to list which Pascal constructs are supported, and to show
+where the &fpc. implementation differs from the &tp. or &delphi.
+implementations.
+
+:p.
+The &tp. and &delphi. Pascal compilers introduced various features in the
+Pascal language. The Free Pascal compiler emulates these compilers in the
+appropriate mode of the compiler: certain features are available only
+if the compiler is switched to the appropriate mode. When required for
+a certain feature, the use of the :hp1.-M:ehp1. command-line switch or
+:hp1.{$MODE}:ehp1. directive will be indicated in the text. More information
+about the various modes can be found in the user's manual and the
+programmer's manual.
+
+:p.
+Earlier versions of this document also contained the reference documentation
+of the :hp1.system:ehp1. unit and :hp1.objpas:ehp1. unit. This has been moved to the
+RTL reference guide.
+
+.* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+.* % Notations
+:h3.Notations
+:p.
+Throughout this document, we will refer to functions, types and variables
+with :font facename=Courier size=16x16.typewriter:font facename='System Proportional'. font.
+Files are referred to with a sans font: :font facename=Sans size=16x16.filename:font facename='System Proportional'..
+
+
+.* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+.* % Syntax diagrams
+:h3.Syntax diagrams
+:p.
+All elements of the Pascal language are explained in syntax diagrams. Syntax diagrams are like flow
+charts. Reading a syntax diagram means getting from the left side to the right side, following the
+arrows. When the right side of a syntax diagram is reached, and it ends with a single arrow, this
+means the syntax diagram is continued on the next line. If the line ends on 2 arrows pointing to each
+other, then the diagram is ended.
+:p.
+Syntactical elements are written like this:
+:cgraphic.
+&ra.&ra.─── syntactical elemements are like this ───────────────────────────────────&ra.&la.
+:ecgraphic.
+
+:p.
+Keywords which must be typed exactly as in the diagram:
+:cgraphic.
+&ra.&ra.─── :hp2.keywords are like this:ehp2. ─────────────────────────────────────────────────&ra.&la.
+:ecgraphic.
+
+:p.
+When something can be repeated, there is an arrow around it:
+:cgraphic.
+&ra.&ra.─────┬─ this can be repeated ─┬─────────────────────────────────────────────&ra.&la.
+ ^────────────────────────┘
+:ecgraphic.
+
+:p.
+When there are different possibilities, they are listed in rows:
+:cgraphic.
+&ra.&ra.─────┬─ First possibility ──┬───────────────────────────────────────────────&ra.&la.
+ └─ Second possibility ─┘
+:ecgraphic.
+
+:p.
+Note, that one of the possibilities can be empty:
+:cgraphic.
+&ra.&ra.─────┬──────────────────────┬───────────────────────────────────────────────&ra.&la.
+ ├─ First possibility ─┤
+ └─ Second possibility ─┘
+:ecgraphic.
+
+:p.
+This means that both the first or second possibility are optional. Of course, all these elements can be
+combined and nested.
+
+
+.* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+.* % About the Pascal Language
+.* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+:h2.About the Pascal Language
+:p.
+The language Pascal was originally designed by Niklaus Wirth around 1970. It
+has evolved significantly since that day, with a lot of contributions by the
+various compiler constructors (Notably: Borland). The basic elements have been
+kept throughout the years:
+:ul.
+:li. Easy syntax, rather verbose, yet easy to read. Ideal for teaching.
+:li. Strongly typed.
+:li. Procedural.
+:li. Case insensitive.
+:li. Allows nested procedures.
+:li. Easy input/output routines built-in.
+:eul.
+
+:p.
+The &tp. and &delphi. Pascal compilers introduced various features in
+the Pascal language, most notably easier string handling and object
+orientedness. The &fpc. compiler initially emulated most of &tp.
+and later on &delphi.. It emulates these compilers in the appropriate mode
+of the compiler: certain features are available only if the compiler is
+switched to the appropriate mode. When required for a certain feature, the use
+of the -M command-line switch or {$MODE } directive will be indicated in the
+text. More information about the various modes can be found in the User's
+Manual and the Programmer's Manual.
+
+
+.* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+.* % Pascal Tokens
+.* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+:h2.Pascal Tokens
+:p.
+Tokens are the basic lexical building blocks of source code: they
+are the 'words' of the language: characters are combined into tokens according
+to the rules of the programming language. There are five classes of tokens:
+
+:parml tsize=20 break=none.
+:pt.:hp2.reserved words:ehp2.
+:pd. These are words which have a fixed meaning in the language. They cannot
+be changed or redefined.
+
+:pt.:hp2.identifiers:ehp2.
+:pd.These are names of symbols that the programmer defines. They can be changed
+and re-used. They are subject to the scope rules of the language.
+
+:pt.:hp2.operators:ehp2.
+:pd.These are usually symbols for mathematical or other operations: +, -, * and
+so on.
+
+:pt.:hp2.separators:ehp2.
+:pd.This is usually white-space.
+
+:pt.:hp2.constants:ehp2.
+:pd.Numerical or character constants are used to denote actual values in the
+source code, such as 1 (integer constant) or 2.3 (float constant) or
+'String constant' (a string: a piece of text).
+:eparml.
+
+:p.
+In this chapter we describe all the Pascal reserved words&comma. as well as the
+various ways to denote strings&comma. numbers&comma. identifiers etc&per.
+
+
+.* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+.* % Symbols
+:h3.Symbols
+:p.
+&fpc. allows all characters, digits and some special character
+symbols in a Pascal source file.
+
+:cgraphic.
+┌──────────────────────────────────────────────────────────────────────────────â”
+:hp2.Recognised symbols:ehp2.
+
+&ra.&ra.─── letter ──┬─ A..Z ─┬─────────────────────────────────────────────────────&ra.&la.
+ └─ a..z ─┘
+
+&ra.&ra.─── digit ─ 0..9 ───────────────────────────────────────────────────────────&ra.&la.
+
+&ra.&ra.─── hex digit ──┬─ 0..9 ─┬──────────────────────────────────────────────────&ra.&la.
+ ├─ A..Z ─┤
+ └─ a..z ─┘
+└──────────────────────────────────────────────────────────────────────────────┘
+:ecgraphic.
+
+:p.
+The following characters have a special meaning:
+:xmp.
++ - * / = < > [ ] . , ( ) : ^ @ { } $ #
+:exmp.
+
+:p.
+and the following character pairs too:
+:xmp.
+<= >= := += -= *= /= (* *) (. .) //
+:exmp.
+
+:p.
+When used in a range specifier, the character pair (. is equivalent to the
+left square bracket [. Likewise, the character pair .) is equivalent to the
+right square bracket ]. When used for comment delimiters, the character pair
+(* is equivalent to the left brace { and the character pair *) is equivalent
+to the right brace }. These character pairs retain their normal meaning in
+string expressions.
+
+.* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+.* % Comments
+:h3.Comments
+:p.
+Comments are pieces of the source code which are completely discarded by the
+compiler. They exist only for the benefit of the programmer, so he can explain
+certain pieces of code. For the compiler, it is as if the comments were not
+present.
+
+:p.
+The following piece of code demonstrates a comment:
+:xmp.
+(* My beautiful function returns an interesting result *)
+Function Beautiful: Integer;
+:exmp.
+
+:p.
+The use of (* and *) as comment delimiters dates from the very first days of
+the Pascal language. It has been replaced mostly by the use of { and } as
+comment delimiters, as in the following example:
+:xmp.
+{ My beautiful function returns an interesting result }
+Function Beautiful: Integer;
+:exmp.
+
+:p.
+The comment can also span multiple lines:
+:xmp.
+{
+ My beautiful function returns an interesting result,
+ but only if the argument A is less than B.
+}
+Function Beautiful(A, B: Integer): Integer;
+:exmp.
+
+:p.
+Single line comments can also be made with the // delimiter:
+:xmp.
+// My beautiful function returns an interesting result
+Function Beautiful: Integer;
+:exmp.
+
+:p.
+The comment extends from the // character till the end of the line. This kind
+of comment was introduced by Borland in the &delphi. Pascal compiler.
+:p.
+&fpc. supports the use of nested comments. The following constructs are
+valid comments:
+:xmp.
+(* This is an old style comment *)
+{ This is a Turbo Pascal comment }
+// This is a &delphi. comment. All is ignored till the end of the line.
+:exmp.
+
+:p.
+The following are valid ways of nesting comments:
+:xmp.
+{ Comment 1 (* comment 2 *) }
+(* Comment 1 { comment 2 } *)
+{ comment 1 // Comment 2 }
+(* comment 1 // Comment 2 *)
+// comment 1 (* comment 2 *)
+// comment 1 { comment 2 }
+:exmp.
+
+:p.
+The last two comments must be on one line. The following two will give errors:
+:xmp.
+// Valid comment { No longer valid comment !!
+ }
+:exmp.
+
+:p.
+and
+:xmp.
+// Valid comment (* No longer valid comment !!
+ *)
+:exmp.
+
+:p.
+The compiler will react with a 'invalid character' error when it encounters
+such constructs, regardless of the :hp1.-Mturbo:ehp1. switch.
+
+:nt.
+In :hp1.TP:ehp1. and :hp1.Delphi:ehp1. mode, nested comments are not allowed,
+for maximum compatibility with existing code for those compilers.
+:ent.
+
+
+
+.* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+.* % Reserved words
+:h3.Reserved words
+:p.
+Reserved words are part of the Pascal language, and as such, cannot be
+redefined by the programmer. Throughout the syntax diagrams they will be
+denoted using a :hp2.bold:ehp2. typeface. Pascal is not case sensitive so the compiler
+will accept any combination of upper or lower case letters for reserved words.
+
+:p.
+We make a distinction between &tp. and &delphi. reserved words. In
+:hp2.TP:ehp2. mode, only the &tp. reserved words are recognised, but
+the &delphi. ones can be redefined. By default, &fpc. recognises the &delphi.
+reserved words.
+
+:h4.&tp. reserved words
+:p.
+The following keywords exist in &tp. mode:
+.* * * *
+:xmp.
+absolute file object shr
+and for of string
+array function on then
+asm goto operator to
+begin if or type
+case implementation packed unit
+const in procedure until
+constructor inherited program uses
+destructor inline record var
+div interface reintroduce while
+do label repeat with
+downto mod self xor
+else nil set
+end not shl
+:exmp.
+
+:h4.&fpc. reserved words
+:p.
+On top of the &tp. reserved words, &fpc. also considers the
+following as reserved words:
+.* * * *
+:xmp.
+dispose false true
+exit new
+:exmp.
+
+
+:h4.Object Pascal reserved words
+:p.
+The reserved words of Object Pascal (used in :hp2.Delphi:ehp2. or :hp2.ObjPas:ehp2. mode) are the
+same as the &tp. ones, with the following additional keywords:
+.* * * *
+:xmp.
+as finalization library raise
+class finally on resourcestring
+dispinterface initialization out threadvar
+except inline packed try
+exports is property
+
+:exmp.
+
+
+:h4.Modifiers
+:p.
+The following is a list of all modifiers. They are not exactly reserved words
+in the sense that they can be used as identifiers, but in specific places, they
+have a special meaning for the compiler, i.e., the compiler considers them as
+part of the Pascal language.
+.* * * *
+:xmp.
+absolute external nostackframe read
+abstract far oldfpccall register
+alias far16 override reintroduce
+assembler forward pascal safecall
+cdecl index private softfloat
+cppdecl local protected stdcall
+default name public virtual
+export near published write
+:exmp.
+
+:p.
+:nt.
+Predefined types such as :hp1.Byte:ehp1., :hp1.Boolean:ehp1. and constants such
+as :hp1.maxint:ehp1. are not reserved words. They are identifiers, declared in the system unit. This means
+that these types can be redefined in other units. The programmer is however
+:hp2.not:ehp2. encouraged to do this, as it will cause a lot of confusion.
+:ent.
+
+:h3.Identifiers
+:p.
+Identifiers denote programmer defined names for specific constants, types,
+variables, procedures and functions, units, and programs. All programmer
+defined names in the source code – excluding reserved words – are designated
+as identifiers.
+
+:p.
+Identifiers consist of between 1 and 127 significant characters (letters,
+digits and the underscore character), of which the first must be an alphanumeric
+character, or an underscore (_). The following diagram gives the basic syntax
+for identifiers.
+
+:cgraphic.
+┌──────────────────────────────────────────────────────────────────────────────â”
+:hp2.Identifiers:ehp2.
+
+&ra.&ra.─── identifier ──┬─ letter ─┬─┬──────────────┬──────────────────────────────&ra.&la.
+ └─── _ ────┘ ^─┬─ letter ─┬─┘
+ ├─ digit ──┤
+ └─── _ ────┘
+└──────────────────────────────────────────────────────────────────────────────┘
+:ecgraphic.
+
+:p.
+Like Pascal reserved words, identifiers are case insensitive, that is, both
+:xmp.
+myprocedure;
+:exmp.
+
+:p.
+and
+:xmp.
+MyProcedure;
+:exmp.
+
+:p.
+refer to the same procedure.
+
+:nt.
+As of version 2.5.1 it is possible to specify a reserved word as an identifier
+by prepending it with an ampersand (&amp.). This means that the following is
+possible:
+
+:xmp.
+program testdo;
+
+procedure &amp.do;
+begin
+end;
+
+begin
+ &amp.do;
+end.
+:exmp.
+
+:p.
+The reserved word :hp1.do:ehp1. is used as an identifier for the declaration
+as well as the invocation of the procedure 'do'.
+:ent.
+
+
+.* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+.* % Hint directives
+:h3.Hint directives
+:p.
+Most identifiers (constants, variables, functions or methods, properties) can
+have a hint directive appended to their definition:
+
+:cgraphic.
+┌──────────────────────────────────────────────────────────────────────────────â”
+:hp2.Hint directives:ehp2.
+
+&ra.&ra.─── hint directive ──┬─────────────────┬────────────────────────────────────&ra.&la.
+ ├── Deprecated ───┤
+ ├─ Experimental ──┤
+ ├─── Platform ────┤
+ └─ Unimplemented ─┘
+└──────────────────────────────────────────────────────────────────────────────┘
+:ecgraphic.
+
+:p.
+Whenever an identifier marked with a hint directive is later encountered by the
+compiler, then a warning will be displayed, corresponding to the specified hint.
+
+:parml tsize=20 break=none.
+
+:pt.:hp2.deprecated:ehp2.
+:pd.The use of this identifier is deprecated, use an alternative instead.
+
+:pt.:hp2.experimental:ehp2.
+:pd.The use of this identifier is experimental: this can be used to flag new
+features that should be used with caution.
+
+:pt.:hp2.platform:ehp2.
+:pd.This is a platform-dependent identifier: it may not be defined on all
+platforms.
+
+:pt.:hp2.unimplemented:ehp2.
+:pd.This should be used on functions and procedures only. It should be used to
+signal that a particular feature has not yet been implemented.
+
+:eparml.
+
+:p.
+The following are examples:
+
+:xmp.
+const
+ AConst = 12 deprecated;
+
+var
+ p: integer platform;
+
+function Something: Integer; experimental;
+begin
+ Something := P + AConst;
+end;
+
+begin
+ Something;
+end.
+:exmp.
+
+:p.
+This would result in the following output:
+
+:xmp.
+testhd.pp(11,15) Warning: Symbol "p" is not portable
+testhd.pp(11,22) Warning: Symbol "AConst" is deprecated
+testhd.pp(15,3) Warning: Symbol "Something" is experimental
+:exmp.
+
+:p.
+Hint directives can follow all kinds of identifiers: units, constants, types,
+variables, functions, procedures and methods.
+
+
+
+.* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+.* % Numbers
+:h3.Numbers
+:p.
+Numbers are by default denoted in decimal notation.
+Real (or decimal) numbers are written using engineering or scientific
+notation (e.g. 0.314E1).
+
+:p.
+For integer type constants, &fpc. supports 4 formats:
+
+:ol.
+:li. Normal, decimal format (base 10). This is the standard format.
+
+:li. Hexadecimal format (base 16), in the same way as &tp. does.
+To specify a constant value in hexadecimal format, prepend it with a dollar
+sign ($). Thus, the hexadecimal $FF equals 255 decimal.
+Note that case is insignificant when using hexadecimal constants.
+
+:li. As of version 1.0.7, Octal format (base 8) is also supported.
+To specify a constant in octal format, prepend it with a ampersand (&amp.).
+For instance 15 is specified in octal notation as &amp.17.
+
+:li. Binary notation (base 2). A binary number can be specified
+by preceding it with a percent sign (%). Thus, 255 can be
+specified in binary notation as %11111111.
+:eol.
+
+:p.
+The following diagrams show the syntax for numbers.
+
+:cgraphic.
+┌──────────────────────────────────────────────────────────────────────────────â”
+:hp2.Numbers:ehp2.
+
+&ra.&ra.─── hex digit sequence ──┬── hex digit ──┬──────────────────────────────────&ra.&la.
+ &uar.───────────────┘
+
+&ra.&ra.─── octal digit sequence ──┬── octal digit ──┬──────────────────────────────&ra.&la.
+ &uar.─────────────────┘
+
+&ra.&ra.─── binary digit sequence ──┬┬─ 1 ─┬┬───────────────────────────────────────&ra.&la.
+ │└─ 0 ─┘│
+ &uar.───────┘
+
+&ra.&ra.─── digit sequence ──┬── digit ──┬──────────────────────────────────────────&ra.&la.
+ ^───────────┘
+
+&ra.&ra.─── unsigned integer ──┬────── digit sequence ───────┬──────────────────────&ra.&la.
+ ├─ $ ─ hex digit sequence ────┤
+ ├─ & ─ octal digit sequence ──┤
+ └─ % ─ binary digit sequence ─┘
+
+&ra.&ra.─── hex digit sequence ──┬── hex digit ──┬──────────────────────────────────&ra.&la.
+ ^───────────────┘
+
+&ra.&ra.─── sign ──┬── + ──┬────────────────────────────────────────────────────────&ra.&la.
+ └── - ──┘
+
+&ra.&ra.─── unsigned real ─ digit sequence ─┬────────────────────┬┬──────────────┬──&ra.&la.
+ └ . ─ digit sequence ┘└ scale factor ┘
+
+&ra.&ra.─── scale factor ─┬─ E ─┬┬──────┬─ digit sequence ──────────────────────────&ra.&la.
+ └─ e ─┘└ sign ┘
+
+&ra.&ra.─── unsigned number ──┬─── unsigned real ──┬────────────────────────────────&ra.&la.
+ └─ unsigned integer ─┘
+
+&ra.&ra.─── signed number ──┬────────┬─ unsigned number ────────────────────────────&ra.&la.
+ └─ sign ─┘
+
+└──────────────────────────────────────────────────────────────────────────────┘
+:ecgraphic.
+
+:nt.
+Octal and Binary notation are not supported in TP or Delphi compatibility mode.
+:ent.
+
+
+
+.* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+.* % Labels
+:h3.Labels
+:p.
+A label is a name for a location in the source code to which can be
+jumped to from another location with a :hp2.goto:ehp2. statement. A Label is a
+standard identifier with the exception that it can start with a digit.
+
+:cgraphic.
+┌──────────────────────────────────────────────────────────────────────────────â”
+:hp2.Label:ehp2.
+
+&ra.&ra.─── label ──┬─ digit sequence ─┬────────────────────────────────────────────&ra.&la.
+ └── identifier ────┘
+
+└──────────────────────────────────────────────────────────────────────────────┘
+:ecgraphic.
+
+:nt.
+The -Sg or -Mtp switches must be specified before labels can be used. By
+default, &fpc. doesn't support :hp2.label:ehp2. and :hp2.goto:ehp2. statements.
+The :hp2.{$GOTO ON}:ehp2. directive can also be used to allow use of labels and
+the goto statement.
+:ent.
+
+
+.* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+.* % Character strings
+:h3.Character strings
+:p.
+A character string (or string for short) is a sequence of zero or more
+characters (byte sized), enclosed in single quotes, and on a single
+line of the program source code: no literal carriage return or linefeed
+characters can appear in the string.
+
+:p.
+A character set with nothing between the quotes ('') is an empty string.
+
+:cgraphic.
+┌──────────────────────────────────────────────────────────────────────────────â”
+:hp2.Character strings:ehp2.
+
+&ra.&ra.─── character string ──┬┬─ quoted string ──┬┬───────────────────────────────&ra.&la.
+ │└─ control string ─┘│
+ ^────────────────────┘
+
+&ra.&ra.─── quoted string ─ ' ──┬─ string character ─┬─ ' ──────────────────────────&ra.&la.
+ ^────────────────────┘
+
+&ra.&ra.─── string character ──┬─ Any character except ' or CR ─┬───────────────────&ra.&la.
+ └────────────── " ───────────────┘
+
+&ra.&ra.─── control string ──┬─ # ─ unsigned integer ─┬─────────────────────────────&ra.&la.
+ ^────────────────────────┘
+
+└──────────────────────────────────────────────────────────────────────────────┘
+:ecgraphic.
+
+:p.
+The string consists of standard, 8-bit ASCII characters or Unicode (normally
+UTF-8 encoded) characters. The :hp1.control string:ehp1. can be used to specify
+characters which cannot be typed on a keyboard, such as :hp1.#27:ehp1. for
+the escape character.
+
+:p.
+The single quote character can be embedded in the string by typing it twice.
+The C construct of escaping characters in the string (using a backslash)
+is not supported in Pascal.
+
+:p.
+The following are valid string constants:
+:xmp.
+ 'This is a pascal string'
+ ''
+ 'a'
+ 'A tabulator character: '#9' is easy to embed'
+:exmp.
+
+:p.
+The following is an invalid string:
+
+:xmp.
+ 'the string starts here
+ and continues here'
+:exmp.
+
+:p.
+The above string must be typed as:
+
+:xmp.
+ 'the string starts here'#13#10' and continues here'
+:exmp.
+
+or
+:xmp.
+ 'the string starts here'#10' and continues here'
+:exmp.
+
+:p.
+on unices (including Mac OS X), and as
+
+:xmp.
+ 'the string starts here'#13' and continues here'
+:exmp.
+
+on a classic Mac-like operating system.
+
+It is possible to use other character sets in strings: in that case the
+codepage of the source file must be specified with the :hp1.{$CODEPAGE XXX}:ehp1.
+directive or with the :hp2.-Fc:ehp2. command line option for the compiler. In that
+case the characters in a string will be interpreted as characters from the
+specified codepage.
+
+
+
+
+.* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+.* % Constants
+.* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+:h2.Constants
+:p.
+Just as in &tp., &fpc. supports both ordinary and typed constants.
+
+:ul.
+:li.:link reftype=hd refid=constants_ordinary.Ordinary constants:elink.
+:li.:link reftype=hd refid=constants_typed.Typed constants:elink.
+:li.:link reftype=hd refid=constants_resource.Resource strings:elink.
+:eul.
+
+.* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+.* % Ordinary constants
+:h3 name=constants_ordinary.Ordinary constants
+:p.
+Ordinary constants declarations are constructed using an identifier name
+followed by an "=" token, and followed by an optional expression consisting
+of legal combinations of numbers, characters, boolean values or enumerated
+values as appropriate. The following syntax diagram shows how to construct
+a legal declaration of an ordinary constant.
+
+:cgraphic.
+┌──────────────────────────────────────────────────────────────────────────────â”
+:hp2.Constant declaration:ehp2.
+
+&ra.&ra.─── constant declaration ─┬─ identifier ─ = ─ expression ─ hint directives ─ ; ─┬───&ra.&la.
+ ^─────────────────────────────────────────────────────┘
+
+└──────────────────────────────────────────────────────────────────────────────┘
+:ecgraphic.
+
+:p.
+The compiler must be able to evaluate the expression in a constant
+declaration at compile time. This means that most of the functions
+in the Run-Time library cannot be used in a constant
+declaration.
+
+:p.
+Operators such as +, -, *, /, not, and, or, div, mod, ord, chr,
+sizeof, pi, int, trunc, round, frac, odd can be used, however.
+For more information on expressions, see the section :link reftype=hd refid=expressions.Expressions:elink.&per.
+
+
+:p.
+Only constants of the following types can be declared: :hp1.Ordinal types:ehp1.&comma.
+:hp1.Real types:ehp1.&comma. :hp1.Char:ehp1.&comma. and :hp1.String:ehp1.&per.
+The following are all valid constant declarations&colon.
+
+:xmp.
+Const
+ e = 2.7182818; { Real type constant. }
+ a = 2; { Ordinal (Integer) type constant. }
+ c = '4'; { Character type constant. }
+ s = 'This is a constant string'; {String type constant.}
+ s = chr(32)
+ ls = SizeOf(Longint);
+:exmp.
+
+:p.
+Assigning a value to an ordinary constant is not permitted.
+Thus, given the previous declaration, the following will result
+in a compiler error:
+:xmp.
+ s := 'some other string';
+:exmp.
+
+:p.
+For string constants, the type of the string is dependent on some compiler
+switches. If a specific type is desired, a typed constant should be used,
+as explained in the following section.
+
+:p.
+Prior to version 1.9, &fpc. did not correctly support 64-bit constants. As
+of version 1.9, 64-bit constants can be specified.
+
+
+
+.* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+.* % Typed constants
+:h3 name=constants_typed.Typed constants
+:p.
+Sometimes it is necessary to specify the type of a constant, for instance
+for constants of complex structures (defined later in the manual).
+Their definition is quite simple.
+
+:cgraphic.
+┌──────────────────────────────────────────────────────────────────────────────â”
+:hp2.Constant declaration:ehp2.
+
+ typed
+&ra.&ra.─── constant ───┬─ identifier ─ : ─ type ─ = ─ type constant ─ hint directives ─ ; ─┬───&ra.&la.
+ declaration ^───────────────────────────────────────────────────────────────────┘
+
+&ra.&ra.─── typed constant ──┬────── constant ───────┬──────────────────────────────&ra.&la.
+ ├─ address constant ─┤
+ ├─ array constant ─┤
+ ├─ record constant ─┤
+ └─ procedural constant ─┘
+
+└──────────────────────────────────────────────────────────────────────────────┘
+:ecgraphic.
+
+:p.
+Contrary to ordinary constants, a value can be assigned to them at
+run-time. This is an old concept from &tp., which has been
+replaced with support for initialized variables: For a detailed
+description, see :link reftype=hd refid='variables_initializedvars'.Initialized variables:elink..
+
+Support for assigning values to typed constants is controlled by the
+:hp2.{$J}:ehp2. directive: it can be switched off, but is on by default
+(for &tp. compatibility). Initialized variables are always allowed.
+
+:nt.
+It should be stressed that typed constants are automatically initialized at program start.
+This is also true for :hp1.local:ehp1. typed constants and initialized variables.
+Local typed constants are also initialized at program start. If their value was
+changed during previous invocations of the function, they will retain their
+changed value, i.e. they are not initialized each time the function is invoked.
+:ent.
+
+.* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+.* % Ordinary constants
+:h3 name=constants_resource.Resource strings
+:p.
+A special kind of constant declaration block is the :hp1.resourcestring:ehp1.
+block. Resourcestring declarations are much like constant string
+declarations: resource strings act as constant strings, but they
+can be localized by means of a set of special routines in the
+:hp1.objpas:ehp1. unit. A resource string declaration block
+is only allowed in the :hp1.Delphi:ehp1. or :hp1.ObjFPC:ehp1. modes.
+
+:p.
+The following is an example of a resourcestring definition:
+:xmp.
+resourcestring
+ FileMenu = '&amp.File...';
+ EditMenu = '&amp.Edit...';
+:exmp.
+
+:p.
+All string constants defined in the resourcestring section are stored
+in special tables. The strings in these tables can be manipulated
+at runtime with some special mechanisms in the :hp1.objpas:ehp1. unit.
+
+:p.
+Semantically, the strings act like ordinary constants; It is not allowed
+to assign values to them (except through the special mechanisms in the
+objpas unit). However, they can be used in assignments or expressions as
+ordinary string constants. The main use of the resourcestring section is
+to provide an easy means of internationalization.
+
+:p.
+More on the subject of resourcestrings can be found in the
+:link reftype=hd database='prog.inf' refid=0.&progref.:elink., and
+in the :hp1.objpas:ehp1. unit reference.
+
+:nt.
+Note that a resource string which is given as an expression will not change if
+the parts of the expression are changed:
+:xmp.
+resourcestring
+ Part1 = 'First part of a long string.';
+ Part2 = 'Second part of a long string.';
+ Sentence = Part1 + ' ' + Part2;
+:exmp.
+
+:p.
+If the localization routines translate :hp1.Part1:ehp1. and :hp1.Part2:ehp1., the
+:hp1.Sentence:ehp1. constant will not be translated automatically: it has a
+separate entry in the resource string tables, and must therefor be
+translated separately. The above construct simply says that the
+initial value of :hp1.Sentence:ehp1. equals :hp1.Part1+' '+Part2:ehp1..
+:ent.
+
+:nt.
+Likewise, when using resource strings in a constant array, only the initial
+values of the resource strings will be used in the array: when the
+individual constants are translated, the elements in the array will retain
+their original value.
+:xmp.
+resourcestring
+ Yes = 'Yes.';
+ No = 'No.';
+
+var
+ YesNo: Array[Boolean] of string = (No, Yes);
+ B: Boolean;
+
+begin
+ Writeln(YesNo[B]);
+end.
+:exmp.
+
+:p.
+This will print 'Yes.' or 'No.' depending on the value of B, even if the
+constants Yes and No have been localized by some localization mechanism.
+:ent.
+
+
+.* ==============================================================
+:h2 name=types.Types
+:p.
+All variables have a type. &fpc. supports the same basic types as &tp., with
+some extra types from &delphi..
+The programmer can declare his own types, which is in essence defining an identifier
+that can be used to denote this custom type when declaring variables further
+in the source code.
+
+:cgraphic.
+┌──────────────────────────────────────────────────────────────────────────────â”
+:hp2.Type declaration:ehp2.
+
+&ra.&ra.─── type declaration ─── identifier ─ = ─ type ─ ; ─────────────────────────&ra.&la.
+
+└──────────────────────────────────────────────────────────────────────────────┘
+:ecgraphic.
+
+:p.
+There are 7 major type classes:
+
+:cgraphic.
+┌──────────────────────────────────────────────────────────────────────────────â”
+:hp2.Types:ehp2.
+
+&ra.&ra.─── type ──┬─── simple type ────┬──────────────────────────────────────────&ra.&la.
+ ├─ string type ─┤
+ ├─ structured type ─┤
+ ├─ pointer type ─┤
+ ├─ procedural type ─┤
+ ├─ generic type ─┤
+ ├─ specialized type ─┤
+ └─ type identifier ─┘
+
+└──────────────────────────────────────────────────────────────────────────────┘
+:ecgraphic.
+
+:p.
+The last case, :hp1.type identifier:ehp1., is just a means to give another
+name to a type. This presents a way to make types platform independent, by
+only using these types, and then defining these types for each platform
+individually. Any programmer who then uses these custom types doesn't have to worry
+about the underlying type size: it is opaque to him. It also allows to use shortcut names
+for fully qualified type names. e.g. define :hp1.system.longint:ehp1. as
+:hp1.Olongint:ehp1. and then redefine :hp1.longint:ehp1..
+
+
+.* --------------------------------------------------------------
+:h3 name=base_types.Base types
+:p.
+The base or simple types of &fpc. are the &delphi. types.
+We will discuss each type separately.
+
+:cgraphic.
+┌──────────────────────────────────────────────────────────────────────────────â”
+:hp2.Simple types:ehp2.
+
+&ra.&ra.─── simple type ──┬─ ordinal type ─┬───────────────────────────────────────&ra.&la.
+ └─ real type ─┘
+
+&ra.&ra.─── real type ─── real type identifier ─────────────────────────────────────&ra.&la.
+
+└──────────────────────────────────────────────────────────────────────────────┘
+:ecgraphic.
+
+
+.* ...................................................................
+:h4.Ordinal types
+:p.
+With the exception of :hp1.int64:ehp1., :hp1.qword:ehp1. and Real types,
+all base types are ordinal types. Ordinal types have the following
+characteristics:
+:ol.
+:li. Ordinal types are countable and ordered, i.e. it is, in principle,
+possible to start counting them one by one, in a specified order.
+This property allows the operation of functions as :hp2.Inc:ehp2., :hp2.Ord:ehp2.,
+:hp2.Dec:ehp2. on ordinal types to be defined.
+:li. Ordinal values have a smallest possible value. Trying to apply the
+:hp2.Pred:ehp2. function on the smallest possible value will generate a range
+check error if range checking is enabled.
+:li. Ordinal values have a largest possible value. Trying to apply the
+:hp2.Succ:ehp2. function on the largest possible value will generate a range
+check error if range checking is enabled.
+:eol.
+
+
+:h5.Integers
+:p.
+A list of pre-defined integer types are presented below.
+
+:lm margin=10.
+:cgraphic.
+ :hp2.Name:ehp2.
+────────────
+ Integer
+ Shortint
+ SmallInt
+ Longint
+ Longword
+ Int64
+ Byte
+ Word
+ Cardinal
+ QWord
+ Boolean
+ ByteBool
+ WordBool
+ LongBool
+ Char
+────────────
+:ecgraphic.
+:lm margin=1.
+
+:p.
+The integer types, and their ranges and sizes, that are predefined in
+&fpc. are listed in in the table below. Please note that
+the :hp1.qword:ehp1. and :hp1.int64:ehp1. types are not true ordinals, so
+some Pascal constructs will not work with these two integer types.
+
+:cgraphic.
+ :hp2.Type Range Size in bytes:ehp2.
+────────────────────────────────────────────────────────────────────
+ Byte 0 .. 255 1
+ Shortint -128 .. 127 1
+ Smallint -32768 .. 32767 2
+ Word 0 .. 65535 2
+ Integer either smallint or longint size 2 or 4
+ Cardinal longword 4
+ Longint -2147483648 .. 2147483647 4
+ Longword 0 .. 4294967295 4
+ Int64 -9223372036854775808 .. 9223372036854775807 8
+ QWord 0 .. 18446744073709551615 8
+────────────────────────────────────────────────────────────────────
+:ecgraphic.
+
+:p.
+The :hp1.integer:ehp1. type maps to the smallint type in the default
+&fpc. mode. It maps to either a longint in either Delphi or ObjFPC
+mode. The :hp1.cardinal:ehp1. type is currently always mapped to the
+longword type.
+
+:nt.
+All decimal constants which do no fit within the -2147483648..2147483647 range
+are silently and automatically parsed as 64-bit integer constants as of version
+1.9.0. Earlier versions would convert it to a real-typed constant.
+:ent.
+
+&fpc. does automatic type conversion in expressions where different kinds of
+integer types are used.
+
+
+:h5.Boolean types
+:p.
+&fpc. supports the :hp1.Boolean:ehp1. type, with its two pre-defined possible
+values :hp1.True:ehp1. and :hp1.False:ehp1.. These are the only two values that can be
+assigned to a :hp1.Boolean:ehp1. type. Of course, any expression that resolves
+to a boolean value, can also be assigned to a boolean type.
+
+:cgraphic.
+ :hp2.Name Size Ord(True):ehp2.
+─────────────────────────────────────────────────
+ Boolean 1 1
+ ByteBool 1 Any nonzero value
+ WordBool 2 Any nonzero value
+ LongBool 4 Any nonzero value
+─────────────────────────────────────────────────
+:ecgraphic.
+
+:p.
+&fpc. also supports the :hp1.ByteBool:ehp1., :hp1.WordBool:ehp1. and :hp1.LongBool:ehp1. types.
+These are of type :hp1.Byte:ehp1., :hp1.Word:ehp1. or :hp1.Longint:ehp1., but are
+assignment compatible with a :hp1.Boolean:ehp1.: the value :hp1.False:ehp1. is
+equivalent to 0 (zero) and any nonzero value is considered :hp1.True:ehp1. when
+converting to a boolean value. A boolean value of :hp1.True:ehp1. is converted
+to -1 in case it is assigned to a variable of type :hp1.LongBool:ehp1..
+
+:p.
+Assuming :hp1.B:ehp1. to be of type :hp1.Boolean:ehp1., the following are valid
+assignments:
+
+:xmp.
+ B := True;
+ B := False;
+ B := 1 <> 2; { Results in B := True }
+:exmp.
+
+:p.
+Boolean expressions are also used in conditions.
+
+:nt.
+In &fpc., boolean expressions are by default always evaluated in such a
+way that when the result is known, the rest of the expression will no longer
+be evaluated: this is called short-cut boolean evaluation.
+
+:p.
+In the following example, the function :hp1.Func:ehp1. will never be called,
+which may have strange side-effects.
+
+:xmp.
+ ...
+ B := False;
+ A := B and Func;
+:exmp.
+
+:p.
+Here :hp1.Func:ehp1. is a function which returns a :hp1.Boolean:ehp1. type.
+
+This behaviour is controllable by the :hp2.{$B}:ehp2. compiler directive.
+:ent.
+
+
+.* ...................................................................
+:h5.Enumeration types
+:p.
+Enumeration types are supported in &fpc.. On top of the &tp.
+implementation, &fpc. also allows a C-style extension of the
+enumeration type, where a value is assigned to a particular element of
+the enumeration list.
+
+:cgraphic.
+┌──────────────────────────────────────────────────────────────────────────────â”
+:hp2.Enumeration types:ehp2.
+
+&ra.&ra.─── enumerated type ─ ( ─┬┬── identifier list ───┬┬─ ) ─────────────────────&ra.&la.
+ │└─ assigned enum list ─┘│
+ ^────────── , ───────────┘
+
+&ra.&ra.─── identifier list ──┬─ identifier ─┬──────────────────────────────────────&ra.&la.
+ ^────── , ─────┘
+
+&ra.&ra.─── assigned enum list ──┬─ identifier ─ := ─ expression ─┬─────────────────&ra.&la.
+ ^─────────────── , ──────────────┘
+
+└──────────────────────────────────────────────────────────────────────────────┘
+:ecgraphic.
+
+:p.
+(see :link reftype=hd refid=expressions.Expressions:elink. for how to use expressions)
+When using assigned enumerated types, the assigned elements must be in
+ascending numerical order in the list, or the compiler will complain.
+The expressions used in assigned enumerated elements must be known at
+compile time. So the following is a correct enumerated type declaration:
+:xmp.
+Type
+ Direction = (North, East, South, West);
+:exmp.
+
+:p.
+A C-style enumeration type looks as follows:
+
+:xmp.
+Type
+ EnumType = (one, two, three, forty := 40, fortyone);
+:exmp.
+
+:p.
+As a result, the ordinal number of :hp1.forty:ehp1. is 40, and not 3,
+as it would be when the ':= 40' wasn't present.
+The ordinal value of :hp1.fortyone:ehp1. is then 41, and not 4, as it
+would be when the assignment wasn't present. After an assignment in an
+enumerated definition the compiler adds 1 to the assigned value to assign to
+the next enumerated value.
+:p.
+When specifying such an enumeration type, it is important to keep in mind
+that the enumerated elements should be kept in ascending order. The
+following will produce a compiler error:
+
+:xmp.
+Type
+ EnumType = (one, two, three, forty := 40, thirty := 30);
+:exmp.
+
+:p.
+It is necessary to keep :hp1.forty:ehp1. and :hp1.thirty:ehp1. in the correct order.
+When using enumeration types it is important to keep the following points
+in mind:
+
+:ol.
+:li. The :hp2.Pred:ehp2. and :hp2.Succ:ehp2. functions cannot be used on
+this kind of enumeration types. Trying to do this anyhow will result in a
+compiler error.
+:li. Enumeration types are stored using a default, independent of the
+actual number of values: the compiler does not try to optimize for space.
+This behaviour can be changed with the :hp2.{$PACKENUM n}:ehp2. compiler
+directive, which tells the compiler the minimal number of bytes to be
+used for enumeration types. For instance:
+
+:xmp.
+type
+{$PACKENUM 4}
+ LargeEnum = ( BigOne, BigTwo, BigThree );
+{$PACKENUM 1}
+ SmallEnum = ( one, two, three );
+var
+ S: SmallEnum;
+ L: LargeEnum;
+begin
+ WriteLn('Small enum : ', SizeOf(S));
+ WriteLn('Large enum : ', SizeOf(L));
+end.
+:exmp.
+:eol.
+
+More information can be found in the &progref., in the Compiler Directives section.
+
+
+.* ...................................................................
+:h5.Subrange types
+:p.
+A subrange type is a range of values from an ordinal type (the host type). To define a subrange type,
+one must specify its limiting values: the highest and lowest value of the type.
+
+:cgraphic.
+┌──────────────────────────────────────────────────────────────────────────────â”
+:hp2.Subrange types:ehp2.
+
+&ra.&ra.─── subrange type ─ constant ─ .. ─ constant ───────────────────────────────&ra.&la.
+
+└──────────────────────────────────────────────────────────────────────────────┘
+:ecgraphic.
+
+:p.
+Some of the predefined integer types are defined as subrange types:
+
+:xmp.
+type
+ Longint = $80000000..$7fffffff;
+ Integer = -32768..32767;
+ shortint = -128..127;
+ byte = 0..255;
+ Word = 0..65535;
+:exmp.
+
+:p.
+Subrange types of enumeration types can also be defined:
+
+:xmp.
+type
+ Days = (monday, tuesday, wednesday, thursday, friday, saturday, sunday);
+ WorkDays = monday..friday;
+ WeekEnd = saturday..sunday;
+:exmp.
+
+
+.* ...................................................................
+:h4.Real types
+:p.
+&fpc. uses the math coprocessor (or emulation) for all its floating-point calculations. The Real
+native type is processor dependent, but it is either Single or Double. Only the IEEE floating point
+types are supported, and these depend on the target processor and emulation options. The true &tp.
+compatible types are listed in the table below. The :hp1.Comp:ehp1. type is, in effect, a 64-bit integer and
+is not available on all target platforms. To get more information on the supported types for each
+platform, refer to the &progref..
+
+
+:cgraphic.
+ :hp2.Type Range Significant digits Size in bytes:ehp2.
+──────────────────────────────────────────────────────────────────────────
+ Real platform dependent ??? 4 or 8
+ Single 1.5E-45 .. 3.4E38 7-8 4
+ Double 5.0E-324 .. 1.7E308 15-16 8
+ Extended 1.9E-4932 .. 1.1E4932 19-20 10
+ Comp -2E64+1 .. 2E63-1 19-20 8
+ Currency -922337203685477.5808 .. 19-20 8
+ 922337203685477.5807
+──────────────────────────────────────────────────────────────────────────
+:ecgraphic.
+
+:p.
+The currency type is a fixed-point real data type which is internally used as an 64-bit integer type
+(automatically scaled with a factor 10000), this minimalizes rounding errors.
+
+
+
+.* --------------------------------------------------------------
+:h3 name=character_types.Character types
+:p.
+We have eight character types in &fpc..
+
+:ul.
+:li.:link reftype=hd refid=character_types_char.Char:elink.
+:li.:link reftype=hd refid=character_types_strings.Strings:elink.
+:li.:link reftype=hd refid=character_types_shortstrings.Short strings:elink.
+:li.:link reftype=hd refid=character_types_ansistrings.AnsiStrings:elink.
+:li.:link reftype=hd refid=character_types_widestrings.WideStrings:elink.
+:li.:link reftype=hd refid=character_types_unicodestrings.UnicodeStrings:elink.
+:li.:link reftype=hd refid=character_types_constantstrings.Constant strings:elink.
+:li.:link reftype=hd refid=character_types_pcharstrings.PChar - Null terminated strings:elink.
+:eul.
+
+
+.* ...................................................................
+:h4 name=character_types_char.Char
+:p.
+&fpc. supports the type :hp2.Char:ehp2.. A :hp2.Char:ehp2. is exactly 1 byte in
+size, and contains one ASCII character.
+
+:p.
+A character constant can be specified by enclosing the character in single
+quotes, as follows: 'a' or 'A' are both character constants.
+
+:p.
+A character can also be specified by its character
+value (commonly an ASCII code), by preceding the ordinal value with the
+number symbol (#). For example specifying :hp1.#65:ehp1. would be the same as :hp1.'A':ehp1.
+
+:p.
+Also, the caret character (^) can be used in combination with a letter to
+specify a character with ASCII value less than 27. Thus ^G equals
+#7 - G is the seventh letter in the alphabet.
+
+:p.
+When the single quote character must be represented, it should be typed
+two times successively, thus :hp1.'''':ehp1. represents the single quote character.
+
+
+.* ...................................................................
+:h4 name=character_types_strings.Strings
+:p.
+&fpc. supports the :hp2.String:ehp2. type as it is defined in &tp.:
+a sequence of characters with an optional size specification.
+It also supports AnsiStrings (with unlimited length) as in Delphi.
+
+:p.
+To declare a variable as a string, use the following type specification:
+
+:cgraphic.
+┌──────────────────────────────────────────────────────────────────────────────â”
+:hp2.String Type:ehp2.
+
+&ra.&ra.─── string type ─ :hp2.string:ehp2. ──┬──────────────────────────────┬─────────────────&ra.&la.
+ └─ [ ── unsigned integer ── ] ─┘
+
+└──────────────────────────────────────────────────────────────────────────────┘
+:ecgraphic.
+
+:p.
+If there is a size specifier, then its maximum value - indicating the maximum
+size of the string - is 255.
+:p.
+The meaning of a string declaration statement without size indicator is
+interpreted differently depending on the :hp2.{$H}:ehp2. switch. If no size
+indication is present, the above declaration can declare an AnsiString or
+a short string.
+:p.
+Whatever the actual type, AnsiStrings and short strings can be used
+interchangeably. The compiler always takes care of the necessary type
+conversions. Note, however, that the result of an expression that contains
+ansistrings and short strings will always be an AnsiString.
+
+
+:h4 name=character_types_shortstrings.Short strings
+:p.
+A string declaration declares a short string in the following cases:
+:ol.
+:li. If the switch is off: {$H-}, the string declaration
+will always be a short string declaration.
+:li. If the switch is on {$H+}, and there is a maximum length (the
+size) specifier, the declaration is a short string declaration.
+:eol.
+
+:p.
+The predefined type :hp2.ShortString:ehp2. is defined as a string of size 255:
+
+:xmp.
+ ShortString = String[255];
+:exmp.
+
+:p.
+If the size of the string is not specified, 255 is taken as a
+default. The actual length of the string can be obtained with the
+:hp1.Length():ehp1. standard runtime routine. For example in
+
+:xmp.
+{$H-}
+
+type
+ NameString = String[10];
+ StreetString = String;
+:exmp.
+
+:p.
+:hp1.NameString:ehp1. can contain a maximum of 10 characters. While
+:hp1.StreetString:ehp1. can contain up to 255 characters.
+
+:nt.
+Short strings have a maximum length of 255 characters: when specifying a
+maximum length, the maximum length may not exceed 255. If a length larger
+than 255 is attempted, then the compiler will give an error message:
+
+:xmp.
+Error: string length must be a value from 1 to 255
+:exmp.
+
+:p.
+For short strings, the length is stored in the character at index 0. Old
+&tp. code relies on this, and it is implemented similarly in &fpc..
+Despite this, to write portable code, it is best to set the length of a
+shortstring with the :hp1.SetLength():ehp1. call, and to retrieve
+it with the :hp1.Length():ehp1. call. These functions will always work, whatever
+the internal representation of the short strings or other strings in use:
+this allows easy switching between the various string types.
+:ent.
+
+
+.* ...................................................................
+:h4 name=character_types_ansistrings.AnsiStrings
+:p.
+AnsiStrings are strings that have no length limit. They are reference
+counted and are guaranteed to be null terminated. Internally, an ansistring is treated as
+a pointer: the actual content of the string is stored on the heap, as much
+memory as needed to store the string content is allocated.
+
+This is all handled transparantly, i.e. they can be manipulated as a normal
+short string. Ansistrings can be defined using the predefined :hp2.AnsiString:ehp2.
+type.
+
+:nt.
+The null-termination does not mean that null characters (char(0) or #0)
+cannot be used: the null-termination is not used internally, but is there for
+convenience when dealing with external routines that expect a
+null-terminated string (as most C routines do).
+:ent.
+
+:p.
+If the {$H} switch is on, then a string definition using the
+regular :hp1.String:ehp1. keyword and that doesn't contain a length specifier,
+will be regarded as an ansistring as well. If a length specifier is present,
+a short string will be used, regardless of the {$H} setting.
+
+:p.
+If the string is empty (''), then the internal pointer representation
+of the string pointer is :hp1.Nil:ehp1.. If the string is not empty, then the
+pointer points to a structure in heap memory.
+
+:p.
+The internal representation as a pointer, and the automatic null-termination
+make it possible to typecast an ansistring to a pchar. If the string is empty
+(so the pointer is Nil) then the compiler makes sure that the typecasted
+pchar will point to a null byte.
+
+:p.
+Assigning one ansistring to another doesn't involve moving the actual
+string. A statement
+
+:xmp.
+ S2 := S1;
+:exmp.
+
+:p.
+results in the reference count of :hp1.S2:ehp1. being decreased with 1,
+the reference count of :hp1.S1:ehp1. is increased by 1, and finally :hp1.S1:ehp1.
+(as a pointer) is copied to :hp1.S2:ehp1.. This is a significant speed-up in
+the code.
+
+:p.
+If the reference count of a string reaches zero, then the memory occupied
+by the string is deallocated automatically, and the pointer is set to
+:hp1.Nil:ehp1., so no memory leaks arise.
+
+:p.
+When an ansistring is declared, the &fpc. compiler initially
+allocates just memory for a pointer, not more. This pointer is guaranteed
+to be :hp1.Nil:ehp1., meaning that the string is initially empty. This is
+true for local and global ansistrings or ansistrings that are part of a
+structure (arrays, records or objects).
+
+:p.
+This does introduce an overhead. For instance, declaring
+
+:xmp.
+var
+ A: array[1..100000] of string;
+:exmp.
+
+:p.
+will copy the value :hp1.Nil:ehp1. 100,000 times into :hp1.A:ehp1..
+When :hp1.A:ehp1. goes out of scope, then the reference
+count of the 100,000 strings will be decreased by 1 for each
+of these strings. All this happens invisible to the programmer,
+but when considering performance issues, this is important.
+
+:p.
+Memory for the string content will be allocated only when the string is
+assigned a value. If the string goes out of scope, then its reference
+count is automatically decreased by 1. If the reference count reaches
+zero, the memory reserved for the string is released.
+
+:p.
+If a value is assigned to a character of a string that has a reference count
+greater than 1, such as in the following statements:
+
+:xmp.
+ S := T; { reference count for S and T are now 2 }
+ S[I] := '@';
+:exmp.
+
+:p.
+then a copy of the string is created before the assignment. This is known
+as :hp1.copy-on-write:ehp1. semantics. It is possible to force a string to have
+a reference count equal to 1 with the :hp1.UniqueString():ehp1. call:
+
+:xmp.
+ S := T;
+ R := T; // Reference count of T is at least 3
+ UniqueString(T); // Reference count of T is quaranteed 1
+:exmp.
+
+:p.
+It's recommended to do this e.g. when typecasting an ansistring to a PChar var
+and passing it to a C routine that modifies the string.
+
+:p.
+The :hp1.Length():ehp1. function must be used to get the length of an
+ansistring: the length is not stored at character 0 of the ansistring.
+The construct
+
+:xmp.
+ L := ord(S[0]);
+:exmp.
+
+:p.
+which was valid for &tp. shortstrings, is no longer correct for
+AnsiStrings. The compiler will warn if such a construct is encountered.
+
+:p.
+To set the length of an ansistring, the :hp1.SetLength():ehp1. function must be used.
+Constant ansistrings have a reference count of -1 and are treated specially.
+The same remark as for :hp1.Length():ehp1. must be given: The construct
+
+:xmp.
+ L := 12;
+ S[0] := Char(L);
+:exmp.
+
+:p.
+which was valid for &tp. shortstrings, is no longer correct for
+AnsiStrings. The compiler will warn if such a construct is encountered.
+
+:p.
+AnsiStrings are converted to short strings by the compiler if needed,
+this means that the use of ansistrings and short strings can be mixed
+without problems.
+
+:p.
+AnsiStrings can be typecasted to :hp1.PChar:ehp1. or :hp1.Pointer:ehp1. types:
+
+:xmp.
+var
+ P: Pointer;
+ PC: PChar;
+ S: AnsiString;
+begin
+ S := 'This is an ansistring';
+ PC := Pchar(S);
+ P := Pointer(S);
+:exmp.
+
+:p.
+There is a difference between the two typecasts. When an empty
+ansistring is typecasted to a pointer, the pointer wil be :hp1.Nil:ehp1.. If an
+empty ansistring is typecasted to a :hp1.PChar:ehp1., then the result will be a pointer to a
+zero byte (an empty string).
+
+:p.
+The result of such a typecast must be used with care. In general, it is best
+to consider the result of such a typecast as read-only, i.e. only suitable for
+passing to a procedure that needs a constant pchar argument.
+
+:p.
+It is therefore :hp2.not:ehp2. advisable to typecast one of the following:
+
+:ol.
+:li. Expressions.
+:li. Strings that have a reference count larger than 1.
+In this case you should call :hp1.UniqueString():ehp1. to ensure the
+string has a reference count 1.
+:eol.
+
+
+
+.* ...................................................................
+:h4 name=character_types_widestrings.WideStrings
+:p.
+WideStrings (used to represent Unicode character strings) are implemented in much
+the same way as AnsiStrings: reference counted, null-terminated arrays, only they
+are implemented as arrays of :hp1.WideChars:ehp1. instead of regular :hp1.Chars:ehp1..
+A :hp1.WideChar:ehp1. is a two-byte character (an element of a DBCS: Double Byte
+Character Set). Mostly the same rules apply for WideStrings as for
+AnsiStrings. The compiler transparently converts WideStrings to
+AnsiStrings and vice versa.
+
+:p.
+Similarly to the typecast of an Ansistring to a PChar null-terminated
+array of characters, a WideString can be converted to a PWideChar
+null-terminated array of characters.
+Note that the :hp1.PWideChar:ehp1. array is terminated by 2 null bytes instead of
+1, so a typecast to a PChar is not automatic.
+
+:p.
+The compiler itself provides no support for any conversion from Unicode to
+AnsiStrings or vice versa. The :hp2.system:ehp2. unit has a widestring manager
+record, which can be initialized with some OS-specific Unicode handling
+routines. For more information, see the :hp2.system:ehp2. unit reference.
+
+
+.* ...................................................................
+:h4 name=character_types_unicodestrings.UnicodeStrings
+:p.
+[text to be written]
+:p.
+Same as WideString, but reference counted on all platforms.
+
+
+
+.* ...................................................................
+:h4 name=character_types_constantstrings.Constant strings
+:p.
+To specify a constant string, it must be enclosed in single quotes, just
+as a :hp1.Char:ehp1. type, only now more than one character is allowed.
+Given that :hp1.S:ehp1. is of type :hp1.String:ehp1., the following are valid
+assignments:
+
+:xmp.
+S := 'This is a string.';
+S := 'One'+', Two'+', Three';
+S := 'This isn''t difficult!';
+S := 'This is a weird character: '#145' !';
+:exmp.
+
+:p.
+As can be seen, the single quote character is represented by 2 single-quote
+characters next to each other. Strange characters can be specified by their
+character value (usually an ASCII code).
+The example shows also that two strings can be added. The resulting string is
+just the concatenation of the first with the second string, without spaces in
+between them. Strings can not be substracted, however.
+
+:p.
+Whether the constant string is stored as an AnsiString or a short string
+depends on the settings of the :hp2.{$H}:ehp2. switch.
+
+
+
+.* ...................................................................
+:h4 name=character_types_pcharstrings.PChar - Null terminated strings
+:p.
+&fpc. supports the Delphi implementation of the :hp1.PChar:ehp1. type. :hp1.PChar:ehp1.
+is defined as a pointer to a \var{Char} type, but allows additional
+operations.
+The :hp1.PChar:ehp1. type can be understood best as the Pascal equivalent of a
+C-style null-terminated string, i.e. a variable of type :hp1.PChar:ehp1. is a
+pointer that points to an array of type :hp1.Char:ehp1., which is ended by a
+null-character (#0).
+&fpc. supports initializing of :hp1.PChar:ehp1. typed constants, or a direct
+assignment. For example, the following pieces of code are equivalent:
+
+:xmp.
+program one;
+var
+ p: PChar;
+begin
+ P := 'This is a null-terminated string.';
+ WriteLn (P);
+end.
+:exmp.
+
+:p.
+Results in the same as
+
+:xmp.
+program two;
+const
+ P: PChar = 'This is a null-terminated string.'
+begin
+ WriteLn (P);
+end.
+:exmp.
+
+:p.
+These examples also show that it is possible to write the contents of
+the string to a file of type :hp1.Text:ehp1.
+The :hp2.strings:ehp2. unit contains procedures and functions that manipulate the
+:hp1.PChar:ehp1. type as in the standard C library.
+Since it is equivalent to a pointer to a type :hp1.Char:ehp1. variable, it is
+also possible to do the following:
+
+:xmp.
+program three;
+var
+ S: String[30];
+ P: PChar;
+begin
+ S := 'This is a null-terminated string.'#0;
+ P := @S[1];
+ WriteLn (P);
+end.
+:exmp.
+
+:p.
+This will have the same result as the previous two examples.
+Null-terminated strings cannot be added as normal Pascal
+strings. If two :hp1.PChar:ehp1. strings must be concatenated; the functions from
+the unit :hp2.strings:ehp2. must be used.
+
+:p.
+However, it is possible to do some pointer arithmetic. The
+operators + and - can be used to do operations
+on :hp1.PChar:ehp1. pointers.
+In the table below, :hp1.P:ehp1. and :hp1.Q:ehp1. are of type :hp1.PChar:ehp1., and
+:hp1.I:ehp1. is of type :hp1.Longint:ehp1..
+
+:cgraphic.
+ :hp2.Operation Result:ehp2.
+────────────────────────────────────────────────────────────────────
+ P + I Adds I to the address pointed to by P.
+ I + P Adds I to the address pointed to by P.
+ P - I Substracts I from the address pointed to by P.
+ P - Q Returns, as an integer, the distance between 2 addresses
+ (or the number of characters between P and Q)
+────────────────────────────────────────────────────────────────────
+:ecgraphic.
+
+
+
+.* --------------------------------------------------------------
+:h3 name=structured_types.Structured types
+:p.
+A structured type is a type that can hold multiple values in one variable.
+Stuctured types can be nested to unlimited levels.
+
+:cgraphic.
+┌──────────────────────────────────────────────────────────────────────────────â”
+:hp2.Structured Types:ehp2.
+
+&ra.&ra.─── structured type ──┬──── array type ────┬───────────────────────────&ra.&la.
+ ├──── record type ────┤
+ ├──── object type ────┤
+ ├──── class type ────┤
+ ├─ class reference type ─┤
+ ├──── interface type ────┤
+ ├──── set type ────┤
+ └───── file type ──────┘
+
+└──────────────────────────────────────────────────────────────────────────────┘
+:ecgraphic.
+
+:p.
+Unlike Delphi, &fpc. does not support the keyword :hp1.packed:ehp1. for all
+structured types. In the following sections each of the possible
+structured types is discussed. It will be mentioned when a type supports
+the :hp1.packed:ehp1. keyword.
+
+
+.* ...................................................................
+:h4 name=structured_types_packed.Packed structured types
+:p.
+When a structured type is declared, no assumptions should be made about
+the internal position of the elements in the type. The compiler will lay
+out the elements of the structure in memory as it thinks will be most
+suitable. That is, the order of the elements will be kept, but the location
+of the elements are not guaranteed, and is partially governed by the :hp2.$PACKRECORDS:ehp2.
+directive (this directive is explained in the &progref.).
+
+:p.
+However, &fpc. allows controlling the layout with the :hp1.Packed:ehp1. and
+:hp1.Bitpacked:ehp1. keywords. The meaning of these words depends on the context:
+
+:parml tsize=15 break=none.
+:pt.:hp2.Bitpacked:ehp2.
+:pd.In this case, the compiler will attempt to align ordinal
+types on bit boundaries, as explained below.
+
+:pt.:hp2.Packed:ehp2.
+:pd.The meaning of the :hp1.Packed:ehp1. keyword depends on the
+situation:
+:ol.
+:li. In :hp1.MACPAS:ehp1. mode, it is equivalent to the :hp1.Bitpacked:ehp1. keyword.
+:li. In other modes, with the :hp1.$BITPACKING:ehp1. directive set to :hp1.ON:ehp1.,
+it is also equivalent to the :hp1.Bitpacked:ehp1. keyword.
+:li. In other modes, with the :hp1.$BITPACKING:ehp1. directive set to :hp1.OFF:ehp1.,
+it signifies normal packing on byte boundaries.
+:lp. Packing on byte boundaries means that each new element of a structured type
+starts on a byte boundary.
+:eol.
+:eparml.
+
+:p.
+The byte packing mechanism is simple: the compiler aligns each element of
+the structure on the first available byte boundary, even if the size of the
+previous element (small enumerated types, subrange types) is less than a
+byte.
+
+:p.
+When using the bit packing mechanism, the compiler calculates for each
+ordinal type how many bits are needed to store it. The next ordinal type
+is then stored on the next free bit. Non-ordinal types - which include but
+are not limited to - sets, floats, strings, (bitpacked) records, (bitpacked)
+arrays, pointers, classes, objects, and procedural variables, are stored
+on the first available byte boundary.
+
+:p.
+Note that the internals of the bitpacking are opaque: they can change
+at any time in the future. What is more: the internal packing depends
+on the endianness of the platform for which the compilation is done,
+and no conversion between platforms are possible. This makes bitpacked
+structures unsuitable for storing on disk or transport over networks.
+The format is however the same as the one used by the GNU Pascal
+Compiler, and the &fpc. team aims to retain this compatibility in the future.
+
+:p.
+There are some more restrictions to elements of bitpacked structures:
+
+:ul.
+:li. The address cannot be retrieved, unless the bit size is a multiple of
+8 and the element happens to be stored on a byte boundary.
+:li. An element of a bitpacked structure cannot be used as a var parameter,
+unless the bit size is a multiple of 8 and the element happens to be stored
+on a byte boundary.
+:eul.
+
+:p.
+To determine the size of an element in a bitpacked structure, there is the
+:hp1.BitSizeOf():ehp1. function. It returns the size - in bits - of the element.
+For other types or elements of structures which are not bitpacked, this will
+simply return the size in bytes multiplied by 8, i.e., the return value is
+then the same as :hp1.8*SizeOf:ehp1..
+
+:p.
+The size of bitpacked records and arrays is limited:
+
+:ul.
+:li. On 32 bit systems the maximal size is 2^29 (2 to the power 29) bytes (512 MB).
+:li. On 64 bit systems the maximal size is 2^61 (2 to the power 61) bytes.
+:eul.
+
+:p.
+The reason is that the offset of an element must be calculated with
+the maximum integer size of the system.
+
+
+.* ...................................................................
+:h4 name=structured_types_arrays.Arrays
+:p.
+&fpc. supports arrays as in &tp.. Multi-dimensional arrays and (bit)packed
+arrays are also supported, as well as the dynamic arrays of &delphi.:
+
+:cgraphic.
+┌──────────────────────────────────────────────────────────────────────────────â”
+:hp2.Array types:ehp2.
+
+&ra.&ra.── array type ─┬───────────────┬─ :hp2.array:ehp2. ─┬────────────────────────────┬─ :hp2.of:ehp2. ─ type ──&ra.&la.
+ ├─ :hp2.packed:ehp2. ─┤ └─ :hp2.[:ehp2. ─┬─ ordinal type ─┬─ :hp2.]:ehp2. ─┘
+ └─ :hp2.bitpacked:ehp2. ─┘ ^────── , ───────┘
+
+└──────────────────────────────────────────────────────────────────────────────┘
+:ecgraphic.
+
+
+
+:h5.Static arrays
+:p.
+When the range of the array is included in the array definition, it is
+called a static array. Trying to access an element with an index that is
+outside the declared range will generate a run-time error (if range checking
+is on). The following is an example of a valid array declaration:
+
+:xmp.
+type
+ RealArray = Array [1..100] of Real;
+:exmp.
+
+:p.
+Valid indexes for accessing an element of the array are between 1 and 100,
+where the borders 1 and 100 are included.
+As in &tp., if the array component type is in itself an array, it is
+possible to combine the two arrays into one multi-dimensional array. The
+following declaration:
+
+:xmp.
+type
+ APoints = array[1..100] of Array[1..3] of Real;
+:exmp.
+
+:p.
+is equivalent to the declaration:
+
+:xmp.
+type
+ APoints = array[1..100, 1..3] of Real;
+:exmp.
+
+:p.
+The functions :hp1.High():ehp1. and :hp1.Low():ehp1. return the high and low bounds of
+the leftmost index type of the array. In the above case, this would be 100
+and 1. You should use them whenever possible, since it improves maintainability
+of your code. The use of both functions is just as efficient as using
+constants, because they are evaluated at compile time.
+
+:p.
+When static array-type variables are assigned to each other, the contents of the
+whole array is copied. This is also true for multi-dimensional arrays:
+
+:xmp.
+program testarray1;
+
+type
+ TA = Array[0..9, 0..9] of Integer;
+
+var
+ A, B: TA;
+ I, J: Integer;
+begin
+ for I := 0 to 9 do
+ for J := 0 to 9 do
+ A[I,J] := I * J;
+ for I := 0 to 9 do
+ begin
+ for J := 0 to 9 do
+ Write(A[I, J]:2, ' ');
+ writeln;
+ end;
+ B := A;
+ writeln;
+ for I := 0 to 9 do
+ for J := 0 to 9 do
+ A[9-I, 9-J] := I * J;
+ for I := 0 to 9 do
+ begin
+ for J := 0 to 9 do
+ write(B[I, J]:2, ' ');
+ writeln;
+ end;
+end.
+:exmp.
+
+:p.
+The output of this program will be 2 identical matrices.
+
+
+
+:h5.Dynamic arrays
+:p.
+As of version 1.1, &fpc. also knows dynamic arrays: In that case the array
+range is omitted, as in the following example:
+
+:xmp.
+Type
+ TByteArray = Array of Byte;
+:exmp.
+
+:p.
+When declaring a variable of a dynamic array type, the initial length of the
+array is zero. The actual length of the array must be set with the standard
+:hp1.SetLength():ehp1. function, which will allocate the necessary memory to contain
+the array elements on the heap. The following example will set the length to
+1000:
+
+:xmp.
+var
+ A: TByteArray;
+begin
+ SetLength(A, 1000);
+:exmp.
+
+:p.
+After a call to :hp1.SetLength():ehp1., valid array indexes are 0 to 999: the array
+index is always zero-based.
+
+:p.
+Note that the length of the array is set in elements, not in bytes of
+allocated memory (although these may be the same). The amount of
+memory allocated is the size of the array multiplied by the size of
+1 element in the array. The memory will be disposed of at the exit of the
+current procedure or function.
+
+:p.
+It is also possible to resize the array: in that case, as much of the
+elements in the array as will fit in the new size, will be kept. The array
+can be resized to zero, which effectively resets the variable.
+
+:p.
+At all times, trying to access an element of the array with an index
+that is not in the current length of the array will generate a run-time
+error.
+
+:p.
+Dynamic arrays are reference counted: assignment of one dynamic array-type
+variable to another will let both variables point to the same array.
+Contrary to ansistrings, an assignment to an element of one array will
+be reflected in the other: there is no copy-on-write. Consider the following
+example:
+
+:xmp.
+var
+ A, B: TByteArray;
+begin
+ SetLength(A, 10);
+ A[0] := 33;
+ B := A;
+ A[0] := 31;
+:exmp.
+
+:p.
+After the second assignment, the first element in B will also contain 31.
+
+:p.
+It can also be seen from the output of the following example:
+
+:xmp.
+program testarray1;
+
+type
+ TA = array of array of Integer;
+
+var
+ A, B: TA;
+ I, J: Integer;
+begin
+ Setlength(A, 10, 10);
+ for I := 0 to 9 do
+ for J := 0 to 9 do
+ A[I, J] := I * J;
+ for I:=0 to 9 do
+ begin
+ for J := 0 to 9 do
+ Write(A[I, J]:2, ' ');
+ writeln;
+ end;
+ B := A;
+ writeln;
+ for I := 0 to 9 do
+ for J := 0 to 9 do
+ A[9-I, 9-J] := I * J;
+ for I := 0 to 9 do
+ begin
+ for J := 0 to 9 do
+ Write(B[I, J]:2, ' ');
+ writeln;
+ end;
+end.
+:exmp.
+
+:p.
+The output of this program will be a matrix of numbers, and then the same
+matrix, mirrorred.
+
+:p.
+As remarked earlier, dynamic arrays are reference counted: if in one of the previous examples A
+goes out of scope and B does not, then the array is not yet disposed of: the
+reference count of A (and B) is decreased with 1. As soon as the reference
+count reaches zero the memory, allocated for the contents of the array, is disposed of.
+
+:p.
+It is also possible to copy and/or resize the array with the standard
+:hp1.Copy():ehp1. function, which acts as the copy function for strings:
+
+:xmp.
+program testarray3;
+
+type
+ TA = array of Integer;
+
+var
+ A, B: TA;
+ I: Integer;
+
+begin
+ Setlength(A, 10);
+ for I := 0 to 9 do
+ A[I] := I;
+ B := Copy(A, 3, 6);
+ for I := 0 to 5 do
+ Writeln(B[I]);
+end.
+:exmp.
+
+:p.
+The :hp1.Copy():ehp1. function will copy 6 elements of the array to a new array.
+Starting at the element at index 3 (i.e. the fourth element) of the array.
+
+:p.
+The :hp1.Length():ehp1. function will return the number of elements in the array.
+The :hp1.Low():ehp1. function on a dynamic array will always return 0, and the
+:hp1.High():ehp1. function will return the value :hp1.Length-1:ehp1., i.e., the value of the
+highest allowed array index.
+
+
+
+:h5.Packing and unpacking an array
+:p.
+Arrays can be packed and bitpacked. Two array types which have the same index
+type and element type, but which are differently packed are not assignment
+compatible.
+
+:p.
+However, it is possible to convert a normal array to a bitpacked array with the
+:hp1.pack:ehp1. routine. The reverse operation is possible as well; a bitpacked
+array can be converted to a normally packed array using the :hp1.unpack:ehp1.
+routine, as in the following example:
+
+:xmp.
+var
+ foo: array [ 'a'..'f' ] of Boolean
+ = ( false, false, true, false, false, false );
+ bar: packed array [ 42..47 ] of Boolean;
+ baz: array [ '0'..'5' ] of Boolean;
+
+begin
+ pack(foo,'a',bar);
+ unpack(bar,baz,'0');
+end.
+:exmp.
+
+:p.
+More information about the pack and unpack routines can be found in the
+:hp2.system:ehp2. unit reference.
+
+
+:h4 name='record_types'.Record types
+:p.
+&fpc. supports fixed records and records with variant parts.
+The syntax diagram for a record type is:
+
+:cgraphic.
+┌──────────────────────────────────────────────────────────────────────────────â”
+:hp2.Record types:ehp2.
+
+&ra.&ra.── record type ─┬───────────────┬─ :hp2.record:ehp2. ─┬──────────────┬─ :hp2.end:ehp2. ───────────&ra.&la.
+ ├─ :hp2.packed:ehp2. ─┤ └─ field list ─┘
+ └─ :hp2.bitpacked:ehp2. ─┘
+
+&ra.&ra.── field list ─┬─── fixed fields ───────────────────────┬─┬─────┬───────────&ra.&la.
+ └─┬─────────────────────┬─ variant part ─┘ └─ ; ─┘
+ └─ fixed fields ─ ; ─┘
+
+&ra.&ra.── fixed fields ─┬─ identifier list ─ : ─ type ─┬───────────────────────────&ra.&la.
+ └──────────── ; ───────────────┘
+
+&ra.&ra.── variant part ─ :hp2.case:ehp2. ─┬────────────────┬─ ordinal type identifier ─ :hp2.of:ehp2. ─┬─ variant─┬───&ra.&la.
+ └ identifier ─ : ┘ ^──── ; ───┘
+
+&ra.&ra.── variant ─┬─ constant ─ , ─┬─ : ─ ( ─┬────────────────┬─ ) ───────────────&ra.&la.
+ ^────────────────┘ ^── field list ──┘
+
+└──────────────────────────────────────────────────────────────────────────────┘
+:ecgraphic.
+
+:p.
+So the following are valid record type declarations:
+
+:xmp.
+type
+ Point = record
+ X, Y, Z: Real;
+ end;
+
+ RPoint = record
+ case Boolean of
+ False: (X, Y, Z: Real);
+ True: (R, theta, phi: Real);
+ end;
+
+ BetterRPoint = record
+ case UsePolar: Boolean of
+ False: (X, Y, Z: Real);
+ True: (R, theta, phi: Real);
+ end;
+:exmp.
+
+
+.* :fn id=record1.
+.* However, it is up to the programmer to maintain this field.
+.* :efn.
+
+:p.
+The variant part must be last in the record. The optional identifier in the
+case statement serves to access the tag field value, which otherwise would
+be invisible to the programmer. It can be used to see which variant is
+active at a certain time [However, it is up to the programmer to maintain this field].
+.* :link refid=record1 reftype=fn.(footnote here):elink.].
+In effect, it introduces a new field in the record.
+
+:note.
+It is possible to nest variant parts, as in&colon.
+
+:xmp.
+type
+ MyRec = Record
+ X: Longint;
+ case byte of
+ 2: (Y: Longint;
+ case byte of
+ 3: (Z: Longint);
+ );
+ end;
+:exmp.
+
+:p.
+By default the size of a record is the sum of the sizes of its fields, each size of a
+field is rounded up to a power of two. If the record contains a variant part, the size
+of the variant part is the size of the biggest variant, plus the size of the
+tag field type :hp1.if an identifier was declared for it:ehp1.. Here also, the size of
+each part is first rounded up to two. So in the above example:
+:ul.
+:li. :hp1.SizeOf():ehp1. would return 24 for :hp1.Point:ehp1.
+:li. It would result in 24 for :hp1.RPoint}:ehp1.
+:li. Finally, 26 would be the size of :hp1.BetterRPoint:ehp1.
+:li. For :hp1.MyRec:ehp1., the value would be 12.
+:eul.
+
+:p.
+If a typed file with records, produced by a &tp. program, must be read,
+then chances are that attempting to read that file correctly will fail.
+The reason for this is that by default, elements of a record are aligned at
+2-byte boundaries, for performance reasons.
+:p.
+This default behaviour can be changed with the :hp1.{$PACKRECORDS N}:ehp1.
+switch. Possible values for :hp1.N:ehp1. are 1, 2, 4, 16 or :hp1.Default:ehp1.
+This switch tells the compiler to align elements of a record or object or
+class that have size larger than :hp1.n:ehp1. on :hp1.n:ehp1. byte boundaries.
+:p.
+Elements that have size smaller or equal than :hp1.n:ehp1. are aligned on
+natural boundaries, i.e. to the first power of two that is larger than or
+equal to the size of the record element.
+:p.
+The keyword :hp1.Default:ehp1. selects the default value for the platform
+that the code is compiled for (currently, this is 2 on all platforms)
+Take a look at the following program:
+
+:xmp.
+Program PackRecordsDemo;
+
+type
+ {$PackRecords 2}
+ Trec1 = Record
+ A : byte;
+ B : Word;
+ end;
+
+ {$PackRecords 1}
+ Trec2 = Record
+ A : Byte;
+ B : Word;
+ end;
+
+ {$PackRecords 2}
+ Trec3 = Record
+ A,B : byte;
+ end;
+
+ {$PackRecords 1}
+ Trec4 = Record
+ A,B : Byte;
+ end;
+
+ {$PackRecords 4}
+ Trec5 = Record
+ A : Byte;
+ B : Array[1..3] of byte;
+ C : byte;
+ end;
+
+ {$PackRecords 8}
+ Trec6 = Record
+ A : Byte;
+ B : Array[1..3] of byte;
+ C : byte;
+ end;
+
+ {$PackRecords 4}
+ Trec7 = Record
+ A : Byte;
+ B : Array[1..7] of byte;
+ C : byte;
+ end;
+
+ {$PackRecords 8}
+ Trec8 = Record
+ A : Byte;
+ B : Array[1..7] of byte;
+ C : byte;
+ end;
+
+var
+ rec1 : TRec1;
+ rec2 : TRec2;
+ rec3 : TRec3;
+ rec4 : TRec4;
+ rec5 : TRec5;
+ rec6 : TRec6;
+ rec7 : TRec7;
+ rec8 : TRec8;
+
+begin
+ Write ('Size TRec1 : ',SizeOf(Trec1));
+ Writeln (' Offset B : ',Longint(@rec1.B)-Longint(@rec1));
+ Write ('Size TRec2 : ',SizeOf(Trec2));
+ Writeln (' Offset B : ',Longint(@rec2.B)-Longint(@rec2));
+ Write ('Size TRec3 : ',SizeOf(Trec3));
+ Writeln (' Offset B : ',Longint(@rec3.B)-Longint(@rec3));
+ Write ('Size TRec4 : ',SizeOf(Trec4));
+ Writeln (' Offset B : ',Longint(@rec4.B)-Longint(@rec4));
+ Write ('Size TRec5 : ',SizeOf(Trec5));
+ Writeln (' Offset B : ',Longint(@rec5.B)-Longint(@rec5),
+ ' Offset C : ',Longint(@rec5.C)-Longint(@rec5));
+ Write ('Size TRec6 : ',SizeOf(Trec6));
+ Writeln (' Offset B : ',Longint(@rec6.B)-Longint(@rec6),
+ ' Offset C : ',Longint(@rec6.C)-Longint(@rec6));
+ Write ('Size TRec7 : ',SizeOf(Trec7));
+ Writeln (' Offset B : ',Longint(@rec7.B)-Longint(@rec7),
+ ' Offset C : ',Longint(@rec7.C)-Longint(@rec7));
+ Write ('Size TRec8 : ',SizeOf(Trec8));
+ Writeln (' Offset B : ',Longint(@rec8.B)-Longint(@rec8),
+ ' Offset C : ',Longint(@rec8.C)-Longint(@rec8));
+end.
+:exmp.
+
+:p.
+The output of this program will be:
+
+:xmp.
+Size TRec1 : 4 Offset B : 2
+Size TRec2 : 3 Offset B : 1
+Size TRec3 : 2 Offset B : 1
+Size TRec4 : 2 Offset B : 1
+Size TRec5 : 8 Offset B : 4 Offset C : 7
+Size TRec6 : 8 Offset B : 4 Offset C : 7
+Size TRec7 : 12 Offset B : 4 Offset C : 11
+Size TRec8 : 16 Offset B : 8 Offset C : 15
+:exmp.
+
+:p.
+And this is as expected:
+
+:ul.
+:li. In Trec1, since B has size 2, it is aligned on a 2 byte boundary, thus leaving an empty byte
+between A and B, and making the total size 4. In Trec2, B is aligned on a 1-byte boundary,
+right after A, hence, the total size of the record is 3.
+
+:li.For Trec3, the sizes of A,B are 1, and hence they are aligned on 1 byte boundaries. The same
+is true for Trec4.
+
+:li.For Trec5, since the size of B – 3 – is smaller than 4, B will be on a 4-byte boundary, as this
+is the first power of two that is larger than its size. The same holds for Trec6.
+
+:li.For Trec7, B is aligned on a 4 byte boundary, since its size – 7 – is larger than 4. However, in
+Trec8, it is aligned on a 8-byte boundary, since 8 is the first power of two that is greater than
+7, thus making the total size of the record 16.
+:eul.
+
+:p.
+&fpc. supports also the 'packed record', this is a record where all the elements are byte-aligned.
+Thus the two following declarations are equivalent:
+
+:xmp.
+ {$PackRecords 1}
+ Trec2 = Record
+ A : Byte;
+ B : Word;
+ end;
+ {$PackRecords 2}
+:exmp.
+
+:p.
+and
+
+:xmp.
+ Trec2 = Packed Record
+ A : Byte;
+ B : Word;
+ end;
+:exmp.
+
+:p.
+Note the :hp1.{$PackRecords 2}:ehp1. after the first declaration!
+
+
+
+:h4 name='set_types'.Set types
+:p.
+&fpc. supports the set types as in &tp.. The prototype of a set declaration is:
+
+:cgraphic.
+┌──────────────────────────────────────────────────────────────────────────────â”
+:hp2.Set types:ehp2.
+
+&ra.&ra.── set type ── :hp2.set:ehp2. ── :hp2.of:ehp2. ── ordinal type ───────────────────────────────────&ra.&la.
+
+└──────────────────────────────────────────────────────────────────────────────┘
+:ecgraphic.
+
+:p.
+Each of the elements of :hp1.SetType:ehp1. must be of type :hp1.TargetType:ehp1..
+:hp1.TargetType:ehp1. can be any ordinal
+type with a range between 0 and 255. A set can contain at most 255 elements.
+The following are valid set declaration:
+
+:xmp.
+type
+ Junk = set of Char;
+
+ Days = (Mon, Tue, Wed, Thu, Fri, Sat, Sun);
+ WorkDays: set of Days;
+:exmp.
+
+:p.
+Given these declarations, the following assignment is legal:
+
+:xmp.
+WorkDays := [Mon, Tue, Wed, Thu, Fri];
+:exmp.
+
+:p.
+The compiler stores small sets (less than 32 elements) in a Longint, if the
+type range allows it. This
+allows for faster processing and decreases program size. Otherwise, sets
+are stored in 32 bytes.
+:p.
+Several operations can be done on sets: taking unions or differences, adding
+or removing elements,
+comparisons. These are documented in :link refid='set_operators' reftype=hd.set operators:elink..
+
+
+
+:h4 name='file_types'.File types
+:p.
+File types are types that store a sequence of some base type, which can be any type except another file
+type. It can contain (in principle) an infinite number of elements. File types are used commonly to
+store data on disk. However, nothing prevents the programmer, from writing a file driver that stores
+its data for instance in memory.
+:p.
+Here is the type declaration for a file type:
+
+:cgraphic.
+┌──────────────────────────────────────────────────────────────────────────────â”
+:hp2.File types:ehp2.
+
+&ra.&ra.── file type ── :hp2.file:ehp2. ─┬─────────────┬───────────────────────────────────────&ra.&la.
+ └─ :hp2.of:ehp2. ─ type ─┘
+
+└──────────────────────────────────────────────────────────────────────────────┘
+:ecgraphic.
+
+:p.
+If no type identifier is given, then the file is an untyped file; it can be
+considered as equivalent to a file
+of bytes. Untyped files require special commands to act on them
+(see :hp1.Blockread:ehp1., :hp1.Blockwrite:ehp1.).
+The following declaration declares a file of records:
+
+:xmp.
+type
+ Point = Record
+ X,Y,Z : real;
+ end;
+ PointFile = File of Point;
+:exmp.
+
+:p.
+Internally, files are represented by the :hp1.FileRec:ehp1. record, which is declared
+in the Dos or SysUtils units.
+:p.
+A special file type is the :hp1.Text:ehp1. file type, represented by the :hp1.TextRec:ehp1. record.
+A file of type :hp1.Text:ehp1. uses special input-output routines. The default :hp1.Input:ehp1.,
+:hp1.Output:ehp1. and :hp1.StdErr:ehp1. file types are defined in the system unit: they are all of
+type :hp1.Text:ehp1., and are opened by the system unit initialization code.
+
+
+
+
+.* --------------------------------------------------------------
+:h3 name=pointer_types.Pointers
+:p.
+&fpc. supports the use of pointers. A variable of the pointer type contains an
+address in memory, where the data of another variable may be stored. A pointer
+type can be defined as follows:
+
+:cgraphic.
+┌──────────────────────────────────────────────────────────────────────────────â”
+:hp2.Pointer types:ehp2.
+
+&ra.&ra.── pointer type ── ^ ── type identifier ────────────────────────────────────&ra.&la.
+
+└──────────────────────────────────────────────────────────────────────────────┘
+:ecgraphic.
+
+:p.
+As can be seen from this diagram, pointers are typed, which means that they point to a particular
+kind of data. The type of this data must be known at compile time.
+:p.
+Dereferencing the pointer (denoted by adding ^ after the variable name) behaves then like a variable.
+This variable has the type declared in the pointer declaration, and the variable is stored in the address
+that is pointed to by the pointer variable. Consider the following example:
+
+:xmp.
+program pointers;
+
+type
+ Buffer = String[255];
+ BufPtr = ^Buffer;
+
+var
+ B: Buffer;
+ BP: BufPtr;
+ PP: Pointer;
+etc...
+:exmp.
+
+:p.
+In this example, BP :hp1.is a pointer to:ehp1. a Buffer type; while B is a variable of type Buffer. B takes
+256 bytes memory, and BP only takes 4 (or 8) bytes of memory: enough memory to store an address.
+:p.
+The expression
+
+:xmp.
+BP^
+:exmp.
+
+:p.
+is known as the dereferencing of BP. The result is of type Buffer, so
+
+:xmp.
+BP^[23]
+:exmp.
+
+:p.
+Denotes the 23-rd character in the string pointed to by BP.
+
+:nt. &fpc. treats pointers much the same way as C does. This means that a pointer to some type
+can be treated as being an array of this type.
+:p.
+From this point of view, the pointer then points to the zeroeth element of this
+array. Thus the following pointer declaration
+
+:xmp.
+var
+ p: ^Longint;
+:exmp.
+
+:p.
+can be considered equivalent to the following array declaration:
+
+:xmp.
+var
+ p: array[0..Infinity] of Longint;
+:exmp.
+
+:p.
+The difference is that the former declaration allocates memory for the pointer only (not for the array),
+and the second declaration allocates memory for the entire array. If the former is used, the memory
+must be allocated manually, using the :hp1.Getmem:ehp1. function. The reference P^ is then the same as p[0].
+The following program illustrates this maybe more clear:
+
+:xmp.
+program PointerArray;
+var
+ i: Longint;
+ p: ^Longint;
+ pp: array[0..100] of Longint;
+begin
+ for i := 0 to 100 do pp[i] := i; { Fill array }
+ p := @pp[0]; { Let p point to pp }
+ for i := 0 to 100 do
+ if p[i] <> pp[i] then
+ WriteLn ('Ohoh, problem !')
+end.
+:exmp.:ent.
+
+:p.
+&fpc. supports pointer arithmetic as C does. This means that, if P is a typed pointer, the
+instructions
+
+:xmp.
+Inc(P);
+Dec(P);
+:exmp.
+
+:p.
+Will increase, respectively decrease the address the pointer points to with the size of the type P is a
+pointer to. For example
+
+:xmp.
+var
+ P: ^Longint;
+&dot.&dot.&dot.
+ Inc(p);
+:exmp.
+
+:p.
+will increase P with 4, because 4 is the size of a longint. If the pointer is untyped, a size of 1 byte is
+assumed (i.e. as if the pointer were a pointer to a byte: ^byte.)
+:p.
+Normal arithmetic operators on pointers can also be used, that is, the following are valid pointer
+arithmetic operations:
+
+:xmp.
+var
+ p1, p2: ^Longint;
+ L: Longint;
+begin
+ P1 := @P2;
+ P2 := @L;
+ L := P1-P2;
+ P1 := P1-4;
+ P2 := P2+4;
+end.
+:exmp.
+
+:p.
+Here, the value that is added or substracted is multiplied by the size of the type the pointer points to.
+In the previous example P1 will be decremented by 16 bytes, and P2 will be incremented by 16.
+
+
+
+.* --------------------------------------------------------------
+:h3 name=forward_type_declarations.Forward type declarations
+:p.
+Programs often need to maintain a linked list of records. Each record then contains a pointer to the
+next record (and possibly to the previous record as well). For type safety, it is best to define this
+pointer as a typed pointer, so the next record can be allocated on the heap using the New call. In
+order to do so, the record should be defined something like this:
+
+:xmp.
+type
+ TListItem = Record
+ Data: Integer;
+ Next: ^TListItem;
+ end;
+:exmp.
+
+:p.
+When trying to compile this, the compiler will complain that the TListItem type is not yet defined
+when it encounters the :hp1.Next:ehp1. declaration: This is correct, as the definition is still being parsed.
+:p.
+To be able to have the Next element as a typed pointer, a 'Forward type declaration'
+must be introduced:
+
+:xmp.
+type
+ PListItem = ^TListItem;
+ TListItem = Record
+ Data : Integer;
+ Next : PTListItem;
+end;
+:exmp.
+
+:p.
+When the compiler encounters a typed pointer declaration where the referenced type is not yet known,
+it postpones resolving the reference till later. The pointer definition is a 'Forward type declaration'.
+:p.
+The referenced type should be introduced later in the same Type block. No other block may come
+between the definition of the pointer type and the referenced type. Indeed, even the word Type
+itself may not re-appear: in effect it would start a new type-block, causing the compiler to resolve all
+pending declarations in the current block.
+:p.
+In most cases, the definition of the referenced type will follow immediatly after the definition of
+the pointer type, as shown in the above listing. The forward defined type can be used in any type
+definition following its declaration.
+:p.
+Note that a forward type declaration is only possible with pointer types and classes, not with other
+types.
+
+
+
+.* --------------------------------------------------------------
+:h3 name=procedural_types.Procedural types
+:p.
+&fpc. has support for procedural types, although it differs a little from the &tp. or
+&delphi. implementation of them. The type declaration remains the same, as can be seen in the following
+syntax diagram:
+
+:cgraphic.
+┌──────────────────────────────────────────────────────────────────────────────â”
+:hp2.Procedural types:ehp2.
+
+&ra.&ra.── procedural type ─┬─ function header ──┬┬───────────────┬┬─────────────────────┬──────&ra.&la.
+ └─ procedure header ─┘└─ :hp2.of:ehp2. ─ :hp2.object:ehp2. ─┘└─ ; ─ call modifier ─┘
+
+&ra.&ra.── function header ── :hp2.function:ehp2. ─ formal parameter list ─ : ─ result type ───────────────&ra.&la.
+
+&ra.&ra.── procedure header ── :hp2.procedure:ehp2. ─ formal parameter list ───────────────────────────────&ra.&la.
+
+&ra.&ra.── call modifiers ─┬─ :hp2.register:ehp2. ─┬───────────────────────────────────────────────────────&ra.&la.
+ ├─ :hp2.cdecl:ehp2. ─┤
+ ├─ :hp2.pascal:ehp2. ─┤
+ ├─ :hp2.stdcall:ehp2. ─┤
+ ├─ :hp2.safecall:ehp2. ─┤
+ └─ :hp2.inline:ehp2. ─┘
+
+└──────────────────────────────────────────────────────────────────────────────┘
+:ecgraphic.
+
+:p.
+For a description of formal parameter lists, see :link refid='procedure_declarations' reftype=hd. Procedure declarations:elink..
+The two following examples are valid type declarations:
+
+:xmp.
+type
+ TOneArg = Procedure (Var X : integer);
+ TNoArg = Function : Real;
+var
+ proc : TOneArg;
+ func : TNoArg;
+:exmp.
+
+:p.
+One can assign the following values to a procedural type variable:
+
+:ol.
+:li. Nil, for both normal procedure pointers and method pointers.
+:li. A variable reference of a procedural type, i.e. another variable of the same type.
+:li. A global procedure or function address, with matching function or procedure header
+and calling convention.
+:li. A method address.
+:eol.
+
+:p.
+Given these declarations, the following assignments are valid:
+
+:xmp.
+Procedure printit (Var X : Integer);
+begin
+ WriteLn (x);
+end;
+&dot.&dot.&dot.
+Proc := @printit;
+Func := @Pi;
+:exmp.
+
+:p.
+From this example, the difference with &tp. is clear: In &tp. it isn't necessary to
+use the address operator (@) when assigning a procedural type variable, whereas
+in &fpc. it is required. In case the :hp1.-MDelphi:ehp1. or :hp1.-MTP:ehp1. switches
+are used, the address operator can be dropped.
+
+:nt.
+The modifiers concerning the calling conventions must be the same as the
+declaration; i.e. the following code would give an error:
+
+:xmp.
+type
+ TOneArgCcall = procedure(Var X: integer); cdecl;
+
+var
+ proc: TOneArgCcall;
+
+procedure printit(Var X : Integer);
+begin
+ WriteLn (x);
+end;
+
+begin
+ Proc := @printit;
+end.
+:exmp.
+
+Because the TOneArgCcall type is a procedure that uses the cdecl calling convention.
+:ent.
+
+
+
+.* --------------------------------------------------------------
+:h3 name=variant_types.Variant types
+:ul.
+:li.:link refid='variant_types_definition' reftype='hd'.Definition:elink.
+:li.:link refid='variant_types_inassignment' reftype='hd'.Variants in assignments and expressions:elink.
+:li.:link refid='variant_types_andinterfaces' reftype='hd'.Variants and interfaces:elink.
+:eul.
+
+.* ...............................................................
+:h4 name='variant_types_definition'.Definition
+:p.
+As of version 1.1, &fpc. has support for variants. For maximum variant support it is recommended to
+add the variants unit to the uses clause of every unit that uses variants in some way: the variants unit
+contains support for examining and transforming variants other than the default support offered by
+the :hp1.System:ehp1. or :hp1.ObjPas:ehp1. units.
+:p.
+The type of a value stored in a variant is only determined at runtime: it depends what has been
+assigned to the to the variant. Almost any simple type can be assigned to variants: ordinal types,
+string types, int64 types.
+:p.
+Structured types such as sets, records, arrays, files, objects and classes are not assignment-compatible
+with a variant, as well as pointers. Interfaces and COM or CORBA objects can be assigned to a
+variant (basically because they are simply a pointer).
+:p.
+This means that the following assignments are valid:
+
+:xmp.
+type
+ TMyEnum = (One, Two, Three);
+
+var
+ V: Variant;
+ I: Integer;
+ B: Byte;
+ W: Word;
+ Q: Int64;
+ E: Extended;
+ D: Double;
+ En: TMyEnum;
+ AS: AnsiString;
+ WS: WideString;
+
+begin
+ V := I;
+ V := B;
+ V := W;
+ V := Q;
+ V := E;
+ V := En;
+ V := D:
+ V := AS;
+ V := WS;
+end;
+:exmp.
+
+:p.
+And of course vice-versa as well.
+:p.
+A variant can hold an an array of values: All elements in the array have the same type (but can be of
+type 'variant'). For a variant that contains an array, the variant can be indexed:
+
+:xmp.
+program testv;
+
+uses
+ Variants;
+
+var
+ A: variant;
+ I: integer;
+begin
+ A := VarArrayCreate([1, 10], varInteger);
+ For I := 1 to 10 do
+ A[I] := I;
+end.
+:exmp.
+
+:p.
+For the explanation of :hp1.VarArrayCreate:ehp1., see Unit Reference.
+:p.
+Note that when the array contains a string, this is not considered an 'array of characters', and so the
+variant cannot be indexed to retrieve a character at a certain position in the string.
+
+
+
+.* ..................................................................
+:h4 name='variant_types_inassignment'.Variants in assignments and expressions
+:p.
+As can be seen from the definition above, most simple types can be assigned to a variant. Likewise,
+a variant can be assigned to a simple type: If possible, the value of the variant will be converted to
+the type that is being assigned to. This may fail: Assigning a variant containing a string to an integer
+will fail unless the string represents a valid integer. In the following example, the first assignment
+will work, the second will fail:
+
+:xmp.
+program testv3;
+
+uses
+ Variants;
+
+var
+ V: Variant;
+ I: Integer;
+
+begin
+ V := '100';
+ I := V;
+ writeln('I : ', I);
+ V := 'Something else';
+ I := V;
+ writeln('I : ', I);
+end.
+:exmp.
+
+:p.
+The first assignment will work, but the second will not, as :hp1.Something else:ehp1. cannot be converted
+to a valid integer value. An EConvertError exception will be the result.
+:p.
+The result of an expression involving a variant will be of type variant again, but this can be assigned
+to a variable of a different type - if the result can be converted to a variable of this type.
+:p.
+Note that expressions involving variants take more time to be evaluated, and should therefore be used
+with caution. If a lot of calculations need to be made, it is best to avoid the use of variants.
+:p.
+When considering implicit type conversions (e.g. byte to integer, integer to double, char to string)
+the compiler will ignore variants unless a variant appears explicitly in the expression.
+
+
+
+
+.* ..................................................................
+:h4 name='variant_types_andinterfaces'.Variants and interfaces
+:p.
+:note.Dispatch interface support for variants is currently broken in the compiler.
+:p.
+Variants can contain a reference to an interface - a normal interface (descending from IInterface)
+or a dispatchinterface (descending from IDispatch). Variants containing a reference to a dispatch
+interface can be used to control the object behind it: the compiler will use late binding to perform
+the call to the dispatch interface: there will be no run-time checking of the function names and
+parameters or arguments given to the functions. The result type is also not checked. The compiler
+will simply insert code to make the dispatch call and retrieve the result.
+:p.
+This means basically, that you can do the following on Windows:
+
+:xmp.
+var
+ W: Variant;
+ V: String;
+begin
+ W := CreateOleObject('Word.Application');
+ V := W.Application.Version;
+ Writeln('Installed version of MS Word is : ', V);
+end;
+:exmp.
+
+:p.
+The line
+
+:xmp.
+V := W.Application.Version;
+:exmp.
+
+:p.
+is executed by inserting the necessary code to query the dispatch interface stored in the variant W, and
+execute the call if the needed dispatch information is found.
+
+
+
+.* ==============================================================
+:h2 name=variables.Variables
+:p.
+:ul.
+:li.:link refid='variables_definition' reftype='hd'.Definition:elink.
+:li.:link refid='variables_declaration' reftype='hd'.Declaration:elink.
+:li.:link refid='variables_scope' reftype='hd'.Scope:elink.
+:li.:link refid='variables_initializedvars' reftype='hd'.Initialized variables:elink.
+:li.:link refid='variables_threadvars' reftype='hd'.Thread variables:elink.
+:li.:link refid='variables_properties' reftype='hd'.Properties:elink.
+:eul.
+
+:h3 name='variables_definition'.Definition
+:p.
+Variables are explicitly named memory locations with a certain type. When assigning values to
+variables, the Free Pascal compiler generates machine code to move the value to the memory location
+reserved for this variable. Where this variable is stored depends on where it is declared:
+
+:ul.
+:li.Global variables are variables declared in a unit or program, but not inside a procedure or
+function. They are stored in fixed memory locations, and are available during the whole execution
+time of the program.
+:li.Local variables are declared inside a procedure or function. Their value is stored on the
+program stack, i.e. not at fixed locations.
+:eul.
+
+:p.
+The &fpc. compiler handles the allocation of these memory locations transparantly, although
+this location can be influenced in the declaration.
+:p.
+The &fpc. compiler also handles reading values from or writing values to the variables transparantly.
+But even this can be explicitly handled by the programmer when using properties.
+:p.
+Variables must be explicitly declared when they are needed. No memory is allocated unless a variable
+is declared. Using an variable identifier (for instance, a loop variable) which is not declared first, is
+an error which will be reported by the compiler.
+
+
+
+:h3 name='variables_declaration'.Declaration
+:p.
+The variables must be declared in a variable declaration section of a unit or a procedure or function.
+It looks as follows:
+
+:cgraphic.
+┌──────────────────────────────────────────────────────────────────────────────â”
+:hp2.Variable declaration:ehp2.
+
+&ra.&ra.── variable declaration ── identifier ── : ── type ─┬──────────────────┬──&ra.
+ └─ :hp2.=:ehp2. ─ expression ─┘
+
+&ra.───┬──────────────────────┬─ hintdirective ── :hp2.;:ehp2. ─────────────────────────────&ra.&la.
+ └─ variable modifiers ─┘
+
+&ra.&ra.── variable modifiers ─┬─┬───── :hp2.absolute:ehp2. ─┬─ integer expression ─┬───────────────────────┬┬─&ra.
+ ^ │ └─ identifier ─┘ ││
+ │ ├────────────────────── :hp2.; export:ehp2. ───────────────────────────────┤│
+ │ ├────────────────────── :hp2.; cvar:ehp2. ─────────────────────────────────┤│
+ │ ├─ :hp2.; external:ehp2. ─┬───────────────────┬┬──────────────────────────┬┤│
+ │ │ └─ string constant ─┘└─ :hp2.name:ehp2. ─ string constant ─┘││
+ │ └────────────────────── hintdirective ──────────────────────────┘│
+ └──────────────────────────────────────────────────────────────────┘
+
+&ra.─────────────────────────────────────────────────────────────────────────────&ra.&la.
+
+└──────────────────────────────────────────────────────────────────────────────┘
+:ecgraphic.
+
+:p.
+This means that the following are valid variable declarations:
+
+:xmp.
+var
+ curterm1: integer;
+
+ curterm2: integer; cvar;
+ curterm3: integer; cvar; external;
+
+ curterm4: integer; external name 'curterm3';
+ curterm5: integer; external 'libc' name 'curterm9';
+
+ curterm6: integer absolute curterm1;
+
+ curterm7: integer; cvar; export;
+ curterm8: integer; cvar; public;
+ curterm9: integer; export name 'me';
+ curterm10: integer; public name 'ma';
+
+ curterm11: integer = 1;
+:exmp.
+
+:p.
+The difference between these declarations is as follows:
+
+:ol.
+:li.The first form (curterm1) defines a regular variable. The compiler manages everything by
+itself.
+:li.The second form (curterm2) declares also a regular variable, but specifies that the assembler
+name for this variable equals the name of the variable as written in the source.
+:li.The third form (curterm3) declares a variable which is located externally: the compiler will
+assume memory is located elsewhere, and that the assembler name of this location is specified
+by the name of the variable, as written in the source. The name may not be specified.
+:li.The fourth form is completely equivalent to the third, it declares a variable which is stored
+externally, and explicitly gives the assembler name of the location. If cvar is not used, the
+name must be specified.
+:li.The fifth form is a variant of the fourth form, only the name of the library in which the memory
+is reserved is specified as well.
+:li.The sixth form declares a variable (curterm6), and tells the compiler that it is stored in the
+same location as another variable (curterm1).
+:li.The seventh form declares a variable (curterm7), and tells the compiler that the assembler
+label of this variable should be the name of the variable (case sensitive) and must be made
+public. i.e. it can be referenced from other object files.
+:li.The eighth form (curterm8) is equivalent to the seventh: 'public' is an alias for 'export'.
+:li.The ninth and tenth form are equivalent: they specify the assembler name of the variable.
+:li.The eleventh form declares a variable (curterm11) and initializes it with a value (1 in the
+above case).
+:eol.
+
+:p.
+Note that assembler names must be unique. It’s not possible to declare or export 2 variables with the
+same assembler name.
+
+
+:h3 name='variables_scope'.Scope
+:p.
+Variables, just as any identifier, obey the general rules of scope. In addition,
+initialized variables are initialized when they enter scope:
+
+:ul.
+:li.Global initialized variables are initialized once, when the program starts.
+:li.Local initialized variables are initialized each time the procedure is entered.
+:eul.
+
+:p.
+Note that the behaviour for local initialized variables is different from the one
+of a local typed constant. A local typed constant behaves like a global initialized
+variable.
+
+
+:h3 name='variables_initializedvars'.Initialized variables
+:p.
+By default, variables in Pascal are not initialized after their declaration. Any assumption that they
+contain 0 or any other default value is erroneous: They can contain rubbish. To remedy this, the
+concept of initialized variables exists. The difference with normal variables is that their declaration
+includes an initial value, as can be seen in the diagram in the previous section.
+:p.
+Given the declaration:
+
+:xmp.
+var
+ S: String = 'This is an initialized string';
+:exmp.
+
+:p.
+The value of the variable following will be initialized with the provided value. The following is an
+even better way of doing this:
+
+:xmp.
+const
+ SDefault = 'This is an initialized string';
+
+var
+ S: String = SDefault;
+:exmp.
+
+:p.
+Initialization is often used to initialize arrays and records. For arrays, the initialized elements must
+be specified, surrounded by round brackets, and separated by commas. The number of initialized
+elements must be exactly the same as the number of elements in the declaration of the type. As an
+example:
+
+:xmp.
+var
+ tt: array [1..3] of string[20] = ('ikke', 'gij', 'hij');
+ ti: array [1..3] of Longint = (1,2,3);
+:exmp.
+
+:p.
+For constant records, each element of the record should be specified, in
+the form :hp1.Field: Value:ehp1., separated by semicolons, and surrounded by round
+brackets.
+
+:xmp.
+type
+ Point = record
+ X, Y: Real
+ end;
+var
+ Origin: Point = (X:0.0; Y:0.0);
+:exmp.
+
+:p.
+The order of the fields in a constant record needs to be the same as in the type declaration, otherwise
+a compile-time error will occur.
+
+:nt.
+It should be stressed that initialized variables are initialized when they come into scope, in difference
+with typed constants, which are initialized at program start. This is also true for local initialized
+variables. Local initialized are initialized whenever the routine is called. Any changes that occurred
+in the previous invocation of the routine will be undone, because they are again initialized.
+:ent.
+
+
+:h3 name='variables_threadvars'.Thread variables
+:p.
+For a program which uses threads, the variables can be really global, i.e. the same for all threads, or
+thread-local: this means that each thread gets a copy of the variable. Local variables (defined inside
+a procedure) are always thread-local. Global variables are normally the same for all threads. A
+global variable can be declared thread-local by replacing the :hp1.var:ehp1. keyword at the start of the variable
+declaration block with :hp1.Threadvar:ehp1.:
+
+:xmp.
+Threadvar
+ IOResult: Integer;
+:exmp.
+
+:p.
+If no threads are used, the variable behaves as an ordinary variable. If threads are used then a copy is
+made for each thread (including the main thread). Note that the copy is made with the original value
+of the variable, :hp1.not:ehp1. with the value of the variable at the time the thread is started.
+:p.
+Threadvars should be used sparingly: There is an overhead for retrieving or setting the variable's
+value. If possible at all, consider using local variables; they are always faster than thread variables.
+:p.
+Threads are not enabled by default. For more information about programming threads, see the chapter
+on threads in the &progref..
+
+
+:h3 name='variables_properties'.Properties
+:p.
+A global block can declare properties, just as they could be defined in a class. The difference is that
+the global property does not need a class instance: there is only 1 instance of this property. Other
+than that, a global property behaves like a class property. The read/write specifiers for the global
+property must also be regular procedures, not methods.
+:p.
+The concept of a global property is specific to &fpc., and does not exist in &delphi.. :hp1.ObjFPC:ehp1.
+mode is required to work with properties.
+:p.
+The concept of a global property can be used to 'hide' the location of the value, or to calculate the
+value on the fly, or to check the values which are written to the property.
+:p.
+The declaration is as follows:
+
+:cgraphic.
+┌──────────────────────────────────────────────────────────────────────────────â”
+:hp2.Properties:ehp2.
+
+&ra.&ra.── property definition ── identifier ─┬──────────────────────┬─ property specifiers ──────&ra.&la.
+ └─ property interface ─┘
+
+&ra.&ra.── property interface ─┬───────────────────────────┬─ : ── type identifier ──&ra.
+ └─ property parameter list ─┘
+
+&ra.───┬───────────────────────────┬─────────────────────────────────────────────&ra.&la.
+ └─ :hp2.index:ehp2. ─ integerconstant ─┘
+
+&ra.&ra.── property parameter list ── :hp2.[:ehp2. ─┬─ parameter declaration ─┬─ :hp2.]:ehp2. ────────────&ra.&la.
+ ^─────────── ; ───────────┘
+
+&ra.&ra.── property specifiers ─┬──────────────────┬┬───────────────────┬┬─────────────────────┬───&ra.&la.
+ └─ read specifier ─┘└─ write specifier ─┘└─ default specifier ─┘
+
+&ra.&ra.── read specifier ── :hp2.read:ehp2. ── field or function ─────────────────────────────&ra.&la.
+
+&ra.&ra.── write specifier ── :hp2.write:ehp2. ── field or function ───────────────────────────&ra.&la.
+
+&ra.&ra.── default specifier ──┬─ :hp2.default:ehp2. ──┬────────────┬┬─────────────────────────&ra.&la.
+ │ └─ constant ─┘│
+ └──────── :hp2.nodefault:ehp2. ───────┘
+
+&ra.&ra.── field or procedure ──┬─── field identifier ───┬──────────────────────────&ra.&la.
+ └─ procedure identifier ─┘
+
+&ra.&ra.── field or function ──┬─── field identifier ───┬───────────────────────────&ra.&la.
+ └─ function identifier ──┘
+
+└──────────────────────────────────────────────────────────────────────────────┘
+:ecgraphic.
+
+:p.
+The following is an example:
+
+:xmp.
+unit testprop;
+
+{$mode objfpc}{$H+}
+
+interface
+
+function GetMyInt: Integer;
+procedure SetMyInt(AValue: Integer);
+
+property MyProp: Integer read GetMyInt write SetMyInt;
+
+implementation
+
+uses
+ sysutils;
+
+var
+ FMyInt: Integer;
+
+function GetMyInt: Integer;
+begin
+ Result := FMyInt;
+end;
+
+procedure SetMyInt(AValue: Integer);
+begin
+ if ((AValue mod 2) = 1) then
+ raise Exception.Create('MyProp can only contain even value');
+ FMyInt := AValue;
+end;
+
+end.
+:exmp.
+
+:p.
+The read/write specifiers can be hidden by declaring them in another unit which must be in the :hp1.uses:ehp1.
+clause of the unit. This can be used to hide the read/write access specifiers for programmers, just as
+if they were in a private section of a class (discussed below). For the previous example, this could
+look as follows:
+
+:xmp.
+unit testrw;
+
+{$mode objfpc}{$H+}
+
+interface
+
+function GetMyInt: Integer;
+procedure SetMyInt(AValue: Integer);
+
+implementation
+
+uses
+ sysutils;
+
+var
+ FMyInt: Integer;
+
+function GetMyInt: Integer;
+begin
+ Result := FMyInt;
+end;
+
+procedure SetMyInt(AValue: Integer);
+begin
+ If ((AValue mod 2) = 1) then
+ Raise Exception.Create('Only even values are allowed');
+ FMyInt := AValue;
+end;
+
+end.
+:exmp.
+
+:p.
+The unit testprop would then look like:
+
+:xmp.
+unit testprop;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+ testrw;
+
+property MyProp: Integer read GetMyInt write SetMyInt;
+
+implementation
+
+end.
+:exmp.
+
+:p.
+More information about properties can be found in the :link refid='classes' reftype='hd'.Classes chapter:elink..
+
+
+
+
+.* ==============================================================
+:h2 name=objects.Objects
+:p.
+:ul.
+:li.:link refid='objects_declaration' reftype='hd'.Declaration:elink.
+:li.:link refid='objects_fields' reftype='hd'.Fields:elink.
+:li.:link refid='objects_staticfields' reftype='hd'.Static Fields:elink.
+:li.:link refid='objects_constructordestructor' reftype='hd'.Constructors and Destructors:elink.
+:li.:link refid='objects_methods' reftype='hd'.Methods:elink.
+:li.:link refid='objects_visibility' reftype='hd'.Visibility:elink.
+:eul.
+
+:h3 name='objects_declaration'.Declaration
+:p.
+&fpc. supports object oriented programming. In fact, most of the compiler is written using
+objects. Here we present some technical questions regarding object oriented programming in &fpc.
+
+:p.
+Objects should be treated as a special kind of record. The record contains all the fields that are
+declared in the objects definition, and pointers to the methods that are associated to the objects’ type.
+
+:p.
+An object is declared just as a record would be declared; except that now, procedures and functions
+can be declared as if they were part of the record. Objects can “inherit†fields and methods from
+“parent†objects. This means that these fields and methods can be used as if they were included in
+the objects declared as a “child†object.
+
+:p.
+Furthermore, a concept of visibility is introduced: fields, procedures and functions can be declared as
+public, protected or private. By default, fields and methods are public, and are exported
+outside the current unit.
+
+:p.
+Fields or methods that are declared private are only accessible in the current unit: their scope is
+limited to the implementation of the current unit.
+
+:p.
+The prototype declaration of an object is as follows:
+
+:cgraphic.
+┌──────────────────────────────────────────────────────────────────────────────â”
+:hp2.Object types:ehp2.
+
+&ra.&ra.───┬──────────┬─ :hp2.object:ehp2. ─┬────────────┬─┬─ component list ─┬─ end ────────────&ra.&la.
+ └─ :hp2.packed:ehp2. ─┘ └─ heritage ─┘ ^──────────────────┘
+
+&ra.&ra.─── heritage ── ( ── object type identifier ── ) ─────────────────────────────&ra.&la.
+
+&ra.&ra.─── component list ─┬───────────────────────────────┬┬──────────────────────┬─&ra.
+ └─ object visibility specifier ─┘└┬─ field definition ─┬┘
+ ^────────────────────┘
+
+&ra.───┬───────────────────────┬───────────────────────────────────────────────────&ra.&la.
+ └┬─ method definition ─┬┘
+ ^─────────────────────┘
+
+&ra.&ra.─── field definition ── identifier list ── : ── type ── ; ──┬───────────┬─────&ra.&la.
+ └─ :hp2.static;:ehp2. ─┘
+
+&ra.&ra.─── object visibility specifier ─┬─ :hp2.private:ehp2. ─┬──────────────────────────────&ra.&la.
+ ├─ :hp2.protected:ehp2. ─┤
+ └─ :hp2.public:ehp2. ─┘
+
+└──────────────────────────────────────────────────────────────────────────────┘
+:ecgraphic.
+
+.* TODO: The "method definition" is missing from the above graph.
+
+:p.
+As can be seen, as many private and public blocks as needed can be declared.
+
+:p.
+The following is a valid definition of an object:
+
+:xmp.
+type
+ TObj = object
+ private
+ Caption: ShortString;
+ public
+ constructor init;
+ destructor done;
+ procedure SetCaption(AValue: String);
+ property GetCaption: String;
+ end;
+:exmp.
+
+:p.
+It contains a constructor/destructor pair, and a method to get and set a
+caption. The :hp1.Caption:ehp1. field is private to the object: it cannot be accessed
+outside the unit in which :hp1.TObj:ehp1. is declared.
+
+:note.
+In MacPas mode, the :hp1.Object:ehp1. keyword is replaced by the :hp1.class:ehp1.
+keyword for compatibility with other pascal compilers available on the Mac.
+That means that objects cannot be used in MacPas mode.
+
+:nt.
+&fpc. also supports the packed object. This is the same as an object, only
+the elements (fields) of the object are byte-aligned, just as in the packed
+record. The declaration of a packed object is similar to the declaration
+of a packed record:
+
+:xmp.
+type
+ TObj = packed object
+ constructor init;
+ ...
+ end;
+ Pobj = ^TObj;
+
+var
+ pp: Pobj;
+:exmp.
+
+:p.
+Similarly, the :hp1.{$PackRecords}:ehp1. directive acts on objects as well.
+:ent.
+
+
+:h3 name='objects_fields'.Fields
+:p.
+Object Fields are like record fields. They are accessed in the same way as
+a record field would be accessed: by using a qualified identifier. Given the
+following declaration:
+
+:xmp.
+type
+ TAnObject = object
+ AField: Longint;
+ procedure AMethod;
+ end;
+
+var
+ AnObject: TAnObject;
+:exmp.
+
+:p.
+then the following would be a valid assignment:
+
+:xmp.
+AnObject.AField := 0;
+:exmp.
+
+:p.
+Inside methods, fields can be accessed using the short identifier:
+
+:xmp.
+procedure TAnObject.AMethod;
+begin
+ ...
+ AField := 0;
+ ...
+end;
+:exmp.
+
+:p.
+Or, one can use the :hp1.self:ehp1. identifier. The :hp1.self:ehp1. identifier refers
+to the current instance of the object:
+
+:xmp.
+procedure TAnObject.AMethod;
+begin
+ ...
+ self.AField := 0;
+ ...
+end;
+:exmp.
+
+:p.
+One cannot access fields that are in a private or protected sections of an object from
+outside the objects’ methods. If this is attempted anyway, the compiler will complain about
+an unknown identifier.
+
+:p.
+It is also possible to use the :hp1.with:ehp1. statement with an object instance,
+just as with a record:
+
+:xmp.
+with AnObject do
+begin
+ AField := 12;
+ AMethod;
+end;
+:exmp.
+
+:p.
+In this example, between the :hp1.begin:ehp1. and :hp1.end:ehp1., it is as if
+:hp1.AnObject:ehp1. was prepended to the :hp1.AField:ehp1. and :hp1.AMethod:ehp1.
+identifiers. More about this in :link refid='statements_structured_with' reftype='hd'.The With Statement:elink..
+
+
+:h3 name='objects_staticfields'.Static Fields
+:p.
+When the :hp1.{$STATIC ON}:ehp1. directive is active, then an object
+can contain static fields: these fields are global to the object type, and act
+like global variables, but are known only as part of the object. They can be
+referenced from within the objects methods, but can also be referenced from
+outside the object by providing the fully qualified name.
+
+:p.
+For instance, the output of the following program:
+
+:xmp.
+{$static on}
+type
+ cl = object
+ l: longint; static;
+ end;
+
+var
+ c1, c2: cl;
+begin
+ c1.l := 2;
+ writeln(c2.l);
+ c2.l := 3;
+ writeln(c1.l);
+ writeln(cl.l);
+end.
+:exmp.
+
+:p.
+will be the following
+
+:xmp.
+2
+3
+3
+:exmp.
+
+:p.
+Note that the last line of code references the object type itself (cl),
+and not an instance of the object (cl1 or cl2).
+
+
+:h3 name='objects_constructordestructor'.Constructors and Destructors
+:p.
+As can be seen in the syntax diagram for an object declaration, &fpc. supports
+constructors and destructors. The programmer is responsible for calling the
+constructor and the destructor explicitly when using objects.
+
+:p.
+The declaration of a constructor or destructor is as follows:
+
+:cgraphic.
+┌──────────────────────────────────────────────────────────────────────────────â”
+:hp2.Constructors and Destructors:ehp2.
+
+&ra.&ra.─── constructor declaration ── constructor header ── ; ── subroutine block ──────&ra.&la.
+
+&ra.&ra.─── destructor declaration ── destructor header ── ; ── subroutine block ────────&ra.&la.
+
+&ra.&ra.─── constructor header ── :hp2.constructor:ehp2. ──┬───────── identifier ──────────┬────────&ra.
+ └─ qualified method identifier ─┘
+
+&ra.──── formal parameter list ───────────────────────────────────────────────────────&ra.&la.
+
+&ra.&ra.─── destructor header ── :hp2.destructor:ehp2. ──┬───────── identifier ──────────┬──────────&ra.
+ └─ qualified method identifier ─┘
+
+&ra.──── formal parameter list ───────────────────────────────────────────────────────&ra.&la.
+
+└──────────────────────────────────────────────────────────────────────────────┘
+:ecgraphic.
+
+:p.
+A constructor/destructor pair is :hp1.required:ehp1. if the object uses virtual methods.
+The reason is that for an object with virtual methods, some internal
+housekeeping must be done: this housekeeping is done by the
+constructor [A pointer to the VMT must be set up].
+
+:p.
+In the declaration of the object type, a simple identifier should be used
+for the name of the constuctor or destructor. When the constructor or destructor
+is implemented, A qualified method identifier should be used,
+i.e. an identifier of the form :hp1.objectidentifier.methodidentifier:ehp1..
+
+:p.
+&fpc. supports also the extended syntax of the :hp1.New:ehp1. and :hp1.Dispose:ehp1.
+procedures. In case a dynamic variable of an object type must be allocated
+the constructor’s name can be specified in the call to :hp1.New:ehp1..
+The :hp1.New:ehp1. is implemented as a function which returns a pointer to the
+instantiated object. Consider the following declarations:
+
+:xmp.
+type
+ TObj = object;
+ constructor init;
+ ...
+ end;
+ Pobj = ^TObj;
+
+var
+ PP: Pobj;
+:exmp.
+
+:p.
+Then the following 3 calls are equivalent:
+
+:xmp.
+pp := new (Pobj,Init);
+:exmp.
+
+:p.
+and
+
+:xmp.
+new(pp,init);
+:exmp.
+
+:p.
+and also
+
+:xmp.
+new (pp);
+pp^.init;
+:exmp.
+
+:p.
+In the last case, the compiler will issue a warning that the
+extended syntax of :hp1.New:ehp1. and :hp1.Dispose:ehp1. must be used to generate instances of an
+object. It is possible to ignore this warning, but it’s better programming practice to
+use the extended syntax to create instances of an object.
+Similarly, the :hp1.Dispose:ehp1. procedure accepts the name of a destructor. The
+destructor will then be called, before removing the object from the heap.
+
+:p.
+In view of the compiler warning remark, the following chapter presents the
+&delphi. approach to object-oriented programming, and may be considered a
+more natural way of object-oriented programming.
+
+
+:h3 name='objects_methods'.Methods
+:p.
+Object methods are just like ordinary procedures or functions, only they
+have an implicit extra parameter: :hp1.self:ehp1.. Self points to the object
+with which the method was invoked.
+When implementing methods, the fully qualified identifier must be given
+in the function header. When declaring methods, a normal identifier must be
+given.
+
+
+:h4 name='objects_methods_declaration'.Declaration
+:p.
+The declaration of a method is much like a normal function or procedure
+declaration, with some additional specifiers, as can be seen from the
+following diagram, which is part of the object declaration:
+
+:cgraphic.
+┌──────────────────────────────────────────────────────────────────────────────â”
+:hp2.Methods:ehp2.
+
+&ra.&ra.─── method definition ─┬─ function header ─┬─ ; ── method directives ─────────────&ra.&la.
+ ├─ procedure header ─┤
+ ├─ constructor header ─┤
+ └─ destructor header ─┘
+
+&ra.&ra.─── method directives ─┬──────────────────────────────────┬┬─────────────────────┬───&ra.&la.
+ └─ :hp2.virtual:ehp2. ─ ; ─┬────────────────┬─┘└─ call modifier ─ ; ─┘
+ └─ :hp2.abstract:ehp2. ─ ; ─┘
+
+└──────────────────────────────────────────────────────────────────────────────┘
+:ecgraphic.
+
+:p.
+from the point of view of declarations, :hp1.Method definitions:ehp1. are
+normal function or procedure declarations.
+Contrary to &tp. and &delphi., fields can be declared after methods in the same
+block, i.e. the following will generate an error when compiling with &delphi.
+or &tp., but not with &fpc.:
+
+:xmp.
+type
+ MyObj = object
+ procedure Doit;
+ Field: Longint;
+ end;
+:exmp.
+
+
+
+:h4 name='objects_method_invocation'.Method invocation
+:p.
+Methods are called just as normal procedures are called, only they have an
+object instance identifier prepended to them (see also :link refid='statements' reftype='hd'.Statements:elink.).
+To determine which method is called, it is necessary to know the type of
+the method. We treat the different types in what follows.
+
+:ul.
+:li.
+:link refid='objects_static_methods' reftype='hd'.Static Methods:elink.
+:li.
+:link refid='objects_virtual_methods' reftype='hd'.Virtual Methods:elink.
+:li.
+:link refid='objects_abstract_methods' reftype='hd'.Abstract Methods:elink.
+:eul.
+
+:h5 name='objects_static_methods'.Static Methods
+:p.
+Static methods are methods that have been declared without a abstract or virtual keyword.
+When calling a static method, the declared (i.e. compile time) method of the object is used. For
+example, consider the following declarations:
+
+:xmp.
+type
+ TParent = object
+ ...
+ procedure Doit;
+ ...
+ end;
+
+ PParent = ^TParent;
+
+ TChild = Object(TParent)
+ ...
+ procedure Doit;
+ ...
+ end;
+
+ PChild = ^TChild;
+:exmp.
+
+:p.
+As it is visible, both the parent and child objects have a method
+called :hp1.Doit:ehp1.. Consider now the following declarations and calls:
+
+:xmp.
+var
+ ParentA, ParentB: PParent;
+ Child: PChild;
+begin
+ ParentA := New(PParent,Init);
+ ParentB := New(PChild,Init);
+ Child := New(PChild,Init);
+ ParentA^.Doit;
+ ParentB^.Doit;
+ Child^.Doit;
+:exmp.
+
+:p.
+Of the three invocations of :hp1.Doit:ehp1., only the last one will call
+:hp1.TChild.Doit:ehp1., the other two calls will call :hp1.TParent.Doit:ehp1..
+This is because for static methods, the compiler determines at compile
+time which method should be called. Since :hp1.ParentB:ehp1. is of type
+:hp1.TParent:ehp1., the compiler decides that it must be called with
+:hp1.TParent.Doit:ehp1., even though it will be created as a :hp1.TChild:ehp1..
+There may be times when the method that is actually called should
+depend on the actual type of the object at run-time. If so, the method
+cannot be a static method, but must be a virtual method.
+
+
+:h5 name='objects_virtual_methods'.Virtual Methods
+:p.
+To remedy the situation in the previous section, :hp1.virtual:ehp1. methods are
+created. This is simply done by appending the method declaration with the
+:hp1.virtual:ehp1. modifier. The descendent object can then override the method
+with a new implementation by re-declaring the method (with the same
+parameter list) using the :hp1.virtual:ehp1. keyword.
+
+:p.
+Going back to the previous example, consider the following alternative
+declaration:
+
+:xmp.
+type
+ TParent = object
+ ...
+ procedure Doit; virtual;
+ ...
+ end;
+
+ PParent = ^TParent;
+
+ TChild = Object(TParent)
+ ...
+ procedure Doit; virtual;
+ ...
+ end;
+
+ PChild = ^TChild;
+:exmp.
+
+:p.
+As it is visible, both the parent and child objects have a method called
+:hp1.Doit:ehp1.. Consider now the following declarations and calls:
+
+:xmp.
+var
+ ParentA, ParentB: PParent;
+ Child: PChild;
+begin
+ ParentA := New(PParent, Init);
+ ParentB := New(PChild, Init);
+ Child := New(PChild, Init);
+ ParentA^.Doit;
+ ParentB^.Doit;
+ Child^.Doit;
+:exmp.
+
+:p.
+Now, different methods will be called, depending on the actual run-time type
+of the object. For :hp1.ParentA:ehp1., nothing changes, since it is created as
+a :hp1.TParent:ehp1. instance. For :hp1.Child:ehp1., the situation also doesn't
+change: it is again created as an instance of :hp1.TChild:ehp1..
+
+:p.
+For :hp1.ParentB:ehp1. however, the situation does change: Even though it was
+declared as a :hp1.TParent:ehp1., it is created as an instance of :hp1.TChild:ehp1..
+Now, when the program runs, before calling :hp1.Doit:ehp1., the program
+checks what the actual type of :hp1.ParentB:ehp1. is, and only then decides which
+method must be called. Seeing that :hp1.ParentB:ehp1. is of type :hp1.TChild:ehp1.,
+:hp1.TChild.Doit:ehp1. will be called. The code for this run-time checking of
+the actual type of an object is inserted by the compiler at compile time.
+
+The :hp1.TChild.Doit:ehp1. is said to "override" the
+:hp1.TParent.Doit:ehp1.. It is possible to acces the :hp1.TParent.Doit:ehp1. from
+within the :hp1.TChild.Doit:ehp1., with the :hp1.inherited:ehp1. keyword:
+
+:xmp.
+procedure TChild.Doit;
+begin
+ inherited Doit;
+ ...
+end;
+:exmp.
+
+:p.
+In the above example, when :hp1.TChild.Doit:ehp1. is called, the first thing it
+does is call :hp1.TParent.Doit:ehp1.. The inherited keyword cannot be used in
+static methods, only on virtual methods.
+
+:p.
+To be able to do this, the compiler keeps - per object type - a table with
+virtual methods: the VMT (Virtual Method Table). This is simply a table
+with pointers to each of the virtual methods: each virtual method has its
+fixed location in this table (an index). The compiler uses this table to
+look up the actual method that must be used. When a descendent object
+overrides a method, the entry of the parent method is overwritten in the
+VMT. More information about the VMT can be found in :link reftype=hd database='prog.inf' refid=0.&progref.:elink..
+
+:p.
+As remarked earlier, objects that have a VMT must be initialized with a
+constructor: the object variable must be initialized with a pointer to
+the VMT of the actual type that it was created with.
+
+
+:h5 name='objects_abstract_methods'.Abstract Methods
+:p.
+An abstract method is a special kind of virtual method. A method that is
+declared :hp1.abstract:ehp1. does not have an implementation for this method.
+It is up to inherited objects to override and implement this method.
+
+:p.
+From this it follows that a method can not be abstract if it is not virtual
+(this can be seen from the syntax diagram). A second consequence is that
+an instance of an object that has an abstract method cannot be created
+directly.
+
+:p.
+The reason is obvious: there is no method where the compiler could jump to!
+A method that is declared :hp1.abstract:ehp1. does not have an implementation for
+this method. It is up to inherited objects to override and implement this
+method. Continuing our example, take a look at this:
+
+:xmp.
+type
+ TParent = object
+ ...
+ procedure Doit; virtual; abstract;
+ ...
+ end;
+
+ PParent=^TParent;
+
+ TChild = Object(TParent)
+ ...
+ procedure Doit;virtual;
+ ...
+ end;
+
+ PChild = ^TChild;
+:exmp.
+
+:p.
+As it is visible, both the parent and child objects have a method called
+:hp1.Doit:ehp1.. Consider now the following declarations and calls:
+
+:xmp.
+var
+ ParentA, ParentB: PParent;
+ Child: PChild;
+begin
+ ParentA := New(PParent, Init);
+ ParentB := New(PChild, Init);
+ Child := New(PChild, Init);
+ ParentA^.Doit;
+ ParentB^.Doit;
+ Child^.Doit;
+:exmp.
+
+:p.
+First of all, Line 3 will generate a compiler error, stating that one cannot
+generate instances of objects with abstract methods: The compiler has
+detected that :hp1.PParent:ehp1. points to an object which has an abstract
+method. Commenting line 3 would allow compilation of the program.
+
+:nt.
+If an abstract method is overridden, The parent method cannot be called
+with :hp1.inherited:ehp1., since there is no parent method; The compiler
+will detect this, and complain about it, like this:
+
+:xmp.
+testo.pp(32,3) Error: Abstract methods can't be called directly
+:exmp.
+
+:p.
+If, through some mechanism, an abstract method is called at run-time,
+then a run-time error will occur. (run-time error 211, to be precise)
+:ent.
+
+:h3 name='objects_visibility'.Visibility
+:p.
+For objects, three visibility specifiers exist: :hp1.private:ehp1., :hp1.protected:ehp1. and
+:hp1.public:ehp1.. If a visibility specifier is not specified, :hp1.public:ehp1.
+is assumed. Both methods and fields can be hidden from a programmer by putting them
+in a :hp1.private:ehp1. section. The exact visibility rule is as follows:
+
+:parml tsize=15 break=none.
+:pt.:hp2.Private:ehp2.
+:pd. All fields and methods that are in a :hp1.private:ehp1. block,
+can only be accessed in the module (i.e. unit or program) that contains
+the object definition.
+They can be accessed from inside the object's methods or from outside them
+e.g. from other objects' methods, or global functions.
+
+:pt.:hp2.Protected:ehp2.
+:pd. Is the same as :hp1.Private:ehp1., except that the members of
+a :hp1.Protected:ehp1. section are also accessible to descendent types, even if
+they are implemented in other modules.
+
+:pt.:hp2.Public:ehp2.
+:pd. Fields and methods are always accessible, from everywhere.
+Fields and methods in a :hp1.Public:ehp1. section behave as though they were part
+of an ordinary :hp1.record:ehp1. type.
+:eparml.
+
+
+
+.* ==============================================================
+:h2 name=classes.Classes
+:p.
+In the &delphi. approach to Object Oriented Programming, everything revolves
+around the concept of 'Classes'. A class can be seen as a pointer to an
+object, or a pointer to a record, with methods associated with it.
+
+:p.
+The difference between objects and classes is mainly that an object
+is allocated on the stack, as an ordinary record would be, and that
+classes are always allocated on the heap. In the following example:
+
+:xmp.
+var
+ A: TSomeObject; // an Object
+ B: TSomeClass; // a Class
+:exmp.
+
+:p.
+The main difference is that the variable A will take up as much
+space on the stack as the size of the object (TSomeObject). The
+variable B, on the other hand, will always take just the size of
+a pointer on the stack. The actual class data is on the heap.
+
+:p.
+From this, a second difference follows: a class must :hp2.always:ehp2. be initialized
+through its constructor, whereas for an object, this is not necessary.
+Calling the constructor allocates the necessary memory on the heap for the
+class instance data.
+
+:nt.
+In earlier versions of &fpc. it was necessary, in order to use classes,
+to put the :hp1.objpas:ehp1. unit in the uses clause of a unit or program.
+:hp1. This is no longer needed as of version 0.99.12.:ehp1. As of this version,
+the unit will be loaded automatically when the :hp2.-MObjfpc:ehp2. or
+:hp2.-MDelphi:ehp2. options are specified, or their corresponding directives are
+used:
+
+:xmp.
+{$mode objfpc}
+{$mode delphi}
+:exmp.
+
+:p.
+In fact, the compiler will give a warning if it encounters the
+:hp1.objpas:ehp1. unit in a uses clause.
+:ent.
+
+:h3.Class definitions
+:p.
+The prototype declaration of a class is as follows:
+
+:cgraphic.
+┌──────────────────────────────────────────────────────────────────────────────â”
+:hp2.Class types:ehp2.
+
+&ra.&ra.───┬──────────┬─ :hp2.class:ehp2. ─┬────────────┬─┬────────────────────┬─ end ──────────────&ra.&la.
+ └─ :hp2.packed:ehp2. ─┘ └─ heritage ─┘ └┬ component list ─┬─┘
+ ^─────────────────┘
+
+&ra.&ra.─── heritage ── ( ── class type identifier ──┬──────────────────────────┬─ ) ────&ra.&la.
+ └─ implemented interfaces ─┘
+
+&ra.&ra.─── implemented interfaces ─┬ , ── interface identifier ──┬──────────────────────&ra.&la.
+ ^─────────────────────────────┘
+
+&ra.&ra.─── component list ─┬────────────────────────┬┬──────────────────────┬─&ra.
+ └─ visibility specifier ─┘└┬─ field definition ─┬┘
+ ^────────────────────┘
+
+&ra.───┬───────────────────────────┬──────────────────────────────────────────────────&ra.&la.
+ └┬┬── method definition ──┬┬┘
+ │└─ property definition ─┘│
+ ^─────────────────────────┘
+
+&ra.&ra.─── field definition ── identifier list ── : ── type ── ; ──┬───────────┬────────&ra.&la.
+ └─ :hp2.static;:ehp2. ─┘
+
+&ra.&ra.─── method definition ─┬┬─────────┬┬─ function header ──┬┬── ; ────────&ra.
+ │└─ :hp2.class:ehp2. ─┘└─ procedure header ─┘│
+ ├───── constructor header ────────┤
+ └───── destructor header ─────────┘
+
+&ra.────┬─────────────────────────────────────────┬┬──────────────────────┬───────────&ra.&la.
+ └─┬┬─ :hp2.virtual:ehp2. ─┬┬──────────────────┬┬─ ; ─┘└─ call modifiers ─ ; ─┘
+ │└─ :hp2.dynamic:ehp2. ─┘└─ ; ── :hp2.abstract:ehp2. ──┘│
+ ├──────── :hp2.override:ehp2. ───────────────┤
+ └─ :hp2.message:ehp2. ─┬─ integer constant ─┬┘
+ └─ string constant ──┘
+
+&ra.&ra.─── class visibility specifier ─┬─ :hp2.private:ehp2. ─┬──────────────────────────────────&ra.&la.
+ ├─ :hp2.protected:ehp2. ─┤
+ ├─ :hp2.public:ehp2. ─┤
+ └─ :hp2.published:ehp2. ─┘
+
+└──────────────────────────────────────────────────────────────────────────────┘
+:ecgraphic.
+
+:p.
+:nt.
+In MacPas mode, the :hp1.Object:ehp1. keyword is replaced by the :hp1.class:ehp1.
+keyword for compatibility with other pascal compilers available on the Mac.
+That means that in MacPas mode, the reserved word 'class' in the above
+diagram may be replaced by the reserved word 'object'.
+:ent.
+
+:p.
+In a class declaration, as many :hp1.private:ehp1., :hp1.protected:ehp1., :hp1.published:ehp1.
+and :hp1.public:ehp1. blocks as needed can be used: the various blocks can be
+repeated, and there is no special order in which they must appear.
+
+:p.
+Methods are normal function or procedure declarations.
+As can be seen, the declaration of a class is almost identical to the
+declaration of an object. The real difference between objects and classes
+is in the way they are created (see further in this chapter).
+The visibility of the different sections are as follows:
+
+:parml tsize=15 break=none.
+:pt.:hp2.Private:ehp2.
+:pd. All fields and methods that are in a :hp1.private:ehp1. block, can
+only be accessed in the module (i.e. unit) that contains the class definition.
+They can be accessed from inside the classes' methods or from outside them
+(e.g. from other classes' methods).
+
+:pt.:hp2.Protected:ehp2.
+:pd.Is the same as :hp1.Private:ehp1., except that the members of
+a :hp1.Protected:ehp1. section are also accessible to descendent types, even if
+they are implemented in other modules.
+
+:pt.:hp2.Public:ehp2.
+:pd.sections are always accessible.
+
+:pt.:hp2.Published:ehp2.
+:pd.Is the same as a :hp1.Public:ehp1. section, but the compiler
+generates also type information that is needed for automatic streaming of
+these classes if the compiler is in the {$M+} state. Fields defined in
+a :hp1.published:ehp1. section must be of class type.
+Array properties cannot be in a published section.
+
+:eparml.
+
+:p.
+In the syntax diagram, it can be seen that a class can list implemented
+interfaces. This feature will be discussed in the next chapter.
+
+:p.
+Classes can contain :hp1.class:ehp1. methods: these are functions that do not
+require an instance. The :hp1.self:ehp1. identifier is valid in such methods,
+but refers to the class pointer (the VMT).
+
+:p.
+Similar to objects, if the {$STATIC ON} directive is active, then a class
+can contain static fields: these fields are global to the class, and act
+like global variables, but are known only as part of the class. They can be
+referenced from within the classes' methods, but can also be referenced from
+outside the class by providing the fully qualified name.
+
+:p.
+For instance, the output of the following program:
+
+:xmp.
+{$mode objfpc}
+{$static on}
+type
+ TMyClass = class
+ l: longint; static;
+ end;
+var
+ c1, c2: TMyClass;
+begin
+ c1 := TMyClass.create;
+ c2 := TMyClass.create;
+ c1.l := 2;
+ writeln(c2.l);
+ c2.l := 3;
+ writeln(c1.l);
+ writeln(TMyClass.l);
+end.
+:exmp.
+
+:p.
+will be the following
+
+:xmp.
+2
+3
+3
+:exmp.
+
+:p.
+Note that the last line of code references the class type itself (TMyClass),
+and not an instance of the class (c1 or c2).
+
+:p.
+It is also possible to define class reference types:
+
+
+:cgraphic.
+┌──────────────────────────────────────────────────────────────────────────────â”
+:hp2.Class reference type:ehp2.
+
+&ra.&ra.─── :hp2.class of:ehp2. ── classtype ──────────────────────────────────────────────────&ra.&la.
+
+└──────────────────────────────────────────────────────────────────────────────┘
+:ecgraphic.
+
+:p.
+Class reference types are used to create instances of a certain class, which
+is not yet known at compile time, but which is specified at run time.
+Essentially, a variable of a class reference type contains a pointer to the
+definition of the speficied class. This can be used to construct an instance
+of the class corresponding to the definition, or to check inheritance.
+The following example shows how it works:
+
+:xmp.
+type
+ TComponentClass = class of TComponent;
+
+function CreateComponent(AClass: TComponentClass; AOwner: TComponent): TComponent;
+begin
+ // ...
+ Result := AClass.Create(AOwner);
+ // ...
+end;
+:exmp.
+
+:p.
+This function can be passed a class reference of any class that descends
+from :hp1.TComponent:ehp1.. The following is a valid call:
+
+:xmp.
+var
+ C: TComponent;
+begin
+ C := CreateComponent(TEdit, Form1);
+end;
+:exmp.
+
+:p.
+On return of the :hp1.CreateComponent:ehp1. function, C will contain an
+instance of the class TEdit. Note that the following call will fail to
+compile:
+
+:xmp.
+var
+ C: TComponent;
+begin
+ C := CreateComponent(TStream, Form1);
+end;
+:exmp.
+
+:p.
+because :hp1.TStream:ehp1. does not descend from :hp1.TComponent:ehp1., and
+:hp1.AClass:ehp1. refers to a :hp1.TComponent:ehp1. class. The compiler can
+(and will) check this at compile time, and will produce an error.
+
+:p.
+References to classes can also be used to check inheritance:
+:xmp.
+type
+ TMinClass = class of TMyClass;
+ TMaxClass = class of TMyClassChild;
+
+function CheckObjectBetween(Instance: TObject): boolean;
+begin
+ if not (Instance is TMinClass)
+ or ((Instance is TMaxClass) and (Instance.ClassType <> TMaxClass)) then
+ raise Exception.Create('SomeError')
+end;
+:exmp.
+
+:p.
+The above example will raise an exception if the passed instance
+is not a descendent of :hp1.TMinClass:ehp1. or a descendent if :hp1.TMaxClass:ehp1..
+
+:p.
+More about instantiating a class can be found in the next section.
+
+
+
+:h3.Class instantiation
+:p.
+Classes must be created using one of their constructors (there can be
+multiple constructors). Remember that a class is a pointer to an object on
+the heap. When a variable of some class is declared, the compiler just
+allocates room for this pointer, not the entire object. The constructor of
+a class returns a pointer to an initialized instance of the object on the
+heap. So, to initialize an instance of some class, one would do the following:
+
+:xmp.
+ ClassVar := ClassType.ConstructorName;
+:exmp.
+
+:p.
+The extended syntax of :hp1.new:ehp1. and :hp1.dispose:ehp1. can :hp2.not:ehp2. be used to
+instantiate and destroy class instances.
+That construct is reserved for use with objects only.
+Calling the constructor will provoke a call to :hp1.getmem:ehp1., to allocate
+enough space to hold the class instance data.
+After that, the constuctor's code is executed.
+The constructor has a pointer to its data, in :hp1.self:ehp1..
+
+:nt.
+:lm margin=5.
+:ul.
+:li. The {$PackRecords} directive also affects classes.
+i.e. the alignment in memory of the different fields depends on the
+value of the {$PackRecords} directive.
+:li. Just as for objects and records, a packed class can be declared.
+This has the same effect as on an object, or record, namely that the
+elements are aligned on 1-byte boundaries. i.e. as close as possible.
+:li. :hp1.SizeOf(class):ehp1. will return the same as :hp1.SizeOf(Pointer):ehp1.,
+since a class is but a pointer to an object. To get the size of the class
+instance data, use the :hp1.TObject.InstanceSize:ehp1. method.
+:eul.
+:ent.
+
+
+
+:h3.Methods
+:p.
+:ul.
+:li.:link refid='class_declaration' reftype='hd'.Declaration:elink.
+:li.:link refid='class_invocation' reftype='hd'.Invocation:elink.
+:li.:link refid='class_virtual_methods' reftype='hd'.Virtual methods:elink.
+:li.:link refid='class_class_methods' reftype='hd'.Class methods:elink.
+:li.:link refid='class_message_methods' reftype='hd'.Message methods:elink.
+:li.:link refid='class_using_inherited' reftype='hd'.Using inherited:elink.
+:eul.
+
+
+:h4 name='class_declaration'.Declaration
+:p.
+Declaration of methods in classes follows the same rules as method
+declarations in objects:
+
+:cgraphic.
+┌──────────────────────────────────────────────────────────────────────────────â”
+:hp2.Methods:ehp2.
+
+&ra.&ra.─── method definition ─┬─ function header ─┬─ ; ── method directives ─────────────────&ra.&la.
+ ├─ procedure header ─┤
+ ├─ constructor header ─┤
+ └─ destructor header ─┘
+
+&ra.&ra.─── method directives ──┬──────────────────────────────────┬┬──────────────────────┬─────&ra.&la.
+ ├─ :hp2.virtual:ehp2. ─ ; ─┬─────────────────┬┘└─ call modifiers ─ ; ─┘
+ │ └─ :hp2.abstract:ehp2. ─ ; ──┤
+ ├──────── :hp2.reintroduce:ehp2. ─ ; ────────┤
+ └─ :hp2.message:ehp2. ─ constant expression ─┘
+
+└──────────────────────────────────────────────────────────────────────────────┘
+:ecgraphic.
+
+
+:h4 name='class_invocation'.Invocation
+:p.
+Method invocation for classes is no different than for objects. The
+following is a valid method invocation:
+
+:xmp.
+var
+ AnObject: TAnObject;
+begin
+ AnObject := TAnObject.Create;
+ AnObject.AMethod;
+:exmp.
+
+
+
+:h4 name='class_virtual_methods'.Virtual methods
+:p.
+Classes have virtual methods, just as objects do. There is however a
+difference between the two. For objects, it is sufficient to redeclare the
+same method in a descendent object with the keyword :hp1.virtual:ehp1. to
+override it. For classes, the situation is different: virtual methods
+:hp2.must:ehp2. be overridden with the :hp1.override:ehp1. keyword. Failing to do so,
+will start a :hp2.new:ehp2. batch of virtual methods, hiding the previous
+one. The :hp1.Inherited:ehp1. keyword will not jump to the inherited method, if
+:hp1.Virtual:ehp1. was used.
+
+:p.
+The following code is :hp2.wrong:ehp2.:
+
+:xmp.
+type
+ TObjParent = class
+ procedure MyProc; virtual;
+ end;
+
+ ObjChild = class(TObjParent)
+ procedure MyProc; virtual;
+ end;
+:exmp.
+
+:p.
+The compiler will produce a warning:
+
+:xmp.
+Warning: An inherited method is hidden by OBJCHILD.MYPROC
+:exmp.
+
+:p.
+The compiler will compile it, but using :hp1.Inherited:ehp1. can
+produce strange effects.
+
+:p.
+The correct declaration is as follows:
+
+:xmp.
+type
+ TObjParent = class
+ procedure MyProc; virtual;
+ end;
+
+ TObjChild = Class(TObjParent)
+ procedure MyProc; override;
+ end;
+:exmp.
+
+:p.
+This will compile and run without warnings or errors.
+
+:p.
+If the virtual method should really be replaced with a method with the
+same name, then the :hp1.reintroduce:ehp1. keyword can be used:
+
+:xmp.
+type
+ TObjParent = class
+ procedure MyProc; virtual;
+ end;
+
+ TObjChild = Class(TObjParent)
+ procedure MyProc; reintroduce;
+ end;
+:exmp.
+
+:p.
+This new method is no longer virtual.
+
+:p.
+To be able to do this, the compiler keeps - per class type - a table with
+virtual methods: the VMT (Virtual Method Table). This is simply a table
+with pointers to each of the virtual methods: each virtual method has its
+fixed location in this table (an index). The compiler uses this table to
+look up the actual method that must be used at runtime. When a descendent object
+overrides a method, the entry of the parent method is overwritten in the
+VMT. More information about the VMT can be found in the &progref..
+
+:nt.
+The keyword 'virtual' can be replaced with the 'dynamic' keyword: dynamic
+methods behave the same as virtual methods. Unlike in &delphi., in &fpc. the
+implementation of dynamic methods is equal to the implementation of virtual
+methods.
+:ent.
+
+
+
+:h4 name='class_class_methods'.Class methods
+:p.
+Class methods are identified by the keyword :hp1.Class:ehp1. in front of the
+procedure or function declaration, as in the following example:
+
+:xmp.
+ class function ClassName: string;
+:exmp.
+
+:p.
+Class methods are methods that do not have an instance (i.e. Self does not
+point to a class instance) but which follow the scoping and inheritance
+rules of a class. They can be used to return information about the current
+class, for instance for registration or use in a class factory. Since no
+instance is available, no information available in instances can be used.
+
+:p.
+Class methods can be called from inside a regular method, but can also be called
+using a class identifier:
+
+:xmp.
+var
+ AClass: TClass;
+begin
+ ...
+ if CompareText(AClass.ClassName,'TCOMPONENT')=0 then
+ ...
+:exmp.
+
+:p.
+But calling them from an instance is also possible:
+
+:xmp.
+var
+ MyClass: TObject;
+begin
+ ...
+ MyClass := TObject.Create;
+ if CompareText(MyClass.ClassName, 'TCOMPONENT')=0 then
+ ...
+:exmp.
+
+:p.
+The reverse is not possible: Inside a class method, the Self identifier
+points to the VMT table of the class. No fields, properties or
+regular methods are available inside a class method. Accessing a regular
+property or method will result in a compiler error.
+
+:p.
+Note that class methods can be virtual, and can be overridden.
+
+:p.
+Class methods cannot be used as read or write specifiers for a
+property.
+
+
+
+:h4 name='class_message_methods'.Message methods
+:p.
+New in classes are :hp1.message:ehp1. methods. Pointers to message methods are
+stored in a special table, together with the integer or string constant that
+they were declared with. They are primarily intended to ease programming of
+callback functions in several GUI toolkits, such as Win32 or
+GTK. In difference with &delphi., &fpc. also accepts strings as message
+identifiers. Message methods are always virtual.
+
+:p.
+As can be seen in the class declaration diagram, message methods are
+declared with a :hp1.message:ehp1. keyword, followed by an integer constant
+expression.
+
+:p.
+Additionally, they can take only one var argument (typed or not):
+
+:xmp.
+ procedure TMyObject.MyHandler(var Msg); message 1;
+:exmp.
+
+:p.
+The method implementation of a message function is not different from an
+ordinary method. It is also possible to call a message method directly,
+but this should not be done. Instead, the TObject.Dispatch method
+should be used. Message methods are automatically virtual,
+i.e. they can be overridden in descendent classes.
+
+:p.
+The TObject.Dispatch method can be used to call a message handler.
+It is declared in the :hp1.System:ehp1. unit and will accept a var
+parameter which must have at the first position a cardinal with the
+message ID that should be called. For example:
+
+:xmp.
+type
+ TMsg = record
+ MsgID: Cardinal;
+ Data: Pointer;
+ end;
+
+var
+ Msg: TMSg;
+begin
+ ...
+ MyObject.Dispatch(Msg);
+:exmp.
+
+:p.
+In this example, the Dispatch() method will look at the object and all
+its ancestors (starting at the object, and searching up the inheritance
+class tree), to see if a message method with message :hp1.MsgID:ehp1. has been
+declared. If such a method is found, it is called, and passed the
+Msg parameter.
+
+:p.
+If no such method is found, :hp1.DefaultHandlerStr():ehp1. is called.
+DefaultHandlerStr() is a virtual method of TObject that doesn't do
+anything, but which can be overridden to provide any processing that might be
+needed. DefaultHandlerStr() is declared as follows:
+
+:xmp.
+ procedure DefaultHandlerStr(var message); virtual;
+:exmp.
+
+:p.
+In addition to this mechanism, a string message method accepts a :hp1.self:ehp1.
+parameter:
+
+:xmp.
+ procedure StrMsgHandler(Data: Pointer; Self: TMyObject); Message 'OnClick';
+:exmp.
+
+:p.
+When encountering such a method, the compiler will generate code that loads
+the :hp1.Self:ehp1. parameter into the object instance pointer. The result of
+this is that it is possible to pass Self as a parameter to such a
+method.
+
+:nt.
+The type of the :hp1.Self:ehp1. parameter must be of the same class
+as the class the method is defined in.
+:ent.
+
+
+
+:h4 name='class_using_inherited'.Using inherited
+:p.
+In an overridden virtual method, it is often necessary to call the parent
+class' implementation of the virtual method. This can be done with the
+:hp1.inherited:ehp1. keyword. Likewise, the :hp1.inherited:ehp1. keyword can be used
+to call any method of the parent class.
+
+:p.
+The first case is the simplest:
+
+:xmp.
+type
+ TMyClass = class(TComponent)
+ constructor Create(AOwner: TComponent); override;
+ end;
+
+constructor TMyClass.Create(AOwner: TComponent);
+begin
+ inherited;
+ // Do more things
+end;
+:exmp.
+
+:p.
+In the above example, the :hp1.Inherited:ehp1. statement will call Create()
+of TComponent, passing it AOwner as a parameter: the same
+parameters that were passed to the current method will be passed to the
+parent's method. They must not be specified again: if none are specified,
+the compiler will pass the same arguments as the ones received.
+
+:p.
+The second case is slightly more complicated:
+
+:xmp.
+type
+ TMyClass = class(TComponent)
+ constructor Create(AOwner: TComponent); override;
+ constructor CreateNew(AOwner: TComponent; DoExtra: Boolean);
+ end;
+
+constructor TMyClass.Create(AOwner: TComponent);
+begin
+ inherited;
+end;
+
+constructor TMyClass.CreateNew(AOwner: TComponent; DoExtra: Boolean);
+begin
+ inherited Create(AOwner);
+ // Do stuff
+end;
+:exmp.
+
+:p.
+The CreateNew() method will first call TComponent.Create() and
+will pass it AOwner as a parameter. It will not call
+TMyClass.Create().
+
+:p.
+Although the examples were given using constructors, the use of
+Inherited is not restricted to constructors, it can be used
+for any procedure or function or destructor as well.
+
+
+
+:h3.Properties
+:p.
+:ul.
+:li.:link refid='class_prop_definition' reftype='hd'.Definition:elink.
+:li.:link refid='class_indexed props' reftype='hd'.Indexed properties:elink.
+:li.:link refid='class_array props' reftype='hd'.Array properties:elink.
+:li.:link refid='class_default props' reftype='hd'.Default properties:elink.
+:li.:link refid='class_storage information' reftype='hd'.Storage information:elink.
+:li.:link refid='class_overriding props' reftype='hd'.Overriding properties:elink.
+:eul.
+
+
+
+
+
+:h4 name='class_prop_definition'.Definition
+:p.
+Classes can contain properties as part of their fields list. A property
+acts like a normal field, i.e. its value can be retrieved or set, but it
+allows to redirect the access of the field through functions and
+procedures. They provide a means to associate an action with an assignment
+of, or a reading from a class 'field'. This allows for e.g. checking that a
+value is valid when assigning, or, when reading, it allows to construct the
+value on the fly. Moreover, properties can be read-only or write only.
+The prototype declaration of a property is as follows:
+
+:cgraphic.
+┌──────────────────────────────────────────────────────────────────────────────â”
+:hp2.Properties:ehp2.
+
+&ra.&ra.─── property definition ── :hp2.property:ehp2. ── identifier ─┬──────────────────────┬───&ra.
+ └─ property interface ─┘
+
+&ra.──── property specifier ── hint directive ─────────────────────────────────────&ra.&la.
+
+&ra.&ra.─── property interface ─┬───────────────────────────┬─ : ── type identifier ──&ra.
+ └─ property parameter list ─┘
+
+&ra.─────┬─────────────────────────────┬───────────────────────────────────────────&ra.&la.
+ └─ :hp2.index:ehp2. ── integer constant ─┘
+
+&ra.&ra.─── property parameter list ── [ ── parameter declaration ─┬──────────────────&ra.&la.
+ ^───────── ; ────────────┘
+
+&ra.&ra.─── property specifiers ──┬──────────────────┬─┬────────────────────────┬─────&ra.
+ └─ read specifier ─┘ ├─── write specifier ────┤
+ └─ implements specifier ─┘
+
+&ra.─────┬─────────────────────┬┬────────────────────┬─────────────────────────────&ra.
+ └─ default specifier ─┘└─ stored specifier ─┘
+
+&ra.─────┬────────────────────────────────────┬────────────────────────────────────&ra.&la.
+ └─ default array property specifier ─┘
+
+&ra.&ra.──── read specifier ── :hp2.read:ehp2. ── field or method ───────────────────────────────&ra.&la.
+
+&ra.&ra.──── write specifier ── :hp2.write:ehp2. ── field or method ─────────────────────────────&ra.&la.
+
+&ra.&ra.──── implements specifier ── :hp2.implements:ehp2. ── identifier ────────────────────────&ra.&la.
+
+&ra.&ra.──── default specifier ─┬─ :hp2.default:ehp2. ─┬────────────┬┬───────────────────────────&ra.&la.
+ │ └─ constant ─┘│
+ └───── :hp2.nodefault:ehp2. ─────────┘
+
+&ra.&ra.──── stored specifier ── :hp2.stored:ehp2. ─┬─ constant ───┬─────────────────────────────&ra.&la.
+ └─ identifier ─┘
+
+&ra.&ra.──── field or method ──┬─ field identifier ──┬────────────────────────────────&ra.&la.
+ └─ method identifier ─┘
+
+&ra.&ra.──── default array property specifier ── ; ── :hp2.default:ehp2. ────────────────────────&ra.&la.
+
+└──────────────────────────────────────────────────────────────────────────────┘
+:ecgraphic.
+
+:p.
+A :hp1.read specifier:ehp1. is either the name of a field that contains the property, or the name of a
+method function that has the same return type as the property type. In the case of a simple type, this
+function must not accept an argument. In case of an array property, the function must accept a single
+argument of the same type as the index. In case of an indexed property, it must accept a integer as an
+argument.
+
+:p.
+A :hp1.read specifier:ehp1. is optional, making the property write-only. Note that class methods cannot
+be used as read specifiers.
+
+:p.
+A :hp1.write specifier:ehp1. is optional: If there is no :hp1.write specifier:ehp1., the property is read-only.
+A write specifier is either the name of a field, or the name of a method procedure that accepts as a sole
+argument a variable of the same type as the property. In case of an array property, the procedure must
+accept 2 arguments: the first argument must have the same type as the index, the second argument
+must be of the same type as the property. Similarly, in case of an indexed property, the first parameter
+must be an integer.
+
+:p.
+The section (private, published) in which the specified function or procedure resides is irrelevant.
+Usually, however, this will be a protected or private method.
+
+:p.
+For example, given the following declaration:
+
+:xmp.
+type
+ MyClass = class
+ private
+ Field1: Longint;
+ Field2: Longint;
+ Field3: Longint;
+ procedure Sety(AValue: Longint);
+ function Gety: Longint;
+ function Getz: Longint;
+ public
+ property X: Longint read Field1 write Field2;
+ property Y: Longint read GetY write Sety;
+ property Z: Longint read GetZ;
+ end;
+
+var
+ MyClass: TMyClass;
+:exmp.
+
+:p.
+The following are valid statements:
+
+:xmp.
+WriteLn ('X : ', MyClass.X);
+WriteLn ('Y : ', MyClass.Y);
+WriteLn ('Z : ', MyClass.Z);
+MyClass.X := 0;
+MyClass.Y := 0;
+:exmp.
+
+:p.
+But the following would generate an error:
+
+:xmp.
+MyClass.Z := 0;
+:exmp.
+
+:p.
+because Z is a read-only property.
+
+:p.
+What happens in the above statements is that when a value needs to be read,
+the compiler inserts a call to the various :hp1.getNNN:ehp1. methods of the
+object, and the result of this call is used. When an assignment is made,
+the compiler passes the value that must be assigned as a paramater to
+the various :hp1.setNNN:ehp1. methods.
+
+:p.
+Because of this mechanism, properties cannot be passed as var arguments to a
+function or procedure, since there is no known address of the property (at
+least, not always).
+
+
+:h4 name='class_indexed props'.Indexed properties
+:p.
+If the property definition contains an index, then the read and write specifiers must be a function and
+a procedure. Moreover, these functions require an additional parameter: An integer parameter. This
+allows to read or write several properties with the same function. For this, the properties must have
+the same type. The following is an example of a property with an index:
+
+:xmp.
+{$mode objfpc}
+type
+ TPoint = class(TObject)
+ private
+ FX: Longint;
+ FY: Longint;
+ function GetCoord(Index: Integer): Longint;
+ procedure SetCoord(Index: Integer; Value: Longint);
+ public
+ property X: Longint index 1 read GetCoord write SetCoord;
+ property Y: Longint index 2 read GetCoord write SetCoord;
+ property Coords[Index: Integer]: Longint read GetCoord;
+ end;
+
+procedure TPoint.SetCoord(Index: Integer; Value: Longint);
+begin
+ case Index of
+ 1 : FX := Value;
+ 2 : FY := Value;
+ end;
+end;
+
+function TPoint.GetCoord(Index: Integer): Longint;
+begin
+ case Index of
+ 1 : Result := FX;
+ 2 : Result := FY;
+ end;
+end;
+
+var
+ P: TPoint;
+
+begin
+ P := TPoint.Create;
+ P.X := 2;
+ P.Y := 3;
+ with P do
+ WriteLn('X=', X, ' Y=', Y);
+end.
+:exmp.
+
+:p.
+When the compiler encounters an assignment to X, then :hp1.SetCoord:ehp1. is called with as first parameter
+the index (1 in the above case) and with as a second parameter the value to be set. Conversely, when
+reading the value of X, the compiler calls :hp1.GetCoord:ehp1. and passes it index 1. Indexes can only be
+integer values.
+
+
+:h4 name='class_array props'.Array properties
+:p.
+Array properties also exist. These are properties that accept an
+index, just as an array does. Only now the index doesn't have to be an
+ordinal type, but can be any type.
+
+:p.
+A :hp1.read specifier:ehp1. for an array property is the name method function
+that has the same return type as the property type.
+The function must accept as a sole arguent a variable of the same type as
+the index type. For an array property, one cannot specify fields as :hp1.read
+specifiers:ehp1..
+
+:p.
+A :hp1.write specifier:ehp1. for an array property is the name of a method
+procedure that accepts two arguments: The first argument has the same
+type as the index, and the second argument is a parameter of the same
+type as the property type. As an example, see the following declaration:
+
+:xmp.
+type
+ TIntList = class
+ private
+ Function GetInt(I: Longint): Longint;
+ Function GetAsString(A: String): String;
+ Procedure SetInt(I: Longint; Value: Longint;);
+ Procedure SetAsString(A: String; Value: String);
+ public
+ property Items[i: Longint]: Longint read GetInt write SetInt;
+ property StrItems[S: String]: String read GetAsString write SetAsstring;
+ end;
+
+var
+ AIntList: TIntList;
+:exmp.
+
+:p.
+Then the following statements would be valid:
+
+:xmp.
+AIntList.Items[26] := 1;
+AIntList.StrItems['twenty-five'] := 'zero';
+WriteLn('Item 26 : ', AIntList.Items[26]);
+WriteLn('Item 25 : ', AIntList.StrItems['twenty-five']);
+:exmp.
+
+:p.
+While the following statements would generate errors:
+
+:xmp.
+AIntList.Items['twenty-five'] := 1;
+AIntList.StrItems[26] := 'zero';
+:exmp.
+
+:p.
+Because the index types are wrong.
+
+
+:h4 name='class_default props'.Default properties
+:p.
+Array properties can be declared as :hp1.default:ehp1. properties. This means that
+it is not necessary to specify the property name when assigning or reading
+it. In the previous example, if the definition of the items property would
+have been
+
+:xmp.
+property Items[i: Longint]: Longint read GetInt write SetInt; default;
+:exmp.
+
+:p.
+Then the assignment
+
+:xmp.
+AIntList.Items[26] := 1;
+:exmp.
+
+:p.
+Would be equivalent to the following abbreviation.
+
+:xmp.
+AIntList[26] := 1;
+:exmp.
+
+:p.
+Only one default property per class is allowed, and descendent classes
+cannot redeclare the default property.
+
+
+
+:h4 name='class_storage information'.Storage information
+:p.
+The :hp1.stored specifier:ehp1. should be either a boolean constant, a boolean
+field of the class, or a parameterless function which returns a boolean
+result. This specifier has no result on the class behaviour. It is an aid
+for the streaming system: the stored specifier is specified in the RTTI
+generated for a class (it can only be streamed if RTTI is generated),
+and is used to determine whether a property should be streamed or not:
+it saves space in a stream. It is not possible to specify the 'Stored'
+directive for array properties.
+
+:p.
+The :hp1.default specifier:ehp1. can be specified for ordinal types and sets.
+It serves the same purpose as the :hp1.stored specifier:ehp1.: Properties that
+have as value their default value, will not be written to the stream by the
+streaming system. The default value is stored in the RTTI that is generated
+for the class. Note that
+
+:ol.
+:li.When the class is instantiated, the default value is not automatically
+applied to the property, it is the responsability of the programmer to do
+this in the constructor of the class.
+:li.The value 2147483648 cannot be used as a default value, as it is used
+internally to denote 'nodefault'.
+:li.It is not possible to specify a default for array properties.
+:eol.
+
+
+:h4 name='class_overriding props'.Overriding properties
+:p.
+aoeu
+.* START HERE !!!!!!!!!!!!!!!!!!!!!!
+
+
+.* ==============================================================
+:h2 name=interfaces.Interfaces
+:p.aa
+
+.* ==============================================================
+:h2 name=generics.Generics
+:p.aa
+
+.* ==============================================================
+:h2 name=expressions.Expressions
+:p.aa
+:h3 name=expression_syntax.Expression syntax
+:p.aa
+:h3 name=function_calls.Function calls
+:p.aa
+:h3 name=set_constructors.Set constructors
+:p.aa
+:h3 name=value_typecasts.Value typecasts
+:p.aa
+:h3 name=varibale_typecasts.Variable typecasts
+:p.aa
+:h3 name=unaligned_typecasts.Unaligned typecasts
+:p.aa
+:h3 name=the_at_operator.The @ operator
+:p.aa
+:h3 name=operators.Operators
+:p.aa
+:h4 name=arithmetic_operators.Arithmetic operators
+:p.aa
+:h4 name=logical_operators.Logical operators
+:p.aa
+:h4 name=boolean_operators.Boolean operators
+:p.aa
+:h4 name=string_operators.String operators
+:p.aa
+:h4 name=set_operators.Set operators
+:p.aa
+:h4 name=relational_operators.Relational operators
+:p.aa
+:h4 name=class_operators.Class operators
+:p.aa
+
+.* ==============================================================
+:h2 name=statements.Statements
+:p.aa
+:h3 name=statements_simple.Simple Statements
+:p.aa
+:h3 name=statements_structured.Structured Statements
+:p.aa
+:h4 name=statements_structured_with.The With Statement
+:p.aa
+
+.* ==============================================================
+:h2 name=functions.Using functions and procedures
+:p.aa
+:h3 name=procedure_declarations.Procedure declarations
+:p.aa
+:h3 name=function-declarations.Function declarations
+:p.aa
+
+.* ==============================================================
+:h2 name=operator_overloading.Operator overloading
+:p.aa
+
+
+
+
+
+.* ==============================================================
+:h2 name=programs_units_blocks.Programs&comma. units and blocks
+:p.A Pascal program can consist of modules called :hp1.units:ehp1.. A unit can be used
+to group pieces of code together, or to give someone code without giving
+the sources.
+Both programs and units consist of code blocks, which are mixtures of
+statements, procedures, and variable or type declarations.
+
+.* --------------------------------------------------------------
+:h3.Programs
+:p.A Pascal program consists of the program header, followed possibly by a
+'uses' clause, and a block.
+
+:xmp.
+ [diagram goes here]
+:exmp.
+
+:p.
+The program header is provided for backwards compatibility, and is ignored
+by the compiler.
+
+:p.
+The uses clause serves to identify all units that are needed by the program.
+All identifiers which are declared in the the interface section of the units
+in the uses clause are added to the known identifiers of the program.
+The system unit doesn't have to be in this list, since it is always loaded
+by the compiler.
+
+:p.
+The order in which the units appear is significant, it determines in
+which order they are initialized. Units are initialized in the same order
+as they appear in the uses clause. Identifiers are searched in the opposite
+order, i.e. when the compiler searches for an identifier, then it looks
+first in the last unit in the uses clause, then the last but one, and so on.
+This is important in case two units declare different types with the same
+identifier.
+
+:p.
+When the compiler looks for unit files, it adds the extension :hp1..ppu:ehp1.
+to the name of the unit. On &linux. and in operating systems where filenames
+are case sensitive when looking for a unit, the following mechanism is
+used:
+
+:ol.
+:li.The unit is first looked for in the original case.
+:li.The unit is looked for in all-lowercase letters.
+:li.The unit is looked for in all-uppercase letters.
+:eol.
+
+:p.
+Additionally, If a unit name is longer than 8 characters, the compiler
+will first look for a unit name with this length, and then it will
+truncate the name to 8 characters and look for it again.
+For compatibility reasons, this is also true on platforms that
+support long file names.
+
+:p.
+Note that the above search is performed in each directory in the search
+path.
+
+:p.
+The program block contains the statements that will be executed when the
+program is started. Note that these statements need not necessarily be the
+first statements that are executed: the initialization code of the units
+may also contain statements that are executed prior to the program code.
+
+:p.
+The structure of a program block is discussed below.
+
+.* --------------------------------------------------------------
+:h3.Units
+:p.A unit contains a set of declarations, procedures and functions that can be
+used by a program or another unit. The syntax for a unit is as follows:
+
+:cgraphic.
+┌──────────────────────────────────────────────────────────────────────────────â”
+:hp2.Units:ehp2.
+
+&ra.&ra.─── unit ── unit header ── interface part ── implementation part ────────────&ra.
+
+&ra.─────┬────────────────────────────────────────────┬─ :hp2.end:ehp2. ── . ─────────────────&ra.&la.
+ ├─ initialization part ─┬───────────────────┬┤
+ │ └ finalization part ┘│
+ └─ :hp2.begin:ehp2. ─── statement ─┬───────────────────┘
+ ^───── ; ─────┘
+
+&ra.&ra.─── unit header ── :hp2.unit:ehp2. ── unit identifier ── ; ──────────────────────────────&ra.&la.
+
+&ra.&ra.─── interface part ── :hp2.interface:ehp2. ─┬───────────────┬┬┬─────────────────────────────┬┬──&ra.&la.
+ └─ uses clause ─┘│├─ constant declaration part ─┤│
+ │├─ type declatation part ─┤│
+ │└─ procedure headers part ─┘│
+ ^───────────────────────────────┘
+
+&ra.&ra.─── procedure headers part ─┬─ procedure header ─┬─ ; ─┬───────────────────────┬─────&ra.&la.
+ └─ function header ─┘ └─ call modifiers ── ; ─┘
+
+&ra.&ra.─── implementation part ── :hp2.implementation:ehp2. ─┬───────────────┬─ declaration part ──────&ra.&la.
+ ^─ uses clause ─┘
+
+&ra.&ra.─── initialization part ── :hp2.initialization:ehp2. ─┬─ statement ─┬────────────────────&ra.&la.
+ ^───── ; ─────┘
+
+&ra.&ra.─── finalization part ── :hp2.finalization:ehp2. ─┬─ statement ─┬────────────────────────&ra.&la.
+ ^───── ; ─────┘
+
+└──────────────────────────────────────────────────────────────────────────────┘
+:ecgraphic.
+
+:p.
+As can be seen from the syntax diagram, a unit always consists of a
+interface and an implementation part. Optionally, there is an initialization
+block and a finalization block, containing code that will be executed when
+the program is started, and when the program stops, respectively.
+
+:p.
+Both the interface part or implementation part can be empty, but the
+keywords :hp1.Interface:ehp1. and :hp1.implementation:ehp1. must be specified.
+The following is a completely valid unit:
+
+:xmp.
+unit a;
+
+interface
+
+implementation
+
+end.
+:exmp.
+
+:p.
+The interface part declares all identifiers that must be exported from the
+unit. This can be constant, type or variable identifiers, and also procedure
+or function identifier declarations. The interface part cannot contain code
+that is executed: only declarations are allowed. The following is a valid
+interface part:
+
+:xmp.
+unit a;
+
+interface
+
+uses b;
+
+function MyFunction: SomeBType;
+
+implementation
+:exmp.
+
+:p.
+The type :hp1.SomeBType:ehp1. is defined in unit :hp1.b:ehp1..
+
+:p.
+All functions and methods that are declared in the interface part must
+be implemented in the implementation part of the unit, except for
+declarations of external functions or procedures. If a declared method
+or function is not implemented in the implementation part, the compiler
+will give an error, for example the following:
+
+:xmp.
+unit unita;
+
+interface
+
+function MyFunction: Integer;
+
+implementation
+
+end.
+:exmp.
+
+:p.
+Will result in the following error:
+
+:xmp.
+unita.pp(5,10) Error: Forward declaration not solved "MyFunction&colon.SmallInt;"
+:exmp.
+
+:p.
+The implementation part is primarily intended for the implementation of the
+functions and procedures declared in the interface part. However, it can
+also contain declarations of it's own: The declarations inside the
+implementation part are :hp2.not:ehp2. accessible outside the unit.
+
+:p.
+The initialization and finalization part of a unit are optional:
+
+:p.
+The initialization block is used to initialize certain variables or
+execute code that is necessary for the correct functioning of the unit.
+The initialization parts of the units
+are executed in the order that the compiler loaded the units when compiling
+a program. They are executed before the first statement of the program is
+executed.
+
+:p.
+The finalization part of the units are executed in the reverse order of the
+initialization execution. They are used for instance to clean up any resources
+allocated in the initialization part of the unit, or during the lifetime of
+the program. The finalization part is always executed in the case of a
+normal program termination: whether it is because the final :hp1.end:ehp1. is
+reached in the program code or because a :hp1.Halt:ehp1. instruction was executed
+somewhere.
+
+:p.
+In case the program stops during the execution of the initialization blocks
+of one of the units, only the units that were already initialized will be
+finalized. Note that if a :hp1.finalization:ehp1. block is present, an
+:hp1.initialization:ehp1. block must be present, but it can be empty:
+
+:xmp.
+initialization
+
+finalization
+ CleanupUnit;
+end.
+:exmp.
+
+:p.
+An initialization section by itself (i.e. without finalization) may simply be
+replaced by a statement block. That is, the following:
+
+:xmp.
+initialization
+ InitializeUnit;
+end.
+:exmp.
+
+:p.
+is completely equivalent to
+
+:xmp.
+begin
+ InitializeUnit;
+end.
+:exmp.
+
+.* --------------------------------------------------------------
+:h3.Unit dependencies
+:p.aa
+
+
+
+
+
+.* ==============================================================
+:h2 name=exceptions.Exceptions
+:p.aa
+
+.* ==============================================================
+:h2 name=assembler.Using assembler
+:p.
+&fpc. supports the use of assembler in code, but not inline
+assembler macros. To have more information on the processor
+specific assembler syntax and its limitations, see the &progref..
+
+.* --------------------------------------------------------------
+:h3.Assembler statements
+The following is an example of assembler inclusion in Pascal code.
+
+:xmp.
+ ...
+ Statements;
+ ...
+ Asm
+ the asm code here
+ ...
+ end;
+ ...
+ Statements;
+:exmp.
+
+:p.
+The assembler instructions between the :hp1.Asm:ehp1. and :hp1.end:ehp1. keywords will
+be inserted in the assembler generated by the compiler.
+Conditionals can be used in assembler code, the compiler will recognise them,
+and treat them as any other conditionals.
+
+.* --------------------------------------------------------------
+:h3.Assembler procedures and functions
+:p.
+Assembler procedures and functions are declared using the
+:hp1.Assembler:ehp1. directive. This permits the code generator to make a number
+of code generation optimizations.
+
+:p.
+The code generator does not generate any stack frame (entry and exit
+code for the routine) if it contains no local variables and no
+parameters. In the case of functions, ordinal values must be returned
+in the accumulator. In the case of floating point values, these depend
+on the target processor and emulation options.
+
+:h2.Object Pascal Grammar
+:p.This section describes the Object Pascal grammar in a EBNF
+(Extended Backus–Naur Form) like style. The syntax only covers the
+:hp1.ObjFPC:ehp1. mode of the &fpc. compiler.
+
+:cgraphic.
+Goal -> (Program | Package | Library | Unit)
+Program -> [PROGRAM Ident ['(' IdentList ')'] ';']
+ ProgramBlock '.'
+Unit -> UNIT Ident [HintDirective] ';'
+ InterfaceSection
+ ImplementationSection
+ InitSection '.'
+Package -> PACKAGE Ident ';'
+ [RequiresClause]
+ [ContainsClause]
+ END '.'
+Library -> LIBRARY Ident ';'
+ ProgramBlock '.'
+ProgramBlock -> [UsesClause]
+ Block
+UsesClause -> USES IdentList ';'
+HintDirective -> deprecated [String]
+ -> experimental
+ -> library
+ -> platform
+ -> unimplemented
+InterfaceSection -> INTERFACE
+ [UsesClause]
+ [InterfaceDecl]...
+InterfaceDecl -> ConstSection
+ -> TypeSection
+ -> VarSection
+ -> ExportedHeading
+ExportedHeading -> ProcedureHeading ';' [Directive]
+ -> FunctionHeading ';' [Directive]
+ImplementationSection -> IMPLEMENTATION
+ [UsesClause]
+ [DeclSection]...
+ [ExportsStmt]...
+Block -> [DeclSection]
+ [ExportsStmt]...
+ CompoundStmt
+ [ExportsStmt]...
+ExportsStmt -> EXPORTS ExportsItem [, ExportsItem]...
+ExportsItem -> Ident [NAME|INDEX "'" ConstExpr "'"]
+ [INDEX|NAME "'" ConstExpr "'"]
+DeclSection -> LabelDeclSection
+ -> ConstSection
+ -> TypeSection
+ -> VarSection
+ -> ProcedureDeclSection
+LabelDeclSection -> LABEL LabelId
+ConstSection -> CONST (ConstantDecl ';')...
+ConstantDecl -> Ident '=' ConstExpr [HintDirective]
+ -> Ident ':' TypeId '=' TypedConstant [HintDirective]
+TypeSection -> TYPE (TypeDecl ';')
+TypeDecl -> Ident '=' [TYPE] Type [HintDirective]
+ -> Ident '=' [TYPE] RestrictedType [HintDirective]
+TypedConstant -> (ConstExpr | ArrayConstant | RecordConstant)
+ArrayConstant -> '(' TypedConstant ',' ')'
+RecordConstant -> '(' RecordFieldConstant ';'... ')'
+RecordFieldConstant -> Ident ':' TypedConstant
+Type -> TypeId
+ -> SimpleType
+ -> StrucType
+ -> PointerType
+ -> StringType
+ -> ProcedureType
+ -> VariantType
+ -> ClassRefType
+RestrictedType -> ObjectType
+ -> ClassType
+ -> InterfaceType
+ClassRefType -> CLASS OF TypeId
+SimpleType -> (OrdinalType | RealType)
+RealType -> REAL48
+ -> REAL
+ -> SINGLE
+ -> DOUBLE
+ -> EXTENDED
+ -> CURRENCY
+ -> COMP
+OrdinalType -> (SubrangeType | EnumeratedType | OrdIdent)
+OrdIdent -> SHORTINT
+ -> SMALLINT
+ -> INTEGER
+ -> BYTE
+ -> LONGINT
+ -> INT64
+ -> WORD
+ -> BOOLEAN
+ -> CHAR
+ -> WIDECHAR
+ -> LONGWORD
+ -> PCHAR
+VariantType -> VARIANT
+ -> OLEVARIANT
+SubrangeType -> ConstExpr '..' ConstExpr
+EnumeratedType -> '(' EnumeratedTypeElement ','... ')'
+EnumeratedTypeElement -> Ident [ '=' ConstExpr ]
+StringType -> STRING
+ -> ANSISTRING
+ -> WIDESTRING
+ -> STRING '[' ConstExpr ']'
+ -> UNICODESTRING
+StrucType -> [PACKED] (ArrayType | SetType | FileType | RecType [PACKED])
+ArrayType -> ARRAY ['[' OrdinalType ','... ']'] OF Type [HintDirective]
+RecType -> RECORD [FieldList] END [HintDirective]
+FieldList -> FieldDecl ';'... [VariantSection] [';']
+FieldDecl -> IdentList ':' Type [HintDirective]
+VariantSection -> CASE [Ident ':'] TypeId OF RecVariant ';'...
+RecVariant -> ConstExpr ','... ':' '(' [FieldList] ')'
+SetType -> SET OF OrdinalType [HintDirective]
+FileType -> FILE OF TypeId [HintDirective]
+PointerType -> '^' TypeId [HintDirective]
+ProcedureType -> (ProcedureHeading | FunctionHeading) [OF OBJECT]
+VarSection -> VAR (VarDecl ';')...
+VarDecl
+ On Windows -> IdentList ':' Type [(ABSOLUTE (Ident | ConstExpr)) | '=' ConstExpr] [HintDirective]
+ On Linux -> IdentList ':' Type [ABSOLUTE (Ident) | '=' ConstExpr] [HintDirective]
+Expression -> SimpleExpression [RelOp SimpleExpression]...
+SimpleExpression -> ['+' | '-'] Term [AddOp Term]...
+Term -> Factor [MulOp Factor]...
+Factor -> Designator ['(' ExprList ')']
+ -> '@' Designator
+ -> Number
+ -> String
+ -> NIL
+ -> '(' Expression ')'
+ -> NOT Factor
+ -> SetConstructor
+ -> TypeId '(' Expression ')'
+RelOp -> '>'
+ -> '<'
+ -> '<='
+ -> '>='
+ -> '<>'
+ -> IN
+ -> IS
+ -> AS
+AddOp -> '+'
+ -> '-'
+ -> OR
+ -> XOR
+MulOp -> '*'
+ -> '/'
+ -> DIV
+ -> MOD
+ -> AND
+ -> SHL
+ -> SHR
+Designator -> QualId ['.' Ident | '[' ExprList ']' | '^']...
+SetConstructor -> '[' [SetElement ','...] ']'
+SetElement -> Expression ['..' Expression]
+ExprList -> Expression ','...
+Statement -> [LabelId ':'] [SimpleStatement | StructStmt]
+StmtList -> Statement ';'
+SimpleStatement -> Designator ['(' [ExprList] ')']
+ -> Designator ':=' Expression
+ -> INHERITED
+ -> GOTO LabelId
+StructStmt -> CompoundStmt
+ -> ConditionalStmt
+ -> LoopStmt
+ -> WithStmt
+ -> TryExceptStmt
+ -> TryFinallyStmt
+ -> RaiseStmt
+ -> AssemblerStmt
+CompoundStmt -> BEGIN StmtList END
+ConditionalStmt -> IfStmt
+ -> CaseStmt
+IfStmt -> IF Expression THEN Statement [ELSE Statement]
+CaseStmt -> CASE Expression OF CaseSelector ';'... [ELSE StmtList] [';'] END
+CaseSelector -> CaseLabel ','... ':' Statement
+CaseLabel -> ConstExpr ['..' ConstExpr]
+LoopStmt -> RepeatStmt
+ -> WhileStmt
+ -> ForStmt
+ -> ForInStmt
+RepeatStmt -> REPEAT Statement UNTIL Expression
+WhileStmt -> WHILE Expression DO Statement
+ForStmt -> FOR QualId ':=' Expression (TO | DOWNTO) Expression DO Statement
+ForInStmt -> FOR QualId IN Expression DO Statement
+WithStmt -> WITH IdentList DO Statement
+TryExceptStmt -> TRY
+ Statement...
+ EXCEPT
+ ExceptionBlock
+ END
+ExceptionBlock -> [ON [Ident ':'] TypeID DO Statement]...
+ [ELSE Statement...]
+TryFinallyStmt -> TRY
+ Statement
+ FINALLY
+ Statement
+ END
+RaiseStmt -> RAISE [object] [AT address]
+AssemblerStatement -> ASM
+ -> <assemblylanguage>
+ -> END
+ProcedureDeclSection -> ProcedureDecl
+ -> FunctionDecl
+ProcedureDecl -> ProcedureHeading ';' [Directive] [HintDirective]
+ Block ';'
+FunctionDecl -> FunctionHeading ';' [Directive] [HintDirective]
+ Block ';'
+FunctionHeading -> FUNCTION Ident [FormalParameters] ':' (SimpleType | STRING)
+ProcedureHeading -> PROCEDURE Ident [FormalParameters]
+FormalParameters -> '(' [FormalParm ';'...] ')'
+FormalParm -> [VAR | CONST | CONSTREF | OUT] Parameter
+Parameter -> IdentList [':' ([ARRAY OF] SimpleType | STRING | FILE)]
+ -> Ident ':' SimpleType '=' ConstExpr
+Directive -> CDECL
+ -> REGISTER
+ -> DYNAMIC
+ -> VIRTUAL
+ -> EXPORT
+ -> EXTERNAL
+ -> NEAR
+ -> FAR
+ -> FORWARD
+ -> MESSAGE ConstExpr
+ -> OVERRIDE
+ -> OVERLOAD
+ -> PASCAL
+ -> REINTRODUCE
+ -> SAFECALL
+ -> STDCALL
+ -> VARARGS
+ -> LOCAL
+ -> ABSTRACT
+ObjectType -> OBJECT [ObjHeritage] [ObjFieldList] [MethodList] END
+ObjHeritage -> '(' QualId ')'
+MethodList -> (MethodHeading [';' VIRTUAL]) ';'...
+MethodHeading -> ProcedureHeading
+ -> FunctionHeading
+ -> ConstructorHeading
+ -> DestructorHeading
+ConstructorHeading -> CONSTRUCTOR Ident [FormalParameters]
+DestructorHeading -> DESTRUCTOR Ident [FormalParameters]
+ObjFieldList -> (IdentList ':' Type) ';'
+InitSection -> INITIALIZATION StmtList [FINALIZATION StmtList] END
+ -> BEGIN StmtList END
+ -> END
+ClassType -> CLASS [ClassHeritage]
+ [ClassVisibility]
+ [ClassFieldList]
+ [ClassMethodList]
+ [ClassPropertyList]
+ END
+ClassHeritage -> '(' IdentList ')'
+ClassVisibility -> [[STRICT] PRIVATE | PROTECTED | PUBLIC | PUBLISHED]
+ClassFieldList -> (ClassVisibility ObjFieldList) ';'...
+ClassMethodList -> (ClassVisibility MethodList) ';'...
+ClassPropertyList -> (ClassVisibility PropertyList ';')...
+PropertyList -> PROPERTY Ident [PropertyInterface] [PropertySpecifiers] [HintDirective]
+PropertyInterface -> [PropertyParameterList] ':' Ident
+PropertyParameterList -> '[' (IdentList ':' TypeId) ';'... ']'
+PropertySpecifiers -> [INDEX ConstExpr]
+ [READ Ident]
+ [WRITE Ident]
+ [STORED (Ident | Constant)]
+ [(DEFAULT ConstExpr) | NODEFAULT]
+ [IMPLEMENTS TypeId]
+InterfaceType -> INTERFACE [InterfaceHeritage]
+ [ClassMethodList]
+ [ClassPropertyList]
+ ...
+ END
+InterfaceHeritage -> '(' IdentList ')'
+RequiresClause -> REQUIRES IdentList... ';'
+ContainsClause -> CONTAINS IdentList... ';'
+IdentList -> Ident ','...
+QualId -> [UnitId '.'] Ident
+TypeId -> [UnitId '.'] <type-identifier>
+Ident -> <identifier>
+ConstExpr -> <constant-expression>
+UnitId -> <unit-identifier>
+LabelId -> <label-identifier>
+Number -> <number>
+String -> <string>
+
+:ecgraphic.
+
+:euserdoc.
+
diff --git a/docs/fpgui-docs-project.xml b/docs/fpgui-docs-project.xml
index cc5541af..c4758228 100644
--- a/docs/fpgui-docs-project.xml
+++ b/docs/fpgui-docs-project.xml
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
<docproject>
<packages>
<!-- Multiple packages can be entered.
@@ -34,14 +35,57 @@
<unit file="../src/corelib/fpg_translations.pas" options="-Fi../src -Fu../src/corelib/"/>
<unit file="../src/corelib/fpg_command_intf.pas" options="-Fi../src -Fu../src/corelib/"/>
- <unit file="../src/gui/fpg_button.pas" options="-Fi../src -Fu../src/gui/ -Fu../src/corelib/"/>
- <unit file="../src/gui/fpg_form.pas" options="-Fi../src -Fu../src/gui/ -Fu../src/corelib/"/>
<unit file="../src/gui/fpg_basegrid.pas" options="-Fi../src -Fu../src/gui/ -Fu../src/corelib/"/>
- <unit file="../src/gui/fpg_tree.pas" options="-Fi../src -Fu../src/gui/ -Fu../src/corelib/"/>
+ <unit file="../src/gui/fpg_button.pas" options="-Fi../src -Fu../src/gui/ -Fu../src/corelib/"/>
+ <unit file="../src/gui/fpg_colormapping.pas" options="-Fi../src -Fu../src/gui/ -Fu../src/corelib/"/>
<unit file="../src/gui/fpg_colorwheel.pas" options="-Fi../src -Fu../src/gui/ -Fu../src/corelib/"/>
<unit file="../src/gui/fpg_dialogs.pas" options="-Fi../src -Fu../src/gui/ -Fu../src/corelib/"/>
+ <unit file="../src/gui/fpg_form.pas" options="-Fi../src -Fu../src/gui/ -Fu../src/corelib/"/>
<unit file="../src/gui/fpg_hyperlink.pas" options="-Fi../src -Fu../src/gui/ -Fu../src/corelib/"/>
- <unit file="../src/gui/fpg_colormapping.pas" options="-Fi../src -Fu../src/gui/ -Fu../src/corelib/"/>
+ <unit file="../src/gui/fpg_tree.pas" options="-Fi../src -Fu../src/gui/ -Fu../src/corelib/"/>
+
+ <!-- undocumented units -->
+ <unit file="../src/gui/fpg_animation.pas" options="-Fi../src -Fu../src/gui/ -Fu../src/corelib/"/>
+ <unit file="../src/gui/fpg_checkbox.pas" options="-Fi../src -Fu../src/gui/ -Fu../src/corelib/"/>
+ <unit file="../src/gui/fpg_combobox.pas" options="-Fi../src -Fu../src/gui/ -Fu../src/corelib/"/>
+ <unit file="../src/gui/fpg_customgrid.pas" options="-Fi../src -Fu../src/gui/ -Fu../src/corelib/"/>
+ <unit file="../src/gui/fpg_edit.pas" options="-Fi../src -Fu../src/gui/ -Fu../src/corelib/"/>
+ <unit file="../src/gui/fpg_editbtn.pas" options="-Fi../src -Fu../src/gui/ -Fu../src/corelib/"/>
+ <unit file="../src/gui/fpg_editcombo.pas" options="-Fi../src -Fu../src/gui/ -Fu../src/corelib/"/>
+ <unit file="../src/gui/fpg_gauge.pas" options="-Fi../src -Fu../src/gui/ -Fu../src/corelib/"/>
+ <unit file="../src/gui/fpg_grid.pas" options="-Fi../src -Fu../src/gui/ -Fu../src/corelib/"/>
+ <unit file="../src/gui/fpg_hint.pas" options="-Fi../src -Fu../src/gui/ -Fu../src/corelib/"/>
+ <unit file="../src/gui/fpg_hyperlink.pas" options="-Fi../src -Fu../src/gui/ -Fu../src/corelib/"/>
+ <unit file="../src/gui/fpg_iniutils.pas" options="-Fi../src -Fu../src/gui/ -Fu../src/corelib/"/>
+ <unit file="../src/gui/fpg_label.pas" options="-Fi../src -Fu../src/gui/ -Fu../src/corelib/"/>
+ <unit file="../src/gui/fpg_listbox.pas" options="-Fi../src -Fu../src/gui/ -Fu../src/corelib/"/>
+ <unit file="../src/gui/fpg_listview.pas" options="-Fi../src -Fu../src/gui/ -Fu../src/corelib/"/>
+ <unit file="../src/gui/fpg_memo.pas" options="-Fi../src -Fu../src/gui/ -Fu../src/corelib/"/>
+ <unit file="../src/gui/fpg_menu.pas" options="-Fi../src -Fu../src/gui/ -Fu../src/corelib/"/>
+ <unit file="../src/gui/fpg_mru.pas" options="-Fi../src -Fu../src/gui/ -Fu../src/corelib/"/>
+ <unit file="../src/gui/fpg_panel.pas" options="-Fi../src -Fu../src/gui/ -Fu../src/corelib/"/>
+ <unit file="../src/gui/fpg_popupcalendar.pas" options="-Fi../src -Fu../src/gui/ -Fu../src/corelib/"/>
+ <unit file="../src/gui/fpg_progressbar.pas" options="-Fi../src -Fu../src/gui/ -Fu../src/corelib/"/>
+ <unit file="../src/gui/fpg_radiobutton.pas" options="-Fi../src -Fu../src/gui/ -Fu../src/corelib/"/>
+ <unit file="../src/gui/fpg_readonly.pas" options="-Fi../src -Fu../src/gui/ -Fu../src/corelib/"/>
+ <unit file="../src/gui/fpg_scrollbar.pas" options="-Fi../src -Fu../src/gui/ -Fu../src/corelib/"/>
+ <unit file="../src/gui/fpg_spinedit.pas" options="-Fi../src -Fu../src/gui/ -Fu../src/corelib/"/>
+ <unit file="../src/gui/fpg_splitter.pas" options="-Fi../src -Fu../src/gui/ -Fu../src/corelib/"/>
+ <unit file="../src/gui/fpg_style.pas" options="-Fi../src -Fu../src/gui/ -Fu../src/corelib/"/>
+ <unit file="../src/gui/fpg_style_bitmap.pas" options="-Fi../src -Fu../src/gui/ -Fu../src/corelib/"/>
+ <unit file="../src/gui/fpg_style_bluecurve.pas" options="-Fi../src -Fu../src/gui/ -Fu../src/corelib/"/>
+ <unit file="../src/gui/fpg_style_clearlooks.pas" options="-Fi../src -Fu../src/gui/ -Fu../src/corelib/"/>
+ <unit file="../src/gui/fpg_style_motif.pas" options="-Fi../src -Fu../src/gui/ -Fu../src/corelib/"/>
+ <unit file="../src/gui/fpg_style_win2k.pas" options="-Fi../src -Fu../src/gui/ -Fu../src/corelib/"/>
+ <unit file="../src/gui/fpg_stylemanager.pas" options="-Fi../src -Fu../src/gui/ -Fu../src/corelib/"/>
+ <unit file="../src/gui/fpg_tab.pas" options="-Fi../src -Fu../src/gui/ -Fu../src/corelib/"/>
+ <unit file="../src/gui/fpg_trackbar.pas" options="-Fi../src -Fu../src/gui/ -Fu../src/corelib/"/>
+ <unit file="../src/gui/fpg_trayicon.pas" options="-Fi../src -Fu../src/gui/ -Fu../src/corelib/"/>
+ <unit file="../src/reportengine/u_command.pas" options="-Fu../src/gui/reportengine/"/>
+ <unit file="../src/reportengine/u_pdf.pas" options="-Fu../src/gui/reportengine/"/>
+ <unit file="../src/reportengine/u_report.pas" options="-Fu../src/gui/reportengine/"/>
+ <unit file="../src/reportengine/u_reportimages.pas" options="-Fu../src/gui/reportengine/"/>
+ <unit file="../src/reportengine/u_visu.pas" options="-Fu../src/gui/reportengine/"/>
</units>
<descriptions>
@@ -80,6 +124,7 @@
<description file="xml/gui/fpg_tree.xml"/>
<description file="xml/gui/fpg_basegrid.xml"/>
<description file="xml/gui/fpg_form.xml"/>
+ <description file="xml/gui/fpg_grid.xml"/>
</descriptions>
</package>
</packages>
@@ -94,7 +139,7 @@
<option name="format" value="rtf"/>
<option name="format" value="chm"/>
-->
- <option name="hide-protected" value="false"/>
+ <option name="hide-protected" value="true"/>
<option name="duplinkeddoc" value="true"/>
<!--
<option name="footer-date" value="yyyy-mm-dd"/>
diff --git a/docs/xml/corelib/fpg_base.xml b/docs/xml/corelib/fpg_base.xml
index abcb6f53..05a1f72f 100644
--- a/docs/xml/corelib/fpg_base.xml
+++ b/docs/xml/corelib/fpg_base.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0"?>
+<?xml version="1.0" encoding="UTF-8"?>
<fpdoc-descriptions>
<package name="fpGUI">
@@ -653,57 +653,61 @@ calculations and screen redraws.</p>
<element name="TfpgWindowBase.Left">
<short>Specifies the horizontal coordinate of the left edge of a component relative to its parent</short>
-<descr><p><printshort id="TfpgWindowBase.Left"/>. Use the Left property to determine where the left side
+<descr><p><printshort id="#fpgui.fpg_base.TfpgWindowBase.Left"/>. Use the Left property to determine where the left side
of the control begins or to reposition the left side of the control.
</p>
<remark>fpGUI delays acting on the Top, Left, Width and Height properties of a control until the
-<var>UpdateWindowPosition</var> method is called. For more information on why this is so, see <link id="fpg_base.TfpgWindowBase.UpdateWindowPosition">UpdateWindowPosition</link>
+<var>UpdateWindowPosition</var> method is called. For more information on why this is so,
+see <link id="#fpgui.fpg_base.TfpgWindowBase.UpdateWindowPosition">UpdateWindowPosition</link>
help.</remark></descr>
<seealso>
-<link id="fpg_base.TfpgWindowBase.UpdateWindowPosition">TfpgWindowBase.UpdateWindowPosition</link>
+<link id="#fpgui.fpg_base.TfpgWindowBase.UpdateWindowPosition">TfpgWindowBase.UpdateWindowPosition</link>
</seealso>
</element>
<element name="TfpgWindowBase.Top">
<short>Specifies the vertical (X) coordinate of the top edge of a component relative to its parent</short>
-<descr><p><printshort id="TfpgWindowBase.Top"/>. Use the Top property to determine where the top side
+<descr><p><printshort id="#fpgui.fpg_base.TfpgWindowBase.Top"/>. Use the Top property to determine where the top side
of the control begins or to reposition the top side of the control.
</p>
<remark>fpGUI delays acting on the Top, Left, Width and Height properties of a control until the
-<var>UpdateWindowPosition</var> method is called. For more information on why this is so, see <link id="fpg_base.TfpgWindowBase.UpdateWindowPosition">UpdateWindowPosition</link>
+<var>UpdateWindowPosition</var> method is called. For more information on why this
+is so, see <link id="#fpgui.fpg_base.TfpgWindowBase.UpdateWindowPosition">UpdateWindowPosition</link>
help.</remark></descr>
<seealso>
-<link id="fpg_base.TfpgWindowBase.UpdateWindowPosition">TfpgWindowBase.UpdateWindowPosition</link>
+<link id="#fpgui.fpg_base.TfpgWindowBase.UpdateWindowPosition">TfpgWindowBase.UpdateWindowPosition</link>
</seealso>
</element>
<element name="TfpgWindowBase.Width">
<short>Specifies the horizontal size of the control or form in pixels</short>
-<descr><p><printshort id="TfpgWindowBase.Width"/>. Use the Width property
+<descr><p><printshort id="#fpgui.fpg_base.TfpgWindowBase.Width"/>. Use the Width property
to read or change the width of the control. For TfpgTabSheet controls of for
controls that have their Align property set to alTop, alBottom or alClient, changing
this property at runtime has no effect.
</p>
<remark>fpGUI delays acting on the Top, Left, Width and Height properties of a control until the
-<var>UpdateWindowPosition</var> method is called. For more information on why this is so, see <link id="fpg_base.TfpgWindowBase.UpdateWindowPosition">UpdateWindowPosition</link>
+<var>UpdateWindowPosition</var> method is called. For more information on why this is so,
+see <link id="#fpgui.fpg_base.TfpgWindowBase.UpdateWindowPosition">UpdateWindowPosition</link>
help.</remark></descr>
<seealso>
-<link id="fpg_base.TfpgWindowBase.UpdateWindowPosition">TfpgWindowBase.UpdateWindowPosition</link>
+<link id="#fpgui.fpg_base.TfpgWindowBase.UpdateWindowPosition">TfpgWindowBase.UpdateWindowPosition</link>
</seealso>
</element>
<element name="TfpgWindowBase.Height">
<short>Specifies the vertical size of the control or form in pixels</short>
-<descr><p><printshort id="TfpgWindowBase.Height"/>. Use the Height property
+<descr><p><printshort id="#fpgui.fpg_base.TfpgWindowBase.Height"/>. Use the Height property
to read or change the height of the control. For TfpgTabSheet controls of for
controls that have their Align property set to alLeft, alRight or alClient, changing
this property at runtime has no effect.
</p>
<remark>fpGUI delays acting on the Top, Left, Width and Height properties of a control until the
-<var>UpdateWindowPosition</var> method is called. For more information on why this is so, see <link id="fpg_base.TfpgWindowBase.UpdateWindowPosition">UpdateWindowPosition</link>
+<var>UpdateWindowPosition</var> method is called. For more information on why this
+is so, see <link id="#fpgui.fpg_base.TfpgWindowBase.UpdateWindowPosition">UpdateWindowPosition</link>
help.</remark></descr>
<seealso>
-<link id="fpg_base.TfpgWindowBase.UpdateWindowPosition">TfpgWindowBase.UpdateWindowPosition</link>
+<link id="#fpgui.fpg_base.TfpgWindowBase.UpdateWindowPosition">TfpgWindowBase.UpdateWindowPosition</link>
</seealso>
</element>
@@ -724,7 +728,7 @@ it makes the target window the active window. Note that depending on the operati
and Window Manager, the active window could still be obscured by other windows. Under Windows,
it seems that the active window is always brought to the front too.</descr>
<seealso>
-<link id="fpg_base.TfpgWindowBase.BringToFront"></link>
+<link id="#fpgui.fpg_base.TfpgWindowBase.BringToFront"></link>
</seealso>
</element>
@@ -742,7 +746,7 @@ it seems that the active window is always brought to the front too.</descr>
<!-- procedure Visibility: public -->
<element name="TfpgImageBase.Invert">
<short>Inverts the Image</short>
- <descr><printshort id="TfpgImageBase.Invert"/>. This changes the actual
+ <descr><printshort id="#fpgui.fpg_base.TfpgImageBase.Invert"/>. This changes the actual
data of the image. There is no undo function. So if you want to undo this action,
you must keep copy of the original image before you call <var>Invert</var>.</descr>
</element>
@@ -804,7 +808,7 @@ you must keep copy of the original image before you call <var>Invert</var>.</des
<short>A abstract class representing a base Interpolation filter.</short>
<descr>This is used as the base class to implement Interpolation filters like
Gaussian, Sinc etc... These decendant filters are used in the
-<link id="TfpgCanvasBase.StretchDraw">Canvas.StretchDraw</link> function.
+<link id="#fpgui.fpg_base.TfpgCanvasBase.StretchDraw">Canvas.StretchDraw</link> function.
</descr>
<seealso>
<link id="TfpgCanvasBase.StretchDraw">Canvas.StretchDraw</link>
@@ -813,15 +817,16 @@ Gaussian, Sinc etc... These decendant filters are used in the
<!-- procedure Visibility: public -->
<element name="TfpgCanvasBase.DrawRectangle">
<short>Draws a rectangle.</short>
- <descr>
- <printshort id="TfpgCanvasBase.DrawRectangle"/> You can specify the size of the rectangle via X, Y, Width and Height parameters or via a TfpgRect parameter.</descr>
+ <descr><printshort id="#fpgui.fpg_base.TfpgCanvasBase.DrawRectangle"/> You can specify the size of the rectangle via X, Y, Width and Height parameters or via a TfpgRect parameter.</descr>
</element>
<!-- procedure Visibility: public -->
<element name="TfpgCanvasBase.DrawLine">
<short>Draws a line</short>
- <descr>
- <printshort id="TfpgCanvasbase.DrawLine"/>. This method draws a line from (x1,y1) to (x2,y2), but does not draw the last pixel. All supported backends follow the Microsoft API and doesn't draw the last pixel. This optimises consecutive lines being drawn without overlapping pixels.</descr>
+ <descr><printshort id="#fpgui.fpg_base.TfpgCanvasBase.DrawLine"/>. This method
+draws a line from (x1,y1) to (x2,y2), but does not draw the last pixel. All supported
+backends follow the Microsoft API and doesn't draw the last pixel. This optimises
+consecutive lines being drawn without overlapping pixels.</descr>
</element>
<element name="TfpgCanvasBase.StretchDraw">
@@ -849,7 +854,7 @@ returns the correct enum type detected.
<short>Converts the TfpgColor to TRGBTriple type</short>
<descr>This function converts the given TfpgColor into a TRGBTriple type.</descr>
<seealso>
- <link id="fpg_base.TRGBTriple">TRGBTriple</link>
+ <link id="#fpgui.fpg_base.TRGBTriple">TRGBTriple</link>
</seealso>
</element>
@@ -859,7 +864,7 @@ returns the correct enum type detected.
<descr>This function converts the given TRGBTriple into a TfpgColor type.
</descr>
<seealso>
- <link id="fpg_base.TRGBTriple">TRGBTriple</link>
+ <link id="#fpgui.fpg_base.TRGBTriple">TRGBTriple</link>
</seealso>
</element>
<!-- function Visibility: default -->
@@ -911,7 +916,7 @@ Right. And the Top is always smaller than the Bottom.
<element name="TfpgCanvasBase.DrawLineClipped">
<short>Draws a line inside a clip rectangle</short>
- <descr><p><printshort id="TfpgCanvasBase.DrawLineClipped"/>. This procedure clips a line to the AClipRect boundaries and
+ <descr><p><printshort id="#fpgui.fpg_base.TfpgCanvasBase.DrawLineClipped"/>. This procedure clips a line to the AClipRect boundaries and
then calls the DrawLine procedure with the clipped coordinates. If the line
lies completely outside of the clip boundary, then the Line routine is not
called. This procedure uses the well known Cohen-Sutherland line clipping
@@ -928,7 +933,7 @@ Right. And the Top is always smaller than the Bottom.
<element name="TfpgCanvasBase.GradientFill">
<short>Paints a rectangle with a gradient</short>
-<descr><printshort id="TfpgCanvasBase.GradientFill"/>. If the gradient direction is
+<descr><printshort id="#fpgui.fpg_base.TfpgCanvasBase.GradientFill"/>. If the gradient direction is
set to gdHorizontal, then it pains from left to right. If the gradient direction is
set to gdVertical, then it paints from top to bottom.</descr>
</element>
@@ -972,7 +977,7 @@ will be removed.</descr>
<element name="TfpgPoint">
<short>An extension of the FPC TPoint structure</short>
-<descr><p><printshort id="TfpgPoint"/>. This structure is used inside the fpGUI framework, and includes some extra methods like
+<descr><p><printshort id="#fpgui.fpg_base.TfpgPoint"/>. This structure is used inside the fpGUI framework, and includes some extra methods like
calculating lengths between to points etc.</p></descr>
</element>
@@ -1011,7 +1016,7 @@ the streets of Manhattan.</p>
<element name="TfpgComponent">
<short>A descendant of the FPC TComponent class</short>
-<descr><p><printshort id="fpg_base.TfpgComponent"/>. It adds a location where we can extend
+<descr><p><printshort id="#fpgui.fpg_base.TfpgComponent"/>. It adds a location where we can extend
the TComponent, without having to make changes to each and every class in fpGUI.</p>
<p>For example: We added the TagPointer property (which is now largely obsolete) because
a while back the Tag property of TComponent could only store a 32bit value.
@@ -1023,12 +1028,12 @@ the type of the Tag property to support 64-bit addresses too.</p></descr>
<element name="fpgComponent.HelpContext">
<short>A numeric ID for the widget's context-sensitive help topic</short>
<descr><p>HelpContext supports help systems that use numeric topic IDs. For help
-systems that use topic keywords, see <link id="fpg_base.TfpgComponent.HelpKeyword">HelpKeyword</link>.</p>
-<p>To enable context-sensitive help for a widget, set <link id="fpg_base.TfpgComponent.HelpType">HelpType</link> to htContext and
+systems that use topic keywords, see <link id="#fpgui.fpg_base.TfpgComponent.HelpKeyword">HelpKeyword</link>.</p>
+<p>To enable context-sensitive help for a widget, set <link id="#fpgui.fpg_base.TfpgComponent.HelpType">HelpType</link> to htContext and
set HelpContext to a numeric topic ID. A topic ID of 0 (default) means that no help
topic is provided for the widget. A 0 ID also mean that the help system should
refer to the parent widget, if there is one, for a help topic; refer to the
-<link id="fpg_widget.TfpgWidget.InvokeHelp">TfpgWidget.InvokeHelp</link> method
+<link id="#fpgui.fpg_widget.TfpgWidget.InvokeHelp">TfpgWidget.InvokeHelp</link> method
for more information.</p></descr>
</element>
@@ -1050,7 +1055,7 @@ for more information.</p></descr>
<element name="TfpgBaseTimer.Enabled">
<short>Allows you to enable or disable the timer</short>
-<descr><printshort id="TfpgBaseTimer.Enabled"/>. The timer will not function until you
+<descr><printshort id="#fpgui.fpg_base.TfpgBaseTimer.Enabled"/>. The timer will not function until you
set the Enabled property to True. Later you can disable the timer by setting the
Enabled property to False.</descr>
</element>
diff --git a/docs/xml/corelib/fpg_command_intf.xml b/docs/xml/corelib/fpg_command_intf.xml
index 03ec28bb..b012efa8 100644
--- a/docs/xml/corelib/fpg_command_intf.xml
+++ b/docs/xml/corelib/fpg_command_intf.xml
@@ -1,22 +1,22 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
+<?xml version="1.0" encoding="UTF-8"?>
<fpdoc-descriptions>
<package name="fpGUI">
<module name="fpg_command_intf">
<short>This unit defines the Command design pattern interfaces used by fpGUI</short>
-<descr><p><printshort id="fpg_command_intf"/>. The Command design pattern is similar to
+<descr><p><printshort id="#fpgui.fpg_command_intf"/>. The Command design pattern is similar to
the TActions from Delphi or Lazarus.</p></descr>
<element name="ICommand">
<short>This interface represents a Command</short>
-<descr><printshort id="ICommand"/>. Currently in only defines one procedure called <var>Execute</var>.</descr>
+<descr><printshort id="#fpgui.fpg_command_intf.ICommand"/>. Currently in only defines one procedure called <var>Execute</var>.</descr>
</element>
<element name="ICommandHolder">
<short>An interface that allows to Get or Set a Command</short>
-<descr><printshort id="ICommandHolder"/>. An example of a class that implements this interface
-is the <link id="fpg_button.TfpgBaseButton">TfpgBaseButton</link> class.</descr>
+<descr><printshort id="#fpgui.fpg_command_intf.ICommandHolder"/>. An example of a class that implements this interface
+is the <link id="#fpgui.fpg_button.TfpgBaseButton">TfpgBaseButton</link> class.</descr>
</element>
</module>
diff --git a/docs/xml/gui/fpg_button.xml b/docs/xml/gui/fpg_button.xml
index 0d0a13ce..ca39c92e 100644
--- a/docs/xml/gui/fpg_button.xml
+++ b/docs/xml/gui/fpg_button.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0"?>
+<?xml version="1.0" encoding="UTF-8"?>
<fpdoc-descriptions>
<package name="fpGUI">
<module name="fpg_button">
@@ -35,23 +35,25 @@ is centred in the available horizontal space of the button.</descr>
<element name="TfpgBaseButton.ImageName">
<short>The registered name of a image to display on the button</short>
<descr>
- <printshort id="TfpgBaseButton.ImageName"/>. This is the name used when
-a image resource was registered with the global <link id="fpg_main.fpgImages">fpgImages</link> instance.</descr>
+ <printshort id="#fpgui.fpg_button.TfpgBaseButton.ImageName"/>. This is the name used when
+a image resource was registered with the global <link id="#fpgui.fpg_main.fpgImages">fpgImages</link> instance.</descr>
</element>
<element name="TfpgButton">
<short>Concrete button class used in user interfaces to represent a push button</short>
- <descr><printshort id="TfpgButton"/>. This class is a descendant of <link id="fpg_button.TfpgBaseButton">TfpgBaseButton</link> and
+ <descr><printshort id="#fpgui.fpg_button.TfpgButton"/>. This class is a
+descendant of <link id="#fpgui.fpg_button.TfpgBaseButton">TfpgBaseButton</link> and
simply publishes various properties for runtime type information.</descr>
<seealso>
- <link id="fpg_button.TfpgBaseButton">TfpgBaseButton</link>
+ <link id="#fpgui.fpg_button.TfpgBaseButton">TfpgBaseButton</link>
</seealso>
</element>
<element name="TfpgButton.ImageName" link="#fpgui.fpg_button.TfpgBaseButton.ImageName"/>
<element name="TfpgButton.ImageSpacing" link="#fpgui.fpg_button.TfpgBaseButton.ImageSpacing"/>
<element name="TfpgButton.ImageLayout" link="#fpgui.fpg_button.TfpgBaseButton.ImageLayout"/>
-
+<element name="TfpgButton.Left" link="#fpgui.fpg_base.TfpgWindowBase.Left"/>
+<element name="TfpgButton.Height" link="#fpgui.fpg_base.TfpgWindowBase.Height"/>
</module>
</package>
diff --git a/docs/xml/gui/fpg_colormapping.xml b/docs/xml/gui/fpg_colormapping.xml
index f605d782..f249aa52 100644
--- a/docs/xml/gui/fpg_colormapping.xml
+++ b/docs/xml/gui/fpg_colormapping.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0"?>
+<?xml version="1.0" encoding="UTF-8"?>
<fpdoc-descriptions>
<package name="fpGUI">
<module name="fpg_colormapping">
diff --git a/docs/xml/gui/fpg_dialogs.xml b/docs/xml/gui/fpg_dialogs.xml
index 98e5fd2f..ef50cac8 100644
--- a/docs/xml/gui/fpg_dialogs.xml
+++ b/docs/xml/gui/fpg_dialogs.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
+<?xml version="1.0" encoding="UTF-8"?>
<fpdoc-descriptions>
<package name="fpGUI">
diff --git a/docs/xml/gui/fpg_form.xml b/docs/xml/gui/fpg_form.xml
index 7bfdf975..6a3027b1 100644
--- a/docs/xml/gui/fpg_form.xml
+++ b/docs/xml/gui/fpg_form.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0"?>
+<?xml version="1.0" encoding="UTF-8"?>
<fpdoc-descriptions>
<package name="fpGUI">
<module name="fpg_form">
diff --git a/docs/xml/gui/fpg_grid.xml b/docs/xml/gui/fpg_grid.xml
new file mode 100644
index 00000000..a916a544
--- /dev/null
+++ b/docs/xml/gui/fpg_grid.xml
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<fpdoc-descriptions>
+<package name="fpGUI">
+
+<module name="fpg_grid">
+<short>This unit contains higher level grid widgets</short>
+<descr><printshort id="#fpgui.fpg_grid"/>. A File Grid and a String Grid widget.</descr>
+
+<element name="TfpgStringGrid.ShowGrid">
+<short>Enable or disable grid line painting</short>
+<descr>If enabled (the default), then grid lines are drawn around each cell.</descr>
+</element>
+
+<element name="TfpgStringGrid.OnDrawCell">
+<short>This event allows you to do custom painting of grid cells</short>
+<descr><p>ARow and ACol parameters should be obvious - they point to the cell being
+drawn. ARect is the boundaries of the Cell being painted. AFlags contain some
+state information about the grid. eg: Has the grid got focus, has the cell got
+focus etc. ADefaultDrawing is set to True by default, which means the grid
+will take care of painting the cell text for you (taking into account layout
+and alignment settings of each column). If you set this to False, then you
+need to paint the text yourself.</p>
+<code>
+procedure TMainForm.StringGridDrawCell(Sender: TObject; const ARow,
+ ACol: Integer; const ARect: TfpgRect; const AFlags: TfpgGridDrawState;
+ var ADefaultDrawing: boolean);
+begin
+ // two rows with different background color
+ if (ARow = 7) or (ARow = 8) then
+ begin
+ if ((gdSelected in AFlags) and (gdFocused in AFlags)) or
+ (gdSelected in AFlags) then
+ Exit; // we want select cel to be painted as normal
+ // If we got here, we must do some painting. The background first.
+ StringGrid.Canvas.Color := clOrange;
+ StringGrid.Canvas.FillRectangle(ARect);
+ // NOTE: We want the grid to take care of the drawing of the text, which
+ // handles text layout and alignment, so we MUST NOT set the
+ // ADefaultDrawing to False. If we do, we need to handle text painting
+ // ourselves.
+ end;
+end;
+</code>
+</descr>
+<seealso>
+ <link id="#fpgui.fpg_basegrid.TfpgDrawCellEvent">fpg_basegrid.TfpgDrawCellEvent</link>
+</seealso>
+</element>
+
+
+</module>
+</package>
+</fpdoc-descriptions>
+
diff --git a/docs/xml/gui/fpg_hyperlink.xml b/docs/xml/gui/fpg_hyperlink.xml
index ae59a8a9..76fdea13 100644
--- a/docs/xml/gui/fpg_hyperlink.xml
+++ b/docs/xml/gui/fpg_hyperlink.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0"?>
+<?xml version="1.0" encoding="UTF-8"?>
<fpdoc-descriptions>
<package name="fpGUI">
<module name="fpg_hyperlink">
diff --git a/docs/xml/gui/fpg_tree.xml b/docs/xml/gui/fpg_tree.xml
index 54cbd893..6a69fd64 100644
--- a/docs/xml/gui/fpg_tree.xml
+++ b/docs/xml/gui/fpg_tree.xml
@@ -1,10 +1,10 @@
-<?xml version="1.0"?>
+<?xml version="1.0" encoding="UTF-8"?>
<fpdoc-descriptions>
<package name="fpGUI">
<module name="fpg_tree">
<short>This unit defines a tree view control</short>
-<descr><p><printshort id="fpg_tree"/>. A tree view displays items in an indented
+<descr><p><printshort id="#fpgui.fpg_tree"/>. A tree view displays items in an indented
outline. The control provides buttons that allow nodes to be expanded and collapsed.
You can include icons with items' text labels and display different icons to
indicate whether a node is expanded or collapsed.</p>
@@ -13,7 +13,7 @@ indicate whether a node is expanded or collapsed.</p>
<element name="TfpgTreeView">
<short>Represents a window that displays a hierachy list of items</short>
-<descr><p><printshort id="TfpgTreeView"/>. Examples of such hierachies can be
+<descr><p><printshort id="#fpgui.fpg_tree.TfpgTreeView"/>. Examples of such hierachies can be
the headings in a document, the entries in a index, or the files and directories
on a disk.</p>
<p>Use TfpgTreeView to add an expanding and contracting outline to a form. Each node
@@ -25,20 +25,20 @@ the user can expand or collapse the associated list of subnodes.</p>
<element name="TfpgTreeView.FullCollapse">
<short>Collapses all the nodes within a tree view control</short>
-<descr><printshort id="TfpgTreeView.FullCollapse"/>. Call FullCollapse to hide
+<descr><printshort id="#fpgui.fpg_tree.TfpgTreeView.FullCollapse"/>. Call FullCollapse to hide
all the nodes in the tree view except those at the first level. All node buttons
will change from '-' to '+'.</descr>
<seealso>
- <link id="TfpgTreeView.FullExpand"/>
+ <link id="#fpgui.fpg_tree.TfpgTreeView.FullExpand">TfpgTreeView.FullExpand</link>
</seealso>
</element>
<element name="TfpgTreeView.FullExpand">
<short>Expands all nodes within the tree view control</short>
-<descr><printshort id="TfpgTreeView.FullExpand"/>. Call FullExpand to display
+<descr><printshort id="#fpgui.fpg_tree.TfpgTreeView.FullExpand"/>. Call FullExpand to display
all the nodes in the tree view. All node buttons will change from '+' to '-'.</descr>
<seealso>
- <link id="TfpgTreeView.FullCollapse"/>
+ <link id="#fpgui.fpg_tree.TfpgTreeView.FullCollapse">TfpgTreeView.FullCollapse</link>
</seealso>
</element>
@@ -52,54 +52,54 @@ all the nodes in the tree view. All node buttons will change from '+' to '-'.</d
<element name="TfpgTreeView.NextNode">
<short>Return the next node after ANode</short>
-<descr><printshort id="TfpgTreeView.NextNode"/>. This function will step into child
+<descr><printshort id="#fpgui.fpg_tree.TfpgTreeView.NextNode"/>. This function will step into child
nodes as well, to return the correct node. It works on the actual nodes in the tree,
and not just the visible nodes in the tree.</descr>
<seealso>
- <link id="TfpgTreeView.PrevNode"/>
+ <link id="#fpgui.fpg_tree.TfpgTreeView.PrevNode">TfpgTreeView.PrevNode</link>
</seealso>
</element>
<element name="TfpgTreeView.PrevNode">
<short>Return the previous node starting from ANode</short>
-<descr><printshort id="TfpgTreeView.PrevNode"/>. This function will step into child
+<descr><printshort id="#fpgui.fpg_tree.TfpgTreeView.PrevNode"/>. This function will step into child
nodes as well, to insure it returns the correct node. It works on the actual nodes
in the tree, and not just on the visible nodes.</descr>
<seealso>
- <link id="TfpgTreeView.NextNode"/>
+ <link id="#fpgui.fpg_tree.TfpgTreeView.NextNode">TfpgTreeView.NextNode</link>
</seealso>
</element>
<element name="TfpgTreeview.NextVisualNode">
<short>Return the next visible node starting from ANode</short>
-<descr><printshort id="TfpgTreeview.NextVisualNode"/>. This works exactly the same
+<descr><printshort id="#fpgui.fpg_tree.TfpgTreeview.NextVisualNode"/>. This works exactly the same
as <var>NextNode</var> function, but this time it only acts on nodes that are visible.</descr>
<seealso>
- <link id="TfpgTreeview.NextNode"/>
+ <link id="#fpgui.fpg_tree.TfpgTreeview.NextNode">TfpgTreeview.NextNode</link>
</seealso>
</element>
<element name="TfpgTreeview.PrevVisualNode">
<short>Return the previous visible node starting from ANode</short>
-<descr><printshort id="TfpgTreeview.PrevVisualNode"/>. This works exactly the same
+<descr><printshort id="#fpgui.fpg_tree.TfpgTreeview.PrevVisualNode"/>. This works exactly the same
as <var>PrevNode</var> function, but this time it only acts on nodes that are visible.</descr>
<seealso>
- <link id="TfpgTreeview.PrevNode"/>
+ <link id="#fpgui.fpg_tree.TfpgTreeview.PrevNode">TfpgTreeview.PrevNode</link>
</seealso>
</element>
<element name="TfpgTreeview.Font">
<short>This gives you read access to the internal Font resource</short>
-<descr><printshort id="TfpgTreeview.Font"/>. If you want to change the font used
-in the tree view, use the <link id="TfpgTreeview.FondDesc">FondDesc</link> property instead.</descr>
+<descr><printshort id="#fpgui.fpg_tree.TfpgTreeview.Font"/>. If you want to change the font used
+in the tree view, use the <link id="#fpgui.fpg_tree.TfpgTreeview.FondDesc">FondDesc</link> property instead.</descr>
<seealso>
- <link id="TfpgTreeview.FontDesc"/>
+ <link id="#fpgui.fpg_tree.TfpgTreeview.FontDesc">TfpgTreeview.FontDesc</link>
</seealso>
</element>
<element name="TfpgTreeview.RootNode">
<short>Returns the first node of the tree where all other nodes branch from</short>
-<descr><printshort id="TfpgTreeview.RootNode"/>. This node is not a visible node, and
+<descr><printshort id="#fpgui.fpg_tree.TfpgTreeview.RootNode"/>. This node is not a visible node, and
is the internal node all other nodes in the tree branches from.</descr>
</element>
@@ -116,31 +116,31 @@ expanded, so the tree view will trigger the OnExpand event as well.</p></descr>
<element name="TfpgTreeview.ImageList">
<short>Refers to the image list associated with the tree view</short>
-<descr><printshort id="TfpgTreeview.ImageList"/>. Use the <var>ImageList</var> to
+<descr><printshort id="#fpgui.fpg_tree.TfpgTreeview.ImageList"/>. Use the <var>ImageList</var> to
provide a customised list of bitmaps that can be displayed with the node's text. Use
-the node's <link id="TfpgTreeNode.ImageIndex">ImageIndex</link> property to specify the
+the node's <link id="#fpgui.fpg_tree.TfpgTreeNode.ImageIndex">ImageIndex</link> property to specify the
bitmap that must be painted next to the node's text.</descr>
<seealso>
- <link id="TfpgTreeNode.ImageIndex"/>
+ <link id="#fpgui.fpg_tree.TfpgTreeNode.ImageIndex">TfpgTreeNode.ImageIndex</link>
</seealso>
</element>
<element name="TfpgTreeview.PopupMenu">
<short>Identifies the pop-up menu associated with the tree view</short>
-<descr><printshort id="TfpgTreeview.PopupMenu"/>. Assign a value to <var>PopupMenu</var>
+<descr><printshort id="#fpgui.fpg_tree.TfpgTreeview.PopupMenu"/>. Assign a value to <var>PopupMenu</var>
to make a popup-menu appear when the user selects the control and clicks the right mouse
button.</descr>
</element>
<element name="TfpgTreeview.DefaultColumnWidth">
<short>Is the default with of columns displayed in the tree view</short>
-<descr><p><printshort id="TfpgTreeview.DefaultColumnWidth"/>.</p>
+<descr><p><printshort id="#fpgui.fpg_tree.TfpgTreeview.DefaultColumnWidth"/>.</p>
<remark>There is basic column support, but this is still very experimental.</remark></descr>
</element>
<element name="TfpgTreeview.FontDesc">
<short>Specifies the font used for the tree view</short>
-<descr><printshort id="TfpgTreeview.FontDesc"/>. You can specify the font name and size
+<descr><printshort id="#fpgui.fpg_tree.TfpgTreeview.FontDesc"/>. You can specify the font name and size
in the format <var>fontname-size:attributes</var>, or you can use any of the font
aliases that has been setup. A font alias is a short name for some specific font, font size
and attribute all in one. A font alias is in the format <var>#aliasname</var>.</descr>
diff --git a/docview/TODO.txt b/docview/TODO.txt
index 886161c8..d0cccc7c 100644
--- a/docview/TODO.txt
+++ b/docview/TODO.txt
@@ -23,11 +23,11 @@ Todo list
[ ] - RichTextView component issue. Incompatible with original OS/2 VIEW. When
resetting a font style (eg: italics to normal), it should not affect a
previously set font color, unless a new font color is explicitly set.
-[ ] - External links are not supported yet.
[o] - Implement Image support in INF or HLP files.
+[x] - External links are not supported yet.
[x] - Access Violation when the application terminates.
[x] - Settings / Customization dialog is needed.
[x] - Create help file for DocView listing all supported features etc..
diff --git a/docview/docs/codepage_2_unicode_mapping/reame.txt b/docview/docs/codepage_2_unicode_mapping/readme.txt
index 33b26a53..33b26a53 100644
--- a/docview/docs/codepage_2_unicode_mapping/reame.txt
+++ b/docview/docs/codepage_2_unicode_mapping/readme.txt
diff --git a/docview/docs/docview.ipf b/docview/docs/docview.ipf
index 1cacd220..94099582 100644
--- a/docview/docs/docview.ipf
+++ b/docview/docs/docview.ipf
@@ -422,6 +422,7 @@ search result. Searches are :hp2.not:ehp2. case-sensitive.
.* Notes
.* ************************************************************
:h2 res=7 id='notes'.Notes
+:i1.Annotate
:hp2.Adding and Using Notes:ehp2.
:p.
&dv. allows you to add notes (annotations) to your help
@@ -568,7 +569,6 @@ you open a new or additional help file.
.* ************************************************************
:h1 res=8 id='bookmarks'.Bookmarks
:hp2.Bookmarks:ehp2.
-:note.:hp8.*** This feature is partially implemented. ***:ehp8.
:p.
&dv. allows you to bookmark particular topics within the current help
file. Simply click the bookmark toolbar button
@@ -579,16 +579,16 @@ To jump to a bookmark, go to the "Bookmarks" menu, and click on
the bookmark you want to open.
:p.
You can view or delete all your bookmarks by clicking on "Edit..." in
-the "Bookmarks" menu. This window can remain open while you read, so
-that you can quickly look through your bookmarks.
+the "Bookmarks" menu.
:p.
Bookmarks are saved in a file with the extension ".bookmarks", in the &dv. config
directory. This is in the user's home profile directory where there is read/write
access. Under Linux it is normally "~/.config/docview/" and under Windows it is
normally "C:\Documents and Settings\<user>\Local Settings\Application Data\docview".
-I will probably add a setting in &dv., so the user can configure a
-preferred storage location for bookmarks (eg: some users prefer it like OS/2's View program did,
-by storing notes in the same directory as the help file).
+.* TODO
+.* I will probably add a setting in &dv., so the user can configure a
+.* preferred storage location for bookmarks (eg: some users prefer it like OS/2's View program did,
+.* by storing notes in the same directory as the help file).
.* ************************************************************
@@ -608,7 +608,7 @@ details on how to configure it.
For more technical details about what browser is used, have a look at the fpgOpenURL()
function in fpGUI Toolkit source code.
:p.
-Email, Newsgroups and FTP links are also passed to operating system or desktop
+Email, Newsgroups and FTP links are also passed to the operating system or desktop
environment, the same as web addresses.
:p.
:hp2.Note to help file authors:ehp2.
@@ -817,55 +817,90 @@ file names), so the environment variable "MYHELP" is not equal to "myhelp".
.* ************************************************************
.* Keyboard Shortcuts
.* ************************************************************
-.* TODO
-.* :h1 res=10 id='KeyboardShortcuts'.
-.* Keyboard Shortcuts
-.* :p.:hp2.Keyboard Shortcuts:ehp2.
-.* :p.Most keyboard shortcuts are visible in the menu&comma. but a few are not&per.
-.* The additional shortcuts are&colon.
-.* :p.:hp2.Alt&plus.F4:ehp2. Exit
-.* :p.:hp2.Ctrl&plus.C:ehp2. Copy selected text to clipboard
-.* :p.:hp2.F7:ehp2. Back
-.* :p.:hp2.F8:ehp2. Forward
-.* :p.:hp2.Ctrl&plus.Left:ehp2. Back
-.* :p.:hp2.F11:ehp2. Previous in contents
-.* :p.:hp2.F12:ehp2. Next in contents
-.* :p.
-.* :p.:hp2.Shortcuts visible in the menu:ehp2.
-.* :p.:hp2.Ctrl&plus.O:ehp2. Open files
-.* :p.:hp2.Ctrl&plus.E:ehp2. Open files from help paths
-.* :p.:hp2.Ctrl&plus.N:ehp2. Open a new window
-.* :p.:hp2.Ctrl&plus.P:ehp2. Print topic
-.* :p.:hp2.F3:ehp2. Exit
-.* :p.
-.* :p.
-.* :p.:hp2.Ctrl&plus.A:ehp2. Select all text in topic
-.* :p.:hp2.Ctrl&plus.Ins:ehp2. Copy selected text to clipboard
-.* :p.
-.* :p.:hp2.Ctrl&plus.F:ehp2. Find within current topic
-.* :p.:hp2.Ctrl&plus.G:ehp2. Repeat last find
-.* :p.
-.* :p.:hp2.Ctrl&plus.S:ehp2. Open global search tool
-.* :p.
-.* :p.:hp2.Alt&plus.C:ehp2. Change to the contents tab
-.* :p.:hp2.Alt&plus.I:ehp2. Change to the index tab
-.* :p.:hp2.Alt&plus.S:ehp2. Change to the search tab
-.* :p.:hp2.Alt&plus.N:ehp2. Change to the notes tab
-.* :p.:hp2.Alt&plus.P:ehp2. Toggle the left panel &lpar.tabs&rpar. on and off
-.* :p.:hp2.F5:ehp2. Expand all contents
-.* :p.:hp2.F6:ehp2. Collapse all contents
-.* :p.
-.* :p.:hp2.Esc:ehp2. Back
-.* :p.:hp2.Ctrl&plus.Right:ehp2. Forward
-.* :p.:hp2.Ctrl&plus.Up:ehp2. Previous topic in contents
-.* :p.:hp2.Ctrl&plus.Down:ehp2. Next topic in contents
-.* :p.
-.* :p.:hp2.Ctrl&plus.D:ehp2. Edit bookmarks
-.* :p.:hp2.Ctrl&plus.B:ehp2. Bookmark current topic
-.* :p.
-.* :p.:hp2.Ctrl&plus.M:ehp2. Add note at cursor position
-.* :p.
-.* :p.:hp2.F1:ehp2. Help for &dv.
+:h1 res=10 id='KeyboardShortcuts'.Keyboard Shortcuts
+:p.:hp2.Keyboard Shortcuts:ehp2.
+:p.Most keyboard shortcuts are visible in the menu, but a few are not.
+Here is a list of keyboard shortcuts supported by &dv.:
+
+:table rules=vert frame=box cols='45 20'.
+:row.
+:c.:hp2.TASK:ehp2.
+:c.:hp2.PRESS:ehp2.
+
+:row.
+:c.----------
+:c.----------
+
+:row.
+:c.Open File
+:c.Ctrl+O
+
+:row.
+:c.Open Additional Files
+:c.Ctrl+Shift+O
+
+:row.
+:c.Open Special (eg: environment variable)
+:c.Ctrl+L
+
+:row.
+:c.Save Current Top
+:c.Ctrl+S
+
+:row.
+:c.Quit &dv.
+:c.Ctrl+Q
+
+:row.
+:c.Switch to Contents tab
+:c.F5
+
+:row.
+:c.Switch to Index tab
+:c.F6
+
+:row.
+:c.Switch to Search tab
+:c.F7
+
+:row.
+:c.Switch to Notes tab
+:c.F8
+
+:row.
+:c.Switch to History tab
+:c.F9
+
+:row.
+:c.Navigate Back
+:c.Ctrl+left arrow
+
+:row.
+:c.Navigate Forward
+:c.Ctrl+right arrow
+
+:row.
+:c.Navigate to previous topic in contents
+:c.Ctrl+up arrow
+
+:row.
+:c.Navigate to next topic in contents
+:c.Ctrl+down arrow
+
+:row.
+:c.Bookmark current topic
+:c.Ctrl+B
+
+:row.
+:c.Edit Bookmarks
+:c.Ctrl+M
+
+:row.
+:c.Add note (annotations) at cursor position
+:c.Ctrl+M
+
+:etable.
+
.* ************************************************************
diff --git a/docview/src/HelpBitmap.pas b/docview/src/HelpBitmap.pas
index 0931ce82..692bf64d 100644
--- a/docview/src/HelpBitmap.pas
+++ b/docview/src/HelpBitmap.pas
@@ -1,14 +1,32 @@
+{
+ fpGUI - Free Pascal GUI Toolkit
+
+ Copyright (C) 2006 - 2013 See the file AUTHORS.txt, included in this
+ distribution, for details of the copyright.
+
+ See the file COPYING.modifiedLGPL, included in this distribution,
+ for details about redistributing fpGUI.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ Description:
+ Encapsulates a bitmap as stored in a IPF file. Once created from
+ file data they can be used as a normal bitmap.
+}
+
unit HelpBitmap;
{$mode objfpc}{$H+}
-interface
+// Debug purposes only
+{.$define LZW_DEBUG}
-// Encapsulates a bitmap as stored in a IPF file.
-// Once created from file data they can be used as a normal bitmap.
+interface
uses
- Classes, SysUtils, fpg_main, ctypes,
+ Classes, SysUtils, fpg_main,
IPFFileFormatUnit;
type
@@ -65,7 +83,6 @@ type
_UncompressedBlockSize: longint;
function GetPaletteSize: longint;
procedure BitmapError(Msg: string);
- procedure DecompressLZW(var Buffer: Pointer; const Count: integer; var NewBuffer: PByte; var NewCount: integer);
procedure ReadBitmapData( Blocks: TList; TotalSize: longint );
public
constructor CreateFromHelpFile(var AFileHandle: TFileStream; Offset: longint);
@@ -73,19 +90,13 @@ type
end;
-var
- LZWDecompressBlock: function( pInput: PBYTE;
- pOutput: PBYTE;
- bytesIn: uint32;
- Var bytesOut: uint32;
- Var FinalCode: byte ): Boolean;
-// APIENTRY;
-// 'newview' index 1;
-
implementation
uses
- nvUtilities, Math, fpg_imgfmt_bmp;
+ nvUtilities,
+ Math,
+ LZWDecompress,
+ fpg_imgfmt_bmp;
const
BFT_bMAP =$4d62; // 'bM'
@@ -102,9 +113,15 @@ type
_Size: uint16;
_CompressionType: uint8;
_Data: PBYTE;
+ constructor Create;
destructor Destroy; override;
end;
+constructor TBitmapBlock.Create;
+begin
+ _Data := nil;
+end;
+
destructor TBitmapBlock.Destroy;
begin
FreeMem( _Data );
@@ -119,7 +136,6 @@ var
BytesRead: longint;
Block: TBitmapBlock;
- p: pointer;
Blocks: TList;
BlockIndex: longint;
ImageType: uint16;
@@ -154,7 +170,8 @@ begin
if _Header.usType <> BFT_bMAP then
raise EHelpBitmapException.Create( 'Invalid bitmap header' );
- _Header.usType := $4d42; // sibyl only accepts 'BM' not 'bM'
+// Graeme: we don't need to do this any more. It was only for Sybil
+// _Header.usType := $4d42; // sibyl only accepts 'BM' not 'bM'
// We can only parse bitmaps with 1 colour plane
// (I can't be bothered and have never seen bitmaps
@@ -174,19 +191,19 @@ begin
_BitsSize := LineSize * _Header.cy;
// Correct header offset - it is wrong in the header (why?)
- _Header.OffBits := sizeof( _Header ) + GetPaletteSize; // TODO: Graeme, double check this!
+ _Header.OffBits := sizeof( _Header ) + GetPaletteSize;
// Load palette
if _Header.cBitCount <= 8 then
begin
_pPalette := GetMem( GetPaletteSize );
- bytes := FileHandle.Read(_pPalette, GetPaletteSize);
+ bytes := FileHandle.Read(_pPalette^, GetPaletteSize);
if bytes <> GetPaletteSize then
raise EHelpBitmapException.Create( 'Failed to read Palette.' );
end;
// Read data header
- FillChar( DataHeader, sizeof( DataHeader ), 0 );
+// FillChar( DataHeader, sizeof( DataHeader ), 0 );
bytes := FileHandle.Read(DataHeader, SizeOf(DataHeader));
if bytes <> SizeOf(DataHeader) then
raise EHelpBitmapException.Create( 'Failed to read DataHeader.' );
@@ -214,7 +231,7 @@ begin
// Now read the block
Block._Data := GetMem( Block._Size );
- FileHandle.Read(Block._Data, Block._Size);
+ FileHandle.Read(Block._Data^, Block._Size);
inc( BytesRead, Block._Size );
Blocks.Add( Block );
@@ -250,227 +267,7 @@ begin
inherited Destroy;
end;
-procedure THelpBitmap.DecompressLZW(var Buffer: Pointer; const Count: Integer; var NewBuffer: PByte; var NewCount: integer);
-type
- TLZWString = packed record
- Count: integer;
- Data: PByte;
- end;
- PLZWString = ^TLZWString;
-const
- ClearCode = 256; // clear table, start with 9bit codes
- EoiCode = 257; // end of input
-var
-// NewBuffer: PByte;
-// NewCount: PtrInt;
- NewCapacity: PtrInt;
- SrcPos: PtrInt;
- SrcPosBit: integer;
- CurBitLength: integer;
- Code: Word;
- Table: PLZWString;
- TableCapacity: integer;
- TableCount: integer;
- OldCode: Word;
-
- function GetNextCode: Word;
- var
- v: Integer;
- begin
- Result:=0;
- // CurBitLength can be 9 to 12
- //writeln('GetNextCode CurBitLength=',CurBitLength,' SrcPos=',SrcPos,' SrcPosBit=',SrcPosBit,' ',hexstr(PByte(Buffer)[SrcPos],2),' ',hexstr(PByte(Buffer)[SrcPos+1],2),' ',hexstr(PByte(Buffer)[SrcPos+2],2));
- // read two or three bytes
- if CurBitLength+SrcPosBit>16 then begin
- // read from three bytes
- if SrcPos+3>Count then BitmapError('LZW stream overrun');
- v:=PByte(Buffer)[SrcPos];
- inc(SrcPos);
- v:=(v shl 8)+PByte(Buffer)[SrcPos];
- inc(SrcPos);
- v:=(v shl 8)+PByte(Buffer)[SrcPos];
- v:=v shr (24-CurBitLength-SrcPosBit);
- end else begin
- // read from two bytes
- if SrcPos+2>Count then BitmapError('LZW stream overrun');
- v:=PByte(Buffer)[SrcPos];
- inc(SrcPos);
- v:=(v shl 8)+PByte(Buffer)[SrcPos];
- if CurBitLength+SrcPosBit=16 then
- inc(SrcPos);
- v:=v shr (16-CurBitLength-SrcPosBit);
- end;
- Result:=v and ((1 shl CurBitLength)-1);
- SrcPosBit:=(SrcPosBit+CurBitLength) and 7;
- //writeln('GetNextCode END SrcPos=',SrcPos,' SrcPosBit=',SrcPosBit,' Result=',Result,' Result=',hexstr(Result,4));
- end;
-
- procedure ClearTable;
- var
- i: Integer;
- begin
- for i:=0 to TableCount-1 do
- ReAllocMem(Table[i].Data,0);
- TableCount:=0;
- end;
-
- procedure InitializeTable;
- begin
- CurBitLength:=9;
- ClearTable;
- end;
-
- function IsInTable(Code: word): boolean;
- begin
- Result:=Code<258+TableCount;
- end;
-
- procedure WriteStringFromCode(Code: integer; AddFirstChar: boolean = false);
- var
- s: TLZWString;
- b: byte;
- begin
- //WriteLn('WriteStringFromCode Code=',Code,' AddFirstChar=',AddFirstChar,' x=',(NewCount div 4) mod IDF.ImageWidth,' y=',(NewCount div 4) div IDF.ImageWidth,' PixelByte=',NewCount mod 4);
- if Code<256 then begin
- // write byte
- b:=Code;
- s.Data:=@b;
- s.Count:=1;
- end else if Code>=258 then begin
- // write string
- if Code-258>=TableCount then
- BitmapError('LZW code out of bounds');
- s:=Table[Code-258];
- end else
- BitmapError('LZW code out of bounds');
- if NewCount+s.Count+1>NewCapacity then begin
- NewCapacity:=NewCapacity*2+8;
- ReAllocMem(NewBuffer,NewCapacity);
- end;
- System.Move(s.Data^,NewBuffer[NewCount],s.Count);
- //for i:=0 to s.Count-1 do write(HexStr(NewBuffer[NewCount+i],2)); // debug
- inc(NewCount,s.Count);
- if AddFirstChar then begin
- NewBuffer[NewCount]:=s.Data^;
- //write(HexStr(NewBuffer[NewCount],2)); // debug
- inc(NewCount);
- end;
- //writeln(',WriteStringFromCode'); // debug
- end;
-
- procedure AddStringToTable(Code, AddFirstCharFromCode: integer);
- // add string from code plus first character of string from code as new string
- var
- b1, b2: byte;
- s1, s2: TLZWString;
- p: PByte;
- begin
- //WriteLn('AddStringToTable Code=',Code,' FCFCode=',AddFirstCharFromCode,' TableCount=',TableCount,' TableCapacity=',TableCapacity);
- // grow table
- if TableCount>=TableCapacity then begin
- TableCapacity:=TableCapacity*2+128;
- ReAllocMem(Table,TableCapacity*SizeOf(TLZWString));
- end;
- // find string 1
- if Code<256 then begin
- // string is byte
- b1:=Code;
- s1.Data:=@b1;
- s1.Count:=1;
- end else if Code>=258 then begin
- // normal string
- if Code-258>=TableCount then
- BitmapError('LZW code out of bounds');
- s1:=Table[Code-258];
- end else
- BitmapError('LZW code out of bounds');
- // find string 2
- if AddFirstCharFromCode<256 then begin
- // string is byte
- b2:=AddFirstCharFromCode;
- s2.Data:=@b2;
- s2.Count:=1;
- end else begin
- // normal string
- if AddFirstCharFromCode-258>=TableCount then
- BitmapError('LZW code out of bounds');
- s2:=Table[AddFirstCharFromCode-258];
- end;
- // set new table entry
- Table[TableCount].Count:=s1.Count+1;
- p:=nil;
- GetMem(p,s1.Count+1);
- Table[TableCount].Data:=p;
- System.Move(s1.Data^,p^,s1.Count);
- // add first character from string 2
- p[s1.Count]:=s2.Data^;
- // increase TableCount
- inc(TableCount);
- case TableCount+259 of
- 512,1024,2048: inc(CurBitLength);
- 4096: BitmapError('LZW too many codes');
- end;
- end;
-
-begin
- if Count=0 then exit;
- //WriteLn('TFPReaderTiff.DecompressLZW START Count=',Count);
- //for SrcPos:=0 to 19 do
- // write(HexStr(PByte(Buffer)[SrcPos],2));
- //writeln();
-
- NewBuffer:=nil;
- NewCount:=0;
- NewCapacity:=Count*2;
- ReAllocMem(NewBuffer,NewCapacity);
-
- SrcPos:=0;
- SrcPosBit:=0;
- CurBitLength:=9;
- Table:=nil;
- TableCount:=0;
- TableCapacity:=0;
- try
- repeat
- Code:=GetNextCode;
- //WriteLn('TFPReaderTiff.DecompressLZW Code=',Code);
- if Code=EoiCode then break;
- if Code=ClearCode then begin
- InitializeTable;
- Code:=GetNextCode;
- //WriteLn('TFPReaderTiff.DecompressLZW after clear Code=',Code);
- if Code=EoiCode then break;
- if Code=ClearCode then
- BitmapError('LZW code out of bounds');
- WriteStringFromCode(Code);
- OldCode:=Code;
- end else begin
- if Code<TableCount+258 then begin
- WriteStringFromCode(Code);
- AddStringToTable(OldCode,Code);
- OldCode:=Code;
- end else if Code=TableCount+258 then begin
- WriteStringFromCode(OldCode,true);
- AddStringToTable(OldCode,OldCode);
- OldCode:=Code;
- end else
- BitmapError('LZW code out of bounds');
- end;
- until false;
- finally
- ClearTable;
- ReAllocMem(Table,0);
- end;
-
- ReAllocMem(NewBuffer,NewCount);
-// FreeMem(Buffer);
-// Buffer:=NewBuffer;
-// Count:=NewCount;
-end;
-
-
-procedure THelpBitmap.ReadBitmapData( Blocks: TList;
- TotalSize: longint );
+procedure THelpBitmap.ReadBitmapData( Blocks: TList; TotalSize: longint );
var
BytesWritten: longint;
BytesWrittenFromBlock: longword;
@@ -483,16 +280,22 @@ var
BlockIndex: longint;
BitmapData: PBYTE;
ptr: PByte;
+ i: integer;
+ img: TfpgImage;
begin
+ BitmapOutputPointer := nil;
+ BitmapData := nil;
+ ptr := nil;
+
// Allocate memory to store the bitmap
- Bitmapdata := GetMem( TotalSize );
+ BitmapData := GetMem( TotalSize );
// Copy header to bitmap
- MemCopy( _Header, BitmapData, sizeof( _Header ) );
+ MemCopy( _Header, BitmapData^, sizeof( _Header ) );
// Copy palette into bitmap
ptr := BitmapData + sizeof( _Header );
- MemCopy( _pPalette, ptr, GetPaletteSize );
+ MemCopy( _pPalette^, ptr^, GetPaletteSize );
BytesWritten := 0;
@@ -506,23 +309,18 @@ begin
case Block._CompressionType of
0,1: // uncompressed (I'm not sure about 1)
begin
- MemCopy( Block._Data, BitmapOutputPointer, Block._Size );
+ MemCopy( Block._Data^, BitmapOutputPointer^, Block._Size );
BytesWrittenFromBlock := Block._Size;
inc( BytesWritten, BytesWrittenFromBlock );
end;
2: // LZW compression
begin
- // decompress block
- if not Assigned( LZWDecompressBlock )then
- raise EHelpBitmapException.Create( 'Cannot decode bitmap - DLL not found' );
-
-// DecompressLZW(Block._Data, Block._Size);
- //LZWDecompressBlock( Block._Data,
- // BitmapOutputPointer,
- // Block._Size,
- // BytesWrittenFromBlock,
- // lastOutByte );
+ LZWDecompressBlock( Block._Data,
+ Block._Size,
+ BitmapOutputPointer,
+ BytesWrittenFromBlock,
+ lastOutByte );
inc( BytesWritten, BytesWrittenFromBlock );
@@ -555,15 +353,37 @@ begin
> BitmapData + TotalSize ) then
assert( false );
- inc( BitmapOutputPointer, BytesWrittenFromBlock );
+{ NOTE: This doesn't seem right. It moves the pointer so later the moving of data to
+ ImageData will be wrong! }
+// inc( BitmapOutputPointer, BytesWrittenFromBlock ); TPersistentObjectState
end;
+ i := TotalSize + SizeOf(_Header) + GetPaletteSize;
+ img := CreateImage_BMP(BitmapData, i);
AllocateImage(32, _Header.cx, _Header.cy);
- if TotalSize <> ImageDataSize then
- writeln('Warning: INF Bitmap size and allocated bitmap size are different. ', TotalSize, ' vs ', ImageDataSize);
- Move(BitmapData^, ImageData^, TotalSize);
+
+ {$IFDEF LZW_DEBUG}
+ writeln('Width = ', Width);
+ writeln('Height = ', Height);
+ writeln('ImageDataSize = ', ImageDataSize);
+ writeln('------------- START -------------');
+ for i := 1 to ImageDataSize do
+ begin
+ write(HexStr(BitmapOutputPointer[i-1],2)+' ');
+ if (i mod 16 = 0) then
+ writeln('')
+ else if (i mod 4 = 0) then
+ write (' | ');
+ end;
+ Writeln('');
+ writeln('------------- END -------------');
+ {$ENDIF}
+
+// Move(BitmapOutputPointer^, ImageData^, ImageDataSize);
+ Move(img.ImageData^, self.ImageData^, img.ImageDataSize);
UpdateImage;
+ img.Free;
FreeMem( BitmapData, TotalSize );
end;
diff --git a/docview/src/HelpFile.pas b/docview/src/HelpFile.pas
index cc4657d9..ce3d9f8a 100644
--- a/docview/src/HelpFile.pas
+++ b/docview/src/HelpFile.pas
@@ -321,29 +321,6 @@ const
entries.AddObject(anIndexEntry.getLabel, anIndexEntry);
end;
-
-
-
-//Procedure OnLanguageEvent( Language: TLanguageFile;
-// const Apply: boolean );
-//var
-// tmpPrefix : String;
-//begin
-// tmpPrefix := 'HelpFile' + LANGUAGE_LABEL_DELIMITER;
-//
-// Language.LL( Apply, FileErrorNotFound, tmpPrefix + 'FileErrorNotFound', 'File not found' );
-// Language.LL( Apply, FileErrorAccessDenied, tmpPrefix + 'FileErrorAccessDenied', 'Access denied' );
-// Language.LL( Apply, FileErrorInUse, tmpPrefix + 'FileErrorInUse', 'File in use by another program' );
-// Language.LL( Apply,
-// FileErrorInvalidHeader,
-// tmpPrefix + 'FileErrorInvalidHeader',
-// 'File doesn''t appear to be an OS/2 Help document (header ID not correct)' );
-// Language.LL( Apply,
-// ErrorCorruptHelpFile,
-// tmpPrefix + 'ErrorCorruptHelpFile',
-// 'File is corrupt' );
-//end;
-
Function TopicFile( Topic: TTopic ): THelpFile;
Begin
Result := Topic.HelpFile as THelpFile;
@@ -1119,9 +1096,7 @@ begin
+ ': '
+ e.Message );}
begin
-// Bitmap := THelpBitmap.Create;
Bitmap := THelpBitmap(fpgImages.GetImage('stdimg.dlg.critical'));
-// Bitmap.LoadFromResourceName( 'MissingBitmap' ); // TODO: Add image resource to DocView
end;
end;
diff --git a/docview/src/HelpTopic.pas b/docview/src/HelpTopic.pas
index 3af43e6a..a9b981f1 100644
--- a/docview/src/HelpTopic.pas
+++ b/docview/src/HelpTopic.pas
@@ -231,7 +231,7 @@ implementation
uses
SysUtils
- ,NewViewConstantsUnit
+ ,dvConstants
,nvUtilities
,ACLStringUtility
,SettingsUnit
@@ -859,6 +859,7 @@ var
ProgramLink: string;
ProgramPath: string;
ProgramFilename: string;
+ lURL: string;
ProgramInfo : TSerializableStringList;
tmpProgramLinkParts : TStrings;
@@ -1000,6 +1001,7 @@ begin
tmpProgramLinkParts := TStringList.Create;
StrExtractStrings(tmpProgramLinkParts, ProgramLink, [' '], #0);
ProgramPath := tmpProgramLinkParts[0];
+ lURL := tmpProgramLinkParts[1];
tmpProgramLinkParts.Destroy;
ProgramFilename := ExtractFilename( ProgramPath );
@@ -1011,7 +1013,7 @@ begin
then
begin
OutputString := '<color blue><link ' + PARAM_LINK_URL + ' '
- + FullDoubleQuote( ProgramLink )
+ + FullDoubleQuote( lURL )
+ '>';
end
else
diff --git a/docview/src/NewViewConstantsUnit.pas b/docview/src/NewViewConstantsUnit.pas
deleted file mode 100644
index 2aed1cd0..00000000
--- a/docview/src/NewViewConstantsUnit.pas
+++ /dev/null
@@ -1,37 +0,0 @@
-{
- fpGUI - Free Pascal GUI Toolkit
-
- Copyright (C) 2006 - 2010 See the file AUTHORS.txt, included in this
- distribution, for details of the copyright.
-
- See the file COPYING.modifiedLGPL, included in this distribution,
- for details about redistributing fpGUI.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
- Description:
- Common used constants for DocView
-}
-unit NewViewConstantsUnit;
-
-{$mode objfpc}{$H+}
-
-interface
-
-const
- PARAM_LINK_NOTE = 'note';
- PARAM_LINK_PROGRAM = 'program';
- PARAM_LINK_URL = 'url';
- PARAM_LINK_EXTERNAL = 'external';
-
- PRGM_EXPLORER = 'explore'; // web explorer
- PRGM_NETSCAPE = 'netscape';
- PRGM_MOZILLA = 'mozilla';
- PRGM_FIREFOX = 'firefox';
-
-
-implementation
-
-end.
diff --git a/docview/src/docview.lpi b/docview/src/docview.lpi
index 30c8e7ff..6fc2c4cb 100644
--- a/docview/src/docview.lpi
+++ b/docview/src/docview.lpi
@@ -23,6 +23,7 @@
<RunParams>
<local>
<FormatVersion Value="1"/>
+ <CommandLineParams Value="/data/devel/tests/inf_test/test2.inf"/>
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
</local>
</RunParams>
@@ -31,7 +32,7 @@
<PackageName Value="fpgui_toolkit"/>
</Item1>
</RequiredPackages>
- <Units Count="36">
+ <Units Count="37">
<Unit0>
<Filename Value="docview.lpr"/>
<IsPartOfProject Value="True"/>
@@ -132,80 +133,85 @@
<UnitName Value="HelpWindowDimensions"/>
</Unit19>
<Unit20>
- <Filename Value="NewViewConstantsUnit.pas"/>
+ <Filename Value="SettingsUnit.pas"/>
<IsPartOfProject Value="True"/>
- <UnitName Value="NewViewConstantsUnit"/>
+ <UnitName Value="SettingsUnit"/>
</Unit20>
<Unit21>
- <Filename Value="SettingsUnit.pas"/>
+ <Filename Value="dvconstants.pas"/>
<IsPartOfProject Value="True"/>
- <UnitName Value="SettingsUnit"/>
+ <UnitName Value="dvConstants"/>
</Unit21>
<Unit22>
- <Filename Value="dvconstants.pas"/>
+ <Filename Value="dvHelpers.pas"/>
<IsPartOfProject Value="True"/>
- <UnitName Value="dvConstants"/>
+ <UnitName Value="dvHelpers"/>
</Unit22>
<Unit23>
- <Filename Value="dvHelpers.pas"/>
+ <Filename Value="HelpWindow.pas"/>
<IsPartOfProject Value="True"/>
- <UnitName Value="dvHelpers"/>
+ <UnitName Value="HelpWindow"/>
</Unit23>
<Unit24>
- <Filename Value="HelpWindow.pas"/>
+ <Filename Value="../TODO.txt"/>
<IsPartOfProject Value="True"/>
- <UnitName Value="HelpWindow"/>
</Unit24>
<Unit25>
- <Filename Value="../TODO.txt"/>
+ <Filename Value="frm_configuration.pas"/>
<IsPartOfProject Value="True"/>
+ <UnitName Value="frm_configuration"/>
</Unit25>
<Unit26>
- <Filename Value="frm_configuration.pas"/>
+ <Filename Value="arrows.inc"/>
<IsPartOfProject Value="True"/>
- <UnitName Value="frm_configuration"/>
</Unit26>
<Unit27>
- <Filename Value="arrows.inc"/>
+ <Filename Value="HelpBitmap.pas"/>
<IsPartOfProject Value="True"/>
+ <UnitName Value="HelpBitmap"/>
</Unit27>
<Unit28>
- <Filename Value="HelpBitmap.pas"/>
+ <Filename Value="missing.inc"/>
<IsPartOfProject Value="True"/>
- <UnitName Value="HelpBitmap"/>
</Unit28>
<Unit29>
- <Filename Value="missing.inc"/>
+ <Filename Value="frm_text.pas"/>
<IsPartOfProject Value="True"/>
+ <UnitName Value="frm_text"/>
</Unit29>
<Unit30>
- <Filename Value="frm_text.pas"/>
+ <Filename Value="docview.rc"/>
<IsPartOfProject Value="True"/>
- <UnitName Value="frm_text"/>
</Unit30>
<Unit31>
- <Filename Value="docview.rc"/>
+ <Filename Value="../docs/docview.ipf"/>
<IsPartOfProject Value="True"/>
</Unit31>
<Unit32>
- <Filename Value="../docs/docview.ipf"/>
+ <Filename Value="frm_note.pas"/>
<IsPartOfProject Value="True"/>
+ <UnitName Value="frm_note"/>
</Unit32>
<Unit33>
- <Filename Value="frm_note.pas"/>
+ <Filename Value="HelpNote.pas"/>
<IsPartOfProject Value="True"/>
- <UnitName Value="frm_note"/>
+ <UnitName Value="HelpNote"/>
</Unit33>
<Unit34>
- <Filename Value="HelpNote.pas"/>
+ <Filename Value="HelpBookmark.pas"/>
<IsPartOfProject Value="True"/>
- <UnitName Value="HelpNote"/>
+ <UnitName Value="HelpBookmark"/>
</Unit34>
<Unit35>
- <Filename Value="HelpBookmark.pas"/>
+ <Filename Value="frm_bookmarks.pas"/>
<IsPartOfProject Value="True"/>
- <UnitName Value="HelpBookmark"/>
+ <UnitName Value="frm_bookmarks"/>
</Unit35>
+ <Unit36>
+ <Filename Value="lzwdecompress.pas"/>
+ <IsPartOfProject Value="True"/>
+ <UnitName Value="LZWDecompress"/>
+ </Unit36>
</Units>
</ProjectOptions>
<CompilerOptions>
diff --git a/docview/src/docview.lpr b/docview/src/docview.lpr
index e49aa4c3..0bee1dbe 100644
--- a/docview/src/docview.lpr
+++ b/docview/src/docview.lpr
@@ -7,12 +7,13 @@ uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
- Classes, fpg_main, frm_main, IPFEscapeCodes, HelpTopic, CompareWordUnit, SearchTable,
- TextSearchQuery, nvUtilities, HelpFile, SearchUnit, fpg_cmdlineparams,
- IPFFileFormatUnit, HelpWindowDimensions, NewViewConstantsUnit, SettingsUnit,
+ Classes, fpg_main, frm_main, IPFEscapeCodes, HelpTopic, CompareWordUnit,
+ SearchTable, TextSearchQuery, nvUtilities, HelpFile, SearchUnit,
+ fpg_cmdlineparams, IPFFileFormatUnit, HelpWindowDimensions, SettingsUnit,
RichTextStyleUnit, CanvasFontManager, ACLStringUtility, RichTextDocumentUnit,
RichTextView, RichTextLayoutUnit, RichTextDisplayUnit, dvconstants, dvHelpers,
- frm_configuration, HelpBitmap, frm_text, frm_note, HelpNote, HelpBookmark;
+ frm_configuration, HelpBitmap, frm_text, frm_note, HelpNote, HelpBookmark,
+ frm_bookmarks, LZWDecompress;
{$IFDEF WINDOWS}
{$R docview.rc}
diff --git a/docview/src/docview.rc b/docview/src/docview.rc
index 87597a3f..34ed0c18 100644
--- a/docview/src/docview.rc
+++ b/docview/src/docview.rc
@@ -1,8 +1,8 @@
MAINICON ICON "../images/docview-48x48.ico"
1 VERSIONINFO
-FILEVERSION 0, 8, 0, 0
-PRODUCTVERSION 0, 8, 0, 0
+FILEVERSION 1, 0, 0, 0
+PRODUCTVERSION 1, 0, 0, 0
FILEFLAGSMASK 0
FILEOS 0x40000
FILETYPE 1
@@ -13,12 +13,12 @@ FILETYPE 1
{
VALUE "CompanyName", "fpGUI Toolkit"
VALUE "FileDescription", "fpGUI's INF Documentation Viewer"
- VALUE "FileVersion", "0.8.0"
+ VALUE "FileVersion", "1.0.0"
VALUE "InternalName", "docview"
VALUE "LegalCopyright", "GNU Public License"
VALUE "OriginalFilename", "docview"
VALUE "ProductName", "fpGUI Toolkit"
- VALUE "ProductVersion", "0.8.0"
+ VALUE "ProductVersion", "1.0.0"
}
}
BLOCK "VarFileInfo"
diff --git a/docview/src/dvHelpers.pas b/docview/src/dvHelpers.pas
index 28dc7809..2aaf710a 100644
--- a/docview/src/dvHelpers.pas
+++ b/docview/src/dvHelpers.pas
@@ -7,9 +7,6 @@ interface
uses
Classes, SysUtils, fpg_base;
-const
- OWN_HELP_MARKER = '[DOCVIEWHELP]';
-
function GetOwnHelpFileName: String;
// Given a filename, which may or may not contain a path or extension,
diff --git a/docview/src/dvconstants.pas b/docview/src/dvconstants.pas
index 9e0073be..e549bfe8 100644
--- a/docview/src/dvconstants.pas
+++ b/docview/src/dvconstants.pas
@@ -36,6 +36,7 @@ const
NOTES_FILE_EXTENSION = ExtensionSeparator + 'notes';
BOOKMARK_FILE_EXTENSION = ExtensionSeparator + 'bookmark';
BOOKMARK_SECTION = '[BOOKMARK]';
+ OWN_HELP_MARKER = '[DOCVIEWHELP]';
cDocViewHelpFile = 'docview.inf';
@@ -60,6 +61,18 @@ const
hcConfigGeneralTab = 510;
hcConfigFontsColorTab = 520;
+const
+ PARAM_LINK_NOTE = 'note';
+ PARAM_LINK_PROGRAM = 'program';
+ PARAM_LINK_URL = 'url';
+ PARAM_LINK_EXTERNAL = 'external';
+
+ PRGM_EXPLORER = 'explore'; // web explorer
+ PRGM_NETSCAPE = 'netscape';
+ PRGM_MOZILLA = 'mozilla';
+ PRGM_FIREFOX = 'firefox';
+
+
implementation
diff --git a/docview/src/frm_bookmarks.pas b/docview/src/frm_bookmarks.pas
new file mode 100644
index 00000000..4180b74f
--- /dev/null
+++ b/docview/src/frm_bookmarks.pas
@@ -0,0 +1,312 @@
+unit frm_bookmarks;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+ SysUtils,
+ Classes,
+ fpg_base,
+ fpg_main,
+ fpg_form,
+ fpg_listbox,
+ fpg_button,
+ HelpBookmark;
+
+type
+ TBookmarkCallback = procedure(Bookmark: TBookmark) of object;
+
+ TBookmarksForm = class(TfpgForm)
+ private
+ {@VFD_HEAD_BEGIN: BookmarksForm}
+ lbBookmarks: TfpgListBox;
+ btnRename: TfpgButton;
+ btnDelete: TfpgButton;
+ btnGoTo: TfpgButton;
+ btnHelp: TfpgButton;
+ btnClose: TfpgButton;
+ {@VFD_HEAD_END: BookmarksForm}
+ FBookmarkList: TList;
+ FOnBookmarksChanged: TNotifyEvent;
+ FOnGotoBookmark: TBookmarkCallback;
+ procedure lbBookmarksKeyPressed(Sender: TObject; var KeyCode: word; var ShiftState: TShiftState; var Consumed: boolean);
+ procedure FormShow(Sender: TObject);
+ procedure lbBookmarksDoubleClicked(Sender: TObject; AButton: TMouseButton; AShift: TShiftState; const AMousePos: TPoint);
+ procedure btnRenameClicked(Sender: TObject);
+ procedure btnDeleteClicked(Sender: TObject);
+ procedure btnGotoClicked(Sender: TObject);
+ procedure btnHelpClicked(Sender: TObject);
+ procedure btnCloseClicked(Sender: TObject);
+ function SelectedObject(ListBox: TfpgListBox): TObject;
+ procedure UpdateControls;
+ function GetSelectedBookmark: TBookmark;
+ procedure GotoSelectedBookmark;
+ public
+ procedure AfterCreate; override;
+ procedure RefreshList;
+ published
+ property BookmarkList: TList read FBookmarkList write FBookmarkList;
+ property OnBookmarksChanged: TNotifyEvent read FOnBookmarksChanged write FOnBookmarksChanged;
+ property OnGotoBookmark: TBookmarkCallback read FOnGotoBookmark write FOnGotoBookmark;
+ end;
+
+{@VFD_NEWFORM_DECL}
+
+implementation
+
+uses
+ fpg_dialogs;
+
+{@VFD_NEWFORM_IMPL}
+
+procedure TBookmarksForm.lbBookmarksKeyPressed(Sender: TObject;
+ var KeyCode: word; var ShiftState: TShiftState; var Consumed: boolean);
+begin
+ if (KeyCode = keyEnter) or (KeyCode = keyPEnter) then
+ begin
+ GotoSelectedBookmark;
+ Close;
+ end;
+end;
+
+procedure TBookmarksForm.FormShow(Sender: TObject);
+begin
+ RefreshList;
+ lbBookmarks.SetFocus;
+end;
+
+procedure TBookmarksForm.lbBookmarksDoubleClicked(Sender: TObject;
+ AButton: TMouseButton; AShift: TShiftState; const AMousePos: TPoint);
+begin
+ GotoSelectedBookmark;
+ Close;
+end;
+
+procedure TBookmarksForm.btnRenameClicked(Sender: TObject);
+var
+ Bookmark: TBookmark;
+ lName: TfpgString;
+begin
+ Bookmark := GetSelectedBookmark;
+ if Bookmark = nil then
+ exit;
+
+ lName := Bookmark.Name;
+ if fpgInputQuery( 'Rename Bookmark', 'Enter the new name of the bookmark', lName ) then
+ begin
+ Bookmark.Name := lName;
+ if Assigned(OnBookmarksChanged) then
+ OnBookmarksChanged(self);
+ // redisplay name in list
+ lbBookmarks.Items[lbBookmarks.FocusItem] := Bookmark.Name;
+ lbBookmarks.Invalidate;
+ end;
+end;
+
+procedure TBookmarksForm.btnDeleteClicked(Sender: TObject);
+var
+ Bookmark: TBookmark;
+ BookmarkIndex: integer;
+begin
+ Bookmark := GetSelectedBookmark;
+ if Bookmark = nil then
+ exit;
+
+ if TfpgMessageDialog.Question('Delete Bookmark',
+ Format('Delete the bookmark named "%s"?', [Bookmark.Name])) = mbYes then
+ begin
+ BookmarkIndex := BookmarkList.IndexOf( Bookmark );
+ lbBookmarks.Items.Delete( BookmarkIndex );
+ BookmarkList.Delete( BookmarkIndex );
+
+ if BookmarkIndex > BookmarkList.Count - 1 then
+ BookmarkIndex := BookmarkList.Count - 1;
+
+ lbBookmarks.FocusItem := BookmarkIndex;
+
+ Bookmark.Free;
+ if Assigned(OnBookmarksChanged) then
+ OnBookmarksChanged(self);
+ lbBookmarks.Invalidate;
+
+ UpdateControls;
+ end;
+end;
+
+procedure TBookmarksForm.btnGotoClicked(Sender: TObject);
+begin
+ GotoSelectedBookmark;
+end;
+
+procedure TBookmarksForm.btnHelpClicked(Sender: TObject);
+begin
+ InvokeHelp;
+end;
+
+procedure TBookmarksForm.btnCloseClicked(Sender: TObject);
+begin
+ Close;
+end;
+
+function TBookmarksForm.SelectedObject(ListBox: TfpgListBox): TObject;
+begin
+ if (ListBox.FocusItem >= 0) and (ListBox.FocusItem < ListBox.Items.Count) then
+ Result := ListBox.Items.Objects[ListBox.FocusItem]
+ else
+ Result := nil;
+end;
+
+procedure TBookmarksForm.UpdateControls;
+var
+ Selected: Boolean;
+begin
+ Selected := GetSelectedBookmark <> nil;
+ btnRename.Enabled := Selected;
+ btnDelete.Enabled := Selected;
+ btnGoto.Enabled := Selected;
+ if not btnGoto.Enabled then
+ btnGoto.Default := false;
+end;
+
+function TBookmarksForm.GetSelectedBookmark: TBookmark;
+begin
+ if SelectedObject(lbBookmarks) = nil then
+ result := nil
+ else
+ result := SelectedObject(lbBookmarks) as TBookmark;
+end;
+
+procedure TBookmarksForm.GotoSelectedBookmark;
+begin
+ if Assigned(FOnGotoBookmark) then
+ if GetSelectedBookmark <> nil then
+ FOnGotoBookmark(GetSelectedBookmark);
+end;
+
+procedure TBookmarksForm.AfterCreate;
+begin
+ {%region 'Auto-generated GUI code' -fold}
+ {@VFD_BODY_BEGIN: BookmarksForm}
+ Name := 'BookmarksForm';
+ SetPosition(553, 246, 393, 247);
+ WindowTitle := 'Bookmarks';
+ Hint := '';
+ HelpType := htContext;
+ HelpContext := 8;
+ OnShow := @FormShow;
+
+ lbBookmarks := TfpgListBox.Create(self);
+ with lbBookmarks do
+ begin
+ Name := 'lbBookmarks';
+ SetPosition(8, 12, 272, 227);
+ Anchors := [anLeft,anRight,anTop,anBottom];
+ FontDesc := '#List';
+ Hint := '';
+ TabOrder := 1;
+ OnDoubleClick := @lbBookmarksDoubleClicked;
+ OnKeyPress := @lbBookmarksKeyPressed;
+ end;
+
+ btnRename := TfpgButton.Create(self);
+ with btnRename do
+ begin
+ Name := 'btnRename';
+ SetPosition(288, 16, 96, 23);
+ Anchors := [anRight,anTop];
+ Text := 'Rename...';
+ FontDesc := '#Label1';
+ Hint := '';
+ ImageName := '';
+ TabOrder := 2;
+ OnClick := @btnRenameClicked;
+ end;
+
+ btnDelete := TfpgButton.Create(self);
+ with btnDelete do
+ begin
+ Name := 'btnDelete';
+ SetPosition(288, 44, 96, 23);
+ Anchors := [anRight,anTop];
+ Text := 'Delete';
+ FontDesc := '#Label1';
+ Hint := '';
+ ImageName := '';
+ TabOrder := 3;
+ OnClick := @btnDeleteClicked;
+ end;
+
+ btnGoTo := TfpgButton.Create(self);
+ with btnGoTo do
+ begin
+ Name := 'btnGoTo';
+ SetPosition(288, 72, 96, 23);
+ Anchors := [anRight,anTop];
+ Text := 'Goto';
+ FontDesc := '#Label1';
+ Hint := '';
+ ImageName := '';
+ TabOrder := 4;
+ Default := True;
+ OnClick := @btnGotoClicked;
+ end;
+
+ btnHelp := TfpgButton.Create(self);
+ with btnHelp do
+ begin
+ Name := 'btnHelp';
+ SetPosition(288, 100, 96, 23);
+ Anchors := [anRight,anTop];
+ Text := 'Help';
+ FontDesc := '#Label1';
+ Hint := '';
+ ImageName := '';
+ TabOrder := 5;
+ OnClick := @btnHelpClicked;
+ end;
+
+ btnClose := TfpgButton.Create(self);
+ with btnClose do
+ begin
+ Name := 'btnClose';
+ SetPosition(288, 217, 96, 23);
+ Anchors := [anRight,anBottom];
+ Text := 'Close';
+ FontDesc := '#Label1';
+ Hint := '';
+ ImageName := '';
+ TabOrder := 6;
+ OnClick := @btnCloseClicked;
+ end;
+
+ {@VFD_BODY_END: BookmarksForm}
+ {%endregion}
+end;
+
+procedure TBookmarksForm.RefreshList;
+var
+ i: integer;
+ Bookmark: TBookmark;
+Begin
+ lbBookmarks.Items.BeginUpdate;
+
+ lbBookmarks.Items.Clear;
+
+ if not Assigned(BookmarkList) then
+ exit;
+
+ for i := 0 to BookmarkList.Count - 1 do
+ begin
+ Bookmark := TBookmark(BookmarkList[i]);
+ lbBookmarks.Items.AddObject(Bookmark.Name, Bookmark);
+ end;
+
+ if lbBookmarks.Items.Count > 0 then
+ lbBookmarks.FocusItem := 0;
+
+ lbBookmarks.Items.EndUpdate;
+ UpdateControls;
+End;
+
+end.
diff --git a/docview/src/frm_main.pas b/docview/src/frm_main.pas
index 0b8cd694..97a9fd04 100644
--- a/docview/src/frm_main.pas
+++ b/docview/src/frm_main.pas
@@ -58,6 +58,7 @@ type
RichView: TRichTextView;
MainMenu: TfpgMenuBar;
miFile: TfpgPopupMenu;
+ miActions: TfpgPopupMenu;
miSettings: TfpgPopupMenu;
miBookmarks: TfpgPopupMenu;
miView: TfpgPopupMenu;
@@ -129,9 +130,19 @@ type
procedure miFileOpenAdditionalFileClicked(Sender: TObject);
procedure miFileOpenSpecialClicked(Sender: TObject);
procedure miFileCloseClicked(Sender: TObject);
+ procedure miActionsContentsClicked(Sender: TObject);
+ procedure miActionsIndexClicked(Sender: TObject);
+ procedure miActionsSearchClicked(Sender: TObject);
+ procedure miActionsNotesClicked(Sender: TObject);
+ procedure miActionsHistoryClicked(Sender: TObject);
+ procedure miActionsBackClicked(Sender: TObject);
+ procedure miActionsForwardClicked(Sender: TObject);
+ procedure miActionsPrevTopicClicked(Sender: TObject);
+ procedure miActionsNextTopicClicked(Sender: TObject);
procedure miConfigureClicked(Sender: TObject);
procedure miViewExpandAllClicked(Sender: TObject);
procedure miViewCollapseAllClicked(Sender: TObject);
+ procedure miOpenBookmarksMenuClicked(Sender: TObject);
procedure miBookmarksMenuItemClicked(Sender: TObject);
procedure miHelpProdInfoClicked(Sender: TObject);
procedure miHelpAboutFPGui(Sender: TObject);
@@ -234,7 +245,6 @@ type
procedure ClearBookmarks;
procedure OnBookmarksChanged(Sender: TObject);
procedure BuildBookmarksMenu;
- procedure UpdateBookmarksDisplay;
procedure NavigateToBookmark(Bookmark: TBookmark);
public
constructor Create(AOwner: TComponent); override;
@@ -265,7 +275,7 @@ uses
,frm_configuration
,frm_text
,frm_note
- ,NewViewConstantsUnit
+ ,frm_bookmarks
,CanvasFontManager
,HelpNote
,RichTextDocumentUnit
@@ -298,6 +308,26 @@ begin
end
end;
+procedure TMainForm.miActionsBackClicked(Sender: TObject);
+begin
+ btnBack.Click;
+end;
+
+procedure TMainForm.miActionsForwardClicked(Sender: TObject);
+begin
+ btnFwd.Click;
+end;
+
+procedure TMainForm.miActionsPrevTopicClicked(Sender: TObject);
+begin
+ btnPrev.Click;
+end;
+
+procedure TMainForm.miActionsNextTopicClicked(Sender: TObject);
+begin
+ btnNext.Click;
+end;
+
procedure TMainForm.Splitter1DoubleClicked(Sender: TObject;
AButton: TMouseButton; AShift: TShiftState; const AMousePos: TPoint);
begin
@@ -420,9 +450,12 @@ end;
procedure TMainForm.RichViewClickLink(Sender: TRichTextView; Link: string);
var
+ LinkDetails: TfpgString;
LinkIndex: integer;
lLink: THelpLink;
lHelp: THelpFile;
+ f: THelpFile;
+ lHelpFileName: TfpgString;
i: integer;
lTopic: TTopic;
lFound: Boolean;
@@ -441,11 +474,36 @@ begin
end
else if pos(PARAM_LINK_EXTERNAL, Link) > 0 then
begin
- TfpgMessageDialog.Warning('', 'External links are not supported in DocView yet. Please try again with a later build.')
+ LinkDetails := StrRightFrom( Link, 10 ); // 10 is starting pos of data, after 'external '
+ LinkIndex := StrToInt( ExtractNextValue( LinkDetails, ' ' ) );
+ lHelp := CurrentTopic.HelpFile as THelpFile;
+
+ lHelpFileName := lHelp.ReferencedFiles[ LinkIndex ];
+
+ { Only open the external file once. So see if it is already openned. }
+ lFound := False;
+ for i := 0 to CurrentOpenFiles.Count-1 do
+ begin
+ f := THelpFile(CurrentOpenFiles[i]);
+ if SameText(fpgExtractFileName(f.Filename), lHelpFileName) then
+ lFound := True;
+ end;
+ if not lFound then
+ begin
+ OpenAdditionalFile := True;
+ OpenFile(lHelpFileName, '', false);
+ OpenAdditionalFile := False;
+ end;
+
+ { Not sure if we have an ID or Resource Name, so lets try both if possible }
+ if TryStrToInt(LinkDetails, i) then
+ DisplayTopicByResourceID(i)
+ else
+ DisplayTopicByName(LinkDetails);
end
else if pos(PARAM_LINK_URL, Link) > 0 then
begin
- // we have a external URL of some kind
+ // we have an external URL of some kind
// format is always: 'url "<uri>"'
lURL := StringReplace(Link, 'url "', '', []);
lURL := UTF8Copy(lURL, 0, UTF8Length(lURL)-1);
@@ -578,6 +636,31 @@ begin
CloseFile;
end;
+procedure TMainForm.miActionsContentsClicked(Sender: TObject);
+begin
+ PageControl1.ActivePage := tsContents;
+end;
+
+procedure TMainForm.miActionsIndexClicked(Sender: TObject);
+begin
+ PageControl1.ActivePage := tsIndex;
+end;
+
+procedure TMainForm.miActionsSearchClicked(Sender: TObject);
+begin
+ PageControl1.ActivePage := tsSearch;
+end;
+
+procedure TMainForm.miActionsNotesClicked(Sender: TObject);
+begin
+ PageControl1.ActivePage := tsNotes;
+end;
+
+procedure TMainForm.miActionsHistoryClicked(Sender: TObject);
+begin
+ PageControl1.ActivePage := tsHistory;
+end;
+
procedure TMainForm.miConfigureClicked(Sender: TObject);
begin
ShowConfigForm;
@@ -594,6 +677,21 @@ begin
tvContents.FullCollapse;
end;
+procedure TMainForm.miOpenBookmarksMenuClicked(Sender: TObject);
+var
+ frm: TBookmarksForm;
+begin
+ frm := TBookmarksForm.Create(nil);
+ try
+ frm.BookmarkList := Bookmarks;
+ frm.OnGotoBookmark := @NavigateToBookmark;
+ frm.OnBookmarksChanged := @OnBookmarksChanged;
+ frm.ShowModal;
+ finally
+ frm.Free;
+ end;
+end;
+
procedure TMainForm.miBookmarksMenuItemClicked(Sender: TObject);
var
t: PtrInt;
@@ -2465,8 +2563,7 @@ begin
if ImageIndices.Count > 0 then
begin
- { TODO -oGraeme : We do not support images yet }
-// THelpFile(CurrentTopic.HelpFile).GetImages(ImageIndices, FImages);
+ THelpFile(CurrentTopic.HelpFile).GetImages(ImageIndices, FImages);
end;
ImageIndices.Free;
@@ -2531,6 +2628,7 @@ var
begin
inherited Create(AOwner);
fpgApplication.OnException := @MainFormException;
+ fpgApplication.HelpFile := cDocViewHelpFile;
OnShow := @MainFormShow;
OnDestroy := @MainFormDestroy;
// Files := TList.Create;
@@ -3078,17 +3176,34 @@ begin
begin
Name := 'miFile';
SetPosition(292, 96, 132, 20);
- AddMenuItem('Open...', 'Ctrl+O', @miFileOpenClicked);
- AddMenuItem('Open additional file...', 'Ctrl+Shift+O', @miFileOpenAdditionalFileClicked);
- AddMenuItem('Open Special...', 'Ctrl+L', @miFileOpenSpecialClicked);
- AddMenuItem('Save current Topic to IPF...', 'Ctrl+S', @miFileSaveTopicAsIPF);
- AddMenuItem('Close', 'Ctrl+W', @miFileCloseClicked);
- AddMenuitem('-', '', nil);
+ AddMenuItem('Open...', rsKeyCtrl+'O', @miFileOpenClicked);
+ AddMenuItem('Open additional file...', rsKeyCtrl+rsKeyShift+'O', @miFileOpenAdditionalFileClicked);
+ AddMenuItem('Open Special...', rsKeyCtrl+'L', @miFileOpenSpecialClicked);
+ AddMenuItem('Save current Topic to IPF...', rsKeyCtrl+'S', @miFileSaveTopicAsIPF);
+ AddMenuItem('Close', rsKeyCtrl+'W', @miFileCloseClicked);
+ AddSeparator;
FFileOpenRecent := AddMenuItem('Open Recent...', '', nil);
AddMenuitem('-', '', nil);
AddMenuItem('Quit', 'Ctrl+Q', @miFileQuitClicked);
end;
+ miActions := TfpgPopupMenu.Create(self);
+ with miActions do
+ begin
+ Name := 'miActions';
+ SetPosition(282, 96, 132, 20);
+ AddMenuItem('Contents', 'F5', @miActionsContentsClicked);
+ AddMenuItem('Index', 'F6', @miActionsIndexClicked);
+ AddMenuItem('Search', 'F7', @miActionsSearchClicked);
+ AddMenuItem('Notes', 'F8', @miActionsNotesClicked);
+ AddMenuItem('History', 'F9', @miActionsHistoryClicked);
+ AddSeparator;
+ AddMenuItem('Back', rsKeyCtrl+'Left', @miActionsBackClicked);
+ AddMenuItem('Forward', rsKeyCtrl+'Right', @miActionsForwardClicked);
+ AddMenuItem('Previous Topic', rsKeyCtrl+'Up', @miActionsPrevTopicClicked);
+ AddMenuItem('Next Topic', rsKeyCtrl+'Down', @miActionsNextTopicClicked);
+ end;
+
miSettings := TfpgPopupMenu.Create(self);
with miSettings do
begin
@@ -3102,8 +3217,10 @@ begin
begin
Name := 'miBookmarks';
SetPosition(292, 144, 132, 20);
- AddMenuItem('Add..', '', nil).Enabled := False;
- AddMenuItem('Show', '', nil).Enabled := False;
+ AddMenuItem('Add', rsKeyCtrl+'B', @btnBookmarkClick);
+ AddMenuItem('Edit...', rsKeyCtrl+'D', @miOpenBookmarksMenuClicked);
+ AddSeparator;
+ AddMenuItem('Add note at cursor position', rsKeyCtrl+'M', @btnNotesAddClick);
end;
miView := TfpgPopupMenu.Create(self);
@@ -3113,7 +3230,7 @@ begin
SetPosition(292, 216, 132, 20);
AddMenuItem('Expand All', '', @miViewExpandAllClicked);
AddMenuItem('Collapse All', '', @miViewCollapseAllClicked);
- AddMenuItem('-', '', nil);
+ AddSeparator;
AddMenuItem('Topic Properties', '', @miTopicPropertiesClicked);
end;
@@ -3137,9 +3254,9 @@ begin
begin
Name := 'miHelp';
SetPosition(292, 168, 132, 20);
- AddMenuItem('Help using DocView', '', @miHelpUsingDocView);
- AddMenuItem('Command line parameters', '', @miHelpCmdLineParams);
- AddMenuItem('-', '', nil);
+ AddMenuItem('Help using DocView', rsKeyCtrl+'F1', @miHelpUsingDocView);
+ AddMenuItem('Command line parameters', rsKeyCtrl+rsKeyShift+'F1', @miHelpCmdLineParams);
+ AddSeparator;
AddMenuItem('About fpGUI Toolkit...', '', @miHelpAboutFPGui);
AddMenuItem('Product Information...', '', @miHelpProdInfoClicked);
end;
@@ -3375,6 +3492,7 @@ begin
// hook up the sub-menus.
MainMenu.AddMenuItem('&File', nil).SubMenu := miFile;
MainMenu.AddMenuItem('&Settings', nil).SubMenu := miSettings;
+ MainMenu.AddMenuItem('&Actions', nil).SubMenu := miActions;
MainMenu.AddMenuItem('&Bookmarks', nil).SubMenu := miBookmarks;
MainMenu.AddMenuItem('&Tools', nil).SubMenu := miTools;
MainMenu.AddMenuItem('&Help', nil).SubMenu := miHelp;
@@ -3842,7 +3960,6 @@ end;
procedure TMainForm.OnBookmarksChanged(Sender: TObject);
begin
BuildBookmarksMenu;
-// UpdateBookmarksForm;
SaveBookmarks;
end;
@@ -3870,33 +3987,6 @@ begin
end;
end;
-procedure TMainForm.UpdateBookmarksDisplay;
-var
- i: integer;
- Bookmark: TBookmark;
-Begin
-(*
- BookmarksListBox.Items.BeginUpdate;
- BookmarksListBox.Clear;
-
- if not Assigned( BookmarkList ) then
- exit;
-
- for i := 0 to BookmarkList.Count - 1 do
- begin
- Bookmark := BookmarkList[ i ];
- BookmarksListBox.Items.AddObject( Bookmark.Name,
- Bookmark );
- end;
-
- if BookmarksListBox.Items.Count > 0 then
- BookmarksListBox.ItemIndex := 0;
-
- BookmarksListBox.Items.EndUpdate;
- UpdateControls;
-*)
-end;
-
procedure TMainForm.NavigateToBookmark(Bookmark: TBookmark);
begin
DisplayTopic(Bookmark.ContentsTopic);
diff --git a/docview/src/frm_note.pas b/docview/src/frm_note.pas
index 2e280a89..310cc252 100644
--- a/docview/src/frm_note.pas
+++ b/docview/src/frm_note.pas
@@ -5,7 +5,13 @@ unit frm_note;
interface
uses
- SysUtils, Classes, fpg_base, fpg_main, fpg_form, fpg_memo, fpg_button;
+ SysUtils,
+ Classes,
+ fpg_base,
+ fpg_main,
+ fpg_form,
+ fpg_memo,
+ fpg_button;
type
@@ -23,6 +29,7 @@ type
function GetText: TfpgString;
procedure SetText(const AValue: TfpgString);
procedure SetCanDelete(const AValue: boolean);
+ procedure btnHelpClicked(Sender: TObject);
public
procedure AfterCreate; override;
property Text: TfpgString read GetText write SetText;
@@ -56,6 +63,11 @@ begin
btnDelete.Enabled := FCanDelete;
end;
+procedure TNoteForm.btnHelpClicked(Sender: TObject);
+begin
+ InvokeHelp;
+end;
+
procedure TNoteForm.AfterCreate;
begin
{%region 'Auto-generated GUI code' -fold}
@@ -65,6 +77,8 @@ begin
WindowTitle := 'Notes';
Hint := '';
OnShow := @FormShow;
+ HelpType := htContext;
+ HelpContext := 7;
Memo1 := TfpgMemo.Create(self);
with Memo1 do
@@ -102,6 +116,7 @@ begin
Hint := '';
ImageName := '';
TabOrder := 3;
+ OnClick := @btnHelpClicked;
end;
btnCancel := TfpgButton.Create(self);
diff --git a/docview/src/lzwdecompress.pas b/docview/src/lzwdecompress.pas
new file mode 100644
index 00000000..0ebba38c
--- /dev/null
+++ b/docview/src/lzwdecompress.pas
@@ -0,0 +1,263 @@
+{
+ fpGUI - Free Pascal GUI Toolkit
+
+ Copyright (C) 2006 - 2013 See the file AUTHORS.txt, included in this
+ distribution, for details of the copyright.
+
+ See the file COPYING.modifiedLGPL, included in this distribution,
+ for details about redistributing fpGUI.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ Description:
+ LZW decompression code for uncompressing IPF bitmaps.
+}
+
+unit LZWDecompress;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+ SysUtils, types;
+
+procedure LZWDecompressBlock( pbInput: pByte;
+ number_bytes: LongWord;
+ pbOutput: PBYTE;
+ Var bytesOut: LongWord;
+ Var FinalCode: byte );
+
+Implementation
+
+(*
+/********************************************************************
+ * *
+ * LZW decompression *
+ * *
+ *******************************************************************/
+
+/*
+ * This is based on code (W) by Peter Fitzsimmons, pfitz@ican.net.
+ * His liner notes in the original:
+ * has its roots in a June 1990
+ * DDJ article "LZW REVISITED", by Shawn M. Regan
+ * --=>revision history<=--
+ * 1 lzw.c 21-Aug-96,2:24:36,`PLF' ;
+ * 2 lzw.c 24-Aug-96,2:27:24,`PLF' wip
+ *
+ * The code has been modified to take the input not from an
+ * open file, but from any memory region. For this, a double
+ * pointer is used, which must be passed to LZWDecompressBlock.
+ * I've also added a few comments for clarity.
+ *
+ * Ported to Sibyl Pascal by Aaron Lawrence
+ * Variables renamed etc to make things clearer.
+ */
+*)
+// -- Stuff for LZW decompression -- */
+const INIT_BITS = 9;
+const MAX_BITS = 12; //PLF Tue 95-10-03 02:16:56*/
+const HASHING_SHIFT = MAX_BITS - 8;
+
+{if MAX_BITS == 15
+const TABLE_SIZE 36768
+#elif MAX_BITS == 14
+const TABLE_SIZE 18041
+#elif MAX_BITS == 13
+const TABLE_SIZE 9029
+#else}
+// For max_bits = 12:
+const TABLE_SIZE = 5021;
+
+const CLEAR_TABLE = 256;
+const TERMINATOR = 257;
+const FIRST_CODE = 258;
+
+function MaxValNBits( N: word ): word;
+begin
+ Result:= ( 1 shl n ) - 1;
+end;
+
+var
+ prefix_code: array[ 0..TABLE_SIZE ] of longword;
+ append_character: array[ 0..TABLE_SIZE ] of Byte;
+ decode_stack: array[ 0..10000 ] of byte;
+ bitsPerCode: longint;
+ maxDictionaryCode: longint;
+
+(*
+ * decode_string:
+ *
+ *)
+function decode_string( buffer: PByte; code: longword ): PByte;
+var
+ i: longint;
+begin
+ i:= 0;
+
+ while Code > 255 do
+ begin
+ buffer^:= append_character[ Code ];
+ inc( Buffer );
+ code:= prefix_code[ code ];
+
+ inc( i );
+ if i > High( decode_stack ) then
+ assert( false, 'Out of space decompressing bitmap!' );
+ end;
+
+ buffer^ := code;
+ Result:= buffer;
+end;
+
+(*
+ * input_code:
+ * this function reads in bytes from the input
+ * stream.
+ *)
+
+var
+ bytes_out: longword = 0;
+ input_bit_count: longword = 0;
+ input_bit_buffer: longword = 0;
+
+// I think this simply reads the next bitsPerCode bits of the input data
+// returning the resulting code.
+function input_code( var pbInput: PBYTE; bytes_to_read: longword ): longword;
+var
+ return_value: longword;
+begin
+ while input_bit_count <= 24 do
+ begin
+ if bytes_out <= bytes_to_read then
+ begin
+ input_bit_buffer:= input_bit_buffer
+ or
+ ( ( longword( pbInput^ ) shl (24 - input_bit_count) ) );
+ inc( pbInput );
+ end
+ else
+ input_bit_buffer:= input_bit_buffer
+ or
+ ( longword( 0 ) shl ( 24 - input_bit_count ) );
+ inc( bytes_out );
+ inc( input_bit_count, 8 );
+ end;
+
+ return_value:= input_bit_buffer shr (32 - bitsPerCode);
+ input_bit_buffer:= input_bit_buffer shl bitsPerCode;
+ dec( input_bit_count, bitsPerCode );
+
+ if bytes_out > bytes_to_read then
+ begin
+ // flush static vars and quit */
+ bytes_out:= 0;
+ input_bit_count:= 0;
+ input_bit_buffer:= 0;
+ Result:= TERMINATOR;
+ end
+ else
+ Result:= return_value;
+end;
+
+// LZWDecompressBlock:
+// this takes one of the INF bitmap blocks
+// and decompresses it using LZW algorithms.
+
+procedure LZWDecompressBlock( pbInput: pByte;
+ number_bytes: LongWord;
+ pbOutput: PBYTE;
+ Var bytesOut: LongWord;
+ Var FinalCode: byte );
+var
+ nextAvailableCode: LongWord;
+ currentCode: LongWord;
+ lastCode: LongWord;
+ character: longword;
+ clear_flag: boolean;
+ theString: pByte;
+begin
+ clear_flag:= true;
+
+ nextAvailableCode:= FIRST_CODE;
+ bitsPerCode:= INIT_BITS;
+ maxDictionaryCode:= MaxValNBits( bitsPerCode );
+
+ bytesOut:= 0;
+ input_bit_count:= 0;
+ input_bit_buffer:= 0;
+
+ // read the first code from input
+ currentCode:= input_code( pbInput, number_bytes );
+ while currentCode <> TERMINATOR do
+ begin
+ if clear_flag then
+ begin
+ clear_flag:= false;
+ lastCode:= currentCode;
+ character:= currentCode;
+
+ pbOutput^:= currentCode;
+ inc( pbOutput );
+ FinalCode:= currentCode;
+ inc( BytesOut );
+ end
+ else if currentCode = CLEAR_TABLE then
+ begin
+ clear_flag:= true;
+ nextAvailableCode:= FIRST_CODE;
+ bitsPerCode:= INIT_BITS;
+ maxDictionaryCode:= MaxValNBits( bitsPerCode );
+ end
+ else
+ begin
+ if currentCode >= nextAvailableCode then
+ begin
+ decode_stack[ 0 ]:= character;
+ theString:= decode_string( Addr( decode_stack[ 1 ] ),
+ lastCode );
+ end
+ else
+ theString:= decode_string( Addr( decode_stack[ 0 ] ),
+ currentCode );
+
+ character:= longword( theString^ );
+ while theString >= Addr( decode_stack[ 0 ] ) do
+ begin
+ FinalCode:= theString^;
+
+ pbOutput^:= theString^;
+ inc( pbOutput );
+ dec( TheString );
+
+ inc( BytesOut );
+ end;
+
+ if nextAvailableCode <= maxDictionaryCode then
+ begin
+ prefix_code[ nextAvailableCode ]:= lastCode;
+ append_character[ nextAvailableCode ]:= character;
+
+ inc( nextAvailableCode );
+
+ if ( nextAvailableCode = maxDictionaryCode ) and ( bitsPerCode < MAX_BITS ) then
+ begin
+ // expand dictionary
+ inc( bitsPerCode );
+ maxDictionaryCode:= MaxValNBits( bitsPerCode );
+ end;
+ end;
+
+ lastCode:= currentCode;
+ end;
+
+ // Read next code from input
+ currentCode:= input_code( pbInput, number_bytes );
+ end;
+end;
+
+
+End.
diff --git a/examples/apps/debugserver/fpgDebugServer.lpi b/examples/apps/debugserver/fpgDebugServer.lpi
index da1b22f2..f26f35ee 100644
--- a/examples/apps/debugserver/fpgDebugServer.lpi
+++ b/examples/apps/debugserver/fpgDebugServer.lpi
@@ -54,7 +54,7 @@
<CompilerOptions>
<Version Value="11"/>
<Target>
- <Filename Value="fpgDebugServer"/>
+ <Filename Value="dbugsrv"/>
</Target>
<SearchPaths>
<UnitOutputDirectory Value="units/$(TargetCPU)-$(TargetOS)"/>
diff --git a/examples/apps/docedit/docedit.lpi b/examples/apps/docedit/docedit.lpi
index 640d3114..3e06fdd7 100644
--- a/examples/apps/docedit/docedit.lpi
+++ b/examples/apps/docedit/docedit.lpi
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<CONFIG>
<ProjectOptions>
- <Version Value="7"/>
+ <Version Value="9"/>
<General>
<Flags>
<SaveOnlyProjectUnits Value="True"/>
@@ -9,11 +9,13 @@
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
- <TargetFileExt Value=""/>
</General>
<VersionInfo>
- <ProjectVersion Value=""/>
+ <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)"/>
@@ -69,9 +71,19 @@
</Units>
</ProjectOptions>
<CompilerOptions>
- <Version Value="8"/>
+ <Version Value="11"/>
+ <Target>
+ <Filename Value="docedit"/>
+ </Target>
+ <SearchPaths>
+ <UnitOutputDirectory Value="units"/>
+ </SearchPaths>
+ <Parsing>
+ <SyntaxOptions>
+ <UseAnsiStrings Value="False"/>
+ </SyntaxOptions>
+ </Parsing>
<Other>
- <CustomOptions Value="-FUunits"/>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
diff --git a/examples/apps/docedit/frm_main.pas b/examples/apps/docedit/frm_main.pas
index f6404b79..884a2d5b 100644
--- a/examples/apps/docedit/frm_main.pas
+++ b/examples/apps/docedit/frm_main.pas
@@ -63,7 +63,9 @@ type
implementation
uses
- fpg_dialogs, frm_options;
+ fpg_dialogs,
+ fpg_constants,
+ frm_options;
const
diff --git a/examples/apps/ide/src/builderthread.pas b/examples/apps/ide/src/builderthread.pas
index bfdc48b1..b5a1ad6f 100644
--- a/examples/apps/ide/src/builderthread.pas
+++ b/examples/apps/ide/src/builderthread.pas
@@ -1,3 +1,19 @@
+{
+ fpGUI IDE - Maximus
+
+ Copyright (C) 2012 - 2013 Graeme Geldenhuys
+
+ See the file COPYING.modifiedLGPL, included in this distribution,
+ for details about redistributing fpGUI.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ Description:
+ ---
+}
+
unit BuilderThread;
{$mode objfpc}{$H+}
@@ -115,7 +131,7 @@ begin
finally
FreeAndNil(p);
end;
-
+
end;
procedure TBuilderThread.DoOutputLine;
diff --git a/examples/apps/ide/src/filemonitor.pas b/examples/apps/ide/src/filemonitor.pas
index 1c97185a..6d28642c 100644
--- a/examples/apps/ide/src/filemonitor.pas
+++ b/examples/apps/ide/src/filemonitor.pas
@@ -1,3 +1,19 @@
+{
+ fpGUI IDE - Maximus
+
+ Copyright (C) 2012 - 2013 Graeme Geldenhuys
+
+ See the file COPYING.modifiedLGPL, included in this distribution,
+ for details about redistributing fpGUI.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ Description:
+ ---
+}
+
unit filemonitor;
{$mode objfpc}{$H+}
diff --git a/examples/apps/ide/src/fpg_textedit.pas b/examples/apps/ide/src/fpg_textedit.pas
index b68c78b3..013ad86b 100644
--- a/examples/apps/ide/src/fpg_textedit.pas
+++ b/examples/apps/ide/src/fpg_textedit.pas
@@ -1,7 +1,7 @@
{
fpGUI - Free Pascal GUI Toolkit
- Copyright (C) 2006 - 2010 See the file AUTHORS.txt, included in this
+ Copyright (C) 2006 - 2013 See the file AUTHORS.txt, included in this
distribution, for details of the copyright.
See the file COPYING.modifiedLGPL, included in this distribution,
@@ -124,17 +124,20 @@ type
function GetGutterVisible: Boolean;
function GetHScrollPos: Integer;
function GetVScrollPos: Integer;
+ function GetCaretPosH: Integer;
+ function GetCaretPosV: Integer;
procedure SetFontDesc(const AValue: string);
procedure SetGutterShowLineNumbers(const AValue: Boolean);
procedure SetGutterVisible(const AValue: Boolean);
procedure SetHScrollPos(const AValue: Integer);
+ procedure SetCaretPosH(const AValue: Integer);
+ procedure SetCaretPosV(const AValue: Integer);
procedure SetLines(const AValue: TStrings);
procedure SetScrollBarStyle(const AValue: TfpgScrollStyle);
procedure SetTabWidth(const AValue: Integer);
procedure SetVScrollPos(const AValue: Integer);
procedure UpdateCharBounds;
procedure GetSelBounds(var AStartNo, AEndNo, AStartOffs, AEndOffs: Integer);
- procedure UpdateScrollBars;
procedure VScrollBarMove(Sender: TObject; position: integer);
procedure HScrollBarMove(Sender: TObject; position: integer);
procedure SetVPos(p: Integer);
@@ -181,6 +184,7 @@ type
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
+ procedure UpdateScrollBars;
function GetClientRect: TfpgRect; override;
function GetWordAtPos(const X, Y: Integer; out XBegin: Integer): TfpgString;
procedure GetRowColAtPos(const X, Y: Integer; out Row, Col: Integer);
@@ -196,6 +200,8 @@ type
procedure SaveToFile(const AFileName: TfpgString);
procedure LoadFromFile(const AFileName: TfpgString);
procedure FindText(TextToFind: TfpgString; FindOptions: TfpgFindOptions; Backward: Boolean = False);
+ property CaretPos_H: Integer read GetCaretPosH write SetCaretPosH;
+ property CaretPos_V: Integer read GetCaretPosV write SetCaretPosV;
property FontHeight: Integer read FChrH;
property FontWidth: Integer read FChrW;
property ScrollPos_H: Integer read GetHScrollPos write SetHScrollPos;
@@ -418,6 +424,16 @@ begin
Result := VPos;
end;
+function TfpgBaseTextEdit.GetCaretPosH: Integer;
+begin
+ Result := CaretPos.Y;
+end;
+
+function TfpgBaseTextEdit.GetCaretPosV: Integer;
+begin
+ Result := CaretPos.X;
+end;
+
procedure TfpgBaseTextEdit.SetFontDesc(const AValue: string);
begin
FFont.Free;
@@ -455,6 +471,16 @@ begin
FTabWidth := AValue;
end;
+procedure TfpgBaseTextEdit.SetCaretPosH(const AValue: integer);
+begin
+ CaretPos.Y := AValue;
+end;
+
+procedure TfpgBaseTextEdit.SetCaretPosV(const AValue: integer);
+begin
+ CaretPos.X := AValue;
+end;
+
procedure TfpgBaseTextEdit.SetVScrollPos(const AValue: Integer);
begin
SetVPos(AValue);
@@ -666,7 +692,7 @@ end;
to set selection if Shift key is pressed. }
procedure TfpgBaseTextEdit.KeyboardCaretNav(const ShiftState: TShiftState; const AKeyCode: Word);
var
- SaveXCaret: Integer;
+ SaveYCaretOffset: Integer;
procedure CtrlKeyLeftKey;
var
@@ -971,6 +997,8 @@ begin
CaretPos.Y := 0;
CaretPos.X := 0;
end;
+ ScrollPos_V := 0;
+ UpdateScrollBars;
Exit;
end;
if ssShift in ShiftState then
@@ -1017,6 +1045,8 @@ begin
CaretPos.Y := pred(FLines.Count);
CaretPos.X := Length(FLines[CaretPos.Y]);
end;
+ ScrollPos_V := CaretPos.Y - FVisLines;
+ UpdateScrollBars;
Exit;
end;
if ssShift in ShiftState then
@@ -1048,7 +1078,7 @@ begin
FSelStartNo := CaretPos.Y;
FSelStartOffs := CaretPos.X;
end;
- SaveXCaret := CaretPos.Y - FTopLine;
+ SaveYCaretOffset := CaretPos.Y - FTopLine;
if AKeyCode = keyPageUp then
begin
if VPos = 0 then
@@ -1062,15 +1092,15 @@ begin
if FVScrollBar.Visible then
FVScrollBar.PageUp;
// restore caret at same line offset as before
- CaretPos.Y := FTopLine + SaveXCaret;
+ CaretPos.Y := FTopLine + SaveYCaretOffset;
end;
end
else
- begin
+ begin { PageDown handling }
if VPos > (FLines.Count - FVisLines) then
begin
CaretPos.Y := FLines.Count-1;
- CaretPos.X := Length(FLines[CaretPos.Y]);
+ CaretPos.X := UTF8Length(FLines[CaretPos.Y]);
end
else
begin
@@ -1078,7 +1108,7 @@ begin
if FVScrollBar.Visible then
FVScrollBar.PageDown;
// restore caret at same line offset as before
- CaretPos.Y := FTopLine + SaveXCaret;
+ CaretPos.Y := FTopLine + SaveYCaretOffset;
end;
end;
if ssShift in ShiftState then
@@ -1677,6 +1707,7 @@ begin
if SLine = '' then // short circut the code block
begin
FLines.Delete(CaretPos.Y);
+ FVScrollBar.Max := FVScrollBar.Max - 1;
end
else
begin
diff --git a/examples/apps/ide/src/frm_configureide.pas b/examples/apps/ide/src/frm_configureide.pas
index 2b2e42c1..fad0418f 100644
--- a/examples/apps/ide/src/frm_configureide.pas
+++ b/examples/apps/ide/src/frm_configureide.pas
@@ -1,3 +1,19 @@
+{
+ fpGUI IDE - Maximus
+
+ Copyright (C) 2012 - 2013 Graeme Geldenhuys
+
+ See the file COPYING.modifiedLGPL, included in this distribution,
+ for details about redistributing fpGUI.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ Description:
+ ---
+}
+
unit frm_configureide;
{$mode objfpc}{$H+}
diff --git a/examples/apps/ide/src/frm_debug.pas b/examples/apps/ide/src/frm_debug.pas
index 267871c2..6991b916 100644
--- a/examples/apps/ide/src/frm_debug.pas
+++ b/examples/apps/ide/src/frm_debug.pas
@@ -1,3 +1,19 @@
+{
+ fpGUI IDE - Maximus
+
+ Copyright (C) 2012 - 2013 Graeme Geldenhuys
+
+ See the file COPYING.modifiedLGPL, included in this distribution,
+ for details about redistributing fpGUI.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ Description:
+ ---
+}
+
unit frm_debug;
{$mode objfpc}{$H+}
diff --git a/examples/apps/ide/src/frm_find.pas b/examples/apps/ide/src/frm_find.pas
index 03e27dd2..3ec856f7 100644
--- a/examples/apps/ide/src/frm_find.pas
+++ b/examples/apps/ide/src/frm_find.pas
@@ -1,3 +1,19 @@
+{
+ fpGUI IDE - Maximus
+
+ Copyright (C) 2012 - 2013 Graeme Geldenhuys
+
+ See the file COPYING.modifiedLGPL, included in this distribution,
+ for details about redistributing fpGUI.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ Description:
+ ---
+}
+
unit frm_find;
{$mode objfpc}{$H+}
@@ -88,6 +104,11 @@ begin
begin
Consumed := True;
btnFind.Click;
+ end
+ else if KeyCode = keyEscape then
+ begin
+ Consumed := True;
+ Close;
end;
end;
diff --git a/examples/apps/ide/src/frm_main.pas b/examples/apps/ide/src/frm_main.pas
index 92d5243e..6ef73f50 100644
--- a/examples/apps/ide/src/frm_main.pas
+++ b/examples/apps/ide/src/frm_main.pas
@@ -1,3 +1,21 @@
+{
+ fpGUI IDE - Maximus
+
+ Copyright (C) 2012 - 2013 Graeme Geldenhuys
+
+ See the file COPYING.modifiedLGPL, included in this distribution,
+ for details about redistributing fpGUI.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ Description:
+ Maximus IDE is an example application, to showcase a bit more of
+ what fpGUI can do in a larger project. It also ties in a lot of
+ various fpGUI widgets and framework functionality.
+}
+
unit frm_main;
{$mode objfpc}{$H+}
@@ -22,7 +40,6 @@ type
btnOpen: TfpgButton;
btnSave: TfpgButton;
btnSaveAll: TfpgButton;
- btnTest: TfpgButton;
pnlStatusBar: TfpgBevel;
lblStatus: TfpgLabel;
pnlClientArea: TfpgBevel;
@@ -39,8 +56,6 @@ type
tsFiles: TfpgTabSheet;
grdFiles: TfpgFileGrid;
Splitter2: TfpgSplitter;
- grdOpenFiles: TfpgStringGrid;
- Splitter3: TfpgSplitter;
pcEditor: TfpgPageControl;
tseditor: TfpgTabSheet;
TextEditor: TfpgTextEdit;
@@ -54,7 +69,11 @@ type
mnuSettings: TfpgPopupMenu;
mnuHelp: TfpgPopupMenu;
{@VFD_HEAD_END: MainForm}
+ {$ifdef DEBUGSVR}
+ btnTest: TfpgButton;
+ {$endif}
pmOpenRecentMenu: TfpgPopupMenu;
+ miFile: TfpgMenuItem;
miRecentProjects: TfpgMenuItem;
FRecentFiles: TfpgMRU;
FRegex: TRegExpr;
@@ -68,6 +87,7 @@ type
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
procedure btnQuitClicked(Sender: TObject);
procedure btnOpenFileClicked(Sender: TObject);
+ procedure miFileNewUnit(Sender: TObject);
procedure miFileSave(Sender: TObject);
procedure miFileSaveAs(Sender: TObject);
procedure miEditCutClicked(Sender: TObject);
@@ -95,8 +115,10 @@ type
procedure miRecentProjectsClick(Sender: TObject; const FileName: String);
procedure miProjectSave(Sender: TObject);
procedure miProjectSaveAs(Sender: TObject);
+ procedure AddUnitToProject(const AUnitName: TfpgString);
procedure miProjectAddUnitToProject(Sender: TObject);
procedure tvProjectDoubleClick(Sender: TObject; AButton: TMouseButton; AShift: TShiftState; const AMousePos: TPoint);
+ procedure grdMessageKeyPressed(Sender: TObject; var KeyCode: Word; var ShiftState: TShiftState; var Consumed: Boolean);
procedure TabSheetClosing(Sender: TObject; ATabSheet: TfpgTabSheet);
procedure BuildTerminated(Sender: TObject);
procedure BuildOutput(Sender: TObject; const ALine: string);
@@ -108,6 +130,7 @@ type
procedure ClearMessagesWindow;
procedure CloseAllTabs;
procedure LoadProject(const AFilename: TfpgString);
+ function CreateNewEditorTab(const ATitle: TfpgString): TfpgTabSheet;
function OpenEditorPage(const AFilename: TfpgString): TfpgTabSheet;
procedure miTest(Sender: TObject);
function GetUnitsNode: TfpgTreeNode;
@@ -176,6 +199,34 @@ begin
end;
end;
+procedure TMainForm.miFileNewUnit(Sender: TObject);
+var
+ newunit: TfpgString;
+ sl: TStringList;
+ FInternalMacroList: TIDEMacroList;
+ i: integer;
+begin
+ if fpgInputQuery('New Unit', 'Please give the new unit a file name', newunit) then
+ begin
+ if GProject.UnitList.FileExists(newunit) then
+ begin
+ ShowMessage(Format('The unit <%s> already exists in the project', [newunit]));
+ Exit;
+ end;
+ sl := TStringList.Create;
+ try
+ sl.LoadFromFile(GMacroList.ExpandMacro('${TEMPLATEDIR}default/unit.pas'));
+ sl.Text := StringReplace(sl.Text, '${UNITNAME}', fpgChangeFileExt(fpgExtractFileName(newunit), ''), [rfReplaceAll, rfIgnoreCase]);
+ sl.SaveToFile(GProject.ProjectDir + newunit);
+ finally
+ sl.Free;
+ end;
+// AddUnitToProject(newunit);
+
+ OpenEditorPage(newunit);
+ end;
+end;
+
procedure TMainForm.miFileSave(Sender: TObject);
var
s: TfpgString;
@@ -471,6 +522,7 @@ begin
s := s + cProjectExt;
try
GProject.Save(s);
+ FRecentFiles.AddItem(s);
except
on E: Exception do
begin
@@ -482,26 +534,20 @@ begin
end;
end;
-procedure TMainForm.miProjectAddUnitToProject(Sender: TObject);
+procedure TMainForm.AddUnitToProject(const AUnitName: TfpgString);
var
u: TUnit;
s: TfpgString;
r: TfpgTreeNode;
n: TfpgTreeNode;
begin
- s := pcEditor.ActivePage.Hint;
-// writeln('adding unit: ', s);
- if s = '' then
- Exit;
- if GProject.UnitList.FileExists(s) then
- Exit;
u := TUnit.Create;
- u.FileName := s;
+ u.FileName := AUnitName;
u.Opened := True;
GProject.UnitList.Add(u);
// add reference to tabsheet
pcEditor.ActivePage.TagPointer := u;
- s := ExtractRelativepath(GProject.ProjectDir, u.FileName);
+ s := fpgExtractRelativepath(GProject.ProjectDir, u.FileName);
r := GetUnitsNode;
n := r.AppendText(s);
// add reference to treenode
@@ -509,6 +555,19 @@ begin
tvProject.Invalidate;
end;
+procedure TMainForm.miProjectAddUnitToProject(Sender: TObject);
+var
+ s: TfpgString;
+begin
+ s := pcEditor.ActivePage.Hint;
+// writeln('adding unit: ', s);
+ if s = '' then
+ Exit;
+ if GProject.UnitList.FileExists(s) then
+ Exit;
+ AddUnitToProject(s);
+end;
+
procedure TMainForm.tvProjectDoubleClick(Sender: TObject; AButton: TMouseButton; AShift: TShiftState; const AMousePos: TPoint);
var
r: TfpgTreeNode;
@@ -528,6 +587,22 @@ begin
end;
end;
+procedure TMainForm.grdMessageKeyPressed(Sender: TObject; var KeyCode: Word; var ShiftState: TShiftState; var Consumed: Boolean);
+var
+ cr: TClipboardKeyType;
+ i: integer;
+ s: TfpgString;
+begin
+ cr := CheckClipboardKey(KeyCode, ShiftState);
+ if cr = ckCopy then
+ begin
+ s := '';
+ for i := 0 to grdMessages.RowCount-1 do
+ s := s + grdMessages.Cells[0, i] + LineEnding;
+ fpgClipboard.Text := s;
+ end;
+end;
+
procedure TMainForm.TabSheetClosing(Sender: TObject; ATabSheet: TfpgTabSheet);
var
u: TUnit;
@@ -578,8 +653,7 @@ begin
begin
for i := 0 to GProject.UnitList.Count-1 do
begin
- {$Note ExtractRelativePath still needs a fpGUI wrapper }
- s := ExtractRelativepath(GProject.ProjectDir, GProject.UnitList[i].FileName);
+ s := fpgExtractRelativepath(GProject.ProjectDir, GProject.UnitList[i].FileName);
n := r.AppendText(s);
n.Data := GProject.UnitList[i];
end;
@@ -655,6 +729,20 @@ begin
AddMessage('Project loaded');
end;
+function TMainForm.CreateNewEditorTab(const ATitle: TfpgString): TfpgTabSheet;
+var
+ m: TfpgTextEdit;
+begin
+ Result := pcEditor.AppendTabSheet(ATitle);
+ m := TfpgTextEdit.Create(Result);
+ m.SetPosition(1, 1, 200, 20);
+ m.Align := alClient;
+ m.FontDesc := gINI.ReadString(cEditor, 'Font', '#Edit2');
+ m.GutterVisible := True;
+ m.GutterShowLineNumbers := True;
+ m.RightEdge := True;
+end;
+
function TMainForm.OpenEditorPage(const AFilename: TfpgString): TfpgTabSheet;
var
s: TfpgString;
@@ -662,10 +750,11 @@ var
i: integer;
found: Boolean;
ts: TfpgTabSheet;
- m: TfpgTextEdit;
ext: TfpgString;
pos_h: integer;
pos_v: integer;
+ cur_pos_h: integer;
+ cur_pos_v: integer;
editor: TfpgTextEdit;
begin
s := AFilename;
@@ -684,10 +773,15 @@ begin
editor := TfpgTextEdit(pcEditor.Pages[i].Components[0]);
pos_h := editor.ScrollPos_H;
pos_v := editor.ScrollPos_V;
+ cur_pos_h := editor.CaretPos_H;
+ cur_pos_v := editor.CaretPos_V;
editor.Lines.BeginUpdate;
editor.LoadFromFile(s);
editor.ScrollPos_H := pos_h;
editor.ScrollPos_V := pos_v;
+ editor.CaretPos_H := cur_pos_h;
+ editor.CaretPos_V := cur_pos_v;
+ editor.UpdateScrollBars;
editor.Lines.EndUpdate;
pcEditor.ActivePageIndex := i;
ts := pcEditor.ActivePage;
@@ -696,17 +790,12 @@ begin
else
begin
// we need a new tabsheet
- ts := pcEditor.AppendTabSheet(f);
- m := TfpgTextEdit.Create(ts);
- m.SetPosition(1, 1, 200, 20);
- m.Align := alClient;
- m.FontDesc := gINI.ReadString(cEditor, 'Font', '#Edit2');
- m.GutterVisible := True;
- m.GutterShowLineNumbers := True;
- m.RightEdge := True;
- TfpgTextEdit(ts.Components[0]).Lines.BeginUpdate;
- TfpgTextEdit(ts.Components[0]).Lines.LoadFromFile(s);
- TfpgTextEdit(ts.Components[0]).Lines.EndUpdate;
+ ts := CreateNewEditorTab(f);
+ editor := ts.Components[0] as TfpgTextEdit;
+ editor.Lines.BeginUpdate;
+ if fpgFileExists(s) then
+ editor.Lines.LoadFromFile(s);
+ editor.Lines.EndUpdate;
if gINI.ReadBool(cEditor, 'SyntaxHighlighting', True) then
begin
ext := fpgExtractFileExt(AFilename);
@@ -733,12 +822,14 @@ var
s: TfpgString;
r: TfpgString;
begin
+ {$ifdef DEBUGSVR}
TempHourGlassCursor(TfpgWidget(self));
s := cMacro_Compiler + ' -FU' +cMacro_Target+' -Fu' + cMacro_FPGuiLibDir;
-// writeln('source string = ', s);
+ SendDebug('source string = ' + s);
r := GMacroList.ExpandMacro(s);
-// writeln('expanded string = ', r);
+ SendDebug('expanded string = ' + r);
sleep(5000);
+ {$endif}
end;
function TMainForm.GetUnitsNode: TfpgTreeNode;
@@ -1243,20 +1334,6 @@ begin
TabOrder := 6;
end;
- btnTest := TfpgButton.Create(Toolbar);
- with btnTest do
- begin
- Name := 'btnTest';
- SetPosition(168, 2, 80, 24);
- Text := 'test';
- Down := False;
- FontDesc := '#Label1';
- Hint := '';
- ImageName := '';
- TabOrder := 7;
- OnClick := @miTest;
- end;
-
pnlStatusBar := TfpgBevel.Create(self);
with pnlStatusBar do
begin
@@ -1325,6 +1402,7 @@ begin
RowSelect := True;
ShowHeader := False;
TabOrder := 13;
+ OnKeyPress := @grdMessageKeyPressed;
end;
tsScribble := TfpgTabSheet.Create(pnlWindow);
@@ -1420,31 +1498,6 @@ begin
Align := alLeft;
end;
- grdOpenFiles := TfpgStringGrid.Create(pnlClientArea);
- with grdOpenFiles do
- begin
- Name := 'grdOpenFiles';
- SetPosition(516, 2, 120, 279);
- Align := alRight;
- BackgroundColor := TfpgColor($80000002);
- AddColumn('File', 100, taLeftJustify);
- FontDesc := '#Grid';
- HeaderFontDesc := '#GridHeader';
- Hint := '';
- RowCount := 0;
- RowSelect := True;
- ShowHeader := False;
- TabOrder := 24;
- end;
-
- Splitter3 := TfpgSplitter.Create(pnlClientArea);
- with Splitter3 do
- begin
- Name := 'Splitter3';
- SetPosition(508, 2, 8, 279);
- Align := alRight;
- end;
-
pcEditor := TfpgPageControl.Create(pnlClientArea);
with pcEditor do
begin
@@ -1483,7 +1536,7 @@ begin
begin
Name := 'mnuFile';
SetPosition(476, 61, 172, 20);
- AddMenuItem('New...', rsKeyCtrl+'N', nil).Enabled := False;
+ miFile := AddMenuItem('New...', rsKeyCtrl+'N', @miFileNewUnit);
AddMenuItem('-', '', nil);
AddMenuItem('Open...', rsKeyCtrl+'O', @btnOpenFileClicked);
AddMenuItem('Open Recent', '', nil).Enabled := False;
@@ -1643,6 +1696,20 @@ begin
FRecentFiles.LoadMRU;
{$IFDEF DEBUGSVR}
+ btnTest := TfpgButton.Create(Toolbar);
+ with btnTest do
+ begin
+ Name := 'btnTest';
+ SetPosition(168, 2, 80, 24);
+ Text := 'test';
+ Down := False;
+ FontDesc := '#Label1';
+ Hint := '';
+ ImageName := '';
+ TabOrder := 7;
+ OnClick := @miTest;
+ end;
+
SendMethodExit('TMainForm.AfterCreate');
{$ENDIF}
end;
diff --git a/examples/apps/ide/src/frm_procedurelist.pas b/examples/apps/ide/src/frm_procedurelist.pas
index 4b5b7548..14eb77dd 100644
--- a/examples/apps/ide/src/frm_procedurelist.pas
+++ b/examples/apps/ide/src/frm_procedurelist.pas
@@ -1,3 +1,19 @@
+{
+ fpGUI IDE - Maximus
+
+ Copyright (C) 2012 - 2013 Graeme Geldenhuys
+
+ See the file COPYING.modifiedLGPL, included in this distribution,
+ for details about redistributing fpGUI.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ Description:
+ ---
+}
+
unit frm_procedurelist;
{$mode objfpc}{$H+}
@@ -194,7 +210,7 @@ begin
{
E := TSimpleEngine.Create;
try
- writeln(Format('Parsing file <%s> for OS <%s> and CPU <%s>', [FFilename, OSTarget, CPUTarget]));
+// writeln(Format('Parsing file <%s> for OS <%s> and CPU <%s>', [FFilename, OSTarget, CPUTarget]));
M := ParseSource(E, FFilename, OSTarget, CPUTarget);
{ Cool, we successfully parsed the unit.
@@ -203,8 +219,7 @@ begin
for I := 0 to Decls.Count - 1 do
begin
p := TObject(Decls[I]) as TPasElement;
- Writeln('Interface item ', I, ': ' + p.Name + ' [line ' + IntToStr(p.SourceLinenumber) + ']');
-
+// Writeln('Interface item ', I, ': ' + p.Name + ' [line ' + IntToStr(p.SourceLinenumber) + ']');
end;
FreeAndNil(M);
finally
@@ -357,7 +372,7 @@ begin
else if StrContains('destructor', ProcName, False) then // Do not localize.
Result := ImageIndexTrash
else if StrBeginsWith('class proc', ProcName, False) // Do not localize.
- or StrContains('class func', ProcName, False)
+ or StrContains('class func', ProcName, False)
or (ProcClass <> '') then
Result := ImageIndexGear
else
@@ -991,7 +1006,7 @@ begin
finally
SFile.Free;
end;
- SendDebug('Procedure List: Starting Parse');
+// SendDebug('Procedure List: Starting Parse');
case Language of
ltPas: Parser.Origin := MemStream.Memory;
// ltCpp: CParser.SetOrigin(MemStream.Memory, MemStream.Size);
@@ -1004,7 +1019,7 @@ begin
finally
LoadObjectCombobox;
end;
- SendDebug('Procedure List: QuickSorting procedures');
+// SendDebug('Procedure List: QuickSorting procedures');
QuickSort(0, FProcList.Count - 1);
// StatusBar.Panels[1].Text := Trim(IntToStr(lvProcs.Items.Count));
finally
@@ -1155,7 +1170,7 @@ begin
FLanguage := ltPas;
FSearchAll := True; // search anywhere in a method name
// FImageList := TfpgImageList.Create;
-
+
// CreateImage_BMP(@grdimg_destructor_16, SizeOf(grdimg_destructor_16));
fpgImages.AddMaskedBMP( // 16x16 image
diff --git a/examples/apps/ide/src/frm_projectoptions.pas b/examples/apps/ide/src/frm_projectoptions.pas
index 74178090..1e1c318a 100644
--- a/examples/apps/ide/src/frm_projectoptions.pas
+++ b/examples/apps/ide/src/frm_projectoptions.pas
@@ -1,3 +1,19 @@
+{
+ fpGUI IDE - Maximus
+
+ Copyright (C) 2012 - 2013 Graeme Geldenhuys
+
+ See the file COPYING.modifiedLGPL, included in this distribution,
+ for details about redistributing fpGUI.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ Description:
+ ---
+}
+
unit frm_projectoptions;
{$mode objfpc}{$H+}
diff --git a/examples/apps/ide/src/ideconst.pas b/examples/apps/ide/src/ideconst.pas
index 03c43ec4..38973457 100644
--- a/examples/apps/ide/src/ideconst.pas
+++ b/examples/apps/ide/src/ideconst.pas
@@ -1,3 +1,19 @@
+{
+ fpGUI IDE - Maximus
+
+ Copyright (C) 2012 - 2013 Graeme Geldenhuys
+
+ See the file COPYING.modifiedLGPL, included in this distribution,
+ for details about redistributing fpGUI.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ Description:
+ ---
+}
+
unit ideconst;
{$mode objfpc}{$H+}
diff --git a/examples/apps/ide/src/ideimages.pas b/examples/apps/ide/src/ideimages.pas
index 6963e6e9..929267af 100644
--- a/examples/apps/ide/src/ideimages.pas
+++ b/examples/apps/ide/src/ideimages.pas
@@ -1,3 +1,19 @@
+{
+ fpGUI IDE - Maximus
+
+ Copyright (C) 2012 - 2013 Graeme Geldenhuys
+
+ See the file COPYING.modifiedLGPL, included in this distribution,
+ for details about redistributing fpGUI.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ Description:
+ ---
+}
+
unit ideimages;
{$mode objfpc}{$H+}
diff --git a/examples/apps/ide/src/idemacros.pas b/examples/apps/ide/src/idemacros.pas
index deee6507..e7632a07 100644
--- a/examples/apps/ide/src/idemacros.pas
+++ b/examples/apps/ide/src/idemacros.pas
@@ -1,3 +1,19 @@
+{
+ fpGUI IDE - Maximus
+
+ Copyright (C) 2012 - 2013 Graeme Geldenhuys
+
+ See the file COPYING.modifiedLGPL, included in this distribution,
+ for details about redistributing fpGUI.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ Description:
+ ---
+}
+
unit idemacros;
{$mode objfpc}{$H+}
diff --git a/examples/apps/ide/src/ideutils.pas b/examples/apps/ide/src/ideutils.pas
index 672103f3..3a75dc0b 100644
--- a/examples/apps/ide/src/ideutils.pas
+++ b/examples/apps/ide/src/ideutils.pas
@@ -1,3 +1,19 @@
+{
+ fpGUI IDE - Maximus
+
+ Copyright (C) 2012 - 2013 Graeme Geldenhuys
+
+ See the file COPYING.modifiedLGPL, included in this distribution,
+ for details about redistributing fpGUI.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ Description:
+ ---
+}
+
unit ideutils;
{$mode objfpc}{$H+}
@@ -101,7 +117,7 @@ type
constructor Create(var AWidget: TfpgWidget);
destructor Destroy; override;
end;
-
+
constructor TTempHourClassCursor.Create(var AWidget: TfpgWidget);
begin
inherited Create;
@@ -115,7 +131,7 @@ begin
FWidget.MouseCursor := FOldCursor;
inherited Destroy;
end;
-
+
function TempHourGlassCursor(var AWidget: TfpgWidget): IInterface;
diff --git a/examples/apps/ide/src/maximus.lpr b/examples/apps/ide/src/maximus.lpr
index d481ba4a..1f758a43 100644
--- a/examples/apps/ide/src/maximus.lpr
+++ b/examples/apps/ide/src/maximus.lpr
@@ -1,3 +1,19 @@
+{
+ fpGUI IDE - Maximus
+
+ Copyright (C) 2012 - 2013 Graeme Geldenhuys
+
+ See the file COPYING.modifiedLGPL, included in this distribution,
+ for details about redistributing fpGUI.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ Description:
+ ---
+}
+
program maximus;
{$mode objfpc}{$H+}
diff --git a/examples/apps/ide/src/maximus.project b/examples/apps/ide/src/maximus.project
index 8c2f4261..31af43e3 100644
--- a/examples/apps/ide/src/maximus.project
+++ b/examples/apps/ide/src/maximus.project
@@ -3,19 +3,19 @@ ProjectName=maximus.project
MainUnit=maximus.lpr
TargetFile=maximus${EXEEXT}
DefaultMake=0
-MakeOptionsCount=5
+MakeOptionsCount=7
MakeOptionEnabled1=1,1,1,1,1,1
MakeOptionEnabled2=1,1,1,1,1,0
-MakeOptionEnabled3=0,1,0,0,0,1
+MakeOptionEnabled3=1,1,0,0,0,1
MakeOptionEnabled4=0,0,0,0,1,1
-MacroCount=6
-Macro1=TargetCPU=x86_64
-Macro2=TargetOS=linux
-Macro3=TargetCPU=i386
-Macro4=TargetOS=win32
+MacroCount=4
+Macro1=TargetCPU=i386
+Macro2=TargetOS=win32
+Macro3=FPGUI_DIR=/home/graemeg/programming/fpgui/
+Macro4=tiOPF_fpGUI_Dir=/home/graemeg/programming/3rdParty/tiOPF2/src/
Macro5=FPGUI_DIR=/home/graemeg/programming/fpgui/
Macro6=tiOPF_fpGUI_Dir=/home/graemeg/programming/3rdParty/tiOPF2/src/
-UnitDirsCount=7
+UnitDirsCount=8
UnitDirEnabled1=1,1,1,1,0,0,0,1,0,0
UnitDirEnabled2=1,1,1,1,0,0,1,1,0,0
UnitDirEnabled3=1,1,1,0,0,0,1,1,0,0
@@ -23,14 +23,18 @@ UnitDirEnabled4=0,0,0,1,0,0,1,1,0,0
UnitDirEnabled5=1,1,1,1,0,0,1,1,0,0
UnitDirEnabled6=1,1,1,1,0,0,1,0,0,0
UnitDirEnabled7=0,0,0,0,1,1,1,0,0,0
-UnitDirEnabled8=0,0,0,0,0,1,1,0,0,0
+UnitDirEnabled8=1,0,0,0,0,0,1,1,0,0
UnitOutputDir=units/${TARGET}/
MakeOptionEnabled5=1,0,0,0,0,0
+MakeOptionEnabled6=1,0,0,0,0,0
+MakeOptionEnabled7=0,0,0,0,0,0
MakeOption1=-l -Mobjfpc -Sch
MakeOption2=-g -gl -O- -gw2 -godwarfsets
MakeOption3=-B
MakeOption4=-O2 -XX -Xs -CX
MakeOption5=-veiw
+MakeOption6=-dDEBUGSVR
+MakeOption7=-dAGGCanvas
UnitDir1=${FPGUIDIR}src/
UnitDir2=${FPGUIDIR}src/corelib/
UnitDir3=${FPGUIDIR}src/corelib/x11/
@@ -38,26 +42,27 @@ UnitDir4=${FPGUIDIR}src/corelib/gdi/
UnitDir5=${FPGUIDIR}src/gui/
UnitDir6=${FPGUIDIR}src/gui/db/
UnitDir7=${FPGUILIBDIR}
+UnitDir8=${FPGUIDIR}src/corelib/render/software/
[Units]
UnitCount=20
Unit1=builderthread.pas,0
Unit2=filemonitor.pas,0
-Unit3=fpg_textedit.pas,0
+Unit3=fpg_textedit.pas,-1
Unit4=frm_configureide.pas,0
Unit5=frm_debug.pas,0
Unit6=frm_find.pas,-1
Unit7=frm_main.pas,-1
-Unit8=frm_procedurelist.pas,0
-Unit9=frm_projectoptions.pas,0
+Unit8=frm_procedurelist.pas,-1
+Unit9=frm_projectoptions.pas,-1
Unit10=ideconst.pas,0
Unit11=ideimages.pas,0
-Unit12=idemacros.pas,0
+Unit12=idemacros.pas,-1
Unit13=ideutils.pas,0
Unit14=maximus.lpr,0
Unit15=mPasLex.pas,0
Unit16=project.pas,-1
Unit17=sha1.pas,0
Unit18=stringhelpers.pas,0
-Unit19=synregexpr.pas,-1
+Unit19=synregexpr.pas,0
Unit20=unitlist.pas,0
diff --git a/examples/apps/ide/src/project.pas b/examples/apps/ide/src/project.pas
index cde77fdf..a82a23c5 100644
--- a/examples/apps/ide/src/project.pas
+++ b/examples/apps/ide/src/project.pas
@@ -1,3 +1,19 @@
+{
+ fpGUI IDE - Maximus
+
+ Copyright (C) 2012 - 2013 Graeme Geldenhuys
+
+ See the file COPYING.modifiedLGPL, included in this distribution,
+ for details about redistributing fpGUI.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ Description:
+ ---
+}
+
unit Project;
{$mode objfpc}{$H+}
@@ -254,6 +270,7 @@ begin
FIniFile := TfpgINIFile.CreateExt(AProjectFile);
ProjectDir := fpgExtractFilePath(AProjectFile);
+ fpgSetCurrentDir(ProjectDir);
ProjectName := FIniFile.ReadString(cProjectOptions, 'ProjectName', fpgChangeFileExt(fpgExtractFileName(AProjectFile), ''));
MainUnit := FIniFile.ReadString(cProjectOptions, 'MainUnit', '');
TargetFile := FIniFile.ReadString(cProjectOptions, 'TargetFile', '');
diff --git a/examples/apps/ide/src/stringhelpers.pas b/examples/apps/ide/src/stringhelpers.pas
index 35fb9060..6e563da5 100644
--- a/examples/apps/ide/src/stringhelpers.pas
+++ b/examples/apps/ide/src/stringhelpers.pas
@@ -1,3 +1,19 @@
+{
+ fpGUI IDE - Maximus
+
+ Copyright (C) 2012 - 2013 Graeme Geldenhuys
+
+ See the file COPYING.modifiedLGPL, included in this distribution,
+ for details about redistributing fpGUI.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ Description:
+ ---
+}
+
unit stringhelpers;
{$mode objfpc}{$H+}
diff --git a/examples/apps/ide/src/templates/default/program.pas b/examples/apps/ide/src/templates/default/program.pas
new file mode 100644
index 00000000..d901e3ac
--- /dev/null
+++ b/examples/apps/ide/src/templates/default/program.pas
@@ -0,0 +1,11 @@
+program ${PROGRAMNAME};
+
+{$mode objfpc}{$H+}
+
+uses
+ Classes,
+ SysUtils;
+
+begin
+ WriteLn('Hello');
+end.
diff --git a/examples/apps/ide/src/templates/default/unit.pas b/examples/apps/ide/src/templates/default/unit.pas
new file mode 100644
index 00000000..b3837ea3
--- /dev/null
+++ b/examples/apps/ide/src/templates/default/unit.pas
@@ -0,0 +1,9 @@
+unit ${UNITNAME};
+
+{$mode objfpc}{$H+}
+
+interface
+
+implementation
+
+end.
diff --git a/examples/apps/ide/src/templates/fpgui/mainform.pas b/examples/apps/ide/src/templates/fpgui/mainform.pas
new file mode 100644
index 00000000..6b9500ac
--- /dev/null
+++ b/examples/apps/ide/src/templates/fpgui/mainform.pas
@@ -0,0 +1,45 @@
+unit frm_main;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+ SysUtils,
+ Classes,
+ fpg_base,
+ fpg_main,
+ fpg_form;
+
+type
+
+ TMainForm = class(TfpgForm)
+ private
+ {@VFD_HEAD_BEGIN: MainForm}
+ {@VFD_HEAD_END: MainForm}
+ public
+ procedure AfterCreate; override;
+ end;
+
+{@VFD_NEWFORM_DECL}
+
+implementation
+
+{@VFD_NEWFORM_IMPL}
+
+procedure TMainForm.AfterCreate;
+begin
+ {%region 'Auto-generated GUI code' -fold}
+ {@VFD_BODY_BEGIN: MainForm}
+ Name := 'MainForm';
+ SetPosition(374, 228, 490, 258);
+ WindowTitle := 'MainForm';
+ Hint := '';
+ WindowPosition := wpOneThirdDown;
+
+ {@VFD_BODY_END: MainForm}
+ {%endregion}
+end;
+
+
+end.
diff --git a/examples/apps/ide/src/templates/fpgui/program.pas b/examples/apps/ide/src/templates/fpgui/program.pas
new file mode 100644
index 00000000..7f3f9732
--- /dev/null
+++ b/examples/apps/ide/src/templates/fpgui/program.pas
@@ -0,0 +1,31 @@
+program ${PROGRAMNAME};
+
+{$mode objfpc}{$H+}
+
+uses
+ {$IFDEF UNIX}{$IFDEF UseCThreads}
+ cthreads,
+ {$ENDIF}{$ENDIF}
+ Classes,
+ fpg_main,
+ frm_main;
+
+
+procedure MainProc;
+var
+ frm: TMainForm;
+begin
+ fpgApplication.Initialize;
+ frm := TMainForm.Create(nil);
+ try
+ frm.Show;
+ fpgApplication.Run;
+ finally
+ frm.Free;
+ end;
+end;
+
+begin
+ MainProc;
+end.
+
diff --git a/examples/apps/ide/src/templates/fpgui/program_all_in_one.pas b/examples/apps/ide/src/templates/fpgui/program_all_in_one.pas
new file mode 100644
index 00000000..0b17ee85
--- /dev/null
+++ b/examples/apps/ide/src/templates/fpgui/program_all_in_one.pas
@@ -0,0 +1,55 @@
+program ${PROJECTNAME};
+
+{$mode objfpc}{$H+}
+
+uses
+ {$IFDEF UNIX}{$IFDEF UseCThreads}
+ cthreads,
+ {$ENDIF}{$ENDIF}
+ Classes, fpg_main, fpg_form;
+
+type
+
+ TMainForm = class(TfpgForm)
+ public
+ {@VFD_HEAD_BEGIN: MainForm}
+ {@VFD_HEAD_END: MainForm}
+ procedure AfterCreate; override;
+ end;
+
+{@VFD_NEWFORM_DECL}
+
+
+
+{@VFD_NEWFORM_IMPL}
+
+procedure TMainForm.AfterCreate;
+begin
+ {@VFD_BODY_BEGIN: MainForm}
+ Name := 'MainForm';
+ SetPosition(316, 186, 300, 250);
+ WindowTitle := 'MainForm';
+
+ {@VFD_BODY_END: MainForm}
+end;
+
+
+procedure MainProc;
+var
+ frm: TMainForm;
+begin
+ fpgApplication.Initialize;
+ frm := TMainForm.Create(nil);
+ try
+ frm.Show;
+ fpgApplication.Run;
+ finally
+ frm.Free;
+ end;
+end;
+
+begin
+ MainProc;
+end.
+
+
diff --git a/examples/apps/ide/src/templates/fpgui/simpleform.pas b/examples/apps/ide/src/templates/fpgui/simpleform.pas
new file mode 100644
index 00000000..d804f4a3
--- /dev/null
+++ b/examples/apps/ide/src/templates/fpgui/simpleform.pas
@@ -0,0 +1,45 @@
+unit ${UNITNAME};
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+ SysUtils,
+ Classes,
+ fpg_base,
+ fpg_main,
+ fpg_form;
+
+type
+
+ T${FORMNAME} = class(TfpgForm)
+ private
+ {@VFD_HEAD_BEGIN: ${FORMNAME}}
+ {@VFD_HEAD_END: ${FORMNAME}}
+ public
+ procedure AfterCreate; override;
+ end;
+
+{@VFD_NEWFORM_DECL}
+
+implementation
+
+{@VFD_NEWFORM_IMPL}
+
+procedure T${FORMNAME}.AfterCreate;
+begin
+ {%region 'Auto-generated GUI code' -fold}
+ {@VFD_BODY_BEGIN: ${FORMNAME}}
+ Name := '${FORMNAME}';
+ SetPosition(374, 228, 490, 258);
+ WindowTitle := 'New Form';
+ Hint := '';
+ WindowPosition := wpOneThirdDown;
+
+ {@VFD_BODY_END: ${FORMNAME}}
+ {%endregion}
+end;
+
+
+end.
diff --git a/examples/apps/ide/src/templates/fptest/program.pas b/examples/apps/ide/src/templates/fptest/program.pas
new file mode 100644
index 00000000..8c4729bc
--- /dev/null
+++ b/examples/apps/ide/src/templates/fptest/program.pas
@@ -0,0 +1,30 @@
+program ${%PROGRAMNAME%};
+
+{$Mode objfpc}{$H+}
+
+
+{$Define TextRunner}
+{.$Define GUIRunner}
+
+
+{$ifdef GuiRunner}
+ {$apptype gui}
+{$endif}
+
+
+uses
+ {$IFDEF TextRunner}
+ TextTestRunner,
+ {$ENDIF}
+ {$IFDEF GUIRunner}
+ GUITestRunner,
+ {$ENDIF}
+ Classes,
+ SampleTests;
+
+begin
+ // Register all tests
+ SampleTests.RegisterTests;
+
+ RunRegisteredTests;
+end.
diff --git a/examples/apps/ide/src/templates/fptest/testunit.pas b/examples/apps/ide/src/templates/fptest/testunit.pas
new file mode 100644
index 00000000..83d2a624
--- /dev/null
+++ b/examples/apps/ide/src/templates/fptest/testunit.pas
@@ -0,0 +1,39 @@
+unit ${UNITNAME};
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+ TestFramework;
+
+type
+ TMyTestCase = class(TTestCase)
+ published
+ procedure FirstTest;
+ end;
+
+
+procedure RegisterTests;
+
+
+implementation
+
+//uses
+// SomeUnitToTest;
+
+
+procedure RegisterTests;
+begin
+ TestFramework.RegisterTest(TMyTestCase.Suite);
+end;
+
+{ TMyTestCase }
+
+procedure TMyTestCase.FirstTest;
+begin
+ Check(2, 1+1, 'Failed on 1');
+end;
+
+
+end.
diff --git a/examples/apps/ide/src/unitlist.pas b/examples/apps/ide/src/unitlist.pas
index b8ca59ad..827326e7 100644
--- a/examples/apps/ide/src/unitlist.pas
+++ b/examples/apps/ide/src/unitlist.pas
@@ -1,3 +1,19 @@
+{
+ fpGUI IDE - Maximus
+
+ Copyright (C) 2012 - 2013 Graeme Geldenhuys
+
+ See the file COPYING.modifiedLGPL, included in this distribution,
+ for details about redistributing fpGUI.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ Description:
+ ---
+}
+
unit UnitList;
{$mode objfpc}{$H+}
diff --git a/examples/corelib/aggcanvas/agg_canvas_test.lpi b/examples/corelib/aggcanvas/agg_canvas_test.lpi
new file mode 100644
index 00000000..f02ac5df
--- /dev/null
+++ b/examples/corelib/aggcanvas/agg_canvas_test.lpi
@@ -0,0 +1,71 @@
+<?xml version="1.0"?>
+<CONFIG>
+ <ProjectOptions>
+ <Version Value="9"/>
+ <General>
+ <Flags>
+ <MainUnitHasCreateFormStatements Value="False"/>
+ <MainUnitHasTitleStatement Value="False"/>
+ <LRSInOutputDirectory Value="False"/>
+ </Flags>
+ <SessionStorage Value="InProjectDir"/>
+ <MainUnit Value="0"/>
+ <Title Value="agg_canvas_test"/>
+ </General>
+ <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"/>
+ <LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
+ </local>
+ </RunParams>
+ <RequiredPackages Count="1">
+ <Item1>
+ <PackageName Value="fpgui_toolkit"/>
+ </Item1>
+ </RequiredPackages>
+ <Units Count="1">
+ <Unit0>
+ <Filename Value="agg_canvas_test.lpr"/>
+ <IsPartOfProject Value="True"/>
+ <UnitName Value="agg_canvas_test"/>
+ </Unit0>
+ </Units>
+ </ProjectOptions>
+ <CompilerOptions>
+ <Version Value="11"/>
+ <Target>
+ <Filename Value="agg_canvas_test"/>
+ </Target>
+ <SearchPaths>
+ <UnitOutputDirectory Value="units"/>
+ </SearchPaths>
+ <Parsing>
+ <SyntaxOptions>
+ <UseAnsiStrings Value="False"/>
+ </SyntaxOptions>
+ </Parsing>
+ <CodeGeneration>
+ <Optimizations>
+ <OptimizationLevel Value="0"/>
+ </Optimizations>
+ </CodeGeneration>
+ <Other>
+ <CompilerMessages>
+ <UseMsgFile Value="True"/>
+ </CompilerMessages>
+ <CustomOptions Value="-dAggCanvas"/>
+ <CompilerPath Value="$(CompPath)"/>
+ </Other>
+ </CompilerOptions>
+</CONFIG>
diff --git a/examples/corelib/aggcanvas/agg_canvas_test.lpr b/examples/corelib/aggcanvas/agg_canvas_test.lpr
new file mode 100644
index 00000000..63ba1d53
--- /dev/null
+++ b/examples/corelib/aggcanvas/agg_canvas_test.lpr
@@ -0,0 +1,389 @@
+{
+ fpGUI - Free Pascal GUI Toolkit
+
+ Copyright (C) 2006 - 2013 See the file AUTHORS.txt, included in this
+ distribution, for details of the copyright.
+
+ See the file COPYING.modifiedLGPL, included in this distribution,
+ for details about redistributing fpGUI.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ Description:
+ This demo was simply to test the Agg2D unit and the TAgg2D canvas
+ class. In this demo the AggPas TAgg2D canvas does all the painting.
+
+ *** IMPORTANT ***
+ For this demo to work, the fpGUI Toolkit MUST be compiled with
+ the AggCanvas compiler define enabled.
+}
+
+program agg_canvas_test;
+
+{$mode objfpc}{$H+}
+
+uses
+ Classes, SysUtils,
+ fpg_base,
+ fpg_main,
+ fpg_form,
+ fpg_imgfmt_bmp,
+ fpg_widget,
+ Agg2D,
+ fpg_dialogs;
+
+
+type
+ TMainForm = class(TfpgForm)
+ private
+ {@VFD_HEAD_BEGIN: MainForm}
+ {@VFD_HEAD_END: MainForm}
+ procedure FormKeyPressed(Sender: TObject; var KeyCode: word; var ShiftState: TShiftState; var Consumed: boolean);
+ procedure FormPaint(Sender: TObject);
+ procedure CustomPaintJob;
+ public
+ procedure AfterCreate; override;
+ end;
+
+
+
+{ TMainForm }
+
+procedure TMainForm.FormKeyPressed(Sender: TObject; var KeyCode: word;
+ var ShiftState: TShiftState; var Consumed: boolean);
+begin
+ if KeyCode = keyF1 then
+ begin
+ ShowMessage('This is a simple Canvas primitives painting test.');
+ end;
+end;
+
+procedure TMainForm.FormPaint(Sender: TObject);
+begin
+ CustomPaintJob;
+end;
+
+// We can now call all the paint methods from HandlePaint or
+// the OnPaint event.fpgcanvas
+procedure TMainForm.CustomPaintJob;
+var
+ r: TfpgRect;
+ fnt: TfpgFont;
+ y: integer;
+ ac: TAgg2D;
+ c1, c2: TAggColor;
+ d: double;
+ i: integer;
+
+ procedure DrawMacLionButton(const x, y: double; const astate: byte; const atext: ansistring);
+ { AState values are interpreted as follows:
+ 0: normal state
+ 1: hover state
+ 2: clicked state }
+ var
+ x1, y1, x2, y2, h, w: double;
+ c1, c2: TAggColor;
+ begin
+ h := 21;
+ w := 100;
+ x1 := x;
+ y1 := y;
+ x2 := x1 + w;
+ y2 := y1 + h;
+
+ ac.NoLine;
+
+ // Top vertical gradient
+ case astate of
+ 0: begin
+ c1.Construct(255, 255, 255, 255);
+ c2.Construct(243, 243, 243, 255);
+ end;
+ 1: begin
+ c1.Construct(204, 229, 252, 255);
+ c2.Construct(161, 209, 249, 255);
+ end;
+ 2: begin
+ c1.Construct(144, 195, 241, 255);
+ c2.Construct(113, 180, 239, 255);
+ end;
+ end;
+ ac.FillLinearGradient(x1, y1, x1, y1+(h/2), c1, c2);
+ ac.RoundedRect(x1+1, y1+1, x2+0.5, y2-(h/2)+0.5, 0.3, 3/2, 0.3, 3/2);
+
+ // Bottom vertical gradient
+ case astate of
+ 0: begin
+ c1.Construct(236, 236, 236, 255);
+ c2.Construct(242, 242, 242, 255);
+ end;
+ 1: begin
+ c1.Construct(143, 202, 251, 255);
+ c2.Construct(207, 245, 253, 255);
+ end;
+ 2: begin
+ c1.Construct(97, 173, 240, 255);
+ c2.Construct(147, 206, 241, 255);
+ end;
+ end;
+ ac.FillLinearGradient(x1, y1+(h/2)+1, x1, y2, c1, c2);
+ ac.RoundedRect(x1+1, y1+(h/2)+0.5, x2+0.5, y2+0.5, 0.3, 3/2, 0.3, 3/2);
+
+ // outer rounded rectangle
+ ac.NoFill;
+ case astate of
+ 0: begin
+ ac.LineColor($9a, $9a, $9a);
+ end;
+ 1,
+ 2: begin
+ ac.LineColor(86, 87, 143);
+ end;
+ end;
+ ac.LineWidth(1.0);
+ ac.RoundedRect(x1+0.5, y1+0.5, x2+0.5, y2+0.5, 3, 3);
+
+ // Slight shadow under the button
+ ac.LineColor($df, $df, $df, $ff);
+ ac.Line(x1+0.5, y2+1.5, x2-0.5, y2+1.5);
+
+ // button text
+ c1.Construct(0,0,0);
+ ac.FillColor(c1);
+ ac.NoLine;
+ ac.Font('arialbd.ttf', 13);
+ ac.TextAlignment(AGG_AlignCenter ,AGG_AlignCenter );
+ ac.Text(
+ (x1 + x2 ) / 2.0 ,
+ (y1 + y2 ) / 2.0 ,
+ atext,
+ true ,0.0 ,0.0 );
+
+ end;
+begin
+ // casting so we have full access to the Agg2D canvas functions
+ ac := TAgg2D(Canvas);
+
+ ac.LineWidth(1.0);
+// ac.ClearAll($ed, $ed, $ed); // mac os x window background color
+ ac.ClearAll(255, 255, 255);
+
+ // Testing Rectangles
+ Canvas.SetColor(clBlack);
+ r.SetRect(0, 0, 1, 1); // 1x1 (this is really a dot)
+ Canvas.DrawRectangle(r);
+ Canvas.SetColor(clRed);
+ r.SetRect(0, 1, 1, 5); // 1x5 (this is really a vertical line)
+ Canvas.DrawRectangle(r);
+ Canvas.SetColor(clMagenta);
+ r.SetRect(1, 0, 5, 1); // 5x1 (this is really a horizontal line)
+ Canvas.DrawRectangle(r);
+
+ Canvas.SetColor(clBlack);
+ r.Top := 5;
+ r.Left := 60;
+ r.Width := 50;
+ r.Height := 50;
+ Canvas.DrawRectangle(r);
+
+ r.Left := 120;
+ Canvas.SetLineStyle(2, lsDash);
+ Canvas.DrawRectangle(r);
+
+ r.Left := 180;
+ Canvas.SetColor(clGreen);
+ Canvas.SetLineStyle(1, lsDot);
+ Canvas.DrawRectangle(r);
+
+ r.Left := 240;
+ Canvas.SetColor(clBlue);
+ Canvas.SetLineStyle(1, lsSolid);
+ Canvas.FillRectangle(r);
+
+ // Testing line drawing
+ ac.NoFill;
+ Canvas.SetColor(clBlue);
+ Canvas.DrawLine(5, 5, 54, 54);
+ Canvas.DrawLine(54, 5, 5, 54);
+ Canvas.SetColor(clRed);
+ { Diagonal line }
+ r.SetRect(60, 5, 50, 50);
+ Canvas.DrawLine(r.Left, r.Top, r.Right, r.Bottom);
+ { Horizontal line }
+ Canvas.DrawLine(r.Left, r.Top-2, r.Right, r.Top-2);
+ { Vertical line }
+ Canvas.DrawLine(r.Left-2, r.Top, r.Left-2, r.Bottom);
+
+
+ // Testing Text and Fonts
+ y := 60;
+ Canvas.SetTextColor(clBlack);
+ Canvas.DrawString(5, y, 'This text must be black and default font');
+
+ // red dot indicates top/left corner of where previous text was started
+ Canvas.Pixels[5,y] := clRed;
+// Canvas.DrawLine(5,y-4, 5,y+5);
+// Canvas.DrawLine(1,y, 10, y);
+
+ Canvas.SetTextColor(clRed);
+ y := y + Canvas.Font.Height; // fonts are different sizes on differet OS's
+ Canvas.DrawString(5, y, 'This text must be red.');
+ Canvas.SetTextColor(clBlack);
+ y := y + Canvas.Font.Height;
+ Canvas.DrawString(5, y, 'Russian (UTF-8) text: Ðевозможно Ñоздать директорию');
+ y := y + Canvas.Font.Height;
+ fnt := fpgApplication.GetFont('Times-14:bold');
+ Canvas.Font := fnt;
+ Canvas.DrawString(5, y, 'Font used is ' + Canvas.Font.FontDesc);
+ y := y + Canvas.Font.Height;
+
+
+ // Testing basic style drawings
+ Canvas.Font := fpgApplication.DefaultFont;
+ Canvas.DrawString(320, 3, 'DrawButtonFace():');
+
+ r.SetRect(300, 20, 75, 25);
+ Canvas.DrawButtonFace(r, []);
+ Canvas.DrawString(385, 20, '= []');
+ r.Top := 50;
+ Canvas.DrawButtonFace(r, [btfIsDefault]);
+ Canvas.DrawString(385, 50, '= [btnIsDefault]');
+ r.Top := 80;
+ Canvas.DrawButtonFace(r, [btfIsPressed]);
+ Canvas.DrawString(385, 80, '= [btnIsPressed]');
+ r.Top := 110;
+ Canvas.DrawButtonFace(r, [btfIsEmbedded, btfIsPressed]);
+ Canvas.DrawString(385, 110, '= [embed & press]');
+ r.Top := 140;
+ Canvas.DrawButtonFace(r, [btfIsEmbedded]);
+ Canvas.DrawString(385, 140, '= [btnIsEmbedded]');
+
+ Canvas.DrawString(45, y, 'DrawControlFrame():');
+ y := y + Canvas.Font.Height;
+ Canvas.DrawControlFrame(5, y, 150, 23);
+
+ // A Vector Text example
+ //----------------------
+ ac.LineWidth(1 );
+ ac.TextAlignment(AGG_AlignLeft ,AGG_AlignBottom );
+ // Normal Text
+ ac.LineColor($00 ,$00 ,$8B );
+ ac.FillColor($1E ,$90 ,$FF );
+ ac.Font('times.ttf' ,45);
+ ac.Text(20 ,250 , 'Vectors are cool !' );
+ // Upside-down Text
+ ac.FlipText(true );
+ ac.LineColor($C0 ,$C0 ,$C0 );
+ ac.FillColor($C0 ,$C0 ,$C0 );
+ ac.Text(20 ,255 ,'Vectors are cool !' );
+
+ // reset the text flip effect
+ ac.FlipText(False);
+
+ // Cool new button styles are now possible
+ DrawMacLionButton(65, 300, 0, 'Normal');
+ DrawMacLionButton(65, 330, 1, 'Hover');
+ DrawMacLionButton(65, 360, 2, 'Clicked');
+ // nice display of virtical text
+ c1.Construct(0,0,0);
+ ac.FillColor(c1);
+ ac.TextHints(true);
+ ac.NoLine;
+ ac.Font('arial.ttf', 13, false,
+ false, AGG_VectorFontCache, 45.0);
+ ac.Text(190, 310, 'Mac OS X Lion buttons', true ,0.0 ,0.0 );
+ // reset text alignment to normal behaviour
+ ac.TextAlignment(AGG_AlignLeft ,AGG_AlignBottom );
+
+
+ // Star shape
+ ac.LineCap(AGG_CapRound);
+ ac.LineWidth(5);
+ ac.LineColor($32 ,$cd ,$32 );
+ c1.Construct(0, 0 , 255, 200);
+ c2.Construct(0, 0, 255, 50);
+ ac.FillLinearGradient(100, 100, 150, 150, c1, c2);
+ ac.Star(100 ,150 ,30 ,70 ,55 ,5 );
+
+ // Draw Arc from 45 degrees to 270 degrees
+ ac.LineColor($FF ,$00 ,$00 );
+ ac.LineWidth(5 );
+ ac.Arc(300 ,320 ,80 ,50 ,Deg2Rad(45 ) ,Deg2Rad(270 ) );
+
+
+ // Lines at various thicknesses & coordinate translation
+ ac.LineColor(0, 0, 0);
+ ac.LineCap(AGG_CapRound);
+ d := 0.1;
+ for i := 1 to 10 do
+ begin
+ ac.LineWidth(d);
+ ac.Line(350, 240, 410, 180);
+ ac.Translate(8, 0);
+ d := d + 0.3;
+ end;
+ ac.ResetTransformations;
+
+
+
+ ac.LineWidth(20 );
+ ac.ResetPath;
+ ac.MoveTo(360 ,310 );
+ ac.LineTo(400 ,270 );
+ ac.LineTo(440 ,310 );
+
+ // Default AGG_JoinRound
+ ac.Translate(10 ,-10 );
+ ac.DrawPath(AGG_StrokeOnly );
+
+ // Change to AGG_JoinMiter
+ ac.LineJoin (AGG_JoinMiter );
+ ac.Translate(0 ,50 );
+ ac.DrawPath (AGG_StrokeOnly );
+
+ // Change to AGG_JoinBevel
+ ac.LineJoin (AGG_JoinBevel );
+ ac.Translate(0 ,50 );
+ ac.DrawPath (AGG_StrokeOnly );
+
+ ac.ResetTransformations;
+end;
+
+procedure TMainForm.AfterCreate;
+begin
+ {%region 'Auto-generated GUI code' -fold}
+ {@VFD_BODY_BEGIN: MainForm}
+ Name := 'MainForm';
+ SetPosition(357, 214, 500, 400);
+ WindowTitle := 'fpGUI with AGG-powered Canvas test';
+ Hint := '';
+ WindowPosition := wpOneThirdDown;
+ OnKeyPress := @FormKeyPressed;
+ OnPaint := @FormPaint;
+
+ {@VFD_BODY_END: MainForm}
+ {%endregion}
+
+ fpgApplication.HelpKey := keyNul;
+end;
+
+
+procedure MainProc;
+var
+ frm: TMainForm;
+begin
+ fpgApplication.Initialize;
+
+ frm := TMainForm.Create(nil);
+ frm.Show;
+ fpgApplication.Run;
+ frm.Free;
+end;
+
+
+begin
+ MainProc;
+end.
+
diff --git a/examples/corelib/aggcanvas/arial.ttf b/examples/corelib/aggcanvas/arial.ttf
new file mode 100644
index 00000000..7ff88f22
--- /dev/null
+++ b/examples/corelib/aggcanvas/arial.ttf
Binary files differ
diff --git a/examples/corelib/aggcanvas/arialbd.ttf b/examples/corelib/aggcanvas/arialbd.ttf
new file mode 100644
index 00000000..c2eb3ddd
--- /dev/null
+++ b/examples/corelib/aggcanvas/arialbd.ttf
Binary files differ
diff --git a/examples/corelib/aggcanvas/extrafpc.cfg b/examples/corelib/aggcanvas/extrafpc.cfg
new file mode 100644
index 00000000..775d592f
--- /dev/null
+++ b/examples/corelib/aggcanvas/extrafpc.cfg
@@ -0,0 +1,5 @@
+-FUunits
+-Fu../../../lib/$fpctarget
+-Xs
+-XX
+-CX
diff --git a/examples/corelib/aggcanvas/times.ttf b/examples/corelib/aggcanvas/times.ttf
new file mode 100644
index 00000000..a998feec
--- /dev/null
+++ b/examples/corelib/aggcanvas/times.ttf
Binary files differ
diff --git a/examples/corelib/aggcanvas/timesi.ttf b/examples/corelib/aggcanvas/timesi.ttf
new file mode 100644
index 00000000..28798d3c
--- /dev/null
+++ b/examples/corelib/aggcanvas/timesi.ttf
Binary files differ
diff --git a/examples/gui/command_interface/commands.pas b/examples/gui/command_interface/commands.pas
index c487b0b1..d4a30858 100644
--- a/examples/gui/command_interface/commands.pas
+++ b/examples/gui/command_interface/commands.pas
@@ -14,11 +14,11 @@ uses
type
// non reference counted interface
- TNullInterfacedObject = class(TObject)
+ TNullInterfacedObject = class(TObject, IUnknown)
protected
- function QueryInterface(const IID: TGUID; out Obj): longint; stdcall;
- function _AddRef: longint; stdcall;
- function _Release: longint; stdcall;
+ function QueryInterface(constref iid : tguid;out obj) : longint;{$IFNDEF WINDOWS}cdecl{$ELSE}stdcall{$ENDIF};
+ function _AddRef : longint;{$IFNDEF WINDOWS}cdecl{$ELSE}stdcall{$ENDIF};
+ function _Release : longint;{$IFNDEF WINDOWS}cdecl{$ELSE}stdcall{$ENDIF};
end;
@@ -44,7 +44,7 @@ uses
{ TNullInterfacedObject }
-function TNullInterfacedObject.QueryInterface(const IID: TGUID; out Obj): longint; stdcall;
+function TNullInterfacedObject.QueryInterface(constref IID: TGUID; out Obj): longint; {$IFNDEF WINDOWS}cdecl{$ELSE}stdcall{$ENDIF};
begin
if GetInterface(IID, Obj) then
Result := 0
@@ -52,12 +52,12 @@ begin
result := integer(e_nointerface);
end;
-function TNullInterfacedObject._AddRef: longint; stdcall;
+function TNullInterfacedObject._AddRef: longint; {$IFNDEF WINDOWS}cdecl{$ELSE}stdcall{$ENDIF};
begin
Result := -1;
end;
-function TNullInterfacedObject._Release: longint; stdcall;
+function TNullInterfacedObject._Release: longint; {$IFNDEF WINDOWS}cdecl{$ELSE}stdcall{$ENDIF};
begin
Result := -1;
end;
@@ -72,7 +72,7 @@ end;
procedure TAddCommand.Execute;
begin
- Writeln('>> TAddComand.Execute');
+ DebugLn('>> TAddComand.Execute');
FMemo.Lines.Add('Hello ' + IntToStr(Random(500)));
FMemo.Invalidate;
end;
@@ -81,7 +81,7 @@ end;
procedure TExitCommand.Execute;
begin
- Writeln('>> TExitComand.Execute');
+ DebugLn('>> TExitComand.Execute');
fpgApplication.Terminated := True;
end;
diff --git a/examples/gui/command_interface/frm_main.pas b/examples/gui/command_interface/frm_main.pas
index bc330130..3a29bccf 100644
--- a/examples/gui/command_interface/frm_main.pas
+++ b/examples/gui/command_interface/frm_main.pas
@@ -9,19 +9,19 @@ unit frm_main;
interface
uses
- SysUtils, Classes, fpg_base, fpg_main, fpg_edit,
- fpg_widget, fpg_form, fpg_label, fpg_button,
- fpg_listbox, fpg_memo, fpg_combobox, fpg_grid,
- fpg_dialogs, fpg_checkbox, fpg_tree, fpg_trackbar,
- fpg_progressbar, fpg_radiobutton, fpg_tab, fpg_menu,
- fpg_panel;
+ SysUtils,
+ Classes,
+ fpg_base,
+ fpg_main,
+ fpg_form,
+ fpg_button,
+ fpg_memo,
+ fpg_menu;
type
TMainForm = class(TfpgForm)
private
- procedure CommandHandler(Sender: TObject);
- public
{@VFD_HEAD_BEGIN: MainForm}
btnAdd: TfpgButton;
memName1: TfpgMemo;
@@ -29,6 +29,9 @@ type
MainMenu: TfpgMenuBar;
mnuFile: TfpgPopupMenu;
{@VFD_HEAD_END: MainForm}
+ miAdd: TfpgMenuItem;
+ procedure CommandHandler(Sender: TObject);
+ public
procedure AfterCreate; override;
end;
@@ -61,7 +64,7 @@ begin
Name := 'MainForm';
SetPosition(293, 236, 284, 254);
WindowTitle := 'Command Interface Test';
- WindowPosition := wpScreenCenter;
+ WindowPosition := wpOneThirdDown;
btnAdd := TfpgButton.Create(self);
with btnAdd do
@@ -106,6 +109,7 @@ begin
begin
Name := 'mnuFile';
SetPosition(44, 72, 120, 20);
+ miAdd := AddMenuItem('Add Item', '', @CommandHandler);
AddMenuItem('Quit', '', @CommandHandler);
end;
@@ -116,6 +120,7 @@ begin
// instantiate the Command classes
btnAdd.SetCommand(TAddCommand.Create(memName1));
btnQuit.SetCommand(TExitCommand.Create);
+ miAdd.SetCommand(btnAdd.GetCommand); // reuse exist command from btnAdd instance
// The menu item File|Quit shares the command of btnQuit
mnuFile.MenuItemByName('Quit').SetCommand(btnQuit.GetCommand);
end;
diff --git a/examples/gui/reporting/u_demo.pas b/examples/gui/reporting/u_demo.pas
index 44ed4999..349b0ad1 100644
--- a/examples/gui/reporting/u_demo.pas
+++ b/examples/gui/reporting/u_demo.pas
@@ -31,7 +31,7 @@ type
Bt_PdfMultiPages: TfpgButton;
Bt_PdfMultiSections: TfpgButton;
Bt_PdfOutlines: TfpgButton;
- Bt_PdfCadres: TfpgButton;
+ Bt_PdfFrames: TfpgButton;
Bt_PdfColor: TfpgButton;
Bt_PdfLines: TfpgButton;
Bt_PdfGrid: TfpgButton;
@@ -45,7 +45,7 @@ type
Bt_VisuMultiPages: TfpgButton;
Bt_VisuMultiSections: TfpgButton;
Bt_VisuOutlines: TfpgButton;
- Bt_VisuCadres: TfpgButton;
+ Bt_VisuFrames: TfpgButton;
Bt_VisuColor: TfpgButton;
Bt_VisuLines: TfpgButton;
Bt_VisuGrid: TfpgButton;
@@ -59,7 +59,7 @@ type
Bt_PrintMultiPages: TfpgButton;
Bt_PrintMultiSections: TfpgButton;
Bt_PrintOutlines: TfpgButton;
- Bt_PrintCadres: TfpgButton;
+ Bt_PrintFrames: TfpgButton;
Bt_PrintColor: TfpgButton;
Bt_PrintLines: TfpgButton;
Bt_PrintGrid: TfpgButton;
@@ -83,7 +83,7 @@ type
procedure Bt_PdfMultiPagesClick(Sender: TObject);
procedure Bt_PdfMultiSectionsClick(Sender: TObject);
procedure Bt_PdfOutlinesClick(Sender: TObject);
- procedure Bt_PdfCadresClick(Sender: TObject);
+ procedure Bt_PdfFramesClick(Sender: TObject);
procedure Bt_PdfColorClick(Sender: TObject);
procedure Bt_PdfLinesClick(Sender: TObject);
procedure Bt_PdfGridClick(Sender: TObject);
@@ -96,7 +96,7 @@ type
procedure Bt_VisuMultiPagesClick(Sender: TObject);
procedure Bt_VisuMultiSectionsClick(Sender: TObject);
procedure Bt_VisuOutlinesClick(Sender: TObject);
- procedure Bt_VisuCadresClick(Sender: TObject);
+ procedure Bt_VisuFramesClick(Sender: TObject);
procedure Bt_VisuColorClick(Sender: TObject);
procedure Bt_VisuLinesClick(Sender: TObject);
procedure Bt_VisuGridClick(Sender: TObject);
@@ -109,7 +109,7 @@ type
procedure Bt_PrintMultiPagesClick(Sender: TObject);
procedure Bt_PrintMultiSectionsClick(Sender: TObject);
procedure Bt_PrintOutlinesClick(Sender: TObject);
- procedure Bt_PrintCadresClick(Sender: TObject);
+ procedure Bt_PrintFramesClick(Sender: TObject);
procedure Bt_PrintColorClick(Sender: TObject);
procedure Bt_PrintLinesClick(Sender: TObject);
procedure Bt_PrintGridClick(Sender: TObject);
@@ -124,7 +124,7 @@ type
procedure PrintMultiPages(Preview: Boolean);
procedure PrintMultiSections(Preview: Boolean);
procedure PrintOutlines(Preview: Boolean);
- procedure PrintCadres(Preview: Boolean);
+ procedure PrintFrames(Preview: Boolean);
procedure PrintColor(Preview: Boolean);
procedure PrintLines(Preview: Boolean);
procedure PrintGrid(Preview: Boolean);
@@ -221,14 +221,14 @@ begin
end;
end;
-procedure TF_Demo.Bt_PdfCadresClick(Sender: TObject);
+procedure TF_Demo.Bt_PdfFramesClick(Sender: TObject);
begin
FReport := T_Report.Create;
with FReport do
begin
// Language:= Version;
- PrintCadres(False);
- DefaultFile:= 'Cadres.pdf';
+ PrintFrames(False);
+ DefaultFile:= 'Frames.pdf';
PrintPdf(LayoutMode, ZoomValue, Preferences);
Free;
end;
@@ -319,7 +319,7 @@ begin
begin
// Language:= Version;
PrintTtfFont(False);
- DefaultFile:= 'TtfFont.pdf';
+ DefaultFile:= 'TrueTypeFonts.pdf';
PrintPdf(LayoutMode, ZoomValue, Preferences);
Free;
end;
@@ -385,14 +385,14 @@ begin
end;
end;
-procedure TF_Demo.Bt_VisuCadresClick(Sender: TObject);
+procedure TF_Demo.Bt_VisuFramesClick(Sender: TObject);
begin
FReport := T_Report.Create;
with FReport do
begin
//Language:= Version;
- DefaultFile := 'Cadres.pdf';
- PrintCadres(True);
+ DefaultFile := 'Frames.pdf';
+ PrintFrames(True);
Free;
end;
end;
@@ -506,7 +506,7 @@ begin
end;
-procedure TF_Demo.Bt_PrintCadresClick(Sender: TObject);
+procedure TF_Demo.Bt_PrintFramesClick(Sender: TObject);
begin
end;
@@ -756,7 +756,7 @@ begin
end;
end;
-procedure TF_Demo.PrintCadres(Preview: Boolean);
+procedure TF_Demo.PrintFrames(Preview: Boolean);
var
FtTitle, FtText: integer;
{TsThin,} TsNorm, TsThick: integer;
@@ -1212,11 +1212,12 @@ begin
SetPosition(0, 0, 900, 600);
WindowPosition := wpScreenCenter;
Sizeable := False;
- fpgSetNamedColor(clWindowBackground, clPaleGreen);
- fpgSetNamedColor(clButtonFace, clCyan);
- fpgSetNamedColor(clText1, clBlue);
- fpgSetNamedColor(clSelection, clSkyBlue);
- fpgSetNamedColor(clSelectionText, clDarkBlue);
+
+ //fpgSetNamedColor(clWindowBackground, clPaleGreen);
+ //fpgSetNamedColor(clButtonFace, clCyan);
+ //fpgSetNamedColor(clText1, clBlue);
+ //fpgSetNamedColor(clSelection, clSkyBlue);
+ //fpgSetNamedColor(clSelectionText, clDarkBlue);
fpgSetNamedFont('Label1', 'bitstream vera sans-10');
fpgSetNamedFont('Edit1', 'bitstream vera sans-10');
L_Pdf := CreateLabel(Self, 50, 5, 'Print to PDF', 150, 20, taCenter);
@@ -1225,7 +1226,7 @@ begin
Bt_PdfMultiPages := CreateButton(Self, 50, 110, 150, 'Multiple pages', @Bt_PdfMultiPagesClick, 'stdimg.Adobe_pdf');
Bt_PdfMultiSections := CreateButton(Self, 50, 150, 150, 'Multiple sections', @Bt_PdfMultiSectionsClick, 'stdimg.Adobe_pdf');
Bt_PdfOutlines := CreateButton(Self, 50, 190, 150, 'Outlines', @Bt_PdfOutlinesClick, 'stdimg.Adobe_pdf');
- Bt_PdfCadres := CreateButton(Self, 50, 230, 150, 'Draw frames', @Bt_PdfCadresClick, 'stdimg.Adobe_pdf');
+ Bt_PdfFrames := CreateButton(Self, 50, 230, 150, 'Draw frames', @Bt_PdfFramesClick, 'stdimg.Adobe_pdf');
Bt_PdfColor := CreateButton(Self, 50, 270, 150, 'Show colors', @Bt_PdfColorClick, 'stdimg.Adobe_pdf');
Bt_PdfLines := CreateButton(Self, 50, 310, 150, 'Draw lines', @Bt_PdfLinesClick, 'stdimg.Adobe_pdf');
Bt_PdfGrid := CreateButton(Self, 50, 350, 150, 'Show grid', @Bt_PdfGridClick, 'stdimg.Adobe_pdf');
@@ -1239,7 +1240,7 @@ begin
Bt_VisuMultiPages := CreateButton(Self, 250, 110, 150, 'Multiple pages', @Bt_VisuMultiPagesClick, 'stdimg.preview');
Bt_VisuMultiSections := CreateButton(Self, 250, 150, 150, 'Multiple sections', @Bt_VisuMultiSectionsClick, 'stdimg.preview');
Bt_VisuOutlines := CreateButton(Self, 250, 190, 150, 'Outlines', @Bt_VisuOutlinesClick, 'stdimg.preview');
- Bt_VisuCadres := CreateButton(Self, 250, 230, 150, 'Draw frames', @Bt_VisuCadresClick, 'stdimg.preview');
+ Bt_VisuFrames := CreateButton(Self, 250, 230, 150, 'Draw frames', @Bt_VisuFramesClick, 'stdimg.preview');
Bt_VisuColor := CreateButton(Self, 250, 270, 150, 'Show colors', @Bt_VisuColorClick, 'stdimg.preview');
Bt_VisuLines := CreateButton(Self, 250, 310, 150, 'Draw lines', @Bt_VisuLinesClick, 'stdimg.preview');
Bt_VisuGrid := CreateButton(Self, 250, 350, 150, 'Show grid', @Bt_VisuGridClick, 'stdimg.preview');
@@ -1258,8 +1259,8 @@ begin
Bt_PrintMultiSections.Enabled := False;
Bt_PrintOutlines := CreateButton(Self, 450, 190, 150, 'Outlines', @Bt_PrintOutlinesClick, 'stdimg.print');
Bt_PrintOutlines.Enabled := False;
- Bt_PrintCadres := CreateButton(Self, 450, 230, 150, 'Draw frames', @Bt_PrintCadresClick, 'stdimg.print');
- Bt_PrintCadres.Enabled := False;
+ Bt_PrintFrames := CreateButton(Self, 450, 230, 150, 'Draw frames', @Bt_PrintFramesClick, 'stdimg.print');
+ Bt_PrintFrames.Enabled := False;
Bt_PrintColor := CreateButton(Self, 450, 270, 150, 'Show colors', @Bt_PrintColorClick, 'stdimg.print');
Bt_PrintColor.Enabled := False;
Bt_PrintLines := CreateButton(Self, 450, 310, 150, 'Draw lines', @Bt_PrintLinesClick, 'stdimg.print');
diff --git a/examples/gui/sprites/background.bmp b/examples/gui/sprites/background.bmp
new file mode 100644
index 00000000..a7a6cd43
--- /dev/null
+++ b/examples/gui/sprites/background.bmp
Binary files differ
diff --git a/examples/gui/sprites/ide_icon48x48.bmp b/examples/gui/sprites/ide_icon48x48.bmp
deleted file mode 100644
index 3e710b1d..00000000
--- a/examples/gui/sprites/ide_icon48x48.bmp
+++ /dev/null
Binary files differ
diff --git a/examples/gui/sprites/splash_logo.bmp b/examples/gui/sprites/splash_logo.bmp
deleted file mode 100644
index 0096893a..00000000
--- a/examples/gui/sprites/splash_logo.bmp
+++ /dev/null
Binary files differ
diff --git a/examples/gui/sprites/spritedemo.lpr b/examples/gui/sprites/spritedemo.lpr
index 5de6e813..ead9f1bf 100644
--- a/examples/gui/sprites/spritedemo.lpr
+++ b/examples/gui/sprites/spritedemo.lpr
@@ -73,6 +73,7 @@ begin
// paint debug info
if FShowInterval then
begin
+ Canvas.TextColor := clWhite;
Canvas.DrawText(4, 4, 'Timer Interval: ' + IntToStr(Timer.Interval));
end;
end;
@@ -124,8 +125,8 @@ begin
OnClose := @FormClose;
OnDestroy := @FormDestroy;
- Background := LoadImage_BMP('splash_logo.bmp');
- SpriteImg := LoadImage_BMP('ide_icon48x48.bmp');
+ Background := LoadImage_BMP('background.bmp');
+ SpriteImg := LoadImage_BMP('ufo.bmp');
SpriteImg.CreateMaskFromSample(0, 0);
SpriteImg.UpdateImage;
diff --git a/examples/gui/sprites/ufo.bmp b/examples/gui/sprites/ufo.bmp
new file mode 100644
index 00000000..709bcaa2
--- /dev/null
+++ b/examples/gui/sprites/ufo.bmp
Binary files differ
diff --git a/examples/gui/stdimages/stdimglist.lpi b/examples/gui/stdimages/stdimglist.lpi
index 94af915b..f519fc99 100644
--- a/examples/gui/stdimages/stdimglist.lpi
+++ b/examples/gui/stdimages/stdimglist.lpi
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<CONFIG>
<ProjectOptions>
- <Version Value="7"/>
+ <Version Value="9"/>
<General>
<Flags>
<SaveOnlyProjectUnits Value="True"/>
@@ -9,11 +9,13 @@
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
- <TargetFileExt Value=""/>
</General>
<VersionInfo>
- <StringTable Comments="" CompanyName="" FileDescription="" FileVersion="0.0.0.0" InternalName="" LegalCopyright="" LegalTrademarks="" OriginalFilename="" ProductName="" ProductVersion=""/>
+ <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)"/>
@@ -38,10 +40,14 @@
</Units>
</ProjectOptions>
<CompilerOptions>
- <Version Value="8"/>
+ <Version Value="11"/>
+ <Parsing>
+ <SyntaxOptions>
+ <UseAnsiStrings Value="False"/>
+ </SyntaxOptions>
+ </Parsing>
<Other>
- <CustomOptions Value="-FUunits
-"/>
+ <CustomOptions Value="-FUunits"/>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
diff --git a/examples/gui/stdimages/stdimglist.lpr b/examples/gui/stdimages/stdimglist.lpr
index 09e57990..2d4ba9d9 100644
--- a/examples/gui/stdimages/stdimglist.lpr
+++ b/examples/gui/stdimages/stdimglist.lpr
@@ -4,7 +4,7 @@ program stdimglist;
uses
Classes, SysUtils,
- fpg_base, fpg_main, fpg_form, fpg_imgfmt_bmp, fpg_button;
+ fpg_base, fpg_main, fpg_form, fpg_imgfmt_bmp, fpg_button, u_reportimages;
type
@@ -28,6 +28,8 @@ begin
MinWidth := 200;
MinHeight := 100;
+ CreateReportImages;
+
btnClose := CreateButton(self, Width-90, Height-35, 75, 'Quit', @btnCloseClick);
btnClose.ImageName := 'stdimg.quit';
btnClose.Anchors := [anRight, anBottom];
diff --git a/images/reporting/fermer.bmp b/images/reporting/close.bmp
index 68decf1f..68decf1f 100644
--- a/images/reporting/fermer.bmp
+++ b/images/reporting/close.bmp
Binary files differ
diff --git a/images/reporting/debut.bmp b/images/reporting/first.bmp
index 9518137b..9518137b 100644
--- a/images/reporting/debut.bmp
+++ b/images/reporting/first.bmp
Binary files differ
diff --git a/images/reporting/fin.bmp b/images/reporting/last.bmp
index 6e048cf7..6e048cf7 100644
--- a/images/reporting/fin.bmp
+++ b/images/reporting/last.bmp
Binary files differ
diff --git a/images/reporting/suivant.bmp b/images/reporting/next.bmp
index afe14564..afe14564 100644
--- a/images/reporting/suivant.bmp
+++ b/images/reporting/next.bmp
Binary files differ
diff --git a/images/reporting/precedent.bmp b/images/reporting/previous.bmp
index cb9a0847..cb9a0847 100644
--- a/images/reporting/precedent.bmp
+++ b/images/reporting/previous.bmp
Binary files differ
diff --git a/images/reporting/imprimer.bmp b/images/reporting/print.bmp
index 51115c5b..51115c5b 100644
--- a/images/reporting/imprimer.bmp
+++ b/images/reporting/print.bmp
Binary files differ
diff --git a/images/reporting/imprimante.bmp b/images/reporting/printer.bmp
index 666a7911..666a7911 100644
--- a/images/reporting/imprimante.bmp
+++ b/images/reporting/printer.bmp
Binary files differ
diff --git a/prototypes/keyboard_symbols.txt b/prototypes/keyboard_symbols.txt
new file mode 100644
index 00000000..1bcd48a0
--- /dev/null
+++ b/prototypes/keyboard_symbols.txt
@@ -0,0 +1,37 @@
+
+
+ HTML Entity . .. GLYPH . . . NAME
+
+ &#63743;. . . . .  . . . Apple
+
+ &#8984; . . . . . ⌘ . . . Command, Cmd, Clover, (formerly) Apple
+ &#8963; . . . . . ⌃ . . . Control, Ctl, Ctrl
+ &#8997; . . . . . ⌥ . . . Option, Opt, (Windows) Alt
+ &#8679; . . . . . ⇧ . . . Shift
+ &#8682; . . . . . ⇪ . . . Caps lock
+ &#9167; . . . . . â . . . Eject
+
+ &#8617; . . . . . ↩ . . . Return, Carriage Return
+ &#8629; &crarr; . ↵ . . . Return, Carriage Return
+ &#9166; . . . . . ⎠. . . Return, Carriage Return
+ &#8996; . . . . . ⌤ . . . Enter
+
+ &#9003; . . . . . ⌫ . . . Delete, Backspace
+ &#8998; . . . . . ⌦ . . . Forward Delete
+ &#9099; . . . . . ⎋ . . . Escape, Esc
+
+ &#8594; &rarr; .. → . . . Right arrow
+ &#8592; &larr; .. ↠. . . Left arrow
+ &#8593; &uarr; .. ↑ . . . Up arrow
+ &#8595; &darr; .. ↓ . . . Down arrow
+ &#8670; . . . . . ⇞ . . . Page Up, PgUp
+ &#8671; . . . . . ⇟ . . . Page Down, PgDn
+ &#8598; . . . . . ↖ . . . Home
+ &#8600; . . . . . ↘ . . . End
+
+ &#8999; . . . . . ⌧ . . . Clear
+ &#8677; . . . . . ⇥ . . . Tab, Tab Right, Horizontal Tab
+ &#8676; . . . . . ⇤ . . . Shift Tab, Tab Left, Back-tab
+ &#9250; . . . . . ⢠. . . Space, Blank
+ &#9251; . . . . . ⣠. .. . Space, Blank
+
diff --git a/src/VERSION_FILE.inc b/src/VERSION_FILE.inc
index f5780fb3..212d4aea 100644
--- a/src/VERSION_FILE.inc
+++ b/src/VERSION_FILE.inc
@@ -1 +1 @@
-FPGUI_VERSION = '0.8';
+FPGUI_VERSION = '1.0';
diff --git a/src/corelib/fpg_base.pas b/src/corelib/fpg_base.pas
index 3eae947a..f3e8f6db 100644
--- a/src/corelib/fpg_base.pas
+++ b/src/corelib/fpg_base.pas
@@ -22,6 +22,9 @@ unit fpg_base;
// To enable the AggPas powered Canvas
{.$define AGGCanvas}
+// For debug use only
+{.$define GDEBUG}
+
interface
uses
@@ -778,6 +781,9 @@ uses
fpg_form, // needed for fpgApplication.CreateForms()
typinfo,
process,
+ {$IFDEF GDEBUG}
+ dbugintf,
+ {$ENDIF}
dateutils;
@@ -2553,7 +2559,9 @@ begin
p.CommandLine := GetHelpViewer + ' ' + HelpFile
else
p.CommandLine := GetHelpViewer + ' ' + HelpFile + ' -n ' + IntToStr(AHelpContext);
-//writeln('DEBUG: TfpgApplicationBase.ContextHelp > ', p.CommandLine);
+ {$ifdef GDEBUG}
+ senddebug(p.CommandLine);
+ {$endif}
end
else
p.CommandLine := GetHelpViewer;
@@ -2576,7 +2584,9 @@ begin
if fpgFileExists(HelpFile) then
begin
p.CommandLine := GetHelpViewer + ' ' + HelpFile + ' -s ' + AHelpKeyword;
-//writeln('DEBUG: TfpgApplicationBase.ContextHelp > ', p.CommandLine);
+ {$ifdef GDEBUG}
+ senddebug(p.CommandLine);
+ {$endif}
end
else
p.CommandLine := GetHelpViewer;
diff --git a/src/corelib/fpg_imgfmt_bmp.pas b/src/corelib/fpg_imgfmt_bmp.pas
index 353b3216..00637f3b 100644
--- a/src/corelib/fpg_imgfmt_bmp.pas
+++ b/src/corelib/fpg_imgfmt_bmp.pas
@@ -1,7 +1,7 @@
{
fpGUI - Free Pascal GUI Toolkit
- Copyright (C) 2006 - 2010 See the file AUTHORS.txt, included in this
+ Copyright (C) 2006 - 2013 See the file AUTHORS.txt, included in this
distribution, for details of the copyright.
See the file COPYING.modifiedLGPL, included in this distribution,
@@ -38,6 +38,15 @@ implementation
uses
fpg_utils;
+{$IF FPC_FULLVERSION<20602}
+type
+ uint16 = word;
+ uint32 = cardinal;
+{$IFEND}
+
+
+procedure ReadImage_OS2BMP(img: TfpgImage; bmp: Pointer; bmpsize: longword); forward;
+
function CreateImage_BMP(bmp: Pointer; bmpsize: longword): TfpgImage;
begin
@@ -147,6 +156,13 @@ begin
p := bmp;
PByte(bh) := p;
+
+ if bh^.signature = $4d62 then { 'bM' }
+ begin
+ ReadImage_OS2BMP(img, bmp, bmpsize);
+ exit;
+ end;
+
ppal := nil;
if bh^.filesize <> bmpsize then
Exit; //==>
@@ -314,7 +330,229 @@ begin
until linecnt >= img.Height;
end;
else
- writeln('Unsupported BMP format!');
+ raise Exception.Create('Unsupported BMP format!');
+ end;
+
+ if ppal <> nil then
+ FreeMem(ppal);
+
+ img.UpdateImage;
+end;
+
+type
+ { These records come from the HelpBitmap unit - part of DocView }
+ INFBITMAPHEADER = packed record
+ // BITMAP FILE HEADER
+ usType: uint16; // = 'bM'
+ cbSize: uint32;
+ xHotspot: uint16;
+ yHotspot: uint16;
+ DataOffset: uint32; // =size(hdr)+size(palette)
+ // BITMAP INFO HEADER
+ cbFIx: uint32; // =size(info_hdr) (usually = 12?)
+ Width: uint16; // width size
+ Height: uint16; // height size
+ cPlanes: uint16; // planes, =1 (always seems to be one)
+ BitCount: uint16; // bits per pixel
+ // followed by RGB triples if <= 8bpp
+ end;
+
+
+procedure ReadImage_OS2BMP(img: TfpgImage; bmp: Pointer; bmpsize: longword);
+var
+ bh: ^INFBITMAPHEADER;
+ p: PByte;
+ ppal: plongword;
+ pcol: Plongword;
+ palsize: integer;
+ pdata: PByte;
+ b: byte;
+ bit: byte;
+ bcnt: byte;
+ linecnt: integer;
+ pixelcnt: integer;
+ pdest: Plongword;
+ depth: integer;
+
+ function GetPalColor(cindex: longword): longword;
+ var
+ pc: Plongword;
+ begin
+ pc := ppal;
+ Inc(pc, cindex);
+ Result := pc^;
+ end;
+
+begin
+ if img = nil then
+ Exit; //==>
+
+ img.FreeImage;
+
+ ppal := nil;
+ p := bmp;
+ PByte(bh) := p;
+
+ pdata := bmp;
+ Inc(pdata, bh^.DataOffset);
+ Inc(p, SizeOf(INFBITMAPHEADER));
+
+ depth := bh^.BitCount;
+
+ if depth > 1 then
+ img.AllocateImage(32, bh^.Width, bh^.Height)// color image (RGB or Indexed)
+ else
+ begin
+ img.AllocateImage(1, bh^.Width, bh^.Height);
+ img.AllocateMask;
+ end;
+
+ if depth <= 8 then
+ begin
+ // reading color palette
+ case depth of
+ 1: palsize := 2;
+ 4: palsize := 16;
+ else
+ palsize := 256;
+ end;
+
+ GetMem(ppal, palsize * SizeOf(longword));
+
+ pcol := ppal;
+ pixelcnt := 0;
+ // OS/2 1.x bitmap with uses 3-byte palette
+ while (p) < (pdata) do
+ begin
+ pcol^ := (LongWord($FF) shl 24) + (LongWord(p[2]) shl 16) + (LongWord(p[1]) shl 8) + LongWord(p[0]);
+ Inc(pcol);
+ inc(p, 3);
+ Inc(pixelcnt);
+ end;
+ end;
+
+ pdest := img.ImageData;
+ Inc(pdest, img.Width * (img.Height - 1)); // bottom-up line order
+ p := bmp;
+ Inc(p, bh^.DataOffset);
+
+ // reading the data...
+ case depth of
+ 1:
+ begin
+ // direct line transfer
+ //writeln('reading 1-bit color bitmap');
+ linecnt := 0;
+ bcnt := img.Width div 32;
+ if (img.Width and $1F) > 0 then
+ Inc(bcnt);
+
+ pdest := img.ImageData;
+ Inc(pdest, bcnt * (img.Height - 1)); // bottom-up line order
+ repeat
+ move(p^, pdest^, bcnt * 4);
+ Inc(p, bcnt * 4);
+ Dec(pdest, bcnt);
+ Inc(linecnt);
+ until linecnt >= img.Height;
+
+ //Writeln(linecnt,' lines loaded.');
+ move(img.ImageData^, img.MaskData^, img.ImageDataSize);
+ img.Invert(True);
+ end;
+
+ 4:
+ begin
+ //writeln('reading 4-bit color');
+ linecnt := 0;
+ repeat
+ // parse one line..
+ bit := 0;
+ pixelcnt := 0;
+ bcnt := 0;
+ repeat
+ if bit = 0 then
+ b := (p^ shr 4) and $0F
+ else
+ begin
+ b := p^ and $0F;
+ Inc(p);
+ Inc(bcnt);
+ end;
+
+ pdest^ := GetPalColor(b);
+ Inc(pdest);
+ Inc(pixelcnt);
+ bit := bit xor 1;
+ until pixelcnt >= img.Width;
+
+ while (bcnt mod 4) <> 0 do
+ begin
+ Inc(bcnt);
+ Inc(p);
+ end;
+
+ Inc(linecnt);
+ Dec(pdest, img.Width * 2); // go to next line
+ until linecnt >= img.Height;
+ end;
+
+ 8:
+ begin
+ //writeln('reading 8-bit color');
+ linecnt := 0;
+ repeat
+ // parse one line..
+ pixelcnt := 0;
+ repeat
+ pdest^ := GetPalColor(p^);
+ Inc(p);
+ Inc(pdest);
+ Inc(pixelcnt);
+ until pixelcnt >= img.Width;
+
+ while (pixelcnt mod 4) <> 0 do
+ begin
+ Inc(pixelcnt);
+ Inc(p);
+ end;
+
+ Inc(linecnt);
+ Dec(pdest, img.Width * 2); // go to next line
+ until linecnt >= img.Height;
+ end;
+
+ 24:
+ begin
+ //writeln('reading truecolor');
+ linecnt := 0;
+ repeat
+ // parse one line..
+ pixelcnt := 0;
+ repeat
+ pdest^ := p^;
+ Inc(p);
+ pdest^ := pdest^ or (longword(p^) shl 8);
+ Inc(p);
+ pdest^ := pdest^ or (longword(p^) shl 16) or ($FF shl 24) {alpha set to full opaque};
+ Inc(p);
+ Inc(pdest);
+ Inc(pixelcnt);
+ until pixelcnt >= img.Width;
+
+ pixelcnt := img.Width * 3;
+ while (pixelcnt mod 4) <> 0 do
+ begin
+ Inc(pixelcnt);
+ Inc(p);
+ end;
+
+ Inc(linecnt);
+ Dec(pdest, img.Width * 2); // go to next line
+ until linecnt >= img.Height;
+ end;
+ else
+ raise Exception.Create('Unsupported BMP format!');
end;
if ppal <> nil then
diff --git a/src/corelib/fpg_imgfmt_png.pas b/src/corelib/fpg_imgfmt_png.pas
index c0659d2e..c95150e4 100644
--- a/src/corelib/fpg_imgfmt_png.pas
+++ b/src/corelib/fpg_imgfmt_png.pas
@@ -1,7 +1,7 @@
{
fpGUI - Free Pascal GUI Toolkit
- Copyright (C) 2006 - 2012 See the file AUTHORS.txt, included in this
+ Copyright (C) 2006 - 2013 See the file AUTHORS.txt, included in this
distribution, for details of the copyright.
See the file COPYING.modifiedLGPL, included in this distribution,
@@ -31,6 +31,7 @@ uses
function LoadImage_PNG(const AFileName: TfpgString): TfpgImage; overload;
function LoadImage_PNG(AStream: TStream): TfpgImage; overload;
+function LoadImage_PNG(const AImageData: Pointer; const AImageDataSize: LongWord): TfpgImage; overload;
function LoadImage_PNG(AInstance: THandle; const AResName: String; AResType: PChar): TfpgImage; overload;
function LoadImage_PNGcrop(const AMaxWidth, AMaxHeight: integer; const AFileName: TfpgString): TfpgImage;
@@ -114,6 +115,19 @@ begin
end;
end;
+function LoadImage_PNG(const AImageData: Pointer; const AImageDataSize: LongWord): TfpgImage;
+var
+ s: TMemoryStream;
+begin
+ s := TMemoryStream.Create;
+ try
+ s.Write(AImageData^, AImageDataSize);
+ Result := LoadImage_PNG(s);
+ finally
+ s.Free;
+ end;
+end;
+
function LoadImage_PNG(AInstance: THandle; const AResName: String; AResType: PChar): TfpgImage;
var
res: TResourceStream;
diff --git a/src/corelib/fpg_main.pas b/src/corelib/fpg_main.pas
index f90e6b4c..44ab6a82 100644
--- a/src/corelib/fpg_main.pas
+++ b/src/corelib/fpg_main.pas
@@ -214,6 +214,7 @@ type
procedure DrawButtonFace(ACanvas: TfpgCanvas; r: TfpgRect; AFlags: TfpgButtonFlags); overload;
function GetButtonBorders: TRect; virtual;
function GetButtonShift: TPoint; virtual;
+ function HasButtonHoverEffect: boolean; virtual;
{ Menus }
procedure DrawMenuBar(ACanvas: TfpgCanvas; r: TfpgRect; ABackgroundColor: TfpgColor); virtual;
procedure DrawMenuRow(ACanvas: TfpgCanvas; r: TfpgRect; AFlags: TfpgMenuItemFlags); virtual;
@@ -456,6 +457,9 @@ uses
{$ifdef AGGCanvas}
Agg2D,
{$endif}
+{$IFDEF DEBUG}
+ dbugintf,
+{$ENDIF}
fpg_imgfmt_bmp,
fpg_stdimages,
fpg_translations,
@@ -831,14 +835,14 @@ begin
FClassName := AClassName;
FMethodName := AMethodName;
{$IFDEF DEBUG}
- Writeln(Format('%s>> %s.%s', [spacing, FClassName, FMethodName]));
+ SendDebug(Format('%s>> %s.%s', [spacing, FClassName, FMethodName]));
{$ENDIF}
end;
destructor TPrintCallTrace.Destroy;
begin
{$IFDEF DEBUG}
- Writeln(Format('%s<< %s.%s', [spacing, FClassName, FMethodName]));
+ SendDebug(Format('%s<< %s.%s', [spacing, FClassName, FMethodName]));
{$ENDIF}
dec(iCallTrace);
inherited Destroy;
@@ -1166,7 +1170,7 @@ begin
end;
{$IFDEF DEBUG}
- Writeln('GetNamedFontDesc error: "' + afontid + '" is missing. Default is used.');
+ SendDebug('GetNamedFontDesc error: "' + afontid + '" is missing. Default is used.');
{$ENDIF}
Result := FPG_DEFAULT_FONT_DESC;
end;
@@ -1327,7 +1331,7 @@ begin
begin
fr.Free;
{$IFDEF DEBUG}
- writeln('fpGFX: Error opening font.');
+ SendDebug('fpGFX: Error opening font.');
{$ENDIF}
end;
end;
@@ -1650,7 +1654,7 @@ end;
procedure TfpgApplication.HideHint;
begin
{$IFDEF DEBUG}
- writeln('HideHint');
+ SendDebug('HideHint');
{$ENDIF}
FHintTimer.Enabled := False;
if Assigned(FHintWindow) and TfpgHintWindow(FHintWindow).Visible then
@@ -2340,6 +2344,11 @@ begin
Result := Point(1, 1);
end;
+function TfpgStyle.HasButtonHoverEffect: boolean;
+begin
+ Result := False;
+end;
+
function TfpgStyle.GetControlFrameBorders: TRect;
begin
Result := Rect(2, 2, 2, 2);
@@ -2433,7 +2442,7 @@ begin
{$Note This occurs every now and again with TfpgMemo and CaretInvert painting! }
// Investigate this.
{$IFDEF DEBUG}
- writeln('TfpgCaret.InvertCaret cause an exception');
+ SendDebug('TfpgCaret.InvertCaret cause an exception');
{$ENDIF}
end;
end;
diff --git a/src/corelib/fpg_utils.pas b/src/corelib/fpg_utils.pas
index dcc0cf71..9d0e907d 100644
--- a/src/corelib/fpg_utils.pas
+++ b/src/corelib/fpg_utils.pas
@@ -63,6 +63,7 @@ function fpgExtractFileDir(const FileName: TfpgString): TfpgString;
function fpgExtractFilePath(const FileName: TfpgString): TfpgString;
function fpgExtractFileName(const FileName: TfpgString): TfpgString;
function fpgExtractFileExt(const FileName: TfpgString): TfpgString;
+function fpgExtractRelativepath(const ABaseName, ADestName: TfpgString): TfpgString;
function fpgForceDirectories(const ADirectory: TfpgString): Boolean;
function fpgChangeFileExt(const FileName, Extension: TfpgString): TfpgString;
function fpgGetAppConfigDir(const Global: Boolean): TfpgString;
@@ -164,6 +165,11 @@ begin
Result := ExtractFileExt(fpgToOSEncoding(Filename));
end;
+function fpgExtractRelativepath(const ABaseName, ADestName: TfpgString): TfpgString;
+begin
+ Result := ExtractRelativepath(fpgToOSEncoding(ABaseName), fpgToOSEncoding(ADestName));
+end;
+
function fpgForceDirectories(const ADirectory: TfpgString): Boolean;
begin
Result := ForceDirectories(fpgToOSEncoding(ADirectory));
diff --git a/src/corelib/fpg_widget.pas b/src/corelib/fpg_widget.pas
index 67206557..a74c1b30 100644
--- a/src/corelib/fpg_widget.pas
+++ b/src/corelib/fpg_widget.pas
@@ -960,7 +960,7 @@ begin
dir := 0;
- if not consumed and (keycode = fpgApplication.HelpKey) then
+ if not consumed and (keycode = fpgApplication.HelpKey) and (shiftstate=[]) then
begin
InvokeHelp;
consumed := True;
diff --git a/src/corelib/gdi/fpgui_toolkit.lpk b/src/corelib/gdi/fpgui_toolkit.lpk
index f3f349c3..bf019e5f 100644
--- a/src/corelib/gdi/fpgui_toolkit.lpk
+++ b/src/corelib/gdi/fpgui_toolkit.lpk
@@ -1,12 +1,11 @@
<?xml version="1.0"?>
<CONFIG>
- <Package Version="3">
+ <Package Version="4">
<PathDelim Value="\"/>
<Name Value="fpgui_toolkit"/>
- <AddToProjectUsesSection Value="False"/>
<Author Value="Graeme Geldenhuys"/>
<CompilerOptions>
- <Version Value="9"/>
+ <Version Value="11"/>
<PathDelim Value="\"/>
<SearchPaths>
<IncludeFiles Value="..\..;..\render\software"/>
@@ -31,7 +30,7 @@
</CompilerOptions>
<Description Value="fpGUI Toolkit"/>
<License Value="LGPL 2 with static linking exception."/>
- <Version Minor="8"/>
+ <Version Major="1"/>
<Files Count="98">
<Item1>
<Filename Value="..\stdimages.inc"/>
diff --git a/src/corelib/render/software/Agg2D.pas b/src/corelib/render/software/Agg2D.pas
index 79940cbd..50a68fb8 100644
--- a/src/corelib/render/software/Agg2D.pas
+++ b/src/corelib/render/software/Agg2D.pas
@@ -40,51 +40,51 @@ interface
{$ENDIF}
uses
- agg_basics ,
- agg_array ,
- agg_trans_affine ,
- agg_trans_viewport ,
- agg_path_storage ,
- agg_conv_stroke ,
- agg_conv_transform ,
- agg_conv_curve ,
- agg_conv_dash ,
- agg_rendering_buffer ,
- agg_renderer_base ,
- agg_renderer_scanline ,
- agg_span_gradient ,
- agg_span_image_filter_rgba ,
- agg_span_image_resample_rgba ,
- agg_span_converter ,
- agg_span_interpolator_linear ,
- agg_span_allocator ,
- agg_rasterizer_scanline_aa ,
- agg_gamma_functions ,
- agg_scanline_u ,
- agg_arc ,
- agg_bezier_arc ,
- agg_rounded_rect ,
- agg_font_engine ,
- agg_font_cache_manager ,
- agg_pixfmt ,
- agg_pixfmt_rgb ,
- agg_pixfmt_rgba ,
- agg_color ,
- agg_math_stroke ,
- agg_image_filters ,
- agg_vertex_source ,
- agg_render_scanlines ,
+ agg_basics ,
+ agg_array ,
+ agg_trans_affine ,
+ agg_trans_viewport ,
+ agg_path_storage ,
+ agg_conv_stroke ,
+ agg_conv_transform ,
+ agg_conv_curve ,
+ agg_conv_dash ,
+ agg_rendering_buffer ,
+ agg_renderer_base ,
+ agg_renderer_scanline ,
+ agg_span_gradient ,
+ agg_span_image_filter_rgba ,
+ agg_span_image_resample_rgba ,
+ agg_span_converter ,
+ agg_span_interpolator_linear ,
+ agg_span_allocator ,
+ agg_rasterizer_scanline_aa ,
+ agg_gamma_functions ,
+ agg_scanline_u ,
+ agg_arc ,
+ agg_bezier_arc ,
+ agg_rounded_rect ,
+ agg_font_engine ,
+ agg_font_cache_manager ,
+ agg_pixfmt ,
+ agg_pixfmt_rgb ,
+ agg_pixfmt_rgba ,
+ agg_color ,
+ agg_math_stroke ,
+ agg_image_filters ,
+ agg_vertex_source ,
+ agg_render_scanlines ,
{$IFDEF AGG2D_USE_FREETYPE }
- agg_font_freetype ,
+ agg_font_freetype ,
{$ENDIF }
{$IFDEF AGG2D_USE_WINFONTS}
- agg_font_win32_tt ,
+ agg_font_win32_tt ,
{$ENDIF }
- Math ,
- Classes,
- SysUtils,
+ Math,
+ Classes,
+ SysUtils,
// This allows for platform specific uses clauses
{$define uses_interface}
@@ -98,8 +98,8 @@ uses
{$I agg_platform_x11.inc}
{$ENDIF}
- fpg_base,
- fpg_main;
+ fpg_base,
+ fpg_main;
{ GLOBAL VARIABLES & CONSTANTS }
const
@@ -3539,7 +3539,11 @@ begin
{$IFDEF WINDOWS}
Font('Arial', 13);
{$ELSE}
- Font('/usr/share/fonts/truetype/ttf-liberation/LiberationSans-Regular.ttf', 13);
+ {$IFDEF BSD}
+ Font('/usr/local/lib/X11/fonts/Liberation/LiberationSans-Regular.ttf', 13);
+ {$ELSE}
+ Font('/usr/share/fonts/truetype/ttf-liberation/LiberationSans-Regular.ttf', 13);
+ {$ENDIF}
{$ENDIF}
end;
@@ -3745,8 +3749,21 @@ begin
end;
procedure TAgg2D.DoDrawPolygon(Points: PPoint; NumPts: Integer; Winding: boolean);
+var
+ i: integer;
+ poly: array of double;
begin
-
+ SetLength(poly, (NumPts*2)+1); // dynamic arrays start at 0, but we want to use 1..NumPts
+ for i := 1 to NumPts do
+ begin
+ poly[i * 2 - 1] := Points[i-1].X + 0.5;
+ poly[i * 2] := Points[i-1].Y + 0.5;
+ end;
+ // Draw Polygon
+ LineWidth(1);
+ LineColor(LineColor);
+ FillColor($00, $00, $00); // clBlack for now
+ Polygon(@poly[1], NumPts);
end;
diff --git a/src/corelib/stdimages.inc b/src/corelib/stdimages.inc
index 076ae4a4..36255154 100644
--- a/src/corelib/stdimages.inc
+++ b/src/corelib/stdimages.inc
@@ -3017,175 +3017,209 @@ Const
0);
Const
- stdimg_print : Array[0..245] of byte = (
- 66, 77,246, 0, 0, 0, 0, 0, 0, 0,118, 0, 0, 0, 40, 0, 0,
- 0, 16, 0, 0, 0, 16, 0, 0, 0, 1, 0, 4, 0, 0, 0, 0, 0,
- 128, 0, 0, 0, 18, 11, 0, 0, 18, 11, 0, 0, 16, 0, 0, 0, 16,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 0, 0,128, 0, 0, 0,128,
- 128, 0,128, 0, 0, 0,128, 0,128, 0,128,128, 0, 0,128,128,128,
- 0,192,192,192, 0, 0, 0,255, 0,192,192,192, 0, 0,255,255, 0,
- 255, 0, 0, 0,192,192,192, 0,255,255, 0, 0,255,255,255, 0,218,
- 218,218,218,218,218,218,218,173, 0, 0, 0, 0, 0, 13,173,208,136,
- 136,136,136,128,128,218, 0, 0, 0, 0, 0, 0, 8, 13, 8,136,136,
- 139,187,136, 0, 10, 8,136,136,135,119,136, 8, 13, 0, 0, 0, 0,
- 0, 0, 8,128, 8,136,136,136,136,128,128,128,208, 0, 0, 0, 0,
- 8, 8, 0,173, 15,255,255,255,240,128,128,218,208,240, 0, 0,240,
- 0, 10,173,160,255,255,255,255, 13,173,218,218, 15, 0, 0, 15, 10,
- 218,173,173, 15,255,255,255,240,173,218,218,208, 0, 0, 0, 0,218,
- 173,173,173,173,173,173,173,173);
+ stdimg_print: array[0..821] of byte = (
+ 66, 77, 54, 3, 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 40, 0, 0,
+ 0, 16, 0, 0, 0, 16, 0, 0, 0, 1, 0, 24, 0, 0, 0, 0, 0,
+ 0, 3, 0, 0, 18, 11, 0, 0, 18, 11, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,
+ 255, 0,255,255, 0,255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0,255, 0,255,255, 0,255,255, 0,255,255, 0,255,
+ 0, 0, 0,192,192,192,192,192,192,192,192,192,192,192,192,192,192,
+ 192,192,192,192,192,192,192,192,192,192,192,192,192, 0, 0, 0,192,
+ 192,192, 0, 0, 0,255, 0,255,255, 0,255, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,192,
+ 192,192, 0, 0, 0,255, 0,255, 0, 0, 0,192,192,192,192,192,192,
+ 192,192,192,192,192,192,192,192,192,192,192,192, 0,255,255, 0,255,
+ 255, 0,255,255,192,192,192,192,192,192, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0,255, 0,255, 0, 0, 0,192,192,192,192,192,192,192,192,192,
+ 192,192,192,192,192,192,192,192,192,128,128,128,128,128,128,128,128,
+ 128,192,192,192,192,192,192, 0, 0, 0,192,192,192, 0, 0, 0,255,
+ 0,255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0,192,192,192,192,192,192, 0, 0, 0, 0,
+ 0, 0,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,
+ 192,192,192,192,192,192,192,192,192,192,192,192,192,192,192, 0, 0,
+ 0,192,192,192, 0, 0, 0,192,192,192, 0, 0, 0,255, 0,255, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,192,192,192, 0, 0,
+ 0,192,192,192, 0, 0, 0, 0, 0, 0,255, 0,255,255, 0,255, 0,
+ 0, 0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,255, 0, 0, 0,192,192,192, 0, 0,
+ 0,192,192,192, 0, 0, 0,255, 0,255,255, 0,255,255, 0,255, 0,
+ 0, 0,255,255,255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0,255,255,255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0,255, 0,255,255, 0,255,255, 0,255,255, 0,255, 0, 0, 0,255,
+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255, 0, 0, 0,255, 0,255,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255, 0, 0, 0,255,
+ 255,255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 255,255,255, 0, 0, 0,255, 0,255,255, 0,255,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255, 0, 0, 0,255,255,255,255,
+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+ 255,255,255, 0, 0, 0,255, 0,255,255, 0,255,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,
+ 255, 0,255,255, 0,255);
const
- stdimg_Adobe_pdf : Array[0..1253] of byte = (
+ stdimg_adobe_pdf: array[0..1253] of byte = (
66, 77,230, 4, 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 40, 0, 0,
0, 20, 0, 0, 0, 20, 0, 0, 0, 1, 0, 24, 0, 0, 0, 0, 0,
176, 4, 0, 0, 19, 11, 0, 0, 19, 11, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0,255,255,255,255,255,255,255,255,255,255,255,255,226,226,
+ 0, 0, 0,255, 0,255,255, 0,255,255, 0,255,255, 0,255,226,226,
226,148,148,148,152,152,152,152,152,152,152,152,152,152,152,152,152,
152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,
- 152,152,152,146,146,146,208,208,208,253,253,253,255,255,255,255,255,
- 255,255,255,255,255,255,255,204,204,204,245,245,245,247,247,244,246,
+ 152,152,152,146,146,146,208,208,208,255, 0,255,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255,204,204,204,245,245,245,247,247,244,246,
246,244,244,244,244,245,245,245,210,210,209,212,212,212,200,201,200,
208,208,208,210,210,209,202,202,202,209,210,209,221,222,221,210,210,
- 210,253,253,253,255,255,255,255,255,255,255,255,255,255,255,255,212,
+ 210,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,212,
212,212,254,254,255,205,205,255,226,226,255,255,255,255,255,255,255,
141,142,139,136,138,135,127,128,125,136,138,135,137,139,136,130,131,
- 128,130,131,129,145,146,143,194,194,194,253,253,253,255,255,255,255,
- 255,255,255,255,255,255,255,255,211,211,211,247,247,255,135,135,254,
+ 128,130,131,129,145,146,143,194,194,194,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,211,211,211,247,247,255,135,135,254,
144,144,254,229,229,254,255,255,255,173,174,172,151,153,151,157,159,
157,175,176,174,193,194,193,131,133,130,190,190,189,188,188,187,200,
- 201,200,253,253,253,255,255,255,255,255,255,255,255,255,255,255,255,
+ 201,200,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,
211,211,211,253,253,254,221,221,253,138,138,253,155,155,253,249,249,
253,238,238,238,225,225,224,226,227,226,237,237,237,252,252,252,207,
- 207,206,255,255,253,253,253,252,222,222,221,253,253,253,255,255,255,
- 255,255,255,255,255,255,255,255,255,210,210,210,253,253,253,254,254,
+ 207,206,255,255,253,253,253,252,222,222,221,255, 0,255,255, 0,255,
+ 255, 0,255,255, 0,255,255, 0,255,210,210,210,253,253,253,254,254,
252,254,254,251,133,133,252,197,197,252,249,249,253,247,247,253,249,
249,253,250,250,253,244,244,252,231,231,254,197,196,251,217,214,249,
- 213,212,220,253,253,253,255,255,255,255,255,255,255,255,255,255,255,
+ 213,212,220,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,
255,209,209,209,251,251,251,250,250,250,252,252,250,248,248,250, 96,
96,252,188,188,251,175,175,251,166,166,251,164,164,252, 99, 99,252,
- 122,122,252,180,180,251,228,228,252,224,224,220,253,253,253,255,255,
- 255,255,255,255,255,255,255,255,255,255,209,209,209,250,250,250,249,
+ 122,122,252,180,180,251,228,228,252,224,224,220,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255,209,209,209,250,250,250,249,
249,249,249,249,249,255,255,249,172,172,250,181,181,250,243,243,249,
131,131,251,162,162,250,192,192,250,195,195,250,201,201,250,243,243,
- 250,221,221,220,253,253,253,255,255,255,255,255,255,255,255,255,255,
- 255,255,208,208,208,248,248,248,247,247,247,247,247,247,247,247,247,
+ 250,221,221,220,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,208,208,208,248,248,248,247,247,247,247,247,247,247,247,247,
249,249,247,102,102,251,161,161,249,185,185,248,252,252,247,251,251,
- 247,251,251,247,250,250,247,249,249,249,219,219,219,253,253,253,255,
- 255,255,255,255,255,255,255,255,255,255,255,207,207,207,246,246,246,
+ 247,251,251,247,250,250,247,249,249,249,219,219,219,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,255, 0,255,207,207,207,246,246,246,
245,245,245,245,245,245,245,245,245,247,247,245,184,184,247, 87, 87,
251,254,254,244,245,245,245,245,245,245,245,245,245,245,245,245,244,
- 244,244,214,214,214,253,253,253,255,255,255,255,255,255,255,255,255,
- 255,255,255,206,206,206,245,245,245,244,244,244,244,244,244,244,244,
+ 244,244,214,214,214,255, 0,255,255, 0,255,255, 0,255,255, 0,255,
+ 255, 0,255,206,206,206,245,245,245,244,244,244,244,244,244,244,244,
244,247,247,244,176,176,246,125,125,248,253,253,244,244,244,244,244,
- 244,244,243,243,243,240,240,240,238,238,238,209,209,209,252,252,252,
- 255,255,255,255,255,255,255,255,255,255,255,255,205,205,205,243,243,
+ 244,244,243,243,243,240,240,240,238,238,238,209,209,209,255, 0,255,
+ 255, 0,255,255, 0,255,255, 0,255,255, 0,255,205,205,205,243,243,
243,242,242,242,242,242,242,242,242,242,247,247,242,118,118,248,191,
191,244,246,246,242,242,242,242,240,240,240,237,237,237,233,233,233,
- 231,231,231,204,204,204,252,252,252,255,255,255,255,255,255,255,255,
- 255,255,255,255,216,216,210,249,249,245,248,248,245,248,248,245,248,
+ 231,231,231,204,204,204,255, 0,255,255, 0,255,255, 0,255,255, 0,
+ 255,255, 0,255,216,216,210,249,249,245,248,248,245,248,248,245,248,
248,245,254,254,245, 96, 96,254,238,238,245,250,250,244,242,242,241,
- 234,234,234,230,230,230,227,227,227,223,223,223,196,196,196,252,252,
- 252,202,202,222,114,114,167,122,122,170,122,122,170, 78, 78,130,145,
+ 234,234,234,230,230,230,227,227,227,223,223,223,196,196,196,255, 0,
+ 255,202,202,222,114,114,167,122,122,170,122,122,170, 78, 78,130,145,
145,177,138,138,173,139,139,172,140,140,171,146,146,172, 68, 68,176,
111,111,174,142,142,169,183,183,199,226,226,227,223,223,223,216,216,
- 216,206,206,206,190,190,190,252,252,252,127,127,195, 0, 0,156, 0,
+ 216,206,206,206,190,190,190,255, 0,255,127,127,195, 0, 0,156, 0,
0,164, 11, 11,168, 44, 44,178, 6, 6,167, 69, 69,184, 53, 53,177,
50, 50,174, 13, 13,158, 3, 3,151, 3, 3,146, 0, 0,132,109,109,
- 162,204,204,205,181,181,181,166,166,166,162,162,162,224,224,224,254,
- 254,254,127,127,209, 0, 0,199, 4, 4,206, 36, 36,212,152,152,234,
+ 162,204,204,205,181,181,181,166,166,166,162,162,162,224,224,224,255,
+ 0,255,127,127,209, 0, 0,199, 4, 4,206, 36, 36,212,152,152,234,
28, 28,209,134,134,230,129,129,229,184,184,238, 41, 41,198, 0, 0,
183, 0, 0,175, 0, 0,159,100,100,165,180,180,181,185,185,185,189,
- 189,189,219,219,219,254,254,254,255,255,255,138,138,225, 28, 28,227,
+ 189,189,219,219,219,255, 0,255,255, 0,255,138,138,225, 28, 28,227,
37, 37,232, 60, 60,234,187,187,247,196,196,248,129,129,238,129,129,
236,175,175,242,168,168,241, 5, 5,204, 0, 0,195, 0, 0,177, 92,
- 92,166,185,185,187,244,244,244,224,224,224,252,252,252,255,255,255,
- 254,254,254,143,143,237, 42, 42,240, 52, 52,244, 59, 59,242,118,118,
+ 92,166,185,185,187,244,244,244,224,224,224,255, 0,255,255, 0,255,
+ 255, 0,255,143,143,237, 42, 42,240, 52, 52,244, 59, 59,242,118,118,
244,101,101,240, 91, 91,235, 86, 86,230, 81, 81,226, 80, 80,221, 2,
2,202, 0, 0,192, 0, 0,177, 80, 80,162,187,187,190,229,229,229,
- 251,251,251,255,255,255,254,254,254,255,255,255,221,221,249,184,184,
+ 255, 0,255,255, 0,255,255, 0,255,255, 0,255,221,221,249,184,184,
248,187,187,250,188,188,250,121,121,213,158,158,224,155,155,220,153,
153,218,147,147,213,142,142,207,141,141,201,135,135,195,126,126,184,
- 148,148,176,227,227,228,253,253,253,255,255,255,254,254,254,255,255,
- 255,255,255,255,254,254,254,254,254,254,254,254,254,254,254,255,248,
- 248,249,243,243,244,243,243,244,243,243,243,242,242,243,241,241,242,
- 239,239,239,237,237,238,235,235,236,245,245,245,254,254,254,255,255,
- 255,254,254,254,255,255,255,255,255,255,255,255,255);
+ 148,148,176,227,227,228,255, 0,255,255, 0,255,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,
+ 255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255);
Const
- stdimg_preview : Array[0..1253] of byte = (
+ stdimg_preview: array[0..1253] of byte = (
66, 77,230, 4, 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 40, 0, 0,
0, 20, 0, 0, 0, 20, 0, 0, 0, 1, 0, 24, 0, 0, 0, 0, 0,
176, 4, 0, 0, 19, 11, 0, 0, 19, 11, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0,255,255,255,255,255,255,255,255,255,160,160,160,160,160,
+ 0, 0, 0,255, 0,255,255, 0,255,255, 0,255,160,160,160,160,160,
160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,
160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,
- 160,160,160,160,160,160,160,160,160,255,255,255,255,255,255,255,255,
+ 160,160,160,160,160,160,160,160,160,255, 0,255,255, 0,255,255, 0,
255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,100,100,100,160,160,
- 160,255,255,255,255,255,255, 0, 0, 0, 0, 0, 0,100,100,100,100,
+ 160,255, 0,255,255, 0,255, 0, 0, 0, 0, 0, 0,100,100,100,100,
100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
100,100,100, 0, 0, 0,150,150,150,200,200,200,200,200,200,200,200,
- 200,200,200,200,100,100,100,160,160,160,255,255,255,255,255,255, 0,
+ 200,200,200,200,100,100,100,160,160,160,255, 0,255,255, 0,255, 0,
0, 0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,200,200,200,100,100,
100,150,150,150,200,200,200,200,200,200,200,200,200,100,100,100,160,
- 160,160,255,255,255,255,255,255, 0, 0, 0,255,255,255,255,255,255,
+ 160,160,255, 0,255,255, 0,255, 0, 0, 0,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,200,200,200,255,255,255,100,100,100,150,150,150,200,
- 200,200,200,200,200,100,100,100,160,160,160,255,255,255,255,255,255,
+ 200,200,200,200,200,100,100,100,160,160,160,255, 0,255,255, 0,255,
0, 0, 0,255,255,255,255,255,255,220,220,220,220,220,220,220,220,
220,220,220,220,220,220,220,220,220,220,220,220,220,200,200,200,255,
255,255,255,255,255,100,100,100,150,150,150,200,200,200,100,100,100,
- 160,160,160,255,255,255,255,255,255, 0, 0, 0,255,255,255,255,255,
+ 160,160,160,255, 0,255,255, 0,255, 0, 0, 0,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,200,200,200,255,255,255,255,255,255,255,255,255,
- 100,100,100,150,150,150,100,100,100,160,160,160,255,255,255,255,255,
+ 100,100,100,150,150,150,100,100,100,160,160,160,255, 0,255,255, 0,
255, 0, 0, 0,255,255,255,255,255,255,200,200,200,200,200,200,200,
200,200,200,200,200,200,200,200,200,200,200,200,200,200,100,100,100,
100,100,100,100,100,100,100,100,100,100,100,100, 0, 0, 0,100,100,
- 100,160,160,160,255,255,255,255,255,255, 0, 0, 0,255,255,255,255,
+ 100,160,160,160,255, 0,255,255, 0,255, 0, 0, 0,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,200,200,200,100,100,100,160,160,160,255,255,255,255,
- 255,255, 0, 0, 0,255,255,255,255,255,255,160,160,160,160,160,160,
+ 255,255,255,255,200,200,200,100,100,100,160,160,160,255, 0,255,255,
+ 0,255, 0, 0, 0,255,255,255,255,255,255,160,160,160,160,160,160,
160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,
160,160,160,160,160,160,160,160,160,160,255,255,255,200,200,200,100,
- 100,100,160,160,160,255,255,255,255,255,255, 0, 0, 0,255,255,255,
+ 100,100,160,160,160,255, 0,255,255, 0,255, 0, 0, 0,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,200,200,200,100,100,100,160,160,160,255,255,255,
- 255,255,255, 0, 0, 0,255,255,255,255,255,255,160,160,160,160,160,
+ 255,255,255,255,255,200,200,200,100,100,100,160,160,160,255, 0,255,
+ 255, 0,255, 0, 0, 0,255,255,255,255,255,255,160,160,160,160,160,
160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,
160,160,160,160,160,160,160,160,160,160,160,255,255,255,200,200,200,
- 100,100,100,160,160,160,255,255,255,255,255,255, 0, 0, 0,255,255,
+ 100,100,100,160,160,160,255, 0,255,255, 0,255, 0, 0, 0,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,200,200,200,100,100,100,160,160,160,255,255,
- 255,255,255,255, 0, 0, 0,255,255,255,255,255,255,160,160,160,160,
+ 255,255,255,255,255,255,200,200,200,100,100,100,160,160,160,255, 0,
+ 255,255, 0,255, 0, 0, 0,255,255,255,255,255,255,160,160,160,160,
160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,
160,160,160,160,160,160,160,160,160,160,160,160,255,255,255,200,200,
- 200,100,100,100,160,160,160,255,255,255,255,255,255, 0, 0, 0,255,
+ 200,100,100,100,160,160,160,255, 0,255,255, 0,255, 0, 0, 0,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,200,200,200,100,100,100,160,160,160,255,
- 255,255,255,255,255, 0, 0, 0,255,255,255,255,255,255,160,160,160,
+ 0,255,255, 0,255, 0, 0, 0,255,255,255,255,255,255,160,160,160,
160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,
160,160,160,160,160,160,160,160,160,160,160,160,160,255,255,255,200,
- 200,200,100,100,100,160,160,160,255,255,255,255,255,255, 0, 0, 0,
+ 200,200,100,100,100,160,160,160,255, 0,255,255, 0,255, 0, 0, 0,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,200,200,200,100,100,100,160,160,160,
- 255,255,255,255,255,255, 0, 0, 0,255,255,255,255,255,255,160,160,
+ 255, 0,255,255, 0,255, 0, 0, 0,255,255,255,255,255,255,160,160,
160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,
160,160,160,160,160,160,160,160,160,160,160,160,160,160,255,255,255,
- 200,200,200,100,100,100,160,160,160,255,255,255,255,255,255, 0, 0,
+ 200,200,200,100,100,100,160,160,160,255, 0,255,255, 0,255, 0, 0,
0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,200,200,200,100,100,100,255,255,
- 255,255,255,255,255,255,255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 255,255,255,255,255,255,255,255,255,200,200,200,100,100,100,255, 0,
+ 255,255, 0,255,255, 0,255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0,255,255,255,255,255,255,255,255,255);
+ 0, 0, 0, 0,255, 0,255,255, 0,255,255, 0,255);
diff --git a/src/corelib/x11/fpg_utils_impl.inc b/src/corelib/x11/fpg_utils_impl.inc
index 753b0ea1..bc5917e9 100644
--- a/src/corelib/x11/fpg_utils_impl.inc
+++ b/src/corelib/x11/fpg_utils_impl.inc
@@ -34,7 +34,11 @@ begin
else if fpsystem('which opera') = 0 then
Helper := 'opera'
else if fpsystem('which mozilla') = 0 then
- Helper := 'mozilla';
+ Helper := 'mozilla'
+ else if fpsystem('which chrome') = 0 then
+ Helper := 'chrome'
+ else if fpsystem('which chromium') = 0 then
+ Helper := 'chromium';
if Helper <> '' then
fpSystem(Helper + ' ' + aURL + '&');
diff --git a/src/corelib/x11/fpgui_toolkit.lpk b/src/corelib/x11/fpgui_toolkit.lpk
index 9be3ad6e..ff08daeb 100644
--- a/src/corelib/x11/fpgui_toolkit.lpk
+++ b/src/corelib/x11/fpgui_toolkit.lpk
@@ -28,7 +28,7 @@
</CompilerOptions>
<Description Value="fpGUI Toolkit"/>
<License Value="LGPL 2 with static linking exception."/>
- <Version Minor="8"/>
+ <Version Major="1"/>
<Files Count="100">
<Item1>
<Filename Value="../stdimages.inc"/>
diff --git a/src/gui/fpg_button.pas b/src/gui/fpg_button.pas
index 28db95d6..3bc026de 100644
--- a/src/gui/fpg_button.pas
+++ b/src/gui/fpg_button.pas
@@ -550,6 +550,12 @@ begin
Include(lBtnFlags, btfHover)
else if FFlat then
Include(lBtnFlags, btfFlat);
+
+ if (not FFlat) and (not FDown) and fpgStyle.HasButtonHoverEffect then
+ begin
+ if FState = 1 then
+ Include(lBtnFlags, btfHover);
+ end;
end
else
begin
@@ -558,7 +564,7 @@ begin
Include(lBtnFlags, btfHover);
end;
- if not FFlat and FDefault then
+ if (not FFlat) and FDefault then
Include(lBtnFlags, btfIsDefault);
if FBackgroundColor <> clButtonFace then
@@ -747,7 +753,7 @@ begin
FDown := False;
Repaint;
end
- else if FFlat then
+ else if FFlat or fpgStyle.HasButtonHoverEffect then
begin
if Enabled then
Repaint;
@@ -766,7 +772,7 @@ begin
FDown := True;
Repaint;
end
- else if FFlat then
+ else if FFlat or fpgStyle.HasButtonHoverEffect then
begin
if Enabled then
Repaint;
diff --git a/src/gui/fpg_menu.pas b/src/gui/fpg_menu.pas
index 8da9302f..91db5992 100644
--- a/src/gui/fpg_menu.pas
+++ b/src/gui/fpg_menu.pas
@@ -135,6 +135,7 @@ type
destructor Destroy; override;
procedure Close; override;
function AddMenuItem(const AMenuName: TfpgString; const hotkeydef: string; OnClickProc: TNotifyEvent): TfpgMenuItem;
+ procedure AddSeparator;
function MenuItemByName(const AMenuName: TfpgString): TfpgMenuItem;
function MenuItem(const AMenuPos: integer): TfpgMenuItem; // added to allow for localization
property BeforeShow: TNotifyEvent read FBeforeShow write FBeforeShow;
@@ -1406,6 +1407,11 @@ begin
end;
end;
+procedure TfpgPopupMenu.AddSeparator;
+begin
+ AddMenuitem('-', '', nil);
+end;
+
function TfpgPopupMenu.MenuItemByName(const AMenuName: TfpgString): TfpgMenuItem;
var
i: integer;
diff --git a/src/gui/fpg_tree.pas b/src/gui/fpg_tree.pas
index 4a4316ac..8935ec36 100644
--- a/src/gui/fpg_tree.pas
+++ b/src/gui/fpg_tree.pas
@@ -1868,74 +1868,77 @@ var
OldSelection: TfpgTreeNode;
begin
OldSelection := Selection;
- case KeyCode of
- keyRight:
- begin
- Consumed := True;
- Selection.Expand;
- DoExpand(Selection);
- ResetScrollbar;
- RePaint;
- end;
+ if ShiftState = [] then
+ begin
+ case KeyCode of
+ keyRight:
+ begin
+ Consumed := True;
+ Selection.Expand;
+ DoExpand(Selection);
+ ResetScrollbar;
+ RePaint;
+ end;
- keyLeft:
- begin
- Consumed := True;
- Selection.Collapsed := true;
- ResetScrollbar;
- RePaint;
- end;
+ keyLeft:
+ begin
+ Consumed := True;
+ Selection.Collapsed := true;
+ ResetScrollbar;
+ RePaint;
+ end;
- keyUp:
- begin
- if Selection = nil then
- Selection := RootNode.FirstSubNode
- else
- if Selection <> RootNode then
+ keyUp:
+ begin
+ if Selection = nil then
+ Selection := RootNode.FirstSubNode
+ else
+ if Selection <> RootNode then
+ begin
+ if NodeIsVisible(selection) then
+ begin
+ h := PrevVisualNode(Selection);
+ if (h <> RootNode) and (h <> nil) then
+ Selection := h;
+ end
+ else
+ begin
+ Selection := RootNode.FirstSubNode;
+ end;
+ end;
+ Consumed := True;
+ end;
+
+ keyDown:
+ begin
+ Consumed := True;
+ if Selection = nil then
+ Selection := RootNode.FirstSubNode
+ else
begin
if NodeIsVisible(selection) then
begin
- h := PrevVisualNode(Selection);
- if (h <> RootNode) and (h <> nil) then
+ h := NextVisualNode(Selection);
+ if (h <> nil) then
Selection := h;
end
else
- begin
Selection := RootNode.FirstSubNode;
- end;
end;
- Consumed := True;
- end;
+ end;
- keyDown:
- begin
- Consumed := True;
- if Selection = nil then
- Selection := RootNode.FirstSubNode
- else
+ keyPageUp:
begin
- if NodeIsVisible(selection) then
- begin
- h := NextVisualNode(Selection);
- if (h <> nil) then
- Selection := h;
- end
- else
- Selection := RootNode.FirstSubNode;
+ FVScrollbar.PageUp;
end;
- end;
-
- keyPageUp:
- begin
- FVScrollbar.PageUp;
- end;
- keyPageDown:
- begin
- FVScrollbar.PageDown;
- end;
- else
- Consumed := False;
+ keyPageDown:
+ begin
+ FVScrollbar.PageDown;
+ end;
+ else
+ Consumed := False;
+ end;
end;
if Selection <> OldSelection then
diff --git a/src/reportengine/u_reportimages.pas b/src/reportengine/u_reportimages.pas
index 7a7a3ba2..250869a3 100644
--- a/src/reportengine/u_reportimages.pas
+++ b/src/reportengine/u_reportimages.pas
@@ -34,134 +34,358 @@ function DeleteReportImages: Boolean;
implementation
const
- repimg_Fin : Array[0..245] of byte = (
- 66, 77,246, 0, 0, 0, 0, 0, 0, 0,118, 0, 0, 0, 40, 0, 0,
- 0, 16, 0, 0, 0, 16, 0, 0, 0, 1, 0, 4, 0, 0, 0, 0, 0,
- 128, 0, 0, 0, 18, 11, 0, 0, 18, 11, 0, 0, 0, 0, 0, 0, 16,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 0, 0,128, 0, 0, 0,128,
- 128, 0,128, 0, 0, 0,128, 0,128, 0,128,128, 0, 0,192,192,192,
- 0,128,128,128, 0, 0, 0,255, 0, 0,255, 0, 0, 0,255,255, 0,
- 255, 0, 0, 0,255, 0,255, 0,255,255, 0, 0,255,255,255, 0,119,
- 119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
- 119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,113,
- 119,119,116, 71,119,119,119,113, 23,119,116, 71,119,119,119,113, 17,
- 119,116, 71,119,119,119,113, 17, 23,116, 71,119,119,119,113, 17, 17,
- 116, 71,119,119,119,113, 17, 23,116, 71,119,119,119,113, 17,119,116,
- 71,119,119,119,113, 23,119,116, 71,119,119,119,113,119,119,116, 71,
- 119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
- 119,119,119,119,119,119,119,119);
+ repimg_Last: array[0..821] of byte = (
+ 66, 77, 54, 3, 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 40, 0, 0,
+ 0, 16, 0, 0, 0, 16, 0, 0, 0, 1, 0, 24, 0, 0, 0, 0, 0,
+ 0, 3, 0, 0, 18, 11, 0, 0, 18, 11, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,
+ 255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,
+ 255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,
+ 255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,
+ 255, 0,255,255, 0,255, 0, 0,128,255, 0,255,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255,128, 0, 0,128, 0, 0,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,
+ 255, 0,255, 0, 0,128, 0, 0,128,255, 0,255,255, 0,255,255, 0,
+ 255,255, 0,255,128, 0, 0,128, 0, 0,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,
+ 0, 0,128, 0, 0,128, 0, 0,128,255, 0,255,255, 0,255,255, 0,
+ 255,128, 0, 0,128, 0, 0,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255, 0, 0,128,
+ 0, 0,128, 0, 0,128, 0, 0,128,255, 0,255,255, 0,255,128, 0,
+ 0,128, 0, 0,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,255, 0,255, 0, 0,128, 0, 0,128,
+ 0, 0,128, 0, 0,128, 0, 0,128,255, 0,255,128, 0, 0,128, 0,
+ 0,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255, 0, 0,128, 0, 0,128, 0, 0,128,
+ 0, 0,128,255, 0,255,255, 0,255,128, 0, 0,128, 0, 0,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255, 0, 0,128, 0, 0,128, 0, 0,128,255, 0,255,
+ 255, 0,255,255, 0,255,128, 0, 0,128, 0, 0,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255, 0, 0,128, 0, 0,128,255, 0,255,255, 0,255,255, 0,255,
+ 255, 0,255,128, 0, 0,128, 0, 0,255, 0,255,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255, 0,
+ 0,128,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,
+ 128, 0, 0,128, 0, 0,255, 0,255,255, 0,255,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,
+ 255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,
+ 255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,
+ 255, 0,255,255, 0,255);
const
- repimg_Imprimante : Array[0..357] of byte = (
- 66, 77,102, 1, 0, 0, 0, 0, 0, 0,118, 0, 0, 0, 40, 0, 0,
- 0, 20, 0, 0, 0, 20, 0, 0, 0, 1, 0, 4, 0, 0, 0, 0, 0,
- 240, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 0, 0,128, 0, 0, 0,128,
- 128, 0,128, 0, 0, 0,128, 0,128, 0,128,128, 0, 0,192,192,192,
- 0,128,128,128, 0, 0, 0,255, 0, 0,255, 0, 0, 0,255,255, 0,
- 255, 0, 0, 0,255, 0,255, 0,255,255, 0, 0,255,255,255, 0, 51,
- 51, 51, 51, 51, 51, 51, 51, 51, 51, 0, 0, 51, 51, 51, 51, 51, 51,
- 51, 51, 51, 51, 0, 0, 51, 0, 3, 51, 51, 51, 51, 48, 0, 51, 0,
- 0, 48, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 48,247,119,119,
- 119,119,119,119,119, 3, 0, 0, 48,247,119,119,119,119,119,119,119,
- 3, 0, 0, 48,247,119,119,119,119,119,153,119, 3, 0, 0, 48,255,
- 255,255,255,255,255,255,255, 3, 0, 0, 56, 0,136,136,136,136,136,
- 136, 0,131, 0, 0, 51, 48, 0, 0, 0, 0, 0, 0, 3, 51, 0, 0,
- 51, 48,136,136,136,136,136,136, 3, 51, 0, 0, 51, 48, 0, 0, 0,
- 0, 0, 0, 3, 51, 0, 0, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
- 0, 0, 51, 51, 51, 51, 51, 51, 56, 0, 8, 51, 0, 0, 51, 51, 51,
- 51, 51, 51, 48,239,224, 51, 0, 0, 51, 56, 0, 0, 0, 0, 14,240,
- 8, 51, 0, 0, 51, 48,224,239,239,239, 63,224, 51, 51, 0, 0, 51,
- 56, 0, 0, 0, 0, 14,240, 8, 51, 0, 0, 51, 51, 51, 51, 51, 51,
- 48,239,224, 51, 0, 0, 51, 51, 51, 51, 51, 51, 56, 0, 8, 51, 0,
- 0);
+ repimg_Printer: array[0..1253] of byte = (
+ 66, 77,230, 4, 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 40, 0, 0,
+ 0, 20, 0, 0, 0, 20, 0, 0, 0, 1, 0, 24, 0, 0, 0, 0, 0,
+ 176, 4, 0, 0, 19, 11, 0, 0, 19, 11, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,
+ 255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,
+ 255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,
+ 255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0,255, 0,255,255, 0,255,255, 0,255, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0,255, 0,255,255, 0,255, 0, 0, 0,255,255,255,192,192,192,
+ 192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,
+ 192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,
+ 192,192,192,192,192,192,192,192, 0, 0, 0,255, 0,255,255, 0,255,
+ 0, 0, 0,255,255,255,192,192,192,192,192,192,192,192,192,192,192,
+ 192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,
+ 192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,
+ 0, 0, 0,255, 0,255,255, 0,255, 0, 0, 0,255,255,255,192,192,
+ 192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,
+ 192,192,192,192,192,192,192,192,192,192,192,192,192,192, 0, 0,255,
+ 0, 0,255,192,192,192,192,192,192, 0, 0, 0,255, 0,255,255, 0,
+ 255, 0, 0, 0,255,255,255,255,255,255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+ 255, 0, 0, 0,255, 0,255,255, 0,255,128,128,128, 0, 0, 0, 0,
+ 0, 0,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,
+ 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,
+ 128,128,128,128, 0, 0, 0, 0, 0, 0,128,128,128,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,255,
+ 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,
+ 0, 0, 0,128,128,128,128,128,128,128,128,128,128,128,128,128,128,
+ 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,
+ 128,128,128,128,128, 0, 0, 0,255, 0,255,255, 0,255,255, 0,255,
+ 255, 0,255,255, 0,255,255, 0,255, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,
+ 255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,
+ 255, 0,255,255, 0,255,128,128,128, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0,128,128,128,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,
+ 255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255, 0, 0,
+ 0,255,255, 0,255,255,255,255,255, 0, 0, 0, 0,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,255, 0,255,128,128,128, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0,255,255, 0,255,255,255, 0, 0, 0, 0,
+ 0, 0,128,128,128,255, 0,255,255, 0,255,255, 0,255,255, 0,255,
+ 255, 0,255, 0, 0, 0,255,255, 0, 0, 0, 0,255,255, 0,255,255,
+ 255,255,255, 0,255,255,255,255,255, 0,255,255,255,255,255, 0,255,
+ 255,255,255,255, 0, 0, 0, 0,255, 0,255,255, 0,255,255, 0,255,
+ 255, 0,255,255, 0,255,255, 0,255,255, 0,255,128,128,128, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,255,255, 0,255,255,255, 0, 0, 0,
+ 0, 0, 0,128,128,128,255, 0,255,255, 0,255,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,
+ 0, 0, 0,255,255, 0,255,255,255,255,255, 0, 0, 0, 0,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,
+ 255, 0,255,255, 0,255,255, 0,255,128,128,128, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0,128,128,128,255, 0,255,255, 0,255);
const
- repimg_Precedent : Array[0..245] of byte = (
- 66, 77,246, 0, 0, 0, 0, 0, 0, 0,118, 0, 0, 0, 40, 0, 0,
- 0, 16, 0, 0, 0, 16, 0, 0, 0, 1, 0, 4, 0, 0, 0, 0, 0,
- 128, 0, 0, 0, 18, 11, 0, 0, 18, 11, 0, 0, 16, 0, 0, 0, 16,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 0, 0,128, 0, 0, 0,128,
- 128, 0,128, 0, 0, 0,128, 0,128, 0,128,128, 0, 0,128,128,128,
- 0,192,192,192, 0, 0, 0,255, 0,192,192,192, 0, 0,255,255, 0,
- 255, 0, 0, 0,192,192,192, 0,255,255, 0, 0,255,255,255, 0,218,
- 218,218,218,218,218,218,218,173,173,173,173,173,173,173,173,218,218,
- 218,218,218,218,218,218,173,173,173,173,173,173,173,173,218,218,218,
- 218,209,218,218,218,173,173,173,173, 17,173,173,173,218,218,218,209,
- 17,218,218,218,173,173,173, 17, 17,173,173,173,218,218,209, 17, 17,
- 218,218,218,173,173,173, 17, 17,173,173,173,218,218,218,209, 17,218,
- 218,218,173,173,173,173, 17,173,173,173,218,218,218,218,209,218,218,
- 218,173,173,173,173,173,173,173,173,218,218,218,218,218,218,218,218,
- 173,173,173,173,173,173,173,173);
+ repimg_Previous: array[0..821] of byte = (
+ 66, 77, 54, 3, 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 40, 0, 0,
+ 0, 16, 0, 0, 0, 16, 0, 0, 0, 1, 0, 24, 0, 0, 0, 0, 0,
+ 0, 3, 0, 0, 18, 11, 0, 0, 18, 11, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,
+ 255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,
+ 255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,
+ 255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,
+ 255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,
+ 255, 0, 0,128,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,
+ 255, 0,255,255, 0,255,255, 0,255,255, 0,255, 0, 0,128, 0, 0,
+ 128,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,
+ 255, 0,255,255, 0,255, 0, 0,128, 0, 0,128, 0, 0,128,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,
+ 0, 0,128, 0, 0,128, 0, 0,128, 0, 0,128,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,255, 0,255, 0, 0,128, 0, 0,128,
+ 0, 0,128, 0, 0,128, 0, 0,128,255, 0,255,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,255, 0,255, 0, 0,128, 0, 0,128,
+ 0, 0,128, 0, 0,128,255, 0,255,255, 0,255,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,255, 0,255, 0, 0,128, 0, 0,128,
+ 0, 0,128,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,255, 0,255, 0, 0,128, 0, 0,128,
+ 255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,255, 0,255, 0, 0,128,255, 0,255,
+ 255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,
+ 255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,
+ 255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,
+ 255, 0,255,255, 0,255);
const
- repimg_Stop : Array[0..245] of byte = (
- 66, 77,246, 0, 0, 0, 0, 0, 0, 0,118, 0, 0, 0, 40, 0, 0,
- 0, 16, 0, 0, 0, 16, 0, 0, 0, 1, 0, 4, 0, 0, 0, 0, 0,
- 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 0, 0,128, 0, 0, 0,128,
- 128, 0,128, 0, 0, 0,128, 0,128, 0,128,128, 0, 0,192,192,192,
- 0,128,128,128, 0, 0, 0,255, 0, 0,255, 0, 0, 0,255,255, 0,
- 255, 0, 0, 0,255, 0,255, 0,255,255, 0, 0,255,255,255, 0, 51,
- 35,153,153,153,153, 34, 35, 51, 41,153,153,153,153,147, 51, 50,153,
- 153,153,153,153,153, 51, 41,153,153,153,153,153,153,147,153,255,153,
- 249,159,153,249,153,159,153,249,249,249,249,249,153,153,153,249,249,
- 249,249,249,153,153,159,153,249,249,249,255,153,153,249,153,249,249,
- 249,249,249,159,153,153,249,249,249,249,249,159,153,249,249,249,249,
- 249,249,153,255,159,255,159,153,255,153, 57,153,153,153,153,153,153,
- 147, 51,153,153,153,153,153,153, 51, 51, 57,153,153,153,153,147, 51,
- 51, 51,153,153,153,153, 51, 51);
+ repimg_Stop: array[0..821] of byte = (
+ 66, 77, 54, 3, 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 40, 0, 0,
+ 0, 16, 0, 0, 0, 16, 0, 0, 0, 1, 0, 24, 0, 0, 0, 0, 0,
+ 0, 3, 0, 0, 19, 11, 0, 0, 19, 11, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0,255, 0,255,255, 0,255,255, 0,255,255, 0,255, 0, 0,
+ 255, 0, 0,255, 0, 0,255, 0, 0,255, 0, 0,255, 0, 0,255, 0,
+ 0,255, 0, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,
+ 255, 0,255,255, 0,255,255, 0,255, 0, 0,255, 0, 0,255, 0, 0,
+ 255, 0, 0,255, 0, 0,255, 0, 0,255, 0, 0,255, 0, 0,255, 0,
+ 0,255, 0, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,
+ 255, 0,255, 0, 0,255, 0, 0,255, 0, 0,255, 0, 0,255, 0, 0,
+ 255, 0, 0,255, 0, 0,255, 0, 0,255, 0, 0,255, 0, 0,255, 0,
+ 0,255, 0, 0,255,255, 0,255,255, 0,255,255, 0,255, 0, 0,255,
+ 0, 0,255, 0, 0,255, 0, 0,255, 0, 0,255, 0, 0,255, 0, 0,
+ 255, 0, 0,255, 0, 0,255, 0, 0,255, 0, 0,255, 0, 0,255, 0,
+ 0,255, 0, 0,255,255, 0,255, 0, 0,255, 0, 0,255,255,255,255,
+ 255,255,255, 0, 0,255, 0, 0,255,255,255,255, 0, 0,255, 0, 0,
+ 255,255,255,255, 0, 0,255, 0, 0,255,255,255,255, 0, 0,255, 0,
+ 0,255, 0, 0,255, 0, 0,255,255,255,255, 0, 0,255, 0, 0,255,
+ 255,255,255, 0, 0,255,255,255,255, 0, 0,255,255,255,255, 0, 0,
+ 255,255,255,255, 0, 0,255,255,255,255, 0, 0,255, 0, 0,255, 0,
+ 0,255, 0, 0,255, 0, 0,255, 0, 0,255, 0, 0,255,255,255,255,
+ 0, 0,255,255,255,255, 0, 0,255,255,255,255, 0, 0,255,255,255,
+ 255, 0, 0,255,255,255,255, 0, 0,255, 0, 0,255, 0, 0,255, 0,
+ 0,255, 0, 0,255, 0, 0,255,255,255,255, 0, 0,255, 0, 0,255,
+ 255,255,255, 0, 0,255,255,255,255, 0, 0,255,255,255,255, 0, 0,
+ 255,255,255,255,255,255,255, 0, 0,255, 0, 0,255, 0, 0,255, 0,
+ 0,255,255,255,255, 0, 0,255, 0, 0,255, 0, 0,255,255,255,255,
+ 0, 0,255,255,255,255, 0, 0,255,255,255,255, 0, 0,255,255,255,
+ 255, 0, 0,255,255,255,255, 0, 0,255, 0, 0,255,255,255,255, 0,
+ 0,255, 0, 0,255, 0, 0,255, 0, 0,255,255,255,255, 0, 0,255,
+ 255,255,255, 0, 0,255,255,255,255, 0, 0,255,255,255,255, 0, 0,
+ 255,255,255,255, 0, 0,255, 0, 0,255,255,255,255, 0, 0,255, 0,
+ 0,255,255,255,255, 0, 0,255,255,255,255, 0, 0,255,255,255,255,
+ 0, 0,255,255,255,255, 0, 0,255,255,255,255, 0, 0,255,255,255,
+ 255, 0, 0,255, 0, 0,255, 0, 0,255,255,255,255,255,255,255, 0,
+ 0,255,255,255,255,255,255,255,255,255,255, 0, 0,255,255,255,255,
+ 0, 0,255, 0, 0,255,255,255,255,255,255,255, 0, 0,255, 0, 0,
+ 255,255, 0,255, 0, 0,255, 0, 0,255, 0, 0,255, 0, 0,255, 0,
+ 0,255, 0, 0,255, 0, 0,255, 0, 0,255, 0, 0,255, 0, 0,255,
+ 0, 0,255, 0, 0,255, 0, 0,255, 0, 0,255,255, 0,255,255, 0,
+ 255,255, 0,255, 0, 0,255, 0, 0,255, 0, 0,255, 0, 0,255, 0,
+ 0,255, 0, 0,255, 0, 0,255, 0, 0,255, 0, 0,255, 0, 0,255,
+ 0, 0,255, 0, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,
+ 255,255, 0,255, 0, 0,255, 0, 0,255, 0, 0,255, 0, 0,255, 0,
+ 0,255, 0, 0,255, 0, 0,255, 0, 0,255, 0, 0,255, 0, 0,255,
+ 255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,
+ 255,255, 0,255, 0, 0,255, 0, 0,255, 0, 0,255, 0, 0,255, 0,
+ 0,255, 0, 0,255, 0, 0,255, 0, 0,255,255, 0,255,255, 0,255,
+ 255, 0,255,255, 0,255);
const
- repimg_Suivant : Array[0..245] of byte = (
- 66, 77,246, 0, 0, 0, 0, 0, 0, 0,118, 0, 0, 0, 40, 0, 0,
- 0, 16, 0, 0, 0, 16, 0, 0, 0, 1, 0, 4, 0, 0, 0, 0, 0,
- 128, 0, 0, 0, 18, 11, 0, 0, 18, 11, 0, 0, 16, 0, 0, 0, 16,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 0, 0,128, 0, 0, 0,128,
- 128, 0,128, 0, 0, 0,128, 0,128, 0,128,128, 0, 0,128,128,128,
- 0,192,192,192, 0, 0, 0,255, 0,192,192,192, 0, 0,255,255, 0,
- 255, 0, 0, 0,192,192,192, 0,255,255, 0, 0,255,255,255, 0,218,
- 218,218,218,218,218,218,218,173,173,173,173,173,173,173,173,218,218,
- 218,218,218,218,218,218,173,173,173,173,173,173,173,173,218,218,218,
- 26,218,218,218,218,173,173,173, 17,173,173,173,173,218,218,218, 17,
- 26,218,218,218,173,173,173, 17, 17,173,173,173,218,218,218, 17, 17,
- 26,218,218,173,173,173, 17, 17,173,173,173,218,218,218, 17, 26,218,
- 218,218,173,173,173, 17,173,173,173,173,218,218,218, 26,218,218,218,
- 218,173,173,173,173,173,173,173,173,218,218,218,218,218,218,218,218,
- 173,173,173,173,173,173,173,173);
+ repimg_Next: array[0..821] of byte = (
+ 66, 77, 54, 3, 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 40, 0, 0,
+ 0, 16, 0, 0, 0, 16, 0, 0, 0, 1, 0, 24, 0, 0, 0, 0, 0,
+ 0, 3, 0, 0, 18, 11, 0, 0, 18, 11, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,
+ 255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,
+ 255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,
+ 255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,
+ 255, 0,255,255, 0,255,255, 0,255, 0, 0,128,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,
+ 255, 0,255,255, 0,255, 0, 0,128, 0, 0,128,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,
+ 255, 0,255, 0, 0,128, 0, 0,128, 0, 0,128,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,
+ 0, 0,128, 0, 0,128, 0, 0,128, 0, 0,128,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255, 0, 0,128,
+ 0, 0,128, 0, 0,128, 0, 0,128, 0, 0,128,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,255, 0,255, 0, 0,128, 0, 0,128,
+ 0, 0,128, 0, 0,128,255, 0,255,255, 0,255,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255, 0, 0,128, 0, 0,128, 0, 0,128,
+ 255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255, 0, 0,128, 0, 0,128,255, 0,255,255, 0,255,
+ 255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255, 0, 0,128,255, 0,255,255, 0,255,255, 0,255,255, 0,255,
+ 255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,
+ 255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,
+ 255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,
+ 255, 0,255,255, 0,255);
+
const
- repimg_Debut : Array[0..245] of byte = (
- 66, 77,246, 0, 0, 0, 0, 0, 0, 0,118, 0, 0, 0, 40, 0, 0,
- 0, 16, 0, 0, 0, 16, 0, 0, 0, 1, 0, 4, 0, 0, 0, 0, 0,
- 128, 0, 0, 0, 18, 11, 0, 0, 18, 11, 0, 0, 0, 0, 0, 0, 16,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 0, 0,128, 0, 0, 0,128,
- 128, 0,128, 0, 0, 0,128, 0,128, 0,128,128, 0, 0,192,192,192,
- 0,128,128,128, 0, 0, 0,255, 0, 0,255, 0, 0, 0,255,255, 0,
- 255, 0, 0, 0,255, 0,255, 0,255,255, 0, 0,255,255,255, 0,119,
- 119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
- 119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, 68,
- 119,119,113,119,119,119,119, 68,119,119, 17,119,119,119,119, 68,119,
- 113, 17,119,119,119,119, 68,119, 17, 17,119,119,119,119, 68,113, 17,
- 17,119,119,119,119, 68,119, 17, 17,119,119,119,119, 68,119,113, 17,
- 119,119,119,119, 68,119,119, 17,119,119,119,119, 68,119,119,113,119,
- 119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
- 119,119,119,119,119,119,119,119);
+ repimg_First: array[0..821] of byte = (
+ 66, 77, 54, 3, 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 40, 0, 0,
+ 0, 16, 0, 0, 0, 16, 0, 0, 0, 1, 0, 24, 0, 0, 0, 0, 0,
+ 0, 3, 0, 0, 18, 11, 0, 0, 18, 11, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,
+ 255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,
+ 255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,
+ 255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,
+ 255, 0,255,128, 0, 0,128, 0, 0,255, 0,255,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255, 0, 0,128,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,
+ 128, 0, 0,128, 0, 0,255, 0,255,255, 0,255,255, 0,255,255, 0,
+ 255, 0, 0,128, 0, 0,128,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,128, 0, 0,
+ 128, 0, 0,255, 0,255,255, 0,255,255, 0,255, 0, 0,128, 0, 0,
+ 128, 0, 0,128,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,255, 0,255,128, 0, 0,128, 0, 0,
+ 255, 0,255,255, 0,255, 0, 0,128, 0, 0,128, 0, 0,128, 0, 0,
+ 128,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,128, 0, 0,128, 0, 0,255, 0,255,
+ 0, 0,128, 0, 0,128, 0, 0,128, 0, 0,128, 0, 0,128,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,128, 0, 0,128, 0, 0,255, 0,255,255, 0,255,
+ 0, 0,128, 0, 0,128, 0, 0,128, 0, 0,128,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,128, 0, 0,128, 0, 0,255, 0,255,255, 0,255,255, 0,255,
+ 0, 0,128, 0, 0,128, 0, 0,128,255, 0,255,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,128,
+ 0, 0,128, 0, 0,255, 0,255,255, 0,255,255, 0,255,255, 0,255,
+ 0, 0,128, 0, 0,128,255, 0,255,255, 0,255,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,128, 0, 0,128,
+ 0, 0,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,
+ 0, 0,128,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,
+ 255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,
+ 255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,
+ 255, 0,255,255, 0,255);
+
procedure CreateReportImages;
begin
- fpgImages.AddMaskedBMP('repimg.Last',@repimg_Fin,sizeof(repimg_Fin),0,0);
+ fpgImages.AddMaskedBMP('repimg.Last',@repimg_Last,sizeof(repimg_Last),0,0);
- fpgImages.AddMaskedBMP('repimg.Printer',@repimg_Imprimante,sizeof(repimg_Imprimante),0,0);
+ fpgImages.AddMaskedBMP('repimg.Printer',@repimg_Printer,sizeof(repimg_Printer),0,0);
- fpgImages.AddMaskedBMP('repimg.Precedent',@repimg_Precedent,sizeof(repimg_Precedent),0,0);
+ fpgImages.AddMaskedBMP('repimg.Previous',@repimg_Previous,sizeof(repimg_Previous),0,0);
fpgImages.AddMaskedBMP('repimg.Stop',@repimg_Stop,sizeof(repimg_Stop),0,0);
- fpgImages.AddMaskedBMP('repimg.Next',@repimg_Suivant,sizeof(repimg_Suivant),0,0);
+ fpgImages.AddMaskedBMP('repimg.Next',@repimg_Next,sizeof(repimg_Next),0,0);
- fpgImages.AddMaskedBMP('repimg.First',@repimg_Debut,sizeof(repimg_Debut),0,0);
+ fpgImages.AddMaskedBMP('repimg.First',@repimg_First,sizeof(repimg_First),0,0);
end;
@@ -172,7 +396,7 @@ begin
fpgImages.DeleteImage('repimg.Printer',True);
- fpgImages.DeleteImage('repimg.Precedent',True);
+ fpgImages.DeleteImage('repimg.Previous',True);
fpgImages.DeleteImage('repimg.Stop',True);
diff --git a/src/reportengine/u_visu.pas b/src/reportengine/u_visu.pas
index bd82c704..b9d2907d 100644
--- a/src/reportengine/u_visu.pas
+++ b/src/reportengine/u_visu.pas
@@ -515,7 +515,7 @@ begin
Bv_Sections := CreateBevel(Bv_Command, 540, 5, 500, 40, bsBox, bsLowered);
Bt_FirstPage := CreateButton(Bv_Pages, 54, 6, 26, '', @Bt_FirstPageClick, 'repimg.First');
- Bt_PrecPage := CreateButton(Bv_Pages, 80, 6, 26, '', @Bt_PrecPageClick, 'repimg.Precedent');
+ Bt_PrecPage := CreateButton(Bv_Pages, 80, 6, 26, '', @Bt_PrecPageClick, 'repimg.Previous');
E_NumPage := CreateEditInteger(Bv_Pages, 110, 6, 60, 0);
E_NumPage.OnKeyPress := @E_NumPageKeypress;
Bt_NextPage := CreateButton(Bv_Pages, 174, 6, 26, '', @Bt_NextPageClick, 'repimg.Next');
@@ -524,7 +524,7 @@ begin
L_FromPage := CreateLabel(Bv_Pages, 235, E_NumPage.Top, rsReportPageOf, 30, E_NumPage.Height, taLeftJustify, tlcenter);
L_NbrPages := CreateLabel(Bv_Pages, 265, E_NumPage.Top, ' ', 30, E_NumPage.Height, taCenter, tlcenter);
- Bt_PrecSect := CreateButton(Bv_Sections, 90, 6, 26, '', @Bt_PrecSectClick, 'repimg.Precedent');
+ Bt_PrecSect := CreateButton(Bv_Sections, 90, 6, 26, '', @Bt_PrecSectClick, 'repimg.Previous');
E_NumSect := CreateEditInteger(Bv_Sections, 120, 6, 60, 0);
E_NumSect.OnKeyPress := @E_NumSectKeyPress;
Bt_NextSect := CreateButton(Bv_Sections, 184, 6, 26, '', @Bt_NextSectClick, 'repimg.Next');
diff --git a/tools/imageconvert/frm_main.pas b/tools/imageconvert/frm_main.pas
index ecd6cc34..83d7c36a 100644
--- a/tools/imageconvert/frm_main.pas
+++ b/tools/imageconvert/frm_main.pas
@@ -20,6 +20,7 @@ type
pmFile: TfpgPopupMenu;
btnClear: TfpgButton;
Label1: TfpgLabel;
+ btnCopy: TfpgButton;
{@VFD_HEAD_END: MainForm}
procedure miFileQuit(Sender: TObject);
procedure MemoDragEnter(Sender, Source: TObject; AMimeList: TStringList;
@@ -29,6 +30,7 @@ type
function ConvertImage(const AFileName: string): string;
procedure btnClearClicked(Sender: TObject);
procedure btnConvertClicked(Sender: TObject);
+ procedure btnCopyClicked(Sender: TObject);
public
procedure AfterCreate; override;
end;
@@ -160,6 +162,11 @@ begin
end;
end;
+procedure TMainForm.btnCopyClicked(Sender: TObject);
+begin
+ fpgClipboard.Text := memImages.Text;
+end;
+
procedure TMainForm.AfterCreate;
begin
{%region 'Auto-generated GUI code' -fold}
@@ -168,6 +175,7 @@ begin
SetPosition(357, 227, 630, 378);
WindowTitle := 'Image Conversion Tool';
Hint := '';
+ ShowHint := True;
DNDEnabled := True;
MainMenu := TfpgMenuBar.Create(self);
@@ -231,11 +239,11 @@ begin
with btnClear do
begin
Name := 'btnClear';
- SetPosition(543, 44, 80, 24);
+ SetPosition(538, 64, 56, 23);
Anchors := [anRight,anTop];
Text := 'Clear';
FontDesc := '#Label1';
- Hint := '';
+ Hint := 'Clear text box';
ImageName := '';
TabOrder := 6;
OnClick := @btnClearClicked;
@@ -245,13 +253,25 @@ begin
with Label1 do
begin
Name := 'Label1';
- SetPosition(4, 72, 619, 16);
- Anchors := [anLeft,anRight,anTop];
+ SetPosition(4, 72, 315, 16);
FontDesc := '#Label1';
Hint := '';
Text := 'Drop one or more images on the text area below:';
end;
+ btnCopy := TfpgButton.Create(self);
+ with btnCopy do
+ begin
+ Name := 'btnCopy';
+ SetPosition(596, 64, 29, 23);
+ Text := '';
+ FontDesc := '#Label1';
+ Hint := 'Copy to clipboard';
+ ImageName := 'stdimg.copy';
+ TabOrder := 8;
+ OnClick := @btnCopyClicked;
+ end;
+
{@VFD_BODY_END: MainForm}
MainMenu.AddMenuItem('File', nil).SubMenu := pmFile;
diff --git a/tools/imageconvert/imgcnv.lpi b/tools/imageconvert/imgcnv.lpi
index 76f8b644..b9e17406 100644
--- a/tools/imageconvert/imgcnv.lpi
+++ b/tools/imageconvert/imgcnv.lpi
@@ -52,7 +52,7 @@
</Units>
</ProjectOptions>
<CompilerOptions>
- <Version Value="9"/>
+ <Version Value="11"/>
<Target>
<Filename Value="imgcnv"/>
</Target>