[MPlayer-cvslog] r20200 - trunk/Gui/win32/dialogs.c

vayne subversion at mplayerhq.hu
Fri Oct 13 19:30:41 CEST 2006


Author: vayne
Date: Fri Oct 13 19:30:41 2006
New Revision: 20200

Modified:
   trunk/Gui/win32/dialogs.c

Log:
code simplification and minor bug fix for files restarting rather than moving to the next file within the playlist.

Modified: trunk/Gui/win32/dialogs.c
==============================================================================
--- trunk/Gui/win32/dialogs.c	(original)
+++ trunk/Gui/win32/dialogs.c	Fri Oct 13 19:30:41 2006
@@ -426,14 +426,13 @@
 {
     int i=0;
     gui_t *gui = (gui_t *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
-    HWND tracklist = GetDlgItem(hwnd, ID_TRACKLIST);
     /* clear listbox */
-    SendMessage(tracklist, LB_RESETCONTENT, 0, 0);
+    SendDlgItemMessage(hwnd, ID_TRACKLIST, LB_RESETCONTENT, 0, 0);
     for (i=0; i < gui->playlist->trackcount; i++)
         if (gui->playlist->tracks[i]->title)
-            SendMessage(tracklist, LB_ADDSTRING, 0, (LPARAM)gui->playlist->tracks[i]->title);
+            SendDlgItemMessage(hwnd, ID_TRACKLIST, LB_ADDSTRING, 0, (LPARAM)gui->playlist->tracks[i]->title);
         else
-            SendMessage(tracklist, LB_ADDSTRING, 0, (LPARAM)gui->playlist->tracks[i]->filename);
+            SendDlgItemMessage(hwnd, ID_TRACKLIST, LB_ADDSTRING, 0, (LPARAM)gui->playlist->tracks[i]->filename);
 }
 
 static LRESULT CALLBACK PlayListWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
@@ -518,11 +517,10 @@
         }
         case WM_COMMAND:
         {
-            HWND tracklist = GetDlgItem(hwnd, ID_TRACKLIST);
             int selected = 0;
             int i;
             for (i=0; i<pl->trackcount; i++)
-                if(0 < SendMessage(tracklist, LB_GETSEL, i, 0)) selected = i + 1;
+                if(0 < SendDlgItemMessage(hwnd, ID_TRACKLIST, LB_GETSEL, i, 0)) selected = i + 1;
             switch (LOWORD(wParam))
             {
                 case ID_CLOSE:
@@ -531,9 +529,10 @@
                 case ID_TRACKLIST:
                     if(HIWORD(wParam) == LBN_DBLCLK)
                     {
+                case ID_PLAY:
                         if(selected) pl->current = selected - 1;
                         mplSetFileName(NULL, pl->tracks[pl->current]->filename, STREAMTYPE_STREAM);
-                        mplGotoTheNext = 0;
+                        mplGotoTheNext = guiIntfStruct.Playing? 0 : 1;
                         gui->startplay(gui);
                     }
                     return 0;
@@ -549,14 +548,6 @@
                     selected++;
                     break;
                 }
-                case ID_PLAY:
-                {
-                    if(selected) pl->current = selected - 1;
-                    mplSetFileName(NULL, pl->tracks[pl->current]->filename, STREAMTYPE_STREAM);
-                    mplGotoTheNext = 0;
-                    gui->startplay(gui);
-                    break;
-                }
                 case ID_REMOVE:
                     if(selected) pl->remove_track(pl, selected);
                     break;
@@ -601,7 +592,7 @@
             updatetracklist(hwnd);
             if(selected < 1) selected = 1;
             else if(selected>pl->trackcount) selected = pl->trackcount;
-            SendMessage(tracklist, LB_SETCURSEL, selected - 1, 0);
+            SendDlgItemMessage(hwnd, ID_TRACKLIST, LB_SETCURSEL, selected - 1, 0);
             return 0;
         }
         case WM_DROPFILES:



More information about the MPlayer-cvslog mailing list