Exemplo n.º 1
0
        private TreeListViewItem FunctionCallToTreeListViewItem(LuaCall call)
        {
            // Create main item with name
            TreeListViewItem tlvi = new TreeListViewItem(string.Empty);

            tlvi.Tag       = call;
            tlvi.ForeColor = call.FunctionSource != "Lua" ? Color.LightGray : Color.Black;

            // Create subitem with name
            TreeListViewSubItem tlvsi = new TreeListViewSubItem(0);

            if (call.IsLineCall)
            {
                ILuaEditDocument doc = DocumentsManager.Instance.OpenDocument(call.FileName, false);

                if (doc is LuaScriptDocument)
                {
                    LuaScriptDocument luaDoc = doc as LuaScriptDocument;

                    if (call.FunctionLineCall < luaDoc.Document.Lines.Length)
                    {
                        tlvsi.Object = string.Format("{0}  Line {1}", luaDoc.Document.Lines[call.FunctionLineCall - 1].TrimStart(new char[] { ' ', '\t' }), call.FunctionLineCall);
                    }
                }
            }
            else
            {
                if (call.FunctionName == "[EntryPoint]")
                {
                    tlvsi.Object = call.FunctionName;
                }
                else
                {
                    tlvsi.Object = string.Format("{0}({1})  Line {2}", call.FunctionName, call.ParamString, call.FunctionLineCall);
                }
            }

            tlvi.SubItems.Add(tlvsi);

            // Create subitem with language
            tlvi.SubItems.Add(new TreeListViewSubItem(1, call.FunctionSource));

            // Create subitem with filename
            tlvi.SubItems.Add(new TreeListViewSubItem(2, call.FileName));

            return(tlvi);
        }
Exemplo n.º 2
0
        private TreeListViewItem LuaVariableToTreeListViewItem(LuaVariable luaVar)
        {
            // Create main item with name
            TreeListViewItem tlvi = new TreeListViewItem(luaVar.Name);

            tlvi.Tag = luaVar;

            // Create subitem with value
            TreeListViewSubItem tlvsi = new TreeListViewSubItem(1, luaVar.GetPrettyPrintValue());

            tlvsi.Tag = luaVar.Value;
            tlvi.SubItems.Add(tlvsi);

            // Create subitem with value type
            tlvsi = new TreeListViewSubItem(2, luaVar.Type.ToString());
            tlvi.SubItems.Add(tlvsi);

            if (luaVar.Type == LuaTypes.LUA_TTABLE)
            {
                tlvi.Items.Add(EmptyTableElementName);
            }

            return(tlvi);
        }
Exemplo n.º 3
0
        private void AddItems()
        {
            var ic  = new TreeListViewItem("XXX", 0);
            var ic1 = new TreeListViewItem("XXy", 0);
            var ic2 = new TreeListViewItem("XXz", 0);

            var myCustomSubItem = new TreeListViewSubItem()
            {
                Text = "Text",
                UseGradientBackground        = true,
                BackgroundGradientStartColor = Color.Red,
                FillRatio = .6,
            };

            ic1.SubItems.Add(myCustomSubItem);

            ic1.SubItems.Add(new Button2Item("r ic1"));

            ic.SubItems.Add(new Button2Item("r ic"));

            ic.Items.Add(ic1);
            ic1.Items.Add(ic2);
            treeListView1.Items.Add(ic);
        }
Exemplo n.º 4
0
        private void UpdateThreads()
        {
            tlvwThreads.BeginUpdate();

            try
            {
                ClearThreads();

                if (ClientDebugManager.Instance.LuaThreads != null)
                {
                    foreach (LuaThread luaThread in ClientDebugManager.Instance.LuaThreads)
                    {
                        LuaCall          call = luaThread.CallStackTopCall;
                        TreeListViewItem tlvi = new TreeListViewItem();
                        tlvi.Tag = luaThread;
                        tlvi.SubItems.Add(new TreeListViewSubItem(0));

                        TreeListViewSubItem tlvsiID = new TreeListViewSubItem(1, luaThread.ThreadID);
                        tlvi.SubItems.Add(tlvsiID);

                        if (call != null)
                        {
                            if (call.IsLineCall)
                            {
                                ILuaEditDocument  doc    = DocumentsManager.Instance.OpenDocument(call.FileName, false);
                                LuaScriptDocument luaDoc = doc as LuaScriptDocument;

                                if (luaDoc != null)
                                {
                                    string location = string.Format("{0}   (Lua)   Line {1}", luaDoc.Document.Lines[call.FunctionLineCall - 1].TrimStart(new char[] { ' ', '\t' }), call.FunctionLineCall);
                                    TreeListViewSubItem tlvsiLocation = new TreeListViewSubItem(2, location);
                                    tlvi.SubItems.Add(tlvsiLocation);
                                }
                            }
                            else
                            {
                                string location = string.Format("{0}   ({1})   Line {2}", call.FunctionName, call.FunctionSource, call.LineCalled);
                                TreeListViewSubItem tlvsiLocation = new TreeListViewSubItem(2, location);
                                tlvi.SubItems.Add(tlvsiLocation);
                            }
                        }

                        if (luaThread.ThreadID == ClientDebugManager.Instance.CurrentThreadID)
                        {
                            tlvi.ImageIndex         = 0;
                            tlvi.SelectedImageIndex = 0;
                        }
                        else
                        {
                            tlvi.ImageIndex         = -1;
                            tlvi.SelectedImageIndex = -1;
                        }

                        tlvwThreads.Items.Add(tlvi);
                    }
                }
            }
            finally
            {
                tlvwThreads.EndUpdate();
            }
        }