]> git.sesse.net Git - vlc/commitdiff
* now selection method in the playlist depends on the state of the
authorCyril Deguet <asmax@videolan.org>
Mon, 9 Jun 2003 14:04:20 +0000 (14:04 +0000)
committerCyril Deguet <asmax@videolan.org>
Mon, 9 Jun 2003 14:04:20 +0000 (14:04 +0000)
  CTRL button (as expected in a normal playlist !)
  TODO: - do the same under windows
        - replace all button constants 1/2 by MOUSE_LEFT/MOUSE_RIGHT

modules/gui/skins/controls/playlist.cpp
modules/gui/skins/src/skin_common.h
modules/gui/skins/src/window.cpp
modules/gui/skins/x11/x11_window.cpp

index 8324e5c2272a8f8db4aac80d05c452bb27997bb0..b44486cb33db927f6a8f589513ef6bbcdae8602e 100644 (file)
@@ -2,7 +2,7 @@
  * playlist.cpp: Playlist control
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: playlist.cpp,v 1.13 2003/06/09 12:33:16 asmax Exp $
+ * $Id: playlist.cpp,v 1.14 2003/06/09 14:04:20 asmax Exp $
  *
  * Authors: Olivier Teulière <ipkiss@via.ecp.fr>
  *          Emmanuel Puig    <karibu@via.ecp.fr>
@@ -433,8 +433,19 @@ bool ControlPlayList::MouseDown( int x, int y, int button )
         {
             for( j = 0; j < NumOfItems; j++ )
             {
-                if( j == i + StartIndex )
-                    Select[j] = !Select[j];
+                if( button & KEY_CTRL )
+                {
+                    // CTRL is pressed
+                    if( j == i + StartIndex )
+                    {
+                        Select[j] = !Select[j];
+                    }
+                }
+                else
+                { 
+                    // CTRL is not pressed
+                    Select[j] = ( j == i + StartIndex );
+                }
             }
             RefreshAll();
             return true;
index a33b39df5b7847831152358758ecf5bd463ebb8b..a67f8e1514a48e72131b491bcf3b48cc6b128511 100644 (file)
@@ -2,7 +2,7 @@
  * skin_common.h: Private Skin interface description
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: skin_common.h,v 1.16 2003/06/09 12:33:16 asmax Exp $
+ * $Id: skin_common.h,v 1.17 2003/06/09 14:04:20 asmax Exp $
  *
  * Authors: Olivier Teulière <ipkiss@via.ecp.fr>
  *          Emmanuel Puig    <karibu@via.ecp.fr>
@@ -39,6 +39,12 @@ class wxIcon;
 #include <X11/Xlib.h>
 #endif
 
+// For mouse events FIXME: should be elsewhere?
+#define MOUSE_LEFT (1<<0)
+#define MOUSE_RIGHT (1<<1)
+#define KEY_CTRL (1<<2)
+
+
 //---------------------------------------------------------------------------
 // intf_sys_t: description and status of skin interface
 //---------------------------------------------------------------------------
index 950e3cf36854226b1c32d495d5359c8bd38e3bad..42870711e9a526aa9d29f3c88d1f083225e90900 100644 (file)
@@ -2,7 +2,7 @@
  * window.cpp: Window class
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: window.cpp,v 1.27 2003/06/09 12:33:16 asmax Exp $
+ * $Id: window.cpp,v 1.28 2003/06/09 14:04:20 asmax Exp $
  *
  * Authors: Olivier Teulière <ipkiss@via.ecp.fr>
  *          Emmanuel Puig    <karibu@via.ecp.fr>
@@ -425,7 +425,7 @@ void SkinWindow::MouseUp( int x, int y, int button )
     }
 
 #ifndef BASIC_SKINS
-    if( i < 0  && button == 2 )
+    if( i < 0  && button == MOUSE_RIGHT )
     {
         p_intf->p_sys->p_dialogs->ShowPopup();
     }
index 9bafaa806b042339e359df1bc7e45d4cd12beb52..7f6e471892d74e5dd76effbfa86e5bf391942aa8 100644 (file)
@@ -2,7 +2,7 @@
  * x11_window.cpp: X11 implementation of the Window class
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: x11_window.cpp,v 1.19 2003/06/09 12:33:17 asmax Exp $
+ * $Id: x11_window.cpp,v 1.20 2003/06/09 14:04:20 asmax Exp $
  *
  * Authors: Cyril Deguet     <asmax@videolan.org>
  *
@@ -226,6 +226,8 @@ bool X11Window::ProcessOSEvent( Event *evt )
     int          p2  = evt->GetParam2();
     int          time;
     int          posX, posY;
+    string       type;
+    int          button;
 
     switch( msg )
     {
@@ -256,11 +258,19 @@ bool X11Window::ProcessOSEvent( Event *evt )
                 XRaiseWindow( display, ( (X11Window *)(*win) )->GetHandle() );
                 XUNLOCK;
             }
+            
+            button = 0;
+            if( ((XButtonEvent *)p2 )->state & ControlMask )
+            {
+                // Control key pressed
+                button |= KEY_CTRL;
+            }
 
             switch( ( (XButtonEvent *)p2 )->button )
             {
                 case 1:
                     // Left button
+                    button |= MOUSE_LEFT;
                     time = OSAPI_GetTime();
                     OSAPI_GetMousePos( posX, posY );
                     if( time - ClickedTime < DblClickDelay && 
@@ -269,7 +279,7 @@ bool X11Window::ProcessOSEvent( Event *evt )
                         // Double-click
                         ClickedTime = 0; 
                         MouseDblClick( (int)( (XButtonEvent *)p2 )->x,
-                                       (int)( (XButtonEvent *)p2 )->y, 1 );
+                                       (int)( (XButtonEvent *)p2 )->y, button );
                     }
                     else
                     {
@@ -278,15 +288,16 @@ bool X11Window::ProcessOSEvent( Event *evt )
                         ClickedY = posY;
                         LButtonDown = true;
                         MouseDown( (int)( (XButtonEvent *)p2 )->x,
-                                   (int)( (XButtonEvent *)p2 )->y, 1 );
+                                   (int)( (XButtonEvent *)p2 )->y, button );
                     }
                     break;
 
                 case 3:
                     // Right button
+                    button |= MOUSE_RIGHT;
                     RButtonDown = true;
                     MouseDown( (int)( (XButtonEvent *)p2 )->x,
-                               (int)( (XButtonEvent *)p2 )->y, 2 );
+                               (int)( (XButtonEvent *)p2 )->y, button );
                     break;
 
                 default:
@@ -295,20 +306,28 @@ bool X11Window::ProcessOSEvent( Event *evt )
             return true;
 
         case ButtonRelease:
+            button = 0;
+            if( ((XButtonEvent *)p2 )->state & ControlMask )
+            {
+                // Control key pressed
+                button |= KEY_CTRL;
+            }
             switch( ( (XButtonEvent *)p2 )->button )
             {
                 case 1:
                     // Left button
+                    button |= MOUSE_LEFT;
                     LButtonDown = false;
                     MouseUp( (int)( (XButtonEvent *)p2 )->x,
-                             (int)( (XButtonEvent *)p2 )->y, 1 );
+                             (int)( (XButtonEvent *)p2 )->y, button );
                     break;
 
                 case 3:
+                    button |= MOUSE_RIGHT;
                     // Right button
                     RButtonDown = false;
                     MouseUp( (int)( (XButtonEvent *)p2 )->x,
-                             (int)( (XButtonEvent *)p2 )->y, 2 );
+                             (int)( (XButtonEvent *)p2 )->y, button );
                     break; 
 
                 case 4:
@@ -335,10 +354,9 @@ bool X11Window::ProcessOSEvent( Event *evt )
             return true;
 
         case ClientMessage:
-            {
             XLOCK;
-            string type = XGetAtomName( display, ( (XClientMessageEvent*)
-                                                    p2 )->message_type );
+            type = XGetAtomName( display, ( (XClientMessageEvent*)
+                                             p2 )->message_type );
             XUNLOCK;
             if( type == "XdndEnter" )
             {
@@ -360,7 +378,6 @@ bool X11Window::ProcessOSEvent( Event *evt )
                 DropObject->DndDrop( ((XClientMessageEvent*)p2)->data.l );
                 return true;
             }
-            }
             return false;
             
         default: