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 )
p_intf->p_sys->b_title_update = 1;
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 );
}
}
......@@ -412,14 +412,14 @@ void __fastcall TMainFrameDlg::NextTitleActionExecute( TObject *Sender )
if( i_id < p_intf->p_sys->p_input->stream.i_area_nb )
{
p_area = p_intf->p_sys->p_input->stream.pp_areas[i_id];
p_area = p_intf->p_sys->p_input->stream.pp_areas[i_id];
input_ChangeArea( p_intf->p_sys->p_input, (input_area_t*)p_area );
input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_PLAY );
p_intf->p_sys->b_title_update = 1;
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 );
}
}
......@@ -439,7 +439,7 @@ void __fastcall TMainFrameDlg::PrevChapterActionExecute( TObject *Sender )
p_intf->p_sys->b_chapter_update = 1;
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 );
}
}
......@@ -449,7 +449,7 @@ void __fastcall TMainFrameDlg::NextChapterActionExecute( TObject *Sender )
input_area_t * p_area;
p_area = p_intf->p_sys->p_input->stream.p_selected_area;
if( p_area->i_part < p_area->i_part_nb )
{
p_area->i_part++;
......@@ -459,7 +459,7 @@ void __fastcall TMainFrameDlg::NextChapterActionExecute( TObject *Sender )
p_intf->p_sys->b_chapter_update = 1;
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 );
}
}
......@@ -512,7 +512,7 @@ void __fastcall TMainFrameDlg::ModeManage()
if( p_intf->p_sys->p_input != NULL )
{
switch( p_intf->p_sys->p_input->stream.i_method & 0xf0 )
{
{
case INPUT_METHOD_FILE:
GroupBoxFile->Visible = true;
ActiveGB = GroupBoxFile;
......@@ -580,7 +580,7 @@ void __fastcall TMainFrameDlg::ModeManage()
else
{
/* add space between tolbar and statusbar when
* nothing is displayed; isn't it nicer ? :) */
* nothing is displayed; isn't it nicer ? :) */
i_Height += 17;
}
......
......@@ -9,7 +9,7 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
......
This diff is collapsed.
/*****************************************************************************
* menu.h: prototypes for menu functions
*****************************************************************************
* Copyright (C) 2002 VideoLAN
*
* Authors: Olivier Teuliere <ipkiss@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
int __fastcall SetupMenus( intf_thread_t * );
/*****************************************************************************
* Convert user_data structures to title and chapter information
*****************************************************************************/
#define DATA2TITLE( data ) ( (int)((long)(data)) >> 16 )
#define DATA2CHAPTER( data ) ( (int)((long)(data)) & 0xffff )
#define POS2DATA( title, chapter ) ( NULL + ( ((title) << 16) \
| ((chapter) & 0xffff)) )
/*****************************************************************************
* menu.h: prototypes for menu functions
*****************************************************************************
* 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>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef menuH
#define menuH
//----------------------------------------------------------------------------
class TMenusGen : public TObject
{
private:
intf_thread_t *p_intf;
/* local pointers to main window menu items */
TMenuItem *MenuAudio;
TMenuItem *PopupAudio;
TMenuItem *MenuSubtitles;
TMenuItem *PopupSubtitles;
TMenuItem *MenuProgram;
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 )
break;
default:
msg_Warn( p_intf, "unknown config type" );
msg_Warn( p_intf, "unknown config type: %i", p_item->i_type );
break;
}
......
......@@ -2,14 +2,15 @@
* win32.cpp : Win32 interface plugin for vlc
*****************************************************************************
* 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>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
......@@ -50,8 +51,6 @@ static void Run ( intf_thread_t * );
int Win32Manage( void *p_data );
intf_thread_t *p_intfGlobal;
/*****************************************************************************
* Open: initialize interface
*****************************************************************************/
......@@ -67,7 +66,6 @@ static int Open ( vlc_object_t *p_this )
return( 1 );
};
p_intfGlobal = p_intf;
p_intf->pf_run = Run;
p_intf->p_sys->p_sub = msg_Subscribe( 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_playwin = new TPlaylistDlg( 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 */
p_intf->p_sys->p_window->ShowModal();
......@@ -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_network ) delete p_intf->p_sys->p_network;
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_playwin;
}
......@@ -158,7 +158,7 @@ int Win32Manage( intf_thread_t *p_intf )
vlc_object_release( p_intf->p_sys->p_input );
p_intf->p_sys->p_input = NULL;
}
if( p_intf->p_sys->p_input )
{
input_thread_t *p_input = p_intf->p_sys->p_input;
......@@ -171,7 +171,7 @@ int Win32Manage( intf_thread_t *p_intf )
if( p_input->stream.b_changed )
{
p_intf->p_sys->p_window->ModeManage();
SetupMenus( p_intf );
p_intf->p_sys->p_menus->SetupMenus();
p_intf->p_sys->b_playing = 1;
}
......@@ -209,7 +209,7 @@ int Win32Manage( intf_thread_t *p_intf )
/* Update the display */
// TrackBar->Invalidate();
# undef p_area
}
......@@ -217,7 +217,7 @@ int Win32Manage( intf_thread_t *p_intf )
p_input->stream.p_selected_area->i_part )
{
// p_intf->p_sys->b_chapter_update = 1;
SetupMenus( p_intf );
p_intf->p_sys->p_menus->SetupMenus();
}
}
......@@ -239,7 +239,7 @@ int Win32Manage( intf_thread_t *p_intf )
/* Just in case */
return( FALSE );
}
vlc_mutex_unlock( &p_intf->change_lock );
return( TRUE );
......
......@@ -62,6 +62,7 @@ struct intf_sys_t
TDiscDlg * p_disc; /* disc selection window */
TNetworkDlg * p_network; /* network stream window */
TPreferencesDlg * p_preferences; /* preferences window */
TMenusGen * p_menus; /* object for menu generation */
/* The slider */
off_t OldValue; /* previous value */
......@@ -78,10 +79,6 @@ struct intf_sys_t
TLabel * p_label_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 */
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