Commit e6d0343f authored by Felix Paul Kühne's avatar Felix Paul Kühne

* implement the playmode buttons and the fullscreen panel. TODO: fix...

* implement the playmode buttons and the fullscreen panel. TODO: fix mainmenu.nib (bring back the old-school error panel), fix some compilation warnings, make sure that the fspanel is hidden on vout:close. Any other remarks are appreciated.
parent ce013a3e
......@@ -42,5 +42,7 @@ SOURCES_macosx = \
embeddedwindow.m \
update.h \
update.m \
fspanel.h \
fspanel.m \
$(NULL)
......@@ -23,6 +23,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#import "fspanel.h"
/*****************************************************************************
* VLCControls interface
*****************************************************************************/
......@@ -32,6 +34,10 @@
IBOutlet id o_btn_fullscreen;
IBOutlet id o_volumeslider;
IBOutlet id o_btn_shuffle;
IBOutlet id o_btn_addNode;
IBOutlet id o_btn_repeat;
IBOutlet id o_specificTime_cancel_btn;
IBOutlet id o_specificTime_enter_fld;
......@@ -41,6 +47,8 @@
IBOutlet id o_specificTime_sec_lbl;
IBOutlet id o_specificTime_stepper;
IBOutlet id o_specificTime_mi;
VLCFSPanel *o_fs_panel;
}
- (IBAction)play:(id)sender;
......@@ -53,6 +61,13 @@
- (IBAction)random:(id)sender;
- (IBAction)repeat:(id)sender;
- (IBAction)loop:(id)sender;
- (IBAction)repeatButtonAction:(id)sender;
/* the three ugly helpers again */
- (void)repeatOne;
- (void)repeatAll;
- (void)repeatOff;
- (void)shuffle;
- (IBAction)forward:(id)sender;
- (IBAction)backward:(id)sender;
......@@ -79,6 +94,7 @@
- (IBAction)goToSpecificTime:(id)sender;
- (id)getFSPanel;
@end
/*****************************************************************************
......
/*****************************************************************************
* controls.m: MacOS X interface module
*****************************************************************************
* Copyright (C) 2002-2005 the VideoLAN team
* Copyright (C) 2002-2006 the VideoLAN team
* $Id$
*
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Christophe Massiot <massiot@via.ecp.fr>
* Derk-Jan Hartman <hartman at videolan dot org>
* Benjamin Pracht <bigben at videolan doit org>
* Felix Khne <fkuehne at videolan dot org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -31,10 +32,11 @@
#include <sys/param.h> /* for MAXPATHLEN */
#include <string.h>
#include "intf.h"
#include "vout.h"
#include "open.h"
#include "controls.h"
#import "intf.h"
#import "vout.h"
#import "open.h"
#import "controls.h"
#import "playlist.h"
#include <vlc_osd.h>
......@@ -43,6 +45,13 @@
*****************************************************************************/
@implementation VLCControls
- (id)init
{
[super init];
o_fs_panel = [[VLCFSPanel alloc] init];
return self;
}
- (void)awakeFromNib
{
[o_specificTime_mi setTitle: _NS("Jump To Time")];
......@@ -174,6 +183,117 @@
vlc_object_release( p_playlist );
}
/* three little ugly helpers */
- (void)repeatOne
{
[o_btn_repeat setImage: [[NSImage alloc] initWithContentsOfFile:
[[NSBundle mainBundle] pathForImageResource:@"repeat_single_embedded_blue.png"]]];
[o_btn_repeat setAlternateImage: [[NSImage alloc] initWithContentsOfFile:
[[NSBundle mainBundle] pathForImageResource:@"repeat_embedded_blue.png"]]];
}
- (void)repeatAll
{
[o_btn_repeat setImage: [[NSImage alloc] initWithContentsOfFile:
[[NSBundle mainBundle] pathForImageResource:@"repeat_embedded_blue.png"]]];
[o_btn_repeat setAlternateImage: [[NSImage alloc] initWithContentsOfFile:
[[NSBundle mainBundle] pathForImageResource:@"repeat_embedded.png"]]];
}
- (void)repeatOff
{
[o_btn_repeat setImage: [[NSImage alloc] initWithContentsOfFile:
[[NSBundle mainBundle] pathForImageResource:@"repeat_embedded.png"]]];
[o_btn_repeat setAlternateImage: [[NSImage alloc] initWithContentsOfFile:
[[NSBundle mainBundle] pathForImageResource:@"repeat_single_embedded_blue.png"]]];
}
- (void)shuffle
{
vlc_value_t val;
intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
if( p_playlist == NULL )
{
return;
}
var_Get( p_playlist, "random", &val );
[o_btn_shuffle setState: val.b_bool];
vlc_object_release( p_playlist );
}
- (IBAction)repeatButtonAction:(id)sender
{
vlc_value_t looping,repeating;
intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
if( p_playlist == NULL )
{
return;
}
var_Get( p_playlist, "repeat", &repeating );
var_Get( p_playlist, "loop", &looping );
[[o_btn_repeat image] release];
[[o_btn_repeat alternateImage] release];
if( !repeating.b_bool && !looping.b_bool )
{
/* was: no repeating at all, switching to Repeat One */
/* set our button's look */
[self repeatOne];
/* prepare core communication */
repeating.b_bool = VLC_TRUE;
looping.b_bool = VLC_FALSE;
config_PutInt( p_playlist, "repeat", 1 );
config_PutInt( p_playlist, "loop", 0 );
/* show the change */
vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Repeat One" ) );
}
else if( repeating.b_bool && !looping.b_bool )
{
/* was: Repeat One, switching to Repeat All */
/* set our button's look */
[self repeatAll];
/* prepare core communication */
repeating.b_bool = VLC_FALSE;
looping.b_bool = VLC_TRUE;
config_PutInt( p_playlist, "repeat", 0 );
config_PutInt( p_playlist, "loop", 1 );
/* show the change */
vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Repeat All" ) );
}
else
{
/* was: Repeat All or bug in VLC, switching to Repeat Off */
/* set our button's look */
[self repeatOff];
/* prepare core communication */
repeating.b_bool = VLC_FALSE;
looping.b_bool = VLC_FALSE;
config_PutInt( p_playlist, "repeat", 0 );
config_PutInt( p_playlist, "loop", 0 );
/* show the change */
vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Repeat Off" ) );
}
/* communicate with core and the main intf loop */
var_Set( p_playlist, "repeat", repeating );
var_Set( p_playlist, "loop", looping );
p_intf->p_sys->b_playmode_update = VLC_TRUE;
p_intf->p_sys->b_intf_update = VLC_TRUE;
vlc_object_release( p_playlist );
}
- (IBAction)repeat:(id)sender
{
vlc_value_t val;
......@@ -670,6 +790,16 @@
}
}
- (id)getFSPanel
{
if( o_fs_panel )
return o_fs_panel;
else
{
msg_Err( VLCIntf, "FSPanel is nil" );
return NULL;
}
}
@end
@implementation VLCControls (NSMenuValidation)
......
/*****************************************************************************
* fspanel.h: MacOS X full screen panel
*****************************************************************************
* Copyright (C) 2006 the VideoLAN team
* $Id: fspanel.h 16935 2006-10-04 08:19:38Z fkuehne $
*
* Authors: Jrme Decoodt <djc at videolan dot org>
* Felix Khne <fkuehne at videolan dot org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
@interface VLCFSPanel : NSWindow
{
NSTimer *fadeTimer,*hideAgainTimer;
NSPoint mouseClic;
BOOL b_fadeQueued;
BOOL b_keptVisible;
BOOL b_alreadyCounting;
int i_timeToKeepVisibleInSec;
}
- (id)initWithContentRect: (NSRect)contentRect
styleMask: (unsigned int)aStyle
backing: (NSBackingStoreType)bufferingType
defer: (BOOL)flag;
- (void)awakeFromNib;
- (BOOL)canBecomeKeyWindow;
- (void)dealloc;
- (void)setPlay;
- (void)setPause;
- (void)setStreamTitle:(NSString *)o_title;
- (void)setStreamPos:(float) f_pos andTime:(NSString *)o_time;
- (void)setSeekable:(BOOL) b_seekable;
- (void)setVolumeLevel: (float)f_volumeLevel;
- (void)focus:(NSTimer *)timer;
- (void)unfocus:(NSTimer *)timer;
- (void)mouseExited:(NSEvent *)theEvent;
- (void)fadeIn;
- (void)quickFadeIn;
- (void)fadeOut;
- (NSTimer *)fadeTimer;
- (void)setFadeTimer:(NSTimer *)timer;
- (void)autoHide;
- (void)keepVisible:(NSTimer *)timer;
- (void)mouseDown:(NSEvent *)theEvent;
- (void)mouseDragged:(NSEvent *)theEvent;
@end
@interface VLCFSPanelView : NSView
{
NSColor *fillColor;
NSButton *o_prev, *o_next, *o_slow, *o_fast, *o_play, *o_fullscreen;
NSTextField *o_streamTitle_txt, *o_streamPosition_txt;
NSSlider *o_fs_timeSlider, *o_fs_volumeSlider;
}
- (id)initWithFrame:(NSRect)frameRect;
- (void)drawRect:(NSRect)rect;
- (void)setPlay;
- (void)setPause;
- (void)setStreamTitle: (NSString *)o_title;
- (void)setStreamPos: (float)f_pos andTime: (NSString *)o_time;
- (void)setSeekable: (BOOL)b_seekable;
- (void)setVolumeLevel: (float)f_volumeLevel;
- (IBAction)play:(id)sender;
- (IBAction)prev:(id)sender;
- (IBAction)next:(id)sender;
- (IBAction)faster:(id)sender;
- (IBAction)slower:(id)sender;
- (IBAction)fsTimeSliderUpdate:(id)sender;
- (IBAction)fsVolumeSliderUpdate:(id)sender;
@end
@interface VLCFSTimeSlider : NSSlider
{
}
- (void)drawKnobInRect:(NSRect)knobRect;
- (void)drawRect:(NSRect)rect;
@end
@interface VLCFSVolumeSlider : NSSlider
{
}
- (void)drawKnobInRect:(NSRect)knobRect;
- (void)drawRect:(NSRect)rect;
@end
This diff is collapsed.
......@@ -32,20 +32,21 @@
#include <string.h>
#include <vlc_keys.h>
#include "intf.h"
#include "vout.h"
#include "prefs.h"
#include "playlist.h"
#include "controls.h"
#include "about.h"
#include "open.h"
#include "wizard.h"
#include "extended.h"
#include "bookmarks.h"
#include "interaction.h"
#include "embeddedwindow.h"
#include "update.h"
#include "AppleRemote.h"
#import "intf.h"
#import "fspanel.h"
#import "vout.h"
#import "prefs.h"
#import "playlist.h"
#import "controls.h"
#import "about.h"
#import "open.h"
#import "wizard.h"
#import "extended.h"
#import "bookmarks.h"
#import "interaction.h"
#import "embeddedwindow.h"
#import "update.h"
#import "AppleRemote.h"
/*****************************************************************************
* Local prototypes.
......@@ -477,6 +478,9 @@ static VLCMain *_o_sharedMainInstance = nil;
var_AddCallback( p_intf, "interaction", InteractCallback, self );
p_intf->b_interaction = VLC_TRUE;
/* update the playmode stuff */
p_intf->p_sys->b_playmode_update = VLC_TRUE;
nib_main_loaded = TRUE;
}
......@@ -1055,6 +1059,8 @@ static VLCMain *_o_sharedMainInstance = nil;
[o_timeslider setFloatValue: 0.0];
[o_timeslider setEnabled: b_seekable];
[o_timefield setStringValue: @"0:00:00"];
[[[self getControls] getFSPanel] setStreamPos: 0 andTime: @"0:00:00"];
[[[self getControls] getFSPanel] setSeekable: b_seekable];
[o_embedded_window setSeekable: b_seekable];
......@@ -1111,6 +1117,7 @@ static VLCMain *_o_sharedMainInstance = nil;
o_temp = [NSString stringWithCString:
p_playlist->status.p_item->input.psz_name];
[self setScrollField: o_temp stopAfter:-1];
[[[self getControls] getFSPanel] setStreamTitle: o_temp];
p_vout = vlc_object_find( p_intf->p_sys->p_input, VLC_OBJECT_VOUT,
FIND_PARENT );
......@@ -1157,6 +1164,7 @@ static VLCMain *_o_sharedMainInstance = nil;
(int) (i_seconds / 60 % 60),
(int) (i_seconds % 60)];
[o_timefield setStringValue: o_time];
[[[self getControls] getFSPanel] setStreamPos: f_updated andTime: o_time];
[o_embedded_window setTime: o_time position: f_updated];
}
......@@ -1170,6 +1178,7 @@ static VLCMain *_o_sharedMainInstance = nil;
i_volume_step = config_GetInt( p_intf->p_vlc, "volume-step" );
[o_volumeslider setFloatValue: (float)i_lastShownVolume / i_volume_step];
[o_volumeslider setEnabled: TRUE];
[[[self getControls] getFSPanel] setVolumeLevel: (float)i_lastShownVolume / i_volume_step];
p_intf->p_sys->b_mute = ( i_lastShownVolume == 0 );
p_intf->p_sys->b_volume_update = FALSE;
}
......@@ -1398,6 +1407,7 @@ static VLCMain *_o_sharedMainInstance = nil;
{
if( i_status == PLAYING_S )
{
[[[self getControls] getFSPanel] setPause];
[o_btn_play setImage: o_img_pause];
[o_btn_play setAlternateImage: o_img_pause_pressed];
[o_btn_play setToolTip: _NS("Pause")];
......@@ -1407,6 +1417,7 @@ static VLCMain *_o_sharedMainInstance = nil;
}
else
{
[[[self getControls] getFSPanel] setPlay];
[o_btn_play setImage: o_img_play];
[o_btn_play setAlternateImage: o_img_play_pressed];
[o_btn_play setToolTip: _NS("Play")];
......@@ -1482,6 +1493,7 @@ static VLCMain *_o_sharedMainInstance = nil;
(int) (i_seconds / 60 % 60),
(int) (i_seconds % 60)];
[o_timefield setStringValue: o_time];
[[[self getControls] getFSPanel] setStreamPos: f_updated andTime: o_time];
[o_embedded_window setTime: o_time position: f_updated];
}
#undef p_input
......
/*****************************************************************************
* playlist.h: MacOS X interface module
*****************************************************************************
* Copyright (C) 2002-2005 the VideoLAN team
* Copyright (C) 2002-2006 the VideoLAN team
* $Id$
*
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
......@@ -74,8 +74,6 @@
IBOutlet id o_playlist_view;
IBOutlet id o_status_field;
IBOutlet id o_search_field;
IBOutlet id o_random_ckb;
IBOutlet id o_loop_popup;
IBOutlet id o_mi_save_playlist;
IBOutlet id o_ctx_menu;
......@@ -119,7 +117,6 @@
- (void)searchfieldChanged:(NSNotification *)o_notification;
- (NSMenu *)menuForEvent:(NSEvent *)o_event;
- (IBAction)handlePopUp:(id)sender;
- (IBAction)searchItem:(id)sender;
- (void)playlistUpdated;
......
/*****************************************************************************
* playlist.m: MacOS X interface module
*****************************************************************************
* Copyright (C) 2002-2005 the VideoLAN team
* Copyright (C) 2002-2006 the VideoLAN team
* $Id$
*
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Derk-Jan Hartman <hartman at videola/n dot org>
* Benjamin Pracht <bigben at videolab dot org>
* Felix Khne <fkuehne at videolan dot org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -25,9 +26,6 @@
/* TODO
* add 'icons' for different types of nodes? (http://www.cocoadev.com/index.pl?IconAndTextInTableCell)
* create a new search field build with pictures from the 'regular' search field, so it can be emulated on 10.2
* create toggle buttons for the shuffle, repeat one, repeat all functions.
* implement drag and drop and item reordering.
* reimplement enable/disable item
* create a new 'tool' button (see the gear button in the Finder window) for 'actions'
(adding service discovery, other views, new node/playlist, save node/playlist) stuff like that
......@@ -44,14 +42,14 @@
#include <sys/mount.h>
#include <vlc_keys.h>
#include "intf.h"
#import "intf.h"
#import "wizard.h"
#import "bookmarks.h"
#import "playlistinfo.h"
#include "playlist.h"
#include "controls.h"
#include "vlc_osd.h"
#include "misc.h"
#import "playlist.h"
#import "controls.h"
#import "vlc_osd.h"
#import "misc.h"
/*****************************************************************************
* VLCPlaylistView implementation
......@@ -491,14 +489,10 @@
[o_status_field setStringValue: [NSString stringWithFormat:
_NS("No items in the playlist")]];
[o_random_ckb setTitle: _NS("Random")];
#if 0
[o_search_button setTitle: _NS("Search")];
#endif
[o_search_field setToolTip: _NS("Search in Playlist")];
[[o_loop_popup itemAtIndex:0] setTitle: _NS("Standard Play")];
[[o_loop_popup itemAtIndex:1] setTitle: _NS("Repeat One")];
[[o_loop_popup itemAtIndex:2] setTitle: _NS("Repeat All")];
[o_mi_addNode setTitle: _NS("Add Folder to Playlist")];
[o_save_accessory_text setStringValue: _NS("File Format:")];
......@@ -564,19 +558,18 @@
var_Get( p_playlist, "repeat", &val );
if( val.b_bool == VLC_TRUE )
{
[o_loop_popup selectItemAtIndex: 1];
[[[VLCMain sharedInstance] getControls] repeatOne];
}
else if( val2.b_bool == VLC_TRUE )
{
[o_loop_popup selectItemAtIndex: 2];
[[[VLCMain sharedInstance] getControls] repeatAll];
}
else
{
[o_loop_popup selectItemAtIndex: 0];
[[[VLCMain sharedInstance] getControls] repeatOff];
}
var_Get( p_playlist, "random", &val );
[o_random_ckb setState: val.b_bool];
[[[VLCMain sharedInstance] getControls] shuffle];
vlc_object_release( p_playlist );
}
......@@ -1221,53 +1214,6 @@
}
- (IBAction)handlePopUp:(id)sender
{
intf_thread_t * p_intf = VLCIntf;
vlc_value_t val1,val2;
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
if( p_playlist == NULL )
{
return;
}
switch( [o_loop_popup indexOfSelectedItem] )
{
case 1:
val1.b_bool = 0;
var_Set( p_playlist, "loop", val1 );
val1.b_bool = 1;
var_Set( p_playlist, "repeat", val1 );
vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Repeat One" ) );
break;
case 2:
val1.b_bool = 0;
var_Set( p_playlist, "repeat", val1 );
val1.b_bool = 1;
var_Set( p_playlist, "loop", val1 );
vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Repeat All" ) );
break;
default:
var_Get( p_playlist, "repeat", &val1 );
var_Get( p_playlist, "loop", &val2 );
if( val1.b_bool || val2.b_bool )
{
val1.b_bool = 0;
var_Set( p_playlist, "repeat", val1 );
var_Set( p_playlist, "loop", val1 );
vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Repeat Off" ) );
}
break;
}
vlc_object_release( p_playlist );
[self playlistUpdated];
}
- (NSMutableArray *)subSearchItem:(playlist_item_t *)p_item
{
playlist_t *p_playlist = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST,
......
......@@ -40,7 +40,9 @@
#include <vlc_keys.h>
#include "intf.h"
#include "fspanel.h"
#include "vout.h"
#import "controls.h"
/*****************************************************************************
* DeviceCallback: Callback triggered when the video-device variable is changed
......@@ -376,6 +378,10 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
var_Get( p_real_vout, "fullscreen", &val );
val.b_bool = !val.b_bool;
var_Set( p_real_vout, "fullscreen", val );
if( [self isFullscreen] )
[[[[VLCMain sharedInstance] getControls] getFSPanel] orderFront: self];
else
[[[[VLCMain sharedInstance] getControls] getFSPanel] orderOut: self];
}
- (BOOL)isFullscreen
......@@ -605,6 +611,8 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
val.b_bool = VLC_TRUE;
var_Set( p_vout, "mouse-moved", val );
}
if( [self isFullscreen] )
[[[[VLCMain sharedInstance] getControls] getFSPanel] fadeIn];
}
[super mouseMoved: o_event];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment