예제 #1
0
 private void TsbAlternateFiltered_Click(object sender, EventArgs e)
 {
     if (dgv.Rows.Count == 0)
     {
         return;
     }
     this.breakPointManager.ChangeBreakPointEvent -= breakPointManager_ChangeBreakPointEvent;
     foreach (DataGridViewRow row in dgv.Rows)
     {
         string          filefullpath = (string)row.Cells["FilePath"].Value;
         int             line         = int.Parse((string)row.Cells["Line"].Value) - 1;
         bool            value        = !(bool)row.Cells["Enable"].Value;
         ITabbedDocument doc          = ScintillaHelper.GetDocument(filefullpath);
         if (doc != null)
         {
             int     newMarker = value ? ScintillaHelper.markerBPEnabled : ScintillaHelper.markerBPDisabled;
             Boolean m         = ScintillaHelper.IsMarkerSet(doc.SciControl, newMarker, line);
             if (!m)
             {
                 doc.SciControl.MarkerAdd(line, newMarker);
                 doc.SciControl.MarkerDelete(line, value ? ScintillaHelper.markerBPDisabled : ScintillaHelper.markerBPEnabled);
             }
         }
         else
         {
             breakPointManager.SetBreakPointInfo(filefullpath, line, false, value);
         }
         row.Cells["Enable"].Value = value;
     }
     dgv.EndEdit();
     this.breakPointManager.ChangeBreakPointEvent += breakPointManager_ChangeBreakPointEvent;
     breakPointManager.Save();
 }
예제 #2
0
 private void TsbRemoveFiltered_Click(object sender, EventArgs e)
 {
     if (dgv.Rows.Count == 0)
     {
         return;
     }
     this.breakPointManager.ChangeBreakPointEvent += breakPointManager_ChangeBreakPointEvent;
     foreach (DataGridViewRow row in dgv.Rows)
     {
         string          filefullpath = (string)row.Cells["FilePath"].Value;
         int             line         = int.Parse((string)row.Cells["Line"].Value) - 1;
         ITabbedDocument doc          = ScintillaHelper.GetDocument(filefullpath);
         if (doc != null)
         {
             Boolean m = ScintillaHelper.IsMarkerSet(doc.SciControl, ScintillaHelper.markerBPDisabled, line);
             doc.SciControl.MarkerDelete(line, m ? ScintillaHelper.markerBPDisabled : ScintillaHelper.markerBPEnabled);
         }
         else
         {
             breakPointManager.SetBreakPointInfo(filefullpath, line, true, false);
         }
     }
     dgv.Rows.Clear();
     this.breakPointManager.ChangeBreakPointEvent += breakPointManager_ChangeBreakPointEvent;
     breakPointManager.Save();
 }
예제 #3
0
        private void TsbRemoveSelected_Click(object sender, EventArgs e)
        {
            if (dgv.SelectedCells.Count == 0)
            {
                return;
            }
            this.breakPointManager.ChangeBreakPointEvent -= breakPointManager_ChangeBreakPointEvent;
            var processedRows = new HashSet <DataGridViewRow>();

            foreach (DataGridViewCell selectedCell in dgv.SelectedCells)
            {
                var selected = selectedCell.OwningRow;
                if (processedRows.Contains(selected))
                {
                    continue;
                }
                processedRows.Add(selected);
                string          filefullpath = (string)selected.Cells["FilePath"].Value;
                int             line         = int.Parse((string)selected.Cells["Line"].Value) - 1;
                ITabbedDocument doc          = ScintillaHelper.GetDocument(filefullpath);
                if (doc != null)
                {
                    Boolean m = ScintillaHelper.IsMarkerSet(doc.SciControl, ScintillaHelper.markerBPDisabled, line);
                    doc.SciControl.MarkerDelete(line, m ? ScintillaHelper.markerBPDisabled : ScintillaHelper.markerBPEnabled);
                }
                else
                {
                    breakPointManager.SetBreakPointInfo(filefullpath, line, true, false);
                }
                dgv.Rows.Remove(selected);
            }
            this.breakPointManager.ChangeBreakPointEvent += breakPointManager_ChangeBreakPointEvent;
            breakPointManager.Save();
        }
예제 #4
0
        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();
                }
            }
        }
예제 #5
0
 void dgv_CellMouseUp(object sender, DataGridViewCellMouseEventArgs e)
 {
     this.breakPointManager.ChangeBreakPointEvent -= breakPointManager_ChangeBreakPointEvent;
     if (e.RowIndex < 0 || e.RowIndex >= dgv.Rows.Count)
     {
         return;
     }
     if (dgv.Rows[e.RowIndex].Cells["Enable"].ColumnIndex == e.ColumnIndex)
     {
         var             row          = dgv.Rows[e.RowIndex];
         string          filefullpath = (string)row.Cells["FilePath"].Value;
         int             line         = int.Parse((string)row.Cells["Line"].Value) - 1;
         ITabbedDocument doc          = ScintillaHelper.GetDocument(filefullpath);
         bool            value        = (Boolean)row.Cells["Enable"].EditedFormattedValue;
         if (doc != null)
         {
             // This logic should be handled by BPManager, so we'll just work arround bad BPs and ignore them
             if (line < 0 || (doc.SciControl != null && line >= doc.SciControl.LineCount))
             {
                 return;
             }
             int     marker = value ? ScintillaHelper.markerBPEnabled : ScintillaHelper.markerBPDisabled;
             Boolean m      = ScintillaHelper.IsMarkerSet(doc.SciControl, marker, line);
             if (!m)
             {
                 doc.SciControl.MarkerAdd(line, marker);
                 doc.SciControl.MarkerDelete(line, value ? ScintillaHelper.markerBPDisabled : ScintillaHelper.markerBPEnabled);
             }
         }
         else
         {
             breakPointManager.SetBreakPointInfo(filefullpath, line, false, value);
         }
     }
     this.breakPointManager.ChangeBreakPointEvent += breakPointManager_ChangeBreakPointEvent;
 }