comparison libvo/vo_macosx.m @ 15855:1ca8b5873c3f

keep window size when changing aspect
author nplourde
date Wed, 29 Jun 2005 21:54:48 +0000
parents df539b2f5f4f
children 77aa290c726a
comparison
equal deleted inserted replaced
15854:df539b2f5f4f 15855:1ca8b5873c3f
286 [window setInitialFirstResponder:mpGLView]; 286 [window setInitialFirstResponder:mpGLView];
287 [window setAcceptsMouseMovedEvents:YES]; 287 [window setAcceptsMouseMovedEvents:YES];
288 [window setTitle:@"MPlayer - The Movie Player"]; 288 [window setTitle:@"MPlayer - The Movie Player"];
289 289
290 isFullscreen = 0; 290 isFullscreen = 0;
291 winSizeMult = 1;
291 } 292 }
292 293
293 - (id) config 294 - (id) config
294 { 295 {
295 uint32_t d_width; 296 uint32_t d_width;
357 kNormalScreenCmd = menuItem; 358 kNormalScreenCmd = menuItem;
358 menuItem = [[NSMenuItem alloc] initWithTitle:@"Double Size" action:@selector(menuAction:) keyEquivalent:@"2"]; [menu addItem:menuItem]; 359 menuItem = [[NSMenuItem alloc] initWithTitle:@"Double Size" action:@selector(menuAction:) keyEquivalent:@"2"]; [menu addItem:menuItem];
359 kDoubleScreenCmd = menuItem; 360 kDoubleScreenCmd = menuItem;
360 menuItem = [[NSMenuItem alloc] initWithTitle:@"Full Size" action:@selector(menuAction:) keyEquivalent:@"f"]; [menu addItem:menuItem]; 361 menuItem = [[NSMenuItem alloc] initWithTitle:@"Full Size" action:@selector(menuAction:) keyEquivalent:@"f"]; [menu addItem:menuItem];
361 kFullScreenCmd = menuItem; 362 kFullScreenCmd = menuItem;
362 menuItem = (NSMenuItem *)[NSMenuItem separatorItem]; [menu addItem:menuItem]; 363 //menuItem = (NSMenuItem *)[NSMenuItem separatorItem]; [menu addItem:menuItem];
363 364
364 NSMenu *aspectMenu; 365 NSMenu *aspectMenu;
365 aspectMenu = [[NSMenu alloc] initWithTitle:@"Aspect Ratio"]; 366 aspectMenu = [[NSMenu alloc] initWithTitle:@"Aspect Ratio"];
366 menuItem = [[NSMenuItem alloc] initWithTitle:@"Keep" action:@selector(menuAction:) keyEquivalent:@""]; [aspectMenu addItem:menuItem]; 367 menuItem = [[NSMenuItem alloc] initWithTitle:@"Keep" action:@selector(menuAction:) keyEquivalent:@""]; [aspectMenu addItem:menuItem];
367 if(vo_keepaspect) [menuItem setState:NSOnState]; 368 if(vo_keepaspect) [menuItem setState:NSOnState];
422 { 423 {
423 if(isFullscreen) { 424 if(isFullscreen) {
424 vo_fs = (!(vo_fs)); [self fullscreen:YES]; 425 vo_fs = (!(vo_fs)); [self fullscreen:YES];
425 } 426 }
426 427
427 frame.size.width = (d_width/2); 428 winSizeMult = 0.5;
428 frame.size.height = ((d_width/movie_aspect)/2); 429 frame.size.width = (d_width*winSizeMult);
430 frame.size.height = ((d_width/movie_aspect)*winSizeMult);
429 [window setContentSize: frame.size]; 431 [window setContentSize: frame.size];
430 [self reshape]; 432 [self reshape];
431 } 433 }
432 if(sender == kNormalScreenCmd) 434 if(sender == kNormalScreenCmd)
433 { 435 {
434 if(isFullscreen) { 436 if(isFullscreen) {
435 vo_fs = (!(vo_fs)); [self fullscreen:YES]; 437 vo_fs = (!(vo_fs)); [self fullscreen:YES];
436 } 438 }
437 439
440 winSizeMult = 1;
438 frame.size.width = d_width; 441 frame.size.width = d_width;
439 frame.size.height = d_width/movie_aspect; 442 frame.size.height = d_width/movie_aspect;
440 [window setContentSize: frame.size]; 443 [window setContentSize: frame.size];
441 [self reshape]; 444 [self reshape];
442 } 445 }
444 { 447 {
445 if(isFullscreen) { 448 if(isFullscreen) {
446 vo_fs = (!(vo_fs)); [self fullscreen:YES]; 449 vo_fs = (!(vo_fs)); [self fullscreen:YES];
447 } 450 }
448 451
449 frame.size.width = d_width*2; 452 winSizeMult = 2;
450 frame.size.height = (d_width/movie_aspect)*2; 453 frame.size.width = d_width*winSizeMult;
454 frame.size.height = (d_width/movie_aspect)*winSizeMult;
451 [window setContentSize: frame.size]; 455 [window setContentSize: frame.size];
452 [self reshape]; 456 [self reshape];
453 } 457 }
454 if(sender == kFullScreenCmd) 458 if(sender == kFullScreenCmd)
455 { 459 {
476 } 480 }
477 481
478 if(sender == kAspectOrgCmd) 482 if(sender == kAspectOrgCmd)
479 { 483 {
480 movie_aspect = old_movie_aspect; 484 movie_aspect = old_movie_aspect;
481 frame.size.width = d_width; 485 frame.size.width = d_width*winSizeMult;
482 frame.size.height = d_width/movie_aspect; 486 frame.size.height = (d_width/movie_aspect)*winSizeMult;
483 [window setContentSize: frame.size]; 487 [window setContentSize: frame.size];
484 [self reshape]; 488 [self reshape];
485 } 489 }
486 490
487 if(sender == kAspectFullCmd) 491 if(sender == kAspectFullCmd)
488 { 492 {
489 movie_aspect = 4.0f/3.0f; 493 movie_aspect = 4.0f/3.0f;
490 frame.size.width = d_width; 494 frame.size.width = d_width*winSizeMult;
491 frame.size.height = d_width/movie_aspect; 495 frame.size.height = (d_width/movie_aspect)*winSizeMult;
492 [window setContentSize: frame.size]; 496 [window setContentSize: frame.size];
493 [self reshape]; 497 [self reshape];
494 } 498 }
495 499
496 if(sender == kAspectWideCmd) 500 if(sender == kAspectWideCmd)
497 { 501 {
498 movie_aspect = 16.0f/9.0f; 502 movie_aspect = 16.0f/9.0f;
499 frame.size.width = d_width; 503 frame.size.width = d_width*winSizeMult;
500 frame.size.height = d_width/movie_aspect; 504 frame.size.height = (d_width/movie_aspect)*winSizeMult;
501 [window setContentSize: frame.size]; 505 [window setContentSize: frame.size];
502 [self reshape]; 506 [self reshape];
503 } 507 }
504 } 508 }
505 509