]> git.sesse.net Git - vlc/blobdiff - plugins/win32/mainframe.cpp
* ./src/interface/main.c: tidied the help output code.
[vlc] / plugins / win32 / mainframe.cpp
index 405e3341b07895e15aa595d7c9eb2532d31901d1..eaa517dc03b5b6b15f03e4a6e0a879932401f810 100644 (file)
@@ -68,6 +68,13 @@ __fastcall TMainFrameDlg::TMainFrameDlg( TComponent* Owner )
 \r
     /* default height */\r
     ClientHeight = 37 + ToolBar->Height;\r
+\r
+    StringListPref = new TStringList();\r
+}\r
+//---------------------------------------------------------------------------\r
+__fastcall TMainFrameDlg::~TMainFrameDlg()\r
+{\r
+    delete StringListPref;\r
 }\r
 //---------------------------------------------------------------------------\r
 \r
@@ -210,17 +217,7 @@ void __fastcall TMainFrameDlg::MenuMessagesClick( TObject *Sender )
 //---------------------------------------------------------------------------\r
 void __fastcall TMainFrameDlg::MenuPreferencesClick( TObject *Sender )\r
 {\r
-    TPreferencesDlg *p_preferences = p_intfGlobal->p_sys->p_preferences;\r
-    if( p_preferences == NULL )\r
-    {\r
-        p_preferences = new TPreferencesDlg( this );\r
-        p_preferences->CreateConfigDialog( "main" );\r
-        p_intfGlobal->p_sys->p_preferences = p_preferences;\r
-    }\r
-    else\r
-    {\r
-        p_preferences->Show();\r
-    }\r
+    CreatePreferences( "main" );\r
 }\r
 //---------------------------------------------------------------------------\r
 void __fastcall TMainFrameDlg::MenuAboutClick( TObject *Sender )\r
@@ -295,7 +292,7 @@ void __fastcall TMainFrameDlg::ToolButtonNextClick( TObject *Sender )
     p_intfGlobal->p_sys->p_playlist->Next();\r
 }\r
 //---------------------------------------------------------------------------\r
-void __fastcall TMainFrameDlg::ToolButtonEjecttempClick( TObject *Sender )\r
+void __fastcall TMainFrameDlg::ToolButtonEjectClick( TObject *Sender )\r
 {\r
     AnsiString Device = "";\r
 \r
@@ -608,7 +605,7 @@ void __fastcall TMainFrameDlg::ModeManage()
                 GroupBoxNetwork->Visible = true;\r
                 ActiveGB = GroupBoxNetwork;\r
                 LabelServer->Caption = p_input_bank->pp_input[0]->psz_source;\r
-                if( config_GetIntVariable( "network_channel" ) )\r
+                if( config_GetIntVariable( "network-channel" ) )\r
                 {\r
                     LabelChannel->Visible = true;\r
                 }\r
@@ -653,7 +650,7 @@ void __fastcall TMainFrameDlg::ModeManage()
     {\r
         i_Height = StatusBar->Height + ToolBar->Height + 47;\r
 \r
-        if( config_GetIntVariable( "network_channel" ) )\r
+        if( config_GetIntVariable( "network-channel" ) )\r
         {\r
             GroupBoxNetwork->Visible = true;\r
             LabelChannel->Visible = true;\r
@@ -690,3 +687,40 @@ void __fastcall TMainFrameDlg::ModeManage()
 }\r
 //---------------------------------------------------------------------------\r
 \r
+\r
+/*****************************************************************************\r
+ * CreateConfig: create a configuration dialog and save it for further use\r
+ *****************************************************************************\r
+ * Check if the dialog box is already opened, if so this will save us\r
+ * quite a bit of work. (the interface will be destroyed when you actually\r
+ * close the main window, but remember that it is only hidden if you\r
+ * clicked on the action buttons). This trick also allows us not to\r
+ * duplicate identical dialog windows.\r
+ *****************************************************************************/\r
+void __fastcall TMainFrameDlg::CreatePreferences( AnsiString Name )\r
+{\r
+    TPreferencesDlg *Preferences;\r
+    int i_index, i_pos;\r
+\r
+    i_index = StringListPref->IndexOf( Name );\r
+    if( i_index != -1 )\r
+    {\r
+        /* config dialog already exists */\r
+        Preferences = (TPreferencesDlg *)StringListPref->Objects[i_index];\r
+    }\r
+    else\r
+    {\r
+        /* create the config dialog */\r
+        Preferences = new TPreferencesDlg( this );\r
+        Preferences->CreateConfigDialog( Name.c_str() );\r
+\r
+        /* save it */\r
+        i_pos = StringListPref->Add( Name );\r
+        StringListPref->Objects[i_pos] = Preferences;\r
+    }\r
+\r
+    /* display the dialog */\r
+    Preferences->Show();\r
+}\r
+//---------------------------------------------------------------------------\r
+\r