Previous 199869 Revisions Next

r35027 Saturday 14th February, 2015 at 11:51:10 UTC by Vasantha Crabb
More functionality, including (break|watch)points view
[src/osd/modules/debugger/osx]debugosxbreakpointsview.h* debugosxbreakpointsview.m* debugosxdebugconsole.h debugosxdebugconsole.m debugosxdebugview.m debugosxdebugwindowhandler.h debugosxdebugwindowhandler.m debugosxmemoryview.h debugosxmemoryview.m debugosxmemoryviewer.m debugosxpointsviewer.h* debugosxpointsviewer.m* debugosxwatchpointsview.h* debugosxwatchpointsview.m*
[src/osd/sdl]sdl.mak

trunk/src/osd/modules/debugger/osx/debugosxbreakpointsview.h
r0r243539
1// license:BSD-3-Clause
2// copyright-holders:Vas Crabb
3//============================================================
4//
5//  debugosxbreakpointsview.h - MacOS X Cocoa debug window handling
6//
7//  Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team.
8//  Visit http://mamedev.org for licensing and usage restrictions.
9//
10//============================================================
11
12#import "debugosx.h"
13#import "debugosxdebugview.h"
14
15#include "emu.h"
16
17#import <Cocoa/Cocoa.h>
18
19
20@interface MAMEBreakpointsView : MAMEDebugView
21{
22}
23
24- (id)initWithFrame:(NSRect)f machine:(running_machine &)m;
25
26@end
trunk/src/osd/modules/debugger/osx/debugosxbreakpointsview.m
r0r243539
1// license:BSD-3-Clause
2// copyright-holders:Vas Crabb
3//============================================================
4//
5//  debugosxbreakpointsview.m - MacOS X Cocoa debug window handling
6//
7//  Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team.
8//  Visit http://mamedev.org for licensing and usage restrictions.
9//
10//============================================================
11
12#import "debugosxbreakpointsview.h"
13
14#include "debug/debugvw.h"
15
16
17@implementation MAMEBreakpointsView
18
19- (id)initWithFrame:(NSRect)f machine:(running_machine &)m {
20   if (!(self = [super initWithFrame:f type:DVT_BREAK_POINTS machine:m]))
21      return nil;
22   return self;
23}
24
25
26- (void)dealloc {
27   [super dealloc];
28}
29
30@end
trunk/src/osd/modules/debugger/osx/debugosxdebugconsole.h
r243538r243539
3939- (IBAction)debugNewMemoryWindow:(id)sender;
4040- (IBAction)debugNewDisassemblyWindow:(id)sender;
4141- (IBAction)debugNewErrorLogWindow:(id)sender;
42- (IBAction)debugNewPointsWindow:(id)sender;
4243
4344- (void)showDebugger:(NSNotification *)notification;
4445- (void)auxiliaryWindowWillClose:(NSNotification *)notification;
trunk/src/osd/modules/debugger/osx/debugosxdebugconsole.m
r243538r243539
1818#import "debugosxdisassemblyviewer.h"
1919#import "debugosxerrorlogviewer.h"
2020#import "debugosxmemoryviewer.h"
21#import "debugosxpointsviewer.h"
2122#import "debugosxregistersview.h"
2223
2324#include "debug/debugcon.h"
r243538r243539
252253}
253254
254255
256- (IBAction)debugNewPointsWindow:(id)sender{
257   MAMEPointsViewer *win = [[MAMEPointsViewer alloc] initWithMachine:*machine console:self];
258   [auxiliaryWindows addObject:win];
259   [win release];
260   [win activate];
261}
262
263
255264- (void)showDebugger:(NSNotification *)notification {
256265   device_t *device = (device_t * )[[[notification userInfo] objectForKey:@"MAMEDebugDevice"] pointerValue];
257266   if (&device->machine() == machine) {
trunk/src/osd/modules/debugger/osx/debugosxdebugview.m
r243538r243539
187187   }
188188   totalWidth = totalHeight = 0;
189189   originLeft = originTop = 0;
190   [self setFont:[[self class] defaultFont]];
190
191191   text = [[NSTextStorage alloc] init];
192192   textContainer = [[NSTextContainer alloc] init];
193193   layoutManager = [[NSLayoutManager alloc] init];
194194   [layoutManager addTextContainer:textContainer];
195   [textContainer release];
195196   [text addLayoutManager:layoutManager];
197   [layoutManager release];
198
199   [self setFont:[[self class] defaultFont]];
200
196201   return self;
197202}
198203
r243538r243539
201206   [[NSNotificationCenter defaultCenter] removeObserver:self];
202207   if (font != nil) [font release];
203208   if (text != nil) [text release];
204   if (textContainer != nil) [textContainer release];
205   if (layoutManager != nil) [layoutManager release];
206209   [super dealloc];
207210}
208211
trunk/src/osd/modules/debugger/osx/debugosxdebugwindowhandler.h
r243538r243539
7171- (IBAction)debugNewMemoryWindow:(id)sender;
7272- (IBAction)debugNewDisassemblyWindow:(id)sender;
7373- (IBAction)debugNewErrorLogWindow:(id)sender;
74- (IBAction)debugNewPointsWindow:(id)sender;
7475
7576- (void)windowWillClose:(NSNotification *)notification;
7677
trunk/src/osd/modules/debugger/osx/debugosxdebugwindowhandler.m
r243538r243539
105105      [newMenu addItemWithTitle:@"Error Log Window"
106106                     action:@selector(debugNewErrorLogWindow:)
107107               keyEquivalent:@"l"];
108      [newMenu addItemWithTitle:@"(Break|Watch)points Window"
109                     action:@selector(debugNewPointsWindow:)
110               keyEquivalent:@"b"];
108111   }
109112   [menu addItem:[NSMenuItem separatorItem]];
110113   [menu addItemWithTitle:@"Close Window" action:@selector(performClose:) keyEquivalent:@"w"];
r243538r243539
287290}
288291
289292
293- (IBAction)debugNewPointsWindow:(id)sender {
294   [console debugNewPointsWindow:sender];
295}
296
297
290298- (void)windowWillClose:(NSNotification *)notification {
291299   [[NSNotificationCenter defaultCenter] postNotificationName:MAMEAuxiliaryDebugWindowWillCloseNotification
292300                                          object:self];
trunk/src/osd/modules/debugger/osx/debugosxmemoryview.h
r243538r243539
3737- (IBAction)showPhysicalAddresses:(id)sender;
3838- (IBAction)showReverseView:(id)sender;
3939- (IBAction)showReverseViewToggle:(id)sender;
40- (IBAction)changeBytesPerLine:(id)sender;
4041
4142- (void)insertActionItemsInMenu:(NSMenu *)menu atIndex:(NSInteger)index;
4243- (void)insertSubviewItemsInMenu:(NSMenu *)menu atIndex:(NSInteger)index;
trunk/src/osd/modules/debugger/osx/debugosxmemoryview.m
r243538r243539
148148}
149149
150150
151- (IBAction)changeBytesPerLine:(id)sender {
152   debug_view_memory *const memView = downcast<debug_view_memory *>(view);
153   memView->set_chunks_per_row(memView->chunks_per_row() + [sender tag]);
154}
155
156
151157- (void)insertActionItemsInMenu:(NSMenu *)menu atIndex:(NSInteger)index {
152   {
153      NSInteger tag;
154      for (tag = 1; tag <= 8; tag <<= 1) {
155         NSString   *title = [NSString stringWithFormat:@"%ld-byte Chunks", (long)tag];
156         NSMenuItem   *chunkItem = [menu insertItemWithTitle:title
157                                          action:@selector(showChunkSize:)
158                                     keyEquivalent:[NSString stringWithFormat:@"%ld", (long)tag]
159                                          atIndex:index++];
160         [chunkItem setTarget:self];
161         [chunkItem setTag:tag];
162      }
158   NSInteger tag;
159   for (tag = 1; tag <= 8; tag <<= 1) {
160      NSString   *title = [NSString stringWithFormat:@"%ld-byte Chunks", (long)tag];
161      NSMenuItem   *chunkItem = [menu insertItemWithTitle:title
162                                       action:@selector(showChunkSize:)
163                                  keyEquivalent:[NSString stringWithFormat:@"%ld", (long)tag]
164                                       atIndex:index++];
165      [chunkItem setTarget:self];
166      [chunkItem setTag:tag];
163167   }
168
164169   [menu insertItem:[NSMenuItem separatorItem] atIndex:index++];
165   {
166      NSMenuItem *logicalItem = [menu insertItemWithTitle:@"Logical Addresses"
167                                        action:@selector(showPhysicalAddresses:)
168                                   keyEquivalent:@"v"
169                                       atIndex:index++];
170      [logicalItem setTarget:self];
171      [logicalItem setTag:FALSE];
172   }
173   {
174      NSMenuItem *physicalItem = [menu insertItemWithTitle:@"Physical Addresses"
175                                         action:@selector(showPhysicalAddresses:)
176                                    keyEquivalent:@"y"
177                                        atIndex:index++];
178      [physicalItem setTarget:self];
179      [physicalItem setTag:TRUE];
180   }
170
171   NSMenuItem *logicalItem = [menu insertItemWithTitle:@"Logical Addresses"
172                                     action:@selector(showPhysicalAddresses:)
173                                keyEquivalent:@"v"
174                                    atIndex:index++];
175   [logicalItem setTarget:self];
176   [logicalItem setTag:FALSE];
177
178   NSMenuItem *physicalItem = [menu insertItemWithTitle:@"Physical Addresses"
179                                      action:@selector(showPhysicalAddresses:)
180                                 keyEquivalent:@"y"
181                                     atIndex:index++];
182   [physicalItem setTarget:self];
183   [physicalItem setTag:TRUE];
184
181185   [menu insertItem:[NSMenuItem separatorItem] atIndex:index++];
182   {
183      NSMenuItem *reverseItem = [menu insertItemWithTitle:@"Reverse View"
184                                        action:@selector(showReverseViewToggle:)
185                                   keyEquivalent:@"r"
186                                       atIndex:index++];
187      [reverseItem setTarget:self];
188   }
186
187   NSMenuItem *reverseItem = [menu insertItemWithTitle:@"Reverse View"
188                                     action:@selector(showReverseViewToggle:)
189                                keyEquivalent:@"r"
190                                    atIndex:index++];
191   [reverseItem setTarget:self];
192
193   [menu insertItem:[NSMenuItem separatorItem] atIndex:index++];
194
195   NSMenuItem *increaseItem = [menu insertItemWithTitle:@"Increase Bytes Per Line"
196                                      action:@selector(changeBytesPerLine:)
197                                 keyEquivalent:@"p"
198                                     atIndex:index++];
199   [increaseItem setTarget:self];
200   [increaseItem setTag:1];
201
202   NSMenuItem *decreaseItem = [menu insertItemWithTitle:@"Decrease Bytes Per Line"
203                                      action:@selector(changeBytesPerLine:)
204                                 keyEquivalent:@"o"
205                                     atIndex:index++];
206   [decreaseItem setTarget:self];
207   [decreaseItem setTag:-1];
208
189209   if (index < [menu numberOfItems])
190210      [menu insertItem:[NSMenuItem separatorItem] atIndex:index++];
191211}
trunk/src/osd/modules/debugger/osx/debugosxmemoryviewer.m
r243538r243539
106106   [window setTitle:[NSString stringWithFormat:@"Memory: %@", [memoryView selectedSubviewName]]];
107107
108108   // calculate the optimal size for everything
109   {
110      NSSize   desired = [NSScrollView frameSizeForContentSize:[memoryView maximumFrameSize]
111                                hasHorizontalScroller:YES
112                                 hasVerticalScroller:YES
113                                        borderType:[memoryScroll borderType]];
114      [self cascadeWindowWithDesiredSize:desired forView:memoryScroll];
115   }
109   NSSize const desired = [NSScrollView frameSizeForContentSize:[memoryView maximumFrameSize]
110                                 hasHorizontalScroller:YES
111                                  hasVerticalScroller:YES
112                                         borderType:[memoryScroll borderType]];
113   [self cascadeWindowWithDesiredSize:desired forView:memoryScroll];
116114
117115   // don't forget the result
118116   return self;
trunk/src/osd/modules/debugger/osx/debugosxpointsviewer.h
r0r243539
1// license:BSD-3-Clause
2// copyright-holders:Vas Crabb
3//============================================================
4//
5//  debugosxpointsviewer.h - MacOS X Cocoa debug window handling
6//
7//  Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team.
8//  Visit http://mamedev.org for licensing and usage restrictions.
9//
10//============================================================
11
12#import "debugosx.h"
13#import "debugosxdebugwindowhandler.h"
14
15#include "emu.h"
16
17#import <Cocoa/Cocoa.h>
18
19
20@class MAMEDebugConsole;
21
22@interface MAMEPointsViewer : MAMEAuxiliaryDebugWindowHandler
23{
24   NSTabView   *tabs;
25}
26
27- (id)initWithMachine:(running_machine &)m console:(MAMEDebugConsole *)c;
28
29- (IBAction)changeSubview:(id)sender;
30
31@end
trunk/src/osd/modules/debugger/osx/debugosxpointsviewer.m
r0r243539
1// license:BSD-3-Clause
2// copyright-holders:Vas Crabb
3//============================================================
4//
5//  debugosxpointsviewer.m - MacOS X Cocoa debug window handling
6//
7//  Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team.
8//  Visit http://mamedev.org for licensing and usage restrictions.
9//
10//============================================================
11
12#import "debugosxpointsviewer.h"
13
14#import "debugosxbreakpointsview.h"
15#import "debugosxwatchpointsview.h"
16
17
18@implementation MAMEPointsViewer
19
20- (id)initWithMachine:(running_machine &)m console:(MAMEDebugConsole *)c {
21   MAMEDebugView   *breakView, *watchView;
22   NSScrollView   *breakScroll, *watchScroll;
23   NSTabViewItem   *breakTab, *watchTab;
24   NSPopUpButton   *actionButton, *subviewButton;
25   NSRect         contentBounds;
26
27   if (!(self = [super initWithMachine:m title:@"(Break|Watch)points" console:c]))
28      return nil;
29   contentBounds = [[window contentView] bounds];
30
31   // create the subview popup
32   subviewButton = [[NSPopUpButton alloc] initWithFrame:NSMakeRect(19,
33                                                   contentBounds.size.height - 19,
34                                                   contentBounds.size.width - 19,
35                                                   19)];
36   [subviewButton setAutoresizingMask:(NSViewWidthSizable | NSViewMinYMargin)];
37   [subviewButton setBezelStyle:NSShadowlessSquareBezelStyle];
38   [subviewButton setFocusRingType:NSFocusRingTypeNone];
39   [subviewButton setFont:[[MAMEDebugView class] defaultFont]];
40   [subviewButton setTarget:self];
41   [subviewButton setAction:@selector(changeSubview:)];
42   [[subviewButton cell] setArrowPosition:NSPopUpArrowAtBottom];
43   [[[subviewButton menu] addItemWithTitle:@"All Breakpoints"
44                            action:NULL
45                       keyEquivalent:@""] setTag:0];
46   [[[subviewButton menu] addItemWithTitle:@"All Watchpoints"
47                            action:NULL
48                       keyEquivalent:@""] setTag:1];
49   [[window contentView] addSubview:subviewButton];
50   [subviewButton release];
51
52   // create the action popup
53   actionButton = [[self class] newActionButtonWithFrame:NSMakeRect(0,
54                                                    contentBounds.size.height - 19,
55                                                    19,
56                                                    19)];
57   [actionButton setAutoresizingMask:(NSViewMaxXMargin | NSViewMinYMargin)];
58   [[window contentView] addSubview:actionButton];
59   [actionButton release];
60
61   // create the breakpoints view
62   breakView = [[MAMEBreakpointsView alloc] initWithFrame:NSMakeRect(0, 0, 100, 100)
63                                       machine:*machine];
64   breakScroll = [[NSScrollView alloc] initWithFrame:NSMakeRect(0,
65                                                 0,
66                                                 contentBounds.size.width,
67                                                 contentBounds.size.height - 19)];
68   [breakScroll setDrawsBackground:YES];
69   [breakScroll setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)];
70   [breakScroll setHasHorizontalScroller:YES];
71   [breakScroll setHasVerticalScroller:YES];
72   [breakScroll setAutohidesScrollers:YES];
73   [breakScroll setBorderType:NSNoBorder];
74   [breakScroll setDocumentView:breakView];
75   [breakView release];
76   breakTab = [[NSTabViewItem alloc] initWithIdentifier:nil];
77   [breakTab setView:breakScroll];
78   [breakScroll release];
79
80   // create the breakpoints view
81   watchView = [[MAMEWatchpointsView alloc] initWithFrame:NSMakeRect(0, 0, 100, 100)
82                                       machine:*machine];
83   watchScroll = [[NSScrollView alloc] initWithFrame:NSMakeRect(0,
84                                                 0,
85                                                 contentBounds.size.width,
86                                                 contentBounds.size.height - 19)];
87   [watchScroll setDrawsBackground:YES];
88   [watchScroll setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)];
89   [watchScroll setHasHorizontalScroller:YES];
90   [watchScroll setHasVerticalScroller:YES];
91   [watchScroll setAutohidesScrollers:YES];
92   [watchScroll setBorderType:NSNoBorder];
93   [watchScroll setDocumentView:watchView];
94   [watchView release];
95   watchTab = [[NSTabViewItem alloc] initWithIdentifier:nil];
96   [watchTab setView:watchScroll];
97   [watchScroll release];
98
99   // create a tabless tabview for the two subviews
100   tabs = [[NSTabView alloc] initWithFrame:NSMakeRect(0,
101                                          0,
102                                          contentBounds.size.width,
103                                          contentBounds.size.height - 19)];
104   [tabs setTabViewType:NSNoTabsNoBorder];
105   [tabs setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)];
106   [tabs addTabViewItem:breakTab];
107   [breakTab release];
108   [tabs addTabViewItem:watchTab];
109   [watchTab release];
110   [[window contentView] addSubview:tabs];
111   [tabs release];
112
113   // set default state
114   [subviewButton selectItemAtIndex:0];
115   [tabs selectFirstTabViewItem:self];
116   [window makeFirstResponder:subviewButton];
117   [window setTitle:[[subviewButton selectedItem] title]];
118
119   // calculate the optimal size for everything
120   NSSize const breakDesired = [NSScrollView frameSizeForContentSize:[breakView maximumFrameSize]
121                                    hasHorizontalScroller:YES
122                                      hasVerticalScroller:YES
123                                             borderType:[breakScroll borderType]];
124   NSSize const watchDesired = [NSScrollView frameSizeForContentSize:[watchView maximumFrameSize]
125                                    hasHorizontalScroller:YES
126                                      hasVerticalScroller:YES
127                                             borderType:[watchScroll borderType]];
128   NSSize const desired = NSMakeSize(MAX(breakDesired.width, watchDesired.width),
129                             MAX(breakDesired.height, watchDesired.height));
130   [self cascadeWindowWithDesiredSize:desired forView:tabs];
131
132   // don't forget the result
133   return self;
134}
135
136
137- (void)dealloc {
138   [super dealloc];
139}
140
141
142- (IBAction)changeSubview:(id)sender {
143   [tabs selectTabViewItemAtIndex:[[sender selectedItem] tag]];
144   [window setTitle:[[sender selectedItem] title]];
145}
146
147@end
trunk/src/osd/modules/debugger/osx/debugosxwatchpointsview.h
r0r243539
1// license:BSD-3-Clause
2// copyright-holders:Vas Crabb
3//============================================================
4//
5//  debugosxwatchpointsview.h - MacOS X Cocoa debug window handling
6//
7//  Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team.
8//  Visit http://mamedev.org for licensing and usage restrictions.
9//
10//============================================================
11
12#import "debugosx.h"
13#import "debugosxdebugview.h"
14
15#include "emu.h"
16
17#import <Cocoa/Cocoa.h>
18
19
20@interface MAMEWatchpointsView : MAMEDebugView
21{
22}
23
24- (id)initWithFrame:(NSRect)f machine:(running_machine &)m;
25
26@end
trunk/src/osd/modules/debugger/osx/debugosxwatchpointsview.m
r0r243539
1// license:BSD-3-Clause
2// copyright-holders:Vas Crabb
3//============================================================
4//
5//  debugosxwatchpointsview.m - MacOS X Cocoa debug window handling
6//
7//  Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team.
8//  Visit http://mamedev.org for licensing and usage restrictions.
9//
10//============================================================
11
12#import "debugosxwatchpointsview.h"
13
14#include "debug/debugvw.h"
15
16
17@implementation MAMEWatchpointsView
18
19- (id)initWithFrame:(NSRect)f machine:(running_machine &)m {
20   if (!(self = [super initWithFrame:f type:DVT_WATCH_POINTS machine:m]))
21      return nil;
22   return self;
23}
24
25
26- (void)dealloc {
27   [super dealloc];
28}
29
30@end
trunk/src/osd/sdl/sdl.mak
r243538r243539
289289
290290DEBUGOBJS = \
291291   $(OSDOBJ)/modules/debugger/debugosx.o \
292   $(OSDOBJ)/modules/debugger/osx/debugosxbreakpointsview.o \
292293   $(OSDOBJ)/modules/debugger/osx/debugosxconsoleview.o \
293294   $(OSDOBJ)/modules/debugger/osx/debugosxdebugcommandhistory.o \
294295   $(OSDOBJ)/modules/debugger/osx/debugosxdebugconsole.o \
r243538r243539
300301   $(OSDOBJ)/modules/debugger/osx/debugosxerrorlogviewer.o \
301302   $(OSDOBJ)/modules/debugger/osx/debugosxmemoryview.o \
302303   $(OSDOBJ)/modules/debugger/osx/debugosxmemoryviewer.o \
303   $(OSDOBJ)/modules/debugger/osx/debugosxregistersview.o
304   $(OSDOBJ)/modules/debugger/osx/debugosxpointsviewer.o \
305   $(OSDOBJ)/modules/debugger/osx/debugosxregistersview.o \
306   $(OSDOBJ)/modules/debugger/osx/debugosxwatchpointsview.o
304307
305308endif
306309


Previous 199869 Revisions Next


© 1997-2024 The MAME Team