Пример #1
0
        void ResetCurrentLocation()
        {
            if ((PluginBase.MainForm as Form).InvokeRequired)
            {
                (PluginBase.MainForm as Form).BeginInvoke((MethodInvoker) delegate()
                {
                    ResetCurrentLocation();
                });
                return;
            }

            if (CurrentLocation.File != null)
            {
                ScintillaControl sci;
                String           localPath = GetLocalPath(CurrentLocation.File);

                if (localPath != null)
                {
                    sci = ScintillaHelper.GetScintillaControl(localPath);

                    if (sci != null)
                    {
                        Int32 i = ScintillaHelper.GetScintillaControlIndex(sci);

                        if (i != -1)
                        {
                            Int32 line = CurrentLocation.Line - 1;
                            sci.MarkerDelete(line, ScintillaHelper.markerCurrentLine);
                        }
                    }
                }
            }
        }
Пример #2
0
        void dgv_CellMouseUp(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (e.RowIndex < 0)
            {
                return;
            }

            if (dgv.Rows[e.RowIndex].Cells["Enable"].ColumnIndex == e.ColumnIndex)
            {
                Boolean enable       = !(Boolean)dgv.Rows[e.RowIndex].Cells["Enable"].Value;
                string  filefullpath = (string)dgv.Rows[e.RowIndex].Cells["FilePath"].Value;
                int     line         = int.Parse((string)dgv.Rows[e.RowIndex].Cells["Line"].Value);
                int     marker       = enable ? 3 : 4;

                ITabbedDocument doc = ScintillaHelper.GetDocument(filefullpath);
                if (doc != null)
                {
                    ScintillaHelper.ToggleMarker(doc.SciControl, 4, line - 1);

                    Int32   lineMask = doc.SciControl.MarkerGet(line - 1);
                    Boolean m        = (lineMask & (1 << 4)) == 0 ? true : false;
                    if ((Boolean)dgv.Rows[e.RowIndex].Cells["Enable"].Value != m)
                    {
                        dgv.Rows[e.RowIndex].Cells["Enable"].Value = m;
                    }
                    dgv.RefreshEdit();
                }
            }
        }
Пример #3
0
        void dgv_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0)
            {
                return;
            }

            if (dgv.Rows[e.RowIndex].Cells["Line"].ColumnIndex == e.ColumnIndex)
            {
                string filename = (string)dgv.Rows[e.RowIndex].Cells["FilePath"].Value;
                int    line     = int.Parse((string)dgv.Rows[e.RowIndex].Cells["Line"].Value);
                ScintillaHelper.ActivateDocument(filename, line - 1, true);
            }
        }
Пример #4
0
        void GotoCurrentLocation(bool bSetMarker)
        {
            if ((PluginBase.MainForm as Form).InvokeRequired)
            {
                (PluginBase.MainForm as Form).BeginInvoke((MethodInvoker) delegate()
                {
                    GotoCurrentLocation(bSetMarker);
                });
                return;
            }

            if (CurrentLocation != null && CurrentLocation.File != null)
            {
                ScintillaControl sci;
                String           localPath = GetLocalPath(CurrentLocation.File);

                if (localPath != null)
                {
                    sci = ScintillaHelper.GetScintillaControl(localPath);

                    if (sci == null)
                    {
                        PluginBase.MainForm.OpenEditableDocument(localPath);
                        sci = ScintillaHelper.GetScintillaControl(localPath);
                    }

                    if (sci != null)
                    {
                        Int32 i = ScintillaHelper.GetScintillaControlIndex(sci);

                        if (i != -1)
                        {
                            PluginBase.MainForm.Documents[i].Activate();
                            Int32 line = CurrentLocation.Line - 1;
                            sci.GotoLine(line);

                            if (bSetMarker)
                            {
                                sci.MarkerAdd(line, ScintillaHelper.markerCurrentLine);
                            }
                        }
                    }
                }
            }
        }
Пример #5
0
        /// <summary>
        ///
        /// </summary>
        static public void SciControl_MarkerChanged(ScintillaControl sender, Int32 line)
        {
            if (line < 0)
            {
                return;
            }

            Boolean bCurrentLine = IsMarkerSet(sender, markerCurrentLine, line);
            Boolean bBpActive    = IsMarkerSet(sender, markerBPEnabled, line);
            Boolean bBpDisabled  = IsMarkerSet(sender, markerBPDisabled, line);

            if (bCurrentLine)
            {
                ScintillaHelper.RemoveHighlight(sender, line, indicatorDebugDisabledBreakpoint);
                ScintillaHelper.RemoveHighlight(sender, line, indicatorDebugEnabledBreakpoint);
                ScintillaHelper.AddHighlight(sender, line, indicatorDebugCurrentLine, 1);
            }
            else if (bBpActive)
            {
                ScintillaHelper.RemoveHighlight(sender, line, indicatorDebugCurrentLine);
                ScintillaHelper.RemoveHighlight(sender, line, indicatorDebugDisabledBreakpoint);
                ScintillaHelper.AddHighlight(sender, line, indicatorDebugEnabledBreakpoint, 1);
            }
            else if (bBpDisabled)
            {
                ScintillaHelper.RemoveHighlight(sender, line, indicatorDebugCurrentLine);
                ScintillaHelper.RemoveHighlight(sender, line, indicatorDebugEnabledBreakpoint);
                ScintillaHelper.AddHighlight(sender, line, indicatorDebugDisabledBreakpoint, 1);
            }
            else
            {
                ScintillaHelper.RemoveHighlight(sender, line, indicatorDebugCurrentLine);
                ScintillaHelper.RemoveHighlight(sender, line, indicatorDebugDisabledBreakpoint);
                ScintillaHelper.RemoveHighlight(sender, line, indicatorDebugEnabledBreakpoint);
            }

            PluginMain.breakPointManager.SetBreakPointInfo(sender.FileName, line, !(bBpActive || bBpDisabled), bBpActive);
        }
Пример #6
0
        /// <summary>
        /// Handles the incoming events
        /// </summary>
        public void HandleEvent(Object sender, NotifyEvent e, HandlingPriority prority)
        {
            if (debugManager == null)
            {
                return;
            }

            switch (e.Type)
            {
            case EventType.FileOpen:
                TextEvent evnt = (TextEvent)e;
                ScintillaHelper.AddSciEvent(evnt.Value);
                breakPointManager.SetBreakPointsToEditor(evnt.Value);
                break;

            case EventType.UIStarted:
                menusHelper.AddToolStrip();
                menusHelper.UpdateMenuState(this, DebuggerState.Initializing);
                CheckValidFile(!disableDebugger);
                break;

            case EventType.UIClosing:
                if (debugManager.FlashInterface.isDebuggerStarted)
                {
                    String title = " " + PluginCore.Localization.TextHelper.GetString("FlashDevelop.Title.ConfirmDialog");
                    switch (MessageBox.Show(TextHelper.GetString("Info.PlayerStillRunning"), title, MessageBoxButtons.YesNoCancel))
                    {
                    case DialogResult.Yes:
                    default:
                        debugManager.FlashInterface.Stop();
                        break;

                    case DialogResult.No:
                        debugManager.FlashInterface.Detach();
                        break;

                    case DialogResult.Cancel:
                        e.Handled = true;
                        break;
                    }
                }

                breakPointManager.Save();
                break;

            case EventType.FileSwitch:
                CheckValidFile(!disableDebugger);
                break;

            case EventType.ProcessEnd:
                TextEvent textevnt = (TextEvent)e;
                if (buildCmpFlg && (textevnt.Value != "Done (0)"))
                {
                    buildCmpFlg = false;
                    menusHelper.UpdateMenuState(this, DebuggerState.Initializing);
                }
                break;

            case EventType.Command:
                PluginCore.DataEvent buildevnt = (PluginCore.DataEvent)e;

                if (buildevnt.Action == "AS3Context.StartDebugger")
                {
                    if (settingObject.StartDebuggerOnTestMovie)
                    {
                        // TODO Detect what sort of TestMovieBehavior is set (or some other way) to disable debugging of ActiveX player
                        buildevnt.Handled = true;
                        debugManager.Start();
                    }
                    return;
                }

                if (!buildevnt.Action.StartsWith("ProjectManager"))
                {
                    return;
                }

                if (buildevnt.Action == ProjectManager.ProjectManagerEvents.Project)
                {
                    IProject project = PluginBase.CurrentProject;
                    if (project != null && project is AS3Project)
                    {
                        disableDebugger = false;
                        CheckValidFile(true);

                        PanelsHelper.breakPointUI.Clear();
                        breakPointManager.Project = project;
                        breakPointManager.Load();
                        breakPointManager.SetBreakPointsToEditor(PluginBase.MainForm.Documents);
                    }
                    else
                    {
                        disableDebugger = true;
                        CheckValidFile(false);

                        if (breakPointManager.Project != null)
                        {
                            breakPointManager.Save();
                        }
                        PanelsHelper.breakPointUI.Clear();
                    }
                }
                else if (disableDebugger)
                {
                    return;
                }

                if (debugBuildStart && buildevnt.Action == ProjectManager.ProjectManagerEvents.BuildFailed)
                {
                    debugBuildStart = false;
                    buildCmpFlg     = false;
                    menusHelper.UpdateMenuState(this, DebuggerState.Initializing);
                }

                else if (buildevnt.Action == ProjectManager.ProjectManagerEvents.TestProject)
                {
                    if (debugManager.FlashInterface.isDebuggerStarted)
                    {
                        if (debugManager.FlashInterface.isDebuggerSuspended)
                        {
                            debugManager.Continue_Click(null, null);
                        }
                        e.Handled = true;
                        return;
                    }
                    debugBuildStart = false;
                    buildCmpFlg     = false;
                    menusHelper.UpdateMenuState(this, DebuggerState.Initializing);
                }

#if false
                else if (buildevnt.Action == "ProjectManager.TestingProject")
                {
                    // no new build while debugging
                    if (debugBuildStart || debugManager.FlashInterface.isDebuggerStarted)
                    {
                        buildevnt.Handled = true;
                        return;
                    }
                    Project newProject = PluginBase.CurrentProject as AS3Project;
                    if (newProject != null && !newProject.NoOutput &&
                        buildevnt.Data.ToString() == "Debug")
                    {
                        buildevnt.Handled           = true;
                        debugManager.currentProject = newProject;
                        debugManager.Start();
                        buildCmpFlg = true;
                    }
                    else
                    {
                        debugManager.currentProject = null;
                    }
                }
#endif
                else if (debugBuildStart && buildevnt.Action == ProjectManager.ProjectManagerEvents.BuildProject &&
                         buildevnt.Data.ToString() == "Debug")
                {
                    buildCmpFlg = true;
                }
                else if (buildevnt.Action == ProjectManager.ProjectManagerEvents.BuildFailed)
                {
                    menusHelper.OnBuildFailed();
                    debugBuildStart = false;
                    buildCmpFlg     = false;
                }
                else if (buildCmpFlg && buildevnt.Action == ProjectManager.ProjectManagerEvents.BuildComplete)
                {
                    if (buildCmpFlg)
                    {
                        debugManager.Start(debugManager.currentProject.OutputPathAbsolute);
                    }
                    else
                    {
                        menusHelper.OnBuildComplete();
                    }

                    debugBuildStart = false;
                    buildCmpFlg     = false;
                    menusHelper.UpdateMenuState(this, DebuggerState.Stopped);
                }
                break;
            }
        }