Mercurial > audlegacy
changeset 434:7ffecac12107 trunk
[svn] Logic stuff relating to tristate-seek. Now I just need to work it into the event loop.
author | nenolod |
---|---|
date | Sat, 14 Jan 2006 17:57:44 -0800 |
parents | 041bc95827be |
children | e3070cc55ab2 |
files | audacious/mainwin.c |
diffstat | 1 files changed, 33 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/audacious/mainwin.c Sat Jan 14 17:21:16 2006 -0800 +++ b/audacious/mainwin.c Sat Jan 14 17:57:44 2006 -0800 @@ -73,6 +73,8 @@ #include "visualization.h" #include "libaudacious/configdb.h" +static GTimeVal cb_time; /* 150ms click delay for tristate --nenolod */ + #define ITEM_SEPARATOR {"/-", NULL, NULL, 0, "<Separator>"} /* @@ -100,7 +102,8 @@ #define VOLSET_DISP_TIMES 5 enum { - MAINWIN_SEEK_REV, + MAINWIN_SEEK_REV = -1, + MAINWIN_SEEK_NIL, MAINWIN_SEEK_FWD }; @@ -168,6 +171,7 @@ GtkItemFactory *mainwin_general_menu, *mainwin_play_menu, *mainwin_add_menu; GtkItemFactory *mainwin_view_menu; +gint seek_state = MAINWIN_SEEK_NIL; GdkGC *mainwin_gc; static GdkPixmap *mainwin_bg = NULL; @@ -394,10 +398,6 @@ static const gint mainwin_add_menu_entries_num = G_N_ELEMENTS(mainwin_add_menu_entries); - -/* -*/ - /* View submenu */ GtkItemFactoryEntry mainwin_view_menu_entries[] = { @@ -1926,27 +1926,49 @@ void mainwin_rev_pushed(void) { - printf("mainwin rev button pushed\n"); + g_get_current_time(&cb_time); + + seek_state = MAINWIN_SEEK_REV; } void mainwin_rev_release(void) { - playlist_prev(); - printf("mainwin rev button released\n"); + GTimeVal now_time; + glong now_dur; + + g_get_current_time(&now_time); + + now_dur = (now_time.tv_usec - cb_time.tv_usec) / 1000; + + if (now_dur <= 150 && now_dur >= -150) + playlist_prev(); + + seek_state = MAINWIN_SEEK_NIL; } void mainwin_fwd_pushed(void) { - printf("mainwin fwd button pushed\n"); + g_get_current_time(&cb_time); + + seek_state = MAINWIN_SEEK_FWD; } void mainwin_fwd_release(void) { - playlist_next(); - printf("mainwin fwd button released\n"); + GTimeVal now_time; + glong now_dur; + + g_get_current_time(&now_time); + + now_dur = (now_time.tv_usec - cb_time.tv_usec) / 1000; + + if (now_dur <= 150 && now_dur >= -150) + playlist_next(); + + seek_state = MAINWIN_SEEK_NIL; } void