Compare commits

...

67 Commits

Author SHA1 Message Date
Travis Burtrum 03c94f443a push test 1 2011-10-14 11:43:10 -04:00
Merlijn Wajer b9fe547613 Initial MML Documentation work. 2011-10-11 16:36:11 +02:00
Merlijn Wajer e60a542c45 Filewall can now hook into DeleteFile. 2011-10-02 00:45:20 +02:00
Merlijn Wajer 5e7cf81f13 Resolve bug #309. 2011-09-30 02:33:16 +02:00
Merlijn Wajer 2833b60142 Clean up settings_const.inc a bit more. 2011-09-28 23:23:33 +02:00
Merlijn Wajer b11cf8bd53 Resolve bug #222. 2011-09-28 23:00:21 +02:00
Merlijn Wajer c7a6f55b66 Bitmaps.rst: Change code examples a bit. 2011-09-28 13:17:01 +02:00
Merlijn Wajer d6117264d2 Bitmaps.rst: fix typo. 2011-09-28 13:12:12 +02:00
Merlijn Wajer ab08afd9c1 Fix spelling mistakes. 2011-09-22 01:31:18 +02:00
Merlijn Wajer b1f02535ff Update TODO files.
Will get to some more Simba work in a week or two.
2011-08-30 10:36:57 +02:00
Merlijn Wajer c899b4e61b Simba: Fix mistake in web.rst 2011-08-20 11:45:04 +02:00
Merlijn Wajer 65c4fdbd08 Documentation: Updated TODO. 2011-08-17 00:11:11 +02:00
Merlijn Wajer 1ea613bfb5 Merge branch 'master' of github.com:MerlijnWajer/Simba 2011-08-15 20:10:27 +02:00
Thomas Augood 41e580273c Add initial TPA documentation.
Squashed commit of the following:

commit 489e0f1fa95fc73f7754700200636839015ffdf7
Author: Merlijn Wajer <merlijn@wizzup.org>
Date:   Mon Aug 15 20:08:39 2011 +0200

    TPA: Remove notes.

commit 1417e3e27653a6722c5b58b8f71a5c81fad1cbb2
Merge: 9602559 ae099c2
Author: Merlijn Wajer <merlijn@wizzup.org>
Date:   Mon Aug 15 19:55:48 2011 +0200

    Merge remote branch 'shuttleu/master' into doc

commit ae099c2eebb63347e882d795968e27ef01bff78a
Author: Thomas Augood <shuttleu@gmail.com>
Date:   Sun Aug 14 20:17:34 2011 +0100

    almost all documentation is done now

commit c95a3931bc16f329e6ca2cca04da3da15a2bb344
Author: Thomas Augood <shuttleu@gmail.com>
Date:   Sun Aug 14 19:31:36 2011 +0100

    more documentation, dont know what the wrap functions do though

commit 0295de8499878b813119d08d67e6724c0f0151d9
Author: Thomas Augood <shuttleu@gmail.com>
Date:   Sun Aug 14 18:28:11 2011 +0100

    done some documentation

Signed-off-by: Merlijn Wajer <merlijn@wizzup.org>
2011-08-15 20:09:56 +02:00
Merlijn Wajer 7d2ef3bff6 Merge pull request #36 from Coh3n/master
Parameter edit
2011-08-14 11:18:12 -07:00
Cohen Adair 23e518f531 MML: Changed PointToBox parameters to be more clear 2011-08-12 00:39:54 -04:00
Merlijn Wajer 96025597f9 Add SMARTLoader example. 2011-08-09 20:31:57 +02:00
Merlijn Wajer 4be1b4009d Revert "Should compile with latest LCL, donno if it works, but meh, just graphic components."
This reverts commit 981ec3760a.
2011-08-07 21:28:21 +02:00
Merlijn Wajer 058f6bef69 Simba: Bump version to 972. 2011-08-04 13:23:14 +02:00
Merlijn Wajer 93f44aa95e Installer: Comment settings.xml copy again. 2011-08-04 13:21:32 +02:00
Merlijn Wajer d25b86624d Simba: Bump version to 971 for next release.
Which would be 0.97.1... :-)
2011-08-04 00:59:44 +02:00
Merlijn Wajer f0fca408fd Installer: Add settings.xml 2011-08-04 00:18:31 +02:00
Merlijn Wajer aaafd6b0c1 Simba: Aboutform Disabled -> ReadOnly. 2011-08-01 16:30:10 +02:00
Bentzilla 9eee19a3af DebugImage always on top, Search box hint, Disable update button once successfully updated 2011-08-01 16:27:53 +02:00
Merlijn Wajer 26a627e7b5 MML/Finder: Fix leak in FindBitmapSpiralTolerance.
Effectively only leaked on non-Windows platforms.
2011-08-01 16:25:41 +02:00
Merlijn Wajer a20a31a250 Simba: Fix FindFile return value. 2011-07-31 17:44:17 +02:00
Merlijn Wajer cf41d95f53 Simba: Fix recursive INCLUDE_ONCE. 2011-07-31 17:36:34 +02:00
Merlijn Wajer b301172600 Simba: INCLUDE_ONCE and INCLUDE fixes. 2011-07-31 16:49:16 +02:00
Merlijn Wajer 00531f5e4a Setup: Add extension.sex to installer. 2011-07-31 15:30:08 +02:00
Merlijn Wajer a8664b3c57 Extensions: Add extension auto updater. 2011-07-31 13:56:47 +02:00
Merlijn Wajer 353d1f393d Lape: Update head. 2011-07-30 14:31:54 +02:00
Merlijn Wajer 841f228a0f Tests: Add BmpBench. 2011-07-30 13:46:53 +02:00
Merlijn Wajer 880072d723 MML/Core: Clean up os_linux. 2011-07-30 11:32:58 +02:00
Merlijn Wajer da0de6e4b9 Merge pull request #32 from Coh3n/master
Added FilterTPADist
2011-07-29 14:03:28 -07:00
Cohen Adair bae2e027e2 Laz: tpa.pas and psexportedmethods.inc added to project inspector 2011-07-29 16:38:20 -04:00
Cohen Adair c58268335a TPA: Removed FilterTPACustom and FilterTPADistEx 2011-07-29 16:32:13 -04:00
Cohen Adair 696a75b3d9 Merge branch 'master' of https://github.com/MerlijnWajer/Simba 2011-07-29 14:46:17 -04:00
Cohen Adair c4215bc2e5 MML: Added FilterTPACustom, FilterTPADistEx, and FilterTPADist 2011-07-29 14:45:30 -04:00
Merlijn Wajer 32a6db47c6 Simba: Fix LCLBase requirement. 2011-07-29 20:41:36 +02:00
Merlijn Wajer b7c8fa9fb6 Simba: Try to fix dependency hell. 2011-07-29 20:38:04 +02:00
Merlijn Wajer 73b2b9635d Lape: Update head. 2011-07-29 12:36:59 +02:00
Merlijn Wajer d199d11e68 Documentation: Small additions. 2011-07-29 12:36:39 +02:00
Merlijn Wajer 1fd51ff6b1 Simba: Define USE_EXTENSIONS by default. 2011-07-26 22:04:48 +02:00
Merlijn Wajer 303253aeed Simba: Attempt to fix include_once behaviour. 2011-07-26 21:44:01 +02:00
Merlijn Wajer 31df8c695a Extensions/paster: Fix bug introduced by StrToInt.
It now raises an exception, so use StrToIntDef instead.
2011-07-26 19:30:41 +02:00
Merlijn Wajer a8cdf77d87 Documentation: New Makefile + conf.py.
Allows for more targets, like manpages. :-)
2011-07-24 18:30:58 +02:00
Merlijn Wajer 4debde6635 Simba: Update ISS Install files. 2011-07-24 14:26:43 +02:00
Merlijn Wajer e0767cb52c Merge branch 'simba-next' 2011-07-24 00:10:17 +02:00
Merlijn Wajer 38c8b16407 Merge pull request #31 from Dgby714/SendKeysFix
MML: SendKeys
2011-07-23 15:08:58 -07:00
John P (Dgby714) 2faecb4966 MML: SendKeys (win), Removed a WriteLn and added a small check. 2011-07-23 18:01:13 -04:00
John P (Dgby714) 8acb244ec3 MML: SendKeys (win), Better way to do it. 2011-07-23 18:00:23 -04:00
John P (Dgby714) 3fbeab9a0b MML: SendKeys, added more shift characters. 2011-07-23 17:14:04 -04:00
Merlijn Wajer e63dcbccb1 Documentation: Add bitmaps references. (<3 vim) 2011-07-22 15:02:27 +02:00
Merlijn Wajer c06304d834 Documentation: Extend and clean up Bitmap scriptref. 2011-07-22 14:39:12 +02:00
Merlijn Wajer 0d553e1fbd Simba: And sync versions some more.
Numbers are now more sane.
2011-07-22 14:29:32 +02:00
Merlijn Wajer aded72ddb7 Documentation: Sync version with next Simba release. 2011-07-22 14:27:26 +02:00
Merlijn Wajer 297ea2abd8 Simba: Fix double-colour picking crash. 2011-07-22 13:54:19 +02:00
Merlijn Wajer 34eb23ba24 Documentation: More changes. 2011-07-19 13:47:24 +02:00
Merlijn Wajer cac637ea02 Documentation: Fix underline. 2011-07-18 18:46:10 +02:00
Merlijn Wajer 9489f3ece1 Documentation: Change style to nature. 2011-07-18 18:43:21 +02:00
Merlijn Wajer cc393d292f Documentation: Fixes for labels/references. 2011-07-18 13:08:51 +02:00
Merlijn Wajer 732d96b37f Documentation: Add labels and clean up. 2011-07-18 13:00:37 +02:00
Merlijn Wajer 2ff6724a7f Documentation: More detailed mouse documentation.
And a few additions to the documentation standards.
2011-07-18 12:47:14 +02:00
Merlijn Wajer 92900171be Documentation: Some changes. 2011-07-18 12:20:47 +02:00
Merlijn Wajer 851c5a8b36 libMML: Changed the indentation. 2011-07-17 20:03:27 +02:00
Merlijn Wajer 62ee91ab89 Documentation: Bump version to 820. 2011-07-17 20:03:15 +02:00
Merlijn Wajer 008196b04e Documentation: Initial libMML documentation. 2011-07-17 20:03:09 +02:00
68 changed files with 2526 additions and 809 deletions

View File

@ -1,39 +1,16 @@
.PHONY: default clean intro psbook html all
intro_ := mufasa_intro
psbook_ := mufasa_ps_handbook
book_ := mufasa_handbook
dev_ := mufasa_developers
default: tex
clean:
rm -rvf $(intro_)
rm -rvf $(psbook_)
rm -rvf $(book_)
rm -rvf $(dev_)
find -iname "$(intro_)*" | grep -v svn | grep -v tex | xargs rm -vf
find -iname "$(psbook_)*" | grep -v svn | grep -v tex | xargs rm -vf
find -iname "$(book_)*" | grep -v svn | grep -v tex | xargs rm -vf
find -iname "$(dev_)*" | grep -v svn | grep -v tex | xargs rm -vf
$(MAKE) -C Pics/ clean
tex:
$(MAKE) -C Pics/
texi2pdf $(intro_).tex #--silent
texi2pdf $(psbook_).tex #--silent
texi2pdf $(book_).tex #--silent
texi2pdf $(dev_).tex #--silent
html:
$(MAKE) -C Pics/
latex2html $(intro_).tex -local_icons -nofootnode
latex2html $(psbook_).tex -local_icons -nofootnode
latex2html $(book_).tex -local_icons -nofootnode
latex2html $(dev_).tex -local_icons -nofootnode
sphinx:
$(MAKE) -C Pics/
$(MAKE) html -C sphinx
.PHONY: default clean tarball
core = client ocr
all:
@python docgen.py `echo $(core) | sed -r \
's/(\w+)/..\/Units\/MMLCore\/\1.pas/g'` > /dev/null
@make -C sphinx/ html
clean:
@rm -f `echo $(core) | sed -r 's/(\w+)/sphinx\/\1.rst/g'`
@make -C sphinx/ clean
tarball:
@$(MAKE) all
@tar cjf doc.tar.bz2 -C sphinx/_build/ html

39
Doc/Makefile_outdated Normal file
View File

@ -0,0 +1,39 @@
.PHONY: default clean intro psbook html all
intro_ := mufasa_intro
psbook_ := mufasa_ps_handbook
book_ := mufasa_handbook
dev_ := mufasa_developers
default: tex
clean:
rm -rvf $(intro_)
rm -rvf $(psbook_)
rm -rvf $(book_)
rm -rvf $(dev_)
find -iname "$(intro_)*" | grep -v svn | grep -v tex | xargs rm -vf
find -iname "$(psbook_)*" | grep -v svn | grep -v tex | xargs rm -vf
find -iname "$(book_)*" | grep -v svn | grep -v tex | xargs rm -vf
find -iname "$(dev_)*" | grep -v svn | grep -v tex | xargs rm -vf
$(MAKE) -C Pics/ clean
tex:
$(MAKE) -C Pics/
texi2pdf $(intro_).tex #--silent
texi2pdf $(psbook_).tex #--silent
texi2pdf $(book_).tex #--silent
texi2pdf $(dev_).tex #--silent
html:
$(MAKE) -C Pics/
latex2html $(intro_).tex -local_icons -nofootnode
latex2html $(psbook_).tex -local_icons -nofootnode
latex2html $(book_).tex -local_icons -nofootnode
latex2html $(dev_).tex -local_icons -nofootnode
sphinx:
$(MAKE) -C Pics/
$(MAKE) html -C sphinx

22
Doc/docgen.py Normal file
View File

@ -0,0 +1,22 @@
import re
from sys import argv
files = argv[1:]
commentregex = re.compile('\(\*.+?\*\)', re.DOTALL)
for file in files:
print file
f = open(file)
p = file.rfind('/')
filetrim = file[p+1:]
p = filetrim.rfind('.pas')
filetrim2 = filetrim[:p]
o = open('sphinx/mmlref/%s.rst' % filetrim2, 'w+')
c = ''.join([x for x in f])
res = commentregex.findall(c)
for y in res:
o.write(y[2:][:-2])
o.close()
f.close()

View File

@ -12,20 +12,26 @@ PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
.PHONY: help clean html dirhtml pickle json htmlhelp qthelp latex changes linkcheck doctest
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " html to make standalone HTML files"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " pickle to make pickle files"
@echo " json to make JSON files"
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " qthelp to make HTML files and a qthelp project"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " changes to make an overview of all changed/added/deprecated items"
@echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
@echo " html to make standalone HTML files"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " singlehtml to make a single large HTML file"
@echo " pickle to make pickle files"
@echo " json to make JSON files"
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " qthelp to make HTML files and a qthelp project"
@echo " devhelp to make HTML files and a Devhelp project"
@echo " epub to make an epub"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " latexpdf to make LaTeX files and run them through pdflatex"
@echo " text to make text files"
@echo " man to make manual pages"
@echo " changes to make an overview of all changed/added/deprecated items"
@echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
clean:
-rm -rf $(BUILDDIR)/*
@ -40,6 +46,11 @@ dirhtml:
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
singlehtml:
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
@echo
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
pickle:
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
@echo
@ -65,12 +76,42 @@ qthelp:
@echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/Simba.qhc"
devhelp:
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
@echo
@echo "Build finished."
@echo "To view the help file:"
@echo "# mkdir -p $$HOME/.local/share/devhelp/Simba"
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/Simba"
@echo "# devhelp"
epub:
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
@echo
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
@echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
"run these through (pdf)latex."
@echo "Run \`make' in that directory to run these through (pdf)latex" \
"(use \`make latexpdf' here to do that automatically)."
latexpdf:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through pdflatex..."
make -C $(BUILDDIR)/latex all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
text:
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
@echo
@echo "Build finished. The text files are in $(BUILDDIR)/text."
man:
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
@echo
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
changes:
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes

View File

@ -1,5 +1,27 @@
# Change a minus to a plus when something is being worked on.
# Remove it when you are done.
Check scriptref/dtm.rst, it look overly complicated with all the different
types. (MDTM, DDTM, TSDTM)....
Add examples to files in scriptref:
- [ ] bitmaps.rst
- [ ] colourconverting.rst
- [ ] colourfinding.rst
- [ ] dtm.rst
- [ ] files.rst
- [/] mouseandkeyboard.rst
- [ ] ocr.rst
- [ ] sound.rst
- [ ] string.rst
- [ ] tpa.rst
- [ ] web.rst
- [ ] window.rst
# ADDING CONTENT
- Create a list of Simba Extensions. If the extension has a doc on it's own,
dont forget to link to it.
- Write mmlref / article (only for developers of Simba)
- Write tutorial?
- Write about Simba Stable/Unstable.
# GENERAL
@ -12,13 +34,3 @@
seems to use it).
- Find stuff to add to this list.
# ADDING CONTENT
- Create a list of Simba Extensions. If the extension has a doc on it's own,
dont forget to link to it.
- Create scriptref/ articles. A lot of functionality that Simba exposes to the
Scripters is currently not documented.
- Write mmlref/ article (only for developers of Simba)
- Write tutorial?
- Fix up articles?
- Write about Simba Stable/Unstable.

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
#
# Simba documentation build configuration file, created by
# sphinx-quickstart on Wed Jun 9 23:55:23 2010.
# sphinx-quickstart on Sun Jul 24 18:24:27 2011.
#
# This file is execfile()d with the current directory set to its containing dir.
#
@ -16,16 +16,19 @@ import sys, os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.append(os.path.abspath('.'))
#sys.path.insert(0, os.path.abspath('.'))
sys.path.append(os.path.abspath('../../Projects/libmml/pymml/mml'))
sys.path.append(os.path.abspath('../../Projects/libmml/pymml'))
# -- General configuration -----------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc']
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode']
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
@ -34,23 +37,23 @@ templates_path = ['_templates']
source_suffix = '.rst'
# The encoding of source files.
#source_encoding = 'utf-8'
#source_encoding = 'utf-8-sig'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = u'Simba'
copyright = u'2010, Merlijn Wajer, Raymond van Venetie'
copyright = u'2011, Merlijn Wajer, Raymond van Venetie'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '0.810'
version = '0.97'
# The full version, including alpha/beta/rc tags.
release = '0.810'
release = '0.97'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
@ -62,12 +65,9 @@ release = '0.810'
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'
# List of documents that shouldn't be included in the build.
#unused_docs = []
# List of directories, relative to source directory, that shouldn't be searched
# for source files.
exclude_trees = ['_build']
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ['_build']
# The reST default role (used for this markup: `text`) to use for all documents.
#default_role = None
@ -92,9 +92,9 @@ pygments_style = 'sphinx'
# -- Options for HTML output ---------------------------------------------------
# The theme to use for HTML and HTML Help pages. Major themes that come with
# Sphinx are currently 'default' and 'sphinxdoc'.
html_theme = 'default'
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'nature'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
@ -141,7 +141,7 @@ html_static_path = ['_static']
#html_additional_pages = {}
# If false, no module index is generated.
#html_use_modindex = True
#html_domain_indices = True
# If false, no index is generated.
#html_use_index = True
@ -152,13 +152,19 @@ html_static_path = ['_static']
# If true, links to the reST sources are added to the pages.
#html_show_sourcelink = True
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
#html_show_sphinx = True
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
#html_show_copyright = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
#html_use_opensearch = ''
# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = ''
# This is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = None
# Output file base name for HTML help builder.
htmlhelp_basename = 'Simbadoc'
@ -187,6 +193,12 @@ latex_documents = [
# not chapters.
#latex_use_parts = False
# If true, show page references after internal links.
#latex_show_pagerefs = False
# If true, show URL addresses after external links.
#latex_show_urls = False
# Additional stuff for the LaTeX preamble.
#latex_preamble = ''
@ -194,4 +206,54 @@ latex_documents = [
#latex_appendices = []
# If false, no module index is generated.
#latex_use_modindex = True
#latex_domain_indices = True
# -- Options for manual page output --------------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'simba', u'Simba Documentation',
[u'Merlijn Wajer, Raymond van Venetie'], 1)
]
# -- Options for Epub output ---------------------------------------------------
# Bibliographic Dublin Core info.
epub_title = u'Simba'
epub_author = u'Merlijn Wajer, Raymond van Venetie'
epub_publisher = u'Merlijn Wajer, Raymond van Venetie'
epub_copyright = u'2011, Merlijn Wajer, Raymond van Venetie'
# The language of the text. It defaults to the language option
# or en if the language is not set.
#epub_language = ''
# The scheme of the identifier. Typical schemes are ISBN or URL.
#epub_scheme = ''
# The unique identifier of the text. This can be a ISBN number
# or the project homepage.
#epub_identifier = ''
# A unique identification for the text.
#epub_uid = ''
# HTML files that should be inserted before the pages created by sphinx.
# The format is a list of tuples containing the path and title.
#epub_pre_files = []
# HTML files shat should be inserted after the pages created by sphinx.
# The format is a list of tuples containing the path and title.
#epub_post_files = []
# A list of files that should not be packed into the epub file.
#epub_exclude_files = []
# The depth of the table of contents in toc.ncx.
#epub_tocdepth = 3
# Allow duplicate toc entries.
#epub_tocdup = True

View File

@ -1,7 +1,9 @@
.. _docdoc:
Documentation Documentation
===========================
This page is the documentation for the documentation.
This page is the documentation for the documentation.
It is very important to know this by heart when you are writing documentation
for Simba.
@ -18,12 +20,13 @@ be found at the bottom of the page.
Building the documentation
--------------------------
In the future, the online documentation will be refreshed every hour. However,
if you want to build the documentation yourself, you should install
``python-sphinx``.
``python-sphinx``.
Move to the ``Simba/doc/sphinx`` directory and run ``make all``.
This will place an HTML version of the documentation in ``_build/html``.
Move to the ``Simba/doc/sphinx`` directory and run ``make all``.
This will place an HTML version of the documentation in ``_build/html``.
.. note::
The build instructions are for Linux only. If you want to build the doc on
@ -66,6 +69,28 @@ The titles of all major sections have all words capitalized. (The ones with
The minor sections and subsections (---) and (~~~) have only the first word and
Simba specific words (like Simba itself) capitalized.
Try to stick to the Python documentation standards.
Try to stick to the Python documentation standards.
( http://docs.python.org/using/index.html )
References
----------
Sphinx has references, most of the .rst files contain labels and references.
A label looks something like this:
.. code-block:: python
.. _<X>-<Y>:
Where X is either the name of file or folder; and Y is the name of the
file/function if X is a folder. For referring to specific functions for example,
use:
.. code-block:: python
.. _scriptref-movemouse:
To define a label for the MoveMouse function. Labels are always placed right
above section/chapter declarations.

View File

@ -1,7 +1,11 @@
Feature Overview
================
Detailed Feature Overview
=========================
Simba has some fancy features; the most basic operations as well as detailed
information about settings will be explained here.
.. toctree::
:maxdepth: 2
features/scriptmanager.rst
features/autoupdate.rst
@ -10,5 +14,3 @@ Feature Overview
features/ui.rst
features/notwellknown.rst
Most stuff here is probably misplaced anyway.

View File

@ -14,9 +14,17 @@ Recommended Simba Extensions
----------------------------
Recommended:
* SRL Updater (and Downloader)
* DTM Editor
* Extension Updater (highly recommended)
* SRL Updater (and Installer/Download)
* Associate Files
* Security extension. (Implements a File and Fire wall)
For developers:
* DTM Editor
* Paster Extension
* CRov, Crash Recovery.
.. note::
You can also use the Reflection Updater (and Downloader) for updating

View File

@ -1,6 +1,9 @@
Not Well Known Features
=======================
..
TODO
Simba has several features that are relatively unknown.
A few will be listed here.

View File

@ -1,5 +1,5 @@
Simba Script Manager
====================
Community-created scripts will be available for download from the
Community-created scripts will be available for download from the
Script Manager. The script manager will appear in release 1.0.

View File

@ -1,3 +1,4 @@
.. _gettingstarted:
Getting Started with Simba
==========================
@ -18,10 +19,12 @@ minutes.
Simba installer
~~~~~~~~~~~~~~~
Everyone can download Simba at http://wizzup.org/simba/
Go to download and download the Simba installer.
Everyone can get Simba at http://wizzup.org/simba/
Once it is done downloading, simply run the installer and follow the steps.
Go to *Download* and download the Simba installer.
Once it is done downloading, simply run the installer, follow the steps and
please make notice of the following note:
.. note::
Simba will install to C:/ by default; if you want to install it
@ -35,18 +38,20 @@ Once it is done downloading, simply run the installer and follow the steps.
Simba will probably tell you there is an update available. In this case, an
update button will appear. Click it and the Simba Updater will show up.
Alternatively you can update Simba using Tools -> Update.
Alternatively you can update Simba using Tools -> Update which will update Simba
if there is a new update available.
.. note::
Updating Simba regularly is recommended.
Updating Simba as soon as an update is released is recommended.
Downloading Simba binary
~~~~~~~~~~~~~~~~~~~~~~~~
Portable Simba Installation
~~~~~~~~~~~~~~~~~~~~~~~~~~~
This is harder and not recommended. Steps on how to do this will follow later.
..
TODO
For now, simply stick to the installer and update Simba after the install has
completed.
To get a portable installation at this time is not supported but will follow
sooner or later.
Setting up SRL 4 with Simba
---------------------------
@ -54,7 +59,7 @@ Setting up SRL 4 with Simba
If you were using the :ref:`simba-installer` then you can simply enable the
``SRL Updater`` extension. (Go to View -> Extensions and enable ``srl.sex``)
See :ref:`simbaext` for more information on Extensions.
See :ref:`simbaext` for more information on (other) Simba extensions.
This is the only supported way. You can simply do a svn checkout on the srl
repository, but if you can do that, then you should be able to set up SRL
@ -68,6 +73,9 @@ This will follow later, upon SRL 5 release.
Installing scripts
------------------
..
TODO
Scripts can be downloaded with the Script Manager, in Tools -> Script Manager.
.. note::

View File

@ -7,11 +7,28 @@ Welcome to the Simba documentation!
===================================
.. note::
The documentation is still WIP (Work In Progress)
Welcome to the Documentation for the Simba project.
This documentation is aimed at providing documentation on just about anything
you'd want to know about Simba.
Welcome to the Documentation for the Simba project.
The documentation is actively being worked on and somewhat incomplete.
This documentation aims to provide information on just about anything
there is to know about Simba.
Starting points are :ref:`whatis`, :ref:`gettingstarted` and the :ref:`scriptref`
Want to help out with the documentation? See :ref:`docdoc`.
Simba is a program used to repeat certain (complicated) tasks. Typically these
tasks involve using the mouse and keyboard. Simba is programmable, which means
you can design your own logic and steps that Simba will follow, based upon
certain input or as a reaction to a certain action.
Simba is created by the SRL community, fully open source and actively
maintained.
For community forums see http://villavu.com/
Contents:
@ -19,7 +36,6 @@ Contents:
:maxdepth: 2
whatis.rst
whatsnew.rst
whysimba.rst
gettingstarted.rst
troubleshooting.rst
@ -31,6 +47,7 @@ Contents:
referencesimba.rst
docdoc.rst
todo.rst
libmml.rst
pymml.rst

11
Doc/sphinx/libmml.rst Normal file
View File

@ -0,0 +1,11 @@
.. _lib-mml:
libMML
==========
.. toctree::
:maxdepth: 2
libmml/intro.rst

100
Doc/sphinx/libmml/intro.rst Normal file
View File

@ -0,0 +1,100 @@
libMML
======
libMML is short for the library to the Mufasa Macro Library.
Why libMML?
-----------
One of the first questions that rise are probably *why* libMML and *what* is
libMML exactly?
libMML is a loadable C-like library that provides most of the MML functionality.
For the ones that do not know, MML is the core component for Simba that does all
the *computational* and *algorithmic* work. See :ref:`mmlref` for more
information.
To summarize, the MML covers:
- Targetting specific windows and getting the window information such as
their bitmaps and dimensions.
- Controlling the mouse and keyboard.
- Finding colours, bitmaps and dtms.
- Text recognition (OCR)
- Accessing files and sockets in an unified manner
Hopefully the *what* part of the question has mainly been covered by now. If
you're literate in computer science the *why* question has also been answered as
soon as it was mentioned that is was a loadable library - which is also implied
by its name. Exporting the MML into a loadable library allows virtually any
program to load it and just use all the MML functionality.
Design (issues)
---------------
libMML itself should not be too complex. It should simply translate the OOP MML
to a non-OOP C-type library and convert datatypes when required (see below as to
why). libMML is basically just a codebase that calls MML functions and passes
the result along in a slightly different format. In simple cases such as
MoveMouse the integers are simply passed; since there's do not differ, but in
the case of arrays of any type we have to copy the arrays to a C format - at
least until MML internally will no longer use Free Pascal (managed) arrays.
As previously mentioned, libMML is a *C*-type library; this is mentioned
explicitly because MML is written in Free Pascal (Object Pascal) which has quite
a few different datatypes. Strings are typically not compatible, and arrays are
managed in Pascal whereas they are not in C which makes it hard to just *pass*
the array along. One of the problems we have to cope with when writing libMML is
converting datatypes to C-compatible datatypes. C-compatible datatypes are
supported by most programming languages and thus the best way to go when making
a universal MML library.
libMML use cases
----------------
Theoretically libMML can be loaded by any programming language; but typically
each programming languages has it's own kind of programming practices and thus
write - again - their own wrapper around libMML. This is what is being done with
*pyMML*, the python libMML wrapper. It is still as much in development as libMML
is, but the functionality exposed by libMML is succesfully used.
As of writing the pyMML usage looks like this, the passing around of a client
may be removed in a later stage, or at least have it's behaviour changed.
.. code-block:: python
DLL = MMLCore('../libmml.so')
client = DLL.dll.create_client()
print 'Python Client: %d' % client
if client in (0, 1):
raise Exception('Could create a client');
c = Color(DLL, client)
ret = c.find((0, 0, 100, 100), 0)
print ret
ret = c.find_all((0, 0, 100, 100), 0, tol=100)
print ret
m = Mouse(DLL, client)
print m[(Mouse.Pos, Mouse.Left, Mouse.Right)]
m[(Mouse.Pos, Mouse.Right)] = ((300,300), True)
print m.getButtonStates()
sleep(0.5)
m.setPos((200,200))
sleep(2)
print 'Done'
m[(Mouse.Left, Mouse.Right, Mouse.Middle)] = [False for x in range(3)]
for v in zip((Mouse.Left, Mouse.Right), m[(Mouse.Left, Mouse.Right)]):
print v
print m.getPos()
del DLL

View File

@ -6,7 +6,6 @@ Python MML
.. toctree::
:maxdepth: 2
pymml/mml.rst
pymml/mouse.rst
pymml/color.rst

View File

@ -1,3 +1,5 @@
.. _mmlref:
MML Reference
=============
@ -10,7 +12,7 @@ There currently is an effort to create a standalone library of the MML; called
*libMML*. This way any application can just load the library and use the MML
functionality.
The MML is split up in "Core" classes and "Addon" classes.
The MML is split up in "Core" classes and "Addon" classes.
.. note::
This section needs to explain more on the core/addon differences,

View File

@ -1,3 +1,5 @@
.. _scriptref:
Scripting Reference
===================

View File

@ -4,17 +4,53 @@
Bitmaps
=======
Bitmaps in Simba are internally all instances of *TMufasBitmap*. Scripts should
A bitmap in Simba is simply a two dimensional *field of colours*. These colours
can all be the same, or they can be of different colours. Simba features
functions to create, manipulate and search for bitmaps.
.. INSERT BITMAP EXAMPLE HERE (Picture, etc)
The bitmaps are - just as files - represented as integer in Simba (they point to
a list of bitmaps, and the value of the integer is the position in the list).
So typically, when referring to bitmaps in Simba, you simply represent them as
an integer:
.. code-block:: pascal
var bmp, x, y: integer;
begin
bmp := CreateBitmap(10, 10); // Create a bitmap of size (10, 10)
if FindBitmapIn(bmp, x, y, 0, 0, 300, 300) then
writeln('Found it!');
FreeBitmap(bmp); // Don't forget to free it when we are done.
end;
Note that the previous example doesn't make a lot of sense as the bitmap has
only been created and not filled with any colours, they are as of yet,
undefined. You can also create bitmaps from screenshots and load them when your
script starts using the :ref:`scriptref-bitmapfromstring` function, or
simple store them as files and load them using the :ref:`scriptref-loadbitmap`
function.
Word of caution on bitmap creation
----------------------------------
Bitmaps in Simba are internally all instances of *TMufasaBitmap*. Scripts should
generally access bitmaps using their *handle*: an integer. All functions
referenced here either require a bitmap *handle* or return one.
If you want to gain more access over a specific bitmap, see the
*GetMufasaBitmap* function. It is highly unrecommended to create bitmaps with:
*GetMufasaBitmap* function. It is highly unrecommended to create bitmaps like
this, because Simba will not free them automatically for you. (There's no
problem doing it like this if you only want to perform operations on it and then
free it again)
.. code-block:: pascal
var bmp: TMufasaBitmap;
bmp := TMufasBitmap.Create;
begin
bmp := TMufasBitmap.Create;
end;
Because there is no way to get a *handle* to this bitmap; as it will not be
managed by Simba internally. (All Bitmaps created by *CreateBitmap* are managed
@ -43,11 +79,14 @@ then call this function to get the class reference.
var bmp: TMufasaBitmap;
bmph: integer;
bmph := CreateBitmap(100, 100);
bmp := GetMufasaBitmap(bmph);
begin;
bmph := CreateBitmap(100, 100);
bmp := GetMufasaBitmap(bmph);
bmp.SetSize(150,150); // also changes bmph, as they are the same bitmap.
bmp.SetSize(150,150); // also changes bmph, as they are the same bitmap.
end;
.. _scriptref-createbitmapstring:
CreateBitmapString
------------------
@ -56,7 +95,11 @@ CreateBitmapString
function CreateBitmapString(bmp : integer) : string;
Creates a string for the given bitmap.
Creates a string for the given bitmap, you can use this to save a bitmap for
later us, for example loading it again using :ref:`scriptref-bitmapfromstring`.
.. _scriptref-createbitmap:
CreateBitmap
------------
@ -65,8 +108,10 @@ CreateBitmap
function CreateBitmap(w,h :integer) : integer;
Create a bitmap with width *h* and height *h*. Returns the bitmap reference.
Create a bitmap with width *h* and height *h*.
Returns the reference to the created bitmap.
.. _scriptref-freebitmap:
FreeBitmap
----------
@ -80,6 +125,8 @@ Be careful when working with bitmaps: not freeing it when you no longer need it
leads to memory leaks, which will eventually make your script crash. (Unless you
stop it in time, in which case Simba will free the bitmaps for you)
.. _scriptref-savebitmap:
SaveBitmap
----------
@ -89,6 +136,8 @@ SaveBitmap
Save the given bitmap to the specified path.
.. _scriptref-bitmapfromstring:
BitmapFromString
----------------
@ -99,6 +148,7 @@ BitmapFromString
Load a bitmap from the given string. This command is usually generated with the
Bitmap to String feature in Simba.
.. _scriptref-loadbitmap:
LoadBitmap
----------
@ -107,8 +157,10 @@ LoadBitmap
function LoadBitmap(Path : string) : integer;
Load a bitmap from a path to a file. Known formats are .bmp and .png. (Possibly
others, don't know for sure)
Load a bitmap from a path to a file. Formats known to work are BMP and PNG
images.
.. _scriptref-setbitmapsize:
SetBitmapSize
-------------
@ -117,7 +169,12 @@ SetBitmapSize
procedure SetBitmapSize(Bmp,NewW,NewH : integer);
Change the size of the bitmap. Previous data will be preserved (if possible).
Change the size of the bitmap.
Previous data will be preserved (if possible), so enlarging the bitmap won't
destroy the old data, but shrinking it will inevitably destroy some data.
(Everything that falls out of the new bounds)
.. _scriptref-getbitmapsize:
GetBitmapSize
-------------
@ -128,6 +185,8 @@ GetBitmapSize
Returns the size of the bitmap in *BmpW*, *BmpH*.
.. _scriptref-stretchbitmapresize:
StretchBitmapResize
-------------------
@ -136,6 +195,8 @@ StretchBitmapResize
procedure StretchBitmapResize(Bmp,NewW,NewH : integer);
.. _scriptref-createmirroredbitmap:
CreateMirroredBitmap
--------------------
@ -144,6 +205,8 @@ CreateMirroredBitmap
function CreateMirroredBitmap(Bmp : integer) : integer;
.. _scriptref-createmirroredbitmapex:
CreateMirroredBitmapEx
----------------------
@ -152,6 +215,8 @@ CreateMirroredBitmapEx
function CreateMirroredBitmapEx(Bmp : integer; MirrorStyle : TBmpMirrorStyle) : integer;
.. _scriptref-fastsetpixel:
FastSetPixel
------------
@ -161,6 +226,8 @@ FastSetPixel
Set the pixel on the bitmap at position x, y to *color*.
.. _scriptref-fastsetpixels:
FastSetPixels
-------------
@ -170,6 +237,7 @@ FastSetPixels
Set the pixels on the bitmap at position TPA[index] to Colors[index].
.. _scriptref-fastgetpixel:
FastGetPixel
------------
@ -180,6 +248,8 @@ FastGetPixel
Return the colour of pixel on the bitmap, position specified by x, y.
.. _scriptref-fastgetpixels:
FastGetPixels
-------------
@ -189,6 +259,7 @@ FastGetPixels
Return an array of the colours on the bitmap; positions specified by *TPA*.
.. _scriptref-getbitmapareacolors:
GetBitmapAreaColors
-------------------
@ -200,6 +271,8 @@ GetBitmapAreaColors
Returns all the colours in the area defined by (*xs*, *xy*, *xe*, *ye*) on the
bitmap in a two dimensions integer array.
.. _scriptref-fastdrawclear:
FastDrawClear
-------------
@ -209,6 +282,8 @@ FastDrawClear
Draw *Color* on every pixel on the bitmap.
.. _scriptref-fastdrawtransparent:
FastDrawTransparent
-------------------
@ -217,6 +292,8 @@ FastDrawTransparent
procedure FastDrawTransparent(x, y: Integer; SourceBitmap, TargetBitmap: Integer);
.. _scriptref-setransparentcolor:
SetTransparentColor
-------------------
@ -224,6 +301,7 @@ SetTransparentColor
procedure SetTransparentColor(bmp : integer; Color : TColor);
.. _scriptref-getransparentcolor:
GetTransparentColor
-------------------
@ -232,6 +310,7 @@ GetTransparentColor
function GetTransparentColor(bmp: integer) : TColor;
.. _scriptref-fastreplacecolor:
FastReplaceColor
----------------
@ -240,6 +319,7 @@ FastReplaceColor
procedure FastReplaceColor(Bmp : integer; OldColor,NewColor : TColor);
.. _scriptref-copyclienttobitmap:
CopyClientToBitmap
------------------
@ -250,6 +330,8 @@ CopyClientToBitmap
Copy client area *xs, ys, xe, ye* to specified bitmap.
.. _scriptref-bitmapfromclient:
BitmapFromClient
----------------
@ -259,6 +341,8 @@ BitmapFromClient
Create a bitmap from the client. Area specified by *xs, ye, xe, ye*.
.. _scriptref-setbitmapname:
SetBitmapName
-------------
@ -269,6 +353,20 @@ SetBitmapName
Assign a name to the bitmap. Mainly for debugging purposes. (It will write the
name of the bitmap if it hasn't been freed.)
.. code-block:: pascal
program new;
var bmp: integer;
begin
bmp := CreateBitmap(10, 10);
SetBitmapName(bmp, 'We will not free this bitmap');
end.
// Simba will print what bitmap has not been freed (along with his long
// name)
.. _scriptref-findbitmap:
FindBitmap
----------
@ -279,6 +377,8 @@ FindBitmap
Searches for the Bitmap *bmp* on the entire client. Returns true if found.
If found, *x, y* specifies the position where the bitmap was found.
.. _scriptref-findbitmapin:
FindBitmapIn
------------
@ -291,6 +391,8 @@ Searches for the Bitmap *bmp* on the client in the area defined by *xs,ys,xe,ye*
Returns true if found. If found, *x, y* specifies the position where the bitmap
was found.
.. _scriptref-findbitmaptolerancein:
FindBitmapToleranceIn
---------------------
@ -300,10 +402,12 @@ FindBitmapToleranceIn
Searches for the Bitmap *bmp* on the client in the area defined by *xs,ys,xe,ye*.
Tolerance defines the tolerance per pixel when matching bitmaps. See
:ref:`scriptref_CTS` for more information on tolerance.
:ref:`scriptref-CTS` for more information on tolerance.
Returns true if found. If found, *x, y* specifies the position where the bitmap
was found.
.. _scriptref-findbitmapspiral:
FindBitmapSpiral
----------------
@ -316,6 +420,8 @@ Returns true if found. If found, *x, y* specifies the position where the bitmap
was found. Search starts from a point defined by *x, y*.
.. _scriptref-findbitmapsspiraltolerance:
FindBitmapsSpiralTolerance
--------------------------
@ -326,10 +432,12 @@ FindBitmapsSpiralTolerance
Searches for the Bitmap *bmp* on the client in the area defined by *xs,ys,xe,ye*.
Tolerance defines the tolerance per pixel when matching bitmaps. See
:ref:`scriptref_CTS` for more information on tolerance.
:ref:`scriptref-CTS` for more information on tolerance.
Search starts from a point defined by *x, y*.
Returns true if found. If found, each point in *TPA* specifies a match.
.. _scriptref-findbitmapspiraltolerance:
FindBitmapSpiralTolerance
-------------------------
@ -339,11 +447,13 @@ FindBitmapSpiralTolerance
Searches for the Bitmap *bmp* on the client in the area defined by *xs,ys,xe,ye*.
Tolerance defines the tolerance per pixel when matching bitmaps. See
:ref:`scriptref_CTS` for more information on tolerance.
:ref:`scriptref-CTS` for more information on tolerance.
Search starts from a point defined by *x, y*.
Returns true if found. If found, *x, y* specifies the position where the bitmap
was found.
.. _scriptref-rotatebitmap:
RotateBitmap
------------
@ -352,6 +462,8 @@ RotateBitmap
function RotateBitmap(bitmap: Integer; angle: Extended): Integer;
.. _scriptref-desaturatebitmap:
DesaturateBitmap
----------------
@ -360,6 +472,8 @@ DesaturateBitmap
function DesaturateBitmap(Bitmap : integer) : integer;
.. _scriptref-invertbitmap:
InvertBitmap
------------
@ -368,6 +482,8 @@ InvertBitmap
procedure InvertBitmap(Bitmap : integer);
.. _scriptref-copybitmap:
CopyBitmap
----------
@ -377,6 +493,8 @@ CopyBitmap
Creates a copy of the *Bitmap*. Returns the bitmap copy.
.. _scriptref-greyscalebitmap:
GreyScaleBitmap
---------------
@ -386,6 +504,7 @@ GreyScaleBitmap
Creates a copy of the bitmap, greyscaled.
.. _scriptref-brightnessbitmap:
BrightnessBitmap
----------------
@ -400,6 +519,8 @@ Returns a new bitmap with the brightness applied.
If you instead want to apply brightness to the current bitmap, see
:ref:`filter_apply_bitmap`
.. _scriptref-contrastbitmap:
ContrastBitmap
--------------
@ -410,6 +531,7 @@ ContrastBitmap
Changes the constrast of a bitmap, returns a new bitmap with the contrast
applied.
.. _scriptref-posterizebitmap:
PosterizeBitmap
---------------
@ -441,6 +563,8 @@ Applying a filter on the current bitmap
FreeBitmap(b);
end.
.. _scriptref-createmaskfrombitmap:
CreateMaskFromBitmap
--------------------
@ -449,6 +573,8 @@ CreateMaskFromBitmap
function CreateMaskFromBitmap(Bitmap : integer) : TMask;
.. _scriptref-findmasktolerance:
FindMaskTolerance
-----------------
@ -457,6 +583,8 @@ FindMaskTolerance
function FindMaskTolerance(const mask: TMask; var x, y: Integer; xs,ys, xe, ye: Integer; Tolerance, ContourTolerance: Integer): Boolean;
.. _scriptref-findbitmapmasktolerance:
FindBitmapMaskTolerance
-----------------------
@ -465,6 +593,8 @@ FindBitmapMaskTolerance
function FindBitmapMaskTolerance(mask: Integer; var x, y: Integer; xs, ys, xe, ye: Integer; Tolerance, ContourTolerance: Integer): Boolean;
.. _scriptref-finddeformedbitmaptolerancein:
FindDeformedBitmapToleranceIn
-----------------------------
@ -473,6 +603,8 @@ FindDeformedBitmapToleranceIn
function FindDeformedBitmapToleranceIn(bitmap: integer; var x,y: Integer; xs, ys, xe, ye: Integer; tolerance: Integer; Range: Integer; AllowPartialAccuracy: Boolean; var accuracy: Extended): Boolean;
.. _scriptref-drawtpabitmap:
DrawTPABitmap
-------------
@ -484,6 +616,7 @@ DrawTPABitmap
on the bitmap by setting the pixel on the bitmap (position defined by tpa point)
to *color*.
.. _scriptref-drawatpabitmap:
DrawATPABitmap
--------------
@ -497,6 +630,8 @@ Each point in the TPointArray is *painted* on the bitmap by setting
the pixel on the bitmap (position defined by tpa point)
to a color. Colors differ per TPointArray (group).
.. _scriptref-drawatpabitmapex:
DrawATPABitmapEx
----------------
@ -509,6 +644,7 @@ Each point in the TPointArray is *painted* on the bitmap by setting
the pixel on the bitmap (position defined by tpa point)
to a color. Colors are defined by *Colors*.
.. _scriptref-drawbitmap:
DrawBitmap
----------
@ -519,6 +655,8 @@ DrawBitmap
Draw the bitmap to a TCanvas.
.. _scriptref-rectanglebitmap:
RectangleBitmap
---------------
@ -527,6 +665,8 @@ RectangleBitmap
procedure RectangleBitmap(bitmap : integer; const box : TBox; Color : TColor);
.. _scriptref-floodfillbitmap:
FloodFillBitmap
---------------
@ -535,6 +675,8 @@ FloodFillBitmap
procedure FloodFillBitmap(bitmap : integer; const StartPoint : TPoint; const SearchCol,ReplaceCol : TColor);
.. _scriptref-calculatepixelshift:
CalculatePixelShift
-------------------
@ -543,6 +685,8 @@ CalculatePixelShift
function CalculatePixelShift(Bmp1,Bmp2 : Integer; CompareBox : TBox) : integer;
.. _scriptref-calculatepixeltolerance:
CalculatePixelTolerance
-----------------------
@ -550,4 +694,3 @@ CalculatePixelTolerance
function CalculatePixelTolerance(Bmp1,Bmp2 : Integer; CompareBox : TBox; CTS : integer) : extended;')

View File

@ -1,8 +1,11 @@
.. _scriptref_colourconv:
.. _scriptref-colourconv:
Colour Conversions
==================
..
TODO:
Colour spaces
-------------
@ -12,6 +15,7 @@ Explain some colour spaces here.
Colour Conversion Methods
-------------------------
.. _scriptref-colortorgb:
ColorToRGB
~~~~~~~~~~
@ -20,6 +24,8 @@ ColorToRGB
procedure ColorToRGB(Color: integer; var r, g, b: Integer);
.. _scriptref-rgbtocolor:
RGBtoColor
~~~~~~~~~~
@ -27,6 +33,8 @@ RGBtoColor
function RGBtoColor(r, g, b: Integer): TColor;
.. _scriptref-colortohsl:
ColorToHSL
~~~~~~~~~~
@ -34,6 +42,8 @@ ColorToHSL
procedure ColorToHSL(Color: Integer; var h, s, l: Extended);
.. _scriptref-hsltocolor:
HSLToColor
~~~~~~~~~~
@ -41,6 +51,8 @@ HSLToColor
function HSLToColor(H, S, L: Extended): TColor;
.. _scriptref-colortoxyz:
ColorToXYZ
~~~~~~~~~~
@ -48,6 +60,8 @@ ColorToXYZ
procedure ColorToXYZ(Color: Integer; var x, y, z: Extended);
.. _scriptref-xyztocolor:
XYZToColor
~~~~~~~~~~
@ -55,6 +69,8 @@ XYZToColor
function XYZToColor(X, Y, Z: Extended): TColor;
.. _scriptref-rgbtohsl:
RGBToHSL
~~~~~~~~
@ -62,6 +78,8 @@ RGBToHSL
procedure RGBToHSL(R, G, B: Integer; var h, s, l: Extended);
.. _scriptref-hsltorgb:
HSLtoRGB
~~~~~~~~
@ -69,6 +87,8 @@ HSLtoRGB
procedure HSLtoRGB(H, S, L: extended; var R, G ,B: Integer);
.. _scriptref-rgbtoxyz:
RGBToXYZ
~~~~~~~~
@ -76,6 +96,8 @@ RGBToXYZ
procedure RGBToXYZ(R, G, B: Integer;var x, y ,z: Extended);
.. _scriptref-xyztorgb:
XYZToRGB
~~~~~~~~
@ -83,4 +105,5 @@ XYZToRGB
procedure XYZToRGB(X, Y, Z: Extended; var R, G, B: Integer);
..
TODO: Add CIE L*a*b.

View File

@ -37,6 +37,7 @@ components:
a *TPointArray*.
.. note::
Other techniques exist, which involve relative point distance from one point
to another; these are found in the :ref:`scriptref-dtm` section.
@ -51,6 +52,8 @@ Colour Finding Methods
A list of all colour finding methods in Simba.
.. _scriptref-similarcolors:
SimilarColors
~~~~~~~~~~~~~
@ -61,6 +64,8 @@ SimilarColors
SimilarColors returns true if the two passed colours are *similar* given the
passed *Tolerance*.
.. _scriptref-getcolor:
GetColor
~~~~~~~~
@ -68,13 +73,19 @@ GetColor
function GetColor(x, y: Integer): Integer;
GetColor returns the color on the coordinate (*x*, *y*).
GetColor returns the color on the coordinate *(x, y)*.
*Example: Printing the colour on coordinate (25, 25)*
Example printing the colour on coordinate (25, 25).
.. code-block:: pascal
Writeln('Colour is ' + IntToStr(GetColor(25, 25)))
program printcolour;
begin
Writeln('Colour is ' + IntToStr(GetColor(25, 25)))
end.
.. _scriptref-getcolors:
GetColors
~~~~~~~~~
@ -85,6 +96,7 @@ GetColors
GetColors returns an array of the colours at the given *Coords*.
.. _scriptref-countcolor:
CountColor
~~~~~~~~~~
@ -96,6 +108,8 @@ CountColor
Returns how many times *Color* occurs in the area defined by (*xs*, *ys*),
(*xe*, *ye*)
.. _scriptref-countcolortolerance:
CountColorTolerance
~~~~~~~~~~~~~~~~~~~
@ -106,6 +120,8 @@ CountColorTolerance
Returns how many times *Color* occurs (within *Tolerance*)
in the area defined by (*xs*, *ys*), (*xe*, *ye*)
.. _scriptref-findcolor:
FindColor
~~~~~~~~~
@ -121,6 +137,8 @@ The point is returned in *x* and *y*.
It searches from the top left to the bottom right and will stop
after matching a point.
.. _scriptref-findcolortolerance:
FindColorTolerance
~~~~~~~~~~~~~~~~~~
@ -134,9 +152,11 @@ FindColorTolerance returns true if a colour within the given tolerance range
*x2*, *y2*.
Only the first point is returned in *x* and *y*.
Whether or not a colour is within the tolerance range is determined by the
:ref:`scriptref_CTS` mode. It searches from the top left to the bottom right
:ref:`scriptref-CTS` mode. It searches from the top left to the bottom right
and will stop after matching a point.
.. _scriptref-findcolors:
FindColors
~~~~~~~~~~
@ -148,6 +168,8 @@ FindColors returns a list of all points that match the colour *col* in an area
defined by *x1*, *y1*, *x2*, *y2*. It returns true if one or more points have
been found.
.. _scriptref-findcolorstolerance:
FindColorsTolerance
~~~~~~~~~~~~~~~~~~~
@ -160,10 +182,12 @@ FindColorsTolerance returns true if at least one point was found.
A point is found if it is within the given tolerance range *tol*
of the given colour *col* and inside the box defined by *x1*, *y1*, *x2*, *y2*.
Whether or not a color is within the tolerance range is determined by the
:ref:`scriptref_CTS` mode.
:ref:`scriptref-CTS` mode.
It searches from the top left to the bottom right and will find all
matching points in the area.
.. _scriptref-findcolorspiral:
FindColorSpiral
~~~~~~~~~~~~~~~
@ -174,6 +198,8 @@ FindColorSpiral
Same as FindColor, but starts searching from *x*, *y*.
.. _scriptref-findcolorspiraltolerance:
FindColorSpiralTolerance
~~~~~~~~~~~~~~~~~~~~~~~~
@ -184,6 +210,8 @@ FindColorSpiralTolerance
Same as FindColorTolerance, but starts searching from *x*, *y*.
.. _scriptref-findcolorsspiraltolerance:
FindColorsSpiralTolerance
~~~~~~~~~~~~~~~~~~~~~~~~~
@ -194,6 +222,9 @@ FindColorsSpiralTolerance
Same as FindColorsTolerance, but starts searching from *x*, *y*.
.. _scriptref-findcoloredarea:
.. _scriptref-findcoloredareatolerance:
Find areas of colours
~~~~~~~~~~~~~~~~~~~~~
@ -215,7 +246,7 @@ FindColoredArea finds an area that consists out of Colours that match *Color* wi
the given *Tolerance* and has a minimal size of *MinArea*.
If you want minimal area of 5x5 pixels (25), then set MinArea to 25.
.. _scriptref_CTS:
.. _scriptref-CTS:
Colour tolerance
----------------
@ -236,6 +267,11 @@ given a tolerance. There are three algorithms, from fastest to slowest:
very little in hue. Luminance is assigned a somewhat static function, and
has no modifier.
..
TODO: CIE-Lab
.. _scriptref-gettolerancespeed:
.. _scriptref-setcolortolerancespeed:
Get and Set Colour Tolerance
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -258,12 +294,15 @@ function, which returns the current colour tolerance speed:
function GetToleranceSpeed: Integer;
*Example: Printing the Color Tolerance*
Example printing the Color Tolerance
.. code-block:: pascal
Writeln(Format('Tolerance Speed = %d', [GetToleranceSpeed]))
.. _scriptref-settolerancespeed2modifiers:
.. _scriptref-gettolerancespeed2modifiers:
Get And Set Colour Modifiers
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -280,14 +319,14 @@ Set colour speed 2 modifiers.
SetToleranceSpeed2Modifiers(42.0, 0.4)
The following function
.. code-block:: pascal
procedure GetToleranceSpeed2Modifiers(var hMod, sMod: Extended);
returns colour speed 2 modifiers.
*Example: Getting the modifiers*
Example getting the modifiers:
.. code-block:: pascal

View File

@ -1,6 +1,9 @@
Mouse and Keyboard
==================
Simba contains several functions to manipulate the mouse and keyboard.
Features range from clicking and moving the mouse to faking keypresses.
Types
-----
@ -27,15 +30,43 @@ list.
Mouse Functions
---------------
Simba's coordinate system is similar to most computer coordinate systems.
Coordinate *(0, 0)* is the top-left part of your selected window (the desktop by
default). To get to point *(5, 0)* we move five pixels to the right; to get to
*(5, 5)* we move five pixels to the right, and five pixels down.
Recall that the first value is *x*, the second value is *y*: *(x, y)*
..
TODO: Picture?
MoveMouse
~~~~~~~~~
.. _scriptref-movemouse:
.. code-block:: pascal
procedure MoveMouse(x, y: integer);
MoveMouse moves the mouse pointer to the specified x and y coordinates.
The following example will move the mouse to position *(10, 10)*; relative
to the selected client. (To get to point (10, 10) visually, recall that (0, 0)
is the *top left* part and to get to (10, 10) we move 10 pixels to the right,
and ten pixels down.)
.. code-block:: pascal
Program MouseMove;
begin
MoveMouse(10, 10);
end.
.. _scriptref-getmousepos:
GetMousePos
~~~~~~~~~~~
@ -43,9 +74,23 @@ GetMousePos
procedure GetMousePos(var x, y: integer);
GetMousePos returns the current position of the mouse in x and
y.
GetMousePos returns the current position of the mouse in x and y.
The following example moves the mouse 1 pixel to the right, relative to its
current position:
.. code-block:: pascal
Program MouseMoveRelative;
var x, y: integer;
begin
GetMousePos(x, y);
MoveMouse(x + 1, y);
end.
.. _scriptref-holdmouse:
HoldMouse
~~~~~~~~~
@ -54,9 +99,14 @@ HoldMouse
procedure HoldMouse(x, y: Integer; clickType: TClickType);
HoldMouse holds the given mouse button (clickType) down at the specified
x, y coordinate. If the mouse if not at the given x, y yet, the mouse position
will be set to x, y.
HoldMouse holds the given mouse button specified by clickType down at the
specified *(x, y)* coordinate. If the mouse if not at the given
(*x, y)* yet, the mouse position will be set to *(x, y)*.
..
TODO: Example
.. _scriptref-releasemouse:
ReleaseMouse
~~~~~~~~~~~~
@ -69,6 +119,11 @@ HoldMouse holds the given mouse button (clickType) down at the specified
x, y coordinate. If the mouse if not at the given x, y yet, the
mouse position will be set to x, y.
..
TODO: Example
.. _scriptref-clickmouse:
ClickMouse
~~~~~~~~~~
@ -77,7 +132,9 @@ ClickMouse
procedure ClickMouse(x, y: Integer; clickType: Integer):
ClickMouse performs a click with the given mouse button (clickType) at the
specified x, y coordinate.
specified *(x, y)* coordinate. This ``click`` equals an immediate click, with no
wait between holding down and releasing the mouse button. To create a more
human-like effect, use the HoldMouse and ReleaseMouse functions.
Keyboard Functions
------------------
@ -85,18 +142,22 @@ Keyboard Functions
Keyboard functions are obviously used to manipulate the keyboard input. It can
also be used to read states of specific keys.
.. _scriptref-keydown:
KeyDown
~~~~~~~
.. code-block:: pascal
procedure KeyDown(key: Word);
KeyDown sends a request to the Operating System to "fake" an event that
causes the ``key`` to be "down".
causes the keyboard ``key`` to be "down".
..
TODO: Example
.. _scriptref-keyup:
KeyUp
~~~~~
@ -108,8 +169,10 @@ KeyUp
KeyDown sends a request to the Operating System to "fake" an event that
causes the ``key`` to be "up".
..
TODO: Example
.. _virtualkeys:
.. _scriptref-virtualkeys:
Keyboard Virtual Keys
---------------------

View File

@ -1,12 +1,12 @@
.. _scriptref_web:
.. _scriptref_sound:
Multimedia Functions
====================
Sound Functions
--------------
---------------
PlaySound
~~~~~~~~~

View File

@ -11,6 +11,8 @@ Quicksort
procedure Quicksort(var Arr : TIntegerArray);
Sorts a TIntegerArray using the Quicksort algorithm
tSwap
-----
@ -19,6 +21,8 @@ tSwap
procedure tSwap(var a, b: TPoint);
Swaps the values of a and b around
tpaSwap
-------
@ -27,6 +31,8 @@ tpaSwap
procedure tpaSwap(var a, b: TPointArray);
Swaps the values of a and b around
SwapE
-----
@ -35,6 +41,8 @@ SwapE
procedure SwapE(var a, b: Extended);
Swaps the values of a and b around
RAaSTPAEx
---------
@ -43,6 +51,7 @@ RAaSTPAEx
procedure RAaSTPAEx(var a: TPointArray; const w, h: Integer);
Leaves one point per box with side lengths W and H to the TPA
RAaSTPA
-------
@ -51,6 +60,8 @@ RAaSTPA
procedure RAaSTPA(var a: TPointArray; const Dist: Integer);
Leaves one point per box with the side length Dist
NearbyPointInArrayEx
--------------------
@ -59,6 +70,8 @@ NearbyPointInArrayEx
function NearbyPointInArrayEx(const P: TPoint; w, h:Integer;const a: TPointArray): Boolean;
Returns true if the point P is near a point in the TPA a with the
NearbyPointInArray
------------------
@ -67,6 +80,8 @@ NearbyPointInArray
function NearbyPointInArray(const P: TPoint; Dist:Integer;const a: TPointArray): Boolean;
Returns true if the point P is near a point in the TPA a with the
QuickTPASort
------------
@ -91,6 +106,8 @@ SortTPAFrom
procedure SortTPAFrom(var a: TPointArray; const From: TPoint);
Sorts the TPA a from the TPoint From
SortATPAFrom
------------
@ -99,6 +116,8 @@ SortATPAFrom
procedure SortATPAFrom(var a: T2DPointArray; const From: TPoint);
Sorts the T2DPointArray a from the TPoint From
SortATPAFromFirstPoint
----------------------
@ -115,6 +134,8 @@ InvertTPA
procedure InvertTPA(var a: TPointArray);
Reverses the TPA
InvertATPA
----------
@ -123,6 +144,8 @@ InvertATPA
procedure InvertATPA(var a: T2DPointArray);
Reverses the T2dPointArray
MiddleTPAEx
-----------
@ -131,6 +154,8 @@ MiddleTPAEx
function MiddleTPAEx(const TPA: TPointArray; var x, y: Integer): Boolean;
Stores the middle point from the TPA in x and y
MiddleTPA
---------
@ -139,6 +164,8 @@ MiddleTPA
function MiddleTPA(const tpa: TPointArray): TPoint;
Returns the middle TPA in the result
SortATPASize
------------
@ -147,6 +174,8 @@ SortATPASize
procedure SortATPASize(var a: T2DPointArray; const BigFirst: Boolean);
Sorts the T2dPointArray from largest to smallest if BigFirst is true or smallest to largest if BigFirst is false
SortATPAFromSize
----------------
@ -155,6 +184,8 @@ SortATPAFromSize
procedure SortATPAFromSize(var a: T2DPointArray; const Size: Integer; CloseFirst: Boolean);
Sorts the T2DPointArray from Size by the closest first if CloseFirst is true
InIntArrayEx
------------
@ -163,6 +194,8 @@ InIntArrayEx
function InIntArrayEx(const a: TIntegerArray; var Where: Integer; const Number: Integer): Boolean;
Returns true if Number was found in the TIntegerArray a and returns its location in Where
InIntArray
----------
@ -171,6 +204,8 @@ InIntArray
function InIntArray(const a: TIntegerArray; Number: Integer): Boolean;
Returns true if Number is found in the TintegerArray a
ClearSameIntegers
-----------------
@ -179,6 +214,8 @@ ClearSameIntegers
procedure ClearSameIntegers(var a: TIntegerArray);
Deletes the indexes in the TintegerArray a which are duplicated
ClearSameIntegersAndTPA
-----------------------
@ -187,6 +224,8 @@ ClearSameIntegersAndTPA
procedure ClearSameIntegersAndTPA(var a: TIntegerArray; var p: TPointArray);
Deletes the indexes in the TIntegerArray a and TPointArray p which are duplicated
SplitTPAEx
----------
@ -195,6 +234,8 @@ SplitTPAEx
function SplitTPAEx(const arr: TPointArray; w, h: Integer): T2DPointArray;
Splits the points with max X and Y distances W and H to their
SplitTPA
--------
@ -203,6 +244,8 @@ SplitTPA
function SplitTPA(const arr: TPointArray; Dist: Integer): T2DPointArray;
Splits the points with max distance Dist to their own TPointArrays
FloodFillTPA
------------
@ -219,6 +262,9 @@ FilterPointsPie
procedure FilterPointsPie(var Points: TPointArray; const SD, ED, MinR, MaxR: Extended; Mx, My: Integer);
Removes the points that are in the TPointArray Points that are not within the the degrees SD (Strat Degrees) and
ED (End Degrees) and the radius' MinR (Min Radius) and MaxR (Max Radius) from the origin Mx and My
FilterPointsLine
----------------
@ -227,6 +273,8 @@ FilterPointsLine
procedure FilterPointsLine(var Points: TPointArray; Radial: Extended; Radius, MX, MY: Integer);
Returns the result in the TPointArray Points. Returns the points from the TPointArray Points that are on the line Radial from the center mx, my that is with the radius Radius
FilterPointsDist
----------------
@ -235,6 +283,9 @@ FilterPointsDist
procedure FilterPointsDist(var Points: TPointArray; const MinDist, MaxDist: Extended; Mx, My: Integer);
Removes the points from the TPointArray Points that are not within the radius MinDist (Min Distance) and MaxDist
from the origin Mx and My
GetATPABounds
-------------
@ -243,6 +294,8 @@ GetATPABounds
function GetATPABounds(const ATPA: T2DPointArray): TBox;
Returns the boundaries of the T2DPointArray ATPA as a TBox
GetTPABounds
------------
@ -251,6 +304,8 @@ GetTPABounds
function GetTPABounds(const TPA: TPointArray): TBox;
Returns the boundaries of the TPointArray TPA as a TBox
FindTPAinTPA
------------
@ -259,6 +314,8 @@ FindTPAinTPA
function FindTPAinTPA(const SearchTPA, TotalTPA: TPointArray; var Matches: TPointArray): Boolean;
Looks for the TPoints from SearchTPA inside TotalTPA and stores the matches inside the TPointArray Matches
GetSamePointsATPA
-----------------
@ -267,6 +324,8 @@ GetSamePointsATPA
function GetSamePointsATPA(const ATPA : T2DPointArray; var Matches : TPointArray) : boolean;
Finds duplicate Points inside the T2DPointArray ATPA and stores the results inside the TPointArray Matches
FindTextTPAinTPA
----------------
@ -275,6 +334,8 @@ FindTextTPAinTPA
function FindTextTPAinTPA(Height : integer;const SearchTPA, TotalTPA: TPointArray; var Matches: TPointArray): Boolean;
Looks for the TPoints from SearchTPA inside TotalTPA with a maximum y distance of Height and stores the matches inside the TPointArray Matches
SortCircleWise
--------------
@ -283,6 +344,8 @@ SortCircleWise
procedure SortCircleWise(var tpa: TPointArray; const cx, cy, StartDegree: Integer; SortUp, ClockWise: Boolean);
Sorts the TPointArray tpa from the point cx, cy if Sortup is true. Starting at StartDegree going clockwise if Clockwise is True
LinearSort
----------
@ -291,6 +354,8 @@ LinearSort
procedure LinearSort(var tpa: TPointArray; cx, cy, sd: Integer; SortUp: Boolean);
Sorts the TPointArray tpa from cx, cy if Sortup is true on the degree angle sd
RotatePoint
-----------
@ -299,6 +364,8 @@ RotatePoint
function RotatePoint(Const p: TPoint; angle, mx, my: Extended): TPoint;
Rotates the TPoint p around the center mx, my with the angle
ChangeDistPT
------------
@ -307,6 +374,8 @@ ChangeDistPT
function ChangeDistPT(const PT : TPoint; mx,my : integer; newdist : extended) : TPoint;
Returns a TPoint with the distance newdist from the point mx, my based on the position of the TPoint TP
ChangeDistTPA
-------------
@ -315,6 +384,8 @@ ChangeDistTPA
function ChangeDistTPA(var TPA : TPointArray; mx,my : integer; newdist : extended) : boolean;
Returns the result in the TPointArray TPA with the distance newdist from mx, my based on the current position TPA
FindGapsTPA
-----------
@ -323,6 +394,8 @@ FindGapsTPA
function FindGapsTPA(const TPA: TPointArray; MinPixels: Integer): T2DPointArray;
Finds the possible gaps in the TPointArray TPA and results the gaps as a T2DPointArray. Considers as a gap if the gap length is >= MinPixels
RemoveDistTPointArray
---------------------
@ -331,6 +404,8 @@ RemoveDistTPointArray
function RemoveDistTPointArray(x, y, dist: Integer;const ThePoints: TPointArray; RemoveHigher: Boolean): TPointArray;
Finds the possible gaps in the TPointArray TPA and removes the gaps. Considers as a gap if the gap length is >= MinPixels
CombineTPA
----------
@ -339,6 +414,8 @@ CombineTPA
function CombineTPA(const Ar1, Ar2: TPointArray): TPointArray;
Attaches the TPointArray Ar2 onto the end of Ar1 and returns it as the result
ReArrangeandShortenArrayEx
--------------------------
@ -347,6 +424,8 @@ ReArrangeandShortenArrayEx
function ReArrangeandShortenArrayEx(const a: TPointArray; w, h: Integer): TPointArray;
Results the TPointArray a with one point per box with side lengths W and H left
ReArrangeandShortenArray
------------------------
@ -355,6 +434,8 @@ ReArrangeandShortenArray
function ReArrangeandShortenArray(const a: TPointArray; Dist: Integer): TPointArray;
Results the TPointArray a with one point per box with side length Dist left
TPAtoATPAEx
-----------
@ -363,6 +444,8 @@ TPAtoATPAEx
function TPAtoATPAEx(const TPA: TPointArray; w, h: Integer): T2DPointArray;
Splits the TPA to boxes with sidelengths W and H and results them as a T2DPointArray
TPAtoATPA
---------
@ -371,6 +454,8 @@ TPAtoATPA
function TPAtoATPA(const TPA: TPointArray; Dist: Integer): T2DPointArray;
Splits the TPA to boxes with sidelength Dist and results them as a T2DPointArray
CombineIntArray
---------------
@ -379,6 +464,8 @@ CombineIntArray
function CombineIntArray(const Ar1, Ar2: TIntegerArray): TIntegerArray;
Attaches the TIntegerArray Ar2 onto the end of Ar1 and returns it as the result
MergeATPA
---------
@ -387,6 +474,8 @@ MergeATPA
function MergeATPA(const ATPA : T2DPointArray) : TPointArray;
Combines all the TPointArrays from the T2DPointArray ATPA into the result
AppendTPA
---------
@ -395,6 +484,8 @@ AppendTPA
procedure AppendTPA(var TPA: TPointArray; const ToAppend: TPointArray);
Attaches the TPointArray ToAppend onto the end of TPA
TPAFromBox
----------
@ -403,6 +494,8 @@ TPAFromBox
function TPAFromBox(const Box : TBox) : TPointArray;
Create a TPointArray from the top left and the bottom right of the TBox Box
RotatePoints
------------
@ -411,6 +504,8 @@ RotatePoints
function RotatePoints(Const P: TPointArray; A, cx, cy: Extended): TPointArray ;
Rotates the TPointArray P around the center cx, cy with the angle a
FindTPAEdges
------------
@ -419,6 +514,8 @@ FindTPAEdges
function FindTPAEdges(const p: TPointArray): TPointArray;
Returns a TPointArray of the edge points of the TPointArray p
ClearTPAFromTPA
---------------
@ -427,6 +524,8 @@ ClearTPAFromTPA
function ClearTPAFromTPA(const arP, ClearPoints: TPointArray): TPointArray;
Removes the points in TPointArray ClearPoints from arP
ReturnPointsNotInTPA
--------------------
@ -435,6 +534,8 @@ ReturnPointsNotInTPA
function ReturnPointsNotInTPA(Const TotalTPA: TPointArray; const Box: TBox): TPointArray;
All the points from the TPointArray TotalTPA that are not in the TBox Box are returned in the TPointArray Res
PointInTPA
----------
@ -443,6 +544,8 @@ PointInTPA
function PointInTPA(p: TPoint;const arP: TPointArray): Boolean;
Returns true if the TPoint p is found in the TPointArray arP
ClearDoubleTPA
--------------
@ -451,6 +554,8 @@ ClearDoubleTPA
procedure ClearDoubleTPA(var TPA: TPointArray);
Deletes duplicate TPAs int he TPointArray TPA
TPACountSort
------------
@ -475,6 +580,8 @@ InvertTIA
procedure InvertTIA(var tI: TIntegerArray);
Reverses the TIntegerArray tI
SumIntegerArray
---------------
@ -483,6 +590,8 @@ SumIntegerArray
function SumIntegerArray(const Ints : TIntegerArray): Integer;
Retuns the sum of all the integers in the TIntegerArray Ints
AverageTIA
----------
@ -491,6 +600,8 @@ AverageTIA
function AverageTIA(const tI: TIntegerArray): Integer;
Gives an average of the sum of the integers in the TIntegerArray tI
AverageExtended
---------------
@ -499,6 +610,8 @@ AverageExtended
function AverageExtended(const tE: TExtendedArray): Extended;
Gives an average of the sum of the extendeds in the TExtendedArray tI
SplitTPAExWrap
--------------
@ -507,6 +620,8 @@ SplitTPAExWrap
procedure SplitTPAExWrap(const arr: TPointArray; w, h: Integer; var res : T2DPointArray);
Splits the points with max X and Y distances W and H to their and returns the result in the T2DPointArray Res
SplitTPAWrap
------------
@ -515,6 +630,8 @@ SplitTPAWrap
procedure SplitTPAWrap(const arr: TPointArray; Dist: Integer; var res: T2DPointArray);
Splits the points with max distance Dist to their own TPointArrays and returns the result in the T2DPointArray Res
FindGapsTPAWrap
---------------
@ -523,6 +640,8 @@ FindGapsTPAWrap
procedure FindGapsTPAWrap(const TPA: TPointArray; MinPixels: Integer; var Res : T2DPointArray);
Finds the possible gaps in the TPointArray TPA and the result is returned in the T2DPointArray Res. Considers as a gap if the gap length is >= MinPixels
RemoveDistTPointArrayWrap
-------------------------
@ -531,6 +650,8 @@ RemoveDistTPointArrayWrap
procedure RemoveDistTPointArrayWrap(x, y, dist: Integer;const ThePoints: TPointArray; RemoveHigher: Boolean; var Res : TPointArray);
Finds the possible gaps in the TPointArray TPA and removes the gaps. Considers as a gap if the gap length is >= MinPixels and returns the result in the TPointArray Res
CombineTPAWrap
--------------
@ -539,6 +660,8 @@ CombineTPAWrap
procedure CombineTPAWrap(const Ar1, Ar2: TPointArray; var Res : TPointArray);
Attaches the TPointArray Ar2 onto the end of Ar1 and returns the result in the TPointArray Res
ReArrangeandShortenArrayExWrap
------------------------------
@ -547,6 +670,8 @@ ReArrangeandShortenArrayExWrap
procedure ReArrangeandShortenArrayExWrap(const a: TPointArray; w, h: Integer; var Res : TPointArray);
Results the TPointArray a with one point per box with side lengths W and H left and puts the result in Res
ReArrangeandShortenArrayWrap
----------------------------
@ -555,6 +680,8 @@ ReArrangeandShortenArrayWrap
procedure ReArrangeandShortenArrayWrap(const a: TPointArray; Dist: Integer; var Res : TPointArray);
Results the TPointArray a with one point per box with side length Dist left and puts the result in Res
TPAtoATPAExWrap
---------------
@ -563,6 +690,8 @@ TPAtoATPAExWrap
procedure TPAtoATPAExWrap(const TPA: TPointArray; w, h: Integer; var Res : T2DPointArray);
Splits the TPA to boxes with sidelengths W and H and results them as a T2DPointArray in Res
TPAtoATPAWrap
-------------
@ -571,6 +700,8 @@ TPAtoATPAWrap
procedure TPAtoATPAWrap(const TPA: TPointArray; Dist: Integer; var Res : T2DPointArray);
Splits the TPA to boxes with sidelength Dist and results them as a T2DPointArray in Res
CombineIntArrayWrap
-------------------
@ -579,6 +710,8 @@ CombineIntArrayWrap
procedure CombineIntArrayWrap(const Ar1, Ar2: TIntegerArray; var Res : TIntegerArray);
Attaches the TIntegerArray Ar2 onto the end of Ar1 and returns it in the TIntegerArray Res
ReturnPointsNotInTPAWrap
------------------------
@ -587,6 +720,8 @@ ReturnPointsNotInTPAWrap
procedure ReturnPointsNotInTPAWrap(Const TotalTPA: TPointArray; const Box: TBox; var Res : TPointArray);
All the points from the TPointArray TotalTPA that are not in the TBox Box are returned in the TPointArray Res
MergeATPAWrap
-------------
@ -595,6 +730,8 @@ MergeATPAWrap
procedure MergeATPAWrap(const ATPA : T2DPointArray; var Res: TPointArray);
Combines all the TPointArrays from the T2DPointArray ATPA into the TPointArray Res
TPAFromBoxWrap
--------------
@ -603,6 +740,8 @@ TPAFromBoxWrap
procedure TPAFromBoxWrap(const Box : TBox; var Res : TPointArray);
Create a TPointArray from the top left and the bottom right of the TBox Box and returns the result in Res
RotatePointsWrap
----------------
@ -611,6 +750,8 @@ RotatePointsWrap
procedure RotatePointsWrap(Const P: TPointArray; A, cx, cy: Extended; var Res : TPointArray);
Rotates the TPointArray P around the center cx, cy with the angle a and returns the result in Res
FindTPAEdgesWrap
----------------
@ -619,6 +760,8 @@ FindTPAEdgesWrap
procedure FindTPAEdgesWrap(const p: TPointArray; var Res : TPointArray);
Returns a TPointArray of the edge points of the TPointArray p and returns the result in the TPointArray Res
ClearTPAFromTPAWrap
-------------------
@ -627,6 +770,8 @@ ClearTPAFromTPAWrap
procedure ClearTPAFromTPAWrap(const arP, ClearPoints: TPointArray; var Res : TPointArray);
Removes the points in TPointArray ClearPoints from arP and returns the results in Res
SameTPA
-------
@ -635,6 +780,8 @@ SameTPA
function SameTPA(const aTPA, bTPA: TPointArray): Boolean;
Returns true if the TPointArray aTPA is the same as bTPA
TPAInATPA
---------
@ -643,6 +790,8 @@ TPAInATPA
function TPAInATPA(const TPA: TPointArray;const InATPA: T2DPointArray; var Index: LongInt): Boolean;
Returns true if the TPointArray TPA is found in the T2DPointArray InATPA and stores the index in Index
OffsetTPA
---------
@ -651,6 +800,8 @@ OffsetTPA
procedure OffsetTPA(var TPA : TPointArray; const Offset : TPoint);
Offsets all the TPAs int the TPointArray TPA but the TPoint Offset
OffsetATPA
----------
@ -659,6 +810,8 @@ OffsetATPA
procedure OffsetATPA(var ATPA : T2DPointArray; const Offset : TPoint);
Offsets all the TPAs int the T2DPointArray ATPA but the TPoint Offset
CopyTPA
-------
@ -667,6 +820,8 @@ CopyTPA
function CopyTPA(const TPA : TPointArray) : TPointArray;
Returns the TPointArray TPA
CopyATPA
--------
@ -675,4 +830,5 @@ CopyATPA
function CopyATPA(const ATPA : T2DPointArray) : T2DPointArray;
Returns the T2DPointArray ATPA

View File

@ -142,6 +142,8 @@ GetRawHeaders returns a string of headers from the specified client.
Socket Functions
----------------
Simba's Socket Functions. Examples required; if you have one, please let u know.
CreateSocket
~~~~~~~~~~~~
@ -190,7 +192,6 @@ ListenSocket
ListenSocket allows for a client socket to accept connections.
AcceptSocket
~~~~~~~~~~~~
@ -249,15 +250,15 @@ SendSocket
SendSocket sends a string of data to a bound client socket.
SetTimeout
SetSocketTimeout
~~~~~~~~~~
.. code-block:: pascal
procedure SetTimeout(Client, Time: integer);
procedure SetSocketTimeout(Client, Time: integer);
SetTimeout sets a maximum amount of time for a bound client socket to wait for
data from another socket.
data from another socket. Time is in *milliseconds*.
SocketInfo
~~~~~~~~~~

View File

@ -3,7 +3,6 @@
Documentation TODO
==================
* **WIP** - What's New. Changelog template added, fill it with stuff.
* *Wizzup* - Script manager (non technical).
* *Wizzup* - Script manager (technical).
* Extend "Getting Started". Include downloading scripts from the manager.

View File

@ -23,9 +23,10 @@ Simba crashes on start complaining about settings.xml
This means your settings.xml has become corrupt somehow, or Simba may not be
able to create it. If a settings.xml exists in your Simba directory, you can
delete it. (All your settings will be lost, but this shouldn't be a bug deal)
delete it. (All your settings will be lost, but this shouldn't be a big deal)
Note that this should no longer happen with Simba 750 and up.
..
..
TODO
Anything else?

View File

@ -1,3 +1,5 @@
.. _whatis:
What Is Simba?
==============
@ -22,4 +24,11 @@ Simba can:
and more. Start now by :ref:`installingsimba`.
Currently Simba is still in its beta stages; this includes the documentation.
You will probably notice some parts of the documentation aren't finished or are just
plain missing.
Simba is being updated almost every day. To see changes as they are added, view
https://github.com/MerlijnWajer/Simba.
If you want to know more about Simba, see :ref:`whysimba`

View File

@ -1,10 +0,0 @@
What's new in Simba?
====================
Currently Simba is still in its beta stages; this includes the documentation.
You will probably notice some parts of the documentation aren't finished or are just
plain missing.
Simba is being updated almost every day. To see changes as they are added, view
https://github.com/MerlijnWajer/Simba. Each commit should be explained
in one line, and the exact changes can be viewed with "commitdiff".

View File

@ -11,15 +11,15 @@ the open-mindedness of the Simba developers.
Free
~~~~
Simba is, and always will be free.
Simba is, and always will be free.
It is free as in Free Beer **and** Freedom.
Simba is 100% free to use. In fact, we welcome you to share it with the
Simba is 100% free to use. In fact, we welcome you to share it with the
rest of the world.
The source code to the program is freely available, under the GPL (v3) license.
The source code to the program is freely available, under the GPL (v3) license.
.. note::
.. note::
The source code allows everyone to see how the program actually
works. Most developers choose not to share their source code and therefore
decide to withhold knowledge. The Simba developers highly disagree with
@ -39,19 +39,19 @@ This way one can easily extend Simba. See :ref:`writing-simba-extensions`
Reliable
~~~~~~~~
Simba is actively maintained by a team of knowledgeable programmers.
Simba is actively maintained by a team of knowledgeable programmers.
We as a team do our best to make Simba into a quality product.
We as a team do our best to make Simba into a quality product.
However this does not guarantee a bug free program.
(Bug free programs don't exist)
Should you encounter a bug, please consider sending a bug report so we can
resolve the issue: :ref:`bugreport`.
try to resolve the issue: :ref:`bugreport`.
Cross Platform
~~~~~~~~~~~~~~
Simba has been written with freedom in mind and believes Simba
Simba has been written with freedom in mind and believes Simba
should not be limited to one platform, as that limits its users
to one platform as well.
@ -59,7 +59,7 @@ Currently the supported platforms are Windows and Linux with attempts
being made to port it to OSX (it may run on OSX if you install X11).
Even though we try hard to make Simba bug-free on all platforms,
some issues remain. The biggest issue is the interpreter that
some issues remain. The biggest issue is the interpreter that
executes your program. It is an external component and does not
play too well on Linux. Hopefully this will be improved upon soon.
@ -94,5 +94,4 @@ Well Documented
~~~~~~~~~~~~~~~
Simba is well documented. (You're looking the documentation right now...)
There is still a lot left to document but overall the documentation is pretty
good.
There is still a lot left to document though.

15
Extensions/extension.sex Normal file
View File

@ -0,0 +1,15 @@
program ExtUpdater;
{$I ..\Extensions\Updater.sei}
procedure Init;
var
EXT: integer;
begin
Settings.GetKeyValueDef('Extensions_Visible', 'false'); //Default Menu to be hidden =)
AddUpdater('Extensions', 'http://wizzup.org/static/srl/exten.tar.bz2',
'http://wizzup.org/static/srl/exten_version', ScriptPath + {$IFDEF WINDOWS}'\' {$ELSE}'/'{$ENDIF}, True, True, EXT);
end;
function GetName: string; begin Result := 'Extensions Updater'; end;
function GetVersion: string; begin Result := '0.1'; end;
begin end.

View File

@ -87,7 +87,7 @@ begin
HOST := HOSTDef;
if (InputQuery(GetName + ' ' + GetVersion + ' Extension', 'Which ID would you like to grab?', Data)) then
begin
if IntToStr(StrToInt(Data)) = Data then
if IntToStr(StrToIntDef(Data, -1)) = Data then
Data := '{"paste_id": ' + Data + '}'
else
Data := '{"paste_id": "' + Data + '"}';

View File

@ -8,9 +8,9 @@
AppId={{524C9B9A-B57F-4FEC-89BE-292202EBA44D}
AppName=Simba
AppVerName=Simba 0.97
AppPublisherURL=http://simba.villavu.com/
AppSupportURL=http://simba.villavu.com/
AppUpdatesURL=http://simba.villavu.com/
AppPublisherURL=http://wizzup.org/simba
AppSupportURL=http://wizzup.org/simba
AppUpdatesURL=http://wizzup.org/simba
DefaultDirName={sd}\Simba
DefaultGroupName=Simba
OutputDir=C:\simba\Install\windows\
@ -30,11 +30,12 @@ Name: "{app}\Extensions"
Name: "{app}\Includes"
Name: "{app}\Plugins"
Name: "{app}\Scripts"
Name: "{app}\Scripts\Tests"
; Name: "{app}\Scripts\Tests"
[Files]
Source: "C:\Simba\Simba.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Simba\Extensions\srl.sex"; DestDir: "{app}\Extensions"; Flags: ignoreversion
Source: "C:\Simba\Extensions\extension.sex"; DestDir: "{app}\Extensions"; Flags: ignoreversion
Source: "C:\Simba\Extensions\msi.sex"; DestDir: "{app}\Extensions"; Flags: ignoreversion
Source: "C:\Simba\Extensions\associate.sex"; DestDir: "{app}\Extensions"; Flags: ignoreversion
Source: "C:\Simba\Extensions\dtm_editor.sex"; DestDir: "{app}\Extensions"; Flags: ignoreversion
@ -43,8 +44,11 @@ Source: "C:\Simba\Extensions\paster.sex"; DestDir: "{app}\Extensions"; Flags: ig
Source: "C:\Simba\Extensions\CRov.sex"; DestDir: "{app}\Extensions"; Flags: ignoreversion
Source: "C:\Simba\Extensions\Updater.sei"; DestDir: "{app}\Extensions"; Flags: ignoreversion
Source: "C:\Simba\Includes\mml.simba"; DestDir: "{app}\Includes"; Flags: ignoreversion
Source: "C:\Simba\Fonts\*"; DestDir: "{app}\Fonts"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "C:\Simba\Tests\PS\*"; DestDir:"{app}\Scripts\Tests"; Flags: ignoreversion
; Source: "C:\Simba\settings.xml"; DestDir: "{app}\"; Flags: ignoreversion
; XXX Make sure to use a MINIMAL settings.xml XXX
; Source: "C:\Simba\Fonts\*"; DestDir: "{app}\Fonts"; Flags: ignoreversion recursesubdirs createallsubdirs
; Source: "C:\Simba\Tests\PS\*"; DestDir:"{app}\Scripts\Tests"; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons]

View File

@ -0,0 +1,154 @@
<?xml version="1.0"?>
<CONFIG>
<ProjectOptions>
<Version Value="9"/>
<General>
<Flags>
<MainUnitHasCreateFormStatements Value="False"/>
</Flags>
<MainUnit Value="0"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
<Icon Value="0"/>
<ActiveWindowIndexAtStart Value="0"/>
</General>
<i18n>
<EnableI18N LFM="False"/>
</i18n>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1" Active="Default">
<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|o|so);*~;backup"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
<LaunchingApplication PathPlusParams="/usr/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
</local>
</RunParams>
<RequiredPackages Count="1">
<Item1>
<PackageName Value="FCL"/>
</Item1>
</RequiredPackages>
<Units Count="5">
<Unit0>
<Filename Value="project1.lpr"/>
<IsPartOfProject Value="True"/>
<UnitName Value="project1"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="0"/>
<WindowIndex Value="0"/>
<TopLine Value="52"/>
<CursorPos X="3" Y="87"/>
<UsageCount Value="21"/>
<Loaded Value="True"/>
</Unit0>
<Unit1>
<Filename Value="../../Units/MMLAddon/plugins.pas"/>
<UnitName Value="plugins"/>
<EditorIndex Value="1"/>
<WindowIndex Value="0"/>
<TopLine Value="6"/>
<CursorPos X="26" Y="37"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit1>
<Unit2>
<Filename Value="../../../fpc/rtl/inc/dynlibs.pas"/>
<UnitName Value="dynlibs"/>
<WindowIndex Value="0"/>
<TopLine Value="1"/>
<CursorPos X="1" Y="1"/>
<UsageCount Value="10"/>
</Unit2>
<Unit3>
<Filename Value="../../Units/Linux/keybinder.pas"/>
<UnitName Value="keybinder"/>
<EditorIndex Value="2"/>
<WindowIndex Value="0"/>
<TopLine Value="1"/>
<CursorPos X="61" Y="24"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit3>
<Unit4>
<Filename Value="../../Units/Linux/xinput.pas"/>
<UnitName Value="xinput"/>
<EditorIndex Value="3"/>
<WindowIndex Value="0"/>
<TopLine Value="1"/>
<CursorPos X="1" Y="1"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit4>
</Units>
<JumpHistory Count="6" HistoryIndex="5">
<Position1>
<Filename Value="../../Units/MMLAddon/plugins.pas"/>
<Caret Line="37" Column="26" TopLine="27"/>
</Position1>
<Position2>
<Filename Value="project1.lpr"/>
<Caret Line="69" Column="17" TopLine="40"/>
</Position2>
<Position3>
<Filename Value="project1.lpr"/>
<Caret Line="16" Column="93" TopLine="1"/>
</Position3>
<Position4>
<Filename Value="project1.lpr"/>
<Caret Line="11" Column="10" TopLine="1"/>
</Position4>
<Position5>
<Filename Value="../../Units/MMLAddon/plugins.pas"/>
<Caret Line="37" Column="26" TopLine="6"/>
</Position5>
<Position6>
<Filename Value="project1.lpr"/>
<Caret Line="53" Column="3" TopLine="25"/>
</Position6>
</JumpHistory>
</ProjectOptions>
<CompilerOptions>
<Version Value="10"/>
<Target>
<Filename Value="project1"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<OtherUnitFiles Value="../../Units/MMLCore"/>
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Linking>
<Options>
<PassLinkerOptions Value="True"/>
</Options>
</Linking>
<Other>
<CompilerMessages>
<UseMsgFile Value="True"/>
</CompilerMessages>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>

View File

@ -0,0 +1,95 @@
program project1;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Classes, SysUtils, CustApp,
{ you can add units after this }
dynlibs;
const libSmart = 'smart';
procedure std_setup (ServerURL, SecondParam: PChar; sizeX, sizeY: Integer; SomeStr: PChar); cdecl; external libSmart;
type
{ TMyApplication }
TMyApplication = class(TCustomApplication)
protected
procedure DoRun; override;
public
constructor Create(TheOwner: TComponent); override;
destructor Destroy; override;
procedure WriteHelp; virtual;
end;
procedure LoadSmart;
begin
std_setup('http://world19.runescape.com/', 'plugin.js?param=o0,a1,m0', 765, 503, 's');
end;
{ TMyApplication }
procedure TMyApplication.DoRun;
var
ErrorMsg: String;
begin
// quick check parameters
ErrorMsg:=CheckOptions('h','help');
if ErrorMsg<>'' then begin
ShowException(Exception.Create(ErrorMsg));
Terminate;
Exit;
end;
// parse parameters
if HasOption('h','help') then begin
WriteHelp;
Terminate;
Exit;
end;
LoadSmart;
sleep(100000);
{ add your program here }
// stop program loop
Terminate;
end;
constructor TMyApplication.Create(TheOwner: TComponent);
begin
inherited Create(TheOwner);
StopOnException:=True;
end;
destructor TMyApplication.Destroy;
begin
inherited Destroy;
end;
procedure TMyApplication.WriteHelp;
begin
{ add your help code here }
writeln('Usage: ',ExeName,' -h');
end;
var
Application: TMyApplication;
//{$R *.res}
begin
Application:=TMyApplication.Create(nil);
Application.Run;
Application.Free;
end.

View File

@ -26,11 +26,13 @@
// See Units/Linux/keybinder.pas
{$ENDIF}
//{$DEFINE SIMBA_VERBOSE} // For more verbosity.
//{$DEFINE USE_RUTIS}
//{$DEFINE USE_CPASCAL} // TODO
//{$DEFINE USE_LAPE} // TODO
//{$DEFINE USE_EXTENSIONS}
{$DEFINE USE_EXTENSIONS}
//{$DEFINE USE_CODECOMPLETION} // TODO
//{$DEFINE TERMINALWRITELN} // Only used once. Remove from SimbaUnit?

View File

@ -35,20 +35,16 @@
<LaunchingApplication PathPlusParams="/usr/bin/gnome-terminal -t 'Lazarus Run Output' -e '$(LazarusDir)/tools/runwait.sh $(TargetCmdLine)'"/>
</local>
</RunParams>
<RequiredPackages Count="3">
<RequiredPackages Count="2">
<Item1>
<PackageName Value="LCLBase"/>
<MinVersion Major="1" Release="1" Valid="True"/>
</Item1>
<Item2>
<PackageName Value="SynEdit"/>
<MinVersion Major="1" Valid="True"/>
</Item2>
<Item3>
</Item1>
<Item2>
<PackageName Value="LCL"/>
</Item3>
</Item2>
</RequiredPackages>
<Units Count="48">
<Units Count="50">
<Unit0>
<Filename Value="Simba.lpr"/>
<IsPartOfProject Value="True"/>
@ -308,10 +304,19 @@
<IsPartOfProject Value="True"/>
<UnitName Value="os_linux"/>
</Unit47>
<Unit48>
<Filename Value="../../Units/MMLCore/tpa.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="tpa"/>
</Unit48>
<Unit49>
<Filename Value="../../Units/MMLAddon/PSInc/psexportedmethods.inc"/>
<IsPartOfProject Value="True"/>
</Unit49>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="10"/>
<Version Value="9"/>
<Target>
<Filename Value="../../Simba"/>
</Target>

View File

@ -33,7 +33,7 @@ uses
{$ENDIF}{$ENDIF}
Interfaces, Forms, SimbaUnit, colourhistory, About, internets, debugimage,
framefunctionlist, simpleanalyzer, updater, updateform, Simbasettings,
libloader, mufasabase, v_ideCodeInsight,
libloader, mufasabase, tpa, v_ideCodeInsight,
PSDump, v_ideCodeParser,
v_AutoCompleteForm, CastaliaPasLex, CastaliaPasLexTypes, CastaliaSimplePasPar,
CastaliaSimplePasParTypes, dcpbase64, mPasLex, v_Constants, v_MiscFunctions,

Binary file not shown.

View File

@ -65,6 +65,7 @@ begin
AboutMemo.Lines.Add(format('You are currently using version: %d',[SimbaUnit.SimbaVersion]));
AboutMemo.Lines.Add('');
AboutMemo.Lines.Add('Please report bugs at: http://bugs.villavu.com/');
AboutMemo.ReadOnly:= True;
end;
procedure TAboutForm.OkButtonClick(Sender: TObject);

View File

@ -110,6 +110,7 @@ begin
Width := DispSize.x;
Height := DispSize.y;
end;
FormStyle := fsStayOnTop;
end;
initialization

View File

@ -12,11 +12,11 @@ object FunctionListFrame: TFunctionListFrame
DesignTop = 200
object FunctionList: TTreeView
Left = 0
Height = 483
Top = 18
Height = 479
Top = 20
Width = 182
Align = alClient
DefaultItemHeight = 15
DefaultItemHeight = 17
ReadOnly = True
ScrollBars = ssAutoBoth
TabOrder = 0
@ -28,16 +28,19 @@ object FunctionListFrame: TFunctionListFrame
end
object editSearchList: TEdit
Left = 0
Height = 21
Top = 501
Height = 23
Hint = 'Search ...'
Top = 499
Width = 182
Align = alBottom
OnChange = editSearchListChange
ParentShowHint = False
ShowHint = True
TabOrder = 1
end
object FunctionListLabel: TLabel
Left = 2
Height = 14
Height = 16
Top = 2
Width = 178
Align = alTop
@ -55,7 +58,6 @@ object FunctionListFrame: TFunctionListFrame
Top = 2
Width = 16
Anchors = [akTop, akRight]
Color = clBtnFace
Flat = True
Glyph.Data = {
36090000424D3609000000000000360000002800000018000000180000000100

View File

@ -399,7 +399,7 @@ begin
end;
if InitScript then
mDebugLn('Init procedure succesfully called')
mDebugLn('Init procedure successfully called')
else
mDebugLn('Init procedure didn''t execute right, or couldn''t be found');
Enabled:= FWorking;

View File

@ -0,0 +1,74 @@
ssSettings = 'Settings/';
ssLastConfig = 'LastConfig/';
ssUpdater = 'Updater/';
ssFonts = 'Fonts/';
ssIncludes = 'Includes/';
ssInterpreter = 'Interpreter/';
ssTabs = 'Tabs/';
ssColourPicker = 'ColourPicker/';
ssScripts = 'Scripts/';
ssExtensions = 'Extensions/';
ssMainForm = 'MainForm/';
ssSourceEditor = 'SourceEditor/';
ssTray = 'Tray/';
ssConsole = 'Console/';
ssNews = 'News/';
ssPlugins = 'Plugins/';
ssCheckUpdate = ssSettings + ssUpdater + 'CheckForUpdates';
ssCheckUpdateMinutes = ssSettings + ssUpdater + 'CheckEveryXMinutes';
ssUpdaterLink = ssSettings + ssUpdater + 'RemoteLink';
ssUpdaterVersionLink = ssSettings + ssUpdater + 'RemoteVersionLink';
ssLoadFontsOnStart = ssSettings + ssFonts + 'LoadOnStartUp';
ssFontsVersion = ssSettings + ssFonts + 'Version';
ssFontsLink = ssSettings + ssFonts + 'UpdateLink';
ssFontsVersionLink = ssSettings + ssFonts + 'VersionLink';
ssFontsPath = ssSettings + ssFonts + 'Path';
ssIncludesPath = ssSettings + ssIncludes + 'Path';
ssInterpreterType = ssSettings + ssInterpreter + 'Type';
ssTabsOpenNextOnClose = ssSettings + ssTabs + 'OpenNextOnClose';
ssTabsOpenScriptInNewTab = ssSettings + ssTabs + 'OpenScriptInNewTab';
ssTabsCheckBeforeOpen = ssSettings + ssTabs + 'CheckTabsBeforeOpen';
ssColourPickerShowHistoryOnPick = ssSettings + ssColourPicker + 'ShowHistoryOnPick';
ssColourPickerAddToHistoryOnPick = ssSettings + ssColourPicker + 'AddToHistoryOnPick';
ssScriptsPath = ssSettings + ssScripts + 'Path';
ssCodeHintsShowAutomatically = ssSettings + 'CodeHints/ShowAutomatically';
ssCodeCompletionShowAutomatically = ssSettings + 'CodeCompletion/ShowAutomatically';
ssSourceEditorLazColors = ssSettings + ssSourceEditor + 'LazColors';
ssSourceEditorDefScriptPath = ssSettings + ssSourceEditor + 'DefScriptPath';
ssNewsLink = ssSettings + ssNews + 'URL';
ssPluginsPath = ssSettings + ssPlugins + 'Path';
ssExtensionsExtensionN = ssExtensions + 'Extension';
ssExtensionsPath = ssSettings + ssExtensions + 'Path';
ssExtensionsCount = ssExtensions + 'ExtensionCount';
ssExtensionsFileExtension = ssSettings + ssExtensions + 'FileExtension';
ssTrayAlwaysVisible = ssSettings + ssTray + 'AlwaysVisible';
ssConsoleVisible = ssLastConfig + ssConsole + 'Visible';
ssMainFormPosition = ssLastConfig + ssMainForm + 'Position';
ssMainFormState = ssLastConfig + ssMainForm + 'State';
ssMainFormNormalSize = ssSettings + ssMainForm + 'NormalSize';
ssFunctionListShown = ssLastConfig + ssMainForm + 'FunctionListShown';
ssFunctionListShowOnStart = ssSettings + 'FunctionList/ShowOnStart';
ssMaxRecentFiles = ssSettings + 'General/MaxRecentFiles';
ssRecentFiles = ssLastConfig + ssMainForm + 'RecentFiles';
ssRecentFilesCount = ssLastConfig + ssMainForm + 'RecentFiles/Count';
ssRecentFileN = ssLastConfig + ssMainForm + 'RecentFiles/File';

View File

@ -62,7 +62,7 @@ uses
settings, updater;
const
SimbaVersion = 830;
SimbaVersion = 972;
interp_PS = 0; //PascalScript
interp_RT = 1; //RUTIS
@ -82,6 +82,8 @@ const
shortcut_PickColourKey = VK_P;
{$ENDIF}
{$I settings_const.inc}
type
{ TMufasaTab }
@ -411,6 +413,7 @@ type
OpenFileData : TOpenFileData;
WriteFileData : TWriteFileData;
ScriptStartData : TScriptStartData;
procedure UpdateInterpreter;
procedure HandleConnectionData;
procedure HandleOpenFileData;
@ -767,7 +770,7 @@ end;
function TSimbaForm.GetInterpreter: Integer;
begin
result := StrToIntDef(LoadSettingDef('Settings/Interpreter/Type','0'),0);
result := StrToIntDef(LoadSettingDef(ssInterpreterType, '0'),0);
if (result < 0) or (result > 2) then
begin
SetInterpreter(0);
@ -777,12 +780,12 @@ end;
function TSimbaForm.GetDefScriptPath: string;
begin
result :=LoadSettingDef('Settings/SourceEditor/DefScriptPath', ExpandFileName(MainDir+DS+'default.simba'));
result :=LoadSettingDef(ssSourceEditorDefScriptPath, ExpandFileName(MainDir+DS+'default.simba'));
end;
function TSimbaForm.GetScriptPath: string;
begin
result :=IncludeTrailingPathDelimiter(LoadSettingDef('Settings/Scripts/Path', ExpandFileName(MainDir+DS+'Scripts' + DS)));
result :=IncludeTrailingPathDelimiter(LoadSettingDef(ssScriptsPath, ExpandFileName(MainDir+DS+'Scripts' + DS)));
end;
procedure TSimbaForm.HandleOpenFileData;
@ -991,7 +994,7 @@ var
begin
UpdateTimer.Interval:= MaxInt;
FontUpdate;
chk := LowerCase(LoadSettingDef('Settings/Updater/CheckForUpdates','True'));
chk := LowerCase(LoadSettingDef(ssCheckUpdate, 'True'));
if chk <> 'true' then
Exit;
@ -1007,7 +1010,7 @@ begin
mDebugLn(format('Current Simba version: %d',[SimbaVersion]));
mDebugLn('Latest Simba Version: ' + IntToStr(LatestVersion));
end;
time := StrToIntDef(LoadSettingDef('Settings/Updater/CheckEveryXMinutes','30'),30);
time := StrToIntDef(LoadSettingDef(ssCheckUpdateMinutes, '30'),30);
UpdateTimer.Interval:= time {mins} * 60 {secs} * 1000 {ms};//Every half hour
end;
@ -1153,7 +1156,7 @@ begin
OldIndex := PageControl1.TabIndex;
if TabIndex = OldIndex then
begin;
if lowercase(LoadSettingDef('Settings/Tabs/OpenNextOnClose','False')) = 'false' then
if lowercase(LoadSettingDef(ssTabsOpenNextOnClose, 'False')) = 'false' then
OldIndex := LastTab //We are closing the 'current' tab, lets go back in history
else
OldIndex := Min(Tabs.Count - 1,OldIndex + 1);
@ -1363,43 +1366,52 @@ procedure TSimbaForm.CreateDefaultEnvironment;
var
PluginsPath,extensionsPath : string;
begin
CreateSetting('Settings/Updater/CheckForUpdates','True');
CreateSetting('Settings/Updater/CheckEveryXMinutes','30');
CreateSetting('Settings/Interpreter/Type', '0');
CreateSetting('Settings/Fonts/LoadOnStartUp', 'True');
CreateSetting('Settings/Fonts/Version','-1');
CreateSetting('Settings/Tabs/OpenNextOnClose','False');
CreateSetting('Settings/Tabs/OpenScriptInNewTab','True');
CreateSetting('Settings/Tabs/CheckTabsBeforeOpen','True');
CreateSetting('Settings/ColourPicker/ShowHistoryOnPick', 'True');
CreateSetting('Settings/General/MaxRecentFiles','10');
CreateSetting('Settings/MainForm/NormalSize','739:555');
CreateSetting('Settings/FunctionList/ShowOnStart','True');
CreateSetting('Settings/CodeHints/ShowAutomatically','True');
CreateSetting('Settings/CodeCompletion/ShowAutomatically','True');
CreateSetting('Settings/SourceEditor/LazColors','True');
{$IFDEF USE_EXTENSIONS}CreateSetting('Settings/Extensions/FileExtension','sex');{$ENDIF}
CreateSetting(ssCheckUpdate, 'True');
CreateSetting(ssCheckUpdateMinutes, '30');
CreateSetting(ssInterpreterType, '0');
CreateSetting(ssLoadFontsOnStart, 'True');
CreateSetting(ssFontsVersion, '-1');
CreateSetting(ssTabsOpenNextOnClose, 'False');
CreateSetting(ssTabsOpenScriptInNewTab, 'True');
CreateSetting(ssTabsCheckBeforeOpen, 'True');
CreateSetting(ssColourPickerShowHistoryOnPick, 'True');
CreateSetting(ssMaxRecentFiles, '10');
CreateSetting(ssMainFormNormalSize, '739:555');
CreateSetting(ssFunctionListShowOnStart, 'True');
CreateSetting(ssCodeHintsShowAutomatically, 'True');
CreateSetting(ssCodeCompletionShowAutomatically, 'True');
CreateSetting(ssSourceEditorLazColors, 'True');
CreateSetting('Settings/Updater/RemoteLink',SimbaURL + 'Simba'{$IFDEF WINDOWS} +'.exe'{$ENDIF});
CreateSetting('Settings/Updater/RemoteVersionLink',SimbaURL + 'Version');
CreateSetting('Settings/Fonts/VersionLink', FontURL + 'Version');
CreateSetting('Settings/Fonts/UpdateLink', FontURL + 'Fonts.tar.bz2');
{$IFDEF USE_EXTENSIONS}
CreateSetting(ssExtensionsFileExtension, 'sex');
{$ENDIF}
CreateSetting('Settings/News/URL', 'http://simba.villavu.com/bin/news');
CreateSetting(ssUpdaterLink, SimbaURL + 'Simba'{$IFDEF WINDOWS} +'.exe'{$ENDIF});
CreateSetting(ssUpdaterVersionLink, SimbaURL + 'Version');
CreateSetting(ssFontsVersionLink, FontURL + 'Version');
CreateSetting(ssFontsLink, FontURL + 'Fonts.tar.bz2');
CreateSetting(ssNewsLink, 'http://simba.villavu.com/bin/news');
{Creates the paths and returns the path}
PluginsPath := CreateSetting('Settings/Plugins/Path', ExpandFileName(MainDir+ DS+ 'Plugins' + DS));
PluginsPath := CreateSetting(ssPluginsPath, ExpandFileName(MainDir + DS + 'Plugins' + DS));
{$IFDEF USE_EXTENSIONS}
extensionsPath := CreateSetting('Settings/Extensions/Path',ExpandFileName(MainDir +DS + 'Extensions' + DS));
CreateSetting('Extensions/ExtensionCount','0');
extensionsPath := CreateSetting(ssExtensionsPath,
ExpandFileName(MainDir +DS + 'Extensions' + DS));
CreateSetting(ssExtensionsCount, '0');
{$ENDIF}
CreateSetting('LastConfig/MainForm/Position','');
CreateSetting('LastConfig/MainForm/State','Normal');
CreateSetting(ssMainFormPosition, '');
CreateSetting(ssMainFormState, 'Normal');
{$ifdef MSWindows}
CreateSetting('LastConfig/Console/Visible','False');
CreateSetting(ssConsoleVisible, 'False');
ShowConsole(False);
{$endif}
CreateSetting('Settings/Tray/AlwaysVisible', 'True');
CreateSetting(ssTrayAlwaysVisible, 'True');
if not DirectoryExists(IncludePath) then
CreateDir(IncludePath);
if not DirectoryExists(FontPath) then
@ -1428,7 +1440,7 @@ var
i,ii : integer;
begin
self.BeginFormUpdate;
str := LoadSettingDef('LastConfig/MainForm/Position','');
str := LoadSettingDef(ssMainFormPosition, '');
if str <> '' then
begin;
Data := Explode(':',str);
@ -1439,36 +1451,38 @@ begin
Self.Width:= StrToIntDef(Data[2],self.width);
Self.Height:= StrToIntDef(Data[3],self.height);
end;
str := lowercase(LoadSettingDef('LastConfig/MainForm/State','Normal'));
str := lowercase(LoadSettingDef(ssMainFormState, 'Normal'));
if str = 'maximized' then
self.windowstate := wsMaximized
else
// if str = 'normal' then
Self.WindowState := wsNormal;
if SettingExists('LastConfig/MainForm/RecentFiles/Count') then
if SettingExists(ssRecentFilesCount) then
begin;
ii := StrToIntDef(LoadSettingDef('LastConfig/MainForm/RecentFiles/Count','-1'),-1);
ii := StrToIntDef(LoadSettingDef(ssRecentFilesCount, '-1'), -1);
for i := 0 to ii do
begin
str := LoadSettingDef('LastConfig/MainForm/RecentFiles/File' + inttostr(I),'');
str := LoadSettingDef(ssRecentFileN + inttostr(I),'');
if str <> '' then
AddRecentFile(str);
end;
end;
str := LowerCase(LoadSettingDef('Settings/FunctionList/ShowOnStart','True'));
str2 := lowercase(LoadSettingDef('LastConfig/MainForm/FunctionListShown',''));
str := LowerCase(LoadSettingDef(ssFunctionListShowOnStart, 'True'));
str2 := lowercase(LoadSettingDef(ssFunctionListShown, ''));
if (str = 'true') or (str2 = 'true') then
FunctionListShown(True)
else
FunctionListShown(false);
{$ifdef MSWindows}
str := LowerCase(LoadSettingDef('LastConfig/Console/Visible','True'));
str := LowerCase(LoadSettingDef(ssConsoleVisible, 'True'));
if str = 'true' then
ShowConsole(True)
else
ShowConsole(false);
{$endif}
if Lowercase(LoadSettingDef('Settings/Tray/AlwaysVisible', 'True')) <> 'true' then
if Lowercase(LoadSettingDef(ssTrayAlwaysVisible, 'True')) <> 'true' then
begin
MTrayIcon.Hide;
writeln('Hiding tray.');
@ -1487,36 +1501,36 @@ begin
with SettingsForm.Settings do
begin
if Self.WindowState = wsMaximized then
SetSetting('LastConfig/MainForm/State','maximized')
SetSetting(ssMainFormState, 'maximized')
else
begin; //Only save the form position if its not maximized.
SetSetting('LastConfig/MainForm/State','normal');
SetSetting(ssMainFormState, 'normal');
Data := ConvArr([inttostr(Self.left),inttostr(self.top),inttostr(self.width),inttostr(self.height)]);
SetSetting('LastConfig/MainForm/Position', Implode(':',Data ));
SetSetting(ssMainFormPosition, Implode(':',Data ));
end;
DeleteKey('LastConfig/MainForm/RecentFiles');
DeleteKey(ssRecentFiles);
if RecentFiles.Count > 0 then
begin
SetSetting('LastConfig/MainForm/RecentFiles/Count',inttostr(RecentFiles.Count));
SetSetting(ssRecentFiles + '/Count', inttostr(RecentFiles.Count));
SetLength(data,RecentFiles.Count);
for i := 0 to RecentFiles.Count - 1 do
SetSetting('LastConfig/MainForm/RecentFiles/File'+inttostr(i),RecentFiles[i]);
SetSetting(ssRecentFileN + inttostr(i),RecentFiles[i]);
end;
if MenuItemFunctionList.Checked then
SetSetting('LastConfig/MainForm/FunctionListShown','True')
SetSetting(ssFunctionListShown, 'True')
else
SetSetting('LastConfig/MainForm/FunctionListShown','False');
SetSetting(ssFunctionListShown, 'False');
{$ifdef MSWindows}
if ConsoleVisible then
SetSetting('LastConfig/Console/Visible','True')
SetSetting(ssConsoleVisible, 'True')
else
SetSetting('LastConfig/Console/Visible','False');
SetSetting(ssConsoleVisible, 'False');
{$endif}
{$IFDEF USE_EXTENSIONS}
SetSetting('Extensions/ExtensionCount',inttostr(ExtManager.Extensions.Count));
SetSetting(ssExtensionsCount, inttostr(ExtManager.Extensions.Count));
for i := 0 to ExtManager.Extensions.Count-1 do
begin;
path :='Extensions/Extension' + inttostr(I);
path := ssExtensionsExtensionN + inttostr(I);
SetSetting(Path + '/Path',TVirtualSimbaExtension(ExtManager.Extensions[i]).Filename);
SetSetting(Path + '/Enabled',BoolToStr(TVirtualSimbaExtension(ExtManager.Extensions[i]).Enabled,True));
end;
@ -1538,7 +1552,7 @@ var
result := false;
if (number < 0) or (number >= extCount) then
exit;
path := 'Extensions/Extension' + inttostr(number);
path := ssExtensionsExtensionN + inttostr(number);
if SettingExists(Path) = false then
exit;
ExtPath := LoadSettingDef(Path + '/Path','');
@ -1554,11 +1568,11 @@ var
i : integer;
path : string;
begin;
path := 'Extensions/Extension';
path := ssExtensionsExtensionN;
SettingsForm.Settings.DeleteKey(path + inttostr(number));
for i := number + 1 to extCount - 1 do
SettingsForm.Settings.RenameKey(path + inttostr(i),'Extension' + inttostr(i-1));
SetSetting('Extensions/ExtensionCount',inttostr(extCount - 1),true);
SetSetting(ssExtensionsCount, inttostr(extCount - 1),true);
dec(extCount);
end;
@ -1566,13 +1580,13 @@ var
str,str2 : string;
i : integer;
begin
extCount := StrToIntDef(LoadSettingDef('Extensions/ExtensionCount/','0'),0);
extCount := StrToIntDef(LoadSettingDef(ssExtensionsCount, '0'),0);
for i := 0 to extCount - 1 do
while (i < extCount) and not LoadExtension(i) do
DeleteExtension(i);
SetSetting('Extensions/ExtensionCount',inttostr(extCount));
str := LoadSettingDef('Settings/Extensions/Path',ExpandFileName(MainDir +DS + 'Extensions' + DS));
str2 := LoadSettingDef('Settings/Extensions/FileExtension','sex');
SetSetting(ssExtensionsCount, inttostr(extCount));
str := LoadSettingDef(ssExtensionsPath, ExpandFileName(MainDir +DS + 'Extensions' + DS));
str2 := LoadSettingDef(ssExtensionsFileExtension, 'sex');
ExtManager.LoadPSExtensionsDir(str,str2);
{$ELSE}
begin
@ -1584,7 +1598,7 @@ var
MaxRecentFiles : integer;
Len,i : integer;
begin
MaxRecentFiles:= StrToIntDef(LoadSettingDef('Settings/General/MaxRecentFiles','10'),10);
MaxRecentFiles:= StrToIntDef(LoadSettingDef(ssMaxRecentFiles, '10'), 10);
i := RecentFiles.IndexOf(filename);
if i <> -1 then
RecentFiles.Delete(i);
@ -1673,7 +1687,7 @@ begin
if selector.haspicked then
Thread.Client.IOManager.SetTarget(Selector.LastPick);
loadFontsOnScriptStart := (lowercase(LoadSettingDef('Settings/Fonts/LoadOnStartUp', 'True')) = 'true');
loadFontsOnScriptStart := (lowercase(LoadSettingDef(ssLoadFontsOnStart, 'True')) = 'true');
if (loadFontsOnScriptStart) then
begin
@ -1929,12 +1943,12 @@ var
SizeStr : string;
Data : TStringArray;
begin
SizeStr := LoadSettingDef('Settings/MainForm/NormalSize','739:555');
SizeStr := LoadSettingDef(ssMainFormNormalSize, '739:555');
Data := Explode(':',SizeStr);
if length(Data) = 2 then
begin
Self.Width:= StrToIntDef(Data[0],739);
Self.Height:= StrToIntDef(Data[1],555);
Self.Width:= StrToIntDef(Data[0], 739);
Self.Height:= StrToIntDef(Data[1], 555);
end else
begin;
self.width := 739;
@ -2811,7 +2825,7 @@ end;
procedure TSimbaForm.MTrayIconClick(Sender: TObject);
begin
self.Show;
if Lowercase(LoadSettingDef('Settings/Tray/AlwaysVisible', 'True')) <> 'true' then
if Lowercase(LoadSettingDef(ssTrayAlwaysVisible, 'True')) <> 'true' then
MTrayIcon.Hide;
if Self.CanFocus then
self.SetFocus;
@ -2821,7 +2835,7 @@ function TSimbaForm.GetSimbaNews: String;
var
t: TDownloadThread;
begin
t := TDownloadThread.Create(LoadSettingDef('Settings/News/URL', 'http://Simba.villavu.com/bin/news'),
t := TDownloadThread.Create(LoadSettingDef(ssNewsLink, 'http://Simba.villavu.com/bin/news'),
@Result);
t.Resume;
while not t.done do
@ -2833,13 +2847,13 @@ end;
procedure TSimbaForm.SetDefScriptPath(const AValue: string);
begin
SetSetting('Settings/SourceEditor/DefScriptPath',AValue,True);
SetSetting(ssSourceEditorDefScriptPath, AValue,True);
end;
{$IFDEF USE_EXTENSIONS}
procedure TSimbaForm.SetExtPath(const AValue: string);
begin
SetSetting('Settings/Extensions/Path',AValue,true);
SetSetting(ssExtensionsPath, AValue,true);
end;
{$ENDIF}
@ -2871,14 +2885,19 @@ var
c, x, y: Integer;
cobj: TColourPickerObject;
begin
if Picker.Picking then
begin
formWriteln('Error: Already picking a colour');
exit;
end;
Picker.Pick(c, x, y);
cobj := TColourPickerObject.Create(c, Classes.Point(x,y), '');
{ TODO: This should be no problem if the form is hidden? }
if lowercase(LoadSettingDef('Settings/ColourPicker/AddToHistoryOnPick', 'True')) = 'true' then
if lowercase(LoadSettingDef(ssColourPickerAddToHistoryOnPick, 'True')) = 'true' then
ColourHistoryForm.AddColObj(cobj, true);
if lowercase(LoadSettingDef('Settings/ColourPicker/ShowHistoryOnPick', 'True')) = 'true' then
if lowercase(LoadSettingDef(ssColourPickerShowHistoryOnPick, 'True')) = 'true' then
ColourHistoryForm.Show;
FormWritelnEx('Picked colour: ' + inttostr(c) + ' at (' + inttostr(x) + ', ' + inttostr(y) + ')');
@ -2998,34 +3017,34 @@ end;
function TSimbaForm.GetShowParamHintAuto: boolean;
begin
Result := LowerCase(LoadSettingDef('Settings/CodeHints/ShowAutomatically','True')) = 'true';
Result := LowerCase(LoadSettingDef(ssCodeHintsShowAutomatically, 'True')) = 'true';
end;
function TSimbaForm.GetShowCodeCompletionAuto: boolean;
begin
Result := LowerCase(LoadSettingDef('Settings/CodeCompletion/ShowAutomatically','True')) = 'true';
Result := LowerCase(LoadSettingDef(ssCodeCompletionShowAutomatically, 'True')) = 'true';
end;
procedure TSimbaForm.SetFontPath(const AValue: String);
begin
SetSetting('Settings/Fonts/Path',AValue,true);
SetSetting(ssFontsPath, AValue,true);
end;
function TSimbaForm.GetFontPath: String;
begin
Result := IncludeTrailingPathDelimiter(LoadSettingDef('Settings/Fonts/Path', ExpandFileName(MainDir+DS+'Fonts' + DS)));
Result := IncludeTrailingPathDelimiter(LoadSettingDef(ssFontsPath, ExpandFileName(MainDir+DS+'Fonts' + DS)));
end;
{$IFDEF USE_EXTENSIONS}
function TSimbaForm.GetExtPath: string;
begin
Result := IncludeTrailingPathDelimiter(LoadSettingDef('Settings/Extensions/Path', ExpandFileName(MainDir+DS+'Extensions' + DS)));
Result := IncludeTrailingPathDelimiter(LoadSettingDef(ssExtensionsPath, ExpandFileName(MainDir+DS+'Extensions' + DS)));
end;
{$ENDIF}
function TSimbaForm.GetHighlighter: TSynCustomHighlighter;
begin
if lowercase(LoadSettingDef('Settings/SourceEditor/LazColors','True')) = 'true' then
if lowercase(LoadSettingDef(ssSourceEditorLazColors, 'True')) = 'true' then
result := LazHighlighter
else
result := SCARHighlighter;
@ -3033,17 +3052,17 @@ end;
function TSimbaForm.GetIncludePath: String;
begin
Result := IncludeTrailingPathDelimiter(LoadSettingDef('Settings/Includes/Path', ExpandFileName(MainDir+DS+'Includes' + DS)));
Result := IncludeTrailingPathDelimiter(LoadSettingDef(ssIncludesPath, ExpandFileName(MainDir+DS+'Includes' + DS)));
end;
function TSimbaForm.GetPluginPath: string;
begin
Result := IncludeTrailingPathDelimiter(LoadSettingDef('Settings/Plugins/Path', ExpandFileName(MainDir+DS+'Plugins' + DS)));
Result := IncludeTrailingPathDelimiter(LoadSettingDef(ssPluginsPath, ExpandFileName(MainDir+DS+'Plugins' + DS)));
end;
procedure TSimbaForm.SetIncludePath(const AValue: String);
begin
SetSetting('Settings/Includes/Path',AValue,true);
SetSetting(ssIncludesPath, AValue,true);
end;
procedure TSimbaForm.SetInterpreter(const AValue: Integer);
@ -3055,7 +3074,7 @@ begin
with CurrScript.Synedit do
if (Lines.text = DefaultScript) and not(CanUndo or CanRedo) then
UpdateCurrScript := true;
SetSetting('Settings/Interpreter/Type',Inttostr(AValue),true);
SetSetting(ssInterpreterType, Inttostr(AValue),true);
UpdateInterpreter;
if UpdateCurrScript then
CurrScript.SynEdit.Lines.text := DefaultScript;
@ -3063,12 +3082,12 @@ end;
procedure TSimbaForm.SetPluginPath(const AValue: string);
begin
SetSetting('Settings/Plugins/Path',AValue,true);
SetSetting(ssPluginsPath, AValue,true);
end;
procedure TSimbaForm.SetScriptPath(const AValue: string);
begin
SetSetting('Settings/Scripts/Path',AValue,True);
SetSetting(ssScriptsPath, AValue,True);
end;
procedure TSimbaForm.SetScriptState(const State: TScriptState);
@ -3141,12 +3160,12 @@ begin
if UpdatingFonts then
exit;
UpdatingFonts := True;
CurrVersion := StrToIntDef(LoadSettingDef('Settings/Fonts/Version','-1'),-1);
CurrVersion := StrToIntDef(LoadSettingDef(ssFontsVersion, '-1'), -1);
LatestVersion := SimbaUpdateForm.GetLatestFontVersion;
if LatestVersion > CurrVersion then
begin;
formWriteln(format('New fonts available. Current version: %d. Latest version: %d',[CurrVersion,LatestVersion]));
FontDownload := TDownloadThread.Create(LoadSettingDef('Settings/Fonts/UpdateLink',FontURL + 'Fonts.tar.bz2'),
FontDownload := TDownloadThread.Create(LoadSettingDef(ssFontsLink, FontURL + 'Fonts.tar.bz2'),
@Fonts);
FontDownload.resume;
while FontDownload.Done = false do
@ -3166,8 +3185,8 @@ begin
Idler;
if UnTarrer.Result then
begin;
FormWriteln('Succesfully installed the new fonts!');
SetSetting('Settings/Fonts/Version',IntToStr(LatestVersion),true);
FormWriteln('Successfully installed the new fonts!');
SetSetting(ssFontsVersion, IntToStr(LatestVersion),true);
if Assigned(self.OCR_Fonts) then
self.OCR_Fonts.Free;
FormWriteln('Freeing the current fonts. Creating new ones now');
@ -3196,12 +3215,12 @@ end;
procedure TSimbaForm.SetShowParamHintAuto(const AValue: boolean);
begin
SetSetting('Settings/CodeHints/ShowAutomatically', Booltostr(AValue,true));
SetSetting(ssCodeHintsShowAutomatically, Booltostr(AValue,true));
end;
procedure TSimbaForm.SetShowCodeCompletionAuto(const AValue: boolean);
begin
SetSetting('Settings/CodeCompletion/ShowAutomatically', Booltostr(AValue,true));
SetSetting(ssCodeCompletionShowAutomatically, Booltostr(AValue,true));
end;
{$ifdef mswindows}
@ -3329,7 +3348,7 @@ var
OpenInNewTab : boolean;
begin
Result := False;
OpenInNewTab:= (LowerCase(LoadSettingDef('Settings/Tabs/OpenScriptInNewTab','True')) = 'true');
OpenInNewTab:= (LowerCase(LoadSettingDef(ssTabsOpenScriptInNewTab, 'True')) = 'true');
if not OpenInNewTab then
if CanExitOrOpen = false then
Exit;
@ -3341,7 +3360,7 @@ begin
InitialDir := ScriptDir;
Options := [ofAllowMultiSelect, ofExtensionDifferent, ofPathMustExist, ofFileMustExist, ofEnableSizing, ofViewDetail];
Filter:= 'Simba Files|*.simba;*.simb;*.cogat;*.mufa;*.txt' +
{$IFDEF USE_EXTENSIONS}';*.' + LoadSettingDef('Settings/Extensions/FileExtension', 'sex') + {$ENDIF}
{$IFDEF USE_EXTENSIONS}';*.' + LoadSettingDef(ssExtensionsFileExtension, 'sex') + {$ENDIF}
'|Any files|*.*';
if Execute then
begin
@ -3370,11 +3389,11 @@ begin
if AlwaysOpenInNewTab then
OpenInNewTab := true
else
OpenInNewTab:= (LowerCase(LoadSettingDef('Settings/Tabs/OpenScriptInNewTab','True')) = 'true');
OpenInNewTab:= (LowerCase(LoadSettingDef(ssTabsOpenScriptInNewTab,'True')) = 'true');
if CheckOtherTabs then
CheckTabsFirst := True
else
CheckTabsFirst := (Lowercase(LoadSettingDef('Settings/Tabs/CheckTabsBeforeOpen','True')) = 'true');
CheckTabsFirst := (Lowercase(LoadSettingDef(ssTabsCheckBeforeOpen, 'True')) = 'true');
if FileExistsUTF8(FileName) then
begin;
if CheckTabsFirst then
@ -3449,7 +3468,7 @@ begin
else
InitialDir := ScriptDir;
filter := 'Simba Files|*.simba;*.simb;*.cogat;*.mufa;*.txt' +
{$IFDEF USE_EXTENSIONS}';*.' + LoadSettingDef('Settings/Extensions/FileExtension','sex') + {$ENDIF}
{$IFDEF USE_EXTENSIONS}';*.' + LoadSettingDef(ssExtensionsFileExtension, 'sex') + {$ENDIF}
'|Any files|*.*';
if Execute then
begin;

View File

@ -241,7 +241,8 @@ begin
FCancelling := False;
FCancelled := True;
DownloadSpeed.Visible := false;
Self.UpdateLog.Lines.Add('Download stopped at '+inttostr(DownloadProgress.Position)+'%... Simba did not succesfully update.');
Self.UpdateLog.Lines.Add('Download stopped at '+inttostr(DownloadProgress.Position)+
'%... Simba did not successfully update.');
// more detailed info
mDebugLn('EXCEPTION IN UPDATEFORM: We either hit Cancel, or something went wrong with files');
if FileExists(Updater.BasePath + Updater.ReplacementFile + '_') then
@ -251,7 +252,8 @@ begin
end;
end;
FDone := True;
Self.UpdateButton.Caption := 'Update!';
Self.UpdateButton.Caption := 'Updated!';
Self.UpdateButton.Enabled := False;
Self.CloseButton.Enabled := true;
FUpdating:= false;
end;

View File

@ -15,6 +15,11 @@ Const
MOUSE_UP = 0;
MOUSE_DOWN = 1;
{
Global variables.
To actually read the last_error, make sure you copy it to a safe place
directly after the function call.
}
var
last_error: String;
debug: boolean;
@ -23,28 +28,28 @@ var
function init: integer; cdecl;
begin
last_error := '';
debug := true;
result := RESULT_OK;
last_error := '';
debug := true;
result := RESULT_OK;
end;
procedure set_last_error(s: string);
begin
last_error := s;
if debug then
writeln('ERROR: ' + s);
last_error := s;
if debug then
writeln('ERROR: ' + s);
end;
{ Validate the TClient. If it is NULL, set last error and return false }
function validate_client(C: TClient): boolean; inline;
begin
result := Assigned(C);
if not result then
begin
last_error := 'PClient is NULL';
if debug then
writeln(last_error);
end;
result := Assigned(C);
if not result then
begin
last_error := 'PClient is NULL';
if debug then
writeln(last_error);
end;
end;
{
@ -55,42 +60,42 @@ function create_client: PtrUInt; cdecl;
var
C: TClient;
begin
try
C := TClient.Create('');
Result := PtrUInt(C);
except on e : Exception do
begin
// FIXME UINT negative
result := PtrUInt(RESULT_ERROR);
set_last_error(e.message);
end;
end;
writeln(format('C: %d, IOManager: %d', [PtrUInt(C), PtrUInt(C.IOManager)]));
try
C := TClient.Create('');
Result := PtrUInt(C);
except on e : Exception do
begin
// FIXME UINT negative
result := PtrUInt(RESULT_ERROR);
set_last_error(e.message);
end;
end;
writeln(format('C: %d, IOManager: %d', [PtrUInt(C), PtrUInt(C.IOManager)]));
end;
{ Destroy a TClient }
function destroy_client(C: TClient): integer; cdecl;
begin
try
C.Free;
except on e : Exception do
begin
result := RESULT_ERROR;
set_last_error(e.message);
end;
end;
try
C.Free;
except on e : Exception do
begin
result := RESULT_ERROR;
set_last_error(e.message);
end;
end;
end;
{ Set (verbose) debug on/off }
procedure set_debug(v: Boolean); cdecl;
begin
debug := v;
debug := v;
end;
{ Get debug }
function get_debug: boolean; cdecl;
begin
exit(debug);
exit(debug);
end;
{
@ -101,40 +106,40 @@ end;
}
function get_last_error: pchar; cdecl;
begin
exit(@last_error[1]);
exit(@last_error[1]);
end;
{ Turn an array into a pointer. The pointer memory is not managed by FPC, so we can pass
it along happily. It'll have to be freed by the external control though }
function array_to_ptr(ptr: Pointer; size: PtrUInt; objsize: PtrUInt): Pointer; cdecl;
begin
result := GetMem(objsize * size);
Move(ptr^, result^, objsize * size);
result := GetMem(objsize * size);
Move(ptr^, result^, objsize * size);
end;
{ Free memory previously allocated by libMML }
function free_ptr(ptr: pointer): boolean; cdecl;
begin
result := Assigned(ptr);
if not result then
begin
set_last_error('TClient is NULL');
if debug then
writeln(last_error);
end else
FreeMem(ptr);
result := Assigned(ptr);
if not result then
begin
set_last_error('TClient is NULL');
if debug then
writeln(last_error);
end else
FreeMem(ptr);
end;
{ Allocate memory with libMML }
function alloc_mem(size, objsize: PtrUInt): Pointer; cdecl;
begin
result := GetMem(size * objsize);
result := GetMem(size * objsize);
end;
{ Reallocate memory with libMML }
function realloc_mem(ptr: Pointer; size, objsize: PtrUInt): Pointer; cdecl;
begin
result := ReAllocMem(ptr, size*objsize);
result := ReAllocMem(ptr, size*objsize);
end;
{ Mouse }
@ -143,34 +148,32 @@ end;
function get_mouse_pos(C: TClient; var t: tpoint): integer; cdecl;
begin
if not validate_client(C) then
if not validate_client(C) then
exit(RESULT_ERROR);
try
C.IOManager.GetMousePos(t.x,t.y);
result := RESULT_OK;
except on e : Exception do
begin
exit(RESULT_ERROR);
end;
try
C.IOManager.GetMousePos(t.x,t.y);
result := RESULT_OK;
except on e : Exception do
begin
result := RESULT_ERROR;
set_last_error(e.Message);
end;
result := RESULT_ERROR;
set_last_error(e.Message);
end;
end;
end;
{ Set mouse position of client C to point t }
function set_mouse_pos(C: TClient; var t: tpoint): integer; cdecl;
begin
try
C.IOManager.MoveMouse(t.x,t.y);
result := RESULT_OK;
except on e : Exception do
try
C.IOManager.MoveMouse(t.x,t.y);
result := RESULT_OK;
except on e : Exception do
begin
result := RESULT_ERROR;
set_last_error(e.Message);
end;
end;
end;
end;
@ -187,38 +190,38 @@ end;
{ Return the state of a mouse button given client C }
function get_mouse_button_state(C: TClient; But: Integer): Integer; cdecl;
begin
try
if C.IOManager.IsMouseButtonDown(ConvIntClickType(But)) then
result := MOUSE_DOWN
else
result := MOUSE_UP;
except on e : Exception do
try
if C.IOManager.IsMouseButtonDown(ConvIntClickType(But)) then
result := MOUSE_DOWN
else
result := MOUSE_UP;
except on e : Exception do
begin
result := RESULT_ERROR;
set_last_error(e.Message);
end;
result := RESULT_ERROR;
set_last_error(e.Message);
end;
end;
end;
{ Set the state of a mouse button given client C }
function set_mouse_button_state(C: TClient; But, State, X, Y: Integer): Integer; cdecl;
begin
try
if State = MOUSE_UP then
begin
C.IOManager.ReleaseMouse(X, Y, ConvIntClickType(But));
result := RESULT_OK;
end else if state = MOUSE_DOWN then
begin
C.IOManager.HoldMouse(X, Y, ConvIntClickType(But));
result := RESULT_OK;
end;
except on e : Exception do
try
if State = MOUSE_UP then
begin
result := RESULT_ERROR;
set_last_error(e.Message);
C.IOManager.ReleaseMouse(X, Y, ConvIntClickType(But));
result := RESULT_OK;
end else if state = MOUSE_DOWN then
begin
C.IOManager.HoldMouse(X, Y, ConvIntClickType(But));
result := RESULT_OK;
end;
except on e : Exception do
begin
result := RESULT_ERROR;
set_last_error(e.Message);
end;
end;
end;
@ -227,52 +230,52 @@ end;
function get_color(C: TClient; x, y: Integer;
out color: Integer): Integer; cdecl;
begin
try
color := C.IOManager.GetColor(x, y);
if color > -1 then
result := RESULT_OK
else
result := RESULT_FALSE;
except on e : Exception do
try
color := C.IOManager.GetColor(x, y);
if color > -1 then
result := RESULT_OK
else
result := RESULT_FALSE;
except on e : Exception do
begin
set_last_error(e.message);
result := RESULT_ERROR;
end;
set_last_error(e.message);
result := RESULT_ERROR;
end;
end;
end;
{ Find color on client C in area (x1,y1,x2,y2) and return coordinate (if any) in x, y }
function find_color(C: TClient; var x, y: Integer;
color, x1, y1, x2, y2: Integer): Integer; cdecl;
begin
try
if C.MFinder.FindColor(x, y, color, x1, y1, x2, y2) then
result := RESULT_OK
else
result := RESULT_FALSE;
except on e : Exception do
try
if C.MFinder.FindColor(x, y, color, x1, y1, x2, y2) then
result := RESULT_OK
else
result := RESULT_FALSE;
except on e : Exception do
begin
set_last_error(e.Message);
result := RESULT_ERROR;
end;
set_last_error(e.Message);
result := RESULT_ERROR;
end;
end;
end;
function find_color_tolerance(C: TClient; var x, y: Integer; color: Integer;
tol, x1, y1, x2, y2: Integer): Integer; cdecl;
begin
try
if C.MFinder.FindColorTolerance(x, y, color, x1, y1, x2, y2, tol) then
result := RESULT_OK
else
result := RESULT_FALSE;
except on e : Exception do
try
if C.MFinder.FindColorTolerance(x, y, color, x1, y1, x2, y2, tol) then
result := RESULT_OK
else
result := RESULT_FALSE;
except on e : Exception do
begin
set_last_error(e.Message);
result := RESULT_ERROR;
end;
set_last_error(e.Message);
result := RESULT_ERROR;
end;
end;
end;
function find_color_tolerance_optimised(C: TClient; var x, y: Integer;
@ -280,18 +283,18 @@ function find_color_tolerance_optimised(C: TClient; var x, y: Integer;
x1, y1, x2, y2: Integer;
tol: Integer): Integer; cdecl;
begin
try
if C.MFinder.FindColorToleranceOptimised(x, y, col, x1, y1, x2, y2,
tol) then
result := RESULT_OK
else
result := RESULT_FALSE;
except on e : Exception do
try
if C.MFinder.FindColorToleranceOptimised(x, y, col, x1, y1, x2, y2,
tol) then
result := RESULT_OK
else
result := RESULT_FALSE;
except on e : Exception do
begin
set_last_error(e.message);
result := RESULT_ERROR;
end;
set_last_error(e.message);
result := RESULT_ERROR;
end;
end;
end;
function find_colors(C: TClient; var ptr: PPoint; var len: Integer;
@ -299,27 +302,27 @@ function find_colors(C: TClient; var ptr: PPoint; var len: Integer;
var
TPA: TPointArray;
begin
setlength(TPA, 0);
try
C.MFinder.FindColors(TPA, color, x1, y1, x2, y2);
except on e : Exception do
setlength(TPA, 0);
try
C.MFinder.FindColors(TPA, color, x1, y1, x2, y2);
except on e : Exception do
begin
set_last_error(e.Message);
result := RESULT_ERROR;
set_last_error(e.Message);
result := RESULT_ERROR;
end;
end;
len := Length(TPA);
if len > 0 then
result := RESULT_OK
else
begin
setlength(tpa, 0);
exit(RESULT_FALSE);
end;
ptr := array_to_ptr(Pointer(@TPA[0]), len, sizeof(TPoint));
end;
len := Length(TPA);
if len > 0 then
result := RESULT_OK
else
begin
setlength(tpa, 0);
exit(RESULT_FALSE);
end;
ptr := array_to_ptr(Pointer(@TPA[0]), len, sizeof(TPoint));
setlength(tpa, 0);
end;
function find_colors_tolerance(C: TClient; var ptr: PPoint; var len: Integer;
@ -327,26 +330,26 @@ function find_colors_tolerance(C: TClient; var ptr: PPoint; var len: Integer;
var
TPA: TPointArray;
begin
try
C.MFinder.FindColorsTolerance(TPA, color, x1, y1, x2, y2, tol);
except on e : Exception do
try
C.MFinder.FindColorsTolerance(TPA, color, x1, y1, x2, y2, tol);
except on e : Exception do
begin
set_last_error(e.Message);
result := RESULT_ERROR;
end;
end;
len := Length(TPA);
if len > 0 then
result := RESULT_OK
else
begin
setlength(tpa, 0);
exit(RESULT_FALSE);
set_last_error(e.Message);
result := RESULT_ERROR;
end;
end;
ptr := array_to_ptr(Pointer(@TPA[0]), len, sizeof(TPoint));
setlength(TPA, 0);
len := Length(TPA);
if len > 0 then
result := RESULT_OK
else
begin
setlength(tpa, 0);
exit(RESULT_FALSE);
end;
ptr := array_to_ptr(Pointer(@TPA[0]), len, sizeof(TPoint));
setlength(TPA, 0);
end;
function find_colors_tolerance_optimised(C: TClient; var ptr: PPoint;
@ -356,184 +359,184 @@ function find_colors_tolerance_optimised(C: TClient; var ptr: PPoint;
var
TPA: TPointArray;
begin
try
C.MFinder.FindColorsToleranceOptimised(TPA, col, x1, y1, x2, y2, tol);
except on e : Exception do
try
C.MFinder.FindColorsToleranceOptimised(TPA, col, x1, y1, x2, y2, tol);
except on e : Exception do
begin
set_last_error(e.message);
result := RESULT_ERROR;
set_last_error(e.message);
result := RESULT_ERROR;
end;
end;
len := Length(TPA);
if len > 0 then
result := RESULT_OK
else
begin
setlength(tpa, 0);
exit(RESULT_FALSE);
end;
ptr := array_to_ptr(Pointer(@TPA[0]), len, sizeof(TPoint));
setlength(TPA, 0);
end;
len := Length(TPA);
if len > 0 then
result := RESULT_OK
else
begin
setlength(tpa, 0);
exit(RESULT_FALSE);
end;
ptr := array_to_ptr(Pointer(@TPA[0]), len, sizeof(TPoint));
setlength(TPA, 0);
end;
function similar_colors(C: TClient; col1, col2, tol: Integer): Integer; cdecl;
begin
try
if C.MFinder.SimilarColors(col1, col2, tol) then
result := RESULT_OK
else
result := RESULT_FALSE;
except on e : Exception do
try
if C.MFinder.SimilarColors(col1, col2, tol) then
result := RESULT_OK
else
result := RESULT_FALSE;
except on e : Exception do
begin
set_last_error(e.message);
result := RESULT_FALSE;
end;
set_last_error(e.message);
result := RESULT_FALSE;
end;
end;
end;
function count_color(C: TClient; out count: Integer;
Color, xs, ys, xe, ye: Integer): Integer; cdecl;
begin
try
count := C.MFinder.CountColor(Color, xs, ys, xe, ye);
if count > 0 then
result := RESULT_OK
else
result := RESULT_FALSE;
except on e : Exception do
try
count := C.MFinder.CountColor(Color, xs, ys, xe, ye);
if count > 0 then
result := RESULT_OK
else
result := RESULT_FALSE;
except on e : Exception do
begin
set_last_error(e.message);
result := RESULT_ERROR;
end;
set_last_error(e.message);
result := RESULT_ERROR;
end;
end;
end;
function count_color_tolerance(C: TClient; out count: Integer; col: Integer;
xs, ys, xe, ye, tol: Integer): Integer; cdecl;
begin
try
count := C.MFinder.CountColorTolerance(col, xs, ys, xe, ye, tol);
except on e : Exception do
try
count := C.MFinder.CountColorTolerance(col, xs, ys, xe, ye, tol);
except on e : Exception do
begin
set_last_error(e.message);
result := RESULT_ERROR;
end;
set_last_error(e.message);
result := RESULT_ERROR;
end;
end;
if count > 0 then
result := RESULT_OK
else
result := RESULT_FALSE;
if count > 0 then
result := RESULT_OK
else
result := RESULT_FALSE;
end;
function find_color_spiral(C: TClient; var x, y: Integer;
col, xs, ys, xe, ye: Integer): Integer; cdecl;
begin
try
if C.MFinder.FindColorSpiral(x, y, col, xs, ys, xe, ye) then
result := RESULT_OK
else
result := RESULT_FALSE;
except on e : Exception do
try
if C.MFinder.FindColorSpiral(x, y, col, xs, ys, xe, ye) then
result := RESULT_OK
else
result := RESULT_FALSE;
except on e : Exception do
begin
set_last_error(e.message);
result := RESULT_ERROR;
end;
set_last_error(e.message);
result := RESULT_ERROR;
end;
end;
end;
function find_color_spiral_tolerance(C: TClient; var x, y: Integer;
col, xs, ys, xe, ye: Integer;
tol: Integer): Integer; cdecl;
begin
try
if C.MFinder.FindColorSpiralTolerance(x, y, col, xs, ys, xe, ye,
tol) then
result := RESULT_OK
else
result := RESULT_FALSE;
except on e : Exception do
try
if C.MFinder.FindColorSpiralTolerance(x, y, col, xs, ys, xe, ye,
tol) then
result := RESULT_OK
else
result := RESULT_FALSE;
except on e : Exception do
begin
set_last_error(e.message);
result := RESULT_ERROR;
end;
set_last_error(e.message);
result := RESULT_ERROR;
end;
end;
end;
function find_colored_area(C: TClient; var x, y: Integer;
col, xs, ys, xe, ye, minA: Integer): Integer; cdecl;
begin
try
if C.MFinder.FindColoredArea(x, y, col, xs, ys, xe, ye, minA) then
result := RESULT_OK
else
result := RESULT_FALSE;
except on e : Exception do
try
if C.MFinder.FindColoredArea(x, y, col, xs, ys, xe, ye, minA) then
result := RESULT_OK
else
result := RESULT_FALSE;
except on e : Exception do
begin
set_last_error(e.message);
result := RESULT_ERROR;
end;
set_last_error(e.message);
result := RESULT_ERROR;
end;
end;
end;
function find_colored_area_tolerance(C: TClient; var x, y: Integer;
col, xs, ys, xe, ye, minA: Integer;
tol: Integer): Integer; cdecl;
begin
try
if C.MFinder.FindColoredAreaTolerance(x, y, col,
xs, ys, xe, ye, minA, tol) then
result := RESULT_OK
else
result := RESULT_FALSE;
except on e : Exception do
try
if C.MFinder.FindColoredAreaTolerance(x, y, col,
xs, ys, xe, ye, minA, tol) then
result := RESULT_OK
else
result := RESULT_FALSE;
except on e : Exception do
begin
set_last_error(e.message);
result := RESULT_ERROR;
end;
set_last_error(e.message);
result := RESULT_ERROR;
end;
end;
end;
function set_tolerance_speed(C: TClient; nCTS: Integer): Integer; cdecl;
begin
try
C.MFinder.SetToleranceSpeed(nCTS);
result := RESULT_OK;
except on e : Exception do
try
C.MFinder.SetToleranceSpeed(nCTS);
result := RESULT_OK;
except on e : Exception do
begin
set_last_error(e.message);
result := RESULT_ERROR;
end;
set_last_error(e.message);
result := RESULT_ERROR;
end;
end;
end;
function get_tolerance_speed(C: TClient; out cts: Integer): Integer; cdecl;
begin
try
cts := C.MFinder.GetToleranceSpeed;
result := RESULT_OK;
except on e: Exception do
begin;
set_last_error(e.message);
result := RESULT_ERROR;
try
cts := C.MFinder.GetToleranceSpeed;
result := RESULT_OK;
except on e: Exception do
begin
set_last_error(e.message);
result := RESULT_ERROR;
end
end;
end;
end;
function set_tolerance_speed_2_modifiers(C: TClient;
nHue, nSat: Extended): Integer; cdecl;
begin
try
C.MFinder.SetToleranceSpeed2Modifiers(nHue, nSat);
result := RESULT_OK;
except on e : Exception do
begin;
set_last_error(e.message);
result := RESULT_ERROR;
end;
try
C.MFinder.SetToleranceSpeed2Modifiers(nHue, nSat);
result := RESULT_OK;
except on e : Exception do
begin
set_last_error(e.message);
result := RESULT_ERROR;
end;
end;
end;
function get_tolerance_speed_2_modifiers(C: TClient; out hueMod: Extended;
@ -541,17 +544,17 @@ function get_tolerance_speed_2_modifiers(C: TClient; out hueMod: Extended;
var
h, s: Extended;
begin
try
C.MFinder.GetToleranceSpeed2Modifiers(h, s);
hueMod := h;
satMod := s;
result := RESULT_OK;
except on e : Exception do
begin;
set_last_error(e.message);
result := RESULT_ERROR;
end;
try
C.MFinder.GetToleranceSpeed2Modifiers(h, s);
hueMod := h;
satMod := s;
result := RESULT_OK;
except on e : Exception do
begin
set_last_error(e.message);
result := RESULT_ERROR;
end;
end;
end;
{ DTM }
@ -564,53 +567,53 @@ function create_dtm(PointLen: integer; Points: PMDTMPoint; DTM: TMDTM): integer;
var
i: integer;
begin
DTM := TMDTM.Create;
for i := 0 to PointLen - 1 do
DTM.AddPoint(Points[i]);
if DTM.Valid then
exit(RESULT_OK);
DTM.Free;
set_last_error('Invalid DTM');
result := RESULT_ERROR;
DTM := TMDTM.Create;
for i := 0 to PointLen - 1 do
DTM.AddPoint(Points[i]);
if DTM.Valid then
exit(RESULT_OK);
DTM.Free;
set_last_error('Invalid DTM');
result := RESULT_ERROR;
end;
{ Delete a MDTM. Don't delete it if it is managed! use remove_dtm instead }
function delete_dtm(C: TClient; DTM: TMDTM): integer; cdecl;
begin
if not assigned(DTM) then
begin
set_last_error('DTM is NULL');
exit(RESULT_ERROR);
end;
DTM.Free;
result := RESULT_OK;
if not assigned(DTM) then
begin
set_last_error('DTM is NULL');
exit(RESULT_ERROR);
end;
DTM.Free;
result := RESULT_OK;
end;
{ Add a previously created DTM to the DTM Manager }
function add_dtm(C: TClient; DTM: TMDTM; var index: integer): integer; cdecl;
begin
if not assigned(DTM) then
begin
set_last_error('DTM is NULL');
exit(RESULT_ERROR);
end;
try
index := C.MDTMs.AddDTM(DTM);
exit(RESULT_OK);
except on e : Exception do
result := RESULT_ERROR;
end;
if not assigned(DTM) then
begin
set_last_error('DTM is NULL');
exit(RESULT_ERROR);
end;
try
index := C.MDTMs.AddDTM(DTM);
exit(RESULT_OK);
except on e : Exception do
result := RESULT_ERROR;
end;
end;
{ Remove a previously added DTM from the DTM manager. This also frees the DTM }
function remove_dtm(C: TClient; DTMi: integer): integer; cdecl;
begin
C.MDTMs.FreeDTM(DTMi);
C.MDTMs.FreeDTM(DTMi);
end;
{ Find a DTM given DTM index i, client C in area x1,y1,x2,y2. Return coord at x, y. }
@ -619,19 +622,19 @@ function find_dtm(C: TClient; DTMi: integer; var x, y: integer; x1, y1, x2,
var
res: boolean;
begin
try
res := C.MFinder.FindDTM(C.MDTMs.DTM[DTMi], x, y, x1, y1, x2, y2);
except on e : Exception do
try
res := C.MFinder.FindDTM(C.MDTMs.DTM[DTMi], x, y, x1, y1, x2, y2);
except on e : Exception do
begin;
result := RESULT_ERROR;
set_last_error(e.Message);
result := RESULT_ERROR;
set_last_error(e.Message);
end;
end;
if res then
result := RESULT_OK
else
result := RESULT_FALSE;
end;
if res then
result := RESULT_OK
else
result := RESULT_FALSE;
end;
{ Find a DTM given DTM index i, client C in area x1,y1,x2,y2. Return coord at x, y. }
@ -642,46 +645,46 @@ var
len: integer;
TPA: TPointArray;
begin
try
res := C.MFinder.FindDTMs(C.MDTMs.DTM[DTMi], TPA, x1, y1, x2, y2);
except on e : Exception do
begin;
result := RESULT_ERROR;
set_last_error(e.Message);
end;
end;
len := Length(TPA);
if len > 0 then
result := RESULT_OK
else
begin
setlength(tpa, 0);
exit(RESULT_FALSE);
end;
ptr := array_to_ptr(Pointer(@TPA[0]), len, sizeof(TPoint));
setlength(TPA, 0);
try
res := C.MFinder.FindDTMs(C.MDTMs.DTM[DTMi], TPA, x1, y1, x2, y2);
except on e : Exception do
begin;
result := RESULT_ERROR;
set_last_error(e.Message);
end;
end;
len := Length(TPA);
if len > 0 then
result := RESULT_OK
else
begin
setlength(tpa, 0);
exit(RESULT_FALSE);
end;
ptr := array_to_ptr(Pointer(@TPA[0]), len, sizeof(TPoint));
setlength(TPA, 0);
end;
function set_array_target(C: TClient; Arr: PRGB32; Size: TPoint): integer;
cdecl;
begin
if not assigned(Arr) then
if not assigned(Arr) then
begin
set_last_error('Arr is not assigned');
exit(RESULT_FALSE);
end;
try
C.IOManager.SetTarget(Arr, Size);
result := RESULT_OK;
except on e : Exception do
begin
set_last_error('Arr is not assigned');
exit(RESULT_FALSE);
end;
try
C.IOManager.SetTarget(Arr, Size);
result := RESULT_OK;
except on e : Exception do
begin;
set_last_error(e.message);
result := RESULT_FALSE;
end;
set_last_error(e.message);
result := RESULT_FALSE;
end;
end;
end;
exports

1
README
View File

@ -1,2 +1,3 @@
This file is a stub. For more information, see http://wizzup.org/simba/
bob

39
TODO
View File

@ -3,31 +3,24 @@ Simple stuff, not required, may not be possible/useful:
- Coloured writeln [ ]
- Make an TAction for the Colour Picker. [ ]
- Portable install (needs fiddling with settings and such) [ ]
- Settings rewrite [ ]
- --no-extensions flag for Simba. [ ]
- CTS/finder speedups and changes [X]
- CTS/finder speedups and changes [ ]
General ideas:
- everything subprocedure (lots of code)
- jit + comparison function (per cts) generated, call in loop
- comparison function (per cts), not generated, call in loop
- JIT (Generate comparison functions) [ ]
- Comparison functions for HSL/XYZ/L*a*b should check for
match on each component before calculating the next.
(see FindColorsToleranceOptimised)
- Pass color information in struct [ ]
- Pass color information in struct [X]
- Precalculate screen bitmap in current cts / keep a cache
to save comparisons [ ]
- Add CTS 3 [ ]
- Add a direct RGB -> CIE L*a*b conversion [ ]
- Make sure colour conversions are inline [ ]
to save comparisons [X]
- Add CTS 3 [/]
- Add a direct RGB -> CIE L*a*b conversion [/]
- More documentation:
- Cover all functions by at least mentioning the definition [ ]
- Cover all functions by at least mentioning the definition [/]
- Imported functions as well?
- Write tutorial [ ]
- In depth documentation per function [ ]
@ -36,17 +29,17 @@ Simple stuff, not required, may not be possible/useful:
- Lape! [ ]
- Integrate script manager [ ]
- Basic support. (Install scripts) [ ]
- Update functionality [ ]
- Uninstall scripts [ ]
- Better storage / more stable storage [ ]
- Pretty GUI [ ]
- Merging / storing usernames when updating [ ]
- Basic support. (Install scripts) [X]
- Update functionality [X]
- Uninstall scripts [X]
- Better storage / more stable storage [?]
- Pretty GUI [/]
- Merging / storing usernames when updating [?]
- Make Simba more ``modular'':
- Fonts [ ]
- Interpreters [ ]
- Interpreters [/]
- Code completion/hints [ ]
- Extensions [ ]
- Extensions [X]
- Interpreter system overhaul? [ ]

34
Tests/PS/bmpbench.simba Normal file
View File

@ -0,0 +1,34 @@
program new;
//http://farm4.static.flickr.com/3067/2612399892_7df428d482.jpg
{Make the above bitmap your target}
var
Bmp : integer;
x,y : integer;
w,h : integer;
t, i, c: integer;
begin
Bmp := createBitmap(15, 10);
FastDrawClear(bmp, clRed);
GetClientDimensions(w,h);
writeln(w);
writeln(h);
for c := 0 to 2 do
begin
writeln('cts: ' + inttostr(c));
setcolortolerancespeed(c);
t:=getsystemtime;
for i := 0 to 100 do
findBitmapToleranceIn(bmp,x,y,0,0,w-1,h-1,10);
writeln((getsystemtime-t) / 100.0);
if findBitmapToleranceIn(bmp,x,y,0,0,w-1,h-1,200) then
writeln('found');
end;
{if FindBitmapToleranceIn(bmp,x,y,0,0,w-1,h-1,300) then
begin
writeln('found');
MoveMouse(x,y);
end;}
end.

View File

@ -101,6 +101,11 @@ begin
result := GetDirectories(path);
end;
function ps_DeleteFile(const Filename: string): Boolean; extdecl;
begin
Result := CurrThread.Client.MFiles.DeleteFile(Filename);
end;
procedure ps_WriteINI(const Section, KeyName, NewString, FileName: string);extdecl;
var
tempini : TIniFile;

View File

@ -172,12 +172,12 @@ begin;
result := (((x >= Box.x1) and(x <= Box.x2)) and ((y >= box.y1) and (y <= box.y2)));
end;
function ps_PointToBox(PT1,PT2 : TPoint) : TBox; extdecl;
function ps_PointToBox(topLeft,bottomRight: TPoint): TBox; extdecl;
begin;
result.x1 := PT1.x;
result.y1 := PT1.y;
result.x2 := PT2.x;
result.y2 := PT2.y;
result.x1 := topLeft.x;
result.y1 := topLeft.y;
result.x2 := bottomRight.x;
result.y2 := bottomRight.y;
end;
function ps_PointInBox(PT : TPoint; Box: TBox): Boolean; extdecl;

View File

@ -143,6 +143,11 @@ begin
FilterPointsLine(points,radial,radius,mx,my);
end;
procedure ps_FilterTPADist(var TPA: TPointArray; maxDist: integer);
begin
FilterTPADist(TPA, maxDist);
end;
function ps_GetATPABounds(const ATPA: T2DPointArray): TBox;extdecl;
begin
result := GetATPABounds(ATPA);

View File

@ -69,7 +69,7 @@ AddFunction(@ps_iAbs,'function iAbs(a : integer) : integer;');
AddFunction(@ps_ArcTan2,'function ArcTan2(y,x : extended) : extended;');
AddFunction(@ps_IntToBox,'function IntToBox(xs,ys,xe,ye : integer) : TBox;');
AddFunction(@ps_IntInBox,'function IntInBox(x, y: Integer; Box: TBox): Boolean;');
AddFunction(@ps_PointToBox,'function PointToBox(PT1,PT2 : TPoint): TBox;');
AddFunction(@ps_PointToBox,'function PointToBox(topLeft,bottomRight: TPoint): TBox;');
AddFunction(@ps_PointInBox,'function PointInBox(PT : TPoint; Box: TBox): Boolean;');
AddFunction(@ps_sqr,'function Sqr(e : extended) : extended;');
AddFunction(@ps_point,'function Point(x,y:integer) : TPoint;');
@ -156,6 +156,7 @@ AddFunction(@ps_FileExists,'function FileExists (const FileName : string ) : Boo
AddFunction(@ps_ForceDirectores,'function ForceDirectories(const dir : string) : boolean;');
AddFunction(@ps_GetFiles,'function GetFiles(const Path, Ext : string) : TStringArray;');
AddFunction(@ps_GetDirectories,'function GetDirectories(const path : string) : TStringArray;');
AddFunction(@ps_DeleteFile, 'function DeleteFile(const Filename: string): Boolean;');
AddFunction(@ps_WriteINI,'procedure WriteINI(const Section, KeyName, NewString, FileName: string);');
AddFunction(@ps_ReadINI,'function ReadINI(const Section, KeyName, FileName: string): string;');
AddFunction(@ps_DeleteINI,'procedure DeleteINI(const Section, KeyName, FileName: string);');
@ -458,6 +459,7 @@ AddFunction(@ps_FloodFillTPA,'function FloodFillTPA(const TPA : TPointArray) : T
AddFunction(@ps_FilterPointsPie,'procedure FilterPointsPie(var Points: TPointArray; const SD, ED, MinR, MaxR: Extended; Mx, My: Integer);');
AddFunction(@ps_FilterPointsLine,'procedure FilterPointsLine(var Points: TPointArray; Radial: Extended; Radius, MX, MY: Integer);');
AddFunction(@ps_filterpointsdist,'procedure FilterPointsDist(var Points: TPointArray; const MinDist, MaxDist: Extended; Mx, My: Integer);');
AddFunction(@ps_filterTPADist, 'procedure FilterTPADist(var TPA: TPointArray; maxDist: integer);');
AddFunction(@ps_GetATPABounds,'function GetATPABounds(const ATPA: T2DPointArray): TBox;');
AddFunction(@ps_GetTPABounds,'function GetTPABounds(const TPA: TPointArray): TBox;');
AddFunction(@ps_FindTPAinTPA,'function FindTPAinTPA(const SearchTPA, TotalTPA: TPointArray; var Matches: TPointArray): Boolean;');

View File

@ -51,7 +51,12 @@ type
procedure ImageMainMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
procedure ImageInfoMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
Procedure ColorPickUp(Sender: TObject; Button: TMouseButton;Shift: TShiftState; X, Y: Integer);
procedure ColorPickUp(Sender: TObject; Button: TMouseButton;Shift: TShiftState; X, Y: Integer);
private
{ Are we currently picking? }
FPicking: Boolean;
public
manager: TIOManager;
{ Form components }
@ -68,7 +73,9 @@ type
{ Handles }
InfoHandle, ImageHandle : HDC;
public
property Picking: Boolean read FPicking;
property OnPick: TColourPickEvent read FPickEvent write FPickEvent;
end;
@ -80,7 +87,8 @@ constructor TMColorPicker.Create(manager: TIOManager);
begin
inherited Create;
self.manager := manager;
Self.manager := manager;
Self.FPicking := False;
end;
destructor TMColorPicker.Destroy;
@ -103,12 +111,17 @@ var
begin
if self.FPicking then
raise Exception.Create('Pick() has not yet returned, but has been called'
+ 'again');
Self.FPicking := True;
{ Disable both of the color pick buttons }
w := 0;
h := 0;
{ If the target window isn't valid (closed etc), make the destkop the new window}
if not Self.Manager.TargetValid then
self.Manager.SetDesktop;
Self.Manager.SetDesktop;
{Desktop is needed for the whole picture}
Desktop := TIOManager.Create;
@ -214,6 +227,8 @@ begin
Desktop.free;
self.FPicking := False;
{ Re-enable the color pick buttons }
// Application.MainForm.Enabled := True;
// ColourHistoryForm.Enabled := True;

View File

@ -184,7 +184,8 @@ type
procedure OnCompile(Sender: TPSScript);
function RequireFile(Sender: TObject; const OriginFileName: String;
var FileName, OutPut: string): Boolean;
function FileAlreadyIncluded(Sender: TObject; FileName: string): Boolean;
function FileAlreadyIncluded(Sender: TObject; OrgFileName, FileName: string): Boolean;
function OnIncludingFile(Sender: TObject; OrgFileName, FileName: string): Boolean;
procedure OnCompImport(Sender: TObject; x: TPSPascalCompiler);
procedure OnExecImport(Sender: TObject; se: TPSExec; x: TPSRuntimeClassImporter);
@ -425,7 +426,9 @@ begin
Exit;
end;
filename := path;//Yeah!
Includes.Add(path);
if Includes.IndexOf(path) = -1 then
Includes.Add(path);
try
f:= TFileStream.Create(UTF8ToSys(Path), fmOpenRead);
@ -615,6 +618,7 @@ begin
PSScript.UsePreProcessor:= True;
PSScript.CompilerOptions := PSScript.CompilerOptions + [icBooleanShortCircuit];
PSScript.OnNeedFile := @RequireFile;
PSScript.OnIncludingFile := @OnIncludingFile;
PSScript.OnFileAlreadyIncluded := @FileAlreadyIncluded;
PSScript.OnProcessDirective:=@OnProcessDirective;
PSScript.OnProcessUnknowDirective:=@PSScriptProcessUnknownDirective;
@ -737,20 +741,57 @@ begin
'{$IFDEF __REMOVE_IS_INCLUDE}{$UNDEF IS_INCLUDE}{$ENDIF}';
end;
function TPSThread.FileAlreadyIncluded(Sender: TObject; FileName: string): Boolean;
function TPSThread.FileAlreadyIncluded(Sender: TObject; OrgFileName, FileName: string): Boolean;
var
path: string;
i: integer;
begin
path := FindFile(Filename,[ScriptPath,IncludePath]);
path := FindFile(filename,[includepath,ScriptPath,IncludeTrailingPathDelimiter(ExtractFileDir(OrgFileName))]);
if path = '' then
begin
Result := True;
Exit;
end;
path := ExpandFileNameUTF8(path);
if (path <> '') then
if Includes.Find(path,i) then
if Includes.IndexOf(path) <> -1 then
begin
psWriteln('Include_Once file already included');
Result := False;
{$IFDEF SIMBA_VERBOSE}
writeln('Include_Once file already included:' + Path);
{$ENDIF}
Result := True;
Exit;
end;
{$IFDEF SIMBA_VERBOSE}
writeln('OnFileAlreadyIncluded, Adding: ' + path);
{$ENDIF}
Includes.Add(path);
Result := True;
Result := False;
end;
function TPSThread.OnIncludingFile(Sender: TObject; OrgFileName, FileName: string): Boolean;
var
path: string;
begin
path := FindFile(filename,[includepath,ScriptPath,IncludeTrailingPathDelimiter(ExtractFileDir(OrgFileName))]);
if path = '' then
begin
Result := True;
Exit;
end;
path := ExpandFileNameUTF8(path);
if Includes.IndexOf(path) = -1 then
begin
{$IFDEF SIMBA_VERBOSE}
writeln('OnIncludingFile, Adding: ' + path);
{$ENDIF}
Includes.Add(path);
end;
Result := True; // Not used
end;
procedure SIRegister_Mufasa(cl: TPSPascalCompiler);
@ -923,7 +964,7 @@ begin
if PSScript.Compile then
begin
OutputMessages;
psWriteln('Compiled succesfully in ' + IntToStr(GetTickCount - Starttime) + ' ms.');
psWriteln('Compiled successfully in ' + IntToStr(GetTickCount - Starttime) + ' ms.');
if CompileOnly then
exit;
// if not (ScriptState = SCompiling) then
@ -1167,7 +1208,7 @@ begin
RUTIS.Compile;
if not RUTIS.CompilerError then
begin
psWriteln('Compiled succesfully in ' + IntToStr(GetTickCount - Starttime) + ' ms.');
psWriteln('Compiled successfully in ' + IntToStr(GetTickCount - Starttime) + ' ms.');
if CompileOnly then
exit;
RUTIS.Run;

View File

@ -34,10 +34,31 @@ uses
{$IFDEF MSWINDOWS} os_windows {$ENDIF}
{$IFDEF LINUX} os_linux {$ENDIF};
{
TClient is a full-blown instance of the MML.
It binds all the components together.
}
(*
Client Class
============
The ``TClient`` class is the class that glues all other MML classes together
into one usable class. Internally, quite some MML classes require other MML
classes, and they access these other classes through their "parent"
``TClient``
class.
An image tells more than a thousands words:
.. image:: ../../Pics/Client_Classes.png
And the class dependency graph: (An arrow indicates a dependency)
.. image:: ../../Pics/client_classes_dependencies.png
The client class does not do much else except creating the classes when it
is
created and destroying the classes when it is being destroyed.
*)
type
@ -57,9 +78,31 @@ type
destructor Destroy; override;
end;
(*
Properties:
- IOManager
- MFiles
- MFinder
- MBitmaps
- MDTMs
- MOCR
- WriteLnProc
*)
implementation
(*
TClient.WriteLn
~~~~~~~~~~~~~~~
.. code-block:: pascal
procedure TClient.WriteLn(s: string);
*)
procedure TClient.WriteLn(s: string);
begin
@ -69,6 +112,17 @@ begin
mDebugLn(s);
end;
(*
TClient.Create
~~~~~~~~~~~~~~
.. code-block:: pascal
constructor TClient.Create(const plugin_dir: string = ''; const UseIOManager : TIOManager = nil);
*)
// Possibly pass arguments to a default window.
constructor TClient.Create(const plugin_dir: string = ''; const UseIOManager : TIOManager = nil);
begin
@ -86,6 +140,17 @@ begin
MOCR := TMOCR.Create(self);
end;
(*
TClient.Destroy
~~~~~~~~~~~~~~~
.. code-block:: pascal
destructor TClient.Destroy;
*)
destructor TClient.Destroy;
begin
if FOwnIOManager then

View File

@ -45,6 +45,7 @@ type
function OpenFile(Path: string; Shared: Boolean): Integer;
function RewriteFile(Path: string; Shared: Boolean): Integer;
function AppendFile(Path: string): Integer;
function DeleteFile(Filename: string): Boolean;
procedure CloseFile(FileNum: Integer);
function EndOfFile(FileNum: Integer): Boolean;
function FileSizeMuf(FileNum: Integer): LongInt;
@ -128,6 +129,7 @@ begin;
exit;
end;
end;
result := '';
end;
constructor TMFiles.Create(Owner : TObject);
@ -333,6 +335,21 @@ begin
end;
end;
function TMFiles.DeleteFile(Filename: string): Boolean;
var
Continue : Boolean;
begin
if Assigned(WriteFileEvent) then
begin;
Continue := true;
WriteFileEvent(Self, Filename, continue);
if not Continue then
exit(False);
end;
Result := DeleteFileUTF8(Filename);
end;
{/\
Free's the given File at the given index.
/\}

View File

@ -1692,6 +1692,8 @@ begin
end;
//We did find the Bmp, otherwise we would be at the part below
TClient(Client).IOManager.FreeReturnData;
x := ClientTPA[i].x + xs;
y := ClientTPA[i].y + ys;
result := true;

View File

@ -33,6 +33,18 @@ uses
graphtype, intfgraphics,graphics;
{End To-Remove unit}
(*
.. _mmlref-ocr:
TMOCR Class
===========
The TMOCR class uses the powerful ``ocrutil`` unit to create some default but
useful functions that can be used to create and identify text. It also contains
some functions used in special cases to filter noise. Specifically, these are
all the ``Filter*`` functions.
*)
type
{ TMOCR }
@ -131,10 +143,18 @@ begin
inherited Destroy;
end;
{
InitTOCR loads all fonts in path
We don't do this in the constructor because we may not yet have the path.
}
(*
InitTOCR
~~~~~~~~
.. code-block:: pascal
function TMOCR.InitTOCR(const path: string): boolean;
InitTOCR loads all fonts in path
We don't do this in the constructor because we may not yet have the path.
*)
function TMOCR.InitTOCR(const path: string): boolean;
var
dirs: array of string;
@ -188,6 +208,7 @@ begin
Self.FFonts := NewFonts.Copy(Self.Client);
end;
{
Filter UpText by a very rough colour comparison / range check.
We first convert the colour to RGB, and if it falls into the following
@ -208,6 +229,16 @@ end;
We will match shadow as well; we need it later on.
}
(*
FilterUpTextByColour
~~~~~~~~~~~~~~~~~~~~
.. code-block:: pascal
procedure TMOCR.FilterUpTextByColour(bmp: TMufasaBitmap);
*)
procedure TMOCR.FilterUpTextByColour(bmp: TMufasaBitmap);
var
x, y,r, g, b: Integer;
@ -351,6 +382,16 @@ end;
We don't need to do this from the right bottom to left top.
}
(*
FilterUpTextByCharacteristics
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. code-block:: pascal
procedure TMOCR.FilterUpTextByCharacteristics(bmp: TMufasaBitmap; w,h: integer);
*)
procedure TMOCR.FilterUpTextByCharacteristics(bmp: TMufasaBitmap; w,h: integer);
var
x,y: Integer;
@ -457,7 +498,18 @@ begin
setlength(result,c);
end;
{ Remove anything but the shadows on the bitmap (Shadow = clPurple, remember?) }
(*
FilterShadowBitmap
~~~~~~~~~~~~~~~~~~
.. code-block:: pascal
procedure TMOCR.FilterShadowBitmap(bmp: TMufasaBitmap);
Remove anything but the shadows on the bitmap (Shadow = clPurple)
*)
procedure TMOCR.FilterShadowBitmap(bmp: TMufasaBitmap);
var
x,y:integer;
@ -473,13 +525,20 @@ begin
end;
end;
{
Remove all but uptext colours clWhite,clGreen, etc.
See constants above.
(*
This assumes that the bitmap only consists of colour 0, and the other
constants founds above the functionss
}
FilterCharsBitmap
~~~~~~~~~~~~~~~~~
.. code-block:: pascal
procedure TMOCR.FilterCharsBitmap(bmp: TMufasaBitmap);
Remove all but uptext colours clWhite,clGreen, etc.
This assumes that the bitmap only consists of colour 0, and the other
constants founds above the functions
*)
procedure TMOCR.FilterCharsBitmap(bmp: TMufasaBitmap);
var
x,y: integer;
@ -509,17 +568,27 @@ end;
{
This uses the two filters, and performs a split on the bitmap.
A split per character, that is. So we can more easily identify it.
}
(*
getTextPointsIn
~~~~~~~~~~~~~~~
TODO:
.. code-block:: pascal
function TMOCR.getTextPointsIn(sx, sy, w, h: Integer; shadow: boolean;
var _chars, _shadows: T2DPointArray): Boolean;
This uses the two filters, and performs a split on the bitmap.
A split per character, that is. So we can more easily identify it.
TODO:
*
Remove more noise after we have split, it should be possible to identify
noise; weird positions or boxes compared to the rest, etc.
*
Split each colours seperately, and combine only later, after removing noise.
*)
}
function TMOCR.getTextPointsIn(sx, sy, w, h: Integer; shadow: boolean;
var _chars, _shadows: T2DPointArray): Boolean;
var
@ -685,14 +754,20 @@ begin
Result := true;
end;
{
GetUpTextAtEx combines/uses the functions above.
(*
GetUpTextAtEx
~~~~~~~~~~~~~
It will identify each character, and also keep track of the previous
chars' final `x' bounds. If the difference between the .x2 of the previous
character and the .x1 of the current character is bigger than 5, then there
was a space between them. (Add ' ' to result)
}
.. code-block:: pascal
function TMOCR.GetUpTextAtEx(atX, atY: integer; shadow: boolean): string;
GetUpTextAtEx will identify each character, and also keep track of the previous
chars' final *x* bounds. If the difference between the .x2 of the previous
character and the .x1 of the current character is bigger than 5, then there
was a space between them. (Add ' ' to result)
*)
function TMOCR.GetUpTextAtEx(atX, atY: integer; shadow: boolean): string;
var
@ -763,6 +838,17 @@ begin
end;
end;
(*
GetUpTextAt
~~~~~~~~~~~
.. code-block:: pascal
function TMOCR.GetUpTextAt(atX, atY: integer; shadow: boolean): string;
Retreives the (special) uptext.
*)
function TMOCR.GetUpTextAt(atX, atY: integer; shadow: boolean): string;
begin
@ -772,6 +858,18 @@ begin
result := GetUpTextAtEx(atX, atY, false);
end;
(*
GetTextATPA
~~~~~~~~~~~
.. code-block:: pascal
function TMOCR.GetTextATPA(const ATPA : T2DPointArray;const maxvspacing : integer; font: string): string;
Returns the text defined by the ATPA. Each TPA represents one character,
approximately.
*)
function TMOCR.GetTextATPA(const ATPA : T2DPointArray;const maxvspacing : integer; font: string): string;
var
b, lb: TBox;
@ -831,6 +929,17 @@ begin
end;
end;
(*
GetTextAt
~~~~~~~~~
.. code-block:: pascal
function TMOCR.GetTextAt(xs, ys, xe,ye, minvspacing, maxvspacing, hspacing,
color, tol: integer; font: string): string;
General text-finding function.
*)
function TMOCR.GetTextAt(xs, ys, xe,ye, minvspacing, maxvspacing, hspacing,
color, tol: integer; font: string): string;
var
@ -851,6 +960,17 @@ begin;
result := gettextatpa(STPA,maxvspacing,font);
end;
(*
GetTextAt (2)
~~~~~~~~~~~~~
.. code-block:: pascal
function TMOCR.GetTextAt(atX, atY, minvspacing, maxvspacing, hspacing,
color, tol, len: integer; font: string): string;
General text-finding function. Different parameters than other GetTextAt.
*)
function TMOCR.GetTextAt(atX, atY, minvspacing, maxvspacing, hspacing,
color, tol, len: integer; font: string): string;
var
@ -873,6 +993,19 @@ begin
end;
(*
TextToFontTPA
~~~~~~~~~~~~~
.. code-block:: pascal
function TMOCR.TextToFontTPA(Text, font: String; out w, h: integer): TPointArray;
Returns a TPA of a specific *Text* of the specified *Font*.
*)
function TMOCR.TextToFontTPA(Text, font: String; out w, h: integer): TPointArray;
var
@ -918,6 +1051,17 @@ begin
{ writeln('C: ' + inttostr(c)); }
end;
(*
TextToFontBitmap
~~~~~~~~~~~~~~~~
.. code-block:: pascal
function TMOCR.TextToFontBitmap(Text, font: String): TMufasaBitmap;
Returns a Bitmap of the specified *Text* of the specified *Font*.
*)
function TMOCR.TextToFontBitmap(Text, font: String): TMufasaBitmap;
var
TPA: TPointArray;
@ -968,3 +1112,179 @@ end;
end.
(*
.. _uptext-filter:
Uptext
======
To read the UpText, the TMOCR class applies several filters on the client data
before performing the actual OCR. We will take a look at the two filters first.
Filter 1: The Colour Filter
~~~~~~~~~~~~~~~~~~~~~~~~~~~
We first filter the raw client image with a very rough and tolerant colour
comparison / check.
We first convert the colour to RGB, and if it falls into the following
defined ranges, it may be part of the uptext. We also get the possible
shadows.
We will iterate over each pixel in the bitmap, and if it matches any of the
*rules* for the colour; we will set it to a constant colour which
represents this colour (and corresponding rule). Usually the *base*
colour. If it doesn't match any of the rules, it will be painted black.
We won't just check for colours, but also for differences between specific
R, G, B values. For example, if the colour is white; R, G and B should all
lie very close to each other. (That's what makes a colour white.)
The tolerance for getting the pixels is quite large. The reasons for the
high tolerance is because the uptext colour vary quite a lot. They're also
transparent and vary thus per background.
We will store/match shadow as well; we need it later on in filter 2.
To my knowledge this algorithm doesn't remove any *valid* points. It does
not remove *all* invalid points either; but that is simply not possible
based purely on the colour. (If someone has a good idea, let me know)
In code:
.. code-block:: pascal
for y := 0 to bmp.Height - 1 do
for x := 0 to bmp.Width - 1 do
begin
colortorgb(bmp.fastgetpixel(x,y),r,g,b);
if (r < ocr_Limit_Low) and (g < ocr_Limit_Low) and
(b < ocr_Limit_Low) then
begin
bmp.FastSetPixel(x,y, ocr_Purple);
continue;
end;
// Black if no match
bmp.fastsetpixel(x,y,0);
end;
Filter 2: The Characteristics Filter
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This second filter is easy to understand but also very powerful:
- It removes *all* false shadow pixels.
- It removes uptext pixels that can't be uptext according to specific
rules. These rules are specifically designed so that it will never
throw away proper points.
It also performs another filter right at the start, but we'll disregard that
filter for now.
Removing shadow points is trivial if one understands the following insight.
If there some pixel is shadow on *x, y*, then it's neighbour *x+1, y+1*
may not be a shadow pixel. A shadow is always only one pixel *thick*.
With this in mind, we can easily define an algorithm which removes all false
shadow pixels. In code:
.. code-block:: pascal
{
The tricky part of the algorithm is that it starts at the bottom,
removing shadow point x,y if x-1,y-1 is also shadow. This is
more efficient than the obvious way. (It is also easier to implement)
}
for y := bmp.Height - 1 downto 1 do
for x := bmp.Width - 1 downto 1 do
begin
// Is it shadow?
if bmp.fastgetpixel(x,y) <> clPurple then
continue;
// Is the point at x-1,y-1 shadow? If it is
// then x, y cannot be shadow.
if bmp.fastgetpixel(x,y) = bmp.fastgetpixel(x-1,y-1) then
begin
bmp.fastsetpixel(x,y,clSilver);
continue;
end;
if bmp.fastgetpixel(x-1,y-1) = 0 then
bmp.fastsetpixel(x,y,clSilver);
end;
We are now left with only proper shadow pixels.
Now it is time to filter out false Uptext pixels.
Realize:
- If *x, y* is uptext, then *x+1, y+1* must be either uptext or shadow.
In code:
.. code-block:: pascal
for y := bmp.Height - 2 downto 0 do
for x := bmp.Width - 2 downto 0 do
begin
if bmp.fastgetpixel(x,y) = clPurple then
continue;
if bmp.fastgetpixel(x,y) = clBlack then
continue;
// Is the other pixel also uptext?
// NOTE THAT IT ALSO HAS TO BE THE SAME COLOUR
// UPTEXT IN THIS CASE.
// I'm still not sure if this is a good idea or not.
// Perhaps it should match *any* uptext colour.
if (bmp.fastgetpixel(x,y) = bmp.fastgetpixel(x+1,y+1) ) then
continue;
// If it isn't shadow (and not the same colour uptext, see above)
// then it is not uptext.
if bmp.fastgetpixel(x+1,y+1) <> clPurple then
begin
bmp.fastsetpixel(x,y,clOlive);
continue;
end;
// If we make it to here, it means the pixel is part of the uptext.
end;
Identifying characters
~~~~~~~~~~~~~~~~~~~~~~
.. note::
This part of the documentation is a bit vague and incomplete.
To actually identify the text we split it up into single character and then
pass each character to the OCR engine.
In the function *getTextPointsIn* we will use both the filters mentioned above.
After these have been applied, we will make a bitmap that only contains the
shadows as well as a bitmap that only contains the uptext chars (not the
shadows)
Now it is a good idea to count the occurances of all colours
(on the character bitmap); we will also use this later on.
To split the characters we use the well known *splittpaex* function.
We will then sort the points for in each character TPA, as this makes
makes looping over them and comparing distances easier. We will also
calculate the bounding box of each characters TPA.
.. note::
Some more hackery is then used to seperate the characters and find
spaces; but isn't yet documented here.
Normal OCR
----------
.. note::
To do :-)
A large part is already explained above.
Most of the other OCR functions are simply used for plain identifying
and have no filtering tasks.
*)

View File

@ -20,15 +20,21 @@
Linux OS specific implementation for Mufasa Macro Library
}
{$mode objfpc}{$H+}
{$mode objfpc}{$H+}
unit os_linux;
{
TODO's:
- Allow selecting a different X display
- Fix keyboard layout / SendString
}
interface
uses
Classes, SysUtils, mufasatypes, xlib, x, xutil, IOManager, XKeyInput, ctypes, xtest,
syncobjs, mufasabase;
type
TNativeWindow = x.TWindow;
@ -43,7 +49,7 @@ interface
TWindow = class(TWindow_Abstract)
public
constructor Create(display: PDisplay; screennum: integer; window: x.TWindow);
constructor Create(display: PDisplay; screennum: integer; window: x.TWindow);
destructor Destroy; override;
procedure GetTargetDimensions(out w, h: integer); override;
procedure GetTargetPosition(out left, top: integer); override;
@ -89,7 +95,7 @@ interface
{ X Error Handler }
oldXHandler: TXErrorHandler;
end;
TIOManager = class(TIOManager_Abstract)
public
constructor Create;
@ -109,7 +115,7 @@ interface
end;
function MufasaXErrorHandler(para1:PDisplay; para2:PXErrorEvent):cint; cdecl;
implementation
uses GraphType, interfacebase, lcltype;
@ -126,7 +132,7 @@ implementation
{
This is extremely hacky, but also very useful.
We have to install a X error handler, because otherwise X
will terminate out entire app on error.
will terminate our entire app on error.
Since we want the right thread to recieve the right error, we have to
fiddle a bit with threadvars, mutexes / semaphores.
@ -207,8 +213,8 @@ implementation
end;
{ See if the semaphores / CS are initialised }
constructor TWindow.Create(display: PDisplay; screennum: integer; window: x.TWindow);
begin
constructor TWindow.Create(display: PDisplay; screennum: integer; window: x.TWindow);
begin
inherited Create;
self.display:= display;
self.screennum:= screennum;
@ -227,8 +233,8 @@ implementation
finally
ErrorCS.Leave;
end;
end;
end;
destructor TWindow.Destroy;
var
erh: TXErrorHandler;
@ -304,8 +310,8 @@ implementation
if ReceivedError then
raise Exception.Create('Error: ActivateClient: ' + GetError);
end;
function TWindow.ReturnData(xs, ys, width, height: Integer): TRetData;
function TWindow.ReturnData(xs, ys, width, height: Integer): TRetData;
var
w,h: integer;
begin
@ -334,8 +340,8 @@ implementation
dirty:= true;
//XSetErrorHandler(Old_Handler);
end;
procedure TWindow.FreeReturnData;
procedure TWindow.FreeReturnData;
begin
if dirty then
begin
@ -413,33 +419,40 @@ implementation
result := xmask and ButtonP > 0;
end;
{ TODO: Check if this supports multiple keyboard layouts, probably not }
procedure TWindow.SendString(str: string);
var
i: integer;
key: byte;
HoldShift : boolean;
I, L: Integer;
K: Byte;
HoldShift: Boolean;
begin
HoldShift := false;
for i := 1 to length(str) do
HoldShift := False;
L := Length(str);
for I := 1 to L do
begin
if((str[i] >= 'A') and (str[i] <= 'Z')) then
if (((str[I] >= 'A') and (str[I] <= 'Z')) or
((str[I] >= '!') and (str[I] <= '&')) or
((str[I] >= '(') and (str[I] <= '+')) or
(str[I] = ':') or
((str[I] >= '<') and (str[I] <= '@')) or
((str[I] >= '^') and (str[I] <= '_')) or
((str[I] >= '{') and (str[I] <= '~'))) then
begin
HoldKey(VK_SHIFT);
HoldShift:= True;
str[i] := lowerCase(str[i]);
end else
if HoldShift then
begin
HoldShift:= false;
ReleaseKey(VK_SHIFT);
end;
key:= GetKeyCode(str[i]);
HoldKey(key);
//BenLand100: You should probably wait here...
ReleaseKey(key);
HoldShift := True;
end;
K := GetKeyCode(str[I]);
HoldKey(K);
Sleep(20);
ReleaseKey(K);
if (HoldShift) then
begin
HoldShift := False;
ReleaseKey(VK_SHIFT);
end;
end;
if HoldShift then
ReleaseKey(VK_SHIFT);
end;
procedure TWindow.HoldKey(key: integer);
@ -468,7 +481,7 @@ implementation
Raise Exception.CreateFMT('GetSimpleKeyCode - char (%s) is not in A..z',[c]);
end
end;
{ ***implementation*** IOManager }
constructor TIOManager.Create;
@ -493,17 +506,17 @@ implementation
{ Get the Desktop Window }
desktop:= RootWindow(display,screennum)
end;
procedure TIOManager.NativeFree;
procedure TIOManager.NativeFree;
begin
XCloseDisplay(display);
end;
procedure TIOManager.SetDesktop;
begin
SetBothTargets(TWindow.Create(display, screennum, desktop));
end;
function TIOManager.SetTarget(target: x.TWindow): integer;
begin
result := SetBothTargets(TWindow.Create(display, screennum, target))

View File

@ -366,34 +366,34 @@ begin
end;
end;
procedure TWindow.SendString(str: string);
var
i: integer;
key: byte;
HoldShift : boolean;
procedure TWindow.SendString(str: string);
var
I, L: integer;
C: Byte;
ScanCode, VK: Word;
Shift: boolean;
begin
L := Length(str);
for I := 1 to L do
begin
HoldShift := false;
for i := 1 to length(str) do
begin
if((str[i] >= 'A') and (str[i] <= 'Z')) then
begin
HoldKey(VK_SHIFT);
HoldShift:= True;
str[i] := lowerCase(str[i]);
end else
if HoldShift then
begin
HoldShift:= false;
ReleaseKey(VK_SHIFT);
end;
key:= GetKeyCode(str[i]);
HoldKey(key);
//BenLand100 note: probably should wait here
ReleaseKey(key);
end;
if HoldShift then
ReleaseKey(VK_SHIFT);
VK := VkKeyScan(str[I]);
Shift := (Hi(VK) > 0);
C := LoByte(VK);
ScanCode := MapVirtualKey(C, 0);
if (ScanCode = 0) then
Continue;
if (Shift) then
Keybd_Event(VK_SHIFT, $2A, 0, 0);
Keybd_Event(C, ScanCode, 0, 0);
Keybd_Event(C, ScanCode, KEYEVENTF_KEYUP, 0);
if (Shift) then
Keybd_Event(VK_SHIFT, $2A, KEYEVENTF_KEYUP, 0);
end;
end;
procedure TWindow.HoldKey(key: integer);
begin
keyinput.Down(key);

View File

@ -67,6 +67,7 @@ function FloodFillTPA(const TPA : TPointArray) : T2DPointArray;
procedure FilterPointsPie(var Points: TPointArray; const SD, ED, MinR, MaxR: Extended; Mx, My: Integer);
procedure FilterPointsDist(var Points: TPointArray; const MinDist,MaxDist: Extended; Mx, My: Integer);
procedure FilterPointsLine(var Points: TPointArray; Radial: Extended; Radius, MX, MY: Integer);
procedure FilterTPADist(var TPA: TPointArray; maxDist: integer);
function RemoveDistTPointArray(x, y, dist: Integer;const ThePoints: TPointArray; RemoveHigher: Boolean): TPointArray;
function GetATPABounds(const ATPA: T2DPointArray): TBox;
function GetTPABounds(const TPA: TPointArray): TBox;
@ -1168,6 +1169,55 @@ begin
Points:= P;
end;
{/\
Removes points in the TPA that are within maxDist of each other.
/\}
procedure FilterTPADist(var TPA: TPointArray; maxDist: integer);
var
c, i, j, l, h, maxDistSq: integer;
newTPA: TPointArray;
inBadElements: TBooleanArray;
begin
h := high(TPA);
l := (h + 1);
maxDistSq := (maxDist * maxDist);
setLength(inBadElements, l);
setLength(newTPA, l);
for i := 0 to h do
inBadElements[i] := false;
for i := 0 to (h - 1) do
begin
if (inBadElements[i]) then
continue;
for j := (i + 1) to h do
begin
if (inBadElements[j]) then
continue;
// simplified -> a^2 + b^2 <= c^2
if (((TPA[i].x - TPA[j].x) * (TPA[i].x - TPA[j].x)) + ((TPA[i].y - TPA[j].y) * (TPA[i].y - TPA[j].y)) <= maxDistSq) then
inBadElements[j] := true;
end;
end;
c := 0;
// set the new TPA
for i := 0 to h do
if (not inBadElements[i]) then
begin
newTPA[c] := TPA[i];
inc(c);
end;
setLength(newTPA, c);
TPA := newTPA;
end;
{/\
Removes the points that are inside or outside the distance Dist from the point (x, y) from the TPointArray ThePoints.
/\}

View File

@ -94,7 +94,8 @@ type
TPSOnNeedFile = function (Sender: TObject; const OrginFileName: tbtstring; var FileName, Output: tbtstring): Boolean of object;
{ Added by Wizzup }
TPSOnFileAlreadyIncluded = function (Sender: TObject; FileName: tbtstring): Boolean of object;
TPSOnFileAlreadyIncluded = function (Sender: TObject; OrgFileName, FileName: tbtstring): Boolean of object;
TPSOnIncludingFile = function (Sender: TObject; OrgFileName, FileName: tbtstring): Boolean of object;
{ Wizzup out }
TPSOnProcessDirective = procedure (
@ -127,6 +128,7 @@ type
FOnNeedFile: TPSOnNeedFile;
{ Added by Wizzup }
FOnFileAlreadyIncluded: TPSOnFileAlreadyIncluded;
FOnIncludingFile: TPSOnIncludingFile;
{ Wizzup out }
FUsePreProcessor: Boolean;
FDefines: TStrings;
@ -161,7 +163,8 @@ type
//--jgv new
function DoOnNeedFile (Sender: TObject; const OrginFileName: tbtstring; var FileName, Output: tbtstring): Boolean; virtual;
{ Added by Wizzup }
function DoOnFileAlreadyIncluded (Sender: TObject; FileName: tbtstring): Boolean; virtual;
function DoOnFileAlreadyIncluded (Sender: TObject; OrgFileName, FileName: tbtstring): Boolean; virtual;
function DoOnIncludingFile (Sender: TObject; OrgFileName, FileName: tbtstring): Boolean; virtual;
{ Wizzup out }
function DoOnUnknowUses (Sender: TPSPascalCompiler; const Name: tbtstring): Boolean; virtual; // return true if processed
procedure DoOnCompImport; virtual;
@ -300,6 +303,7 @@ type
{ Added by Wizzup }
property OnFileAlreadyIncluded: TPSOnFileAlreadyIncluded read FOnFileAlreadyIncluded write FOnFileAlreadyIncluded;
property OnIncludingFile: TPSOnIncludingFile read FOnIncludingFile write FOnIncludingFile;
{ Wizzup out }
property Defines: TStrings read FDefines write SetDefines;
@ -553,9 +557,14 @@ begin
end;
{ Added by Wizzup }
function CEOnFileAlreadyIncluded(Sender: TPSPreProcessor; FileName: tbtstring): Boolean;
function CEOnFileAlreadyIncluded(Sender: TPSPreProcessor; OrgFileName, FileName: tbtstring): Boolean;
begin
Result := TPSScript (Sender.ID).DoOnFileAlreadyIncluded(Sender.ID, Filename);
Result := TPSScript (Sender.ID).DoOnFileAlreadyIncluded(Sender.ID, OrgFileName, Filename);
end;
function CEOnIncludingFile(Sender: TPSPreProcessor; OrgFileName, FileName: tbtstring): Boolean;
begin
Result := TPSScript (Sender.ID).DoOnIncludingFile(Sender.ID, OrgFileName, Filename);
end;
{ Wizzup out }
@ -675,6 +684,7 @@ begin
{ Added by Wizzup }
FPP.OnFileAlreadyIncluded:= CEOnFileAlreadyIncluded;
FPP.OnIncludingFile:= CEOnIncludingFile;
{ Wizzup out }
FDefines := TStringList.Create;
@ -1081,10 +1091,19 @@ end;
{ Added by Wizzup }
function TPSScript.DoOnFileAlreadyIncluded(Sender: TObject;
FileName: tbtstring): Boolean;
OrgFileName, FileName: tbtstring): Boolean;
begin
If Assigned (OnFileAlreadyIncluded) then
Result := OnFileAlreadyIncluded(Sender, FileName)
Result := OnFileAlreadyIncluded(Sender, OrgFileName, FileName)
else
Result := False;
end;
function TPSScript.DoOnIncludingFile(Sender: TObject;
OrgFileName, FileName: tbtstring): Boolean;
begin
If Assigned (OnIncludingFile) then
Result := OnIncludingFile(Sender, OrgFileName, FileName)
else
Result := False;
end;

View File

@ -311,7 +311,7 @@ begin T := Self.TabIndex; end;
(*----------------------------------------------------------------------------*)
procedure TTabControlNoteBookStringsNoteBook_R(Self: TTabControlNoteBookStrings; var T: TNoteBook);
begin T := TNoteBook(Self.NoteBook); end;
begin T := Self.NoteBook; end;
(*----------------------------------------------------------------------------*)
procedure TTabControlStringsTabWidth_W(Self: TTabControlStrings; const T: Smallint);

View File

@ -16,7 +16,8 @@ type
TPSOnNeedFile = function (Sender: TPSPreProcessor; const callingfilename: tbtstring; var FileName, Output: tbtstring): Boolean;
{ Added by Wizzup }
TPSOnFileAlreadyIncluded = function (Sender: TPSPreProcessor; FileName: tbtstring): Boolean;
TPSOnFileAlreadyIncluded = function (Sender: TPSPreProcessor; OrgFileName, FileName: tbtstring): Boolean;
TPSOnIncludingFile = function (Sender: TPSPreProcessor; OrgFileName, FileName: tbtstring): Boolean;
{ Wizzup out }
TPSOnProcessDirective = procedure (
@ -99,6 +100,7 @@ type
FOnNeedFile: TPSOnNeedFile;
{ Added by Wizzup }
FOnFileAlreadyIncluded: TPSOnFileAlreadyIncluded;
FOnIncludingFile: TPSOnIncludingFile;
{ Wizzup out }
FAddedPosition: Cardinal;
FDefineState: TPSDefineStates;
@ -120,6 +122,7 @@ type
{ Added by Wizzup }
property OnFileAlreadyIncluded: TPSOnFileAlreadyIncluded read FOnFileAlreadyIncluded write FOnFileAlreadyIncluded;
property OnIncludingFile: TPSOnIncludingFile read FOnIncludingFile write FOnIncludingFile;
{ Wizzup out }
property Defines: TStringList read FDefines write FDefines;
@ -633,6 +636,8 @@ begin
begin
if FDefineState.DoWrite then
begin
if assigned(@OnIncludingFile) then
OnIncludingFile(self , Filename, s);
FAddedPosition := 0;
IntPreProcess(Level +1, FileName, s, Dest);
FCurrentLineInfo.Current := current;
@ -646,7 +651,7 @@ begin
raise EPSPreProcessor.CreateFmt(RPS_IncludeOnceNotFound, [FileName, OrgFileName])
else
begin
if not OnFileAlreadyIncluded(Self, FileName) then
if not OnFileAlreadyIncluded(Self, FileName, s) then
begin
FAddedPosition := 0;
IntPreProcess(Level +1, FileName, s, Dest);

View File

@ -85,14 +85,14 @@ procedure RIRegisterTPANEL(Cl: TPSRuntimeClassImporter);
begin
Cl.Add(TPANEL);
end;
procedure TPagePageIndex_R(Self: TCustomPage; var T: INTEGER); begin T := Self.PageIndex; end;
procedure TPagePageIndex_W(Self: TCustomPage; T: INTEGER); begin Self.PageIndex := T; end;
procedure TPageOnShow_R(Self: TCustomPage; var T: TNotifyEvent); begin T := Self.OnShow; end;
procedure TPageOnShow_W(Self: TCustomPage; T: TNotifyEvent); begin Self.OnShow := T; end;
procedure TPagePageIndex_R(Self: TPAGE; var T: INTEGER); begin T := Self.PageIndex; end;
procedure TPagePageIndex_W(Self: TPAGE; T: INTEGER); begin Self.PageIndex := T; end;
procedure TPageOnShow_R(Self: TPAGE; var T: TNotifyEvent); begin T := Self.OnShow; end;
procedure TPageOnShow_W(Self: TPAGE; T: TNotifyEvent); begin Self.OnShow := T; end;
{$IFNDEF CLX}
procedure RIRegisterTPAGE(Cl: TPSRuntimeClassImporter);
begin
with Cl.Add(TCustomPage) do
with Cl.Add(TPAGE) do
begin
RegisterPropertyHelper(@TPagePageIndex_R,@TPagePageIndex_W,'PageIndex');
RegisterEventPropertyHelper(@TPageOnShow_R,@TPageOnShow_W,'OnShow');
@ -106,7 +106,7 @@ begin
with Cl.Add(TNOTEBOOK) do
begin
{$IFDEF FPC}
// RegisterMethod(@TNoteBook.TabIndexAtClientPos,'TABINDEXATCLIENTPOS');
RegisterMethod(@TNoteBook.TabIndexAtClientPos,'TABINDEXATCLIENTPOS');
{$ENDIF}
RegisterPropertyHelper(@TNoteBookPageCount_R,nil,'PAGECOUNT');
end;

@ -1 +1 @@
Subproject commit 1b8211db373428cd2916905980ad51be8fab1f83
Subproject commit b24c52b9748c6f9f3e91a7a86f727022bf2fd6ce