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

macosx: resizing fixes for the minimized state. additionally, make sure we...

macosx: resizing fixes for the minimized state. additionally, make sure we restore the state last present on quit. (close #6122)
parent b27649e5
......@@ -21,16 +21,16 @@
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="4722"/>
<integer value="4850"/>
<integer value="1617"/>
<integer value="2770"/>
<integer value="21"/>
<integer value="283"/>
<integer value="4722"/>
<integer value="915"/>
<integer value="29"/>
<integer value="4596"/>
<integer value="1617"/>
<integer value="2730"/>
<integer value="29"/>
<integer value="2770"/>
<integer value="4682"/>
<integer value="915"/>
<integer value="4850"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
......@@ -62,7 +62,6 @@
<nil key="NSViewClass"/>
<nil key="NSUserInterfaceItemIdentifier"/>
<string key="NSWindowContentMaxSize">{1.7976931348623157e+308, 1.7976931348623157e+308}</string>
<string key="NSWindowContentMinSize">{604, 310}</string>
<object class="NSView" key="NSWindowView" id="429932428">
<reference key="NSNextResponder"/>
<int key="NSvFlags">256</int>
......@@ -342,6 +341,39 @@
<int key="NSMaximumRecents">10</int>
</object>
</object>
<object class="NSImageView" id="447614808">
<reference key="NSNextResponder" ref="440594360"/>
<int key="NSvFlags">266</int>
<object class="NSMutableSet" key="NSDragTypes">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="set.sortedObjects">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>Apple PDF pasteboard type</string>
<string>Apple PICT pasteboard type</string>
<string>Apple PNG pasteboard type</string>
<string>NSFilenamesPboardType</string>
<string>NeXT Encapsulated PostScript v1.2 pasteboard type</string>
<string>NeXT TIFF v4.0 pasteboard type</string>
</object>
</object>
<string key="NSFrame">{{0, 251}, {403, 23}}</string>
<reference key="NSSuperview" ref="440594360"/>
<int key="NSViewLayerContentsRedrawPolicy">2</int>
<bool key="NSEnabled">YES</bool>
<object class="NSImageCell" key="NSCell" id="660513772">
<int key="NSCellFlags">130560</int>
<int key="NSCellFlags2">33554432</int>
<object class="NSCustomResource" key="NSContents">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">topbar_background</string>
</object>
<int key="NSAlign">0</int>
<int key="NSScale">1</int>
<int key="NSStyle">0</int>
<bool key="NSAnimates">NO</bool>
</object>
<bool key="NSEditable">YES</bool>
</object>
<object class="NSScrollView" id="915491793">
<reference key="NSNextResponder" ref="440594360"/>
<int key="NSvFlags">4370</int>
......@@ -559,39 +591,6 @@
<reference key="NSHeaderClipView" ref="576307303"/>
<bytes key="NSScrollAmts">QSAAAEEgAABBiAAAQYgAAA</bytes>
</object>
<object class="NSImageView" id="447614808">
<reference key="NSNextResponder" ref="440594360"/>
<int key="NSvFlags">266</int>
<object class="NSMutableSet" key="NSDragTypes">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="set.sortedObjects">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>Apple PDF pasteboard type</string>
<string>Apple PICT pasteboard type</string>
<string>Apple PNG pasteboard type</string>
<string>NSFilenamesPboardType</string>
<string>NeXT Encapsulated PostScript v1.2 pasteboard type</string>
<string>NeXT TIFF v4.0 pasteboard type</string>
</object>
</object>
<string key="NSFrame">{{0, 251}, {403, 23}}</string>
<reference key="NSSuperview" ref="440594360"/>
<int key="NSViewLayerContentsRedrawPolicy">2</int>
<bool key="NSEnabled">YES</bool>
<object class="NSImageCell" key="NSCell" id="660513772">
<int key="NSCellFlags">130560</int>
<int key="NSCellFlags2">33554432</int>
<object class="NSCustomResource" key="NSContents">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">topbar_background</string>
</object>
<int key="NSAlign">0</int>
<int key="NSScale">1</int>
<int key="NSStyle">0</int>
<bool key="NSAnimates">NO</bool>
</object>
<bool key="NSEditable">YES</bool>
</object>
</object>
<string key="NSFrame">{{201, 0}, {403, 274}}</string>
<reference key="NSSuperview" ref="302568132"/>
......@@ -1151,7 +1150,6 @@
<int key="NSViewLayerContentsRedrawPolicy">2</int>
</object>
<string key="NSScreenRect">{{0, 0}, {1280, 778}}</string>
<string key="NSMinSize">{604, 332}</string>
<string key="NSMaxSize">{1.7976931348623157e+308, 1.7976931348623157e+308}</string>
<string key="NSFrameAutosaveName">mainwindow</string>
<bool key="NSWindowIsRestorable">YES</bool>
......@@ -11207,8 +11205,8 @@ LCAuLi4</string>
<string>{{364, 446}, {604, 310}}</string>
<boolean value="YES"/>
<boolean value="NO"/>
<boolean value="YES"/>
<string>{604, 310}</string>
<boolean value="NO"/>
<string>{604, 36}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES"/>
<string>{{816, 490}, {64, 6}}</string>
......
......@@ -142,6 +142,8 @@
- (void)showDropZone;
- (void)hideDropZone;
- (void)showSplitView;
- (void)hideSplitView;
- (void)updateTimeSlider;
- (void)updateVolumeSlider;
- (void)updateWindow;
......
......@@ -122,6 +122,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
- (void)awakeFromNib
{
BOOL b_splitviewShouldBeHidden = NO;
/* setup the styled interface */
b_nativeFullscreenMode = NO;
#ifdef MAC_OS_X_VERSION_10_7
......@@ -244,6 +245,8 @@ static VLCMainWindow *_o_sharedInstance = nil;
[o_volume_up_btn setEnabled: b_mute];
/* interface builder action */
if ([self frame].size.height < 100)
b_splitviewShouldBeHidden = YES;
[self setDelegate: self];
[self setExcludedFromWindowsMenu: YES];
[self setAcceptsMouseMovedEvents: YES];
......@@ -430,10 +433,14 @@ static VLCMainWindow *_o_sharedInstance = nil;
[o_titlebar_view setFrame: NSMakeRect( 0, winrect.size.height - f_titleBarHeight,
winrect.size.width, f_titleBarHeight )];
[[self contentView] addSubview: o_titlebar_view];
[[self contentView] addSubview: o_titlebar_view positioned: NSWindowAbove relativeTo: o_split_view];
if (winrect.size.height > 100)
{
[self setFrame: winrect display:YES animate:YES];
previousSavedFrame = winrect;
}
winrect = [o_split_view frame];
winrect.size.height = winrect.size.height - f_titleBarHeight;
[o_split_view setFrame: winrect];
......@@ -469,6 +476,12 @@ static VLCMainWindow *_o_sharedInstance = nil;
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(someWindowWillMiniaturize:) name: NSWindowWillMiniaturizeNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(applicationWillTerminate:) name: NSApplicationWillTerminateNotification object: nil];
[[VLCMain sharedInstance] playbackModeUpdated];
if (b_splitviewShouldBeHidden)
{
i_lastSplitViewHeight = [o_split_view frame].size.height;
[self hideSplitView];
}
}
#pragma mark -
......@@ -566,7 +579,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
{
NSRect plrect;
plrect = [[o_playlist_table animator] frame];
plrect.size.height = i_lastSplitViewHeight - 22.0; // actual pl top bar height, which differs from its frame
plrect.size.height = i_lastSplitViewHeight - 19.0; // actual pl top bar height, which differs from its frame
[[o_playlist_table animator] setFrame: plrect];
}
......@@ -574,31 +587,13 @@ static VLCMainWindow *_o_sharedInstance = nil;
{
if ((([[NSApp currentEvent] modifierFlags] & NSAlternateKeyMask) != 0) && !b_splitview_removed)
{
NSRect winrect = [self frame];
i_lastSplitViewHeight = [o_split_view frame].size.height;
winrect.size.height = winrect.size.height - i_lastSplitViewHeight;
winrect.origin.y = winrect.origin.y + i_lastSplitViewHeight;
[self setFrame: winrect display: YES animate: YES];
[self performSelector:@selector(hideDropZone) withObject:nil afterDelay:0.1];
b_splitview_removed = YES;
[self hideSplitView];
}
else
{
if (b_splitview_removed)
{
NSRect winrect;
winrect = [self frame];
winrect.size.height = winrect.size.height + i_lastSplitViewHeight;
winrect.origin.y = winrect.origin.y - i_lastSplitViewHeight;
[self setFrame: winrect display: YES animate: YES];
[self performSelector:@selector(resizePlaylistAfterCollapse) withObject: nil afterDelay:0.75];
if (b_dropzone_active)
[self performSelector:@selector(showDropZone) withObject: nil afterDelay:0.3];
b_splitview_removed = NO;
return;
[self showSplitView];
}
if (b_dropzone_active && ![[VLCMain sharedInstance] activeVideoPlayback])
......@@ -992,6 +987,49 @@ static VLCMainWindow *_o_sharedInstance = nil;
[[o_playlist_table animator] setHidden: NO];
}
- (void)hideSplitView
{
NSRect winrect = [self frame];
i_lastSplitViewHeight = [o_split_view frame].size.height;
winrect.size.height = winrect.size.height - i_lastSplitViewHeight;
winrect.origin.y = winrect.origin.y + i_lastSplitViewHeight;
[self setFrame: winrect display: YES animate: YES];
[self performSelector:@selector(hideDropZone) withObject:nil afterDelay:0.1];
if (b_dark_interface)
{
[self setContentMinSize: NSMakeSize( 604., [o_bottombar_view frame].size.height + [o_titlebar_view frame].size.height )];
[self setContentMaxSize: NSMakeSize( FLT_MAX, [o_bottombar_view frame].size.height + [o_titlebar_view frame].size.height )];
}
else
{
[self setContentMinSize: NSMakeSize( 604., [o_bottombar_view frame].size.height )];
[self setContentMaxSize: NSMakeSize( FLT_MAX, [o_bottombar_view frame].size.height )];
}
if (i_lastSplitViewHeight < 100)
i_lastSplitViewHeight = 300; // random reasonable size
b_splitview_removed = YES;
}
- (void)showSplitView
{
if (b_dark_interface)
[self setContentMinSize:NSMakeSize( 604., 288. + [o_titlebar_view frame].size.height )];
else
[self setContentMinSize:NSMakeSize( 604., 288. )];
[self setContentMaxSize: NSMakeSize( FLT_MAX, FLT_MAX )];
NSRect winrect;
winrect = [self frame];
winrect.size.height = winrect.size.height + i_lastSplitViewHeight;
winrect.origin.y = winrect.origin.y - i_lastSplitViewHeight;
[self setFrame: winrect display: YES animate: YES];
[self performSelector:@selector(resizePlaylistAfterCollapse) withObject: nil afterDelay:0.75];
[self performSelector:@selector(updateWindow) withObject: nil afterDelay:0.3];
b_splitview_removed = NO;
}
- (void)updateTimeSlider
{
input_thread_t * p_input;
......
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