Commit 3fdc9959 authored by Olivier Teulière's avatar Olivier Teulière

 * ./plugins/win32/*: Added management for secondary config dialogs
parent 5ba63c66
...@@ -68,6 +68,13 @@ __fastcall TMainFrameDlg::TMainFrameDlg( TComponent* Owner ) ...@@ -68,6 +68,13 @@ __fastcall TMainFrameDlg::TMainFrameDlg( TComponent* Owner )
/* default height */ /* default height */
ClientHeight = 37 + ToolBar->Height; ClientHeight = 37 + ToolBar->Height;
StringListPref = new TStringList();
}
//---------------------------------------------------------------------------
__fastcall TMainFrameDlg::~TMainFrameDlg()
{
delete StringListPref;
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
...@@ -210,17 +217,7 @@ void __fastcall TMainFrameDlg::MenuMessagesClick( TObject *Sender ) ...@@ -210,17 +217,7 @@ void __fastcall TMainFrameDlg::MenuMessagesClick( TObject *Sender )
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void __fastcall TMainFrameDlg::MenuPreferencesClick( TObject *Sender ) void __fastcall TMainFrameDlg::MenuPreferencesClick( TObject *Sender )
{ {
TPreferencesDlg *p_preferences = p_intfGlobal->p_sys->p_preferences; CreatePreferences( "main" );
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();
}
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void __fastcall TMainFrameDlg::MenuAboutClick( TObject *Sender ) void __fastcall TMainFrameDlg::MenuAboutClick( TObject *Sender )
...@@ -690,3 +687,41 @@ void __fastcall TMainFrameDlg::ModeManage() ...@@ -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();
}
//---------------------------------------------------------------------------
object MainFrameDlg: TMainFrameDlg object MainFrameDlg: TMainFrameDlg
Left = 304 Left = 314
Top = 245 Top = 198
Width = 534 Width = 535
Height = 307 Height = 306
BorderIcons = [biSystemMenu, biMinimize] BorderIcons = [biSystemMenu, biMinimize]
Caption = 'VideoLAN Client (win32 interface)' Caption = 'VideoLAN Client (win32 interface)'
Color = clBtnFace Color = clBtnFace
...@@ -140,7 +140,7 @@ object MainFrameDlg: TMainFrameDlg ...@@ -140,7 +140,7 @@ object MainFrameDlg: TMainFrameDlg
object ToolBar: TToolBar object ToolBar: TToolBar
Left = 0 Left = 0
Top = 0 Top = 0
Width = 526 Width = 527
Height = 60 Height = 60
ButtonHeight = 52 ButtonHeight = 52
ButtonWidth = 39 ButtonWidth = 39
...@@ -276,8 +276,8 @@ object MainFrameDlg: TMainFrameDlg ...@@ -276,8 +276,8 @@ object MainFrameDlg: TMainFrameDlg
end end
object StatusBar: TStatusBar object StatusBar: TStatusBar
Left = 0 Left = 0
Top = 242 Top = 241
Width = 526 Width = 527
Height = 19 Height = 19
Panels = <> Panels = <>
ParentShowHint = False ParentShowHint = False
...@@ -287,7 +287,7 @@ object MainFrameDlg: TMainFrameDlg ...@@ -287,7 +287,7 @@ object MainFrameDlg: TMainFrameDlg
object GroupBoxFile: TGroupBox object GroupBoxFile: TGroupBox
Left = 0 Left = 0
Top = 100 Top = 100
Width = 526 Width = 527
Height = 32 Height = 32
Align = alTop Align = alTop
TabOrder = 2 TabOrder = 2
...@@ -295,7 +295,7 @@ object MainFrameDlg: TMainFrameDlg ...@@ -295,7 +295,7 @@ object MainFrameDlg: TMainFrameDlg
object LabelFileName: TLabel object LabelFileName: TLabel
Left = 2 Left = 2
Top = 15 Top = 15
Width = 522 Width = 523
Height = 15 Height = 15
Align = alClient Align = alClient
Alignment = taCenter Alignment = taCenter
...@@ -305,7 +305,7 @@ object MainFrameDlg: TMainFrameDlg ...@@ -305,7 +305,7 @@ object MainFrameDlg: TMainFrameDlg
object GroupBoxNetwork: TGroupBox object GroupBoxNetwork: TGroupBox
Left = 0 Left = 0
Top = 164 Top = 164
Width = 526 Width = 527
Height = 40 Height = 40
Align = alTop Align = alTop
TabOrder = 3 TabOrder = 3
...@@ -357,7 +357,7 @@ object MainFrameDlg: TMainFrameDlg ...@@ -357,7 +357,7 @@ object MainFrameDlg: TMainFrameDlg
object GroupBoxDisc: TGroupBox object GroupBoxDisc: TGroupBox
Left = 0 Left = 0
Top = 132 Top = 132
Width = 526 Width = 527
Height = 32 Height = 32
Align = alTop Align = alTop
TabOrder = 4 TabOrder = 4
...@@ -441,7 +441,7 @@ object MainFrameDlg: TMainFrameDlg ...@@ -441,7 +441,7 @@ object MainFrameDlg: TMainFrameDlg
object GroupBoxSlider: TGroupBox object GroupBoxSlider: TGroupBox
Left = 0 Left = 0
Top = 60 Top = 60
Width = 526 Width = 527
Height = 40 Height = 40
Align = alTop Align = alTop
Caption = '0:00:00' Caption = '0:00:00'
...@@ -450,7 +450,7 @@ object MainFrameDlg: TMainFrameDlg ...@@ -450,7 +450,7 @@ object MainFrameDlg: TMainFrameDlg
object TrackBar: TTrackBar object TrackBar: TTrackBar
Left = 2 Left = 2
Top = 15 Top = 15
Width = 522 Width = 523
Height = 21 Height = 21
Align = alTop Align = alTop
Orientation = trHorizontal Orientation = trHorizontal
......
...@@ -185,9 +185,12 @@ __published: // IDE-managed Components ...@@ -185,9 +185,12 @@ __published: // IDE-managed Components
void __fastcall ButtonGoClick( TObject *Sender ); void __fastcall ButtonGoClick( TObject *Sender );
private: // User declarations private: // User declarations
public: // User declarations public: // User declarations
TStringList *StringListPref; /* stores config dialogs */
__fastcall TMainFrameDlg( TComponent* Owner ); __fastcall TMainFrameDlg( TComponent* Owner );
virtual __fastcall ~TMainFrameDlg();
void __fastcall DisplayHint( TObject *Sender ); void __fastcall DisplayHint( TObject *Sender );
void __fastcall ModeManage(); void __fastcall ModeManage();
void __fastcall CreatePreferences( AnsiString Name );
void __fastcall MenuProgramClick( TObject *Sender ); void __fastcall MenuProgramClick( TObject *Sender );
void __fastcall MenuAudioClick( TObject *Sender ); void __fastcall MenuAudioClick( TObject *Sender );
void __fastcall MenuSubtitleClick( TObject *Sender ); void __fastcall MenuSubtitleClick( TObject *Sender );
......
...@@ -158,6 +158,7 @@ __fastcall TGroupBoxPlugin::TGroupBoxPlugin( TComponent* Owner, ...@@ -158,6 +158,7 @@ __fastcall TGroupBoxPlugin::TGroupBoxPlugin( TComponent* Owner,
/* init configure button */ /* init configure button */
ButtonConfig = CreateButton( this, 16, 70, 192, 25, "Configure" ); ButtonConfig = CreateButton( this, 16, 70, 192, 25, "Configure" );
ButtonConfig->Enabled = false; ButtonConfig->Enabled = false;
ButtonConfig->OnClick = ButtonConfigClick;
/* init select button */ /* init select button */
ButtonSelect = CreateButton( this, 110, 70, 192, 25, "Select" ); ButtonSelect = CreateButton( this, 110, 70, 192, 25, "Select" );
...@@ -210,7 +211,7 @@ void __fastcall TGroupBoxPlugin::ButtonSelectClick( TObject *Sender ) ...@@ -210,7 +211,7 @@ void __fastcall TGroupBoxPlugin::ButtonSelectClick( TObject *Sender )
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void __fastcall TGroupBoxPlugin::ButtonConfigClick( TObject *Sender ) void __fastcall TGroupBoxPlugin::ButtonConfigClick( TObject *Sender )
{ {
/* FIXME: TODO */ p_intfGlobal->p_sys->p_window->CreatePreferences( ModuleSelected->psz_name );
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void __fastcall TGroupBoxPlugin::UpdateChanges() void __fastcall TGroupBoxPlugin::UpdateChanges()
...@@ -326,14 +327,18 @@ void __fastcall TPreferencesDlg::FormClose( TObject *Sender, ...@@ -326,14 +327,18 @@ void __fastcall TPreferencesDlg::FormClose( TObject *Sender,
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void __fastcall TPreferencesDlg::FormShow( TObject *Sender ) void __fastcall TPreferencesDlg::FormShow( TObject *Sender )
{ {
/*
p_intfGlobal->p_sys->p_window->MenuPreferences->Checked = true; p_intfGlobal->p_sys->p_window->MenuPreferences->Checked = true;
p_intfGlobal->p_sys->p_window->PopupPreferences->Checked = true; p_intfGlobal->p_sys->p_window->PopupPreferences->Checked = true;
*/
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void __fastcall TPreferencesDlg::FormHide( TObject *Sender ) void __fastcall TPreferencesDlg::FormHide( TObject *Sender )
{ {
/*
p_intfGlobal->p_sys->p_window->MenuPreferences->Checked = false; p_intfGlobal->p_sys->p_window->MenuPreferences->Checked = false;
p_intfGlobal->p_sys->p_window->PopupPreferences->Checked = false; p_intfGlobal->p_sys->p_window->PopupPreferences->Checked = false;
*/
} }
...@@ -352,7 +357,6 @@ void __fastcall TPreferencesDlg::FormHide( TObject *Sender ) ...@@ -352,7 +357,6 @@ void __fastcall TPreferencesDlg::FormHide( TObject *Sender )
void __fastcall TPreferencesDlg::CreateConfigDialog( char *psz_module_name ) void __fastcall TPreferencesDlg::CreateConfigDialog( char *psz_module_name )
{ {
bool config_dialog;
module_t *p_module; module_t *p_module;
module_t *p_module_plugins; module_t *p_module_plugins;
unsigned int i; unsigned int i;
...@@ -367,28 +371,10 @@ void __fastcall TPreferencesDlg::CreateConfigDialog( char *psz_module_name ) ...@@ -367,28 +371,10 @@ void __fastcall TPreferencesDlg::CreateConfigDialog( char *psz_module_name )
TGroupBoxBool *GroupBoxBool; TGroupBoxBool *GroupBoxBool;
TListItem *ListItem; 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 */ /* Look for the selected module */
for( p_module = p_module_bank->first ; p_module != NULL ; for( p_module = p_module_bank->first ; p_module != NULL ;
p_module = p_module->next ) p_module = p_module->next )
{ {
if( psz_module_name && !strcmp( psz_module_name, p_module->psz_name ) ) if( psz_module_name && !strcmp( psz_module_name, p_module->psz_name ) )
break; break;
} }
...@@ -498,14 +484,6 @@ void __fastcall TPreferencesDlg::CreateConfigDialog( char *psz_module_name ) ...@@ -498,14 +484,6 @@ void __fastcall TPreferencesDlg::CreateConfigDialog( char *psz_module_name )
* FIXME: i don't know why, but both lines are necessary */ * FIXME: i don't know why, but both lines are necessary */
PageControlPref->ActivePageIndex = 1; PageControlPref->ActivePageIndex = 1;
PageControlPref->ActivePageIndex = 0; 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 #undef ADD_PANEL
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
......
...@@ -242,6 +242,7 @@ object PreferencesDlg: TPreferencesDlg ...@@ -242,6 +242,7 @@ object PreferencesDlg: TPreferencesDlg
01FFFFFF0000FFFF01FFFFFF0000FFFF81FFFFFF0000FFFFC3FFFFFF0000FFFF 01FFFFFF0000FFFF01FFFFFF0000FFFF81FFFFFF0000FFFFC3FFFFFF0000FFFF
FFFFFFFF0000FFFFFFFFFFFF0000FFFFFFFFFFFF0000FFFFFFFFFFFF0000} FFFFFFFF0000FFFFFFFFFFFF0000FFFFFFFFFFFF0000FFFFFFFFFFFF0000}
OldCreateOrder = False OldCreateOrder = False
Position = poDefaultPosOnly
OnClose = FormClose OnClose = FormClose
OnHide = FormHide OnHide = FormHide
OnShow = FormShow OnShow = FormShow
......
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