]> git.sesse.net Git - vlc/commitdiff
* ctrl_tree.cpp: (un)folding of a playlist item is no triggered
authorCyril Deguet <asmax@videolan.org>
Sun, 23 Oct 2005 17:59:52 +0000 (17:59 +0000)
committerCyril Deguet <asmax@videolan.org>
Sun, 23 Oct 2005 17:59:52 +0000 (17:59 +0000)
by a simple click (was a double click before) which is more
natural

modules/gui/skins2/controls/ctrl_tree.cpp
modules/gui/skins2/vars/playtree.cpp

index b9c9fc9890f8d66f10fbd13f9c32542d51cfbdf4..c44c888fef4edbf0391643e759a6094fad5af121 100644 (file)
@@ -396,18 +396,27 @@ void CtrlTree::handleEvent( EvtGeneric &rEvent )
         else if( rEvent.getAsString().find( "mouse:left:down" ) !=
                  string::npos )
         {
-            // Unselect any previously selected item
-            for( it = m_rTree.begin(); it != m_rTree.end();
-                 it = m_rTree.getNextVisibleItem( it ) )
+            it = findItemAtPos(yPos);
+            if( it->size() && xPos > (it->depth() - 1) * itemImageWidth()
+                && xPos < it->depth() * itemImageWidth() )
             {
-                it->m_selected = false;
+                // Fold/unfold the item
+                it->m_expanded = !it->m_expanded;
             }
-            // Select the new item
-            it = findItemAtPos(yPos);
-            if( it != m_rTree.end() )
+            else
             {
-                it->m_selected = true;
-                m_pLastSelected = &*it;
+                // Unselect any previously selected item
+                for( it = m_rTree.begin(); it != m_rTree.end();
+                     it = m_rTree.getNextVisibleItem( it ) )
+                {
+                    it->m_selected = false;
+                }
+                // Select the new item
+                if( it != m_rTree.end() )
+                {
+                    it->m_selected = true;
+                    m_pLastSelected = &*it;
+                }
             }
         }
 
@@ -417,15 +426,8 @@ void CtrlTree::handleEvent( EvtGeneric &rEvent )
             it = findItemAtPos(yPos);
             if( it != m_rTree.end() )
             {
-                if( it->size() && xPos < it->depth() * itemImageWidth() )
-                {
-                    it->m_expanded = !it->m_expanded;
-                }
-                else
-                {
-                    // Execute the action associated to this item
-                    m_rTree.action( &*it );
-                }
+               // Execute the action associated to this item
+               m_rTree.action( &*it );
             }
         }
 
index b5dfd75bd19b54d1cb734ca0c430494a28fb0571..4c674a9f14cacce28bd1597ea8a6424c23dd4d91 100644 (file)
@@ -88,8 +88,6 @@ void Playtree::action( VarTree *pItem )
 
 void Playtree::onChange()
 {
-    /* FIXME : updateTree could be a nice idea so we don't have to
-     * start from scratch each time the playlist changes */
     buildTree();
     notify();
 }