1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-12-22 07:18:51 -05:00

Fixes mantis #39.

git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@395 3f818213-9676-44b0-a9b4-5e4c4e03d09d
This commit is contained in:
Wizzup? 2010-01-11 16:47:19 +00:00
parent 9be1743a7f
commit 6f9335edb1
2 changed files with 27 additions and 30 deletions

View File

@ -87,13 +87,14 @@ begin
pp := TSettingsForm(Sender).ScreenToClient(p);
N := SettingsTreeView.GetNodeAt(pp.x, pp.y);
if N <> nil then
if (N.Text = 'Value') and (N.Parent <> nil) then
if assigned(N.Data) then
begin
Path := Settings.GetNodePath(N.Parent);
NewVal := InputBox('Change Setting', 'Change value for ' + N.Parent.Text,
NewVal := InputBox('Change Setting', 'Change value for ' + TSettingData(N.Data).Val,
Settings.GetKeyValue(Path));
writeln('NewVal: ' + NewVal);
Settings.SetKeyValue(Path, NewVal);
N.Text := NewVal;
end;
end;

View File

@ -150,10 +150,7 @@ var
if Node = nil then Exit; // Stops if reached a leaf
// Adds a node to the tree
if (Node.NodeType = 3) then
s := 'Data'
else
s := Node.NodeName;
s := Node.NodeName;
TreeNode := Nodes.AddChild(TreeNode, s);
if (Node.NodeType = 3) then
@ -162,7 +159,7 @@ var
D.Val := Node.NodeValue;
TreeNode.Data := D;
TreeNode.Text := 'Value';
TreeNode.Text := Node.NodeValue;
end;
// Goes to the child node
cNode := Node.FirstChild;
@ -269,6 +266,8 @@ begin
result := '';
for i := high(s) downto 0 do
result := result + s[i] + '/';
if length(result) > 1 then
setlength(result,length(result)-1);
end;
{
@ -313,23 +312,20 @@ end;
function TMMLSettings.IsKey(KeyName: String): Boolean;
var
N: TTreeNode;
i: Integer;
begin
N := WalkToNode(KeyName);
if N = nil then
Exit(False);
i := 0;
N := N.GetFirstChild;
while N <> nil do
n := N.GetFirstChild;
while n <> nil do
begin
if N.Text <> 'Value' then
inc(i);
N := N.GetNextSibling;
if n.HasChildren then
exit(false);
n := N.GetNextSibling;
end;
Exit(i = 0);
exit(true);
end;
{
@ -361,9 +357,10 @@ begin
N := N.GetFirstChild;
while N <> nil do
begin
if N.Text = 'Value' then
if assigned(n.Data) then
Exit(TSettingData(n.Data).Val);
if assigned(n.Data) then
begin
Exit(TSettingData(n.Data).Val);
end;
N := N.GetNextSibling;
end;
Exit('');
@ -516,7 +513,7 @@ begin
if not N.HasChildren then
begin
NN := TTreeNode.Create(Nodes);
NN.Text := 'Value';
NN.Text := KeyValue;
NN.MoveTo(N, naAddChild);
end;
@ -524,14 +521,11 @@ begin
N := N.GetFirstChild;
while N <> nil do
begin
if N.Text = 'Value' then
begin
if Assigned(N.Data) then
TSettingData(N.Data).Free;
N.Data := TSettingData.Create;
TSettingData(N.Data).Val := KeyValue;
writeln('Setting ' + KeyName + 'to ' + KeyValue);
end;
if Assigned(N.Data) then
TSettingData(N.Data).Free;
N.Data := TSettingData.Create;
TSettingData(N.Data).Val := KeyValue;
writeln('Setting ' + KeyName + ' to ' + KeyValue);
N := N.GetNextSibling;
end;
end;
@ -556,7 +550,9 @@ var
DDataNode, DataNode: TDOMNode;
begin
if n.Text = 'Value' then
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');
if assigned(n.Data) then
begin
XMLChild := XMLDoc.CreateTextNode(TSettingData(N.Data).Val);
end else