static int
spectrogram_message (ddb_gtkui_widget_t *widget, uint32_t id, uintptr_t ctx, uint32_t p1, uint32_t p2)
{
    w_spectrogram_t *w = (w_spectrogram_t *)widget;

    switch (id) {
        case DB_EV_CONFIGCHANGED:
            on_config_changed (w, ctx);
            spectrogram_set_refresh_interval (w, CONFIG_REFRESH_INTERVAL);
            break;
        case DB_EV_SONGSTARTED:
            spectrogram_set_refresh_interval (w, CONFIG_REFRESH_INTERVAL);
            break;
        case DB_EV_PAUSED:
            if (deadbeef->get_output ()->state () == OUTPUT_STATE_PLAYING) {
                spectrogram_set_refresh_interval (w, CONFIG_REFRESH_INTERVAL);
            }
            else {
                if (w->drawtimer) {
                    g_source_remove (w->drawtimer);
                    w->drawtimer = 0;
                }
            }
            break;
        case DB_EV_STOP:
            if (w->drawtimer) {
                g_source_remove (w->drawtimer);
                w->drawtimer = 0;
            }
            break;
    }
    return 0;
}
void NativeEngine::handle_cmd(int32_t cmd){
	switch (cmd) {
		case APP_CMD_INPUT_CHANGED:
			on_input_changed();
			break;
		case APP_CMD_INIT_WINDOW:
			on_init_window();
			break;
		case APP_CMD_TERM_WINDOW:
			on_term_window();
			break;
		case APP_CMD_WINDOW_RESIZED:
			on_window_resized();
			break;
		case APP_CMD_WINDOW_REDRAW_NEEDED:
			on_window_redraw_needed();
			break;
		case APP_CMD_CONTENT_RECT_CHANGED:
			on_content_rect_changed();
			break;
		case APP_CMD_GAINED_FOCUS:
			on_gained_focus();
			break;
		case APP_CMD_LOST_FOCUS:
			on_lost_focus();
			break;
		case APP_CMD_CONFIG_CHANGED:
			on_config_changed();
			break;
		case APP_CMD_LOW_MEMORY:
			on_low_memory();
			break;
		case APP_CMD_START:
			on_start();
			break;
		case APP_CMD_RESUME:
			on_resume();
			break;
		case APP_CMD_SAVE_STATE:
			on_save_state();
			break;
		case APP_CMD_PAUSE:
			on_pause();
			break;
		case APP_CMD_STOP:
			on_stop();
			break;
		case APP_CMD_DESTROY:
			on_destroy();
			break;
	}
}
Example #3
0
static int
playback_status_message (ddb_gtkui_widget_t *widget, uint32_t id, uintptr_t ctx, uint32_t p1, uint32_t p2)
{
    w_playback_status_t *w = (w_playback_status_t *)widget;

    switch (id) {
        case DB_EV_SONGSTARTED:
            playback_status_set_refresh_interval (w, CONFIG_REFRESH_INTERVAL);
            break;
        case DB_EV_PAUSED:
            break;
        case DB_EV_STOP:
            break;
        case DB_EV_CONFIGCHANGED:
            on_config_changed (w, ctx);
            playback_status_set_refresh_interval (w, CONFIG_REFRESH_INTERVAL);
            break;
    }
    return 0;
}