]> git.sesse.net Git - vlc/blobdiff - modules/gui/macosx/intf.m
* ALL: ported the WX-bookmarks-window to Cocoa (closes #22)
[vlc] / modules / gui / macosx / intf.m
index 5e58cc188cb099ac74b2dc48a035511ac045de86..f24de7e281ada258b1292e2ffe7fb20d9d90a4de 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * intf.m: MacOS X interface module
  *****************************************************************************
- * Copyright (C) 2002-2005 VideoLAN
+ * Copyright (C) 2002-2005 the VideoLAN team
  * $Id$
  *
  * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
@@ -39,6 +39,8 @@
 #include "about.h"
 #include "open.h"
 #include "wizard.h"
+#include "extended.h"
+#include "bookmarks.h"
 
 /*****************************************************************************
  * Local prototypes.
@@ -298,6 +300,8 @@ static VLCMain *_o_sharedMainInstance = nil;
     o_prefs = nil;
     o_open = [[VLCOpen alloc] init];
     o_wizard = [[VLCWizard alloc] init];
+    o_extended = [[VLCExtended alloc] init];
+    o_bookmarks = [[VLCBookmarks alloc] init];
 
     i_lastShownVolume = -1;
     return _o_sharedMainInstance;
@@ -422,6 +426,17 @@ static VLCMain *_o_sharedMainInstance = nil;
     }
 }
 
+- (void)dealloc
+{
+    [o_about release];
+    [o_prefs release];
+    [o_open release];
+    [o_extended release];
+    [o_bookmarks release];
+    
+    [super dealloc];
+}
+
 - (void)initStrings
 {
     [o_window setTitle: _NS("VLC - Controller")];
@@ -444,7 +459,7 @@ static VLCMain *_o_sharedMainInstance = nil;
     [o_msgs_btn_crashlog setTitle: _NS("Open CrashLog")];
 
     /* main menu */
-    [o_mi_about setTitle: _NS("About VLC media player")];
+    [o_mi_about setTitle: _NS("About VLC media player...")];
     [o_mi_prefs setTitle: _NS("Preferences...")];
     [o_mi_add_intf setTitle: _NS("Add Interface")];
     [o_mu_add_intf setTitle: _NS("Add Interface")];
@@ -527,6 +542,8 @@ static VLCMain *_o_sharedMainInstance = nil;
     [o_mi_close_window setTitle: _NS("Close Window")];
     [o_mi_controller setTitle: _NS("Controller")];
     [o_mi_equalizer setTitle: _NS("Equalizer")];
+    [o_mi_extended setTitle: _NS("Extended controls")];
+    [o_mi_bookmarks setTitle: _NS("Bookmarks")];
     [o_mi_playlist setTitle: _NS("Playlist")];
     [o_mi_info setTitle: _NS("Info")];
     [o_mi_messages setTitle: _NS("Messages")];
@@ -549,8 +566,10 @@ static VLCMain *_o_sharedMainInstance = nil;
 
     /* error panel */
     [o_error setTitle: _NS("Error")];
-    [o_err_lbl setStringValue: _NS("An error has occurred which probably prevented the execution of your request:")];
-    [o_err_bug_lbl setStringValue: _NS("If you believe that it is a bug, please follow the instructions at:")];
+    [o_err_lbl setStringValue: _NS("An error has occurred which probably " \
+        "prevented the execution of your request:")];
+    [o_err_bug_lbl setStringValue: _NS("If you believe that it is a bug, " \
+        "please follow the instructions at:")];
     [o_err_btn_msgs setTitle: _NS("Open Messages Window")];
     [o_err_btn_dismiss setTitle: _NS("Dismiss")];
     [o_err_ckbk_surpress setTitle: _NS("Suppress further errors")];
@@ -716,7 +735,6 @@ static VLCMain *_o_sharedMainInstance = nil;
         case NSDeleteFunctionKey:
         case NSDeleteCharFunctionKey:
         case NSBackspaceCharacter:
-            return YES;
         case NSUpArrowFunctionKey:
         case NSDownArrowFunctionKey:
         case NSRightArrowFunctionKey:
@@ -764,7 +782,25 @@ static VLCMain *_o_sharedMainInstance = nil;
     {
         return o_info;
     }
-    return  nil;
+    return nil;
+}
+
+- (id)getWizard
+{
+    if ( o_wizard )
+    {
+        return o_wizard;
+    }
+    return nil;
+}
+
+- (id)getBookmarks
+{
+    if ( o_bookmarks )
+    {
+        return o_bookmarks;
+    }
+    return nil;
 }
 
 - (void)manage
@@ -982,7 +1018,7 @@ static VLCMain *_o_sharedMainInstance = nil;
         if( p_intf->p_sys->b_volume_update )
         {
             NSString *o_text;
-            o_text = [NSString stringWithFormat: _NS("Volume: %d"), i_lastShownVolume * 200 / AOUT_VOLUME_MAX];
+            o_text = [NSString stringWithFormat: _NS("Volume: %d%%"), i_lastShownVolume * 400 / AOUT_VOLUME_MAX];
             if( i_lastShownVolume != -1 )
             [self setScrollField:o_text stopAfter:1000000];
 
@@ -1300,6 +1336,14 @@ static VLCMain *_o_sharedMainInstance = nil;
     playlist_t * p_playlist;
     vout_thread_t * p_vout;
 
+#define p_input p_intf->p_sys->p_input
+    if( p_input )
+    {
+        vlc_object_release( p_input );
+        p_input = NULL;
+    }
+#undef p_input
+
     /* Stop playback */
     if( ( p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
                                         FIND_ANYWHERE ) ) )
@@ -1430,15 +1474,52 @@ static VLCMain *_o_sharedMainInstance = nil;
     {
         nib_wizard_loaded = [NSBundle loadNibNamed:@"Wizard" owner:self];
         [o_wizard initStrings];
+        [o_wizard resetWizard];
         [o_wizard showWizard];
     } else {
+        [o_wizard resetWizard];
         [o_wizard showWizard];
     }
 }
 
+- (IBAction)showExtended:(id)sender
+{
+    /* we need the wizard-nib for the bookmarks's extract functionality */
+    if (!nib_wizard_loaded)
+    {
+        nib_wizard_loaded = [NSBundle loadNibNamed:@"Wizard" owner:self];
+    }
+
+    if (!nib_extended_loaded)
+    {
+        nib_extended_loaded = [NSBundle loadNibNamed:@"Extended" owner:self];
+        [o_extended initStrings];
+        [o_extended showPanel];
+    } else {
+        [o_extended showPanel];
+    }
+}
+
+- (IBAction)showBookmarks:(id)sender
+{
+    if (!nib_bookmarks_loaded)
+    {
+        nib_bookmarks_loaded = [NSBundle loadNibNamed:@"Bookmarks" owner:self];
+        [o_bookmarks showBookmarks];
+    } else {
+        [o_bookmarks showBookmarks];
+    }
+}
+
 - (IBAction)viewAbout:(id)sender
 {
-    [o_about showPanel];
+    if (!nib_about_loaded)
+    {
+        nib_about_loaded = [NSBundle loadNibNamed:@"About" owner:self];
+        [o_about showPanel];
+    } else {
+        [o_about showPanel];
+    }
 }
 
 - (IBAction)viewPreferences:(id)sender