...
 
Commits (8)
......@@ -91,6 +91,9 @@
1CCC89052078A3D500E5626F /* TextfieldPanel.xib in Sources */ = {isa = PBXBuildFile; fileRef = 6B8224151E4D2A9000833BE1 /* TextfieldPanel.xib */; };
1CCC89062078A3D500E5626F /* TimeSelectionPanel.xib in Sources */ = {isa = PBXBuildFile; fileRef = 6B8224161E4D2A9000833BE1 /* TimeSelectionPanel.xib */; };
1CFE8D591EA0D42A00E94451 /* VLCErrorWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1CFE8D581EA0D42A00E94451 /* VLCErrorWindowController.m */; };
524D376B21106CCC008FEE22 /* VLCDraggablePanelView.m in Sources */ = {isa = PBXBuildFile; fileRef = 524D376A21106CCC008FEE22 /* VLCDraggablePanelView.m */; };
524D376E21149546008FEE22 /* VLCDraggablePanelController.m in Sources */ = {isa = PBXBuildFile; fileRef = 524D376D21149546008FEE22 /* VLCDraggablePanelController.m */; };
529BE1402130140A0005F3A4 /* DPCommon.m in Sources */ = {isa = PBXBuildFile; fileRef = 529BE13F2130140A0005F3A4 /* DPCommon.m */; };
6B0292E61F43256300A50082 /* VLCBottomBarView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B0292E51F43256300A50082 /* VLCBottomBarView.m */; };
6B0AB0F01F1AC8B3003A1B4E /* VLCSlider.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B0AB0ED1F1AC8B3003A1B4E /* VLCSlider.m */; };
6B0AB0F11F1AC8B3003A1B4E /* VLCSliderCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B0AB0EF1F1AC8B3003A1B4E /* VLCSliderCell.m */; };
......@@ -163,6 +166,12 @@
1CFE8D561EA0D3D300E94451 /* ErrorPanel.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ErrorPanel.xib; sourceTree = "<group>"; };
1CFE8D571EA0D42A00E94451 /* VLCErrorWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VLCErrorWindowController.h; sourceTree = "<group>"; };
1CFE8D581EA0D42A00E94451 /* VLCErrorWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCErrorWindowController.m; sourceTree = "<group>"; };
524D376921106CCC008FEE22 /* VLCDraggablePanelView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCDraggablePanelView.h; sourceTree = "<group>"; };
524D376A21106CCC008FEE22 /* VLCDraggablePanelView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCDraggablePanelView.m; sourceTree = "<group>"; };
524D376C21149546008FEE22 /* VLCDraggablePanelController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCDraggablePanelController.h; sourceTree = "<group>"; };
524D376D21149546008FEE22 /* VLCDraggablePanelController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCDraggablePanelController.m; sourceTree = "<group>"; };
529BE13E2130140A0005F3A4 /* DPCommon.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DPCommon.h; sourceTree = "<group>"; };
529BE13F2130140A0005F3A4 /* DPCommon.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DPCommon.m; sourceTree = "<group>"; };
5CCED71014C0D4A90057F8D1 /* VLCExtensionsDialogProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VLCExtensionsDialogProvider.h; sourceTree = "<group>"; };
5CCED71114C0D4A90057F8D1 /* VLCExtensionsDialogProvider.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCExtensionsDialogProvider.m; sourceTree = "<group>"; };
5CCED71214C0D4A90057F8D1 /* VLCExtensionsManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VLCExtensionsManager.h; sourceTree = "<group>"; };
......@@ -1040,6 +1049,12 @@
6BCB590A1DA247CD009BCA66 /* VLCFSPanelController.m */,
1CAEBBFF1E1EC0A400A99E49 /* VLCFSPanelDraggableView.h */,
1CAEBC001E1EC0A400A99E49 /* VLCFSPanelDraggableView.m */,
524D376921106CCC008FEE22 /* VLCDraggablePanelView.h */,
524D376A21106CCC008FEE22 /* VLCDraggablePanelView.m */,
524D376C21149546008FEE22 /* VLCDraggablePanelController.h */,
524D376D21149546008FEE22 /* VLCDraggablePanelController.m */,
529BE13E2130140A0005F3A4 /* DPCommon.h */,
529BE13F2130140A0005F3A4 /* DPCommon.m */,
);
name = "Fullscreen Controller";
sourceTree = "<group>";
......@@ -1534,6 +1549,7 @@
1CCC88FB2078A3D500E5626F /* Help.xib in Sources */,
1CCC88FC2078A3D500E5626F /* LogMessageWindow.xib in Sources */,
1CCC88FD2078A3D500E5626F /* Open.xib in Sources */,
529BE1402130140A0005F3A4 /* DPCommon.m in Sources */,
1CCC88FE2078A3D500E5626F /* PlaylistAccessoryView.xib in Sources */,
1CCC88FF2078A3D500E5626F /* PlaylistMenu.xib in Sources */,
1CCC89002078A3D500E5626F /* PopupPanel.xib in Sources */,
......@@ -1560,6 +1576,7 @@
1C3113EF1E508C7600D4DD76 /* VLCRendererDiscovery.m in Sources */,
1C3113F11E508C7600D4DD76 /* VLCRendererItem.m in Sources */,
1C3113F31E508C7600D4DD76 /* VLCRendererMenuController.m in Sources */,
524D376E21149546008FEE22 /* VLCDraggablePanelController.m in Sources */,
6B4D50931E7979CB004479B5 /* VLCSimplePrefsWindow.m in Sources */,
1C31138E1E508C6900D4DD76 /* VLCAboutWindowController.m in Sources */,
1C3113901E508C6900D4DD76 /* VLCHelpWindowController.m in Sources */,
......@@ -1609,6 +1626,7 @@
1C3113D51E508C6900D4DD76 /* VLCTextfieldPanelController.m in Sources */,
1C3113D71E508C6900D4DD76 /* VLCPopupPanelController.m in Sources */,
1C3113D91E508C6900D4DD76 /* VLCSimplePrefsController.m in Sources */,
524D376B21106CCC008FEE22 /* VLCDraggablePanelView.m in Sources */,
6B2EFC601F2819F700F3C0EA /* VLCVolumeSlider.m in Sources */,
7D2E0EDB20CD204D0033A221 /* VLCWindow.m in Sources */,
1C3113DB1E508C6900D4DD76 /* VLCStringUtility.m in Sources */,
......
//
// DPCommon.h
// Pseudo-VLC
//
// Created by Daksh Shah on 24/08/18.
//
#import <Foundation/Foundation.h>
@interface DPCommon : NSObject
- (IBAction)play:(id)sender;
@end
//
// DPCommon.m
// Pseudo-VLC
//
// Created by Daksh Shah on 24/08/18.
//
#import "DPCommon.h"
#import "VLCCoreInteraction.h"
#import "CompatibilityFixes.h"
#import "VLCMain.h"
#import <vlc_aout.h>
@implementation DPCommon
- (IBAction)play:(id)sender {
[[VLCCoreInteraction sharedInstance] playOrPause];
}
//#pragma mark -
//#pragma mark Control Actions
//
//- (IBAction)togglePlayPause:(id)sender
//{
// [[VLCCoreInteraction sharedInstance] playOrPause];
//}
//
//- (IBAction)jumpForward:(id)sender
//{
// static NSTimeInterval last_event = 0;
// if (([NSDate timeIntervalSinceReferenceDate] - last_event) > 0.16) {
// /* We just skipped 4 "continuous" events, otherwise we are too fast */
// [[VLCCoreInteraction sharedInstance] forwardExtraShort];
// last_event = [NSDate timeIntervalSinceReferenceDate];
// }
//}
//
//- (IBAction)jumpBackward:(id)sender
//{
// static NSTimeInterval last_event = 0;
// if (([NSDate timeIntervalSinceReferenceDate] - last_event) > 0.16) {
// /* We just skipped 4 "continuous" events, otherwise we are too fast */
// [[VLCCoreInteraction sharedInstance] backwardExtraShort];
// last_event = [NSDate timeIntervalSinceReferenceDate];
// }
//}
//
//- (IBAction)gotoPrevious:(id)sender
//{
// [[VLCCoreInteraction sharedInstance] previous];
//}
//
//- (IBAction)gotoNext:(id)sender
//{
// [[VLCCoreInteraction sharedInstance] next];
//}
//
//- (IBAction)toggleFullscreen:(id)sender
//{
// [[VLCCoreInteraction sharedInstance] toggleFullscreen];
//}
//
//- (IBAction)timeSliderUpdate:(id)sender
//{
// switch([[NSApp currentEvent] type]) {
// case NSLeftMouseUp:
// /* Ignore mouse up, as this is a continuous slider and
// * when the user does a single click to a position on the slider,
// * the action is called twice, once for the mouse down and once
// * for the mouse up event. This results in two short seeks one
// * after another to the same position, which results in weird
// * audio quirks.
// */
// return;
// case NSLeftMouseDown:
// case NSLeftMouseDragged:
// break;
//
// default:
// return;
// }
// input_thread_t *p_input;
// p_input = pl_CurrentInput(getIntf());
//
// if (p_input) {
// vlc_value_t pos;
// pos.f_float = [_timeSlider floatValue] / 10000.;
// var_Set(p_input, "position", pos);
// vlc_object_release(p_input);
// }
// [[[VLCMain sharedInstance] mainWindow] updateTimeSlider];
//}
//
//- (IBAction)volumeSliderUpdate:(id)sender
//{
// [[VLCCoreInteraction sharedInstance] setVolume:[sender intValue]];
//}
//
//#pragma mark -
//#pragma mark Metadata and state updates
//
//- (void)setPlay
//{
// [_playPauseButton setState:NSOffState];
// [_playPauseButton setToolTip: _NS("Play")];
//}
//
//- (void)setPause
//{
// [_playPauseButton setState:NSOnState];
// [_playPauseButton setToolTip: _NS("Pause")];
//}
//
//- (void)setStreamTitle:(NSString *)title
//{
// [_mediaTitle setStringValue:title];
//}
//
//- (void)fixTitleBar
//{
// //Issue-3, the titleBar should be shown/hidden only for the respective window of FSPanel...
// _associatedVoutWindow.styleMask = NSTitledWindowMask | NSClosableWindowMask | NSResizableWindowMask
// | NSMiniaturizableWindowMask;
// // [self showTitleBar];
// //[_associatedVoutWindow showControlsBar]; //It apparently does not have showControlsBar, because it is a NSWindow... would have to figure out a way to hide/show it
//}
//
//-(void)unFixTitleBar
//{
// _associatedVoutWindow.styleMask |= NSFullSizeContentViewWindowMask;
//}
//
//- (void)hideTitleBar
//{
// [[[[_associatedVoutWindow standardWindowButton:NSWindowCloseButton] superview] animator] setAlphaValue:0];
//}
//
//- (void)updatePositionAndTime
//{
// input_thread_t *p_input = pl_CurrentInput(getIntf());
//
// /* If nothing is playing, reset times and slider */
// if (!p_input) {
// [_timeSlider setFloatValue:0.0];
// [_elapsedTime setStringValue:@""];
// [_remainingOrTotalTime setHidden:YES];
// return;
// }
//
// vlc_value_t pos;
// char psz_time[MSTRTIME_MAX_SIZE];
//
// var_Get(p_input, "position", &pos);
// float f_updated = 10000. * pos.f_float;
// [_timeSlider setFloatValue:f_updated];
//
//
// int64_t t = var_GetInteger(p_input, "time");
// mtime_t dur = input_item_GetDuration(input_GetItem(p_input));
//
// /* Update total duration (right field) */
// if (dur <= 0) {
// [_remainingOrTotalTime setHidden:YES];
// } else {
// [_remainingOrTotalTime setHidden:NO];
//
// NSString *totalTime;
//
// if ([_remainingOrTotalTime timeRemaining]) {
// mtime_t remaining = 0;
// if (dur > t)
// remaining = dur - t;
// totalTime = [NSString stringWithFormat:@"-%s", secstotimestr(psz_time, (int)(remaining / CLOCK_FREQ))];
// } else {
// totalTime = toNSStr(secstotimestr(psz_time, (int)(dur / 1000000)));
// }
// [_remainingOrTotalTime setStringValue:totalTime];
// }
//
// /* Update current position (left field) */
// NSString *playbackPosition = toNSStr(secstotimestr(psz_time, (int)(t / CLOCK_FREQ)));
//
// [_elapsedTime setStringValue:playbackPosition];
// vlc_object_release(p_input);
//}
//
//- (void)setSeekable:(BOOL)seekable
//{
// [_timeSlider setEnabled:seekable];
// [_forwardButton setEnabled:seekable];
// [_backwardButton setEnabled:seekable];
//}
//
//- (void)setVolumeLevel:(int)value
//{
// [_volumeSlider setIntValue:value];
// [_volumeSlider setToolTip: [NSString stringWithFormat:_NS("Volume: %i %%"), (value*200)/AOUT_VOLUME_MAX]];
//}
@end
......@@ -97,7 +97,10 @@ libmacosx_plugin_la_SOURCES = \
gui/macosx/VLCSliderCell.h gui/macosx/VLCSliderCell.m \
gui/macosx/VLCVolumeSlider.h gui/macosx/VLCVolumeSlider.m \
gui/macosx/VLCVolumeSliderCell.h gui/macosx/VLCVolumeSliderCell.m \
gui/macosx/VLCWrappableTextField.h gui/macosx/VLCWrappableTextField.m
gui/macosx/VLCWrappableTextField.h gui/macosx/VLCWrappableTextField.m \
gui/macosx/VLCDraggablePanelView.h gui/macosx/VLCDraggablePanelView.m \
gui/macosx/VLCDraggablePanelController.h gui/macosx/VLCDraggablePanelController.m \
gui/macosx/DPCommon.h gui/macosx/DPCommon.m
# User interface compilation
......
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14113" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14109" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14113"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14109"/>
<capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
<capability name="system font weights other than Regular or Bold" minToolsVersion="7.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="NSWindowController">
<customObject id="-2" userLabel="File's Owner" customClass="VLCDraggablePanelController">
<connections>
<outlet property="backwardButton" destination="hi7-6M-p0y" id="y6Z-o8-YpR"/>
<outlet property="controlsView" destination="hjO-mI-3wB" id="cIm-uc-dZS"/>
<outlet property="elapsedTime" destination="I20-7J-nKn" id="gl3-QL-MY6"/>
<outlet property="forwardButton" destination="jgn-bJ-CyD" id="E7I-Gh-iLC"/>
<outlet property="fullscreenButton" destination="qpg-Nt-InG" id="aCi-N1-OUl"/>
<outlet property="mediaTitle" destination="QSG-7h-uuB" id="VUR-Tv-XIW"/>
<outlet property="nextButton" destination="cvk-HV-oxv" id="PBf-QE-URA"/>
<outlet property="playPauseButton" destination="sr2-da-moG" id="V90-hX-Hvo"/>
<outlet property="previousButton" destination="tlI-Jl-hVM" id="Li0-lk-TMj"/>
<outlet property="remainingOrTotalTime" destination="fUw-IV-aIx" id="IPE-yi-QCz"/>
<outlet property="timeSlider" destination="nbQ-vJ-EPO" id="dZD-0c-Fex"/>
<outlet property="volumeSlider" destination="oxl-sA-ALW" id="73V-9a-0ec"/>
<outlet property="window" destination="2" id="62"/>
</connections>
</customObject>
......@@ -16,17 +30,20 @@
<window title="VLC media player" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" restorable="NO" releasedWhenClosed="NO" showsToolbarButton="NO" visibleAtLaunch="NO" frameAutosaveName="detachedvideowindow" animationBehavior="default" id="2" userLabel="Detached Video Window" customClass="VLCDetachedVideoWindow">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" topStrut="YES"/>
<rect key="contentRect" x="91" y="467" width="363" height="239"/>
<rect key="screenRect" x="0.0" y="0.0" width="1280" height="778"/>
<rect key="contentRect" x="91" y="467" width="789" height="414"/>
<rect key="screenRect" x="0.0" y="0.0" width="1920" height="1058"/>
<view key="contentView" id="4">
<rect key="frame" x="0.0" y="0.0" width="363" height="239"/>
<rect key="frame" x="0.0" y="0.0" width="789" height="414"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="63" customClass="VLCVoutView">
<rect key="frame" x="0.0" y="36" width="789" height="378"/>
</customView>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="5" customClass="VLCBottomBarView">
<rect key="frame" x="0.0" y="0.0" width="363" height="36"/>
<rect key="frame" x="0.0" y="0.0" width="789" height="36"/>
<subviews>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="65" customClass="VLCDragDropView">
<rect key="frame" x="0.0" y="0.0" width="363" height="36"/>
<rect key="frame" x="0.0" y="0.0" width="789" height="36"/>
<subviews>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="Vae-cT-EEI" userLabel="Play controls group">
<rect key="frame" x="8" y="6" width="85" height="23"/>
......@@ -77,7 +94,7 @@
</constraints>
</customView>
<slider hidden="YES" horizontalHuggingPriority="200" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="20" customClass="VLCSlider">
<rect key="frame" x="101" y="10" width="157" height="16"/>
<rect key="frame" x="101" y="10" width="583" height="16"/>
<constraints>
<constraint firstAttribute="height" constant="14" id="MYp-CS-yPe"/>
</constraints>
......@@ -89,7 +106,7 @@
</connections>
</slider>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="9" customClass="VLCTimeField">
<rect key="frame" x="264" y="11" width="56" height="13"/>
<rect key="frame" x="690" y="11" width="56" height="13"/>
<constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="52" id="EvZ-Sy-m25"/>
<constraint firstAttribute="height" constant="13" id="LYT-Sd-Gf6"/>
......@@ -101,7 +118,7 @@
</textFieldCell>
</textField>
<button translatesAutoresizingMaskIntoConstraints="NO" id="8">
<rect key="frame" x="326" y="6" width="29" height="23"/>
<rect key="frame" x="752" y="6" width="29" height="23"/>
<constraints>
<constraint firstAttribute="width" constant="29" id="VjW-79-ABX"/>
<constraint firstAttribute="height" constant="23" id="fNg-pN-oQw"/>
......@@ -136,8 +153,218 @@
<constraint firstAttribute="height" constant="36" id="z2X-5w-wme"/>
</constraints>
</customView>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="63" customClass="VLCVoutView">
<rect key="frame" x="0.0" y="36" width="363" height="203"/>
<customView ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="hjO-mI-3wB" customClass="VLCDraggablePanelView">
<rect key="frame" x="74" y="157" width="480" height="94"/>
<subviews>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="9an-Dc-AH0" userLabel="Bottom View">
<rect key="frame" x="0.0" y="0.0" width="480" height="42"/>
<subviews>
<button translatesAutoresizingMaskIntoConstraints="NO" id="Trq-Rd-N1l" customClass="VLCImageButton">
<rect key="frame" x="20" y="14" width="25" height="14"/>
<constraints>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="10" id="HCa-L3-eR6"/>
<constraint firstAttribute="width" secondItem="Trq-Rd-N1l" secondAttribute="height" multiplier="25:14" id="ywE-EA-AGO"/>
</constraints>
<buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="VLCVolumeOnTemplate" imagePosition="only" alignment="center" alternateImage="VLCVolumeOffTemplate" imageScaling="proportionallyUpOrDown" inset="2" id="jqy-2U-rZT">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
</button>
<slider verticalHuggingPriority="750" horizontalCompressionResistancePriority="800" translatesAutoresizingMaskIntoConstraints="NO" id="oxl-sA-ALW" userLabel="Volume Slider" customClass="VLCDefaultValueSlider">
<rect key="frame" x="50" y="14" width="80" height="13"/>
<constraints>
<constraint firstAttribute="width" constant="80" id="t0B-vQ-xwa"/>
</constraints>
<sliderCell key="cell" controlSize="mini" continuous="YES" state="on" alignment="left" maxValue="100" doubleValue="50" tickMarkPosition="above" sliderType="linear" id="4kg-OP-fNv" customClass="VLCDefaultValueSliderCell"/>
<connections>
<action selector="volumeSliderUpdate:" target="3fL-vQ-fZQ" id="mur-1N-RJX"/>
</connections>
</slider>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="zxC-jL-DOC" userLabel="Playback Buttons group">
<rect key="frame" x="159" y="7" width="163" height="29"/>
<subviews>
<button translatesAutoresizingMaskIntoConstraints="NO" id="tlI-Jl-hVM" userLabel="Previous Button" customClass="VLCImageButton">
<rect key="frame" x="0.0" y="0.0" width="34" height="29"/>
<constraints>
<constraint firstAttribute="width" secondItem="tlI-Jl-hVM" secondAttribute="height" multiplier="19:16" id="A8k-Us-FUf"/>
</constraints>
<buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="VLCPreviousTemplate" imagePosition="only" alignment="center" imageScaling="proportionallyUpOrDown" inset="2" id="UF0-hx-8KV">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="gotoPrevious:" target="3fL-vQ-fZQ" id="gKh-Zz-ONt"/>
</connections>
</button>
<button translatesAutoresizingMaskIntoConstraints="NO" id="hi7-6M-p0y" userLabel="Backward Button" customClass="VLCImageButton">
<rect key="frame" x="32" y="0.0" width="34" height="29"/>
<constraints>
<constraint firstAttribute="width" secondItem="hi7-6M-p0y" secondAttribute="height" multiplier="19:16" id="j5i-eU-cXj"/>
</constraints>
<buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="VLCBackwardTemplate" imagePosition="only" alignment="center" continuous="YES" imageScaling="proportionallyUpOrDown" inset="2" id="7AH-Vs-m0l">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="jumpBackward:" target="3fL-vQ-fZQ" id="Yax-zo-ZWJ"/>
</connections>
</button>
<button translatesAutoresizingMaskIntoConstraints="NO" id="sr2-da-moG" userLabel="Play Pause Button" customClass="VLCImageButton">
<rect key="frame" x="64" y="0.0" width="35" height="29"/>
<constraints>
<constraint firstAttribute="width" secondItem="sr2-da-moG" secondAttribute="height" multiplier="1:1" constant="6" id="0Z5-wy-Kb6"/>
</constraints>
<buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="VLCPlayTemplate" imagePosition="overlaps" alignment="center" alternateImage="VLCPauseTemplate" imageScaling="proportionallyUpOrDown" inset="2" id="sba-yB-93u">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="toggle" value="YES"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="togglePlayPause:" target="3fL-vQ-fZQ" id="SCr-bz-6k1"/>
</connections>
</button>
<button translatesAutoresizingMaskIntoConstraints="NO" id="jgn-bJ-CyD" userLabel="Forward Button" customClass="VLCImageButton">
<rect key="frame" x="97" y="0.0" width="34" height="29"/>
<constraints>
<constraint firstAttribute="width" secondItem="jgn-bJ-CyD" secondAttribute="height" multiplier="19:16" id="pg8-EA-cTA"/>
</constraints>
<buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="VLCForwardTemplate" imagePosition="only" alignment="center" continuous="YES" imageScaling="proportionallyUpOrDown" inset="2" id="YlK-vS-VyZ">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="jumpForward:" target="3fL-vQ-fZQ" id="Ogi-Yd-B5Z"/>
</connections>
</button>
<button translatesAutoresizingMaskIntoConstraints="NO" id="cvk-HV-oxv" userLabel="Next Button" customClass="VLCImageButton">
<rect key="frame" x="129" y="0.0" width="34" height="29"/>
<constraints>
<constraint firstAttribute="width" secondItem="cvk-HV-oxv" secondAttribute="height" multiplier="19:16" id="rmN-hw-ufG"/>
</constraints>
<buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="VLCNextTemplate" imagePosition="only" alignment="center" imageScaling="proportionallyUpOrDown" inset="2" id="Ehr-E8-lde">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="gotoNext:" target="3fL-vQ-fZQ" id="IPr-ox-l50"/>
</connections>
</button>
</subviews>
<constraints>
<constraint firstItem="hi7-6M-p0y" firstAttribute="top" secondItem="zxC-jL-DOC" secondAttribute="top" id="5p6-ss-UoG"/>
<constraint firstItem="tlI-Jl-hVM" firstAttribute="right" secondItem="hi7-6M-p0y" secondAttribute="left" constant="2" id="Coe-Y1-DOu"/>
<constraint firstItem="tlI-Jl-hVM" firstAttribute="left" secondItem="zxC-jL-DOC" secondAttribute="left" id="De2-gF-5kI"/>
<constraint firstItem="jgn-bJ-CyD" firstAttribute="right" secondItem="cvk-HV-oxv" secondAttribute="left" constant="2" id="J5o-yJ-miC"/>
<constraint firstItem="tlI-Jl-hVM" firstAttribute="top" secondItem="zxC-jL-DOC" secondAttribute="top" id="Mpx-3H-rCk"/>
<constraint firstAttribute="bottom" secondItem="hi7-6M-p0y" secondAttribute="bottom" id="NCj-SO-nZx"/>
<constraint firstAttribute="bottom" secondItem="jgn-bJ-CyD" secondAttribute="bottom" id="TVc-0w-ZsK"/>
<constraint firstAttribute="bottom" secondItem="sr2-da-moG" secondAttribute="bottom" id="Tn0-3p-dCb"/>
<constraint firstItem="hi7-6M-p0y" firstAttribute="right" secondItem="sr2-da-moG" secondAttribute="left" constant="2" id="aQf-MB-eFE"/>
<constraint firstItem="sr2-da-moG" firstAttribute="right" secondItem="jgn-bJ-CyD" secondAttribute="left" constant="2" id="jrU-lR-pSx"/>
<constraint firstAttribute="right" secondItem="cvk-HV-oxv" secondAttribute="right" id="l5G-kD-bId"/>
<constraint firstAttribute="bottom" secondItem="cvk-HV-oxv" secondAttribute="bottom" id="s5W-PO-iDR"/>
<constraint firstItem="cvk-HV-oxv" firstAttribute="top" secondItem="zxC-jL-DOC" secondAttribute="top" id="tD5-E5-ewy"/>
<constraint firstAttribute="bottom" secondItem="tlI-Jl-hVM" secondAttribute="bottom" id="vOj-Dh-wh4"/>
<constraint firstItem="sr2-da-moG" firstAttribute="top" secondItem="zxC-jL-DOC" secondAttribute="top" id="wtB-gs-0sV"/>
<constraint firstItem="jgn-bJ-CyD" firstAttribute="top" secondItem="zxC-jL-DOC" secondAttribute="top" id="x2c-6X-EOE"/>
</constraints>
</customView>
<button translatesAutoresizingMaskIntoConstraints="NO" id="qpg-Nt-InG" userLabel="Fullscreen Button" customClass="VLCImageButton">
<rect key="frame" x="438" y="10" width="22" height="22"/>
<constraints>
<constraint firstAttribute="width" secondItem="qpg-Nt-InG" secondAttribute="height" multiplier="1:1" id="d1P-xd-XyV"/>
</constraints>
<buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="VLCFullscreenOnTemplate" imagePosition="only" alignment="center" imageScaling="proportionallyUpOrDown" inset="2" id="Cur-VS-RR4">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="toggleFullscreen:" target="3fL-vQ-fZQ" id="Bpr-x3-zza"/>
</connections>
</button>
</subviews>
<constraints>
<constraint firstAttribute="trailing" secondItem="qpg-Nt-InG" secondAttribute="trailing" constant="20" id="2O7-5g-Rao"/>
<constraint firstAttribute="bottom" secondItem="Trq-Rd-N1l" secondAttribute="bottom" constant="14" id="2zn-0z-j22"/>
<constraint firstItem="zxC-jL-DOC" firstAttribute="top" secondItem="9an-Dc-AH0" secondAttribute="top" constant="6" id="3zQ-bq-YlA"/>
<constraint firstItem="qpg-Nt-InG" firstAttribute="top" secondItem="9an-Dc-AH0" secondAttribute="top" constant="10" id="83d-by-KFV"/>
<constraint firstItem="zxC-jL-DOC" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="oxl-sA-ALW" secondAttribute="trailing" constant="29" id="8TX-c3-4mg"/>
<constraint firstAttribute="bottom" secondItem="zxC-jL-DOC" secondAttribute="bottom" constant="7" id="E53-q1-vKP"/>
<constraint firstAttribute="height" relation="lessThanOrEqual" constant="80" identifier="customViewHeightMax" id="Fan-i3-l1E"/>
<constraint firstItem="oxl-sA-ALW" firstAttribute="leading" secondItem="Trq-Rd-N1l" secondAttribute="trailing" constant="5" id="I5l-TJ-B2y"/>
<constraint firstItem="Trq-Rd-N1l" firstAttribute="top" secondItem="9an-Dc-AH0" secondAttribute="top" constant="14" id="KOt-Tc-wIW"/>
<constraint firstAttribute="bottom" secondItem="qpg-Nt-InG" secondAttribute="bottom" constant="10" id="hWa-mg-b6O"/>
<constraint firstItem="Trq-Rd-N1l" firstAttribute="leading" secondItem="9an-Dc-AH0" secondAttribute="leading" constant="20" id="oF3-2i-YDo"/>
<constraint firstItem="oxl-sA-ALW" firstAttribute="centerY" secondItem="9an-Dc-AH0" secondAttribute="centerY" id="orY-gF-qmQ"/>
<constraint firstItem="zxC-jL-DOC" firstAttribute="centerX" secondItem="9an-Dc-AH0" secondAttribute="centerX" id="ybx-Af-oQb"/>
</constraints>
</customView>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="I20-7J-nKn" userLabel="Elapsed Time" customClass="VLCTimeField">
<rect key="frame" x="18" y="69" width="79" height="14"/>
<constraints>
<constraint firstAttribute="width" constant="75" id="BuI-tb-RXn"/>
<constraint firstAttribute="height" constant="14" id="Ivd-50-EJt"/>
</constraints>
<textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" allowsUndo="NO" sendsActionOnEndEditing="YES" alignment="left" title="0:00" id="EXF-qa-8Qb">
<font key="font" metaFont="systemThin" size="11"/>
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="fUw-IV-aIx" userLabel="Remaining or Total Time" customClass="VLCTimeField">
<rect key="frame" x="383" y="69" width="79" height="14"/>
<constraints>
<constraint firstAttribute="width" constant="75" id="BIQ-Ja-Tfh"/>
<constraint firstAttribute="height" constant="14" id="Jf0-Hg-A28"/>
</constraints>
<textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" allowsUndo="NO" sendsActionOnEndEditing="YES" alignment="right" placeholderString="∞" id="WQg-O4-37w">
<font key="font" metaFont="systemThin" size="11"/>
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="QSG-7h-uuB" userLabel="Media Title">
<rect key="frame" x="198" y="69" width="90" height="14"/>
<constraints>
<constraint firstAttribute="height" constant="14" id="TE0-bf-iQF"/>
</constraints>
<textFieldCell key="cell" controlSize="small" lineBreakMode="truncatingTail" allowsUndo="NO" sendsActionOnEndEditing="YES" alignment="center" placeholderString="Nothing Playing" usesSingleLineMode="YES" id="3HV-Oj-1XP">
<font key="font" metaFont="systemThin" size="11"/>
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<slider verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="nbQ-vJ-EPO" userLabel="Time Slider">
<rect key="frame" x="23" y="49" width="440" height="17"/>
<constraints>
<constraint firstAttribute="height" constant="15" id="J3c-eD-mvr"/>
</constraints>
<sliderCell key="cell" controlSize="small" continuous="YES" state="on" alignment="left" maxValue="10000" tickMarkPosition="above" sliderType="linear" id="nyT-Mk-q5A"/>
<connections>
<action selector="timeSliderUpdate:" target="3fL-vQ-fZQ" id="DUX-AI-Vbx"/>
</connections>
</slider>
</subviews>
<constraints>
<constraint firstItem="nbQ-vJ-EPO" firstAttribute="top" secondItem="I20-7J-nKn" secondAttribute="bottom" constant="4" id="88G-8N-dgP"/>
<constraint firstItem="nbQ-vJ-EPO" firstAttribute="leading" secondItem="hjO-mI-3wB" secondAttribute="leading" constant="23" id="9Rh-Td-MYc"/>
<constraint firstAttribute="bottom" secondItem="9an-Dc-AH0" secondAttribute="bottom" id="A0s-7l-S1M"/>
<constraint firstItem="nbQ-vJ-EPO" firstAttribute="top" secondItem="hjO-mI-3wB" secondAttribute="top" constant="29" id="DFa-HX-8BE"/>
<constraint firstAttribute="trailing" secondItem="fUw-IV-aIx" secondAttribute="trailing" constant="20" id="JMa-Tm-WjW"/>
<constraint firstAttribute="width" constant="480" id="Nv5-CR-UQ9"/>
<constraint firstItem="I20-7J-nKn" firstAttribute="leading" secondItem="hjO-mI-3wB" secondAttribute="leading" constant="20" id="REW-Mj-gSv"/>
<constraint firstItem="9an-Dc-AH0" firstAttribute="leading" secondItem="hjO-mI-3wB" secondAttribute="leading" id="RJj-tw-6Xb"/>
<constraint firstItem="QSG-7h-uuB" firstAttribute="baseline" secondItem="I20-7J-nKn" secondAttribute="baseline" id="Xae-jA-X4a"/>
<constraint firstItem="9an-Dc-AH0" firstAttribute="top" secondItem="nbQ-vJ-EPO" secondAttribute="bottom" constant="8" id="Yf7-TQ-iAi"/>
<constraint firstAttribute="trailing" secondItem="9an-Dc-AH0" secondAttribute="trailing" id="cJd-wN-lka"/>
<constraint firstItem="QSG-7h-uuB" firstAttribute="baseline" secondItem="fUw-IV-aIx" secondAttribute="baseline" id="cjM-gQ-X92"/>
<constraint firstItem="9an-Dc-AH0" firstAttribute="top" secondItem="nbQ-vJ-EPO" secondAttribute="bottom" constant="8" symbolic="YES" id="i5A-8t-A3c"/>
<constraint firstAttribute="height" constant="94" id="lkz-vO-hGJ"/>
<constraint firstItem="nbQ-vJ-EPO" firstAttribute="centerX" secondItem="QSG-7h-uuB" secondAttribute="centerX" id="ubk-vT-QO8"/>
<constraint firstAttribute="trailing" secondItem="nbQ-vJ-EPO" secondAttribute="trailing" constant="17" id="zl9-no-Uc7"/>
</constraints>
</customView>
</subviews>
<constraints>
......@@ -165,6 +392,7 @@
<outlet property="videoView" destination="63" id="68"/>
<outlet property="videoViewBottomConstraint" destination="VbV-nq-qDN" id="twJ-2J-MZX"/>
</connections>
<point key="canvasLocation" x="353.5" y="249"/>
</window>
<customObject id="3" userLabel="Detached Window Controls Bar" customClass="VLCControlsBarCommon">
<connections>
......@@ -179,8 +407,33 @@
<outlet property="timeSlider" destination="20" id="AFS-sq-vuw"/>
</connections>
</customObject>
<customObject id="3fL-vQ-fZQ" userLabel="DP Common waali object" customClass="VLCDraggablePanelController">
<connections>
<outlet property="backwardButton" destination="hi7-6M-p0y" id="D93-Cg-hYg"/>
<outlet property="controlsView" destination="hjO-mI-3wB" id="OH9-jm-Ktw"/>
<outlet property="elapsedTime" destination="I20-7J-nKn" id="fow-LS-rai"/>
<outlet property="forwardButton" destination="jgn-bJ-CyD" id="oBb-Dg-R5O"/>
<outlet property="fullscreenButton" destination="qpg-Nt-InG" id="PHQ-DG-aH3"/>
<outlet property="mediaTitle" destination="QSG-7h-uuB" id="h03-BK-puy"/>
<outlet property="nextButton" destination="cvk-HV-oxv" id="1MA-B8-FSf"/>
<outlet property="playPauseButton" destination="sr2-da-moG" id="bgo-aI-lah"/>
<outlet property="previousButton" destination="tlI-Jl-hVM" id="WIp-fL-rAZ"/>
<outlet property="remainingOrTotalTime" destination="fUw-IV-aIx" id="D6c-zf-BD2"/>
<outlet property="timeSlider" destination="nbQ-vJ-EPO" id="vpS-Y0-KKv"/>
<outlet property="volumeSlider" destination="oxl-sA-ALW" id="UnS-MC-x6w"/>
</connections>
</customObject>
</objects>
<resources>
<image name="VLCBackwardTemplate" width="128" height="128"/>
<image name="VLCForwardTemplate" width="128" height="128"/>
<image name="VLCFullscreenOnTemplate" width="128" height="128"/>
<image name="VLCNextTemplate" width="128" height="128"/>
<image name="VLCPauseTemplate" width="128" height="128"/>
<image name="VLCPlayTemplate" width="128" height="128"/>
<image name="VLCPreviousTemplate" width="128" height="128"/>
<image name="VLCVolumeOffTemplate" width="128" height="128"/>
<image name="VLCVolumeOnTemplate" width="128" height="128"/>
<image name="backward-3btns" width="29" height="23"/>
<image name="backward-3btns-pressed" width="29" height="23"/>
<image name="forward-3btns" width="29" height="23"/>
......
#import <Cocoa/Cocoa.h>
#import "VLCWindow.h"
#import "VLCDefaultValueSlider.h"
#import "VLCTimeField.h"
@interface VLCDraggablePanelController : NSObject
@property (readwrite, weak) NSTimer *hideTimer;
@property IBOutlet NSView *controlsView;
@property IBOutlet NSButton *playPauseButton;
@property IBOutlet NSButton *forwardButton;
@property IBOutlet NSButton *backwardButton;
@property IBOutlet NSButton *nextButton;
@property IBOutlet NSButton *previousButton;
@property IBOutlet NSButton *fullscreenButton;
@property IBOutlet NSTextField *mediaTitle;
@property IBOutlet VLCTimeField *elapsedTime;
@property IBOutlet VLCTimeField *remainingOrTotalTime;
@property IBOutlet NSSlider *timeSlider;
@property IBOutlet VLCDefaultValueSlider *volumeSlider;
@property (assign) IBOutlet NSLayoutConstraint *heightMaxConstraint;
- (IBAction)togglePlayPause:(id)sender;
- (IBAction)jumpForward:(id)sender;
- (IBAction)jumpBackward:(id)sender;
- (IBAction)gotoPrevious:(id)sender;
- (IBAction)gotoNext:(id)sender;
- (IBAction)toggleFullscreen:(id)sender;
- (IBAction)timeSliderUpdate:(id)sender;
- (IBAction)volumeSliderUpdate:(id)sender;
- (void)fadeIn;
- (void)fadeOut;
- (void)setActive;
- (void)setNonActive;
- (void)setVoutWasUpdated:(VLCWindow *)voutWindow;
- (void)centerPanel; //Have to find a better alternative than to centering each time on resize/drag
- (void)setSeekable:(BOOL)seekable;
- (void)setVolumeLevel:(int)value;
- (void)updatePositionAndTime;
- (void)setStreamTitle:(NSString *)title;
- (void)setPlay;
- (void)setPause;
// Constrain frame to window. Used by VLCFSPanelDraggableView.
- (NSRect)contrainFrameToAssociatedVoutWindow:(NSRect)frame;
@end
//
// VLCDraggablePanelController.m
// Pseudo-VLC
//
// Created by Daksh Shah on 03/08/18.
//
#import "VLCDraggablePanelController.h"
#import "VLCCoreInteraction.h"
#import "CompatibilityFixes.h"
#import "VLCMain.h"
#import <vlc_aout.h>
@interface VLCDraggablePanelController () {
BOOL _isCounting;
// Only used to track changes and trigger centering of FS panel
NSRect _associatedVoutFrame;
// Used to ask for current constraining rect on movement
NSWindow *_associatedVoutWindow;
}
@end
@implementation VLCDraggablePanelController
static NSString *kAssociatedFullscreenRect = @"VLCFullscreenAssociatedWindowRect";
+ (void)initialize
{
NSDictionary *appDefaults = [NSDictionary dictionaryWithObjectsAndKeys: NSStringFromRect(NSZeroRect), kAssociatedFullscreenRect, nil];
[[NSUserDefaults standardUserDefaults] registerDefaults:appDefaults];
}
#define setupButton(target, title, desc) \
target.accessibilityTitle = title; \
target.accessibilityLabel = desc; \
[target setToolTip:title];
- (void)setupControls
{
/* Setup translations for buttons */
setupButton(_playPauseButton,
_NS("Play/Pause"),
_NS("Play/Pause the current media"));
setupButton(_nextButton,
_NS("Next"),
_NS("Go to next item"));
setupButton(_previousButton,
_NS("Previous"),
_NS("Go to the previous item"));
setupButton(_forwardButton,
_NS("Forward"),
_NS("Seek forward"));
setupButton(_backwardButton,
_NS("Backward"),
_NS("Seek backward"));
setupButton(_fullscreenButton,
_NS("Leave fullscreen"),
_NS("Leave fullscreen"));
setupButton(_volumeSlider,
_NS("Volume"),
_NS("Adjust the volume"));
setupButton(_timeSlider,
_NS("Position"),
_NS("Adjust the current playback position"));
/* Setup other controls */
[_volumeSlider setMaxValue:[[VLCCoreInteraction sharedInstance] maxVolume]];
[_volumeSlider setIntValue:AOUT_VOLUME_DEFAULT];
[_volumeSlider setDefaultValue:AOUT_VOLUME_DEFAULT];
/* Identifier to store the state of the remaining or total time label,
* this is the same identifier as used for the window playback cotrols
* so the state is shared between those.
*/
[_remainingOrTotalTime setRemainingIdentifier:@"DisplayTimeAsTimeRemaining"];
}
#undef setupButton
#pragma mark -
#pragma mark Control Actions
- (IBAction)togglePlayPause:(id)sender
{
[[VLCCoreInteraction sharedInstance] playOrPause];
}
- (IBAction)jumpForward:(id)sender
{
static NSTimeInterval last_event = 0;
if (([NSDate timeIntervalSinceReferenceDate] - last_event) > 0.16) {
/* We just skipped 4 "continuous" events, otherwise we are too fast */
[[VLCCoreInteraction sharedInstance] forwardExtraShort];
last_event = [NSDate timeIntervalSinceReferenceDate];
}
}
- (IBAction)jumpBackward:(id)sender
{
static NSTimeInterval last_event = 0;
if (([NSDate timeIntervalSinceReferenceDate] - last_event) > 0.16) {
/* We just skipped 4 "continuous" events, otherwise we are too fast */
[[VLCCoreInteraction sharedInstance] backwardExtraShort];
last_event = [NSDate timeIntervalSinceReferenceDate];
}
}
- (IBAction)gotoPrevious:(id)sender
{
[[VLCCoreInteraction sharedInstance] previous];
}
- (IBAction)gotoNext:(id)sender
{
[[VLCCoreInteraction sharedInstance] next];
}
- (IBAction)toggleFullscreen:(id)sender
{
[self fadeOut];
// [[VLCCoreInteraction sharedInstance] toggleFullscreen];
}
- (IBAction)timeSliderUpdate:(id)sender
{
switch([[NSApp currentEvent] type]) {
case NSLeftMouseUp:
/* Ignore mouse up, as this is a continuous slider and
* when the user does a single click to a position on the slider,
* the action is called twice, once for the mouse down and once
* for the mouse up event. This results in two short seeks one
* after another to the same position, which results in weird
* audio quirks.
*/
return;
case NSLeftMouseDown:
case NSLeftMouseDragged:
break;
default:
return;
}
input_thread_t *p_input;
p_input = pl_CurrentInput(getIntf());
if (p_input) {
vlc_value_t pos;
pos.f_float = [_timeSlider floatValue] / 10000.;
var_Set(p_input, "position", pos);
vlc_object_release(p_input);
}
[[[VLCMain sharedInstance] mainWindow] updateTimeSlider];
}
- (IBAction)volumeSliderUpdate:(id)sender
{
[[VLCCoreInteraction sharedInstance] setVolume:[sender intValue]];
}
#pragma mark -
#pragma mark Metadata and state updates
- (void)setPlay
{
[_playPauseButton setState:NSOffState];
[_playPauseButton setToolTip: _NS("Play")];
}
- (void)setPause
{
[_playPauseButton setState:NSOnState];
[_playPauseButton setToolTip: _NS("Pause")];
}
- (void)setStreamTitle:(NSString *)title
{
[_mediaTitle setStringValue:title];
}
- (void)updatePositionAndTime
{
input_thread_t *p_input = pl_CurrentInput(getIntf());
/* If nothing is playing, reset times and slider */
if (!p_input) {
[_timeSlider setFloatValue:0.0];
[_elapsedTime setStringValue:@""];
[_remainingOrTotalTime setHidden:YES];
return;
}
vlc_value_t pos;
char psz_time[MSTRTIME_MAX_SIZE];
var_Get(p_input, "position", &pos);
float f_updated = 10000. * pos.f_float;
[_timeSlider setFloatValue:f_updated];
int64_t t = var_GetInteger(p_input, "time");
mtime_t dur = input_item_GetDuration(input_GetItem(p_input));
/* Update total duration (right field) */
if (dur <= 0) {
[_remainingOrTotalTime setHidden:YES];
} else {
[_remainingOrTotalTime setHidden:NO];
NSString *totalTime;
if ([_remainingOrTotalTime timeRemaining]) {
mtime_t remaining = 0;
if (dur > t)
remaining = dur - t;
totalTime = [NSString stringWithFormat:@"-%s", secstotimestr(psz_time, (int)(remaining / CLOCK_FREQ))];
} else {
totalTime = toNSStr(secstotimestr(psz_time, (int)(dur / 1000000)));
}
[_remainingOrTotalTime setStringValue:totalTime];
}
/* Update current position (left field) */
NSString *playbackPosition = toNSStr(secstotimestr(psz_time, (int)(t / CLOCK_FREQ)));
[_elapsedTime setStringValue:playbackPosition];
vlc_object_release(p_input);
}
- (void)setSeekable:(BOOL)seekable
{
[_timeSlider setEnabled:seekable];
[_forwardButton setEnabled:seekable];
[_backwardButton setEnabled:seekable];
}
- (void)setVolumeLevel:(int)value
{
[_volumeSlider setIntValue:value];
[_volumeSlider setToolTip: [NSString stringWithFormat:_NS("Volume: %i %%"), (value*200)/AOUT_VOLUME_MAX]];
}
#pragma mark -
#pragma mark Window interactions
- (void)fadeIn
{
if (!var_InheritBool(getIntf(), "macosx-fspanel"))
return;
[NSAnimationContext beginGrouping];
[[NSAnimationContext currentContext] setDuration:0.4f];
[[_controlsView animator] setAlphaValue:1.0f];
[NSAnimationContext endGrouping];
[self startAutohideTimer];
}
- (void)fadeOut
{
[NSAnimationContext beginGrouping];
[[NSAnimationContext currentContext] setDuration:0.4f];
[[_controlsView animator] setAlphaValue:0.0f];
[NSAnimationContext endGrouping];
}
//
//- (void)centerPanel
//{
// NSRect windowFrame = [self.window frame];
//
// /* Calculate coordinates for centered position */
// NSRect limitFrame = _associatedVoutWindow.frame;
// windowFrame.origin.x = (limitFrame.size.width - windowFrame.size.width) / 2 + limitFrame.origin.x;
// windowFrame.origin.y = (limitFrame.size.height / 5) - windowFrame.size.height + limitFrame.origin.y;
//
// windowFrame = [self contrainFrameToAssociatedVoutWindow:windowFrame];
// [self.window setFrame:windowFrame display:YES animate:NO];
//}
//
//- (NSRect)contrainFrameToAssociatedVoutWindow:(NSRect)frame
//{
// NSRect limitFrame = _associatedVoutWindow.frame;
//
// // Limit rect to limitation view
// if (frame.origin.x < limitFrame.origin.x)
// frame.origin.x = limitFrame.origin.x;
// if (frame.origin.y < limitFrame.origin.y)
// frame.origin.y = limitFrame.origin.y;
//
// // Limit size (could be needed after resolution changes)
// if (frame.size.height > limitFrame.size.height)
// frame.size.height = limitFrame.size.height;
// if (frame.size.width > limitFrame.size.width)
// frame.size.width = limitFrame.size.width;
//
// if (frame.origin.x + frame.size.width > limitFrame.origin.x + limitFrame.size.width)
// frame.origin.x = limitFrame.origin.x + limitFrame.size.width - frame.size.width;
// if (frame.origin.y + frame.size.height > limitFrame.origin.y + limitFrame.size.height)
// frame.origin.y = limitFrame.origin.y + limitFrame.size.height - frame.size.height;
//
// return frame;
//}
//
//- (void)setNonActive
//{
// [self.window orderOut:self];
//}
//
- (void)setActive
{
// [self.window orderFront:self];
[self fadeIn];
}
#pragma mark -
#pragma mark Misc interactions
- (void)hideMouse
{
[NSCursor setHiddenUntilMouseMoves:YES];
}
//
//- (void)setVoutWasUpdated:(VLCWindow *)voutWindow
//{
// _associatedVoutWindow = voutWindow;
//
// NSRect voutRect = voutWindow.frame;
// if (!NSEqualRects(_associatedVoutFrame, voutRect)) {
// _associatedVoutFrame = voutRect;
// [[NSUserDefaults standardUserDefaults] setObject:NSStringFromRect(_associatedVoutFrame) forKey:kAssociatedFullscreenRect];
//
// [self centerPanel];
// }
//
//}
//
#pragma mark -
#pragma mark Autohide timer management
- (void)startAutohideTimer
{
/* Do nothing if timer is already in place */
if (_isCounting)
return;
/* Get timeout and make sure it is not lower than 1 second */
long long _timeToKeepVisibleInSec = MAX(var_CreateGetInteger(getIntf(), "mouse-hide-timeout") / 1000, 1);
_hideTimer = [NSTimer scheduledTimerWithTimeInterval:_timeToKeepVisibleInSec
target:self
selector:@selector(autohideCallback:)
userInfo:nil
repeats:NO];
_isCounting = YES;
}
- (void)stopAutohideTimer
{
[_hideTimer invalidate];
_isCounting = NO;
}
- (void)autohideCallback:(NSTimer *)timer
{
if (!NSMouseInRect([NSEvent mouseLocation], [_controlsView frame], NO)) {
[self fadeOut];
[self hideMouse];
}
_isCounting = NO;
}
//
//#pragma mark -
//#pragma mark Helpers
//
//
///**
// Create an image mask for the NSVisualEffectView
// with rounded corners in the given rect
//
// This is necessary as clipping the VisualEffectView using the layers
// rounded corners is not possible when using the NSColor clearColor
// as background color.
//
// \note The returned image will have the necessary \c capInsets and
// \c capResizingMode set.
//
// \param bounds The rect for the image size
// */
//- (NSImage *)maskImageWithBounds:(NSRect)bounds
//{
// static const float radius = 8.0;
// NSImage *img = [NSImage imageWithSize:bounds.size flipped:YES drawingHandler:^BOOL(NSRect dstRect) {
// NSBezierPath *path = [NSBezierPath bezierPathWithRoundedRect:bounds xRadius:radius yRadius:radius];
// [[NSColor blackColor] setFill];
// [path fill];
// return YES;
// }];
// [img setCapInsets:NSEdgeInsetsMake(radius, radius, radius, radius)];
// [img setResizingMode:NSImageResizingModeStretch];
// return img;
//}
//
///**
// Injects the visual effect view in the Windows view hierarchy
//
// This is necessary as we can't use the NSVisualEffect view on
// all macOS Versions and therefore need to dynamically insert it.
//
// */
//- (void)injectVisualEffectView
//{
// /* Setup the view */
// NSVisualEffectView *view = [[NSVisualEffectView alloc] initWithFrame:self.window.contentView.frame];
// [view setMaskImage:[self maskImageWithBounds:self.window.contentView.bounds]];
// [view setBlendingMode:NSVisualEffectBlendingModeBehindWindow];
// [view setMaterial:NSVisualEffectMaterialDark];
// [view setState:NSVisualEffectStateActive];
// [view setAutoresizesSubviews:YES];
//
// /* Inject view in view hierarchy */
// [self.window setContentView:view];
// [_controlsView setAppearance:[NSAppearance appearanceNamed:NSAppearanceNameVibrantDark]];
// [self.window.contentView addSubview:_controlsView];
//}
//
//- (void)dealloc
//{
// [self stopAutohideTimer];
//}
//
@end
//
// testViewTwo.h
// Pseudo-VLC
//
// Created by Daksh Shah on 31/07/18.
//
#import <Cocoa/Cocoa.h>
@interface VLCDraggablePanelView : NSView
@property(readonly) BOOL mouseDownCanMoveWindow;
@property(readwrite) NSPoint lastDragLocation;
@end
//
// testViewTwo.m
// Pseudo-VLC
//
// Created by Daksh Shah on 31/07/18.
//
#import "VLCDraggablePanelView.h"
#import "VLCDraggablePanelController.h"
@implementation VLCDraggablePanelView
- (BOOL)mouseDownCanMoveWindow
{
return NO;
}
- (void)drawRect:(NSRect)dirtyRect {
[super drawRect:dirtyRect];
CGContextRef context = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
CGContextSetRGBFillColor(context, 1, 1, 1, 0.6);
CGContextFillRect(context, NSRectToCGRect(dirtyRect));
}
- (BOOL) acceptsFirstMouse:(NSEvent *)theEvent
{
return YES;
}
- (void)mouseDown:(NSEvent *)theEvent
{
NSLog(@"mouseDown"); //Debug-Statement
_lastDragLocation = [theEvent locationInWindow];
}
- (void)mouseDragged:(NSEvent *)theEvent
{
NSLog(@"mouseDragged"); //Debug-Statement
NSPoint newDragLocation = [[self superview] convertPoint:[theEvent locationInWindow] fromView:nil];
NSPoint thisOrigin = [self frame].origin;
thisOrigin.x += (-self.lastDragLocation.x + newDragLocation.x);
thisOrigin.y += (-self.lastDragLocation.y + newDragLocation.y);
[self setFrameOrigin:thisOrigin];
self.lastDragLocation = newDragLocation;
}
@end
......@@ -63,6 +63,10 @@
- (void)setActive;
- (void)setNonActive;
- (void)setVoutWasUpdated:(VLCWindow *)voutWindow;
- (void)centerPanel; //Have to find a better alternative than to centering each time on resize/drag
- (void)fixTitleBar;
- (void)unFixTitleBar;
- (void)setSeekable:(BOOL)seekable;
- (void)setVolumeLevel:(int)value;
......
......@@ -233,6 +233,25 @@ static NSString *kAssociatedFullscreenRect = @"VLCFullscreenAssociatedWindowRect
[_mediaTitle setStringValue:title];
}
- (void)fixTitleBar
{
//Issue-3, the titleBar should be shown/hidden only for the respective window of FSPanel...
_associatedVoutWindow.styleMask = NSTitledWindowMask | NSClosableWindowMask | NSResizableWindowMask
| NSMiniaturizableWindowMask;
// [self showTitleBar];
//[_associatedVoutWindow showControlsBar]; //It apparently does not have showControlsBar, because it is a NSWindow... would have to figure out a way to hide/show it
}
-(void)unFixTitleBar
{
_associatedVoutWindow.styleMask |= NSFullSizeContentViewWindowMask;
}
- (void)hideTitleBar
{
[[[[_associatedVoutWindow standardWindowButton:NSWindowCloseButton] superview] animator] setAlphaValue:0];
}
- (void)updatePositionAndTime
{
input_thread_t *p_input = pl_CurrentInput(getIntf());
......@@ -322,13 +341,13 @@ static NSString *kAssociatedFullscreenRect = @"VLCFullscreenAssociatedWindowRect
- (void)centerPanel
{
NSRect windowFrame = [self.window frame];
windowFrame = [self contrainFrameToAssociatedVoutWindow:windowFrame];
/* Calculate coordinates for centered position */
NSRect limitFrame = _associatedVoutWindow.frame;
windowFrame.origin.x = (limitFrame.size.width - windowFrame.size.width) / 2 + limitFrame.origin.x;
windowFrame.origin.y = (limitFrame.size.height / 5) - windowFrame.size.height + limitFrame.origin.y;
windowFrame = [self contrainFrameToAssociatedVoutWindow:windowFrame];
[self.window setFrame:windowFrame display:YES animate:NO];
}
......@@ -420,6 +439,11 @@ static NSString *kAssociatedFullscreenRect = @"VLCFullscreenAssociatedWindowRect
if (!NSMouseInRect([NSEvent mouseLocation], [self.window frame], NO)) {
[self fadeOut];
[self hideMouse];
//Issue-3 //maybe not the right way to go about it. Why hide titleBars for all vout windows? and maybe this should not be a part of draggablepanel at all
[[[VLCMain sharedInstance] voutProvider] updateDraggablePanelsUsingBlock:^(VLCFSPanelController *draggablepanel) {
[draggablepanel hideTitleBar];
}];
}
_isCounting = NO;
}
......
......@@ -34,10 +34,12 @@
- (void)mouseDown:(NSEvent *)event
{
NSLog(@"mouseDown"); //Debug-Statement
NSWindow *window = [self window];
NSRect mouseLocationInWindow = {[event locationInWindow], {0,0}};
NSPoint originalMouseLocation = [window convertRectToScreen:mouseLocationInWindow].origin;
NSRect originalFrame = [window frame];
NSLog(@"%f",originalFrame.origin.x); //Debug-Statement
while (YES)
{
......
......@@ -215,9 +215,6 @@ static const float f_min_window_height = 307.;
// Set that here as IB seems to be buggy
[self setContentMinSize:NSMakeSize(604., f_min_window_height)];
_fspanel = [[VLCFSPanelController alloc] init];
[_fspanel showWindow:self];
/* make sure we display the desired default appearance when VLC launches for the first time */
if (![defaults objectForKey:@"VLCFirstRun"]) {
[defaults setObject:[NSDate date] forKey:@"VLCFirstRun"];
......@@ -371,7 +368,7 @@ static const float f_min_window_height = 307.;
}
// Show split view and hide the video view
- (void)makeSplitViewVisible
- (void)makeSplitViewVisible//making the playlist view visible
{
[self setContentMinSize: NSMakeSize(604., f_min_window_height)];
......@@ -388,8 +385,7 @@ static const float f_min_window_height = 307.;
[self.videoView setHidden:YES];
[_splitView setHidden:NO];
if (self.nativeFullscreenMode && [self fullscreen]) {
[self showControlsBar];
[self.fspanel setNonActive];
// [self.fspanel setNonActive];
}
[self makeFirstResponder:_playlistScrollView];
......@@ -404,7 +400,7 @@ static const float f_min_window_height = 307.;
[self.videoView setHidden:NO];
if (self.nativeFullscreenMode && [self fullscreen]) {
[self hideControlsBar];
[self.fspanel setActive];
// [self.fspanel setActive];
}
if ([[self.videoView subviews] count] > 0)
......@@ -415,7 +411,7 @@ static const float f_min_window_height = 307.;
{
// Beware, this code is really ugly
msg_Dbg(getIntf(), "toggle playlist from state: removed splitview %i, minimized view %i. Event %i", b_splitview_removed, b_minimized_view, event);
msg_Err(getIntf(), "toggle playlist from state: removed splitview %i, minimized view %i. Event %i", b_splitview_removed, b_minimized_view, event);
if (![self isVisible] && event == psUserMenuEvent) {
[self makeKeyAndOrderFront: nil];
return;
......@@ -473,7 +469,7 @@ static const float f_min_window_height = 307.;
}
}
msg_Dbg(getIntf(), "toggle playlist to state: removed splitview %i, minimized view %i", b_splitview_removed, b_minimized_view);
msg_Err(getIntf(), "toggle playlist to state: removed splitview %i, minimized view %i", b_splitview_removed, b_minimized_view);
}
- (IBAction)dropzoneButtonAction:(id)sender
......@@ -484,8 +480,15 @@ static const float f_min_window_height = 307.;
#pragma mark -
#pragma mark overwritten default functionality
- (void)windowDidMove:(NSNotification *)notification{
[[self draggablepanel] centerPanel];
msg_Err(getIntf(),"windowDidMove so I am re-centering the draggablepanel"); //Debug-Statement
NSLog(@"%f",[self frame].origin.x); //Debug-Statement
}
- (void)windowResizedOrMoved:(NSNotification *)notification
{
//What is this for? It does not get trigger on neither resize nor move. And it does not seem to be in apple documentation
[self saveFrameUsingName:[self frameAutosaveName]];
}
......@@ -570,7 +573,12 @@ static const float f_min_window_height = 307.;
- (void)updateTimeSlider
{
[self.controlsBar updateTimeSlider];
[self.fspanel updatePositionAndTime];
// [[[[VLCMain sharedInstance] voutProvider] fspanel] updatePositionAndTime];
[self.draggablepanel updatePositionAndTime];
[[[VLCMain sharedInstance] voutProvider] updateDraggablePanelsUsingBlock:^(VLCFSPanelController *draggablepanel) {
[draggablepanel updatePositionAndTime];
}];
[[[VLCMain sharedInstance] voutProvider] updateControlsBarsUsingBlock:^(VLCControlsBarCommon *controlsBar) {
[controlsBar updateTimeSlider];
......@@ -626,7 +634,12 @@ static const float f_min_window_height = 307.;
[o_window setTitle:aString];
}];
[self.fspanel setStreamTitle: aString];
// [[[[VLCMain sharedInstance] voutProvider] fspanel] setStreamTitle: aString];
[self.draggablepanel setStreamTitle: aString];
[[[VLCMain sharedInstance] voutProvider] updateDraggablePanelsUsingBlock:^(VLCFSPanelController *draggablepanel) {
[draggablepanel setStreamTitle: aString];
}];
} else {
[self setTitle: _NS("VLC media player")];
[self setRepresentedURL: nil];
......@@ -658,8 +671,14 @@ static const float f_min_window_height = 307.;
}
[self updateTimeSlider];
if ([self.fspanel respondsToSelector:@selector(setSeekable:)])
[self.fspanel setSeekable: b_seekable];
if ([self.draggablepanel respondsToSelector:@selector(setSeekable:)])
[self.draggablepanel setSeekable: b_seekable];
[[[VLCMain sharedInstance] voutProvider] updateDraggablePanelsUsingBlock:^(VLCFSPanelController *draggablepanel) {
if ([draggablepanel respondsToSelector:@selector(setSeekable:)])
[draggablepanel setSeekable: b_seekable];
}];
// if ([ [ [[VLCMain sharedInstance] voutProvider] fspanel] respondsToSelector:@selector(setSeekable:) ])
// [[[[VLCMain sharedInstance] voutProvider] fspanel] setSeekable: b_seekable];
PL_LOCK;
if ([[[[VLCMain sharedInstance] playlist] model] currentRootType] != ROOT_TYPE_PLAYLIST ||
......@@ -676,27 +695,42 @@ static const float f_min_window_height = 307.;
- (void)setPause
{
[self.controlsBar setPause];
[self.fspanel setPause];
// [[[[VLCMain sharedInstance] voutProvider] fspanel] setPause];
[self.draggablepanel setPause];
[[[VLCMain sharedInstance] voutProvider] updateControlsBarsUsingBlock:^(VLCControlsBarCommon *controlsBar) {
[controlsBar setPause];
}];
[[[VLCMain sharedInstance] voutProvider] updateDraggablePanelsUsingBlock:^(VLCFSPanelController *draggablepanel) {
[draggablepanel setPause];
}];
}
- (void)setPlay
{
[self.controlsBar setPlay];
[self.fspanel setPlay];
[self.draggablepanel setPlay];
// [[[[VLCMain sharedInstance] voutProvider] fspanel] setPlay];
[[[VLCMain sharedInstance] voutProvider] updateControlsBarsUsingBlock:^(VLCControlsBarCommon *controlsBar) {
[controlsBar setPlay];
}];
[[[VLCMain sharedInstance] voutProvider] updateDraggablePanelsUsingBlock:^(VLCFSPanelController *draggablepanel) {
[draggablepanel setPlay];
}];
}
- (void)updateVolumeSlider
{
[(VLCMainWindowControlsBar *)[self controlsBar] updateVolumeSlider];
[self.fspanel setVolumeLevel:[[VLCCoreInteraction sharedInstance] volume]];
// [self.fspanel setVolumeLevel:[[VLCCoreInteraction sharedInstance] volume]];
[self.draggablepanel setVolumeLevel:[[VLCCoreInteraction sharedInstance] volume]];
[[[VLCMain sharedInstance] voutProvider] updateDraggablePanelsUsingBlock:^(VLCFSPanelController *draggablepanel) {
[draggablepanel setVolumeLevel:[[VLCCoreInteraction sharedInstance] volume]];
}];
// msg_Err(getIntf(), "DAX WAS HERE #10 updateVolumeSlider");
// [[[[VLCMain sharedInstance] voutProvider] fspanel] setVolumeLevel:[[VLCCoreInteraction sharedInstance] volume] ];
}
#pragma mark -
......@@ -710,9 +744,21 @@ static const float f_min_window_height = 307.;
- (void)setVideoplayEnabled
{
NSLog(@"Hey there, check this out! :D");
BOOL b_videoPlayback = [[VLCMain sharedInstance] activeVideoPlayback];
//b_videoPlayback (here) is same as b_activeVideo (changePlaylistState)
if (!b_videoPlayback) {
msg_Err(getIntf(), "Going from VIDEO TO PLAYLIST");//Debug-Statement
NSLog(@"Active Video: %hhd, setting Titled Window",b_videoPlayback);//Debug-Statement
//Issue-3
self.styleMask = NSTitledWindowMask | NSClosableWindowMask | NSResizableWindowMask | NSMiniaturizableWindowMask;
[[[[[[VLCMain sharedInstance] mainWindow] standardWindowButton:NSWindowCloseButton] superview] animator] setAlphaValue:1];
[self showControlsBar];
[[self draggablepanel] fadeOut];
[[self draggablepanel] setNonActive];
if (!self.nonembedded && (!self.nativeFullscreenMode || (self.nativeFullscreenMode && !self.fullscreen)) && frameBeforePlayback.size.width > 0 && frameBeforePlayback.size.height > 0) {
// only resize back to minimum view of this is still desired final state
......@@ -740,15 +786,11 @@ static const float f_min_window_height = 307.;
// restore alpha value to 1 for the case that macosx-opaqueness is set to < 1
[self setAlphaValue:1.0];
}
else{
NSLog(@"Active Video: %hhd, setting FullSize Window",b_videoPlayback);//Debug-Statement
// self.styleMask |= NSFullSizeContentViewWindowMask;
// [self hideControlsBar];
if (self.nativeFullscreenMode) {
if ([self hasActiveVideo] && [self fullscreen] && b_videoPlayback) {
[self hideControlsBar];
[self.fspanel setActive];
} else {
[self showControlsBar];
[self.fspanel setNonActive];
}
}
}
......@@ -757,15 +799,11 @@ static const float f_min_window_height = 307.;
- (void)showFullscreenController
{
id currentWindow = [NSApp keyWindow];
if ([currentWindow respondsToSelector:@selector(hasActiveVideo)] && [currentWindow hasActiveVideo]) {
if ([currentWindow respondsToSelector:@selector(fullscreen)] && [currentWindow fullscreen] && ![[currentWindow videoView] isHidden]) {
if ([[VLCMain sharedInstance] activeVideoPlayback])
[self.fspanel fadeIn];
}
}
//see if we need it...
// id currentWindow = [NSApp keyWindow];
// if ([currentWindow respondsToSelector:@selector(hasActiveVideo)] && [currentWindow hasActiveVideo]) {
// [self.draggablepanel setActive];