Esempio n. 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);
            }
        }
 private void LuaCallStackServiceStackLevelChanged(object sender, SledLuaCallStackServiceEventArgs e)
 {
     foreach (var collection in Collection)
     {
         collection.ValidationEnded();
     }
 }
        private void LuaCallStackServiceLevelAdding(object sender, SledLuaCallStackServiceEventArgs e)
        {
            if ((e.NewLevel + 1) > Collection.Count)
            {
                var root =
                    new DomNode(
                        SledLuaSchema.SledLuaVarEnvListType.Type,
                        SledLuaSchema.SledLuaVarEnvListRootElement);

                var envVars = root.As <SledLuaVarEnvListType>();
                envVars.Name =
                    string.Format(
                        "{0}{1}{2}{3}",
                        ProjectService.ProjectName,
                        Resource.Space,
                        Resource.LuaEnvironmentVariables,
                        e.NewLevel);

                envVars.DomNode.AttributeChanged += DomNodeAttributeChanged;
                Collection.Add(envVars);
            }

            if ((e.NewLevel == 0) && (Collection.Count > 0))
            {
                m_editor.View = Collection[0];
            }
        }
        private void LuaCallStackServiceStackLevelChanging(object sender, SledLuaCallStackServiceEventArgs e)
        {
            foreach (var collection in Collection)
            {
                collection.ValidationBeginning();
            }

            m_editor.View = null;
            Collection[e.OldLevel].SaveExpandedStates();

            m_editor.View = Collection[e.NewLevel];
        }
Esempio n. 5
0
        private void RemoteTargetCallStackNew(SledCallStackType cs)
        {
            m_callStackCollection.ValidationBeginning();

            // Event args indicating new stack level #
            var cssea = new SledLuaCallStackServiceEventArgs(-1, cs.Level);

            // Fire event signalling a new stack level is being added
            LevelAdding.Raise(this, cssea);

            // Add new call stack level
            m_callStackCollection.CallStack.Add(cs);

            // Fire event signalling a new stack level has finished being added
            LevelAdded.Raise(this, cssea);
        }
Esempio n. 6
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;
            }
        }