]> git.sesse.net Git - vlc/blobdiff - modules/gui/macosx/intf.m
Merge branch '1.0'
[vlc] / modules / gui / macosx / intf.m
index 4757ddea3d3082d9a5cfe74c0bdfb9fc81cea8a0..725451ed115ad22b3daedf399d314584781a5cb6 100644 (file)
@@ -54,7 +54,6 @@
 #import "AppleRemote.h"
 #import "eyetv.h"
 #import "simple_prefs.h"
-#import "vlm.h"
 
 #import <AddressBook/AddressBook.h>         /* for crashlog send mechanism */
 #import <IOKit/hidsystem/ev_keymap.h>         /* for the media key support */
@@ -69,6 +68,12 @@ static void * ManageThread( void *user_data );
 static unichar VLCKeyToCocoa( unsigned int i_key );
 static unsigned int VLCModifiersToCocoa( unsigned int i_key );
 
+static void updateProgressPanel (void *, const char *, float);
+static bool checkProgressPanel (void *);
+static void destroyProgressPanel (void *);
+
+static void MsgCallback( msg_cb_data_t *, msg_item_t *, unsigned );
+
 #pragma mark -
 #pragma mark VLC Interface Object Callbacks
 
@@ -176,7 +181,6 @@ static void MsgCallback( msg_cb_data_t *data, msg_item_t *item, unsigned int i )
     vlc_restorecancel( canc );
 }
 
-
 /*****************************************************************************
  * playlistChanged: Callback triggered by the intf-change playlist
  * variable, to let the intf update the playlist.
@@ -231,15 +235,53 @@ static int DialogCallback( vlc_object_t *p_this, const char *type, vlc_value_t p
     NSAutoreleasePool * o_pool = [[NSAutoreleasePool alloc] init];
     VLCMain *interface = (VLCMain *)data;
 
-    const dialog_fatal_t *p_dialog = (const dialog_fatal_t *)value.p_address;
+    if( [[NSString stringWithUTF8String: type] isEqualToString: @"dialog-progress-bar"] )
+    {
+        /* the progress panel needs to update itself and therefore wants special treatment within this context */
+        dialog_progress_bar_t *p_dialog = (dialog_progress_bar_t *)value.p_address;
+
+        p_dialog->pf_update = updateProgressPanel;
+        p_dialog->pf_check = checkProgressPanel;
+        p_dialog->pf_destroy = destroyProgressPanel;
+        p_dialog->p_sys = VLCIntf->p_libvlc;
+    }
 
-    NSValue *o_value = [NSValue valueWithPointer:p_dialog];
+    NSValue *o_value = [NSValue valueWithPointer:value.p_address];
     [[NSNotificationCenter defaultCenter] postNotificationName: @"VLCNewCoreDialogEventNotification" object:[interface coreDialogProvider] userInfo:[NSDictionary dictionaryWithObjectsAndKeys: o_value, @"VLCDialogPointer", [NSString stringWithUTF8String: type], @"VLCDialogType", nil]];
 
     [o_pool release];
     return VLC_SUCCESS;
 }
 
+void updateProgressPanel (void *priv, const char *text, float value)
+{
+    NSAutoreleasePool *o_pool = [[NSAutoreleasePool alloc] init];
+
+    NSString *o_txt;
+    if( text != NULL )
+        o_txt = [NSString stringWithUTF8String: text];
+    else
+        o_txt = @"";
+
+    [[[VLCMain sharedInstance] coreDialogProvider] updateProgressPanelWithText: o_txt andNumber: (double)(value * 1000.)];
+
+    [o_pool release];
+}
+
+void destroyProgressPanel (void *priv)
+{
+    NSAutoreleasePool *o_pool = [[NSAutoreleasePool alloc] init];
+    [[[VLCMain sharedInstance] coreDialogProvider] destroyProgressPanel];
+    [o_pool release];
+}
+
+bool checkProgressPanel (void *priv)
+{
+    NSAutoreleasePool *o_pool = [[NSAutoreleasePool alloc] init];
+    return [[[VLCMain sharedInstance] coreDialogProvider] progressCancelled];
+    [o_pool release];
+}
+
 #pragma mark -
 #pragma mark Private
 
@@ -281,7 +323,6 @@ static VLCMain *_o_sharedMainInstance = nil;
     o_prefs = nil;
     o_open = [[VLCOpen alloc] init];
     o_wizard = [[VLCWizard alloc] init];
-    o_vlm = [[VLCVLMController alloc] init];
     o_extended = nil;
     o_bookmarks = [[VLCBookmarks alloc] init];
     o_embedded_list = [[VLCEmbeddedList alloc] init];
@@ -655,6 +696,7 @@ static VLCMain *_o_sharedMainInstance = nil;
     [o_mu_window setTitle: _NS("Window")];
     [o_mi_minimize setTitle: _NS("Minimize Window")];
     [o_mi_close_window setTitle: _NS("Close Window")];
+    [o_mi_player setTitle: _NS("Player...")];
     [o_mi_controller setTitle: _NS("Controller...")];
     [o_mi_equalizer setTitle: _NS("Equalizer...")];
     [o_mi_extended setTitle: _NS("Extended Controls...")];
@@ -1267,7 +1309,7 @@ static unsigned int VLCModifiersToCocoa( unsigned int i_key )
     unichar key = 0;
     vlc_value_t val;
     unsigned int i_pressed_modifiers = 0;
-    struct hotkey *p_hotkeys;
+    const struct hotkey *p_hotkeys;
     int i;
 
     val.i_int = 0;
@@ -1377,11 +1419,6 @@ static unsigned int VLCModifiersToCocoa( unsigned int i_key )
     return nil;
 }
 
-- (id)vlm
-{
-    return o_vlm;
-}
-
 - (id)bookmarks
 {
     if( o_bookmarks )
@@ -1632,10 +1669,13 @@ static void manage_cleanup( void * args )
         }
 
         [o_btn_stop setEnabled: b_input];
+        [o_embedded_window setStop: b_input];
         [o_btn_ff setEnabled: b_seekable];
         [o_btn_rewind setEnabled: b_seekable];
         [o_btn_prev setEnabled: (b_plmul || b_chapters)];
+        [o_embedded_window setPrev: (b_plmul || b_chapters)];
         [o_btn_next setEnabled: (b_plmul || b_chapters)];
+        [o_embedded_window setNext: (b_plmul || b_chapters)];
 
         [o_timeslider setFloatValue: 0.0];
         [o_timeslider setEnabled: b_seekable];
@@ -1644,6 +1684,7 @@ static void manage_cleanup( void * args )
         [[[self controls] fspanel] setSeekable: b_seekable];
 
         [o_embedded_window setSeekable: b_seekable];
+        [o_embedded_window setTime:@"00:00" position:0.0];
 
         p_intf->p_sys->b_current_title_update = true;
         
@@ -1764,6 +1805,8 @@ static void manage_cleanup( void * args )
         i_volume_step = config_GetInt( p_intf->p_libvlc, "volume-step" );
         [o_volumeslider setFloatValue: (float)i_lastShownVolume / i_volume_step];
         [o_volumeslider setEnabled: TRUE];
+        [o_embedded_window setVolumeSlider: (float)i_lastShownVolume / i_volume_step];
+        [o_embedded_window setVolumeEnabled: TRUE];
         [[[self controls] fspanel] setVolumeLevel: (float)i_lastShownVolume / i_volume_step];
         p_intf->p_sys->b_mute = ( i_lastShownVolume == 0 );
         p_intf->p_sys->b_volume_update = FALSE;
@@ -1901,6 +1944,7 @@ end:
     else
         i_end_scroll = -1;
     [o_scrollfield setStringValue: o_string];
+    [o_embedded_window setScrollString: o_string];
 }
 
 - (void)resetScrollField
@@ -2117,14 +2161,6 @@ end:
     }
 }
 
-- (IBAction)showVLM:(id)sender
-{
-    if( !nib_vlm_loaded )
-        nib_vlm_loaded = [NSBundle loadNibNamed:@"VLM" owner: NSApp];
-
-    [o_vlm showVLMWindow];
-}
-
 - (IBAction)showExtended:(id)sender
 {
     if( o_extended == nil )