Commit a0140fe5 authored by David Fuhrmann's avatar David Fuhrmann

macosx: create new classes for all controls bar related code

Now, we have two classes (instantiated from the xib file for each window)
with controls bar stuff:
- VLCControlsBarCommon holds all code common for main and detached window
- VLCMainWindowControlsBar adds code specific for the main window bar

With that, we can avoid all these redundant code for o_detached_*, furthermore
this decouples all detached window control bar stuff from MainWindow.m.

The objects can be accessed through the controlsBar method.
parent b219b338
......@@ -977,6 +977,8 @@
DC769AB8085DF0DB001A838D /* wizard.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = wizard.h; path = ../../../modules/gui/macosx/wizard.h; sourceTree = SOURCE_ROOT; };
DCE7BD0608A5724D007B10AE /* bookmarks.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = bookmarks.m; path = ../../../modules/gui/macosx/bookmarks.m; sourceTree = SOURCE_ROOT; };
DCE7BD0708A5724D007B10AE /* bookmarks.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = bookmarks.h; path = ../../../modules/gui/macosx/bookmarks.h; sourceTree = SOURCE_ROOT; };
E0382C00160BA09E0031D7FF /* ControlsBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ControlsBar.h; path = ../../../modules/gui/macosx/ControlsBar.h; sourceTree = SOURCE_ROOT; };
E0382C01160BA09E0031D7FF /* ControlsBar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ControlsBar.m; path = ../../../modules/gui/macosx/ControlsBar.m; sourceTree = SOURCE_ROOT; };
E06CF7F416020F6200C698B7 /* Windows.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Windows.h; path = ../../../modules/gui/macosx/Windows.h; sourceTree = SOURCE_ROOT; };
E06CF7F516020F6200C698B7 /* Windows.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Windows.m; path = ../../../modules/gui/macosx/Windows.m; sourceTree = SOURCE_ROOT; };
F69B0CA702E24F6401A80112 /* English */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text.plist.strings; name = English; path = Resources/English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
......@@ -1056,6 +1058,8 @@
CC448A6113B68A0B009F72E0 /* CoreInteraction.m */,
CC448A6213B68A0B009F72E0 /* MainWindow.h */,
CC448A6313B68A0B009F72E0 /* MainWindow.m */,
E0382C00160BA09E0031D7FF /* ControlsBar.h */,
E0382C01160BA09E0031D7FF /* ControlsBar.m */,
CC4A33220F8CB017000FC4A7 /* coredialogs.h */,
CC4A33210F8CB017000FC4A7 /* coredialogs.m */,
5CCED71014C0D4A90057F8D1 /* ExtensionsDialogProvider.h */,
......
/*****************************************************************************
* ControlsBar.h: MacOS X interface module
*****************************************************************************
* Copyright (C) 2012 VLC authors and VideoLAN
* $Id$
*
* Authors: Felix Paul Kühne <fkuehne -at- videolan -dot- org>
* David Fuhrmann <david dot fuhrmann at googlemail dot com>
*
* 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.
*****************************************************************************/
#import <Cocoa/Cocoa.h>
#import "CompatibilityFixes.h"
@class VLCFSPanel;
/*****************************************************************************
* VLCControlsBarCommon
*
* Holds all outlets, actions and code common for controls bar in detached
* and in main window.
*****************************************************************************/
@interface VLCControlsBarCommon : NSObject
{
IBOutlet id o_associated_window;
IBOutlet id o_bottombar_view;
IBOutlet id o_play_btn;
IBOutlet id o_bwd_btn;
IBOutlet id o_fwd_btn;
IBOutlet id o_progress_view;
IBOutlet id o_time_sld;
IBOutlet id o_time_sld_fancygradient_view;
IBOutlet id o_time_sld_background;
IBOutlet id o_progress_bar;
IBOutlet id o_time_fld;
IBOutlet id o_fullscreen_btn;
IBOutlet id o_resize_view;
NSImage * o_pause_img;
NSImage * o_pause_pressed_img;
NSImage * o_play_img;
NSImage * o_play_pressed_img;
NSTimeInterval last_fwd_event;
NSTimeInterval last_bwd_event;
BOOL just_triggered_next;
BOOL just_triggered_previous;
BOOL b_nativeFullscreenMode;
BOOL b_dark_interface;
}
@property (readonly) id bottomBarView;
- (IBAction)play:(id)sender;
- (IBAction)bwd:(id)sender;
- (IBAction)fwd:(id)sender;
- (IBAction)timeSliderAction:(id)sender;
- (IBAction)fullscreen:(id)sender;
- (void)updateTimeSlider;
- (void)drawFancyGradientEffectForTimeSlider;
- (void)updateControls;
- (void)setPause;
- (void)setPlay;
- (void)setFullscreenState:(BOOL)b_fullscreen;
@end
/*****************************************************************************
* VLCMainWindowControlsBar
*
* Holds all specific outlets, actions and code for the main window controls bar.
*****************************************************************************/
@interface VLCMainWindowControlsBar : VLCControlsBarCommon
{
IBOutlet id o_stop_btn;
IBOutlet id o_playlist_btn;
IBOutlet id o_repeat_btn;
IBOutlet id o_shuffle_btn;
IBOutlet id o_volume_sld;
IBOutlet id o_volume_track_view;
IBOutlet id o_volume_down_btn;
IBOutlet id o_volume_up_btn;
IBOutlet id o_effects_btn;
NSImage * o_repeat_img;
NSImage * o_repeat_pressed_img;
NSImage * o_repeat_all_img;
NSImage * o_repeat_all_pressed_img;
NSImage * o_repeat_one_img;
NSImage * o_repeat_one_pressed_img;
NSImage * o_shuffle_img;
NSImage * o_shuffle_pressed_img;
NSImage * o_shuffle_on_img;
NSImage * o_shuffle_on_pressed_img;
NSButton * o_prev_btn;
NSButton * o_next_btn;
BOOL b_show_jump_buttons;
BOOL b_show_playmode_buttons;
}
- (IBAction)stop:(id)sender;
- (IBAction)shuffle:(id)sender;
- (IBAction)volumeAction:(id)sender;
- (IBAction)effects:(id)sender;
- (void)setRepeatOne;
- (void)setRepeatAll;
- (void)setRepeatOff;
- (IBAction)repeat:(id)sender;
- (void)setShuffle;
- (IBAction)shuffle:(id)sender;
- (void)toggleJumpButtons;
- (void)togglePlaymodeButtons;
- (void)updateVolumeSlider;
- (void)updateControls;
- (void)updatePosAndTimeInFSPanel:(VLCFSPanel *)o_fspanel;
@end
This diff is collapsed.
......@@ -41,6 +41,7 @@
#import "VideoView.h"
#import "CoreInteraction.h"
#import "MainWindow.h"
#import "ControlsBar.h"
#import "ExtensionsManager.h"
#import "ConvertAndSave.h"
......@@ -633,7 +634,7 @@ static VLCMainMenu *_o_sharedInstance = nil;
{
BOOL b_value = !config_GetInt(VLCIntf, "macosx-show-playback-buttons");
config_PutInt(VLCIntf, "macosx-show-playback-buttons", b_value);
[[[VLCMain sharedInstance] mainWindow] toggleJumpButtons];
[[[[VLCMain sharedInstance] mainWindow] controlsBar] toggleJumpButtons];
[o_mi_toggleJumpButtons setState: b_value];
}
......@@ -641,7 +642,7 @@ static VLCMainMenu *_o_sharedInstance = nil;
{
BOOL b_value = !config_GetInt(VLCIntf, "macosx-show-playmode-buttons");
config_PutInt(VLCIntf, "macosx-show-playmode-buttons", b_value);
[[[VLCMain sharedInstance] mainWindow] togglePlaymodeButtons];
[[[[VLCMain sharedInstance] mainWindow] controlsBar] togglePlaymodeButtons];
[o_mi_togglePlaymodeButtons setState: b_value];
}
......
......@@ -34,29 +34,12 @@
#import "fspanel.h"
#import "MainWindowTitle.h"
@class VLCMainWindowControlsBar;
@interface VLCMainWindow : VLCVideoWindowCommon <PXSourceListDataSource, PXSourceListDelegate, NSWindowDelegate, NSAnimationDelegate, NSSplitViewDelegate> {
IBOutlet id o_play_btn;
IBOutlet id o_bwd_btn;
IBOutlet id o_fwd_btn;
IBOutlet id o_stop_btn;
IBOutlet id o_playlist_btn;
IBOutlet id o_repeat_btn;
IBOutlet id o_shuffle_btn;
IBOutlet id o_effects_btn;
IBOutlet id o_fullscreen_btn;
IBOutlet id o_search_fld;
IBOutlet id o_topbar_view;
IBOutlet id o_volume_sld;
IBOutlet id o_volume_track_view;
IBOutlet id o_volume_down_btn;
IBOutlet id o_volume_up_btn;
IBOutlet id o_progress_view;
IBOutlet id o_time_sld;
IBOutlet id o_time_sld_fancygradient_view;
IBOutlet id o_time_fld;
IBOutlet id o_progress_bar;
IBOutlet id o_bottombar_view;
IBOutlet id o_time_sld_background;
IBOutlet id o_playlist_table;
IBOutlet id o_video_view;
IBOutlet id o_split_view;
......@@ -72,19 +55,7 @@
IBOutlet id o_dropzone_box;
IBOutlet VLCFSPanel *o_fspanel;
IBOutlet id o_resize_view;
IBOutlet id o_detached_resize_view;
IBOutlet id o_detached_play_btn;
IBOutlet id o_detached_fwd_btn;
IBOutlet id o_detached_bwd_btn;
IBOutlet id o_detached_fullscreen_btn;
IBOutlet id o_detached_time_fld;
IBOutlet id o_detached_time_sld;
IBOutlet id o_detached_time_sld_background;
IBOutlet id o_detached_progress_bar;
IBOutlet id o_detached_time_sld_fancygradient_view;
IBOutlet id o_detached_bottombar_view;
IBOutlet id o_detached_video_window;
IBOutlet id o_podcast_view;
......@@ -108,32 +79,8 @@
BOOL b_dropzone_active;
BOOL b_splitview_removed;
BOOL b_minimized_view;
BOOL b_show_jump_buttons;
BOOL b_show_playmode_buttons;
int i_lastSplitViewHeight;
input_state_e cachedInputState;
NSImage * o_pause_img;
NSImage * o_pause_pressed_img;
NSImage * o_play_img;
NSImage * o_play_pressed_img;
NSImage * o_repeat_img;
NSImage * o_repeat_pressed_img;
NSImage * o_repeat_all_img;
NSImage * o_repeat_all_pressed_img;
NSImage * o_repeat_one_img;
NSImage * o_repeat_one_pressed_img;
NSImage * o_shuffle_img;
NSImage * o_shuffle_pressed_img;
NSImage * o_shuffle_on_img;
NSImage * o_shuffle_on_pressed_img;
NSTimeInterval last_fwd_event;
NSTimeInterval last_bwd_event;
BOOL just_triggered_next;
BOOL just_triggered_previous;
NSButton * o_prev_btn;
NSButton * o_next_btn;
NSMutableArray *o_sidebaritems;
......@@ -164,21 +111,10 @@
+ (VLCMainWindow *)sharedInstance;
@property (readonly) BOOL fullscreen;
- (IBAction)play:(id)sender;
- (IBAction)prev:(id)sender;
- (IBAction)backward:(id)sender;
- (IBAction)bwd:(id)sender;
- (IBAction)next:(id)sender;
- (IBAction)forward:(id)sender;
- (IBAction)fwd:(id)sender;
- (IBAction)stop:(id)sender;
- (VLCMainWindowControlsBar *)controlsBar;
- (IBAction)togglePlaylist:(id)sender;
- (IBAction)repeat:(id)sender;
- (IBAction)shuffle:(id)sender;
- (IBAction)timeSliderAction:(id)sender;
- (IBAction)volumeAction:(id)sender;
- (IBAction)effects:(id)sender;
- (IBAction)fullscreen:(id)sender;
- (IBAction)dropzoneButtonAction:(id)sender;
- (IBAction)addPodcast:(id)sender;
......@@ -193,19 +129,11 @@
- (void)showSplitView;
- (void)hideSplitView;
- (void)updateTimeSlider;
- (void)updateVolumeSlider;
- (void)updateWindow;
- (void)updateName;
- (void)setPause;
- (void)setPlay;
- (void)setRepeatOne;
- (void)setRepeatAll;
- (void)setRepeatOff;
- (void)setShuffle;
- (void)toggleJumpButtons;
- (void)togglePlaymodeButtons;
- (void)drawFancyGradientEffectForTimeSlider;
- (void)updateVolumeSlider;
- (id)videoView;
- (void)setupVideoView;
......
This diff is collapsed.
......@@ -82,4 +82,6 @@ SOURCES_macosx = \
SharedDialogs.m \
Windows.h \
Windows.m \
ControlsBar.m \
ControlsBar.h \
$(NULL)
......@@ -25,6 +25,7 @@
#import <Cocoa/Cocoa.h>
#import "CompatibilityFixes.h"
/*****************************************************************************
* VLCWindow
*
......@@ -56,6 +57,7 @@
@end
@class VLCControlsBarCommon;
/*****************************************************************************
* VLCVideoWindowCommon
......@@ -69,8 +71,12 @@
BOOL b_dark_interface;
IBOutlet id o_titlebar_view; // only set in main or detached window
IBOutlet VLCControlsBarCommon* o_controls_bar;
}
@property (readonly) VLCControlsBarCommon* controlsBar;
- (void)setTitle:(NSString *)title;
@end
\ No newline at end of file
......@@ -219,6 +219,8 @@
@implementation VLCVideoWindowCommon
@synthesize controlsBar=o_controls_bar;
#pragma mark -
#pragma mark Init
......
......@@ -22,6 +22,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
@interface VLCFSPanel : NSWindow
{
NSTimer *fadeTimer,*hideAgainTimer;
......
......@@ -148,7 +148,7 @@ struct intf_sys_t
- (void)setIntf:(intf_thread_t *)p_mainintf;
- (id)mainMenu;
- (id)mainWindow;
- (VLCMainWindow *)mainWindow;
- (id)controls;
- (id)bookmarks;
- (id)open;
......
......@@ -1351,17 +1351,17 @@ static VLCMain *_o_sharedMainInstance = nil;
bool loop = var_GetBool(p_playlist, "loop");
bool repeat = var_GetBool(p_playlist, "repeat");
if (repeat) {
[o_mainwindow setRepeatOne];
[[o_mainwindow controlsBar] setRepeatOne];
[o_mainmenu setRepeatOne];
} else if (loop) {
[o_mainwindow setRepeatAll];
[[o_mainwindow controlsBar] setRepeatAll];
[o_mainmenu setRepeatAll];
} else {
[o_mainwindow setRepeatOff];
[[o_mainwindow controlsBar] setRepeatOff];
[o_mainmenu setRepeatOff];
}
[o_mainwindow setShuffle];
[[o_mainwindow controlsBar] setShuffle];
[o_mainmenu setShuffle];
}
......@@ -1402,7 +1402,7 @@ static VLCMain *_o_sharedMainInstance = nil;
return o_mainmenu;
}
- (id)mainWindow
- (VLCMainWindow *)mainWindow
{
return o_mainwindow;
}
......
......@@ -25,6 +25,7 @@
#import "misc.h"
#import "intf.h" /* VLCApplication */
#import "MainWindow.h"
#import "ControlsBar.h"
#import "controls.h"
#import "CoreInteraction.h"
#import <CoreAudio/CoreAudio.h>
......@@ -452,7 +453,7 @@ void _drawFrameInRect(NSRect frameRect)
- (void)drawRect:(NSRect)rect
{
[[[VLCMain sharedInstance] mainWindow] drawFancyGradientEffectForTimeSlider];
[[[[VLCMain sharedInstance] mainWindow] controlsBar] drawFancyGradientEffectForTimeSlider];
msleep( 10000 ); //wait for the gradient to draw completely
/* Draw default to make sure the slider behaves correctly */
......
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