]> git.sesse.net Git - vlc/commitdiff
* Finally fixed the issue with resizing the controller and the broken playlist view...
authorDerk-Jan Hartman <hartman@videolan.org>
Thu, 17 Feb 2005 01:53:50 +0000 (01:53 +0000)
committerDerk-Jan Hartman <hartman@videolan.org>
Thu, 17 Feb 2005 01:53:50 +0000 (01:53 +0000)
extras/MacOSX/Resources/English.lproj/MainMenu.nib/classes.nib
extras/MacOSX/Resources/English.lproj/MainMenu.nib/info.nib
extras/MacOSX/Resources/English.lproj/MainMenu.nib/objects.nib
modules/gui/macosx/intf.h
modules/gui/macosx/intf.m
modules/gui/macosx/misc.m
modules/gui/macosx/playlist.h
modules/gui/macosx/playlist.m

index bffb82d8352d00a89412ee2ee9b9987ec0a8a456..2513faeab3867f941fb2eb0b9440ecf9f250841d 100644 (file)
                 openWebsite = id; 
                 reportABug = id; 
                 timesliderUpdate = id; 
+                togglePlaylist = id; 
                 viewAbout = id; 
                 viewPreferences = id; 
             }; 
                 "o_btn_fullscreen" = id; 
                 "o_btn_next" = id; 
                 "o_btn_play" = id; 
+                "o_btn_playlist" = id; 
                 "o_btn_prev" = id; 
                 "o_btn_rewind" = id; 
                 "o_btn_stop" = id; 
-                "o_clip_view" = id; 
                 "o_controls" = id; 
                 "o_dmi_mute" = id; 
                 "o_dmi_next" = id; 
                 "o_mu_visual" = id; 
                 "o_mu_window" = id; 
                 "o_playlist" = id; 
+                "o_playlist_view" = id; 
                 "o_scrollfield" = id; 
                 "o_timefield" = id; 
                 "o_timeslider" = id; 
                 selectAll = id; 
                 sortNodeByAuthor = id; 
                 sortNodeByName = id; 
-                toggleWindow = id; 
             }; 
             CLASS = VLCPlaylist; 
             LANGUAGE = ObjC; 
             OUTLETS = {
-                "o_btn_playlist" = id; 
                 "o_controller" = id; 
                 "o_ctx_menu" = id; 
                 "o_loop_popup" = id; 
                 "o_mi_sort_name" = id; 
                 "o_mu_services" = id; 
                 "o_outline_view" = id; 
+                "o_playlist_view" = id; 
                 "o_random_ckb" = id; 
                 "o_search_field" = id; 
                 "o_status_field" = id; 
index b4641d66528a4dc0e6484752c54becb71a316c66..8f99c874d6ecdd02f5b80f9755290d262610c871 100644 (file)
@@ -3,13 +3,13 @@
 <plist version="1.0">
 <dict>
        <key>IBDocumentLocation</key>
-       <string>16 61 505 517 0 0 800 578 </string>
+       <string>78 314 505 517 0 0 1280 938 </string>
        <key>IBEditorPositions</key>
        <dict>
                <key>1617</key>
                <string>542 480 104 149 0 0 1024 746 </string>
                <key>2197</key>
-               <string>195 211 596 367 0 0 1280 938 </string>
+               <string>342 573 596 143 0 0 1280 938 </string>
                <key>29</key>
                <string>132 749 419 44 0 0 1280 938 </string>
                <key>915</key>
        <key>IBFramework Version</key>
        <string>364.0</string>
        <key>IBLockedObjects</key>
+       <array/>
+       <key>IBOpenObjects</key>
        <array>
-               <integer>2203</integer>
-               <integer>2208</integer>
-               <integer>2206</integer>
+               <integer>2197</integer>
+               <integer>21</integer>
        </array>
        <key>IBSystem Version</key>
-       <string>7S215</string>
+       <string>7U16</string>
 </dict>
 </plist>
index 5d23ed890a964f20b55bb08b55d91e9864ffbb89..7b7a090abf06a8ba9acffa2d3c709aa6ab7078f6 100644 (file)
Binary files a/extras/MacOSX/Resources/English.lproj/MainMenu.nib/objects.nib and b/extras/MacOSX/Resources/English.lproj/MainMenu.nib/objects.nib differ
index 094be51cd9a0e62fbfcee1608c4050086d57fa73..d1f552a4174a89ad1bbb7c148720f843bb2838d4 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * intf.h: MacOS X interface module
  *****************************************************************************
- * Copyright (C) 2002-2004 VideoLAN
+ * Copyright (C) 2002-2005 VideoLAN
  * $Id$
  *
  * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
@@ -87,7 +87,7 @@ struct intf_sys_t
     BOOL nib_open_loaded;       /* reference to the open-nib */
 
     IBOutlet id o_window;       /* main window    */
-    IBOutlet id o_clip_view;    /* playlist clipview    */
+    IBOutlet id o_playlist_view;/* playlist view  */
     IBOutlet id o_scrollfield;  /* info field     */
     IBOutlet id o_timefield;    /* time field     */
     IBOutlet id o_timeslider;   /* time slider    */
@@ -102,6 +102,7 @@ struct intf_sys_t
     IBOutlet id o_btn_ff;       /* btn fast forward     */
     IBOutlet id o_btn_next;     /* btn next       */
     IBOutlet id o_btn_fullscreen;/* btn fullscreen      */
+    IBOutlet id o_btn_playlist; /* btn playlist   */
 
     NSImage * o_img_play;       /* btn play img   */
     NSImage * o_img_pause;      /* btn pause img  */
@@ -234,9 +235,8 @@ struct intf_sys_t
     IBOutlet id o_dmi_previous;
     IBOutlet id o_dmi_mute;
     
-    /* stupid outline views .... */
-    NSRect rect_remember;
-    NSView *o_document_view;
+    bool b_small_window;
+    
 }
 
 + (VLCMain *)sharedInstance;
@@ -283,6 +283,9 @@ struct intf_sys_t
 - (IBAction)openLicense:(id)sender;
 - (IBAction)openCrashLog:(id)sender;
 
+- (IBAction)togglePlaylist:(id)sender;
+- (void)updateTogglePlaylistState;
+
 - (void)windowDidBecomeKey:(NSNotification *)o_notification;
 
 @end
index 80680ff95f59389347cebce1900807c716343023..f4defeced0126e52d739c2b98fb3ff0a84787d82 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * intf.m: MacOS X interface module
  *****************************************************************************
- * Copyright (C) 2002-2004 VideoLAN
+ * Copyright (C) 2002-2005 VideoLAN
  * $Id$
  *
  * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
@@ -378,6 +378,22 @@ static VLCMain *_o_sharedMainInstance = nil;
     [self setSubmenusEnabled: FALSE];
     [self manageVolumeSlider];
     [o_window setDelegate: self];
+    
+    if( [o_window frame].size.height <= 200 )
+    {
+        b_small_window = YES;
+        [o_window setFrame: NSMakeRect( [o_window frame].origin.x, [o_window frame].origin.y, [o_window frame].size.width, 95 ) display: YES animate:YES];
+        [o_playlist_view setAutoresizesSubviews: NO];
+    }
+    else
+    {
+        b_small_window = NO;
+        [o_playlist_view setFrame: NSMakeRect( 10, 10, [o_window frame].size.width - 20, [o_window frame].size.height - 105 )];
+        [o_playlist_view setNeedsDisplay:YES];
+        [o_playlist_view setAutoresizesSubviews: YES];
+        [[o_window contentView] addSubview: o_playlist_view];
+    }
+    [self updateTogglePlaylistState];
 
     p_playlist = (playlist_t *) vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
 
@@ -413,6 +429,7 @@ static VLCMain *_o_sharedMainInstance = nil;
     [o_btn_fullscreen setToolTip: _NS("Fullscreen")];
     [o_volumeslider setToolTip: _NS("Volume")];
     [o_timeslider setToolTip: _NS("Position")];
+    [o_btn_playlist setToolTip: _NS("Playlist")];
 
     /* messages panel */
     [o_msgs_panel setTitle: _NS("Messages")];
@@ -1438,31 +1455,80 @@ static VLCMain *_o_sharedMainInstance = nil;
     }
 }
 
+- (IBAction)togglePlaylist:(id)sender
+{
+    NSRect o_rect = [o_window frame];
+    /*First, check if the playlist is visible*/
+    if( o_rect.size.height <= 200 )
+    {
+        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;
+        
+        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;
+        [o_btn_playlist setState: YES];
+    }
+    else
+    {
+        /* make small */
+        o_rect.size.height = 95;
+        o_rect.origin.x = [o_window frame].origin.x;
+        /* 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];
+        b_small_window = NO; /* we aren't small here just yet. we are doing an animated resize after this */
+    }
+
+    [o_window setFrame: o_rect display:YES animate: YES];
+}
+
+- (void)updateTogglePlaylistState
+{
+    if( [o_window frame].size.height <= 200 )
+    {
+        [o_btn_playlist setState: NO];
+    }
+    else
+    {
+        [o_btn_playlist setState: YES];
+    }
+}
+
 - (NSSize)windowWillResize:(NSWindow *)sender toSize:(NSSize)proposedFrameSize
 {
+    /* Not triggered on a window resize or maxification of the window. only by window mouse dragging resize */
     if( proposedFrameSize.height <= 200 )
     {
-        if( [sender frame].size.height > 200 )
+        if( b_small_window == NO )
         {
-            //rect_remember = [[o_playlist playlistView] frame];
-            o_document_view = [o_clip_view documentView];
-            [o_document_view retain];
-            [o_clip_view setDocumentView: NULL];
+            /* if large and going to small then hide */
+            b_small_window = YES;
+            [o_playlist_view setAutoresizesSubviews: NO];
+            [o_playlist_view removeFromSuperview];
         }
         return NSMakeSize( proposedFrameSize.width, 95 );
     }
-    else
+    return proposedFrameSize;
+}
+
+- (void)windowDidResize:(NSNotification *)notif
+{
+    if( [o_window frame].size.height > 200 && b_small_window )
     {
-        if( [sender frame].size.height <= 200 )
-        {
-            [o_clip_view setDocumentView: o_document_view];
-            [o_document_view release];
-            [o_document_view setFrameSize: NSMakeSize( proposedFrameSize.width - 22, proposedFrameSize.height - 120 )];
-            //[[o_playlist playlistView] setFrame: rect_remember];
-        }
-        return proposedFrameSize;
+        /* If large and coming from small then show */
+        [o_playlist_view setAutoresizesSubviews: YES];
+        [o_playlist_view setFrame: NSMakeRect( 10, 10, [o_window frame].size.width - 20, [o_window frame].size.height - 95 - 10 )];
+        [o_playlist_view setNeedsDisplay:YES];
+        [[o_window contentView] addSubview: o_playlist_view];
+        b_small_window = NO;
     }
-    return proposedFrameSize;
+    [self updateTogglePlaylistState];
 }
 
 @end
index 946495b0e009cfed866a84b57c6d77ec91f146f9..f4c2f7181cff3b54499492f58c1980118e5a03bb 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * misc.m: code not specific to vlc
  *****************************************************************************
- * Copyright (C) 2003-2004 VideoLAN
+ * Copyright (C) 2003-2005 VideoLAN
  * $Id$
  *
  * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
@@ -41,7 +41,7 @@
 
     o_size_with_playlist = [self frame].size;
 
-    [[[VLCMain sharedInstance] getPlaylist] updateTogglePlaylistState];
+    [[VLCMain sharedInstance] updateTogglePlaylistState];
 
     return( self );
 }
@@ -59,7 +59,7 @@
     o_size_with_playlist = proposedFrameSize;
 
     /*Callback to update the state of Playlist Toggle Button*/
-    [[[VLCMain sharedInstance] getPlaylist] updateTogglePlaylistState];
+    [[VLCMain sharedInstance] updateTogglePlaylistState];
 
     return proposedFrameSize;
 }
index 81b325666bd74a0d166b9f3b4c83594f16296641..6fee48cf360158920f02382606e9f382a80d63d2 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * playlist.h: MacOS X interface module
  *****************************************************************************
- * Copyright (C) 2002-2004 VideoLAN
+ * Copyright (C) 2002-2005 VideoLAN
  * $Id$
  *
  * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
@@ -39,6 +39,7 @@
     IBOutlet id o_controller;
 
     IBOutlet id o_btn_playlist;
+    IBOutlet id o_playlist_view;
     IBOutlet id o_outline_view;
     IBOutlet id o_tc_name;
     IBOutlet id o_tc_author;
 
 - (void)initStrings;
 - (NSMenu *)menuForEvent:(NSEvent *)o_event;
-- (NSOutlineView *)playlistView;
+- (NSOutlineView *)outlineView;
 
 - (IBAction)handlePopUp:(id)sender;
 - (IBAction)searchItem:(id)sender;
 
-- (void)updateTogglePlaylistState;
 - (void)playlistUpdated;
 - (void)sortNode:(int)i_mode;
 - (void)updateRowSelection;
index d25fc93b56c08f7580e728b4b4e4b66677732373..4fb380cbc8795d25a67cb95daa8b6e056b12d9de 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * playlist.m: MacOS X interface module
  *****************************************************************************
- * Copyright (C) 2002-2004 VideoLAN
+ * Copyright (C) 2002-2005 VideoLAN
  * $Id$
  *
  * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
@@ -25,7 +25,6 @@
 
 /* TODO
  * add 'icons' for different types of nodes? (http://www.cocoadev.com/index.pl?IconAndTextInTableCell)
- * create a new 'playlist toggle' that hides the playlist and in effect give you the old controller
  * 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.
@@ -51,9 +50,6 @@
 #include "osd.h"
 #include "misc.h"
 
-#define REF_HEIGHT 500
-#define REF_WIDTH 500
-
 /*****************************************************************************
  * VLCPlaylistView implementation 
  *****************************************************************************/
@@ -199,75 +195,16 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
 #if 0
     [o_search_button setTitle: _NS("Search")];
 #endif
-    [o_btn_playlist setToolTip: _NS("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")];
 }
 
-- (NSOutlineView *)playlistView
+- (NSOutlineView *)outlineView
 {
     return o_outline_view;
 }
 
-- (IBAction)toggleWindow:(id)sender
-{
-    NSRect o_rect;
-    /*First, check if the playlist is visible*/
-    if ( [o_controller frame].size.height == [o_controller minSize].height )
-    {
-        /*Check if the stored heigth of the controller is usable (!= minSize)*/
-        if ([o_controller getSizeWithPlaylist].height !=
-                                        [o_controller minSize].height)
-        {
-            o_rect.size.height = [o_controller getSizeWithPlaylist].height;
-        }
-        else
-        {
-            /*If the stored height is not usable, use a reference one*/
-            o_rect.size.height = REF_HEIGHT;
-        }
-
-        /*Check if the controller width is the minimum one*/
-        if ( [o_controller frame].size.width == [o_controller minSize].width)
-        {
-            /*If the controller width is minimum, check if the stored height
-              of the playlist makes it visible*/
-            if ([o_controller getSizeWithPlaylist].height !=
-                                               [o_controller minSize].height)
-            {
-                o_rect.size.width = [o_controller getSizeWithPlaylist].width;
-            }
-            else
-            {
-                /*If not, use a reference width*/
-                o_rect.size.width = REF_WIDTH;
-            }
-        }
-        else
-        {
-            o_rect.size.width = [o_controller frame].size.width;
-        }
-        o_rect.origin.x = [o_controller frame].origin.x;
-        o_rect.origin.y = [o_controller frame].origin.y - o_rect.size.height +
-                                                [o_controller minSize].height;
-
-        [o_btn_playlist setState: YES];
-    }
-    else
-    {
-        o_rect.size = [o_controller minSize];
-        o_rect.origin.x = [o_controller frame].origin.x;
-        /*Calculate the position of the lower right corner after resize*/
-        o_rect.origin.y = [o_controller frame].origin.y +
-            [o_controller frame].size.height - [o_controller minSize].height;
-
-        [o_btn_playlist setState: NO];
-    }
-
-    [o_controller setFrame: o_rect display:YES animate: YES];
-}
-
 - (void)playlistUpdated
 {
     unsigned int i;
@@ -286,20 +223,6 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
     [o_outline_view reloadData];
 }
 
-
-- (void)updateTogglePlaylistState
-{
-    if( [o_controller getSizeWithPlaylist].height ==
-                                    [o_controller minSize].height )
-    {
-        [o_btn_playlist setState: NO];
-    }
-    else
-    {
-        [o_btn_playlist setState: YES];
-    }
-}
-
 - (void)updateRowSelection
 {
     int i,i_row;