diff --git a/PAiPlayer.rc b/PAiPlayer.rc index f57f5c4..20be7c5 100644 Binary files a/PAiPlayer.rc and b/PAiPlayer.rc differ diff --git a/Resource.h b/Resource.h index 148442e..d912f2e 100644 --- a/Resource.h +++ b/Resource.h @@ -15,6 +15,10 @@ #define IDC_MENU 200 #define ID_PLIK_OD32774 32774 #define ID_REFRESH 32775 +#define ID_OPCJE_ODTWARZAJPOKLIKNI32776 32776 +#define ID_OPCJE_POWTARZAJ 32777 +#define ID_OPCJE_ONCLICK 32778 +#define ID_OPCJE_LOOP 32779 #define IDC_STATIC -1 // Next default values for new objects @@ -23,7 +27,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NO_MFC 1 #define _APS_NEXT_RESOURCE_VALUE 129 -#define _APS_NEXT_COMMAND_VALUE 32776 +#define _APS_NEXT_COMMAND_VALUE 32780 #define _APS_NEXT_CONTROL_VALUE 1000 #define _APS_NEXT_SYMED_VALUE 110 #endif diff --git a/main.cpp b/main.cpp index 11cf1a5..96a6883 100644 --- a/main.cpp +++ b/main.cpp @@ -39,6 +39,7 @@ TCHAR* selected = NULL; */ int currentState = -1; BOOL isAutoPlayEnabled = TRUE; +BOOL isLoopEnabled = FALSE; //CONTROLS HWND mainWindow; @@ -50,6 +51,7 @@ HWND playButton; HWND stopButton; HWND npLabel; HWND autoPlayCheck; +HWND loopCheck; HMENU menuBar; //HOOKS @@ -87,7 +89,7 @@ void CreateControls(HWND window) { SendMessage(dirLabel, WM_SETFONT, (WPARAM)hFont, TRUE); browseButton = EzCreateButton(L"Przeglądaj", 275, 10, 100, 30, window, NULL); SendMessage(browseButton, WM_SETFONT, (WPARAM)hFont, TRUE); - filesListCtrl = CreateWindowEx(0, L"LISTBOX", NULL, LBS_STANDARD | WS_CHILD | WS_VISIBLE, 0, 50, 400, 425, window, (HMENU)IDC_LIST, NULL, NULL); + filesListCtrl = CreateWindowEx(0, L"LISTBOX", NULL, LBS_STANDARD | WS_CHILD | WS_VISIBLE | WS_VSCROLL, 0, 50, 400, 425, window, (HMENU)IDC_LIST, NULL, NULL); SendMessage(filesListCtrl, WM_SETFONT, (WPARAM)hFont, TRUE); npLabel = EzCreateLabel(NOT_PLAYING_LABEL, -5, 460, 400, 30, window, SS_CENTER | WS_CHILD | WS_VISIBLE | SS_CENTERIMAGE); SendMessage(npLabel, WM_SETFONT, (WPARAM)hFont, TRUE); @@ -98,6 +100,9 @@ void CreateControls(HWND window) { autoPlayCheck = CreateWindowEx(NULL, L"BUTTON", L"Odtwarzaj automatycznie", BS_CHECKBOX | WS_VISIBLE | WS_CHILD | SS_CENTER | SS_CENTERIMAGE, 105, 485, 170, 30, window, NULL, NULL, NULL); SendMessage(autoPlayCheck, BM_SETCHECK, BST_CHECKED, NULL); SendMessage(autoPlayCheck, WM_SETFONT, (WPARAM)hFont, TRUE); + loopCheck = CreateWindowEx(NULL, L"BUTTON", L"Pętla", BS_CHECKBOX | WS_VISIBLE | WS_CHILD | SS_CENTER | SS_CENTERIMAGE, 300, 485, 50, 30, window, NULL, NULL, NULL); + SendMessage(loopCheck, BM_SETCHECK, BST_UNCHECKED, NULL); + SendMessage(loopCheck, WM_SETFONT, (WPARAM)hFont, TRUE); filesListScroll = CreateWindowEx(0, L"SCROLLBAR", NULL, WS_CHILD | WS_VISIBLE | SBS_VERT, 300, 50, 50, 425, NULL, NULL, NULL, NULL); } void GetFiles(TCHAR* path, wstring ext) { @@ -160,7 +165,12 @@ void Play(TCHAR* path, TCHAR* fileName) { //PLAY THE SOUND mciSendString(fullCommand, NULL, 0, NULL); - mciSendString(L"play mp3 notify", NULL, 0, mainWindow); + if (isLoopEnabled) { + mciSendString(L"play mp3 repeat", NULL, 0, mainWindow); + } + else { + mciSendString(L"play mp3 notify", NULL, 0, mainWindow); + } } else { MessageBox(mainWindow, L"Podczas odtwarzania wystąpił błąd. Sprawdź czy podany plik istnieje.", L"Wystąpił błąd", MB_ICONERROR); @@ -227,6 +237,16 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { isAutoPlayEnabled = TRUE; } } + else if ((HWND)lParam == loopCheck) { + if (isLoopEnabled) { + SendMessage(loopCheck, BM_SETCHECK, BST_UNCHECKED, NULL); + isLoopEnabled = FALSE; + } + else { + SendMessage(loopCheck, BM_SETCHECK, BST_CHECKED, NULL); + isLoopEnabled = TRUE; + } + } else if ((HWND)lParam == stopButton) { mciSendString(L"close mp3", NULL, 0, NULL); SendMessage(mainWindow, STATE_CHANGE, 0, NULL);