50 lines
1.3 KiB
C++
50 lines
1.3 KiB
C++
|
|
#include <ocarina/gtk.h>
|
|
#include <ocarina/button.h>
|
|
#include <ocarina/shortcut.h>
|
|
#include <libsaria/audio.h>
|
|
#include <libsaria/controls.h>
|
|
#include "footer.h"
|
|
|
|
static GtkWidget *make_buttons()
|
|
{
|
|
GtkWidget *buttons = gtk_hbox_new(FALSE, 0);
|
|
gtk_widget_show(buttons);
|
|
|
|
box_pack_end(buttons, make_next_button(), FALSE, FALSE, 0);
|
|
box_pack_end(buttons, make_stop_button(), FALSE, FALSE, 0);
|
|
box_pack_end(buttons, make_pause_button(), FALSE, FALSE, 0);
|
|
box_pack_end(buttons, make_play_button(), FALSE, FALSE, 0);
|
|
box_pack_end(buttons, make_forward_button(), FALSE, FALSE, 0);
|
|
box_pack_end(buttons, make_rewind_button(), FALSE, FALSE, 0);
|
|
|
|
return buttons;
|
|
}
|
|
|
|
static void toggle_pause_after()
|
|
{
|
|
libsaria::set_pause_after(!libsaria::get_pause_after());
|
|
}
|
|
|
|
GtkWidget *get_controls()
|
|
{
|
|
GtkWidget *controls = gtk_vbox_new(FALSE, 0);
|
|
gtk_widget_show(controls);
|
|
/*
|
|
* Putting the button hbox into a vbox will keep them from
|
|
* expanding vertically to take up all the space.
|
|
*/
|
|
box_pack_start(controls, make_buttons(), TRUE, FALSE, 0);
|
|
return controls;
|
|
}
|
|
|
|
void controls_init()
|
|
{
|
|
register_shortcut("Left", libsaria::rewind);
|
|
register_shortcut("Right", libsaria::forward);
|
|
register_shortcut("space", libsaria::toggle_play);
|
|
register_shortcut("n", libsaria::next);
|
|
register_shortcut("s", libsaria::audio::stop);
|
|
register_shortcut("p", toggle_pause_after);
|
|
}
|