Esempio n. 1
0
 public static void Remove()
 {
     if (instance != null)
     {
         instance.Document.BookmarkManager.RemoveMark(instance);
         instance.RemoveMarker();
         instance = null;
     }
 }
Esempio n. 2
0
 public static CurrentBreakpointBookmark IsOnBreakpoint(IDocument document, int lineNumber)
 {
     foreach (Bookmark m in document.BookmarkManager.Marks)
     {
         CurrentBreakpointBookmark breakpoint = m as CurrentBreakpointBookmark;
         if (breakpoint != null)
         {
             if (breakpoint.LineNumber == lineNumber)
             {
                 return(breakpoint);
             }
         }
     }
     return(null);
 }
Esempio n. 3
0
 public static void ToggleBreakpointAtByOpen(IDocument document, string fileName, int lineNumber, Breakpoint br)
 {
     foreach (char ch in document.GetText(document.GetLineSegment(lineNumber)))
     {
         if (!char.IsWhiteSpace(ch))
         {
             CurrentBreakpointBookmark cbb = new CurrentBreakpointBookmark(fileName, document, lineNumber);
             breakpoints.Add(cbb, br);
             document.BookmarkManager.AddMark(cbb);
             document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.SingleLine, lineNumber));
             document.CommitUpdate();
             break;
         }
     }
 }
Esempio n. 4
0
        public static void SetPosition(string fileName, IDocument document, int makerStartLine, int makerStartColumn, int makerEndLine, int makerEndColumn)
        {
            Remove();

            startLine   = makerStartLine;
            startColumn = makerStartColumn;
            endLine     = makerEndLine;
            endColumn   = makerEndColumn;

            LineSegment line = document.GetLineSegment(startLine - 1);

            instance = new CurrentBreakpointBookmark(fileName, document, startLine - 1);
            document.BookmarkManager.AddMark(instance);
            document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.LinesBetween, startLine - 1, endLine - 1));
            document.CommitUpdate();
        }
Esempio n. 5
0
 public static void IconBarMouseDown(AbstractMargin iconBar, Point mousepos, MouseButtons mouseButtons)
 {
     try
     {
         if (mouseButtons != MouseButtons.Left)
         {
             if (mouseButtons == MouseButtons.Right)
             {
                 iconBar.TextArea.MotherTextEditorControl.ContextMenuStrip = null;
                 Rectangle viewRect = iconBar.TextArea.TextView.DrawingPosition;
                 ICSharpCode.TextEditor.TextLocation logicPos = iconBar.TextArea.TextView.GetLogicalPosition(0, mousepos.Y - viewRect.Top);
                 if (logicPos.Y >= 0 && logicPos.Y < iconBar.TextArea.Document.TotalNumberOfLines)
                 {
                     cur_bookmark = IsOnBreakpoint(iconBar.TextArea.Document, logicPos.Y);
                     if (cur_bookmark != null)
                     {
                         iconBar.TextArea.MotherTextEditorControl.ContextMenuStrip = VisualPABCSingleton.MainForm.BreakpointMenuStrip;
                     }
                 }
             }
             return;
         }
         else
         {
             Rectangle viewRect = iconBar.TextArea.TextView.DrawingPosition;
             //Point logicPos = iconBar.TextArea.TextView.GetLogicalPosition(0, mousepos.Y - viewRect.Top);
             ICSharpCode.TextEditor.TextLocation logicPos = iconBar.TextArea.TextView.GetLogicalPosition(0, mousepos.Y - viewRect.Top);
             if (logicPos.Y >= 0 && logicPos.Y < iconBar.TextArea.Document.TotalNumberOfLines)
             {
                 string s = iconBar.TextArea.MotherTextEditorControl.FileName;
                 if (s == null)
                 {
                     s = TextAreaHelper.GetFileNameByTextArea(iconBar.TextArea);
                 }
                 ToggleBreakpointAt(iconBar.TextArea.Document, s, logicPos.Y);
                 iconBar.TextArea.Refresh(iconBar);
             }
         }
     }
     catch (System.Exception e)
     {
     }
 }
Esempio n. 6
0
 public static void ToggleBreakpointAt(IDocument document, string fileName, int lineNumber)
 {
     foreach (Bookmark m in document.BookmarkManager.Marks)
     {
         CurrentBreakpointBookmark breakpoint = m as CurrentBreakpointBookmark;
         if (breakpoint != null)
         {
             if (breakpoint.LineNumber == lineNumber)
             {
                 document.BookmarkManager.RemoveMark(m);
                 try
                 {
                     if (breakpoints_conditions.ContainsKey(breakpoints[breakpoint]))
                     {
                         breakpoints_conditions.Remove(breakpoints[breakpoint]);
                     }
                     WorkbenchServiceFactory.DebuggerManager.RemoveBreakpoint(breakpoints[breakpoint]);
                 }
                 catch (System.Exception e)
                 {
                 }
                 breakpoints.Remove(breakpoint);
                 breakpoint.RemoveMarker();
                 return;
             }
         }
     }
     foreach (char ch in document.GetText(document.GetLineSegment(lineNumber)))
     {
         if (!char.IsWhiteSpace(ch))
         {
             CurrentBreakpointBookmark cbb = new CurrentBreakpointBookmark(fileName, document, lineNumber);
             breakpoints.Add(cbb, WorkbenchServiceFactory.DebuggerManager.AddBreakPoint(fileName, lineNumber + 1, true));
             document.BookmarkManager.AddMark(cbb);
             document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.SingleLine, lineNumber));
             document.CommitUpdate();
             break;
         }
     }
 }
Esempio n. 7
0
 public static void IconBarMouseDown(AbstractMargin iconBar, Point mousepos, MouseButtons mouseButtons)
 {
     try
     {
         if (mouseButtons != MouseButtons.Left)
         {
         	if (mouseButtons == MouseButtons.Right)
         	{
         		iconBar.TextArea.MotherTextEditorControl.ContextMenuStrip = null;
         		Rectangle viewRect = iconBar.TextArea.TextView.DrawingPosition;
         		ICSharpCode.TextEditor.TextLocation logicPos = iconBar.TextArea.TextView.GetLogicalPosition(0, mousepos.Y - viewRect.Top);
         		if (logicPos.Y >= 0 && logicPos.Y < iconBar.TextArea.Document.TotalNumberOfLines)
         		{
         			cur_bookmark = IsOnBreakpoint(iconBar.TextArea.Document,logicPos.Y);
         			if (cur_bookmark != null)
         			{
         				iconBar.TextArea.MotherTextEditorControl.ContextMenuStrip = VisualPABCSingleton.MainForm.BreakpointMenuStrip;
         			}
         		}
         	}
         	return;
         }
         else
         {
         	Rectangle viewRect = iconBar.TextArea.TextView.DrawingPosition;
         	//Point logicPos = iconBar.TextArea.TextView.GetLogicalPosition(0, mousepos.Y - viewRect.Top);
         	ICSharpCode.TextEditor.TextLocation logicPos = iconBar.TextArea.TextView.GetLogicalPosition(0, mousepos.Y - viewRect.Top);
         	if (logicPos.Y >= 0 && logicPos.Y < iconBar.TextArea.Document.TotalNumberOfLines)
         	{
             	string s = iconBar.TextArea.MotherTextEditorControl.FileName;
             	if (s == null) s = TextAreaHelper.GetFileNameByTextArea(iconBar.TextArea);
             	ToggleBreakpointAt(iconBar.TextArea.Document, s, logicPos.Y);
            	 	iconBar.TextArea.Refresh(iconBar);
        	 	}
         }
     }
     catch (System.Exception e)
     {
     }
 }
Esempio n. 8
0
 public static void ToggleBreakpointAt(IDocument document, string fileName, int lineNumber)
 {
     foreach (Bookmark m in document.BookmarkManager.Marks)
     {
         CurrentBreakpointBookmark breakpoint = m as CurrentBreakpointBookmark;
         if (breakpoint != null)
         {
             if (breakpoint.LineNumber == lineNumber)
             {
             	document.BookmarkManager.RemoveMark(m);
                 try
                 {
                     if (breakpoints_conditions.ContainsKey(breakpoints[breakpoint]))
             		breakpoints_conditions.Remove(breakpoints[breakpoint]);
                 	WorkbenchServiceFactory.DebuggerManager.RemoveBreakpoint(breakpoints[breakpoint]);
                 }
                 catch (System.Exception e)
                 {
                 }
                 breakpoints.Remove(breakpoint);
                 breakpoint.RemoveMarker();
                 return;
             }
         }
     }
     foreach (char ch in document.GetText(document.GetLineSegment(lineNumber)))
     {
         if (!char.IsWhiteSpace(ch))
         {
             CurrentBreakpointBookmark cbb = new CurrentBreakpointBookmark(fileName, document, lineNumber);
             breakpoints.Add(cbb, WorkbenchServiceFactory.DebuggerManager.AddBreakPoint(fileName, lineNumber + 1,true));
             document.BookmarkManager.AddMark(cbb);
             document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.SingleLine, lineNumber));
             document.CommitUpdate();
             break;
         }
     }
 }
Esempio n. 9
0
 public static void ToggleBreakpointAtByOpen(IDocument document, string fileName, int lineNumber, Breakpoint br)
 {
     foreach (char ch in document.GetText(document.GetLineSegment(lineNumber)))
     {
         if (!char.IsWhiteSpace(ch))
         {
             CurrentBreakpointBookmark cbb = new CurrentBreakpointBookmark(fileName, document, lineNumber);
             breakpoints.Add(cbb, br);
             document.BookmarkManager.AddMark(cbb);
             document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.SingleLine, lineNumber));
             document.CommitUpdate();
             break;
         }
     }
 }
Esempio n. 10
0
 public static void Remove()
 {
     if (instance != null)
     {
         instance.Document.BookmarkManager.RemoveMark(instance);
         instance.RemoveMarker();
         instance = null;
     }
 }
Esempio n. 11
0
        public static void SetPosition(string fileName, IDocument document, int makerStartLine, int makerStartColumn, int makerEndLine, int makerEndColumn)
        {
            Remove();

            startLine = makerStartLine;
            startColumn = makerStartColumn;
            endLine = makerEndLine;
            endColumn = makerEndColumn;

            LineSegment line = document.GetLineSegment(startLine - 1);
            instance = new CurrentBreakpointBookmark(fileName, document, startLine - 1);
            document.BookmarkManager.AddMark(instance);
            document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.LinesBetween, startLine - 1, endLine - 1));
            document.CommitUpdate();
        }