]> uap-core.de Git - uwplayer.git/commitdiff
add repeat list and autoplay menu items
authorOlaf Wintermann <olaf.wintermann@gmail.com>
Sun, 16 Jan 2022 19:24:21 +0000 (20:24 +0100)
committerOlaf Wintermann <olaf.wintermann@gmail.com>
Sun, 16 Jan 2022 19:24:21 +0000 (20:24 +0100)
application/window.c
application/window.h

index b0d9a3420792569cc92d22c2abe74e0ceead7c64..d14861e867daac86ace84096f031d953ef2c7d5c 100644 (file)
@@ -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', "Ctrl<Key>Q", "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', "<Key>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) {
index ad44fcb210b1b6e6169d826e2fea20ab5897cae7..b0f9c6430b6fbf99972a4f1c1a3dbea9385f360a 100644 (file)
@@ -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);