Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-gpu
Commits
0562366c
Commit
0562366c
authored
Feb 12, 2003
by
Olivier Teulière
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* compilation fix
* all files are stored in dos mode, or Borland won't compile some of them...
parent
3fedb969
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
2399 additions
and
2393 deletions
+2399
-2393
modules/gui/win32/about.cpp
modules/gui/win32/about.cpp
+47
-47
modules/gui/win32/mainframe.cpp
modules/gui/win32/mainframe.cpp
+728
-722
modules/gui/win32/menu.cpp
modules/gui/win32/menu.cpp
+1020
-1020
modules/gui/win32/menu.h
modules/gui/win32/menu.h
+98
-98
modules/gui/win32/sout.h
modules/gui/win32/sout.h
+69
-69
modules/gui/win32/subtitles.cpp
modules/gui/win32/subtitles.cpp
+65
-65
modules/gui/win32/subtitles.h
modules/gui/win32/subtitles.h
+55
-55
modules/gui/win32/win32.bpf
modules/gui/win32/win32.bpf
+2
-2
modules/gui/win32/win32.cpp
modules/gui/win32/win32.cpp
+315
-315
No files found.
modules/gui/win32/about.cpp
View file @
0562366c
/*****************************************************************************
/*****************************************************************************
* about.cpp: The "About" dialog box
* about.cpp: The "About" dialog box
*****************************************************************************
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* Copyright (C) 2002 VideoLAN
*
*
* Authors: Olivier Teuliere <ipkiss@via.ecp.fr>
* Authors: Olivier Teuliere <ipkiss@via.ecp.fr>
*
*
* This program is free software; you can redistribute it and/or modify
* 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
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
*****************************************************************************/
#include <vcl.h>
#include <vcl.h>
#pragma hdrstop
#pragma hdrstop
#include <vlc/vlc.h>
#include <vlc/vlc.h>
#include <vlc/intf.h>
#include <vlc/intf.h>
#include "about.h"
#include "about.h"
#include "misc.h"
#include "misc.h"
#include "win32_common.h"
#include "win32_common.h"
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
//#pragma package(smart_init)
//#pragma package(smart_init)
#pragma resource "*.dfm"
#pragma resource "*.dfm"
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
__fastcall
TAboutDlg
::
TAboutDlg
(
TComponent
*
Owner
,
intf_thread_t
*
_p_intf
)
__fastcall
TAboutDlg
::
TAboutDlg
(
TComponent
*
Owner
,
intf_thread_t
*
_p_intf
)
:
TForm
(
Owner
)
:
TForm
(
Owner
)
{
{
p_intf
=
_p_intf
;
p_intf
=
_p_intf
;
Image1
->
Picture
->
Icon
=
p_intf
->
p_sys
->
p_window
->
Icon
;
Image1
->
Picture
->
Icon
=
p_intf
->
p_sys
->
p_window
->
Icon
;
LabelVersion
->
Caption
=
"Version "
VERSION
;
LabelVersion
->
Caption
=
"Version "
VERSION
;
Translate
(
this
);
Translate
(
this
);
}
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
modules/gui/win32/mainframe.cpp
View file @
0562366c
/*****************************************************************************
/*****************************************************************************
* mainframe.cpp: Win32 interface plugin for vlc
* mainframe.cpp: Win32 interface plugin for vlc
*****************************************************************************
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* Copyright (C) 2002 VideoLAN
*
*
* 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
* 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
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
*****************************************************************************/
#include <vcl.h>
#include <vcl.h>
#pragma hdrstop
#pragma hdrstop
#include <vlc/vlc.h>
#include <vlc/vlc.h>
#include <vlc/intf.h>
#include <vlc/intf.h>
#include <vlc/vout.h>
#include <vlc/vout.h>
#include <vlc/aout.h>
#include "dragdrop.h"
#include "mainframe.h"
#include "dragdrop.h"
#include "menu.h"
#include "mainframe.h"
#include "disc.h"
#include "menu.h"
#include "network.h"
#include "disc.h"
#include "about.h"
#include "network.h"
#include "preferences.h"
#include "about.h"
#include "messages.h"
#include "preferences.h"
#include "playlist.h"
#include "messages.h"
#include "sout.h"
#include "playlist.h"
#include "subtitles.h"
#include "sout.h"
#include "misc.h"
#include "subtitles.h"
#include "win32_common.h"
#include "misc.h"
#include "win32_common.h"
#include "netutils.h"
#include "netutils.h"
//---------------------------------------------------------------------------
#pragma link "CSPIN"
/*****************************************************************************
#pragma resource "*.dfm"
* BORLAND SUCKS
* If the following pragma doesn't end with \r\n instead of \n, the file
extern
int
Win32Manage
(
intf_thread_t
*
p_intf
);
* doesn't compile anymore... Funny, isn't it?
* With vim, you can use ":set ff=dos" to correct it
//---------------------------------------------------------------------------
*****************************************************************************/
__fastcall
TMainFrameDlg
::
TMainFrameDlg
(
#pragma link "CSPIN"
TComponent
*
Owner
,
intf_thread_t
*
_p_intf
)
:
TForm
(
Owner
)
#pragma resource "*.dfm"
{
p_intf
=
_p_intf
;
extern
int
Win32Manage
(
intf_thread_t
*
p_intf
);
Application
->
ShowHint
=
true
;
//---------------------------------------------------------------------------
Application
->
OnHint
=
DisplayHint
;
__fastcall
TMainFrameDlg
::
TMainFrameDlg
(
TComponent
*
Owner
,
intf_thread_t
*
_p_intf
)
:
TForm
(
Owner
)
TimerManage
->
Interval
=
INTF_IDLE_SLEEP
/
1000
;
{
p_intf
=
_p_intf
;
TrackBar
->
Max
=
SLIDER_MAX_VALUE
;
Application
->
ShowHint
=
true
;
/* default height and caption */
Application
->
OnHint
=
DisplayHint
;
ClientHeight
=
37
+
ToolBar
->
Height
;
Caption
=
VOUT_TITLE
" (Win32 interface)"
;
TimerManage
->
Interval
=
INTF_IDLE_SLEEP
/
1000
;
StringListPref
=
new
TStringList
();
TrackBar
->
Max
=
SLIDER_MAX_VALUE
;
Translate
(
this
);
/* default height and caption */
ClientHeight
=
37
+
ToolBar
->
Height
;
/* drag and drop stuff */
Caption
=
VOUT_TITLE
" (Win32 interface)"
;
/* initialize the OLE library */
StringListPref
=
new
TStringList
();
OleInitialize
(
NULL
);
/* TDropTarget will send the WM_OLEDROP message to the form */
Translate
(
this
);
lpDropTarget
=
(
LPDROPTARGET
)
new
TDropTarget
(
this
->
Handle
);
CoLockObjectExternal
(
lpDropTarget
,
true
,
true
);
/* drag and drop stuff */
/* register the form as a drop target */
RegisterDragDrop
(
this
->
Handle
,
lpDropTarget
);
/* initialize the OLE library */
}
OleInitialize
(
NULL
);
//---------------------------------------------------------------------------
/* TDropTarget will send the WM_OLEDROP message to the form */
__fastcall
TMainFrameDlg
::~
TMainFrameDlg
()
lpDropTarget
=
(
LPDROPTARGET
)
new
TDropTarget
(
this
->
Handle
);
{
CoLockObjectExternal
(
lpDropTarget
,
true
,
true
);
delete
StringListPref
;
/* register the form as a drop target */
}
RegisterDragDrop
(
this
->
Handle
,
lpDropTarget
);
//---------------------------------------------------------------------------
}
//---------------------------------------------------------------------------
__fastcall
TMainFrameDlg
::~
TMainFrameDlg
()
/*****************************************************************************
{
* Event handlers
delete
StringListPref
;
****************************************************************************/
}
void
__fastcall
TMainFrameDlg
::
TimerManageTimer
(
TObject
*
Sender
)
//---------------------------------------------------------------------------
{
Win32Manage
(
p_intf
);
}
/*****************************************************************************
//---------------------------------------------------------------------------
* Event handlers
void
__fastcall
TMainFrameDlg
::
DisplayHint
(
TObject
*
Sender
)
****************************************************************************/
{
void
__fastcall
TMainFrameDlg
::
TimerManageTimer
(
TObject
*
Sender
)
StatusBar
->
SimpleText
=
GetLongHint
(
Application
->
Hint
);
{
}
Win32Manage
(
p_intf
);
//---------------------------------------------------------------------------
}
void
__fastcall
TMainFrameDlg
::
TrackBarChange
(
TObject
*
Sender
)
//---------------------------------------------------------------------------
{
void
__fastcall
TMainFrameDlg
::
DisplayHint
(
TObject
*
Sender
)
/* This function displays the current date related to the position in
{
* the stream. It is called whenever the slider changes its value.
StatusBar
->
SimpleText
=
GetLongHint
(
Application
->
Hint
);
* The lock has to be taken before the function is called */
}
//---------------------------------------------------------------------------
if
(
p_intf
->
p_sys
->
p_input
!=
NULL
)
void
__fastcall
TMainFrameDlg
::
TrackBarChange
(
TObject
*
Sender
)
{
{
#define p_area p_intf->p_sys->p_input->stream.p_selected_area
/* This function displays the current date related to the position in
char
psz_time
[
OFFSETTOTIME_MAX_SIZE
];
* the stream. It is called whenever the slider changes its value.
off_t
Value
=
TrackBar
->
Position
;
* The lock has to be taken before the function is called */
GroupBoxSlider
->
Caption
=
if
(
p_intf
->
p_sys
->
p_input
!=
NULL
)
input_OffsetToTime
(
p_intf
->
p_sys
->
p_input
,
psz_time
,
{
(
p_area
->
i_size
*
Value
)
/
(
off_t
)
SLIDER_MAX_VALUE
);
#define p_area p_intf->p_sys->p_input->stream.p_selected_area
#undef p_area
char
psz_time
[
OFFSETTOTIME_MAX_SIZE
];
}
off_t
Value
=
TrackBar
->
Position
;
}
//---------------------------------------------------------------------------
GroupBoxSlider
->
Caption
=
void
__fastcall
TMainFrameDlg
::
FormClose
(
TObject
*
Sender
,
input_OffsetToTime
(
p_intf
->
p_sys
->
p_input
,
psz_time
,
TCloseAction
&
Action
)
(
p_area
->
i_size
*
Value
)
/
(
off_t
)
SLIDER_MAX_VALUE
);
{
#undef p_area
vlc_mutex_lock
(
&
p_intf
->
change_lock
);
}
p_intf
->
p_vlc
->
b_die
=
VLC_TRUE
;
}
vlc_mutex_unlock
(
&
p_intf
->
change_lock
);
//---------------------------------------------------------------------------
void
__fastcall
TMainFrameDlg
::
FormClose
(
TObject
*
Sender
,
/* remove the form from the list of drop targets */
TCloseAction
&
Action
)
RevokeDragDrop
(
this
->
Handle
);
{
lpDropTarget
->
Release
();
vlc_mutex_lock
(
&
p_intf
->
change_lock
);
CoLockObjectExternal
(
lpDropTarget
,
false
,
true
);
p_intf
->
p_vlc
->
b_die
=
VLC_TRUE
;
vlc_mutex_unlock
(
&
p_intf
->
change_lock
);
/* uninitialize the OLE library */
OleUninitialize
();
/* remove the form from the list of drop targets */
RevokeDragDrop
(
this
->
Handle
);
/* we don't destroy the form immediatly */
lpDropTarget
->
Release
();
Action
=
caHide
;
CoLockObjectExternal
(
lpDropTarget
,
false
,
true
);
}
//---------------------------------------------------------------------------
/* uninitialize the OLE library */
OleUninitialize
();
/*****************************************************************************
/* we don't destroy the form immediatly */
* Main callbacks
Action
=
caHide
;
****************************************************************************/
}
void
__fastcall
TMainFrameDlg
::
OpenFileActionExecute
(
TObject
*
Sender
)
//---------------------------------------------------------------------------
{
if
(
OpenDialog1
->
Execute
()
)
{
/*****************************************************************************
/* add the new file to the interface playlist */
* Main callbacks
for
(
int
i
=
0
;
i
<
OpenDialog1
->
Files
->
Count
;
i
++
)
****************************************************************************/
p_intf
->
p_sys
->
p_playwin
->
Add
(
OpenDialog1
->
Files
->
Strings
[
i
],
void
__fastcall
TMainFrameDlg
::
OpenFileActionExecute
(
TObject
*
Sender
)
PLAYLIST_APPEND
{
|
(
p_intf
->
p_sys
->
b_play_when_adding
?
PLAYLIST_GO
:
0
),
if
(
OpenDialog1
->
Execute
()
)
PLAYLIST_END
);
{
};
/* add the new file to the interface playlist */
}
for
(
int
i
=
0
;
i
<
OpenDialog1
->
Files
->
Count
;
i
++
)
//---------------------------------------------------------------------------
p_intf
->
p_sys
->
p_playwin
->
Add
(
OpenDialog1
->
Files
->
Strings
[
i
],
void
__fastcall
TMainFrameDlg
::
OpenDiscActionExecute
(
TObject
*
Sender
)
PLAYLIST_APPEND
{
|
(
p_intf
->
p_sys
->
b_play_when_adding
?
PLAYLIST_GO
:
0
),
TDiscDlg
*
p_disc
=
p_intf
->
p_sys
->
p_disc
;
PLAYLIST_END
);
if
(
p_disc
==
NULL
)
};
{
}
p_disc
=
new
TDiscDlg
(
this
,
p_intf
);
//---------------------------------------------------------------------------
p_intf
->
p_sys
->
p_disc
=
p_disc
;
void
__fastcall
TMainFrameDlg
::
OpenDiscActionExecute
(
TObject
*
Sender
)
}
{
p_disc
->
Show
();
TDiscDlg
*
p_disc
=
p_intf
->
p_sys
->
p_disc
;
}
if
(
p_disc
==
NULL
)
//---------------------------------------------------------------------------
{
void
__fastcall
TMainFrameDlg
::
NetworkStreamActionExecute
(
TObject
*
Sender
)
p_disc
=
new
TDiscDlg
(
this
,
p_intf
);
{
p_intf
->
p_sys
->
p_disc
=
p_disc
;
TNetworkDlg
*
p_network
=
p_intf
->
p_sys
->
p_network
;
}
if
(
p_network
==
NULL
)
p_disc
->
Show
();
{
}
p_network
=
new
TNetworkDlg
(
this
,
p_intf
);
//---------------------------------------------------------------------------
p_intf
->
p_sys
->
p_network
=
p_network
;
void
__fastcall
TMainFrameDlg
::
NetworkStreamActionExecute
(
TObject
*
Sender
)
}
{
p_network
->
Show
();
TNetworkDlg
*
p_network
=
p_intf
->
p_sys
->
p_network
;
}
if
(
p_network
==
NULL
)
//---------------------------------------------------------------------------
{
void
__fastcall
TMainFrameDlg
::
AddSubtitlesActionsExecute
(
TObject
*
Sender
)
p_network
=
new
TNetworkDlg
(
this
,
p_intf
);
{
p_intf
->
p_sys
->
p_network
=
p_network
;
TSubtitlesDlg
*
p_subtitles
=
new
TSubtitlesDlg
(
this
,
p_intf
);
}
p_subtitles
->
ShowModal
();
p_network
->
Show
();
delete
p_subtitles
;
}
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
void
__fastcall
TMainFrameDlg
::
AddSubtitlesActionsExecute
(
TObject
*
Sender
)
void
__fastcall
TMainFrameDlg
::
StreamOutputActionExecute
(
TObject
*
Sender
)
{
{
TSubtitlesDlg
*
p_subtitles
=
new
TSubtitlesDlg
(
this
,
p_intf
);
TSoutDlg
*
p_sout
=
new
TSoutDlg
(
this
,
p_intf
);
p_subtitles
->
ShowModal
();
p_sout
->
ShowModal
();
delete
p_subtitles
;
delete
p_sout
;
}
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
void
__fastcall
TMainFrameDlg
::
StreamOutputActionExecute
(
TObject
*
Sender
)
void
__fastcall
TMainFrameDlg
::
ExitActionExecute
(
TObject
*
Sender
)
{
{
TSoutDlg
*
p_sout
=
new
TSoutDlg
(
this
,
p_intf
);
Close
();
p_sout
->
ShowModal
();
}
delete
p_sout
;
//---------------------------------------------------------------------------
}
void
__fastcall
TMainFrameDlg
::
FullscreenActionExecute
(
TObject
*
Sender
)
//---------------------------------------------------------------------------
{
void
__fastcall
TMainFrameDlg
::
ExitActionExecute
(
TObject
*
Sender
)
vout_thread_t
*
p_vout
;
{
Close
();
p_vout
=
(
vout_thread_t
*
)
vlc_object_find
(
p_intf
->
p_sys
->
p_input
,
}
VLC_OBJECT_VOUT
,
FIND_CHILD
);
//---------------------------------------------------------------------------
if
(
p_vout
==
NULL
)
void
__fastcall
TMainFrameDlg
::
FullscreenActionExecute
(
TObject
*
Sender
)
{
{
return
;
vout_thread_t
*
p_vout
;
}
p_vout
=
(
vout_thread_t
*
)
vlc_object_find
(
p_intf
->
p_sys
->
p_input
,
p_vout
->
i_changes
|=
VOUT_FULLSCREEN_CHANGE
;
VLC_OBJECT_VOUT
,
FIND_CHILD
);
vlc_object_release
(
p_vout
);
if
(
p_vout
==
NULL
)
}
{
//---------------------------------------------------------------------------
return
;
void
__fastcall
TMainFrameDlg
::
OnTopActionExecute
(
TObject
*
Sender
)
}
{
vlc_object_t
*
p_vout
;
p_vout
->
i_changes
|=
VOUT_FULLSCREEN_CHANGE
;
p_vout
=
(
vlc_object_t
*
)
vlc_object_find
(
p_intf
,
VLC_OBJECT_VOUT
,
vlc_object_release
(
p_vout
);
FIND_ANYWHERE
);
}
if
(
p_vout
!=
NULL
)
//---------------------------------------------------------------------------
{
void
__fastcall
TMainFrameDlg
::
OnTopActionExecute
(
TObject
*
Sender
)
vlc_value_t
val
;
{
if
(
var_Get
(
p_vout
,
"directx-on-top"
,
&
val
)
>=
0
)
vlc_object_t
*
p_vout
;
{
p_vout
=
(
vlc_object_t
*
)
vlc_object_find
(
p_intf
,
VLC_OBJECT_VOUT
,
val
.
b_bool
=
!
val
.
b_bool
;
FIND_ANYWHERE
);
var_Set
(
p_vout
,
"directx-on-top"
,
val
);
if
(
p_vout
!=
NULL
)
MenuOnTop
->
Checked
=
val
.
b_bool
;
{
PopupOnTop
->
Checked
=
val
.
b_bool
;
vlc_value_t
val
;
}
if
(
var_Get
(
p_vout
,
"directx-on-top"
,
&
val
)
>=
0
)
vlc_object_release
(
p_vout
);
{
}
val
.
b_bool
=
!
val
.
b_bool
;
}
var_Set
(
p_vout
,
"directx-on-top"
,
val
);
//---------------------------------------------------------------------------
MenuOnTop
->
Checked
=
val
.
b_bool
;
void
__fastcall
TMainFrameDlg
::
PlaylistActionExecute
(
TObject
*
Sender
)
PopupOnTop
->
Checked
=
val
.
b_bool
;
{
}
TPlaylistDlg
*
p_playwin
=
p_intf
->
p_sys
->
p_playwin
;
vlc_object_release
(
p_vout
);
if
(
p_playwin
->
Visible
)
}
{
}
p_playwin
->
Hide
();
//---------------------------------------------------------------------------
}
void
__fastcall
TMainFrameDlg
::
PlaylistActionExecute
(
TObject
*
Sender
)
else
{
{
TPlaylistDlg
*
p_playwin
=
p_intf
->
p_sys
->
p_playwin
;
p_playwin
->
UpdateGrid
();
if
(
p_playwin
->
Visible
)
p_playwin
->
Show
();
{
}
p_playwin
->
Hide
();
}
}
//---------------------------------------------------------------------------
else
void
__fastcall
TMainFrameDlg
::
MessagesActionExecute
(
TObject
*
Sender
)
{
{
p_playwin
->
UpdateGrid
();
p_intf
->
p_sys
->
p_messages
->
Show
();
p_playwin
->
Show
();
}
}
//---------------------------------------------------------------------------
}
void
__fastcall
TMainFrameDlg
::
PreferencesActionExecute
(
TObject
*
Sender
)
//---------------------------------------------------------------------------
{
void
__fastcall
TMainFrameDlg
::
MessagesActionExecute
(
TObject
*
Sender
)
CreatePreferences
(
"main"
);
{
}
p_intf
->
p_sys
->
p_messages
->
Show
();
//---------------------------------------------------------------------------
}
void
__fastcall
TMainFrameDlg
::
AboutActionExecute
(
TObject
*
Sender
)
//---------------------------------------------------------------------------
{
void
__fastcall
TMainFrameDlg
::
PreferencesActionExecute
(
TObject
*
Sender
)
TAboutDlg
*
AboutDlg
=
new
TAboutDlg
(
this
,
p_intf
);
{
AboutDlg
->
ShowModal
();
CreatePreferences
(
"main"
);
delete
AboutDlg
;
}
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
void
__fastcall
TMainFrameDlg
::
AboutActionExecute
(
TObject
*
Sender
)
void
__fastcall
TMainFrameDlg
::
BackActionExecute
(
TObject
*
Sender
)
{
{
TAboutDlg
*
AboutDlg
=
new
TAboutDlg
(
this
,
p_intf
);
/* TODO */
AboutDlg
->
ShowModal
();
}
delete
AboutDlg
;
//---------------------------------------------------------------------------
}
void
__fastcall
TMainFrameDlg
::
PlayActionExecute
(
TObject
*
Sender
)
//---------------------------------------------------------------------------
{
void
__fastcall
TMainFrameDlg
::
BackActionExecute
(
TObject
*
Sender
)
p_intf
->
p_sys
->
p_playwin
->
Play
();
{
}
/* TODO */
//---------------------------------------------------------------------------
}
void
__fastcall
TMainFrameDlg
::
PauseActionExecute
(
TObject
*
Sender
)
//---------------------------------------------------------------------------
{
void
__fastcall
TMainFrameDlg
::
PlayActionExecute
(
TObject
*
Sender
)
p_intf
->
p_sys
->
p_playwin
->
Pause
();
{
}
p_intf
->
p_sys
->
p_playwin
->
Play
();
//---------------------------------------------------------------------------
}
void
__fastcall
TMainFrameDlg
::
StopActionExecute
(
TObject
*
Sender
)
//---------------------------------------------------------------------------
{
void
__fastcall
TMainFrameDlg
::
PauseActionExecute
(
TObject
*
Sender
)
p_intf
->
p_sys
->
p_playwin
->
Stop
();
{
}
p_intf
->
p_sys
->
p_playwin
->
Pause
();
//---------------------------------------------------------------------------
}
void
__fastcall
TMainFrameDlg
::
SlowActionExecute
(
TObject
*
Sender
)
//---------------------------------------------------------------------------
{
void
__fastcall
TMainFrameDlg
::
StopActionExecute
(
TObject
*
Sender
)
p_intf
->
p_sys
->
p_playwin
->
Slow
();
{
}
p_intf
->
p_sys
->
p_playwin
->
Stop
();
//---------------------------------------------------------------------------
}
void
__fastcall
TMainFrameDlg
::
FastActionExecute
(
TObject
*
Sender
)
//---------------------------------------------------------------------------
{
void
__fastcall
TMainFrameDlg
::
SlowActionExecute
(
TObject
*
Sender
)
p_intf
->
p_sys
->
p_playwin
->
Fast
();
{
}
p_intf
->
p_sys
->
p_playwin
->
Slow
();
//---------------------------------------------------------------------------
}
void
__fastcall
TMainFrameDlg
::
PreviousActionExecute
(
TObject
*
Sender
)
//---------------------------------------------------------------------------
{
void
__fastcall
TMainFrameDlg
::
FastActionExecute
(
TObject
*
Sender
)
p_intf
->
p_sys
->
p_playwin
->
Previous
();
{
}
p_intf
->
p_sys
->
p_playwin
->
Fast
();
//---------------------------------------------------------------------------
}
void
__fastcall
TMainFrameDlg
::
NextActionExecute
(
TObject
*
Sender
)
//---------------------------------------------------------------------------
{
void
__fastcall
TMainFrameDlg
::
PreviousActionExecute
(
TObject
*
Sender
)
p_intf
->
p_sys
->
p_playwin
->
Next
();
{
}
p_intf
->
p_sys
->
p_playwin
->
Previous
();
//---------------------------------------------------------------------------
}
void
__fastcall
TMainFrameDlg
::
EjectActionExecute
(
TObject
*
Sender
)
//---------------------------------------------------------------------------
{
void
__fastcall
TMainFrameDlg
::
NextActionExecute
(
TObject
*
Sender
)
AnsiString
Device
=
""
;
{
char
*
psz_current
;
p_intf
->
p_sys
->
p_playwin
->
Next
();
playlist_t
*
p_playlist
;
}
//---------------------------------------------------------------------------
p_playlist
=
(
playlist_t
*
)
vlc_object_find
(
p_intf
,
void
__fastcall
TMainFrameDlg
::
EjectActionExecute
(
TObject
*
Sender
)
VLC_OBJECT_PLAYLIST
,
FIND_ANYWHERE
);
{
if
(
p_playlist
==
NULL
)
AnsiString
Device
=
""
;
{
char
*
psz_current
;
return
;
playlist_t
*
p_playlist
;
}
p_playlist
=
(
playlist_t
*
)
vlc_object_find
(
p_intf
,
/*
VLC_OBJECT_PLAYLIST
,
FIND_ANYWHERE
);
* Get the active input
if
(
p_playlist
==
NULL
)
* Determine whether we can eject a media, ie it's a VCD or DVD
{
* If it's neither a VCD nor a DVD, then return
return
;
*/
}
vlc_mutex_lock
(
&
p_playlist
->
object_lock
);
/*
psz_current
=
p_playlist
->
pp_items
[
p_playlist
->
i_index
]
->
psz_name
;
* Get the active input
* Determine whether we can eject a media, ie it's a VCD or DVD
if
(
psz_current
!=
NULL
)
* If it's neither a VCD nor a DVD, then return
{
*/
if
(
strncmp
(
psz_current
,
"dvd"
,
3
)
||
strncmp
(
psz_current
,
"vcd"
,
3
)
)
vlc_mutex_lock
(
&
p_playlist
->
object_lock
);
{
psz_current
=
p_playlist
->
pp_items
[
p_playlist
->
i_index
]
->
psz_name
;
/* Determine the device name by omitting the first 4 characters
* and keeping 3 characters */
if
(
psz_current
!=
NULL
)
Device
=
strdup
(
(
psz_current
+
4
)
);
{
Device
=
Device
.
SubString
(
1
,
2
);
if
(
strncmp
(
psz_current
,
"dvd"
,
3
)
}
||
strncmp
(
psz_current
,
"vcd"
,
3
)
)
}
{
/* Determine the device name by omitting the first 4 characters
vlc_mutex_unlock
(
&
p_playlist
->
object_lock
);
* and keeping 3 characters */
vlc_object_release
(
p_playlist
);
Device
=
strdup
(
(
psz_current
+
4
)
);
Device
=
Device
.
SubString
(
1
,
2
);
if
(
Device
==
""
)
}
{
}
return
;
}
vlc_mutex_unlock
(
&
p_playlist
->
object_lock
);
vlc_object_release
(
p_playlist
);
/* If there's a stream playing, we aren't allowed to eject ! */
if
(
p_intf
->
p_sys
->
p_input
==
NULL
)
if
(
Device
==
""
)
{
{
msg_Dbg
(
p_intf
,
"ejecting %s"
,
Device
.
c_str
()
);
return
;
}
intf_Eject
(
p_intf
,
Device
.
c_str
()
);
}
/* If there's a stream playing, we aren't allowed to eject ! */
}
if
(
p_intf
->
p_sys
->
p_input
==
NULL
)
//--------------------------------------------------------------------------
{
void
__fastcall
TMainFrameDlg
::
VolumeUpActionExecute
(
TObject
*
Sender
)
msg_Dbg
(
p_intf
,
"ejecting %s"
,
Device
.
c_str
()
);
{
aout_VolumeUp
(
p_intf
,
1
,
NULL
);
intf_Eject
(
p_intf
,
Device
.
c_str
()
);
}
}
//---------------------------------------------------------------------------
}
void
__fastcall
TMainFrameDlg
::
VolumeDownActionExecute
(
TObject
*
Sender
)
//--------------------------------------------------------------------------
{
void
__fastcall
TMainFrameDlg
::
VolumeUpActionExecute
(
TObject
*
Sender
)
aout_VolumeDown
(
p_intf
,
1
,
NULL
);
{
}
aout_VolumeUp
(
p_intf
,
1
,
NULL
);
//---------------------------------------------------------------------------
}
void
__fastcall
TMainFrameDlg
::
MuteActionExecute
(
TObject
*
Sender
)
//---------------------------------------------------------------------------
{
void
__fastcall
TMainFrameDlg
::
VolumeDownActionExecute
(
TObject
*
Sender
)
aout_VolumeMute
(
p_intf
,
NULL
);
{
// MenuMute->Checked = ! MenuMute->Checked;
aout_VolumeDown
(
p_intf
,
1
,
NULL
);
}
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
void
__fastcall
TMainFrameDlg
::
MuteActionExecute
(
TObject
*
Sender
)
{
/*****************************************************************************
aout_VolumeMute
(
p_intf
,
NULL
);
* External drop handling
// MenuMute->Checked = ! MenuMute->Checked;
*****************************************************************************/
}
void
__fastcall
TMainFrameDlg
::
OnDrop
(
TMessage
&
Msg
)
//---------------------------------------------------------------------------
{
/* find the number of files dropped */
int
num_files
=
DragQueryFile
(
(
HDROP
)
Msg
.
WParam
,
0xFFFFFFFF
,
/*****************************************************************************
(
LPSTR
)
NULL
,
NULL
);
* External drop handling
*****************************************************************************/
/* append each file to the playlist */
void
__fastcall
TMainFrameDlg
::
OnDrop
(
TMessage
&
Msg
)
for
(
int
i
=
0
;
i
<
num_files
;
i
++
)
{
{
/* find the number of files dropped */
/* find the length of the filename */
int
num_files
=
DragQueryFile
(
(
HDROP
)
Msg
.
WParam
,
0xFFFFFFFF
,
int
name_length
=
DragQueryFile
(
(
HDROP
)
Msg
.
WParam
,
i
,
NULL
,
NULL
)
+
1
;
(
LPSTR
)
NULL
,
NULL
);
/* get the filename */
/* append each file to the playlist */
char
*
FileName
=
new
char
[
name_length
];
for
(
int
i
=
0
;
i
<
num_files
;
i
++
)
DragQueryFile
(
(
HDROP
)
Msg
.
WParam
,
i
,
FileName
,
name_length
);
{
/* find the length of the filename */
/* add the new file to the playlist */
int
name_length
=
DragQueryFile
(
(
HDROP
)
Msg
.
WParam
,
i
,
NULL
,
NULL
)
+
1
;
if
(
config_GetInt
(
p_intf
,
"enqueue"
)
)
{
/* get the filename */
p_intf
->
p_sys
->
p_playwin
->
Add
(
FileName
,
char
*
FileName
=
new
char
[
name_length
];
PLAYLIST_APPEND
,
PLAYLIST_END
);
DragQueryFile
(
(
HDROP
)
Msg
.
WParam
,
i
,
FileName
,
name_length
);
}
else
/* add the new file to the playlist */
{
if
(
config_GetInt
(
p_intf
,
"enqueue"
)
)
p_intf
->
p_sys
->
p_playwin
->
Add
(
FileName
,
{
PLAYLIST_APPEND
|
PLAYLIST_GO
,
PLAYLIST_END
);
p_intf
->
p_sys
->
p_playwin
->
Add
(
FileName
,
}
PLAYLIST_APPEND
,
PLAYLIST_END
);
}
delete
[]
FileName
;
else
}
{
p_intf
->
p_sys
->
p_playwin
->
Add
(
FileName
,
DragFinish
(
(
HDROP
)
Msg
.
WParam
);
PLAYLIST_APPEND
|
PLAYLIST_GO
,
PLAYLIST_END
);
Msg
.
Result
=
0
;
}
}
//--------------------------------------------------------------------------
delete
[]
FileName
;
}
/*****************************************************************************
DragFinish
(
(
HDROP
)
Msg
.
WParam
);
* Menu and popup callbacks
Msg
.
Result
=
0
;
*****************************************************************************/
}
void
__fastcall
TMainFrameDlg
::
MenuHideinterfaceClick
(
TObject
*
Sender
)
//--------------------------------------------------------------------------
{
this
->
SendToBack
();
}
/*****************************************************************************
//---------------------------------------------------------------------------
* Menu and popup callbacks
void
__fastcall
TMainFrameDlg
::
PopupToggleInterfaceClick
(
TObject
*
Sender
)
*****************************************************************************/
{
void
__fastcall
TMainFrameDlg
::
MenuHideinterfaceClick
(
TObject
*
Sender
)
this
->
BringToFront
();
{
}
this
->
SendToBack
();
//---------------------------------------------------------------------------
}
void
__fastcall
TMainFrameDlg
::
PopupCloseClick
(
TObject
*
Sender
)
//---------------------------------------------------------------------------
{
void
__fastcall
TMainFrameDlg
::
PopupToggleInterfaceClick
(
TObject
*
Sender
)
/* We do nothing, we just need a click on a menu item
{
* to close the popup. Don't ask me why... */
this
->
BringToFront
();
return
;
}
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
void
__fastcall
TMainFrameDlg
::
PopupCloseClick
(
TObject
*
Sender
)
void
__fastcall
TMainFrameDlg
::
PopupJumpClick
(
TObject
*
Sender
)
{
{
/* We do nothing, we just need a click on a menu item
/* TODO */
* to close the popup. Don't ask me why... */
}
return
;
//---------------------------------------------------------------------------
}
//---------------------------------------------------------------------------
void
__fastcall
TMainFrameDlg
::
PopupJumpClick
(
TObject
*
Sender
)
/*****************************************************************************
{
* Callbacks for DVD/VCD navigation
/* TODO */
****************************************************************************/
}
void
__fastcall
TMainFrameDlg
::
PrevTitleActionExecute
(
TObject
*
Sender
)
//---------------------------------------------------------------------------
{
input_area_t
*
p_area
;
int
i_id
;
/*****************************************************************************
* Callbacks for DVD/VCD navigation
vlc_mutex_lock
(
&
p_intf
->
p_sys
->
p_input
->
stream
.
stream_lock
);
****************************************************************************/
i_id
=
p_intf
->
p_sys
->
p_input
->
stream
.
p_selected_area
->
i_id
-
1
;
void
__fastcall
TMainFrameDlg
::
PrevTitleActionExecute
(
TObject
*
Sender
)
{
/* Disallow area 0 since it is used for video_ts.vob */
input_area_t
*
p_area
;
if
(
i_id
>
0
)
int
i_id
;
{
p_area
=
p_intf
->
p_sys
->
p_input
->
stream
.
pp_areas
[
i_id
];
vlc_mutex_lock
(
&
p_intf
->
p_sys
->
p_input
->
stream
.
stream_lock
);
vlc_mutex_unlock
(
&
p_intf
->
p_sys
->
p_input
->
stream
.
stream_lock
);
i_id
=
p_intf
->
p_sys
->
p_input
->
stream
.
p_selected_area
->
i_id
-
1
;
input_ChangeArea
(
p_intf
->
p_sys
->
p_input
,
p_area
);
/* Disallow area 0 since it is used for video_ts.vob */
input_SetStatus
(
p_intf
->
p_sys
->
p_input
,
INPUT_STATUS_PLAY
);
if
(
i_id
>
0
)
{
p_intf
->
p_sys
->
b_title_update
=
VLC_TRUE
;
p_area
=
p_intf
->
p_sys
->
p_input
->
stream
.
pp_areas
[
i_id
];
vlc_mutex_lock
(
&
p_intf
->
p_sys
->
p_input
->
stream
.
stream_lock
);
vlc_mutex_unlock
(
&
p_intf
->
p_sys
->
p_input
->
stream
.
stream_lock
);
p_intf
->
p_sys
->
p_menus
->
SetupMenus
();
}
input_ChangeArea
(
p_intf
->
p_sys
->
p_input
,
p_area
);
input_SetStatus
(
p_intf
->
p_sys
->
p_input
,
INPUT_STATUS_PLAY
);
vlc_mutex_unlock
(
&
p_intf
->
p_sys
->
p_input
->
stream
.
stream_lock
);
}
p_intf
->
p_sys
->
b_title_update
=
VLC_TRUE
;
//---------------------------------------------------------------------------
vlc_mutex_lock
(
&
p_intf
->
p_sys
->
p_input
->
stream
.
stream_lock
);
void
__fastcall
TMainFrameDlg
::
NextTitleActionExecute
(
TObject
*
Sender
)
p_intf
->
p_sys
->
p_menus
->
SetupMenus
();
{
}
input_area_t
*
p_area
;
unsigned
int
i_id
;
vlc_mutex_unlock
(
&
p_intf
->
p_sys
->
p_input
->
stream
.
stream_lock
);
}
vlc_mutex_lock
(
&
p_intf
->
p_sys
->
p_input
->
stream
.
stream_lock
);
//---------------------------------------------------------------------------
i_id
=
p_intf
->
p_sys
->
p_input
->
stream
.
p_selected_area
->
i_id
+
1
;
void
__fastcall
TMainFrameDlg
::
NextTitleActionExecute
(
TObject
*
Sender
)
{
if
(
i_id
<
p_intf
->
p_sys
->
p_input
->
stream
.
i_area_nb
)
input_area_t
*
p_area
;
{
unsigned
int
i_id
;
p_area
=
p_intf
->
p_sys
->
p_input
->
stream
.
pp_areas
[
i_id
];
vlc_mutex_unlock
(
&
p_intf
->
p_sys
->
p_input
->
stream
.
stream_lock
);
vlc_mutex_lock
(
&
p_intf
->
p_sys
->
p_input
->
stream
.
stream_lock
);
i_id
=
p_intf
->
p_sys
->
p_input
->
stream
.
p_selected_area
->
i_id
+
1
;
input_ChangeArea
(
p_intf
->
p_sys
->
p_input
,
p_area
);
input_SetStatus
(
p_intf
->
p_sys
->
p_input
,
INPUT_STATUS_PLAY
);
if
(
i_id
<
p_intf
->
p_sys
->
p_input
->
stream
.
i_area_nb
)
{
p_intf
->
p_sys
->
b_title_update
=
VLC_TRUE
;
p_area
=
p_intf
->
p_sys
->
p_input
->
stream
.
pp_areas
[
i_id
];
vlc_mutex_lock
(
&
p_intf
->
p_sys
->
p_input
->
stream
.
stream_lock
);
vlc_mutex_unlock
(
&
p_intf
->
p_sys
->
p_input
->
stream
.
stream_lock
);
p_intf
->
p_sys
->
p_menus
->
SetupMenus
();
}
input_ChangeArea
(
p_intf
->
p_sys
->
p_input
,
p_area
);
input_SetStatus
(
p_intf
->
p_sys
->
p_input
,
INPUT_STATUS_PLAY
);
vlc_mutex_unlock
(
&
p_intf
->
p_sys
->
p_input
->
stream
.
stream_lock
);
}
p_intf
->
p_sys
->
b_title_update
=
VLC_TRUE
;
//---------------------------------------------------------------------------
vlc_mutex_lock
(
&
p_intf
->
p_sys
->
p_input
->
stream
.
stream_lock
);
void
__fastcall
TMainFrameDlg
::
PrevChapterActionExecute
(
TObject
*
Sender
)
p_intf
->
p_sys
->
p_menus
->
SetupMenus
();
{
}
input_area_t
*
p_area
;
vlc_mutex_unlock
(
&
p_intf
->
p_sys
->
p_input
->
stream
.
stream_lock
);
vlc_mutex_lock
(
&
p_intf
->
p_sys
->
p_input
->
stream
.
stream_lock
);
}
p_area
=
p_intf
->
p_sys
->
p_input
->
stream
.
p_selected_area
;
//---------------------------------------------------------------------------
void
__fastcall
TMainFrameDlg
::
PrevChapterActionExecute
(
TObject
*
Sender
)
if
(
p_area
->
i_part
-
1
>
0
)
{
{
input_area_t
*
p_area
;
p_area
->
i_part
--
;
vlc_mutex_unlock
(
&
p_intf
->
p_sys
->
p_input
->
stream
.
stream_lock
);
vlc_mutex_lock
(
&
p_intf
->
p_sys
->
p_input
->
stream
.
stream_lock
);
p_area
=
p_intf
->
p_sys
->
p_input
->
stream
.
p_selected_area
;
input_ChangeArea
(
p_intf
->
p_sys
->
p_input
,
p_area
);
input_SetStatus
(
p_intf
->
p_sys
->
p_input
,
INPUT_STATUS_PLAY
);
if
(
p_area
->
i_part
-
1
>
0
)
{
p_intf
->
p_sys
->
b_chapter_update
=
VLC_TRUE
;
p_area
->
i_part
--
;
vlc_mutex_lock
(
&
p_intf
->
p_sys
->
p_input
->
stream
.
stream_lock
);
vlc_mutex_unlock
(
&
p_intf
->
p_sys
->
p_input
->
stream
.
stream_lock
);
p_intf
->
p_sys
->
p_menus
->
SetupMenus
();
}
input_ChangeArea
(
p_intf
->
p_sys
->
p_input
,
p_area
);
input_SetStatus
(
p_intf
->
p_sys
->
p_input
,
INPUT_STATUS_PLAY
);
vlc_mutex_unlock
(
&
p_intf
->
p_sys
->
p_input
->
stream
.
stream_lock
);
}
p_intf
->
p_sys
->
b_chapter_update
=
VLC_TRUE
;
//---------------------------------------------------------------------------
vlc_mutex_lock
(
&
p_intf
->
p_sys
->
p_input
->
stream
.
stream_lock
);
void
__fastcall
TMainFrameDlg
::
NextChapterActionExecute
(
TObject
*
Sender
)
p_intf
->
p_sys
->
p_menus
->
SetupMenus
();
{
}
input_area_t
*
p_area
;
vlc_mutex_unlock
(
&
p_intf
->
p_sys
->
p_input
->
stream
.
stream_lock
);
vlc_mutex_lock
(
&
p_intf
->
p_sys
->
p_input
->
stream
.
stream_lock
);
}
p_area
=
p_intf
->
p_sys
->
p_input
->
stream
.
p_selected_area
;
//---------------------------------------------------------------------------
void
__fastcall
TMainFrameDlg
::
NextChapterActionExecute
(
TObject
*
Sender
)
if
(
p_area
->
i_part
+
1
<
p_area
->
i_part_nb
)
{
{
input_area_t
*
p_area
;
p_area
->
i_part
++
;
vlc_mutex_unlock
(
&
p_intf
->
p_sys
->
p_input
->
stream
.
stream_lock
);
vlc_mutex_lock
(
&
p_intf
->
p_sys
->
p_input
->
stream
.
stream_lock
);
p_area
=
p_intf
->
p_sys
->
p_input
->
stream
.
p_selected_area
;
input_ChangeArea
(
p_intf
->
p_sys
->
p_input
,
p_area
);
input_SetStatus
(
p_intf
->
p_sys
->
p_input
,
INPUT_STATUS_PLAY
);
if
(
p_area
->
i_part
+
1
<
p_area
->
i_part_nb
)
{
p_intf
->
p_sys
->
b_chapter_update
=
VLC_TRUE
;
p_area
->
i_part
++
;
vlc_mutex_lock
(
&
p_intf
->
p_sys
->
p_input
->
stream
.
stream_lock
);
vlc_mutex_unlock
(
&
p_intf
->
p_sys
->
p_input
->
stream
.
stream_lock
);
p_intf
->
p_sys
->
p_menus
->
SetupMenus
();
}
input_ChangeArea
(
p_intf
->
p_sys
->
p_input
,
p_area
);
input_SetStatus
(
p_intf
->
p_sys
->
p_input
,
INPUT_STATUS_PLAY
);
vlc_mutex_unlock
(
&
p_intf
->
p_sys
->
p_input
->
stream
.
stream_lock
);
}
p_intf
->
p_sys
->
b_chapter_update
=
VLC_TRUE
;
//---------------------------------------------------------------------------
vlc_mutex_lock
(
&
p_intf
->
p_sys
->
p_input
->
stream
.
stream_lock
);
p_intf
->
p_sys
->
p_menus
->
SetupMenus
();
}
/*****************************************************************************
* Callback for the 'go!' button
vlc_mutex_unlock
(
&
p_intf
->
p_sys
->
p_input
->
stream
.
stream_lock
);
****************************************************************************/
}
void
__fastcall
TMainFrameDlg
::
ButtonGoClick
(
TObject
*
Sender
)
//---------------------------------------------------------------------------
{
int
i_channel
;
/*****************************************************************************
i_channel
=
SpinEditChannel
->
Value
;
* Callback for the 'go!' button
msg_Dbg
(
p_intf
,
"joining channel %d"
,
i_channel
);
****************************************************************************/
void
__fastcall
TMainFrameDlg
::
ButtonGoClick
(
TObject
*
Sender
)
vlc_mutex_lock
(
&
p_intf
->
change_lock
);
{
network_ChannelJoin
(
p_intf
,
i_channel
);
int
i_channel
;
vlc_mutex_unlock
(
&
p_intf
->
change_lock
);
i_channel
=
SpinEditChannel
->
Value
;
// input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_PLAY );
msg_Dbg
(
p_intf
,
"joining channel %d"
,
i_channel
);
}
//---------------------------------------------------------------------------
vlc_mutex_lock
(
&
p_intf
->
change_lock
);
network_ChannelJoin
(
p_intf
,
i_channel
);
vlc_mutex_unlock
(
&
p_intf
->
change_lock
);
/*****************************************************************************
* ModeManage: actualise the aspect of the interface whenever the input
// input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_PLAY );
* changes.
}
*****************************************************************************
//---------------------------------------------------------------------------
* The lock has to be taken before you call the function.
*****************************************************************************/
void
__fastcall
TMainFrameDlg
::
ModeManage
()
/*****************************************************************************
{
* ModeManage: actualise the aspect of the interface whenever the input
TGroupBox
*
ActiveGB
;
* changes.
int
i_Height
;
*****************************************************************************
bool
b_control
;
* The lock has to be taken before you call the function.
*****************************************************************************/
/* hide all boxes */
void
__fastcall
TMainFrameDlg
::
ModeManage
()
GroupBoxFile
->
Visible
=
false
;
{
GroupBoxNetwork
->
Visible
=
false
;
TGroupBox
*
ActiveGB
;
GroupBoxDisc
->
Visible
=
false
;
int
i_Height
;
bool
b_control
;
/* hide slider */
GroupBoxSlider
->
Hide
();
/* hide all boxes */
GroupBoxFile
->
Visible
=
false
;
/* controls unavailable */
GroupBoxNetwork
->
Visible
=
false
;
b_control
=
0
;
GroupBoxDisc
->
Visible
=
false
;
/* show the box related to current input mode */
/* hide slider */
if
(
p_intf
->
p_sys
->
p_input
!=
NULL
)
GroupBoxSlider
->
Hide
();
{
switch
(
p_intf
->
p_sys
->
p_input
->
stream
.
i_method
&
0xf0
)
/* controls unavailable */
{
b_control
=
0
;
case
INPUT_METHOD_FILE
:
GroupBoxFile
->
Visible
=
true
;
/* show the box related to current input mode */
ActiveGB
=
GroupBoxFile
;
if
(
p_intf
->
p_sys
->
p_input
!=
NULL
)
LabelFileName
->
Caption
=
p_intf
->
p_sys
->
p_input
->
psz_source
;
{
break
;
switch
(
p_intf
->
p_sys
->
p_input
->
stream
.
i_method
&
0xf0
)
case
INPUT_METHOD_DISC
:
{
GroupBoxDisc
->
Visible
=
true
;
case
INPUT_METHOD_FILE
:
ActiveGB
=
GroupBoxDisc
;
GroupBoxFile
->
Visible
=
true
;
break
;
ActiveGB
=
GroupBoxFile
;
case
INPUT_METHOD_NETWORK
:
LabelFileName
->
Caption
=
p_intf
->
p_sys
->
p_input
->
psz_source
;
GroupBoxNetwork
->
Visible
=
true
;
break
;
ActiveGB
=
GroupBoxNetwork
;
case
INPUT_METHOD_DISC
:
LabelServer
->
Caption
=
p_intf
->
p_sys
->
p_input
->
psz_source
;
GroupBoxDisc
->
Visible
=
true
;
if
(
config_GetInt
(
p_intf
,
"network-channel"
)
)
ActiveGB
=
GroupBoxDisc
;
{
break
;
LabelChannel
->
Visible
=
true
;
case
INPUT_METHOD_NETWORK
:
}
GroupBoxNetwork
->
Visible
=
true
;
else
ActiveGB
=
GroupBoxNetwork
;
{
LabelServer
->
Caption
=
p_intf
->
p_sys
->
p_input
->
psz_source
;
LabelChannel
->
Visible
=
false
;
if
(
config_GetInt
(
p_intf
,
"network-channel"
)
)
}
{
break
;
LabelChannel
->
Visible
=
true
;
default:
}
msg_Warn
(
p_intf
,
"cannot determine input method"
);
else
GroupBoxFile
->
Visible
=
true
;
{
ActiveGB
=
GroupBoxFile
;
LabelChannel
->
Visible
=
false
;
LabelFileName
->
Caption
=
p_intf
->
p_sys
->
p_input
->
psz_source
;
}
break
;
break
;
}
default:
msg_Warn
(
p_intf
,
"cannot determine input method"
);
i_Height
=
StatusBar
->
Height
+
ActiveGB
->
Height
+
ToolBar
->
Height
+
54
;
GroupBoxFile
->
Visible
=
true
;
ActiveGB
=
GroupBoxFile
;
/* initialize and show slider for seekable streams */
LabelFileName
->
Caption
=
p_intf
->
p_sys
->
p_input
->
psz_source
;
if
(
p_intf
->
p_sys
->
p_input
->
stream
.
b_seekable
)
break
;
{
}
TrackBar
->
Position
=
p_intf
->
p_sys
->
OldValue
=
0
;
GroupBoxSlider
->
Show
();
i_Height
=
StatusBar
->
Height
+
ActiveGB
->
Height
+
ToolBar
->
Height
+
54
;
i_Height
+=
GroupBoxSlider
->
Height
;
}
/* initialize and show slider for seekable streams */
if
(
p_intf
->
p_sys
->
p_input
->
stream
.
b_seekable
)
/* control buttons for free pace streams */
{
b_control
=
p_intf
->
p_sys
->
p_input
->
stream
.
b_pace_control
;
TrackBar
->
Position
=
p_intf
->
p_sys
->
OldValue
=
0
;
GroupBoxSlider
->
Show
();
/* get ready for menu regeneration */
i_Height
+=
GroupBoxSlider
->
Height
;
p_intf
->
p_sys
->
b_program_update
=
1
;
}
p_intf
->
p_sys
->
b_title_update
=
1
;
p_intf
->
p_sys
->
b_chapter_update
=
1
;
/* control buttons for free pace streams */
p_intf
->
p_sys
->
b_audio_update
=
1
;
b_control
=
p_intf
->
p_sys
->
p_input
->
stream
.
b_pace_control
;
p_intf
->
p_sys
->
b_spu_update
=
1
;
p_intf
->
p_sys
->
i_part
=
0
;
/* get ready for menu regeneration */
p_intf
->
p_sys
->
b_program_update
=
1
;
p_intf
->
p_sys
->
p_input
->
stream
.
b_changed
=
0
;
p_intf
->
p_sys
->
b_title_update
=
1
;
msg_Dbg
(
p_intf
,
"stream has changed, refreshing interface"
);
p_intf
->
p_sys
->
b_chapter_update
=
1
;
}
p_intf
->
p_sys
->
b_audio_update
=
1
;
else
p_intf
->
p_sys
->
b_spu_update
=
1
;
{
p_intf
->
p_sys
->
i_part
=
0
;
i_Height
=
StatusBar
->
Height
+
ToolBar
->
Height
+
47
;
p_intf
->
p_sys
->
p_input
->
stream
.
b_changed
=
0
;
if
(
config_GetInt
(
p_intf
,
"network-channel"
)
)
msg_Dbg
(
p_intf
,
"stream has changed, refreshing interface"
);
{
}
GroupBoxNetwork
->
Visible
=
true
;
else
LabelChannel
->
Visible
=
true
;
{
i_Height
+=
GroupBoxNetwork
->
Height
+
7
;
i_Height
=
StatusBar
->
Height
+
ToolBar
->
Height
+
47
;
}
else
if
(
config_GetInt
(
p_intf
,
"network-channel"
)
)
{
{
/* add space between tolbar and statusbar when
GroupBoxNetwork
->
Visible
=
true
;
* nothing is displayed; isn't it nicer ? :) */
LabelChannel
->
Visible
=
true
;
i_Height
+=
17
;
i_Height
+=
GroupBoxNetwork
->
Height
+
7
;
}
}
else
/* unsensitize menus */
{
MenuProgram
->
Enabled
=
false
;
/* add space between tolbar and statusbar when
MenuTitle
->
Enabled
=
false
;
* nothing is displayed; isn't it nicer ? :) */
MenuChapter
->
Enabled
=
false
;
i_Height
+=
17
;
MenuLanguage
->
Enabled
=
false
;
}
MenuSubtitles
->
Enabled
=
false
;
PopupNavigation
->
Enabled
=
false
;
/* unsensitize menus */
PopupLanguage
->
Enabled
=
false
;
MenuProgram
->
Enabled
=
false
;
PopupSubtitles
->
Enabled
=
false
;
MenuTitle
->
Enabled
=
false
;
}
MenuChapter
->
Enabled
=
false
;
MenuLanguage
->
Enabled
=
false
;
/* resize main window */
MenuSubtitles
->
Enabled
=
false
;
this
->
Height
=
i_Height
;
PopupNavigation
->
Enabled
=
false
;
PopupLanguage
->
Enabled
=
false
;
/* set control items */
PopupSubtitles
->
Enabled
=
false
;
ToolButtonBack
->
Enabled
=
false
;
}
ToolButtonEject
->
Enabled
=
!
b_control
;
StopAction
->
Enabled
=
true
;
/* resize main window */
PauseAction
->
Enabled
=
b_control
;
this
->
Height
=
i_Height
;
SlowAction
->
Enabled
=
b_control
;
FastAction
->
Enabled
=
b_control
;
/* set control items */
PopupBack
->
Enabled
=
false
;
ToolButtonBack
->
Enabled
=
false
;
}
ToolButtonEject
->
Enabled
=
!
b_control
;
//---------------------------------------------------------------------------
StopAction
->
Enabled
=
true
;
PauseAction
->
Enabled
=
b_control
;
SlowAction
->
Enabled
=
b_control
;
/*****************************************************************************
FastAction
->
Enabled
=
b_control
;
* CreateConfig: create a configuration dialog and save it for further use
PopupBack
->
Enabled
=
false
;
*****************************************************************************
}
* Check if the dialog box is already opened, if so this will save us
//---------------------------------------------------------------------------
* quite a bit of work. (the interface will be destroyed when you actually
* close the main window, but remember that it is only hidden if you
* clicked on the action buttons). This trick also allows us not to
/*****************************************************************************
* duplicate identical dialog windows.
* CreateConfig: create a configuration dialog and save it for further use
*****************************************************************************/
*****************************************************************************
void
__fastcall
TMainFrameDlg
::
CreatePreferences
(
AnsiString
Name
)
* Check if the dialog box is already opened, if so this will save us
{
* quite a bit of work. (the interface will be destroyed when you actually
TPreferencesDlg
*
Preferences
;
* close the main window, but remember that it is only hidden if you
int
i_index
,
i_pos
;
* clicked on the action buttons). This trick also allows us not to
* duplicate identical dialog windows.
i_index
=
StringListPref
->
IndexOf
(
Name
);
*****************************************************************************/
if
(
i_index
!=
-
1
)
void
__fastcall
TMainFrameDlg
::
CreatePreferences
(
AnsiString
Name
)
{
{
/* config dialog already exists */
TPreferencesDlg
*
Preferences
;
Preferences
=
(
TPreferencesDlg
*
)
StringListPref
->
Objects
[
i_index
];
int
i_index
,
i_pos
;
}
else
i_index
=
StringListPref
->
IndexOf
(
Name
);
{
if
(
i_index
!=
-
1
)
/* create the config dialog */
{
Preferences
=
new
TPreferencesDlg
(
this
,
p_intf
);
/* config dialog already exists */
Preferences
->
CreateConfigDialog
(
Name
.
c_str
()
);
Preferences
=
(
TPreferencesDlg
*
)
StringListPref
->
Objects
[
i_index
];
}
/* save it */
else
i_pos
=
StringListPref
->
Add
(
Name
);
{
StringListPref
->
Objects
[
i_pos
]
=
Preferences
;
/* create the config dialog */
}
Preferences
=
new
TPreferencesDlg
(
this
,
p_intf
);
Preferences
->
CreateConfigDialog
(
Name
.
c_str
()
);
/* display the dialog */
Preferences
->
Show
();
/* save it */
}
i_pos
=
StringListPref
->
Add
(
Name
);
//---------------------------------------------------------------------------
StringListPref
->
Objects
[
i_pos
]
=
Preferences
;
}
/* display the dialog */
Preferences
->
Show
();
}
//---------------------------------------------------------------------------
modules/gui/win32/menu.cpp
View file @
0562366c
/*****************************************************************************
/*****************************************************************************
* menu.cpp: functions to handle menu items
* menu.cpp: functions to handle menu items
*****************************************************************************
*****************************************************************************
* Copyright (C) 2002-2003 VideoLAN
* Copyright (C) 2002-2003 VideoLAN
* $Id: menu.cpp,v 1.1
3 2003/02/06 23:59:40 sam Exp $
* $Id: menu.cpp,v 1.1
4 2003/02/12 02:11:58 ipkiss Exp $
*
*
* Authors: Olivier Teuliere <ipkiss@via.ecp.fr>
* Authors: Olivier Teuliere <ipkiss@via.ecp.fr>
*
*
* This program is free software; you can redistribute it and/or modify
* 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
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
*****************************************************************************/
#include <vcl.h>
#include <vcl.h>
#include <vlc/vlc.h>
#include <vlc/vlc.h>
#include <vlc/intf.h>
#include <vlc/intf.h>
#include "menu.h"
#include "menu.h"
#include "win32_common.h"
#include "win32_common.h"
/*****************************************************************************
/*****************************************************************************
* TMenusGen::*Click: callbacks for the menuitems
* TMenusGen::*Click: callbacks for the menuitems
****************************************************************************/
****************************************************************************/
/*
/*
* Variables
* Variables
*/
*/
/* variables of the audio output */
/* variables of the audio output */
void
__fastcall
TMenusGen
::
AoutVarClick
(
TObject
*
Sender
)
void
__fastcall
TMenusGen
::
AoutVarClick
(
TObject
*
Sender
)
{
{
TMenuItem
*
Item
=
(
TMenuItem
*
)
Sender
;
TMenuItem
*
Item
=
(
TMenuItem
*
)
Sender
;
vlc_object_t
*
p_aout
;
vlc_object_t
*
p_aout
;
p_aout
=
(
vlc_object_t
*
)
vlc_object_find
(
p_intf
,
VLC_OBJECT_AOUT
,
p_aout
=
(
vlc_object_t
*
)
vlc_object_find
(
p_intf
,
VLC_OBJECT_AOUT
,
FIND_ANYWHERE
);
FIND_ANYWHERE
);
if
(
p_aout
==
NULL
)
if
(
p_aout
==
NULL
)
{
{
msg_Warn
(
p_intf
,
"cannot set variable (%s)"
,
Item
->
Caption
.
c_str
()
);
msg_Warn
(
p_intf
,
"cannot set variable (%s)"
,
Item
->
Caption
.
c_str
()
);
return
;
return
;
}
}
if
(
Item
->
Parent
==
MenuADevice
||
Item
->
Parent
==
PopupADevice
)
if
(
Item
->
Parent
==
MenuADevice
||
Item
->
Parent
==
PopupADevice
)
{
{
VarChange
(
p_aout
,
"audio-device"
,
MenuADevice
,
PopupADevice
,
Item
);
VarChange
(
p_aout
,
"audio-device"
,
MenuADevice
,
PopupADevice
,
Item
);
}
}
else
if
(
Item
->
Parent
==
MenuChannel
||
Item
->
Parent
==
PopupChannel
)
else
if
(
Item
->
Parent
==
MenuChannel
||
Item
->
Parent
==
PopupChannel
)
{
{
VarChange
(
p_aout
,
"audio-channels"
,
MenuChannel
,
PopupChannel
,
Item
);
VarChange
(
p_aout
,
"audio-channels"
,
MenuChannel
,
PopupChannel
,
Item
);
}
}
vlc_object_release
(
p_aout
);
vlc_object_release
(
p_aout
);
}
}
/* variables of the video output */
/* variables of the video output */
void
__fastcall
TMenusGen
::
VoutVarClick
(
TObject
*
Sender
)
void
__fastcall
TMenusGen
::
VoutVarClick
(
TObject
*
Sender
)
{
{
TMenuItem
*
Item
=
(
TMenuItem
*
)
Sender
;
TMenuItem
*
Item
=
(
TMenuItem
*
)
Sender
;
vlc_object_t
*
p_vout
;
vlc_object_t
*
p_vout
;
p_vout
=
(
vlc_object_t
*
)
vlc_object_find
(
p_intf
,
VLC_OBJECT_VOUT
,
p_vout
=
(
vlc_object_t
*
)
vlc_object_find
(
p_intf
,
VLC_OBJECT_VOUT
,
FIND_ANYWHERE
);
FIND_ANYWHERE
);
if
(
p_vout
==
NULL
)
if
(
p_vout
==
NULL
)
{
{
msg_Warn
(
p_intf
,
"cannot set variable (%s)"
,
Item
->
Caption
.
c_str
()
);
msg_Warn
(
p_intf
,
"cannot set variable (%s)"
,
Item
->
Caption
.
c_str
()
);
return
;
return
;
}
}
if
(
Item
->
Parent
==
MenuVDevice
||
Item
->
Parent
==
PopupVDevice
)
if
(
Item
->
Parent
==
MenuVDevice
||
Item
->
Parent
==
PopupVDevice
)
{
{
VarChange
(
p_vout
,
"video-device"
,
MenuVDevice
,
PopupVDevice
,
Item
);
VarChange
(
p_vout
,
"video-device"
,
MenuVDevice
,
PopupVDevice
,
Item
);
}
}
vlc_object_release
(
p_vout
);
vlc_object_release
(
p_vout
);
}
}
/*
/*
* Modules
* Modules
*/
*/
/* Interface modules: we spawn a new interface */
/* Interface modules: we spawn a new interface */
void
__fastcall
TMenusGen
::
InterfaceModuleClick
(
TObject
*
Sender
)
void
__fastcall
TMenusGen
::
InterfaceModuleClick
(
TObject
*
Sender
)
{
{
TMenuItem
*
Item
=
(
TMenuItem
*
)
Sender
;
TMenuItem
*
Item
=
(
TMenuItem
*
)
Sender
;
AnsiString
IntfName
=
CleanCaption
(
Item
->
Caption
);
AnsiString
IntfName
=
CleanCaption
(
Item
->
Caption
);
intf_thread_t
*
p_newintf
;
intf_thread_t
*
p_newintf
;
p_newintf
=
intf_Create
(
p_intf
->
p_vlc
,
IntfName
.
c_str
()
);
p_newintf
=
intf_Create
(
p_intf
->
p_vlc
,
IntfName
.
c_str
()
);
if
(
p_newintf
)
if
(
p_newintf
)
{
{
p_newintf
->
b_block
=
VLC_FALSE
;
p_newintf
->
b_block
=
VLC_FALSE
;
if
(
intf_RunThread
(
p_newintf
)
)
if
(
intf_RunThread
(
p_newintf
)
)
{
{
vlc_object_detach
(
p_newintf
);
vlc_object_detach
(
p_newintf
);
intf_Destroy
(
p_newintf
);
intf_Destroy
(
p_newintf
);
}
}
}
}
}
}
/*
/*
* Audio
* Audio
*/
*/
void
__fastcall
TMenusGen
::
MenuLanguageClick
(
TObject
*
Sender
)
void
__fastcall
TMenusGen
::
MenuLanguageClick
(
TObject
*
Sender
)
{
{
LangChange
(
MenuLanguage
,
(
TMenuItem
*
)
Sender
,
PopupLanguage
,
AUDIO_ES
);
LangChange
(
MenuLanguage
,
(
TMenuItem
*
)
Sender
,
PopupLanguage
,
AUDIO_ES
);
}
}
void
__fastcall
TMenusGen
::
PopupLanguageClick
(
TObject
*
Sender
)
void
__fastcall
TMenusGen
::
PopupLanguageClick
(
TObject
*
Sender
)
{
{
LangChange
(
PopupLanguage
,
(
TMenuItem
*
)
Sender
,
MenuLanguage
,
AUDIO_ES
);
LangChange
(
PopupLanguage
,
(
TMenuItem
*
)
Sender
,
MenuLanguage
,
AUDIO_ES
);
}
}
/*
/*
* Subtitles
* Subtitles
*/
*/
void
__fastcall
TMenusGen
::
MenuSubtitleClick
(
TObject
*
Sender
)
void
__fastcall
TMenusGen
::
MenuSubtitleClick
(
TObject
*
Sender
)
{
{
LangChange
(
MenuSubtitles
,
(
TMenuItem
*
)
Sender
,
PopupSubtitles
,
SPU_ES
);
LangChange
(
MenuSubtitles
,
(
TMenuItem
*
)
Sender
,
PopupSubtitles
,
SPU_ES
);
}
}
void
__fastcall
TMenusGen
::
PopupSubtitleClick
(
TObject
*
Sender
)
void
__fastcall
TMenusGen
::
PopupSubtitleClick
(
TObject
*
Sender
)
{
{
LangChange
(
PopupSubtitles
,
(
TMenuItem
*
)
Sender
,
MenuSubtitles
,
SPU_ES
);
LangChange
(
PopupSubtitles
,
(
TMenuItem
*
)
Sender
,
MenuSubtitles
,
SPU_ES
);
}
}
/*
/*
* Program
* Program
*/
*/
void
__fastcall
TMenusGen
::
MenuProgramClick
(
TObject
*
Sender
)
void
__fastcall
TMenusGen
::
MenuProgramClick
(
TObject
*
Sender
)
{
{
ProgramChange
(
(
TMenuItem
*
)
Sender
,
PopupProgram
);
ProgramChange
(
(
TMenuItem
*
)
Sender
,
PopupProgram
);
}
}
void
__fastcall
TMenusGen
::
PopupProgramClick
(
TObject
*
Sender
)
void
__fastcall
TMenusGen
::
PopupProgramClick
(
TObject
*
Sender
)
{
{
ProgramChange
(
(
TMenuItem
*
)
Sender
,
MenuProgram
);
ProgramChange
(
(
TMenuItem
*
)
Sender
,
MenuProgram
);
}
}
/*
/*
* Title
* Title
*/
*/
void
__fastcall
TMenusGen
::
MenuTitleClick
(
TObject
*
Sender
)
void
__fastcall
TMenusGen
::
MenuTitleClick
(
TObject
*
Sender
)
{
{
TMenuItem
*
Item
=
(
TMenuItem
*
)
Sender
;
TMenuItem
*
Item
=
(
TMenuItem
*
)
Sender
;
TMenuItem
*
ItemTitle
;
TMenuItem
*
ItemTitle
;
input_area_t
*
p_area
;
input_area_t
*
p_area
;
unsigned
int
i_title
=
Item
->
Tag
;
unsigned
int
i_title
=
Item
->
Tag
;
vlc_mutex_lock
(
&
p_intf
->
p_sys
->
p_input
->
stream
.
stream_lock
);
vlc_mutex_lock
(
&
p_intf
->
p_sys
->
p_input
->
stream
.
stream_lock
);
i_title
=
__MIN
(
i_title
,
i_title
=
__MIN
(
i_title
,
p_intf
->
p_sys
->
p_input
->
stream
.
i_area_nb
-
1
);
p_intf
->
p_sys
->
p_input
->
stream
.
i_area_nb
-
1
);
i_title
=
__MAX
(
i_title
,
1
);
i_title
=
__MAX
(
i_title
,
1
);
p_area
=
p_intf
->
p_sys
->
p_input
->
stream
.
pp_areas
[
i_title
];
p_area
=
p_intf
->
p_sys
->
p_input
->
stream
.
pp_areas
[
i_title
];
vlc_mutex_unlock
(
&
p_intf
->
p_sys
->
p_input
->
stream
.
stream_lock
);
vlc_mutex_unlock
(
&
p_intf
->
p_sys
->
p_input
->
stream
.
stream_lock
);
input_ChangeArea
(
p_intf
->
p_sys
->
p_input
,
p_area
);
input_ChangeArea
(
p_intf
->
p_sys
->
p_input
,
p_area
);
Item
->
Checked
=
true
;
Item
->
Checked
=
true
;
ItemTitle
=
Index2Item
(
PopupNavigation
,
i_title
-
1
,
false
);
ItemTitle
=
Index2Item
(
PopupNavigation
,
i_title
-
1
,
false
);
Index2Item
(
ItemTitle
,
0
,
false
)
->
Checked
=
true
;
Index2Item
(
ItemTitle
,
0
,
false
)
->
Checked
=
true
;
input_SetStatus
(
p_intf
->
p_sys
->
p_input
,
INPUT_STATUS_PLAY
);
input_SetStatus
(
p_intf
->
p_sys
->
p_input
,
INPUT_STATUS_PLAY
);
}
}
/*
/*
* Chapter
* Chapter
*/
*/
void
__fastcall
TMenusGen
::
MenuChapterClick
(
TObject
*
Sender
)
void
__fastcall
TMenusGen
::
MenuChapterClick
(
TObject
*
Sender
)
{
{
TMenuItem
*
Item
=
(
TMenuItem
*
)
Sender
;
TMenuItem
*
Item
=
(
TMenuItem
*
)
Sender
;
TMenuItem
*
ItemTitle
;
TMenuItem
*
ItemTitle
;
input_area_t
*
p_area
;
input_area_t
*
p_area
;
unsigned
int
i_title
;
unsigned
int
i_title
;
unsigned
int
i_chapter
=
Item
->
Tag
;
unsigned
int
i_chapter
=
Item
->
Tag
;
vlc_mutex_lock
(
&
p_intf
->
p_sys
->
p_input
->
stream
.
stream_lock
);
vlc_mutex_lock
(
&
p_intf
->
p_sys
->
p_input
->
stream
.
stream_lock
);
p_area
=
p_intf
->
p_sys
->
p_input
->
stream
.
p_selected_area
;
p_area
=
p_intf
->
p_sys
->
p_input
->
stream
.
p_selected_area
;
i_chapter
=
__MIN
(
i_chapter
,
p_area
->
i_part_nb
-
1
);
i_chapter
=
__MIN
(
i_chapter
,
p_area
->
i_part_nb
-
1
);
i_chapter
=
__MAX
(
i_chapter
,
1
);
i_chapter
=
__MAX
(
i_chapter
,
1
);
p_area
->
i_part
=
i_chapter
;
p_area
->
i_part
=
i_chapter
;
vlc_mutex_unlock
(
&
p_intf
->
p_sys
->
p_input
->
stream
.
stream_lock
);
vlc_mutex_unlock
(
&
p_intf
->
p_sys
->
p_input
->
stream
.
stream_lock
);
input_ChangeArea
(
p_intf
->
p_sys
->
p_input
,
p_area
);
input_ChangeArea
(
p_intf
->
p_sys
->
p_input
,
p_area
);
vlc_mutex_lock
(
&
p_intf
->
p_sys
->
p_input
->
stream
.
stream_lock
);
vlc_mutex_lock
(
&
p_intf
->
p_sys
->
p_input
->
stream
.
stream_lock
);
i_title
=
p_intf
->
p_sys
->
p_input
->
stream
.
p_selected_area
->
i_id
;
i_title
=
p_intf
->
p_sys
->
p_input
->
stream
.
p_selected_area
->
i_id
;
vlc_mutex_unlock
(
&
p_intf
->
p_sys
->
p_input
->
stream
.
stream_lock
);
vlc_mutex_unlock
(
&
p_intf
->
p_sys
->
p_input
->
stream
.
stream_lock
);
ItemTitle
=
Index2Item
(
PopupNavigation
,
i_title
,
false
);
ItemTitle
=
Index2Item
(
PopupNavigation
,
i_title
,
false
);
Index2Item
(
ItemTitle
,
i_chapter
,
false
)
->
Checked
=
true
;
Index2Item
(
ItemTitle
,
i_chapter
,
false
)
->
Checked
=
true
;
input_SetStatus
(
p_intf
->
p_sys
->
p_input
,
INPUT_STATUS_PLAY
);
input_SetStatus
(
p_intf
->
p_sys
->
p_input
,
INPUT_STATUS_PLAY
);
}
}
/*
/*
* Navigation
* Navigation
*/
*/
void
__fastcall
TMenusGen
::
PopupNavigationClick
(
TObject
*
Sender
)
void
__fastcall
TMenusGen
::
PopupNavigationClick
(
TObject
*
Sender
)
{
{
TMenuItem
*
Item
=
(
TMenuItem
*
)
Sender
;
TMenuItem
*
Item
=
(
TMenuItem
*
)
Sender
;
TMenuItem
*
ItemTitle
;
TMenuItem
*
ItemTitle
;
input_area_t
*
p_area
;
input_area_t
*
p_area
;
unsigned
int
i_title
=
Data2Title
(
Item
->
Tag
);
unsigned
int
i_title
=
Data2Title
(
Item
->
Tag
);
unsigned
int
i_chapter
=
Data2Chapter
(
Item
->
Tag
);
unsigned
int
i_chapter
=
Data2Chapter
(
Item
->
Tag
);
vlc_mutex_lock
(
&
p_intf
->
p_sys
->
p_input
->
stream
.
stream_lock
);
vlc_mutex_lock
(
&
p_intf
->
p_sys
->
p_input
->
stream
.
stream_lock
);
i_title
=
__MIN
(
i_title
,
i_title
=
__MIN
(
i_title
,
p_intf
->
p_sys
->
p_input
->
stream
.
i_area_nb
-
1
);
p_intf
->
p_sys
->
p_input
->
stream
.
i_area_nb
-
1
);
i_title
=
__MAX
(
i_title
,
1
);
i_title
=
__MAX
(
i_title
,
1
);
p_area
=
p_intf
->
p_sys
->
p_input
->
stream
.
pp_areas
[
i_title
];
p_area
=
p_intf
->
p_sys
->
p_input
->
stream
.
pp_areas
[
i_title
];
i_chapter
=
__MIN
(
i_chapter
,
p_area
->
i_part_nb
-
1
);
i_chapter
=
__MIN
(
i_chapter
,
p_area
->
i_part_nb
-
1
);
i_chapter
=
__MAX
(
i_chapter
,
1
);
i_chapter
=
__MAX
(
i_chapter
,
1
);
p_area
->
i_part
=
i_chapter
;
p_area
->
i_part
=
i_chapter
;
vlc_mutex_unlock
(
&
p_intf
->
p_sys
->
p_input
->
stream
.
stream_lock
);
vlc_mutex_unlock
(
&
p_intf
->
p_sys
->
p_input
->
stream
.
stream_lock
);
input_ChangeArea
(
p_intf
->
p_sys
->
p_input
,
p_area
);
input_ChangeArea
(
p_intf
->
p_sys
->
p_input
,
p_area
);
Item
->
Checked
=
true
;
Item
->
Checked
=
true
;
ItemTitle
=
Index2Item
(
MenuTitle
,
i_title
,
false
);
ItemTitle
=
Index2Item
(
MenuTitle
,
i_title
,
false
);
if
(
ItemTitle
->
Checked
)
if
(
ItemTitle
->
Checked
)
{
{
/* same title, new chapter */
/* same title, new chapter */
Index2Item
(
MenuChapter
,
i_chapter
,
false
)
->
Checked
=
true
;
Index2Item
(
MenuChapter
,
i_chapter
,
false
)
->
Checked
=
true
;
}
}
else
else
{
{
/* new title => we must rebuild the chapter menu */
/* new title => we must rebuild the chapter menu */
vlc_mutex_lock
(
&
p_intf
->
p_sys
->
p_input
->
stream
.
stream_lock
);
vlc_mutex_lock
(
&
p_intf
->
p_sys
->
p_input
->
stream
.
stream_lock
);
RadioMenu
(
RadioMenu
(
MenuChapter
,
"Chapter"
,
MenuChapter
,
"Chapter"
,
p_intf
->
p_sys
->
p_input
->
stream
.
p_selected_area
->
i_part_nb
,
p_intf
->
p_sys
->
p_input
->
stream
.
p_selected_area
->
i_part_nb
,
i_chapter
,
MenuChapterClick
);
i_chapter
,
MenuChapterClick
);
vlc_mutex_unlock
(
&
p_intf
->
p_sys
->
p_input
->
stream
.
stream_lock
);
vlc_mutex_unlock
(
&
p_intf
->
p_sys
->
p_input
->
stream
.
stream_lock
);
}
}
input_SetStatus
(
p_intf
->
p_sys
->
p_input
,
INPUT_STATUS_PLAY
);
input_SetStatus
(
p_intf
->
p_sys
->
p_input
,
INPUT_STATUS_PLAY
);
}
}
__fastcall
TMenusGen
::
TMenusGen
(
intf_thread_t
*
_p_intf
)
:
TObject
()
__fastcall
TMenusGen
::
TMenusGen
(
intf_thread_t
*
_p_intf
)
:
TObject
()
{
{
p_intf
=
_p_intf
;
p_intf
=
_p_intf
;
/* Initialize local pointers to menu items of the main window */
/* Initialize local pointers to menu items of the main window */
TMainFrameDlg
*
p_window
=
p_intf
->
p_sys
->
p_window
;
TMainFrameDlg
*
p_window
=
p_intf
->
p_sys
->
p_window
;
if
(
p_window
==
NULL
)
if
(
p_window
==
NULL
)
{
{
msg_Warn
(
p_intf
,
"Main window wasn't created, expect problems..."
);
msg_Warn
(
p_intf
,
"Main window wasn't created, expect problems..."
);
return
;
return
;
}
}
MenuChannel
=
p_window
->
MenuChannel
;
MenuChannel
=
p_window
->
MenuChannel
;
PopupChannel
=
p_window
->
PopupChannel
;
PopupChannel
=
p_window
->
PopupChannel
;
MenuADevice
=
p_window
->
MenuADevice
;
MenuADevice
=
p_window
->
MenuADevice
;
PopupADevice
=
p_window
->
PopupADevice
;
PopupADevice
=
p_window
->
PopupADevice
;
MenuVDevice
=
p_window
->
MenuVDevice
;
MenuVDevice
=
p_window
->
MenuVDevice
;
PopupVDevice
=
p_window
->
PopupVDevice
;
PopupVDevice
=
p_window
->
PopupVDevice
;
MenuLanguage
=
p_window
->
MenuLanguage
;
MenuLanguage
=
p_window
->
MenuLanguage
;
PopupLanguage
=
p_window
->
PopupLanguage
;
PopupLanguage
=
p_window
->
PopupLanguage
;
MenuSubtitles
=
p_window
->
MenuSubtitles
;
MenuSubtitles
=
p_window
->
MenuSubtitles
;
PopupSubtitles
=
p_window
->
PopupSubtitles
;
PopupSubtitles
=
p_window
->
PopupSubtitles
;
MenuProgram
=
p_window
->
MenuProgram
;
MenuProgram
=
p_window
->
MenuProgram
;
PopupProgram
=
p_window
->
PopupProgram
;
PopupProgram
=
p_window
->
PopupProgram
;
MenuTitle
=
p_window
->
MenuTitle
;
MenuTitle
=
p_window
->
MenuTitle
;
MenuChapter
=
p_window
->
MenuChapter
;
MenuChapter
=
p_window
->
MenuChapter
;
PopupNavigation
=
p_window
->
PopupNavigation
;
PopupNavigation
=
p_window
->
PopupNavigation
;
MenuAddInterface
=
p_window
->
MenuAddInterface
;
MenuAddInterface
=
p_window
->
MenuAddInterface
;
/* Create the "Add interface" menu */
/* Create the "Add interface" menu */
SetupModuleMenu
(
"interface"
,
MenuAddInterface
,
InterfaceModuleClick
);
SetupModuleMenu
(
"interface"
,
MenuAddInterface
,
InterfaceModuleClick
);
}
}
/*****************************************************************************
/*****************************************************************************
* SetupMenus: This function dynamically generates some menus
* SetupMenus: This function dynamically generates some menus
*****************************************************************************
*****************************************************************************
* The lock on p_input->stream must be taken before you call this function
* The lock on p_input->stream must be taken before you call this function
*****************************************************************************/
*****************************************************************************/
void
__fastcall
TMenusGen
::
SetupMenus
()
void
__fastcall
TMenusGen
::
SetupMenus
()
{
{
TMainFrameDlg
*
p_window
=
p_intf
->
p_sys
->
p_window
;
TMainFrameDlg
*
p_window
=
p_intf
->
p_sys
->
p_window
;
input_thread_t
*
p_input
=
p_intf
->
p_sys
->
p_input
;
input_thread_t
*
p_input
=
p_intf
->
p_sys
->
p_input
;
es_descriptor_t
*
p_audio_es
;
es_descriptor_t
*
p_audio_es
;
es_descriptor_t
*
p_spu_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_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_program_update
|
p_intf
->
p_sys
->
b_title_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_program_update
|
p_intf
->
p_sys
->
b_title_update
;
p_intf
->
p_sys
->
b_title_update
;
if
(
p_intf
->
p_sys
->
b_program_update
)
if
(
p_intf
->
p_sys
->
b_program_update
)
{
{
pgrm_descriptor_t
*
p_pgrm
;
pgrm_descriptor_t
*
p_pgrm
;
if
(
p_input
->
stream
.
p_new_program
)
if
(
p_input
->
stream
.
p_new_program
)
{
{
p_pgrm
=
p_input
->
stream
.
p_new_program
;
p_pgrm
=
p_input
->
stream
.
p_new_program
;
}
}
else
else
{
{
p_pgrm
=
p_input
->
stream
.
p_selected_program
;
p_pgrm
=
p_input
->
stream
.
p_selected_program
;
}
}
ProgramMenu
(
MenuProgram
,
p_pgrm
,
MenuProgramClick
);
ProgramMenu
(
MenuProgram
,
p_pgrm
,
MenuProgramClick
);
ProgramMenu
(
PopupProgram
,
p_pgrm
,
PopupProgramClick
);
ProgramMenu
(
PopupProgram
,
p_pgrm
,
PopupProgramClick
);
p_intf
->
p_sys
->
b_program_update
=
VLC_FALSE
;
p_intf
->
p_sys
->
b_program_update
=
VLC_FALSE
;
}
}
if
(
p_intf
->
p_sys
->
b_title_update
)
if
(
p_intf
->
p_sys
->
b_title_update
)
{
{
// why "-1" ?
// why "-1" ?
// because if the titles go from 1 to X-1, there are X-1 titles
// because if the titles go from 1 to X-1, there are X-1 titles
RadioMenu
(
MenuTitle
,
"Title"
,
RadioMenu
(
MenuTitle
,
"Title"
,
p_input
->
stream
.
i_area_nb
-
1
,
p_input
->
stream
.
i_area_nb
-
1
,
p_input
->
stream
.
p_selected_area
->
i_id
,
p_input
->
stream
.
p_selected_area
->
i_id
,
MenuTitleClick
);
MenuTitleClick
);
AnsiString
CurrentTitle
;
AnsiString
CurrentTitle
;
CurrentTitle
.
sprintf
(
"%d"
,
p_input
->
stream
.
p_selected_area
->
i_id
);
CurrentTitle
.
sprintf
(
"%d"
,
p_input
->
stream
.
p_selected_area
->
i_id
);
p_window
->
LabelTitleCurrent
->
Caption
=
CurrentTitle
;
p_window
->
LabelTitleCurrent
->
Caption
=
CurrentTitle
;
p_intf
->
p_sys
->
b_title_update
=
VLC_FALSE
;
p_intf
->
p_sys
->
b_title_update
=
VLC_FALSE
;
}
}
if
(
p_intf
->
p_sys
->
b_chapter_update
)
if
(
p_intf
->
p_sys
->
b_chapter_update
)
{
{
RadioMenu
(
MenuChapter
,
"Chapter"
,
RadioMenu
(
MenuChapter
,
"Chapter"
,
p_input
->
stream
.
p_selected_area
->
i_part_nb
-
1
,
p_input
->
stream
.
p_selected_area
->
i_part_nb
-
1
,
p_input
->
stream
.
p_selected_area
->
i_part
,
p_input
->
stream
.
p_selected_area
->
i_part
,
MenuChapterClick
);
MenuChapterClick
);
NavigationMenu
(
PopupNavigation
,
PopupNavigationClick
);
NavigationMenu
(
PopupNavigation
,
PopupNavigationClick
);
AnsiString
CurrentChapter
;
AnsiString
CurrentChapter
;
CurrentChapter
.
sprintf
(
"%d"
,
p_input
->
stream
.
p_selected_area
->
i_part
);
CurrentChapter
.
sprintf
(
"%d"
,
p_input
->
stream
.
p_selected_area
->
i_part
);
p_window
->
LabelChapterCurrent
->
Caption
=
CurrentChapter
;
p_window
->
LabelChapterCurrent
->
Caption
=
CurrentChapter
;
p_intf
->
p_sys
->
i_part
=
p_input
->
stream
.
p_selected_area
->
i_part
;
p_intf
->
p_sys
->
i_part
=
p_input
->
stream
.
p_selected_area
->
i_part
;
p_intf
->
p_sys
->
b_chapter_update
=
VLC_FALSE
;
p_intf
->
p_sys
->
b_chapter_update
=
VLC_FALSE
;
}
}
/* look for selected ES */
/* look for selected ES */
p_audio_es
=
NULL
;
p_audio_es
=
NULL
;
p_spu_es
=
NULL
;
p_spu_es
=
NULL
;
for
(
unsigned
int
i
=
0
;
i
<
p_input
->
stream
.
i_selected_es_number
;
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
p_input
->
stream
.
i_selected_es_number
;
i
++
)
{
{
if
(
p_input
->
stream
.
pp_selected_es
[
i
]
->
i_cat
==
AUDIO_ES
)
if
(
p_input
->
stream
.
pp_selected_es
[
i
]
->
i_cat
==
AUDIO_ES
)
{
{
p_audio_es
=
p_input
->
stream
.
pp_selected_es
[
i
];
p_audio_es
=
p_input
->
stream
.
pp_selected_es
[
i
];
}
}
if
(
p_input
->
stream
.
pp_selected_es
[
i
]
->
i_cat
==
SPU_ES
)
if
(
p_input
->
stream
.
pp_selected_es
[
i
]
->
i_cat
==
SPU_ES
)
{
{
p_spu_es
=
p_input
->
stream
.
pp_selected_es
[
i
];
p_spu_es
=
p_input
->
stream
.
pp_selected_es
[
i
];
}
}
}
}
this
->
p_audio_es_old
=
p_audio_es
;
this
->
p_audio_es_old
=
p_audio_es
;
this
->
p_spu_es_old
=
p_spu_es
;
this
->
p_spu_es_old
=
p_spu_es
;
vlc_mutex_unlock
(
&
p_input
->
stream
.
stream_lock
);
vlc_mutex_unlock
(
&
p_input
->
stream
.
stream_lock
);
/* audio menus */
/* audio menus */
if
(
p_intf
->
p_sys
->
b_audio_update
)
if
(
p_intf
->
p_sys
->
b_audio_update
)
{
{
LanguageMenu
(
MenuLanguage
,
p_audio_es
,
AUDIO_ES
,
MenuLanguageClick
);
LanguageMenu
(
MenuLanguage
,
p_audio_es
,
AUDIO_ES
,
MenuLanguageClick
);
LanguageMenu
(
PopupLanguage
,
p_audio_es
,
AUDIO_ES
,
PopupLanguageClick
);
LanguageMenu
(
PopupLanguage
,
p_audio_es
,
AUDIO_ES
,
PopupLanguageClick
);
p_intf
->
p_sys
->
b_audio_update
=
VLC_FALSE
;
p_intf
->
p_sys
->
b_audio_update
=
VLC_FALSE
;
}
}
/* sub picture menus */
/* sub picture menus */
if
(
p_intf
->
p_sys
->
b_spu_update
)
if
(
p_intf
->
p_sys
->
b_spu_update
)
{
{
LanguageMenu
(
PopupSubtitles
,
p_spu_es
,
SPU_ES
,
PopupSubtitleClick
);
LanguageMenu
(
PopupSubtitles
,
p_spu_es
,
SPU_ES
,
PopupSubtitleClick
);
LanguageMenu
(
MenuSubtitles
,
p_spu_es
,
SPU_ES
,
MenuSubtitleClick
);
LanguageMenu
(
MenuSubtitles
,
p_spu_es
,
SPU_ES
,
MenuSubtitleClick
);
p_intf
->
p_sys
->
b_spu_update
=
VLC_FALSE
;
p_intf
->
p_sys
->
b_spu_update
=
VLC_FALSE
;
}
}
if
(
p_intf
->
p_sys
->
b_aout_update
)
if
(
p_intf
->
p_sys
->
b_aout_update
)
{
{
aout_instance_t
*
p_aout
;
aout_instance_t
*
p_aout
;
p_aout
=
(
aout_instance_t
*
)
vlc_object_find
(
p_intf
,
VLC_OBJECT_AOUT
,
p_aout
=
(
aout_instance_t
*
)
vlc_object_find
(
p_intf
,
VLC_OBJECT_AOUT
,
FIND_ANYWHERE
);
FIND_ANYWHERE
);
if
(
p_aout
!=
NULL
)
if
(
p_aout
!=
NULL
)
{
{
vlc_value_t
val
;
vlc_value_t
val
;
val
.
b_bool
=
VLC_FALSE
;
val
.
b_bool
=
VLC_FALSE
;
var_Set
(
(
vlc_object_t
*
)
p_aout
,
"intf-change"
,
val
);
var_Set
(
(
vlc_object_t
*
)
p_aout
,
"intf-change"
,
val
);
SetupVarMenu
(
(
vlc_object_t
*
)
p_aout
,
"audio-channels"
,
SetupVarMenu
(
(
vlc_object_t
*
)
p_aout
,
"audio-channels"
,
MenuChannel
,
AoutVarClick
);
MenuChannel
,
AoutVarClick
);
SetupVarMenu
(
(
vlc_object_t
*
)
p_aout
,
"audio-channels"
,
SetupVarMenu
(
(
vlc_object_t
*
)
p_aout
,
"audio-channels"
,
PopupChannel
,
AoutVarClick
);
PopupChannel
,
AoutVarClick
);
SetupVarMenu
(
(
vlc_object_t
*
)
p_aout
,
"audio-device"
,
SetupVarMenu
(
(
vlc_object_t
*
)
p_aout
,
"audio-device"
,
MenuADevice
,
AoutVarClick
);
MenuADevice
,
AoutVarClick
);
SetupVarMenu
(
(
vlc_object_t
*
)
p_aout
,
"audio-device"
,
SetupVarMenu
(
(
vlc_object_t
*
)
p_aout
,
"audio-device"
,
PopupADevice
,
AoutVarClick
);
PopupADevice
,
AoutVarClick
);
vlc_object_release
(
(
vlc_object_t
*
)
p_aout
);
vlc_object_release
(
(
vlc_object_t
*
)
p_aout
);
}
}
p_intf
->
p_sys
->
b_aout_update
=
VLC_FALSE
;
p_intf
->
p_sys
->
b_aout_update
=
VLC_FALSE
;
}
}
if
(
p_intf
->
p_sys
->
b_vout_update
)
if
(
p_intf
->
p_sys
->
b_vout_update
)
{
{
vout_thread_t
*
p_vout
;
vout_thread_t
*
p_vout
;
p_vout
=
(
vout_thread_t
*
)
vlc_object_find
(
p_intf
,
VLC_OBJECT_VOUT
,
p_vout
=
(
vout_thread_t
*
)
vlc_object_find
(
p_intf
,
VLC_OBJECT_VOUT
,
FIND_ANYWHERE
);
FIND_ANYWHERE
);
if
(
p_vout
!=
NULL
)
if
(
p_vout
!=
NULL
)
{
{
vlc_value_t
val
;
vlc_value_t
val
;
val
.
b_bool
=
VLC_FALSE
;
val
.
b_bool
=
VLC_FALSE
;
var_Set
(
(
vlc_object_t
*
)
p_vout
,
"intf-change"
,
val
);
var_Set
(
(
vlc_object_t
*
)
p_vout
,
"intf-change"
,
val
);
SetupVarMenu
(
(
vlc_object_t
*
)
p_vout
,
"video-device"
,
SetupVarMenu
(
(
vlc_object_t
*
)
p_vout
,
"video-device"
,
MenuVDevice
,
VoutVarClick
);
MenuVDevice
,
VoutVarClick
);
SetupVarMenu
(
(
vlc_object_t
*
)
p_vout
,
"video-device"
,
SetupVarMenu
(
(
vlc_object_t
*
)
p_vout
,
"video-device"
,
PopupVDevice
,
VoutVarClick
);
PopupVDevice
,
VoutVarClick
);
vlc_object_release
(
(
vlc_object_t
*
)
p_vout
);
vlc_object_release
(
(
vlc_object_t
*
)
p_vout
);
}
}
p_intf
->
p_sys
->
b_vout_update
=
VLC_FALSE
;
p_intf
->
p_sys
->
b_vout_update
=
VLC_FALSE
;
}
}
vlc_mutex_lock
(
&
p_input
->
stream
.
stream_lock
);
vlc_mutex_lock
(
&
p_input
->
stream
.
stream_lock
);
}
}
/*****************************************************************************
/*****************************************************************************
* Private functions
* Private functions
*****************************************************************************/
*****************************************************************************/
TMenuItem
*
TMenusGen
::
Index2Item
(
TMenuItem
*
Root
,
int
i_index
,
TMenuItem
*
TMenusGen
::
Index2Item
(
TMenuItem
*
Root
,
int
i_index
,
bool
SingleColumn
)
bool
SingleColumn
)
{
{
if
(
SingleColumn
||
(
i_index
<
20
)
)
if
(
SingleColumn
||
(
i_index
<
20
)
)
return
Root
->
Items
[
i_index
];
return
Root
->
Items
[
i_index
];
else
else
return
Root
->
Items
[
i_index
/
10
]
->
Items
[
i_index
%
10
];
return
Root
->
Items
[
i_index
/
10
]
->
Items
[
i_index
%
10
];
}
}
int
TMenusGen
::
Item2Index
(
TMenuItem
*
Root
,
TMenuItem
*
Item
)
int
TMenusGen
::
Item2Index
(
TMenuItem
*
Root
,
TMenuItem
*
Item
)
{
{
if
(
Item
->
Parent
==
Root
)
if
(
Item
->
Parent
==
Root
)
return
Item
->
MenuIndex
;
return
Item
->
MenuIndex
;
else
else
return
(
10
*
Item
->
Parent
->
MenuIndex
+
Item
->
MenuIndex
);
return
(
10
*
Item
->
Parent
->
MenuIndex
+
Item
->
MenuIndex
);
}
}
int
__fastcall
TMenusGen
::
Data2Title
(
int
data
)
int
__fastcall
TMenusGen
::
Data2Title
(
int
data
)
{
{
return
(
int
)
(
data
>>
16
);
return
(
int
)
(
data
>>
16
);
}
}
int
__fastcall
TMenusGen
::
Data2Chapter
(
int
data
)
int
__fastcall
TMenusGen
::
Data2Chapter
(
int
data
)
{
{
return
(
int
)
(
data
&
0xffff
);
return
(
int
)
(
data
&
0xffff
);
}
}
int
__fastcall
TMenusGen
::
Pos2Data
(
int
title
,
int
chapter
)
int
__fastcall
TMenusGen
::
Pos2Data
(
int
title
,
int
chapter
)
{
{
return
(
int
)
((
title
<<
16
)
|
(
chapter
&
0xffff
));
return
(
int
)
((
title
<<
16
)
|
(
chapter
&
0xffff
));
}
}
/* This function deletes all the '&' characters in the caption string,
/* This function deletes all the '&' characters in the caption string,
* because Borland automatically adds one when (and only when!) you click on
* because Borland automatically adds one when (and only when!) you click on
* the menuitem. Grrrrr... */
* the menuitem. Grrrrr... */
AnsiString
__fastcall
TMenusGen
::
CleanCaption
(
AnsiString
Caption
)
AnsiString
__fastcall
TMenusGen
::
CleanCaption
(
AnsiString
Caption
)
{
{
while
(
Caption
.
LastDelimiter
(
"&"
)
!=
0
)
while
(
Caption
.
LastDelimiter
(
"&"
)
!=
0
)
{
{
Caption
.
Delete
(
Caption
.
LastDelimiter
(
"&"
),
1
);
Caption
.
Delete
(
Caption
.
LastDelimiter
(
"&"
),
1
);
}
}
return
Caption
;
return
Caption
;
}
}
/****************************************************************************
/****************************************************************************
* VarChange: change a variable in a vlc_object_t
* VarChange: change a variable in a vlc_object_t
****************************************************************************
****************************************************************************
* Change the variable and update the menuitems.
* Change the variable and update the menuitems.
****************************************************************************/
****************************************************************************/
void
__fastcall
TMenusGen
::
VarChange
(
vlc_object_t
*
p_object
,
void
__fastcall
TMenusGen
::
VarChange
(
vlc_object_t
*
p_object
,
const
char
*
psz_variable
,
TMenuItem
*
RootMenu
,
TMenuItem
*
RootPopup
,
const
char
*
psz_variable
,
TMenuItem
*
RootMenu
,
TMenuItem
*
RootPopup
,
TMenuItem
*
Item
)
TMenuItem
*
Item
)
{
{
vlc_value_t
val
;
vlc_value_t
val
;
int
i_index
;
int
i_index
;
AnsiString
Caption
=
CleanCaption
(
Item
->
Caption
);
AnsiString
Caption
=
CleanCaption
(
Item
->
Caption
);
val
.
psz_string
=
Caption
.
c_str
();
val
.
psz_string
=
Caption
.
c_str
();
/* set the new value */
/* set the new value */
if
(
var_Set
(
p_object
,
psz_variable
,
val
)
<
0
)
if
(
var_Set
(
p_object
,
psz_variable
,
val
)
<
0
)
{
{
msg_Warn
(
p_object
,
"cannot set variable (%s)"
,
val
.
psz_string
);
msg_Warn
(
p_object
,
"cannot set variable (%s)"
,
val
.
psz_string
);
}
}
i_index
=
Item
->
MenuIndex
;
i_index
=
Item
->
MenuIndex
;
RootMenu
->
Items
[
i_index
]
->
Checked
=
true
;
RootMenu
->
Items
[
i_index
]
->
Checked
=
true
;
RootPopup
->
Items
[
i_index
]
->
Checked
=
true
;
RootPopup
->
Items
[
i_index
]
->
Checked
=
true
;
}
}
/****************************************************************************
/****************************************************************************
* 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.
****************************************************************************/
****************************************************************************/
void
__fastcall
TMenusGen
::
LangChange
(
TMenuItem
*
RootCurrent
,
TMenuItem
*
Item
,
void
__fastcall
TMenusGen
::
LangChange
(
TMenuItem
*
RootCurrent
,
TMenuItem
*
Item
,
TMenuItem
*
RootOther
,
int
i_cat
)
TMenuItem
*
RootOther
,
int
i_cat
)
{
{
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
;
int
i_es
;
int
i_es
;
/* find the selected ES */
/* find the selected ES */
i_es
=
Item
->
Tag
;
i_es
=
Item
->
Tag
;
/* find selected menu item */
/* find selected menu item */
i_index
=
Item2Index
(
RootCurrent
,
Item
)
-
1
;
i_index
=
Item2Index
(
RootCurrent
,
Item
)
-
1
;
if
(
i_index
<
0
)
if
(
i_index
<
0
)
{
{
/* 'None' was selected */
/* 'None' was selected */
p_es
=
NULL
;
p_es
=
NULL
;
}
}
else
else
{
{
vlc_mutex_lock
(
&
p_intf
->
p_sys
->
p_input
->
stream
.
stream_lock
);
vlc_mutex_lock
(
&
p_intf
->
p_sys
->
p_input
->
stream
.
stream_lock
);
p_es
=
p_intf
->
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_intf
->
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
=
this
->
p_audio_es_old
;
p_es_old
=
this
->
p_audio_es_old
;
this
->
p_audio_es_old
=
p_es
;
this
->
p_audio_es_old
=
p_es
;
}
}
else
else
{
{
p_es_old
=
this
->
p_spu_es_old
;
p_es_old
=
this
->
p_spu_es_old
;
this
->
p_spu_es_old
=
p_es
;
this
->
p_spu_es_old
=
p_es
;
}
}
/* exchange them */
/* exchange them */
input_ToggleES
(
p_intf
->
p_sys
->
p_input
,
p_es_old
,
false
);
input_ToggleES
(
p_intf
->
p_sys
->
p_input
,
p_es_old
,
false
);
input_ToggleES
(
p_intf
->
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.
****************************************************************************/
****************************************************************************/
void
__fastcall
TMenusGen
::
ProgramChange
(
TMenuItem
*
Item
,
void
__fastcall
TMenusGen
::
ProgramChange
(
TMenuItem
*
Item
,
TMenuItem
*
RootOther
)
TMenuItem
*
RootOther
)
{
{
int
i_program
=
Item
->
Tag
;
int
i_program
=
Item
->
Tag
;
/* toggle the program */
/* toggle the program */
input_ChangeProgram
(
p_intf
->
p_sys
->
p_input
,
(
uint16_t
)
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
;
Index2Item
(
RootOther
,
i_program
-
1
,
true
)
->
Checked
=
true
;
Index2Item
(
RootOther
,
i_program
-
1
,
true
)
->
Checked
=
true
;
/* update audio/subtitles menus */
/* update audio/subtitles menus */
p_intf
->
p_sys
->
b_audio_update
=
VLC_TRUE
;
p_intf
->
p_sys
->
b_audio_update
=
VLC_TRUE
;
p_intf
->
p_sys
->
b_spu_update
=
VLC_TRUE
;
p_intf
->
p_sys
->
b_spu_update
=
VLC_TRUE
;
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
();
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
);
p_intf
->
p_sys
->
b_audio_update
=
VLC_FALSE
;
p_intf
->
p_sys
->
b_audio_update
=
VLC_FALSE
;
p_intf
->
p_sys
->
b_spu_update
=
VLC_FALSE
;
p_intf
->
p_sys
->
b_spu_update
=
VLC_FALSE
;
input_SetStatus
(
p_intf
->
p_sys
->
p_input
,
INPUT_STATUS_PLAY
);
input_SetStatus
(
p_intf
->
p_sys
->
p_input
,
INPUT_STATUS_PLAY
);
}
}
/*****************************************************************************
/*****************************************************************************
* SetupVarMenu: build a menu allowing to change a variable
* SetupVarMenu: build a menu allowing to change a variable
*****************************************************************************/
*****************************************************************************/
void
__fastcall
TMenusGen
::
SetupVarMenu
(
vlc_object_t
*
p_object
,
void
__fastcall
TMenusGen
::
SetupVarMenu
(
vlc_object_t
*
p_object
,
const
char
*
psz_variable
,
TMenuItem
*
Root
,
TNotifyEvent
MenuItemClick
)
const
char
*
psz_variable
,
TMenuItem
*
Root
,
TNotifyEvent
MenuItemClick
)
{
{
TMenuItem
*
Item
;
TMenuItem
*
Item
;
vlc_value_t
val
;
vlc_value_t
val
;
char
*
psz_value
=
NULL
;
char
*
psz_value
=
NULL
;
int
i
;
int
i
;
/* remove previous menu */
/* remove previous menu */
Root
->
Clear
();
Root
->
Clear
();
/* get the current value */
/* get the current value */
if
(
var_Get
(
p_object
,
psz_variable
,
&
val
)
<
0
)
if
(
var_Get
(
p_object
,
psz_variable
,
&
val
)
<
0
)
{
{
return
;
return
;
}
}
psz_value
=
val
.
psz_string
;
psz_value
=
val
.
psz_string
;
if
(
var_Change
(
p_object
,
psz_variable
,
VLC_VAR_GETLIST
,
&
val
)
<
0
)
if
(
var_Change
(
p_object
,
psz_variable
,
VLC_VAR_GETLIST
,
&
val
)
<
0
)
{
{
free
(
psz_value
);
free
(
psz_value
);
return
;
return
;
}
}
/* append a menuitem for each option */
/* append a menuitem for each option */
for
(
i
=
0
;
i
<
val
.
p_list
->
i_count
;
i
++
)
for
(
i
=
0
;
i
<
val
.
p_list
->
i_count
;
i
++
)
{
{
Item
=
new
TMenuItem
(
Root
);
Item
=
new
TMenuItem
(
Root
);
Item
->
Caption
=
val
.
p_list
->
p_values
[
i
].
psz_string
;
Item
->
Caption
=
val
.
p_list
->
p_values
[
i
].
psz_string
;
Item
->
Hint
=
val
.
p_list
->
p_values
[
i
].
psz_string
;
Item
->
Hint
=
val
.
p_list
->
p_values
[
i
].
psz_string
;
Item
->
RadioItem
=
true
;
Item
->
RadioItem
=
true
;
Item
->
OnClick
=
MenuItemClick
;
Item
->
OnClick
=
MenuItemClick
;
if
(
!
strcmp
(
psz_value
,
val
.
p_list
->
p_values
[
i
].
psz_string
)
)
if
(
!
strcmp
(
psz_value
,
val
.
p_list
->
p_values
[
i
].
psz_string
)
)
Item
->
Checked
=
true
;
Item
->
Checked
=
true
;
/* Add the item to the submenu */
/* Add the item to the submenu */
Root
->
Add
(
Item
);
Root
->
Add
(
Item
);
}
}
/* enable the menu if there is at least 1 item */
/* enable the menu if there is at least 1 item */
Root
->
Enabled
=
(
val
.
p_list
->
i_count
>
0
);
Root
->
Enabled
=
(
val
.
p_list
->
i_count
>
0
);
/* clean up everything */
/* clean up everything */
var_Change
(
p_object
,
psz_variable
,
VLC_VAR_FREELIST
,
&
val
);
var_Change
(
p_object
,
psz_variable
,
VLC_VAR_FREELIST
,
&
val
);
// free( psz_value );
// free( psz_value );
}
}
/*****************************************************************************
/*****************************************************************************
* SetupModuleMenu: build a menu listing all the modules of a given
* SetupModuleMenu: build a menu listing all the modules of a given
capability
capability
*****************************************************************************/
*****************************************************************************/
void
__fastcall
TMenusGen
::
SetupModuleMenu
(
const
char
*
psz_capability
,
void
__fastcall
TMenusGen
::
SetupModuleMenu
(
const
char
*
psz_capability
,
TMenuItem
*
Root
,
TNotifyEvent
MenuItemClick
)
TMenuItem
*
Root
,
TNotifyEvent
MenuItemClick
)
{
{
module_t
*
p_parser
;
module_t
*
p_parser
;
vlc_list_t
*
p_list
;
vlc_list_t
*
p_list
;
int
i_index
;
int
i_index
;
/* remove previous menu */
/* remove previous menu */
Root
->
Clear
();
Root
->
Clear
();
Root
->
Enabled
=
false
;
Root
->
Enabled
=
false
;
p_list
=
vlc_list_find
(
p_intf
,
VLC_OBJECT_MODULE
,
FIND_ANYWHERE
);
p_list
=
vlc_list_find
(
p_intf
,
VLC_OBJECT_MODULE
,
FIND_ANYWHERE
);
for
(
i_index
=
0
;
i_index
<
p_list
->
i_count
;
i_index
++
)
for
(
i_index
=
0
;
i_index
<
p_list
->
i_count
;
i_index
++
)
{
{
p_parser
=
(
module_t
*
)
p_list
->
p_values
[
i_index
].
p_object
;
p_parser
=
(
module_t
*
)
p_list
->
p_values
[
i_index
].
p_object
;
if
(
!
strcmp
(
p_parser
->
psz_capability
,
psz_capability
)
)
if
(
!
strcmp
(
p_parser
->
psz_capability
,
psz_capability
)
)
{
{
TMenuItem
*
Item
=
new
TMenuItem
(
Root
);
TMenuItem
*
Item
=
new
TMenuItem
(
Root
);
Item
->
Caption
=
p_parser
->
psz_object_name
;
Item
->
Caption
=
p_parser
->
psz_object_name
;
Item
->
Hint
=
Item
->
Caption
;
Item
->
Hint
=
Item
->
Caption
;
Item
->
OnClick
=
MenuItemClick
;
Item
->
OnClick
=
MenuItemClick
;
Root
->
Add
(
Item
);
Root
->
Add
(
Item
);
}
}
}
}
vlc_list_release
(
p_list
);
vlc_list_release
(
p_list
);
/* be sure that menu is enabled, if there is at least one item */
/* be sure that menu is enabled, if there is at least one item */
if
(
i_index
>
0
)
if
(
i_index
>
0
)
Root
->
Enabled
=
true
;
Root
->
Enabled
=
true
;
}
}
/*****************************************************************************
/*****************************************************************************
* ProgramMenu: update the programs menu of the interface
* ProgramMenu: update the programs menu of the interface
*****************************************************************************
*****************************************************************************
* Builds the program menu according to what have been found in the PAT
* 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.
* by the input. Useful for multi-programs streams such as DVB ones.
*****************************************************************************/
*****************************************************************************/
void
__fastcall
TMenusGen
::
ProgramMenu
(
TMenuItem
*
Root
,
void
__fastcall
TMenusGen
::
ProgramMenu
(
TMenuItem
*
Root
,
pgrm_descriptor_t
*
p_pgrm
,
TNotifyEvent
MenuItemClick
)
pgrm_descriptor_t
*
p_pgrm
,
TNotifyEvent
MenuItemClick
)
{
{
TMenuItem
*
Item
;
TMenuItem
*
Item
;
/* remove previous menu */
/* remove previous menu */
Root
->
Clear
();
Root
->
Clear
();
Root
->
Enabled
=
false
;
Root
->
Enabled
=
false
;
/* create a set of program buttons and append them to the container */
/* create a set of program buttons and append them to the container */
for
(
unsigned
int
i
=
0
;
i
<
p_intf
->
p_sys
->
p_input
->
stream
.
i_pgrm_number
;
for
(
unsigned
int
i
=
0
;
i
<
p_intf
->
p_sys
->
p_input
->
stream
.
i_pgrm_number
;
i
++
)
i
++
)
{
{
AnsiString
Name
;
AnsiString
Name
;
Name
.
sprintf
(
"id %d"
,
Name
.
sprintf
(
"id %d"
,
p_intf
->
p_sys
->
p_input
->
stream
.
pp_programs
[
i
]
->
i_number
);
p_intf
->
p_sys
->
p_input
->
stream
.
pp_programs
[
i
]
->
i_number
);
Item
=
new
TMenuItem
(
Root
);
Item
=
new
TMenuItem
(
Root
);
Item
->
Caption
=
Name
;
Item
->
Caption
=
Name
;
Item
->
Hint
=
Name
;
Item
->
Hint
=
Name
;
Item
->
RadioItem
=
true
;
Item
->
RadioItem
=
true
;
Item
->
OnClick
=
MenuItemClick
;
Item
->
OnClick
=
MenuItemClick
;
/* FIXME: temporary hack to save the program id with the Item
/* FIXME: temporary hack to save the program id with the Item
* It will be used in the callback. */
* It will be used in the callback. */
Item
->
Tag
=
i
+
1
;
Item
->
Tag
=
i
+
1
;
/* check the currently selected program */
/* check the currently selected program */
if
(
p_pgrm
==
p_intf
->
p_sys
->
p_input
->
stream
.
pp_programs
[
i
]
)
if
(
p_pgrm
==
p_intf
->
p_sys
->
p_input
->
stream
.
pp_programs
[
i
]
)
Item
->
Checked
=
true
;
Item
->
Checked
=
true
;
/* add the item to the submenu */
/* add the item to the submenu */
Root
->
Add
(
Item
);
Root
->
Add
(
Item
);
}
}
/* be sure that menu is enabled if more than 1 program */
/* be sure that menu is enabled if more than 1 program */
if
(
p_intf
->
p_sys
->
p_input
->
stream
.
i_pgrm_number
>
1
)
if
(
p_intf
->
p_sys
->
p_input
->
stream
.
i_pgrm_number
>
1
)
Root
->
Enabled
=
true
;
Root
->
Enabled
=
true
;
}
}
/*****************************************************************************
/*****************************************************************************
* RadioMenu: update interactive menus of the interface
* RadioMenu: update interactive menus of the interface
*****************************************************************************
*****************************************************************************
* Sets up menus with information from input
* Sets up menus with information from input
* 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
*****************************************************************************/
*****************************************************************************/
void
__fastcall
TMenusGen
::
RadioMenu
(
TMenuItem
*
Root
,
AnsiString
ItemName
,
void
__fastcall
TMenusGen
::
RadioMenu
(
TMenuItem
*
Root
,
AnsiString
ItemName
,
int
i_nb
,
int
i_selected
,
TNotifyEvent
MenuItemClick
)
int
i_nb
,
int
i_selected
,
TNotifyEvent
MenuItemClick
)
{
{
TMenuItem
*
ItemGroup
;
TMenuItem
*
ItemGroup
;
TMenuItem
*
Item
;
TMenuItem
*
Item
;
AnsiString
Name
;
AnsiString
Name
;
/* remove previous menu */
/* remove previous menu */
Root
->
Enabled
=
false
;
Root
->
Enabled
=
false
;
Root
->
Clear
();
Root
->
Clear
();
for
(
int
i_item
=
1
;
i_item
<=
i_nb
;
i_item
++
)
for
(
int
i_item
=
1
;
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
==
1
)
&&
(
i_nb
>
20
)
)
if
(
(
i_item
%
10
==
1
)
&&
(
i_nb
>
20
)
)
{
{
if
(
i_item
!=
1
)
if
(
i_item
!=
1
)
Root
->
Add
(
ItemGroup
);
Root
->
Add
(
ItemGroup
);
Name
.
sprintf
(
"%ss %d to %d"
,
ItemName
,
i_item
,
i_item
+
9
);
Name
.
sprintf
(
"%ss %d to %d"
,
ItemName
,
i_item
,
i_item
+
9
);
ItemGroup
=
new
TMenuItem
(
Root
);
ItemGroup
=
new
TMenuItem
(
Root
);
ItemGroup
->
Hint
=
Name
;
ItemGroup
->
Hint
=
Name
;
ItemGroup
->
RadioItem
=
true
;
ItemGroup
->
RadioItem
=
true
;
/* set the accelerator character */
/* set the accelerator character */
Name
.
Insert
(
"&"
,
Name
.
Length
()
-
1
);
Name
.
Insert
(
"&"
,
Name
.
Length
()
-
1
);
ItemGroup
->
Caption
=
Name
;
ItemGroup
->
Caption
=
Name
;
}
}
Name
.
sprintf
(
"%s %d"
,
ItemName
,
i_item
);
Name
.
sprintf
(
"%s %d"
,
ItemName
,
i_item
);
Item
=
new
TMenuItem
(
Root
);
Item
=
new
TMenuItem
(
Root
);
Item
->
RadioItem
=
true
;
Item
->
RadioItem
=
true
;
Item
->
Hint
=
Name
;
Item
->
Hint
=
Name
;
/* set the accelerator character */
/* set the accelerator character */
Name
.
Insert
(
"&"
,
Name
.
Length
()
);
Name
.
Insert
(
"&"
,
Name
.
Length
()
);
Item
->
Caption
=
Name
;
Item
->
Caption
=
Name
;
/* FIXME: temporary hack to save i_item with the Item
/* FIXME: temporary hack to save i_item with the Item
* It will be used in the callback. */
* It will be used in the callback. */
Item
->
Tag
=
i_item
;
Item
->
Tag
=
i_item
;
/* check the currently selected chapter */
/* check the currently selected chapter */
if
(
i_selected
==
i_item
)
if
(
i_selected
==
i_item
)
Item
->
Checked
=
true
;
Item
->
Checked
=
true
;
/* setup signal handling */
/* setup signal handling */
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
)
Root
->
Add
(
ItemGroup
);
Root
->
Add
(
ItemGroup
);
/* be sure that menu is enabled, if there are several items */
/* be sure that menu is enabled, if there are several items */
if
(
i_nb
>
1
)
if
(
i_nb
>
1
)
Root
->
Enabled
=
true
;
Root
->
Enabled
=
true
;
}
}
/*****************************************************************************
/*****************************************************************************
* LanguageMenus: update interactive menus of the interface
* LanguageMenus: update interactive menus of the interface
*****************************************************************************
*****************************************************************************
* Sets up menus with information from input:
* Sets up menus with information from input:
* - languages
* - languages
* - sub-pictures
* - sub-pictures
* 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
*****************************************************************************/
*****************************************************************************/
void
__fastcall
TMenusGen
::
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
;
AnsiString
Name
;
AnsiString
Name
;
/* remove previous menu */
/* remove previous menu */
Root
->
Clear
();
Root
->
Clear
();
Root
->
Enabled
=
false
;
Root
->
Enabled
=
false
;
/* special case for "off" item */
/* special case for "off" item */
Name
=
"None"
;
Name
=
"None"
;
Item
=
new
TMenuItem
(
Root
);
Item
=
new
TMenuItem
(
Root
);
Item
->
RadioItem
=
true
;
Item
->
RadioItem
=
true
;
Item
->
Hint
=
Name
;
Item
->
Hint
=
Name
;
Item
->
Caption
=
Name
;
Item
->
Caption
=
Name
;
Item
->
OnClick
=
MenuItemClick
;
Item
->
OnClick
=
MenuItemClick
;
Item
->
Tag
=
-
1
;
Item
->
Tag
=
-
1
;
Root
->
Add
(
Item
);
Root
->
Add
(
Item
);
/* separator item */
/* separator item */
Separator
=
new
TMenuItem
(
Root
);
Separator
=
new
TMenuItem
(
Root
);
Separator
->
Caption
=
"-"
;
Separator
->
Caption
=
"-"
;
Root
->
Add
(
Separator
);
Root
->
Add
(
Separator
);
int
i_item
=
0
;
int
i_item
=
0
;
vlc_mutex_lock
(
&
p_intf
->
p_sys
->
p_input
->
stream
.
stream_lock
);
vlc_mutex_lock
(
&
p_intf
->
p_sys
->
p_input
->
stream
.
stream_lock
);
#define ES p_intf->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
(
unsigned
int
i
=
0
;
i
<
p_intf
->
p_sys
->
p_input
->
stream
.
i_es_number
;
for
(
unsigned
int
i
=
0
;
i
<
p_intf
->
p_sys
->
p_input
->
stream
.
i_es_number
;
i
++
)
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_intf
->
p_sys
->
p_input
->
stream
.
p_selected_program
)
)
p_intf
->
p_sys
->
p_input
->
stream
.
p_selected_program
)
)
{
{
i_item
++
;
i_item
++
;
Name
=
p_intf
->
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
);
Item
=
new
TMenuItem
(
Root
);
Item
=
new
TMenuItem
(
Root
);
Item
->
RadioItem
=
true
;
Item
->
RadioItem
=
true
;
Item
->
Hint
=
Name
;
Item
->
Hint
=
Name
;
Item
->
Caption
=
Name
;
Item
->
Caption
=
Name
;
Item
->
Tag
=
i
;
Item
->
Tag
=
i
;
/* check the currently selected item */
/* check the currently selected item */
if
(
p_es
==
p_intf
->
p_sys
->
p_input
->
stream
.
pp_es
[
i
]
)
if
(
p_es
==
p_intf
->
p_sys
->
p_input
->
stream
.
pp_es
[
i
]
)
Item
->
Checked
=
true
;
Item
->
Checked
=
true
;
/* setup signal hanling */
/* setup signal hanling */
Item
->
OnClick
=
MenuItemClick
;
Item
->
OnClick
=
MenuItemClick
;
Root
->
Add
(
Item
);
Root
->
Add
(
Item
);
}
}
}
}
#undef ES
#undef ES
vlc_mutex_unlock
(
&
p_intf
->
p_sys
->
p_input
->
stream
.
stream_lock
);
vlc_mutex_unlock
(
&
p_intf
->
p_sys
->
p_input
->
stream
.
stream_lock
);
/* be sure that menu is enabled if non empty */
/* be sure that menu is enabled if non empty */
if
(
i_item
>
0
)
if
(
i_item
>
0
)
Root
->
Enabled
=
true
;
Root
->
Enabled
=
true
;
}
}
/*****************************************************************************
/*****************************************************************************
* NavigationMenu: sets menus for titles and chapters selection
* NavigationMenu: sets menus for titles and chapters selection
*****************************************************************************
*****************************************************************************
* Generates two types of menus:
* Generates two types of menus:
* -simple list of titles
* -simple list of titles
* -cascaded lists of chapters for each title
* -cascaded lists of chapters for each title
*****************************************************************************/
*****************************************************************************/
void
__fastcall
TMenusGen
::
NavigationMenu
(
TMenuItem
*
Root
,
void
__fastcall
TMenusGen
::
NavigationMenu
(
TMenuItem
*
Root
,
TNotifyEvent
MenuItemClick
)
TNotifyEvent
MenuItemClick
)
{
{
TMenuItem
*
TitleGroup
;
TMenuItem
*
TitleGroup
;
TMenuItem
*
TitleItem
;
TMenuItem
*
TitleItem
;
TMenuItem
*
ChapterGroup
;
TMenuItem
*
ChapterGroup
;
TMenuItem
*
ChapterItem
;
TMenuItem
*
ChapterItem
;
AnsiString
Name
;
AnsiString
Name
;
unsigned
int
i_title_nb
;
unsigned
int
i_title_nb
;
unsigned
int
i_chapter_nb
;
unsigned
int
i_chapter_nb
;
/* remove previous menu */
/* remove previous menu */
Root
->
Enabled
=
false
;
Root
->
Enabled
=
false
;
Root
->
Clear
();
Root
->
Clear
();
i_title_nb
=
p_intf
->
p_sys
->
p_input
->
stream
.
i_area_nb
-
1
;
i_title_nb
=
p_intf
->
p_sys
->
p_input
->
stream
.
i_area_nb
-
1
;
/* loop on titles */
/* loop on titles */
for
(
unsigned
int
i_title
=
1
;
i_title
<=
i_title_nb
;
i_title
++
)
for
(
unsigned
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
)
)
{
{
if
(
i_title
!=
1
)
if
(
i_title
!=
1
)
Root
->
Add
(
TitleGroup
);
Root
->
Add
(
TitleGroup
);
Name
.
sprintf
(
"%d - %d"
,
i_title
,
i_title
+
9
);
Name
.
sprintf
(
"%d - %d"
,
i_title
,
i_title
+
9
);
TitleGroup
=
new
TMenuItem
(
Root
);
TitleGroup
=
new
TMenuItem
(
Root
);
TitleGroup
->
RadioItem
=
true
;
TitleGroup
->
RadioItem
=
true
;
TitleGroup
->
Hint
=
Name
;
TitleGroup
->
Hint
=
Name
;
TitleGroup
->
Caption
=
Name
;
TitleGroup
->
Caption
=
Name
;
}
}
Name
.
sprintf
(
"Title %d (%d)"
,
i_title
,
Name
.
sprintf
(
"Title %d (%d)"
,
i_title
,
p_intf
->
p_sys
->
p_input
->
stream
.
pp_areas
[
i_title
]
->
i_part_nb
-
1
);
p_intf
->
p_sys
->
p_input
->
stream
.
pp_areas
[
i_title
]
->
i_part_nb
-
1
);
{
{
TitleItem
=
new
TMenuItem
(
Root
);
TitleItem
=
new
TMenuItem
(
Root
);
TitleItem
->
RadioItem
=
true
;
TitleItem
->
RadioItem
=
true
;
TitleItem
->
Hint
=
Name
;
TitleItem
->
Hint
=
Name
;
TitleItem
->
Caption
=
Name
;
TitleItem
->
Caption
=
Name
;
i_chapter_nb
=
i_chapter_nb
=
p_intf
->
p_sys
->
p_input
->
stream
.
pp_areas
[
i_title
]
->
i_part_nb
-
1
;
p_intf
->
p_sys
->
p_input
->
stream
.
pp_areas
[
i_title
]
->
i_part_nb
-
1
;
/* loop on chapters */
/* loop on chapters */
for
(
unsigned
int
i_chapter
=
1
;
i_chapter
<=
i_chapter_nb
;
for
(
unsigned
int
i_chapter
=
1
;
i_chapter
<=
i_chapter_nb
;
i_chapter
++
)
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
==
1
)
&&
(
i_chapter_nb
>
20
)
)
if
(
(
i_chapter
%
10
==
1
)
&&
(
i_chapter_nb
>
20
)
)
{
{
if
(
i_chapter
!=
1
)
if
(
i_chapter
!=
1
)
TitleItem
->
Add
(
ChapterGroup
);
TitleItem
->
Add
(
ChapterGroup
);
Name
.
sprintf
(
"%d - %d"
,
i_chapter
,
i_chapter
+
9
);
Name
.
sprintf
(
"%d - %d"
,
i_chapter
,
i_chapter
+
9
);
ChapterGroup
=
new
TMenuItem
(
TitleItem
);
ChapterGroup
=
new
TMenuItem
(
TitleItem
);
ChapterGroup
->
RadioItem
=
true
;
ChapterGroup
->
RadioItem
=
true
;
ChapterGroup
->
Hint
=
Name
;
ChapterGroup
->
Hint
=
Name
;
ChapterGroup
->
Caption
=
Name
;
ChapterGroup
->
Caption
=
Name
;
}
}
Name
.
sprintf
(
"Chapter %d"
,
i_chapter
);
Name
.
sprintf
(
"Chapter %d"
,
i_chapter
);
ChapterItem
=
new
TMenuItem
(
TitleItem
);
ChapterItem
=
new
TMenuItem
(
TitleItem
);
ChapterItem
->
RadioItem
=
true
;
ChapterItem
->
RadioItem
=
true
;
ChapterItem
->
Hint
=
Name
;
ChapterItem
->
Hint
=
Name
;
ChapterItem
->
Caption
=
Name
;
ChapterItem
->
Caption
=
Name
;
/* 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
=
Pos2Data
(
i_title
,
i_chapter
);
ChapterItem
->
Tag
=
Pos2Data
(
i_title
,
i_chapter
);
#define p_area p_intf->p_sys->p_input->stream.pp_areas[i_title]
#define p_area p_intf->p_sys->p_input->stream.pp_areas[i_title]
/* check the currently selected chapter */
/* check the currently selected chapter */
if
(
(
p_area
==
if
(
(
p_area
==
p_intf
->
p_sys
->
p_input
->
stream
.
p_selected_area
)
&&
p_intf
->
p_sys
->
p_input
->
stream
.
p_selected_area
)
&&
(
p_area
->
i_part
==
i_chapter
)
)
(
p_area
->
i_part
==
i_chapter
)
)
{
{
ChapterItem
->
Checked
=
true
;
ChapterItem
->
Checked
=
true
;
}
}
#undef p_area
#undef p_area
/* setup signal handling */
/* 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_intf
->
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 */
Root
->
Enabled
=
true
;
Root
->
Enabled
=
true
;
}
}
}
}
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
)
Root
->
Add
(
TitleGroup
);
Root
->
Add
(
TitleGroup
);
/* be sure that menu is sensitive */
/* be sure that menu is sensitive */
Root
->
Enabled
=
true
;
Root
->
Enabled
=
true
;
}
}
modules/gui/win32/menu.h
View file @
0562366c
/*****************************************************************************
/*****************************************************************************
* 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.
4 2003/01/23 03:33:34 ipkiss Exp $
* $Id: menu.h,v 1.
5 2003/02/12 02:11:58 ipkiss Exp $
*
*
* Authors: Olivier Teuliere <ipkiss@via.ecp.fr>
* Authors: Olivier Teuliere <ipkiss@via.ecp.fr>
*
*
* This program is free software; you can redistribute it and/or modify
* 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
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
*****************************************************************************/
#ifndef menuH
#ifndef menuH
#define menuH
#define menuH
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
class
TMenusGen
:
public
TObject
class
TMenusGen
:
public
TObject
{
{
private:
private:
intf_thread_t
*
p_intf
;
intf_thread_t
*
p_intf
;
/* local pointers to main window menu items */
/* local pointers to main window menu items */
TMenuItem
*
MenuChannel
;
TMenuItem
*
MenuChannel
;
TMenuItem
*
PopupChannel
;
TMenuItem
*
PopupChannel
;
TMenuItem
*
MenuADevice
;
TMenuItem
*
MenuADevice
;
TMenuItem
*
PopupADevice
;
TMenuItem
*
PopupADevice
;
TMenuItem
*
MenuVDevice
;
TMenuItem
*
MenuVDevice
;
TMenuItem
*
PopupVDevice
;
TMenuItem
*
PopupVDevice
;
TMenuItem
*
MenuLanguage
;
TMenuItem
*
MenuLanguage
;
TMenuItem
*
PopupLanguage
;
TMenuItem
*
PopupLanguage
;
TMenuItem
*
MenuSubtitles
;
TMenuItem
*
MenuSubtitles
;
TMenuItem
*
PopupSubtitles
;
TMenuItem
*
PopupSubtitles
;
TMenuItem
*
MenuProgram
;
TMenuItem
*
MenuProgram
;
TMenuItem
*
PopupProgram
;
TMenuItem
*
PopupProgram
;
TMenuItem
*
MenuTitle
;
TMenuItem
*
MenuTitle
;
TMenuItem
*
MenuChapter
;
TMenuItem
*
MenuChapter
;
TMenuItem
*
PopupNavigation
;
TMenuItem
*
PopupNavigation
;
TMenuItem
*
MenuAddInterface
;
TMenuItem
*
MenuAddInterface
;
/* Language information */
/* Language information */
es_descriptor_t
*
p_audio_es_old
;
es_descriptor_t
*
p_audio_es_old
;
es_descriptor_t
*
p_spu_es_old
;
es_descriptor_t
*
p_spu_es_old
;
/* Helpful functions */
/* Helpful functions */
int
Item2Index
(
TMenuItem
*
Root
,
TMenuItem
*
Item
);
int
Item2Index
(
TMenuItem
*
Root
,
TMenuItem
*
Item
);
TMenuItem
*
Index2Item
(
TMenuItem
*
Root
,
int
i_index
,
bool
SingleColumn
);
TMenuItem
*
Index2Item
(
TMenuItem
*
Root
,
int
i_index
,
bool
SingleColumn
);
int
__fastcall
Data2Title
(
int
data
);
int
__fastcall
Data2Title
(
int
data
);
int
__fastcall
Data2Chapter
(
int
data
);
int
__fastcall
Data2Chapter
(
int
data
);
int
__fastcall
Pos2Data
(
int
title
,
int
chapter
);
int
__fastcall
Pos2Data
(
int
title
,
int
chapter
);
AnsiString
__fastcall
TMenusGen
::
CleanCaption
(
AnsiString
Caption
);
AnsiString
__fastcall
TMenusGen
::
CleanCaption
(
AnsiString
Caption
);
void
__fastcall
VarChange
(
vlc_object_t
*
,
const
char
*
,
TMenuItem
*
,
void
__fastcall
VarChange
(
vlc_object_t
*
,
const
char
*
,
TMenuItem
*
,
TMenuItem
*
,
TMenuItem
*
);
TMenuItem
*
,
TMenuItem
*
);
void
__fastcall
LangChange
(
TMenuItem
*
,
TMenuItem
*
,
TMenuItem
*
,
int
);
void
__fastcall
LangChange
(
TMenuItem
*
,
TMenuItem
*
,
TMenuItem
*
,
int
);
void
__fastcall
ProgramChange
(
TMenuItem
*
,
TMenuItem
*
);
void
__fastcall
ProgramChange
(
TMenuItem
*
,
TMenuItem
*
);
void
__fastcall
SetupVarMenu
(
vlc_object_t
*
,
const
char
*
,
TMenuItem
*
,
void
__fastcall
SetupVarMenu
(
vlc_object_t
*
,
const
char
*
,
TMenuItem
*
,
TNotifyEvent
);
TNotifyEvent
);
void
__fastcall
SetupModuleMenu
(
const
char
*
,
TMenuItem
*
,
TNotifyEvent
);
void
__fastcall
SetupModuleMenu
(
const
char
*
,
TMenuItem
*
,
TNotifyEvent
);
void
__fastcall
ProgramMenu
(
TMenuItem
*
,
pgrm_descriptor_t
*
,
void
__fastcall
ProgramMenu
(
TMenuItem
*
,
pgrm_descriptor_t
*
,
TNotifyEvent
);
TNotifyEvent
);
void
__fastcall
RadioMenu
(
TMenuItem
*
,
AnsiString
,
int
,
int
,
void
__fastcall
RadioMenu
(
TMenuItem
*
,
AnsiString
,
int
,
int
,
TNotifyEvent
);
TNotifyEvent
);
void
__fastcall
LanguageMenu
(
TMenuItem
*
,
es_descriptor_t
*
,
int
,
void
__fastcall
LanguageMenu
(
TMenuItem
*
,
es_descriptor_t
*
,
int
,
TNotifyEvent
);
TNotifyEvent
);
void
__fastcall
NavigationMenu
(
TMenuItem
*
,
TNotifyEvent
);
void
__fastcall
NavigationMenu
(
TMenuItem
*
,
TNotifyEvent
);
public:
public:
__fastcall
TMenusGen
(
intf_thread_t
*
_p_intf
);
__fastcall
TMenusGen
(
intf_thread_t
*
_p_intf
);
/* menu generation */
/* menu generation */
void
__fastcall
SetupMenus
();
void
__fastcall
SetupMenus
();
/* callbacks for menuitems */
/* callbacks for menuitems */
void
__fastcall
AoutVarClick
(
TObject
*
Sender
);
void
__fastcall
AoutVarClick
(
TObject
*
Sender
);
void
__fastcall
VoutVarClick
(
TObject
*
Sender
);
void
__fastcall
VoutVarClick
(
TObject
*
Sender
);
void
__fastcall
InterfaceModuleClick
(
TObject
*
Sender
);
void
__fastcall
InterfaceModuleClick
(
TObject
*
Sender
);
void
__fastcall
MenuLanguageClick
(
TObject
*
Sender
);
void
__fastcall
MenuLanguageClick
(
TObject
*
Sender
);
void
__fastcall
PopupLanguageClick
(
TObject
*
Sender
);
void
__fastcall
PopupLanguageClick
(
TObject
*
Sender
);
void
__fastcall
MenuSubtitleClick
(
TObject
*
Sender
);
void
__fastcall
MenuSubtitleClick
(
TObject
*
Sender
);
void
__fastcall
PopupSubtitleClick
(
TObject
*
Sender
);
void
__fastcall
PopupSubtitleClick
(
TObject
*
Sender
);
void
__fastcall
MenuProgramClick
(
TObject
*
Sender
);
void
__fastcall
MenuProgramClick
(
TObject
*
Sender
);
void
__fastcall
PopupProgramClick
(
TObject
*
Sender
);
void
__fastcall
PopupProgramClick
(
TObject
*
Sender
);
void
__fastcall
MenuTitleClick
(
TObject
*
Sender
);
void
__fastcall
MenuTitleClick
(
TObject
*
Sender
);
void
__fastcall
MenuChapterClick
(
TObject
*
Sender
);
void
__fastcall
MenuChapterClick
(
TObject
*
Sender
);
void
__fastcall
PopupNavigationClick
(
TObject
*
Sender
);
void
__fastcall
PopupNavigationClick
(
TObject
*
Sender
);
};
};
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
#endif
#endif
modules/gui/win32/sout.h
View file @
0562366c
/*****************************************************************************
/*****************************************************************************
* sout.h: the stream ouput dialog box
* sout.h: the stream ouput dialog box
*****************************************************************************
*****************************************************************************
* Copyright (C) 2002-2003 VideoLAN
* Copyright (C) 2002-2003 VideoLAN
* $Id: sout.h,v 1.
3 2003/01/26 03:55:36 ipkiss Exp $
* $Id: sout.h,v 1.
4 2003/02/12 02:11:58 ipkiss Exp $
*
*
* Authors: Olivier Teuliere <ipkiss@via.ecp.fr>
* Authors: Olivier Teuliere <ipkiss@via.ecp.fr>
*
*
* This program is free software; you can redistribute it and/or modify
* 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
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
*****************************************************************************/
#ifndef soutH
#ifndef soutH
#define soutH
#define soutH
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Classes.hpp>
#include <Controls.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <Forms.hpp>
#include <ExtCtrls.hpp>
#include <ExtCtrls.hpp>
#include "CSPIN.h"
#include "CSPIN.h"
#include <Dialogs.hpp>
#include <Dialogs.hpp>
#include <Buttons.hpp>
#include <Buttons.hpp>
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
class
TSoutDlg
:
public
TForm
class
TSoutDlg
:
public
TForm
{
{
__published:
// IDE-managed Components
__published:
// IDE-managed Components
TGroupBox
*
GroupBoxStreamOut
;
TGroupBox
*
GroupBoxStreamOut
;
TEdit
*
EditMrl
;
TEdit
*
EditMrl
;
TPanel
*
PanelAccess
;
TPanel
*
PanelAccess
;
TRadioButton
*
RadioButtonFile
;
TRadioButton
*
RadioButtonFile
;
TRadioButton
*
RadioButtonUDP
;
TRadioButton
*
RadioButtonUDP
;
TRadioButton
*
RadioButtonRTP
;
TRadioButton
*
RadioButtonRTP
;
TOpenDialog
*
OpenDialog1
;
TOpenDialog
*
OpenDialog1
;
TButton
*
ButtonBrowse
;
TButton
*
ButtonBrowse
;
TEdit
*
EditFile
;
TEdit
*
EditFile
;
TCSpinEdit
*
SpinEditPort
;
TCSpinEdit
*
SpinEditPort
;
TEdit
*
EditAddress
;
TEdit
*
EditAddress
;
TLabel
*
LabelPort
;
TLabel
*
LabelPort
;
TLabel
*
LabelAddress
;
TLabel
*
LabelAddress
;
TPanel
*
PanelMux
;
TPanel
*
PanelMux
;
TRadioButton
*
RadioButtonPS
;
TRadioButton
*
RadioButtonPS
;
TRadioButton
*
RadioButtonTS
;
TRadioButton
*
RadioButtonTS
;
TButton
*
ButtonOK
;
TButton
*
ButtonOK
;
TButton
*
ButtonCancel
;
TButton
*
ButtonCancel
;
void
__fastcall
ButtonBrowseClick
(
TObject
*
Sender
);
void
__fastcall
ButtonBrowseClick
(
TObject
*
Sender
);
void
__fastcall
CustomEditChange
(
TObject
*
Sender
);
void
__fastcall
CustomEditChange
(
TObject
*
Sender
);
void
__fastcall
RadioButtonMuxClick
(
TObject
*
Sender
);
void
__fastcall
RadioButtonMuxClick
(
TObject
*
Sender
);
void
__fastcall
RadioButtonAccessClick
(
TObject
*
Sender
);
void
__fastcall
RadioButtonAccessClick
(
TObject
*
Sender
);
void
__fastcall
ButtonOKClick
(
TObject
*
Sender
);
void
__fastcall
ButtonOKClick
(
TObject
*
Sender
);
private:
// User declarations
private:
// User declarations
void
__fastcall
RebuildMrl
();
void
__fastcall
RebuildMrl
();
intf_thread_t
*
p_intf
;
intf_thread_t
*
p_intf
;
public:
// User declarations
public:
// User declarations
__fastcall
TSoutDlg
(
TComponent
*
Owner
,
intf_thread_t
*
_p_intf
);
__fastcall
TSoutDlg
(
TComponent
*
Owner
,
intf_thread_t
*
_p_intf
);
};
};
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
#endif
#endif
modules/gui/win32/subtitles.cpp
View file @
0562366c
/*****************************************************************************
/*****************************************************************************
* subtitles.cpp: Dialog box for divx subtitle selection
* subtitles.cpp: Dialog box for divx subtitle selection
*****************************************************************************
*****************************************************************************
* Copyright (C) 2002-2003 VideoLAN
* Copyright (C) 2002-2003 VideoLAN
* $Id: subtitles.cpp,v 1.
2 2003/01/26 03:55:36 ipkiss Exp $
* $Id: subtitles.cpp,v 1.
3 2003/02/12 02:11:58 ipkiss Exp $
*
*
* Authors: Olivier Teuliere <ipkiss@via.ecp.fr>
* Authors: Olivier Teuliere <ipkiss@via.ecp.fr>
*
*
* This program is free software; you can redistribute it and/or modify
* 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
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
*****************************************************************************/
#include <vcl.h>
#include <vcl.h>
#pragma hdrstop
#pragma hdrstop
#include <vlc/vlc.h>
#include <vlc/vlc.h>
#include <vlc/intf.h>
#include <vlc/intf.h>
#include "subtitles.h"
#include "subtitles.h"
#include "misc.h"
#include "misc.h"
#include "win32_common.h"
#include "win32_common.h"
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
#pragma resource "*.dfm"
#pragma resource "*.dfm"
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
__fastcall
TSubtitlesDlg
::
TSubtitlesDlg
(
TComponent
*
Owner
,
__fastcall
TSubtitlesDlg
::
TSubtitlesDlg
(
TComponent
*
Owner
,
intf_thread_t
*
_p_intf
)
:
TForm
(
Owner
)
intf_thread_t
*
_p_intf
)
:
TForm
(
Owner
)
{
{
p_intf
=
_p_intf
;
p_intf
=
_p_intf
;
Constraints
->
MinWidth
=
Width
;
Constraints
->
MinWidth
=
Width
;
Constraints
->
MinHeight
=
Height
;
Constraints
->
MinHeight
=
Height
;
Translate
(
this
);
Translate
(
this
);
}
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
void
__fastcall
TSubtitlesDlg
::
ButtonBrowseClick
(
TObject
*
Sender
)
void
__fastcall
TSubtitlesDlg
::
ButtonBrowseClick
(
TObject
*
Sender
)
{
{
if
(
OpenDialog1
->
Execute
()
)
if
(
OpenDialog1
->
Execute
()
)
{
{
EditFile
->
Text
=
OpenDialog1
->
FileName
;
EditFile
->
Text
=
OpenDialog1
->
FileName
;
}
}
}
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
void
__fastcall
TSubtitlesDlg
::
ButtonOKClick
(
TObject
*
Sender
)
void
__fastcall
TSubtitlesDlg
::
ButtonOKClick
(
TObject
*
Sender
)
{
{
int
delay
=
(
int
)
(
10
*
atof
(
EditDelay
->
Text
.
c_str
()
));
int
delay
=
(
int
)
(
10
*
atof
(
EditDelay
->
Text
.
c_str
()
));
float
fps
=
atof
(
EditFPS
->
Text
.
c_str
()
);
float
fps
=
atof
(
EditFPS
->
Text
.
c_str
()
);
config_PutPsz
(
p_intf
,
"sub-file"
,
EditFile
->
Text
.
c_str
()
);
config_PutPsz
(
p_intf
,
"sub-file"
,
EditFile
->
Text
.
c_str
()
);
config_PutInt
(
p_intf
,
"sub-delay"
,
delay
);
config_PutInt
(
p_intf
,
"sub-delay"
,
delay
);
config_PutFloat
(
p_intf
,
"sub-fps"
,
fps
);
config_PutFloat
(
p_intf
,
"sub-fps"
,
fps
);
}
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
modules/gui/win32/subtitles.h
View file @
0562366c
/*****************************************************************************
/*****************************************************************************
* subtitles.h: Dialog box for divx subtitle selection
* subtitles.h: Dialog box for divx subtitle selection
*****************************************************************************
*****************************************************************************
* Copyright (C) 2002-2003 VideoLAN
* Copyright (C) 2002-2003 VideoLAN
* $Id: subtitles.h,v 1.
2 2003/01/26 03:55:36 ipkiss Exp $
* $Id: subtitles.h,v 1.
3 2003/02/12 02:11:58 ipkiss Exp $
*
*
* Authors: Olivier Teuliere <ipkiss@via.ecp.fr>
* Authors: Olivier Teuliere <ipkiss@via.ecp.fr>
*
*
* This program is free software; you can redistribute it and/or modify
* 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
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
*****************************************************************************/
#ifndef subtitlesH
#ifndef subtitlesH
#define subtitlesH
#define subtitlesH
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Classes.hpp>
#include <Controls.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <Forms.hpp>
#include <Dialogs.hpp>
#include <Dialogs.hpp>
#include <Buttons.hpp>
#include <Buttons.hpp>
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
class
TSubtitlesDlg
:
public
TForm
class
TSubtitlesDlg
:
public
TForm
{
{
__published:
// IDE-managed Components
__published:
// IDE-managed Components
TOpenDialog
*
OpenDialog1
;
TOpenDialog
*
OpenDialog1
;
TGroupBox
*
GroupBoxSubtitles
;
TGroupBox
*
GroupBoxSubtitles
;
TEdit
*
EditDelay
;
TEdit
*
EditDelay
;
TEdit
*
EditFPS
;
TEdit
*
EditFPS
;
TEdit
*
EditFile
;
TEdit
*
EditFile
;
TButton
*
ButtonBrowse
;
TButton
*
ButtonBrowse
;
TLabel
*
LabelDelay
;
TLabel
*
LabelDelay
;
TLabel
*
LabelFPS
;
TLabel
*
LabelFPS
;
TButton
*
ButtonOK
;
TButton
*
ButtonOK
;
TButton
*
ButtonCancel
;
TButton
*
ButtonCancel
;
void
__fastcall
ButtonBrowseClick
(
TObject
*
Sender
);
void
__fastcall
ButtonBrowseClick
(
TObject
*
Sender
);
void
__fastcall
ButtonOKClick
(
TObject
*
Sender
);
void
__fastcall
ButtonOKClick
(
TObject
*
Sender
);
private:
// User declarations
private:
// User declarations
intf_thread_t
*
p_intf
;
intf_thread_t
*
p_intf
;
public:
// User declarations
public:
// User declarations
__fastcall
TSubtitlesDlg
(
TComponent
*
Owner
,
intf_thread_t
*
p_intf
);
__fastcall
TSubtitlesDlg
(
TComponent
*
Owner
,
intf_thread_t
*
p_intf
);
};
};
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
#endif
#endif
modules/gui/win32/win32.bpf
View file @
0562366c
...
@@ -14,5 +14,5 @@ USEFORM("sout.cpp", SoutDlg);
...
@@ -14,5 +14,5 @@ USEFORM("sout.cpp", SoutDlg);
USEFORM("subtitles.cpp", SubtitlesDlg);
USEFORM("subtitles.cpp", SubtitlesDlg);
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
This file is used by the project manager only and should be treated like the project file
This file is used by the project manager only and should be treated like the project file
DllEntryPoint
DllEntryPoint
modules/gui/win32/win32.cpp
View file @
0562366c
/*****************************************************************************
/*****************************************************************************
* win32.cpp : Win32 interface plugin for vlc
* win32.cpp : Win32 interface plugin for vlc
*****************************************************************************
*****************************************************************************
* Copyright (C) 2002-2003 VideoLAN
* Copyright (C) 2002-2003 VideoLAN
* $Id: win32.cpp,v 1.1
4 2003/02/01 22:21:44 ipkiss Exp $
* $Id: win32.cpp,v 1.1
5 2003/02/12 02:11:58 ipkiss 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
* 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
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
*****************************************************************************/
/*****************************************************************************
/*****************************************************************************
* Preamble
* Preamble
*****************************************************************************/
*****************************************************************************/
#include <vcl.h>
#include <vcl.h>
#include <stdlib.h>
/* malloc(), free() */
#include <stdlib.h>
/* malloc(), free() */
#include <errno.h>
/* ENOMEM */
#include <errno.h>
/* ENOMEM */
#include <string.h>
#include <string.h>
#include <vlc/vlc.h>
#include <vlc/vlc.h>
#include <vlc/intf.h>
#include <vlc/intf.h>
#include "mainframe.h"
#include "mainframe.h"
#include "menu.h"
#include "menu.h"
#include "win32_common.h"
#include "win32_common.h"
/*****************************************************************************
/*****************************************************************************
* Exported interface functions.
* Exported interface functions.
*****************************************************************************/
*****************************************************************************/
extern
"C"
__declspec
(
dllexport
)
extern
"C"
__declspec
(
dllexport
)
int
__VLC_SYMBOL
(
vlc_entry
)
(
module_t
*
p_module
);
int
__VLC_SYMBOL
(
vlc_entry
)
(
module_t
*
p_module
);
/*****************************************************************************
/*****************************************************************************
* Local prototypes.
* Local prototypes.
*****************************************************************************/
*****************************************************************************/
static
int
Open
(
vlc_object_t
*
);
static
int
Open
(
vlc_object_t
*
);
static
void
Close
(
vlc_object_t
*
);
static
void
Close
(
vlc_object_t
*
);
static
void
Run
(
intf_thread_t
*
);
static
void
Run
(
intf_thread_t
*
);
int
Win32Manage
(
void
*
p_data
);
int
Win32Manage
(
void
*
p_data
);
/*****************************************************************************
/*****************************************************************************
* Open: initialize interface
* Open: initialize interface
*****************************************************************************/
*****************************************************************************/
static
int
Open
(
vlc_object_t
*
p_this
)
static
int
Open
(
vlc_object_t
*
p_this
)
{
{
intf_thread_t
*
p_intf
=
(
intf_thread_t
*
)
p_this
;
intf_thread_t
*
p_intf
=
(
intf_thread_t
*
)
p_this
;
/* Allocate instance and initialize some members */
/* Allocate instance and initialize some members */
p_intf
->
p_sys
=
(
intf_sys_t
*
)
malloc
(
sizeof
(
intf_sys_t
)
);
p_intf
->
p_sys
=
(
intf_sys_t
*
)
malloc
(
sizeof
(
intf_sys_t
)
);
if
(
p_intf
->
p_sys
==
NULL
)
if
(
p_intf
->
p_sys
==
NULL
)
{
{
msg_Err
(
p_intf
,
"out of memory"
);
msg_Err
(
p_intf
,
"out of memory"
);
return
(
1
);
return
(
1
);
};
};
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
);
/* Initialize Win32 thread */
/* Initialize Win32 thread */
p_intf
->
p_sys
->
b_playing
=
0
;
p_intf
->
p_sys
->
b_playing
=
0
;
p_intf
->
p_sys
->
b_popup_changed
=
0
;
p_intf
->
p_sys
->
b_popup_changed
=
0
;
p_intf
->
p_sys
->
p_input
=
NULL
;
p_intf
->
p_sys
->
p_input
=
NULL
;
p_intf
->
p_sys
->
i_playing
=
-
1
;
p_intf
->
p_sys
->
i_playing
=
-
1
;
p_intf
->
p_sys
->
b_play_when_adding
=
VLC_TRUE
;
p_intf
->
p_sys
->
b_play_when_adding
=
VLC_TRUE
;
p_intf
->
p_sys
->
b_slider_free
=
1
;
p_intf
->
p_sys
->
b_slider_free
=
1
;
p_intf
->
p_sys
->
b_aout_update
=
VLC_FALSE
;
p_intf
->
p_sys
->
b_aout_update
=
VLC_FALSE
;
p_intf
->
p_sys
->
b_vout_update
=
VLC_FALSE
;
p_intf
->
p_sys
->
b_vout_update
=
VLC_FALSE
;
p_intf
->
p_sys
->
b_program_update
=
VLC_FALSE
;
p_intf
->
p_sys
->
b_program_update
=
VLC_FALSE
;
p_intf
->
p_sys
->
b_title_update
=
VLC_FALSE
;
p_intf
->
p_sys
->
b_title_update
=
VLC_FALSE
;
p_intf
->
p_sys
->
b_chapter_update
=
VLC_FALSE
;
p_intf
->
p_sys
->
b_chapter_update
=
VLC_FALSE
;
p_intf
->
p_sys
->
b_audio_update
=
VLC_FALSE
;
p_intf
->
p_sys
->
b_audio_update
=
VLC_FALSE
;
p_intf
->
p_sys
->
b_spu_update
=
VLC_FALSE
;
p_intf
->
p_sys
->
b_spu_update
=
VLC_FALSE
;
return
(
0
);
return
(
0
);
}
}
/*****************************************************************************
/*****************************************************************************
* Close: destroy interface
* Close: destroy interface
*****************************************************************************/
*****************************************************************************/
static
void
Close
(
vlc_object_t
*
p_this
)
static
void
Close
(
vlc_object_t
*
p_this
)
{
{
intf_thread_t
*
p_intf
=
(
intf_thread_t
*
)
p_this
;
intf_thread_t
*
p_intf
=
(
intf_thread_t
*
)
p_this
;
if
(
p_intf
->
p_sys
->
p_input
)
if
(
p_intf
->
p_sys
->
p_input
)
{
{
vlc_object_release
(
p_intf
->
p_sys
->
p_input
);
vlc_object_release
(
p_intf
->
p_sys
->
p_input
);
}
}
msg_Unsubscribe
(
p_intf
,
p_intf
->
p_sys
->
p_sub
);
msg_Unsubscribe
(
p_intf
,
p_intf
->
p_sys
->
p_sub
);
/* Destroy structure */
/* Destroy structure */
free
(
p_intf
->
p_sys
);
free
(
p_intf
->
p_sys
);
}
}
/*****************************************************************************
/*****************************************************************************
* Run: main loop
* Run: main loop
*****************************************************************************/
*****************************************************************************/
static
void
Run
(
intf_thread_t
*
p_intf
)
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
);
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
();
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_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
;
delete
p_intf
->
p_sys
->
p_window
;
delete
p_intf
->
p_sys
->
p_window
;
}
}
/*****************************************************************************
/*****************************************************************************
* Win32Manage: manage main thread messages
* Win32Manage: manage main thread messages
*****************************************************************************
*****************************************************************************
* In this function, called approx. 10 times a second, we check what the
* In this function, called approx. 10 times a second, we check what the
* main program wanted to tell us.
* main program wanted to tell us.
*****************************************************************************/
*****************************************************************************/
int
Win32Manage
(
intf_thread_t
*
p_intf
)
int
Win32Manage
(
intf_thread_t
*
p_intf
)
{
{
vlc_mutex_lock
(
&
p_intf
->
change_lock
);
vlc_mutex_lock
(
&
p_intf
->
change_lock
);
/* If the "display popup" flag has changed */
/* If the "display popup" flag has changed */
if
(
p_intf
->
b_menu_change
)
if
(
p_intf
->
b_menu_change
)
{
{
/* FIXME: It would be nice to close the popup when the user left-clicks
/* FIXME: It would be nice to close the popup when the user left-clicks
elsewhere, or to actualize the position when he right-clicks again,
elsewhere, or to actualize the position when he right-clicks again,
but i couldn't find a way to close it :-( */
but i couldn't find a way to close it :-( */
TPoint
MousePos
=
Mouse
->
CursorPos
;
TPoint
MousePos
=
Mouse
->
CursorPos
;
p_intf
->
p_sys
->
p_window
->
PopupMenuMain
->
Popup
(
MousePos
.
x
,
MousePos
.
y
);
p_intf
->
p_sys
->
p_window
->
PopupMenuMain
->
Popup
(
MousePos
.
x
,
MousePos
.
y
);
p_intf
->
b_menu_change
=
0
;
p_intf
->
b_menu_change
=
0
;
}
}
/* Update the log window */
/* Update the log window */
p_intf
->
p_sys
->
p_messages
->
UpdateLog
();
p_intf
->
p_sys
->
p_messages
->
UpdateLog
();
/* Update the playlist */
/* Update the playlist */
p_intf
->
p_sys
->
p_playwin
->
Manage
();
p_intf
->
p_sys
->
p_playwin
->
Manage
();
/* Update the input */
/* Update the input */
if
(
p_intf
->
p_sys
->
p_input
==
NULL
)
if
(
p_intf
->
p_sys
->
p_input
==
NULL
)
{
{
p_intf
->
p_sys
->
p_input
=
(
input_thread_t
*
)
p_intf
->
p_sys
->
p_input
=
(
input_thread_t
*
)
vlc_object_find
(
p_intf
,
VLC_OBJECT_INPUT
,
FIND_ANYWHERE
);
vlc_object_find
(
p_intf
,
VLC_OBJECT_INPUT
,
FIND_ANYWHERE
);
}
}
else
if
(
p_intf
->
p_sys
->
p_input
->
b_dead
)
else
if
(
p_intf
->
p_sys
->
p_input
->
b_dead
)
{
{
vlc_object_release
(
p_intf
->
p_sys
->
p_input
);
vlc_object_release
(
p_intf
->
p_sys
->
p_input
);
p_intf
->
p_sys
->
p_input
=
NULL
;
p_intf
->
p_sys
->
p_input
=
NULL
;
}
}
if
(
p_intf
->
p_sys
->
p_input
!=
NULL
&&
!
p_intf
->
p_sys
->
p_input
->
b_die
)
if
(
p_intf
->
p_sys
->
p_input
!=
NULL
&&
!
p_intf
->
p_sys
->
p_input
->
b_die
)
{
{
vlc_bool_t
b_need_menus
=
VLC_FALSE
;
vlc_bool_t
b_need_menus
=
VLC_FALSE
;
input_thread_t
*
p_input
=
p_intf
->
p_sys
->
p_input
;
input_thread_t
*
p_input
=
p_intf
->
p_sys
->
p_input
;
vlc_object_t
*
p_aout
=
NULL
;
vlc_object_t
*
p_aout
=
NULL
;
vlc_object_t
*
p_vout
=
NULL
;
vlc_object_t
*
p_vout
=
NULL
;
vlc_mutex_lock
(
&
p_input
->
stream
.
stream_lock
);
vlc_mutex_lock
(
&
p_input
->
stream
.
stream_lock
);
/* New input or stream map change */
/* New input or stream map change */
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
();
b_need_menus
=
VLC_TRUE
;
b_need_menus
=
VLC_TRUE
;
p_intf
->
p_sys
->
b_playing
=
1
;
p_intf
->
p_sys
->
b_playing
=
1
;
}
}
/* Manage the slider */
/* Manage the slider */
if
(
p_input
->
stream
.
b_seekable
&&
p_intf
->
p_sys
->
b_playing
)
if
(
p_input
->
stream
.
b_seekable
&&
p_intf
->
p_sys
->
b_playing
)
{
{
TTrackBar
*
TrackBar
=
p_intf
->
p_sys
->
p_window
->
TrackBar
;
TTrackBar
*
TrackBar
=
p_intf
->
p_sys
->
p_window
->
TrackBar
;
off_t
NewValue
=
TrackBar
->
Position
;
off_t
NewValue
=
TrackBar
->
Position
;
#define p_area p_input->stream.p_selected_area
#define p_area p_input->stream.p_selected_area
/* If the user hasn't touched the slider since the last time,
/* If the user hasn't touched the slider since the last time,
* then the input can safely change it */
* then the input can safely change it */
if
(
NewValue
==
p_intf
->
p_sys
->
OldValue
)
if
(
NewValue
==
p_intf
->
p_sys
->
OldValue
)
{
{
/* Update the value */
/* Update the value */
TrackBar
->
Position
=
p_intf
->
p_sys
->
OldValue
=
TrackBar
->
Position
=
p_intf
->
p_sys
->
OldValue
=
(
(
off_t
)
SLIDER_MAX_VALUE
*
p_area
->
i_tell
)
/
(
(
off_t
)
SLIDER_MAX_VALUE
*
p_area
->
i_tell
)
/
p_area
->
i_size
;
p_area
->
i_size
;
}
}
/* Otherwise, send message to the input if the user has
/* Otherwise, send message to the input if the user has
* finished dragging the slider */
* finished dragging the slider */
else
if
(
p_intf
->
p_sys
->
b_slider_free
)
else
if
(
p_intf
->
p_sys
->
b_slider_free
)
{
{
off_t
i_seek
=
(
NewValue
*
p_area
->
i_size
)
/
off_t
i_seek
=
(
NewValue
*
p_area
->
i_size
)
/
(
off_t
)
SLIDER_MAX_VALUE
;
(
off_t
)
SLIDER_MAX_VALUE
;
/* release the lock to be able to seek */
/* release the lock to be able to seek */
vlc_mutex_unlock
(
&
p_input
->
stream
.
stream_lock
);
vlc_mutex_unlock
(
&
p_input
->
stream
.
stream_lock
);
input_Seek
(
p_input
,
i_seek
,
INPUT_SEEK_SET
);
input_Seek
(
p_input
,
i_seek
,
INPUT_SEEK_SET
);
vlc_mutex_lock
(
&
p_input
->
stream
.
stream_lock
);
vlc_mutex_lock
(
&
p_input
->
stream
.
stream_lock
);
/* Update the old value */
/* Update the old value */
p_intf
->
p_sys
->
OldValue
=
NewValue
;
p_intf
->
p_sys
->
OldValue
=
NewValue
;
}
}
# undef p_area
# undef p_area
}
}
if
(
p_intf
->
p_sys
->
i_part
!=
p_input
->
stream
.
p_selected_area
->
i_part
)
if
(
p_intf
->
p_sys
->
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
;
b_need_menus
=
VLC_TRUE
;
b_need_menus
=
VLC_TRUE
;
}
}
/* Does the audio output require to update the menus ? */
/* Does the audio output require to update the menus ? */
p_aout
=
(
vlc_object_t
*
)
vlc_object_find
(
p_intf
,
VLC_OBJECT_AOUT
,
p_aout
=
(
vlc_object_t
*
)
vlc_object_find
(
p_intf
,
VLC_OBJECT_AOUT
,
FIND_ANYWHERE
);
FIND_ANYWHERE
);
if
(
p_aout
!=
NULL
)
if
(
p_aout
!=
NULL
)
{
{
vlc_value_t
val
;
vlc_value_t
val
;
if
(
var_Get
(
p_aout
,
"intf-change"
,
&
val
)
>=
0
if
(
var_Get
(
p_aout
,
"intf-change"
,
&
val
)
>=
0
&&
val
.
b_bool
)
&&
val
.
b_bool
)
{
{
p_intf
->
p_sys
->
b_aout_update
=
1
;
p_intf
->
p_sys
->
b_aout_update
=
1
;
b_need_menus
=
VLC_TRUE
;
b_need_menus
=
VLC_TRUE
;
}
}
vlc_object_release
(
p_aout
);
vlc_object_release
(
p_aout
);
}
}
/* Does the video output require to update the menus ? */
/* Does the video output require to update the menus ? */
p_vout
=
(
vlc_object_t
*
)
vlc_object_find
(
p_intf
,
VLC_OBJECT_VOUT
,
p_vout
=
(
vlc_object_t
*
)
vlc_object_find
(
p_intf
,
VLC_OBJECT_VOUT
,
FIND_ANYWHERE
);
FIND_ANYWHERE
);
if
(
p_vout
!=
NULL
)
if
(
p_vout
!=
NULL
)
{
{
vlc_value_t
val
;
vlc_value_t
val
;
if
(
var_Get
(
p_vout
,
"intf-change"
,
&
val
)
>=
0
if
(
var_Get
(
p_vout
,
"intf-change"
,
&
val
)
>=
0
&&
val
.
b_bool
)
&&
val
.
b_bool
)
{
{
p_intf
->
p_sys
->
b_vout_update
=
1
;
p_intf
->
p_sys
->
b_vout_update
=
1
;
b_need_menus
=
VLC_TRUE
;
b_need_menus
=
VLC_TRUE
;
}
}
if
(
var_Get
(
p_vout
,
"directx-on-top"
,
&
val
)
>=
0
)
if
(
var_Get
(
p_vout
,
"directx-on-top"
,
&
val
)
>=
0
)
{
{
p_intf
->
p_sys
->
p_window
->
MenuOnTop
->
Checked
=
val
.
b_bool
;
p_intf
->
p_sys
->
p_window
->
MenuOnTop
->
Checked
=
val
.
b_bool
;
p_intf
->
p_sys
->
p_window
->
PopupOnTop
->
Checked
=
val
.
b_bool
;
p_intf
->
p_sys
->
p_window
->
PopupOnTop
->
Checked
=
val
.
b_bool
;
}
}
vlc_object_release
(
p_vout
);
vlc_object_release
(
p_vout
);
}
}
if
(
b_need_menus
)
if
(
b_need_menus
)
{
{
p_intf
->
p_sys
->
p_menus
->
SetupMenus
();
p_intf
->
p_sys
->
p_menus
->
SetupMenus
();
}
}
vlc_mutex_unlock
(
&
p_input
->
stream
.
stream_lock
);
vlc_mutex_unlock
(
&
p_input
->
stream
.
stream_lock
);
}
}
else
if
(
p_intf
->
p_sys
->
b_playing
&&
!
p_intf
->
b_die
)
else
if
(
p_intf
->
p_sys
->
b_playing
&&
!
p_intf
->
b_die
)
{
{
p_intf
->
p_sys
->
p_window
->
ModeManage
();
p_intf
->
p_sys
->
p_window
->
ModeManage
();
p_intf
->
p_sys
->
b_playing
=
0
;
p_intf
->
p_sys
->
b_playing
=
0
;
}
}
if
(
p_intf
->
b_die
)
if
(
p_intf
->
b_die
)
{
{
vlc_mutex_unlock
(
&
p_intf
->
change_lock
);
vlc_mutex_unlock
(
&
p_intf
->
change_lock
);
/* Prepare to die, young Skywalker */
/* Prepare to die, young Skywalker */
p_intf
->
p_sys
->
p_window
->
ModalResult
=
mrOk
;
p_intf
->
p_sys
->
p_window
->
ModalResult
=
mrOk
;
/* Just in case */
/* Just in case */
return
(
FALSE
);
return
(
FALSE
);
}
}
vlc_mutex_unlock
(
&
p_intf
->
change_lock
);
vlc_mutex_unlock
(
&
p_intf
->
change_lock
);
return
(
TRUE
);
return
(
TRUE
);
}
}
/*****************************************************************************
/*****************************************************************************
* Module descriptor
* Module descriptor
*****************************************************************************/
*****************************************************************************/
#define MAX_LINES_TEXT N_("maximum number of lines in the log window")
#define MAX_LINES_TEXT N_("maximum number of lines in the log window")
#define MAX_LINES_LONGTEXT N_( \
#define MAX_LINES_LONGTEXT N_( \
"You can set the maximum number of lines that the log window will display."\
"You can set the maximum number of lines that the log window will display."
\
" Enter -1 if you want to keep all messages." )
" Enter -1 if you want to keep all messages."
)
vlc_module_begin
();
vlc_module_begin
();
add_category_hint
(
N_
(
"Miscellaneous"
),
NULL
);
add_category_hint
(
N_
(
"Miscellaneous"
),
NULL
);
add_integer
(
"intfwin-max-lines"
,
500
,
NULL
,
MAX_LINES_TEXT
,
MAX_LINES_LONGTEXT
);
add_integer
(
"intfwin-max-lines"
,
500
,
NULL
,
MAX_LINES_TEXT
,
MAX_LINES_LONGTEXT
);
set_description
(
_
(
"Native Windows interface module"
)
);
set_description
(
_
(
"Native Windows interface module"
)
);
set_capability
(
"interface"
,
100
);
set_capability
(
"interface"
,
100
);
set_callbacks
(
E_
(
Open
),
E_
(
Close
)
);
set_callbacks
(
E_
(
Open
),
E_
(
Close
)
);
add_shortcut
(
"win"
);
add_shortcut
(
"win"
);
add_shortcut
(
"win32"
);
add_shortcut
(
"win32"
);
vlc_module_end
();
vlc_module_end
();
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment