mirror of
https://github.com/moparisthebest/Simba
synced 2025-03-03 10:51:49 -05:00
Cleanup (deleted unneeded variables etc).
git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@574 3f818213-9676-44b0-a9b4-5e4c4e03d09d
This commit is contained in:
parent
77b4ea33ea
commit
9e398674ae
@ -31,17 +31,17 @@ interface
|
||||
|
||||
uses
|
||||
{$ifdef linux}cthreads,{$endif}Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
|
||||
StdCtrls, Menus, ComCtrls, ExtCtrls, SynEdit, SynHighlighterPas, SynMemo,
|
||||
StdCtrls, Menus, ComCtrls, ExtCtrls, SynEdit, SynHighlighterPas,
|
||||
//Client,
|
||||
MufasaTypes,
|
||||
mmlpsthread,synedittypes,
|
||||
{$IFDEF MSWINDOWS} os_windows, {$ENDIF} //For ColorPicker etc.
|
||||
{$IFDEF LINUX} os_linux, {$ENDIF} //For ColorPicker etc.
|
||||
colourpicker, framescript, windowselector, lcltype, ActnList, StdActns,
|
||||
SynExportHTML, SynEditKeyCmds, SynEditHighlighter, SynEditMarkupSpecialLine,
|
||||
SynEditMarkupHighAll, SynEditMiscClasses, LMessages, Buttons, PairSplitter,
|
||||
colourpicker, framescript, windowselector, lcltype, ActnList,
|
||||
SynExportHTML, SynEditKeyCmds, SynEditHighlighter,
|
||||
SynEditMarkupHighAll, LMessages, Buttons,
|
||||
stringutil,mufasatypesutil,
|
||||
ColorBox , about, framefunctionlist, ocr, updateform, simbasettings;
|
||||
about, framefunctionlist, ocr, updateform, simbasettings;
|
||||
|
||||
const
|
||||
SimbaVersion = 571;
|
||||
@ -379,12 +379,10 @@ var
|
||||
|
||||
implementation
|
||||
uses
|
||||
lclintf,plugins,
|
||||
lclintf,
|
||||
syncobjs, // for the critical sections
|
||||
debugimage,
|
||||
bitmaps,
|
||||
colourhistory,
|
||||
simpleanalyzer,
|
||||
math;
|
||||
|
||||
//{$ifdef mswindows}
|
||||
@ -1729,6 +1727,7 @@ var
|
||||
Temp2Node : TTreeNode;
|
||||
Tree : TTreeView;
|
||||
begin
|
||||
SetLength(nodes,0);
|
||||
if frmFunctionList.FunctionList.Items.Count = 0 then
|
||||
begin;
|
||||
Methods := TMThread.GetExportedMethods;
|
||||
@ -1997,12 +1996,6 @@ begin
|
||||
end;
|
||||
|
||||
procedure TForm1.FunctionListShown(ShowIt: boolean);
|
||||
var
|
||||
Node : TTreeNode;
|
||||
tmpNode : TTreeNode;
|
||||
Tree : TTreeView;
|
||||
Analyzer : TScriptAnalyzer;
|
||||
I,ii : integer;
|
||||
begin
|
||||
with MenuItemFunctionList, frmFunctionList do
|
||||
begin
|
||||
@ -2158,8 +2151,6 @@ begin
|
||||
end;
|
||||
|
||||
function TForm1.CanExitOrOpen: boolean;
|
||||
var
|
||||
I : integer;
|
||||
begin;
|
||||
Self.Enabled := False;//We HAVE to answer the popup
|
||||
Result := True;
|
||||
@ -2194,8 +2185,10 @@ end;
|
||||
|
||||
function TForm1.ClearScript: boolean;
|
||||
begin
|
||||
result := false;
|
||||
if CanExitOrOpen then
|
||||
begin;
|
||||
result := true;
|
||||
CurrTab.Clear;
|
||||
RefreshTab();
|
||||
end;
|
||||
|
@ -3,14 +3,14 @@ begin
|
||||
result := GetPage(S);
|
||||
end;
|
||||
|
||||
function ps_InitializeHTTPClient(HandleCookies, HandleRedirects: Boolean): Integer; extdecl;
|
||||
function ps_InitializeHTTPClient(HandleCookies: Boolean): Integer; extdecl;
|
||||
begin
|
||||
result := CurrThread.MInternet.CreateHTTPClient(HandleCookies);
|
||||
end;
|
||||
|
||||
procedure ps_FreeHTTPClient(Client: Integer); extdecl;
|
||||
begin;
|
||||
CurrThread.MInternet.GetHTTPClient(Client).Free;
|
||||
CurrThread.MInternet.FreeHTTPClient(client);
|
||||
end;
|
||||
|
||||
function ps_GetHTTPPage(Client: Integer; URL: string): string; extdecl;
|
||||
|
@ -159,7 +159,7 @@ AddFunction(@ps_explodewrap,'procedure ExplodeWrap(del, str: string; var res : T
|
||||
SetCurrSection('Web');
|
||||
AddFunction(@OpenWebPage,'procedure OpenWebPage(url : string);');
|
||||
AddFunction(@ps_GetPage,'function GetPage(url : string): string;');
|
||||
AddFunction(@ps_InitializeHTTPClient,'function InitializeHTTPClient(HandleCookies, HandleRedirects: Boolean): Integer;');
|
||||
AddFunction(@ps_InitializeHTTPClient,'function InitializeHTTPClient(HandleCookies: Boolean): Integer;');
|
||||
AddFunction(@ps_FreeHTTPClient,'procedure FreeHTTPClient(Client: Integer);');
|
||||
AddFunction(@ps_GetHTTPPage,'function GetHTTPPage(Client: Integer; URL: string): string;');
|
||||
AddFunction(@ps_SetHTTPUserAgent,'procedure SetHTTPUserAgent(Client: Integer; Agent: string);');
|
||||
|
@ -44,8 +44,6 @@ type
|
||||
end;
|
||||
|
||||
implementation
|
||||
uses
|
||||
synacode;
|
||||
|
||||
{ OTHER }
|
||||
function GetPage(URL: String): String;
|
||||
|
@ -227,8 +227,6 @@ begin;
|
||||
end;
|
||||
|
||||
function writeln_(Caller: TPSExec; p: TPSExternalProcRec; Global, Stack: TPSStack): Boolean;
|
||||
var
|
||||
arr: TPSVariantIFC;
|
||||
begin
|
||||
Result:=true;
|
||||
psWriteln(makeString(NewTPSVariantIFC(Stack[Stack.Count-1],false)));
|
||||
@ -259,8 +257,6 @@ begin
|
||||
end;
|
||||
|
||||
function ToStr_(Caller: TPSExec; p: TPSExternalProcRec; Global, Stack: TPSStack): Boolean;
|
||||
var
|
||||
data: TPSVariantIFC;
|
||||
begin
|
||||
result := true;
|
||||
Stack.SetAnsiString(-1, MakeString(NewTPSVariantIFC(Stack[Stack.Count-2],false)));
|
||||
@ -527,6 +523,7 @@ function TPSThread.PSScriptFindUnknownFile(Sender: TObject;
|
||||
const OrginFileName: string; var FileName, Output: string): Boolean;
|
||||
begin
|
||||
Writeln(OrginFileName + '-' + Output + '-' + FileName);
|
||||
Result := false;
|
||||
end;
|
||||
|
||||
procedure TPSThread.PSScriptProcessUnknowDirective(Sender: TPSPreProcessor;
|
||||
@ -762,8 +759,7 @@ begin
|
||||
end;
|
||||
|
||||
function Interpreter_Precompiler(name, args: PChar): boolean; stdcall;
|
||||
var
|
||||
local_name, local_args: string;
|
||||
|
||||
begin
|
||||
result:= CurrThread.ProcessDirective(name, args);
|
||||
end;
|
||||
@ -818,7 +814,7 @@ end;
|
||||
|
||||
procedure TCPThread.Execute;
|
||||
var
|
||||
i,ii: integer;
|
||||
i: integer;
|
||||
begin
|
||||
CurrThread := Self;
|
||||
Starttime := GetTickCount;
|
||||
|
@ -28,14 +28,11 @@ unit settings;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, ComCtrls, xmlread, xmlwrite, DOM;
|
||||
Classes, SysUtils, ComCtrls, xmlread, xmlwrite, DOM,mufasatypes;
|
||||
|
||||
|
||||
|
||||
type
|
||||
// remove later
|
||||
TStringArray = Array Of String;
|
||||
|
||||
TSettingData = class(TObject)
|
||||
public
|
||||
Val: String;
|
||||
@ -104,7 +101,7 @@ type
|
||||
|
||||
implementation
|
||||
uses
|
||||
strutils;
|
||||
stringutil;
|
||||
|
||||
constructor TSettingData.Create;
|
||||
begin
|
||||
@ -184,30 +181,8 @@ begin
|
||||
end;
|
||||
|
||||
function TMMLSettings.KeyNameToKeys(KeyName: String): TStringArray;
|
||||
// yay for SRL!
|
||||
function srl_Explode(str, del: string): TStringArray;
|
||||
var
|
||||
i, l, dL: Integer;
|
||||
begin
|
||||
i := 0;
|
||||
l := -1;
|
||||
SetLength(Result, 0);
|
||||
if (str = '') then
|
||||
Exit;
|
||||
dL := Length(del) - 1;
|
||||
repeat
|
||||
Inc(l);
|
||||
SetLength(Result, l + 1);
|
||||
i := Pos(del, str);
|
||||
if i <= 0 then
|
||||
Break;
|
||||
Result[l] := Copy(str, 1, i - 1);
|
||||
Delete(str, 1, i + dL);
|
||||
until false;
|
||||
Result[l] := Copy(str, 1, Length(str));
|
||||
end;
|
||||
begin
|
||||
Result := srl_Explode(KeyName, '/');
|
||||
Result := Explode('/',KeyName);
|
||||
end;
|
||||
|
||||
function TMMLSettings.WalkToNode(KeyName: String): TTreeNode;
|
||||
@ -277,8 +252,6 @@ end;
|
||||
function TMMLSettings.ListKeys(KeyName: String): TStringArray;
|
||||
var
|
||||
N: TTreeNode;
|
||||
i: Integer;
|
||||
S: TStringArray;
|
||||
begin
|
||||
SetLength(Result, 0);
|
||||
N := WalkToNode(KeyName);
|
||||
@ -552,10 +525,6 @@ end;
|
||||
procedure TMMLSettings.WriteXMLData(n: TTreeNode;
|
||||
XMLNode: TDOMNode; XMLDoc: TXMLDocument;
|
||||
var XMLChild: TDOMNode; var C: Integer);
|
||||
|
||||
var
|
||||
DDataNode, DataNode: TDOMNode;
|
||||
|
||||
begin
|
||||
if assigned(n.data) and (n.HasChildren) then
|
||||
writeln('Has data and children! Please close simba and remove settings.xml. if problem persists, please report your settings.xml');
|
||||
|
@ -84,7 +84,7 @@ begin;
|
||||
result := str;
|
||||
l := length(str);
|
||||
cap := true;
|
||||
Range := ['a'..'z'] + ['A'..'Z'];
|
||||
Range := ['a'..'z','A'..'Z'];
|
||||
for i := 1 to l do
|
||||
if cap and (str[i] in Range) then
|
||||
begin;
|
||||
@ -101,9 +101,10 @@ var
|
||||
begin;
|
||||
case Extract of
|
||||
Numbers : Range := ['0'..'9'];
|
||||
Letters : Range := ['A'..'Z'] + ['a'..'z'];
|
||||
Others : Range := [#0..#255] - ['0'..'9'] - ['A'..'Z'] - ['a'..'z'];
|
||||
Letters : Range := ['A'..'Z','a'..'z'];
|
||||
Others : Range := [#0..#255] - ['0'..'9','A'..'Z','a'..'z'];
|
||||
end;
|
||||
Result := '';
|
||||
for i := length(str) downto 1 do
|
||||
if str[i] in Range then
|
||||
result := str[i] + result;
|
||||
|
@ -85,8 +85,7 @@ type
|
||||
|
||||
|
||||
implementation
|
||||
uses
|
||||
strings;
|
||||
|
||||
|
||||
procedure TMMLFileDownloader.SetBasePath(s: string);
|
||||
begin
|
||||
@ -128,9 +127,6 @@ end;
|
||||
|
||||
procedure TMMLFileDownloader.OnMonitor(Sender: TObject; Writing: Boolean;
|
||||
const Buffer: TMemory; Len: Integer);
|
||||
|
||||
var
|
||||
i,p:integer;
|
||||
begin
|
||||
if writing then exit;
|
||||
Inc(FTotal, len);
|
||||
@ -154,8 +150,6 @@ function TMMLFileDownloader.DownloadAndSave: Boolean;
|
||||
|
||||
var
|
||||
response: TStream;
|
||||
i:integer;
|
||||
f: TFileStream;
|
||||
|
||||
begin
|
||||
Result := False;
|
||||
|
@ -120,7 +120,7 @@ implementation
|
||||
|
||||
uses
|
||||
paszlib,DCPbase64,math,
|
||||
colour_conv,IOManager,mufasatypesutil,tpa;
|
||||
colour_conv,IOManager,mufasatypesutil;
|
||||
|
||||
// Needs more fixing. We need to either copy the memory ourself, or somehow
|
||||
// find a TRawImage feature to skip X bytes after X bytes read. (Most likely a
|
||||
@ -651,7 +651,7 @@ end;
|
||||
|
||||
function TMufasaBitmap.CreateTPA(SearchCol: TColor): TPointArray;
|
||||
var
|
||||
x,y,L,I : Integer;
|
||||
x,y,L : Integer;
|
||||
StartPtr : PRGB32;
|
||||
Search : TRGB32;
|
||||
begin
|
||||
@ -661,7 +661,7 @@ begin
|
||||
StartPtr := Self.FData;
|
||||
For y := 0 to Self.h - 1 do
|
||||
For x := 0 to self.w - 1 do
|
||||
if LongWord(StartPtr^) = LongWord(SearchCol) then
|
||||
if LongWord(StartPtr^) = LongWord(Search) then
|
||||
begin;
|
||||
L := L + 1;
|
||||
Result[L].x := x;
|
||||
|
@ -76,7 +76,7 @@ type
|
||||
|
||||
implementation
|
||||
uses
|
||||
Client, dtmutil, paszlib,
|
||||
dtmutil, paszlib,
|
||||
graphics, // for TColor
|
||||
math // for max
|
||||
;
|
||||
@ -124,11 +124,11 @@ begin
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
Function AreaShape(Color, Tolerance, Size, Shape: Integer; P: TPoint) : Boolean; inline;
|
||||
{Function AreaShape(Color, Tolerance, Size, Shape: Integer; P: TPoint) : Boolean; inline;
|
||||
|
||||
Begin
|
||||
|
||||
End;
|
||||
End;}
|
||||
|
||||
// Rotates the given point (p) by A (in radians) around the point defined by cx, cy.
|
||||
|
||||
|
@ -54,7 +54,7 @@ const
|
||||
implementation
|
||||
uses math;
|
||||
|
||||
Function RotatePoints_(Var P: TPointArray; A, cx, cy: Extended): TPointArray ;
|
||||
procedure RotatePoints_(Var P: TPointArray; A, cx, cy: Extended);
|
||||
|
||||
Var
|
||||
I, L: Integer;
|
||||
@ -282,9 +282,6 @@ begin
|
||||
end;
|
||||
|
||||
function RotateDTM(const dtm: pdtm; angle: extended) : pDTM;
|
||||
|
||||
var
|
||||
i: integer;
|
||||
begin
|
||||
if length(dtm.p) = 0 then
|
||||
raise Exception.Create('RotateDTM, no points in DTM.');
|
||||
@ -293,8 +290,6 @@ begin
|
||||
end;
|
||||
|
||||
function copydtm(const dtm: pdtm): pdtm;
|
||||
var
|
||||
i: integer;
|
||||
begin
|
||||
initdtm(result,dtm.l);
|
||||
Move(dtm.p[0], result.p[0], length(dtm.p) * sizeof(Tpoint));
|
||||
|
@ -379,8 +379,6 @@ end;
|
||||
/\}
|
||||
|
||||
function TMFiles.FileSizeMuf(FileNum: Integer): LongInt;
|
||||
Var
|
||||
tempPos: Integer;
|
||||
begin
|
||||
|
||||
If(FileNum < 0) or (FileNum >= Length(MFiles)) Then
|
||||
@ -472,8 +470,6 @@ end;
|
||||
/\}
|
||||
|
||||
function TMFiles.WriteFileString(FileNum: Integer; s: string): Boolean;
|
||||
var
|
||||
BytesRead : DWord;
|
||||
begin
|
||||
If(FileNum < 0) or (FileNum >= Length(MFiles)) Then
|
||||
Begin
|
||||
|
@ -80,7 +80,7 @@ type
|
||||
function FindBitmapSpiral(bitmap: TMufasaBitmap; var x, y: Integer; xs, ys, xe, ye: Integer): Boolean;
|
||||
function FindBitmapSpiralTolerance(bitmap: TMufasaBitmap; var x, y: Integer; xs, ys, xe, ye,tolerance : integer): Boolean;
|
||||
function FindBitmapsSpiralTolerance(bitmap: TMufasaBitmap; x, y: Integer; out Points : TPointArray; xs, ys, xe, ye,tolerance: Integer): Boolean;
|
||||
function FindDeformedBitmapToleranceIn(bitmap: TMufasaBitmap; out x, y: Integer; xs, ys, xe, ye: Integer; tolerance: Integer; Range: Integer; AllowPartialAccuracy: Boolean; var accuracy: Extended): Boolean;
|
||||
function FindDeformedBitmapToleranceIn(bitmap: TMufasaBitmap; out x, y: Integer; xs, ys, xe, ye: Integer; tolerance: Integer; Range: Integer; AllowPartialAccuracy: Boolean; out accuracy: Extended): Boolean;
|
||||
|
||||
function FindDTM(DTM: pDTM; out x, y: Integer; x1, y1, x2, y2: Integer): Boolean;
|
||||
function FindDTMs(DTM: pDTM; out Points: TPointArray; x1, y1, x2, y2, maxToFind: Integer): Boolean;
|
||||
@ -1765,7 +1765,7 @@ end;
|
||||
|
||||
function TMFinder.FindDeformedBitmapToleranceIn(bitmap: TMufasaBitmap; out x,
|
||||
y: Integer; xs, ys, xe, ye: Integer; tolerance: Integer; Range: Integer;
|
||||
AllowPartialAccuracy: Boolean; var accuracy: Extended): Boolean;
|
||||
AllowPartialAccuracy: Boolean; out accuracy: Extended): Boolean;
|
||||
var
|
||||
MainRowdata : TPRGB32Array;
|
||||
BmpRowData : TPRGB32Array;
|
||||
|
@ -75,7 +75,7 @@ type
|
||||
implementation
|
||||
|
||||
uses
|
||||
files, MufasaTypes;
|
||||
MufasaTypes;
|
||||
|
||||
|
||||
constructor TMFont.Create;
|
||||
@ -194,8 +194,12 @@ var
|
||||
i: integer;
|
||||
begin
|
||||
i := GetFontIndex(Name);
|
||||
TMFont(Fonts.Items[i]).Free;
|
||||
Fonts.Delete(i);
|
||||
result := (i <> -1);
|
||||
if result then
|
||||
begin
|
||||
TMFont(Fonts.Items[i]).Free;
|
||||
Fonts.Delete(i);
|
||||
end;
|
||||
end;
|
||||
|
||||
function TMFonts.LoadFont(Name: String; Shadow: Boolean): boolean;
|
||||
|
@ -72,7 +72,6 @@ implementation
|
||||
procedure TGenericLoader.ValidateDirs;
|
||||
var
|
||||
i : integer;
|
||||
TempStr : string;
|
||||
begin
|
||||
for i := 0 to PluginDirs.Count - 1 do
|
||||
begin;
|
||||
@ -116,7 +115,6 @@ implementation
|
||||
function TGenericLoader.LoadPlugin(PluginName: string): Integer;
|
||||
var
|
||||
i, ii : integer;
|
||||
Status : LongInt;
|
||||
PlugExt: String = {$IFDEF LINUX}'.so';{$ELSE}'.dll';{$ENDIF}
|
||||
begin
|
||||
ii := -1;
|
||||
|
@ -56,7 +56,7 @@ uses
|
||||
|
||||
function GetTextAt(atX, atY, minvspacing, maxvspacing, hspacing,
|
||||
color, tol, len: integer; font: string): string;
|
||||
function TextToFontTPA(Text, font: String; var w, h: integer): TPointArray;
|
||||
function TextToFontTPA(Text, font: String; out w, h: integer): TPointArray;
|
||||
function TextToFontBitmap(Text, font: String): TMufasaBitmap;
|
||||
function TextToMask(Text, font: String): TMask;
|
||||
|
||||
@ -118,10 +118,6 @@ const
|
||||
|
||||
{ Constructor }
|
||||
constructor TMOCR.Create(Owner: TObject);
|
||||
|
||||
var
|
||||
files: TStringArray;
|
||||
|
||||
begin
|
||||
inherited Create;
|
||||
Self.Client := Owner;
|
||||
@ -145,15 +141,15 @@ function TMOCR.InitTOCR(path: string): boolean;
|
||||
var
|
||||
dirs: array of string;
|
||||
i: longint;
|
||||
dir: string;
|
||||
begin
|
||||
// We're going to load all fonts now
|
||||
Fonts.SetPath(path);
|
||||
dirs := GetDirectories(path);
|
||||
|
||||
Result := false;
|
||||
for i := 0 to high(dirs) do
|
||||
begin
|
||||
Fonts.LoadFont(dirs[i], false);
|
||||
if Fonts.LoadFont(dirs[i], false) then
|
||||
result := true;
|
||||
{$IFDEF FONTDEBUG}
|
||||
writeln('Loading ' + dirs[i]);
|
||||
{$ENDIF}
|
||||
@ -461,8 +457,6 @@ function TMOCR.getTextPointsIn(sx, sy, w, h: Integer; shadow: boolean;
|
||||
var
|
||||
bmp, shadowsbmp, charsbmp: TMufasaBitmap;
|
||||
x,y: integer;
|
||||
r,g,b: integer;
|
||||
n: TNormArray;
|
||||
{$IFDEF OCRDEBUG}
|
||||
dx,dy: integer;
|
||||
{$ENDIF}
|
||||
@ -620,6 +614,7 @@ begin
|
||||
bmp.Free;
|
||||
charsbmp.Free;
|
||||
shadowsbmp.Free;
|
||||
Result := true;
|
||||
end;
|
||||
|
||||
{
|
||||
@ -724,8 +719,6 @@ var
|
||||
fD: TocrData;
|
||||
TPA: TPointArray;
|
||||
STPA: T2DPointArray;
|
||||
bmp:tmufasabitmap;
|
||||
|
||||
|
||||
begin
|
||||
fD := Fonts.GetFont(font);
|
||||
@ -832,7 +825,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TMOCR.TextToFontTPA(Text, font: String; var w, h: integer): TPointArray;
|
||||
function TMOCR.TextToFontTPA(Text, font: String; out w, h: integer): TPointArray;
|
||||
|
||||
var
|
||||
fontD: TOcrData;
|
||||
@ -899,7 +892,6 @@ var
|
||||
i,x,y : integer;
|
||||
dx,dy : integer;
|
||||
c : integer;
|
||||
bmp: TMufasaBitmap;
|
||||
Pixels : array of array of boolean; //White = true
|
||||
begin
|
||||
TPA := TextToFontTPA(text, font, w, h);
|
||||
|
@ -65,7 +65,7 @@ type
|
||||
|
||||
implementation
|
||||
uses
|
||||
bitmaps, math,
|
||||
math,
|
||||
{Begin To-Remove units. Replace ReadBmp with TMufasaBitmap stuff later.}
|
||||
graphtype, intfgraphics,graphics;
|
||||
{End To-Remove unit}
|
||||
|
Loading…
x
Reference in New Issue
Block a user