Function

TfrmTemplateEditor.Clone

Module

fTemplateEditor

Last Modified

7/15/2014 3:26:44 PM

Visibility

Protected

Owner

TfrmTemplateEditor

Declaration

function Clone(Node: TTreeNode): boolean;

Calls Hierarchy


TfrmTemplateEditor.Clone
 ├TfrmTemplateEditor.CanClone
 │ ├GetFirstPersonalNode
 │ │ └..(rec)..
 │ └TTemplate.CanModify
 │   ├TTemplate.ValidID
 │   └LockTemplate
 ├..(rec)..
 ├TTemplate.CanModify...
 ├TTemplate.Clone
 │ ├TTemplate.TrueClone
 │ │ ├TTemplate.GetChildren
 │ │ ├TTemplate.Create
 │ │ │ └TTemplate.ReminderDialogIEN
 │ │ ├TTemplate.SetBoilerplate
 │ │ │ ├TTemplate.CanModify...
 │ │ │ └TTemplate.ValidID
 │ │ ├TTemplate.GetBoilerplate
 │ │ │ └GetTemplateBoilerplate
 │ │ ├TTemplate.SetDescription
 │ │ │ ├TTemplate.CanModify...
 │ │ │ └TTemplate.ValidID
 │ │ └TTemplate.GetDescription
 │ │   └LoadTemplateDescription
 │ ├TTemplate.GetItems
 │ │ └ExpandTemplate
 │ │   ├TTemplate.GetChildren
 │ │   ├GetTemplateChildren
 │ │   ├AddTemplate
 │ │   │ ├TTemplate.Create...
 │ │   │ └TTemplate.AddChild
 │ │   │   └TTemplate.GetItems...
 │ │   └TTemplate.ItemIENs
 │ │     └TTemplate.GetItems...
 │ └TTemplate.BackupItems
 │   └TTemplate.ItemIENs...
 ├TTemplate.RemoveNode
 ├MarkDeleted
 │ ├TTemplate.ValidID
 │ ├TTemplate.SetFileLink
 │ │ └TTemplate.AssignFileLink
 │ │   ├TTemplate.CanModify...
 │ │   ├TTemplate.ValidID
 │ │   ├TTemplate.LinkType
 │ │   ├TTemplate.SetReminderDialog
 │ │   │ ├TTemplate.CanModify...
 │ │   │ ├TTemplate.ValidID
 │ │   │ ├TTemplate.ReminderDialogIEN
 │ │   │ ├TTemplate.LinkType
 │ │   │ └TTemplate.SetFileLink...
 │ │   ├TTemplate.GetItems...
 │ │   └..(rec)..
 │ ├TTemplate.GetItems...
 │ └..(rec)..
 ├TTemplate.AddNode
 ├TTemplate.GetItems...
 └TfrmTemplateEditor.ShowTemplateType

Called-By Hierarchy


                      TfrmTemplateEditor.Clone
              TfrmTemplateEditor.btnNewClick┤ 
                             EditTemplates┤ │ 
     TfrmDCSumm.popSummMemoTemplateClick┤ │ │ 
          TfrmDCSumm.mnuNewTemplateClick┤ │ │ 
        TfrmDCSumm.mnuEditTemplatesClick┤ │ │ 
  TfrmDCSumm.mnuEditSharedTemplatesClick┤ │ │ 
    TfrmDCSumm.mnuNewSharedTemplateClick┤ │ │ 
   TfrmConsults.popNoteMemoTemplateClick┤ │ │ 
      TfrmConsults.mnuEditTemplatesClick┤ │ │ 
        TfrmConsults.mnuNewTemplateClick┤ │ │ 
TfrmConsults.mnuEditSharedTemplatesClick┤ │ │ 
  TfrmConsults.mnuNewSharedTemplateClick┤ │ │ 
       TfrmDrawers.mnuEditTemplatesClick┤ │ │ 
         TfrmDrawers.mnuNewTemplateClick┤ │ │ 
    TfrmSurgery.popNoteMemoTemplateClick┤ │ │ 
       TfrmSurgery.mnuEditTemplatesClick┤ │ │ 
         TfrmSurgery.mnuNewTemplateClick┤ │ │ 
 TfrmSurgery.mnuEditSharedTemplatesClick┤ │ │ 
   TfrmSurgery.mnuNewSharedTemplateClick┤ │ │ 
      TfrmNotes.popNoteMemoTemplateClick┤ │ │ 
         TfrmNotes.mnuEditTemplatesClick┤ │ │ 
           TfrmNotes.mnuNewTemplateClick┤ │ │ 
   TfrmNotes.mnuEditSharedTemplatesClick┤ │ │ 
     TfrmNotes.mnuNewSharedTemplateClick┘ │ │ 
        TfrmTemplateEditor.mnuAutoGenClick┤ │ 
 TfrmTemplateEditor.mnuImportTemplateClick┘ │ 
         TfrmTemplateEditor.edtNameOldChange┤ 
       TfrmTemplateEditor.tvTreeNodeEdited┤ │ 
        TfrmTemplateEditor.mnuAutoGenClick┘ │ 
            TfrmTemplateEditor.cbActiveClick┤ 
           TfrmTemplateEditor.cbExcludeClick┤ 
             TfrmTemplateEditor.edtGapChange┤ 
            TfrmTemplateEditor.sbMoveUpClick┤ 
          TfrmTemplateEditor.sbMoveDownClick┤ 
            TfrmTemplateEditor.sbDeleteClick┤ 
     TfrmTemplateEditor.mnuNodeDeleteClick┤ │ 
          TfrmTemplateEditor.tvTreeKeyDown┘ │ 
           TfrmTemplateEditor.tvTreeDragDrop┤ 
        TfrmTemplateEditor.sbCopyLeftClick┤ │ 
       TfrmTemplateEditor.sbCopyRightClick┤ │ 
      TfrmTemplateEditor.mnuNodePasteClick┘ │ 
                                   ..(rec)..┤ 
             TfrmTemplateEditor.reBoilChange┤ 
            TfrmTemplateEditor.reNotesChange┤ 
                  TfrmTemplateEditor.cbClick┤ 
     TfrmTemplateEditor.cbDisplayOnlyClick┤ │ 
       TfrmTemplateEditor.cbFirstLineClick┤ │ 
     TfrmTemplateEditor.cbOneItemOnlyClick┤ │ 
    TfrmTemplateEditor.cbHideDlgItemsClick┤ │ 
       TfrmTemplateEditor.cbHideItemsClick┤ │ 
          TfrmTemplateEditor.cbIndentClick┤ │ 
            TfrmTemplateEditor.cbLockClick┘ │ 
            TfrmTemplateEditor.cbxTypeChange┤ 
         TfrmTemplateEditor.cbxRemDlgsChange┘ 

Calls

Name Declaration Comments
TTemplate.AddNode procedure AddNode(Node: Pointer); -
TfrmTemplateEditor.CanClone function CanClone(const Node: TTreeNode): boolean; -
TTemplate.CanModify function CanModify: boolean; -
TfrmTemplateEditor.Clone function Clone(Node: TTreeNode): boolean; -
TTemplate.Clone function Clone(Owner: Int64): TTemplate; -
TTemplate.GetItems function GetItems: TList; -
MarkDeleted procedure MarkDeleted(Template: TTemplate); -
TTemplate.RemoveNode procedure RemoveNode(Node: Pointer); -
TfrmTemplateEditor.ShowTemplateType procedure ShowTemplateType(Template: TTemplate); -

Called-By

Name Declaration Comments
TfrmTemplateEditor.btnNewClick procedure btnNewClick(Sender: TObject); -
TfrmTemplateEditor.cbActiveClick procedure cbActiveClick(Sender: TObject); -
TfrmTemplateEditor.cbClick procedure cbClick(Sender: TCheckBox; Index: integer); -
TfrmTemplateEditor.cbExcludeClick procedure cbExcludeClick(Sender: TObject); -
TfrmTemplateEditor.cbxRemDlgsChange procedure cbxRemDlgsChange(Sender: TObject); -
TfrmTemplateEditor.cbxTypeChange procedure cbxTypeChange(Sender: TObject); -
TfrmTemplateEditor.Clone function Clone(Node: TTreeNode): boolean; -
TfrmTemplateEditor.edtGapChange procedure edtGapChange(Sender: TObject); -
TfrmTemplateEditor.edtNameOldChange procedure edtNameOldChange(Sender: TObject); -
TfrmTemplateEditor.reBoilChange procedure reBoilChange(Sender: TObject); -
TfrmTemplateEditor.reNotesChange procedure reNotesChange(Sender: TObject); -
TfrmTemplateEditor.sbDeleteClick procedure sbDeleteClick(Sender: TObject); -
TfrmTemplateEditor.sbMoveDownClick procedure sbMoveDownClick(Sender: TObject); -
TfrmTemplateEditor.sbMoveUpClick procedure sbMoveUpClick(Sender: TObject); -
TfrmTemplateEditor.tvTreeDragDrop procedure tvTreeDragDrop(Sender, Source: TObject; X, Y: Integer); -


Source

2174  function TfrmTemplateEditor.Clone(Node: TTreeNode): boolean;
2175  var
2176    idx: integer;
2177    Prnt, OldT, NewT: TTemplate;
2178    PNode: TTreeNode;
2179    ok: boolean;
2180  
2181  begin
2182    Result := FALSE;
2183    if ((assigned(Node)) and (TTreeView(Node.TreeView) = tvPersonal)) then
2184    begin
2185      OldT := TTemplate(Node.Data);
2186      if (OldT.PersonalOwner <> User.DUZ) then
2187      begin
2188        PNode := Node.Parent;
2189        Prnt := nil;
2190        if (assigned(PNode)) then
2191        begin
2192          ok := CanClone(PNode);
2193          if ok then
2194          begin
2195            Clone(PNode);
2196            Prnt := TTemplate(PNode.Data);
2197            ok := Prnt.CanModify;
2198          end;
2199        end
2200        else
2201          ok := TRUE;
2202        if ok then
2203        begin
2204          BtnApply.Enabled := TRUE;
2205          Result := TRUE;
2206          NewT := OldT.Clone(User.DUZ);
2207          OldT.RemoveNode(Node);
2208          MarkDeleted(OldT);
2209          Node.Data := NewT;
2210          NewT.AddNode(Node);
2211          if (assigned(Prnt)) then
2212          begin
2213            idx := Prnt.Items.IndexOf(OldT);
2214            if (idx >= 0) then
2215              Prnt.Items[idx] := NewT;
2216          end;
2217          tvPersonal.Invalidate;
2218          ShowTemplateType(NewT);
2219        end;
2220      end;
2221    end;
2222  end;