Previous 199869 Revisions Next

r36059 Sunday 22nd February, 2015 at 17:23:12 UTC by Vasantha Crabb
Add a whole line scroll mode to make breakpoints/watchpoints header work nicely
[/branches/kale/src/osd/modules/debugger/osx]breakpointsview.m consoleview.m debugview.h debugview.m disassemblyview.m errorlogview.m memoryview.m registersview.m watchpointsview.m

branches/kale/src/osd/modules/debugger/osx/breakpointsview.m
r244570r244571
1717@implementation MAMEBreakpointsView
1818
1919- (id)initWithFrame:(NSRect)f machine:(running_machine &)m {
20   if (!(self = [super initWithFrame:f type:DVT_BREAK_POINTS machine:m]))
20   if (!(self = [super initWithFrame:f type:DVT_BREAK_POINTS machine:m wholeLineScroll:YES]))
2121      return nil;
2222   return self;
2323}
branches/kale/src/osd/modules/debugger/osx/consoleview.m
r244570r244571
1717@implementation MAMEConsoleView
1818
1919- (id)initWithFrame:(NSRect)f machine:(running_machine &)m {
20   if (!(self = [super initWithFrame:f type:DVT_CONSOLE machine:m]))
20   if (!(self = [super initWithFrame:f type:DVT_CONSOLE machine:m wholeLineScroll:NO]))
2121      return nil;
2222   return self;
2323}
branches/kale/src/osd/modules/debugger/osx/debugview.h
r244570r244571
2222   int            type;
2323   running_machine   *machine;
2424   debug_view      *view;
25   BOOL         wholeLineScroll;
2526
2627   INT32         totalWidth, totalHeight, originTop;
2728
r244570r244571
3536
3637+ (NSFont *)defaultFont;
3738
38- (id)initWithFrame:(NSRect)f type:(debug_view_type)t machine:(running_machine &)m;
39- (id)initWithFrame:(NSRect)f type:(debug_view_type)t machine:(running_machine &)m wholeLineScroll:(BOOL)w;
3940
4041- (void)update;
4142
branches/kale/src/osd/modules/debugger/osx/debugview.m
r244570r244571
168168   // this gets all the lines that are at least partially visible
169169   debug_view_xy origin(0, 0), size(totalWidth, totalHeight);
170170   [self convertBounds:[self visibleRect] toFirstAffectedLine:&origin.y count:&size.y];
171   size.y = MIN(size.y, totalHeight - origin.y);
171172
172173   // tell the underlying view how much real estate is available
173174   view->set_visible_size(size);
r244570r244571
196197
197198- (void)adjustSizeAndRecomputeVisible {
198199   NSSize const clip = [[[self enclosingScrollView] contentView] bounds].size;
199   NSSize const content = NSMakeSize((fontWidth * totalWidth) + (2 * [textContainer lineFragmentPadding]),
200                             fontHeight * totalHeight);
201   [self setFrameSize:NSMakeSize(MAX(clip.width, content.width), MAX(clip.height, content.height))];
200   NSSize content = NSMakeSize((fontWidth * totalWidth) + (2 * [textContainer lineFragmentPadding]),
201                        fontHeight * totalHeight);
202   if (wholeLineScroll)
203      content.height += (fontHeight * 2) - 1;
204   [self setFrameSize:NSMakeSize(ceil(MAX(clip.width, content.width)),
205                          ceil(MAX(clip.height, content.height)))];
202206   [self recomputeVisible];
203207}
204208
r244570r244571
208212}
209213
210214
211- (id)initWithFrame:(NSRect)f type:(debug_view_type)t machine:(running_machine &)m {
215- (id)initWithFrame:(NSRect)f type:(debug_view_type)t machine:(running_machine &)m wholeLineScroll:(BOOL)w {
212216   if (!(self = [super initWithFrame:f]))
213217      return nil;
214218   type = t;
r244570r244571
218222      [self release];
219223      return nil;
220224   }
221   totalWidth = totalHeight = 0;
225   wholeLineScroll = w;
226   debug_view_xy const size = view->total_size();
227   totalWidth = size.x;
228   totalHeight = size.y;
222229   originTop = 0;
223230
224231   text = [[NSTextStorage alloc] init];
r244570r244571
258265      if (scroller)
259266      {
260267         NSSize const clip = [[scroller contentView] bounds].size;
261         NSSize const content = NSMakeSize((fontWidth * newSize.x) + (2 * [textContainer lineFragmentPadding]),
262                                   fontHeight * newSize.y);
263         [self setFrameSize:NSMakeSize(MAX(clip.width, content.width), MAX(clip.height, content.height))];
264         [self recomputeVisible];
268         NSSize content = NSMakeSize((fontWidth * newSize.x) + (2 * [textContainer lineFragmentPadding]),
269                              fontHeight * newSize.y);
270         if (wholeLineScroll)
271            content.height += (fontHeight * 2) - 1;
272         [self setFrameSize:NSMakeSize(ceil(MAX(clip.width, content.width)),
273                                ceil(MAX(clip.height, content.height)))];
265274      }
266275      totalWidth = newSize.x;
267276      totalHeight = newSize.y;
r244570r244571
273282   {
274283      NSRect const visible = [self visibleRect];
275284      NSPoint scroll = NSMakePoint(visible.origin.x, newOrigin.y * fontHeight);
276      if ((newOrigin.y + view->visible_size().y) == totalHeight)
277         scroll.y += (view->visible_size().y * fontHeight) - visible.size.height;
278285      [self scrollPoint:scroll];
279286      originTop = newOrigin.y;
280287   }
r244570r244571
287294- (NSSize)maximumFrameSize {
288295   debug_view_xy const max = view->total_size();
289296   return NSMakeSize(ceil((max.x * fontWidth) + (2 * [textContainer lineFragmentPadding])),
290                 ceil(max.y * fontHeight));
297                 ceil((max.y + (wholeLineScroll ? 1 : 0)) * fontHeight));
291298}
292299
293300
r244570r244571
519526                                     selector:@selector(viewFrameDidChange:)
520527                                        name:NSViewFrameDidChangeNotification
521528                                       object:[scroller contentView]];
529      [self adjustSizeAndRecomputeVisible];
522530   }
523531}
524532
r244570r244571
558566}
559567
560568
569- (NSRect)adjustScroll:(NSRect)proposedVisibleRect {
570   if (wholeLineScroll)
571   {
572      CGFloat const clamp = [self bounds].size.height - fontHeight - proposedVisibleRect.size.height;
573      proposedVisibleRect.origin.y = MIN(proposedVisibleRect.origin.y, MAX(clamp, 0));
574      proposedVisibleRect.origin.y -= fmod(proposedVisibleRect.origin.y, fontHeight);
575   }
576   return proposedVisibleRect;
577}
578
579
561580- (void)drawRect:(NSRect)dirtyRect {
562581   // work out what's available
563582   [self recomputeVisible];
branches/kale/src/osd/modules/debugger/osx/disassemblyview.m
r244570r244571
1717@implementation MAMEDisassemblyView
1818
1919- (id)initWithFrame:(NSRect)f machine:(running_machine &)m {
20   if (!(self = [super initWithFrame:f type:DVT_DISASSEMBLY machine:m]))
20   if (!(self = [super initWithFrame:f type:DVT_DISASSEMBLY machine:m wholeLineScroll:NO]))
2121      return nil;
2222   return self;
2323}
branches/kale/src/osd/modules/debugger/osx/errorlogview.m
r244570r244571
1717@implementation MAMEErrorLogView
1818
1919- (id)initWithFrame:(NSRect)f machine:(running_machine &)m {
20   if (!(self = [super initWithFrame:f type:DVT_LOG machine:m]))
20   if (!(self = [super initWithFrame:f type:DVT_LOG machine:m wholeLineScroll:NO]))
2121      return nil;
2222   return self;
2323}
branches/kale/src/osd/modules/debugger/osx/memoryview.m
r244570r244571
1818@implementation MAMEMemoryView
1919
2020- (id)initWithFrame:(NSRect)f machine:(running_machine &)m {
21   if (!(self = [super initWithFrame:f type:DVT_MEMORY machine:m]))
21   if (!(self = [super initWithFrame:f type:DVT_MEMORY machine:m wholeLineScroll:NO]))
2222      return nil;
2323   return self;
2424}
branches/kale/src/osd/modules/debugger/osx/registersview.m
r244570r244571
1818@implementation MAMERegistersView
1919
2020- (id)initWithFrame:(NSRect)f machine:(running_machine &)m {
21   if (!(self = [super initWithFrame:f type:DVT_STATE machine:m]))
21   if (!(self = [super initWithFrame:f type:DVT_STATE machine:m wholeLineScroll:NO]))
2222      return nil;
2323   return self;
2424}
branches/kale/src/osd/modules/debugger/osx/watchpointsview.m
r244570r244571
1717@implementation MAMEWatchpointsView
1818
1919- (id)initWithFrame:(NSRect)f machine:(running_machine &)m {
20   if (!(self = [super initWithFrame:f type:DVT_WATCH_POINTS machine:m]))
20   if (!(self = [super initWithFrame:f type:DVT_WATCH_POINTS machine:m wholeLineScroll:YES]))
2121      return nil;
2222   return self;
2323}


Previous 199869 Revisions Next


© 1997-2024 The MAME Team