Exemplo n.º 1
0
void Mixer::create_menu()
{
    QMenu *view_menu = menuBar()->addMenu(tr("View"));
    QAction *about_act = menuBar()->addAction(tr("About"));
    connect(about_act, SIGNAL(triggered()), this, SLOT(show_about()));
    view_menu->addAction(sections_dock->toggleViewAction());
    view_menu->addAction(info_dock->toggleViewAction());
}
Exemplo n.º 2
0
void show_menu(){
    clear();
    mvprintdoge(0,0);
    attron(COLOR_PAIR(1) | A_BOLD);
    mvprintw(3,65,"doge teaches typing");
    attroff(A_BOLD);
    mvprintw(mr-1,mc-13,"by Joe Jevnik");
    if (opt == 0){ attron(A_STANDOUT); }
    mvprintw(5,69,"time 2 play");
    if (opt == 0){ attroff(A_STANDOUT); }
    if (opt == 1){ attron(A_STANDOUT); }
    mvprintw(6,69,"how  2 play");
    if (opt == 1){ attroff(A_STANDOUT); }
    if (opt == 2){ attron(A_STANDOUT); }
    mvprintw(7,72,"about");
    if (opt == 2){ attroff(A_STANDOUT); }
    if (opt == 3){ attron(A_STANDOUT); }
    mvprintw(8,72,"exit");
    if (opt == 3){ attroff(A_STANDOUT); }
    refresh();
    switch(getch()){
    case KEY_RESIZE:
	endwin();
	getmaxyx(stdscr,mr,mc);
	refresh();
	show_menu();
	break;
    case KEY_UP:
	if (opt > 0){
	--opt;
	}
	break;
    case KEY_DOWN:
	if (opt < 3){
	    ++opt;
	}
	break;
    case 10: // ENTER
	switch(opt){
	case 0:
	    start_game();
	    return;
	    break;
	case 1:
	    show_help();
	    break;
	case 2:
	    show_about();
	    break;
	case 3:
	    endwin();
	    exit(0);
	    break;
	}
	break;
    }
    show_menu();
}
Exemplo n.º 3
0
void menu_select_callback(MenuLayer *menu_layer, MenuIndex *cell_index, void *data) {
  switch (cell_index->row) {
    case 0:
      show_itinerary();
      break;
    case 1:
      show_wait_times_select_park();
      break;
    case 2:
      show_entertainment_select_park();
      break;
    case 3:
      show_about();
      break;
  }
}
Exemplo n.º 4
0
void parse_cmdline(int argc, char *argv[], struct parameters *p)
{
	struct option long_options[] = {
		{ "help",         0, NULL, 'h' },
		{ "about",        0, NULL, 'a' },
		{ "shm-size",     1, NULL, 's' },
		{ 0, 0, 0, 0 }
	};

	int val, opt_index = 0, arg;

	while ((val = getopt_long(argc, argv, "has:",
					long_options, &opt_index)) != -1) {

		switch (val) {
			case 'h':
				show_help(argv[0]);
				exit(0);

			case 'a':
				show_about();
				exit(0);

			case 's':
				arg = atoi(optarg);
				if (arg < 1)
					die("Invalid shared memory size");

				p->shm_size = arg;
				break;

			default:
				show_help(argv[0]);
				exit(-1);
		}
	}

	if (*(argv + optind) == NULL) {
		show_help(argv[0]);
		exit(-1);
	}

	p->message = *(argv + optind);
}
Exemplo n.º 5
0
void MainWindow::createActions()
{
    pt_openDeviceAct = new QAction(tr("Device"),this);
    pt_openDeviceAct->setStatusTip(tr("Try to open available video capture device"));
    connect(pt_openDeviceAct, SIGNAL(triggered()), this, SLOT(opendevice()));

    pt_openVideoAct = new QAction(tr("File"),this);
    pt_openVideoAct->setStatusTip(tr("Try to open available video file"));
    connect(pt_openVideoAct, SIGNAL(triggered()), this, SLOT(openvideofile()));

    pt_pauseAct = new QAction(tr("&Pause"), this);
    pt_pauseAct->setStatusTip(tr("Stop a processing session"));
    connect(pt_pauseAct, SIGNAL(triggered()), pt_videoCapture, SLOT(pause()));

    pt_resumeAct = new QAction(tr("&Resume"), this);
    pt_resumeAct->setStatusTip(tr("Resume a processing session"));
    connect(pt_resumeAct, SIGNAL(triggered()), pt_videoCapture, SLOT(resume()));

    pt_exitAct = new QAction(tr("E&xit"), this);
    pt_exitAct->setStatusTip(tr("Application exit"));
    connect(pt_exitAct, SIGNAL(triggered()), this, SLOT(close()));

    pt_aboutAct = new QAction(tr("&About"), this);
    pt_aboutAct->setStatusTip(tr("Show the application's About box"));
    connect(pt_aboutAct, SIGNAL(triggered()), this, SLOT(show_about()));

    pt_helpAct = new QAction(tr("&Help"), this);
    pt_helpAct->setStatusTip(tr("Show the application's Help"));
    connect(pt_helpAct, SIGNAL(triggered()), this, SLOT(show_help()));

    pt_deviceResAct = new QAction(tr("&CamResolution"), this);
    pt_deviceResAct->setStatusTip(tr("Open a video device resolution dialog"));
    connect(pt_deviceResAct, SIGNAL(triggered()), this, SLOT(opendeviceresolutiondialog()));

    pt_deviceSetAct = new QAction(tr("&CamSettings"), this);
    pt_deviceSetAct->setStatusTip(tr("Open a video device settings dialog"));
    connect(pt_deviceSetAct, SIGNAL(triggered()), this, SLOT(opendevicesettingsdialog()));

    pt_DirectShowAct = new QAction(tr("&DS_dialog"), this);
    pt_DirectShowAct->setStatusTip(tr("Try to open a device-driver embedded settings dialog"));
    connect(pt_DirectShowAct, SIGNAL(triggered()), this, SLOT(callDirectShowSdialog()));
}
Exemplo n.º 6
0
void parse_cmdline(int argc, char *argv[], struct parameters *p)
{
	struct option long_options[] = {
		{ "help",         0, NULL, 'h' },
		{ "about",        0, NULL, 'a' },
		{ "fifo-path",    1, NULL, 'f' },
		{ 0, 0, 0, 0 }
	};

	int val, opt_index = 0, arg;

	while ((val = getopt_long(argc, argv, "haf:",
					long_options, &opt_index)) != -1) {

		switch (val) {
			case 'h':
				show_help(argv[0]);
				exit(0);

			case 'a':
				show_about();
				exit(0);

			case 'f':
				p->fifo_path = optarg;
				break;

			default:
				show_help(argv[0]);
				exit(-1);
		}
	}

	if (*(argv + optind) == NULL) {
		show_help(argv[0]);
		exit(-1);
	}

	p->message = *(argv + optind);
}
Exemplo n.º 7
0
void
TrayControlWindow::create_tray_actions() {
  m_act_launch = new QAction(QIcon(":/hub/Launch-07.png") ,tr("Launch"), this);

  m_act_settings = new QAction(QIcon(":/hub/Settings-07.png"), tr("Settings"), this);
  connect(m_act_settings, SIGNAL(triggered()), this, SLOT(show_settings_dialog()));

  m_act_vbox = new QAction(QIcon(":/hub/VM-07.png"), tr("Virtual machines"), this);
  connect(m_act_vbox, SIGNAL(triggered()), this, SLOT(show_vbox()));

  m_act_hub = new QAction(QIcon(":/hub/Environmetns-07.png"), tr("Environments"), this);

  m_act_quit = new QAction(QIcon(":/hub/Exit-07"), tr("Quit"), this);
  connect(m_act_quit, SIGNAL(triggered()), this, SLOT(application_quit()));

  m_act_info = new QAction(QIcon(":/hub/Balance-07.png"), CHubController::Instance().balance(), this);

  m_act_about = new QAction(QIcon(":/hub/about.png"), tr("About"), this);
  connect(m_act_about, SIGNAL(triggered()), this, SLOT(show_about()));

  m_act_generate_ssh = new QAction("Generate SSH key", this);
  connect(m_act_generate_ssh, SIGNAL(triggered()), this, SLOT(ssh_key_generate_triggered()));
}
Exemplo n.º 8
0
CLI::CLI() {
    init();
    show_about();
}
Exemplo n.º 9
0
Arquivo: gui.c Projeto: adtools/db101
void main_event_handler()
{
	ULONG result;
    UWORD Code;
    static char *strinfo, *args;
	static char *path;
	int line=0;
	int *iptr;
    struct Node *node;
	uint32 addr;
	struct Process *pr;

    while ((result = RA_HandleInput(MainWinObj, &Code)) != WMHI_LASTMSG && done != TRUE)
    {
		switch (result & WMHI_CLASSMASK)
        {
        	case WMHI_CLOSEWINDOW:
            	done = TRUE;
                break;
				
			case WMHI_ICONIFY:
				if( RA_Iconify(MainWinObj) )
				mainwin = NULL;
				break;

			case WMHI_UNICONIFY:
				mainwin = RA_Uniconify(MainWinObj);
				if( !mainwin )
					done = TRUE;
				break;

			case WMHI_MENUPICK:
				if (Code != MENUNULL)
				switch (MENUNUM(Code))
				{
					case MENU_FILE:
						switch(ITEMNUM(Code))
						{
							case MENU_PREFS:
								preferences_open_window();
								break;
							case MENU_MODULES:
								modules_open_window();
								break;
							case MENU_ABOUT:
								show_about();
								break;
							case MENU_QUIT:
								done = TRUE;
								break;
						}
				}
				break;
			
            case WMHI_GADGETUP:
            switch(result & WMHI_GADGETMASK)
            {
				case GAD_SELECT_BUTTON:

					strinfo = request_file(mainwin, &path);
					if (!strinfo)
						break;

					strcpy (filename, strinfo);
					if (strlen(path) > 0)
					{
						strcpy (childpath, path);
					}

					if(!request_arguments(&args))
					{
						console_printf(OUTPUT_WARNING, "User aborted!");
						break;
					}

					main_load (strinfo, path, args);
									
                    break;
                                    
				case GAD_RELOAD_BUTTON:
								
					main_load(strinfo, path, args);
					break;
									
				case GAD_ATTACH_BUTTON:

					if(!isattached)
					{
						pr = attach_select_process();
						if(main_attach (pr))
							button_set_detach();
					}
					else
					{
						console_printf(OUTPUT_SYSTEM, "Detaching from external process...");
						detach();
						stabs_free_stabs();
						button_set_attach();
						enable(TRUE, GAD_SELECT_BUTTON, TAG_END);
						enable(FALSE, GAD_START_BUTTON, GAD_PAUSE_BUTTON, GAD_KILL_BUTTON, GAD_STEPOVER_BUTTON,
										GAD_STEPINTO_BUTTON, GAD_STEPOUT_BUTTON, GAD_SETBREAK_BUTTON, GAD_HEX_BUTTON, TAG_END);
						console_printf(OUTPUT_SYSTEM, "Done!");
					}
						
					break;

				case GAD_START_BUTTON:

					main_play();
					break;

				case GAD_PAUSE_BUTTON:

					main_pause();
					break;

				case GAD_STEPOVER_BUTTON:

					main_step();
					break;

				case GAD_STEPINTO_BUTTON:
				
					main_into();
					break;

				case GAD_STEPOUT_BUTTON:
				
					main_out();
					break;

				case GAD_KILL_BUTTON:

					main_kill();
					break;
#if 0
				case GAD_CRASH_BUTTON:

					crash();
					break;
#endif
				case GAD_SETBREAK_BUTTON:

					breakpoints_open_window();
					break;

				case GAD_VARIABLES_LISTBROWSER:
								
					variables_handle_input();
					break;

				case GAD_SIGNAL_BUTTON:
				
					sigwin_open_window();
					break;

				case GAD_IMPORT_BUTTON:
				
					import_open_window();
					break;

				case GAD_X_BUTTON:

					console_clear();
					break;

				case GAD_HEX_BUTTON:

					hex_open_window();
					break;

				case GAD_DISASSEMBLER_LISTBROWSER:
					disassembler_show_selected();
					break;
									
				case GAD_DISASSEMBLER_STEP_BUTTON:
					asmstep();
					should_continue = FALSE;
					asm_trace = TRUE;
					break;
									
				case GAD_DISASSEMBLER_SKIP_BUTTON:
					asmskip();
					disassembler_makelist();
					break;

				case GAD_SOURCE_LISTBROWSER:
					source_handle_input();
					source_show_currentline();
					break;
				
				case GAD_SOURCELIST_LISTBROWSER:
					sourcelist_handle_input();
					break;
					
				case GAD_AREXX_BUTTON:
				case GAD_AREXX_STRING:
				{
					char *str;
									
                    IIntuition->GetAttrs( MainObj[GAD_AREXX_STRING], STRINGA_TextVal, &str, TAG_DONE );
					strcpy (arexxcommandstring, str);

					arexxexecute.MethodID = AM_EXECUTE;
					arexxexecute.ape_CommandString = arexxcommandstring;
					arexxexecute.ape_PortName = "AREXXDB101";
					arexxexecute.ape_IO = (BPTR)NULL;

                    IIntuition->SetAttrs( MainObj[GAD_AREXX_STRING], STRINGA_TextVal, "", TAG_DONE );
					IIntuition->RefreshGadgets ((struct Gadget *)MainObj[GAD_AREXX_STRING], mainwin, NULL);

					console_printf(OUTPUT_AREXX, arexxcommandstring);
					IIntuition->IDoMethodA(arexx_obj, (Msg)&arexxexecute);
	
					//IIntuition->ActivateGadget((struct Gadget *)MainObj[GAD_AREXX_STRING], mainwin, NULL);
					ILayout->ActivateLayoutGadget((struct Gadget *)MainObj[GAD_TOPLAYOUT], mainwin, NULL, (uint32)MainObj[GAD_AREXX_STRING]);
					break;
				}
			}
			break;
		}
	}
	return;
}
Exemplo n.º 10
0
static void menu_show(gpointer data, guint action, GtkWidget *widget)
{
    GtkTextIter p; 
    
    switch(action) 
      {
      case MENU_NEW:
	if(save_if_modified())  /* call save if modified wen user opens a new file */
	  {
	    /* get all the current tag table n put them in the new buffer */
	    buf = gtk_text_buffer_new(gtk_text_buffer_get_tag_table(buf));
	    gtk_text_view_set_buffer(GTK_TEXT_VIEW(view), buf);
	    g_object_unref(G_OBJECT(buf)); 
            /* needed for freeing memory by the buffer wen a new buffer is created */
	  }
	break;
      case MENU_OPEN:
	if(save_if_modified()) 
        {
	  /* call save if modified wen user opens a new file */
	  buf = gtk_text_buffer_new(gtk_text_buffer_get_tag_table(buf));
	  gtk_text_view_set_buffer(GTK_TEXT_VIEW(view), buf);

        /* needed for freeing memory by the buffer wen a new buffer is created */
	  g_object_unref(G_OBJECT(buf));
	  load_file(NULL);
	}
	break;
      case MENU_SAVE:
	save_file(filename);
	break;
      case MENU_SAVE_AS:
	save_file(NULL);
	break;
      case MENU_QUIT:
	if(save_if_modified())            /* call save if modified wen user opens a new file */
	  gtk_widget_destroy(window);
	break;
      case MENU_CUT:
	gtk_text_buffer_cut_clipboard(buf,gtk_clipboard_get(sel_atom), TRUE);
	break;
      case MENU_COPY:
	gtk_text_buffer_copy_clipboard(buf,gtk_clipboard_get(sel_atom));
	break;
      case MENU_PASTE:
        /* if null text is inserted at the current cursor position */
	gtk_text_buffer_paste_clipboard(buf,gtk_clipboard_get(sel_atom), NULL, TRUE);
	break;
      case MENU_FIND:
	textfind();
	break;
      case MENU_REPLACE:
	text_find_replace();	
	break;
	
      case MENU_SELECT_ALL:
	gtk_text_buffer_get_start_iter(buf, &p);  /* get the starting pt of the buffer */
	gtk_text_buffer_place_cursor(buf, &p);    /* ignore the selection made by the mouse */
	gtk_text_buffer_get_end_iter(buf, &p);   /* get the ending pt of the buffer */
	gtk_text_buffer_move_mark_by_name(buf, "selection_bound", &p);
	break;
      case MENU_HELP:
	show_help();
	break;
      case MENU_ABOUT:
        show_about();
        break;
	
      default:      /* error checking */
	g_printerr("Menu action not defined : %u\n", action);
	break;
      }
} 
Exemplo n.º 11
0
/* returns 1 if the key was handled */
static int handle_key_global(struct key_event * k)
{
	int i, ins_mode;

	if (_mp_active == 2 && (k->mouse == MOUSE_CLICK && k->state == KEY_RELEASE)) {
		status.flags |= NEED_UPDATE;
		dialog_destroy_all();
		_mp_active = 0;
		// eat it...
		return 1;
	}
	if ((!_mp_active) && k->state == KEY_PRESS && k->mouse == MOUSE_CLICK) {
		if (k->x >= 63 && k->x <= 77 && k->y >= 6 && k->y <= 7) {
			status.vis_style++;
			status.vis_style %= VIS_SENTINEL;
			status.flags |= NEED_UPDATE;
			return 1;
		} else if (k->y == 5 && k->x == 50) {
			minipop_slide(kbd_get_current_octave(), "Octave", 0, 8,
				kbd_set_current_octave, NULL, 50, 5);
			return 1;
		} else if (k->y == 4 && k->x >= 50 && k->x <= 52) {
			minipop_slide(song_get_current_speed(), "Speed", 1, 255,
				song_set_current_speed, song_set_initial_speed, 51, 4);
			return 1;
		} else if (k->y == 4 && k->x >= 54 && k->x <= 56) {
			minipop_slide(song_get_current_tempo(), "Tempo", 32, 255,
				song_set_current_tempo, song_set_initial_tempo, 55, 4);
			return 1;
		} else if (k->y == 3 && k->x >= 50 && k-> x <= 77) {
			if (page_is_instrument_list(status.current_page)
			    || status.current_page == PAGE_SAMPLE_LIST
			    || (!(status.flags & CLASSIC_MODE)
				&& (status.current_page == PAGE_ORDERLIST_PANNING
				    || status.current_page == PAGE_ORDERLIST_VOLUMES)))
				ins_mode = 0;
			else
				ins_mode = song_is_instrument_mode();
			if (ins_mode) {
				minipop_slide(instrument_get_current(), "!",
					status.current_page == PAGE_INSTRUMENT_LIST ? 1 : 0,
					99 /* FIXME */, instrument_set, NULL, 58, 3);
			} else {
				minipop_slide(sample_get_current(), "@",
					status.current_page == PAGE_SAMPLE_LIST ? 1 : 0,
					99 /* FIXME */, sample_set, NULL, 58, 3);
			}

		} else if (k->y == 7 && k->x >= 11 && k->x <= 17) {
			minipop_slide(get_current_row(), "Row",
				0, song_get_rows_in_pattern(get_current_pattern()),
				set_current_row, NULL, 14, 7);
			return 1;
		} else if (k->y == 6 && k->x >= 11 && k->x <= 17) {
			minipop_slide(get_current_pattern(), "Pattern",
				0, csf_get_num_patterns(current_song),
				set_current_pattern, NULL, 14, 6);
			return 1;
		} else if (k->y == 5 && k->x >= 11 && k->x <= 17) {
			minipop_slide(song_get_current_order(), "Order",
				0, csf_get_num_orders(current_song),
				set_current_order, NULL, 14, 5);
			return 1;
		}
	} else if ((!_mp_active) && k->mouse == MOUSE_DBLCLICK) {
		if (k->y == 4 && k->x >= 11 && k->x <= 28) {
			set_page(PAGE_SAVE_MODULE);
			return 1;
		} else if (k->y == 3 && k->x >= 11 && k->x <= 35) {
			set_page(PAGE_SONG_VARIABLES);
			return 1;
		}
	}

	/* shortcut */
	if (k->mouse != MOUSE_NONE) {
		return 0;
	}

	/* first, check the truly global keys (the ones that still work if
	 * a dialog's open) */
	switch (k->sym) {
	case SDLK_RETURN:
		if ((k->mod & KMOD_CTRL) && k->mod & KMOD_ALT) {
			if (k->state == KEY_PRESS)
				return 1;
			toggle_display_fullscreen();
			return 1;
		}
		break;
	case SDLK_m:
		if (k->mod & KMOD_CTRL) {
			if (k->state == KEY_RELEASE)
				return 1;
			video_mousecursor(MOUSE_CYCLE_STATE);
			return 1;
		}
		break;

	case SDLK_d:
		if (k->mod & KMOD_CTRL) {
			if (k->state == KEY_RELEASE)
				return 1; /* argh */
			i = SDL_WM_GrabInput(SDL_GRAB_QUERY);
			if (i == SDL_GRAB_QUERY)
				i = currently_grabbed;
			currently_grabbed = i = (i != SDL_GRAB_ON ? SDL_GRAB_ON : SDL_GRAB_OFF);
			SDL_WM_GrabInput(i);
			status_text_flash(i
				? "Mouse and keyboard grabbed, press Ctrl+D to release"
				: "Mouse and keyboard released");
			return 1;
		}
		break;

	case SDLK_i:
		/* reset audio stuff? */
		if (k->mod & KMOD_CTRL) {
			if (k->state == KEY_RELEASE)
				return 1;
			audio_reinit();
			return 1;
		}
		break;
	case SDLK_e:
		/* This should reset everything display-related. */
		if (k->mod & KMOD_CTRL) {
			if (k->state == KEY_RELEASE)
				return 1;
			font_init();
			status.flags |= NEED_UPDATE;
			return 1;
		}
		break;
	case SDLK_HOME:
		if (!(k->mod & KMOD_ALT)) break;
		if (status.flags & DISKWRITER_ACTIVE) break;
		if (k->state == KEY_RELEASE)
			return 0;
		kbd_set_current_octave(kbd_get_current_octave() - 1);
		return 1;
	case SDLK_END:
		if (!(k->mod & KMOD_ALT)) break;
		if (status.flags & DISKWRITER_ACTIVE) break;
		if (k->state == KEY_RELEASE)
			return 0;
		kbd_set_current_octave(kbd_get_current_octave() + 1);
		return 1;
	default:
		break;
	}

	/* next, if there's no dialog, check the rest of the keys */
	if (status.flags & DISKWRITER_ACTIVE) return 0;

	switch (k->sym) {
	case SDLK_q:
		if (status.dialog_type != DIALOG_NONE)
			return 0;
		if (k->mod & KMOD_CTRL) {
			_mp_finish(NULL);
			if (k->state == KEY_PRESS)
				show_exit_prompt();
			return 1;
		}
		break;
	case SDLK_n:
		if (status.dialog_type != DIALOG_NONE)
			return 0;
		if (k->mod & KMOD_CTRL) {
			_mp_finish(NULL);
			if (k->state == KEY_PRESS)
				new_song_dialog();
			return 1;
		}
		break;
	case SDLK_g:
		if (status.dialog_type != DIALOG_NONE)
			return 0;
		if (k->mod & KMOD_CTRL) {
			_mp_finish(NULL);
			if (k->state == KEY_PRESS)
				show_song_timejump();
			return 1;
		}
		break;
	case SDLK_p:
		if (status.dialog_type != DIALOG_NONE)
			return 0;
		if (k->mod & KMOD_CTRL) {
			_mp_finish(NULL);
			if (k->state == KEY_PRESS)
				show_song_length();
			return 1;
		}
		break;
	case SDLK_F1:
		if (status.dialog_type != DIALOG_NONE)
			return 0;
		if (k->mod & KMOD_CTRL) {
			_mp_finish(NULL);
			if (k->state == KEY_PRESS)
				set_page(PAGE_CONFIG);
		} else if (k->mod & KMOD_SHIFT) {
			_mp_finish(NULL);
			if (k->state == KEY_PRESS)
				set_page(status.current_page == PAGE_MIDI ? PAGE_MIDI_OUTPUT : PAGE_MIDI);
		} else if (NO_MODIFIER(k->mod)) {
			_mp_finish(NULL);
			if (k->state == KEY_PRESS)
				set_page(PAGE_HELP);
		} else {
			break;
		}
		return 1;
	case SDLK_F2:
		if (k->mod & KMOD_CTRL) {
			if (status.current_page == PAGE_PATTERN_EDITOR) {
				_mp_finish(NULL);
				if (k->state == KEY_PRESS && status.dialog_type == DIALOG_NONE) {
					pattern_editor_length_edit();
				}
				return 1;
			}
			if (status.dialog_type != DIALOG_NONE)
				return 0;
		} else if (NO_MODIFIER(k->mod)) {
			if (status.current_page == PAGE_PATTERN_EDITOR) {
				if (k->state == KEY_PRESS) {
					if (status.dialog_type & DIALOG_MENU) {
						return 0;
					} else if (status.dialog_type != DIALOG_NONE) {
						dialog_yes_NULL();
						status.flags |= NEED_UPDATE;
					} else {
						_mp_finish(NULL);
						pattern_editor_display_options();
					}
				}
			} else {
				if (status.dialog_type != DIALOG_NONE)
					return 0;
				_mp_finish(NULL);
				if (k->state == KEY_PRESS)
					set_page(PAGE_PATTERN_EDITOR);
			}
			return 1;
		}
		break;
	case SDLK_F3:
		if (status.dialog_type != DIALOG_NONE)
			return 0;
		if (NO_MODIFIER(k->mod)) {
			_mp_finish(NULL);
			if (k->state == KEY_PRESS)
				set_page(PAGE_SAMPLE_LIST);
		} else {
			_mp_finish(NULL);
			if (k->mod & KMOD_CTRL) set_page(PAGE_LIBRARY_SAMPLE);
			break;
		}
		return 1;
	case SDLK_F4:
		if (status.dialog_type != DIALOG_NONE)
			return 0;
		if (NO_MODIFIER(k->mod)) {
			if (status.current_page == PAGE_INSTRUMENT_LIST) return 0;
			_mp_finish(NULL);
			if (k->state == KEY_PRESS)
				set_page(PAGE_INSTRUMENT_LIST);
		} else {
			if (k->mod & KMOD_SHIFT) return 0;
			_mp_finish(NULL);
			if (k->mod & KMOD_CTRL) set_page(PAGE_LIBRARY_INSTRUMENT);
			break;
		}
		return 1;
	case SDLK_F5:
		if (k->mod & KMOD_CTRL) {
			_mp_finish(NULL);
			if (k->state == KEY_PRESS)
				song_start();
		} else if (k->mod & KMOD_SHIFT) {
			if (status.dialog_type != DIALOG_NONE)
				return 0;
			_mp_finish(NULL);
			if (k->state == KEY_RELEASE)
				set_page(PAGE_PREFERENCES);
		} else if (NO_MODIFIER(k->mod)) {
			if (song_get_mode() == MODE_STOPPED
			|| (song_get_mode() == MODE_SINGLE_STEP && status.current_page == PAGE_INFO)) {
				_mp_finish(NULL);
				if (k->state == KEY_PRESS)
					song_start();
			}
			if (k->state == KEY_PRESS) {
				if (status.dialog_type != DIALOG_NONE)
					return 0;
				_mp_finish(NULL);
				set_page(PAGE_INFO);
			}
		} else {
			break;
		}
		return 1;
	case SDLK_F6:
		if (k->mod & KMOD_SHIFT) {
			_mp_finish(NULL);
			if (k->state == KEY_PRESS)
				song_start_at_order(get_current_order(), 0);
		} else if (NO_MODIFIER(k->mod)) {
			_mp_finish(NULL);
			if (k->state == KEY_PRESS)
				song_loop_pattern(get_current_pattern(), 0);
		} else {
			break;
		}
		return 1;
	case SDLK_F7:
		if (NO_MODIFIER(k->mod)) {
			_mp_finish(NULL);
			if (k->state == KEY_PRESS)
				play_song_from_mark();
		} else {
			break;
		}
		return 1;
	case SDLK_F8:
		if (k->mod & KMOD_SHIFT) {
			if (k->state == KEY_PRESS)
				song_pause();
		} else if (NO_MODIFIER(k->mod)) {
			_mp_finish(NULL);
			if (k->state == KEY_PRESS)
				song_stop();
			status.flags |= NEED_UPDATE;
		} else {
			break;
		}
		return 1;
	case SDLK_F9:
		if (status.dialog_type != DIALOG_NONE)
			return 0;
		if (k->mod & KMOD_SHIFT) {
			_mp_finish(NULL);
			if (k->state == KEY_PRESS)
				set_page(PAGE_MESSAGE);
		} else if (NO_MODIFIER(k->mod)) {
			_mp_finish(NULL);
			if (k->state == KEY_PRESS)
				set_page(PAGE_LOAD_MODULE);
		} else {
			break;
		}
		return 1;
	case SDLK_l:
	case SDLK_r:
		if (status.dialog_type != DIALOG_NONE)
			return 0;
		if (k->mod & KMOD_CTRL) {
			_mp_finish(NULL);
			if (k->state == KEY_RELEASE)
				set_page(PAGE_LOAD_MODULE);
		} else {
			break;
		}
		return 1;
	case SDLK_s:
		if (status.dialog_type != DIALOG_NONE)
			return 0;
		if (k->mod & KMOD_CTRL) {
			_mp_finish(NULL);
			if (k->state == KEY_RELEASE)
				save_song_or_save_as();
		} else {
			break;
		}
		return 1;
	case SDLK_w:
		/* Ctrl-W _IS_ in IT, and hands don't leave home row :) */
		if (status.dialog_type != DIALOG_NONE)
			return 0;
		if (k->mod & KMOD_CTRL) {
			_mp_finish(NULL);
			if (k->state == KEY_RELEASE)
				set_page(PAGE_SAVE_MODULE);
		} else {
			break;
		}
		return 1;
	case SDLK_F10:
		if (status.dialog_type != DIALOG_NONE)
			return 0;
		if (k->mod & KMOD_ALT) break;
		if (k->mod & KMOD_CTRL) break;

		_mp_finish(NULL);
		if (k->mod & KMOD_SHIFT) {
			if (k->state == KEY_PRESS)
				set_page(PAGE_EXPORT_MODULE);
		} else {
			if (k->state == KEY_PRESS)
				set_page(PAGE_SAVE_MODULE);
		}
		return 1;
	case SDLK_F11:
		if (status.dialog_type != DIALOG_NONE)
			return 0;
		if (NO_MODIFIER(k->mod)) {
			_mp_finish(NULL);
			if (status.current_page == PAGE_ORDERLIST_PANNING) {
				if (k->state == KEY_PRESS)
					set_page(PAGE_ORDERLIST_VOLUMES);
			} else {
				if (k->state == KEY_PRESS)
					set_page(PAGE_ORDERLIST_PANNING);
			}
		} else if (k->mod & KMOD_CTRL) {
			if (k->state == KEY_PRESS) {
				_mp_finish(NULL);
				if (status.current_page == PAGE_LOG) {
					show_about();
				} else {
					set_page(PAGE_LOG);
				}
			}
		} else if (k->state == KEY_PRESS && (k->mod & KMOD_ALT)) {
			_mp_finish(NULL);
			if (song_toggle_orderlist_locked())
				status_text_flash("Order list locked");
			else
				status_text_flash("Order list unlocked");
		} else {
			break;
		}
		return 1;
	case SDLK_F12:
		if (status.dialog_type != DIALOG_NONE)
			return 0;
		if ((k->mod & KMOD_ALT) && status.current_page == PAGE_INFO) {
			_mp_finish(NULL);
			if (k->state == KEY_PRESS)
				set_page(PAGE_WATERFALL);
		} else if (k->mod & KMOD_CTRL) {
			_mp_finish(NULL);
			if (k->state == KEY_PRESS)
				set_page(PAGE_PALETTE_EDITOR);
		} else if (k->mod & KMOD_SHIFT) {
			_mp_finish(NULL);
			if (k->state == KEY_PRESS) {
				fontedit_return_page = status.current_page;
				set_page(PAGE_FONT_EDIT);
			}

		} else if (NO_MODIFIER(k->mod)) {
			_mp_finish(NULL);
			if (k->state == KEY_PRESS)
				set_page(PAGE_SONG_VARIABLES);
		} else {
			break;
		}
		return 1;
	/* hack alert */
	case SDLK_f:
		if (!(k->mod & KMOD_CTRL))
			return 0;
		/* fall through */
	case SDLK_SCROLLOCK:
		if (status.dialog_type != DIALOG_NONE)
			return 0;
		_mp_finish(NULL);
		if (k->mod & KMOD_ALT) {
			if (k->state == KEY_PRESS) {
				midi_flags ^= (MIDI_DISABLE_RECORD);
				status_text_flash("MIDI Input %s",
					(midi_flags & MIDI_DISABLE_RECORD)
					? "Disabled" : "Enabled");
			}
			return 1;
		} else {
			/* os x steals plain scroll lock for brightness,
			 * so catch ctrl+scroll lock here as well */
			if (k->state == KEY_PRESS) {
				midi_playback_tracing = (playback_tracing = !playback_tracing);
				status_text_flash("Playback tracing %s",
						  (playback_tracing ? "enabled" : "disabled"));
			}
			return 1;
		}
	default:
		if (status.dialog_type != DIALOG_NONE)
			return 0;
		break;
	}

	/* got a bit ugly here, sorry */
	i = k->sym;
	if (k->mod & KMOD_ALT) {
		switch (i) {
		case SDLK_F1: i = 0; break;
		case SDLK_F2: i = 1; break;
		case SDLK_F3: i = 2; break;
		case SDLK_F4: i = 3; break;
		case SDLK_F5: i = 4; break;
		case SDLK_F6: i = 5; break;
		case SDLK_F7: i = 6; break;
		case SDLK_F8: i = 7; break;
		default:
			return 0;
		};
		if (k->state == KEY_RELEASE)
			return 1;

		song_toggle_channel_mute(i);
		status.flags |= NEED_UPDATE;
		return 1;
	}

	/* oh well */
	return 0;
}
Exemplo n.º 12
0
/****** Main menu constructor ******/
main_menu::main_menu(QWidget *parent) : QWidget(parent)
{
	//Setup actions
	QAction* open = new QAction("Open", this);
	QAction* quit = new QAction ("Quit", this);

	QAction* pause = new QAction("Pause", this);
	QAction* reset = new QAction("Reset", this);
	QAction* fullscreen = new QAction("Fullscreen", this);
	QAction* screenshot = new QAction("Screenshot", this);
	QAction* nplay_start = new QAction("Start Netplay", this);
	QAction* nplay_stop = new QAction("Stop Netplay", this);

	QAction* general = new QAction("General Settings...", this);
	QAction* display = new QAction("Display", this);
	QAction* sound = new QAction("Sound", this);
	QAction* controls = new QAction("Controls", this);
	QAction* netplay = new QAction("Netplay", this);
	QAction* paths = new QAction("Paths", this);

	QAction* custom_gfx = new QAction("Custom Graphics...", this);
	QAction* debugging = new QAction("Debugger", this);

	QAction* about = new QAction("About", this);

	//Set shortcuts for actions
	open->setShortcut(tr("CTRL+O"));
	quit->setShortcut(tr("CTRL+Q"));

	pause->setShortcut(tr("CTRL+P"));
	reset->setShortcut(tr("F8"));
	fullscreen->setShortcut(tr("F12"));
	screenshot->setShortcut(tr("F9"));
	nplay_start->setShortcut(tr("F5"));
	nplay_stop->setShortcut(tr("F6"));

	pause->setCheckable(true);
	pause->setObjectName("pause_action");
	fullscreen->setCheckable(true);
	fullscreen->setObjectName("fullscreen_action");

	menu_bar = new QMenuBar(this);

	//Setup File menu
	QMenu* file;

	file = new QMenu(tr("File"), this);
	file->addAction(open);
	recent_list = file->addMenu(tr("Recent Files"));
	file->addSeparator();
	state_save_list = file->addMenu(tr("Save State"));
	state_load_list = file->addMenu(tr("Load State"));
	file->addSeparator();
	file->addAction(quit);
	menu_bar->addMenu(file);

	//Setup Emulation menu
	QMenu* emulation;

	emulation = new QMenu(tr("Emulation"), this);
	emulation->addAction(pause);
	emulation->addAction(reset);
	emulation->addSeparator();
	emulation->addAction(fullscreen);
	emulation->addAction(screenshot);
	emulation->addSeparator();
	emulation->addAction(nplay_start);
	emulation->addAction(nplay_stop);
	menu_bar->addMenu(emulation);

	//Setup Options menu
	QMenu* options;
	
	options = new QMenu(tr("Options"), this);
	options->addAction(general);
	options->addSeparator();
	options->addAction(display);
	options->addAction(sound);
	options->addAction(controls);
	options->addAction(netplay);
	options->addAction(paths);
	menu_bar->addMenu(options);

	//Advanced menu
	QMenu* advanced;

	advanced = new QMenu(tr("Advanced"), this);
	advanced->addAction(custom_gfx);
	advanced->addAction(debugging);
	menu_bar->addMenu(advanced);

	//Setup Help menu
	QMenu* help;

	help = new QMenu(tr("Help"), this);
	help->addAction(about);
	menu_bar->addMenu(help);

	//Setup signals
	connect(quit, SIGNAL(triggered()), this, SLOT(quit()));
	connect(open, SIGNAL(triggered()), this, SLOT(open_file()));
	connect(pause, SIGNAL(triggered()), this, SLOT(pause()));
	connect(fullscreen, SIGNAL(triggered()), this, SLOT(fullscreen()));
	connect(screenshot, SIGNAL(triggered()), this, SLOT(screenshot()));
	connect(nplay_start, SIGNAL(triggered()), this, SLOT(start_netplay()));
	connect(nplay_stop, SIGNAL(triggered()), this, SLOT(stop_netplay()));
	connect(reset, SIGNAL(triggered()), this, SLOT(reset()));
	connect(general, SIGNAL(triggered()), this, SLOT(show_settings()));
	connect(display, SIGNAL(triggered()), this, SLOT(show_display_settings()));
	connect(sound, SIGNAL(triggered()), this, SLOT(show_sound_settings()));
	connect(controls, SIGNAL(triggered()), this, SLOT(show_control_settings()));
	connect(netplay, SIGNAL(triggered()), this, SLOT(show_netplay_settings()));
	connect(paths, SIGNAL(triggered()), this, SLOT(show_paths_settings()));
	connect(custom_gfx, SIGNAL(triggered()), this, SLOT(show_cgfx()));
	connect(debugging, SIGNAL(triggered()), this, SLOT(show_debugger()));
	connect(about, SIGNAL(triggered()), this, SLOT(show_about()));

	sw_screen = new soft_screen();
	hw_screen = new hard_screen();

	QVBoxLayout* layout = new QVBoxLayout;
	layout->setContentsMargins(0, 0, 0, -1);
	layout->addWidget(sw_screen);
	layout->addWidget(hw_screen);
	layout->setMenuBar(menu_bar);
	setLayout(layout);

	config::scaling_factor = 2;

	hw_screen->hide();
	hw_screen->setEnabled(false);

	//Parse .ini options
	parse_ini_file();

	//Parse cheats file
	if(config::use_cheats) { parse_cheats_file(); }

	//Parse command-line arguments
	//These will override .ini options!
	if(!parse_cli_args()) { exit(0); }

	//Some command-line arguments are invalid for the Qt version
	config::use_debugger = false;

	//Setup Recent Files
	list_mapper = new QSignalMapper(this);

	for(int x = (config::recent_files.size() - 1); x >= 0; x--)
	{
		QString path = QString::fromStdString(config::recent_files[x]);
		QFileInfo file(path);
		path = file.fileName();

		QAction* temp = new QAction(path, this);
		recent_list->addAction(temp);

		connect(temp, SIGNAL(triggered()), list_mapper, SLOT(map()));
		list_mapper->setMapping(temp, x);
	}

	connect(list_mapper, SIGNAL(mapped(int)), this, SLOT(load_recent(int)));

	//Setup Save States
	QSignalMapper* save_mapper = new QSignalMapper(this);

	for(int x = 0; x < 10; x++)
	{
		QAction* temp;

		if(x == 0) 
		{
			temp = new QAction(tr("Quick Save"), this);
			temp->setShortcut(tr("F1"));
		}
		
		else
		{
			std::string slot_id = "Slot " + util::to_str(x);
			QString slot_name = QString::fromStdString(slot_id);
			temp = new QAction(slot_name, this);
		}

		state_save_list->addAction(temp);

		connect(temp, SIGNAL(triggered()), save_mapper, SLOT(map()));
		save_mapper->setMapping(temp, x);
	}

	connect(save_mapper, SIGNAL(mapped(int)), this, SLOT(save_state(int)));

	//Setup Load States
	QSignalMapper* load_mapper = new QSignalMapper(this);

	for(int x = 0; x < 10; x++)
	{
		QAction* temp;

		if(x == 0)
		{
			temp = new QAction(tr("Quick Load"), this);
			temp->setShortcut(tr("F2"));
		}
		
		else
		{
			std::string slot_id = "Slot " + util::to_str(x);
			QString slot_name = QString::fromStdString(slot_id);
			temp = new QAction(slot_name, this);
		}

		state_load_list->addAction(temp);

		connect(temp, SIGNAL(triggered()), load_mapper, SLOT(map()));
		load_mapper->setMapping(temp, x);
	}

	connect(load_mapper, SIGNAL(mapped(int)), this, SLOT(load_state(int)));

	//Set up settings dialog
	settings = new gen_settings();
	settings->set_ini_options();

	//Set up custom graphics dialog
	cgfx = new gbe_cgfx();
	cgfx->hide();
	cgfx->advanced->setChecked(true);

	//Set up DMG-GBC debugger
	main_menu::dmg_debugger = new dmg_debug();
	main_menu::dmg_debugger->hide();

	//Setup About pop-up
	about_box = new QWidget();
	about_box->resize(300, 250);
	about_box->setWindowTitle("About GBE+");

	QDialogButtonBox* about_button = new QDialogButtonBox(QDialogButtonBox::Close);
	connect(about_button->button(QDialogButtonBox::Close), SIGNAL(clicked()), about_box, SLOT(close()));

	QLabel* emu_title = new QLabel("GBE+ 1.0");
	QFont font = emu_title->font();
	font.setPointSize(18);
	font.setBold(true);
	emu_title->setFont(font);

	QImage logo(QString::fromStdString(config::cfg_path + "data/icons/gbe_plus.png"));
	logo = logo.scaled(128, 128);
	QLabel* emu_desc = new QLabel("A GB/GBC/GBA emulator with enhancements");
	QLabel* emu_copyright = new QLabel("Copyright D.S. Baxter 2014-2016");
	QLabel* emu_proj_copyright = new QLabel("Copyright GBE+ Team 2014-2016");
	QLabel* emu_license = new QLabel("This program is licensed under the GNU GPLv2");
	QLabel* emu_site = new QLabel("<a href=\"https://github.com/shonumi/gbe-plus/\">GBE+ on GitHub</a>");
	emu_site->setOpenExternalLinks(true);
	QLabel* emu_logo = new QLabel;
	emu_logo->setPixmap(QPixmap::fromImage(logo));

	QVBoxLayout* about_layout = new QVBoxLayout;
	about_layout->addWidget(emu_title, 0, Qt::AlignCenter | Qt::AlignTop);
	about_layout->addWidget(emu_desc, 0, Qt::AlignCenter | Qt::AlignTop);
	about_layout->addWidget(emu_copyright, 0, Qt::AlignCenter | Qt::AlignTop);
	about_layout->addWidget(emu_proj_copyright, 0, Qt::AlignCenter | Qt::AlignTop);
	about_layout->addWidget(emu_license, 0, Qt::AlignCenter | Qt::AlignTop);
	about_layout->addWidget(emu_site, 0, Qt::AlignCenter | Qt::AlignTop);
	about_layout->addWidget(emu_logo, 0, Qt::AlignCenter | Qt::AlignTop);
	about_layout->addWidget(about_button);
	about_box->setLayout(about_layout);
	about_box->setWindowIcon(QIcon(QString::fromStdString(config::cfg_path + "data/icons/gbe_plus.png")));
	
	about_box->hide();

	//Setup warning message box
	warning_box = new QMessageBox;
	QPushButton* warning_box_ok = warning_box->addButton("OK", QMessageBox::AcceptRole);
	warning_box->setIcon(QMessageBox::Warning);
	warning_box->hide();

	display_width = QApplication::desktop()->screenGeometry().width();
	display_height = QApplication::desktop()->screenGeometry().height();

	fullscreen_mode = false;
}
Exemplo n.º 13
0
static void action_about(G_GNUC_UNUSED GtkAction *act,
                                    G_GNUC_UNUSED gpointer data)
{
	show_about();
}
Exemplo n.º 14
0
static void menu_about (GtkMenuItem *menuitem, gpointer data) {
  show_about();
}
Exemplo n.º 15
0
Arquivo: gvccmd.c Projeto: 131/gsview
/* gsview menu commands */
int
gsview_command(int command)
{
    switch (command) {
    case IDM_NEXTHOME:
    case IDM_NEXT:
    case IDM_NEXTSKIP:
    case IDM_REDISPLAY:
    case IDM_PREVHOME:
    case IDM_PREVSKIP:
    case IDM_PREV:
    case IDM_GOBACK:
    case IDM_GOFWD:
    case IDM_MAGPLUS:
    case IDM_MAGMINUS:
    case IDM_FITWIN:
    case IDM_ZOOM:
    case IDM_FULLSCREEN:
        /* These don't close the full screen window */
        break;
    default:
        gsview_fullscreen_end();
    }
    switch (command) {
    case IDM_FULLSCREEN:
        gsview_fullscreen();
        return 0;
    case IDM_OPEN:
        if (pending.psfile) {
            play_sound(SOUND_BUSY);
            return 0;
        }
        gsview_display();
        return 0;
    case IDM_LASTFILE1:
    case IDM_LASTFILE2:
    case IDM_LASTFILE3:
    case IDM_LASTFILE4:
        if (pending.psfile) {
            play_sound(SOUND_BUSY);
            return 0;
        }
        make_cwd(last_files[command-IDM_LASTFILE1]);
        gsview_displayfile(last_files[command-IDM_LASTFILE1]);
        return 0;
    case IDM_CLOSE:
        /* doesn't unload DLL */
        /* close file */
        if (gsdll.open && (gsdll.state != GS_UNINIT)) {
            PSFILE *tpsfile;
            if (pending.psfile) {
                play_sound(SOUND_BUSY);
                return 0;
            }
            tpsfile = (PSFILE *)malloc(sizeof(PSFILE));
            if (tpsfile == NULL)
                return 0;
            memset((char *)tpsfile, 0, sizeof(PSFILE));
            pending.psfile = tpsfile;
            pending.now = TRUE;
            if (psfile.name[0] && psfile.dsc==(CDSC *)NULL)
                pending.abort = TRUE;
        }
        else {
            /* DLL isn't loaded */
            if (psfile.file)
                dfclose();	/* just to make sure */
            psfile_free(&psfile);
            post_img_message(WM_GSTITLE, 0);
            info_wait(IDS_NOWAIT);
        }
        return 0;
    case IDM_CLOSE_DONE:
        if (selectname[0] != '\0') {
            /* pending IDM_SELECT */
            PSFILE *tpsfile;
            tpsfile = gsview_openfile(selectname);
            if (tpsfile) {
                psfile = *tpsfile;
                free(tpsfile);
            }
            selectname[0] = '\0';
            post_img_message(WM_GSTITLE, 0);
            info_wait(IDS_NOWAIT);
        }
        return 0;
    case IDM_NEXTHOME:
#ifdef UNIX
        set_scroll(-1, 0);
#else
#ifdef _Windows
        PostMessage(hwnd_image ,WM_VSCROLL,SB_TOP,0L);
#else
        WinPostMsg(hwnd_frame, WM_VSCROLL, MPFROMLONG(0), MPFROM2SHORT(0, SB_TOP));
#endif
#endif
    /* fall thru */
    case IDM_NEXT:
        if (not_open())
            return 0;
        gs_page_skip(1);
        return 0;
    case IDM_NEXTSKIP:
        if (not_dsc())
            return 0;
        if (order_is_special())
            return 0;
        gs_page_skip(page_skip);
        return 0;
    case IDM_REDISPLAY:
        if (dfchanged()) {
            PSFILE *tpsfile;
            if (dfchanged() < 0) {
                gs_addmess("File has been deleted\n");
                gsview_command(IDM_CLOSE);
                pending.unload = TRUE;
                pending.now = FALSE;
                return 0;
            }
            if (pending.psfile)
                tpsfile = pending.psfile;	/* new file, old file deleted */
            else
                tpsfile = gsview_openfile(psfile.name);
            if (tpsfile) {
                tpsfile->pagenum = psfile.pagenum;
                request_mutex();
                pending.psfile = tpsfile;
                if ( gsdll.hmodule &&  (psfile.dsc==(CDSC *)NULL) &&
                        (gsdll.state != GS_IDLE) )
                    /* don't know where we are so close and reopen */
                    pending.abort = TRUE;
                pending.now = TRUE;
                release_mutex();
            }
        }

        if (not_open())
            return 0;
        if (psfile.dsc==(CDSC *)NULL) {
            /* don't know where we are so close and reopen */
            if (gsdll.state != GS_IDLE) {
                if (!pending.psfile) {
                    pending.psfile = (PSFILE *)malloc(sizeof(PSFILE));
                    if (pending.psfile)
                        *pending.psfile = psfile;
                }
                pending.psfile->pagenum = pending.pagenum = 1;
                pending.abort = TRUE;
                pending.now = TRUE;
            }
        }
        else {
            pending.pagenum = -1;  /* default page number is current page */
            if (psfile.dsc->page_order == CDSC_SPECIAL)
                pending.pagenum = 1;	/* restart */
        }
        gsview_unzoom();
        pending.now = TRUE;
        return 0;
    case IDM_PREVHOME:
#ifdef UNIX
        set_scroll(-1, 0);
#else
#ifdef _Windows
        PostMessage(hwnd_image ,WM_VSCROLL,SB_TOP,0L);
#else
        WinPostMsg(hwnd_frame, WM_VSCROLL, MPFROMLONG(0), MPFROM2SHORT(0, SB_TOP));
#endif
#endif
    /* fall thru */
    case IDM_PREV:
        if (not_dsc())
            return 0;
        if (order_is_special())
            return 0;
        gs_page_skip(-1);
        return 0;
    case IDM_PREVSKIP:
        if (not_dsc())
            return 0;
        if (order_is_special())
            return 0;
        gs_page_skip(-page_skip);
        return 0;
    case IDM_GOTO:
        if (not_dsc())
            return 0;
        if (order_is_special())
            return 0;
        if (psfile.dsc->page_count == 0) {
            gserror(IDS_NOPAGE, NULL, MB_ICONEXCLAMATION, SOUND_NONUMBER);
            return 0;
        }
        nHelpTopic = IDS_TOPICGOTO;
        {   int pagenum;
            pagenum = psfile.pagenum;
            if (get_page(&pagenum, FALSE, FALSE)) {
                gsview_goto_page(pagenum);
            }
        }
        return 0;
    case IDM_GOBACK:
        if (not_dsc())
            return 0;
        if (order_is_special())
            return 0;
        history_back();
        return 0;
    case IDM_GOFWD:
        if (not_open())
            return 0;
        if (psfile.dsc == (CDSC *)NULL)
            gsview_command(IDM_NEXT);
        else
            history_forward();
        return 0;
    case IDM_INFO:
        show_info();
        return 0;
    case IDM_SELECT:
        if (pending.psfile) {
            play_sound(SOUND_BUSY);
            return 0;
        }
        gsview_select();
        return 0;
#ifndef VIEWONLY
    case IDM_PRINT:
    case IDM_PRINTTOFILE:
    case IDM_CONVERTFILE:
        if (psfile.name[0] == '\0')
            gsview_select();
        if (gsdll.state == GS_BUSY) {
            play_sound(SOUND_BUSY);
            return 0;
        }
        if (dfreopen() != 0)
            return 0;
        if (command == IDM_PRINTTOFILE)
            option.print_to_file = TRUE;
        if (psfile.name[0] != '\0')
            gsview_print(command == IDM_CONVERTFILE);
        dfclose();
        return 0;
    case IDM_SPOOL:
        gsview_spool((char *)NULL, (char *)NULL);
        return 0;
    case IDM_SAVEAS:
        if (gsdll.state == GS_BUSY) {
            play_sound(SOUND_BUSY);
            return 0;
        }
        if (psfile.name[0] == '\0')
            gsview_select();
        if (psfile.name[0] != '\0')
            gsview_saveas();
        return 0;
    case IDM_EXTRACT:
        if (gsdll.state == GS_BUSY) {
            play_sound(SOUND_BUSY);
            return 0;
        }
        if (psfile.name[0] == '\0')
            gsview_select();
        if (order_is_special())
            return 0;
        if (psfile.name[0] != '\0')
            gsview_extract();
        return 0;
    case IDM_PSTOEDIT:
        if (gsdll.state == GS_BUSY) {
            play_sound(SOUND_BUSY);
            return 0;
        }
        if (psfile.name[0] == '\0')
            gsview_select();
        (void)order_is_special();    /* warn, but allow it anyway */
        if (dfreopen() != 0)
            return 0;
        if (psfile.name[0] != '\0')
            gsview_pstoedit();
        dfclose();
        return 0;
    case IDM_TEXTEXTRACT:
        if (psfile.name[0] == '\0')
            gsview_select();
        if (psfile.name[0] != '\0')
            gsview_text_extract();
        return 0;
    case IDM_TEXTEXTRACT_SLOW:
        gsview_text_extract_slow();
        return 0;
    case IDM_TEXTFIND:
        gsview_text_find();
        return 0;
    case IDM_TEXTFINDNEXT:
        gsview_text_findnext();
        return 0;
    case IDM_COPYCLIP:
        copy_clipboard();
        return 0;
    case IDM_PASTETO:
        paste_to_file();
        return 0;
    case IDM_CONVERT:
        clip_convert();
        return 0;
    case IDM_MEASURE:
        if (gsdll.state == GS_BUSY) {
            play_sound(SOUND_BUSY);
            return 0;
        }
        measure_show();
        return 0;
#endif /* !VIEWONLY */
    case IDM_GSMESS:
        gs_showmess();	/* show messages from Ghostscript */
        return 0;
    case IDM_EXIT:
        if (print_count) {
            /* Still busy printing.  Warn user. */
            TCHAR buf[MAXSTR];
            load_string(IDS_BUSYPRINTING, buf,
                        sizeof(buf)/sizeof(TCHAR)-1);
            if (message_box(buf, MB_OKCANCEL) != IDOK)
                return 0;
        }
        post_img_message(WM_CLOSE, 0);
        return 0;
    case IDM_CFG:	/* Easy configure */
        config_wizard(TRUE);
        return 0;
    case IDM_GSCOMMAND:	/* Advanced configure */
        if (install_gsdll() && gsdll.open)
            pending.unload = TRUE;
        return 0;
    case IDM_UNITPT:
    case IDM_UNITMM:
    case IDM_UNITINCH:
        gsview_unit(command);
        return 0;
    case IDM_UNITFINE:
        option.unitfine = !option.unitfine;
        check_menu_item(IDM_UNITMENU, IDM_UNITFINE, option.unitfine);
        return 0;
    case IDM_LANGMENU+1:
    case IDM_LANGMENU+2:
    case IDM_LANGMENU+3:
    case IDM_LANGMENU+4:
    case IDM_LANGMENU+5:
    case IDM_LANGMENU+6:
    case IDM_LANGMENU+7:
    case IDM_LANGMENU+8:
    case IDM_LANGMENU+9:
    case IDM_LANGMENU+10:
    case IDM_LANGMENU+11:
    case IDM_LANGMENU+12:
    case IDM_LANGMENU+13:
    case IDM_LANGMENU+14:
    case IDM_LANGMENU+15:
    case IDM_LANGMENU+16:
    case IDM_LANGMENU+17:
    case IDM_LANGMENU+18:
    case IDM_LANGMENU+19:
        gsview_language(command);
        return 0;
    case IDM_SAFER:
        option.safer = !option.safer;
        check_menu_item(IDM_OPTIONMENU, IDM_SAFER, option.safer);
        return 0;
    case IDM_SAVEDIR:
        option.save_dir = !option.save_dir;
        check_menu_item(IDM_OPTIONMENU, IDM_SAVEDIR, option.save_dir);
        return 0;
    case IDM_BUTTONSHOW:
        option.button_show = !option.button_show;
        check_menu_item(IDM_OPTIONMENU, IDM_BUTTONSHOW, option.button_show);
        show_buttons();
        return 0;
    case IDM_FITPAGE:
        option.fit_page = !option.fit_page;
        check_menu_item(IDM_OPTIONMENU, IDM_FITPAGE, option.fit_page);
        /* should cause WM_SIZE message to be sent */
        return 0;
    case IDM_PSTOTEXTDIS:
    case IDM_PSTOTEXTNORM:
    case IDM_PSTOTEXTCORK:
        check_menu_item(IDM_PSTOTEXTMENU, option.pstotext + IDM_PSTOTEXTMENU + 1, FALSE);
        option.pstotext = command - IDM_PSTOTEXTMENU - 1;
        check_menu_item(IDM_PSTOTEXTMENU, option.pstotext + IDM_PSTOTEXTMENU + 1, TRUE);
        return 0;
    case IDM_AUTOREDISPLAY:
        option.redisplay = !option.redisplay;
        check_menu_item(IDM_OPTIONMENU, IDM_AUTOREDISPLAY, option.redisplay);
        return 0;
    case IDM_EPSFCLIP:
        option.epsf_clip = !option.epsf_clip;
        check_menu_item(IDM_OPTIONMENU, IDM_EPSFCLIP, option.epsf_clip);
        gs_resize();
        return 0;
    case IDM_EPSFWARN:
        option.epsf_warn = !option.epsf_warn;
        check_menu_item(IDM_OPTIONMENU, IDM_EPSFWARN, option.epsf_warn);
        return 0;
    case IDM_IGNOREDSC:
        option.ignore_dsc = !option.ignore_dsc;
        check_menu_item(IDM_OPTIONMENU, IDM_IGNOREDSC, option.ignore_dsc);
        if (psfile.name[0]) {
            if (option.redisplay)
                gsview_displayfile(psfile.name);
            else
                gsview_selectfile(psfile.name);
        }
        return 0;
    case IDM_SHOWBBOX:
        option.show_bbox = !option.show_bbox;
        check_menu_item(IDM_OPTIONMENU, IDM_SHOWBBOX, option.show_bbox);
#ifdef UNIX
        gtk_widget_draw(img, NULL);
#else
#ifdef _Windows
        PostMessage(hwndimg, WM_GSSYNC, 0, 0L);
#else
        if (!WinInvalidateRect(hwnd_bmp, (PRECTL)NULL, TRUE))
            error_message("error invalidating rect");
        if (!WinUpdateWindow(hwnd_bmp))
            error_message("error updating window");
#endif
#endif
        return 0;
#ifndef VIEWONLY
    case IDM_PSTOEPS:
        if (not_open())
            return 0;
        if (psfile.name[0] != '\0') {
            if (dfreopen() != 0)
                return 0;
            ps_to_eps();
            dfclose();
        }
        return 0;
    case IDM_MAKEEPSI:
        if ( (option.orientation == IDM_PORTRAIT) ||
                (option.auto_orientation == TRUE) ) {
            char epsname[MAXSTR];
            epsname[0] = '\0';
            if (dfreopen() != 0)
                return 0;
            if (!get_filename(epsname, TRUE, FILTER_EPS, 0,
                              IDS_TOPICPREVIEW)) {
                dfclose();
                return 0;
            }
            image_lock(view.img);
            make_eps_interchange(FALSE, epsname);
            image_unlock(view.img);
            dfclose();
        }
        else
            gserror(IDS_MUSTUSEPORTRAIT, 0, MB_ICONEXCLAMATION, 0);
        return 0;
    case IDM_MAKEEPST4:
    case IDM_MAKEEPST6U:
    case IDM_MAKEEPST6P:
        if ( (option.orientation == IDM_PORTRAIT) ||
                (option.auto_orientation == TRUE) ) {
            char epsname[MAXSTR];
            epsname[0] = '\0';
            if (dfreopen() != 0)
                return 0;
            if (!get_filename(epsname, TRUE, FILTER_EPS, 0,
                              IDS_TOPICPREVIEW)) {
                dfclose();
                return 0;
            }
            image_lock(view.img);
            make_eps_tiff(command, FALSE, epsname);
            image_unlock(view.img);
            dfclose();
        }
        else
            gserror(IDS_MUSTUSEPORTRAIT, 0, MB_ICONEXCLAMATION, 0);
        return 0;
    case IDM_MAKEEPSW:
        if ( (option.orientation == IDM_PORTRAIT) ||
                (option.auto_orientation == TRUE) ) {
            char epsname[MAXSTR];
            epsname[0] = '\0';
            if (dfreopen() != 0)
                return 0;
            if (!get_filename(epsname, TRUE, FILTER_EPS, 0,
                              IDS_TOPICPREVIEW)) {
                dfclose();
                return 0;
            }
            image_lock(view.img);
            make_eps_metafile(FALSE, epsname);
            image_unlock(view.img);
            dfclose();
        }
        else
            gserror(IDS_MUSTUSEPORTRAIT, 0, MB_ICONEXCLAMATION, 0);
        return 0;
    case IDM_MAKEEPSU:
        if (dfreopen() != 0)
            return 0;
        make_eps_user();
        dfclose();
        return 0;
    case IDM_EXTRACTPS:
    case IDM_EXTRACTPRE:
        if (dfreopen() != 0)
            return 0;
        extract_doseps(command);
        dfclose();
        return 0;
#endif
    case IDM_SETTINGS:
        write_profile();
        return 0;
    case IDM_SAVESETTINGS:
        option.settings = !option.settings;
        check_menu_item(IDM_OPTIONMENU, IDM_SAVESETTINGS, option.settings);
        {   char buf[MAXSTR];
            PROFILE *prf = profile_open(szIniFile);
            sprintf(buf, "%d", (int)option.settings);
            profile_write_string(prf, INISECTION, "SaveSettings", buf);
            profile_close(prf);
        }
        return 0;
    case IDM_SOUNDS:
        change_sounds();
        return 0;
    case IDM_AUTOORIENT:
    case IDM_PORTRAIT:
    case IDM_LANDSCAPE:
    case IDM_UPSIDEDOWN:
    case IDM_SEASCAPE:
    case IDM_SWAPLANDSCAPE:
        gsview_orientation(command);
        return 0;
    case IDM_DSC_OFF:
    case IDM_DSC_ERROR:
    case IDM_DSC_WARN:
    case IDM_DSC_INFO:
        check_menu_item(IDM_DSCMENU, option.dsc_warn, FALSE);
        option.dsc_warn = command;
        check_menu_item(IDM_DSCMENU, option.dsc_warn, TRUE);
        return 0;
    case IDM_ZOOM:		/* called indirectly from Right Mouse Button */
        if (not_dsc()) {
            zoom = FALSE;
            return 0;
        }
        if (order_is_special()) {
            zoom = FALSE;
            return 0;
        }
        if (! ((gsdll.state == GS_PAGE) || (gsdll.state == GS_IDLE)) ) {
            zoom = FALSE;
            gserror(IDS_NOZOOM, NULL, MB_ICONEXCLAMATION, SOUND_ERROR);
            return 0;
        }
        gs_resize();
        pending.pagenum = -1;  /* default page number is current page */
        pending.now = TRUE;
        return 0;
    case IDM_MAGPLUS:
        gs_magnify((float)1.2);
        return 0;
    case IDM_MAGMINUS:
        gs_magnify((float)0.8333);
        return 0;
    case IDM_FITWIN:
        /* fit media to size of current window */
        gsview_fitwin();
        return 0;
    case IDM_DISPLAYSETTINGS:
        display_settings();
        return 0;
    case IDM_MEDIAROTATE:
        option.media_rotate = !option.media_rotate;
        check_menu_item(IDM_MEDIAMENU, IDM_MEDIAROTATE,
                        option.media_rotate);
        zoom = FALSE;
        gs_resize();
        return 0;
    case IDM_11x17:
    case IDM_A3:
    case IDM_A4:
    case IDM_A5:
    case IDM_B4:
    case IDM_B5:
    case IDM_LEDGER:
    case IDM_LEGAL:
    case IDM_LETTER:
    case IDM_NOTE:
    case IDM_USERSIZE:
    case IDM_USERSIZE1:
    case IDM_USERSIZE2:
    case IDM_USERSIZE3:
    case IDM_USERSIZE4:
    case IDM_USERSIZE5:
    case IDM_USERSIZE6:
    case IDM_USERSIZE7:
    case IDM_USERSIZE8:
    case IDM_USERSIZE9:
    case IDM_USERSIZE10:
    case IDM_USERSIZE11:
    case IDM_USERSIZE12:
    case IDM_USERSIZE13:
        if (command == IDM_USERSIZE)
            if (!gsview_usersize())
                return 0;
        gsview_media(command);
        return 0;
    case IDM_HELPCONTENT:
#ifdef UNIX
        nHelpTopic = IDS_TOPICROOT;
        get_help();
#else
#ifdef _Windows
#ifdef USE_HTMLHELP
        nHelpTopic = IDS_TOPICROOT;
        get_help();
#else
        WinHelp(hwndimg,szHelpName,HELP_CONTENTS,(DWORD)NULL);
#endif
#else
        WinSendMsg(hwnd_help, HM_HELP_CONTENTS, 0L, 0L);
#endif
#endif
        return 0;
    case IDM_HELPSEARCH:
#ifdef UNIX
        gs_addmess("IDM_HELPSEARCH: not implemented\n");
#else
#ifdef _Windows
#ifdef USE_HTMLHELP
        HtmlHelp(hwndimg,szHelpName,HH_DISPLAY_INDEX, (DWORD)TEXT(""));
        gs_addmessf("HtmlHelp: %s HH_DISPLAY_INDEX\n", szHelpName);
#else
        WinHelp(hwndimg,szHelpName,HELP_PARTIALKEY,(DWORD)"");
#endif
#else
        WinSendMsg(hwnd_help, HM_HELP_INDEX, 0L, 0L);
#endif
#endif
        return 0;
    case IDM_HELPKEYS:
        nHelpTopic = IDS_TOPICKEYS;
        get_help();
        return 0;
    case IDM_ABOUT:
        show_about();
        return 0;
    case IDM_REGISTER:
        registration_nag();
        return 0;
    }
    return 0;
}