Commit 8bf866ed authored by Olivier Teulière's avatar Olivier Teulière

 * ALL: replaced TUpDown components by TCSpinEdit ones, which allow
   values greater than 32767. It fixes the audio bug ocurring when a
   configuration file is saved under the win32 interface

 * ./plugins/win32/mainframe.cpp: Added some extra space between
   statusbar and toolbar when nothing is displayed. I find it nicer :)
parent a457b188
......@@ -36,6 +36,7 @@
//---------------------------------------------------------------------------
//#pragma package(smart_init)
#pragma link "CSPIN"
#pragma resource "*.dfm"
extern struct intf_thread_s *p_intfGlobal;
......@@ -84,8 +85,8 @@ void __fastcall TDiscDlg::BitBtnOkClick( TObject *Sender )
}
/* Select title and chapter */
Title.sprintf( "%d", UpDownTitle->Position );
Chapter.sprintf( "%d", UpDownChapter->Position );
Title.sprintf( "%d", SpinEditTitle->Value );
Chapter.sprintf( "%d", SpinEditChapter->Value );
/* Build source name and add it to playlist */
Source = Method + ":" + Device + "@" + Title + "," + Chapter;
......
......@@ -275,47 +275,29 @@ object DiscDlg: TDiscDlg
Height = 13
Caption = 'Chapter'
end
object EditTitle: TEdit
object SpinEditTitle: TCSpinEdit
Left = 64
Top = 20
Width = 57
Height = 21
Top = 19
Width = 73
Height = 22
TabStop = True
MaxValue = 65535
MinValue = 1
ParentColor = False
TabOrder = 0
Text = '1'
Value = 1
end
object EditChapter: TEdit
object SpinEditChapter: TCSpinEdit
Left = 64
Top = 48
Width = 57
Height = 21
Top = 47
Width = 73
Height = 22
TabStop = True
MaxValue = 65535
MinValue = 1
ParentColor = False
TabOrder = 1
Text = '1'
end
object UpDownTitle: TUpDown
Left = 121
Top = 20
Width = 15
Height = 21
Associate = EditTitle
Min = 1
Max = 32767
Position = 1
TabOrder = 2
Thousands = False
Wrap = False
end
object UpDownChapter: TUpDown
Left = 121
Top = 48
Width = 15
Height = 21
Associate = EditChapter
Min = 1
Max = 32767
Position = 1
TabOrder = 3
Thousands = False
Wrap = False
Value = 1
end
end
object RadioGroupType: TRadioGroup
......
......@@ -30,6 +30,7 @@
#include <Buttons.hpp>
#include <ComCtrls.hpp>
#include <ExtCtrls.hpp>
#include "CSPIN.h"
//---------------------------------------------------------------------------
class TDiscDlg : public TForm
{
......@@ -38,14 +39,12 @@ __published: // IDE-managed Components
TGroupBox *GroupBoxPosition;
TLabel *LabelTitle;
TLabel *LabelChapter;
TEdit *EditTitle;
TEdit *EditChapter;
TUpDown *UpDownTitle;
TUpDown *UpDownChapter;
TRadioGroup *RadioGroupType;
TBitBtn *BitBtnOk;
TBitBtn *BitBtnCancel;
TEdit *EditDevice;
TCSpinEdit *SpinEditTitle;
TCSpinEdit *SpinEditChapter;
void __fastcall FormShow(TObject *Sender);
void __fastcall FormHide(TObject *Sender);
void __fastcall BitBtnCancelClick(TObject *Sender);
......
......@@ -50,6 +50,7 @@
//---------------------------------------------------------------------------
//#pragma package(smart_init)
#pragma link "CSPIN"
#pragma resource "*.dfm"
extern struct intf_thread_s *p_intfGlobal;
......@@ -529,7 +530,7 @@ void __fastcall TMainFrameDlg::ButtonGoClick( TObject *Sender )
intf_thread_t *p_intf = p_intfGlobal;
int i_channel;
i_channel = UpDownChannel->Position;
i_channel = SpinEditChannel->Value;
intf_WarnMsg( 3, "intf info: joining channel %d", i_channel );
vlc_mutex_lock( &p_intf->change_lock );
......@@ -658,6 +659,10 @@ void __fastcall TMainFrameDlg::ModeManage()
}
else
{
/* add space between tolbar and statusbar when
* nothing is displayed; isn't it nicer ? :) */
i_Height += 18;
/* unsensitize menus */
MenuProgram->Enabled = false;
MenuTitle->Enabled = false;
......
......@@ -320,39 +320,29 @@ object MainFrameDlg: TMainFrameDlg
object LabelServer: TLabel
Left = 64
Top = 16
Width = 52
Width = 49
Height = 13
Caption = 'No server !'
end
object EditChannel: TEdit
Left = 336
Top = 12
Width = 17
Height = 21
TabOrder = 0
Text = '0'
end
object UpDownChannel: TUpDown
Left = 353
Top = 12
Width = 15
Height = 21
Associate = EditChannel
Min = 0
Position = 0
TabOrder = 1
Thousands = False
Wrap = False
Caption = 'No server!'
end
object ButtonGo: TButton
Left = 376
Left = 384
Top = 10
Width = 25
Height = 25
Caption = 'Go!'
TabOrder = 2
TabOrder = 0
OnClick = ButtonGoClick
end
object SpinEditChannel: TCSpinEdit
Left = 336
Top = 11
Width = 41
Height = 22
TabStop = True
MaxValue = 99
ParentColor = False
TabOrder = 1
end
end
object GroupBoxDisc: TGroupBox
Left = 0
......
......@@ -35,6 +35,7 @@
#include <ToolWin.hpp>
#include <AppEvnts.hpp>
#include <ExtCtrls.hpp>
#include "CSPIN.h"
//---------------------------------------------------------------------------
class TMainFrameDlg : public TForm
{
......@@ -109,8 +110,6 @@ __published: // IDE-managed Components
TGroupBox *GroupBoxFile;
TLabel *LabelFileName;
TGroupBox *GroupBoxNetwork;
TEdit *EditChannel;
TUpDown *UpDownChannel;
TLabel *LabelChannel;
TLabel *LabelServer;
TGroupBox *GroupBoxDisc;
......@@ -135,6 +134,7 @@ __published: // IDE-managed Components
TMenuItem *PopupNetworkStream;
TMenuItem *PopupClose;
TMenuItem *N9;
TCSpinEdit *SpinEditChannel;
void __fastcall TimerManageTimer( TObject *Sender );
void __fastcall TrackBarChange( TObject *Sender );
void __fastcall FormClose( TObject *Sender, TCloseAction &Action );
......
......@@ -38,6 +38,7 @@
//---------------------------------------------------------------------------
//#pragma package(smart_init)
#pragma link "CSPIN"
#pragma resource "*.dfm"
extern struct intf_thread_s *p_intfGlobal;
......@@ -51,8 +52,8 @@ __fastcall TNetworkDlg::TNetworkDlg( TComponent* Owner )
OldRadioValue = 0;
/* server port */
UpDownUDPPort->Position = config_GetIntVariable( "server-port" );
UpDownMulticastPort->Position = config_GetIntVariable( "server-port" );
SpinEditUDPPort->Value = config_GetIntVariable( "server-port" );
SpinEditMulticastPort->Value = config_GetIntVariable( "server-port" );
/* channel server */
if( config_GetIntVariable( "network-channel" ) )
......@@ -68,7 +69,7 @@ __fastcall TNetworkDlg::TNetworkDlg( TComponent* Owner )
free( psz_channel_server );
}
UpDownCSPort->Position = config_GetIntVariable( "channel-port" );
SpinEditCSPort->Value = config_GetIntVariable( "channel-port" );
}
//---------------------------------------------------------------------------
void __fastcall TNetworkDlg::FormShow( TObject *Sender )
......@@ -92,7 +93,7 @@ void __fastcall TNetworkDlg::BitBtnOkClick( TObject *Sender )
{
AnsiString Source, Address;
AnsiString Channel = ComboBoxCSAddress->Text;
unsigned int i_channel_port = UpDownCSPort->Position;
unsigned int i_channel_port = SpinEditCSPort->Value;
unsigned int i_port;
int i_end = p_main->p_playlist->i_size;
......@@ -110,7 +111,7 @@ void __fastcall TNetworkDlg::BitBtnOkClick( TObject *Sender )
/* UDP */
case 0:
config_PutIntVariable( "network-channel", FALSE );
i_port = UpDownUDPPort->Position;
i_port = SpinEditUDPPort->Value;
/* Build source name */
Source = "udp:@:" + IntToStr( i_port );
......@@ -127,7 +128,7 @@ void __fastcall TNetworkDlg::BitBtnOkClick( TObject *Sender )
case 1:
config_PutIntVariable( "network-channel", FALSE );
Address = ComboBoxMulticastAddress->Text;
i_port = UpDownMulticastPort->Position;
i_port = SpinEditMulticastPort->Value;
/* Build source name */
Source = "udp:@" + Address + ":" + IntToStr( i_port );
......@@ -178,8 +179,7 @@ void __fastcall TNetworkDlg::ChangeEnabled( int i_selected )
{
case 0:
LabelUDPPort->Enabled = NOT( LabelUDPPort->Enabled );
EditUDPPort->Enabled = NOT( EditUDPPort->Enabled );
UpDownUDPPort->Enabled = NOT( UpDownUDPPort->Enabled );
SpinEditUDPPort->Enabled = NOT( SpinEditUDPPort->Enabled );
break;
case 1:
LabelMulticastAddress->Enabled =
......@@ -187,15 +187,13 @@ void __fastcall TNetworkDlg::ChangeEnabled( int i_selected )
ComboBoxMulticastAddress->Enabled =
NOT( ComboBoxMulticastAddress->Enabled );
LabelMulticastPort->Enabled = NOT( LabelMulticastPort->Enabled );
EditMulticastPort->Enabled = NOT( EditMulticastPort->Enabled );
UpDownMulticastPort->Enabled = NOT( UpDownMulticastPort->Enabled );
SpinEditMulticastPort->Enabled = NOT( SpinEditMulticastPort->Enabled );
break;
case 2:
LabelCSAddress->Enabled = NOT( LabelCSAddress->Enabled );
ComboBoxCSAddress->Enabled = NOT( ComboBoxCSAddress->Enabled );
LabelCSPort->Enabled = NOT( LabelCSPort->Enabled );
EditCSPort->Enabled = NOT( EditCSPort->Enabled );
UpDownCSPort->Enabled = NOT( UpDownCSPort->Enabled );
SpinEditCSPort->Enabled = NOT( SpinEditCSPort->Enabled );
break;
case 3:
LabelHTTPURL->Enabled = NOT( LabelHTTPURL->Enabled );
......
object NetworkDlg: TNetworkDlg
Left = 353
Top = 273
Left = 369
Top = 301
BorderStyle = bsDialog
Caption = 'Open network'
ClientHeight = 222
ClientHeight = 206
ClientWidth = 482
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
......@@ -249,7 +249,7 @@ object NetworkDlg: TNetworkDlg
TextHeight = 13
object BitBtnOk: TBitBtn
Left = 40
Top = 184
Top = 168
Width = 177
Height = 25
TabOrder = 0
......@@ -258,7 +258,7 @@ object NetworkDlg: TNetworkDlg
end
object BitBtnCancel: TBitBtn
Left = 256
Top = 184
Top = 168
Width = 177
Height = 25
TabOrder = 1
......@@ -269,19 +269,19 @@ object NetworkDlg: TNetworkDlg
Left = 8
Top = 8
Width = 465
Height = 161
Height = 145
Caption = 'Network mode'
TabOrder = 2
object LabelUDPPort: TLabel
Left = 148
Top = 34
Top = 26
Width = 22
Height = 13
Caption = 'Port:'
end
object LabelMulticastPort: TLabel
Left = 364
Top = 66
Top = 54
Width = 22
Height = 13
Caption = 'Port:'
......@@ -289,7 +289,7 @@ object NetworkDlg: TNetworkDlg
end
object LabelCSPort: TLabel
Left = 364
Top = 98
Top = 82
Width = 22
Height = 13
Caption = 'Port:'
......@@ -297,7 +297,7 @@ object NetworkDlg: TNetworkDlg
end
object LabelMulticastAddress: TLabel
Left = 139
Top = 66
Top = 54
Width = 41
Height = 13
Caption = 'Address:'
......@@ -305,7 +305,7 @@ object NetworkDlg: TNetworkDlg
end
object LabelCSAddress: TLabel
Left = 139
Top = 98
Top = 82
Width = 41
Height = 13
Caption = 'Address:'
......@@ -313,7 +313,7 @@ object NetworkDlg: TNetworkDlg
end
object LabelHTTPURL: TLabel
Left = 147
Top = 130
Top = 110
Width = 25
Height = 13
Caption = 'URL:'
......@@ -321,7 +321,7 @@ object NetworkDlg: TNetworkDlg
end
object RadioButtonUDP: TRadioButton
Left = 16
Top = 32
Top = 24
Width = 97
Height = 17
Caption = 'UDP'
......@@ -332,7 +332,7 @@ object NetworkDlg: TNetworkDlg
end
object RadioButtonMulticast: TRadioButton
Left = 16
Top = 64
Top = 52
Width = 97
Height = 17
Caption = 'UDP Multicast'
......@@ -341,7 +341,7 @@ object NetworkDlg: TNetworkDlg
end
object RadioButtonCS: TRadioButton
Left = 16
Top = 96
Top = 80
Width = 97
Height = 17
Caption = 'Channel Server'
......@@ -350,108 +350,76 @@ object NetworkDlg: TNetworkDlg
end
object RadioButtonHTTP: TRadioButton
Left = 16
Top = 128
Top = 108
Width = 97
Height = 17
Caption = 'HTTP'
TabOrder = 3
OnEnter = RadioButtonHTTPEnter
end
object EditUDPPort: TEdit
Left = 184
Top = 30
Width = 41
Height = 21
TabOrder = 4
Text = '1234'
end
object UpDownUDPPort: TUpDown
Left = 225
Top = 30
Width = 16
Height = 21
Associate = EditUDPPort
Min = 0
Max = 32767
Position = 1234
TabOrder = 5
Thousands = False
Wrap = False
end
object EditMulticastPort: TEdit
Left = 392
Top = 62
Width = 41
Height = 21
Enabled = False
TabOrder = 7
Text = '1234'
end
object UpDownMulticastPort: TUpDown
Left = 433
Top = 62
Width = 16
Height = 21
Associate = EditMulticastPort
Enabled = False
Min = 0
Max = 32767
Position = 1234
TabOrder = 8
Thousands = False
Wrap = False
end
object EditCSPort: TEdit
Left = 392
Top = 94
Width = 41
Height = 21
Enabled = False
TabOrder = 10
Text = '6010'
end
object UpDownCSPort: TUpDown
Left = 433
Top = 94
Width = 16
Height = 21
Associate = EditCSPort
Enabled = False
Min = 0
Max = 32767
Position = 6010
TabOrder = 11
Thousands = False
Wrap = False
end
object ComboBoxMulticastAddress: TComboBox
Left = 184
Top = 62
Top = 50
Width = 161
Height = 21
Enabled = False
ItemHeight = 13
TabOrder = 6
TabOrder = 5
end
object ComboBoxCSAddress: TComboBox
Left = 184
Top = 94
Top = 78
Width = 161
Height = 21
Enabled = False
ItemHeight = 13
TabOrder = 9
TabOrder = 7
Text = '138.195.156.230'
Items.Strings = (
'138.195.159.230')
end
object EditHTTPURL: TEdit
Left = 184
Top = 126
Top = 106
Width = 265
Height = 21
Enabled = False
TabOrder = 12
TabOrder = 9
end
object SpinEditUDPPort: TCSpinEdit
Left = 184
Top = 21
Width = 57
Height = 22
TabStop = True
MaxValue = 65535
ParentColor = False
TabOrder = 4
Value = 1234
end
object SpinEditMulticastPort: TCSpinEdit
Left = 392
Top = 49
Width = 57
Height = 22
TabStop = True
Enabled = False
MaxValue = 65535
ParentColor = False
TabOrder = 6
Value = 1234
end
object SpinEditCSPort: TCSpinEdit
Left = 392
Top = 77
Width = 57
Height = 22
TabStop = True
Enabled = False
MaxValue = 65535
ParentColor = False
TabOrder = 8
Value = 6010
end
end
end
......@@ -30,6 +30,7 @@
#include <Buttons.hpp>
#include <ComCtrls.hpp>
#include <ExtCtrls.hpp>
#include "CSPIN.h"
//---------------------------------------------------------------------------
#define NOT( var ) ( (var) ? false : true )
......@@ -45,20 +46,17 @@ __published: // IDE-managed Components
TRadioButton *RadioButtonCS;
TRadioButton *RadioButtonHTTP;
TLabel *LabelUDPPort;
TEdit *EditUDPPort;
TUpDown *UpDownUDPPort;
TLabel *LabelMulticastPort;
TEdit *EditMulticastPort;
TUpDown *UpDownMulticastPort;
TLabel *LabelCSPort;
TEdit *EditCSPort;
TUpDown *UpDownCSPort;
TLabel *LabelMulticastAddress;
TComboBox *ComboBoxMulticastAddress;
TLabel *LabelCSAddress;
TComboBox *ComboBoxCSAddress;
TEdit *EditHTTPURL;
TLabel *LabelHTTPURL;
TCSpinEdit *SpinEditUDPPort;
TCSpinEdit *SpinEditMulticastPort;
TCSpinEdit *SpinEditCSPort;
void __fastcall FormShow( TObject *Sender );
void __fastcall FormHide( TObject *Sender );
void __fastcall BitBtnCancelClick( TObject *Sender );
......
......@@ -35,6 +35,7 @@
//---------------------------------------------------------------------------
//#pragma package(smart_init)
#pragma link "CSPIN"
#pragma resource "*.dfm"
extern struct intf_thread_s *p_intfGlobal;
......@@ -117,16 +118,20 @@ TEdit * __fastcall TGroupBoxPref::CreateEdit( TWinControl *Parent,
return Edit;
}
//---------------------------------------------------------------------------
TUpDown * __fastcall TGroupBoxPref::CreateUpDown( TWinControl *Parent,
int Min, int Max, int Position, bool Thousands )
TCSpinEdit * __fastcall TGroupBoxPref::CreateSpinEdit( TWinControl *Parent,
int Left, int Width, int Top, int Height,
long Min, long Max, long Value )
{
TUpDown *UpDown = new TUpDown( Parent );
UpDown->Parent = Parent;
UpDown->Min = Min;
UpDown->Max = Max;
UpDown->Position = Position;
UpDown->Thousands = Thousands;
return UpDown;
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;
}
//---------------------------------------------------------------------------
void __fastcall TGroupBoxPref::UpdateChanges()
......@@ -264,22 +269,20 @@ __fastcall TGroupBoxInteger::TGroupBoxInteger( TComponent* Owner,
LabelDesc = CreateLabel( this, 230, 225, 19, 26,
p_config->psz_longtext, true );
/* init edit */
Edit = CreateEdit( this, 16, 148, 24, 21, "" );
/* init updown */
UpDown = CreateUpDown( this, -1, 32767, p_config->i_value, false );
UpDown->Associate = Edit;
/* init spinedit */
SpinEdit = CreateSpinEdit( this, 16, 164, 24, 21,
-1, 100000, p_config->i_value );
/* vertical alignment */
Height = LabelDesc->Height + 24;
LabelDesc->Top = Top + ( Height - LabelDesc->Height ) / 2 + 4;
Edit->Top = Top + ( Height - Edit->Height ) / 2 + 4;
SpinEdit->Top = Top + ( Height - SpinEdit->Height ) / 2 + 4;
};
//---------------------------------------------------------------------------
void __fastcall TGroupBoxInteger::UpdateChanges()
{
p_config->i_value = StrToInt( Edit->Text );
/* Warning: we're casting from long to int */
p_config->i_value = (int)SpinEdit->Value;
}
......
......@@ -30,6 +30,7 @@
#include <Buttons.hpp>
#include <ComCtrls.hpp>
#include <ExtCtrls.hpp>
#include "CSPIN.h"
//---------------------------------------------------------------------------
class TGroupBoxPref : public TGroupBox
{
......@@ -48,8 +49,9 @@ public:
bool WordWrap );
TEdit * __fastcall CreateEdit( TWinControl *Parent,
int Left, int Width, int Top, int Height, AnsiString Text );
TUpDown * __fastcall CreateUpDown( TWinControl *Parent,
int Min, int Max, int Position, bool Thousands );
TCSpinEdit * __fastcall CreateSpinEdit( TWinControl *Parent,
int Left, int Width, int Top, int Height,
long Min, long Max, long Value );
};
//---------------------------------------------------------------------------
class TGroupBoxPlugin : public TGroupBoxPref
......@@ -85,8 +87,7 @@ class TGroupBoxInteger : public TGroupBoxPref
public:
__fastcall TGroupBoxInteger( TComponent* Owner, module_config_t *p_config );
TLabel *LabelDesc;
TEdit *Edit;
TUpDown *UpDown;
TCSpinEdit *SpinEdit;
void __fastcall UpdateChanges();
};
//---------------------------------------------------------------------------
......
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