ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/MacOSX/EmulatorView.mm
(Generate patch)

Comparing BasiliskII/src/MacOSX/EmulatorView.mm (file contents):
Revision 1.9 by nigel, 2003-03-21T06:41:04Z vs.
Revision 1.16 by gbeauche, 2008-01-01T09:40:32Z

# Line 3 | Line 3
3   *
4   *      $Id$
5   *
6 < *  Basilisk II (C) 1997-2003 Christian Bauer
6 > *  Basilisk II (C) 1997-2008 Christian Bauer
7   *
8   *  This program is free software; you can redistribute it and/or modify
9   *  it under the terms of the GNU General Public License as published by
# Line 232 | Line 232 | static int prevFlags;
232  
233      if ( ! b )
234          {
235 <                ErrorAlert("Could not allocate an NSBitmapImageRep for the TIFF");
235 >                ErrorAlert("Could not allocate an NSBitmapImageRep for the TIFF\nTry setting the emulation to millions of colours?");
236                  return nil;
237          }
238  
# Line 378 | Line 378 | static NSPoint mouse;                  // Previous/curr
378  
379   - (BOOL) processMouseMove: (NSEvent *) event
380   {
381 <        NSPoint location;
381 >        if ( ! drawView )
382 >        {
383 >                D(NSLog(@"Unable to process event - Emulator has not started yet"));
384 >                return NO;
385 >        }
386  
387          if ( fullScreen )
388          {
# Line 386 | Line 390 | static NSPoint mouse;                  // Previous/curr
390                  return YES;
391          }
392  
393 <        location = [self convertPoint: [event locationInWindow] fromView:nil];
393 >        NSPoint location = [self convertPoint: [event locationInWindow] fromView:nil];
394  
395          D(NSLog (@"%s - loc.x=%f, loc.y=%f",
396                                  __PRETTY_FUNCTION__, location.x, location.y));
# Line 396 | Line 400 | static NSPoint mouse;                  // Previous/curr
400  
401          mouse = location;
402  
403 < #ifdef CAN_RESIZE_VIEW
404 <        int     mouseY = y - y * mouse.y / [self height];
405 <        int     mouseX =         x * mouse.x / [self width];
406 < #else
407 <        int     mouseY = y - (int) mouse.y;
404 <        int     mouseX =         (int) mouse.x;
405 < #endif
403 >        int     mouseY = y - (int) (y * mouse.y / [self height]);
404 >        int     mouseX =         (int) (x * mouse.x / [self width]);
405 >        // If the view was not resizable, then this would be simpler:
406 >        // int  mouseY = y - (int) mouse.y;
407 >        // int  mouseX =         (int) mouse.x;
408  
409          ADBMouseMoved(mouseX, mouseY);
410          return YES;
# Line 479 | Line 481 | static NSPoint mouse;                  // Previous/curr
481   #endif
482   }
483  
484 + - (void) setTo: (int) val               // Set all of bitmap to val
485 + {
486 +        unsigned char   *data
487 +  #ifdef NSBITMAP
488 +                                                        = [bitmap bitmapData];
489 +  #else
490 +                                                        = (unsigned char *) bitmap;
491 +  #endif
492 +
493 +        memset(data, val, (long unsigned)numBytes);
494 + }
495 +
496 + - (void) blacken        // Set bitmap black
497 + {
498 +        [self setTo: 0];
499 + }
500 +
501 + - (void) clear          // Set bitmap white
502 + {
503 +        [self setTo: 0xFF];
504 + }
505 +
506   //
507   // Extra drawing stuff
508   //

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines