Beispiel #1
0
        private void CallStackEditorMouseClick(object sender, MouseEventArgs e)
        {
            var editor = sender.As <SledLuaCallStackEditor>();

            if (editor == null)
            {
                return;
            }

            var obj = editor.GetItemAt(e.Location);

            if (obj == null)
            {
                return;
            }

            if (!obj.Is <SledCallStackType>())
            {
                return;
            }

            var cs = obj.As <SledCallStackType>();

            // Don't continue if already showing this level
            if (cs.Level == CurrentStackLevel)
            {
                return;
            }

            // Create event args (cs.Level is new level
            // and m_iCurrentStackLevel is old level)
            var cssea =
                new SledLuaCallStackServiceEventArgs(
                    CurrentStackLevel,
                    cs.Level);

            // Fire event indicating stack level is changing
            StackLevelChanging.Raise(this, cssea);

            // See if we have the data or not and look it up if we don't
            if (cs.NodeCanBeLookedUp && cs.NodeNeedsLookedUp)
            {
                // Send message
                m_debugService.SendScmp(
                    new Scmp.LuaCallStackLookupPerform(
                        m_luaLanguagePlugin.LanguageId,
                        (Int16)cs.Level));

                // Fire event indicating the stack level has to be looked up
                StackLevelLookingUp.Raise(this, cssea);
            }
            else
            {
                // Store level since we switched
                CurrentStackLevel = cs.Level;

                // Fire event indicating stack level has changed
                StackLevelChanged.Raise(this, cssea);
            }
        }
Beispiel #2
0
        private void DebugServiceDataReady(object sender, SledDebugServiceEventArgs e)
        {
            var typeCode = (Scmp.LuaTypeCodes)e.Scmp.TypeCode;

            switch (typeCode)
            {
            case Scmp.LuaTypeCodes.LuaCallStackBegin:
                RemoteTargetCallStackClear();
                break;

            case Scmp.LuaTypeCodes.LuaCallStack:
            {
                var var = m_debugService.GetScmpBlob <Scmp.LuaCallStack>();

                var node = new DomNode(SledSchema.SledCallStackType.Type);

                var cs = node.As <SledCallStackType>();
                cs.File               = SledUtil.FixSlashes(var.RelScriptPath);
                cs.CurrentLine        = var.CurrentLine;
                cs.LineDefined        = var.LineDefined;
                cs.LineEnd            = var.LastLineDefined;
                cs.Function           = m_luaFunctionParserService.Value.LookUpFunction(var.FunctionName);
                cs.Level              = var.StackLevel;
                cs.NodeCanBeLookedUp  = true;
                cs.NodeNeedsLookedUp  = (cs.Level != 0);
                cs.IsCursorInFunction = (cs.Level == 0);

                RemoteTargetCallStackNew(cs);
            }
            break;

            case Scmp.LuaTypeCodes.LuaCallStackEnd:
                break;

            case Scmp.LuaTypeCodes.LuaCallStackLookupBegin:
                break;

            case Scmp.LuaTypeCodes.LuaCallStackLookup:
            {
                var scmp = m_debugService.GetScmpBlob <Scmp.LuaCallStackLookup>();

                int iLevel = scmp.StackLevel;

                // Save this so the call stack GUI knows where it is
                CurrentStackLevel = iLevel;

                // Find existing callstack entry at iLevel and update
                // it to not need to be looked up anymore
                m_callStackCollection.CallStack[iLevel].NodeNeedsLookedUp = false;
            }
            break;

            case Scmp.LuaTypeCodes.LuaCallStackLookupEnd:
            {
                var cssea = new SledLuaCallStackServiceEventArgs(PreviousStackLevel, CurrentStackLevel);

                // Fire event indicating stack level has finished being looked up
                StackLevelLookedUp.Raise(this, cssea);

                // Fire event indicating stack level has changed
                StackLevelChanged.Raise(this, cssea);
            }
            break;
            }
        }