Initial work to get a source view using NSRulerView.
authorRobert Sesek <rsesek@bluestatic.org>
Tue, 11 Jan 2011 23:11:37 +0000 (18:11 -0500)
committerRobert Sesek <rsesek@bluestatic.org>
Sun, 16 Jan 2011 04:45:03 +0000 (23:45 -0500)
Redefine the BSSourceView interface to have a markers property, so that clients
don't dig in for the numberView to set them.

Remove the BSSourceViewTextView as that custom view is no longer needed.

12 files changed:
MacGDBp.xcodeproj/project.pbxproj
Source/BSLineNumberRulerView.h [moved from Source/BSSourceViewTextView.h with 81% similarity]
Source/BSLineNumberRulerView.m [new file with mode: 0644]
Source/BSLineNumberView.mm [moved from Source/BSLineNumberView.m with 100% similarity]
Source/BSSourceView.h
Source/BSSourceView.mm [moved from Source/BSSourceView.m with 72% similarity]
Source/BSSourceViewTextView.m [deleted file]
Source/BreakpointController.h
Source/BreakpointController.m
Source/BreakpointManager.m
Source/DebuggerController.h
Source/DebuggerController.m

index cc5bd058308fdee50e3928c2898f465039b490f8..f25179a6dcaed7818fbfdfea4449f343324a398f 100644 (file)
@@ -22,9 +22,8 @@
                1E67E6FD0F3C052000E68F1B /* PreferencesPathsArrayController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1E67E6FC0F3C052000E68F1B /* PreferencesPathsArrayController.m */; };
                1E6B5947116106FE001189D2 /* LoggingController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1E6B5946116106FE001189D2 /* LoggingController.m */; };
                1E6B594C11610993001189D2 /* Log.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1E6B594A11610993001189D2 /* Log.xib */; };
-               1E7188680D839F6300969277 /* BSLineNumberView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1E7188630D839F6300969277 /* BSLineNumberView.m */; };
-               1E7188690D839F6300969277 /* BSSourceView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1E7188650D839F6300969277 /* BSSourceView.m */; };
-               1E71886A0D839F6300969277 /* BSSourceViewTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1E7188670D839F6300969277 /* BSSourceViewTextView.m */; };
+               1E7188680D839F6300969277 /* BSLineNumberView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1E7188630D839F6300969277 /* BSLineNumberView.mm */; };
+               1E7188690D839F6300969277 /* BSSourceView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1E7188650D839F6300969277 /* BSSourceView.mm */; };
                1E822CDD0DA28AC30027A23F /* Breakpoint.m in Sources */ = {isa = PBXBuildFile; fileRef = 1E822CDC0DA28AC30027A23F /* Breakpoint.m */; };
                1E9582620E252474001A3D89 /* Preferences.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1E9582600E252474001A3D89 /* Preferences.xib */; };
                1E9582670E2524AD001A3D89 /* PreferencesController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1E9582660E2524AD001A3D89 /* PreferencesController.m */; };
@@ -37,6 +36,7 @@
                1EC6965812BBC6A700A8D984 /* modp_b64.cc in Sources */ = {isa = PBXBuildFile; fileRef = 1EC6965212BBC6A700A8D984 /* modp_b64.cc */; };
                1EC6965912BBC6A700A8D984 /* README.bluestatic in Resources */ = {isa = PBXBuildFile; fileRef = 1EC6965512BBC6A700A8D984 /* README.bluestatic */; };
                1EC6965A12BBC6A700A8D984 /* README.chromium in Resources */ = {isa = PBXBuildFile; fileRef = 1EC6965612BBC6A700A8D984 /* README.chromium */; };
+               1EDA9CF812DD13B300596211 /* BSLineNumberRulerView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1EDA9CF712DD13B300596211 /* BSLineNumberRulerView.m */; };
                1EEBFBE50D34C793008F835B /* Debugger.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1EEBFBE30D34C793008F835B /* Debugger.xib */; };
                1EEBFC2B0D358EBD008F835B /* StepIn.png in Resources */ = {isa = PBXBuildFile; fileRef = 1EEBFC2A0D358EBD008F835B /* StepIn.png */; };
                1EEBFC370D358F1B008F835B /* StepOut.png in Resources */ = {isa = PBXBuildFile; fileRef = 1EEBFC360D358F1B008F835B /* StepOut.png */; };
                1E6B5946116106FE001189D2 /* LoggingController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = LoggingController.m; path = Source/LoggingController.m; sourceTree = "<group>"; };
                1E6B594B11610993001189D2 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/Log.xib; sourceTree = "<group>"; };
                1E7188620D839F6300969277 /* BSLineNumberView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BSLineNumberView.h; path = Source/BSLineNumberView.h; sourceTree = "<group>"; };
-               1E7188630D839F6300969277 /* BSLineNumberView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = BSLineNumberView.m; path = Source/BSLineNumberView.m; sourceTree = "<group>"; };
-               1E7188640D839F6300969277 /* BSSourceView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BSSourceView.h; path = Source/BSSourceView.h; sourceTree = "<group>"; };
-               1E7188650D839F6300969277 /* BSSourceView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = BSSourceView.m; path = Source/BSSourceView.m; sourceTree = "<group>"; };
-               1E7188660D839F6300969277 /* BSSourceViewTextView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BSSourceViewTextView.h; path = Source/BSSourceViewTextView.h; sourceTree = "<group>"; };
-               1E7188670D839F6300969277 /* BSSourceViewTextView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = BSSourceViewTextView.m; path = Source/BSSourceViewTextView.m; sourceTree = "<group>"; };
+               1E7188630D839F6300969277 /* BSLineNumberView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = BSLineNumberView.mm; path = Source/BSLineNumberView.mm; sourceTree = "<group>"; };
+               1E7188640D839F6300969277 /* BSSourceView.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; name = BSSourceView.h; path = Source/BSSourceView.h; sourceTree = "<group>"; };
+               1E7188650D839F6300969277 /* BSSourceView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = BSSourceView.mm; path = Source/BSSourceView.mm; sourceTree = "<group>"; };
                1E822CDB0DA28AC30027A23F /* Breakpoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Breakpoint.h; path = Source/Breakpoint.h; sourceTree = "<group>"; };
                1E822CDC0DA28AC30027A23F /* Breakpoint.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Breakpoint.m; path = Source/Breakpoint.m; sourceTree = "<group>"; };
                1E9582610E252474001A3D89 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/Preferences.xib; sourceTree = "<group>"; };
                1EC6965412BBC6A700A8D984 /* modp_b64_data.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = modp_b64_data.h; sourceTree = "<group>"; };
                1EC6965512BBC6A700A8D984 /* README.bluestatic */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.bluestatic; sourceTree = "<group>"; };
                1EC6965612BBC6A700A8D984 /* README.chromium */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.chromium; sourceTree = "<group>"; };
+               1EDA9CF612DD13B300596211 /* BSLineNumberRulerView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BSLineNumberRulerView.h; path = Source/BSLineNumberRulerView.h; sourceTree = "<group>"; };
+               1EDA9CF712DD13B300596211 /* BSLineNumberRulerView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = BSLineNumberRulerView.m; path = Source/BSLineNumberRulerView.m; sourceTree = "<group>"; };
                1EEBFBE40D34C793008F835B /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/Debugger.xib; sourceTree = "<group>"; };
                1EEBFC2A0D358EBD008F835B /* StepIn.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = StepIn.png; path = Icons/StepIn.png; sourceTree = "<group>"; };
                1EEBFC360D358F1B008F835B /* StepOut.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = StepOut.png; path = Icons/StepOut.png; sourceTree = "<group>"; };
                                1EEBFD080D3599E8008F835B /* BSSplitView.h */,
                                1EEBFD070D3599E8008F835B /* BSSplitView.m */,
                                1E7188620D839F6300969277 /* BSLineNumberView.h */,
-                               1E7188630D839F6300969277 /* BSLineNumberView.m */,
+                               1E7188630D839F6300969277 /* BSLineNumberView.mm */,
                                1E7188640D839F6300969277 /* BSSourceView.h */,
-                               1E7188650D839F6300969277 /* BSSourceView.m */,
-                               1E7188660D839F6300969277 /* BSSourceViewTextView.h */,
-                               1E7188670D839F6300969277 /* BSSourceViewTextView.m */,
+                               1E7188650D839F6300969277 /* BSSourceView.mm */,
+                               1EDA9CF612DD13B300596211 /* BSLineNumberRulerView.h */,
+                               1EDA9CF712DD13B300596211 /* BSLineNumberRulerView.m */,
                        );
                        name = "Source View";
                        sourceTree = "<group>";
                                1E02C5F60C610724006F1752 /* DebuggerController.m in Sources */,
                                1E35FC760C6579CA0030F527 /* NSXMLElementAdditions.m in Sources */,
                                1EEBFD090D3599E8008F835B /* BSSplitView.m in Sources */,
-                               1E7188680D839F6300969277 /* BSLineNumberView.m in Sources */,
-                               1E7188690D839F6300969277 /* BSSourceView.m in Sources */,
-                               1E71886A0D839F6300969277 /* BSSourceViewTextView.m in Sources */,
+                               1E7188680D839F6300969277 /* BSLineNumberView.mm in Sources */,
+                               1E7188690D839F6300969277 /* BSSourceView.mm in Sources */,
                                1E822CDD0DA28AC30027A23F /* Breakpoint.m in Sources */,
                                1E4C7AF90DA401C7000A9DC7 /* BreakpointManager.m in Sources */,
                                1EFF70C30DFDC018006B9D33 /* BreakpointController.m in Sources */,
                                1EC6965812BBC6A700A8D984 /* modp_b64.cc in Sources */,
                                1EFBE63012C515C200F96D6E /* NetworkConnection.mm in Sources */,
                                1EFBE66B12C51E3900F96D6E /* NetworkCallbackController.mm in Sources */,
+                               1EDA9CF812DD13B300596211 /* BSLineNumberRulerView.m in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
similarity index 81%
rename from Source/BSSourceViewTextView.h
rename to Source/BSLineNumberRulerView.h
index 4fd2ac95fa649b124e0e3b51e1177c34c4cea6e4..f2493f40f3e9b74332410492ef3bf6fec90be456 100644 (file)
 
 #import <Cocoa/Cocoa.h>
 
-@class BSSourceView;
-
-@interface BSSourceViewTextView : NSTextView
+// The NSRulerView that draws line numbers on the BSSourceView.
+@interface BSLineNumberRulerView : NSRulerView
 {
-  BSSourceView* sourceView;
+
 }
 
-@property(readwrite, assign) BSSourceView* sourceView;
+// Designated initializer.
+- (id)initWithScrollView:(NSScrollView*)scrollView;
 
 @end
diff --git a/Source/BSLineNumberRulerView.m b/Source/BSLineNumberRulerView.m
new file mode 100644 (file)
index 0000000..601c5ac
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * MacGDBp
+ * Copyright (c) 2007 - 2011, Blue Static <http://www.bluestatic.org>
+ * 
+ * This program is free software; you can redistribute it and/or modify it under the terms of the GNU 
+ * General Public License as published by the Free Software Foundation; either version 2 of the 
+ * License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 
+ * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+ * General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License along with this program; if not, 
+ * write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#import "BSLineNumberRulerView.h"
+
+
+@implementation BSLineNumberRulerView
+
+- (id)initWithScrollView:(NSScrollView*)scrollView
+{
+  if (self = [super initWithScrollView:scrollView orientation:NSVerticalRuler]) {
+    [self setClientView:[scrollView documentView]];
+  }
+  return self;
+}
+
+- (void)awakeFromNib
+{
+  [self setClientView:[[self scrollView] documentView]];
+}
+
+@end
index 811f834ffc703fc1f2ee86eb6dbc9c3d1b5046ba..cb53f19eb92a9bfa01347883f8fe719d1b0b85e2 100644 (file)
  */
 
 #import <Cocoa/Cocoa.h>
+#include <vector>
+
 #import "BSLineNumberView.h"
-#import "BSSourceViewTextView.h"
 
 @protocol BSSourceViewDelegate;
 
 @interface BSSourceView : NSView
 {
-  BSLineNumberView* numberView;
-  BSSourceViewTextView* textView;
-  NSScrollView* scrollView;
-  
+ @private
+  NSTextView* textView_;
+  NSScrollView* scrollView_;
+
+  std::vector<NSUInteger> lineIndex_;
+
+  NSSet* markers_;
+
   NSString* file;
   int markedLine;
-  
+
   id<BSSourceViewDelegate> delegate;
 }
 
-@property(readwrite, assign) BSLineNumberView* numberView;
-@property(readwrite, assign) BSSourceViewTextView* textView;
-@property(readwrite, assign) NSScrollView* scrollView;
-@property(readwrite, nonatomic, assign) NSString* file;
-@property(readwrite, assign) int markedLine;
-@property(readwrite, assign) id delegate;
+@property (assign) NSTextView* textView;
+@property (assign) NSScrollView* scrollView;
+@property (retain) NSSet* markers;
+@property (nonatomic, assign) NSString* file;
+@property (assign) int markedLine;
+@property (assign) id delegate;
 
 - (void)setFile:(NSString*)f;
 - (void)setString:(NSString*)source asFile:(NSString*)path;
similarity index 72%
rename from Source/BSSourceView.m
rename to Source/BSSourceView.mm
index 55481eb0eca721226e9c2a0b1d80ff51a5e488f8..9a6fbe8585d464780ec131eaa0ef317b8b52c8c9 100644 (file)
@@ -16,6 +16,8 @@
 
 #import "BSSourceView.h"
 
+#include "BSLineNumberRulerView.h"
+
 @interface BSSourceView (Private)
 - (void)setupViews;
 - (void)errorHighlightingFile:(NSNotification*)notif;
 
 @implementation BSSourceView
 
-@synthesize numberView, textView, scrollView, markedLine, delegate, file;
+@synthesize textView = textView_;
+@synthesize scrollView = scrollView_;
+@synthesize markers = markers_;
+@synthesize markedLine;
+@synthesize delegate;
+@synthesize file;
 
 /**
  * Initializes the source view with the path of a file
@@ -51,9 +58,8 @@
 {
   [file release];
   
-  [numberView removeFromSuperview];
-  [scrollView removeFromSuperview];
-  [textView removeFromSuperview];
+  [scrollView_ removeFromSuperview];
+  [textView_ removeFromSuperview];
   
   [super dealloc];
 }
@@ -71,7 +77,7 @@
   
   if (![[NSFileManager defaultManager] fileExistsAtPath:f])
   {
-    [textView setString:@""];
+    [textView_ setString:@""];
     return;
   }
 
@@ -92,7 +98,7 @@
     
     NSData* data               = [[outPipe fileHandleForReading] readDataToEndOfFile];
     NSAttributedString* source = [[NSAttributedString alloc] initWithHTML:data documentAttributes:NULL];
-    [[textView textStorage] setAttributedString:source];
+    [[textView_ textStorage] setAttributedString:source];
     [source release];
   }
   @catch (NSException* exception)
   [source writeToFile:tmpPath atomically:NO encoding:NSUTF8StringEncoding error:&error];
   if (error)
   {
-    [textView setString:source];
+    [textView_ setString:source];
     return;
   }
   
  */
 - (void)scrollToLine:(int)line
 {
-  if ([[textView textStorage] length] == 0)
+  if ([[textView_ textStorage] length] == 0)
     return;
   
   // go through the document until we find the NSRange for the line we want
   int rangeIndex = 0;
   for (int i = 0; i < line; i++)
   {
-    rangeIndex = NSMaxRange([[textView string] lineRangeForRange:NSMakeRange(rangeIndex, 0)]);
+    rangeIndex = NSMaxRange([[textView_ string] lineRangeForRange:NSMakeRange(rangeIndex, 0)]);
   }
   
   // now get the true start/end markers for it
   unsigned lineStart, lineEnd;
-  [[textView string] getLineStart:&lineStart end:NULL contentsEnd:&lineEnd forRange:NSMakeRange(rangeIndex - 1, 0)];
-  [textView scrollRangeToVisible:[[textView string] lineRangeForRange:NSMakeRange(lineStart, lineEnd - lineStart)]];
+  [[textView_ string] getLineStart:&lineStart end:NULL contentsEnd:&lineEnd forRange:NSMakeRange(rangeIndex - 1, 0)];
+  [textView_ scrollRangeToVisible:[[textView_ string] lineRangeForRange:NSMakeRange(lineStart, lineEnd - lineStart)]];
 }
 
 /**
 {
   int gutterWidth = 30;
   
-  // setup the line number view
-  NSRect numberFrame = [self bounds];
-  numberFrame.origin = NSMakePoint(0.0, 0.0);
-  numberFrame.size.width = gutterWidth;
-  numberView = [[BSLineNumberView alloc] initWithFrame:numberFrame];
-  [numberView setAutoresizingMask:NSViewHeightSizable];
-  [numberView setSourceView:self];
-  [self addSubview:numberView];
-  
-  // create the scroll view
+  // Create the scroll view.
   NSRect scrollFrame = [self bounds];
   scrollFrame.origin.x = gutterWidth;
   scrollFrame.size.width = scrollFrame.size.width - gutterWidth;
-  scrollView = [[NSScrollView alloc] initWithFrame:scrollFrame];
-  [scrollView setHasHorizontalScroller:YES];
-  [scrollView setHasVerticalScroller:YES];
-  [scrollView setAutohidesScrollers:YES];
-  [scrollView setBorderType:NSBezelBorder];
-  [scrollView setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)];
-  [[scrollView contentView] setAutoresizesSubviews:YES];
-  [self addSubview:scrollView];
-  
+  scrollView_ = [[[NSScrollView alloc] initWithFrame:scrollFrame] autorelease];
+  [scrollView_ setHasHorizontalScroller:YES];
+  [scrollView_ setHasVerticalScroller:YES];
+  [scrollView_ setAutohidesScrollers:YES];
+  [scrollView_ setBorderType:NSBezelBorder];
+  [scrollView_ setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)];
+  [[scrollView_ contentView] setAutoresizesSubviews:YES];
+  [self addSubview:scrollView_];
+
+  // Set up the ruler.
+  BSLineNumberRulerView* lineNumberView =
+      [[[BSLineNumberRulerView alloc] initWithScrollView:scrollView_] autorelease];
+  [scrollView_ setVerticalRulerView:lineNumberView];  
+  [scrollView_ setHasHorizontalRuler:NO];
+  [scrollView_ setHasVerticalRuler:YES];
+  [scrollView_ setRulersVisible:YES];
+
   // add the text view to the scroll view
   NSRect textFrame;
   textFrame.origin = NSMakePoint(0.0, 0.0);
-  textFrame.size = [scrollView contentSize];
-  textView = [[BSSourceViewTextView alloc] initWithFrame:textFrame];
-  [textView setSourceView:self];
-  [textView setEditable:NO];
-  [textView setFont:[NSFont fontWithName:@"Monaco" size:10.0]];
-  [textView setHorizontallyResizable:YES];
-  [textView setVerticallyResizable:YES];
-  [textView setMinSize:textFrame.size];
-  [textView setMaxSize:NSMakeSize(FLT_MAX, FLT_MAX)];
-  [[textView textContainer] setContainerSize:NSMakeSize(FLT_MAX, FLT_MAX)];
-  [[textView textContainer] setWidthTracksTextView:NO];
-  [[textView textContainer] setHeightTracksTextView:NO];
-  [textView setAutoresizingMask:NSViewNotSizable];
-  [scrollView setDocumentView:textView];
+  textFrame.size = [scrollView_ contentSize];
+  textView_ = [[[NSTextView alloc] initWithFrame:textFrame] autorelease];
+  [textView_ setEditable:NO];
+  [textView_ setFont:[NSFont fontWithName:@"Monaco" size:10.0]];
+  [textView_ setHorizontallyResizable:YES];
+  [textView_ setVerticallyResizable:YES];
+  [textView_ setMinSize:textFrame.size];
+  [textView_ setMaxSize:NSMakeSize(FLT_MAX, FLT_MAX)];
+  [[textView_ textContainer] setContainerSize:NSMakeSize(FLT_MAX, FLT_MAX)];
+  [[textView_ textContainer] setWidthTracksTextView:NO];
+  [[textView_ textContainer] setHeightTracksTextView:NO];
+  [textView_ setAutoresizingMask:NSViewNotSizable];
+  [scrollView_ setDocumentView:textView_];
 
   NSArray* types = [NSArray arrayWithObject:NSFilenamesPboardType];
   [self registerForDraggedTypes:types];
     NSLog(@"Error reading file at %@: %@", filePath, error);
     return;
   }
-  [textView setString:contents];
+  [textView_ setString:contents];
 }
 
 /**
diff --git a/Source/BSSourceViewTextView.m b/Source/BSSourceViewTextView.m
deleted file mode 100644 (file)
index 99cead5..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * MacGDBp
- * Copyright (c) 2007 - 2011, Blue Static <http://www.bluestatic.org>
- * 
- * This program is free software; you can redistribute it and/or modify it under the terms of the GNU 
- * General Public License as published by the Free Software Foundation; either version 2 of the 
- * License, or (at your option) any later version.
- * 
- * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 
- * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
- * General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License along with this program; if not, 
- * write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- */
-
-#import "BSSourceViewTextView.h"
-#import "BSSourceView.h"
-
-@implementation BSSourceViewTextView
-
-@synthesize sourceView;
-
-/**
- * Override -[drawRect:] so we can tell the line numbers to draw
- */
-- (void)drawRect:(NSRect)rect
-{
-  [super drawRect:rect];
-  
-  unsigned i = 0, line = 1;
-  while (i < [[self layoutManager] numberOfGlyphs])
-  {
-    NSRange fragRange;
-    NSRect fragRect = [self convertRect:[[self layoutManager] lineFragmentRectForGlyphAtIndex:i effectiveRange:&fragRange] fromView:self];
-    fragRect.origin.x = rect.origin.x; // horizontal scrolling matters not
-    
-    if ([sourceView markedLine] == line)
-    {
-      [[[NSColor redColor] colorWithAlphaComponent:0.25] set];
-      [NSBezierPath fillRect:fragRect];
-      break;
-    }
-    
-    i += fragRange.length;
-    line++;
-  }
-  
-  [[sourceView numberView] setNeedsDisplay:YES];
-}
-
-@end
index 95b635a3682d965bc9718cf33c34e073acfd8192..f188a22cab53f54e938ebcc862d91d74158ab7af 100644 (file)
@@ -16,7 +16,9 @@
 
 #import <Cocoa/Cocoa.h>
 #import "BreakpointManager.h"
-#import "BSSourceView.h"
+
+@class BSSourceView;
+@protocol BSSourceViewDelegate;
 
 @interface BreakpointController : NSWindowController<BSSourceViewDelegate>
 {
index f50a63c957af6110d1264869afb1b8ec9c092d85..9f162db24b1e2104cb3e65aee51d928d248ab9ec 100644 (file)
@@ -15,8 +15,9 @@
  */
 
 #import "BreakpointController.h"
-#import "AppDelegate.h"
 
+#import "AppDelegate.h"
+#import "BSSourceView.h"
 
 @implementation BreakpointController
 
@@ -86,7 +87,7 @@
   Breakpoint* bp = [selection objectAtIndex:0];
   [sourceView setFile:[bp file]];
   [sourceView scrollToLine:[bp line]];
-  [[sourceView numberView] setMarkers:[NSSet setWithArray:[manager breakpointsForFile:[bp file]]]];
+  [sourceView setMarkers:[NSSet setWithArray:[manager breakpointsForFile:[bp file]]]];
 }
 
 #pragma mark BSSourceView Delegate
     [bp release];
   }
   
-  [[sourceView numberView] setMarkers:[NSSet setWithArray:[manager breakpointsForFile:file]]];
-  [[sourceView numberView] setNeedsDisplay:YES];
+  [sourceView setMarkers:[NSSet setWithArray:[manager breakpointsForFile:file]]];
+  [sourceView setNeedsDisplay:YES];
 }
 
 /**
index 0407a472163c8006bcd1512699d35bae43f98a31..b4654a40795e9eaaa49ca494a9ad11045c15766c 100644 (file)
   AppDelegate* appDel = [NSApp delegate];
   [[[appDel breakpoint] arrayController] rearrangeObjects];
   [[[appDel breakpoint] sourceView] setNeedsDisplay:YES];
-  [[[[appDel breakpoint] sourceView] numberView] setMarkers:[NSSet setWithArray:[self breakpointsForFile:file]]];
+  [[[appDel breakpoint] sourceView] setMarkers:[NSSet setWithArray:[self breakpointsForFile:file]]];
   [[[appDel debugger] sourceViewer] setNeedsDisplay:YES];
-  [[[[appDel debugger] sourceViewer] numberView] setMarkers:[NSSet setWithArray:[self breakpointsForFile:file]]];
+  [[[appDel debugger] sourceViewer] setMarkers:[NSSet setWithArray:[self breakpointsForFile:file]]];
 }
 
 @end
index caba4bbd8c182ba1a364278b0e64028d7df1d959..947172953fd956914962114b79ffa817e11ad2f5 100644 (file)
  */
 
 #import <Cocoa/Cocoa.h>
-#import "BSSourceView.h"
 #import "DebuggerBackEnd.h"
 #import "StackController.h"
 #include "VariableNode.h"
 
+@class BSSourceView;
+
 @interface DebuggerController : NSWindowController <DebuggerBackEndDelegate>
 {
   DebuggerBackEnd* connection;
index efd037ea1bc41d8ee82ec82c25d1902e5ed39118..e481daad293a92d1f695ba3e51c0e6af98cfefe6 100644 (file)
  */
 
 #import "DebuggerController.h"
-#import "NSXMLElementAdditions.h"
+
 #import "AppDelegate.h"
+#import "BSSourceView.h"
 #import "BreakpointManager.h"
+#import "NSXMLElementAdditions.h"
 
 @interface DebuggerController (Private)
 - (void)updateSourceViewer;
     [sourceViewer setString:frame.source asFile:filename];
     
     NSSet* breakpoints = [NSSet setWithArray:[[BreakpointManager sharedManager] breakpointsForFile:filename]];
-    [[sourceViewer numberView] setMarkers:breakpoints];
+    [sourceViewer setMarkers:breakpoints];
   }
   
   [sourceViewer setMarkedLine:frame.lineNumber];
     [bp release];
   }
   
-  [[sourceViewer numberView] setMarkers:[NSSet setWithArray:[mngr breakpointsForFile:file]]];
-  [[sourceViewer numberView] setNeedsDisplay:YES];
+  [sourceViewer setMarkers:[NSSet setWithArray:[mngr breakpointsForFile:file]]];
+  [sourceViewer setNeedsDisplay:YES];
 }
 
 #pragma mark GDBpConnectionDelegate