]> git.sesse.net Git - vlc/commitdiff
* modules/*: got rid of empty module objects.
authorGildas Bazin <gbazin@videolan.org>
Tue, 17 Jun 2003 16:09:16 +0000 (16:09 +0000)
committerGildas Bazin <gbazin@videolan.org>
Tue, 17 Jun 2003 16:09:16 +0000 (16:09 +0000)
* modules/gui/wxwindows/preferences.cpp: fixed the config options display for submodules.

modules/access/dvd/dvd.c
modules/access/dvdplay/dvd.c
modules/access/dvdread/dvdread.c
modules/access/slp.c
modules/gui/beos/BeOS.cpp
modules/gui/macosx/macosx.m
modules/gui/qnx/qnx.c
modules/gui/wxwindows/preferences.cpp
modules/misc/dummy/dummy.c
modules/misc/sap.c

index 02d0ca50a980fc97d9ea2db1ac6ab84db5bf4b5c..94dbfb9205eb1e543924fc925a57090bc98c8f11 100644 (file)
@@ -2,7 +2,7 @@
  * dvd.c : DVD input module for vlc
  *****************************************************************************
  * Copyright (C) 2000-2001 VideoLAN
- * $Id: dvd.c,v 1.7 2003/05/15 22:27:36 massiot Exp $
+ * $Id: dvd.c,v 1.8 2003/06/17 16:09:16 gbazin Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -96,9 +96,9 @@ vlc_module_begin();
 #endif
     add_shortcut( "dvdold" );
     add_shortcut( "dvdsimple" );
-    add_submodule();
-        set_capability( "access", i );
-        set_callbacks( E_(DVDOpen), E_(DVDClose) );
+    set_capability( "access", i );
+    set_callbacks( E_(DVDOpen), E_(DVDClose) );
+
     add_submodule();
         set_capability( "demux", 0 );
         set_callbacks( E_(DVDInit), E_(DVDEnd) );
index 936a99e8001f85d6b61f142bb55fb96958b8f1dc..6a5ef88dc07c52e7c136fb36cdcf91410731d4b6 100644 (file)
@@ -7,7 +7,7 @@
  *****************************************************************************
  *    
  * Copyright (C) 2001 VideoLAN
- * $Id: dvd.c,v 1.5 2003/03/30 18:14:35 gbazin Exp $
+ * $Id: dvd.c,v 1.6 2003/06/17 16:09:16 gbazin Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -50,10 +50,9 @@ void E_(CloseIntf) ( vlc_object_t * );
 vlc_module_begin();
     add_usage_hint( N_("[dvdplay:][device][@[title][,[chapter][,angle]]]") );
     set_description( _("DVD input with menus support") );
-    add_submodule();
-        set_capability( "access", 120 );
-        set_callbacks( E_(OpenDVD), E_(CloseDVD) );
-        add_shortcut( "dvd" );
+    set_capability( "access", 120 );
+    set_callbacks( E_(OpenDVD), E_(CloseDVD) );
+    add_shortcut( "dvd" );
     add_submodule();
         set_capability( "demux", 0 );
         set_callbacks( E_(InitDVD), E_(EndDVD) );
index cf79cb95aa3d69b8d4775f5c39da80018ff527f5..fccf632e77d4ca596a6b87e32708afc72d644dea 100644 (file)
@@ -2,7 +2,7 @@
  * dvdread.c : DvdRead input module for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: dvdread.c,v 1.6 2003/03/30 18:14:35 gbazin Exp $
+ * $Id: dvdread.c,v 1.7 2003/06/17 16:09:16 gbazin Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -43,9 +43,8 @@ void E_(EndDVD)    ( vlc_object_t * );
  *****************************************************************************/
 vlc_module_begin();
     set_description( _("DVD input (using libdvdread)") );
-    add_submodule();
-        set_capability( "access", 110 );
-        set_callbacks( E_(OpenDVD), E_(CloseDVD) );
+    set_capability( "access", 110 );
+    set_callbacks( E_(OpenDVD), E_(CloseDVD) );
     add_submodule();
         set_capability( "demux", 0 );
         set_callbacks( E_(InitDVD), E_(EndDVD) );
index efae932218b6d40a8f26d51131d185d802920169..39cadd3e365ca8176f878a8d9bf2660039eda63c 100644 (file)
@@ -2,7 +2,7 @@
  * slp.c: SLP access plugin
  *****************************************************************************
  * Copyright (C) 2001, 2002 VideoLAN
- * $Id: slp.c,v 1.11 2003/05/15 22:27:36 massiot Exp $
+ * $Id: slp.c,v 1.12 2003/06/17 16:09:16 gbazin Exp $
  *
  * Authors: Loïc Minier <lool@videolan.org>
  *
@@ -84,9 +84,9 @@ vlc_module_begin();
                 NAMINGAUTHORITY_LONGTEXT, VLC_TRUE );
     add_string( "slp-filter", "", NULL, FILTER_TEXT, FILTER_LONGTEXT, VLC_TRUE );
     add_string( "slp-lang", "", NULL, LANG_TEXT, LANG_LONGTEXT, VLC_TRUE );
-    add_submodule();
-        set_capability( "access", 0 );
-        set_callbacks( Open, Close );
+    set_capability( "access", 0 );
+    set_callbacks( Open, Close );
+
     add_submodule();
         add_shortcut( "demux_slp" );
         set_capability( "demux", 0 );
index 840aa2f172243af2e0d4ce64446a89124ab90554..a8e29860f100baab17391b9c15e69d1fa8cb7e27 100644 (file)
@@ -2,7 +2,7 @@
  * beos.cpp : BeOS plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000, 2001 VideoLAN
- * $Id: BeOS.cpp,v 1.11 2003/06/03 12:06:29 titer Exp $
+ * $Id: BeOS.cpp,v 1.12 2003/06/17 16:09:16 gbazin Exp $
  *
  * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -53,9 +53,9 @@ vlc_module_begin();
     add_string( "beos-screenshotpath", "/boot/home/", NULL, "Screenshot Path", "", VLC_TRUE );
     add_string_from_list( "beos-screenshotformat", "PNG", ppsz_screenshotformat, NULL, "Screenshot Format", "", VLC_TRUE );
     set_description( _("BeOS standard API interface") );
-    add_submodule();
-        set_capability( "interface", 100 );
-        set_callbacks( E_(OpenIntf), E_(CloseIntf) );
+    set_capability( "interface", 100 );
+    set_callbacks( E_(OpenIntf), E_(CloseIntf) );
+
     add_submodule();                                     
         set_capability( "video output", 100 );
         set_callbacks( E_(OpenVideo), E_(CloseVideo) );
index ad23cd23121a1226c4ff6e807ef62d407340c1f9..49243964ed5efa3de9c8fc354e4114a3085e24b4 100644 (file)
@@ -2,7 +2,7 @@
  * macosx.m: MacOS X plugin for vlc
  *****************************************************************************
  * Copyright (C) 2001-2003 VideoLAN
- * $Id: macosx.m,v 1.14 2003/06/06 02:48:19 hartman Exp $
+ * $Id: macosx.m,v 1.15 2003/06/17 16:09:16 gbazin Exp $
  *
  * Authors: Colin Delacroix <colin@zoy.org>
  *          Eugenio Jarosiewicz <ej0@cise.ufl.edu>
@@ -60,9 +60,8 @@ void E_(CloseVideo)   ( vlc_object_t * );
 
 vlc_module_begin();
     set_description( _("MacOS X interface, sound and video") );
-    add_submodule();
-        set_capability( "interface", 100 );
-        set_callbacks( E_(OpenIntf), E_(CloseIntf) );
+    set_capability( "interface", 100 );
+    set_callbacks( E_(OpenIntf), E_(CloseIntf) );
     add_submodule();
         set_capability( "video output", 200 );
         set_callbacks( E_(OpenVideo), E_(CloseVideo) );
index 794ed525576911fe2b966c356e79233ecfd70f25..8c8248b45ce455d1fcb4fb33fe9d1bddc2a2c5bc 100644 (file)
@@ -42,9 +42,8 @@ void E_(CloseVideo)   ( vlc_object_t * );
  *****************************************************************************/
 vlc_module_begin();
     set_description( _("QNX RTOS video and audio output") );
-    add_submodule();
-        set_capability( "video output", 100 );
-        set_callbacks( E_(OpenVideo), E_(CloseVideo) );
+    set_capability( "video output", 100 );
+    set_callbacks( E_(OpenVideo), E_(CloseVideo) );
     add_submodule();
         set_capability( "audio output", 100 );
         set_callbacks( E_(OpenAudio), E_(CloseAudio) );
index 66cabba037b925d42680f1af031f13695378d577..3ec76ea668e890fda31110da9facb25ec507e1af 100644 (file)
@@ -2,7 +2,7 @@
  * preferences.cpp : wxWindows plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000-2001 VideoLAN
- * $Id: preferences.cpp,v 1.20 2003/06/16 21:55:58 gbazin Exp $
+ * $Id: preferences.cpp,v 1.21 2003/06/17 16:09:16 gbazin Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *
@@ -66,6 +66,7 @@
 /*****************************************************************************
  * Classes declarations.
  *****************************************************************************/
+class ConfigTreeData;
 class PrefsTreeCtrl : public wxTreeCtrl
 {
 public:
@@ -81,6 +82,7 @@ public:
 private:
     /* Event handlers (these functions should _not_ be virtual) */
     void OnSelectTreeItem( wxTreeEvent& event );
+    ConfigTreeData *FindModuleConfig( ConfigTreeData *config_data );
 
     DECLARE_EVENT_TABLE()
 
@@ -150,9 +152,11 @@ class ConfigTreeData : public wxTreeItemData
 {
 public:
 
-    ConfigTreeData() { panel = NULL; psz_section = NULL; }
+    ConfigTreeData() { b_submodule = 0; panel = NULL; psz_section = NULL; }
     virtual ~ConfigTreeData() { if( panel ) delete panel; }
 
+    vlc_bool_t b_submodule;
+
     PrefsPanel *panel;
     wxBoxSizer *sizer;
     int i_object_id;
@@ -442,7 +446,10 @@ PrefsTreeCtrl::PrefsTreeCtrl( wxWindow *_p_parent, intf_thread_t *_p_intf,
 
         /* Add the plugin to the tree */
         ConfigTreeData *config_data = new ConfigTreeData;
-        config_data->i_object_id = p_module->i_object_id;
+        config_data->b_submodule = p_module->b_submodule;
+        config_data->i_object_id = p_module->b_submodule ?
+            ((module_t *)p_module->p_parent)->i_object_id :
+            p_module->i_object_id;
         AppendItem( capability_item, wxU(p_module->psz_object_name), -1, -1,
                     config_data );
     }
@@ -524,6 +531,14 @@ void PrefsTreeCtrl::CleanChanges()
     long cookie, cookie2;
     ConfigTreeData *config_data;
 
+    config_data = !GetSelection() ? NULL :
+        FindModuleConfig( (ConfigTreeData *)GetItemData( GetSelection() ) );
+    if( config_data  )
+    {
+        config_data->panel->Hide();
+        p_sizer->Remove( config_data->panel );
+    }
+
     /* Clean changes for the main module */
     wxTreeItemId item = GetFirstChild( root_item, cookie );
     for( size_t i_child_index = 0;
@@ -533,20 +548,8 @@ void PrefsTreeCtrl::CleanChanges()
         config_data = (ConfigTreeData *)GetItemData( item );
         if( config_data && config_data->panel )
         {
-            if( item == GetSelection() )
-            {
-                config_data->panel->Hide();
-                p_sizer->Remove( config_data->panel );
-            }
-
             delete config_data->panel;
             config_data->panel = NULL;
-
-            if( item == GetSelection() )
-            {
-                wxTreeEvent event;
-                OnSelectTreeItem( event );
-            }
         }
 
         item = GetNextChild( root_item, cookie );
@@ -567,20 +570,50 @@ void PrefsTreeCtrl::CleanChanges()
 
             if( config_data && config_data->panel )
             {
-                if( item2 == GetSelection() )
-                {
-                    config_data->panel->Hide();
-                    p_sizer->Remove( config_data->panel );
-                }
-
                 delete config_data->panel;
                 config_data->panel = NULL;
+            }
 
-                if( item2 == GetSelection() )
-                {
-                    wxTreeEvent event;
-                    OnSelectTreeItem( event );
-                }
+            item2 = GetNextChild( item, cookie2 );
+        }
+
+        item = GetNextChild( plugins_item, cookie );
+    }
+
+    if( GetSelection() )
+    {
+        wxTreeEvent event;
+        OnSelectTreeItem( event );
+    }
+}
+
+ConfigTreeData *PrefsTreeCtrl::FindModuleConfig( ConfigTreeData *config_data )
+{
+    /* We need this complexity because submodules don't have their own config
+     * options. They use the parent module ones. */
+
+    if( !config_data || !config_data->b_submodule )
+    {
+        return config_data;
+    }
+
+    long cookie, cookie2;
+    ConfigTreeData *config_new;
+    wxTreeItemId item = GetFirstChild( plugins_item, cookie );
+    for( size_t i_child_index = 0;
+         i_child_index < GetChildrenCount( plugins_item, FALSE );
+         i_child_index++ )
+    {
+        wxTreeItemId item2 = GetFirstChild( item, cookie2 );
+        for( size_t i_child_index = 0;
+             i_child_index < GetChildrenCount( item, FALSE );
+             i_child_index++ )
+        {
+            config_new = (ConfigTreeData *)GetItemData( item2 );
+            if( config_new && !config_new->b_submodule &&
+                config_new->i_object_id == config_data->i_object_id )
+            {
+                return config_new;
             }
 
             item2 = GetNextChild( item, cookie2 );
@@ -588,13 +621,17 @@ void PrefsTreeCtrl::CleanChanges()
 
         item = GetNextChild( plugins_item, cookie );
     }
+
+    /* Found nothing */
+    return NULL;
 }
 
 void PrefsTreeCtrl::OnSelectTreeItem( wxTreeEvent& event )
 {
     ConfigTreeData *config_data;
 
-    config_data = (ConfigTreeData *)GetItemData( event.GetOldItem() );
+    config_data = FindModuleConfig( (ConfigTreeData *)GetItemData(
+                                    event.GetOldItem() ) );
     if( config_data && config_data->panel )
     {
         config_data->panel->Hide();
@@ -602,7 +639,8 @@ void PrefsTreeCtrl::OnSelectTreeItem( wxTreeEvent& event )
     }
 
     /* Don't use event.GetItem() because we also send fake events */
-    config_data = (ConfigTreeData *)GetItemData( GetSelection() );
+    config_data = FindModuleConfig( (ConfigTreeData *)GetItemData(
+                                    GetSelection() ) );
     if( config_data )
     {
         if( !config_data->panel )
index f7f7803c9f2145ff332d90df89c0cb40cb694f87..07e6912b419a11a618e94d94acba81c2311f4c79 100644 (file)
@@ -2,7 +2,7 @@
  * dummy.c : dummy plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000, 2001 VideoLAN
- * $Id: dummy.c,v 1.7 2003/05/15 22:27:37 massiot Exp $
+ * $Id: dummy.c,v 1.8 2003/06/17 16:09:16 gbazin Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
 #endif
 
 vlc_module_begin();
-    set_description( _("dummy functions") );
+    set_description( _("dummy interface function") );
+    set_capability( "interface", 0 );
     add_shortcut( "vlc" );
-    add_submodule();
-        set_description( _("dummy interface function") );
-        set_capability( "interface", 0 );
-        set_callbacks( E_(OpenIntf), NULL );
+    set_callbacks( E_(OpenIntf), NULL );
 #ifdef WIN32
-        add_category_hint( N_("Interface"), NULL, VLC_FALSE );
-        add_bool( "dummy-quiet", 0, NULL, QUIET_TEXT, QUIET_LONGTEXT, VLC_FALSE );
+    add_category_hint( N_("Interface"), NULL, VLC_FALSE );
+    add_bool( "dummy-quiet", 0, NULL, QUIET_TEXT, QUIET_LONGTEXT, VLC_FALSE );
 #endif
     add_submodule();
         set_description( _("dummy access function") );
index ebb4503e7ef5ec3162fb056dd09535a93480c400..4d455291ec5b2fb8fc8d1f1a955d137eac73af34 100644 (file)
@@ -2,7 +2,7 @@
  * sap.c :  SAP interface module
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: sap.c,v 1.12 2003/06/16 15:39:11 zorglub Exp $
+ * $Id: sap.c,v 1.13 2003/06/17 16:09:16 gbazin Exp $
  *
  * Authors: Arnaud Schauly <gitan@via.ecp.fr>
  *
 #   endif
 #endif
 
+#ifdef UNDER_CE
+#   define close(a) CloseHandle(a);
+#elif defined( WIN32 )
+#   define close(a) closesocket(a);
+#endif
+
 #include "network.h"
 
 #define MAX_LINE_LENGTH 256
@@ -217,15 +223,7 @@ static void Run( intf_thread_t *p_intf )
     }
 
     /* Closing socket */
-
-#ifdef UNDER_CE
-    CloseHandle( socket_desc.i_handle );
-#elif defined( WIN32 )
-    closesocket( socket_desc.i_handle );
-#else
     close( socket_desc.i_handle );
-#endif
-
 }
 
 /********************************************************************