]> git.sesse.net Git - vlc/commitdiff
beos/*: fixed title/chapter navigation
authorEric Petit <titer@videolan.org>
Mon, 6 Sep 2004 16:46:25 +0000 (16:46 +0000)
committerEric Petit <titer@videolan.org>
Mon, 6 Sep 2004 16:46:25 +0000 (16:46 +0000)
modules/gui/beos/InterfaceWindow.cpp
modules/gui/beos/MsgVals.h

index 630be2005c6b8d114dfbf6fce5421cd59901d852..965c570627dc9afccce0fcb35e61711b97c62c5b 100644 (file)
@@ -269,13 +269,10 @@ InterfaceWindow::InterfaceWindow( intf_thread_t * _p_intf, BRect frame,
     fNextTitleMI = new BMenuItem( _("Next Title"), new BMessage( NEXT_TITLE ) );
     fPrevChapterMI = new BMenuItem( _("Previous chapter"), new BMessage( PREV_CHAPTER ) );
     fNextChapterMI = new BMenuItem( _("Next chapter"), new BMessage( NEXT_CHAPTER ) );
-    fGotoMenuMI = new BMenuItem( _("Goto Menu"), new BMessage( NAVIGATE_MENU ) );
 
     /* Add the Navigation menu */
     fNavigationMenu = new BMenu( _("Navigation") );
     fMenuBar->AddItem( fNavigationMenu );
-    fNavigationMenu->AddItem( fGotoMenuMI );
-    fNavigationMenu->AddSeparatorItem();
     fNavigationMenu->AddItem( fPrevTitleMI );
     fNavigationMenu->AddItem( fNextTitleMI );
     fNavigationMenu->AddItem( fTitleMenu = new TitleMenu( _("Go to Title"), p_intf ) );
@@ -555,13 +552,6 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
             }
             break;
 
-        case NAVIGATE_MENU:
-            if( p_input )
-            {
-                var_SetInteger( p_input, "title", 0 );
-            }
-            break;
-
         case TOGGLE_TITLE:
         {
             int32 index;
@@ -833,8 +823,8 @@ void InterfaceWindow::UpdateInterface()
     {
         vlc_value_t val;
         p_mediaControl->SetEnabled( true );
-        bool hasTitles   = var_Get( p_input, "title", &val );
-        bool hasChapters = var_Get( p_input, "chapter", &val );
+        bool hasTitles   = !var_Get( p_input, "title", &val );
+        bool hasChapters = !var_Get( p_input, "chapter", &val );
         p_mediaControl->SetStatus( var_GetInteger( p_input, "state" ), 
                                    var_GetInteger( p_input, "rate" ) );
         var_Get( p_input, "position", &val );
@@ -948,7 +938,6 @@ InterfaceWindow::_SetMenusEnabled(bool hasFile, bool hasChapters, bool hasTitles
              fSubtitlesMenu->SetEnabled( hasFile );
         if ( fSpeedMenu->IsEnabled() != hasFile )
              fSpeedMenu->SetEnabled( hasFile );
-        fGotoMenuMI->SetEnabled( true );
         Unlock();
     }
 }
@@ -1296,6 +1285,7 @@ void TitleMenu::AttachedToWindow()
     }
 
     vlc_value_t val;
+    BMessage * message;
     if( !var_Get( p_input, "title", &val ) )
     {
         vlc_value_t val_list, text_list;
@@ -1304,8 +1294,10 @@ void TitleMenu::AttachedToWindow()
         
         for( int i = 0; i < val_list.p_list->i_count; i++ )
         {
+            message = new BMessage( TOGGLE_TITLE );
+            message->AddInt32( "index", val_list.p_list->p_values[i].i_int );
             item = new BMenuItem( text_list.p_list->p_values[i].psz_string,
-                                  NULL );
+                                  message );
             if( val_list.p_list->p_values[i].i_int == val.i_int )
             {
                 item->SetMarked( true );
@@ -1356,6 +1348,7 @@ void ChapterMenu::AttachedToWindow()
     }
 
     vlc_value_t val;
+    BMessage * message;
     if( !var_Get( p_input, "chapter", &val ) )
     {
         vlc_value_t val_list, text_list;
@@ -1364,8 +1357,10 @@ void ChapterMenu::AttachedToWindow()
         
         for( int i = 0; i < val_list.p_list->i_count; i++ )
         {
+            message = new BMessage( TOGGLE_CHAPTER );
+            message->AddInt32( "index", val_list.p_list->p_values[i].i_int );
             item = new BMenuItem( text_list.p_list->p_values[i].psz_string,
-                                  NULL );
+                                  message );
             if( val_list.p_list->p_values[i].i_int == val.i_int )
             {
                 item->SetMarked( true );
index cd71a13797e303609f684352d98efd04bc82ec01..c499996e07dd33278a314fe4273d54857173db97 100644 (file)
@@ -2,7 +2,7 @@
  * MsgVals.h
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: MsgVals.h,v 1.11 2004/01/26 16:52:31 zorglub Exp $
+ * $Id$
  *
  * Authors: Tony Castley <tcastley@mail.powerup.com.au>
  *          Stephan Aßmus <stippi@yellowbites.com>
@@ -51,7 +51,6 @@
 #define PREV_TITLE         'prti'
 #define NEXT_TITLE         'nxti'
 #define TOGGLE_TITLE       'tgti'
-#define NAVIGATE_MENU      'navm'
 #define PREV_CHAPTER       'prch'
 #define NEXT_CHAPTER       'nxch'
 #define TOGGLE_CHAPTER     'tgch'