From: Olaf Wintermann Date: Sun, 16 Jan 2022 19:24:21 +0000 (+0100) Subject: add repeat list and autoplay menu items X-Git-Url: https://uap-core.de/gitweb/?a=commitdiff_plain;h=663ac840aba3c8203afd517380d9eba7191787e4;p=uwplayer.git add repeat list and autoplay menu items --- diff --git a/application/window.c b/application/window.c index b0d9a34..d14861e 100644 --- a/application/window.c +++ b/application/window.c @@ -37,6 +37,8 @@ static void WindowCreateMenu(MainWindow *win, Widget parent, Arg *args, int narg static void FileOpenCB(Widget w, void *udata, void *cdata); static void FileQuitCB(Widget w, void *udata, void *cdata); static void PlayRepeatCB(Widget w, void *udata, void *cdata); +static void PlayRepeatListCB(Widget w, void *udata, void *cdata); +static void PlayAutoPlayCB(Widget w, void *udata, void *cdata); static void ViewFullscreenCB(Widget w, void *udata, void *cdata); static void WindowRealized(MainWindow *win); @@ -408,7 +410,12 @@ static void WindowCreateMenu(MainWindow *win, Widget parent, Arg *mbargs, int nm createMenuItem(fileMenu, "fileQuit", "Exit", 'E', "CtrlQ", "Ctrl+Q", FileQuitCB, NULL); // play menu - createToggleMenuItem(playMenu, "playRepeatTrack", "Repeat", 'R', False, NULL, NULL, PlayRepeatCB, win); + win->playRepeatTrackButton = createToggleMenuItem(playMenu, "playRepeatTrack", "Repeat", 'R', False, NULL, NULL, PlayRepeatCB, win); + win->playRepeatListButton = createToggleMenuItem(playMenu, "playRepeatList", "Repeat List", 'L', False, NULL, NULL, PlayRepeatListCB, win); + win->playAutoPlayButton = createToggleMenuItem(playMenu, "playAutoNext", "Autoplay Folder", 'A', False, NULL, NULL, PlayAutoPlayCB, win); + XtVaSetValues(win->playRepeatTrackButton, XmNindicatorType, XmONE_OF_MANY, NULL); + XtVaSetValues(win->playRepeatListButton, XmNindicatorType, XmONE_OF_MANY, NULL); + XtVaSetValues(win->playAutoPlayButton, XmNindicatorType, XmONE_OF_MANY, NULL); // view menu createMenuItem(viewMenu, "viewFullscreen", "Fullscreen", 'F', "F", "F", ViewFullscreenCB, NULL); @@ -538,6 +545,28 @@ static void FileQuitCB(Widget w, void *udata, void *cdata) { static void PlayRepeatCB(Widget w, void *udata, void *cdata) { MainWindow *win = udata; win->repeatTrack = XmToggleButtonGadgetGetState(w); + win->repeatList = 0; + win->autoplayFolder = 0; + XtVaSetValues(win->playRepeatListButton, XmNset, 0, NULL); + XtVaSetValues(win->playAutoPlayButton, XmNset, 0, NULL); +} + +static void PlayRepeatListCB(Widget w, void *udata, void *cdata) { + MainWindow *win = udata; + win->repeatList = XmToggleButtonGadgetGetState(w); + win->repeatTrack = 0; + win->autoplayFolder = 0; + XtVaSetValues(win->playRepeatTrackButton, XmNset, 0, NULL); + XtVaSetValues(win->playAutoPlayButton, XmNset, 0, NULL); +} + +static void PlayAutoPlayCB(Widget w, void *udata, void *cdata) { + MainWindow *win = udata; + win->autoplayFolder = XmToggleButtonGadgetGetState(w); + win->repeatTrack = 0; + win->repeatList = 0; + XtVaSetValues(win->playRepeatTrackButton, XmNset, 0, NULL); + XtVaSetValues(win->playRepeatListButton, XmNset, 0, NULL); } static void ViewFullscreenCB(Widget w, void *udata, void *cdata) { diff --git a/application/window.h b/application/window.h index ad44fcb..b0f9c64 100644 --- a/application/window.h +++ b/application/window.h @@ -58,6 +58,10 @@ typedef struct MainWindow { bool cursorhidden; bool buttongrab; + Widget playRepeatTrackButton; + Widget playRepeatListButton; + Widget playAutoPlayButton; + Time player_event_time; Time button_press_time; double motion_playback_time; @@ -67,6 +71,8 @@ typedef struct MainWindow { int mouse_y_orig; Boolean repeatTrack; + Boolean repeatList; + Boolean autoplayFolder; } MainWindow; MainWindow* WindowCreate(Display *dp);