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