# HG changeset patch # User vayne # Date 1160760641 0 # Node ID 10cebc4e94ae691fdc307c5f6883be7a2168ec25 # Parent 7f76345fdc0f6498587518bee7cfd66ba489b350 code simplification and minor bug fix for files restarting rather than moving to the next file within the playlist. diff -r 7f76345fdc0f -r 10cebc4e94ae Gui/win32/dialogs.c --- 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; itrackcount; 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: