]> git.sesse.net Git - vlc/commitdiff
* ./plugins/win32/*: Added management for secondary config dialogs
authorOlivier Teulière <ipkiss@videolan.org>
Wed, 3 Apr 2002 13:18:36 +0000 (13:18 +0000)
committerOlivier Teulière <ipkiss@videolan.org>
Wed, 3 Apr 2002 13:18:36 +0000 (13:18 +0000)
plugins/win32/mainframe.cpp
plugins/win32/mainframe.dfm
plugins/win32/mainframe.h
plugins/win32/preferences.cpp
plugins/win32/preferences.dfm

index 405e3341b07895e15aa595d7c9eb2532d31901d1..c0a1b5d5ed2465d8facc144e25b5fd06204b3fff 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
@@ -690,3 +687,41 @@ 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
+\r
index af9d1c8b4c7509b7946551e1e72e0c5b5717f850..161420d40387c53ab424b99734a5a58c5d083ed7 100644 (file)
@@ -1,8 +1,8 @@
 object MainFrameDlg: TMainFrameDlg\r
-  Left = 304\r
-  Top = 245\r
-  Width = 534\r
-  Height = 307\r
+  Left = 314\r
+  Top = 198\r
+  Width = 535\r
+  Height = 306\r
   BorderIcons = [biSystemMenu, biMinimize]\r
   Caption = 'VideoLAN Client (win32 interface)'\r
   Color = clBtnFace\r
@@ -140,7 +140,7 @@ object MainFrameDlg: TMainFrameDlg
   object ToolBar: TToolBar\r
     Left = 0\r
     Top = 0\r
-    Width = 526\r
+    Width = 527\r
     Height = 60\r
     ButtonHeight = 52\r
     ButtonWidth = 39\r
@@ -276,8 +276,8 @@ object MainFrameDlg: TMainFrameDlg
   end\r
   object StatusBar: TStatusBar\r
     Left = 0\r
-    Top = 242\r
-    Width = 526\r
+    Top = 241\r
+    Width = 527\r
     Height = 19\r
     Panels = <>\r
     ParentShowHint = False\r
@@ -287,7 +287,7 @@ object MainFrameDlg: TMainFrameDlg
   object GroupBoxFile: TGroupBox\r
     Left = 0\r
     Top = 100\r
-    Width = 526\r
+    Width = 527\r
     Height = 32\r
     Align = alTop\r
     TabOrder = 2\r
@@ -295,7 +295,7 @@ object MainFrameDlg: TMainFrameDlg
     object LabelFileName: TLabel\r
       Left = 2\r
       Top = 15\r
-      Width = 522\r
+      Width = 523\r
       Height = 15\r
       Align = alClient\r
       Alignment = taCenter\r
@@ -305,7 +305,7 @@ object MainFrameDlg: TMainFrameDlg
   object GroupBoxNetwork: TGroupBox\r
     Left = 0\r
     Top = 164\r
-    Width = 526\r
+    Width = 527\r
     Height = 40\r
     Align = alTop\r
     TabOrder = 3\r
@@ -357,7 +357,7 @@ object MainFrameDlg: TMainFrameDlg
   object GroupBoxDisc: TGroupBox\r
     Left = 0\r
     Top = 132\r
-    Width = 526\r
+    Width = 527\r
     Height = 32\r
     Align = alTop\r
     TabOrder = 4\r
@@ -441,7 +441,7 @@ object MainFrameDlg: TMainFrameDlg
   object GroupBoxSlider: TGroupBox\r
     Left = 0\r
     Top = 60\r
-    Width = 526\r
+    Width = 527\r
     Height = 40\r
     Align = alTop\r
     Caption = '0:00:00'\r
@@ -450,7 +450,7 @@ object MainFrameDlg: TMainFrameDlg
     object TrackBar: TTrackBar\r
       Left = 2\r
       Top = 15\r
-      Width = 522\r
+      Width = 523\r
       Height = 21\r
       Align = alTop\r
       Orientation = trHorizontal\r
index f4917a02aa3ed1258d4936fb961a6084a0327e53..b46dc425abdc4019ad5990c12157f44fc08c61c2 100644 (file)
@@ -185,9 +185,12 @@ __published:       // IDE-managed Components
     void __fastcall ButtonGoClick( TObject *Sender );\r
 private:       // User declarations\r
 public:                // User declarations\r
+    TStringList *StringListPref;                   /* stores config dialogs */\r
     __fastcall TMainFrameDlg( TComponent* Owner );\r
+    virtual __fastcall ~TMainFrameDlg();\r
     void __fastcall DisplayHint( TObject *Sender );\r
     void __fastcall ModeManage();\r
+    void __fastcall CreatePreferences( AnsiString Name );\r
     void __fastcall MenuProgramClick( TObject *Sender );\r
     void __fastcall MenuAudioClick( TObject *Sender );\r
     void __fastcall MenuSubtitleClick( TObject *Sender );\r
index a04b669b4d178068b75443f908aeec49b53407b3..3617df5175dab9a9002792b0a36f9742c09c461e 100644 (file)
@@ -158,6 +158,7 @@ __fastcall TGroupBoxPlugin::TGroupBoxPlugin( TComponent* Owner,
     /* init configure button */\r
     ButtonConfig = CreateButton( this, 16, 70, 192, 25, "Configure" );\r
     ButtonConfig->Enabled = false;\r
+    ButtonConfig->OnClick = ButtonConfigClick;\r
 \r
     /* init select button */\r
     ButtonSelect = CreateButton( this, 110, 70, 192, 25, "Select" );\r
@@ -210,7 +211,7 @@ void __fastcall TGroupBoxPlugin::ButtonSelectClick( TObject *Sender )
 //---------------------------------------------------------------------------\r
 void __fastcall TGroupBoxPlugin::ButtonConfigClick( TObject *Sender )\r
 {\r
-    /* FIXME: TODO */\r
+    p_intfGlobal->p_sys->p_window->CreatePreferences( ModuleSelected->psz_name );\r
 }\r
 //---------------------------------------------------------------------------\r
 void __fastcall TGroupBoxPlugin::UpdateChanges()\r
@@ -326,14 +327,18 @@ void __fastcall TPreferencesDlg::FormClose( TObject *Sender,
 //---------------------------------------------------------------------------\r
 void __fastcall TPreferencesDlg::FormShow( TObject *Sender )\r
 {\r
+/*\r
     p_intfGlobal->p_sys->p_window->MenuPreferences->Checked = true;\r
     p_intfGlobal->p_sys->p_window->PopupPreferences->Checked = true;\r
+*/\r
 }\r
 //---------------------------------------------------------------------------\r
 void __fastcall TPreferencesDlg::FormHide( TObject *Sender )\r
 {\r
+/*\r
     p_intfGlobal->p_sys->p_window->MenuPreferences->Checked = false;\r
     p_intfGlobal->p_sys->p_window->PopupPreferences->Checked = false;\r
+*/\r
 }\r
 \r
 \r
@@ -352,7 +357,6 @@ void __fastcall TPreferencesDlg::FormHide( TObject *Sender )
 \r
 void __fastcall TPreferencesDlg::CreateConfigDialog( char *psz_module_name )\r
 {\r
-    bool                config_dialog;\r
     module_t           *p_module;\r
     module_t           *p_module_plugins;\r
     unsigned int        i;\r
@@ -367,28 +371,10 @@ void __fastcall TPreferencesDlg::CreateConfigDialog( char *psz_module_name )
     TGroupBoxBool      *GroupBoxBool;\r
     TListItem          *ListItem;\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
-    /* FIXME: we must find a way of really checking whether the dialog\r
-     * box is already opened */\r
-    config_dialog = false;\r
-\r
-    if( config_dialog )\r
-    {\r
-        /* Yeah it was open */\r
-        Show();\r
-        return;\r
-    }\r
-\r
     /* Look for the selected module */\r
     for( p_module = p_module_bank->first ; p_module != NULL ;\r
          p_module = p_module->next )\r
     {\r
-\r
         if( psz_module_name && !strcmp( psz_module_name, p_module->psz_name ) )\r
             break;\r
     }\r
@@ -498,14 +484,6 @@ void __fastcall TPreferencesDlg::CreateConfigDialog( char *psz_module_name )
      * FIXME: i don't know why, but both lines are necessary */\r
     PageControlPref->ActivePageIndex = 1;\r
     PageControlPref->ActivePageIndex = 0;\r
-\r
-    /* Ok, job done successfully. Let's keep a reference to the dialog box*/\r
-    /* FIXME: TODO */\r
-\r
-    /* we want this ref to be destroyed if the object is destroyed */\r
-    /* FIXME: TODO */\r
-    \r
-    Show();\r
 }\r
 #undef ADD_PANEL\r
 //---------------------------------------------------------------------------\r
index 81de0fc21c32345545af305421c5283a1326e7f6..54dc0dad39317d76db7b54f4f4cf177205e5fc9f 100644 (file)
@@ -242,6 +242,7 @@ object PreferencesDlg: TPreferencesDlg
     01FFFFFF0000FFFF01FFFFFF0000FFFF81FFFFFF0000FFFFC3FFFFFF0000FFFF\r
     FFFFFFFF0000FFFFFFFFFFFF0000FFFFFFFFFFFF0000FFFFFFFFFFFF0000}\r
   OldCreateOrder = False\r
+  Position = poDefaultPosOnly\r
   OnClose = FormClose\r
   OnHide = FormHide\r
   OnShow = FormShow\r