Skip to content

Commit 0d8fefe

Browse files
committed
Tweaks to improve GUI
1 parent 93cefd9 commit 0d8fefe

11 files changed

Lines changed: 122 additions & 89 deletions

README

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,3 @@ To boot A/UX
3636
3) xcodebuild -project gui/Shoebill.xcodeproj # to build the Cocoa GUI
3737

3838

39-
40-
41-
42-

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
Shoebill
22
========
33

4-
a Macintosh II emulator that only runs A/UX
4+
a Macintosh II emulator that runs A/UX

gui/Shoebill/Shoebill-Info.plist

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,12 @@
1616
<string>${PRODUCT_NAME}</string>
1717
<key>CFBundlePackageType</key>
1818
<string>APPL</string>
19-
<key>CFBundleShortVersionString</key>
20-
<string>1.0</string>
19+
<key>CFBundleVersion</key>
20+
<string>0.0.1</string>
2121
<key>CFBundleSignature</key>
2222
<string>????</string>
23-
<key>CFBundleVersion</key>
24-
<string>1</string>
2523
<key>LSMinimumSystemVersion</key>
2624
<string>${MACOSX_DEPLOYMENT_TARGET}</string>
27-
<key>NSHumanReadableCopyright</key>
28-
<string>Copyright © 2014 Peter Rutenbar. All rights reserved.</string>
2925
<key>NSMainNibFile</key>
3026
<string>MainMenu</string>
3127
<key>NSPrincipalClass</key>

gui/Shoebill/en.lproj/Credits.rtf

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,13 @@
1-
{\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;}
1+
{\rtf1\ansi\ansicpg1252\cocoartf1265
2+
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
23
{\colortbl;\red255\green255\blue255;}
3-
\paperw9840\paperh8400
4-
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural
4+
\vieww9600\viewh8400\viewkind0
5+
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural
56

6-
\f0\b\fs24 \cf0 Engineering:
7+
\f0\b\fs24 \cf0 Shoebill
78
\b0 \
8-
Some people\
9+
A Macintosh II emulator that runs A/UX\
910
\
10-
11-
\b Human Interface Design:
12-
\b0 \
13-
Some other people\
14-
\
15-
16-
\b Testing:
17-
\b0 \
18-
Hopefully not nobody\
11+
{\field{\*\fldinst{HYPERLINK "https://github.com/pruten/shoebill"}}{\fldrslt https://github.com/pruten/shoebill}}\
1912
\
20-
21-
\b Documentation:
22-
\b0 \
23-
Whoever\
24-
\
25-
26-
\b With special thanks to:
27-
\b0 \
28-
Mom\
29-
}
13+
Peter Rutenbar (pruten@gmail.com)}

gui/Shoebill/shoeAppDelegate.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@
2727

2828
@interface shoeAppDelegate : NSObject <NSApplicationDelegate> {
2929

30-
@public
31-
NSWindowController *windowController;
3230
}
3331

34-
@property (assign) IBOutlet NSWindow *window;
35-
3632
@end

gui/Shoebill/shoeAppDelegate.m

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,33 @@
2828

2929
@implementation shoeAppDelegate
3030

31+
- (void)createFirstTimeUserDefaults
32+
{
33+
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
34+
uint32_t i;
35+
36+
[defaults setObject:@"" forKey:@"kernelPath"];
37+
[defaults setObject:@"" forKey:@"romPath"];
38+
[defaults setInteger:NSOffState forKey:@"verboseState"];
39+
[defaults setInteger:16 forKey:@"memorySize"];
40+
41+
[defaults setInteger:640 forKey:@"screenWidth"];
42+
[defaults setInteger:480 forKey:@"screenHeight"];
43+
44+
for (i=0; i<7; i++)
45+
[defaults setObject:@"" forKey:[NSString stringWithFormat:@"scsiPath%u", i]];
46+
47+
[defaults setBool:YES forKey:@"defaultsInitialized"];
48+
}
49+
3150
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
3251
{
33-
/*windowController = [[NSWindowController alloc] initWithWindowNibName:@"shoeScreenView"];
34-
[windowController showWindow:nil];
35-
[windowController.window makeKeyAndOrderFront:nil];*/
52+
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
53+
54+
BOOL isInitialized = [defaults boolForKey:@"defaultsInitialized"];
55+
56+
if (!isInitialized)
57+
[self createFirstTimeUserDefaults];
3658
}
3759

3860

gui/Shoebill/shoeApplication.m

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,12 @@ - (void)sendEvent:(NSEvent *)event
165165
if (type == NSFlagsChanged) {
166166
NSUInteger modifierFlags = [event modifierFlags];
167167
shoebill_key_modifier(modifierFlags >> 16);
168-
return ;
168+
169+
// Block any key-related event while the command key is down
170+
if (modifierFlags & NSCommandKeyMask)
171+
return ;
172+
173+
[super sendEvent:event];
169174
}
170175
else if (type == NSKeyDown || type == NSKeyUp) {
171176
NSString *chars = [[event charactersIgnoringModifiers] lowercaseString];
@@ -183,7 +188,12 @@ - (void)sendEvent:(NSEvent *)event
183188

184189
}
185190

186-
return ;
191+
// Block any key-related event while the command key is down
192+
if (modifierFlags & NSCommandKeyMask)
193+
return ;
194+
195+
[super sendEvent:event];
196+
187197
}
188198
}
189199

@@ -280,6 +290,9 @@ - (void) createScreenWindow:(uint8_t)slotnum
280290

281291
- (void) startEmulator
282292
{
293+
if (isRunning)
294+
return;
295+
283296
uint16_t width, height;
284297
uint32_t i;
285298

@@ -310,7 +323,6 @@ - (void) startEmulator
310323
- (IBAction)runMenuItem:(id)sender
311324
{
312325
[self startEmulator];
313-
314326
}
315327

316328

gui/Shoebill/shoePreferencesWindowController.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ - (IBAction)applyAndRunPressed:(id)sender
185185
shoeApplication *shoeApp = (shoeApplication*) NSApp;
186186
[self applyPressed:sender];
187187
[shoeApp startEmulator];
188+
[[self window] close];
188189
}
189190

190191
@end

gui/Shoebill/shoeScreenView.m

Lines changed: 30 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
*/
2525

2626
#import "shoeScreenView.h"
27+
#import "shoeScreenWindow.h"
2728
#import "shoeAppDelegate.h"
2829
#import "shoeApplication.h"
2930
#import <Foundation/Foundation.h>
@@ -198,21 +199,6 @@ - (void)drawRect:(NSRect)rect
198199
[[self openGLContext] flushBuffer];
199200
}
200201

201-
- (void) warpToCenter
202-
{
203-
// Convert the cocoa window frame to quartz global coordinates
204-
NSRect winrect = [[self window] frame];
205-
NSScreen *mainScreen = (NSScreen*)[[NSScreen screens] objectAtIndex:0];
206-
winrect.origin.y = NSMaxY([mainScreen frame]) - NSMaxY(winrect);
207-
CGRect cgwinrect = NSRectToCGRect(winrect);
208-
209-
// Find the center of the window
210-
cgwinrect.origin.x += cgwinrect.size.width / 2.0;
211-
cgwinrect.origin.y += cgwinrect.size.height / 2.0;
212-
213-
CGWarpMouseCursorPosition(cgwinrect.origin);
214-
}
215-
216202
- (void)viewDidMoveToWindow
217203
{
218204
[[self window] setAcceptsMouseMovedEvents:YES];
@@ -229,22 +215,14 @@ - (void)mouseEntered:(NSEvent *)theEvent
229215
- (void)mouseMoved:(NSEvent *)theEvent
230216
{
231217
if (shoeApp->doCaptureMouse) {
232-
assert(shoeApp->isRunning);
233-
//NSPoint point = [theEvent locationInWindow];
234-
//NSPoint point = [self convertPoint:windowPoint fromView:self];
218+
shoeScreenWindow *win = (shoeScreenWindow*)[self window];
235219

236-
/*NSRect winFrame = [[self window] frame];
237-
NSPoint winCenter;
238-
winCenter.x = winFrame.size.width / 2.0;
239-
winCenter.y = winFrame.size.height / 2.0;*/
220+
assert(shoeApp->isRunning);
240221

241-
/*int32_t delta_x = (int32_t)(point.x - winCenter.x);
242-
int32_t delta_y = -(int32_t)(point.y - winCenter.y);*/
243-
244222
int32_t delta_x, delta_y;
245223
CGGetLastMouseDelta(&delta_x, &delta_y);
246224
shoebill_mouse_move_delta(delta_x, delta_y);
247-
[self warpToCenter];
225+
[win warpToCenter];
248226
}
249227
}
250228

@@ -253,7 +231,7 @@ -(void)mouseDragged:(NSEvent *)theEvent
253231
[self mouseMoved:theEvent];
254232
}
255233

256-
- (void) say:(NSString*)str
234+
/*- (void) say:(NSString*)str
257235
{
258236
NSAlert *theAlert = [NSAlert
259237
alertWithMessageText:nil
@@ -263,21 +241,31 @@ - (void) say:(NSString*)str
263241
informativeTextWithFormat:@"%@", str
264242
];
265243
[theAlert runModal];
266-
}
244+
}*/
267245

268246
- (void)mouseDown:(NSEvent *)theEvent
269247
{
248+
270249
if (shoeApp->doCaptureMouse) {
271250
assert(shoeApp->isRunning);
272-
shoebill_mouse_click(1);
273-
274-
// Warp experiment
275-
276-
277251

278-
//[self say:[NSString stringWithFormat:@"view origin x=%f, y=%f, window origin x=%f, y=%f", rect.origin.x, rect.origin.y, winrect.origin.x, winrect.origin.y]];
252+
// ctrl - left click doesn't get reported as rightMouseDown
253+
// on Mavericks (and maybe other OS X versions?)
254+
if ([theEvent modifierFlags] & NSControlKeyMask) {
255+
shoeScreenWindow *win = (shoeScreenWindow*)[self window];
256+
[win uncaptureMouse];
257+
}
258+
else
259+
shoebill_mouse_click(1);
279260

280261
}
262+
else {
263+
shoeScreenWindow *win = (shoeScreenWindow*)[self window];
264+
if ([win isKeyWindow]) {
265+
shoeApp->doCaptureKeys = YES;
266+
[win captureMouse];
267+
}
268+
}
281269
}
282270

283271
- (void)mouseUp:(NSEvent *)theEvent
@@ -288,4 +276,12 @@ - (void)mouseUp:(NSEvent *)theEvent
288276
}
289277
}
290278

279+
- (void)rightMouseDown:(NSEvent *)theEvent
280+
{
281+
if (shoeApp->doCaptureMouse) {
282+
shoeScreenWindow *win = (shoeScreenWindow*)[self window];
283+
[win uncaptureMouse];
284+
}
285+
}
286+
291287
@end

gui/Shoebill/shoeScreenWindow.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@
3131
uint8_t slotnum;
3232
}
3333

34-
- (void)configure:(uint8_t) _slotnum;
35-
- (void)reevaluateKeyWindowness;
34+
- (void) configure:(uint8_t) _slotnum;
35+
- (void) reevaluateKeyWindowness;
36+
- (void) warpToCenter;
37+
- (void) captureMouse;
38+
- (void) uncaptureMouse;
3639
@end

0 commit comments

Comments
 (0)