From 3ec87e80d9d13f17dc4579c5922d3dfcc7e62e73 Mon Sep 17 00:00:00 2001 From: vayne Date: Fri, 13 Oct 2006 17:30:41 +0000 Subject: code simplification and minor bug fix for files restarting rather than moving to the next file within the playlist. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@20200 b3059339-0415-0410-9bf9-f77b7e298cf2 --- Gui/win32/dialogs.c | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/Gui/win32/dialogs.c b/Gui/win32/dialogs.c index 7a722959a5..5be4af04a6 100644 --- a/Gui/win32/dialogs.c +++ b/Gui/win32/dialogs.c @@ -426,14 +426,13 @@ static void updatetracklist(HWND hwnd) { 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 @@ static LRESULT CALLBACK PlayListWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPA } 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 @@ static LRESULT CALLBACK PlayListWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPA 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 @@ static LRESULT CALLBACK PlayListWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPA 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 @@ static LRESULT CALLBACK PlayListWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPA 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: -- cgit v1.2.3