~ubuntu-branches/ubuntu/utopic/vlc/utopic

« back to all changes in this revision

Viewing changes to modules/gui/macosx/fspanel.m

  • Committer: Package Import Robot
  • Author(s): Benjamin Drung
  • Date: 2012-07-21 17:52:21 UTC
  • mfrom: (1.1.48) (3.5.44 sid)
  • Revision ID: package-import@ubuntu.com-20120721175221-53m5pclzo992kawy
Tags: 2.0.3-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 * fspanel.m: MacOS X full screen panel
3
3
 *****************************************************************************
4
4
 * Copyright (C) 2006-2011 VLC authors and VideoLAN
5
 
 * $Id: 016351255e98e031a415bed30966e0dc2bc2ae85 $
 
5
 * $Id: 2d925cf43df123e86cfeb77d69e0eea1520ca7b6 $
6
6
 *
7
7
 * Authors: Jérôme Decoodt <djc at videolan dot org>
8
8
 *          Felix Paul Kühne <fkuehne at videolan dot org>
133
133
    theScreensFrame = [screen frame];
134
134
    theWindowsFrame = [self frame];
135
135
 
136
 
    if( theScreensFrame.size.width >= 2560 ) //  27" iMacs, external displays
137
 
        b_usingBigScreen = YES;
138
 
 
139
 
    if( (b_usingBigScreen && theWindowsFrame.size.width < 820) || (!b_usingBigScreen && theWindowsFrame.size.width > 550) )
140
 
        [self adaptWindowSizeToScreen];
141
 
 
142
136
    theCoordinate.x = (theScreensFrame.size.width - theWindowsFrame.size.width) / 2 + theScreensFrame.origin.x;
143
137
    theCoordinate.y = (theScreensFrame.size.height / 3) - theWindowsFrame.size.height + theScreensFrame.origin.y;
144
138
    [self setFrameTopLeftPoint: theCoordinate];
387
381
        [self center];
388
382
    }
389
383
}
390
 
 
391
 
- (void)adaptWindowSizeToScreen
392
 
{
393
 
    NSRect theWindowsFrame = [self frame];
394
 
    if( b_usingBigScreen )
395
 
    {
396
 
        theWindowsFrame.size.width = 824;
397
 
        theWindowsFrame.size.height = 131;
398
 
    }
399
 
    else
400
 
    {
401
 
        theWindowsFrame.size.width = 549;
402
 
        theWindowsFrame.size.height = 87;
403
 
    }
404
 
 
405
 
    [[self contentView] adaptViewSizeToScreen: b_usingBigScreen];
406
 
 
407
 
    [self setFrame:theWindowsFrame display:YES animate:YES];
408
 
}
409
384
@end
410
385
 
411
386
/*****************************************************************************
440
415
    [o_text setFont:[NSFont font:[NSFont smallSystemFontSize]]];                     \
441
416
    [self addSubview:o_text];
442
417
 
443
 
#define restyleButton( o_button, imageOff, imageOn, _x, _y ) \
444
 
    [o_button setFrameOrigin: NSMakePoint( _x, _y )]; \
445
 
    [o_button setImage: [NSImage imageNamed: imageOff]]; \
446
 
    [o_button setAlternateImage: [NSImage imageNamed: imageOn]]; \
447
 
    [o_button sizeToFit]; \
448
 
    [o_button setNeedsDisplay: YES]
449
 
 
450
 
#define restyleTextfieldOrSlider( o_field, _x, _y, _w, _h ) \
451
 
    [o_field setFrameOrigin: NSMakePoint( _x, _y )]; \
452
 
    [o_field setFrameSize: NSMakeSize( _w, _h )]; \
453
 
    [o_field setNeedsDisplay: YES]
454
 
 
455
 
 
456
418
- (id)initWithFrame:(NSRect)frameRect
457
419
{
458
420
    id view = [super initWithFrame:frameRect];
510
472
    s_rc.size.width = 65;
511
473
    addTextfield( VLCTimeField, o_streamPosition_txt, NSRightTextAlignment, systemFontOfSize, whiteColor );
512
474
 
 
475
    o_background_img = [[NSImage imageNamed:@"fs_background"] retain];
 
476
    o_vol_sld_img = [[NSImage imageNamed:@"fs_volume_slider_bar"] retain];
 
477
    o_vol_mute_img = [[NSImage imageNamed:@"fs_volume_mute"] retain];
 
478
    o_vol_max_img = [[NSImage imageNamed:@"fs_volume_max"] retain];
 
479
    o_time_sld_img = [[NSImage imageNamed:@"fs_time_slider"] retain];
 
480
 
513
481
    return view;
514
482
}
515
483
 
516
484
- (void)dealloc
517
485
{
 
486
    [o_background_img release];
 
487
    [o_vol_sld_img release];
 
488
    [o_vol_mute_img release];
 
489
    [o_vol_max_img release];
 
490
    [o_time_sld_img release];
518
491
    [o_fs_timeSlider release];
519
492
    [o_fs_volumeSlider release];
520
493
    [o_prev release];
530
503
 
531
504
- (void)setPlay
532
505
{
533
 
    if( b_usingBigScreen )
534
 
    {
535
 
        [o_play setImage:[NSImage imageNamed:@"fs_play@x1.5"]];
536
 
        [o_play setAlternateImage: [NSImage imageNamed:@"fs_play_highlight@x1.5"]];
537
 
    }
538
 
    else
539
 
    {
540
 
        [o_play setImage:[NSImage imageNamed:@"fs_play"]];
541
 
        [o_play setAlternateImage: [NSImage imageNamed:@"fs_play_highlight"]];
542
 
    }
 
506
    [o_play setImage:[NSImage imageNamed:@"fs_play"]];
 
507
    [o_play setAlternateImage: [NSImage imageNamed:@"fs_play_highlight"]];
543
508
}
544
509
 
545
510
- (void)setPause
546
511
{
547
 
    if( b_usingBigScreen )
548
 
    {
549
 
        [o_play setImage: [NSImage imageNamed:@"fs_pause@x1.5"]];
550
 
        [o_play setAlternateImage: [NSImage imageNamed:@"fs_pause_highlight@x1.5"]];
551
 
    }
552
 
    else
553
 
    {
554
 
        [o_play setImage: [NSImage imageNamed:@"fs_pause"]];
555
 
        [o_play setAlternateImage: [NSImage imageNamed:@"fs_pause_highlight"]];
556
 
    }
 
512
    [o_play setImage: [NSImage imageNamed:@"fs_pause"]];
 
513
    [o_play setAlternateImage: [NSImage imageNamed:@"fs_pause_highlight"]];
557
514
}
558
515
 
559
516
- (void)setStreamTitle:(NSString *)o_title
629
586
    [[VLCCoreInteraction sharedInstance] setVolume: [sender intValue]];
630
587
}
631
588
 
632
 
#define addImage(image, _x, _y, mode, _width)                                               \
633
 
    img = [NSImage imageNamed:image];                                              \
634
 
    image_rect.size = [img size];                                                           \
 
589
#define addImage(image, _x, _y, mode)                                                       \
 
590
    image_size = [image size];                                                              \
 
591
    image_rect.size = image_size;                                                           \
635
592
    image_rect.origin.x = 0;                                                                \
636
593
    image_rect.origin.y = 0;                                                                \
637
594
    frame.origin.x = _x;                                                                    \
638
595
    frame.origin.y = _y;                                                                    \
639
 
    frame.size = [img size];                                                                \
640
 
    if( _width ) frame.size.width = _width;                                                 \
641
 
    [img drawInRect:frame fromRect:image_rect operation:mode fraction:1];
 
596
    frame.size = image_size;                                                                \
 
597
    [image drawInRect:frame fromRect:image_rect operation:mode fraction:1];
642
598
 
643
599
- (void)drawRect:(NSRect)rect
644
600
{
645
601
    NSRect frame = [self frame];
646
602
    NSRect image_rect;
 
603
    NSSize image_size;
647
604
    NSImage *img;
648
 
    if (b_usingBigScreen)
649
 
    {
650
 
        addImage( @"fs_background@x1.5", 0, 0, NSCompositeCopy, 0 );
651
 
        addImage( @"fs_volume_slider_bar@x1.5", 39, 35.5, NSCompositeSourceOver, 0 );
652
 
        addImage( @"fs_volume_mute@x1.5", 24, 27, NSCompositeSourceOver, 0 );
653
 
        addImage( @"fs_volume_max@x1.5", 186, 27, NSCompositeSourceOver, 0 );
654
 
        addImage( @"fs_time_slider@x1.5", 22.5, 79.5, NSCompositeSourceOver, 0);
655
 
    }
656
 
    else
657
 
    {
658
 
        addImage( @"fs_background", 0, 0, NSCompositeCopy, 0 );
659
 
        addImage( @"fs_volume_slider_bar", 26, 23, NSCompositeSourceOver, 0 );
660
 
        addImage( @"fs_volume_mute", 16, 18, NSCompositeSourceOver, 0 );
661
 
        addImage( @"fs_volume_max", 124, 18, NSCompositeSourceOver, 0 );
662
 
        addImage( @"fs_time_slider", 15, 53, NSCompositeSourceOver, 0);
663
 
    }
664
 
}
665
 
 
666
 
- (void)adaptViewSizeToScreen:(BOOL)b_value
667
 
{
668
 
    b_usingBigScreen = b_value;
669
 
 
670
 
    if (b_usingBigScreen)
671
 
    {
672
 
        restyleButton( o_prev, @"fs_skip_previous@x1.5", @"fs_skip_previous_highlight@x1.5", 261, 22.5 );
673
 
        restyleButton( o_bwd, @"fs_rewind@x1.5", @"fs_rewind_highlight@x1.5", 316.5, 21 );
674
 
        restyleButton( o_play, @"fs_play@x1.5", @"fs_play_highlight@x1.5", 400.5, 15 );
675
 
        restyleButton( o_fwd, @"fs_forward@x1.5", @"fs_forward_highlight@x1.5", 469.5, 21 );
676
 
        restyleButton( o_next, @"fs_skip_next@x1.5", @"fs_skip_next_highlight@x1.5", 547.5, 22.5 );
677
 
        restyleButton( o_fullscreen, @"fs_exit_fullscreen@x1.5", @"fs_exit_fullscreen_hightlight@x1.5", 765.5, 19.5 );
678
 
        restyleTextfieldOrSlider( o_streamTitle_txt, 148, 96, 528, 21 );
679
 
        [o_streamTitle_txt setFont:[NSFont systemFontOfSize:[NSFont systemFontSize]]];
680
 
        restyleTextfieldOrSlider( o_streamPosition_txt, 718, 96, 82.5, 21 );
681
 
        [o_streamPosition_txt setFont:[NSFont systemFontOfSize:[NSFont systemFontSize]]];
682
 
        restyleTextfieldOrSlider( o_fs_timeSlider, 22.5, 82.5, 777, 13.5 );
683
 
        restyleTextfieldOrSlider( o_fs_volumeSlider, 39, 32, 142.5, 15);
684
 
    }
685
 
    else
686
 
    {
687
 
        restyleButton( o_prev, @"fs_skip_previous", @"fs_skip_previous_highlight", 174, 15 );
688
 
        restyleButton( o_bwd, @"fs_rewind", @"fs_rewind_highlight", 211, 14 );
689
 
        restyleButton( o_play, @"fs_play", @"fs_play_highlight", 267, 10 );
690
 
        restyleButton( o_fwd, @"fs_forward", @"fs_forward_highlight", 313, 14 );
691
 
        restyleButton( o_next, @"fs_skip_next", @"fs_skip_next_highlight", 365, 15 );
692
 
        restyleButton( o_fullscreen, @"fs_exit_fullscreen", @"fs_exit_fullscreen_hightlight", 507, 13 );
693
 
        restyleTextfieldOrSlider( o_streamTitle_txt, 98, 64, 352, 14 );
694
 
        [o_streamTitle_txt setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
695
 
        restyleTextfieldOrSlider( o_streamPosition_txt, 471, 64, 65, 14);
696
 
        [o_streamPosition_txt setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
697
 
        restyleTextfieldOrSlider( o_fs_timeSlider, 15, 55, 518, 9 );
698
 
        restyleTextfieldOrSlider( o_fs_volumeSlider, 26, 20, 95, 10);
699
 
    }
 
605
    addImage( o_background_img, 0, 0, NSCompositeCopy );
 
606
    addImage( o_vol_sld_img, 26, 23, NSCompositeSourceOver );
 
607
    addImage( o_vol_mute_img, 16, 18, NSCompositeSourceOver );
 
608
    addImage( o_vol_max_img, 124, 18, NSCompositeSourceOver );
 
609
    addImage( o_time_sld_img, 15, 53, NSCompositeSourceOver );
700
610
}
701
611
 
702
612
@end