mirror of
https://github.com/holub/mame
synced 2025-04-16 05:24:54 +03:00
Cocoa debugger: correctly size controls for user font selection (nw)
This commit is contained in:
parent
a1ae6f640a
commit
a443584b1f
@ -38,6 +38,7 @@
|
||||
return nil;
|
||||
history = [[MAMEDebugCommandHistory alloc] init];
|
||||
auxiliaryWindows = [[NSMutableArray alloc] init];
|
||||
NSFont *const defaultFont = [[MAMEDebugView class] defaultFontForMachine:m];
|
||||
|
||||
// create the register view
|
||||
regView = [[MAMERegistersView alloc] initWithFrame:NSMakeRect(0, 0, 100, 100) machine:*machine];
|
||||
@ -74,17 +75,19 @@
|
||||
// create the command field
|
||||
commandField = [[NSTextField alloc] initWithFrame:NSMakeRect(0, 0, 100, 19)];
|
||||
[commandField setAutoresizingMask:(NSViewWidthSizable | NSViewMaxYMargin)];
|
||||
[commandField setFont:[[MAMEDebugView class] defaultFontForMachine:m]];
|
||||
[commandField setFont:defaultFont];
|
||||
[commandField setFocusRingType:NSFocusRingTypeNone];
|
||||
[commandField setTarget:self];
|
||||
[commandField setAction:@selector(doCommand:)];
|
||||
[commandField setDelegate:self];
|
||||
[commandField sizeToFit];
|
||||
rct = [commandField frame];
|
||||
[commandField setFrame:NSMakeRect(rct.size.height, 0, rct.size.width - rct.size.height, rct.size.height)];
|
||||
[commandField setFrame:NSMakeRect(rct.size.height, 0, 100 - rct.size.height, rct.size.height)];
|
||||
|
||||
// create the action pull-down button
|
||||
actionButton = [[self class] newActionButtonWithFrame:NSMakeRect(0, 0, rct.size.height, rct.size.height)];
|
||||
[actionButton setAutoresizingMask:(NSViewMaxXMargin | NSViewMaxYMargin)];
|
||||
[actionButton setFont:[NSFont systemFontOfSize:[defaultFont pointSize]]];
|
||||
[dasmView insertActionItemsInMenu:[actionButton menu] atIndex:1];
|
||||
|
||||
// create the container for the console and command input field
|
||||
|
@ -38,9 +38,7 @@
|
||||
[expressionField setTarget:self];
|
||||
[expressionField setAction:@selector(doExpression:)];
|
||||
[expressionField setDelegate:self];
|
||||
expressionFrame = [expressionField frame];
|
||||
expressionFrame.size.width = (contentBounds.size.width - expressionFrame.size.height) / 2;
|
||||
[expressionField setFrameSize:expressionFrame.size];
|
||||
[expressionField sizeToFit];
|
||||
|
||||
// create the subview popup
|
||||
subviewButton = [[NSPopUpButton alloc] initWithFrame:NSOffsetRect(expressionFrame,
|
||||
@ -53,6 +51,16 @@
|
||||
[subviewButton setTarget:self];
|
||||
[subviewButton setAction:@selector(changeSubview:)];
|
||||
[[subviewButton cell] setArrowPosition:NSPopUpArrowAtBottom];
|
||||
[subviewButton sizeToFit];
|
||||
|
||||
// adjust sizes to make it fit nicely
|
||||
expressionFrame = [expressionField frame];
|
||||
expressionFrame.size.height = MAX(expressionFrame.size.height, [subviewButton frame].size.height);
|
||||
expressionFrame.size.width = (contentBounds.size.width - expressionFrame.size.height) / 2;
|
||||
[expressionField setFrame:expressionFrame];
|
||||
expressionFrame.origin.x = expressionFrame.size.width;
|
||||
expressionFrame.size.width = contentBounds.size.width - expressionFrame.size.height - expressionFrame.origin.x;
|
||||
[subviewButton setFrame:expressionFrame];
|
||||
|
||||
// create a container for the expression field and subview popup
|
||||
expressionFrame = NSMakeRect(expressionFrame.size.height,
|
||||
@ -91,6 +99,7 @@
|
||||
expressionFrame.size.height,
|
||||
expressionFrame.size.height)];
|
||||
[actionButton setAutoresizingMask:(NSViewMaxXMargin | NSViewMinYMargin)];
|
||||
[actionButton setFont:[NSFont systemFontOfSize:[defaultFont pointSize]]];
|
||||
[dasmView insertActionItemsInMenu:[actionButton menu] atIndex:1];
|
||||
[[window contentView] addSubview:actionButton];
|
||||
[actionButton release];
|
||||
|
@ -37,14 +37,10 @@
|
||||
[expressionField setTarget:self];
|
||||
[expressionField setAction:@selector(doExpression:)];
|
||||
[expressionField setDelegate:self];
|
||||
expressionFrame = [expressionField frame];
|
||||
expressionFrame.size.width = (contentBounds.size.width - expressionFrame.size.height) / 2;
|
||||
[expressionField setFrameSize:expressionFrame.size];
|
||||
[expressionField sizeToFit];
|
||||
|
||||
// create the subview popup
|
||||
subviewButton = [[NSPopUpButton alloc] initWithFrame:NSOffsetRect(expressionFrame,
|
||||
expressionFrame.size.width,
|
||||
0)];
|
||||
subviewButton = [[NSPopUpButton alloc] initWithFrame:NSMakeRect(0, 0, 100, 19)];
|
||||
[subviewButton setAutoresizingMask:(NSViewWidthSizable | NSViewMinXMargin | NSViewMinYMargin)];
|
||||
[subviewButton setBezelStyle:NSShadowlessSquareBezelStyle];
|
||||
[subviewButton setFocusRingType:NSFocusRingTypeNone];
|
||||
@ -52,6 +48,16 @@
|
||||
[subviewButton setTarget:self];
|
||||
[subviewButton setAction:@selector(changeSubview:)];
|
||||
[[subviewButton cell] setArrowPosition:NSPopUpArrowAtBottom];
|
||||
[subviewButton sizeToFit];
|
||||
|
||||
// adjust sizes to make it fit nicely
|
||||
expressionFrame = [expressionField frame];
|
||||
expressionFrame.size.height = MAX(expressionFrame.size.height, [subviewButton frame].size.height);
|
||||
expressionFrame.size.width = (contentBounds.size.width - expressionFrame.size.height) / 2;
|
||||
[expressionField setFrame:expressionFrame];
|
||||
expressionFrame.origin.x = expressionFrame.size.width;
|
||||
expressionFrame.size.width = contentBounds.size.width - expressionFrame.size.height - expressionFrame.origin.x;
|
||||
[subviewButton setFrame:expressionFrame];
|
||||
|
||||
// create a container for the expression field and subview popup
|
||||
expressionFrame = NSMakeRect(expressionFrame.size.height,
|
||||
@ -91,6 +97,7 @@
|
||||
expressionFrame.size.height,
|
||||
expressionFrame.size.height)];
|
||||
[actionButton setAutoresizingMask:(NSViewMaxXMargin | NSViewMinYMargin)];
|
||||
[actionButton setFont:[NSFont systemFontOfSize:[defaultFont pointSize]]];
|
||||
[memoryView insertActionItemsInMenu:[actionButton menu] atIndex:1];
|
||||
[[window contentView] addSubview:actionButton];
|
||||
[actionButton release];
|
||||
|
@ -19,21 +19,19 @@
|
||||
NSScrollView *breakScroll, *watchScroll;
|
||||
NSTabViewItem *breakTab, *watchTab;
|
||||
NSPopUpButton *actionButton, *subviewButton;
|
||||
NSRect contentBounds;
|
||||
NSRect subviewFrame;
|
||||
|
||||
if (!(self = [super initWithMachine:m title:@"(Break|Watch)points" console:c]))
|
||||
return nil;
|
||||
contentBounds = [[window contentView] bounds];
|
||||
NSRect const contentBounds = [[window contentView] bounds];
|
||||
NSFont *const defaultFont = [[MAMEDebugView class] defaultFontForMachine:m];
|
||||
|
||||
// create the subview popup
|
||||
subviewButton = [[NSPopUpButton alloc] initWithFrame:NSMakeRect(19,
|
||||
contentBounds.size.height - 19,
|
||||
contentBounds.size.width - 19,
|
||||
19)];
|
||||
subviewButton = [[NSPopUpButton alloc] initWithFrame:NSMakeRect(0, 0, 100, 19)];
|
||||
[subviewButton setAutoresizingMask:(NSViewWidthSizable | NSViewMinYMargin)];
|
||||
[subviewButton setBezelStyle:NSShadowlessSquareBezelStyle];
|
||||
[subviewButton setFocusRingType:NSFocusRingTypeNone];
|
||||
[subviewButton setFont:[[MAMEDebugView class] defaultFontForMachine:m]];
|
||||
[subviewButton setFont:defaultFont];
|
||||
[subviewButton setTarget:self];
|
||||
[subviewButton setAction:@selector(changeSubview:)];
|
||||
[[subviewButton cell] setArrowPosition:NSPopUpArrowAtBottom];
|
||||
@ -43,15 +41,22 @@
|
||||
[[[subviewButton menu] addItemWithTitle:@"All Watchpoints"
|
||||
action:NULL
|
||||
keyEquivalent:@""] setTag:1];
|
||||
[subviewButton sizeToFit];
|
||||
subviewFrame = [subviewButton frame];
|
||||
subviewFrame.origin.x = subviewFrame.size.height;
|
||||
subviewFrame.origin.y = contentBounds.size.height - subviewFrame.size.height;
|
||||
subviewFrame.size.width = contentBounds.size.width - subviewFrame.size.height;
|
||||
[subviewButton setFrame:subviewFrame];
|
||||
[[window contentView] addSubview:subviewButton];
|
||||
[subviewButton release];
|
||||
|
||||
// create the action popup
|
||||
actionButton = [[self class] newActionButtonWithFrame:NSMakeRect(0,
|
||||
contentBounds.size.height - 19,
|
||||
19,
|
||||
19)];
|
||||
subviewFrame.origin.y,
|
||||
subviewFrame.size.height,
|
||||
subviewFrame.size.height)];
|
||||
[actionButton setAutoresizingMask:(NSViewMaxXMargin | NSViewMinYMargin)];
|
||||
[actionButton setFont:[NSFont systemFontOfSize:[defaultFont pointSize]]];
|
||||
[[window contentView] addSubview:actionButton];
|
||||
[actionButton release];
|
||||
|
||||
@ -61,7 +66,7 @@
|
||||
breakScroll = [[NSScrollView alloc] initWithFrame:NSMakeRect(0,
|
||||
0,
|
||||
contentBounds.size.width,
|
||||
contentBounds.size.height - 19)];
|
||||
contentBounds.size.height - subviewFrame.size.height)];
|
||||
[breakScroll setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)];
|
||||
[breakScroll setHasHorizontalScroller:YES];
|
||||
[breakScroll setHasVerticalScroller:YES];
|
||||
@ -76,10 +81,7 @@
|
||||
// create the breakpoints view
|
||||
watchView = [[MAMEWatchpointsView alloc] initWithFrame:NSMakeRect(0, 0, 100, 100)
|
||||
machine:*machine];
|
||||
watchScroll = [[NSScrollView alloc] initWithFrame:NSMakeRect(0,
|
||||
0,
|
||||
contentBounds.size.width,
|
||||
contentBounds.size.height - 19)];
|
||||
watchScroll = [[NSScrollView alloc] initWithFrame:[breakScroll frame]];
|
||||
[watchScroll setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)];
|
||||
[watchScroll setHasHorizontalScroller:YES];
|
||||
[watchScroll setHasVerticalScroller:YES];
|
||||
@ -92,10 +94,7 @@
|
||||
[watchScroll release];
|
||||
|
||||
// create a tabless tabview for the two subviews
|
||||
tabs = [[NSTabView alloc] initWithFrame:NSMakeRect(0,
|
||||
0,
|
||||
contentBounds.size.width,
|
||||
contentBounds.size.height - 19)];
|
||||
tabs = [[NSTabView alloc] initWithFrame:[breakScroll frame]];
|
||||
[tabs setTabViewType:NSNoTabsNoBorder];
|
||||
[tabs setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)];
|
||||
[tabs addTabViewItem:breakTab];
|
||||
|
Loading…
Reference in New Issue
Block a user