]> git.sesse.net Git - vlc/blobdiff - modules/gui/wxwidgets/dialogs/preferences.cpp
FSF address change.
[vlc] / modules / gui / wxwidgets / dialogs / preferences.cpp
index e723eeddac81910692eb97b3ee8060554335b63b..653f02a37d4731183053499b04502e61fc3f8596 100644 (file)
@@ -18,7 +18,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
 /*****************************************************************************
@@ -84,6 +84,8 @@ private:
     wxWindow *p_parent;
     vlc_bool_t b_advanced;
 
+    wxPanel *p_current;
+
     wxTreeItemId root_item;
     wxTreeItemId plugins_item;
 };
@@ -369,6 +371,7 @@ PrefsTreeCtrl::PrefsTreeCtrl( wxWindow *_p_parent, intf_thread_t *_p_intf,
             {
             case CONFIG_CATEGORY:
                 config_data = new ConfigTreeData;
+                if( p_item->i_value == -1 )   break; // Don't display it
                 config_data->psz_name = strdup( config_CategoryNameGet(
                                                             p_item->i_value ) );
                 psz_help = config_CategoryHelpGet( p_item->i_value );
@@ -408,6 +411,7 @@ PrefsTreeCtrl::PrefsTreeCtrl( wxWindow *_p_parent, intf_thread_t *_p_intf,
 
                 break;
             case CONFIG_SUBCATEGORY:
+                if( p_item->i_value == -1 ) break; // Don't display it
                 if( p_item->i_value == SUBCAT_VIDEO_GENERAL ||
                     p_item->i_value == SUBCAT_AUDIO_GENERAL )
                 {
@@ -603,11 +607,11 @@ PrefsTreeCtrl::PrefsTreeCtrl( wxWindow *_p_parent, intf_thread_t *_p_intf,
     }
 
     /* Sort all this mess */
-    wxTreeItemIdValue cookie; 
+    wxTreeItemIdValue cookie;
     size_t i_child_index;
     wxTreeItemId capability_item = GetFirstChild( root_item, cookie);
     for( i_child_index = 0;
-         (capability_item.IsOk() && 
+         (capability_item.IsOk() &&
           //(i_child_index < GetChildrenCount( plugins_item, FALSE )));
           (i_child_index < GetChildrenCount( root_item, FALSE )));
          i_child_index++ )
@@ -623,6 +627,8 @@ PrefsTreeCtrl::PrefsTreeCtrl( wxWindow *_p_parent, intf_thread_t *_p_intf,
     p_sizer->Add( this, 1, wxEXPAND | wxALL, 0 );
     p_sizer->Layout();
 
+    p_current = NULL;
+
     /* Update Tree Ctrl */
 #ifndef WIN32 /* Workaround a bug in win32 implementation */
     SelectItem( GetFirstChild( root_item, cookie ) );
@@ -687,6 +693,7 @@ void PrefsTreeCtrl::CleanChanges()
 #else
         p_sizer->Remove( config_data->panel );
 #endif
+        p_current = NULL;
     }
 
     wxTreeItemId category = GetFirstChild( root_item, cookie );
@@ -772,17 +779,15 @@ void PrefsTreeCtrl::OnSelectTreeItem( wxTreeEvent& event )
 {
     ConfigTreeData *config_data = NULL;
 
-    if( event.GetOldItem() )
-        config_data = FindModuleConfig( (ConfigTreeData *)GetItemData(
-                                        event.GetOldItem() ) );
-    if( config_data && config_data->panel )
+    if( p_current )
     {
-        config_data->panel->Hide();
+        p_current->Hide();
 #if (wxCHECK_VERSION(2,5,0))
-        p_sizer->Detach( config_data->panel );
+        p_sizer->Detach( p_current  );
 #else
-        p_sizer->Remove( config_data->panel );
+        p_sizer->Remove( p_current );
 #endif
+        p_current = NULL;
     }
 
     /* Don't use event.GetItem() because we also send fake events */
@@ -804,6 +809,8 @@ void PrefsTreeCtrl::OnSelectTreeItem( wxTreeEvent& event )
             config_data->panel->Show();
         }
 
+        p_current = config_data->panel;
+
         p_sizer->Add( config_data->panel, 3, wxEXPAND | wxALL, 0 );
         p_sizer->Layout();
     }
@@ -823,6 +830,7 @@ void PrefsTreeCtrl::OnAdvanced( wxCommandEvent& event )
 #else
         p_sizer->Remove( config_data->panel );
 #endif
+        p_current = NULL;
     }
 
     if( GetSelection() )