gboolean on_window2_destroy_event (GtkWidget *widget, GdkEvent *event, gpointer user_data) { return quit_request(); }
gboolean on_main_window_delete_event (GtkWidget *widget, GdkEvent *event, gpointer user_data) { return quit_request(); }
void event_poll(Uint32 mask) { SDL_Event event; #if TO_EVENT_POLL time_t t0 = SDL_GetTicks (); time_t _t = t0; #endif /* if (!mask) mask = SDL_ALLEVENTS; else mask |= SDL_ACTIVEEVENTMASK | SDL_QUITMASK | SDL_SYSWMEVENTMASK; while (PollEvent(&event, mask)) { */ while (SDL_PollEvent (&event)) { #if TO_EVENT_POLL if (!gameOpts->legacy.bInput) _t = SDL_GetTicks (); #endif switch(event.type) { case SDL_KEYDOWN: key_handler((SDL_KeyboardEvent *)&event); break; case SDL_KEYUP: key_handler((SDL_KeyboardEvent *)&event); break; case SDL_MOUSEBUTTONDOWN: case SDL_MOUSEBUTTONUP: mouse_button_handler((SDL_MouseButtonEvent *)&event); break; case SDL_MOUSEMOTION: mouse_motion_handler((SDL_MouseMotionEvent *)&event); break; #ifndef USE_LINUX_JOY // stpohle - so we can choose at compile time.. case SDL_JOYBUTTONDOWN: case SDL_JOYBUTTONUP: joy_button_handler((SDL_JoyButtonEvent *)&event); break; case SDL_JOYAXISMOTION: joy_axis_handler((SDL_JoyAxisEvent *)&event); break; case SDL_JOYHATMOTION: joy_hat_handler((SDL_JoyHatEvent *)&event); break; case SDL_JOYBALLMOTION: break; #endif case SDL_QUIT: { quit_request(); } break; } #if TO_EVENT_POLL if (!gameOpts->legacy.bInput && (_t - t0 >= TO_EVENT_POLL)) break; #endif } }
/** Process gui events and deliver them as required. \todo This should probably limit how frequently it calls draw render thread */ void sdl_master::process_events() { bool done = false; SDL_MouseMotionEvent mouse_position; mouse_position.state = 0; mouse_position.x = 0; mouse_position.y = 0; add_draw_timer(50); //20 fps SDL_Event event; while(!done) { if (SDL_WaitEvent(&event)) { //wait on an event switch(event.type) { //Check event type case SDL_USEREVENT: switch (event.user.code) { case 0: draw(); break; default: break; } break; case SDL_MOUSEMOTION: mouse_move(&mouse_position, &event.motion); mouse_position = event.motion; break; case SDL_MOUSEBUTTONDOWN: case SDL_MOUSEBUTTONUP: mouse_click(&event.button); break; case SDL_KEYDOWN: case SDL_KEYUP: key_press(&event.key); break; case SDL_QUIT: quit_request(); break; case SDL_VIDEORESIZE: //User resized window display = SDL_SetVideoMode(event.resize.w, event.resize.h, 16, SDL_HWSURFACE | SDL_DOUBLEBUF); // Create new window break; } } done = check_users(done); } // int status; // if (game_client[0] != 0) // SDL_WaitThread(game_client[0], &status); }
void on_quit_mi_activate (GtkMenuItem * menuitem, gpointer user_data) { quit_request(); }
void on_quit_toolbutton_clicked (GtkToolButton *toolbutton, gpointer user_data) { quit_request(); }
void InterfaceMini::main_key(unsigned long p_unicode, unsigned long p_scan_code,bool p_press,bool p_repeat,int p_modifier_mask) { KeyBindList kbind=KeyBind::get_bind( p_scan_code|p_modifier_mask ); if (kbind==KB_MAX) return; switch(kbind) { case KB_PLAYER_PLAY_SONG: { if (!p_press) break; button_play_pressed(); } break; case KB_PLAYER_STOP_SONG: { if (!p_press) break; button_stop_pressed(); } break; case KB_PLAYER_FF_SONG: { if (!p_press) break; button_fw_pressed(); } break; case KB_PLAYER_RW_SONG: { if (!p_press) break; button_rw_pressed(); } break; case KB_PLAYER_PLAY_PATTERN: { if (!p_press) break; button_play_pattern_pressed(); } break; case KB_PLAYER_PLAY_CURSOR: { if (!p_press) break; button_play_cursor_pressed(); } break; case KB_PLAYER_PLAY_ORDER: { if (!p_press) break; button_play_order_pressed(); } break; case KB_GOTO_PATTERN_SCREEN: { if (!p_press) break; pre_screen_changed_from( tabs->get_selected_tab() ); tabs->set_tab( SCREEN_PATTERN ); main_stack->raise( SCREEN_PATTERN ); screen_changed_to( SCREEN_PATTERN ); pattern_screen->goto_pattern(); } break; case KB_GOTO_PATTERN_SCREEN_ORDERLIST: { if (!p_press) break; pre_screen_changed_from( tabs->get_selected_tab() ); tabs->set_tab( SCREEN_PATTERN ); main_stack->raise( SCREEN_PATTERN ); screen_changed_to( SCREEN_PATTERN ); pattern_screen->goto_orderlist(); } break; case KB_GOTO_SAMPLE_SCREEN: { if (!p_press) break; pre_screen_changed_from( tabs->get_selected_tab() ); tabs->set_tab( SCREEN_SAMPLES ); main_stack->raise( SCREEN_SAMPLES ); screen_changed_to( SCREEN_SAMPLES ); } break; case KB_GOTO_INSTRUMENT_SCREEN: { if (!p_press || !tracker.song->has_instruments()) break; pre_screen_changed_from( tabs->get_selected_tab() ); tabs->set_tab( SCREEN_INSTRUMENTS ); main_stack->raise( SCREEN_INSTRUMENTS); screen_changed_to( SCREEN_INSTRUMENTS ); } break; case KB_GOTO_VARIABLES_SCREEN: { if (!p_press) break; pre_screen_changed_from( tabs->get_selected_tab() ); tabs->set_tab( SCREEN_VARIABLES ); main_stack->raise( SCREEN_VARIABLES); screen_changed_to( SCREEN_VARIABLES ); screen_changed_to( SCREEN_VARIABLES ); } break; case KB_FILE_OPEN: { if (!p_press) break; song_menu_selected( SONG_MENU_OPEN ); } break; case KB_FILE_SAVE: { if (!p_press) break; song_menu_selected( SONG_MENU_SAVE ); } break; case KB_FILE_SAVE_AS: { if (!p_press) break; song_menu_selected( SONG_MENU_SAVE_AS ); } break; case KB_OCTAVE_RAISE: { if (!p_press) break; tracker.editor->set_default_octave( tracker.editor->get_default_octave() +1 ); /*default_octave->get_range()->set( (int)tracker.editor->get_default_octave() );*/ } break; case KB_OCTAVE_LOWER: { if (!p_press) break; tracker.editor->set_default_octave( tracker.editor->get_default_octave() -1 ); /*default_octave->get_range()->set( (int)tracker.editor->get_default_octave() );*/ } break; case KB_QUIT: { if (!p_press) break; quit_request(); } break; default: { switch( tabs->get_selected_tab() ) { case SCREEN_PATTERN: { pattern_screen->handle_key( p_unicode,p_scan_code,p_press,p_repeat,p_modifier_mask); } break; case SCREEN_SAMPLES: { sample_screen->handle_key( p_unicode,p_scan_code,p_press,p_repeat,p_modifier_mask); } break; case SCREEN_INSTRUMENTS: { instrument_screen->handle_key( p_unicode,p_scan_code,p_press,p_repeat,p_modifier_mask); } break; case SCREEN_VARIABLES: { } break; } } }; }
void InterfaceMini::song_menu_selected(int p_option) { switch (p_option) { case SONG_MENU_NEW: { new_song.patterns->set_checked(false); new_song.instruments->set_checked(false); new_song.samples->set_checked(false); new_song.variables->set_checked(false); new_song.window->show(); last_filename=""; //this is to avoid a potentially dangerous risk of overtwriting previous song } break; case SONG_MENU_OPEN: { file_dialog->clear_filter_list(); file_dialog->add_filter("Impulse Tracker",".it"); file_dialog->add_filter("Fast Tracker 2",".xm"); file_dialog->add_filter("Scream Tracker 3",".s3m"); file_dialog->add_filter("Standard Module",".mod"); file_dialog->show(FileDialog::MODE_OPEN); } break; case SONG_MENU_SAVE: { if (last_filename!="") { Saver::Error err = tracker.file_manager.save_song( last_filename.utf8().get_data(), tracker.song ); switch(err) { case Saver::SAVE_ERROR: error_msg->show("Error Saving"); break; case Saver::UNKNOWN_EXTENSION: error_msg->show("Unknown File Extension"); break; default:{}; } break; } } //go to saveas otherwise case SONG_MENU_SAVE_AS: { file_dialog->clear_filter_list(); file_dialog->add_filter("Impulse Tracker",".it"); file_dialog->show(FileDialog::MODE_SAVE); //file_dialog->add_filter("Fast Tracker 2",".xm"); //file_dialog->add_filter("Scream Tracker 3",".s3m"); //file_dialog->add_filter("Standard Module",".mod"); } break; case SONG_MENU_EXPORT_WAV: { wav_saver->show(); //file_dialog->add_filter("Fast Tracker 2",".xm"); //file_dialog->add_filter("Scream Tracker 3",".s3m"); //file_dialog->add_filter("Standard Module",".mod"); } break; case SONG_MENU_CLEANUP: { cleanup.patterns->set_checked(false); cleanup.instruments->set_checked(false); cleanup.samples->set_checked(false); cleanup.orders->set_checked(false); cleanup.def_pan->set_checked(false); cleanup.def_vol->set_checked(false); cleanup.window->show(); } break; case SONG_MENU_QUIT: { quit_request(); } break; }; }