changeset 20194:10cebc4e94ae

code simplification and minor bug fix for files restarting rather than moving to the next file within the playlist.
author vayne
date Fri, 13 Oct 2006 17:30:41 +0000
parents 7f76345fdc0f
children 32a550c28268
files Gui/win32/dialogs.c
diffstat 1 files changed, 7 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/Gui/win32/dialogs.c	Fri Oct 13 08:44:02 2006 +0000
+++ b/Gui/win32/dialogs.c	Fri Oct 13 17:30:41 2006 +0000
@@ -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: