Commit 788c882a authored by Olivier Teulière's avatar Olivier Teulière

* All: Removed the win32 plugin; wxwindows rulez :)

parent 41e4d5d7
dnl Autoconf settings for vlc
dnl $Id: configure.ac,v 1.42 2003/07/25 11:33:24 gbazin Exp $
dnl $Id: configure.ac,v 1.43 2003/07/27 12:31:50 ipkiss Exp $
AC_INIT(vlc,0.6.1-test1)
......@@ -3296,7 +3296,6 @@ AC_OUTPUT([
modules/gui/qnx/Makefile
modules/gui/qt/Makefile
modules/gui/skins/Makefile
modules/gui/win32/Makefile
modules/gui/wxwindows/Makefile
modules/misc/Makefile
modules/misc/dummy/Makefile
......
.deps
.dirstamp
*.lo
*.la
*.dll
*.dylib
*.sl
*.so
Makefile.am
Makefile.in
Makefile
#
# Borland C++ project
# This module is only available as a plugin. Don't try to fiddle with it!
#
EXTRA_DIST += $(BORLAND_win32)
# We have private rules! We do whatever we want! Don't mess with us!
SOURCES_win32 = PRIVATE
libwin32_plugin.dll: $(BORLAND_win32)
cd && \
rm -f win32.mak && \
$(BPR2MAK) win32.bpr -s | \
sed -e 's@^LIBPATH = .*@&;$$(RELEASELIBPATH)@' \
-e 's@^USERDEFINES = .*@& -DMODULE_NAME=win32@' \
> win32.mak && \
$(BCMAKE) -f win32.mak -b
BORLAND_win32 = \
win32.bpr \
win32.bpf \
\
about.cpp \
disc.cpp \
dragdrop.cpp \
mainframe.cpp \
menu.cpp \
messages.cpp \
network.cpp \
playlist.cpp \
preferences.cpp \
win32.cpp \
misc.cpp \
sout.cpp \
subtitles.cpp \
\
about.dfm \
disc.dfm \
mainframe.dfm \
messages.dfm \
network.dfm \
playlist.dfm \
preferences.dfm \
sout.dfm \
subtitles.dfm \
\
about.h \
disc.h \
dragdrop.h \
mainframe.h \
menu.h \
messages.h \
network.h \
playlist.h \
preferences.h \
win32_common.h \
misc.h \
sout.h \
subtitles.h \
$(NULL)
/*****************************************************************************
* about.cpp: The "About" dialog box
*****************************************************************************
* Copyright (C) 2002 VideoLAN
*
* Authors: Olivier Teuliere <ipkiss@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include <vcl.h>
#pragma hdrstop
#include <vlc/vlc.h>
#include <vlc/intf.h>
#include "about.h"
#include "misc.h"
#include "win32_common.h"
//---------------------------------------------------------------------------
//#pragma package(smart_init)
#pragma resource "*.dfm"
//---------------------------------------------------------------------------
__fastcall TAboutDlg::TAboutDlg( TComponent* Owner, intf_thread_t *_p_intf )
: TForm( Owner )
{
p_intf = _p_intf;
Image1->Picture->Icon = p_intf->p_sys->p_window->Icon;
LabelVersion->Caption = "Version " VERSION;
Translate( this );
}
//---------------------------------------------------------------------------
object AboutDlg: TAboutDlg
Tag = 3
Left = 442
Top = 281
BorderStyle = bsDialog
Caption = 'About'
ClientHeight = 222
ClientWidth = 282
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
Icon.Data = {
0000010001003030000001001800A81C00001600000028000000300000006000
00000100180000000000001B0000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000069375900000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000120E0A4011253E0F18000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000F0B
084143CA08070016430F08040800000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000003127291203174647E8464AE808010840E54039E6390B0C06
0E0A1C0000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0070CD0079DD0079DD0070CD0000000000000000000C1008261D6E4647E54547
E64748E105040039E6393AE53939E63936D33308030100000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000070CD0079DD0079DE007DE40088F9008CFF008CFF0088F9007CE302
6EC70B09124641DC4444DF4546E34446E54847E003040040E6403AEA3A3EE33E
3CE33C39E639080F010801050000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000070CD0079DD0077D90070CB0078D8007BDC007BDC007BDC
007BDC007BDC007BDD007EE32E232D0804084553F14250F34252ED4449DB4844
DC4645E208010540E5401C78150D18053CE63C3AE63A39EA393CD83C241A2006
0402000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000070CD0079DD007ADF007BDE007BDC0072
CC005188004877004876004876004876034976054A760B4D7731434221175B42
54EC4253EE4252F60B05104250F44252EB4546DA08010539E6392BAA2B080105
3CE63C39E7393AE63A39E93939E839081208181C080000000000000000000000
000000000000000000000000000000000000000070CD0079DD0079DD007CE300
88F90089F90075D2005188004877005188008CFF008CFF008CFF008CFF008CFF
1092FF2099FF31A0FF1408294840DB4550E1464EEA0C060B0B05084654F64653
F64453EF080E033AE63A2BAA2B03030339E33939DF3939E639080F083DDB3D24
9C24434B3B000000000000000000000000000000000000000000000000000000
0063B60085F3008BFE0088F9007FE90088F90080E8005CA0008CFF008CFF008C
FF008CFF008CFF008CFF008CFF048DFF1594FF259BFF35A2FF0C04103F38C754
5AF7505BF10C08100801084352F64652F44253F30813053AE63A39E639030403
1C521826A1250812010807032454131558150000000000000000000000000000
000000000000000000000000000000000000000070CD007CE30079DD00000000
7CE30089FA008CFF0089FA008CFF008CFF008CFF008CFF008CFF008CFF098FFF
1996FF2A9DFF3AA4FF0804103A2AA34E58F74E58F40B0B120803054652F34548
E64451F305130532CA323AE23A03070308070307040008040139E63939E43931
B42F5E1347000000000000000000000000000000000000000000000000000000
0000000000000000000061B10000000079DD008CFF008CFF008CFF008CFF008C
FF008CFF008CFF008CFF008CFF0E91FF1E98FF2E9FFF3FA6FF040408382BAF4D
5AEF555AF70F12250501050F04160804074250F3121A123AE93A39E239080803
0D2F08010401268C2539E7393DE63D3FE23E0804100000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
79DD008CFF008CFF008CFF008CFF008CFF008CFF008CFF008CFF028CFF1293FF
239AFF33A1FF43A8FF0802083A2AA3565BF7555AF71714330501050104000801
07424FF12828203AEA3A39E639030703182F1008340801040139E7393DE83D39
E939080400000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000070CD0088F9008CFF008CFF008CFF008C
FF008CFF008CFF008CFF078EFF1795FF279CFF38A3FF48AAFF0808005151F155
5AF30804030804000504050800082E358E0E0C1F1D192439E53940E640080400
2AA12739E63908020708010539E8393BE93B0804080000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000007CE3008CFF008CFF008CFF058EFD1D96F92398F8269AFA31A0FC42A8FF
4FAEFF5CB3FF65B7FF0C08084F5AF14E57F50B04080804043639A54647E81C13
49363AA70804080F120835953439E7393EE63E39DF3939EA39081105308A2B3F
E73F080601000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000047BDB1D96F92398F82498F83BA0
F399C1E1B1C9DDBCD4E7CBE0F3D9EDFFDCEEFFDEEFFFCDE8FF080808575BF750
58F624125A5057F34845DF4A41E0150E30C55734E3723EC56E33A23D27050105
39E43939E63939E6393CE63C14420C3BE03B192A090000000000000000000000
0000000000000000000000000000000000000000000000000000000000000004
04042D88D399C1E1B1C9DDB1C9DCB7CBDBCFD3D7D5D5D6E2E2E3F0F0F1FEFEFF
FEFEFFFEFEFFF9FCFF0C08085D61F15B61EF555AF64A4FE13937BB0E0A12DE74
39E1733CDE713CDF753AE67541C36B342C231F17141B3AE63A39E7393DE83D39
E93939DE39000000000000000000000000000000000000000000000000000000
0000000000000000000000000000001818186893B8C3CCD2D5D5D6D5D5D6D5D5
D6D6D6D6D6D6D6E3E3E3F1F1F1FFFFFFFFFFFFFFFFFFFFFFFF140C145C5EF668
63F75555EA10061CC3673FDF713A0C1104080403080105080007070407D56F36
DE743EDE72401C200C29452939E63939E73939EA390000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000343434A2B4C2D5D5D6D6D6D6D6D6D6D6D6D6D5D5D6E2E2E3F0F0F1FEFEFF
FEFEFFFEFEFFFEFEFF20161C5C5EF6373EAE0E0413E2713DE1763CCD6A3C2A0D
08A44B2CDE743EBD612F080401030403E1713CDE7239DE713AE1723C22201139
C13341E641000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000001B1B1B99AEBED5D5D6D5D5D6D5D5
D6CFD3D7B8CBDBBFD5E7CEE2F3DCEFFFDFF0FFE2F1FFE9F4FF10100C3639A46E
4540DE7239DE713DE1713C07000784261CDE7639E3743E0812001F0407D86E36
E3753EE57540E57541DE763CDE733DD26637493C387E2F7B0000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00001B1B1B99AEBFCED3D7B7CBDBB1C9DD99C1E140A2F339A2FA49AAFC59B2FF
66B8FF74BEFF92CBFFD9ECFF0F0402C66531DE7139E2733D854B1E0A01084D11
0DE3733EE1723CDF713ADF753AE1763C1D0A08290708E57140E1763CDE733DC7
6B34080408000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000001818187FA5C399C1E13BA0F32498
F81D96F91091FD1C97FF2C9EFF3CA5FF4DACFF5DB3FF71BBFF8DC8FF9FD0FF08
0400080406B95C2EDE7239070B070803014D1615DE723CDE7540E5714030090D
0504003A120FE67541DE75390808044A0C290000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000707071778C81C92F3058EFD008CFF008CFF1092FF2099FF31A0FF41A7FF
51AEFF62B5FF72BCFF7BBFFF7BBBF96E9FCD0808080806041D0508E571403E22
0C200708080405070407070007080303B05F31DE723967301908010500000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000007CE3008CFF008C
FF048DFF1594FF259BFF35A2FF46A9FF56B0FF66B7FF77BEFF7BBFFF6DAAE300
0000000000000000000000080401200C088D4024E17141E57140DF713ADE713E
DE76390801070000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000079DD008CFF008CFF098FFF1996FF2A9DFF3AA4FF4AABFF
5BB2FF6BB9FF7BBFFF7BBFFF6AA5DD0000000000000000000000000000001D1A
0C1A0F08110903441912E57140623B1E08020300000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000079DD008CFF008C
FF0E91FF1E98FF2E9FFF3FA6FF4FADFF5FB4FF70BBFF7BBFFF78BAF96299CD00
00000000000000000000000000000000000000003914100000005A2411000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000070CD0088F9078EFD2C9CF940A3F850ACFA60B4FC70BCFF
7DC2FF87C6FF7EC0FF6DAAE30000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000707071A85DD40A2
F3A0C3E1B7CBDDC6D8E7D4E5F3E2F1FFE5F2FFD9ECFF9FD0FF7AACDD05050500
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000001818187FA5C3B8CBDBD0D4D7D5D5D6E2E2E3F0F0F1FEFEFF
FEFEFFFAFCFFE2EDF99FB7CD1C1C1C0000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000001B1B1B99AEBFD4D5
D6D6D6D6D6D6D6E3E3E3F1F1F1FFFFFFFFFFFFFEFEFFD1DAE33E3E3E00000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000001D1D1D7B9BB4CACED1D6D6D6D5D5D6E2E2E3F0F0F1FEFEFF
FEFEFFFEFEFFC9D2DD2121210000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000343434A5B5
C2CFD3D7BFCEDBC9D9E7D7E6F3E6F3FFECF5FFF0F4F9AEBDCD23232300000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000018181887A8C3A6C6E169B3F367B6FA77BEFC88C6FF
9FD0FFB4CBE33939390000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000040404338C
D749A8F947A9FD54AFFF64B6FF74BDFF7EC0FF76ABDD05050500000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000001F7DCD369FF948AAFF58B1FF69B8FF79BFFF
78BAF96299CD0000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
003592E34DACFF5DB3FF6DBAFF7BBFFF6DAAE300000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000003890DD51AEFF62B5FF72BCFF7BBFFF
6AA5DD0000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
003B8FD84C9CE3589FDE69A9E375B6F46299CD00000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000003376B00000000000000000005788B6
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000006CC61A83DD247FCC00000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000006DC71A83DD2686D71F6EB1
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000FFFF
FFFFFFFF0000FFFFFFFFFFFF0000FFFFFE1FDFFF0000FFFFE0078FFF0000FFFE
000007FF0000FFF0000001FF0000FF80000000FF0000FF000000003F0000FF00
0000000F0000FE00000000070000F800000000070000F8000000000F0000FC00
000000070000FE00000000070000FF80000000070000FFC0000000070000FFE0
000000070000FFE0000000070000FFE0000000070000FFE0000000070000FFF0
000000070000FFF0000000030000FFF0000000070000FFF00000000F0000FFF0
0000003F0000FFF8000E00FF0000FFF8000F01FF0000FFF8000FD7FF0000FFF8
001FFFFF0000FFFC001FFFFF0000FFFC001FFFFF0000FFFC003FFFFF0000FFFC
003FFFFF0000FFFE003FFFFF0000FFFE007FFFFF0000FFFE007FFFFF0000FFFE
007FFFFF0000FFFF00FFFFFF0000FFFF00FFFFFF0000FFFF00FFFFFF0000FFFF
01FFFFFF0000FFFF01FFFFFF0000FFFF81FFFFFF0000FFFFC3FFFFFF0000FFFF
FFFFFFFF0000FFFFFFFFFFFF0000FFFFFFFFFFFF0000FFFFFFFFFFFF0000}
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object Label1: TLabel
Tag = 3
Left = 82
Top = 13
Width = 141
Height = 20
Caption = 'VLC media player'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -16
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
end
object Label2: TLabel
Tag = 3
Left = 14
Top = 64
Width = 161
Height = 13
Caption = '(c) 1996-2003 the VideoLAN team'
end
object Label4: TLabel
Tag = 3
Left = 14
Top = 131
Width = 253
Height = 39
Caption =
'This is the VideoLAN Client, a DVD, MPEG and DivX player. It can' +
' play MPEG and MPEG2 files from a file or from a network source.'
WordWrap = True
end
object Label3: TLabel
Tag = 3
Left = 14
Top = 88
Width = 216
Height = 13
Caption = 'the VideoLAN team <videolan@videolan.org>'
end
object Image1: TImage
Left = 16
Top = 8
Width = 49
Height = 49
end
object Label5: TLabel
Tag = 3
Left = 14
Top = 104
Width = 121
Height = 13
Caption = 'http://www.videolan.org/'
end
object LabelVersion: TLabel
Tag = 3
Left = 82
Top = 35
Width = 59
Height = 13
Caption = 'Version x.y.z'
end
object ButtonOK: TButton
Tag = 3
Left = 69
Top = 188
Width = 145
Height = 24
Anchors = [akLeft, akBottom]
Caption = 'OK'
Default = True
ModalResult = 1
TabOrder = 0
end
end
/*****************************************************************************
* about.h: The "About" dialog box
*****************************************************************************
* Copyright (C) 2002 VideoLAN
*
* Authors: Olivier Teuliere <ipkiss@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef aboutH
#define aboutH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <Buttons.hpp>
#include <ExtCtrls.hpp>
#include <Graphics.hpp>
//---------------------------------------------------------------------------
class TAboutDlg : public TForm
{
__published: // IDE-managed Components
TLabel *Label1;
TLabel *Label2;
TLabel *Label4;
TLabel *Label3;
TImage *Image1;
TLabel *Label5;
TLabel *LabelVersion;
TButton *ButtonOK;
private: // User declarations
intf_thread_t *p_intf;
public: // User declarations
__fastcall TAboutDlg( TComponent* Owner, intf_thread_t *_p_intf );
};
//---------------------------------------------------------------------------
#endif
/*****************************************************************************
* disc.cpp: "Open disc" dialog box.
*****************************************************************************
* Copyright (C) 2002 VideoLAN
*
* Authors: Olivier Teuliere <ipkiss@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include <vcl.h>
#pragma hdrstop
#include <vlc/vlc.h>
#include <vlc/intf.h>
#include "disc.h"
#include "misc.h"
#include "win32_common.h"
//---------------------------------------------------------------------------
//#pragma package(smart_init)
#pragma link "CSPIN"
#pragma resource "*.dfm"
//---------------------------------------------------------------------------
__fastcall TDiscDlg::TDiscDlg( TComponent* Owner, intf_thread_t *_p_intf )
: TForm( Owner )
{
p_intf = _p_intf;
/* Simulate a click to get the correct device name */
RadioGroupTypeClick( RadioGroupType );
Translate( this );
}
//---------------------------------------------------------------------------
void __fastcall TDiscDlg::FormShow( TObject *Sender )
{
p_intf->p_sys->p_window->OpenDiscAction->Checked = true;
}
//---------------------------------------------------------------------------
void __fastcall TDiscDlg::FormHide( TObject *Sender )
{
p_intf->p_sys->p_window->OpenDiscAction->Checked = false;
}
//---------------------------------------------------------------------------
void __fastcall TDiscDlg::ButtonCancelClick( TObject *Sender )
{
Hide();
}
//---------------------------------------------------------------------------
void __fastcall TDiscDlg::ButtonOkClick( TObject *Sender )
{
AnsiString Device, Source;
Hide();
Device = EditDevice->Text;
/* Build source name and add it to playlist */
if ( CheckBoxMenus->Checked && RadioGroupType->ItemIndex == 0 )
{
Source = "dvdplay://" + Device;
}
else
{
AnsiString Method, Title, Chapter;
/* Select title and chapter */
Title.sprintf( "%d", SpinEditTitle->Value );
Chapter.sprintf( "%d", SpinEditChapter->Value );
/* Select access method */
if( RadioGroupType->ItemIndex == 0 )
Method = "dvdold";
else
Method = "vcd";
/* build the MRL */
Source = Method + "://" + Device + "@" + Title + "," + Chapter;
}
msg_Dbg (p_intf , Source.c_str());
p_intf->p_sys->p_playwin->Add( Source, PLAYLIST_APPEND
| ( p_intf->p_sys->b_play_when_adding ? PLAYLIST_GO : 0 ),
PLAYLIST_END );
}
//---------------------------------------------------------------------------
void __fastcall TDiscDlg::RadioGroupTypeClick( TObject *Sender )
{
TRadioGroup *RadioGroupType = (TRadioGroup *)Sender;
char *psz_device;
if( RadioGroupType->ItemIndex == 0 )
{
psz_device = config_GetPsz( p_intf, "dvd" );
CheckBoxMenus->Enabled = true;
DisableTitles( CheckBoxMenus->Checked );
}
else
{
psz_device = config_GetPsz( p_intf, "vcd" );
CheckBoxMenus->Enabled = false;
/* We don't support menus for vcds, so we use titles and chapters */
DisableTitles( false );
}
if( psz_device )
{
EditDevice->Text = psz_device;
free( psz_device );
}
}
//---------------------------------------------------------------------------
void __fastcall TDiscDlg::CheckBoxMenusClick( TObject *Sender )
{
DisableTitles( CheckBoxMenus->Checked );
}
//---------------------------------------------------------------------------
void __fastcall TDiscDlg::DisableTitles( Boolean disable )
{
if( disable )
{
GroupBoxPosition->Enabled = false;
LabelTitle->Enabled = false;
LabelChapter->Enabled = false;
SpinEditTitle->Enabled = false;
SpinEditTitle->Color = clBtnFace;
SpinEditChapter->Enabled = false;
SpinEditChapter->Color = clBtnFace;
}
else
{
GroupBoxPosition->Enabled = true;
LabelTitle->Enabled = true;
LabelChapter->Enabled = true;
SpinEditTitle->Enabled = true;
SpinEditTitle->Color = clWindow;
SpinEditChapter->Enabled = true;
SpinEditChapter->Color = clWindow;
}
}
//---------------------------------------------------------------------------
object DiscDlg: TDiscDlg
Tag = 3
Left = 465
Top = 337
BorderIcons = [biSystemMenu, biMinimize]
BorderStyle = bsDialog
Caption = 'Open Disc'
ClientHeight = 173
ClientWidth = 248
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
OnHide = FormHide
OnShow = FormShow
PixelsPerInch = 96
TextHeight = 13
object LabelDevice: TLabel
Tag = 3
Left = 8
Top = 117
Width = 66
Height = 13
Caption = 'Device &name:'
end
object CheckBoxMenus: TCheckBox
Left = 96
Top = 8
Width = 97
Height = 17
Caption = '&Menus'
TabOrder = 1
OnClick = CheckBoxMenusClick
end
object GroupBoxPosition: TGroupBox
Tag = 3
Left = 96
Top = 33
Width = 144
Height = 72
Caption = 'Starting position'
TabOrder = 2
object LabelTitle: TLabel
Tag = 3
Left = 8
Top = 19
Width = 23
Height = 13
Caption = '&Title:'
end
object LabelChapter: TLabel
Tag = 3
Left = 8
Top = 47
Width = 40
Height = 13
Caption = '&Chapter:'
end
object SpinEditTitle: TCSpinEdit
Left = 56
Top = 14
Width = 80
Height = 22
TabStop = True
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
MaxValue = 65535
MinValue = 1
ParentColor = False
ParentFont = False
TabOrder = 1
Value = 1
end
object SpinEditChapter: TCSpinEdit
Left = 56
Top = 42
Width = 80
Height = 22
TabStop = True
MaxValue = 65535
MinValue = 1
ParentColor = False
TabOrder = 0
Value = 1
end
end
object RadioGroupType: TRadioGroup
Tag = 3
Left = 8
Top = 8
Width = 80
Height = 97
Caption = 'Disc type'
ItemIndex = 0
Items.Strings = (
'&DVD'
'&VCD')
TabOrder = 0
OnClick = RadioGroupTypeClick
end
object ButtonOk: TButton
Tag = 3
Left = 82
Top = 142
Width = 75
Height = 23
Caption = 'OK'
Default = True
ModalResult = 1
TabOrder = 4
OnClick = ButtonOkClick
end
object ButtonCancel: TButton
Tag = 3
Left = 165
Top = 142
Width = 75
Height = 23
Cancel = True
Caption = 'Cancel'
ModalResult = 2
TabOrder = 5
OnClick = ButtonCancelClick
end
object EditDevice: TEdit
Tag = 5
Left = 96
Top = 113
Width = 144
Height = 21
TabOrder = 3
Text = 'F:\'
end
end
/*****************************************************************************
* disc.h: "Open disc" dialog box.
*****************************************************************************
* Copyright (C) 2002 VideoLAN
*
* Authors: Olivier Teuliere <ipkiss@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef discH
#define discH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <Buttons.hpp>
#include <ComCtrls.hpp>
#include <ExtCtrls.hpp>
#include "CSPIN.h"
//---------------------------------------------------------------------------
class TDiscDlg : public TForm
{
__published: // IDE-managed Components
TLabel *LabelDevice;
TGroupBox *GroupBoxPosition;
TLabel *LabelTitle;
TLabel *LabelChapter;
TRadioGroup *RadioGroupType;
TButton *ButtonOk;
TButton *ButtonCancel;
TEdit *EditDevice;
TCSpinEdit *SpinEditTitle;
TCSpinEdit *SpinEditChapter;
TCheckBox *CheckBoxMenus;
void __fastcall FormShow( TObject *Sender );
void __fastcall FormHide( TObject *Sender );
void __fastcall ButtonCancelClick( TObject *Sender );
void __fastcall ButtonOkClick( TObject *Sender);
void __fastcall RadioGroupTypeClick( TObject *Sender );
void __fastcall CheckBoxMenusClick( TObject *Sender );
private: // User declarations
intf_thread_t *p_intf;
void __fastcall DisableTitles( Boolean disable );
public: // User declarations
__fastcall TDiscDlg( TComponent* Owner, intf_thread_t *_p_intf );
};
//---------------------------------------------------------------------------
#endif
/*****************************************************************************
* dragdrop.cpp: drag and drop management
*****************************************************************************
* Copyright (C) 2002 VideoLAN
*
* Authors: Olivier Teuliere <ipkiss@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include <vcl.h>
#pragma hdrstop
#include "dragdrop.h"
//---------------------------------------------------------------------------
__fastcall TDropTarget::TDropTarget( HWND HForm ) : IDropTarget()
{
FormHandle = HForm;
References = 1;
}
//---------------------------------------------------------------------------
__fastcall TDropTarget::~TDropTarget()
{
}
//---------------------------------------------------------------------------
/* helper routine to notify Form of drop on target */
void __fastcall TDropTarget::HandleDrop( HDROP HDrop )
{
SendMessage( FormHandle, WM_OLEDROP, (WPARAM)HDrop, 0 );
}
//---------------------------------------------------------------------------
STDMETHODIMP TDropTarget::QueryInterface( REFIID iid, void FAR* FAR* ppv )
{
/* tell other objects about our capabilities */
if( iid == IID_IUnknown || iid == IID_IDropTarget )
{
*ppv = this;
AddRef();
return S_OK;
}
*ppv = NULL;
return ResultFromScode( E_NOINTERFACE );
}
//---------------------------------------------------------------------------
STDMETHODIMP_(ULONG) TDropTarget::AddRef()
{
return ++References;
}
//---------------------------------------------------------------------------
STDMETHODIMP_(ULONG) TDropTarget::Release()
{
if( --References == 0 )
{
delete this;
return 0;
}
return References;
}
//---------------------------------------------------------------------------
/* Indicates whether a drop can be accepted, and, if so,
* the effect of the drop */
STDMETHODIMP TDropTarget::DragEnter( LPDATAOBJECT pDataObj, DWORD grfKeyState,
POINTL pt, DWORD *pdwEffect )
{
FORMATETC fmtetc;
fmtetc.cfFormat = CF_HDROP;
fmtetc.ptd = NULL;
fmtetc.dwAspect = DVASPECT_CONTENT;
fmtetc.lindex = -1;
fmtetc.tymed = TYMED_HGLOBAL;
/* Check that the drag source provides CF_HDROP,
* which is the only format we accept */
if( pDataObj->QueryGetData( &fmtetc ) == S_OK )
*pdwEffect = DROPEFFECT_COPY;
else
*pdwEffect = DROPEFFECT_NONE;
return S_OK;
}
//---------------------------------------------------------------------------
/* for visual feedback */
STDMETHODIMP TDropTarget::DragOver( DWORD grfKeyState, POINTL pt,
DWORD *pdwEffect )
{
return S_OK;
}
//---------------------------------------------------------------------------
/* remove visual feedback */
STDMETHODIMP TDropTarget::DragLeave()
{
return S_OK;
}
//---------------------------------------------------------------------------
/* something has been dropped */
STDMETHODIMP TDropTarget::Drop( LPDATAOBJECT pDataObj, DWORD grfKeyState,
POINTL pt, DWORD *pdwEffect )
{
/* user has dropped on us -- get the CF_HDROP data from drag source */
FORMATETC fmtetc;
fmtetc.cfFormat = CF_HDROP;
fmtetc.ptd = NULL;
fmtetc.dwAspect = DVASPECT_CONTENT;
fmtetc.lindex = -1;
fmtetc.tymed = TYMED_HGLOBAL;
STGMEDIUM medium;
HRESULT hr = pDataObj->GetData( &fmtetc, &medium );
if( !FAILED(hr) )
{
/* grab a pointer to the data */
HGLOBAL HFiles = medium.hGlobal;
HDROP HDrop = (HDROP)GlobalLock( HFiles );
/* call the helper routine which will notify the Form of the drop */
HandleDrop( HDrop );
/* release the pointer to the memory */
GlobalUnlock( HFiles );
ReleaseStgMedium( &medium );
}
else
{
*pdwEffect = DROPEFFECT_NONE;
return hr;
}
return S_OK;
}
/*****************************************************************************
* dragdrop.h: drag and drop management
*****************************************************************************
* Copyright (C) 2002 VideoLAN
*
* Authors: Olivier Teuliere <ipkiss@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef dragdropH
#define dragdropH
//---------------------------------------------------------------------------
#include <ole2.h>
#define WM_OLEDROP WM_USER + 1
//---------------------------------------------------------------------------
class TDropTarget : public IDropTarget
{
public:
__fastcall TDropTarget( HWND HForm );
__fastcall ~TDropTarget();
protected:
/* IUnknown methods */
STDMETHOD(QueryInterface)( REFIID riid, void FAR* FAR* ppvObj );
STDMETHOD_(ULONG, AddRef)();
STDMETHOD_(ULONG, Release)();
/* IDropTarget methods */
STDMETHOD(DragEnter)( LPDATAOBJECT pDataObj, DWORD grfKeyState,
POINTL pt, DWORD *pdwEffect );
STDMETHOD(DragOver)( DWORD grfKeyState, POINTL pt, DWORD *pdwEffect );
STDMETHOD(DragLeave)();
STDMETHOD(Drop)( LPDATAOBJECT pDataObj, DWORD grfKeyState,
POINTL pt, DWORD *pdwEffect );
private:
unsigned long References;
HWND FormHandle;
/* helper function */
void __fastcall HandleDrop( HDROP HDrop );
};
//---------------------------------------------------------------------------
#endif
/*****************************************************************************
* mainframe.cpp: Win32 interface plugin for vlc
*****************************************************************************
* Copyright (C) 2002 VideoLAN
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include <vcl.h>
#pragma hdrstop
#include <vlc/vlc.h>
#include <vlc/intf.h>
#include <vlc/vout.h>
#include <vlc/aout.h>
#include "dragdrop.h"
#include "mainframe.h"
#include "menu.h"
#include "disc.h"
#include "network.h"
#include "about.h"
#include "preferences.h"
#include "messages.h"
#include "playlist.h"
#include "sout.h"
#include "subtitles.h"
#include "misc.h"
#include "win32_common.h"
/*****************************************************************************
* BORLAND SUCKS
* If the following pragma doesn't end with \r\n instead of \n, the file
* doesn't compile anymore... Funny, isn't it?
* With vim, you can use ":set ff=dos" to correct it
*****************************************************************************/
#pragma link "CSPIN"
#pragma resource "*.dfm"
extern int Win32Manage( intf_thread_t *p_intf );
//---------------------------------------------------------------------------
__fastcall TMainFrameDlg::TMainFrameDlg(
TComponent* Owner, intf_thread_t *_p_intf ) : TForm( Owner )
{
p_intf = _p_intf;
Application->ShowHint = true;
Application->OnHint = DisplayHint;
TimerManage->Interval = INTF_IDLE_SLEEP / 1000;
TrackBar->Max = SLIDER_MAX_VALUE;
/* do we need to show the captions of the toolbuttons? */
if( config_GetInt( p_intf, "intfwin-show-captions" ) )
{
ToolBar->ShowCaptions = true;
/* Add enough room for the text */
ToolBar->Height += 9;
}
/* default height and caption */
ClientHeight = 37 + ToolBar->Height;
Caption = VOUT_TITLE " (Win32 interface)";
StringListPref = new TStringList();
Translate( this );
/* drag and drop stuff */
/* initialize the OLE library */
OleInitialize( NULL );
/* TDropTarget will send the WM_OLEDROP message to the form */
lpDropTarget = (LPDROPTARGET)new TDropTarget( this->Handle );
CoLockObjectExternal( lpDropTarget, true, true );
/* register the form as a drop target */
RegisterDragDrop( this->Handle, lpDropTarget );
}
//---------------------------------------------------------------------------
__fastcall TMainFrameDlg::~TMainFrameDlg()
{
delete StringListPref;
}
//---------------------------------------------------------------------------
/*****************************************************************************
* Event handlers
****************************************************************************/
void __fastcall TMainFrameDlg::TimerManageTimer( TObject *Sender )
{
Win32Manage( p_intf );
}
//---------------------------------------------------------------------------
void __fastcall TMainFrameDlg::DisplayHint( TObject *Sender )
{
StatusBar->SimpleText = GetLongHint( Application->Hint );
}
//---------------------------------------------------------------------------
void __fastcall TMainFrameDlg::TrackBarChange( TObject *Sender )
{
/* This function displays the current date related to the position in
* the stream. It is called whenever the slider changes its value.
* The lock has to be taken before the function is called */
if( p_intf->p_sys->p_input != NULL )
{
#define p_area p_intf->p_sys->p_input->stream.p_selected_area
char psz_time[ OFFSETTOTIME_MAX_SIZE ];
off_t Value = TrackBar->Position;
GroupBoxSlider->Caption =
input_OffsetToTime( p_intf->p_sys->p_input, psz_time,
( p_area->i_size * Value ) / (off_t)SLIDER_MAX_VALUE );
#undef p_area
}
}
//---------------------------------------------------------------------------
void __fastcall TMainFrameDlg::FormClose( TObject *Sender,
TCloseAction &Action )
{
vlc_mutex_lock( &p_intf->change_lock );
p_intf->p_vlc->b_die = VLC_TRUE;
vlc_mutex_unlock( &p_intf->change_lock );
/* remove the form from the list of drop targets */
RevokeDragDrop( this->Handle );
lpDropTarget->Release();
CoLockObjectExternal( lpDropTarget, false, true );
/* uninitialize the OLE library */
OleUninitialize();
/* we don't destroy the form immediatly */
Action = caHide;
}
//---------------------------------------------------------------------------
/*****************************************************************************
* Main callbacks
****************************************************************************/
void __fastcall TMainFrameDlg::OpenFileActionExecute( TObject *Sender )
{
if( OpenDialog1->Execute() )
{
/* 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],
PLAYLIST_APPEND
| ( p_intf->p_sys->b_play_when_adding ? PLAYLIST_GO : 0 ),
PLAYLIST_END );
};
}
//---------------------------------------------------------------------------
void __fastcall TMainFrameDlg::OpenDiscActionExecute( TObject *Sender )
{
TDiscDlg *p_disc = p_intf->p_sys->p_disc;
if( p_disc == NULL )
{
p_disc = new TDiscDlg( this, p_intf );
p_intf->p_sys->p_disc = p_disc;
}
p_disc->Show();
}
//---------------------------------------------------------------------------
void __fastcall TMainFrameDlg::NetworkStreamActionExecute( TObject *Sender )
{
TNetworkDlg *p_network = p_intf->p_sys->p_network;
if( p_network == NULL )
{
p_network = new TNetworkDlg( this, p_intf );
p_intf->p_sys->p_network = p_network;
}
p_network->Show();
}
//---------------------------------------------------------------------------
void __fastcall TMainFrameDlg::AddSubtitlesActionsExecute( TObject *Sender )
{
TSubtitlesDlg *p_subtitles = new TSubtitlesDlg( this, p_intf );
p_subtitles->ShowModal();
delete p_subtitles;
}
//---------------------------------------------------------------------------
void __fastcall TMainFrameDlg::StreamOutputActionExecute( TObject *Sender )
{
TSoutDlg *p_sout = new TSoutDlg( this, p_intf );
p_sout->ShowModal();
delete p_sout;
}
//---------------------------------------------------------------------------
void __fastcall TMainFrameDlg::ExitActionExecute( TObject *Sender )
{
Close();
}
//---------------------------------------------------------------------------
void __fastcall TMainFrameDlg::FullscreenActionExecute( TObject *Sender )
{
vout_thread_t *p_vout;
if( p_intf->p_sys->p_input == NULL )
{
return;
}
p_vout = (vout_thread_t *)vlc_object_find( p_intf->p_sys->p_input,
VLC_OBJECT_VOUT, FIND_CHILD );
if( p_vout == NULL )
{
return;
}
p_vout->i_changes |= VOUT_FULLSCREEN_CHANGE;
vlc_object_release( p_vout );
}
//---------------------------------------------------------------------------
void __fastcall TMainFrameDlg::OnTopActionExecute( TObject *Sender )
{
vlc_object_t *p_vout;
p_vout = (vlc_object_t *)vlc_object_find( p_intf, VLC_OBJECT_VOUT,
FIND_ANYWHERE );
if( p_vout != NULL )
{
vlc_value_t val;
if( var_Get( p_vout, "directx-on-top", &val ) >= 0 )
{
val.b_bool = ! val.b_bool;
var_Set( p_vout, "directx-on-top", val );
MenuOnTop->Checked = val.b_bool;
PopupOnTop->Checked = val.b_bool;
}
vlc_object_release( p_vout );
}
}
//---------------------------------------------------------------------------
void __fastcall TMainFrameDlg::PlaylistActionExecute( TObject *Sender )
{
TPlaylistDlg *p_playwin = p_intf->p_sys->p_playwin;
if( p_playwin->Visible )
{
p_playwin->Hide();
}
else
{
p_playwin->UpdateGrid();
p_playwin->Show();
}
}
//---------------------------------------------------------------------------
void __fastcall TMainFrameDlg::MessagesActionExecute( TObject *Sender )
{
p_intf->p_sys->p_messages->Show();
}
//---------------------------------------------------------------------------
void __fastcall TMainFrameDlg::PreferencesActionExecute( TObject *Sender )
{
CreatePreferences( "main" );
}
//---------------------------------------------------------------------------
void __fastcall TMainFrameDlg::AboutActionExecute( TObject *Sender )
{
TAboutDlg *AboutDlg = new TAboutDlg( this, p_intf );
AboutDlg->ShowModal();
delete AboutDlg;
}
//---------------------------------------------------------------------------
void __fastcall TMainFrameDlg::BackActionExecute( TObject *Sender )
{
/* TODO */
}
//---------------------------------------------------------------------------
void __fastcall TMainFrameDlg::PlayActionExecute( TObject *Sender )
{
p_intf->p_sys->p_playwin->Play();
}
//---------------------------------------------------------------------------
void __fastcall TMainFrameDlg::PauseActionExecute( TObject *Sender )
{
p_intf->p_sys->p_playwin->Pause();
}
//---------------------------------------------------------------------------
void __fastcall TMainFrameDlg::StopActionExecute( TObject *Sender )
{
p_intf->p_sys->p_playwin->Stop();
}
//---------------------------------------------------------------------------
void __fastcall TMainFrameDlg::SlowActionExecute( TObject *Sender )
{
p_intf->p_sys->p_playwin->Slow();
}
//---------------------------------------------------------------------------
void __fastcall TMainFrameDlg::FastActionExecute( TObject *Sender )
{
p_intf->p_sys->p_playwin->Fast();
}
//---------------------------------------------------------------------------
void __fastcall TMainFrameDlg::PreviousActionExecute(TObject *Sender)
{
p_intf->p_sys->p_playwin->Previous();
}
//---------------------------------------------------------------------------
void __fastcall TMainFrameDlg::NextActionExecute(TObject *Sender)
{
p_intf->p_sys->p_playwin->Next();
}
//---------------------------------------------------------------------------
void __fastcall TMainFrameDlg::EjectActionExecute( TObject *Sender )
{
AnsiString Device = "";
char * psz_current;
playlist_t * p_playlist;
p_playlist = (playlist_t *)vlc_object_find( p_intf,
VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
if( p_playlist == NULL )
{
return;
}
/*
* Get the active input
* 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
*/
vlc_mutex_lock( &p_playlist->object_lock );
psz_current = p_playlist->pp_items[ p_playlist->i_index ]->psz_name;
if( psz_current != NULL )
{
if( strncmp( psz_current, "dvd", 3 )
|| strncmp( psz_current, "vcd", 3 ) )
{
/* Determine the device name by omitting the first 4 characters
* and keeping 3 characters */
Device = strdup( ( psz_current + 4 ) );
Device = Device.SubString( 1, 2 );
}
}
vlc_mutex_unlock( &p_playlist->object_lock );
vlc_object_release( p_playlist );
if( Device == "" )
{
return;
}
/* If there's a stream playing, we aren't allowed to eject ! */
if( p_intf->p_sys->p_input == NULL )
{
msg_Dbg( p_intf, "ejecting %s", Device.c_str() );
intf_Eject( p_intf, Device.c_str() );
}
}
//--------------------------------------------------------------------------
void __fastcall TMainFrameDlg::VolumeUpActionExecute( TObject *Sender )
{
aout_VolumeUp( p_intf, 1, NULL );
}
//---------------------------------------------------------------------------
void __fastcall TMainFrameDlg::VolumeDownActionExecute( TObject *Sender )
{
aout_VolumeDown( p_intf, 1, NULL );
}
//---------------------------------------------------------------------------
void __fastcall TMainFrameDlg::MuteActionExecute( TObject *Sender )
{
aout_VolumeMute( p_intf, NULL );
// MenuMute->Checked = ! MenuMute->Checked;
}
//---------------------------------------------------------------------------
/*****************************************************************************
* External drop handling
*****************************************************************************/
void __fastcall TMainFrameDlg::OnDrop( TMessage &Msg )
{
/* find the number of files dropped */
int num_files = DragQueryFile( (HDROP)Msg.WParam, 0xFFFFFFFF,
(LPSTR)NULL, NULL );
/* append each file to the playlist */
for( int i = 0; i < num_files; i++ )
{
/* find the length of the filename */
int name_length = DragQueryFile( (HDROP)Msg.WParam, i, NULL, NULL ) + 1;
/* get the filename */
char *FileName = new char[name_length];
DragQueryFile( (HDROP)Msg.WParam, i, FileName, name_length );
/* add the new file to the playlist */
if( config_GetInt( p_intf, "enqueue" ) )
{
p_intf->p_sys->p_playwin->Add( FileName,
PLAYLIST_APPEND, PLAYLIST_END );
}
else
{
p_intf->p_sys->p_playwin->Add( FileName,
PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END );
}
delete[] FileName;
}
DragFinish( (HDROP)Msg.WParam );
Msg.Result = 0;
}
//--------------------------------------------------------------------------
/*****************************************************************************
* Menu and popup callbacks
*****************************************************************************/
void __fastcall TMainFrameDlg::MenuHideinterfaceClick( TObject *Sender )
{
this->SendToBack();
}
//---------------------------------------------------------------------------
void __fastcall TMainFrameDlg::PopupToggleInterfaceClick( TObject *Sender )
{
this->BringToFront();
}
//---------------------------------------------------------------------------
void __fastcall TMainFrameDlg::PopupCloseClick( TObject *Sender )
{
/* We do nothing, we just need a click on a menu item
* to close the popup. Don't ask me why... */
return;
}
//---------------------------------------------------------------------------
void __fastcall TMainFrameDlg::PopupJumpClick( TObject *Sender )
{
/* TODO */
}
//---------------------------------------------------------------------------
/*****************************************************************************
* Callbacks for DVD/VCD navigation
****************************************************************************/
void __fastcall TMainFrameDlg::PrevTitleActionExecute( TObject *Sender )
{
input_area_t * p_area;
int i_id;
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;
/* Disallow area 0 since it is used for video_ts.vob */
if( i_id > 0 )
{
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 );
input_ChangeArea( p_intf->p_sys->p_input, p_area );
input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_PLAY );
p_intf->p_sys->b_title_update = VLC_TRUE;
vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
p_intf->p_sys->p_menus->SetupMenus();
}
vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
}
//---------------------------------------------------------------------------
void __fastcall TMainFrameDlg::NextTitleActionExecute( TObject *Sender )
{
input_area_t * p_area;
unsigned int i_id;
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;
if( i_id < p_intf->p_sys->p_input->stream.i_area_nb )
{
p_area = p_intf->p_sys->p_input->stream.pp_areas[i_id];
vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
input_ChangeArea( p_intf->p_sys->p_input, p_area );
input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_PLAY );
p_intf->p_sys->b_title_update = VLC_TRUE;
vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
p_intf->p_sys->p_menus->SetupMenus();
}
vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
}
//---------------------------------------------------------------------------
void __fastcall TMainFrameDlg::PrevChapterActionExecute( TObject *Sender )
{
input_area_t * p_area;
vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
p_area = p_intf->p_sys->p_input->stream.p_selected_area;
if( p_area->i_part - 1 > 0 )
{
p_area->i_part--;
vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
input_ChangeArea( p_intf->p_sys->p_input, p_area );
input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_PLAY );
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();
}
vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
}
//---------------------------------------------------------------------------
void __fastcall TMainFrameDlg::NextChapterActionExecute( TObject *Sender )
{
input_area_t * p_area;
vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
p_area = p_intf->p_sys->p_input->stream.p_selected_area;
if( p_area->i_part + 1 < p_area->i_part_nb )
{
p_area->i_part++;
vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
input_ChangeArea( p_intf->p_sys->p_input, p_area );
input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_PLAY );
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();
}
vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
}
//---------------------------------------------------------------------------
/*****************************************************************************
* Callback for the 'go!' button
****************************************************************************/
void __fastcall TMainFrameDlg::ButtonGoClick( TObject *Sender )
{
msg_Err( p_intf, "Deprecated, doesn't do anything" );
}
//---------------------------------------------------------------------------
/*****************************************************************************
* ModeManage: actualise the aspect of the interface whenever the input
* changes.
*****************************************************************************
* The lock has to be taken before you call the function.
*****************************************************************************/
void __fastcall TMainFrameDlg::ModeManage()
{
TGroupBox * ActiveGB;
int i_Height;
bool b_control;
/* hide all boxes */
GroupBoxFile->Visible = false;
GroupBoxNetwork->Visible = false;
GroupBoxDisc->Visible = false;
/* hide slider */
GroupBoxSlider->Hide();
/* controls unavailable */
b_control = 0;
/* show the box related to current input mode */
if( p_intf->p_sys->p_input != NULL )
{
switch( p_intf->p_sys->p_input->stream.i_method & 0xf0 )
{
case INPUT_METHOD_FILE:
GroupBoxFile->Visible = true;
ActiveGB = GroupBoxFile;
LabelFileName->Caption = p_intf->p_sys->p_input->psz_source;
break;
case INPUT_METHOD_DISC:
GroupBoxDisc->Visible = true;
ActiveGB = GroupBoxDisc;
break;
case INPUT_METHOD_NETWORK:
GroupBoxNetwork->Visible = true;
ActiveGB = GroupBoxNetwork;
LabelServer->Caption = p_intf->p_sys->p_input->psz_source;
if( config_GetInt( p_intf, "network-channel" ) )
{
LabelChannel->Visible = true;
}
else
{
LabelChannel->Visible = false;
}
break;
default:
msg_Warn( p_intf, "cannot determine input method" );
GroupBoxFile->Visible = true;
ActiveGB = GroupBoxFile;
LabelFileName->Caption = p_intf->p_sys->p_input->psz_source;
break;
}
i_Height = StatusBar->Height + ActiveGB->Height + ToolBar->Height + 54;
/* initialize and show slider for seekable streams */
if( p_intf->p_sys->p_input->stream.b_seekable )
{
TrackBar->Position = p_intf->p_sys->OldValue = 0;
GroupBoxSlider->Show();
i_Height += GroupBoxSlider->Height;
}
/* control buttons for free pace streams */
b_control = p_intf->p_sys->p_input->stream.b_pace_control;
/* get ready for menu regeneration */
p_intf->p_sys->b_program_update = 1;
p_intf->p_sys->b_title_update = 1;
p_intf->p_sys->b_chapter_update = 1;
p_intf->p_sys->b_audio_update = 1;
p_intf->p_sys->b_spu_update = 1;
p_intf->p_sys->i_part = 0;
p_intf->p_sys->p_input->stream.b_changed = 0;
msg_Dbg( p_intf, "stream has changed, refreshing interface" );
}
else
{
i_Height = StatusBar->Height + ToolBar->Height + 47;
if( config_GetInt( p_intf, "network-channel" ) )
{
GroupBoxNetwork->Visible = true;
LabelChannel->Visible = true;
i_Height += GroupBoxNetwork->Height + 7;
}
else
{
/* add space between tolbar and statusbar when
* nothing is displayed; isn't it nicer ? :) */
i_Height += 17;
}
/* unsensitize menus */
MenuProgram->Enabled = false;
MenuTitle->Enabled = false;
MenuChapter->Enabled = false;
MenuLanguage->Enabled = false;
MenuSubtitles->Enabled = false;
PopupNavigation->Enabled = false;
PopupLanguage->Enabled = false;
PopupSubtitles->Enabled = false;
}
/* resize main window */
this->Height = i_Height;
/* set control items */
EjectAction->Enabled = !b_control;
StopAction->Enabled = true;
PauseAction->Enabled = b_control;
SlowAction->Enabled = b_control;
FastAction->Enabled = b_control;
PopupBack->Enabled = false;
}
//---------------------------------------------------------------------------
/*****************************************************************************
* CreateConfig: create a configuration dialog and save it for further use
*****************************************************************************
* 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.
*****************************************************************************/
void __fastcall TMainFrameDlg::CreatePreferences( AnsiString Name )
{
TPreferencesDlg *Preferences;
int i_index, i_pos;
i_index = StringListPref->IndexOf( Name );
if( i_index != -1 )
{
/* config dialog already exists */
Preferences = (TPreferencesDlg *)StringListPref->Objects[i_index];
}
else
{
/* create the config dialog */
Preferences = new TPreferencesDlg( this, p_intf );
Preferences->CreateConfigDialog( Name.c_str() );
/* save it */
i_pos = StringListPref->Add( Name );
StringListPref->Objects[i_pos] = Preferences;
}
/* display the dialog */
Preferences->Show();
}
//---------------------------------------------------------------------------
This source diff could not be displayed because it is too large. You can view the blob instead.
/*****************************************************************************
* mainframe.h: Prototype for main window
*****************************************************************************
* Copyright (C) 2002 VideoLAN
*
* Authors: Olivier Teuliere <ipkiss@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef mainframeH
#define mainframeH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <ComCtrls.hpp>
#include <Dialogs.hpp>
#include <ImgList.hpp>
#include <Menus.hpp>
#include <ToolWin.hpp>
#include <AppEvnts.hpp>
#include <ExtCtrls.hpp>
#include "CSPIN.h"
#include <ActnList.hpp>
#include <oleidl.h> /* for drag and drop */
/*****************************************************************************
* This message is sent to the controls registered as drop targets
*****************************************************************************/
#define WM_OLEDROP WM_USER + 1
//---------------------------------------------------------------------------
class TMainFrameDlg : public TForm
{
__published: // IDE-managed Components
TToolBar *ToolBar;
TToolButton *ToolButtonFile;
TToolButton *ToolButtonDisc;
TToolButton *ToolButtonNet;
TToolButton *ToolButtonSep1;
TToolButton *ToolButtonStop;
TToolButton *ToolButtonPlay;
TToolButton *ToolButtonPause;
TToolButton *ToolButtonSep2;
TToolButton *ToolButtonSlow;
TToolButton *ToolButtonFast;
TToolButton *ToolButtonSep3;
TToolButton *ToolButtonPlaylist;
TToolButton *ToolButtonPrev;
TToolButton *ToolButtonNext;
TMainMenu *MainMenu1;
TMenuItem *MenuFile;
TMenuItem *MenuOpenFile;
TMenuItem *MenuOpenDisc;
TMenuItem *MenuNetworkStream;
TMenuItem *MenuExit;
TMenuItem *MenuView;
TMenuItem *MenuHideinterface;
TMenuItem *MenuTitle;
TMenuItem *MenuChapter;
TMenuItem *MenuAngle;
TMenuItem *N3;
TMenuItem *MenuPlaylist;
TMenuItem *MenuMessages;
TMenuItem *MenuControls;
TMenuItem *MenuLanguage;
TMenuItem *MenuSubtitles;
TMenuItem *MenuPreferences;
TMenuItem *MenuHelp;
TMenuItem *MenuAbout;
TOpenDialog *OpenDialog1;
TImageList *ImageListToolbar;
TPopupMenu *PopupMenuMain;
TMenuItem *PopupPlay;
TMenuItem *PopupPause;
TMenuItem *PopupStop;
TMenuItem *PopupBack;
TMenuItem *PopupSlow;
TMenuItem *PopupFast;
TMenuItem *PopupToggleInterface;
TMenuItem *PopupNext;
TMenuItem *PopupPrev;
TMenuItem *PopupJump;
TMenuItem *PopupNavigation;
TMenuItem *PopupProgram;
TMenuItem *PopupLanguage;
TMenuItem *PopupSubtitles;
TMenuItem *PopupFile;
TMenuItem *PopupPlaylist;
TMenuItem *PopupPreferences;
TMenuItem *N7;
TMenuItem *PopupExit;
TStatusBar *StatusBar;
TGroupBox *GroupBoxFile;
TLabel *LabelFileName;
TGroupBox *GroupBoxNetwork;
TLabel *LabelChannel;
TLabel *LabelServer;
TGroupBox *GroupBoxDisc;
TMenuItem *N8;
TMenuItem *MenuProgram;
TLabel *LabelDisc;
TLabel *LabelTitle;
TButton *ButtonTitlePrev;
TButton *ButtonTitleNext;
TButton *ButtonChapterPrev;
TButton *ButtonChapterNext;
TLabel *LabelChapter;
TLabel *LabelTitleCurrent;
TLabel *LabelChapterCurrent;
TButton *ButtonGo;
TGroupBox *GroupBoxSlider;
TTrackBar *TrackBar;
TTimer *TimerManage;
TMenuItem *PopupOpenFile;
TMenuItem *PopupOpenDisc;
TMenuItem *PopupNetworkStream;
TMenuItem *PopupClose;
TMenuItem *N9;
TCSpinEdit *SpinEditChannel;
TActionList *ActionList1;
TAction *OpenFileAction;
TAction *OpenDiscAction;
TAction *NetworkStreamAction;
TAction *PlayAction;
TAction *PauseAction;
TAction *StopAction;
TAction *EjectAction;
TAction *SlowAction;
TAction *FastAction;
TAction *PreviousAction;
TAction *NextAction;
TAction *BackAction;
TAction *PlaylistAction;
TAction *ExitAction;
TAction *FullscreenAction;
TAction *PreferencesAction;
TAction *MessagesAction;
TAction *AboutAction;
TAction *PrevTitleAction;
TAction *NextTitleAction;
TAction *PrevChapterAction;
TAction *NextChapterAction;
TAction *VolumeUpAction;
TAction *VolumeDownAction;
TAction *MuteAction;
TAction *StreamOutputAction;
TAction *AddSubtitlesAction;
TMenuItem *Control1;
TMenuItem *N5;
TMenuItem *N10;
TMenuItem *N11;
TMenuItem *MenuChannel;
TMenuItem *PopupChannel;
TMenuItem *MenuVolumeUp;
TMenuItem *MenuVolumeDown;
TMenuItem *MenuMute;
TMenuItem *MenuADevice;
TMenuItem *PopupAudioSettings;
TMenuItem *PopupADevice;
TMenuItem *VolumeDown1;
TMenuItem *VolumeUp1;
TMenuItem *Mute1;
TMenuItem *MenuVDevice;
TMenuItem *N1;
TMenuItem *PopupVDevice;
TMenuItem *MenuStreamOuput;
TMenuItem *MenuAddSubtitles;
TMenuItem *N4;
TMenuItem *MenuAddInterface;
TAction *OnTopAction;
TMenuItem *MenuFullscreen;
TMenuItem *MenuOnTop;
TMenuItem *PopupFullscreen;
TMenuItem *Videosettings1;
TMenuItem *PopupOnTop;
TMenuItem *N2;
TMenuItem *MenuEjectDisc;
void __fastcall TimerManageTimer( TObject *Sender );
void __fastcall TrackBarChange( TObject *Sender );
void __fastcall FormClose( TObject *Sender, TCloseAction &Action );
void __fastcall MenuHideinterfaceClick( TObject *Sender );
void __fastcall PopupCloseClick( TObject *Sender );
void __fastcall PopupToggleInterfaceClick( TObject *Sender );
void __fastcall PopupJumpClick( TObject *Sender );
void __fastcall ButtonGoClick( TObject *Sender );
void __fastcall OpenFileActionExecute( TObject *Sender );
void __fastcall OpenDiscActionExecute( TObject *Sender );
void __fastcall NetworkStreamActionExecute( TObject *Sender );
void __fastcall StreamOutputActionExecute( TObject *Sender );
void __fastcall ExitActionExecute( TObject *Sender );
void __fastcall PlaylistActionExecute( TObject *Sender );
void __fastcall MessagesActionExecute( TObject *Sender );
void __fastcall AboutActionExecute( TObject *Sender );
void __fastcall BackActionExecute( TObject *Sender );
void __fastcall PlayActionExecute( TObject *Sender );
void __fastcall PauseActionExecute( TObject *Sender );
void __fastcall StopActionExecute( TObject *Sender );
void __fastcall SlowActionExecute( TObject *Sender );
void __fastcall FastActionExecute( TObject *Sender );
void __fastcall PreviousActionExecute( TObject *Sender );
void __fastcall NextActionExecute( TObject *Sender );
void __fastcall EjectActionExecute( TObject *Sender );
void __fastcall VolumeUpActionExecute( TObject *Sender );
void __fastcall VolumeDownActionExecute( TObject *Sender );
void __fastcall MuteActionExecute( TObject *Sender );
void __fastcall FullscreenActionExecute( TObject *Sender );
void __fastcall PreferencesActionExecute( TObject *Sender );
void __fastcall PrevTitleActionExecute( TObject *Sender );
void __fastcall NextTitleActionExecute( TObject *Sender );
void __fastcall PrevChapterActionExecute( TObject *Sender );
void __fastcall NextChapterActionExecute( TObject *Sender );
void __fastcall AddSubtitlesActionsExecute( TObject *Sender );
void __fastcall OnTopActionExecute( TObject *Sender );
private: // User declarations
intf_thread_t *p_intf;
/* drag and drop handling */
LPDROPTARGET lpDropTarget;
BEGIN_MESSAGE_MAP
MESSAGE_HANDLER( WM_OLEDROP, TMessage, OnDrop )
END_MESSAGE_MAP( TForm )
public: // User declarations
TStringList *StringListPref; /* stores config dialogs */
__fastcall TMainFrameDlg( TComponent* Owner, intf_thread_t *_p_intf );
virtual __fastcall ~TMainFrameDlg();
void __fastcall DisplayHint( TObject *Sender );
void __fastcall ModeManage();
void __fastcall CreatePreferences( AnsiString Name );
void __fastcall MenuProgramClick( TObject *Sender );
void __fastcall MenuAudioClick( TObject *Sender );
void __fastcall MenuSubtitleClick( TObject *Sender );
void __fastcall MenuTitleClick( TObject *Sender );
void __fastcall MenuChapterClick( TObject *Sender );
void __fastcall PopupProgramClick( TObject *Sender );
void __fastcall PopupAudioClick( TObject *Sender );
void __fastcall PopupSubtitleClick( TObject *Sender );
void __fastcall PopupNavigationClick( TObject *Sender );
void __fastcall OnDrop( TMessage &Msg );
};
//---------------------------------------------------------------------------
#endif
/*****************************************************************************
* menu.cpp: functions to handle menu items
*****************************************************************************
* Copyright (C) 2002-2003 VideoLAN
* $Id: menu.cpp,v 1.16 2003/05/05 22:23:39 gbazin Exp $
*
* Authors: Olivier Teuliere <ipkiss@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include <vcl.h>
#include <vlc/vlc.h>
#include <vlc/intf.h>
#include "menu.h"
#include "win32_common.h"
/*****************************************************************************
* TMenusGen::*Click: callbacks for the menuitems
****************************************************************************/
/*
* Variables
*/
/* variables of the audio output */
void __fastcall TMenusGen::AoutVarClick( TObject *Sender )
{
TMenuItem * Item = (TMenuItem *)Sender;
vlc_object_t * p_aout;
p_aout = (vlc_object_t *)vlc_object_find( p_intf, VLC_OBJECT_AOUT,
FIND_ANYWHERE );
if( p_aout == NULL )
{
msg_Warn( p_intf, "cannot set variable (%s)", Item->Caption.c_str() );
return;
}
#error fixme! look at rc.c line 823
if( Item->Parent == MenuADevice || Item->Parent == PopupADevice )
{
VarChange( p_aout, "audio-device", MenuADevice, PopupADevice, Item );
}
else if( Item->Parent == MenuChannel || Item->Parent == PopupChannel )
{
VarChange( p_aout, "audio-channels", MenuChannel, PopupChannel, Item );
}
vlc_object_release( p_aout );
}
/* variables of the video output */
void __fastcall TMenusGen::VoutVarClick( TObject *Sender )
{
TMenuItem * Item = (TMenuItem *)Sender;
vlc_object_t * p_vout;
p_vout = (vlc_object_t *)vlc_object_find( p_intf, VLC_OBJECT_VOUT,
FIND_ANYWHERE );
if( p_vout == NULL )
{
msg_Warn( p_intf, "cannot set variable (%s)", Item->Caption.c_str() );
return;
}
if( Item->Parent == MenuVDevice || Item->Parent == PopupVDevice )
{
VarChange( p_vout, "video-device", MenuVDevice, PopupVDevice, Item );
}
vlc_object_release( p_vout );
}
/*
* Modules
*/
/* Interface modules: we spawn a new interface */
void __fastcall TMenusGen::InterfaceModuleClick( TObject *Sender )
{
TMenuItem * Item = (TMenuItem *)Sender;
AnsiString IntfName = CleanCaption( Item->Caption );
intf_thread_t *p_newintf;
p_newintf = intf_Create( p_intf->p_vlc, IntfName.c_str() );
if( p_newintf )
{
p_newintf->b_block = VLC_FALSE;
if( intf_RunThread( p_newintf ) )
{
vlc_object_detach( p_newintf );
intf_Destroy( p_newintf );
}
}
}
/*
* Audio
*/
void __fastcall TMenusGen::MenuLanguageClick( TObject *Sender )
{
LangChange( MenuLanguage, (TMenuItem *)Sender, PopupLanguage, AUDIO_ES );
}
void __fastcall TMenusGen::PopupLanguageClick( TObject *Sender )
{
LangChange( PopupLanguage, (TMenuItem *)Sender, MenuLanguage, AUDIO_ES );
}
/*
* Subtitles
*/
void __fastcall TMenusGen::MenuSubtitleClick( TObject *Sender )
{
LangChange( MenuSubtitles, (TMenuItem *)Sender, PopupSubtitles, SPU_ES );
}
void __fastcall TMenusGen::PopupSubtitleClick( TObject *Sender )
{
LangChange( PopupSubtitles, (TMenuItem *)Sender, MenuSubtitles, SPU_ES );
}
/*
* Program
*/
void __fastcall TMenusGen::MenuProgramClick( TObject *Sender )
{
ProgramChange( (TMenuItem *)Sender, PopupProgram );
}
void __fastcall TMenusGen::PopupProgramClick( TObject *Sender )
{
ProgramChange( (TMenuItem *)Sender, MenuProgram );
}
/*
* Title
*/
void __fastcall TMenusGen::MenuTitleClick( TObject *Sender )
{
TMenuItem * Item = (TMenuItem *)Sender;
TMenuItem * ItemTitle;
input_area_t * p_area;
unsigned int i_title = Item->Tag;
vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
i_title = __MIN( i_title,
p_intf->p_sys->p_input->stream.i_area_nb - 1 );
i_title = __MAX( i_title, 1 );
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 );
input_ChangeArea( p_intf->p_sys->p_input, p_area );
Item->Checked = true;
ItemTitle = Index2Item( PopupNavigation, i_title - 1, false );
Index2Item( ItemTitle, 0, false )->Checked = true;
input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_PLAY );
}
/*
* Chapter
*/
void __fastcall TMenusGen::MenuChapterClick( TObject *Sender )
{
TMenuItem * Item = (TMenuItem *)Sender;
TMenuItem * ItemTitle;
input_area_t * p_area;
unsigned int i_title;
unsigned int i_chapter = Item->Tag;
vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
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 = __MAX( i_chapter, 1 );
p_area->i_part = i_chapter;
vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
input_ChangeArea( p_intf->p_sys->p_input, p_area );
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;
vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
ItemTitle = Index2Item( PopupNavigation, i_title, false );
Index2Item( ItemTitle, i_chapter, false )->Checked = true;
input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_PLAY );
}
/*
* Navigation
*/
void __fastcall TMenusGen::PopupNavigationClick( TObject *Sender )
{
TMenuItem * Item = (TMenuItem *)Sender;
TMenuItem * ItemTitle;
input_area_t * p_area;
unsigned int i_title = Data2Title( Item->Tag );
unsigned int i_chapter = Data2Chapter( Item->Tag );
vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
i_title = __MIN( i_title,
p_intf->p_sys->p_input->stream.i_area_nb - 1 );
i_title = __MAX( i_title, 1 );
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 = __MAX( i_chapter, 1 );
p_area->i_part = i_chapter;
vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
input_ChangeArea( p_intf->p_sys->p_input, p_area );
Item->Checked = true;
ItemTitle = Index2Item( MenuTitle, i_title, false );
if( ItemTitle->Checked )
{
/* same title, new chapter */
Index2Item( MenuChapter, i_chapter, false )->Checked = true;
}
else
{
/* new title => we must rebuild the chapter menu */
vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
RadioMenu(
MenuChapter, "Chapter",
p_intf->p_sys->p_input->stream.p_selected_area->i_part_nb,
i_chapter, MenuChapterClick );
vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
}
input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_PLAY );
}
__fastcall TMenusGen::TMenusGen( intf_thread_t *_p_intf ) : TObject()
{
p_intf = _p_intf;
/* Initialize local pointers to menu items of the main window */
TMainFrameDlg * p_window = p_intf->p_sys->p_window;
if( p_window == NULL )
{
msg_Warn( p_intf, "Main window wasn't created, expect problems..." );
return;
}
MenuChannel = p_window->MenuChannel;
PopupChannel = p_window->PopupChannel;
MenuADevice = p_window->MenuADevice;
PopupADevice = p_window->PopupADevice;
MenuVDevice = p_window->MenuVDevice;
PopupVDevice = p_window->PopupVDevice;
MenuLanguage = p_window->MenuLanguage;
PopupLanguage = p_window->PopupLanguage;
MenuSubtitles = p_window->MenuSubtitles;
PopupSubtitles = p_window->PopupSubtitles;
MenuProgram = p_window->MenuProgram;
PopupProgram = p_window->PopupProgram;
MenuTitle = p_window->MenuTitle;
MenuChapter = p_window->MenuChapter;
PopupNavigation = p_window->PopupNavigation;
MenuAddInterface = p_window->MenuAddInterface;
/* Create the "Add interface" menu */
SetupModuleMenu( "interface", MenuAddInterface, InterfaceModuleClick );
}
/*****************************************************************************
* SetupMenus: This function dynamically generates some menus
*****************************************************************************
* The lock on p_input->stream must be taken before you call this function
*****************************************************************************/
void __fastcall TMenusGen::SetupMenus()
{
TMainFrameDlg * p_window = p_intf->p_sys->p_window;
input_thread_t * p_input = p_intf->p_sys->p_input;
es_descriptor_t * p_audio_es;
es_descriptor_t * p_spu_es;
p_intf->p_sys->b_chapter_update |= p_intf->p_sys->b_title_update;
p_intf->p_sys->b_audio_update |= p_intf->p_sys->b_program_update |
p_intf->p_sys->b_title_update;
p_intf->p_sys->b_spu_update |= p_intf->p_sys->b_program_update |
p_intf->p_sys->b_title_update;
if( p_intf->p_sys->b_program_update )
{
pgrm_descriptor_t * p_pgrm;
if( p_input->stream.p_new_program )
{
p_pgrm = p_input->stream.p_new_program;
}
else
{
p_pgrm = p_input->stream.p_selected_program;
}
ProgramMenu( MenuProgram, p_pgrm, MenuProgramClick );
ProgramMenu( PopupProgram, p_pgrm, PopupProgramClick );
p_intf->p_sys->b_program_update = VLC_FALSE;
}
if( p_intf->p_sys->b_title_update )
{
// why "-1" ?
// because if the titles go from 1 to X-1, there are X-1 titles
RadioMenu( MenuTitle, "Title",
p_input->stream.i_area_nb - 1,
p_input->stream.p_selected_area->i_id,
MenuTitleClick );
AnsiString CurrentTitle;
CurrentTitle.sprintf( "%d", p_input->stream.p_selected_area->i_id );
p_window->LabelTitleCurrent->Caption = CurrentTitle;
p_intf->p_sys->b_title_update = VLC_FALSE;
}
if( p_intf->p_sys->b_chapter_update )
{
RadioMenu( MenuChapter, "Chapter",
p_input->stream.p_selected_area->i_part_nb - 1,
p_input->stream.p_selected_area->i_part,
MenuChapterClick );
NavigationMenu( PopupNavigation, PopupNavigationClick );
AnsiString CurrentChapter;
CurrentChapter.sprintf( "%d", p_input->stream.p_selected_area->i_part );
p_window->LabelChapterCurrent->Caption = CurrentChapter;
p_intf->p_sys->i_part = p_input->stream.p_selected_area->i_part;
p_intf->p_sys->b_chapter_update = VLC_FALSE;
}
/* look for selected ES */
p_audio_es = NULL;
p_spu_es = NULL;
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 )
{
p_audio_es = p_input->stream.pp_selected_es[i];
}
if( p_input->stream.pp_selected_es[i]->i_cat == SPU_ES )
{
p_spu_es = p_input->stream.pp_selected_es[i];
}
}
this->p_audio_es_old = p_audio_es;
this->p_spu_es_old = p_spu_es;
vlc_mutex_unlock( &p_input->stream.stream_lock );
/* audio menus */
if( p_intf->p_sys->b_audio_update )
{
LanguageMenu( MenuLanguage, p_audio_es, AUDIO_ES, MenuLanguageClick );
LanguageMenu( PopupLanguage, p_audio_es, AUDIO_ES, PopupLanguageClick );
p_intf->p_sys->b_audio_update = VLC_FALSE;
}
/* sub picture menus */
if( p_intf->p_sys->b_spu_update )
{
LanguageMenu( PopupSubtitles, p_spu_es, SPU_ES, PopupSubtitleClick );
LanguageMenu( MenuSubtitles, p_spu_es, SPU_ES, MenuSubtitleClick );
p_intf->p_sys->b_spu_update = VLC_FALSE;
}
if( p_intf->p_sys->b_aout_update )
{
aout_instance_t * p_aout;
p_aout = (aout_instance_t *)vlc_object_find( p_intf, VLC_OBJECT_AOUT,
FIND_ANYWHERE );
if( p_aout != NULL )
{
vlc_value_t val;
val.b_bool = VLC_FALSE;
var_Set( (vlc_object_t *)p_aout, "intf-change", val );
#error fixme! look at rc.c line 823
SetupVarMenu( (vlc_object_t *)p_aout, "audio-channels",
MenuChannel, AoutVarClick );
SetupVarMenu( (vlc_object_t *)p_aout, "audio-channels",
PopupChannel, AoutVarClick );
SetupVarMenu( (vlc_object_t *)p_aout, "audio-device",
MenuADevice, AoutVarClick );
SetupVarMenu( (vlc_object_t *)p_aout, "audio-device",
PopupADevice, AoutVarClick );
vlc_object_release( (vlc_object_t *)p_aout );
}
p_intf->p_sys->b_aout_update = VLC_FALSE;
}
if( p_intf->p_sys->b_vout_update )
{
vout_thread_t * p_vout;
p_vout = (vout_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_VOUT,
FIND_ANYWHERE );
if( p_vout != NULL )
{
vlc_value_t val;
val.b_bool = VLC_FALSE;
var_Set( (vlc_object_t *)p_vout, "intf-change", val );
SetupVarMenu( (vlc_object_t *)p_vout, "video-device",
MenuVDevice, VoutVarClick );
SetupVarMenu( (vlc_object_t *)p_vout, "video-device",
PopupVDevice, VoutVarClick );
vlc_object_release( (vlc_object_t *)p_vout );
}
p_intf->p_sys->b_vout_update = VLC_FALSE;
}
vlc_mutex_lock( &p_input->stream.stream_lock );
}
/*****************************************************************************
* Private functions
*****************************************************************************/
TMenuItem * TMenusGen::Index2Item( TMenuItem *Root, int i_index,
bool SingleColumn )
{
if( SingleColumn || ( i_index < 20 ) )
return Root->Items[i_index];
else
return Root->Items[i_index / 10]->Items[i_index % 10];
}
int TMenusGen::Item2Index( TMenuItem *Root, TMenuItem *Item )
{
if( Item->Parent == Root )
return Item->MenuIndex;
else
return( 10 * Item->Parent->MenuIndex + Item->MenuIndex );
}
int __fastcall TMenusGen::Data2Title( int data )
{
return (int) (data >> 16 );
}
int __fastcall TMenusGen::Data2Chapter( int data )
{
return (int) (data & 0xffff);
}
int __fastcall TMenusGen::Pos2Data( int title, int chapter )
{
return (int) (( title << 16 ) | ( chapter & 0xffff ));
}
/* This function deletes all the '&' characters in the caption string,
* because Borland automatically adds one when (and only when!) you click on
* the menuitem. Grrrrr... */
AnsiString __fastcall TMenusGen::CleanCaption( AnsiString Caption )
{
while( Caption.LastDelimiter( "&" ) != 0 )
{
Caption.Delete( Caption.LastDelimiter( "&" ), 1 );
}
return Caption;
}
/****************************************************************************
* VarChange: change a variable in a vlc_object_t
****************************************************************************
* Change the variable and update the menuitems.
****************************************************************************/
void __fastcall TMenusGen::VarChange( vlc_object_t *p_object,
const char *psz_variable, TMenuItem *RootMenu, TMenuItem *RootPopup,
TMenuItem *Item )
{
vlc_value_t val;
int i_index;
AnsiString Caption = CleanCaption( Item->Caption );
val.psz_string = Caption.c_str();
/* set the new value */
if( var_Set( p_object, psz_variable, val ) < 0 )
{
msg_Warn( p_object, "cannot set variable (%s)", val.psz_string );
}
i_index = Item->MenuIndex;
RootMenu->Items[i_index]->Checked = true;
RootPopup->Items[i_index]->Checked = true;
}
/****************************************************************************
* LangChange: change audio or subtitles languages
****************************************************************************
* Toggle the language, and update the selected menuitems.
****************************************************************************/
void __fastcall TMenusGen::LangChange( TMenuItem *RootCurrent, TMenuItem *Item,
TMenuItem *RootOther, int i_cat )
{
es_descriptor_t * p_es;
es_descriptor_t * p_es_old;
int i_index;
int i_es;
/* find the selected ES */
i_es = Item->Tag;
/* find selected menu item */
i_index = Item2Index( RootCurrent, Item ) - 1;
if( i_index < 0 )
{
/* 'None' was selected */
p_es = NULL;
}
else
{
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];
vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
}
/* find the current ES */
if( i_cat == AUDIO_ES )
{
p_es_old = this->p_audio_es_old;
this->p_audio_es_old = p_es;
}
else
{
p_es_old = this->p_spu_es_old;
this->p_spu_es_old = p_es;
}
/* exchange them */
input_ToggleES( p_intf->p_sys->p_input, p_es_old, false );
input_ToggleES( p_intf->p_sys->p_input, p_es, true );
Item->Checked = true;
Index2Item( RootOther, i_index + 1, true )->Checked = true;
}
/****************************************************************************
* ProgramChange: change the program
****************************************************************************
* Toggle the program, and update the selected menuitems.
****************************************************************************/
void __fastcall TMenusGen::ProgramChange( TMenuItem *Item,
TMenuItem *RootOther )
{
int i_program = Item->Tag;
/* toggle the program */
input_ChangeProgram( p_intf->p_sys->p_input, (uint16_t)i_program );
/* check selected menu items */
Item->Checked = true;
Index2Item( RootOther, i_program - 1, true )->Checked = true;
/* update audio/subtitles menus */
p_intf->p_sys->b_audio_update = VLC_TRUE;
p_intf->p_sys->b_spu_update = VLC_TRUE;
vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
SetupMenus();
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_spu_update = VLC_FALSE;
input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_PLAY );
}
/*****************************************************************************
* SetupVarMenu: build a menu allowing to change a variable
*****************************************************************************/
void __fastcall TMenusGen::SetupVarMenu( vlc_object_t *p_object,
const char *psz_variable, TMenuItem *Root, TNotifyEvent MenuItemClick )
{
TMenuItem * Item;
vlc_value_t val;
char * psz_value = NULL;
int i;
/* remove previous menu */
Root->Clear();
/* get the current value */
if( var_Get( p_object, psz_variable, &val ) < 0 )
{
return;
}
psz_value = val.psz_string;
if( var_Change( p_object, psz_variable, VLC_VAR_GETLIST, &val, NULL ) < 0 )
{
free( psz_value );
return;
}
/* append a menuitem for each option */
for( i = 0; i < val.p_list->i_count; i++ )
{
Item = new TMenuItem( Root );
Item->Caption = val.p_list->p_values[i].psz_string;
Item->Hint = val.p_list->p_values[i].psz_string;
Item->RadioItem = true;
Item->OnClick = MenuItemClick;
if( !strcmp( psz_value, val.p_list->p_values[i].psz_string ) )
Item->Checked = true;
/* Add the item to the submenu */
Root->Add( Item );
}
/* enable the menu if there is at least 1 item */
Root->Enabled = ( val.p_list->i_count > 0 );
/* clean up everything */
var_Change( p_object, psz_variable, VLC_VAR_FREELIST, &val, NULL );
// free( psz_value );
}
/*****************************************************************************
* SetupModuleMenu: build a menu listing all the modules of a given
capability
*****************************************************************************/
void __fastcall TMenusGen::SetupModuleMenu( const char *psz_capability,
TMenuItem *Root, TNotifyEvent MenuItemClick )
{
module_t * p_parser;
vlc_list_t *p_list;
int i_index;
/* remove previous menu */
Root->Clear();
Root->Enabled = false;
p_list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
for( i_index = 0; i_index < p_list->i_count; i_index++ )
{
p_parser = (module_t *)p_list->p_values[i_index].p_object ;
if( !strcmp( p_parser->psz_capability, psz_capability ) )
{
TMenuItem *Item = new TMenuItem( Root );
Item->Caption = p_parser->psz_object_name;
Item->Hint = Item->Caption;
Item->OnClick = MenuItemClick;
Root->Add( Item );
}
}
vlc_list_release( p_list );
/* be sure that menu is enabled, if there is at least one item */
if( i_index > 0 )
Root->Enabled = true;
}
/*****************************************************************************
* ProgramMenu: update the programs menu of the interface
*****************************************************************************
* Builds the program menu according to what have been found in the PAT
* by the input. Useful for multi-programs streams such as DVB ones.
*****************************************************************************/
void __fastcall TMenusGen::ProgramMenu( TMenuItem *Root,
pgrm_descriptor_t *p_pgrm, TNotifyEvent MenuItemClick )
{
TMenuItem * Item;
/* remove previous menu */
Root->Clear();
Root->Enabled = false;
/* 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;
i++ )
{
AnsiString Name;
Name.sprintf( "id %d",
p_intf->p_sys->p_input->stream.pp_programs[i]->i_number );
Item = new TMenuItem( Root );
Item->Caption = Name;
Item->Hint = Name;
Item->RadioItem = true;
Item->OnClick = MenuItemClick;
/* FIXME: temporary hack to save the program id with the Item
* It will be used in the callback. */
Item->Tag = i + 1;
/* check the currently selected program */
if( p_pgrm == p_intf->p_sys->p_input->stream.pp_programs[i] )
Item->Checked = true;
/* add the item to the submenu */
Root->Add( Item );
}
/* be sure that menu is enabled if more than 1 program */
if( p_intf->p_sys->p_input->stream.i_pgrm_number > 1 )
Root->Enabled = true;
}
/*****************************************************************************
* RadioMenu: update interactive menus of the interface
*****************************************************************************
* Sets up menus with information from input
* Warning: since this function is designed to be called by management
* function, the interface lock has to be taken
*****************************************************************************/
void __fastcall TMenusGen::RadioMenu( TMenuItem *Root, AnsiString ItemName,
int i_nb, int i_selected, TNotifyEvent MenuItemClick )
{
TMenuItem * ItemGroup;
TMenuItem * Item;
AnsiString Name;
/* remove previous menu */
Root->Enabled = false;
Root->Clear();
for( int i_item = 1; i_item <= i_nb; i_item++ )
{
/* we group titles/chapters in packets of ten for small screens */
if( ( i_item % 10 == 1 ) && ( i_nb > 20 ) )
{
if( i_item != 1 )
Root->Add( ItemGroup );
Name.sprintf( "%ss %d to %d", ItemName, i_item, i_item + 9 );
ItemGroup = new TMenuItem( Root );
ItemGroup->Hint = Name;
ItemGroup->RadioItem = true;
/* set the accelerator character */
Name.Insert( "&", Name.Length() - 1 );
ItemGroup->Caption = Name;
}
Name.sprintf( "%s %d", ItemName, i_item );
Item = new TMenuItem( Root );
Item->RadioItem = true;
Item->Hint = Name;
/* set the accelerator character */
Name.Insert( "&", Name.Length() );
Item->Caption = Name;
/* FIXME: temporary hack to save i_item with the Item
* It will be used in the callback. */
Item->Tag = i_item;
/* check the currently selected chapter */
if( i_selected == i_item )
Item->Checked = true;
/* setup signal handling */
Item->OnClick = MenuItemClick;
if( i_nb > 20 )
ItemGroup->Add( Item );
else
Root->Add( Item );
}
// if( ( i_nb > 20 ) && ( i_item % 10 ) ) ?
if( i_nb > 20 )
Root->Add( ItemGroup );
/* be sure that menu is enabled, if there are several items */
if( i_nb > 1 )
Root->Enabled = true;
}
/*****************************************************************************
* LanguageMenus: update interactive menus of the interface
*****************************************************************************
* Sets up menus with information from input:
* - languages
* - sub-pictures
* Warning: since this function is designed to be called by management
* function, the interface lock has to be taken
*****************************************************************************/
void __fastcall TMenusGen::LanguageMenu( TMenuItem *Root, es_descriptor_t *p_es,
int i_cat, TNotifyEvent MenuItemClick )
{
TMenuItem * Separator;
TMenuItem * Item;
AnsiString Name;
/* remove previous menu */
Root->Clear();
Root->Enabled = false;
/* special case for "off" item */
Name = "None";
Item = new TMenuItem( Root );
Item->RadioItem = true;
Item->Hint = Name;
Item->Caption = Name;
Item->OnClick = MenuItemClick;
Item->Tag = -1;
Root->Add( Item );
/* separator item */
Separator = new TMenuItem( Root );
Separator->Caption = "-";
Root->Add( Separator );
int i_item = 0;
vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
#define ES p_intf->p_sys->p_input->stream.pp_es[i]
/* 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;
i++ )
{
if( ( ES->i_cat == i_cat ) &&
( !ES->p_pgrm ||
ES->p_pgrm ==
p_intf->p_sys->p_input->stream.p_selected_program ) )
{
i_item++;
if( 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() )
Name.sprintf( "Language %d", i_item );
Item = new TMenuItem( Root );
Item->RadioItem = true;
Item->Hint = Name;
Item->Caption = Name;
Item->Tag = i;
/* check the currently selected item */
if( p_es == p_intf->p_sys->p_input->stream.pp_es[i] )
Item->Checked = true;
/* setup signal hanling */
Item->OnClick = MenuItemClick;
Root->Add( Item );
}
}
#undef ES
vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
/* be sure that menu is enabled if non empty */
if( i_item > 0 )
Root->Enabled = true;
}
/*****************************************************************************
* NavigationMenu: sets menus for titles and chapters selection
*****************************************************************************
* Generates two types of menus:
* -simple list of titles
* -cascaded lists of chapters for each title
*****************************************************************************/
void __fastcall TMenusGen::NavigationMenu( TMenuItem *Root,
TNotifyEvent MenuItemClick )
{
TMenuItem * TitleGroup;
TMenuItem * TitleItem;
TMenuItem * ChapterGroup;
TMenuItem * ChapterItem;
AnsiString Name;
unsigned int i_title_nb;
unsigned int i_chapter_nb;
/* remove previous menu */
Root->Enabled = false;
Root->Clear();
i_title_nb = p_intf->p_sys->p_input->stream.i_area_nb - 1;
/* loop on titles */
for( unsigned int i_title = 1; i_title <= i_title_nb; i_title++ )
{
/* we group titles in packets of ten for small screens */
if( ( i_title % 10 == 1 ) && ( i_title_nb > 20 ) )
{
if( i_title != 1 )
Root->Add( TitleGroup );
Name.sprintf( "%d - %d", i_title, i_title + 9 );
TitleGroup = new TMenuItem( Root );
TitleGroup->RadioItem = true;
TitleGroup->Hint = Name;
TitleGroup->Caption = Name;
}
Name.sprintf( "Title %d (%d)", i_title,
p_intf->p_sys->p_input->stream.pp_areas[i_title]->i_part_nb - 1 );
{
TitleItem = new TMenuItem( Root );
TitleItem->RadioItem = true;
TitleItem->Hint = Name;
TitleItem->Caption = Name;
i_chapter_nb =
p_intf->p_sys->p_input->stream.pp_areas[i_title]->i_part_nb - 1;
/* loop on chapters */
for( unsigned int i_chapter = 1; i_chapter <= i_chapter_nb;
i_chapter++ )
{
/* we group chapters in packets of ten for small screens */
if( ( i_chapter % 10 == 1 ) && ( i_chapter_nb > 20 ) )
{
if( i_chapter != 1 )
TitleItem->Add( ChapterGroup );
Name.sprintf( "%d - %d", i_chapter, i_chapter + 9 );
ChapterGroup = new TMenuItem( TitleItem );
ChapterGroup->RadioItem = true;
ChapterGroup->Hint = Name;
ChapterGroup->Caption = Name;
}
Name.sprintf( "Chapter %d", i_chapter );
ChapterItem = new TMenuItem( TitleItem );
ChapterItem->RadioItem = true;
ChapterItem->Hint = Name;
ChapterItem->Caption = Name;
/* FIXME: temporary hack to save i_title and i_chapter with
* ChapterItem, since we will need them in the callback */
ChapterItem->Tag = Pos2Data( i_title, i_chapter );
#define p_area p_intf->p_sys->p_input->stream.pp_areas[i_title]
/* check the currently selected chapter */
if( ( p_area ==
p_intf->p_sys->p_input->stream.p_selected_area ) &&
( p_area->i_part == i_chapter ) )
{
ChapterItem->Checked = true;
}
#undef p_area
/* setup signal handling */
ChapterItem->OnClick = MenuItemClick;
if( i_chapter_nb > 20 )
ChapterGroup->Add( ChapterItem );
else
TitleItem->Add( ChapterItem );
}
if( i_chapter_nb > 20 )
{
TitleItem->Add( ChapterGroup );
}
if( p_intf->p_sys->p_input->stream.pp_areas[i_title]->i_part_nb
> 1 )
{
/* be sure that menu is sensitive */
Root->Enabled = true;
}
}
if( i_title_nb > 20 )
TitleGroup->Add( TitleItem );
else
Root->Add( TitleItem );
}
if( i_title_nb > 20 )
Root->Add( TitleGroup );
/* be sure that menu is sensitive */
Root->Enabled = true;
}
/*****************************************************************************
* menu.h: prototypes for menu functions
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: menu.h,v 1.5 2003/02/12 02:11:58 ipkiss Exp $
*
* Authors: Olivier Teuliere <ipkiss@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef menuH
#define menuH
//----------------------------------------------------------------------------
class TMenusGen : public TObject
{
private:
intf_thread_t *p_intf;
/* local pointers to main window menu items */
TMenuItem *MenuChannel;
TMenuItem *PopupChannel;
TMenuItem *MenuADevice;
TMenuItem *PopupADevice;
TMenuItem *MenuVDevice;
TMenuItem *PopupVDevice;
TMenuItem *MenuLanguage;
TMenuItem *PopupLanguage;
TMenuItem *MenuSubtitles;
TMenuItem *PopupSubtitles;
TMenuItem *MenuProgram;
TMenuItem *PopupProgram;
TMenuItem *MenuTitle;
TMenuItem *MenuChapter;
TMenuItem *PopupNavigation;
TMenuItem *MenuAddInterface;
/* Language information */
es_descriptor_t * p_audio_es_old;
es_descriptor_t * p_spu_es_old;
/* Helpful functions */
int Item2Index( TMenuItem *Root, TMenuItem *Item );
TMenuItem *Index2Item( TMenuItem *Root, int i_index, bool SingleColumn );
int __fastcall Data2Title( int data );
int __fastcall Data2Chapter( int data );
int __fastcall Pos2Data( int title, int chapter );
AnsiString __fastcall TMenusGen::CleanCaption( AnsiString Caption );
void __fastcall VarChange( vlc_object_t *, const char *, TMenuItem *,
TMenuItem *, TMenuItem * );
void __fastcall LangChange( TMenuItem *, TMenuItem *, TMenuItem *, int );
void __fastcall ProgramChange( TMenuItem *, TMenuItem * );
void __fastcall SetupVarMenu( vlc_object_t *, const char *, TMenuItem *,
TNotifyEvent );
void __fastcall SetupModuleMenu( const char *, TMenuItem *, TNotifyEvent );
void __fastcall ProgramMenu( TMenuItem *, pgrm_descriptor_t *,
TNotifyEvent );
void __fastcall RadioMenu( TMenuItem *, AnsiString, int, int,
TNotifyEvent );
void __fastcall LanguageMenu( TMenuItem *, es_descriptor_t *, int,
TNotifyEvent );
void __fastcall NavigationMenu( TMenuItem *, TNotifyEvent );
public:
__fastcall TMenusGen( intf_thread_t *_p_intf );
/* menu generation */
void __fastcall SetupMenus();
/* callbacks for menuitems */
void __fastcall AoutVarClick( TObject *Sender );
void __fastcall VoutVarClick( TObject *Sender );
void __fastcall InterfaceModuleClick( TObject *Sender );
void __fastcall MenuLanguageClick( TObject *Sender );
void __fastcall PopupLanguageClick( TObject *Sender );
void __fastcall MenuSubtitleClick( TObject *Sender );
void __fastcall PopupSubtitleClick( TObject *Sender );
void __fastcall MenuProgramClick( TObject *Sender );
void __fastcall PopupProgramClick( TObject *Sender );
void __fastcall MenuTitleClick( TObject *Sender );
void __fastcall MenuChapterClick( TObject *Sender );
void __fastcall PopupNavigationClick( TObject *Sender );
};
//----------------------------------------------------------------------------
#endif
/*****************************************************************************
* messages.cpp: log window.
*****************************************************************************
* Copyright (C) 2002 VideoLAN
*
* Authors: Olivier Teuliere <ipkiss@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include <vcl.h>
#pragma hdrstop
#include <vlc/vlc.h>
#include <vlc/intf.h>
#include "messages.h"
#include "misc.h"
#include "win32_common.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
//---------------------------------------------------------------------------
__fastcall TMessagesDlg::TMessagesDlg(
TComponent* Owner, intf_thread_t *_p_intf ) : TForm( Owner )
{
p_intf = _p_intf;
Icon = p_intf->p_sys->p_window->Icon;
Translate( this );
}
//---------------------------------------------------------------------------
void __fastcall TMessagesDlg::ButtonOKClick( TObject *Sender )
{
Hide();
}
//---------------------------------------------------------------------------
void __fastcall TMessagesDlg::FormHide( TObject *Sender )
{
p_intf->p_sys->p_window->MessagesAction->Checked = false;
}
//---------------------------------------------------------------------------
void __fastcall TMessagesDlg::FormShow( TObject *Sender )
{
p_intf->p_sys->p_window->MessagesAction->Checked = true;
}
//---------------------------------------------------------------------------
void __fastcall TMessagesDlg::UpdateLog()
{
msg_subscription_t *p_sub = p_intf->p_sys->p_sub;
int i_start, i_stop, i_del, i_count;
int i_max_lines;
vlc_mutex_lock( p_sub->p_lock );
i_stop = *p_sub->pi_stop;
vlc_mutex_unlock( p_sub->p_lock );
if( p_sub->i_start != i_stop )
{
for( i_start = p_sub->i_start;
i_start != i_stop;
i_start = (i_start+1) % VLC_MSG_QSIZE )
{
/* Append all messages to log window */
switch( p_sub->p_msg[i_start].i_type )
{
case VLC_MSG_ERR:
RichEditMessages->SelAttributes->Color = clRed;
break;
case VLC_MSG_WARN:
RichEditMessages->SelAttributes->Color = clBlue;
break;
default:
RichEditMessages->SelAttributes->Color = clBlack;
break;
}
/* Limit log size */
i_count = RichEditMessages->Lines->Count;
i_max_lines = config_GetInt( p_intf, "intfwin-max-lines" );
if( i_max_lines > 0 )
{
for( i_del = 0; i_del <= i_count - i_max_lines; i_del++ )
{
RichEditMessages->Lines->Delete( 0 );
}
}
/* Add message */
if( i_max_lines )
{
/* We don't use RichEditMessages->Lines->Add(), because with
* some versions of rich32.dll it can trigger the
* "RichEdit line insertion error" bug... */
RichEditMessages->SelStart = RichEditMessages->GetTextLen();
RichEditMessages->SelText = p_sub->p_msg[i_start].psz_msg;
RichEditMessages->SelText = RichEditMessages->SelText + "\r\n";
}
}
vlc_mutex_lock( p_sub->p_lock );
p_sub->i_start = i_start;
vlc_mutex_unlock( p_sub->p_lock );
}
}
//---------------------------------------------------------------------------
void __fastcall TMessagesDlg::PopupCopyTextClick( TObject *Sender )
{
/* If nothinf is selected, select everything */
if( RichEditMessages->SelLength == 0 )
{
RichEditMessages->SelStart = 0;
RichEditMessages->SelLength = RichEditMessages->GetTextLen();
}
/* Copy selected text to clipboard */
RichEditMessages->CopyToClipboard();
}
//---------------------------------------------------------------------------
object MessagesDlg: TMessagesDlg
Tag = 3
Left = 325
Top = 160
Width = 440
Height = 502
Caption = 'Messages'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clPurple
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
OnHide = FormHide
OnShow = FormShow
PixelsPerInch = 96
TextHeight = 13
object RichEditMessages: TRichEdit
Left = 0
Top = 0
Width = 432
Height = 424
Align = alTop
Anchors = [akLeft, akTop, akRight, akBottom]
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
ParentFont = False
PopupMenu = PopupMenu1
ReadOnly = True
ScrollBars = ssBoth
TabOrder = 0
WantReturns = False
end
object ButtonOK: TButton
Tag = 3
Left = 144
Top = 437
Width = 145
Height = 25
Anchors = [akBottom]
Caption = 'OK'
Default = True
ModalResult = 1
TabOrder = 1
OnClick = ButtonOKClick
end
object PopupMenu1: TPopupMenu
Left = 304
Top = 432
object PopupCopyText: TMenuItem
Caption = '&Copy text'
ShortCut = 16451
OnClick = PopupCopyTextClick
end
end
end
/*****************************************************************************
* messages.h: log window
*****************************************************************************
* Copyright (C) 2002 VideoLAN
*
* Authors: Olivier Teuliere <ipkiss@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef messagesH
#define messagesH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <ComCtrls.hpp>
#include <Menus.hpp>
//---------------------------------------------------------------------------
class TMessagesDlg : public TForm
{
__published: // IDE-managed Components
TRichEdit *RichEditMessages;
TButton *ButtonOK;
TPopupMenu *PopupMenu1;
TMenuItem *PopupCopyText;
void __fastcall ButtonOKClick( TObject *Sender );
void __fastcall FormHide( TObject *Sender );
void __fastcall FormShow( TObject *Sender );
void __fastcall PopupCopyTextClick( TObject *Sender );
private: // User declarations
intf_thread_t *p_intf;
public: // User declarations
__fastcall TMessagesDlg( TComponent* Owner, intf_thread_t *_p_intf );
void __fastcall UpdateLog();
};
//---------------------------------------------------------------------------
#endif
/*****************************************************************************
* misc.cpp: miscellaneous functions.
*****************************************************************************
* Copyright (C) 2002 VideoLAN
*
* Authors: Olivier Teuliere <ipkiss@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include <vcl.h>
#include <comctrls.hpp>
#pragma hdrstop
#include <vlc/vlc.h>
#include "misc.h"
/****************************************************************************
* This function replaces "Hint", "Caption" and "Text" properties of each
* component of the form by the appropriate translation.
****************************************************************************/
void __fastcall Translate( TForm *Form )
{
// We must test the string because we don't want to get the default one
if( Form->Hint != "" )
{
Form->Hint = _( Form->Hint.c_str() );
}
if( Form->Caption != "" )
{
Form->Caption = _( Form->Caption.c_str() );
}
for( int i = 0; i < Form->ComponentCount; i++ )
{
// Does this component need a translation ?
if( Form->Components[i]->Tag > 0 )
{
TComponent *Component = Form->Components[i];
// Note: the Text property isn't translated, because we don't want
// to modify the content of TEdit or TComboBox objects, which
// may have default values
// Hint property
if( Component->Tag & 1 )
{
if( Component->InheritsFrom( __classid( TControl ) ) )
{
TControl *Object = (TControl *) Component;
if( Object->Hint != "" )
{
Object->Hint = _( Object->Hint.c_str() );
}
}
else if( Component->InheritsFrom( __classid( TMenuItem ) ) )
{
TMenuItem *Object = (TMenuItem *) Component;
if( Object->Hint != "" )
{
Object->Hint = _( Object->Hint.c_str() );
}
}
}
// Caption property
if( Component->Tag & 2 )
{
if( Component->InheritsFrom( __classid( TMenuItem ) ) )
{
TMenuItem *Object = (TMenuItem *) Component;
if( Object->Caption != "" )
{
Object->Caption = _( Object->Caption.c_str() );
}
}
else if( Component->InheritsFrom( __classid( TLabel ) ) )
{
TLabel *Object = (TLabel *) Component;
if( Object->Caption != "" )
{
Object->Caption = _( Object->Caption.c_str() );
}
}
else if( Component->InheritsFrom( __classid( TButton ) ) )
{
TButton *Object = (TButton *) Component;
if( Object->Caption != "" )
{
Object->Caption = _( Object->Caption.c_str() );
}
}
else if( Component->InheritsFrom( __classid( TRadioButton ) ) )
{
TRadioButton *Object = (TRadioButton *) Component;
if( Object->Caption != "" )
{
Object->Caption = _( Object->Caption.c_str() );
}
}
else if( Component->InheritsFrom( __classid( TCheckBox ) ) )
{
TCheckBox *Object = (TCheckBox *) Component;
if( Object->Caption != "" )
{
Object->Caption = _( Object->Caption.c_str() );
}
}
else if( Component->InheritsFrom( __classid( TRadioGroup ) ) )
{
TRadioGroup *Object = (TRadioGroup *) Component;
if( Object->Caption != "" )
{
Object->Caption = _( Object->Caption.c_str() );
}
}
else if( Component->InheritsFrom( __classid( TGroupBox ) ) )
{
TGroupBox *Object = (TGroupBox *) Component;
if( Object->Caption != "" )
{
Object->Caption = _( Object->Caption.c_str() );
}
}
else if( Component->InheritsFrom( __classid( TToolButton ) ) )
{
TToolButton *Object = (TToolButton *) Component;
if( Object->Caption != "" )
{
Object->Caption = _( Object->Caption.c_str() );
}
}
else if( Component->InheritsFrom( __classid( TListView ) ) )
{
TListView *ListView = (TListView *) Component;
for( int iCol = 0; iCol < ListView->Columns->Count; iCol++ )
{
TListColumn *Object = ListView->Columns->Items[iCol];
if( Object->Caption != "" )
{
Object->Caption = _( Object->Caption.c_str() );
}
}
}
}
}
}
}
/*****************************************************************************
* misc.h: Prototype for main window
*****************************************************************************
* Copyright (C) 2002 VideoLAN
*
* Authors: Olivier Teuliere <ipkiss@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef miscH
#define miscH
void __fastcall Translate( TForm *Form );
#endif
/*****************************************************************************
* network.cpp: the "network" dialog box
*****************************************************************************
* Copyright (C) 2002 VideoLAN
*
* Authors: Olivier Teuliere <ipkiss@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include <vcl.h>
#pragma hdrstop
#include <vlc/vlc.h>
#include <vlc/intf.h>
#include "network.h"
#include "misc.h"
#include "win32_common.h"
//---------------------------------------------------------------------------
//#pragma package(smart_init)
#pragma link "CSPIN"
#pragma resource "*.dfm"
//---------------------------------------------------------------------------
__fastcall TNetworkDlg::TNetworkDlg( TComponent* Owner, intf_thread_t *_p_intf )
: TForm( Owner )
{
p_intf = _p_intf;
char *psz_channel_server;
OldRadioValue = 0;
/* server port */
SpinEditUDPPort->Value = config_GetInt( p_intf, "server-port" );
SpinEditMulticastPort->Value = config_GetInt( p_intf, "server-port" );
/* channel server */
if( config_GetInt( p_intf, "network-channel" ) )
{
RadioButtonCS->Checked = true;
RadioButtonCSEnter( RadioButtonCS );
}
psz_channel_server = config_GetPsz( p_intf, "channel-server" );
if( psz_channel_server )
{
ComboBoxCSAddress->Text = psz_channel_server;
free( psz_channel_server );
}
SpinEditCSPort->Value = config_GetInt( p_intf, "channel-port" );
Translate( this );
}
//---------------------------------------------------------------------------
void __fastcall TNetworkDlg::FormShow( TObject *Sender )
{
p_intf->p_sys->p_window->NetworkStreamAction->Checked = true;
}
//---------------------------------------------------------------------------
void __fastcall TNetworkDlg::FormHide( TObject *Sender )
{
p_intf->p_sys->p_window->NetworkStreamAction->Checked = false;
}
//---------------------------------------------------------------------------
void __fastcall TNetworkDlg::ButtonCancelClick( TObject *Sender )
{
Hide();
}
//---------------------------------------------------------------------------
void __fastcall TNetworkDlg::ButtonOkClick( TObject *Sender )
{
AnsiString Source, Address;
AnsiString Channel = ComboBoxCSAddress->Text;
unsigned int i_channel_port = SpinEditCSPort->Value;
unsigned int i_port;
Hide();
/* Check which option was chosen */
switch( OldRadioValue )
{
/* UDP */
case 0:
config_PutInt( p_intf, "network-channel", FALSE );
i_port = SpinEditUDPPort->Value;
/* Build source name */
Source = "udp:@:" + IntToStr( i_port );
p_intf->p_sys->p_playwin->Add( Source,
PLAYLIST_APPEND
| ( p_intf->p_sys->b_play_when_adding ? PLAYLIST_GO : 0 )
, PLAYLIST_END );
break;
/* UDP Multicast */
case 1:
config_PutInt( p_intf, "network-channel", FALSE );
Address = ComboBoxMulticastAddress->Text;
i_port = SpinEditMulticastPort->Value;
/* Build source name */
Source = "udp:@" + Address + ":" + IntToStr( i_port );
p_intf->p_sys->p_playwin->Add( Source,
PLAYLIST_APPEND
| ( p_intf->p_sys->b_play_when_adding ? PLAYLIST_GO : 0 )
, PLAYLIST_END );
/* HTTP */
case 3:
config_PutInt( p_intf, "network-channel", FALSE );
Address = EditHTTPURL->Text;
/* Build source name with a basic test;
* http is the default protocol */
if( Address.SubString( 1, 7 ) == "http://" ||
Address.SubString( 1, 6 ) == "ftp://" ||
Address.SubString( 1, 6 ) == "mms://" )
{
Source = Address;
}
else
{
Source = "http://" + Address;
}
p_intf->p_sys->p_playwin->Add( Source,
PLAYLIST_APPEND
| ( p_intf->p_sys->b_play_when_adding ? PLAYLIST_GO : 0 )
, PLAYLIST_END );
break;
}
}
//---------------------------------------------------------------------------
void __fastcall TNetworkDlg::ChangeEnabled( int i_selected )
{
switch( i_selected )
{
case 0:
LabelUDPPort->Enabled = NOT( LabelUDPPort->Enabled );
SpinEditUDPPort->Enabled = NOT( SpinEditUDPPort->Enabled );
break;
case 1:
LabelMulticastAddress->Enabled =
NOT( LabelMulticastAddress->Enabled );
ComboBoxMulticastAddress->Enabled =
NOT( ComboBoxMulticastAddress->Enabled );
LabelMulticastPort->Enabled = NOT( LabelMulticastPort->Enabled );
SpinEditMulticastPort->Enabled = NOT( SpinEditMulticastPort->Enabled );
break;
case 2:
LabelCSAddress->Enabled = NOT( LabelCSAddress->Enabled );
ComboBoxCSAddress->Enabled = NOT( ComboBoxCSAddress->Enabled );
LabelCSPort->Enabled = NOT( LabelCSPort->Enabled );
SpinEditCSPort->Enabled = NOT( SpinEditCSPort->Enabled );
break;
case 3:
LabelHTTPURL->Enabled = NOT( LabelHTTPURL->Enabled );
EditHTTPURL->Enabled = NOT( EditHTTPURL->Enabled );
break;
}
}
//---------------------------------------------------------------------------
void __fastcall TNetworkDlg::RadioButtonUDPEnter( TObject *Sender )
{
ChangeEnabled( OldRadioValue );
OldRadioValue = 0;
ChangeEnabled( OldRadioValue );
}
//---------------------------------------------------------------------------
void __fastcall TNetworkDlg::RadioButtonMulticastEnter( TObject *Sender )
{
ChangeEnabled( OldRadioValue );
OldRadioValue = 1;
ChangeEnabled( OldRadioValue );
}
//---------------------------------------------------------------------------
void __fastcall TNetworkDlg::RadioButtonCSEnter( TObject *Sender )
{
ChangeEnabled( OldRadioValue );
OldRadioValue = 2;
ChangeEnabled( OldRadioValue );
}
//---------------------------------------------------------------------------
void __fastcall TNetworkDlg::RadioButtonHTTPEnter( TObject *Sender )
{
ChangeEnabled( OldRadioValue );
OldRadioValue = 3;
ChangeEnabled( OldRadioValue );
}
//---------------------------------------------------------------------------
object NetworkDlg: TNetworkDlg
Tag = 3
Left = 358
Top = 414
BorderStyle = bsDialog
Caption = 'Open network'
ClientHeight = 191
ClientWidth = 496
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
Icon.Data = {
0000010001003030000001001800A81C00001600000028000000300000006000
00000100180000000000001B0000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000069375900000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000120E0A4011253E0F18000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000F0B
084143CA08070016430F08040800000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000003127291203174647E8464AE808010840E54039E6390B0C06
0E0A1C0000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0070CD0079DD0079DD0070CD0000000000000000000C1008261D6E4647E54547
E64748E105040039E6393AE53939E63936D33308030100000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000070CD0079DD0079DE007DE40088F9008CFF008CFF0088F9007CE302
6EC70B09124641DC4444DF4546E34446E54847E003040040E6403AEA3A3EE33E
3CE33C39E639080F010801050000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000070CD0079DD0077D90070CB0078D8007BDC007BDC007BDC
007BDC007BDC007BDD007EE32E232D0804084553F14250F34252ED4449DB4844
DC4645E208010540E5401C78150D18053CE63C3AE63A39EA393CD83C241A2006
0402000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000070CD0079DD007ADF007BDE007BDC0072
CC005188004877004876004876004876034976054A760B4D7731434221175B42
54EC4253EE4252F60B05104250F44252EB4546DA08010539E6392BAA2B080105
3CE63C39E7393AE63A39E93939E839081208181C080000000000000000000000
000000000000000000000000000000000000000070CD0079DD0079DD007CE300
88F90089F90075D2005188004877005188008CFF008CFF008CFF008CFF008CFF
1092FF2099FF31A0FF1408294840DB4550E1464EEA0C060B0B05084654F64653
F64453EF080E033AE63A2BAA2B03030339E33939DF3939E639080F083DDB3D24
9C24434B3B000000000000000000000000000000000000000000000000000000
0063B60085F3008BFE0088F9007FE90088F90080E8005CA0008CFF008CFF008C
FF008CFF008CFF008CFF008CFF048DFF1594FF259BFF35A2FF0C04103F38C754
5AF7505BF10C08100801084352F64652F44253F30813053AE63A39E639030403
1C521826A1250812010807032454131558150000000000000000000000000000
000000000000000000000000000000000000000070CD007CE30079DD00000000
7CE30089FA008CFF0089FA008CFF008CFF008CFF008CFF008CFF008CFF098FFF
1996FF2A9DFF3AA4FF0804103A2AA34E58F74E58F40B0B120803054652F34548
E64451F305130532CA323AE23A03070308070307040008040139E63939E43931
B42F5E1347000000000000000000000000000000000000000000000000000000
0000000000000000000061B10000000079DD008CFF008CFF008CFF008CFF008C
FF008CFF008CFF008CFF008CFF0E91FF1E98FF2E9FFF3FA6FF040408382BAF4D
5AEF555AF70F12250501050F04160804074250F3121A123AE93A39E239080803
0D2F08010401268C2539E7393DE63D3FE23E0804100000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
79DD008CFF008CFF008CFF008CFF008CFF008CFF008CFF008CFF028CFF1293FF
239AFF33A1FF43A8FF0802083A2AA3565BF7555AF71714330501050104000801
07424FF12828203AEA3A39E639030703182F1008340801040139E7393DE83D39
E939080400000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000070CD0088F9008CFF008CFF008CFF008C
FF008CFF008CFF008CFF078EFF1795FF279CFF38A3FF48AAFF0808005151F155
5AF30804030804000504050800082E358E0E0C1F1D192439E53940E640080400
2AA12739E63908020708010539E8393BE93B0804080000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000007CE3008CFF008CFF008CFF058EFD1D96F92398F8269AFA31A0FC42A8FF
4FAEFF5CB3FF65B7FF0C08084F5AF14E57F50B04080804043639A54647E81C13
49363AA70804080F120835953439E7393EE63E39DF3939EA39081105308A2B3F
E73F080601000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000047BDB1D96F92398F82498F83BA0
F399C1E1B1C9DDBCD4E7CBE0F3D9EDFFDCEEFFDEEFFFCDE8FF080808575BF750
58F624125A5057F34845DF4A41E0150E30C55734E3723EC56E33A23D27050105
39E43939E63939E6393CE63C14420C3BE03B192A090000000000000000000000
0000000000000000000000000000000000000000000000000000000000000004
04042D88D399C1E1B1C9DDB1C9DCB7CBDBCFD3D7D5D5D6E2E2E3F0F0F1FEFEFF
FEFEFFFEFEFFF9FCFF0C08085D61F15B61EF555AF64A4FE13937BB0E0A12DE74
39E1733CDE713CDF753AE67541C36B342C231F17141B3AE63A39E7393DE83D39
E93939DE39000000000000000000000000000000000000000000000000000000
0000000000000000000000000000001818186893B8C3CCD2D5D5D6D5D5D6D5D5
D6D6D6D6D6D6D6E3E3E3F1F1F1FFFFFFFFFFFFFFFFFFFFFFFF140C145C5EF668
63F75555EA10061CC3673FDF713A0C1104080403080105080007070407D56F36
DE743EDE72401C200C29452939E63939E73939EA390000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000343434A2B4C2D5D5D6D6D6D6D6D6D6D6D6D6D5D5D6E2E2E3F0F0F1FEFEFF
FEFEFFFEFEFFFEFEFF20161C5C5EF6373EAE0E0413E2713DE1763CCD6A3C2A0D
08A44B2CDE743EBD612F080401030403E1713CDE7239DE713AE1723C22201139
C13341E641000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000001B1B1B99AEBED5D5D6D5D5D6D5D5
D6CFD3D7B8CBDBBFD5E7CEE2F3DCEFFFDFF0FFE2F1FFE9F4FF10100C3639A46E
4540DE7239DE713DE1713C07000784261CDE7639E3743E0812001F0407D86E36
E3753EE57540E57541DE763CDE733DD26637493C387E2F7B0000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00001B1B1B99AEBFCED3D7B7CBDBB1C9DD99C1E140A2F339A2FA49AAFC59B2FF
66B8FF74BEFF92CBFFD9ECFF0F0402C66531DE7139E2733D854B1E0A01084D11
0DE3733EE1723CDF713ADF753AE1763C1D0A08290708E57140E1763CDE733DC7
6B34080408000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000001818187FA5C399C1E13BA0F32498
F81D96F91091FD1C97FF2C9EFF3CA5FF4DACFF5DB3FF71BBFF8DC8FF9FD0FF08
0400080406B95C2EDE7239070B070803014D1615DE723CDE7540E5714030090D
0504003A120FE67541DE75390808044A0C290000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000707071778C81C92F3058EFD008CFF008CFF1092FF2099FF31A0FF41A7FF
51AEFF62B5FF72BCFF7BBFFF7BBBF96E9FCD0808080806041D0508E571403E22
0C200708080405070407070007080303B05F31DE723967301908010500000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000007CE3008CFF008C
FF048DFF1594FF259BFF35A2FF46A9FF56B0FF66B7FF77BEFF7BBFFF6DAAE300
0000000000000000000000080401200C088D4024E17141E57140DF713ADE713E
DE76390801070000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000079DD008CFF008CFF098FFF1996FF2A9DFF3AA4FF4AABFF
5BB2FF6BB9FF7BBFFF7BBFFF6AA5DD0000000000000000000000000000001D1A
0C1A0F08110903441912E57140623B1E08020300000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000079DD008CFF008C
FF0E91FF1E98FF2E9FFF3FA6FF4FADFF5FB4FF70BBFF7BBFFF78BAF96299CD00
00000000000000000000000000000000000000003914100000005A2411000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000070CD0088F9078EFD2C9CF940A3F850ACFA60B4FC70BCFF
7DC2FF87C6FF7EC0FF6DAAE30000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000707071A85DD40A2
F3A0C3E1B7CBDDC6D8E7D4E5F3E2F1FFE5F2FFD9ECFF9FD0FF7AACDD05050500
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000001818187FA5C3B8CBDBD0D4D7D5D5D6E2E2E3F0F0F1FEFEFF
FEFEFFFAFCFFE2EDF99FB7CD1C1C1C0000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000001B1B1B99AEBFD4D5
D6D6D6D6D6D6D6E3E3E3F1F1F1FFFFFFFFFFFFFEFEFFD1DAE33E3E3E00000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000001D1D1D7B9BB4CACED1D6D6D6D5D5D6E2E2E3F0F0F1FEFEFF
FEFEFFFEFEFFC9D2DD2121210000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000343434A5B5
C2CFD3D7BFCEDBC9D9E7D7E6F3E6F3FFECF5FFF0F4F9AEBDCD23232300000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000018181887A8C3A6C6E169B3F367B6FA77BEFC88C6FF
9FD0FFB4CBE33939390000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000040404338C
D749A8F947A9FD54AFFF64B6FF74BDFF7EC0FF76ABDD05050500000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000001F7DCD369FF948AAFF58B1FF69B8FF79BFFF
78BAF96299CD0000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
003592E34DACFF5DB3FF6DBAFF7BBFFF6DAAE300000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000003890DD51AEFF62B5FF72BCFF7BBFFF
6AA5DD0000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
003B8FD84C9CE3589FDE69A9E375B6F46299CD00000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000003376B00000000000000000005788B6
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000006CC61A83DD247FCC00000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000006DC71A83DD2686D71F6EB1
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000FFFF
FFFFFFFF0000FFFFFFFFFFFF0000FFFFFE1FDFFF0000FFFFE0078FFF0000FFFE
000007FF0000FFF0000001FF0000FF80000000FF0000FF000000003F0000FF00
0000000F0000FE00000000070000F800000000070000F8000000000F0000FC00
000000070000FE00000000070000FF80000000070000FFC0000000070000FFE0
000000070000FFE0000000070000FFE0000000070000FFE0000000070000FFF0
000000070000FFF0000000030000FFF0000000070000FFF00000000F0000FFF0
0000003F0000FFF8000E00FF0000FFF8000F01FF0000FFF8000FD7FF0000FFF8
001FFFFF0000FFFC001FFFFF0000FFFC001FFFFF0000FFFC003FFFFF0000FFFC
003FFFFF0000FFFE003FFFFF0000FFFE007FFFFF0000FFFE007FFFFF0000FFFE
007FFFFF0000FFFF00FFFFFF0000FFFF00FFFFFF0000FFFF00FFFFFF0000FFFF
01FFFFFF0000FFFF01FFFFFF0000FFFF81FFFFFF0000FFFFC3FFFFFF0000FFFF
FFFFFFFF0000FFFFFFFFFFFF0000FFFFFFFFFFFF0000FFFFFFFFFFFF0000}
OldCreateOrder = False
OnHide = FormHide
OnShow = FormShow
PixelsPerInch = 96
TextHeight = 13
object GroupBoxMode: TGroupBox
Tag = 3
Left = 8
Top = 8
Width = 479
Height = 144
Anchors = [akLeft, akTop, akRight]
Caption = 'Network mode'
TabOrder = 0
object LabelUDPPort: TLabel
Tag = 3
Left = 172
Top = 26
Width = 22
Height = 13
Caption = 'Port:'
end
object LabelMulticastPort: TLabel
Tag = 3
Left = 386
Top = 54
Width = 22
Height = 13
Anchors = [akTop, akRight]
Caption = 'Port:'
Enabled = False
end
object LabelCSPort: TLabel
Tag = 3
Left = 386
Top = 82
Width = 22
Height = 13
Anchors = [akTop, akRight]
Caption = 'Port:'
Enabled = False
end
object LabelMulticastAddress: TLabel
Tag = 3
Left = 163
Top = 54
Width = 41
Height = 13
Caption = 'Address:'
Enabled = False
end
object LabelCSAddress: TLabel
Tag = 3
Left = 163
Top = 82
Width = 41
Height = 13
Caption = 'Address:'
Enabled = False
end
object LabelHTTPURL: TLabel
Tag = 3
Left = 171
Top = 110
Width = 25
Height = 13
Caption = 'URL:'
Enabled = False
end
object RadioButtonUDP: TRadioButton
Tag = 3
Left = 16
Top = 24
Width = 113
Height = 17
Caption = 'UDP/RTP'
Checked = True
TabOrder = 0
TabStop = True
OnEnter = RadioButtonUDPEnter
end
object RadioButtonMulticast: TRadioButton
Tag = 3
Left = 16
Top = 52
Width = 113
Height = 17
Caption = 'UDP/RTP Multicast'
TabOrder = 1
OnEnter = RadioButtonMulticastEnter
end
object RadioButtonCS: TRadioButton
Tag = 3
Left = 16
Top = 80
Width = 113
Height = 17
Caption = 'Channel server'
TabOrder = 2
OnEnter = RadioButtonCSEnter
end
object RadioButtonHTTP: TRadioButton
Tag = 3
Left = 16
Top = 108
Width = 113
Height = 17
Caption = 'HTTP/FTP/MMS'
TabOrder = 3
OnEnter = RadioButtonHTTPEnter
end
object ComboBoxMulticastAddress: TComboBox
Tag = 5
Left = 208
Top = 50
Width = 159
Height = 21
Anchors = [akLeft, akTop, akRight]
Enabled = False
ItemHeight = 13
TabOrder = 5
end
object ComboBoxCSAddress: TComboBox
Tag = 5
Left = 208
Top = 78
Width = 159
Height = 21
Anchors = [akLeft, akTop, akRight]
Enabled = False
ItemHeight = 13
TabOrder = 7
Text = 'vlcs'
Items.Strings = (
'vlcs')
end
object EditHTTPURL: TEdit
Tag = 5
Left = 208
Top = 106
Width = 263
Height = 21
Anchors = [akLeft, akTop, akRight]
Enabled = False
TabOrder = 9
end
object SpinEditUDPPort: TCSpinEdit
Left = 208
Top = 21
Width = 57
Height = 22
TabStop = True
MaxValue = 65535
ParentColor = False
TabOrder = 4
Value = 1234
end
object SpinEditMulticastPort: TCSpinEdit
Left = 414
Top = 49
Width = 57
Height = 22
TabStop = True
Anchors = [akTop, akRight]
Enabled = False
MaxValue = 65535
ParentColor = False
TabOrder = 6
Value = 1234
end
object SpinEditCSPort: TCSpinEdit
Left = 414
Top = 77
Width = 57
Height = 22
TabStop = True
Anchors = [akTop, akRight]
Enabled = False
MaxValue = 65535
ParentColor = False
TabOrder = 8
Value = 6010
end
end
object ButtonOK: TButton
Tag = 3
Left = 330
Top = 160
Width = 75
Height = 23
Caption = 'OK'
Default = True
ModalResult = 1
TabOrder = 1
OnClick = ButtonOkClick
end
object ButtonCancel: TButton
Tag = 3
Left = 413
Top = 160
Width = 75
Height = 23
Anchors = [akTop, akRight]
Cancel = True
Caption = 'Cancel'
Default = True
ModalResult = 2
TabOrder = 2
OnClick = ButtonCancelClick
end
end
/*****************************************************************************
* network.h: the "network" dialog box
*****************************************************************************
* Copyright (C) 2002 VideoLAN
*
* Authors: Olivier Teuliere <ipkiss@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef networkH
#define networkH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <Buttons.hpp>
#include <ComCtrls.hpp>
#include <ExtCtrls.hpp>
#include "CSPIN.h"
//---------------------------------------------------------------------------
#define NOT( var ) ( (var) ? false : true )
class TNetworkDlg : public TForm
{
__published: // IDE-managed Components
TGroupBox *GroupBoxMode;
TRadioButton *RadioButtonUDP;
TRadioButton *RadioButtonMulticast;
TRadioButton *RadioButtonCS;
TRadioButton *RadioButtonHTTP;
TLabel *LabelUDPPort;
TLabel *LabelMulticastPort;
TLabel *LabelCSPort;
TLabel *LabelMulticastAddress;
TComboBox *ComboBoxMulticastAddress;
TLabel *LabelCSAddress;
TComboBox *ComboBoxCSAddress;
TEdit *EditHTTPURL;
TLabel *LabelHTTPURL;
TCSpinEdit *SpinEditUDPPort;
TCSpinEdit *SpinEditMulticastPort;
TCSpinEdit *SpinEditCSPort;
TButton *ButtonOK;
TButton *ButtonCancel;
void __fastcall FormShow( TObject *Sender );
void __fastcall FormHide( TObject *Sender );
void __fastcall ButtonCancelClick( TObject *Sender );
void __fastcall ButtonOkClick( TObject *Sender );
void __fastcall RadioButtonUDPEnter( TObject *Sender );
void __fastcall RadioButtonMulticastEnter( TObject *Sender );
void __fastcall RadioButtonCSEnter( TObject *Sender );
void __fastcall RadioButtonHTTPEnter( TObject *Sender );
private: // User declarations
int OldRadioValue;
void __fastcall ChangeEnabled( int i_selected );
intf_thread_t *p_intf;
public: // User declarations
__fastcall TNetworkDlg( TComponent* Owner, intf_thread_t *_p_intf );
};
//---------------------------------------------------------------------------
#endif
/*****************************************************************************
* playlist.cpp: Interface for the playlist dialog
*****************************************************************************
* Copyright (C) 2002 VideoLAN
*
* Authors: Olivier Teuliere <ipkiss@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include <vcl.h>
#pragma hdrstop
#include <vlc/vlc.h>
#include <vlc/intf.h>
#include "playlist.h"
#include "dragdrop.h"
#include "misc.h"
#include "win32_common.h"
//---------------------------------------------------------------------------
#pragma resource "*.dfm"
//---------------------------------------------------------------------------
_fastcall TPlaylistDlg::TPlaylistDlg(
TComponent* Owner, intf_thread_t *_p_intf ) : TForm( Owner )
{
p_intf = _p_intf;
Icon = p_intf->p_sys->p_window->Icon;
Translate( this );
/* store a pointer to the core playlist */
p_playlist = (playlist_t *)
vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
if( p_playlist == NULL )
{
msg_Err( p_intf, "cannot find a playlist object" );
}
/* drag and drop stuff */
/* initialize the OLE library */
OleInitialize( NULL );
/* TDropTarget will send the WM_OLEDROP message to the form */
lpDropTarget = (LPDROPTARGET)new TDropTarget( this->Handle );
CoLockObjectExternal( lpDropTarget, true, true );
/* register the listview as a drop target */
RegisterDragDrop( ListViewPlaylist->Handle, lpDropTarget );
}
//---------------------------------------------------------------------------
__fastcall TPlaylistDlg::~TPlaylistDlg()
{
/* release the core playlist */
vlc_object_release( p_playlist );
/* remove the listview from the list of drop targets */
RevokeDragDrop( ListViewPlaylist->Handle );
lpDropTarget->Release();
CoLockObjectExternal( lpDropTarget, false, true );
/* uninitialize the OLE library */
OleUninitialize();
}
//---------------------------------------------------------------------------
char * __fastcall TPlaylistDlg::rindex( char *s, char c )
{
char *ref = s;
s = s + strlen( s ) - 2;
while( ( s > ref ) && ( *s != c ) )
{
s--;
}
if( *s == c )
{
return( s );
}
else
{
return( NULL );
}
}
//---------------------------------------------------------------------------
/*****************************************************************************
* External drop handling
*****************************************************************************/
void __fastcall TPlaylistDlg::OnDrop( TMessage &Msg )
{
p_intf->p_sys->p_window->OnDrop( Msg );
}
//--------------------------------------------------------------------------
/*****************************************************************************
* Event handlers
****************************************************************************/
void __fastcall TPlaylistDlg::FormShow( TObject *Sender )
{
p_intf->p_sys->p_window->PlaylistAction->Checked = true;
}
//---------------------------------------------------------------------------
void __fastcall TPlaylistDlg::FormHide( TObject *Sender )
{
p_intf->p_sys->p_window->PlaylistAction->Checked = false;
}
//---------------------------------------------------------------------------
void __fastcall TPlaylistDlg::ButtonOkClick( TObject *Sender )
{
Hide();
}
//---------------------------------------------------------------------------
void __fastcall TPlaylistDlg::PlayStreamActionExecute( TObject *Sender )
{
TListItem *Item;
TListItem *ItemStart;
TItemStates Focused;
if( p_playlist == NULL )
return;
/* search the selected item */
if( ListViewPlaylist->SelCount > 0 )
{
if( ListViewPlaylist->SelCount == 1 )
{
Item = ListViewPlaylist->Selected;
}
else
{
Focused << isFocused;
ItemStart = ListViewPlaylist->Items->Item[0];
Item = ListViewPlaylist->GetNextItem( ItemStart, sdAll, Focused );
}
playlist_Goto( p_playlist, Item->Index );
}
}
//---------------------------------------------------------------------------
void __fastcall TPlaylistDlg::ListViewPlaylistKeyDown( TObject *Sender,
WORD &Key, TShiftState Shift )
{
/* 'suppr' or 'backspace' */
if( ( Key == VK_DELETE ) || ( Key == VK_BACK ) )
{
DeleteSelectionActionExecute( Sender );
}
/* 'enter' */
if( Key == VK_RETURN )
{
PlayStreamActionExecute( Sender );
}
}
//---------------------------------------------------------------------------
void __fastcall TPlaylistDlg::ListViewPlaylistCustomDrawItem(
TCustomListView *Sender, TListItem *Item, TCustomDrawState State,
bool &DefaultDraw)
{
TRect Rect = Item->DisplayRect( drBounds );
/* set the background color */
if( Item->Index == p_intf->p_sys->i_playing )
Sender->Canvas->Brush->Color = clRed;
else
Sender->Canvas->Brush->Color = clWhite;
Sender->Canvas->FillRect( Rect );
}
//---------------------------------------------------------------------------
/*****************************************************************************
* Menu and popup callbacks
****************************************************************************/
void __fastcall TPlaylistDlg::MenuAddFileClick( TObject *Sender )
{
p_intf->p_sys->b_play_when_adding =
(vlc_bool_t)config_GetInt( p_intf, "enqueue" );
p_intf->p_sys->p_window->OpenFileActionExecute( Sender );
p_intf->p_sys->b_play_when_adding = VLC_TRUE;
}
//---------------------------------------------------------------------------
void __fastcall TPlaylistDlg::MenuAddDiscClick( TObject *Sender )
{
p_intf->p_sys->b_play_when_adding =
(vlc_bool_t)config_GetInt( p_intf, "enqueue" );
p_intf->p_sys->p_window->OpenDiscActionExecute( Sender );
p_intf->p_sys->b_play_when_adding = VLC_TRUE;
(vlc_bool_t)config_GetInt( p_intf, "enqueue" );
}
//---------------------------------------------------------------------------
void __fastcall TPlaylistDlg::MenuAddNetClick( TObject *Sender )
{
p_intf->p_sys->b_play_when_adding =
(vlc_bool_t)config_GetInt( p_intf, "enqueue" );
p_intf->p_sys->p_window->NetworkStreamActionExecute( Sender );
p_intf->p_sys->b_play_when_adding = VLC_TRUE;
}
//---------------------------------------------------------------------------
void __fastcall TPlaylistDlg::MenuAddUrlClick( TObject *Sender )
{
/* TODO */
}
//---------------------------------------------------------------------------
void __fastcall TPlaylistDlg::DeleteSelectionActionExecute( TObject *Sender )
{
/* user wants to delete a file in the queue */
int i_pos;
/* lock the struct */
vlc_mutex_lock( &p_intf->change_lock );
/* delete the items from the last to the first */
for( i_pos = p_playlist->i_size - 1; i_pos >= 0; i_pos-- )
{
if( ListViewPlaylist->Items->Item[i_pos]->Selected )
{
DeleteItem( i_pos );
}
}
/* rebuild the ListView */
UpdateGrid();
vlc_mutex_unlock( &p_intf->change_lock );
}
//---------------------------------------------------------------------------
void __fastcall TPlaylistDlg::DeleteAllActionExecute( TObject *Sender )
{
int i_pos;
/* lock the struct */
vlc_mutex_lock( &p_intf->change_lock );
/* delete the items from the last to the first */
for( i_pos = p_playlist->i_size - 1; i_pos >= 0; i_pos-- )
{
DeleteItem( i_pos );
}
/* Rebuild the ListView */
UpdateGrid();
vlc_mutex_unlock( &p_intf->change_lock );
}
//---------------------------------------------------------------------------
void __fastcall TPlaylistDlg::InvertSelectionActionExecute( TObject *Sender )
{
#define NOT( var ) ( (var) ? false : true )
int i_pos;
TListItems *Items = ListViewPlaylist->Items;
/* delete the items from the last to the first */
for( i_pos = p_playlist->i_size - 1; i_pos >= 0; i_pos-- )
{
Items->Item[i_pos]->Selected = NOT( Items->Item[i_pos]->Selected );
}
#undef NOT
}
//---------------------------------------------------------------------------
void __fastcall TPlaylistDlg::CropSelectionActionExecute( TObject *Sender )
{
InvertSelectionActionExecute( Sender );
DeleteSelectionActionExecute( Sender );
}
//---------------------------------------------------------------------------
/*****************************************************************************
* Useful functions, needed by the event handlers or by other windows
****************************************************************************/
void __fastcall TPlaylistDlg::Add( AnsiString FileName, int i_mode, int i_pos )
{
if( p_playlist == NULL )
return;
playlist_Add( p_playlist, FileName.c_str(), i_mode, i_pos );
/* refresh the display */
UpdateGrid();
}
//---------------------------------------------------------------------------
void __fastcall TPlaylistDlg::Stop()
{
if( p_playlist == NULL )
return;
playlist_Stop( p_playlist );
}
//---------------------------------------------------------------------------
void __fastcall TPlaylistDlg::Play()
{
if( p_playlist == NULL )
return;
if ( p_playlist->i_size )
playlist_Play( p_playlist );
else
Show();
}
//---------------------------------------------------------------------------
void __fastcall TPlaylistDlg::Pause()
{
if( p_intf->p_sys->p_input != NULL )
{
input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_PAUSE );
}
}
//---------------------------------------------------------------------------
void __fastcall TPlaylistDlg::Slow()
{
if( p_intf->p_sys->p_input != NULL )
{
input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_SLOWER );
}
}
//---------------------------------------------------------------------------
void __fastcall TPlaylistDlg::Fast()
{
if( p_intf->p_sys->p_input != NULL )
{
input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_FASTER );
}
}
//---------------------------------------------------------------------------
void __fastcall TPlaylistDlg::UpdateGrid()
{
int i_dummy;
char *FileName;
TListItem *Item;
ListViewPlaylist->Items->BeginUpdate();
/* Clear the list... */
ListViewPlaylist->Items->Clear();
/* ...and rebuild it */
for( i_dummy = 0; i_dummy < p_playlist->i_size; i_dummy++ )
{
#ifdef WIN32
/* Position of the last '\' in the string */
FileName = rindex( p_playlist->pp_items[i_dummy]->psz_name, '\\' );
#else
/* Position of the last '/' in the string */
FileName = rindex( p_playlist->pp_items[i_dummy]->psz_name, '/' );
#endif
if( ( FileName == NULL ) || ( *(FileName + 1) == '\0' ) )
{
FileName = p_playlist->pp_items[i_dummy]->psz_name;
}
else
{
/* Skip leading '\' or '/' */
FileName++;
}
Item = ListViewPlaylist->Items->Add();
Item->Caption = FileName;
Item->SubItems->Add( "no info" );
}
/* TODO: Set background color ? */
ListViewPlaylist->Items->EndUpdate();
}
//---------------------------------------------------------------------------
void __fastcall TPlaylistDlg::Manage()
{
if( p_playlist == NULL )
return;
vlc_mutex_lock( &p_playlist->object_lock );
if( p_intf->p_sys->i_playing != p_playlist->i_index )
{
p_intf->p_sys->i_playing = p_playlist->i_index;
/* update the background color */
UpdateGrid();
}
vlc_mutex_unlock( &p_playlist->object_lock );
}
//---------------------------------------------------------------------------
void __fastcall TPlaylistDlg::DeleteItem( int i_pos )
{
if( p_playlist == NULL )
return;
playlist_Delete( p_playlist, i_pos );
}
//---------------------------------------------------------------------------
void __fastcall TPlaylistDlg::Previous()
{
if( p_playlist == NULL )
return;
playlist_Prev( p_playlist );
}
//---------------------------------------------------------------------------
void __fastcall TPlaylistDlg::Next()
{
if( p_playlist == NULL )
return;
playlist_Next( p_playlist );
}
//---------------------------------------------------------------------------
void __fastcall TPlaylistDlg::MenuFileCloseClick( TObject *Sender )
{
Hide();
}
//---------------------------------------------------------------------------
void __fastcall TPlaylistDlg::MenuFileOpenClick( TObject *Sender )
{
if( PlaylistOpenDlg->Execute() )
{
// playlist_LoadFile( p_playlist , PlaylistOpenDlg->FileName.c_str() );
UpdateGrid();
}
}
//---------------------------------------------------------------------------
void __fastcall TPlaylistDlg::MenuFileSaveClick( TObject *Sender )
{
if( PlaylistSaveDlg->Execute() )
{
// playlist_SaveFile( p_playlist , PlaylistSaveDlg->FileName.c_str() );
}
}
//---------------------------------------------------------------------------
object PlaylistDlg: TPlaylistDlg
Tag = 3
Left = 470
Top = 197
Width = 335
Height = 435
Caption = 'Playlist'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
Menu = MainMenuPlaylist
OldCreateOrder = False
OnHide = FormHide
OnShow = FormShow
PixelsPerInch = 96
TextHeight = 13
object ListViewPlaylist: TListView
Tag = 3
Left = 11
Top = 10
Width = 305
Height = 330
Anchors = [akLeft, akTop, akRight, akBottom]
Columns = <
item
Caption = 'Filename'
Width = 200
end
item
Alignment = taCenter
Caption = 'Duration'
Width = 100
end>
HideSelection = False
MultiSelect = True
ReadOnly = True
RowSelect = True
PopupMenu = PopupMenuPlaylist
TabOrder = 1
ViewStyle = vsReport
OnCustomDrawItem = ListViewPlaylistCustomDrawItem
OnDblClick = PlayStreamActionExecute
OnKeyDown = ListViewPlaylistKeyDown
end
object ButtonOK: TButton
Tag = 3
Left = 75
Top = 352
Width = 177
Height = 25
Anchors = [akLeft, akRight, akBottom]
Caption = 'OK'
Default = True
ModalResult = 1
TabOrder = 0
OnClick = ButtonOkClick
end
object MainMenuPlaylist: TMainMenu
Left = 8
Top = 8
object MenuAdd: TMenuItem
Tag = 3
Caption = '&Add'
object MenuAddFile: TMenuItem
Tag = 3
Caption = '&File...'
OnClick = MenuAddFileClick
end
object MenuAddDisc: TMenuItem
Tag = 3
Caption = '&Disc...'
OnClick = MenuAddDiscClick
end
object MenuAddNet: TMenuItem
Tag = 3
Caption = '&Network...'
OnClick = MenuAddNetClick
end
object MenuAddUrl: TMenuItem
Tag = 3
Caption = '&Url'
Enabled = False
OnClick = MenuAddUrlClick
end
end
object MenuDelete: TMenuItem
Tag = 3
Caption = '&Delete'
object MenuDeleteAll: TMenuItem
Tag = 3
Action = DeleteAllAction
end
object MenuDeleteSelected: TMenuItem
Tag = 3
Action = DeleteSelectionAction
Caption = '&Selection'
end
end
object MenuSelection: TMenuItem
Tag = 3
Caption = '&Selection'
object MenuSelectionCrop: TMenuItem
Tag = 3
Action = CropSelectionAction
end
object MenuSelectionInvert: TMenuItem
Tag = 3
Action = InvertSelectionAction
end
end
end
object PopupMenuPlaylist: TPopupMenu
Left = 40
Top = 8
object PopupPlay: TMenuItem
Tag = 3
Action = PlayStreamAction
end
object N1: TMenuItem
Caption = '-'
end
object PopupInvertSelection: TMenuItem
Tag = 3
Action = InvertSelectionAction
Caption = '&Invert selection'
end
object PopupCropSelection: TMenuItem
Tag = 3
Action = CropSelectionAction
Caption = '&Crop selection'
end
object N2: TMenuItem
Caption = '-'
end
object PopupDeleteSelected: TMenuItem
Tag = 3
Action = DeleteSelectionAction
Caption = '&Delete selection'
end
object PopupDeleteAll: TMenuItem
Tag = 3
Action = DeleteAllAction
Caption = 'Delete &all'
end
end
object ActionList1: TActionList
Left = 72
Top = 8
object InvertSelectionAction: TAction
Tag = 3
Caption = 'Invert'
Hint = 'Invert selection'
OnExecute = InvertSelectionActionExecute
end
object CropSelectionAction: TAction
Tag = 3
Caption = 'Crop'
Hint = 'Crop selection'
OnExecute = CropSelectionActionExecute
end
object DeleteSelectionAction: TAction
Tag = 3
Caption = 'Delete'
Hint = 'Delete selection'
OnExecute = DeleteSelectionActionExecute
end
object DeleteAllAction: TAction
Tag = 3
Caption = 'All'
Hint = 'Delete all items'
OnExecute = DeleteAllActionExecute
end
object PlayStreamAction: TAction
Tag = 3
Caption = 'Play'
Hint = 'Play the selected stream'
OnExecute = PlayStreamActionExecute
end
end
object PlaylistOpenDlg: TOpenDialog
Filter = 'All files(*.*)|*.*'
Options = [ofHideReadOnly, ofPathMustExist, ofFileMustExist, ofEnableSizing]
Left = 136
Top = 8
end
object PlaylistSaveDlg: TSaveDialog
Filter = 'All files(*.*)|*.*'
Options = [ofOverwritePrompt, ofHideReadOnly, ofPathMustExist, ofEnableSizing]
Left = 104
Top = 8
end
end
/*****************************************************************************
* playlist.h: Interface for the playlist dialog
*****************************************************************************
* Copyright (C) 2002 VideoLAN
*
* Authors: Olivier Teuliere <ipkiss@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef playlistH
#define playlistH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <Buttons.hpp>
#include <Menus.hpp>
#include <Grids.hpp>
#include <ComCtrls.hpp>
#include <ActnList.hpp>
#include <oleidl.h>
#include <Dialogs.hpp> /* for drag and drop */
/*****************************************************************************
* This message is sent to the controls registered as drop targets
*****************************************************************************/
#define WM_OLEDROP WM_USER + 1
//---------------------------------------------------------------------------
class TPlaylistDlg : public TForm
{
__published: // IDE-managed Components
TMainMenu *MainMenuPlaylist;
TMenuItem *MenuAdd;
TMenuItem *MenuAddFile;
TMenuItem *MenuAddDisc;
TMenuItem *MenuAddNet;
TMenuItem *MenuAddUrl;
TMenuItem *MenuDelete;
TMenuItem *MenuDeleteAll;
TMenuItem *MenuDeleteSelected;
TMenuItem *MenuSelection;
TMenuItem *MenuSelectionCrop;
TMenuItem *MenuSelectionInvert;
TListView *ListViewPlaylist;
TPopupMenu *PopupMenuPlaylist;
TMenuItem *PopupPlay;
TMenuItem *N1;
TMenuItem *PopupDeleteAll;
TMenuItem *PopupDeleteSelected;
TMenuItem *N2;
TMenuItem *PopupInvertSelection;
TMenuItem *PopupCropSelection;
TActionList *ActionList1;
TAction *InvertSelectionAction;
TAction *CropSelectionAction;
TAction *DeleteSelectionAction;
TAction *DeleteAllAction;
TAction *PlayStreamAction;
TOpenDialog *PlaylistOpenDlg;
TSaveDialog *PlaylistSaveDlg;
TButton *ButtonOK;
void __fastcall FormShow( TObject *Sender );
void __fastcall FormHide( TObject *Sender );
void __fastcall ButtonOkClick( TObject *Sender );
void __fastcall ListViewPlaylistKeyDown( TObject *Sender, WORD &Key,
TShiftState Shift );
void __fastcall ListViewPlaylistCustomDrawItem( TCustomListView *Sender,
TListItem *Item, TCustomDrawState State, bool &DefaultDraw );
void __fastcall MenuAddFileClick( TObject *Sender );
void __fastcall MenuAddDiscClick( TObject *Sender );
void __fastcall MenuAddNetClick( TObject *Sender );
void __fastcall MenuAddUrlClick( TObject *Sender );
void __fastcall InvertSelectionActionExecute( TObject *Sender );
void __fastcall CropSelectionActionExecute( TObject *Sender );
void __fastcall DeleteSelectionActionExecute( TObject *Sender );
void __fastcall DeleteAllActionExecute( TObject *Sender );
void __fastcall PlayStreamActionExecute( TObject *Sender );
void __fastcall MenuFileCloseClick( TObject *Sender );
void __fastcall MenuFileOpenClick( TObject *Sender );
void __fastcall MenuFileSaveClick( TObject *Sender );
private: // User declarations
char * __fastcall rindex( char *s, char c );
intf_thread_t *p_intf;
playlist_t *p_playlist;
/* drag and drop handling */
LPDROPTARGET lpDropTarget;
BEGIN_MESSAGE_MAP
MESSAGE_HANDLER( WM_OLEDROP, TMessage, OnDrop )
END_MESSAGE_MAP( TForm )
void __fastcall OnDrop( TMessage &Msg );
public: // User declarations
__fastcall TPlaylistDlg( TComponent* Owner, intf_thread_t *_p_intf );
__fastcall ~TPlaylistDlg();
void __fastcall Add( AnsiString FileName, int i_mode, int i_pos );
void __fastcall Stop();
void __fastcall Play();
void __fastcall Pause();
void __fastcall Slow();
void __fastcall Fast();
void __fastcall UpdateGrid();
void __fastcall Manage();
void __fastcall DeleteItem( int i_pos );
void __fastcall Previous();
void __fastcall Next();
};
//---------------------------------------------------------------------------
#endif
/*****************************************************************************
* preferences.cpp: the "Preferences" dialog box
*****************************************************************************
* Copyright (C) 2002-2003 VideoLAN
*
* Authors: Olivier Teuliere <ipkiss@via.ecp.fr>
* Boris Dores <babal@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include <vcl.h>
#pragma hdrstop
#include <stdlib.h> /* malloc(), free() */
#include <string.h> /* strcmp */
#include <vlc/vlc.h>
#include <vlc/intf.h>
#include "preferences.h"
#include "win32_common.h"
//---------------------------------------------------------------------------
//#pragma package(smart_init)
#pragma link "CSPIN"
#pragma resource "*.dfm"
/****************************************************************************
* A THintWindow with a limited width
****************************************************************************/
void __fastcall TNarrowHintWindow::ActivateHint( const Windows::TRect &Rect,
const System::AnsiString AHint )
{
TRect NarrowRect = CalcHintRect( 300, AHint, NULL );
NarrowRect.Left = Rect.Left;
NarrowRect.Top = Rect.Top;
NarrowRect.Right += Rect.Left;
NarrowRect.Bottom += Rect.Top;
THintWindow::ActivateHint( NarrowRect, AHint );
}
/****************************************************************************
* Functions to help components creation
****************************************************************************/
__fastcall TPanelPref::TPanelPref( TComponent* Owner,
module_config_t *_p_config, intf_thread_t *_p_intf ) : TPanel( Owner )
{
p_intf = _p_intf;
p_config = _p_config;
BevelInner = bvNone;
BevelOuter = bvNone;
BorderStyle = bsNone;
}
//---------------------------------------------------------------------------
TExtCheckListBox * __fastcall TPanelPref::CreateExtCheckListBox(
TWinControl *Parent, int Left, int Width, int Top, int Height )
{
TExtCheckListBox *ExtCheckListBox = new TExtCheckListBox( Parent );
ExtCheckListBox->Parent = Parent;
ExtCheckListBox->Left = Left;
ExtCheckListBox->Width = Width;
ExtCheckListBox->Top = Top;
ExtCheckListBox->Height = Height;
return ExtCheckListBox;
}
//---------------------------------------------------------------------------
TButton * __fastcall TPanelPref::CreateButton( TWinControl *Parent,
int Left, int Width, int Top, int Height, AnsiString Caption )
{
TButton *Button = new TButton( Parent );
Button->Parent = Parent;
Button->Left = Left;
Button->Width = Width;
Button->Top = Top;
Button->Height = Height;
Button->Caption = Caption;
return Button;
}
//---------------------------------------------------------------------------
TCheckBox * __fastcall TPanelPref::CreateCheckBox( TWinControl *Parent,
int Left, int Width, int Top, int Height, AnsiString Caption )
{
TCheckBox *CheckBox = new TCheckBox( Parent );
CheckBox->Parent = Parent;
CheckBox->Left = Left;
CheckBox->Width = Width;
CheckBox->Top = Top;
CheckBox->Height = Height;
CheckBox->Caption = Caption;
return CheckBox;
}
//---------------------------------------------------------------------------
TLabel * __fastcall TPanelPref::CreateLabel( TWinControl *Parent,
int Left, int Width, int Top, int Height, AnsiString Caption,
bool WordWrap )
{
TLabel *Label = new TLabel( Parent );
Label->Parent = Parent;
Label->Caption = Caption;
Label->Left = Left;
Label->Width = Width;
Label->Top = Top;
Label->Height = Height;
Label->WordWrap = WordWrap;
return Label;
}
//---------------------------------------------------------------------------
TEdit * __fastcall TPanelPref::CreateEdit( TWinControl *Parent,
int Left, int Width, int Top, int Height, AnsiString Text )
{
TEdit *Edit = new TEdit( Parent );
Edit->Parent = Parent;
Edit->Left = Left;
Edit->Width = Width;
Edit->Top = Top;
Edit->Height = Height;
Edit->Text = Text;
return Edit;
}
//---------------------------------------------------------------------------
TCSpinEdit * __fastcall TPanelPref::CreateSpinEdit( TWinControl *Parent,
int Left, int Width, int Top, int Height,
long Min, long Max, long Value )
{
TCSpinEdit *SpinEdit = new TCSpinEdit( Parent );
SpinEdit->Parent = Parent;
SpinEdit->Left = Left;
SpinEdit->Width = Width;
SpinEdit->Top = Top;
SpinEdit->Height = Height;
SpinEdit->MinValue = Min;
SpinEdit->MaxValue = Max;
SpinEdit->Value = Value;
return SpinEdit;
}
//---------------------------------------------------------------------------
#define LIBWIN32_PREFSIZE_VPAD 4
#define LIBWIN32_PREFSIZE_HPAD 4
#define LIBWIN32_PREFSIZE_LEFT 16
#define LIBWIN32_PREFSIZE_EDIT_LEFT (LIBWIN32_PREFSIZE_LEFT+32)
#define LIBWIN32_PREFSIZE_WIDTH 375
#define LIBWIN32_PREFSIZE_EDIT_WIDTH (LIBWIN32_PREFSIZE_WIDTH-32)
#define LIBWIN32_PREFSIZE_BUTTON_WIDTH 150
#define LIBWIN32_PREFSIZE_SPINEDIT_WIDTH 100
#define LIBWIN32_PREFSIZE_RIGHT (LIBWIN32_PREFSIZE_LEFT+LIBWIN32_PREFSIZE_WIDTH)
#define LIBWIN32_PREFSIZE_BUTTON_HEIGHT 23
#define LIBWIN32_PREFSIZE_LABEL_HEIGHT 26
#define LIBWIN32_PREFSIZE_CHECKLISTBOX_HEIGHT 120
#define LIBWIN32_PREFSIZE_EDIT_HEIGHT 21
#define LIBWIN32_PREFSIZE_CHECKBOX_HEIGHT 17
#define LIBWIN32_PREFSIZE_SPINEDIT_HEIGHT 21
/****************************************************************************
* Panel for module management
****************************************************************************/
__fastcall TPanelPlugin::TPanelPlugin( TComponent* Owner,
module_config_t *p_config, intf_thread_t *_p_intf,
TStringList * ModuleNames, bool b_multi_plugins )
: TPanelPref( Owner, p_config, _p_intf )
{
this->b_multi_plugins = b_multi_plugins;
this->ModuleNames = ModuleNames;
/* init configure button */
ButtonConfig = CreateButton( this,
LIBWIN32_PREFSIZE_RIGHT - LIBWIN32_PREFSIZE_BUTTON_WIDTH,
LIBWIN32_PREFSIZE_BUTTON_WIDTH,
LIBWIN32_PREFSIZE_VPAD,
LIBWIN32_PREFSIZE_BUTTON_HEIGHT,
"Configure..." );
ButtonConfig->Enabled = false;
ButtonConfig->OnClick = ButtonConfigClick;
/* init label */
AnsiString Text = AnsiString( p_config->psz_text ) + ":";
Label = CreateLabel( this,
LIBWIN32_PREFSIZE_LEFT,
LIBWIN32_PREFSIZE_RIGHT - LIBWIN32_PREFSIZE_BUTTON_WIDTH
- LIBWIN32_PREFSIZE_HPAD,
LIBWIN32_PREFSIZE_VPAD,
LIBWIN32_PREFSIZE_LABEL_HEIGHT,
Text.c_str(), true );
/* vertical alignement */
if ( ButtonConfig->Height > Label->Height )
Label->Top += ( ButtonConfig->Height - Label->Height ) / 2;
else
ButtonConfig->Top += ( Label->Height - ButtonConfig->Height ) / 2;
/* init checklistbox */
ExtCheckListBox = CreateExtCheckListBox( this,
LIBWIN32_PREFSIZE_EDIT_LEFT,
LIBWIN32_PREFSIZE_EDIT_WIDTH,
max( Label->Top + Label->Height , ButtonConfig->Top
+ ButtonConfig->Height ) + LIBWIN32_PREFSIZE_VPAD,
LIBWIN32_PREFSIZE_CHECKLISTBOX_HEIGHT );
ExtCheckListBox->OnClick = CheckListBoxClick;
ExtCheckListBox->OnClickCheck = CheckListBoxClickCheck;
ExtCheckListBox->Hint = p_config->psz_longtext;
ExtCheckListBox->ShowHint = true;
/* init up and down buttons */
if ( b_multi_plugins )
{
ButtonUp = CreateButton ( this, LIBWIN32_PREFSIZE_LEFT,
ExtCheckListBox->Left - LIBWIN32_PREFSIZE_HPAD
- LIBWIN32_PREFSIZE_LEFT,
ExtCheckListBox->Top + ( ExtCheckListBox->Height
- 2*LIBWIN32_PREFSIZE_BUTTON_HEIGHT ) / 3,
LIBWIN32_PREFSIZE_BUTTON_HEIGHT,
"+" );
ButtonUp->Enabled = false;
ButtonUp->OnClick = ButtonUpClick;
ButtonUp->Hint = "Raise the plugin priority";
ButtonUp->ShowHint = true;
ButtonDown = CreateButton ( this, LIBWIN32_PREFSIZE_LEFT,
ExtCheckListBox->Left - LIBWIN32_PREFSIZE_HPAD
- LIBWIN32_PREFSIZE_LEFT,
ExtCheckListBox->Top + ( ExtCheckListBox->Height
- 2*LIBWIN32_PREFSIZE_BUTTON_HEIGHT ) * 2 / 3
+ LIBWIN32_PREFSIZE_BUTTON_HEIGHT,
LIBWIN32_PREFSIZE_BUTTON_HEIGHT,
"-" );
ButtonDown->Enabled = false;
ButtonDown->OnClick = ButtonDownClick;
ButtonDown->Hint = "Decrease the plugin priority";
ButtonDown->ShowHint = true;
}
else
{
ButtonUp = NULL;
ButtonDown = NULL;
}
/* panel height */
Height = ExtCheckListBox->Top + ExtCheckListBox->Height
+ LIBWIN32_PREFSIZE_VPAD;
};
//---------------------------------------------------------------------------
void __fastcall TPanelPlugin::CheckListBoxClick( TObject *Sender )
{
module_t *p_parser;
vlc_list_t *p_list;
int i_index;
/* check that the click is valid (we are on an item, and the click
* started on an item */
if( ExtCheckListBox->ItemIndex == -1 )
{
if ( ButtonUp != NULL ) ButtonUp->Enabled = false;
if ( ButtonDown != NULL ) ButtonDown->Enabled = false;
return;
}
AnsiString Name = ModuleNames->Strings
[ExtCheckListBox->GetItemData(ExtCheckListBox->ItemIndex)];
if( Name == "" )
return;
/* enable up and down buttons */
if ( b_multi_plugins && ButtonUp != NULL && ButtonDown != NULL )
{
if ( ExtCheckListBox->ItemIndex == 0 )
ButtonUp->Enabled = false; else ButtonUp->Enabled = true;
if ( ExtCheckListBox->ItemIndex
== ExtCheckListBox->Items->Count - 1 )
ButtonDown->Enabled = false; else ButtonDown->Enabled = true;
}
/* look for module 'Name' */
p_list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
for( i_index = 0; i_index < p_list->i_count; i_index++ )
{
p_parser = (module_t *)p_list->p_values[i_index].p_object ;
if( strcmp( p_parser->psz_object_name, Name.c_str() ) == 0 )
{
ModuleSelected = p_parser;
ButtonConfig->Enabled =
p_parser->i_config_items ? true : false;
break;
}
}
vlc_list_release( p_list );
}
//---------------------------------------------------------------------------
void __fastcall TPanelPlugin::CheckListBoxClickCheck( TObject *Sender )
{
if ( ! b_multi_plugins )
{
/* one item maximum must be checked */
if( ExtCheckListBox->Checked[ExtCheckListBox->ItemIndex] )
{
for( int item = 0; item < ExtCheckListBox->Items->Count; item++ )
{
if( item != ExtCheckListBox->ItemIndex )
{
ExtCheckListBox->Checked[item] = false;
}
}
}
}
}
//---------------------------------------------------------------------------
void __fastcall TPanelPlugin::ButtonConfigClick( TObject *Sender )
{
p_intf->p_sys->p_window->
CreatePreferences( ModuleSelected->psz_object_name );
}
//---------------------------------------------------------------------------
void __fastcall TPanelPlugin::ButtonUpClick( TObject *Sender )
{
if( ExtCheckListBox->ItemIndex != -1 && ExtCheckListBox->ItemIndex > 0 )
{
int Pos = ExtCheckListBox->ItemIndex;
ExtCheckListBox->Items->Move ( Pos , Pos - 1 );
ExtCheckListBox->ItemIndex = Pos - 1;
CheckListBoxClick ( Sender );
}
}
//---------------------------------------------------------------------------
void __fastcall TPanelPlugin::ButtonDownClick( TObject *Sender )
{
if( ExtCheckListBox->ItemIndex != -1
&& ExtCheckListBox->ItemIndex < ExtCheckListBox->Items->Count - 1 )
{
int Pos = ExtCheckListBox->ItemIndex;
ExtCheckListBox->Items->Move ( Pos , Pos + 1 );
ExtCheckListBox->ItemIndex = Pos + 1;
CheckListBoxClick ( Sender );
}
}
//---------------------------------------------------------------------------
void __fastcall TPanelPlugin::SetValue ( AnsiString Values )
{
int TopChecked = 0;
while ( Values.Length() != 0 )
{
AnsiString Value;
int NextValue = Values.Pos ( "," );
if ( NextValue == 0 )
{
Value = Values.Trim();
Values = "";
}
else
{
Value = Values.SubString(1,NextValue-1).Trim();
Values = Values.SubString ( NextValue + 1
, Values.Length() - NextValue );
}
if ( Value.Length() > 0 )
{
for ( int i = TopChecked; i < ExtCheckListBox->Items->Count; i++ )
{
if ( ModuleNames->Strings[ExtCheckListBox->GetItemData(i)]
== Value )
{
ExtCheckListBox->Checked[i] = true;
ExtCheckListBox->Items->Move ( i , TopChecked );
TopChecked++;
}
}
}
}
}
//---------------------------------------------------------------------------
void __fastcall TPanelPlugin::UpdateChanges()
{
AnsiString Name = "";
/* find the selected plugin (if any) */
for( int item = 0; item < ExtCheckListBox->Items->Count; item++ )
{
if( ExtCheckListBox->Checked[item] )
{
if ( Name.Length() == 0 )
{
Name = ModuleNames->Strings
[ExtCheckListBox->GetItemData(item)];
}
else
{
Name = Name + "," + ModuleNames->Strings
[ExtCheckListBox->GetItemData(item)];
}
}
}
config_PutPsz( p_intf, p_config->psz_name,
Name.Length() ? Name.c_str() : NULL );
}
/****************************************************************************
* Panel for string management
****************************************************************************/
__fastcall TPanelString::TPanelString( TComponent* Owner,
module_config_t *p_config, intf_thread_t *_p_intf )
: TPanelPref( Owner, p_config, _p_intf )
{
/* init description label */
AnsiString Text = AnsiString ( p_config->psz_text ) + ":";
Label = CreateLabel( this,
LIBWIN32_PREFSIZE_LEFT,
LIBWIN32_PREFSIZE_WIDTH,
LIBWIN32_PREFSIZE_VPAD,
LIBWIN32_PREFSIZE_LABEL_HEIGHT,
Text.c_str(), true );
/* init edit */
Edit = CreateEdit( this,
LIBWIN32_PREFSIZE_EDIT_LEFT,
LIBWIN32_PREFSIZE_EDIT_WIDTH,
LIBWIN32_PREFSIZE_VPAD + Label->Height + LIBWIN32_PREFSIZE_VPAD,
LIBWIN32_PREFSIZE_EDIT_HEIGHT, "" );
vlc_mutex_lock( p_config->p_lock );
Edit->Text = p_config->psz_value ? p_config->psz_value : "";
vlc_mutex_unlock( p_config->p_lock );
Edit->Hint = p_config->psz_longtext;
Edit->ShowHint = true;
/* panel height */
Height = LIBWIN32_PREFSIZE_VPAD + Label->Height + LIBWIN32_PREFSIZE_VPAD
+ Edit->Height + LIBWIN32_PREFSIZE_VPAD;
};
//---------------------------------------------------------------------------
void __fastcall TPanelString::UpdateChanges()
{
config_PutPsz( p_intf, p_config->psz_name,
Edit->Text.Length() ? Edit->Text.c_str() : NULL );
}
/****************************************************************************
* Panel for integer management
****************************************************************************/
__fastcall TPanelInteger::TPanelInteger( TComponent* Owner,
module_config_t *p_config, intf_thread_t *_p_intf )
: TPanelPref( Owner, p_config, _p_intf )
{
/* init description label */
AnsiString Text = AnsiString ( p_config->psz_text ) + ":";
Label = CreateLabel( this,
LIBWIN32_PREFSIZE_LEFT,
LIBWIN32_PREFSIZE_WIDTH - LIBWIN32_PREFSIZE_SPINEDIT_WIDTH
- LIBWIN32_PREFSIZE_HPAD,
LIBWIN32_PREFSIZE_VPAD,
LIBWIN32_PREFSIZE_LABEL_HEIGHT, Text.c_str(), true );
/* init spinedit */
SpinEdit = CreateSpinEdit( this,
LIBWIN32_PREFSIZE_RIGHT - LIBWIN32_PREFSIZE_SPINEDIT_WIDTH,
LIBWIN32_PREFSIZE_SPINEDIT_WIDTH,
LIBWIN32_PREFSIZE_VPAD,
LIBWIN32_PREFSIZE_SPINEDIT_HEIGHT,
-1, 100000, p_config->i_value );
SpinEdit->Hint = p_config->psz_longtext;
SpinEdit->ShowHint = true;
/* vertical alignement and panel height */
if ( SpinEdit->Height > Label->Height )
{
Label->Top += ( SpinEdit->Height - Label->Height ) / 2;
Height = SpinEdit->Top + SpinEdit->Height + LIBWIN32_PREFSIZE_VPAD;
}
else
{
SpinEdit->Top += ( Label->Height - SpinEdit->Height ) / 2;
Height = Label->Top + Label->Height + LIBWIN32_PREFSIZE_VPAD;
}
};
//---------------------------------------------------------------------------
void __fastcall TPanelInteger::UpdateChanges()
{
/* Warning: we're casting from long to int */
config_PutInt( p_intf, p_config->psz_name, (int)SpinEdit->Value );
}
/****************************************************************************
* Panel for float management
****************************************************************************/
__fastcall TPanelFloat::TPanelFloat( TComponent* Owner,
module_config_t *p_config, intf_thread_t *_p_intf )
: TPanelPref( Owner, p_config, _p_intf )
{
#define MAX_FLOAT_CHARS 20
/* init description label */
AnsiString Text = AnsiString( p_config->psz_text ) + ":";
Label = CreateLabel( this,
LIBWIN32_PREFSIZE_LEFT,
LIBWIN32_PREFSIZE_WIDTH,
LIBWIN32_PREFSIZE_VPAD,
LIBWIN32_PREFSIZE_LABEL_HEIGHT,
Text.c_str(), true );
/* init edit */
char *psz_value = (char *)malloc( MAX_FLOAT_CHARS );
snprintf( psz_value, MAX_FLOAT_CHARS, "%f", p_config->f_value );
/* we use the spinedit size, to be similar with the integers */
Edit = CreateEdit( this,
LIBWIN32_PREFSIZE_RIGHT - LIBWIN32_PREFSIZE_SPINEDIT_WIDTH,
LIBWIN32_PREFSIZE_SPINEDIT_WIDTH,
LIBWIN32_PREFSIZE_VPAD,
LIBWIN32_PREFSIZE_SPINEDIT_HEIGHT,
psz_value );
free( psz_value );
Edit->Hint = p_config->psz_longtext;
Edit->ShowHint = true;
/* vertical alignement and panel height */
if ( Edit->Height > Label->Height )
{
Label->Top += ( Edit->Height - Label->Height ) / 2;
Height = Edit->Top + Edit->Height + LIBWIN32_PREFSIZE_VPAD;
}
else
{
Edit->Top += ( Label->Height - Edit->Height ) / 2;
Height = Label->Top + Label->Height + LIBWIN32_PREFSIZE_VPAD;
}
#undef MAX_FLOAT_CHARS
};
//---------------------------------------------------------------------------
void __fastcall TPanelFloat::UpdateChanges()
{
/* Warning: we're casting from double to float */
config_PutFloat( p_intf, p_config->psz_name, atof( Edit->Text.c_str() ) );
}
/****************************************************************************
* Panel for boolean management
****************************************************************************/
__fastcall TPanelBool::TPanelBool( TComponent* Owner,
module_config_t *p_config, intf_thread_t *_p_intf )
: TPanelPref( Owner, p_config, _p_intf )
{
/* init checkbox */
CheckBox = CreateCheckBox( this,
LIBWIN32_PREFSIZE_LEFT,
LIBWIN32_PREFSIZE_WIDTH,
LIBWIN32_PREFSIZE_VPAD,
LIBWIN32_PREFSIZE_CHECKBOX_HEIGHT, p_config->psz_text );
CheckBox->Checked = p_config->i_value;
CheckBox->Hint = p_config->psz_longtext;
CheckBox->ShowHint = true;
/* panel height */
Height = LIBWIN32_PREFSIZE_VPAD + CheckBox->Height + LIBWIN32_PREFSIZE_VPAD;
};
//---------------------------------------------------------------------------
void __fastcall TPanelBool::UpdateChanges()
{
config_PutInt( p_intf, p_config->psz_name, CheckBox->Checked ? 1 : 0 );
}
/****************************************************************************
* Callbacks for the dialog
****************************************************************************/
__fastcall TPreferencesDlg::TPreferencesDlg( TComponent* Owner,
intf_thread_t *_p_intf ) : TForm( Owner )
{
p_intf = _p_intf;
Icon = p_intf->p_sys->p_window->Icon;
Application->HintHidePause = 0x1000000;
HintWindowClass = __classid ( TNarrowHintWindow );
ModuleNames = new TStringList();
/* prevent the form from being resized horizontally */
Constraints->MinWidth = Width;
Constraints->MaxWidth = Width;
}
//---------------------------------------------------------------------------
__fastcall TPreferencesDlg::~TPreferencesDlg()
{
delete ModuleNames;
}
//---------------------------------------------------------------------------
void __fastcall TPreferencesDlg::FormClose( TObject *Sender,
TCloseAction &Action )
{
Action = caHide;
}
/****************************************************************************
* CreateConfigDialog: dynamically creates the configuration dialog
* box from all the configuration data provided by the selected module.
****************************************************************************/
#define ADD_PANEL \
{ \
Panel = new TPanel( this ); \
Panel->Parent = ScrollBox; \
Panel->Caption = ""; \
Panel->BevelOuter = bvNone; \
Panel->Height = 12; \
}
void __fastcall TPreferencesDlg::CreateConfigDialog( char *psz_module_name )
{
module_t *p_parser;
vlc_list_t *p_list;
int i_index;
module_config_t *p_item;
int i_pages, i_ctrl;
TTabSheet *TabSheet;
TScrollBox *ScrollBox = NULL;
TPanel *Panel;
TPanelPlugin *PanelPlugin;
TPanelString *PanelString;
TPanelInteger *PanelInteger;
TPanelFloat *PanelFloat;
TPanelBool *PanelBool;
/* Look for the selected module */
p_list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
for( i_index = 0; i_index < p_list->i_count; i_index++ )
{
p_parser = (module_t *)p_list->p_values[i_index].p_object ;
if( psz_module_name
&& !strcmp( psz_module_name, p_parser->psz_object_name ) )
{
break;
}
}
if( !p_parser || i_index == p_list->i_count )
{
vlc_list_release( p_list );
return;
}
/*
* We found it, now we can start building its configuration interface
*/
/* Enumerate config options and add corresponding config boxes */
p_item = p_parser->p_config;
if( p_item ) do
{
if( p_item->b_advanced && !config_GetInt( p_intf, "advanced" ) )
{
continue;
}
switch( p_item->i_type )
{
case CONFIG_HINT_CATEGORY:
/* create a new tabsheet. */
TabSheet = new TTabSheet( this );
TabSheet->PageControl = PageControlPref;
TabSheet->Caption = p_item->psz_text;
TabSheet->Visible = true;
/* pack a scrollbox into the tabsheet */
ScrollBox = new TScrollBox( this );
ScrollBox->Parent = TabSheet;
ScrollBox->Align = alClient;
ScrollBox->BorderStyle = bsNone;
ScrollBox->HorzScrollBar->Tracking = true;
ScrollBox->VertScrollBar->Tracking = true;
/* add a panel as top margin */
ADD_PANEL;
break;
case CONFIG_ITEM_MODULE:
/* add new panel for the config option */
PanelPlugin =
new TPanelPlugin( this, p_item, p_intf, ModuleNames, true );
PanelPlugin->Parent = ScrollBox;
/* Look for valid modules */
for( i_index = 0; i_index < p_list->i_count; i_index++ )
{
p_parser = (module_t *)p_list->p_values[i_index].p_object ;
if( !strcmp( p_parser->psz_capability, p_item->psz_type ) )
{
AnsiString ModuleDesc;
if ( p_parser->psz_longname != NULL ) {
ModuleDesc = AnsiString( p_parser->psz_longname ) +
" (" + AnsiString( p_parser->psz_object_name ) +
")";
}
else
ModuleDesc = AnsiString( p_parser->psz_object_name );
// add a reference to the module name string
// in the list item object
PanelPlugin->ExtCheckListBox->SetItemData (
PanelPlugin->ExtCheckListBox->Items->Add(ModuleDesc)
, ModuleNames->Add( p_parser->psz_object_name ) );
}
}
/* check relevant boxes */
PanelPlugin->SetValue ( AnsiString ( p_item->psz_value ) );
break;
case CONFIG_ITEM_FILE:
case CONFIG_ITEM_STRING:
/* add new panel for the config option */
PanelString = new TPanelString( this, p_item, p_intf );
PanelString->Parent = ScrollBox;
break;
case CONFIG_ITEM_INTEGER:
/* add new panel for the config option */
PanelInteger = new TPanelInteger( this, p_item, p_intf );
PanelInteger->Parent = ScrollBox;
break;
case CONFIG_ITEM_FLOAT:
/* add new panel for the config option */
PanelFloat = new TPanelFloat( this, p_item, p_intf );
PanelFloat->Parent = ScrollBox;
break;
case CONFIG_ITEM_BOOL:
/* add new panel for the config option */
PanelBool = new TPanelBool( this, p_item, p_intf );
PanelBool->Parent = ScrollBox;
break;
default:
msg_Warn( p_intf, "unknown config type: %i", p_item->i_type );
break;
}
}
while( p_item->i_type != CONFIG_HINT_END && p_item++ );
/* Reorder panels inside the tabsheets */
for( i_pages = 0; i_pages < PageControlPref->PageCount; i_pages++ )
{
/* get scrollbox from the tabsheet */
ScrollBox = (TScrollBox *)PageControlPref->Pages[i_pages]->Controls[0];
/* add a panel as bottom margin */
ADD_PANEL;
for( i_ctrl = ScrollBox->ControlCount - 1; i_ctrl >= 0 ; i_ctrl-- )
{
ScrollBox->Controls[i_ctrl]->Align = alTop;
}
}
vlc_list_release( p_list );
/* set active tabsheet
* FIXME: i don't know why, but both lines are necessary */
PageControlPref->ActivePageIndex = 1;
PageControlPref->ActivePageIndex = 0;
}
#undef ADD_PANEL
//---------------------------------------------------------------------------
void __fastcall TPreferencesDlg::ButtonOkClick( TObject *Sender )
{
ButtonApplyClick( Sender );
Hide();
}
//---------------------------------------------------------------------------
void __fastcall TPreferencesDlg::ButtonApplyClick( TObject *Sender )
{
TScrollBox *ScrollBox;
TPanelPref *Panel;
int i, j;
for( i = 0; i < PageControlPref->PageCount; i++ )
{
/* get scrollbox from the tabsheet */
ScrollBox = (TScrollBox *)PageControlPref->Pages[i]->Controls[0];
for( j = 0; j < ScrollBox->ControlCount ; j++ )
{
/* skip the panels */
if( ScrollBox->Controls[j]->InheritsFrom( __classid( TPanelPref ) ) )
{
Panel = (TPanelPref *)ScrollBox->Controls[j];
Panel->UpdateChanges();
}
}
}
}
//---------------------------------------------------------------------------
void __fastcall TPreferencesDlg::ButtonSaveClick( TObject *Sender )
{
ButtonApplyClick( Sender );
config_SaveConfigFile( p_intf, NULL );
}
//---------------------------------------------------------------------------
void __fastcall TPreferencesDlg::ButtonCancelClick( TObject *Sender )
{
Hide();
}
//---------------------------------------------------------------------------
object PreferencesDlg: TPreferencesDlg
Tag = 3
Left = 310
Top = 125
Width = 458
Height = 588
Anchors = [akTop, akRight]
Caption = 'Preferences'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
Icon.Data = {
0000010001003030000001001800A81C00001600000028000000300000006000
00000100180000000000001B0000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000069375900000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000120E0A4011253E0F18000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000F0B
084143CA08070016430F08040800000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000003127291203174647E8464AE808010840E54039E6390B0C06
0E0A1C0000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0070CD0079DD0079DD0070CD0000000000000000000C1008261D6E4647E54547
E64748E105040039E6393AE53939E63936D33308030100000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000070CD0079DD0079DE007DE40088F9008CFF008CFF0088F9007CE302
6EC70B09124641DC4444DF4546E34446E54847E003040040E6403AEA3A3EE33E
3CE33C39E639080F010801050000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000070CD0079DD0077D90070CB0078D8007BDC007BDC007BDC
007BDC007BDC007BDD007EE32E232D0804084553F14250F34252ED4449DB4844
DC4645E208010540E5401C78150D18053CE63C3AE63A39EA393CD83C241A2006
0402000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000070CD0079DD007ADF007BDE007BDC0072
CC005188004877004876004876004876034976054A760B4D7731434221175B42
54EC4253EE4252F60B05104250F44252EB4546DA08010539E6392BAA2B080105
3CE63C39E7393AE63A39E93939E839081208181C080000000000000000000000
000000000000000000000000000000000000000070CD0079DD0079DD007CE300
88F90089F90075D2005188004877005188008CFF008CFF008CFF008CFF008CFF
1092FF2099FF31A0FF1408294840DB4550E1464EEA0C060B0B05084654F64653
F64453EF080E033AE63A2BAA2B03030339E33939DF3939E639080F083DDB3D24
9C24434B3B000000000000000000000000000000000000000000000000000000
0063B60085F3008BFE0088F9007FE90088F90080E8005CA0008CFF008CFF008C
FF008CFF008CFF008CFF008CFF048DFF1594FF259BFF35A2FF0C04103F38C754
5AF7505BF10C08100801084352F64652F44253F30813053AE63A39E639030403
1C521826A1250812010807032454131558150000000000000000000000000000
000000000000000000000000000000000000000070CD007CE30079DD00000000
7CE30089FA008CFF0089FA008CFF008CFF008CFF008CFF008CFF008CFF098FFF
1996FF2A9DFF3AA4FF0804103A2AA34E58F74E58F40B0B120803054652F34548
E64451F305130532CA323AE23A03070308070307040008040139E63939E43931
B42F5E1347000000000000000000000000000000000000000000000000000000
0000000000000000000061B10000000079DD008CFF008CFF008CFF008CFF008C
FF008CFF008CFF008CFF008CFF0E91FF1E98FF2E9FFF3FA6FF040408382BAF4D
5AEF555AF70F12250501050F04160804074250F3121A123AE93A39E239080803
0D2F08010401268C2539E7393DE63D3FE23E0804100000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
79DD008CFF008CFF008CFF008CFF008CFF008CFF008CFF008CFF028CFF1293FF
239AFF33A1FF43A8FF0802083A2AA3565BF7555AF71714330501050104000801
07424FF12828203AEA3A39E639030703182F1008340801040139E7393DE83D39
E939080400000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000070CD0088F9008CFF008CFF008CFF008C
FF008CFF008CFF008CFF078EFF1795FF279CFF38A3FF48AAFF0808005151F155
5AF30804030804000504050800082E358E0E0C1F1D192439E53940E640080400
2AA12739E63908020708010539E8393BE93B0804080000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000007CE3008CFF008CFF008CFF058EFD1D96F92398F8269AFA31A0FC42A8FF
4FAEFF5CB3FF65B7FF0C08084F5AF14E57F50B04080804043639A54647E81C13
49363AA70804080F120835953439E7393EE63E39DF3939EA39081105308A2B3F
E73F080601000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000047BDB1D96F92398F82498F83BA0
F399C1E1B1C9DDBCD4E7CBE0F3D9EDFFDCEEFFDEEFFFCDE8FF080808575BF750
58F624125A5057F34845DF4A41E0150E30C55734E3723EC56E33A23D27050105
39E43939E63939E6393CE63C14420C3BE03B192A090000000000000000000000
0000000000000000000000000000000000000000000000000000000000000004
04042D88D399C1E1B1C9DDB1C9DCB7CBDBCFD3D7D5D5D6E2E2E3F0F0F1FEFEFF
FEFEFFFEFEFFF9FCFF0C08085D61F15B61EF555AF64A4FE13937BB0E0A12DE74
39E1733CDE713CDF753AE67541C36B342C231F17141B3AE63A39E7393DE83D39
E93939DE39000000000000000000000000000000000000000000000000000000
0000000000000000000000000000001818186893B8C3CCD2D5D5D6D5D5D6D5D5
D6D6D6D6D6D6D6E3E3E3F1F1F1FFFFFFFFFFFFFFFFFFFFFFFF140C145C5EF668
63F75555EA10061CC3673FDF713A0C1104080403080105080007070407D56F36
DE743EDE72401C200C29452939E63939E73939EA390000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000343434A2B4C2D5D5D6D6D6D6D6D6D6D6D6D6D5D5D6E2E2E3F0F0F1FEFEFF
FEFEFFFEFEFFFEFEFF20161C5C5EF6373EAE0E0413E2713DE1763CCD6A3C2A0D
08A44B2CDE743EBD612F080401030403E1713CDE7239DE713AE1723C22201139
C13341E641000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000001B1B1B99AEBED5D5D6D5D5D6D5D5
D6CFD3D7B8CBDBBFD5E7CEE2F3DCEFFFDFF0FFE2F1FFE9F4FF10100C3639A46E
4540DE7239DE713DE1713C07000784261CDE7639E3743E0812001F0407D86E36
E3753EE57540E57541DE763CDE733DD26637493C387E2F7B0000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00001B1B1B99AEBFCED3D7B7CBDBB1C9DD99C1E140A2F339A2FA49AAFC59B2FF
66B8FF74BEFF92CBFFD9ECFF0F0402C66531DE7139E2733D854B1E0A01084D11
0DE3733EE1723CDF713ADF753AE1763C1D0A08290708E57140E1763CDE733DC7
6B34080408000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000001818187FA5C399C1E13BA0F32498
F81D96F91091FD1C97FF2C9EFF3CA5FF4DACFF5DB3FF71BBFF8DC8FF9FD0FF08
0400080406B95C2EDE7239070B070803014D1615DE723CDE7540E5714030090D
0504003A120FE67541DE75390808044A0C290000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000707071778C81C92F3058EFD008CFF008CFF1092FF2099FF31A0FF41A7FF
51AEFF62B5FF72BCFF7BBFFF7BBBF96E9FCD0808080806041D0508E571403E22
0C200708080405070407070007080303B05F31DE723967301908010500000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000007CE3008CFF008C
FF048DFF1594FF259BFF35A2FF46A9FF56B0FF66B7FF77BEFF7BBFFF6DAAE300
0000000000000000000000080401200C088D4024E17141E57140DF713ADE713E
DE76390801070000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000079DD008CFF008CFF098FFF1996FF2A9DFF3AA4FF4AABFF
5BB2FF6BB9FF7BBFFF7BBFFF6AA5DD0000000000000000000000000000001D1A
0C1A0F08110903441912E57140623B1E08020300000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000079DD008CFF008C
FF0E91FF1E98FF2E9FFF3FA6FF4FADFF5FB4FF70BBFF7BBFFF78BAF96299CD00
00000000000000000000000000000000000000003914100000005A2411000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000070CD0088F9078EFD2C9CF940A3F850ACFA60B4FC70BCFF
7DC2FF87C6FF7EC0FF6DAAE30000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000707071A85DD40A2
F3A0C3E1B7CBDDC6D8E7D4E5F3E2F1FFE5F2FFD9ECFF9FD0FF7AACDD05050500
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000001818187FA5C3B8CBDBD0D4D7D5D5D6E2E2E3F0F0F1FEFEFF
FEFEFFFAFCFFE2EDF99FB7CD1C1C1C0000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000001B1B1B99AEBFD4D5
D6D6D6D6D6D6D6E3E3E3F1F1F1FFFFFFFFFFFFFEFEFFD1DAE33E3E3E00000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000001D1D1D7B9BB4CACED1D6D6D6D5D5D6E2E2E3F0F0F1FEFEFF
FEFEFFFEFEFFC9D2DD2121210000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000343434A5B5
C2CFD3D7BFCEDBC9D9E7D7E6F3E6F3FFECF5FFF0F4F9AEBDCD23232300000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000018181887A8C3A6C6E169B3F367B6FA77BEFC88C6FF
9FD0FFB4CBE33939390000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000040404338C
D749A8F947A9FD54AFFF64B6FF74BDFF7EC0FF76ABDD05050500000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000001F7DCD369FF948AAFF58B1FF69B8FF79BFFF
78BAF96299CD0000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
003592E34DACFF5DB3FF6DBAFF7BBFFF6DAAE300000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000003890DD51AEFF62B5FF72BCFF7BBFFF
6AA5DD0000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
003B8FD84C9CE3589FDE69A9E375B6F46299CD00000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000003376B00000000000000000005788B6
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000006CC61A83DD247FCC00000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000006DC71A83DD2686D71F6EB1
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000FFFF
FFFFFFFF0000FFFFFFFFFFFF0000FFFFFE1FDFFF0000FFFFE0078FFF0000FFFE
000007FF0000FFF0000001FF0000FF80000000FF0000FF000000003F0000FF00
0000000F0000FE00000000070000F800000000070000F8000000000F0000FC00
000000070000FE00000000070000FF80000000070000FFC0000000070000FFE0
000000070000FFE0000000070000FFE0000000070000FFE0000000070000FFF0
000000070000FFF0000000030000FFF0000000070000FFF00000000F0000FFF0
0000003F0000FFF8000E00FF0000FFF8000F01FF0000FFF8000FD7FF0000FFF8
001FFFFF0000FFFC001FFFFF0000FFFC001FFFFF0000FFFC003FFFFF0000FFFC
003FFFFF0000FFFE003FFFFF0000FFFE007FFFFF0000FFFE007FFFFF0000FFFE
007FFFFF0000FFFF00FFFFFF0000FFFF00FFFFFF0000FFFF00FFFFFF0000FFFF
01FFFFFF0000FFFF01FFFFFF0000FFFF81FFFFFF0000FFFFC3FFFFFF0000FFFF
FFFFFFFF0000FFFFFFFFFFFF0000FFFFFFFFFFFF0000FFFFFFFFFFFF0000}
OldCreateOrder = False
Position = poDefaultPosOnly
OnClose = FormClose
PixelsPerInch = 96
TextHeight = 13
object PageControlPref: TPageControl
Left = 8
Top = 8
Width = 433
Height = 512
Anchors = [akLeft, akTop, akRight, akBottom]
MultiLine = True
TabOrder = 0
end
object ButtonApply: TButton
Tag = 3
Left = 284
Top = 528
Width = 75
Height = 23
Anchors = [akRight, akBottom]
Caption = 'Apply'
TabOrder = 3
OnClick = ButtonApplyClick
end
object ButtonSave: TButton
Tag = 3
Left = 367
Top = 528
Width = 75
Height = 23
Anchors = [akRight, akBottom]
Caption = 'Save'
TabOrder = 4
OnClick = ButtonSaveClick
end
object ButtonOK: TButton
Tag = 3
Left = 118
Top = 528
Width = 75
Height = 23
Anchors = [akRight, akBottom]
Caption = 'OK'
Default = True
ModalResult = 1
TabOrder = 1
OnClick = ButtonOkClick
end
object ButtonCancel: TButton
Tag = 3
Left = 201
Top = 528
Width = 75
Height = 23
Anchors = [akRight, akBottom]
Cancel = True
Caption = 'Cancel'
ModalResult = 2
TabOrder = 2
OnClick = ButtonCancelClick
end
end
/*****************************************************************************
* preferences.h: the "Preferences" dialog box
*****************************************************************************
* Copyright (C) 2002-2003 VideoLAN
*
* Authors: Olivier Teuliere <ipkiss@via.ecp.fr>
* Boris Dores <babal@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef preferencesH
#define preferencesH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <Buttons.hpp>
#include <ComCtrls.hpp>
#include <CheckLst.hpp>
#include <ExtCtrls.hpp>
#include "CSPIN.h"
//---------------------------------------------------------------------------
/* A TCheckListBox that can associate an integer to each string item */
class TExtCheckListBox : public TCheckListBox
{
public:
DYNAMIC void __fastcall SetItemData(int Index, int AData) {
TCheckListBox::SetItemData ( Index , AData );
}
DYNAMIC int __fastcall GetItemData(int Index) {
return TCheckListBox::GetItemData ( Index );
}
__fastcall TExtCheckListBox( Classes::TComponent* AOwner )
: TCheckListBox( AOwner ) {};
};
//---------------------------------------------------------------------------
/* A THintWindow with a limited width */
class TNarrowHintWindow : public THintWindow
{
public:
virtual void __fastcall ActivateHint( const Windows::TRect &Rect,
const System::AnsiString AHint );
};
//---------------------------------------------------------------------------
class TPanelPref : public TPanel
{
public:
__fastcall TPanelPref( TComponent* Owner, module_config_t *_p_config,
intf_thread_t *_p_intf );
virtual void __fastcall UpdateChanges() = 0;
protected:
module_config_t * p_config;
intf_thread_t * p_intf;
TExtCheckListBox * __fastcall CreateExtCheckListBox(TWinControl *Parent,
int Left, int Width, int Top, int Height );
TButton * __fastcall CreateButton( TWinControl *Parent,
int Left, int Width, int Top, int Height, AnsiString Caption );
TCheckBox * __fastcall CreateCheckBox( TWinControl *Parent,
int Left, int Width, int Top, int Height, AnsiString Caption );
TLabel * __fastcall CreateLabel( TWinControl *Parent,
int Left, int Width, int Top, int Height, AnsiString Caption,
bool WordWrap );
TEdit * __fastcall CreateEdit( TWinControl *Parent,
int Left, int Width, int Top, int Height, AnsiString Text );
TCSpinEdit * __fastcall CreateSpinEdit( TWinControl *Parent,
int Left, int Width, int Top, int Height,
long Min, long Max, long Value );
};
//---------------------------------------------------------------------------
class TPanelPlugin : public TPanelPref
{
module_t *ModuleSelected;
public:
__fastcall TPanelPlugin( TComponent* Owner, module_config_t *p_config,
intf_thread_t *_p_intf, TStringList * ModuleNames,
bool b_multi_plugins );
bool b_multi_plugins;
TExtCheckListBox *ExtCheckListBox;
TButton *ButtonConfig;
TButton *ButtonUp;
TButton *ButtonDown;
TLabel *Label;
TStringList * ModuleNames;
virtual void __fastcall TPanelPlugin::SetValue ( AnsiString Values );
virtual void __fastcall UpdateChanges();
void __fastcall CheckListBoxClick( TObject *Sender );
void __fastcall CheckListBoxClickCheck( TObject *Sender );
void __fastcall ButtonConfigClick( TObject *Sender );
void __fastcall ButtonUpClick( TObject *Sender );
void __fastcall ButtonDownClick( TObject *Sender );
};
//---------------------------------------------------------------------------
class TPanelString : public TPanelPref
{
public:
__fastcall TPanelString( TComponent* Owner, module_config_t *p_config,
intf_thread_t *_p_intf );
TLabel *Label;
TEdit *Edit;
virtual void __fastcall UpdateChanges();
};
//---------------------------------------------------------------------------
class TPanelInteger : public TPanelPref
{
public:
__fastcall TPanelInteger( TComponent* Owner, module_config_t *p_config,
intf_thread_t *_p_intf );
TLabel *Label;
TCSpinEdit *SpinEdit;
virtual void __fastcall UpdateChanges();
};
//---------------------------------------------------------------------------
class TPanelFloat : public TPanelPref
{
public:
__fastcall TPanelFloat( TComponent* Owner, module_config_t *p_config,
intf_thread_t *_p_intf );
TLabel *Label;
TEdit *Edit;
virtual void __fastcall UpdateChanges();
};
//---------------------------------------------------------------------------
class TPanelBool : public TPanelPref
{
public:
__fastcall TPanelBool( TComponent* Owner, module_config_t *p_config,
intf_thread_t *_p_intf );
TCheckBox *CheckBox;
virtual void __fastcall UpdateChanges();
};
//---------------------------------------------------------------------------
class TPreferencesDlg : public TForm
{
__published: // IDE-managed Components
TPageControl *PageControlPref;
TButton *ButtonApply;
TButton *ButtonSave;
TButton *ButtonOK;
TButton *ButtonCancel;
void __fastcall ButtonOkClick( TObject *Sender );
void __fastcall ButtonApplyClick( TObject *Sender );
void __fastcall ButtonSaveClick( TObject *Sender );
void __fastcall ButtonCancelClick( TObject *Sender );
void __fastcall FormClose( TObject *Sender, TCloseAction &Action );
private: // User declarations
intf_thread_t *p_intf;
TStringList * ModuleNames;
public: // User declarations
__fastcall TPreferencesDlg( TComponent* Owner, intf_thread_t *_p_intf );
virtual __fastcall ~TPreferencesDlg();
void __fastcall CreateConfigDialog( char *psz_module_name );
};
//---------------------------------------------------------------------------
#endif
/*****************************************************************************
* sout.cpp: the stream ouput dialog box
*****************************************************************************
* Copyright (C) 2002-2003 VideoLAN
* $Id: sout.cpp,v 1.4 2003/01/26 03:55:36 ipkiss Exp $
*
* Authors: Olivier Teuliere <ipkiss@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include <vcl.h>
#pragma hdrstop
#include <vlc/vlc.h>
#include <vlc/intf.h>
#include "sout.h"
#include "misc.h"
#include "win32_common.h"
//---------------------------------------------------------------------------
#pragma link "CSPIN"
#pragma resource "*.dfm"
//---------------------------------------------------------------------------
__fastcall TSoutDlg::TSoutDlg( TComponent* Owner, intf_thread_t *_p_intf )
: TForm( Owner )
{
p_intf = _p_intf;
PanelAccess->BevelOuter = bvNone;
PanelMux->BevelOuter = bvNone;
Translate( this );
}
//---------------------------------------------------------------------------
void __fastcall TSoutDlg::ButtonBrowseClick( TObject *Sender )
{
if( OpenDialog1->Execute() )
{
EditFile->Text = OpenDialog1->FileName;
RebuildMrl();
};
}
//---------------------------------------------------------------------------
void __fastcall TSoutDlg::CustomEditChange( TObject *Sender )
{
RebuildMrl();
}
//---------------------------------------------------------------------------
void __fastcall TSoutDlg::RadioButtonMuxClick( TObject *Sender )
{
RebuildMrl();
}
//---------------------------------------------------------------------------
void __fastcall TSoutDlg::RadioButtonAccessClick( TObject *Sender )
{
bool b_file = RadioButtonFile->Checked;
bool b_udp = RadioButtonUDP->Checked;
bool b_rtp = RadioButtonRTP->Checked;
EditFile->Enabled = b_file;
ButtonBrowse->Enabled = b_file;
LabelAddress->Enabled = b_udp | b_rtp;
EditAddress->Enabled = b_udp | b_rtp;
LabelPort->Enabled = b_udp | b_rtp;
SpinEditPort->Enabled = b_udp | b_rtp;
RadioButtonPS->Enabled = !b_rtp;
if( b_udp || b_rtp )
RadioButtonTS->Checked = true;
RebuildMrl();
}
//---------------------------------------------------------------------------
void __fastcall TSoutDlg::ButtonOKClick( TObject *Sender )
{
config_PutPsz( p_intf, "sout", EditMrl->Text.c_str() );
}
//---------------------------------------------------------------------------
/*****************************************************************************
* Private functions
*****************************************************************************/
void _fastcall TSoutDlg::RebuildMrl()
{
AnsiString Mux, Mrl;
if( RadioButtonPS->Checked )
Mux = "ps";
else
Mux = "ts";
if( RadioButtonFile->Checked )
Mrl = "file/" + Mux + "://" + EditFile->Text;
else if( RadioButtonUDP->Checked )
Mrl = "udp/" + Mux + "://" + EditAddress->Text + ":"
+ SpinEditPort->Value;
else
Mrl = "rtp/" + Mux + "://" + EditAddress->Text + ":"
+ SpinEditPort->Value;
EditMrl->Text = Mrl;
}
//---------------------------------------------------------------------------
object SoutDlg: TSoutDlg
Tag = 3
Left = 454
Top = 369
Width = 392
Height = 244
Caption = 'Stream output'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object GroupBoxStreamOut: TGroupBox
Tag = 3
Left = 8
Top = 8
Width = 368
Height = 168
Anchors = [akLeft, akTop, akRight]
Caption = 'Stream output MRL (Media Resource Locator)'
TabOrder = 0
object LabelPort: TLabel
Tag = 3
Left = 263
Top = 98
Width = 22
Height = 13
Anchors = [akTop, akRight]
Caption = 'Port:'
Enabled = False
end
object LabelAddress: TLabel
Tag = 3
Left = 96
Top = 98
Width = 41
Height = 13
Caption = 'Address:'
Enabled = False
end
object EditMrl: TEdit
Left = 16
Top = 24
Width = 336
Height = 21
Anchors = [akLeft, akTop, akRight]
TabOrder = 0
Text = 'file/ts://'
end
object PanelAccess: TPanel
Left = 16
Top = 56
Width = 73
Height = 97
TabOrder = 1
object RadioButtonFile: TRadioButton
Tag = 3
Left = 8
Top = 8
Width = 49
Height = 17
Caption = 'File'
Checked = True
TabOrder = 0
TabStop = True
OnClick = RadioButtonAccessClick
end
object RadioButtonUDP: TRadioButton
Tag = 3
Left = 8
Top = 40
Width = 49
Height = 17
Caption = 'UDP'
TabOrder = 1
OnClick = RadioButtonAccessClick
end
object RadioButtonRTP: TRadioButton
Tag = 3
Left = 8
Top = 72
Width = 49
Height = 17
Caption = 'RTP'
TabOrder = 2
OnClick = RadioButtonAccessClick
end
end
object ButtonBrowse: TButton
Tag = 3
Left = 277
Top = 60
Width = 75
Height = 25
Anchors = [akTop, akRight]
Caption = 'Browse...'
TabOrder = 3
OnClick = ButtonBrowseClick
end
object EditFile: TEdit
Left = 96
Top = 62
Width = 176
Height = 21
Anchors = [akLeft, akTop, akRight]
TabOrder = 2
OnChange = CustomEditChange
end
object SpinEditPort: TCSpinEdit
Left = 295
Top = 93
Width = 57
Height = 22
TabStop = True
Anchors = [akTop, akRight]
Enabled = False
MaxValue = 100000
ParentColor = False
TabOrder = 5
Value = 1234
OnChange = CustomEditChange
OnClick = CustomEditChange
end
object EditAddress: TEdit
Left = 144
Top = 94
Width = 112
Height = 21
Anchors = [akLeft, akTop, akRight]
Enabled = False
TabOrder = 4
Text = '239.239.0.1'
OnChange = CustomEditChange
end
object PanelMux: TPanel
Left = 184
Top = 124
Width = 88
Height = 25
Anchors = [akLeft, akTop, akRight]
TabOrder = 6
object RadioButtonPS: TRadioButton
Tag = 3
Left = 3
Top = 4
Width = 41
Height = 17
Anchors = [akTop]
Caption = 'PS'
TabOrder = 0
OnClick = RadioButtonMuxClick
end
object RadioButtonTS: TRadioButton
Tag = 3
Left = 39
Top = 4
Width = 41
Height = 17
Anchors = [akTop]
Caption = 'TS'
Checked = True
TabOrder = 1
TabStop = True
OnClick = RadioButtonMuxClick
end
end
end
object ButtonOK: TButton
Tag = 3
Left = 218
Top = 184
Width = 75
Height = 23
Caption = 'OK'
Default = True
ModalResult = 1
TabOrder = 1
OnClick = ButtonOKClick
end
object ButtonCancel: TButton
Tag = 3
Left = 301
Top = 184
Width = 75
Height = 23
Cancel = True
Caption = 'Cancel'
ModalResult = 2
TabOrder = 2
end
object OpenDialog1: TOpenDialog
Left = 120
Top = 128
end
end
/*****************************************************************************
* sout.h: the stream ouput dialog box
*****************************************************************************
* Copyright (C) 2002-2003 VideoLAN
* $Id: sout.h,v 1.4 2003/02/12 02:11:58 ipkiss Exp $
*
* Authors: Olivier Teuliere <ipkiss@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef soutH
#define soutH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <ExtCtrls.hpp>
#include "CSPIN.h"
#include <Dialogs.hpp>
#include <Buttons.hpp>
//---------------------------------------------------------------------------
class TSoutDlg : public TForm
{
__published: // IDE-managed Components
TGroupBox *GroupBoxStreamOut;
TEdit *EditMrl;
TPanel *PanelAccess;
TRadioButton *RadioButtonFile;
TRadioButton *RadioButtonUDP;
TRadioButton *RadioButtonRTP;
TOpenDialog *OpenDialog1;
TButton *ButtonBrowse;
TEdit *EditFile;
TCSpinEdit *SpinEditPort;
TEdit *EditAddress;
TLabel *LabelPort;
TLabel *LabelAddress;
TPanel *PanelMux;
TRadioButton *RadioButtonPS;
TRadioButton *RadioButtonTS;
TButton *ButtonOK;
TButton *ButtonCancel;
void __fastcall ButtonBrowseClick( TObject *Sender );
void __fastcall CustomEditChange( TObject *Sender );
void __fastcall RadioButtonMuxClick( TObject *Sender );
void __fastcall RadioButtonAccessClick( TObject *Sender );
void __fastcall ButtonOKClick( TObject *Sender );
private: // User declarations
void __fastcall RebuildMrl();
intf_thread_t *p_intf;
public: // User declarations
__fastcall TSoutDlg( TComponent* Owner, intf_thread_t *_p_intf );
};
//---------------------------------------------------------------------------
#endif
/*****************************************************************************
* subtitles.cpp: Dialog box for divx subtitle selection
*****************************************************************************
* Copyright (C) 2002-2003 VideoLAN
* $Id: subtitles.cpp,v 1.3 2003/02/12 02:11:58 ipkiss Exp $
*
* Authors: Olivier Teuliere <ipkiss@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include <vcl.h>
#pragma hdrstop
#include <vlc/vlc.h>
#include <vlc/intf.h>
#include "subtitles.h"
#include "misc.h"
#include "win32_common.h"
//---------------------------------------------------------------------------
#pragma resource "*.dfm"
//---------------------------------------------------------------------------
__fastcall TSubtitlesDlg::TSubtitlesDlg( TComponent* Owner,
intf_thread_t *_p_intf ) : TForm( Owner )
{
p_intf = _p_intf;
Constraints->MinWidth = Width;
Constraints->MinHeight = Height;
Translate( this );
}
//---------------------------------------------------------------------------
void __fastcall TSubtitlesDlg::ButtonBrowseClick( TObject *Sender )
{
if( OpenDialog1->Execute() )
{
EditFile->Text = OpenDialog1->FileName;
}
}
//---------------------------------------------------------------------------
void __fastcall TSubtitlesDlg::ButtonOKClick( TObject *Sender )
{
int delay = (int) (10 * atof( EditDelay->Text.c_str() ));
float fps = atof( EditFPS->Text.c_str() );
config_PutPsz( p_intf, "sub-file", EditFile->Text.c_str() );
config_PutInt( p_intf, "sub-delay", delay );
config_PutFloat( p_intf, "sub-fps", fps );
}
//---------------------------------------------------------------------------
object SubtitlesDlg: TSubtitlesDlg
Tag = 3
Left = 520
Top = 185
Width = 338
Height = 172
Caption = 'Add subtitles'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object GroupBoxSubtitles: TGroupBox
Tag = 3
Left = 8
Top = 8
Width = 314
Height = 96
Anchors = [akLeft, akTop, akRight]
Caption = 'Select a subtitles file'
TabOrder = 0
object LabelDelay: TLabel
Tag = 3
Left = 48
Top = 64
Width = 30
Height = 13
Caption = 'Delay:'
end
object LabelFPS: TLabel
Tag = 3
Left = 177
Top = 64
Width = 23
Height = 13
Anchors = [akTop, akRight]
Caption = 'FPS:'
end
object EditDelay: TEdit
Left = 88
Top = 60
Width = 57
Height = 21
Hint = 'Set the delay (in seconds)'
ParentShowHint = False
ShowHint = True
TabOrder = 2
Text = '0.0'
end
object EditFPS: TEdit
Left = 209
Top = 60
Width = 57
Height = 21
Hint = 'Set the number of Frames Per Second'
Anchors = [akTop, akRight]
ParentShowHint = False
ShowHint = True
TabOrder = 3
Text = '0.0'
end
object EditFile: TEdit
Left = 16
Top = 24
Width = 194
Height = 21
Anchors = [akLeft, akTop, akRight]
TabOrder = 0
end
object ButtonBrowse: TButton
Tag = 3
Left = 223
Top = 22
Width = 75
Height = 25
Anchors = [akTop, akRight]
Caption = 'Browse...'
TabOrder = 1
OnClick = ButtonBrowseClick
end
end
object ButtonOK: TButton
Tag = 3
Left = 164
Top = 112
Width = 75
Height = 23
Caption = 'OK'
Default = True
ModalResult = 1
TabOrder = 1
OnClick = ButtonOKClick
end
object ButtonCancel: TButton
Tag = 3
Left = 247
Top = 112
Width = 75
Height = 23
Cancel = True
Caption = 'Cancel'
ModalResult = 2
TabOrder = 2
OnClick = ButtonOKClick
end
object OpenDialog1: TOpenDialog
Filter =
'Subtitles Files (*.txt, *.sub, *.srt, *.ssa)|*.txt;*.sub;*.srt;*' +
'.ssa|All Files (*.*)|*.*'
Left = 16
Top = 64
end
end
/*****************************************************************************
* subtitles.h: Dialog box for divx subtitle selection
*****************************************************************************
* Copyright (C) 2002-2003 VideoLAN
* $Id: subtitles.h,v 1.3 2003/02/12 02:11:58 ipkiss Exp $
*
* Authors: Olivier Teuliere <ipkiss@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef subtitlesH
#define subtitlesH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <Dialogs.hpp>
#include <Buttons.hpp>
//---------------------------------------------------------------------------
class TSubtitlesDlg : public TForm
{
__published: // IDE-managed Components
TOpenDialog *OpenDialog1;
TGroupBox *GroupBoxSubtitles;
TEdit *EditDelay;
TEdit *EditFPS;
TEdit *EditFile;
TButton *ButtonBrowse;
TLabel *LabelDelay;
TLabel *LabelFPS;
TButton *ButtonOK;
TButton *ButtonCancel;
void __fastcall ButtonBrowseClick( TObject *Sender );
void __fastcall ButtonOKClick( TObject *Sender );
private: // User declarations
intf_thread_t *p_intf;
public: // User declarations
__fastcall TSubtitlesDlg( TComponent* Owner, intf_thread_t *p_intf );
};
//---------------------------------------------------------------------------
#endif
USEUNIT("win32.cpp");
USEFORM("mainframe.cpp", MainFrameDlg);
USEFORM("network.cpp", NetworkDlg);
USEFORM("playlist.cpp", PlaylistDlg);
USEFORM("preferences.cpp", PreferencesDlg);
USEFORM("about.cpp", AboutDlg);
USEFORM("disc.cpp", DiscDlg);
USE("win32_common.h", File);
USEUNIT("menu.cpp");
USEFORM("messages.cpp", MessagesDlg);
USEUNIT("misc.cpp");
USEUNIT("dragdrop.cpp");
USEFORM("sout.cpp", SoutDlg);
USEFORM("subtitles.cpp", SubtitlesDlg);
//---------------------------------------------------------------------------
This file is used by the project manager only and should be treated like the project file
DllEntryPoint
<?xml version='1.0' encoding='utf-8' ?>
<!-- C++Builder XML Project -->
<PROJECT>
<MACROS>
<VERSION value="BCB.05.03"/>
<PROJECT value="libwin32_plugin.dll"/>
<OBJFILES value="win32.obj mainframe.obj network.obj playlist.obj preferences.obj about.obj
disc.obj menu.obj messages.obj misc.obj dragdrop.obj sout.obj subtitles.obj"/>
<RESFILES value=""/>
<DEFFILE value=""/>
<RESDEPEN value="$(RESFILES) mainframe.dfm network.dfm playlist.dfm preferences.dfm
about.dfm disc.dfm messages.dfm sout.dfm subtitles.dfm"/>
<LIBFILES value=""/>
<LIBRARIES value="VCLX50.lib bcbsmp50.lib VCL50.lib"/>
<SPARELIBS value="VCL50.lib bcbsmp50.lib VCLX50.lib"/>
<PACKAGES value="VCL50.bpi VCLX50.bpi bcbsmp50.bpi QRPT50.bpi VCLDB50.bpi VCLBDE50.bpi
ibsmp50.bpi VCLDBX50.bpi TEEUI50.bpi TEEDB50.bpi TEE50.bpi TEEQR50.bpi
VCLIB50.bpi bcbie50.bpi VCLIE50.bpi INETDB50.bpi INET50.bpi NMFAST50.bpi"/>
<PATHCPP value=".;"/>
<PATHPAS value=".;"/>
<PATHRC value=".;"/>
<PATHASM value=".;"/>
<DEBUGLIBPATH value="$(BCB)\lib\debug"/>
<RELEASELIBPATH value="$(BCB)\lib\release"/>
<LINKER value="tlink32"/>
<USERDEFINES value="_DEBUG;WIN32;__VLC__;__PLUGIN__;MODULE_NAME_IS_win32"/>
<SYSDEFINES value="NO_STRICT"/>
<MAINSOURCE value="win32.bpf"/>
<INCLUDEPATH value="F:\ProgInst\Borland\CBuilder5\Bin;..\..\win32;$(BCB)\include;$(BCB)\include\vcl;..\..\..\include;..\..\..;..\..\..\intl"/>
<LIBPATH value="F:\ProgInst\Borland\CBuilder5\Bin;..\..\win32;$(BCB)\lib\obj;$(BCB)\lib"/>
<WARNINGS value="-w-par"/>
</MACROS>
<OPTIONS>
<CFLAG1 value="-WD -Od -H=$(BCB)\lib\vcl50.csm -Hc -Vx -Ve -X- -r- -a8 -b- -k -y -v -vi-
-tWD -tWM -c"/>
<PFLAGS value="-$Y+ -$W -$O- -v -JPHNE -M"/>
<RFLAGS value=""/>
<AFLAGS value="/mx /w2 /zi"/>
<LFLAGS value="-D&quot;&quot; -aa -Tpd -x -Gn -Gi -v"/>
</OPTIONS>
<LINKER>
<ALLOBJ value="c0d32.obj sysinit.obj $(OBJFILES)"/>
<ALLRES value="$(RESFILES)"/>
<ALLLIB value="$(LIBFILES) $(LIBRARIES) import32.lib cp32mt.lib"/>
</LINKER>
<IDEOPTIONS>
[Version Info]
IncludeVerInfo=0
AutoIncBuild=0
MajorVer=1
MinorVer=0
Release=0
Build=0
Debug=0
PreRelease=0
Special=0
Private=0
DLL=0
Locale=1036
CodePage=1252
[Version Info Keys]
CompanyName=
FileDescription=
FileVersion=1.0.0.0
InternalName=
LegalCopyright=
LegalTrademarks=
OriginalFilename=
ProductName=
ProductVersion=1.0.0.0
Comments=
[HistoryLists\hlIncludePath]
Count=1
Item0=..\..\win32;$(BCB)\include;$(BCB)\include\vcl;..\..\..\include;..\..\src\misc
[HistoryLists\hlLibraryPath]
Count=2
Item0=..\..\win32;$(BCB)\lib\obj;$(BCB)\lib
Item1=..\win32;..\..\win32;$(BCB)\lib\obj;$(BCB)\lib
[HistoryLists\hlDebugSourcePath]
Count=1
Item0=$(BCB)\source\vcl
[HistoryLists\hlConditionals]
Count=5
Item0=_DEBUG;WIN32;__VLC__;__PLUGIN__;MODULE_NAME_IS_win32
Item1=_DEBUG;WIN32;__VLC__;__PLUGIN__;MODULE_NAME_IS_win32;MODULE_NAME=win32;MODULE_PATH=modules_gui_win32_win32
Item2=_DEBUG;__VLC__;__PLUGIN__;MODULE_NAME_IS_win32;MODULE_NAME=win32;MODULE_PATH=modules_gui_win32_win32
Item3=_DEBUG;__VLC__;__PLUGIN__
Item4=_DEBUG
[Debugging]
DebugSourceDirs=$(BCB)\source\vcl
[Parameters]
RunParams=
HostApplication=
RemoteHost=
RemotePath=
RemoteDebug=0
[Compiler]
ShowInfoMsgs=0
LinkDebugVcl=0
LinkCGLIB=0
[Language]
ActiveLang=
ProjectLang=
RootDir=
</IDEOPTIONS>
</PROJECT>
/*****************************************************************************
* win32.cpp : Win32 interface plugin for vlc
*****************************************************************************
* Copyright (C) 2002-2003 VideoLAN
* $Id: win32.cpp,v 1.19 2003/05/15 22:27:37 massiot Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <vcl.h>
#include <stdlib.h> /* malloc(), free() */
#include <errno.h> /* ENOMEM */
#include <string.h>
#include <vlc/vlc.h>
#include <vlc/intf.h>
#include "mainframe.h"
#include "menu.h"
#include "win32_common.h"
/*****************************************************************************
* Exported interface functions.
*****************************************************************************/
extern "C" __declspec(dllexport)
int __VLC_SYMBOL( vlc_entry ) ( module_t *p_module );
/*****************************************************************************
* Local prototypes.
*****************************************************************************/
static int Open ( vlc_object_t * );
static void Close ( vlc_object_t * );
static void Run ( intf_thread_t * );
int Win32Manage( void *p_data );
/*****************************************************************************
* Open: initialize interface
*****************************************************************************/
static int Open ( vlc_object_t *p_this )
{
intf_thread_t *p_intf = (intf_thread_t *)p_this;
/* Allocate instance and initialize some members */
p_intf->p_sys = (intf_sys_t *) malloc( sizeof( intf_sys_t ) );
if( p_intf->p_sys == NULL )
{
msg_Err( p_intf, "out of memory" );
return( 1 );
};
p_intf->pf_run = Run;
p_intf->p_sys->p_sub = msg_Subscribe( p_intf );
/* Initialize Win32 thread */
p_intf->p_sys->b_playing = 0;
p_intf->p_sys->b_popup_changed = 0;
p_intf->p_sys->p_input = NULL;
p_intf->p_sys->i_playing = -1;
p_intf->p_sys->b_play_when_adding = VLC_TRUE;
p_intf->p_sys->b_slider_free = 1;
p_intf->p_sys->b_aout_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_title_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_spu_update = VLC_FALSE;
return( 0 );
}
/*****************************************************************************
* Close: destroy interface
*****************************************************************************/
static void Close ( vlc_object_t *p_this )
{
intf_thread_t *p_intf = (intf_thread_t *)p_this;
if( 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 );
/* Destroy structure */
free( p_intf->p_sys );
}
/*****************************************************************************
* Run: main loop
*****************************************************************************/
static void Run( intf_thread_t *p_intf )
{
p_intf->p_sys->p_window = new TMainFrameDlg( NULL, p_intf );
p_intf->p_sys->p_playwin = new TPlaylistDlg( NULL, p_intf );
p_intf->p_sys->p_messages = new TMessagesDlg( NULL, p_intf );
p_intf->p_sys->p_menus = new TMenusGen( p_intf );
/* show main window and wait until it is closed */
p_intf->p_sys->p_window->ShowModal();
if( p_intf->p_sys->p_disc ) delete p_intf->p_sys->p_disc;
if( p_intf->p_sys->p_network ) delete p_intf->p_sys->p_network;
if( p_intf->p_sys->p_preferences ) delete p_intf->p_sys->p_preferences;
delete p_intf->p_sys->p_menus;
delete p_intf->p_sys->p_messages;
delete p_intf->p_sys->p_playwin;
delete p_intf->p_sys->p_window;
}
/*****************************************************************************
* Win32Manage: manage main thread messages
*****************************************************************************
* In this function, called approx. 10 times a second, we check what the
* main program wanted to tell us.
*****************************************************************************/
int Win32Manage( intf_thread_t *p_intf )
{
vlc_mutex_lock( &p_intf->change_lock );
/* If the "display popup" flag has changed */
if( p_intf->b_menu_change )
{
/* 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,
but i couldn't find a way to close it :-( */
TPoint MousePos = Mouse->CursorPos;
p_intf->p_sys->p_window->PopupMenuMain->Popup( MousePos.x, MousePos.y );
p_intf->b_menu_change = 0;
}
/* Update the log window */
p_intf->p_sys->p_messages->UpdateLog();
/* Update the playlist */
p_intf->p_sys->p_playwin->Manage();
/* Update the input */
if( p_intf->p_sys->p_input == NULL )
{
p_intf->p_sys->p_input = (input_thread_t *)
vlc_object_find( p_intf, VLC_OBJECT_INPUT, FIND_ANYWHERE );
}
else if( p_intf->p_sys->p_input->b_dead )
{
vlc_object_release( p_intf->p_sys->p_input );
p_intf->p_sys->p_input = NULL;
}
if( p_intf->p_sys->p_input != NULL && !p_intf->p_sys->p_input->b_die )
{
vlc_bool_t b_need_menus = VLC_FALSE;
input_thread_t * p_input = p_intf->p_sys->p_input;
vlc_object_t * p_aout = NULL;
vlc_object_t * p_vout = NULL;
vlc_mutex_lock( &p_input->stream.stream_lock );
/* New input or stream map change */
if( p_input->stream.b_changed )
{
p_intf->p_sys->p_window->ModeManage();
b_need_menus = VLC_TRUE;
p_intf->p_sys->b_playing = 1;
}
/* Manage the slider */
if( p_input->stream.b_seekable && p_intf->p_sys->b_playing )
{
TTrackBar * TrackBar = p_intf->p_sys->p_window->TrackBar;
off_t NewValue = TrackBar->Position;
#define p_area p_input->stream.p_selected_area
/* If the user hasn't touched the slider since the last time,
* then the input can safely change it */
if( NewValue == p_intf->p_sys->OldValue )
{
/* Update the value */
TrackBar->Position = p_intf->p_sys->OldValue =
( (off_t)SLIDER_MAX_VALUE * p_area->i_tell ) /
p_area->i_size;
}
/* Otherwise, send message to the input if the user has
* finished dragging the slider */
else if( p_intf->p_sys->b_slider_free )
{
off_t i_seek = ( NewValue * p_area->i_size ) /
(off_t)SLIDER_MAX_VALUE;
/* release the lock to be able to seek */
vlc_mutex_unlock( &p_input->stream.stream_lock );
input_Seek( p_input, i_seek, INPUT_SEEK_SET );
vlc_mutex_lock( &p_input->stream.stream_lock );
/* Update the old value */
p_intf->p_sys->OldValue = NewValue;
}
# undef p_area
}
if( p_intf->p_sys->i_part != p_input->stream.p_selected_area->i_part )
{
p_intf->p_sys->b_chapter_update = 1;
b_need_menus = VLC_TRUE;
}
/* Does the audio output require to update the menus ? */
p_aout = (vlc_object_t *)vlc_object_find( p_intf, VLC_OBJECT_AOUT,
FIND_ANYWHERE );
if( p_aout != NULL )
{
vlc_value_t val;
if( var_Get( p_aout, "intf-change", &val ) >= 0
&& val.b_bool )
{
p_intf->p_sys->b_aout_update = 1;
b_need_menus = VLC_TRUE;
}
vlc_object_release( p_aout );
}
/* Does the video output require to update the menus ? */
p_vout = (vlc_object_t *)vlc_object_find( p_intf, VLC_OBJECT_VOUT,
FIND_ANYWHERE );
if( p_vout != NULL )
{
vlc_value_t val;
if( var_Get( p_vout, "intf-change", &val ) >= 0
&& val.b_bool )
{
p_intf->p_sys->b_vout_update = 1;
b_need_menus = VLC_TRUE;
}
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->PopupOnTop->Checked = val.b_bool;
}
vlc_object_release( p_vout );
}
if( b_need_menus )
{
p_intf->p_sys->p_menus->SetupMenus();
}
vlc_mutex_unlock( &p_input->stream.stream_lock );
}
else if( p_intf->p_sys->b_playing && !p_intf->b_die )
{
p_intf->p_sys->p_window->ModeManage();
p_intf->p_sys->b_playing = 0;
}
if( p_intf->b_die )
{
vlc_mutex_unlock( &p_intf->change_lock );
/* Prepare to die, young Skywalker */
p_intf->p_sys->p_window->ModalResult = mrOk;
/* Just in case */
return( FALSE );
}
vlc_mutex_unlock( &p_intf->change_lock );
return( TRUE );
}
/*****************************************************************************
* Module descriptor
*****************************************************************************/
#define MAX_LINES_TEXT N_( "Maximum number of lines in the log window" )
#define MAX_LINES_LONGTEXT N_( \
"You can set the maximum number of lines that the log window will display."\
" Enter -1 if you want to keep all messages." )
#define SHOW_CAPTIONS_TEXT N_( "Display text under images in the toolbar" )
#define SHOW_CAPTIONS_LONGTEXT N_( \
"Check this option if you want to display the caption of the buttons in " \
"the toolbar. Beware, the display may be messed up" )
vlc_module_begin();
add_category_hint( N_("Miscellaneous"), NULL, VLC_TRUE );
add_integer( "intfwin-max-lines", 500, NULL, MAX_LINES_TEXT,
MAX_LINES_LONGTEXT, VLC_TRUE );
add_bool( "intfwin-show-captions", 0, NULL, SHOW_CAPTIONS_TEXT,
SHOW_CAPTIONS_LONGTEXT, VLC_FALSE );
set_description( _("Native Windows interface") );
set_capability( "interface", 100 );
set_callbacks( E_(Open), E_(Close) );
add_shortcut( "win" );
add_shortcut( "win32" );
vlc_module_end();
/*****************************************************************************
* win32_common.h: private win32 interface description
*****************************************************************************
* Copyright (C) 2002 VideoLAN
*
* Authors: Olivier Teuliere <ipkiss@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include "disc.h"
#include "mainframe.h"
#include "menu.h"
#include "messages.h"
#include "network.h"
#include "playlist.h"
#include "preferences.h"
/*****************************************************************************
* The TrackBar is graduated from 0 to SLIDER_MAX_VALUE.
* SLIDER_MAX_VALUE is set to the higher acceptable value (2^31 - 1), in order
* to obtain the best precision in date calculation
*****************************************************************************/
#define SLIDER_MAX_VALUE 2147483647
/*****************************************************************************
* intf_sys_t: description and status of Win32 interface
*****************************************************************************/
struct intf_sys_t
{
/* special actions */
vlc_bool_t b_playing;
vlc_bool_t b_popup_changed; /* display popup menu ? */
vlc_bool_t b_slider_free; /* slider status */
/* menus handlers */
vlc_bool_t b_aout_update; /* do we need to update menus
related with audio output */
vlc_bool_t b_vout_update; /* do we need to update menus
related with video output */
vlc_bool_t b_program_update; /* do we need to update programs
menu */
vlc_bool_t b_title_update; /* do we need to update title menus */
vlc_bool_t b_chapter_update; /* do we need to update chapter
menus */
vlc_bool_t b_audio_update; /* do we need to update audio menus */
vlc_bool_t b_spu_update; /* do we need to update spu menus */
/* windows and widgets */
TMainFrameDlg * p_window; /* main window */
TPlaylistDlg * p_playwin; /* playlist */
TPopupMenu * p_popup; /* popup menu */
TDiscDlg * p_disc; /* disc selection window */
TNetworkDlg * p_network; /* network stream window */
TPreferencesDlg * p_preferences; /* preferences window */
TMenusGen * p_menus; /* object for menu generation */
/* The slider */
off_t OldValue; /* previous value */
/* The messages window */
TMessagesDlg * p_messages; /* messages window */
msg_subscription_t* p_sub; /* message bank subscription */
/* Playlist management */
int i_playing; /* playlist selected item */
vlc_bool_t b_play_when_adding;
/* The window labels for DVD mode */
TLabel * p_label_title;
TLabel * p_label_chapter;
unsigned int i_part; /* current chapter */
/* The input thread */
input_thread_t * p_input;
};
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment