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 );
}
}
......@@ -419,7 +419,7 @@ void __fastcall TMainFrameDlg::NextTitleActionExecute( 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 );
}
}
......@@ -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 );
}
}
......@@ -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 );
}
}
......
This diff is collapsed.
......@@ -2,6 +2,7 @@
* 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>
*
......@@ -20,13 +21,61 @@
* 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;
/*****************************************************************************
* 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)) )
/* 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,6 +2,7 @@
* 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>
*
......@@ -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;
}
......@@ -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;
}
......@@ -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();
}
}
......
......@@ -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