1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-10-31 23:45:13 -04:00

Compare commits

..

No commits in common. "master" and "simba-0.97" have entirely different histories.

25 changed files with 228 additions and 1179 deletions

View File

@ -1,16 +1,39 @@
.PHONY: default clean tarball
core = client ocr
.PHONY: default clean intro psbook html all
all:
@python docgen.py `echo $(core) | sed -r \
's/(\w+)/..\/Units\/MMLCore\/\1.pas/g'` > /dev/null
@make -C sphinx/ html
intro_ := mufasa_intro
psbook_ := mufasa_ps_handbook
book_ := mufasa_handbook
dev_ := mufasa_developers
default: tex
clean:
@rm -f `echo $(core) | sed -r 's/(\w+)/sphinx\/\1.rst/g'`
@make -C sphinx/ 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
tarball:
@$(MAKE) all
@tar cjf doc.tar.bz2 -C sphinx/_build/ html
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

View File

@ -1,39 +0,0 @@
.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

View File

@ -1,22 +0,0 @@
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

@ -1,27 +1,5 @@
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.
# Change a minus to a plus when something is being worked on.
# Remove it when you are done.
# GENERAL
@ -34,3 +12,13 @@ Add examples to files in scriptref:
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

@ -18,12 +18,10 @@ 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;
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.
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,
@ -35,7 +33,7 @@ function.
Word of caution on bitmap creation
----------------------------------
Bitmaps in Simba are internally all instances of *TMufasaBitmap*. Scripts should
Bitmaps in Simba are internally all instances of *TMufasBitmap*. Scripts should
generally access bitmaps using their *handle*: an integer. All functions
referenced here either require a bitmap *handle* or return one.
@ -48,9 +46,7 @@ free it again)
.. code-block:: pascal
var bmp: TMufasaBitmap;
begin
bmp := TMufasBitmap.Create;
end;
bmp := TMufasBitmap.Create;
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
@ -79,12 +75,10 @@ then call this function to get the class reference.
var bmp: TMufasaBitmap;
bmph: integer;
begin;
bmph := CreateBitmap(100, 100);
bmp := GetMufasaBitmap(bmph);
bmph := CreateBitmap(100, 100);
bmp := GetMufasaBitmap(bmph);
bmp.SetSize(150,150); // also changes bmph, as they are the same bitmap.
end;
bmp.SetSize(150,150); // also changes bmph, as they are the same bitmap.
.. _scriptref-createbitmapstring:

View File

@ -11,8 +11,6 @@ Quicksort
procedure Quicksort(var Arr : TIntegerArray);
Sorts a TIntegerArray using the Quicksort algorithm
tSwap
-----
@ -21,8 +19,6 @@ tSwap
procedure tSwap(var a, b: TPoint);
Swaps the values of a and b around
tpaSwap
-------
@ -31,8 +27,6 @@ tpaSwap
procedure tpaSwap(var a, b: TPointArray);
Swaps the values of a and b around
SwapE
-----
@ -41,8 +35,6 @@ SwapE
procedure SwapE(var a, b: Extended);
Swaps the values of a and b around
RAaSTPAEx
---------
@ -51,7 +43,6 @@ 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
-------
@ -60,8 +51,6 @@ RAaSTPA
procedure RAaSTPA(var a: TPointArray; const Dist: Integer);
Leaves one point per box with the side length Dist
NearbyPointInArrayEx
--------------------
@ -70,8 +59,6 @@ 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
------------------
@ -80,8 +67,6 @@ 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
------------
@ -106,8 +91,6 @@ SortTPAFrom
procedure SortTPAFrom(var a: TPointArray; const From: TPoint);
Sorts the TPA a from the TPoint From
SortATPAFrom
------------
@ -116,8 +99,6 @@ SortATPAFrom
procedure SortATPAFrom(var a: T2DPointArray; const From: TPoint);
Sorts the T2DPointArray a from the TPoint From
SortATPAFromFirstPoint
----------------------
@ -134,8 +115,6 @@ InvertTPA
procedure InvertTPA(var a: TPointArray);
Reverses the TPA
InvertATPA
----------
@ -144,8 +123,6 @@ InvertATPA
procedure InvertATPA(var a: T2DPointArray);
Reverses the T2dPointArray
MiddleTPAEx
-----------
@ -154,8 +131,6 @@ MiddleTPAEx
function MiddleTPAEx(const TPA: TPointArray; var x, y: Integer): Boolean;
Stores the middle point from the TPA in x and y
MiddleTPA
---------
@ -164,8 +139,6 @@ MiddleTPA
function MiddleTPA(const tpa: TPointArray): TPoint;
Returns the middle TPA in the result
SortATPASize
------------
@ -174,8 +147,6 @@ 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
----------------
@ -184,8 +155,6 @@ 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
------------
@ -194,8 +163,6 @@ 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
----------
@ -204,8 +171,6 @@ InIntArray
function InIntArray(const a: TIntegerArray; Number: Integer): Boolean;
Returns true if Number is found in the TintegerArray a
ClearSameIntegers
-----------------
@ -214,8 +179,6 @@ ClearSameIntegers
procedure ClearSameIntegers(var a: TIntegerArray);
Deletes the indexes in the TintegerArray a which are duplicated
ClearSameIntegersAndTPA
-----------------------
@ -224,8 +187,6 @@ ClearSameIntegersAndTPA
procedure ClearSameIntegersAndTPA(var a: TIntegerArray; var p: TPointArray);
Deletes the indexes in the TIntegerArray a and TPointArray p which are duplicated
SplitTPAEx
----------
@ -234,8 +195,6 @@ 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
--------
@ -244,8 +203,6 @@ SplitTPA
function SplitTPA(const arr: TPointArray; Dist: Integer): T2DPointArray;
Splits the points with max distance Dist to their own TPointArrays
FloodFillTPA
------------
@ -262,9 +219,6 @@ 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
----------------
@ -273,8 +227,6 @@ 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
----------------
@ -283,9 +235,6 @@ 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
-------------
@ -294,8 +243,6 @@ GetATPABounds
function GetATPABounds(const ATPA: T2DPointArray): TBox;
Returns the boundaries of the T2DPointArray ATPA as a TBox
GetTPABounds
------------
@ -304,8 +251,6 @@ GetTPABounds
function GetTPABounds(const TPA: TPointArray): TBox;
Returns the boundaries of the TPointArray TPA as a TBox
FindTPAinTPA
------------
@ -314,8 +259,6 @@ 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
-----------------
@ -324,8 +267,6 @@ 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
----------------
@ -334,8 +275,6 @@ 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
--------------
@ -344,8 +283,6 @@ 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
----------
@ -354,8 +291,6 @@ 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
-----------
@ -364,8 +299,6 @@ RotatePoint
function RotatePoint(Const p: TPoint; angle, mx, my: Extended): TPoint;
Rotates the TPoint p around the center mx, my with the angle
ChangeDistPT
------------
@ -374,8 +307,6 @@ 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
-------------
@ -384,8 +315,6 @@ 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
-----------
@ -394,8 +323,6 @@ 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
---------------------
@ -404,8 +331,6 @@ 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
----------
@ -414,8 +339,6 @@ CombineTPA
function CombineTPA(const Ar1, Ar2: TPointArray): TPointArray;
Attaches the TPointArray Ar2 onto the end of Ar1 and returns it as the result
ReArrangeandShortenArrayEx
--------------------------
@ -424,8 +347,6 @@ 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
------------------------
@ -434,8 +355,6 @@ ReArrangeandShortenArray
function ReArrangeandShortenArray(const a: TPointArray; Dist: Integer): TPointArray;
Results the TPointArray a with one point per box with side length Dist left
TPAtoATPAEx
-----------
@ -444,8 +363,6 @@ 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
---------
@ -454,8 +371,6 @@ TPAtoATPA
function TPAtoATPA(const TPA: TPointArray; Dist: Integer): T2DPointArray;
Splits the TPA to boxes with sidelength Dist and results them as a T2DPointArray
CombineIntArray
---------------
@ -464,8 +379,6 @@ CombineIntArray
function CombineIntArray(const Ar1, Ar2: TIntegerArray): TIntegerArray;
Attaches the TIntegerArray Ar2 onto the end of Ar1 and returns it as the result
MergeATPA
---------
@ -474,8 +387,6 @@ MergeATPA
function MergeATPA(const ATPA : T2DPointArray) : TPointArray;
Combines all the TPointArrays from the T2DPointArray ATPA into the result
AppendTPA
---------
@ -484,8 +395,6 @@ AppendTPA
procedure AppendTPA(var TPA: TPointArray; const ToAppend: TPointArray);
Attaches the TPointArray ToAppend onto the end of TPA
TPAFromBox
----------
@ -494,8 +403,6 @@ TPAFromBox
function TPAFromBox(const Box : TBox) : TPointArray;
Create a TPointArray from the top left and the bottom right of the TBox Box
RotatePoints
------------
@ -504,8 +411,6 @@ 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
------------
@ -514,8 +419,6 @@ FindTPAEdges
function FindTPAEdges(const p: TPointArray): TPointArray;
Returns a TPointArray of the edge points of the TPointArray p
ClearTPAFromTPA
---------------
@ -524,8 +427,6 @@ ClearTPAFromTPA
function ClearTPAFromTPA(const arP, ClearPoints: TPointArray): TPointArray;
Removes the points in TPointArray ClearPoints from arP
ReturnPointsNotInTPA
--------------------
@ -534,8 +435,6 @@ 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
----------
@ -544,8 +443,6 @@ PointInTPA
function PointInTPA(p: TPoint;const arP: TPointArray): Boolean;
Returns true if the TPoint p is found in the TPointArray arP
ClearDoubleTPA
--------------
@ -554,8 +451,6 @@ ClearDoubleTPA
procedure ClearDoubleTPA(var TPA: TPointArray);
Deletes duplicate TPAs int he TPointArray TPA
TPACountSort
------------
@ -580,8 +475,6 @@ InvertTIA
procedure InvertTIA(var tI: TIntegerArray);
Reverses the TIntegerArray tI
SumIntegerArray
---------------
@ -590,8 +483,6 @@ SumIntegerArray
function SumIntegerArray(const Ints : TIntegerArray): Integer;
Retuns the sum of all the integers in the TIntegerArray Ints
AverageTIA
----------
@ -600,8 +491,6 @@ AverageTIA
function AverageTIA(const tI: TIntegerArray): Integer;
Gives an average of the sum of the integers in the TIntegerArray tI
AverageExtended
---------------
@ -610,8 +499,6 @@ AverageExtended
function AverageExtended(const tE: TExtendedArray): Extended;
Gives an average of the sum of the extendeds in the TExtendedArray tI
SplitTPAExWrap
--------------
@ -620,8 +507,6 @@ 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
------------
@ -630,8 +515,6 @@ 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
---------------
@ -640,8 +523,6 @@ 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
-------------------------
@ -650,8 +531,6 @@ 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
--------------
@ -660,8 +539,6 @@ 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
------------------------------
@ -670,8 +547,6 @@ 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
----------------------------
@ -680,8 +555,6 @@ 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
---------------
@ -690,8 +563,6 @@ 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
-------------
@ -700,8 +571,6 @@ 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
-------------------
@ -710,8 +579,6 @@ 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
------------------------
@ -720,8 +587,6 @@ 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
-------------
@ -730,8 +595,6 @@ MergeATPAWrap
procedure MergeATPAWrap(const ATPA : T2DPointArray; var Res: TPointArray);
Combines all the TPointArrays from the T2DPointArray ATPA into the TPointArray Res
TPAFromBoxWrap
--------------
@ -740,8 +603,6 @@ 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
----------------
@ -750,8 +611,6 @@ 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
----------------
@ -760,8 +619,6 @@ 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
-------------------
@ -770,8 +627,6 @@ 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
-------
@ -780,8 +635,6 @@ SameTPA
function SameTPA(const aTPA, bTPA: TPointArray): Boolean;
Returns true if the TPointArray aTPA is the same as bTPA
TPAInATPA
---------
@ -790,8 +643,6 @@ 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
---------
@ -800,8 +651,6 @@ OffsetTPA
procedure OffsetTPA(var TPA : TPointArray; const Offset : TPoint);
Offsets all the TPAs int the TPointArray TPA but the TPoint Offset
OffsetATPA
----------
@ -810,8 +659,6 @@ OffsetATPA
procedure OffsetATPA(var ATPA : T2DPointArray; const Offset : TPoint);
Offsets all the TPAs int the T2DPointArray ATPA but the TPoint Offset
CopyTPA
-------
@ -820,8 +667,6 @@ CopyTPA
function CopyTPA(const TPA : TPointArray) : TPointArray;
Returns the TPointArray TPA
CopyATPA
--------
@ -830,5 +675,4 @@ CopyATPA
function CopyATPA(const ATPA : T2DPointArray) : T2DPointArray;
Returns the T2DPointArray ATPA

View File

@ -142,8 +142,6 @@ 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
~~~~~~~~~~~~
@ -192,6 +190,7 @@ ListenSocket
ListenSocket allows for a client socket to accept connections.
AcceptSocket
~~~~~~~~~~~~
@ -250,15 +249,15 @@ SendSocket
SendSocket sends a string of data to a bound client socket.
SetSocketTimeout
SetTimeout
~~~~~~~~~~
.. code-block:: pascal
procedure SetSocketTimeout(Client, Time: integer);
procedure SetTimeout(Client, Time: integer);
SetTimeout sets a maximum amount of time for a bound client socket to wait for
data from another socket. Time is in *milliseconds*.
data from another socket.
SocketInfo
~~~~~~~~~~

View File

@ -44,7 +44,7 @@ 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\settings.xml"; DestDir: "{app}\"; 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

View File

@ -1,154 +0,0 @@
<?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

@ -1,95 +0,0 @@
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

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

View File

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

View File

@ -241,8 +241,7 @@ begin
FCancelling := False;
FCancelled := True;
DownloadSpeed.Visible := false;
Self.UpdateLog.Lines.Add('Download stopped at '+inttostr(DownloadProgress.Position)+
'%... Simba did not successfully update.');
Self.UpdateLog.Lines.Add('Download stopped at '+inttostr(DownloadProgress.Position)+'%... Simba did not succesfully 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

1
README
View File

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

39
TODO
View File

@ -3,24 +3,31 @@ 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 [X]
- Pass color information in struct [ ]
- Precalculate screen bitmap in current cts / keep a cache
to save comparisons [X]
- Add CTS 3 [/]
- Add a direct RGB -> CIE L*a*b conversion [/]
to save comparisons [ ]
- Add CTS 3 [ ]
- Add a direct RGB -> CIE L*a*b conversion [ ]
- Make sure colour conversions are inline [ ]
- More documentation:
- Cover all functions by at least mentioning the definition [/]
- Imported functions as well?
- Cover all functions by at least mentioning the definition [ ]
- Write tutorial [ ]
- In depth documentation per function [ ]
@ -29,17 +36,17 @@ Simple stuff, not required, may not be possible/useful:
- Lape! [ ]
- Integrate script manager [ ]
- Basic support. (Install scripts) [X]
- Update functionality [X]
- Uninstall scripts [X]
- Better storage / more stable storage [?]
- Pretty GUI [/]
- Merging / storing usernames when updating [?]
- Basic support. (Install scripts) [ ]
- Update functionality [ ]
- Uninstall scripts [ ]
- Better storage / more stable storage [ ]
- Pretty GUI [ ]
- Merging / storing usernames when updating [ ]
- Make Simba more ``modular'':
- Fonts [ ]
- Interpreters [/]
- Interpreters [ ]
- Code completion/hints [ ]
- Extensions [X]
- Extensions [ ]
- Interpreter system overhaul? [ ]

View File

@ -101,11 +101,6 @@ 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(topLeft,bottomRight: TPoint): TBox; extdecl;
function ps_PointToBox(PT1,PT2 : TPoint) : TBox; extdecl;
begin;
result.x1 := topLeft.x;
result.y1 := topLeft.y;
result.x2 := bottomRight.x;
result.y2 := bottomRight.y;
result.x1 := PT1.x;
result.y1 := PT1.y;
result.x2 := PT2.x;
result.y2 := PT2.y;
end;
function ps_PointInBox(PT : TPoint; Box: TBox): Boolean; extdecl;

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(topLeft,bottomRight: TPoint): TBox;');
AddFunction(@ps_PointToBox,'function PointToBox(PT1,PT2 : 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,7 +156,6 @@ 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);');

View File

@ -964,7 +964,7 @@ begin
if PSScript.Compile then
begin
OutputMessages;
psWriteln('Compiled successfully in ' + IntToStr(GetTickCount - Starttime) + ' ms.');
psWriteln('Compiled succesfully in ' + IntToStr(GetTickCount - Starttime) + ' ms.');
if CompileOnly then
exit;
// if not (ScriptState = SCompiling) then
@ -1208,7 +1208,7 @@ begin
RUTIS.Compile;
if not RUTIS.CompilerError then
begin
psWriteln('Compiled successfully in ' + IntToStr(GetTickCount - Starttime) + ' ms.');
psWriteln('Compiled succesfully in ' + IntToStr(GetTickCount - Starttime) + ' ms.');
if CompileOnly then
exit;
RUTIS.Run;

View File

@ -34,31 +34,10 @@ uses
{$IFDEF MSWINDOWS} os_windows {$ENDIF}
{$IFDEF LINUX} os_linux {$ENDIF};
(*
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.
*)
{
TClient is a full-blown instance of the MML.
It binds all the components together.
}
type
@ -78,31 +57,9 @@ 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
@ -112,17 +69,6 @@ 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
@ -140,17 +86,6 @@ begin
MOCR := TMOCR.Create(self);
end;
(*
TClient.Destroy
~~~~~~~~~~~~~~~
.. code-block:: pascal
destructor TClient.Destroy;
*)
destructor TClient.Destroy;
begin
if FOwnIOManager then

View File

@ -45,7 +45,6 @@ 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;
@ -335,21 +334,6 @@ 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

@ -33,18 +33,6 @@ 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 }
@ -143,18 +131,10 @@ begin
inherited Destroy;
end;
(*
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.
*)
{
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;
@ -208,7 +188,6 @@ 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
@ -229,16 +208,6 @@ 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;
@ -382,16 +351,6 @@ 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;
@ -498,18 +457,7 @@ begin
setlength(result,c);
end;
(*
FilterShadowBitmap
~~~~~~~~~~~~~~~~~~
.. code-block:: pascal
procedure TMOCR.FilterShadowBitmap(bmp: TMufasaBitmap);
Remove anything but the shadows on the bitmap (Shadow = clPurple)
*)
{ Remove anything but the shadows on the bitmap (Shadow = clPurple, remember?) }
procedure TMOCR.FilterShadowBitmap(bmp: TMufasaBitmap);
var
x,y:integer;
@ -525,20 +473,13 @@ begin
end;
end;
(*
{
Remove all but uptext colours clWhite,clGreen, etc.
See constants above.
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
*)
This assumes that the bitmap only consists of colour 0, and the other
constants founds above the functionss
}
procedure TMOCR.FilterCharsBitmap(bmp: TMufasaBitmap);
var
x,y: integer;
@ -568,27 +509,17 @@ end;
{
}
(*
getTextPointsIn
~~~~~~~~~~~~~~~
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.
.. 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:
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
@ -754,20 +685,14 @@ begin
Result := true;
end;
(*
GetUpTextAtEx
~~~~~~~~~~~~~
{
GetUpTextAtEx combines/uses the functions above.
.. 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)
*)
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)
}
function TMOCR.GetUpTextAtEx(atX, atY: integer; shadow: boolean): string;
var
@ -838,17 +763,6 @@ 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
@ -858,18 +772,6 @@ 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;
@ -929,17 +831,6 @@ 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
@ -960,17 +851,6 @@ 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
@ -993,19 +873,6 @@ 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
@ -1051,17 +918,6 @@ 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;
@ -1112,179 +968,3 @@ 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

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

View File

@ -85,14 +85,14 @@ procedure RIRegisterTPANEL(Cl: TPSRuntimeClassImporter);
begin
Cl.Add(TPANEL);
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;
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;
{$IFNDEF CLX}
procedure RIRegisterTPAGE(Cl: TPSRuntimeClassImporter);
begin
with Cl.Add(TPAGE) do
with Cl.Add(TCustomPage) 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;