summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd/modules/debugger/osx/errorlogviewer.m
diff options
context:
space:
mode:
Diffstat (limited to 'src/osd/modules/debugger/osx/errorlogviewer.m')
-rw-r--r--src/osd/modules/debugger/osx/errorlogviewer.m64
1 files changed, 64 insertions, 0 deletions
diff --git a/src/osd/modules/debugger/osx/errorlogviewer.m b/src/osd/modules/debugger/osx/errorlogviewer.m
new file mode 100644
index 00000000000..44189922f91
--- /dev/null
+++ b/src/osd/modules/debugger/osx/errorlogviewer.m
@@ -0,0 +1,64 @@
+// license:BSD-3-Clause
+// copyright-holders:Vas Crabb
+//============================================================
+//
+// debugosxerrorlogviewer.m - MacOS X Cocoa debug window handling
+//
+// Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team.
+// Visit http://mamedev.org for licensing and usage restrictions.
+//
+//============================================================
+
+#import "errorlogviewer.h"
+
+#import "errorlogview.h"
+
+
+@implementation MAMEErrorLogViewer
+
+- (id)initWithMachine:(running_machine &)m console:(MAMEDebugConsole *)c {
+ NSScrollView *logScroll;
+ NSString *title;
+
+ title = [NSString stringWithFormat:@"Error Log: %@ [%@]",
+ [NSString stringWithUTF8String:m.system().description],
+ [NSString stringWithUTF8String:m.system().name]];
+ if (!(self = [super initWithMachine:m title:title console:c]))
+ return nil;
+
+ // create the error log view
+ logView = [[MAMEErrorLogView alloc] initWithFrame:NSMakeRect(0, 0, 100, 100) machine:*machine];
+ logScroll = [[NSScrollView alloc] initWithFrame:NSMakeRect(0, 0, 100, 100)];
+ [logScroll setDrawsBackground:YES];
+ [logScroll setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)];
+ [logScroll setHasHorizontalScroller:YES];
+ [logScroll setHasVerticalScroller:YES];
+ [logScroll setAutohidesScrollers:YES];
+ [logScroll setBorderType:NSNoBorder];
+ [logScroll setDocumentView:logView];
+ [logView release];
+ [window setContentView:logScroll];
+ [logScroll release];
+
+ // calculate the optimal size for everything
+ {
+ NSSize desired = [NSScrollView frameSizeForContentSize:[logView maximumFrameSize]
+ hasHorizontalScroller:YES
+ hasVerticalScroller:YES
+ borderType:[logScroll borderType]];
+
+ // this thing starts with no content, so its prefered height may be very small
+ desired.height = MAX(desired.height, 240);
+ [self cascadeWindowWithDesiredSize:desired forView:logScroll];
+ }
+
+ // don't forget the result
+ return self;
+}
+
+
+- (void)dealloc {
+ [super dealloc];
+}
+
+@end