From: Benjamin Pracht Date: Tue, 12 Apr 2005 14:31:14 +0000 (+0000) Subject: * intf.* : try to restore an a bit more intelligent behavior for the playlist toggle... X-Git-Tag: 0.8.2~534 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=44c6d658c95fc55d3f7a9129f9dea42ee1bdf067;p=vlc * intf.* : try to restore an a bit more intelligent behavior for the playlist toggle button (remeber previous state, for instance) * misc.* : get rid of unused code. --- diff --git a/modules/gui/macosx/intf.h b/modules/gui/macosx/intf.h index 31e2169fe6..c63b52a1bf 100644 --- a/modules/gui/macosx/intf.h +++ b/modules/gui/macosx/intf.h @@ -234,10 +234,13 @@ struct intf_sys_t IBOutlet id o_dmi_next; IBOutlet id o_dmi_previous; IBOutlet id o_dmi_mute; - + bool b_small_window; - + mtime_t i_end_scroll; + + NSSize o_size_with_playlist; + } + (VLCMain *)sharedInstance; diff --git a/modules/gui/macosx/intf.m b/modules/gui/macosx/intf.m index 10ca87ab09..e2ac383708 100644 --- a/modules/gui/macosx/intf.m +++ b/modules/gui/macosx/intf.m @@ -397,6 +397,8 @@ static VLCMain *_o_sharedMainInstance = nil; } [self updateTogglePlaylistState]; + o_size_with_playlist = [o_window frame].size; + p_playlist = (playlist_t *) vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE ); if( p_playlist ) @@ -1516,8 +1518,21 @@ static VLCMain *_o_sharedMainInstance = nil; { b_small_window = YES; /* we know we are small, make sure this is actually set (see case below) */ /* make large */ - o_rect.size.height = 500; - + if ( o_size_with_playlist.height > 200 ) + { + o_rect.size.height = o_size_with_playlist.height; + } + else + { + o_rect.size.height = 500; + if ( o_rect.size.width == [o_window minSize].width ) + { + o_rect.size.width = 500; + } + + } + o_rect.size.height = (o_size_with_playlist.height > 200) ? + o_size_with_playlist.height : 500; o_rect.origin.x = [o_window frame].origin.x; o_rect.origin.y = [o_window frame].origin.y - o_rect.size.height + [o_window minSize].height; @@ -1531,7 +1546,7 @@ static VLCMain *_o_sharedMainInstance = nil; /* Calculate the position of the lower right corner after resize */ o_rect.origin.y = [o_window frame].origin.y + [o_window frame].size.height - [o_window minSize].height; - + [o_playlist_view setAutoresizesSubviews: NO]; [o_playlist_view removeFromSuperview]; [o_btn_playlist setState: NO]; @@ -1556,6 +1571,11 @@ static VLCMain *_o_sharedMainInstance = nil; - (NSSize)windowWillResize:(NSWindow *)sender toSize:(NSSize)proposedFrameSize { /* Not triggered on a window resize or maxification of the window. only by window mouse dragging resize */ + + /*Stores the size the controller one resize, to be able to restore it when + toggling the playlist*/ + o_size_with_playlist = proposedFrameSize; + if( proposedFrameSize.height <= 200 ) { if( b_small_window == NO ) diff --git a/modules/gui/macosx/misc.h b/modules/gui/macosx/misc.h index fa8a70509d..f656ed2de7 100644 --- a/modules/gui/macosx/misc.h +++ b/modules/gui/macosx/misc.h @@ -25,13 +25,11 @@ * VLCControllerWindow *****************************************************************************/ + @interface VLCControllerWindow : NSWindow { - NSSize o_size_with_playlist; } -- (NSSize)getSizeWithPlaylist; - @end /***************************************************************************** diff --git a/modules/gui/macosx/misc.m b/modules/gui/macosx/misc.m index f4c2f7181c..a85213af28 100644 --- a/modules/gui/macosx/misc.m +++ b/modules/gui/macosx/misc.m @@ -39,8 +39,6 @@ self = [super initWithContentRect:contentRect styleMask:styleMask //& ~NSTitledWindowMask backing:backingType defer:flag]; - o_size_with_playlist = [self frame].size; - [[VLCMain sharedInstance] updateTogglePlaylistState]; return( self ); @@ -51,24 +49,6 @@ return [[VLCMain sharedInstance] hasDefinedShortcutKey:o_event]; } -/*Stores the size the controller one resize, to be able to restore it when - toggling the playlist*/ - -- (NSSize)windowWillResize:(NSWindow *)sender toSize:(NSSize)proposedFrameSize -{ - o_size_with_playlist = proposedFrameSize; - - /*Callback to update the state of Playlist Toggle Button*/ - [[VLCMain sharedInstance] updateTogglePlaylistState]; - - return proposedFrameSize; -} - -- (NSSize)getSizeWithPlaylist -{ - return o_size_with_playlist; -} - @end