QMenuBar *win_char_editor::setup_menuBar() { file_new_Act = new QAction(tr("New"), this); connect(file_new_Act, SIGNAL(triggered()), this, SLOT(file_new())); file_open_Act = new QAction(tr("Open"), this); connect(file_open_Act, SIGNAL(triggered()), this, SLOT(file_open())); file_saveAct = new QAction(tr("Save"), this); file_saveAct->setEnabled(FALSE); connect(file_saveAct, SIGNAL(triggered()), this, SLOT(file_save())); file_save_asAct = new QAction(tr("Save &As..."), this); file_save_asAct->setEnabled(TRUE); connect(file_save_asAct, SIGNAL(triggered()), this, SLOT(file_save_as())); file_exitAct = new QAction(tr("Exit"), this); connect(file_exitAct, SIGNAL(triggered()), this, SLOT(close())); edit_undoAct = new QAction(tr("Undo"), this); edit_undoAct->setShortcut(tr("Ctrl+Z")); connect(edit_undoAct, SIGNAL(triggered()), this, SLOT(edit_undo())); edit_undoAct->setEnabled(FALSE); edit_redoAct = new QAction(tr("Redo"), this); edit_redoAct->setShortcut(tr("Ctrl+Y")); connect(edit_redoAct, SIGNAL(triggered()), this, SLOT(edit_redo())); edit_redoAct->setEnabled(FALSE); fileMenu = new QMenu(tr("&File")); fileMenu->addAction(file_new_Act); fileMenu->addSeparator(); fileMenu->addAction(file_open_Act); fileMenu->addSeparator(); fileMenu->addAction(file_saveAct); fileMenu->addAction(file_save_asAct); fileMenu->addSeparator(); fileMenu->addAction(file_exitAct); connect(fileMenu,SIGNAL(aboutToShow()),this,SLOT(menu_file_open())); editMenu = new QMenu(tr("&Edit")); editMenu->addAction(edit_undoAct); editMenu->addAction(edit_redoAct); mb = new QMenuBar(this); mb->clear(); mb->addMenu(fileMenu); mb->addMenu(editMenu); return mb; }
static int keypress( const input_event_key_t *event ) { int swallow; const keyboard_spectrum_keys_t *ptr; #ifdef USE_WIDGET if( widget_level >= 0 ) { widget_keyhandler( event->native_key ); return 0; } #endif /* #ifdef USE_WIDGET */ /* Escape => ask UI to end mouse grab, return if grab ended */ if( event->native_key == INPUT_KEY_Escape && ui_mouse_grabbed ) { ui_mouse_grabbed = ui_mouse_release( 0 ); if( !ui_mouse_grabbed ) return 0; } swallow = 0; /* Joystick emulation via keyboard keys */ if ( event->spectrum_key == settings_current.joystick_keyboard_up ) { swallow = joystick_press( JOYSTICK_KEYBOARD, JOYSTICK_BUTTON_UP , 1 ); } else if( event->spectrum_key == settings_current.joystick_keyboard_down ) { swallow = joystick_press( JOYSTICK_KEYBOARD, JOYSTICK_BUTTON_DOWN , 1 ); } else if( event->spectrum_key == settings_current.joystick_keyboard_left ) { swallow = joystick_press( JOYSTICK_KEYBOARD, JOYSTICK_BUTTON_LEFT , 1 ); } else if( event->spectrum_key == settings_current.joystick_keyboard_right ) { swallow = joystick_press( JOYSTICK_KEYBOARD, JOYSTICK_BUTTON_RIGHT, 1 ); } else if( event->spectrum_key == settings_current.joystick_keyboard_fire ) { swallow = joystick_press( JOYSTICK_KEYBOARD, JOYSTICK_BUTTON_FIRE , 1 ); } if( swallow ) return 0; ptr = keyboard_get_spectrum_keys( event->spectrum_key ); if( ptr ) { keyboard_press( ptr->key1 ); keyboard_press( ptr->key2 ); } #ifdef USE_WIDGET switch( event->native_key ) { case INPUT_KEY_F1: fuse_emulation_pause(); widget_do( WIDGET_TYPE_MENU, &widget_menu ); fuse_emulation_unpause(); break; case INPUT_KEY_F2: fuse_emulation_pause(); menu_file_savesnapshot( 0 ); fuse_emulation_unpause(); break; case INPUT_KEY_F3: fuse_emulation_pause(); menu_file_open( 0 ); fuse_emulation_unpause(); break; case INPUT_KEY_F4: fuse_emulation_pause(); menu_options_general( 0 ); fuse_emulation_unpause(); break; case INPUT_KEY_F5: fuse_emulation_pause(); menu_machine_reset( 0 ); fuse_emulation_unpause(); break; case INPUT_KEY_F6: fuse_emulation_pause(); menu_media_tape_write( 0 ); fuse_emulation_unpause(); break; case INPUT_KEY_F7: fuse_emulation_pause(); menu_media_tape_open( 0 ); fuse_emulation_unpause(); break; case INPUT_KEY_F8: menu_media_tape_play( 0 ); break; case INPUT_KEY_F9: fuse_emulation_pause(); menu_machine_select( 0 ); fuse_emulation_unpause(); break; case INPUT_KEY_F10: fuse_emulation_pause(); menu_file_exit( 0 ); fuse_emulation_unpause(); break; default: break; /* Remove gcc warning */ } #endif /* #ifdef USE_WIDGET */ return 0; }
void menu_func (int value) { switch (value) { case M_QUIT: exit(0); break; case M_HELP: menu_help(); break; case M_PRINT_CONFIG: cerr << *options << endl; break; case M_FILE_OPEN: menu_file_open(); break; case M_FILE_RELOAD: menu_file_reload(); break; case M_FILE_SAVE_IMAGE: menu_file_save_image(); break; case M_FILE_SAVE_RAYFILE: menu_file_save_rayfile(); break; case M_RENDER_RAYTRACE: menu_render_raytrace(); break; case M_RENDER_JITTER: menu_render_jitter(); break; case M_RENDER_SHADOWS: menu_render_shadows(); break; case M_RENDER_RDEPTH: menu_render_rdepth(); break; case M_RENDER_CLIMIT: menu_render_climit(); break; case M_RENDER_SET_SIZE: menu_render_set_size(); break; case M_OPTIONS_LIGHTING: options->lighting = !options->lighting; cerr << "Lights " << (options->lighting?"on":"off") << endl; glutPostRedisplay(); break; case M_OPTIONS_TRANSFORMS: options->transforms = !options->transforms; cerr << "Transforms " << (options->transforms?"on":"off") << endl; glutPostRedisplay(); break; case M_OPTIONS_TEXTURES: options->textures = !options->textures; cerr << "Textures " << (options->textures?"on":"off") << endl; glutPostRedisplay(); break; case M_OPTIONS_BUMPMAPS: options->bumpMaps = !options->bumpMaps; cerr << "Bump maps " << (options->bumpMaps?"on":"off") << endl; glutPostRedisplay(); break; case M_OPTIONS_TRANSPARENCY: options->transparency = !options->transparency; cerr << "Transparency " << (options->transparency?"on":"off") << endl; glutPostRedisplay(); break; case M_OPTIONS_BACKFACE: options->backface = !options->backface; cerr << "Backface Culling " << (options->backface?"on":"off") << endl; glutPostRedisplay(); break; default: break; } cerr << "done!" << endl; }