procedure TfrmSettings.BuildConfigurationTree( Tree: TTntTreeView );
var
ParentNode: TTntTreeNode;
Owner: TTntTreeNodes;
function AddNewConfigItem( Parent: TTntTreeNode;
Text: WideString;
StateIndex: Integer ): TTntTreeNode;
var
Owner: TTntTreeNodes;
begin
Owner := tv_config.Items;
result := Owner.AddChild( Parent, Text );
result.ImageIndex := -1;
result.SelectedIndex := -1;
result.StateIndex := StateIndex;
end;
begin
Owner := Tree.Items;
Owner.BeginUpdate;
try
try
// Delete all current tree items
Owner.Clear;
//General
ParentNode := AddNewConfigItem(
nil, _( '
General' ), -1 );
AddNewConfigItem( ParentNode, _( '
Workstation' ), 0 );
AddNewConfigItem( ParentNode, _( '
Display' ), 1 );
AddNewConfigItem( ParentNode, _( '
Sound effects' ), 2 );
AddNewConfigItem( ParentNode, _( '
Logging' ), 3 );
// Interfaces
ParentNode := AddNewConfigItem(
nil, _( '
Interfaces' ), -1 );
AddNewConfigItem( ParentNode, _( '
Scanner' ), 4 );
// OIP
ParentNode := AddNewConfigItem(
nil, _( '
OIP' ), -1 );
AddNewConfigItem( ParentNode, _( '
Directories' ), 5 );
AddNewConfigItem( ParentNode, _( '
Printer' ), 6 );
finally
Owner.EndUpdate;
end;
except
Owner.Owner.Invalidate;
// force repaint on exception
raise;
end;
end;