Procedure

TfrmDrawers.UpdatePersonalTemplates

Module

fDrawers

Last Modified

7/15/2014 3:26:36 PM

Visibility

Public

Owner

TfrmDrawers

Declaration

procedure UpdatePersonalTemplates;

Calls Hierarchy


TfrmDrawers.UpdatePersonalTemplates
 ├UserTemplateAccessLevel
 │ ├GetTemplateRoots
 │ └GetTemplateAccess
 ├TTemplate.GetChildren
 ├TfrmDrawers.AddTemplateNode
 │ └TdmodShared.AddTemplateNode
 │   ├AddChildObject
 │   │ └TTemplate.AddNode
 │   └TTemplate.GetChildren
 └FindNode

Called-By Hierarchy


   TfrmDrawers.UpdatePersonalTemplates
TdmodShared.EncounterLocationChanged┘ 
         TdmodShared.AddDrawerTree┘   
          TfrmDrawers.FormCreate┘     

Calls

Name Declaration Comments
TfrmDrawers.AddTemplateNode procedure AddTemplateNode(const tmpl: TTemplate; const Owner: TTreeNode = nil); -
FindNode function FindNode: TTreeNode; -
TTemplate.GetChildren function GetChildren: TTemplateChildren; -
UserTemplateAccessLevel function UserTemplateAccessLevel: TTemplateAccess; -

Called-By

Name Declaration Comments
TdmodShared.EncounterLocationChanged procedure EncounterLocationChanged(Sender: TObject); -


Source

1252  procedure TfrmDrawers.UpdatePersonalTemplates;
1253  var
1254    NeedPersonal: boolean;
1255    Node: TTreeNode;
1256  
1257    function FindNode: TTreeNode;
1258    begin
1259      Result := tvTemplates.Items.GetFirstNode;
1260      while assigned(Result) do
1261      begin
1262        if(Result.Data = MyTemplate) then exit;
1263        Result := Result.getNextSibling;
1264      end;
1265    end;
1266  
1267  begin
1268    NeedPersonal := (UserTemplateAccessLevel <> taNone);
1269    if(NeedPersonal <> FHasPersonalTemplates) then
1270    begin
1271      if(NeedPersonal) then
1272      begin
1273        if(assigned(MyTemplate)) and (MyTemplate.Children in [tcActive, tcBoth]) then
1274        begin
1275          AddTemplateNode(MyTemplate);
1276          FHasPersonalTemplates := TRUE;
1277          if(assigned(MyTemplate)) then
1278          begin
1279            Node := FindNode;
1280            if(assigned(Node)) then
1281              Node.MoveTo(nil, naAddFirst);
1282          end;
1283        end;
1284      end
1285      else
1286      begin
1287        if(assigned(MyTemplate)) then
1288        begin
1289          Node := FindNode;
1290          if(assigned(Node)) then Node.Delete;
1291        end;
1292        FHasPersonalTemplates := FALSE;
1293      end;
1294    end;
1295  end;