/// <summary>
        ///
        /// </summary>
        static public void ApplyHighlights(ScintillaControl sender, Int32 line)
        {
            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);
        }
Exemple #2
0
        /// <summary>
        ///
        /// </summary>
        private void ResetCurrentLocation()
        {
            if ((PluginBase.MainForm as Form).InvokeRequired)
            {
                (PluginBase.MainForm as Form).BeginInvoke((MethodInvoker) delegate()
                {
                    ResetCurrentLocation();
                });
                return;
            }

            ScintillaControl sci;
            String           localPath = CurrentFullFilePath;

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

                if (sci != null)
                {
                    Int32 i = ScintillaHelper.GetScintillaControlIndex(sci);
                    if (i != -1)
                    {
                        int line = (int)CurrentLocation.line;

                        sci.MarkerDelete(line, ScintillaHelper.markerCurrentLine);
                    }
                }
            }
        }
 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);
     }
 }
        void dgv_CellMouseUp(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (e.RowIndex < 0 || e.RowIndex >= dgv.Rows.Count)
            {
                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);
                ITabbedDocument doc          = ScintillaHelper.GetDocument(filefullpath);
                if (doc != null)
                {
                    // This logic should be handled by BPMAnager, wo we'll just work arround bad BPs and ignore them
                    if (line < 1 || (doc.SciControl != null && line > doc.SciControl.LineCount))
                    {
                        return;
                    }
                    Boolean m = ScintillaHelper.IsMarkerSet(doc.SciControl, ScintillaHelper.markerBPDisabled, line - 1);
                    if (m)
                    {
                        doc.SciControl.MarkerAdd(line - 1, ScintillaHelper.markerBPEnabled);
                        doc.SciControl.MarkerDelete(line - 1, ScintillaHelper.markerBPDisabled);
                    }
                    else
                    {
                        doc.SciControl.MarkerAdd(line - 1, ScintillaHelper.markerBPDisabled);
                        doc.SciControl.MarkerDelete(line - 1, ScintillaHelper.markerBPEnabled);
                    }

                    if (e.RowIndex >= 0 && e.RowIndex < dgv.Rows.Count) // list can have been updated in the meantime
                    {
                        if ((Boolean)dgv.Rows[e.RowIndex].Cells["Enable"].Value != m)
                        {
                            dgv.Rows[e.RowIndex].Cells["Enable"].Value = m;
                        }
                    }
                    dgv.RefreshEdit();
                }
            }
        }
Exemple #5
0
        /// <summary>
        ///
        /// </summary>
        private void GotoCurrentLocation(bool bSetMarker)
        {
            if ((PluginBase.MainForm as Form).InvokeRequired)
            {
                (PluginBase.MainForm as Form).BeginInvoke((MethodInvoker) delegate()
                {
                    GotoCurrentLocation(bSetMarker);
                });
                return;
            }

            ScintillaControl sci;
            String           localPath = CurrentFullFilePath;

            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();
                        int line = (int)CurrentLocation.line;
                        sci.GotoLine(line);

                        if (bSetMarker)
                        {
                            sci.MarkerAdd(line, ScintillaHelper.markerCurrentLine);
                        }
                    }
                }
            }
        }
Exemple #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.AddToolStripItems();
                menusHelper.UpdateMenuState(this, DebuggerState.Initializing);
                debugManager.RestoreOldLayout();
                break;

            case EventType.UIClosing:
                if (debugManager.IsDebuggerStarted)
                {
                    debugManager.Stop_Click(null, null);
                }
                break;

            case EventType.ApplySettings:
                menusHelper.UpdateMenuState(this);
                break;

            case EventType.FileSwitch:
                menusHelper.UpdateMenuState(this);
                break;

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

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

                if (buildevnt.Action == ProjectManager.ProjectManagerEvents.Project)
                {
                    IProject project = PluginBase.CurrentProject;
                    if (project != null)
                    {
                        disableDebugger = false;
                        PanelsHelper.breakPointUI.Clear();
                        if (breakPointManager.Project != null && breakPointManager.Project != project)
                        {
                            breakPointManager.Save();
                        }
                        breakPointManager.Project = project;
                        breakPointManager.Load();
                        breakPointManager.SetBreakPointsToEditor(PluginBase.MainForm.Documents);
                    }
                    else
                    {
                        disableDebugger = true;
                        if (breakPointManager.Project != null)
                        {
                            breakPointManager.Save();
                        }
                        PanelsHelper.breakPointUI.Clear();
                    }
                }
                else if (disableDebugger)
                {
                    return;
                }

                if (buildevnt.Action == ProjectManager.ProjectManagerEvents.DebugProject)
                {
                    if (debugManager.IsDebuggerStarted)
                    {
                        if (debugManager.IsDebuggerSuspended)
                        {
                            debugManager.Continue_Click(null, null);
                            e.Handled = true;
                            return;
                        }
                    }
                    else
                    {
                        if (debugManager.Start())
                        {
                            e.Handled = true;
                            return;
                        }
                    }
                }
                break;
            }
        }