Commit 7822e559 authored by VideoLAN's avatar VideoLAN

* ./modules/win32/menu.cpp: reorganized the code for menus generation,

   and got rid of the global variable (at last!) in the win32 interface.

Please check that navigation and language selection aren't too much
broken for DVDs...
parent a71b1c8c
...@@ -398,7 +398,7 @@ void __fastcall TMainFrameDlg::PrevTitleActionExecute( TObject *Sender ) ...@@ -398,7 +398,7 @@ void __fastcall TMainFrameDlg::PrevTitleActionExecute( TObject *Sender )
p_intf->p_sys->b_title_update = 1; p_intf->p_sys->b_title_update = 1;
vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock ); vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
SetupMenus( p_intf ); p_intf->p_sys->p_menus->SetupMenus();
vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock ); vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
} }
} }
...@@ -419,7 +419,7 @@ void __fastcall TMainFrameDlg::NextTitleActionExecute( TObject *Sender ) ...@@ -419,7 +419,7 @@ void __fastcall TMainFrameDlg::NextTitleActionExecute( TObject *Sender )
p_intf->p_sys->b_title_update = 1; p_intf->p_sys->b_title_update = 1;
vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock ); vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
SetupMenus( p_intf ); p_intf->p_sys->p_menus->SetupMenus();
vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock ); vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
} }
} }
...@@ -439,7 +439,7 @@ void __fastcall TMainFrameDlg::PrevChapterActionExecute( TObject *Sender ) ...@@ -439,7 +439,7 @@ void __fastcall TMainFrameDlg::PrevChapterActionExecute( TObject *Sender )
p_intf->p_sys->b_chapter_update = 1; p_intf->p_sys->b_chapter_update = 1;
vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock ); vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
SetupMenus( p_intf ); p_intf->p_sys->p_menus->SetupMenus();
vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock ); vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
} }
} }
...@@ -459,7 +459,7 @@ void __fastcall TMainFrameDlg::NextChapterActionExecute( TObject *Sender ) ...@@ -459,7 +459,7 @@ void __fastcall TMainFrameDlg::NextChapterActionExecute( TObject *Sender )
p_intf->p_sys->b_chapter_update = 1; p_intf->p_sys->b_chapter_update = 1;
vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock ); vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
SetupMenus( p_intf ); p_intf->p_sys->p_menus->SetupMenus();
vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock ); vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
} }
} }
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
* menu.cpp: functions to handle menu items * menu.cpp: functions to handle menu items
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: menu.cpp,v 1.2 2002/12/13 03:52:58 videolan Exp $
* *
* Authors: Olivier Teuliere <ipkiss@via.ecp.fr> * Authors: Olivier Teuliere <ipkiss@via.ecp.fr>
* *
...@@ -21,7 +22,6 @@ ...@@ -21,7 +22,6 @@
*****************************************************************************/ *****************************************************************************/
#include <vcl.h> #include <vcl.h>
//#pragma hdrstop
#include <vlc/vlc.h> #include <vlc/vlc.h>
#include <vlc/intf.h> #include <vlc/intf.h>
...@@ -29,60 +29,317 @@ ...@@ -29,60 +29,317 @@
#include "menu.h" #include "menu.h"
#include "win32_common.h" #include "win32_common.h"
/*****************************************************************************
/**************************************************************************** * TMenusGen::*Click: callbacks for the menuitems
* Local Prototypes ****************************************************************************
* These functions need to be in a class, or we won't be able to pass them
* as arguments (since TNotifyEvent uses __closure)
****************************************************************************/ ****************************************************************************/
extern intf_thread_t *p_intfGlobal;
static TMenuItem *Index2Item( TMenuItem *, int, bool ); /*
static int Item2Index( TMenuItem *, TMenuItem * ); * Audio
static void __fastcall LangChange( TMenuItem *, TMenuItem *, TMenuItem *, int ); */
static void __fastcall ProgramChange( TMenuItem *, TMenuItem * );
static void __fastcall RadioMenu( TMenuItem *, AnsiString, void __fastcall TMenusGen::MenuAudioClick( TObject *Sender )
int, int, TNotifyEvent ); {
static void __fastcall ProgramMenu( TMenuItem *, pgrm_descriptor_t *, LangChange( MenuAudio, (TMenuItem *)Sender, PopupAudio, AUDIO_ES );
TNotifyEvent ); }
static void __fastcall LanguageMenu( TMenuItem *t, es_descriptor_t *,
int, TNotifyEvent );
static void __fastcall NavigationMenu( TMenuItem *, TNotifyEvent );
void __fastcall TMenusGen::PopupAudioClick( TObject *Sender )
{
LangChange( PopupAudio, (TMenuItem *)Sender, MenuAudio, AUDIO_ES );
}
static TMenuItem *Index2Item( TMenuItem *Root, int i_index, bool SingleColumn ) /*
* Subtitles
*/
void __fastcall TMenusGen::MenuSubtitleClick( TObject *Sender )
{ {
if( SingleColumn || ( i_index < 20 ) ) LangChange( MenuSubtitles, (TMenuItem *)Sender,
PopupSubtitles, SPU_ES );
}
void __fastcall TMenusGen::PopupSubtitleClick( TObject *Sender )
{
LangChange( PopupSubtitles, (TMenuItem *)Sender,
MenuSubtitles, SPU_ES );
}
/*
* Program
*/
void __fastcall TMenusGen::MenuProgramClick( TObject *Sender )
{
ProgramChange( (TMenuItem *)Sender, PopupProgram );
}
void __fastcall TMenusGen::PopupProgramClick( TObject *Sender )
{
ProgramChange( (TMenuItem *)Sender, MenuProgram );
}
/*
* Title
*/
void __fastcall TMenusGen::MenuTitleClick( TObject *Sender )
{
TMenuItem * Item = (TMenuItem *)Sender;
TMenuItem * ItemTitle;
int i_title = Item->Tag;
input_ChangeArea( p_intf->p_sys->p_input,
p_intf->p_sys->p_input->stream.pp_areas[i_title] );
Item->Checked = true;
ItemTitle = Index2Item( PopupNavigation, i_title - 1, false );
Index2Item( ItemTitle, 0, false )->Checked = true;
input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_PLAY );
}
/*
* Chapter
*/
void __fastcall TMenusGen::MenuChapterClick( TObject *Sender )
{
TMenuItem * Item = (TMenuItem *)Sender;
TMenuItem * ItemTitle;
input_area_t * p_area;
int i_title;
int i_chapter = Item->Tag;
p_area = p_intf->p_sys->p_input->stream.p_selected_area;
p_area->i_part = i_chapter;
input_ChangeArea( p_intf->p_sys->p_input, (input_area_t*)p_area );
i_title = p_intf->p_sys->p_input->stream.p_selected_area->i_id;
ItemTitle = Index2Item( PopupNavigation, i_title - 1, false );
Index2Item( ItemTitle, i_chapter - 1, false )->Checked = true;
input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_PLAY );
}
/*
* Navigation
*/
void __fastcall TMenusGen::PopupNavigationClick( TObject *Sender )
{
TMenuItem * Item = (TMenuItem *)Sender;
TMenuItem * ItemTitle;
input_area_t * p_area;
int i_title = Data2Title( Item->Tag );
int i_chapter = Data2Chapter( Item->Tag );
p_area = p_intf->p_sys->p_input->stream.pp_areas[i_title];
p_area->i_part = i_chapter;
input_ChangeArea( p_intf->p_sys->p_input, (input_area_t*)p_area );
Item->Checked = true;
ItemTitle = Index2Item( MenuTitle, i_title - 1, false );
if( ItemTitle->Checked )
{ {
return Root->Items[i_index]; /* same title, new chapter */
Index2Item( MenuChapter, i_chapter - 1, false )->Checked = true;
} }
else else
{ {
return Root->Items[i_index / 10]->Items[i_index % 10]; /* new title => we must rebuild the chapter menu */
vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
RadioMenu(
MenuChapter, "Chapter",
p_intf->p_sys->p_input->stream.p_selected_area->i_part_nb,
i_chapter, MenuChapterClick );
vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
} }
input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_PLAY );
} }
static int Item2Index( TMenuItem *Root, TMenuItem *Item )
__fastcall TMenusGen::TMenusGen( intf_thread_t *_p_intf ) : TObject()
{ {
if( Item->Parent == Root ) p_intf = _p_intf;
/* Initialize local pointers to menu items of the main window */
TMainFrameDlg * p_window = p_intf->p_sys->p_window;
if( p_window == NULL )
{ {
return Item->MenuIndex; msg_Err( p_intf, "Main window wasn't created, expect problems..." );
return;
}
MenuAudio = p_window->MenuAudio;
PopupAudio = p_window->PopupAudio;
MenuSubtitles = p_window->MenuSubtitles;
PopupSubtitles = p_window->PopupSubtitles;
MenuProgram = p_window->MenuProgram;
PopupProgram = p_window->PopupProgram;
MenuTitle = p_window->MenuTitle;
MenuChapter = p_window->MenuChapter;
PopupNavigation = p_window->PopupNavigation;
}
void __fastcall TMenusGen::SetupMenus()
{
TMainFrameDlg * p_window = p_intf->p_sys->p_window;
input_thread_t *p_input = p_intf->p_sys->p_input;
es_descriptor_t * p_audio_es;
es_descriptor_t * p_spu_es;
p_intf->p_sys->b_chapter_update |= p_intf->p_sys->b_title_update;
p_intf->p_sys->b_audio_update |= p_intf->p_sys->b_program_update;
// p_intf->p_sys->b_audio_update |= p_intf->p_sys->b_title_update;
p_intf->p_sys->b_spu_update |= p_intf->p_sys->b_program_update;
// p_intf->p_sys->b_spu_update |= p_intf->p_sys->b_title_update;
if( p_intf->p_sys->b_program_update )
{
pgrm_descriptor_t * p_pgrm;
if( p_input->stream.p_new_program )
{
p_pgrm = p_input->stream.p_new_program;
} }
else else
{ {
return( 10 * Item->Parent->MenuIndex + Item->MenuIndex ); p_pgrm = p_input->stream.p_selected_program;
}
ProgramMenu( p_window->MenuProgram, p_pgrm, MenuProgramClick );
ProgramMenu( p_window->PopupProgram, p_pgrm, PopupProgramClick );
p_intf->p_sys->b_program_update = 0;
}
if( p_intf->p_sys->b_title_update )
{
// why "-1" ?
RadioMenu( p_window->MenuTitle, "Title",
p_input->stream.i_area_nb - 1,
p_input->stream.p_selected_area->i_id,
MenuTitleClick );
AnsiString CurrentTitle;
CurrentTitle.sprintf( "%d", p_input->stream.p_selected_area->i_id );
p_window->LabelTitleCurrent->Caption = CurrentTitle;
p_intf->p_sys->b_title_update = 0;
} }
if( p_intf->p_sys->b_chapter_update )
{
RadioMenu( p_window->MenuChapter, "Chapter",
p_input->stream.p_selected_area->i_part_nb,
p_input->stream.p_selected_area->i_part,
MenuChapterClick );
NavigationMenu( p_window->PopupNavigation,
PopupNavigationClick );
AnsiString CurrentChapter;
CurrentChapter.sprintf( "%d", p_input->stream.p_selected_area->i_part );
p_window->LabelChapterCurrent->Caption = CurrentChapter;
p_intf->p_sys->i_part = p_input->stream.p_selected_area->i_part;
p_intf->p_sys->b_chapter_update = 0;
}
/* look for selected ES */
p_audio_es = NULL;
p_spu_es = NULL;
for( int i = 0; i < p_input->stream.i_selected_es_number; i++ )
{
if( p_input->stream.pp_selected_es[i]->i_cat == AUDIO_ES )
{
p_audio_es = p_input->stream.pp_selected_es[i];
}
if( p_input->stream.pp_selected_es[i]->i_cat == SPU_ES )
{
p_spu_es = p_input->stream.pp_selected_es[i];
}
}
this->p_audio_es_old = p_audio_es;
this->p_spu_es_old = p_spu_es;
vlc_mutex_unlock( &p_input->stream.stream_lock );
/* audio menus */
if( p_intf->p_sys->b_audio_update )
{
LanguageMenu( p_window->MenuAudio, p_audio_es, AUDIO_ES,
MenuAudioClick );
LanguageMenu( p_window->PopupAudio, p_audio_es, AUDIO_ES,
PopupAudioClick );
p_intf->p_sys->b_audio_update = 0;
}
/* sub picture menus */
if( p_intf->p_sys->b_spu_update )
{
LanguageMenu( p_window->PopupSubtitles, p_spu_es, SPU_ES,
PopupSubtitleClick );
LanguageMenu( p_window->MenuSubtitles, p_spu_es, SPU_ES,
MenuSubtitleClick );
p_intf->p_sys->b_spu_update = 0;
}
vlc_mutex_lock( &p_input->stream.stream_lock );
} }
/*****************************************************************************
* Private functions
*****************************************************************************/
TMenuItem * TMenusGen::Index2Item( TMenuItem *Root, int i_index, bool SingleColumn )
{
if( SingleColumn || ( i_index < 20 ) )
return Root->Items[i_index];
else
return Root->Items[i_index / 10]->Items[i_index % 10];
}
int TMenusGen::Item2Index( TMenuItem *Root, TMenuItem *Item )
{
if( Item->Parent == Root )
return Item->MenuIndex;
else
return( 10 * Item->Parent->MenuIndex + Item->MenuIndex );
}
int __fastcall TMenusGen::Data2Title( int data )
{
return (int) (data >> 16 );
}
int __fastcall TMenusGen::Data2Chapter( int data )
{
return (int) (data & 0xffff);
}
int __fastcall TMenusGen::Pos2Data( int title, int chapter )
{
return (int) (( title << 16 ) | ( chapter & 0xffff ));
}
/**************************************************************************** /****************************************************************************
* LangChange: change audio or subtitles languages * LangChange: change audio or subtitles languages
**************************************************************************** ****************************************************************************
* Toggle the language, and update the selected menuitems. * Toggle the language, and update the selected menuitems.
****************************************************************************/ ****************************************************************************/
static void __fastcall LangChange( TMenuItem *RootCurrent, TMenuItem *Item, void __fastcall TMenusGen::LangChange( TMenuItem *RootCurrent, TMenuItem *Item,
TMenuItem *RootOther, int i_cat ) TMenuItem *RootOther, int i_cat )
{ {
intf_thread_t * p_intf = p_intfGlobal;
es_descriptor_t * p_es; es_descriptor_t * p_es;
es_descriptor_t * p_es_old; es_descriptor_t * p_es_old;
int i_index; int i_index;
...@@ -100,44 +357,43 @@ static void __fastcall LangChange( TMenuItem *RootCurrent, TMenuItem *Item, ...@@ -100,44 +357,43 @@ static void __fastcall LangChange( TMenuItem *RootCurrent, TMenuItem *Item,
} }
else else
{ {
vlc_mutex_lock( &p_intfGlobal->p_sys->p_input->stream.stream_lock ); vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
p_es = p_intfGlobal->p_sys->p_input->stream.pp_es[i_es]; p_es = p_intf->p_sys->p_input->stream.pp_es[i_es];
vlc_mutex_unlock( &p_intfGlobal->p_sys->p_input->stream.stream_lock ); vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
} }
/* find the current ES */ /* find the current ES */
if( i_cat == AUDIO_ES ) if( i_cat == AUDIO_ES )
{ {
p_es_old = p_intf->p_sys->p_audio_es_old; p_es_old = this->p_audio_es_old;
p_intf->p_sys->p_audio_es_old = p_es; this->p_audio_es_old = p_es;
} }
else else
{ {
p_es_old = p_intf->p_sys->p_spu_es_old; p_es_old = this->p_spu_es_old;
p_intf->p_sys->p_spu_es_old = p_es; this->p_spu_es_old = p_es;
} }
/* exchange them */ /* exchange them */
input_ToggleES( p_intfGlobal->p_sys->p_input, p_es_old, false ); input_ToggleES( p_intf->p_sys->p_input, p_es_old, false );
input_ToggleES( p_intfGlobal->p_sys->p_input, p_es, true ); input_ToggleES( p_intf->p_sys->p_input, p_es, true );
Item->Checked = true; Item->Checked = true;
Index2Item( RootOther, i_index + 1, true )->Checked = true; Index2Item( RootOther, i_index + 1, true )->Checked = true;
} }
/**************************************************************************** /****************************************************************************
* ProgramChange: change the program * ProgramChange: change the program
**************************************************************************** ****************************************************************************
* Toggle the program, and update the selected menuitems. * Toggle the program, and update the selected menuitems.
****************************************************************************/ ****************************************************************************/
static void __fastcall ProgramChange( TMenuItem *Item, TMenuItem *RootOther ) void __fastcall TMenusGen::ProgramChange( TMenuItem *Item,
TMenuItem *RootOther )
{ {
intf_thread_t * p_intf = p_intfGlobal;
int i_program = Item->Tag; int i_program = Item->Tag;
/* toggle the program */ /* toggle the program */
input_ChangeProgram( p_intfGlobal->p_sys->p_input, (u16)i_program ); input_ChangeProgram( p_intf->p_sys->p_input, (uint16_t)i_program );
/* check selected menu items */ /* check selected menu items */
Item->Checked = true; Item->Checked = true;
...@@ -146,150 +402,73 @@ static void __fastcall ProgramChange( TMenuItem *Item, TMenuItem *RootOther ) ...@@ -146,150 +402,73 @@ static void __fastcall ProgramChange( TMenuItem *Item, TMenuItem *RootOther )
/* update audio/subtitles menus */ /* update audio/subtitles menus */
p_intf->p_sys->b_audio_update = 1; p_intf->p_sys->b_audio_update = 1;
p_intf->p_sys->b_spu_update = 1; p_intf->p_sys->b_spu_update = 1;
vlc_mutex_lock( &p_intfGlobal->p_sys->p_input->stream.stream_lock ); vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
SetupMenus( p_intf ); SetupMenus();
vlc_mutex_unlock( &p_intfGlobal->p_sys->p_input->stream.stream_lock ); vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
p_intf->p_sys->b_audio_update = 0; p_intf->p_sys->b_audio_update = 0;
p_intf->p_sys->b_spu_update = 0; p_intf->p_sys->b_spu_update = 0;
input_SetStatus( p_intfGlobal->p_sys->p_input, INPUT_STATUS_PLAY ); input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_PLAY );
}
/****************************************************************************
* TMainFrameDlg::*Click: callbacks for the menuitems
****************************************************************************
* These functions need to be in a class, or we won't be able to pass them
* as arguments (since TNotifyEvent uses __closure)
****************************************************************************/
/*
* Audio
*/
void __fastcall TMainFrameDlg::MenuAudioClick( TObject *Sender )
{
LangChange( MenuAudio, (TMenuItem *)Sender, PopupAudio, AUDIO_ES );
}
void __fastcall TMainFrameDlg::PopupAudioClick( TObject *Sender )
{
LangChange( PopupAudio, (TMenuItem *)Sender, MenuAudio, AUDIO_ES );
} }
/* /*****************************************************************************
* Subtitles * ProgramMenu: update the programs menu of the interface
*/ *****************************************************************************
* Builds the program menu according to what have been found in the PAT
void __fastcall TMainFrameDlg::MenuSubtitleClick( TObject *Sender ) * by the input. Useful for multi-programs streams such as DVB ones.
{ *****************************************************************************/
LangChange( MenuSubtitles, (TMenuItem *)Sender, PopupSubtitles, SPU_ES ); void __fastcall TMenusGen::ProgramMenu( TMenuItem *Root,
} pgrm_descriptor_t *p_pgrm, TNotifyEvent MenuItemClick)
void __fastcall TMainFrameDlg::PopupSubtitleClick( TObject *Sender )
{ {
LangChange( PopupSubtitles, (TMenuItem *)Sender, MenuSubtitles, SPU_ES ); TMenuItem * Item;
} TMenuItem * ItemActive;
/* /* remove previous menu */
* Program Root->Clear();
*/ Root->Enabled = false;
void __fastcall TMainFrameDlg::MenuProgramClick( TObject *Sender ) ItemActive = NULL;
{
ProgramChange( (TMenuItem *)Sender, PopupProgram );
}
void __fastcall TMainFrameDlg::PopupProgramClick( TObject *Sender ) /* create a set of program buttons and append them to the container */
{ for( int i = 0; i < p_intf->p_sys->p_input->stream.i_pgrm_number; i++ )
ProgramChange( (TMenuItem *)Sender, MenuProgram ); {
} AnsiString Name;
Name.sprintf( "id %d",
p_intf->p_sys->p_input->stream.pp_programs[i]->i_number );
/* Item = new TMenuItem( Root );
* Navigation Item->Caption = Name;
*/ Item->Hint = Name;
Item->RadioItem = true;
Item->OnClick = MenuItemClick;
void __fastcall TMainFrameDlg::PopupNavigationClick( TObject *Sender ) /* FIXME: temporary hack to save the program id with the Item
{ * It will be used in the callback. */
TMenuItem * Item = (TMenuItem *)Sender; Item->Tag = i + 1;
TMenuItem * ItemTitle;
input_area_t * p_area;
int i_title = DATA2TITLE( Item->Tag );
int i_chapter = DATA2CHAPTER( Item->Tag );
p_area = p_intfGlobal->p_sys->p_input->stream.pp_areas[i_title]; if( p_pgrm == p_intf->p_sys->p_input->stream.pp_programs[i] )
p_area->i_part = i_chapter; {
/* don't lose Item when we append into menu */
ItemActive = Item;
}
input_ChangeArea( p_intfGlobal->p_sys->p_input, (input_area_t*)p_area ); /* Add the item to the submenu */
Root->Add( Item );
}
Item->Checked = true; /* check currently selected program */
ItemTitle = Index2Item( MenuTitle, i_title - 1, false ); if( ItemActive != NULL )
if( ItemTitle->Checked )
{ {
/* same title, new chapter */ ItemActive->Checked = true;
Index2Item( MenuChapter, i_chapter - 1, false )->Checked = true;
} }
else
/* be sure that menu is enabled if more than 1 program */
if( p_intf->p_sys->p_input->stream.i_pgrm_number > 1 )
{ {
/* new title => we must rebuild the chapter menu */ Root->Enabled = true;
vlc_mutex_lock( &p_intfGlobal->p_sys->p_input->stream.stream_lock );
RadioMenu( MenuChapter, "Chapter",
p_intfGlobal->p_sys->p_input->stream.p_selected_area->i_part_nb,
i_chapter, MenuChapterClick );
vlc_mutex_unlock( &p_intfGlobal->p_sys->p_input->stream.stream_lock );
} }
input_SetStatus( p_intfGlobal->p_sys->p_input, INPUT_STATUS_PLAY );
} }
/*
* Title
*/
void __fastcall TMainFrameDlg::MenuTitleClick( TObject *Sender )
{
TMenuItem * Item = (TMenuItem *)Sender;
TMenuItem * ItemTitle;
int i_title = Item->Tag;
input_ChangeArea( p_intfGlobal->p_sys->p_input,
p_intfGlobal->p_sys->p_input->stream.pp_areas[i_title] );
Item->Checked = true;
ItemTitle = Index2Item( PopupNavigation, i_title - 1, false );
Index2Item( ItemTitle, 0, false )->Checked = true;
input_SetStatus( p_intfGlobal->p_sys->p_input, INPUT_STATUS_PLAY );
}
/*
* Chapter
*/
void __fastcall TMainFrameDlg::MenuChapterClick( TObject *Sender )
{
TMenuItem * Item = (TMenuItem *)Sender;
TMenuItem * ItemTitle;
input_area_t * p_area;
int i_title;
int i_chapter = Item->Tag;
p_area = p_intfGlobal->p_sys->p_input->stream.p_selected_area;
p_area->i_part = i_chapter;
input_ChangeArea( p_intfGlobal->p_sys->p_input, (input_area_t*)p_area );
i_title = p_intfGlobal->p_sys->p_input->stream.p_selected_area->i_id;
ItemTitle = Index2Item( PopupNavigation, i_title - 1, false );
Index2Item( ItemTitle, i_chapter - 1, false )->Checked = true;
input_SetStatus( p_intfGlobal->p_sys->p_input, INPUT_STATUS_PLAY );
}
/****************************************************************************
* Functions to generate menus
****************************************************************************/
/***************************************************************************** /*****************************************************************************
* RadioMenu: update interactive menus of the interface * RadioMenu: update interactive menus of the interface
***************************************************************************** *****************************************************************************
...@@ -297,15 +476,13 @@ void __fastcall TMainFrameDlg::MenuChapterClick( TObject *Sender ) ...@@ -297,15 +476,13 @@ void __fastcall TMainFrameDlg::MenuChapterClick( TObject *Sender )
* Warning: since this function is designed to be called by management * Warning: since this function is designed to be called by management
* function, the interface lock has to be taken * function, the interface lock has to be taken
*****************************************************************************/ *****************************************************************************/
static void __fastcall RadioMenu( TMenuItem * Root, AnsiString ItemName, void __fastcall TMenusGen::RadioMenu( TMenuItem *Root, AnsiString ItemName,
int i_nb, int i_selected, int i_nb, int i_selected, TNotifyEvent MenuItemClick )
TNotifyEvent MenuItemClick )
{ {
TMenuItem * ItemGroup; TMenuItem * ItemGroup;
TMenuItem * Item; TMenuItem * Item;
TMenuItem * ItemActive; TMenuItem * ItemActive;
AnsiString Name; AnsiString Name;
int i_item;
/* remove previous menu */ /* remove previous menu */
Root->Enabled = false; Root->Enabled = false;
...@@ -313,7 +490,7 @@ static void __fastcall RadioMenu( TMenuItem * Root, AnsiString ItemName, ...@@ -313,7 +490,7 @@ static void __fastcall RadioMenu( TMenuItem * Root, AnsiString ItemName,
ItemActive = NULL; ItemActive = NULL;
for( i_item = 0; i_item < i_nb; i_item++ ) for( int i_item = 0; i_item < i_nb; i_item++ )
{ {
/* we group titles/chapters in packets of ten for small screens */ /* we group titles/chapters in packets of ten for small screens */
if( ( i_item % 10 == 0 ) && ( i_nb > 20 ) ) if( ( i_item % 10 == 0 ) && ( i_nb > 20 ) )
...@@ -326,6 +503,7 @@ static void __fastcall RadioMenu( TMenuItem * Root, AnsiString ItemName, ...@@ -326,6 +503,7 @@ static void __fastcall RadioMenu( TMenuItem * Root, AnsiString ItemName,
Name.sprintf( "%ss %d to %d", ItemName, i_item + 1, i_item + 10 ); Name.sprintf( "%ss %d to %d", ItemName, i_item + 1, i_item + 10 );
ItemGroup = new TMenuItem( Root ); ItemGroup = new TMenuItem( Root );
ItemGroup->Hint = Name; ItemGroup->Hint = Name;
ItemGroup->RadioItem = true;
/* set the accelerator character */ /* set the accelerator character */
Name.Insert( "&", Name.Length() - 1 ); Name.Insert( "&", Name.Length() - 1 );
...@@ -354,14 +532,10 @@ static void __fastcall RadioMenu( TMenuItem * Root, AnsiString ItemName, ...@@ -354,14 +532,10 @@ static void __fastcall RadioMenu( TMenuItem * Root, AnsiString ItemName,
Item->OnClick = MenuItemClick; Item->OnClick = MenuItemClick;
if( i_nb > 20 ) if( i_nb > 20 )
{
ItemGroup->Add( Item ); ItemGroup->Add( Item );
}
else else
{
Root->Add( Item ); Root->Add( Item );
} }
}
// if( ( i_nb > 20 ) && ( i_item % 10 ) ) ? // if( ( i_nb > 20 ) && ( i_item % 10 ) ) ?
if( i_nb > 20 ) if( i_nb > 20 )
...@@ -382,68 +556,6 @@ static void __fastcall RadioMenu( TMenuItem * Root, AnsiString ItemName, ...@@ -382,68 +556,6 @@ static void __fastcall RadioMenu( TMenuItem * Root, AnsiString ItemName,
} }
} }
/*****************************************************************************
* ProgramMenu: update the programs menu of the interface
*****************************************************************************
* Builds the program menu according to what have been found in the PAT
* by the input. Useful for multi-programs streams such as DVB ones.
*****************************************************************************/
static void __fastcall ProgramMenu( TMenuItem * Root,
pgrm_descriptor_t * p_pgrm,
TNotifyEvent MenuItemClick )
{
TMenuItem * Item;
TMenuItem * ItemActive;
AnsiString Name;
int i;
/* remove previous menu */
Root->Clear();
Root->Enabled = false;
ItemActive = NULL;
/* create a set of program buttons and append them to the container */
for( i = 0; i < p_intfGlobal->p_sys->p_input->stream.i_pgrm_number; i++ )
{
Name.sprintf( "id %d",
p_intfGlobal->p_sys->p_input->stream.pp_programs[i]->i_number );
Item = new TMenuItem( Root );
Item->Caption = Name;
Item->Hint = Name;
Item->RadioItem = true;
Item->OnClick = MenuItemClick;
/* FIXME: temporary hack to save the program id with the Item
* It will be used in the callback. */
Item->Tag = i + 1;
if( p_pgrm == p_intfGlobal->p_sys->p_input->stream.pp_programs[i] )
{
/* don't lose Item when we append into menu */
ItemActive = Item;
}
/* Add the item to the submenu */
Root->Add( Item );
}
/* check currently selected program */
if( ItemActive != NULL )
{
ItemActive->Checked = true;
}
/* be sure that menu is enabled if more than 1 program */
if( p_intfGlobal->p_sys->p_input->stream.i_pgrm_number > 1 )
{
Root->Enabled = true;
}
}
/***************************************************************************** /*****************************************************************************
* LanguageMenus: update interactive menus of the interface * LanguageMenus: update interactive menus of the interface
***************************************************************************** *****************************************************************************
...@@ -453,15 +565,13 @@ static void __fastcall ProgramMenu( TMenuItem * Root, ...@@ -453,15 +565,13 @@ static void __fastcall ProgramMenu( TMenuItem * Root,
* Warning: since this function is designed to be called by management * Warning: since this function is designed to be called by management
* function, the interface lock has to be taken * function, the interface lock has to be taken
*****************************************************************************/ *****************************************************************************/
static void __fastcall LanguageMenu( TMenuItem * Root, es_descriptor_t * p_es, void __fastcall TMenusGen::LanguageMenu( TMenuItem *Root, es_descriptor_t *p_es,
int i_cat, TNotifyEvent MenuItemClick ) int i_cat, TNotifyEvent MenuItemClick )
{ {
TMenuItem * Separator; TMenuItem * Separator;
TMenuItem * Item; TMenuItem * Item;
TMenuItem * ItemActive; TMenuItem * ItemActive;
AnsiString Name; AnsiString Name;
int i_item;
int i;
/* remove previous menu */ /* remove previous menu */
Root->Clear(); Root->Clear();
...@@ -483,21 +593,21 @@ static void __fastcall LanguageMenu( TMenuItem * Root, es_descriptor_t * p_es, ...@@ -483,21 +593,21 @@ static void __fastcall LanguageMenu( TMenuItem * Root, es_descriptor_t * p_es,
Root->Add( Separator ); Root->Add( Separator );
ItemActive = NULL; ItemActive = NULL;
i_item = 0; int i_item = 0;
vlc_mutex_lock( &p_intfGlobal->p_sys->p_input->stream.stream_lock ); vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
#define ES p_intfGlobal->p_sys->p_input->stream.pp_es[i] #define ES p_intf->p_sys->p_input->stream.pp_es[i]
/* create a set of language buttons and append them to the Root */ /* create a set of language buttons and append them to the Root */
for( i = 0; i < p_intfGlobal->p_sys->p_input->stream.i_es_number; i++ ) for( int i = 0; i < p_intf->p_sys->p_input->stream.i_es_number; i++ )
{ {
if( ( ES->i_cat == i_cat ) && if( ( ES->i_cat == i_cat ) &&
( !ES->p_pgrm || ( !ES->p_pgrm ||
ES->p_pgrm == ES->p_pgrm ==
p_intfGlobal->p_sys->p_input->stream.p_selected_program ) ) p_intf->p_sys->p_input->stream.p_selected_program ) )
{ {
i_item++; i_item++;
Name = p_intfGlobal->p_sys->p_input->stream.pp_es[i]->psz_desc; Name = p_intf->p_sys->p_input->stream.pp_es[i]->psz_desc;
if( Name.IsEmpty() ) if( Name.IsEmpty() )
{ {
Name.sprintf( "Language %d", i_item ); Name.sprintf( "Language %d", i_item );
...@@ -509,7 +619,7 @@ static void __fastcall LanguageMenu( TMenuItem * Root, es_descriptor_t * p_es, ...@@ -509,7 +619,7 @@ static void __fastcall LanguageMenu( TMenuItem * Root, es_descriptor_t * p_es,
Item->Caption = Name; Item->Caption = Name;
Item->Tag = i; Item->Tag = i;
if( p_es == p_intfGlobal->p_sys->p_input->stream.pp_es[i] ) if( p_es == p_intf->p_sys->p_input->stream.pp_es[i] )
{ {
/* don't lose Item when we append into menu */ /* don't lose Item when we append into menu */
ItemActive = Item; ItemActive = Item;
...@@ -522,7 +632,7 @@ static void __fastcall LanguageMenu( TMenuItem * Root, es_descriptor_t * p_es, ...@@ -522,7 +632,7 @@ static void __fastcall LanguageMenu( TMenuItem * Root, es_descriptor_t * p_es,
} }
#undef ES #undef ES
vlc_mutex_unlock( &p_intfGlobal->p_sys->p_input->stream.stream_lock ); vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
/* check currently selected item */ /* check currently selected item */
if( ItemActive != NULL ) if( ItemActive != NULL )
...@@ -537,7 +647,6 @@ static void __fastcall LanguageMenu( TMenuItem * Root, es_descriptor_t * p_es, ...@@ -537,7 +647,6 @@ static void __fastcall LanguageMenu( TMenuItem * Root, es_descriptor_t * p_es,
} }
} }
/***************************************************************************** /*****************************************************************************
* NavigationMenu: sets menus for titles and chapters selection * NavigationMenu: sets menus for titles and chapters selection
***************************************************************************** *****************************************************************************
...@@ -545,7 +654,7 @@ static void __fastcall LanguageMenu( TMenuItem * Root, es_descriptor_t * p_es, ...@@ -545,7 +654,7 @@ static void __fastcall LanguageMenu( TMenuItem * Root, es_descriptor_t * p_es,
* -simple list of titles * -simple list of titles
* -cascaded lists of chapters for each title * -cascaded lists of chapters for each title
*****************************************************************************/ *****************************************************************************/
static void __fastcall NavigationMenu( TMenuItem * Root, void __fastcall TMenusGen::NavigationMenu( TMenuItem *Root,
TNotifyEvent MenuItemClick ) TNotifyEvent MenuItemClick )
{ {
TMenuItem * TitleGroup; TMenuItem * TitleGroup;
...@@ -554,8 +663,6 @@ static void __fastcall NavigationMenu( TMenuItem * Root, ...@@ -554,8 +663,6 @@ static void __fastcall NavigationMenu( TMenuItem * Root,
TMenuItem * ChapterGroup; TMenuItem * ChapterGroup;
TMenuItem * ChapterItem; TMenuItem * ChapterItem;
AnsiString Name; AnsiString Name;
int i_title;
int i_chapter;
int i_title_nb; int i_title_nb;
int i_chapter_nb; int i_chapter_nb;
...@@ -565,10 +672,10 @@ static void __fastcall NavigationMenu( TMenuItem * Root, ...@@ -565,10 +672,10 @@ static void __fastcall NavigationMenu( TMenuItem * Root,
Root->Clear(); Root->Clear();
ItemActive = NULL; ItemActive = NULL;
i_title_nb = p_intfGlobal->p_sys->p_input->stream.i_area_nb; i_title_nb = p_intf->p_sys->p_input->stream.i_area_nb;
/* loop on titles */ /* loop on titles */
for( i_title = 1; i_title < i_title_nb; i_title++ ) for( int i_title = 1; i_title < i_title_nb; i_title++ )
{ {
/* we group titles in packets of ten for small screens */ /* we group titles in packets of ten for small screens */
if( ( i_title % 10 == 1 ) && ( i_title_nb > 20 ) ) if( ( i_title % 10 == 1 ) && ( i_title_nb > 20 ) )
...@@ -586,8 +693,7 @@ static void __fastcall NavigationMenu( TMenuItem * Root, ...@@ -586,8 +693,7 @@ static void __fastcall NavigationMenu( TMenuItem * Root,
} }
Name.sprintf( "Title %d (%d)", i_title, Name.sprintf( "Title %d (%d)", i_title,
p_intfGlobal->p_sys->p_input->stream.pp_areas[i_title]->i_part_nb ); p_intf->p_sys->p_input->stream.pp_areas[i_title]->i_part_nb );
{ {
TitleItem = new TMenuItem( Root ); TitleItem = new TMenuItem( Root );
TitleItem->RadioItem = true; TitleItem->RadioItem = true;
...@@ -595,10 +701,10 @@ static void __fastcall NavigationMenu( TMenuItem * Root, ...@@ -595,10 +701,10 @@ static void __fastcall NavigationMenu( TMenuItem * Root,
TitleItem->Caption = Name; TitleItem->Caption = Name;
i_chapter_nb = i_chapter_nb =
p_intfGlobal->p_sys->p_input->stream.pp_areas[i_title]->i_part_nb; p_intf->p_sys->p_input->stream.pp_areas[i_title]->i_part_nb;
/* loop on chapters */ /* loop on chapters */
for( i_chapter = 0; i_chapter < i_chapter_nb; i_chapter++ ) for( int i_chapter = 0; i_chapter < i_chapter_nb; i_chapter++ )
{ {
/* we group chapters in packets of ten for small screens */ /* we group chapters in packets of ten for small screens */
if( ( i_chapter % 10 == 0 ) && ( i_chapter_nb > 20 ) ) if( ( i_chapter % 10 == 0 ) && ( i_chapter_nb > 20 ) )
...@@ -624,36 +730,32 @@ static void __fastcall NavigationMenu( TMenuItem * Root, ...@@ -624,36 +730,32 @@ static void __fastcall NavigationMenu( TMenuItem * Root,
/* FIXME: temporary hack to save i_title and i_chapter with /* FIXME: temporary hack to save i_title and i_chapter with
* ChapterItem, since we will need them in the callback */ * ChapterItem, since we will need them in the callback */
ChapterItem->Tag = (int)POS2DATA( i_title, i_chapter + 1 ); ChapterItem->Tag = Pos2Data( i_title, i_chapter + 1 );
#define p_area p_intfGlobal->p_sys->p_input->stream.pp_areas[i_title] #define p_area p_intf->p_sys->p_input->stream.pp_areas[i_title]
if( ( p_area == if( ( p_area ==
p_intfGlobal->p_sys->p_input->stream.p_selected_area ) && p_intf->p_sys->p_input->stream.p_selected_area ) &&
( p_area->i_part == i_chapter + 1 ) ) ( p_area->i_part == i_chapter + 1 ) )
{ {
ItemActive = ChapterItem; ItemActive = ChapterItem;
} }
#undef p_area #undef p_area
/* setup signal hanling */ /* setup signal handling */
ChapterItem->OnClick = MenuItemClick; ChapterItem->OnClick = MenuItemClick;
if( i_chapter_nb > 20 ) if( i_chapter_nb > 20 )
{
ChapterGroup->Add( ChapterItem ); ChapterGroup->Add( ChapterItem );
}
else else
{
TitleItem->Add( ChapterItem ); TitleItem->Add( ChapterItem );
} }
}
if( i_chapter_nb > 20 ) if( i_chapter_nb > 20 )
{ {
TitleItem->Add( ChapterGroup ); TitleItem->Add( ChapterGroup );
} }
if( p_intfGlobal->p_sys->p_input->stream.pp_areas[i_title]->i_part_nb if( p_intf->p_sys->p_input->stream.pp_areas[i_title]->i_part_nb
> 1 ) > 1 )
{ {
/* be sure that menu is sensitive */ /* be sure that menu is sensitive */
...@@ -662,14 +764,10 @@ static void __fastcall NavigationMenu( TMenuItem * Root, ...@@ -662,14 +764,10 @@ static void __fastcall NavigationMenu( TMenuItem * Root,
} }
if( i_title_nb > 20 ) if( i_title_nb > 20 )
{
TitleGroup->Add( TitleItem ); TitleGroup->Add( TitleItem );
}
else else
{
Root->Add( TitleItem ); Root->Add( TitleItem );
} }
}
if( i_title_nb > 20 ) if( i_title_nb > 20 )
{ {
...@@ -686,131 +784,3 @@ static void __fastcall NavigationMenu( TMenuItem * Root, ...@@ -686,131 +784,3 @@ static void __fastcall NavigationMenu( TMenuItem * Root,
Root->Enabled = true; Root->Enabled = true;
} }
/*****************************************************************************
* SetupMenus: function that generates title/chapter/audio/subpic
* menus with help from preceding functions
*****************************************************************************/
int __fastcall SetupMenus( intf_thread_t * p_intf )
{
TMainFrameDlg * p_window = p_intf->p_sys->p_window;
es_descriptor_t * p_audio_es;
es_descriptor_t * p_spu_es;
int i;
p_intf->p_sys->b_chapter_update |= p_intf->p_sys->b_title_update;
p_intf->p_sys->b_audio_update |= p_intf->p_sys->b_title_update |
p_intf->p_sys->b_program_update;
p_intf->p_sys->b_spu_update |= p_intf->p_sys->b_title_update |
p_intf->p_sys->b_program_update;
if( p_intf->p_sys->b_program_update )
{
pgrm_descriptor_t * p_pgrm;
if( p_intfGlobal->p_sys->p_input->stream.p_new_program )
{
p_pgrm = p_intfGlobal->p_sys->p_input->stream.p_new_program;
}
else
{
p_pgrm = p_intfGlobal->p_sys->p_input->stream.p_selected_program;
}
ProgramMenu( p_window->MenuProgram, p_pgrm,
p_window->MenuProgramClick );
ProgramMenu( p_window->PopupProgram, p_pgrm,
p_window->PopupProgramClick );
p_intf->p_sys->b_program_update = 0;
}
if( p_intf->p_sys->b_title_update )
{
RadioMenu( p_window->MenuTitle, "Title",
//why "-1" ?
p_intfGlobal->p_sys->p_input->stream.i_area_nb - 1,
p_intfGlobal->p_sys->p_input->stream.p_selected_area->i_id,
p_window->MenuTitleClick );
AnsiString CurrentTitle;
CurrentTitle.sprintf( "%d",
p_intfGlobal->p_sys->p_input->stream.p_selected_area->i_id );
p_window->LabelTitleCurrent->Caption = CurrentTitle;
p_intf->p_sys->b_title_update = 0;
}
if( p_intf->p_sys->b_chapter_update )
{
RadioMenu( p_window->MenuChapter, "Chapter",
p_intfGlobal->p_sys->p_input->stream.p_selected_area->i_part_nb,
p_intfGlobal->p_sys->p_input->stream.p_selected_area->i_part,
p_window->MenuChapterClick );
NavigationMenu( p_window->PopupNavigation,
p_window->PopupNavigationClick );
AnsiString CurrentChapter;
CurrentChapter.sprintf( "%d",
p_intfGlobal->p_sys->p_input->stream.p_selected_area->i_part );
p_window->LabelChapterCurrent->Caption = CurrentChapter;
p_intf->p_sys->i_part =
p_intfGlobal->p_sys->p_input->stream.p_selected_area->i_part;
p_intf->p_sys->b_chapter_update = 0;
}
/* look for selected ES */
p_audio_es = NULL;
p_spu_es = NULL;
for( i = 0; i < p_intfGlobal->p_sys->p_input->stream.i_selected_es_number; i++ )
{
if( p_intfGlobal->p_sys->p_input->stream.pp_selected_es[i]->i_cat
== AUDIO_ES )
{
p_audio_es = p_intfGlobal->p_sys->p_input->stream.pp_selected_es[i];
p_intfGlobal->p_sys->p_audio_es_old = p_audio_es;
}
if( p_intfGlobal->p_sys->p_input->stream.pp_selected_es[i]->i_cat
== SPU_ES )
{
p_spu_es = p_intfGlobal->p_sys->p_input->stream.pp_selected_es[i];
p_intfGlobal->p_sys->p_spu_es_old = p_spu_es;
}
}
vlc_mutex_unlock( &p_intfGlobal->p_sys->p_input->stream.stream_lock );
/* audio menus */
if( p_intf->p_sys->b_audio_update )
{
LanguageMenu( p_window->MenuAudio, p_audio_es, AUDIO_ES,
p_window->MenuAudioClick );
LanguageMenu( p_window->PopupAudio, p_audio_es, AUDIO_ES,
p_window->PopupAudioClick );
p_intf->p_sys->b_audio_update = 0;
}
/* sub picture menus */
if( p_intf->p_sys->b_spu_update )
{
LanguageMenu( p_window->PopupSubtitles, p_spu_es, SPU_ES,
p_window->PopupSubtitleClick );
LanguageMenu( p_window->MenuSubtitles, p_spu_es, SPU_ES,
p_window->MenuSubtitleClick );
p_intf->p_sys->b_spu_update = 0;
}
vlc_mutex_lock( &p_intfGlobal->p_sys->p_input->stream.stream_lock );
return true;
}
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
* menu.h: prototypes for menu functions * menu.h: prototypes for menu functions
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: menu.h,v 1.2 2002/12/13 03:52:58 videolan Exp $
* *
* Authors: Olivier Teuliere <ipkiss@via.ecp.fr> * Authors: Olivier Teuliere <ipkiss@via.ecp.fr>
* *
...@@ -20,13 +21,61 @@ ...@@ -20,13 +21,61 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/ *****************************************************************************/
int __fastcall SetupMenus( intf_thread_t * ); #ifndef menuH
#define menuH
//----------------------------------------------------------------------------
class TMenusGen : public TObject
{
private:
intf_thread_t *p_intf;
/***************************************************************************** /* local pointers to main window menu items */
* Convert user_data structures to title and chapter information TMenuItem *MenuAudio;
*****************************************************************************/ TMenuItem *PopupAudio;
#define DATA2TITLE( data ) ( (int)((long)(data)) >> 16 ) TMenuItem *MenuSubtitles;
#define DATA2CHAPTER( data ) ( (int)((long)(data)) & 0xffff ) TMenuItem *PopupSubtitles;
#define POS2DATA( title, chapter ) ( NULL + ( ((title) << 16) \ TMenuItem *MenuProgram;
| ((chapter) & 0xffff)) ) TMenuItem *PopupProgram;
TMenuItem *MenuTitle;
TMenuItem *MenuChapter;
TMenuItem *PopupNavigation;
/* Language information */
es_descriptor_t * p_audio_es_old;
es_descriptor_t * p_spu_es_old;
/* Helpful functions */
int Item2Index( TMenuItem *Root, TMenuItem *Item );
TMenuItem *Index2Item( TMenuItem *Root, int i_index, bool SingleColumn );
int __fastcall Data2Title( int data );
int __fastcall Data2Chapter( int data );
int __fastcall Pos2Data( int title, int chapter );
void __fastcall LangChange( TMenuItem *, TMenuItem *, TMenuItem *, int );
void __fastcall ProgramChange( TMenuItem *, TMenuItem * );
void __fastcall ProgramMenu( TMenuItem *, pgrm_descriptor_t *,
TNotifyEvent );
void __fastcall RadioMenu( TMenuItem *, AnsiString, int, int,
TNotifyEvent );
void __fastcall LanguageMenu( TMenuItem *, es_descriptor_t *, int,
TNotifyEvent );
void __fastcall NavigationMenu( TMenuItem *, TNotifyEvent );
public:
__fastcall TMenusGen( intf_thread_t *_p_intf );
/* menu generation */
void __fastcall SetupMenus();
/* callbacks for menuitems */
void __fastcall MenuAudioClick( TObject *Sender );
void __fastcall PopupAudioClick( TObject *Sender );
void __fastcall MenuSubtitleClick( TObject *Sender );
void __fastcall PopupSubtitleClick( TObject *Sender );
void __fastcall MenuProgramClick( TObject *Sender );
void __fastcall PopupProgramClick( TObject *Sender );
void __fastcall MenuTitleClick( TObject *Sender );
void __fastcall MenuChapterClick( TObject *Sender );
void __fastcall PopupNavigationClick( TObject *Sender );
};
//----------------------------------------------------------------------------
#endif
...@@ -662,7 +662,7 @@ void __fastcall TPreferencesDlg::CreateConfigDialog( char *psz_module_name ) ...@@ -662,7 +662,7 @@ void __fastcall TPreferencesDlg::CreateConfigDialog( char *psz_module_name )
break; break;
default: default:
msg_Warn( p_intf, "unknown config type" ); msg_Warn( p_intf, "unknown config type: %i", p_item->i_type );
break; break;
} }
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
* win32.cpp : Win32 interface plugin for vlc * win32.cpp : Win32 interface plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: win32.cpp,v 1.5 2002/12/13 03:52:58 videolan Exp $
* *
* Authors: Olivier Teulire <ipkiss@via.ecp.fr> * Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* *
...@@ -50,8 +51,6 @@ static void Run ( intf_thread_t * ); ...@@ -50,8 +51,6 @@ static void Run ( intf_thread_t * );
int Win32Manage( void *p_data ); int Win32Manage( void *p_data );
intf_thread_t *p_intfGlobal;
/***************************************************************************** /*****************************************************************************
* Open: initialize interface * Open: initialize interface
*****************************************************************************/ *****************************************************************************/
...@@ -67,7 +66,6 @@ static int Open ( vlc_object_t *p_this ) ...@@ -67,7 +66,6 @@ static int Open ( vlc_object_t *p_this )
return( 1 ); return( 1 );
}; };
p_intfGlobal = p_intf;
p_intf->pf_run = Run; p_intf->pf_run = Run;
p_intf->p_sys->p_sub = msg_Subscribe( p_intf ); p_intf->p_sys->p_sub = msg_Subscribe( p_intf );
...@@ -109,6 +107,7 @@ static void Run( intf_thread_t *p_intf ) ...@@ -109,6 +107,7 @@ static void Run( intf_thread_t *p_intf )
p_intf->p_sys->p_window = new TMainFrameDlg( NULL, p_intf ); p_intf->p_sys->p_window = new TMainFrameDlg( NULL, p_intf );
p_intf->p_sys->p_playwin = new TPlaylistDlg( NULL, p_intf ); p_intf->p_sys->p_playwin = new TPlaylistDlg( NULL, p_intf );
p_intf->p_sys->p_messages = new TMessagesDlg( NULL, p_intf ); p_intf->p_sys->p_messages = new TMessagesDlg( NULL, p_intf );
p_intf->p_sys->p_menus = new TMenusGen( p_intf );
/* show main window and wait until it is closed */ /* show main window and wait until it is closed */
p_intf->p_sys->p_window->ShowModal(); p_intf->p_sys->p_window->ShowModal();
...@@ -116,6 +115,7 @@ static void Run( intf_thread_t *p_intf ) ...@@ -116,6 +115,7 @@ static void Run( intf_thread_t *p_intf )
if( p_intf->p_sys->p_disc ) delete p_intf->p_sys->p_disc; if( p_intf->p_sys->p_disc ) delete p_intf->p_sys->p_disc;
if( p_intf->p_sys->p_network ) delete p_intf->p_sys->p_network; if( p_intf->p_sys->p_network ) delete p_intf->p_sys->p_network;
if( p_intf->p_sys->p_preferences ) delete p_intf->p_sys->p_preferences; if( p_intf->p_sys->p_preferences ) delete p_intf->p_sys->p_preferences;
delete p_intf->p_sys->p_menus;
delete p_intf->p_sys->p_messages; delete p_intf->p_sys->p_messages;
delete p_intf->p_sys->p_playwin; delete p_intf->p_sys->p_playwin;
} }
...@@ -171,7 +171,7 @@ int Win32Manage( intf_thread_t *p_intf ) ...@@ -171,7 +171,7 @@ int Win32Manage( intf_thread_t *p_intf )
if( p_input->stream.b_changed ) if( p_input->stream.b_changed )
{ {
p_intf->p_sys->p_window->ModeManage(); p_intf->p_sys->p_window->ModeManage();
SetupMenus( p_intf ); p_intf->p_sys->p_menus->SetupMenus();
p_intf->p_sys->b_playing = 1; p_intf->p_sys->b_playing = 1;
} }
...@@ -217,7 +217,7 @@ int Win32Manage( intf_thread_t *p_intf ) ...@@ -217,7 +217,7 @@ int Win32Manage( intf_thread_t *p_intf )
p_input->stream.p_selected_area->i_part ) p_input->stream.p_selected_area->i_part )
{ {
// p_intf->p_sys->b_chapter_update = 1; // p_intf->p_sys->b_chapter_update = 1;
SetupMenus( p_intf ); p_intf->p_sys->p_menus->SetupMenus();
} }
} }
......
...@@ -62,6 +62,7 @@ struct intf_sys_t ...@@ -62,6 +62,7 @@ struct intf_sys_t
TDiscDlg * p_disc; /* disc selection window */ TDiscDlg * p_disc; /* disc selection window */
TNetworkDlg * p_network; /* network stream window */ TNetworkDlg * p_network; /* network stream window */
TPreferencesDlg * p_preferences; /* preferences window */ TPreferencesDlg * p_preferences; /* preferences window */
TMenusGen * p_menus; /* object for menu generation */
/* The slider */ /* The slider */
off_t OldValue; /* previous value */ off_t OldValue; /* previous value */
...@@ -78,10 +79,6 @@ struct intf_sys_t ...@@ -78,10 +79,6 @@ struct intf_sys_t
TLabel * p_label_chapter; TLabel * p_label_chapter;
int i_part; /* current chapter */ int i_part; /* current chapter */
/* Language information */
es_descriptor_t * p_audio_es_old;
es_descriptor_t * p_spu_es_old;
/* The input thread */ /* The input thread */
input_thread_t * p_input; input_thread_t * p_input;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment