mirror of
https://github.com/moparisthebest/Simba
synced 2024-12-22 15:28:50 -05:00
Changes for settings.
git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@389 3f818213-9676-44b0-a9b4-5e4c4e03d09d
This commit is contained in:
parent
baf574c414
commit
c387bbde93
@ -53,7 +53,7 @@ Mufasa is:
|
|||||||
and it is possible to make this, with the right effort. \\
|
and it is possible to make this, with the right effort. \\
|
||||||
\item Open minded. We appreciate your help, ideas and critisism!
|
\item Open minded. We appreciate your help, ideas and critisism!
|
||||||
\item Well documented. Well... At least we are aiming towards being
|
\item Well documented. Well... At least we are aiming towards being
|
||||||
well documented, but there is probably work left.
|
well documented, but there is still some work left.
|
||||||
\end{itemize}
|
\end{itemize}
|
||||||
|
|
||||||
\pagebreak
|
\pagebreak
|
||||||
@ -239,9 +239,12 @@ sub point points are arelative to the main point.
|
|||||||
|
|
||||||
\begin{verbatim}
|
\begin{verbatim}
|
||||||
pDTM = record
|
pDTM = record
|
||||||
|
l: Integer;
|
||||||
p: TPointArray;
|
p: TPointArray;
|
||||||
c, t, asz, ash: TIntegerArray;
|
c, t, asz, ash: TIntegerArray;
|
||||||
end;
|
bp: Array Of Boolean;
|
||||||
|
n: String;
|
||||||
|
end;
|
||||||
\end{verbatim}
|
\end{verbatim}
|
||||||
|
|
||||||
\subsection{Example of a simple DTM}
|
\subsection{Example of a simple DTM}
|
||||||
@ -307,16 +310,18 @@ between the two given colours.
|
|||||||
Area Size and Shape add that nifty extra functionality to DTM's.
|
Area Size and Shape add that nifty extra functionality to DTM's.
|
||||||
\textbf{Area Size} defines the area that should all match the colour
|
\textbf{Area Size} defines the area that should all match the colour
|
||||||
with the given tolerance. \\
|
with the given tolerance. \\
|
||||||
|
\textbf{Area Shape} is currently not implemented, mainly because
|
||||||
|
we haven't found a good use for area shapes.
|
||||||
|
|
||||||
The \textbf{Area Shape} defines the Shape of the Area Size.
|
%The \textbf{Area Shape} defines the Shape of the Area Size.
|
||||||
Currently, the following shapes are supported:
|
%Currently, the following shapes are supported:
|
||||||
\begin{itemize}
|
%\begin{itemize}
|
||||||
\item Rectangle
|
% \item Rectangle
|
||||||
\item Cross
|
% \item Cross
|
||||||
\item DiagonalCross
|
% \item DiagonalCross
|
||||||
\item Circle
|
% \item Circle
|
||||||
\item Triangle\footnote{Not fully implemented yet.}
|
% \item Triangle\footnote{Not fully implemented yet.}
|
||||||
\end{itemize}
|
%\end{itemize}
|
||||||
|
|
||||||
\subsection{Loading a DTM from a string}
|
\subsection{Loading a DTM from a string}
|
||||||
|
|
||||||
@ -338,7 +343,7 @@ One may know DTM's as a different type:
|
|||||||
TDTM = record
|
TDTM = record
|
||||||
MainPoint: TDTMPointDef;
|
MainPoint: TDTMPointDef;
|
||||||
SubPoints: TDTMPointDefArray;
|
SubPoints: TDTMPointDefArray;
|
||||||
end;
|
end;
|
||||||
\end{verbatim}
|
\end{verbatim}
|
||||||
|
|
||||||
The MML provides the two functions \textbf{pDTMtoTDTM} and \textbf{TDTMtopDTM} to
|
The MML provides the two functions \textbf{pDTMtoTDTM} and \textbf{TDTMtopDTM} to
|
||||||
@ -393,6 +398,11 @@ Bitmap.FData[20 * 50 + 5].b := 255;
|
|||||||
You can also name a bitmap by setting the BmpName property.
|
You can also name a bitmap by setting the BmpName property.
|
||||||
This may come in handy when working with multiple bitmaps.
|
This may come in handy when working with multiple bitmaps.
|
||||||
|
|
||||||
|
\section{Finder class}
|
||||||
|
The finder class contains all the methods that are used to ``identify''
|
||||||
|
pixels\footnote{Also contains methods for bitmaps on bitmaps, dtms, etc}
|
||||||
|
and more on other bitmaps; or just on a window.
|
||||||
|
|
||||||
\section{Notes on the previously mentioned classes}
|
\section{Notes on the previously mentioned classes}
|
||||||
|
|
||||||
|
|
||||||
|
@ -92,6 +92,7 @@ begin
|
|||||||
Path := Settings.GetNodePath(N.Parent);
|
Path := Settings.GetNodePath(N.Parent);
|
||||||
NewVal := InputBox('Change Setting', 'Change value for ' + N.Parent.Text,
|
NewVal := InputBox('Change Setting', 'Change value for ' + N.Parent.Text,
|
||||||
Settings.GetKeyValue(Path));
|
Settings.GetKeyValue(Path));
|
||||||
|
writeln('NewVal: ' + NewVal);
|
||||||
Settings.SetKeyValue(Path, NewVal);
|
Settings.SetKeyValue(Path, NewVal);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
@ -492,7 +492,7 @@ procedure TForm1.RunScript;
|
|||||||
var
|
var
|
||||||
DbgImgInfo : TDbgImgInfo;
|
DbgImgInfo : TDbgImgInfo;
|
||||||
fontPath: String;
|
fontPath: String;
|
||||||
saveAfterSetting: Boolean = false;
|
loadFontsOnScriptStart: String;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
with CurrScript do
|
with CurrScript do
|
||||||
@ -534,36 +534,34 @@ begin
|
|||||||
ScriptThread.Client.MWindow.SetWindow(Self.Window);
|
ScriptThread.Client.MWindow.SetWindow(Self.Window);
|
||||||
|
|
||||||
|
|
||||||
|
loadFontsOnScriptStart := SettingsForm.Settings.GetSetLoadSaveDefaultKeyValueIfNotExists(
|
||||||
|
'Settings/Fonts/LoadOnStartUp', 'True', SimbaSettingsFile);
|
||||||
// Copy our current fonts
|
// Copy our current fonts
|
||||||
if not assigned(Self.OCR_Fonts) then
|
if not assigned(Self.OCR_Fonts) and (lowercase(loadFontsOnScriptStart) = 'true') then
|
||||||
begin
|
begin
|
||||||
Self.OCR_Fonts := TMOCR.Create(ScriptThread.Client);
|
Self.OCR_Fonts := TMOCR.Create(ScriptThread.Client);
|
||||||
|
|
||||||
if lowercase(
|
fontPath := SettingsForm.Settings.GetSetLoadSaveDefaultKeyValueIfNotExists(
|
||||||
SettingsForm.Settings.GetSetLoadSaveDefaultKeyValueIfNotExists(
|
|
||||||
'Settings/Fonts/LoadOnStartUp', 'True', SimbaSettingsFile)
|
|
||||||
) = 'true' then
|
|
||||||
begin
|
|
||||||
fontPath := SettingsForm.Settings.GetSetLoadSaveDefaultKeyValueIfNotExists(
|
|
||||||
'Settings/Fonts/Path',
|
'Settings/Fonts/Path',
|
||||||
IncludeTrailingPathDelimiter(ExpandFileName(MainDir
|
IncludeTrailingPathDelimiter(ExpandFileName(MainDir
|
||||||
+DS + '..' + DS + '..' + ds)) + 'Fonts' + DS,
|
+DS + '..' + DS + '..' + ds)) + 'Fonts' + DS,
|
||||||
SimbaSettingsFile
|
SimbaSettingsFile
|
||||||
);
|
);
|
||||||
|
|
||||||
if DirectoryExists(fontPath) then
|
if DirectoryExists(fontPath) then
|
||||||
begin
|
begin
|
||||||
OCR_Fonts.InitTOCR(fontPath);
|
OCR_Fonts.InitTOCR(fontPath);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
writeln('Warning: The Font directory in the Settings is not valid. Changing to default.');
|
writeln('Warning: The Font directory in the Settings is not valid. Changing to default.');
|
||||||
OCR_Fonts.InitTOCR(IncludeTrailingPathDelimiter(ExpandFileName(MainDir +DS + '..' + DS + '..' + ds)) + 'Fonts' + DS);
|
OCR_Fonts.InitTOCR(IncludeTrailingPathDelimiter(ExpandFileName(MainDir +DS + '..' + DS + '..' + ds)) + 'Fonts' + DS);
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
end;
|
|
||||||
ScriptThread.Client.MOCR.SetFonts(OCR_Fonts.GetFonts);
|
|
||||||
|
|
||||||
|
ScriptThread.Client.MOCR.SetFonts(OCR_Fonts.GetFonts);
|
||||||
|
end else
|
||||||
|
if assigned(Self.OCR_Fonts) and (lowercase(loadFontsOnScriptStart) = 'true') then
|
||||||
|
ScriptThread.Client.MOCR.SetFonts(OCR_Fonts.GetFonts);
|
||||||
ScriptThread.OnTerminate:=@ScriptThreadTerminate;
|
ScriptThread.OnTerminate:=@ScriptThreadTerminate;
|
||||||
ScriptState:= ss_Running;
|
ScriptState:= ss_Running;
|
||||||
//Lets run it!
|
//Lets run it!
|
||||||
@ -1479,8 +1477,13 @@ begin
|
|||||||
Picker.Pick(c, x, y);
|
Picker.Pick(c, x, y);
|
||||||
cobj := TColourPickerObject.Create(c, Point(x,y), '');
|
cobj := TColourPickerObject.Create(c, Point(x,y), '');
|
||||||
|
|
||||||
ColourHistoryForm.AddColObj(cobj, true);
|
if lowercase(SettingsForm.Settings.GetSetLoadSaveDefaultKeyValueIfNotExists(
|
||||||
ColourHistoryForm.Show;
|
'Settings/ColourPicker/ShowHistoryOnPick', 'True', SimbaSettingsFile
|
||||||
|
)) = 'true' then
|
||||||
|
begin
|
||||||
|
ColourHistoryForm.AddColObj(cobj, true);
|
||||||
|
ColourHistoryForm.Show;
|
||||||
|
end;
|
||||||
formWriteln('Picked colour: ' + inttostr(c) + ' at (' + inttostr(x) + ', ' + inttostr(y) + ')');
|
formWriteln('Picked colour: ' + inttostr(c) + ' at (' + inttostr(x) + ', ' + inttostr(y) + ')');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -316,7 +316,7 @@ begin
|
|||||||
|
|
||||||
i := 0;
|
i := 0;
|
||||||
|
|
||||||
N := N.GetNextSibling;
|
N := N.GetFirstChild;
|
||||||
while N <> nil do
|
while N <> nil do
|
||||||
begin
|
begin
|
||||||
if N.Text <> 'Value' then
|
if N.Text <> 'Value' then
|
||||||
@ -497,10 +497,15 @@ var
|
|||||||
N, NN: TTreeNode;
|
N, NN: TTreeNode;
|
||||||
begin
|
begin
|
||||||
if not KeyExists(KeyName) then
|
if not KeyExists(KeyName) then
|
||||||
|
begin
|
||||||
|
writeln('SetKeyValue - Key does not exist');
|
||||||
Exit;
|
Exit;
|
||||||
|
end;
|
||||||
if not IsKey(KeyName) then
|
if not IsKey(KeyName) then
|
||||||
|
begin
|
||||||
|
writeln('SetKeyValue - IsKey returned false');
|
||||||
Exit;
|
Exit;
|
||||||
|
end;
|
||||||
N := WalkToNode(KeyName);
|
N := WalkToNode(KeyName);
|
||||||
|
|
||||||
if not N.HasChildren then
|
if not N.HasChildren then
|
||||||
@ -520,6 +525,7 @@ begin
|
|||||||
TSettingData(N.Data).Free;
|
TSettingData(N.Data).Free;
|
||||||
N.Data := TSettingData.Create;
|
N.Data := TSettingData.Create;
|
||||||
TSettingData(N.Data).Val := KeyValue;
|
TSettingData(N.Data).Val := KeyValue;
|
||||||
|
writeln('Setting ' + KeyName + 'to ' + KeyValue);
|
||||||
end;
|
end;
|
||||||
N := N.GetNextSibling;
|
N := N.GetNextSibling;
|
||||||
end;
|
end;
|
||||||
@ -531,6 +537,7 @@ procedure TMMLSettings.LoadFromXML(fileName: String);
|
|||||||
var
|
var
|
||||||
Doc: TXMLDocument;
|
Doc: TXMLDocument;
|
||||||
begin
|
begin
|
||||||
|
Nodes.Clear;
|
||||||
ReadXMLFile(Doc, fileName);
|
ReadXMLFile(Doc, fileName);
|
||||||
InternalLoadFromXML(Doc);
|
InternalLoadFromXML(Doc);
|
||||||
Doc.Free;
|
Doc.Free;
|
||||||
|
@ -1796,8 +1796,6 @@ var
|
|||||||
C: Array of Integer;
|
C: Array of Integer;
|
||||||
|
|
||||||
// Bitwise
|
// Bitwise
|
||||||
// TODO: Change to record. One that indicates if there is a match at bit i
|
|
||||||
// and one that indicates it has already been tested at bit i...
|
|
||||||
b: Array of Array of Integer;
|
b: Array of Array of Integer;
|
||||||
|
|
||||||
// bounds
|
// bounds
|
||||||
|
Loading…
Reference in New Issue
Block a user