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

Comparing BasiliskII/src/MacOSX/PrefsEditor.mm (file contents):
Revision 1.5 by nigel, 2002-12-18T11:56:12Z vs.
Revision 1.8 by nigel, 2003-03-21T12:04:34Z

# Line 4 | Line 4
4   *
5   *      $Id$
6   *
7 < *  Basilisk II (C) 1997-2001 Christian Bauer
7 > *  Basilisk II (C) 1997-2003 Christian Bauer
8   *
9   *  This program is free software; you can redistribute it and/or modify
10   *  it under the terms of the GNU General Public License as published by
# Line 281 | Line 281
281          edited = YES;
282   }
283  
284 < // This is called when any of the screen/openGL/window,
284 >
285 > // If we are not using the CGIMAGEREF drawing strategy,
286 > // then source bitmaps must be 32bits deep.
287 >
288 > - (short) testWinDepth: (int) newbpp
289 > {
290 > #ifdef CGIMAGEREF
291 >        return newbpp;
292 > #else
293 >        if ( newbpp != 32 )
294 >                WarningSheet(@"Sorry - In windowed mode, depth must be 32", panel);
295 >        return 32
296 > #endif
297 > }
298 >
299 > // This is called when the screen/window,
300   // width, height or depth is clicked.
301   //
302   // Note that sender may not actually be an NSMatrix.
# Line 296 | Line 311
311          short newtype;
312          char  str[20];
313  
314 <        if ( cell == openGL )
300 <                newtype = DISPLAY_OPENGL;
301 <        else if ( cell == screen )
314 >        if ( cell == screen )
315                  newtype = DISPLAY_SCREEN;
316          else if ( cell == window )
317                  newtype = DISPLAY_WINDOW;
# Line 314 | Line 327
327          }
328  
329          // If we are changing type, supply some sensible defaults
330 +
331 +        short   screenx = CGDisplayPixelsWide(kCGDirectMainDisplay),
332 +                        screeny = CGDisplayPixelsHigh(kCGDirectMainDisplay),
333 +                        screenb = CGDisplayBitsPerPixel(kCGDirectMainDisplay);
334 +
335          if ( newtype != display_type )
336          {
337                  D(NSLog(@"Changing display type in ChangeScreen"));
320                if ( newtype == DISPLAY_SCREEN )                // If changing to full screen
321                {
322                        // supply main screen dimensions as a default
323                        newx   = CGDisplayPixelsWide  (kCGDirectMainDisplay);
324                        newy   = CGDisplayPixelsHigh  (kCGDirectMainDisplay);
325                        newbpp = CGDisplayBitsPerPixel(kCGDirectMainDisplay);
326                }
338  
339 <                if ( display_type == DISPLAY_SCREEN )   // If changing from full screen
339 >                // If changing to full screen, supply main screen dimensions as a default
340 >                if ( newtype == DISPLAY_SCREEN )
341 >                        newx = screenx, newy = screeny, newbpp = screenb;
342 >
343 >                // If changing from full screen, use minimum screen resolutions
344 >                if ( display_type == DISPLAY_SCREEN )
345 >        {
346                          newx = MIN_WIDTH, newy = MIN_HEIGHT;
347 <
348 <                [width  setIntValue: newx];
332 <                [height setIntValue: newy];
333 <                [depth  setIntValue: newbpp];
347 >                        newbpp = [self testWinDepth: newbpp];
348 >        }
349          }
350          else
351          {
352 +                newbpp = [self testWinDepth: newbpp];
353 +
354                  // Check size is within ranges of MIN_WIDTH ... MAX_WIDTH
355                  //                                                      and MIN_HEIGHT ... MAX_HEIGHT
356                  // ???
357          }
358  
359 +        [width  setIntValue: newx];
360 +        [height setIntValue: newy];
361 +        [depth  setIntValue: newbpp];
362 +
363  
364          // Store new prefs
365          *str = '\0';
# Line 350 | Line 371
371                          else
372                                  sprintf(str, "win/%hd/%hd",  newx, newy);
373                          break;
353                case DISPLAY_OPENGL:
354                        if ( newbpp )
355                                sprintf(str, "opengl/%hd/%hd/%hd",  newx, newy, newbpp);
356                        else
357                                sprintf(str, "opengl/%hd/%hd",  newx, newy);
358                        break;
374                  case DISPLAY_SCREEN:
375                          if ( newbpp )
376                                  sprintf(str, "full/%hd/%hd/%hd", newx, newy, newbpp);
# Line 662 | Line 677 | shouldProceedAfterError: (NSDictionary *
677          switch ( display_type )
678          {
679                  case DISPLAY_WINDOW: [window setState: YES]; break;
665                case DISPLAY_OPENGL: [openGL setState: YES]; break;
680                  case DISPLAY_SCREEN: [screen setState: YES]; break;
681          }
682  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines