Procedure

TfrmTemplateEditor.tvTreeDragDrop

Module

fTemplateEditor

Last Modified

7/15/2014 3:26:44 PM

Visibility

Public/Published

Owner

TfrmTemplateEditor

Declaration

procedure tvTreeDragDrop(Sender, Source: TObject; X, Y: Integer);

Calls Hierarchy


TfrmTemplateEditor.tvTreeDragDrop
 ├TTemplate.GetItems
 │ └ExpandTemplate
 │   ├TTemplate.GetChildren
 │   ├GetTemplateChildren
 │   ├AddTemplate
 │   │ ├TTemplate.Create
 │   │ │ └TTemplate.ReminderDialogIEN
 │   │ └TTemplate.AddChild
 │   │   └TTemplate.GetItems...
 │   └TTemplate.ItemIENs
 │     └TTemplate.GetItems...
 ├TfrmTemplateEditor.AllowMove
 │ ├TfrmTemplateEditor.IsTemplateLocked
 │ │ ├TTemplate.AutoLock
 │ │ │ └TTemplate.LinkType
 │ │ ├TTemplate.IsLocked
 │ │ │ └TTemplate.AutoLock...
 │ │ └..(rec)..
 │ └TTemplate.GetItems...
 ├TfrmTemplateEditor.CanClone
 │ ├GetFirstPersonalNode
 │ │ └..(rec)..
 │ └TTemplate.CanModify
 │   ├TTemplate.ValidID
 │   └LockTemplate
 ├TfrmTemplateEditor.Clone
 │ ├TfrmTemplateEditor.CanClone...
 │ ├..(rec)..
 │ ├TTemplate.CanModify...
 │ ├TTemplate.Clone
 │ │ ├TTemplate.TrueClone
 │ │ │ ├TTemplate.GetChildren
 │ │ │ ├TTemplate.Create...
 │ │ │ ├TTemplate.SetBoilerplate
 │ │ │ │ ├TTemplate.CanModify...
 │ │ │ │ └TTemplate.ValidID
 │ │ │ ├TTemplate.GetBoilerplate
 │ │ │ │ └GetTemplateBoilerplate
 │ │ │ ├TTemplate.SetDescription
 │ │ │ │ ├TTemplate.CanModify...
 │ │ │ │ └TTemplate.ValidID
 │ │ │ └TTemplate.GetDescription
 │ │ │   └LoadTemplateDescription
 │ │ ├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
 ├TTemplate.CanModify...
 ├TTemplate.SetPersonalOwner
 │ ├TTemplate.CanModify...
 │ ├TTemplate.ValidID
 │ ├TTemplate.GetItems...
 │ └..(rec)..
 └TfrmTemplateEditor.Resync
   ├TdmodShared.Resync
   │ ├InSyncNode
   │ ├GetID
   │ │ └..(rec)..
   │ ├TTemplate.RemoveNode
   │ ├BuildNodes
   │ │ ├TTemplate.AddNode
   │ │ ├TTemplate.GetItems...
   │ │ ├..(rec)..
   │ │ └TTemplate.GetChildren
   │ └GetNode
   │   └GetID...
   ├TfrmTemplateEditor.EnableNavControls
   │ └TfrmTemplateEditor.AllowMove...
   └TfrmTemplateEditor.tvTreeChange
     ├TfrmTemplateEditor.ChangeTree
     ├TfrmTemplateEditor.IsTemplateLocked...
     ├TfrmTemplateEditor.EnableControls
     │ ├TfrmTemplateEditor.UpdateInsertsDialogs
     │ │ ├TfrmTemplateObjects.UpdateStatus
     │ │ └TfrmTemplateFields.UpdateStatus
     │ │   └TfrmTemplateFields.ValidInsert
     │ └TfrmTemplateEditor.EnableNavControls...
     └TfrmTemplateEditor.ShowInfo
       ├TfrmTemplateEditor.ShowTemplateType
       ├TfrmTemplateEditor.GetLinkType
       ├LoadServiceListWithSynonyms
       ├TTemplate.LinkName
       │ ├GetLinkName
       │ │ └ExternalName
       │ ├TTemplate.LinkIEN
       │ └TTemplate.LinkType
       ├TTemplate.LinkIEN
       ├TTemplate.GetDescription...
       ├TTemplate.IsLocked...
       ├TTemplate.AutoLock...
       ├TfrmTemplateEditor.IsTemplateLocked...
       ├TTemplate.GetChildren
       ├TTemplate.ReminderDialogIEN
       ├TdmodShared.InDialog
       │ └TTemplate.IsDialog
       ├TTemplate.GetBoilerplate...
       ├TfrmTemplateEditor.DisplayBoilerplate
       │ ├TfrmTemplateEditor.pnlBoilerplateResize
       │ ├TTemplate.GetBoilerplate...
       │ ├TTemplate.FullBoilerplate
       │ │ ├TTemplate.GetBoilerplate...
       │ │ ├TTemplate.ItemBoilerplate
       │ │ │ ├TTemplate.GetItems...
       │ │ │ ├TTemplate.GetTemplateType
       │ │ │ ├DlgText
       │ │ │ └TTemplate.DialogProperties
       │ │ │   ├TTemplate.GetBoilerplate...
       │ │ │   └TTemplate.DlgID
       │ │ ├DlgText
       │ │ └TTemplate.DialogProperties...
       │ ├TfrmTemplateEditor.UpdateInsertsDialogs...
       │ ├TfrmTemplateEditor.ShowBoilerPlate
       │ └TfrmTemplateEditor.ShowGroupBoilerplate
       ├TfrmTemplateEditor.ShowGroupBoilerplate
       └TfrmTemplateEditor.pnlBoilerplateResize

Called-By Hierarchy


     TfrmTemplateEditor.tvTreeDragDrop
  TfrmTemplateEditor.sbCopyLeftClick┤ 
 TfrmTemplateEditor.sbCopyRightClick┤ 
TfrmTemplateEditor.mnuNodePasteClick┘ 

Calls

Name Declaration Comments
TfrmTemplateEditor.AllowMove function AllowMove(ADropNode, ADragNode: TTreeNode): boolean; -
TfrmTemplateEditor.CanClone function CanClone(const Node: TTreeNode): boolean; -
TTemplate.CanModify function CanModify: boolean; -
TfrmTemplateEditor.Clone function Clone(Node: TTreeNode): boolean; -
TTemplate.GetItems function GetItems: TList; -
TfrmTemplateEditor.Resync procedure Resync(const Templates: array of TTemplate); -
TTemplate.SetPersonalOwner procedure SetPersonalOwner(Value: Int64); -

Called-By

Name Declaration Comments
TfrmTemplateEditor.mnuNodePasteClick procedure mnuNodePasteClick(Sender: TObject); -
TfrmTemplateEditor.sbCopyLeftClick procedure sbCopyLeftClick(Sender: TObject); -
TfrmTemplateEditor.sbCopyRightClick procedure sbCopyRightClick(Sender: TObject); -


Source

1923  procedure TfrmTemplateEditor.tvTreeDragDrop(Sender, Source: TObject; X,
1924    Y: Integer);
1925  var
1926    Src, Template, Item: TTemplate;
1927    SIdx, idx: integer;
1928    TmpNode: TTreeNode;
1929  
1930  begin
1931    if (assigned(FDragNode)) and (assigned(FDropNode)) and (FDragNode <> FDropNode) then
1932    begin
1933      Item := TTemplate(FDragNode.Data);
1934      if (FDropInto) then
1935      begin
1936        TmpNode := FDropNode;
1937        idx := 0;
1938      end
1939      else
1940      begin
1941        TmpNode := FDropNode.Parent;
1942        idx := TTemplate(FDropNode.Parent.Data).Items.IndexOf(FDropNode.Data);
1943      end;
1944      if (AllowMove(TmpNode, FDragNode) and (idx >= 0)) then
1945      begin
1946        Template := TTemplate(TmpNode.Data);
1947        if (Template <> FDragNode.Parent.Data) and
1948          (Template.Items.IndexOf(Item) >= 0) then
1949          InfoBox(Template.PrintName + ' already contains the ' +
1950            Item.PrintName + ' template.',
1951            'Error', MB_OK or MB_ICONERROR)
1952        else
1953        begin
1954          Src := TTemplate(FDragNode.Parent.Data);
1955          Sidx := Src.Items.IndexOf(Item);
1956          if CanClone(TmpNode) then
1957          begin
1958            if (Clone(TmpNode)) then
1959              Template := TTemplate(TmpNode.Data);
1960            if assigned(Template) and Template.CanModify then
1961            begin
1962              if (Sidx >= 0) and (FDragNode.TreeView = FDropNode.TreeView) and
1963                (not FCopying) then // if same tree delete source
1964              begin
1965                if CanClone(FDragNode.Parent) then
1966                begin
1967                  if (Clone(FDragNode.Parent)) then
1968                    Src := TTemplate(FDragNode.Parent.Data);
1969                  if assigned(Src) and Src.CanModify then
1970                  begin
1971                    Src.Items.Delete(Sidx);
1972                    if (Template = Src) then
1973                      Src := nil;
1974                  end
1975                  else
1976                    Src := nil;
1977                end
1978                else
1979                  Src := nil;
1980              end
1981              else
1982                Src := nil;
1983              if (idx > 0) then
1984                idx := TTemplate(FDropNode.Parent.Data).Items.IndexOf(FDropNode.Data);
1985              Template.Items.Insert(idx, Item);
1986              if (TTreeView(FDropNode.TreeView) = tvShared) then
1987              begin
1988                Item.PersonalOwner := 0;
1989                tvPersonal.Invalidate;
1990              end;
1991              TTreeView(FDragNode.TreeView).Selected := FDragNode;
1992              TTreeView(FDragNode.TreeView).SetFocus;
1993              Resync([Src, Template]);
1994              btnApply.Enabled := TRUE;
1995            end;
1996          end;
1997        end;
1998      end;
1999    end;
2000  end;