Commit d7bba658 authored by Olivier Teulière's avatar Olivier Teulière

 * ./plugins/win32:
        - fixed a few bugs in the preferences
        - better auto-resizing of the main window
        - the disc dialog now respects the preferences settings
parent 58e56290
...@@ -31,9 +31,9 @@ ...@@ -31,9 +31,9 @@
#include "interface.h" #include "interface.h"
#include "intf_playlist.h" #include "intf_playlist.h"
#include "disc.h"
#include "win32_common.h" #include "win32_common.h"
#include "disc.h"
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
//#pragma package(smart_init) //#pragma package(smart_init)
#pragma resource "*.dfm" #pragma resource "*.dfm"
...@@ -44,20 +44,7 @@ extern struct intf_thread_s *p_intfGlobal; ...@@ -44,20 +44,7 @@ extern struct intf_thread_s *p_intfGlobal;
__fastcall TDiscDlg::TDiscDlg( TComponent* Owner ) __fastcall TDiscDlg::TDiscDlg( TComponent* Owner )
: TForm( Owner ) : TForm( Owner )
{ {
char *psz_dvd_device = config_GetPszVariable( "dvd_device" ); RadioGroupTypeClick( RadioGroupType );
char *psz_vcd_device = config_GetPszVariable( "vcd_device" );
if( psz_dvd_device )
{
EditDevice->Text.sprintf( "%s", psz_dvd_device );
free( psz_dvd_device );
}
if( psz_vcd_device )
{
EditDevice->Text.sprintf( "%s", psz_vcd_device );
free( psz_vcd_device );
}
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void __fastcall TDiscDlg::FormShow( TObject *Sender ) void __fastcall TDiscDlg::FormShow( TObject *Sender )
...@@ -116,4 +103,25 @@ void __fastcall TDiscDlg::BitBtnOkClick( TObject *Sender ) ...@@ -116,4 +103,25 @@ void __fastcall TDiscDlg::BitBtnOkClick( TObject *Sender )
intf_PlaylistJumpto( p_main->p_playlist, i_end - 1 ); intf_PlaylistJumpto( p_main->p_playlist, i_end - 1 );
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void __fastcall TDiscDlg::RadioGroupTypeClick( TObject *Sender )
{
TRadioGroup *RadioGroupType = (TRadioGroup *)Sender;
char *psz_device;
if( RadioGroupType->ItemIndex == 0 )
{
psz_device = config_GetPszVariable( "dvd_device" );
}
else
{
psz_device = config_GetPszVariable( "vcd_device" );
}
if( psz_device )
{
EditDevice->Text = psz_device;
free( psz_device );
}
}
//---------------------------------------------------------------------------
...@@ -329,6 +329,7 @@ object DiscDlg: TDiscDlg ...@@ -329,6 +329,7 @@ object DiscDlg: TDiscDlg
'DVD' 'DVD'
'VCD') 'VCD')
TabOrder = 0 TabOrder = 0
OnClick = RadioGroupTypeClick
end end
object BitBtnOk: TBitBtn object BitBtnOk: TBitBtn
Left = 8 Left = 8
......
...@@ -50,6 +50,7 @@ __published: // IDE-managed Components ...@@ -50,6 +50,7 @@ __published: // IDE-managed Components
void __fastcall FormHide(TObject *Sender); void __fastcall FormHide(TObject *Sender);
void __fastcall BitBtnCancelClick(TObject *Sender); void __fastcall BitBtnCancelClick(TObject *Sender);
void __fastcall BitBtnOkClick(TObject *Sender); void __fastcall BitBtnOkClick(TObject *Sender);
void __fastcall RadioGroupTypeClick(TObject *Sender);
private: // User declarations private: // User declarations
public: // User declarations public: // User declarations
__fastcall TDiscDlg( TComponent* Owner ); __fastcall TDiscDlg( TComponent* Owner );
......
...@@ -635,9 +635,6 @@ void __fastcall TMainFrameDlg::ModeManage() ...@@ -635,9 +635,6 @@ void __fastcall TMainFrameDlg::ModeManage()
i_Height += GroupBoxSlider->Height; i_Height += GroupBoxSlider->Height;
} }
/* resize main window */
this->Height = i_Height;
/* control buttons for free pace streams */ /* control buttons for free pace streams */
b_control = p_input_bank->pp_input[0]->stream.b_pace_control; b_control = p_input_bank->pp_input[0]->stream.b_pace_control;
...@@ -654,16 +651,16 @@ void __fastcall TMainFrameDlg::ModeManage() ...@@ -654,16 +651,16 @@ void __fastcall TMainFrameDlg::ModeManage()
} }
else else
{ {
i_Height = StatusBar->Height + ToolBar->Height + 47;
if( config_GetIntVariable( "network_channel" ) ) if( config_GetIntVariable( "network_channel" ) )
{ {
GroupBoxNetwork->Visible = true; GroupBoxNetwork->Visible = true;
LabelChannel->Visible = true; LabelChannel->Visible = true;
i_Height += GroupBoxNetwork->Height;
} }
else else
{ {
/* default mode */
ClientHeight = 37 + ToolBar->Height;
/* unsensitize menus */ /* unsensitize menus */
MenuProgram->Enabled = false; MenuProgram->Enabled = false;
MenuTitle->Enabled = false; MenuTitle->Enabled = false;
...@@ -676,6 +673,9 @@ void __fastcall TMainFrameDlg::ModeManage() ...@@ -676,6 +673,9 @@ void __fastcall TMainFrameDlg::ModeManage()
} }
} }
/* resize main window */
this->Height = i_Height;
/* set control items */ /* set control items */
ToolButtonBack->Enabled = false; ToolButtonBack->Enabled = false;
ToolButtonStop->Enabled = true; ToolButtonStop->Enabled = true;
...@@ -688,4 +688,5 @@ void __fastcall TMainFrameDlg::ModeManage() ...@@ -688,4 +688,5 @@ void __fastcall TMainFrameDlg::ModeManage()
PopupSlow->Enabled = b_control; PopupSlow->Enabled = b_control;
PopupFast->Enabled = b_control; PopupFast->Enabled = b_control;
} }
//---------------------------------------------------------------------------
...@@ -3,6 +3,7 @@ object MainFrameDlg: TMainFrameDlg ...@@ -3,6 +3,7 @@ object MainFrameDlg: TMainFrameDlg
Top = 245 Top = 245
Width = 534 Width = 534
Height = 307 Height = 307
BorderIcons = [biSystemMenu, biMinimize]
Caption = 'VideoLAN Client (win32 interface)' Caption = 'VideoLAN Client (win32 interface)'
Color = clBtnFace Color = clBtnFace
Font.Charset = DEFAULT_CHARSET Font.Charset = DEFAULT_CHARSET
...@@ -599,7 +600,7 @@ object MainFrameDlg: TMainFrameDlg ...@@ -599,7 +600,7 @@ object MainFrameDlg: TMainFrameDlg
Left = 104 Left = 104
Top = 208 Top = 208
Bitmap = { Bitmap = {
494C01010D000E00040020002000FFFFFFFFFF00FFFFFFFFFFFFFFFF424D3600 494C01010D000E00040020002000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600
0000000000003600000028000000800000008000000001002000000000000000 0000000000003600000028000000800000008000000001002000000000000000
0100000000000000000000000000000000000000000000000000000000000000 0100000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
...@@ -2715,7 +2716,8 @@ object MainFrameDlg: TMainFrameDlg ...@@ -2715,7 +2716,8 @@ object MainFrameDlg: TMainFrameDlg
E0000003F800001FC0000001FFFFF001F0000003FC00003FC0000003FFFFFC01 E0000003F800001FC0000001FFFFF001F0000003FC00003FC0000003FFFFFC01
FFFFF803FE00007FC0000007FFFFFF01FFFFFC07FF0000FFFFFFFE1FFFFFFFC1 FFFFF803FE00007FC0000007FFFFFF01FFFFFC07FF0000FFFFFFFE1FFFFFFFC1
FFFFFE07FFC003FFFFFFFC3FFFFFFFF9FFFFFFFFFFF80FFFFFFFF8FFFFFFFFFF FFFFFE07FFC003FFFFFFFC3FFFFFFFF9FFFFFFFFFFF80FFFFFFFF8FFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFF} FFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFF00000000000000000000000000000000
000000000000}
end end
object PopupMenuMain: TPopupMenu object PopupMenuMain: TPopupMenu
AutoPopup = False AutoPopup = False
......
...@@ -23,6 +23,9 @@ ...@@ -23,6 +23,9 @@
#include <vcl.h> #include <vcl.h>
#pragma hdrstop #pragma hdrstop
#include <stdlib.h> /* malloc(), free() */
#include <string.h> /* strcmp */
#include <videolan/vlc.h> #include <videolan/vlc.h>
#include "interface.h" #include "interface.h"
...@@ -36,6 +39,7 @@ ...@@ -36,6 +39,7 @@
extern struct intf_thread_s *p_intfGlobal; extern struct intf_thread_s *p_intfGlobal;
/**************************************************************************** /****************************************************************************
* Functions to help components creation * Functions to help components creation
****************************************************************************/ ****************************************************************************/
...@@ -124,6 +128,10 @@ TUpDown * __fastcall TGroupBoxPref::CreateUpDown( TWinControl *Parent, ...@@ -124,6 +128,10 @@ TUpDown * __fastcall TGroupBoxPref::CreateUpDown( TWinControl *Parent,
UpDown->Thousands = Thousands; UpDown->Thousands = Thousands;
return UpDown; return UpDown;
} }
//---------------------------------------------------------------------------
void __fastcall TGroupBoxPref::UpdateChanges()
{
}
/**************************************************************************** /****************************************************************************
...@@ -163,7 +171,6 @@ __fastcall TGroupBoxPlugin::TGroupBoxPlugin( TComponent* Owner, ...@@ -163,7 +171,6 @@ __fastcall TGroupBoxPlugin::TGroupBoxPlugin( TComponent* Owner,
vlc_mutex_lock( p_config->p_lock ); vlc_mutex_lock( p_config->p_lock );
Edit->Text = p_config->psz_value ? p_config->psz_value : ""; Edit->Text = p_config->psz_value ? p_config->psz_value : "";
vlc_mutex_unlock( p_config->p_lock ); vlc_mutex_unlock( p_config->p_lock );
Edit->OnChange = EditChange;
Height = 233; Height = 233;
}; };
...@@ -182,7 +189,7 @@ void __fastcall TGroupBoxPlugin::ListViewSelectItem( TObject *Sender, ...@@ -182,7 +189,7 @@ void __fastcall TGroupBoxPlugin::ListViewSelectItem( TObject *Sender,
p_module != NULL ; p_module != NULL ;
p_module = p_module->next ) p_module = p_module->next )
{ {
if( !strcmp( p_module->psz_name, Name.c_str() ) ) if( strcmp( p_module->psz_name, Name.c_str() ) == 0 )
{ {
ModuleSelected = p_module; ModuleSelected = p_module;
LabelHint->Caption = p_module->psz_longname ? LabelHint->Caption = p_module->psz_longname ?
...@@ -203,13 +210,15 @@ void __fastcall TGroupBoxPlugin::ButtonSelectClick( TObject *Sender ) ...@@ -203,13 +210,15 @@ void __fastcall TGroupBoxPlugin::ButtonSelectClick( TObject *Sender )
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void __fastcall TGroupBoxPlugin::ButtonConfigClick( TObject *Sender ) void __fastcall TGroupBoxPlugin::ButtonConfigClick( TObject *Sender )
{ {
/* FIWME: TODO */ /* FIXME: TODO */
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void __fastcall TGroupBoxPlugin::EditChange( TObject *Sender ) void __fastcall TGroupBoxPlugin::UpdateChanges()
{ {
TEdit *Edit = (TEdit *)Sender; /* XXX: Necessary, since c_str() returns only a temporary pointer... */
p_config->psz_value = Edit->Text.c_str(); free( p_config->psz_value );
p_config->psz_value = (char *)malloc( Edit->Text.Length() + 1 );
strcpy( p_config->psz_value, Edit->Text.c_str() );
} }
...@@ -228,7 +237,6 @@ __fastcall TGroupBoxString::TGroupBoxString( TComponent* Owner, ...@@ -228,7 +237,6 @@ __fastcall TGroupBoxString::TGroupBoxString( TComponent* Owner,
vlc_mutex_lock( p_config->p_lock ); vlc_mutex_lock( p_config->p_lock );
Edit->Text = p_config->psz_value ? p_config->psz_value : ""; Edit->Text = p_config->psz_value ? p_config->psz_value : "";
vlc_mutex_unlock( p_config->p_lock ); vlc_mutex_unlock( p_config->p_lock );
Edit->OnChange = EditChange;
/* vertical alignment */ /* vertical alignment */
Height = LabelDesc->Height + 24; Height = LabelDesc->Height + 24;
...@@ -236,10 +244,12 @@ __fastcall TGroupBoxString::TGroupBoxString( TComponent* Owner, ...@@ -236,10 +244,12 @@ __fastcall TGroupBoxString::TGroupBoxString( TComponent* Owner,
Edit->Top = Top + ( Height - Edit->Height ) / 2 + 4; Edit->Top = Top + ( Height - Edit->Height ) / 2 + 4;
}; };
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void __fastcall TGroupBoxString::EditChange( TObject *Sender ) void __fastcall TGroupBoxString::UpdateChanges()
{ {
TEdit *Edit = (TEdit *)Sender; /* XXX: Necessary, since c_str() returns only a temporary pointer... */
p_config->psz_value = Edit->Text.c_str(); free( p_config->psz_value );
p_config->psz_value = (char *)malloc( Edit->Text.Length() + 1 );
strcpy( p_config->psz_value, Edit->Text.c_str() );
} }
...@@ -255,7 +265,6 @@ __fastcall TGroupBoxInteger::TGroupBoxInteger( TComponent* Owner, ...@@ -255,7 +265,6 @@ __fastcall TGroupBoxInteger::TGroupBoxInteger( TComponent* Owner,
/* init edit */ /* init edit */
Edit = CreateEdit( this, 16, 148, 24, 21, "" ); Edit = CreateEdit( this, 16, 148, 24, 21, "" );
Edit->OnChange = EditChange;
/* init updown */ /* init updown */
UpDown = CreateUpDown( this, -1, 32767, p_config->i_value, false ); UpDown = CreateUpDown( this, -1, 32767, p_config->i_value, false );
...@@ -267,9 +276,8 @@ __fastcall TGroupBoxInteger::TGroupBoxInteger( TComponent* Owner, ...@@ -267,9 +276,8 @@ __fastcall TGroupBoxInteger::TGroupBoxInteger( TComponent* Owner,
Edit->Top = Top + ( Height - Edit->Height ) / 2 + 4; Edit->Top = Top + ( Height - Edit->Height ) / 2 + 4;
}; };
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void __fastcall TGroupBoxInteger::EditChange( TObject *Sender ) void __fastcall TGroupBoxInteger::UpdateChanges()
{ {
TEdit *Edit = (TEdit *)Sender;
p_config->i_value = StrToInt( Edit->Text ); p_config->i_value = StrToInt( Edit->Text );
} }
...@@ -287,7 +295,6 @@ __fastcall TGroupBoxBool::TGroupBoxBool( TComponent* Owner, ...@@ -287,7 +295,6 @@ __fastcall TGroupBoxBool::TGroupBoxBool( TComponent* Owner,
/* init checkbox */ /* init checkbox */
CheckBox = CreateCheckBox( this, 16, 184, 28, 17, p_config->psz_text ); CheckBox = CreateCheckBox( this, 16, 184, 28, 17, p_config->psz_text );
CheckBox->Checked = p_config->i_value; CheckBox->Checked = p_config->i_value;
CheckBox->OnClick = CheckBoxClick;
/* vertical alignment */ /* vertical alignment */
Height = LabelDesc->Height + 24; Height = LabelDesc->Height + 24;
...@@ -295,9 +302,8 @@ __fastcall TGroupBoxBool::TGroupBoxBool( TComponent* Owner, ...@@ -295,9 +302,8 @@ __fastcall TGroupBoxBool::TGroupBoxBool( TComponent* Owner,
CheckBox->Top = Top + ( Height - CheckBox->Height ) / 2 + 4; CheckBox->Top = Top + ( Height - CheckBox->Height ) / 2 + 4;
}; };
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void __fastcall TGroupBoxBool::CheckBoxClick( TObject *Sender ) void __fastcall TGroupBoxBool::UpdateChanges()
{ {
TCheckBox *CheckBox = (TCheckBox *)Sender;
p_config->i_value = CheckBox->Checked ? 1 : 0; p_config->i_value = CheckBox->Checked ? 1 : 0;
} }
...@@ -349,7 +355,8 @@ void __fastcall TPreferencesDlg::CreateConfigDialog( char *psz_module_name ) ...@@ -349,7 +355,8 @@ void __fastcall TPreferencesDlg::CreateConfigDialog( char *psz_module_name )
bool config_dialog; bool config_dialog;
module_t *p_module; module_t *p_module;
module_t *p_module_plugins; module_t *p_module_plugins;
int i, j; unsigned int i;
int i_pages, i_ctrl;
TTabSheet *TabSheet; TTabSheet *TabSheet;
TScrollBox *ScrollBox; TScrollBox *ScrollBox;
...@@ -476,14 +483,14 @@ void __fastcall TPreferencesDlg::CreateConfigDialog( char *psz_module_name ) ...@@ -476,14 +483,14 @@ void __fastcall TPreferencesDlg::CreateConfigDialog( char *psz_module_name )
} }
/* Reorder groupboxes inside the tabsheets */ /* Reorder groupboxes inside the tabsheets */
for( i = 0; i < PageControlPref->PageCount; i++ ) for( i_pages = 0; i_pages < PageControlPref->PageCount; i_pages++ )
{ {
/* get scrollbox from the tabsheet */ /* get scrollbox from the tabsheet */
ScrollBox = (TScrollBox *)PageControlPref->Pages[i]->Controls[0]; ScrollBox = (TScrollBox *)PageControlPref->Pages[i_pages]->Controls[0];
for( j = ScrollBox->ControlCount - 1; j >= 0 ; j-- ) for( i_ctrl = ScrollBox->ControlCount - 1; i_ctrl >= 0 ; i_ctrl-- )
{ {
ScrollBox->Controls[j]->Align = alTop; ScrollBox->Controls[i_ctrl]->Align = alTop;
} }
} }
...@@ -525,6 +532,7 @@ void __fastcall TPreferencesDlg::ButtonApplyClick( TObject *Sender ) ...@@ -525,6 +532,7 @@ void __fastcall TPreferencesDlg::ButtonApplyClick( TObject *Sender )
if( ScrollBox->Controls[j]->InheritsFrom( __classid( TGroupBoxPref ) ) ) if( ScrollBox->Controls[j]->InheritsFrom( __classid( TGroupBoxPref ) ) )
{ {
GroupBox = (TGroupBoxPref *)ScrollBox->Controls[j]; GroupBox = (TGroupBoxPref *)ScrollBox->Controls[j];
GroupBox->UpdateChanges();
SaveValue( GroupBox->p_config ); SaveValue( GroupBox->p_config );
} }
} }
...@@ -549,7 +557,8 @@ void __fastcall TPreferencesDlg::SaveValue( module_config_t *p_config ) ...@@ -549,7 +557,8 @@ void __fastcall TPreferencesDlg::SaveValue( module_config_t *p_config )
case MODULE_CONFIG_ITEM_STRING: case MODULE_CONFIG_ITEM_STRING:
case MODULE_CONFIG_ITEM_FILE: case MODULE_CONFIG_ITEM_FILE:
case MODULE_CONFIG_ITEM_PLUGIN: case MODULE_CONFIG_ITEM_PLUGIN:
config_PutPszVariable( p_config->psz_name, p_config->psz_value ); config_PutPszVariable( p_config->psz_name,
*p_config->psz_value ? p_config->psz_value : NULL );
break; break;
case MODULE_CONFIG_ITEM_INTEGER: case MODULE_CONFIG_ITEM_INTEGER:
case MODULE_CONFIG_ITEM_BOOL: case MODULE_CONFIG_ITEM_BOOL:
......
...@@ -36,6 +36,7 @@ class TGroupBoxPref : public TGroupBox ...@@ -36,6 +36,7 @@ class TGroupBoxPref : public TGroupBox
public: public:
__fastcall TGroupBoxPref( TComponent* Owner, module_config_t *p_config_arg ); __fastcall TGroupBoxPref( TComponent* Owner, module_config_t *p_config_arg );
module_config_t *p_config; module_config_t *p_config;
virtual void __fastcall UpdateChanges();
TListView * __fastcall CreateListView( TWinControl *Parent, TListView * __fastcall CreateListView( TWinControl *Parent,
int Left, int Width, int Top, int Height, TViewStyle ViewStyle ); int Left, int Width, int Top, int Height, TViewStyle ViewStyle );
TButton * __fastcall CreateButton( TWinControl *Parent, TButton * __fastcall CreateButton( TWinControl *Parent,
...@@ -63,11 +64,11 @@ public: ...@@ -63,11 +64,11 @@ public:
TLabel *LabelSelected; TLabel *LabelSelected;
TEdit *Edit; TEdit *Edit;
module_t *ModuleSelected; module_t *ModuleSelected;
void __fastcall UpdateChanges();
void __fastcall ListViewSelectItem( TObject *Sender, TListItem *Item, void __fastcall ListViewSelectItem( TObject *Sender, TListItem *Item,
bool Selected ); bool Selected );
void __fastcall ButtonSelectClick( TObject *Sender ); void __fastcall ButtonSelectClick( TObject *Sender );
void __fastcall ButtonConfigClick( TObject *Sender ); void __fastcall ButtonConfigClick( TObject *Sender );
void __fastcall EditChange( TObject *Sender );
}; };
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
class TGroupBoxString : public TGroupBoxPref class TGroupBoxString : public TGroupBoxPref
...@@ -76,7 +77,7 @@ public: ...@@ -76,7 +77,7 @@ public:
__fastcall TGroupBoxString( TComponent* Owner, module_config_t *p_config ); __fastcall TGroupBoxString( TComponent* Owner, module_config_t *p_config );
TLabel *LabelDesc; TLabel *LabelDesc;
TEdit *Edit; TEdit *Edit;
void __fastcall EditChange( TObject *Sender ); void __fastcall UpdateChanges();
}; };
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
class TGroupBoxInteger : public TGroupBoxPref class TGroupBoxInteger : public TGroupBoxPref
...@@ -86,7 +87,7 @@ public: ...@@ -86,7 +87,7 @@ public:
TLabel *LabelDesc; TLabel *LabelDesc;
TEdit *Edit; TEdit *Edit;
TUpDown *UpDown; TUpDown *UpDown;
void __fastcall EditChange( TObject *Sender ); void __fastcall UpdateChanges();
}; };
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
class TGroupBoxBool : public TGroupBoxPref class TGroupBoxBool : public TGroupBoxPref
...@@ -95,7 +96,7 @@ public: ...@@ -95,7 +96,7 @@ public:
__fastcall TGroupBoxBool( TComponent* Owner, module_config_t *p_config ); __fastcall TGroupBoxBool( TComponent* Owner, module_config_t *p_config );
TLabel *LabelDesc; TLabel *LabelDesc;
TCheckBox *CheckBox; TCheckBox *CheckBox;
void __fastcall CheckBoxClick( TObject *Sender ); void __fastcall UpdateChanges();
}; };
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
class TPreferencesDlg : public TForm class TPreferencesDlg : public TForm
......
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