Index: apps/gui/statusbar.h =================================================================== --- apps/gui/statusbar.h (revision 18777) +++ apps/gui/statusbar.h (working copy) @@ -30,10 +30,6 @@ #define STATUSBAR_Y_POS 0 /* MUST be a multiple of 8 */ #define STATUSBAR_HEIGHT 8 -/* possibly a horrible misuse of the event system. - This is triggered when the statusbar setting changes */ -#define STATUSBAR_TOGGLE_EVENT (EVENT_CLASS_GUI|1) - struct status_info { int battlevel; int batt_charge_step; Index: apps/gui/gwps.c =================================================================== --- apps/gui/gwps.c (revision 18777) +++ apps/gui/gwps.c (working copy) @@ -61,6 +61,7 @@ #include "backdrop.h" #include "quickscreen.h" #include "pitchscreen.h" +#include "appevents.h" /* currently only on wps_state is needed */ struct wps_state wps_state; @@ -820,7 +834,7 @@ gui_wps_set_statusbar(&gui_wps[i], &statusbars.statusbars[i]); } #ifdef HAVE_LCD_BITMAP - add_event(STATUSBAR_TOGGLE_EVENT, false, statusbar_toggle_handler); + add_event(GUI_EVENT_STATUSBAR_TOGGLE, false, statusbar_toggle_handler); #endif #if LCD_DEPTH > 1 unload_wps_backdrop(); Index: apps/menus/display_menu.c =================================================================== --- apps/menus/display_menu.c (revision 18777) +++ apps/menus/display_menu.c (working copy) @@ -23,7 +23,7 @@ #include #include #include "config.h" -#include "events.h" +#include "appevents.h" #include "lang.h" #include "action.h" #include "settings.h" @@ -304,7 +304,7 @@ switch (action) { case ACTION_EXIT_MENUITEM: - send_event(STATUSBAR_TOGGLE_EVENT, NULL); + send_event(GUI_EVENT_STATUSBAR_TOGGLE, NULL); /* this should be changed so only the viewports are reloaded */ settings_apply(false); break; Index: apps/appevents.h =================================================================== --- apps/appevents.h (revision 0) +++ apps/appevents.h (revision 0) @@ -0,0 +1,55 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id: events.h 17847 2008-06-28 18:10:04Z bagder $ + * + * Copyright (C) 2008 by Jonathan Gordon + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#ifndef _APPEVENTS_H +#define _APPEVENTS_H + +#include +#include "events.h" + +/** Only app/ level events should be defined here. + * firmware/ level events and CLASS's are defined in firmware/export/events.h + */ + +/** Playback events **/ +enum { + PLAYBACK_EVENT_TRACK_BUFFER = (EVENT_CLASS_PLAYBACK|1), + PLAYBACK_EVENT_TRACK_FINISH, + PLAYBACK_EVENT_TRACK_CHANGE, +}; + +/** Buffering events **/ +enum { + EVENT_BUFFER_LOW = (EVENT_CLASS_BUFFERING|1), + EVENT_HANDLE_REBUFFER, + EVENT_HANDLE_CLOSED, + EVENT_HANDLE_MOVED, + EVENT_HANDLE_FINISHED, +}; + +/** Generic GUI class events **/ +enum { + GUI_EVENT_THEME_CHANGED = (EVENT_CLASS_GUI|1), + GUI_EVENT_STATUSBAR_TOGGLE, +}; + +#endif + Index: apps/mpeg.c =================================================================== --- apps/mpeg.c (revision 18777) +++ apps/mpeg.c (working copy) @@ -39,7 +39,7 @@ #include "mp3_playback.h" #include "sound.h" #include "bitswap.h" -#include "events.h" +#include "appevents.h" #ifndef SIMULATOR #include "i2c.h" #include "mas.h" Index: apps/playback.c =================================================================== --- apps/playback.c (revision 18777) +++ apps/playback.c (working copy) @@ -44,7 +44,7 @@ #include "codecs.h" #include "audio.h" #include "buffering.h" -#include "events.h" +#include "appevents.h" #include "voice_thread.h" #include "mp3_playback.h" #include "usb.h" Index: apps/buffering.c =================================================================== --- apps/buffering.c (revision 18777) +++ apps/buffering.c (working copy) @@ -50,7 +50,7 @@ #include "pcmbuf.h" #include "buffer.h" #include "bmp.h" -#include "events.h" +#include "appevents.h" #include "metadata.h" #if MEM > 1 Index: apps/buffering.h =================================================================== --- apps/buffering.h (revision 18777) +++ apps/buffering.h (working copy) @@ -24,7 +24,7 @@ #include #include -#include "events.h" +#include "appevents.h" enum data_type { @@ -38,14 +38,6 @@ TYPE_UNKNOWN, }; -enum callback_event { - EVENT_BUFFER_LOW = (EVENT_CLASS_BUFFERING|1), - EVENT_HANDLE_REBUFFER, - EVENT_HANDLE_CLOSED, - EVENT_HANDLE_MOVED, - EVENT_HANDLE_FINISHED, -}; - /* Error return values */ #define ERR_HANDLE_NOT_FOUND -1 #define ERR_BUFFER_FULL -2 Index: apps/scrobbler.c =================================================================== --- apps/scrobbler.c (revision 18777) +++ apps/scrobbler.c (working copy) @@ -34,6 +34,7 @@ #include "settings.h" #include "ata_idle_notify.h" #include "misc.h" +#include "appevents.h" #if CONFIG_RTC #include "time.h" Index: apps/tagtree.c =================================================================== --- apps/tagtree.c (revision 18777) +++ apps/tagtree.c (working copy) @@ -47,7 +47,7 @@ #include "misc.h" #include "filetypes.h" #include "audio.h" -#include "events.h" +#include "appevents.h" #define FILE_SEARCH_INSTRUCTIONS ROCKBOX_DIR "/tagnavi.config" Index: firmware/export/events.h =================================================================== --- firmware/export/events.h (revision 18777) +++ firmware/export/events.h (working copy) @@ -24,6 +24,10 @@ #include +/** Only CLASS defines and firmware/ level events should be defined here. + * apps/ level events are defined in apps/appevents.h + */ + /** * High byte = Event class definition * Low byte = Event ID @@ -34,17 +38,6 @@ #define EVENT_CLASS_BUFFERING 0x0400 #define EVENT_CLASS_GUI 0x0800 -/** - * Because same playback events are used in mpeg.c and playback.c, define - * them here to prevent cluttering and ifdefs. - */ -enum { - PLAYBACK_EVENT_TRACK_BUFFER = (EVENT_CLASS_PLAYBACK|1), - PLAYBACK_EVENT_TRACK_FINISH, - PLAYBACK_EVENT_TRACK_CHANGE, -}; - - bool add_event(unsigned short id, bool oneshot, void (*handler)); void remove_event(unsigned short id, void (*handler)); void send_event(unsigned short id, void *data);