mirror of
https://github.com/videolan/vlc.git
synced 2025-01-06 07:48:29 +08:00
* ./plugins/win32/*: Added management for secondary config dialogs
This commit is contained in:
parent
5ba63c6664
commit
3fdc995931
@ -68,6 +68,13 @@ __fastcall TMainFrameDlg::TMainFrameDlg( TComponent* Owner )
|
||||
|
||||
/* default height */
|
||||
ClientHeight = 37 + ToolBar->Height;
|
||||
|
||||
StringListPref = new TStringList();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
__fastcall TMainFrameDlg::~TMainFrameDlg()
|
||||
{
|
||||
delete StringListPref;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
@ -210,17 +217,7 @@ void __fastcall TMainFrameDlg::MenuMessagesClick( TObject *Sender )
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TMainFrameDlg::MenuPreferencesClick( TObject *Sender )
|
||||
{
|
||||
TPreferencesDlg *p_preferences = p_intfGlobal->p_sys->p_preferences;
|
||||
if( p_preferences == NULL )
|
||||
{
|
||||
p_preferences = new TPreferencesDlg( this );
|
||||
p_preferences->CreateConfigDialog( "main" );
|
||||
p_intfGlobal->p_sys->p_preferences = p_preferences;
|
||||
}
|
||||
else
|
||||
{
|
||||
p_preferences->Show();
|
||||
}
|
||||
CreatePreferences( "main" );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TMainFrameDlg::MenuAboutClick( TObject *Sender )
|
||||
@ -690,3 +687,41 @@ void __fastcall TMainFrameDlg::ModeManage()
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* 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 );
|
||||
Preferences->CreateConfigDialog( Name.c_str() );
|
||||
|
||||
/* save it */
|
||||
i_pos = StringListPref->Add( Name );
|
||||
StringListPref->Objects[i_pos] = Preferences;
|
||||
}
|
||||
|
||||
/* display the dialog */
|
||||
Preferences->Show();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
object MainFrameDlg: TMainFrameDlg
|
||||
Left = 304
|
||||
Top = 245
|
||||
Width = 534
|
||||
Height = 307
|
||||
Left = 314
|
||||
Top = 198
|
||||
Width = 535
|
||||
Height = 306
|
||||
BorderIcons = [biSystemMenu, biMinimize]
|
||||
Caption = 'VideoLAN Client (win32 interface)'
|
||||
Color = clBtnFace
|
||||
@ -140,7 +140,7 @@ object MainFrameDlg: TMainFrameDlg
|
||||
object ToolBar: TToolBar
|
||||
Left = 0
|
||||
Top = 0
|
||||
Width = 526
|
||||
Width = 527
|
||||
Height = 60
|
||||
ButtonHeight = 52
|
||||
ButtonWidth = 39
|
||||
@ -276,8 +276,8 @@ object MainFrameDlg: TMainFrameDlg
|
||||
end
|
||||
object StatusBar: TStatusBar
|
||||
Left = 0
|
||||
Top = 242
|
||||
Width = 526
|
||||
Top = 241
|
||||
Width = 527
|
||||
Height = 19
|
||||
Panels = <>
|
||||
ParentShowHint = False
|
||||
@ -287,7 +287,7 @@ object MainFrameDlg: TMainFrameDlg
|
||||
object GroupBoxFile: TGroupBox
|
||||
Left = 0
|
||||
Top = 100
|
||||
Width = 526
|
||||
Width = 527
|
||||
Height = 32
|
||||
Align = alTop
|
||||
TabOrder = 2
|
||||
@ -295,7 +295,7 @@ object MainFrameDlg: TMainFrameDlg
|
||||
object LabelFileName: TLabel
|
||||
Left = 2
|
||||
Top = 15
|
||||
Width = 522
|
||||
Width = 523
|
||||
Height = 15
|
||||
Align = alClient
|
||||
Alignment = taCenter
|
||||
@ -305,7 +305,7 @@ object MainFrameDlg: TMainFrameDlg
|
||||
object GroupBoxNetwork: TGroupBox
|
||||
Left = 0
|
||||
Top = 164
|
||||
Width = 526
|
||||
Width = 527
|
||||
Height = 40
|
||||
Align = alTop
|
||||
TabOrder = 3
|
||||
@ -357,7 +357,7 @@ object MainFrameDlg: TMainFrameDlg
|
||||
object GroupBoxDisc: TGroupBox
|
||||
Left = 0
|
||||
Top = 132
|
||||
Width = 526
|
||||
Width = 527
|
||||
Height = 32
|
||||
Align = alTop
|
||||
TabOrder = 4
|
||||
@ -441,7 +441,7 @@ object MainFrameDlg: TMainFrameDlg
|
||||
object GroupBoxSlider: TGroupBox
|
||||
Left = 0
|
||||
Top = 60
|
||||
Width = 526
|
||||
Width = 527
|
||||
Height = 40
|
||||
Align = alTop
|
||||
Caption = '0:00:00'
|
||||
@ -450,7 +450,7 @@ object MainFrameDlg: TMainFrameDlg
|
||||
object TrackBar: TTrackBar
|
||||
Left = 2
|
||||
Top = 15
|
||||
Width = 522
|
||||
Width = 523
|
||||
Height = 21
|
||||
Align = alTop
|
||||
Orientation = trHorizontal
|
||||
|
@ -185,9 +185,12 @@ __published: // IDE-managed Components
|
||||
void __fastcall ButtonGoClick( TObject *Sender );
|
||||
private: // User declarations
|
||||
public: // User declarations
|
||||
TStringList *StringListPref; /* stores config dialogs */
|
||||
__fastcall TMainFrameDlg( TComponent* Owner );
|
||||
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 );
|
||||
|
@ -158,6 +158,7 @@ __fastcall TGroupBoxPlugin::TGroupBoxPlugin( TComponent* Owner,
|
||||
/* init configure button */
|
||||
ButtonConfig = CreateButton( this, 16, 70, 192, 25, "Configure" );
|
||||
ButtonConfig->Enabled = false;
|
||||
ButtonConfig->OnClick = ButtonConfigClick;
|
||||
|
||||
/* init select button */
|
||||
ButtonSelect = CreateButton( this, 110, 70, 192, 25, "Select" );
|
||||
@ -210,7 +211,7 @@ void __fastcall TGroupBoxPlugin::ButtonSelectClick( TObject *Sender )
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TGroupBoxPlugin::ButtonConfigClick( TObject *Sender )
|
||||
{
|
||||
/* FIXME: TODO */
|
||||
p_intfGlobal->p_sys->p_window->CreatePreferences( ModuleSelected->psz_name );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TGroupBoxPlugin::UpdateChanges()
|
||||
@ -326,14 +327,18 @@ void __fastcall TPreferencesDlg::FormClose( TObject *Sender,
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TPreferencesDlg::FormShow( TObject *Sender )
|
||||
{
|
||||
/*
|
||||
p_intfGlobal->p_sys->p_window->MenuPreferences->Checked = true;
|
||||
p_intfGlobal->p_sys->p_window->PopupPreferences->Checked = true;
|
||||
*/
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TPreferencesDlg::FormHide( TObject *Sender )
|
||||
{
|
||||
/*
|
||||
p_intfGlobal->p_sys->p_window->MenuPreferences->Checked = false;
|
||||
p_intfGlobal->p_sys->p_window->PopupPreferences->Checked = false;
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
@ -352,7 +357,6 @@ void __fastcall TPreferencesDlg::FormHide( TObject *Sender )
|
||||
|
||||
void __fastcall TPreferencesDlg::CreateConfigDialog( char *psz_module_name )
|
||||
{
|
||||
bool config_dialog;
|
||||
module_t *p_module;
|
||||
module_t *p_module_plugins;
|
||||
unsigned int i;
|
||||
@ -367,28 +371,10 @@ void __fastcall TPreferencesDlg::CreateConfigDialog( char *psz_module_name )
|
||||
TGroupBoxBool *GroupBoxBool;
|
||||
TListItem *ListItem;
|
||||
|
||||
/* 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. */
|
||||
|
||||
/* FIXME: we must find a way of really checking whether the dialog
|
||||
* box is already opened */
|
||||
config_dialog = false;
|
||||
|
||||
if( config_dialog )
|
||||
{
|
||||
/* Yeah it was open */
|
||||
Show();
|
||||
return;
|
||||
}
|
||||
|
||||
/* Look for the selected module */
|
||||
for( p_module = p_module_bank->first ; p_module != NULL ;
|
||||
p_module = p_module->next )
|
||||
{
|
||||
|
||||
if( psz_module_name && !strcmp( psz_module_name, p_module->psz_name ) )
|
||||
break;
|
||||
}
|
||||
@ -498,14 +484,6 @@ void __fastcall TPreferencesDlg::CreateConfigDialog( char *psz_module_name )
|
||||
* FIXME: i don't know why, but both lines are necessary */
|
||||
PageControlPref->ActivePageIndex = 1;
|
||||
PageControlPref->ActivePageIndex = 0;
|
||||
|
||||
/* Ok, job done successfully. Let's keep a reference to the dialog box*/
|
||||
/* FIXME: TODO */
|
||||
|
||||
/* we want this ref to be destroyed if the object is destroyed */
|
||||
/* FIXME: TODO */
|
||||
|
||||
Show();
|
||||
}
|
||||
#undef ADD_PANEL
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -242,6 +242,7 @@ object PreferencesDlg: TPreferencesDlg
|
||||
01FFFFFF0000FFFF01FFFFFF0000FFFF81FFFFFF0000FFFFC3FFFFFF0000FFFF
|
||||
FFFFFFFF0000FFFFFFFFFFFF0000FFFFFFFFFFFF0000FFFFFFFFFFFF0000}
|
||||
OldCreateOrder = False
|
||||
Position = poDefaultPosOnly
|
||||
OnClose = FormClose
|
||||
OnHide = FormHide
|
||||
OnShow = FormShow
|
||||
|
Loading…
Reference in New Issue
Block a user