Esempio n. 1
0
static void keyboard(unsigned char key, int x, int y)
{
	if (cmdopts.verbose) {
		jas_eprintf("keyboard(%d, %d, %d)\n", key, x, y);
	}

	switch (key) {
	case ' ':
		nextimage();
		break;
	case '\b':
		previmage();
		break;
	case '>':
		gs.sx /= BIGZOOM;
		gs.sy /= BIGZOOM;
		gs.dirty = 1;
		glutPostRedisplay();
		break;
	case '.':
		gs.sx /= SMALLZOOM;
		gs.sy /= SMALLZOOM;
		gs.dirty = 1;
		glutPostRedisplay();
		break;
	case '<':
		gs.sx *= BIGZOOM;
		gs.sy *= BIGZOOM;
		adjust();
		gs.dirty = 1;
		glutPostRedisplay();
		break;
	case ',':
		gs.sx *= SMALLZOOM;
		gs.sy *= SMALLZOOM;
		gs.dirty = 1;
		adjust();
		glutPostRedisplay();
		break;
	case 'c':
		nextcmpt();
		break;
	case 'C':
		prevcmpt();
		break;
	case 'q':
		cleanupandexit(EXIT_SUCCESS);
		break;
	}
}
void pwan::imageviewer_frontend_qt_widget::keyPressEvent(QKeyEvent *keyevent)
{
    int keycodefound = keyevent->key();
    p_img_keyevent pkey = programKeys.find(keycodefound)->second;
    switch (pkey)
    {
        case QUIT:
            emit exitprogram();
            break;
        case FULLSCREEN:
            setWindowState(windowState() ^ Qt::WindowFullScreen);
            update();
            break;
        case NEXTIMAGE:
            emit nextimage();
            break;
        case PREVIMAGE:
            emit previmage();
        default:
            break;
    }
}