diff --git a/branches/script-component/Projects/OCRBench/project1.lpi b/branches/script-component/Projects/OCRBench/project1.lpi
index ecec126..2d9400f 100644
--- a/branches/script-component/Projects/OCRBench/project1.lpi
+++ b/branches/script-component/Projects/OCRBench/project1.lpi
@@ -7,7 +7,7 @@
-
+
@@ -31,12 +31,12 @@
-
+
-
+
@@ -44,10 +44,10 @@
-
-
+
+
-
+
@@ -73,10 +73,10 @@
-
-
-
-
+
+
+
+
@@ -84,8 +84,8 @@
-
-
+
+
@@ -93,8 +93,8 @@
-
-
+
+
@@ -102,8 +102,8 @@
-
-
+
+
@@ -117,17 +117,15 @@
-
-
-
-
+
+
@@ -135,8 +133,8 @@
-
-
+
+
@@ -156,24 +154,26 @@
-
-
+
+
-
-
-
+
+
+
+
+
-
-
-
-
+
+
+
+
@@ -181,150 +181,175 @@
-
-
-
-
+
+
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
+
-
+
-
-
+
+
-
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
diff --git a/branches/script-component/Projects/OCRBench/unit1.pas b/branches/script-component/Projects/OCRBench/unit1.pas
index e0cb9ae..94e2a9d 100644
--- a/branches/script-component/Projects/OCRBench/unit1.pas
+++ b/branches/script-component/Projects/OCRBench/unit1.pas
@@ -6,7 +6,9 @@ interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
- StdCtrls, ExtCtrls, Client, MufasaTypes, Bitmaps, ocr, windowselector,window;
+ StdCtrls, ExtCtrls, Client, MufasaTypes, Bitmaps, ocr, windowselector,
+ {$IFDEF MSWINDOWS} os_windows, {$ENDIF}
+ {$IFDEF LINUX} os_linux {$ENDIF};
type
@@ -31,7 +33,7 @@ type
BitmapPath: String;
FontPath: String;
- CliW: TMWindow;
+ CliW: TIOManager;
UseClient: Boolean;
{ private declarations }
public
@@ -79,14 +81,14 @@ begin
Form1.Image1.Canvas.Rectangle(0, 0, Form1.Image1.Canvas.Width, Form1.Image1.Canvas.Height);
// create and init client
- C := TClient.Create;
+ C := TClient.Create('');
bmp := TMufasaBitmap.Create;
if UseClient then
- C.MWindow.SetWindow(CliW)
+ C.IOManager.SetTarget(TWindow(CliW.GetImageTarget).GetNativeWindow())
else
begin
bmp.LoadFromFile(BitmapPath);
- C.MWindow.SetTarget(bmp);
+ C.IOManager.SetTarget(bmp);
end;
Shadow :=FShadow.Checked;
@@ -158,7 +160,7 @@ Var
begin
UseClient := True;
if not assigned(CliW) then
- CliW := TMWindow.Create;
+ CliW := TIOManager.Create;
WS := TMWindowSelector.Create(CliW);
CliW.SetTarget(WS.Drag{$IFDEF WINDOWS},w_Window{$ENDIF});
end;
diff --git a/branches/script-component/Projects/SAMufasaGUI/project1.ico b/branches/script-component/Projects/SAMufasaGUI/project1.ico
new file mode 100644
index 0000000..e350cac
Binary files /dev/null and b/branches/script-component/Projects/SAMufasaGUI/project1.ico differ
diff --git a/branches/script-component/Projects/SAMufasaGUI/project1.lpi b/branches/script-component/Projects/SAMufasaGUI/project1.lpi
index 3b30106..89413a5 100644
--- a/branches/script-component/Projects/SAMufasaGUI/project1.lpi
+++ b/branches/script-component/Projects/SAMufasaGUI/project1.lpi
@@ -10,12 +10,13 @@
-
+
+
-
-
+
+
@@ -139,11 +140,9 @@
-
-
-
+
+
-
@@ -191,7 +190,7 @@
-
+
@@ -266,9 +265,9 @@
-
-
-
+
+
+
@@ -350,7 +349,7 @@
-
+
@@ -495,11 +494,9 @@
-
-
-
-
-
+
+
+
@@ -538,10 +535,8 @@
-
-
+
-
@@ -627,10 +622,8 @@
-
-
+
-
@@ -713,9 +706,11 @@
-
+
+
+
@@ -770,9 +765,9 @@
-
-
-
+
+
+
@@ -892,11 +887,9 @@
-
-
-
+
+
-
@@ -1546,7 +1539,9 @@
+
+
@@ -1595,7 +1590,7 @@
-
+
@@ -1622,7 +1617,9 @@
+
+
@@ -1650,7 +1647,7 @@
-
+
@@ -1708,10 +1705,10 @@
-
-
-
-
+
+
+
+
@@ -1727,7 +1724,7 @@
-
+
@@ -1738,7 +1735,7 @@
-
+
@@ -1859,7 +1856,7 @@
-
+
@@ -1897,7 +1894,7 @@
-
+
@@ -1954,7 +1951,7 @@
-
+
@@ -2000,19 +1997,19 @@
-
-
+
+
-
+
-
-
-
+
+
+
@@ -2025,10 +2022,10 @@
-
-
-
-
+
+
+
+
@@ -2049,11 +2046,9 @@
-
-
-
-
-
+
+
+
@@ -2064,10 +2059,10 @@
-
-
-
-
+
+
+
+
@@ -2088,130 +2083,128 @@
+
+
-
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
-
-
@@ -2230,6 +2223,12 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/branches/script-component/Projects/SAMufasaGUI/project1.lpr b/branches/script-component/Projects/SAMufasaGUI/project1.lpr
index 0db1af9..d925af1 100644
--- a/branches/script-component/Projects/SAMufasaGUI/project1.lpr
+++ b/branches/script-component/Projects/SAMufasaGUI/project1.lpr
@@ -35,6 +35,8 @@ libloader;
//{$R project1.res}
+{$R project1.res}
+
begin
Application.Title:='Simba';
Application.Initialize;
diff --git a/branches/script-component/Projects/SAMufasaGUI/project1.res b/branches/script-component/Projects/SAMufasaGUI/project1.res
new file mode 100644
index 0000000..da688d6
Binary files /dev/null and b/branches/script-component/Projects/SAMufasaGUI/project1.res differ
diff --git a/branches/script-component/Projects/SAMufasaGUI/testunit.pas b/branches/script-component/Projects/SAMufasaGUI/testunit.pas
index ece40ea..9883219 100644
--- a/branches/script-component/Projects/SAMufasaGUI/testunit.pas
+++ b/branches/script-component/Projects/SAMufasaGUI/testunit.pas
@@ -43,7 +43,7 @@ uses
ColorBox , about, framefunctionlist, ocr, updateform, simbasettings;
const
- SimbaVersion = 462;
+ SimbaVersion = 469;
type
diff --git a/branches/script-component/Units/MMLCore/iomanager.pas b/branches/script-component/Units/MMLCore/iomanager.pas
index 29405e9..4ae2e9b 100644
--- a/branches/script-component/Units/MMLCore/iomanager.pas
+++ b/branches/script-component/Units/MMLCore/iomanager.pas
@@ -222,7 +222,9 @@ interface
procedure PressKey(key: Word);
procedure SendText(text: string);
function isKeyDown(key: Word): Boolean;
-
+
+ function GetImageTarget: TTarget;
+
protected
keymouse: TTarget;
image: TTarget;
@@ -231,6 +233,7 @@ interface
bothsame: boolean;
procedure SetImageTarget(target: TTarget);
+
procedure SetKeyMouseTarget(target: TTarget);
procedure SetBothTargets(target: TTarget);
procedure NativeInit; virtual; abstract;
@@ -290,6 +293,12 @@ begin
image:= target;
bothsame:= false;
end;
+
+function TIOManager_Abstract.GetImageTarget: TTarget;
+begin
+ result := image;
+end;
+
procedure TIOManager_Abstract.SetKeyMouseTarget(target: TTarget);
begin
if not(bothsame) then keymouse.Free();
@@ -340,17 +349,34 @@ begin
result:= frozen <> nil;
end;
-function TIOManager_Abstract.GetColor(x,y : integer) : TColor; begin result:= image.GetColor(x,y); end;
-function TIOManager_Abstract.ReturnData(xs,ys,width,height: integer): TRetData; begin result:= image.ReturnData(xs,ys,width,height); end;
-procedure TIOManager_Abstract.FreeReturnData; begin image.freeReturnData(); end;
+function TIOManager_Abstract.GetColor(x,y : integer) : TColor;
+begin
+ result:= image.GetColor(x,y);
+end;
+function TIOManager_Abstract.ReturnData(xs,ys,width,height: integer): TRetData;
+begin
+ result:= image.ReturnData(xs,ys,width,height);
+end;
+procedure TIOManager_Abstract.FreeReturnData;
+begin
+ image.freeReturnData();
+end;
+
+function TIOManager_Abstract.SetTarget(ArrPtr: PRGB32; Size: TPoint): integer;
+begin
+ SetImageTarget(TRawTarget.Create(ArrPtr,Size.X,Size.Y));
+end;
+function TIOManager_Abstract.SetTarget(bmp : TMufasaBitmap) : integer;
+begin
+ SetImageTarget(TRawTarget.Create(bmp.FData,bmp.width,bmp.height));
+end;
-function TIOManager_Abstract.SetTarget(ArrPtr: PRGB32; Size: TPoint): integer; begin SetImageTarget(TRawTarget.Create(ArrPtr,Size.X,Size.Y)); end;
-function TIOManager_Abstract.SetTarget(bmp : TMufasaBitmap) : integer; begin SetImageTarget(TRawTarget.Create(bmp.FData,bmp.width,bmp.height)); end;
function TIOManager_Abstract.SetTarget(name: string; initargs: pointer): integer;
var
client: TEIOS_Client;
begin
- if not eios_controller.ClientExists(name) then raise Exception.Create('EIOS Client by specified name does not exist');
+ if not eios_controller.ClientExists(name) then
+ raise Exception.Create('EIOS Client by specified name does not exist');
client:= eios_controller.GetClient(name);
SetBothTargets(TEIOS_Target.Create(client, initargs));
end;
@@ -369,10 +395,23 @@ begin
{not sure if image needs activation or not, if its a native window keymouse == image so it should be good.}
end;
-procedure TIOManager_Abstract.GetMousePos(var X, Y: Integer); begin keymouse.GetMousePosition(x,y) end;
-procedure TIOManager_Abstract.SetMousePos(X, Y: Integer); begin keymouse.MoveMouse(x,y); end;
-procedure TIOManager_Abstract.HoldMouse(x,y : integer; button: TClickType); begin keymouse.ReleaseMouse(x,y,button); end;
-procedure TIOManager_Abstract.ReleaseMouse(x,y : integer; button: TClickType); begin keymouse.ReleaseMouse(x,y,button); end;
+procedure TIOManager_Abstract.GetMousePos(var X, Y: Integer);
+begin
+ keymouse.GetMousePosition(x,y)
+end;
+procedure TIOManager_Abstract.SetMousePos(X, Y: Integer);
+begin
+ keymouse.MoveMouse(x,y);
+end;
+procedure TIOManager_Abstract.HoldMouse(x,y : integer; button: TClickType);
+begin
+ keymouse.HoldMouse(x,y,button);
+end;
+procedure TIOManager_Abstract.ReleaseMouse(x,y : integer; button: TClickType);
+begin
+ keymouse.ReleaseMouse(x,y,button);
+end;
+
procedure TIOManager_Abstract.ClickMouse(X, Y: Integer; button: TClickType);
begin
HoldMouse(x,y,button);
@@ -380,11 +419,28 @@ begin
ReleaseMouse(x,y,button);
end;
-procedure TIOManager_Abstract.KeyUp(key: Word); begin keymouse.ReleaseKey(key) end;
-procedure TIOManager_Abstract.KeyDown(key: Word); begin keymouse.HoldKey(key) end;
-procedure TIOManager_Abstract.PressKey(key: Word); begin keyup(key); keydown(key); end;
-procedure TIOManager_Abstract.SendText(text: string); begin keymouse.SendString(text); end;
-function TIOManager_Abstract.isKeyDown(key: Word): Boolean; begin result:= keymouse.IsKeyHeld(key); end;
+procedure TIOManager_Abstract.KeyUp(key: Word);
+begin
+ keymouse.ReleaseKey(key)
+end;
+procedure TIOManager_Abstract.KeyDown(key: Word);
+begin
+ keymouse.HoldKey(key)
+end;
+procedure TIOManager_Abstract.PressKey(key: Word);
+begin
+ keyup(key);
+ keydown(key);
+end;
+procedure TIOManager_Abstract.SendText(text: string);
+begin
+ keymouse.SendString(text);
+end;
+
+function TIOManager_Abstract.isKeyDown(key: Word): Boolean;
+begin
+ result:= keymouse.IsKeyHeld(key);
+end;
//***implementation*** TTarget
diff --git a/branches/script-component/Units/MMLCore/ocr.pas b/branches/script-component/Units/MMLCore/ocr.pas
index 661a5a5..b665f6c 100644
--- a/branches/script-component/Units/MMLCore/ocr.pas
+++ b/branches/script-component/Units/MMLCore/ocr.pas
@@ -54,7 +54,7 @@ uses
procedure FilterShadowBitmap(bmp: TMufasaBitmap);
procedure FilterCharsBitmap(bmp: TMufasaBitmap);
- function GetTextAt(atX, atY, font, minspacing, maxspacing, color, len: integer): string;
+ function GetTextAt(atX, atY, minspacing, maxspacing, color, tol, len: integer; font: string): string;
function TextToFontTPA(Text, font: String; var w, h: integer): TPointArray;
function TextToFontBitmap(Text, font: String): TMufasaBitmap;
function TextToMask(Text, font: String): TMask;
@@ -704,9 +704,17 @@ begin
result := GetUpTextAtEx(atX, atY, false);
end;
-function TMOCR.GetTextAt(atX, atY, font, minspacing, maxspacing, color, len: integer): string;
+function TMOCR.GetTextAt(atX, atY, minspacing, maxspacing, color, tol, len: integer; font: string): string;
+
+var
+ fD: TocrData;
+ TPA: TPointArray;
begin
+ fD := Fonts.GetFont(font);
+ SetLength(TPA, 0);
+ TClient(Client).MFinder.FindColorsTolerance(TPA, color, atX, atY, {fuck}0, {fuck}0, tol);
+
end;
diff --git a/branches/script-component/Units/MMLCore/os_linux.pas b/branches/script-component/Units/MMLCore/os_linux.pas
index 19c23f0..7bb6c32 100644
--- a/branches/script-component/Units/MMLCore/os_linux.pas
+++ b/branches/script-component/Units/MMLCore/os_linux.pas
@@ -57,6 +57,8 @@ interface
procedure HoldKey(key: integer); override;
procedure ReleaseKey(key: integer); override;
function IsKeyHeld(key: integer): boolean; override;
+
+ function GetNativeWindow: x.TWindow;
private
display: PDisplay;
screennum: integer;
@@ -131,7 +133,12 @@ implementation
keyinput.Free;
inherited Destroy;
end;
-
+
+ function TWindow.GetNativeWindow: x.TWindow;
+ begin
+ result := self.window;
+ end;
+
procedure TWindow.GetTargetDimensions(var w, h: integer);
var
Old_Handler: TXErrorHandler;
diff --git a/branches/script-component/Units/MMLCore/os_windows.pas b/branches/script-component/Units/MMLCore/os_windows.pas
index 79e4d17..91648c1 100644
--- a/branches/script-component/Units/MMLCore/os_windows.pas
+++ b/branches/script-component/Units/MMLCore/os_windows.pas
@@ -58,6 +58,8 @@ interface
procedure HoldKey(key: integer); override;
procedure ReleaseKey(key: integer); override;
function IsKeyHeld(key: integer): boolean; override;
+
+ function GetNativeWindow: Hwnd;
private
handle: Hwnd;
dc: HDC;
@@ -160,6 +162,11 @@ implementation
inherited Destroy;
end;
+ function TWindow.GetNativeWindow: Hwnd;
+ begin
+ result := handle;
+ end;
+
function TWindow.TargetValid: boolean;
begin
result:= IsWindow(handle);