1
0
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:
Wizzup? 2010-01-10 14:34:23 +00:00
parent baf574c414
commit c387bbde93
5 changed files with 56 additions and 37 deletions

View File

@ -53,7 +53,7 @@ Mufasa is:
and it is possible to make this, with the right effort. \\
\item Open minded. We appreciate your help, ideas and critisism!
\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}
\pagebreak
@ -239,8 +239,11 @@ sub point points are arelative to the main point.
\begin{verbatim}
pDTM = record
l: Integer;
p: TPointArray;
c, t, asz, ash: TIntegerArray;
bp: Array Of Boolean;
n: String;
end;
\end{verbatim}
@ -307,16 +310,18 @@ between the two given colours.
Area Size and Shape add that nifty extra functionality to DTM's.
\textbf{Area Size} defines the area that should all match the colour
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.
Currently, the following shapes are supported:
\begin{itemize}
\item Rectangle
\item Cross
\item DiagonalCross
\item Circle
\item Triangle\footnote{Not fully implemented yet.}
\end{itemize}
%The \textbf{Area Shape} defines the Shape of the Area Size.
%Currently, the following shapes are supported:
%\begin{itemize}
% \item Rectangle
% \item Cross
% \item DiagonalCross
% \item Circle
% \item Triangle\footnote{Not fully implemented yet.}
%\end{itemize}
\subsection{Loading a DTM from a string}
@ -393,6 +398,11 @@ Bitmap.FData[20 * 50 + 5].b := 255;
You can also name a bitmap by setting the BmpName property.
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}

View File

@ -92,6 +92,7 @@ begin
Path := Settings.GetNodePath(N.Parent);
NewVal := InputBox('Change Setting', 'Change value for ' + N.Parent.Text,
Settings.GetKeyValue(Path));
writeln('NewVal: ' + NewVal);
Settings.SetKeyValue(Path, NewVal);
end;
end;

View File

@ -492,7 +492,7 @@ procedure TForm1.RunScript;
var
DbgImgInfo : TDbgImgInfo;
fontPath: String;
saveAfterSetting: Boolean = false;
loadFontsOnScriptStart: String;
begin
with CurrScript do
@ -534,36 +534,34 @@ begin
ScriptThread.Client.MWindow.SetWindow(Self.Window);
loadFontsOnScriptStart := SettingsForm.Settings.GetSetLoadSaveDefaultKeyValueIfNotExists(
'Settings/Fonts/LoadOnStartUp', 'True', SimbaSettingsFile);
// Copy our current fonts
if not assigned(Self.OCR_Fonts) then
if not assigned(Self.OCR_Fonts) and (lowercase(loadFontsOnScriptStart) = 'true') then
begin
Self.OCR_Fonts := TMOCR.Create(ScriptThread.Client);
if lowercase(
SettingsForm.Settings.GetSetLoadSaveDefaultKeyValueIfNotExists(
'Settings/Fonts/LoadOnStartUp', 'True', SimbaSettingsFile)
) = 'true' then
begin
fontPath := SettingsForm.Settings.GetSetLoadSaveDefaultKeyValueIfNotExists(
fontPath := SettingsForm.Settings.GetSetLoadSaveDefaultKeyValueIfNotExists(
'Settings/Fonts/Path',
IncludeTrailingPathDelimiter(ExpandFileName(MainDir
+DS + '..' + DS + '..' + ds)) + 'Fonts' + DS,
SimbaSettingsFile
);
if DirectoryExists(fontPath) then
begin
OCR_Fonts.InitTOCR(fontPath);
end
else
begin
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);
end;
if DirectoryExists(fontPath) then
begin
OCR_Fonts.InitTOCR(fontPath);
end
else
begin
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);
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;
ScriptState:= ss_Running;
//Lets run it!
@ -1479,8 +1477,13 @@ begin
Picker.Pick(c, x, y);
cobj := TColourPickerObject.Create(c, Point(x,y), '');
ColourHistoryForm.AddColObj(cobj, true);
ColourHistoryForm.Show;
if lowercase(SettingsForm.Settings.GetSetLoadSaveDefaultKeyValueIfNotExists(
'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) + ')');
end;

View File

@ -316,7 +316,7 @@ begin
i := 0;
N := N.GetNextSibling;
N := N.GetFirstChild;
while N <> nil do
begin
if N.Text <> 'Value' then
@ -497,10 +497,15 @@ var
N, NN: TTreeNode;
begin
if not KeyExists(KeyName) then
begin
writeln('SetKeyValue - Key does not exist');
Exit;
end;
if not IsKey(KeyName) then
begin
writeln('SetKeyValue - IsKey returned false');
Exit;
end;
N := WalkToNode(KeyName);
if not N.HasChildren then
@ -520,6 +525,7 @@ begin
TSettingData(N.Data).Free;
N.Data := TSettingData.Create;
TSettingData(N.Data).Val := KeyValue;
writeln('Setting ' + KeyName + 'to ' + KeyValue);
end;
N := N.GetNextSibling;
end;
@ -531,6 +537,7 @@ procedure TMMLSettings.LoadFromXML(fileName: String);
var
Doc: TXMLDocument;
begin
Nodes.Clear;
ReadXMLFile(Doc, fileName);
InternalLoadFromXML(Doc);
Doc.Free;

View File

@ -1796,8 +1796,6 @@ var
C: Array of Integer;
// 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;
// bounds