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 PlayRandomCB(Widget w, void *udata, void *cdata);
static void ViewFullscreenCB(Widget w, void *udata, void *cdata);
static void ViewSidebarCB(Widget w, void *udata, void *cdata);
+static void ViewAdjustWindowSizeCB(Widget w, void *udata, void *cdata);
static void WindowRealized(MainWindow *win);
PlayListInit(window);
+ window->adjustWindowSize = true; // auto adjust window size by default
+
return window;
}
return menuItem;
}
+/*
+ * Creates a menu separator
+ */
+static Widget createMenuSeparator(Widget menu) {
+ Widget w = XmCreateSeparator(menu, "separator", NULL, 0);
+ XtManageChild(w);
+ return w;
+}
+
static void WindowCreateMenu(MainWindow *win, Widget parent, Arg *mbargs, int nmbargs) {
Widget menubar = XmCreateMenuBar(parent, "menubar", mbargs, nmbargs);
XtManageChild(menubar);
XtVaSetValues(win->playRepeatListButton, XmNindicatorType, XmONE_OF_MANY, NULL);
XtVaSetValues(win->playAutoPlayButton, XmNindicatorType, XmONE_OF_MANY, NULL);
+ createMenuSeparator(playMenu);
+
+ win->playRandom = createToggleMenuItem(playMenu, "playRandom", "Random Playback", 'P', False, NULL, NULL, PlayRandomCB, win);
+
+
// view menu
createMenuItem(viewMenu, "viewFullscreen", "Fullscreen", 'F', "<Key>F", "F", ViewFullscreenCB, NULL);
win->viewSidebarButton = createToggleMenuItem(viewMenu, "viewSidebar", "View Sidebar", 'S', False, NULL, NULL, ViewSidebarCB, win);
+
+ createMenuSeparator(viewMenu);
+
+ win->viewAdjustWindowSize = createToggleMenuItem(viewMenu, "viewAdjustWindowSize", "Adjust Window Size", 'W', TRUE, NULL, NULL, ViewAdjustWindowSizeCB, win);
}
void go_fullscreen(Display *dsp, Window win)
XtVaSetValues(win->playRepeatListButton, XmNset, 0, NULL);
}
+static void PlayRandomCB(Widget w, void *udata, void *cdata) {
+ MainWindow *win = udata;
+ win->playlist.random = XmToggleButtonGadgetGetState(w);
+}
+
static void ViewFullscreenCB(Widget w, void *udata, void *cdata) {
if(main_window->fullscreen) {
WindowFullscreen(main_window, FALSE);
}
}
+static void ViewAdjustWindowSizeCB(Widget w, void *udata, void *cdata) {
+ MainWindow *win = udata;
+ win->adjustWindowSize = XmToggleButtonGadgetGetState(w);
+}
+
void WindowAdjustAspectRatio(MainWindow *win) {
if(!win->player) return;
if(!win->player->isactive || win->player->width <= 0 || win->player->height <= 0) return;