예제 #1
0
        public virtual bool IsLeaf(TreePath treePath)
        {
            LuaVariableItem item = treePath.LastNode as LuaVariableItem;

            if (item != null)
            {
                if (item.LuaValue is LuaTable)
                {
                    return(false);
                }
            }
            return(true);
        }
예제 #2
0
        protected ExpandedNodesDictionary SaveExpandedNodes(TreeNodeAdv rootNode)
        {
            ExpandedNodesDictionary expandedObjects = new ExpandedNodesDictionary(rootNode.IsExpanded);

            foreach (TreeNodeAdv child in rootNode.Children)
            {
                LuaVariableItem item = child.Tag as LuaVariableItem;
                if (item != null && item.LuaValue.Type == LuaVariableType.Table)
                {
                    expandedObjects[item.LuaKey] = SaveExpandedNodes(child);
                }
            }
            return(expandedObjects);
        }
예제 #3
0
        private void treeViewAdvWatch_ItemDrag(object sender, ItemDragEventArgs e)
        {
            Aga.Controls.Tree.TreeNodeAdv[] items = e.Item as Aga.Controls.Tree.TreeNodeAdv[];
            if (items != null && items.Length == 1)
            {
                var    item     = items[0];
                string fullName = string.Empty;
                do
                {
                    string           subPart       = string.Empty;
                    LuaWatchVariable watchVariable = item.Tag as LuaWatchVariable;
                    if (watchVariable != null)
                    {
                        subPart = watchVariable.Name;
                    }
                    else
                    {
                        LuaVariableItem variableItem = item.Tag as LuaVariableItem;
                        if (variableItem != null)
                        {
                            LuaString keyString = variableItem.LuaKey as LuaString;
                            if (keyString != null)
                            {
                                subPart = keyString.Value;
                            }
                        }
                    }

                    if (subPart != string.Empty)
                    {
                        if (fullName == string.Empty)
                        {
                            fullName = subPart;
                        }
                        else
                        {
                            fullName = subPart + "." + fullName;
                        }
                    }

                    item = item.Parent;
                } while (item.Parent != null);
                if (!string.IsNullOrEmpty(fullName))
                {
                    DoDragDrop(fullName, DragDropEffects.Copy);
                }
            }
        }
예제 #4
0
 protected void RestoreExpandedNodes(TreeNodeAdv rootNode, ExpandedNodesDictionary expanded)
 {
     rootNode.IsExpanded = expanded.IsExpanded;
     foreach (TreeNodeAdv child in rootNode.Children)
     {
         LuaVariableItem item = child.Tag as LuaVariableItem;
         if (item != null)
         {
             ExpandedNodesDictionary childExpanded;
             if (expanded.TryGetValue(item.LuaKey, out childExpanded))
             {
                 RestoreExpandedNodes(child, childExpanded);
             }
         }
     }
 }
예제 #5
0
        public virtual System.Collections.IEnumerable GetChildren(TreePath treePath)
        {
            List <LuaVariableItem> children = new List <LuaVariableItem>();
            LuaTable currentTable           = null;

            if (treePath.IsEmpty())
            {
                currentTable = filteredLuaTable != null ? filteredLuaTable : filter < 0 ? rootLuaTable : null;
            }
            else
            {
                LuaVariableItem item = treePath.LastNode as LuaVariableItem;
                if (item != null)
                {
                    currentTable = item.LuaValue as LuaTable;
                }
                else
                {
                    LuaWatchVariable watchVariable = treePath.LastNode as LuaWatchVariable;
                    if (watchVariable != null)
                    {
                        currentTable = watchVariable.LuaValue as LuaTable;
                    }
                }
            }
            if (currentTable != null)
            {
                children.Capacity = currentTable.Value.Count;
                foreach (var kvp in currentTable.Value)
                {
                    LuaVariableItem item = new LuaVariableItem(kvp.Key, kvp.Value);
                    children.Add(item);
                }
            }
            // Sort items alphabetically by Key name
            children.Sort((x, y) => x.Key.CompareTo(y.Key));
            return(children);
        }