예제 #1
0
int RecordMonitorGUI::keypress_event()
{
	int result = 0;

	switch(get_keypress()) {
	case LEFT:
		if( !ctrl_down() ) { 
			record->record_gui->set_translation(--(record->video_x), record->video_y, record->video_zoom);
		}
		else {
			record->video_zoom -= 0.1;
			record->record_gui->set_translation(record->video_x, record->video_y, record->video_zoom);
		}
		result = 1;
		break;
	case RIGHT:
		if( !ctrl_down() ) { 
			record->record_gui->set_translation(++(record->video_x), record->video_y, record->video_zoom);
		}
		else {
			record->video_zoom += 0.1;
			record->record_gui->set_translation(record->video_x, record->video_y, record->video_zoom);
		}
		result = 1;
		break;
	case UP:
		if( !ctrl_down() ) { 
			record->record_gui->set_translation(record->video_x, --(record->video_y), record->video_zoom);
		}
		else {
			record->video_zoom -= 0.1;
			record->record_gui->set_translation(record->video_x, record->video_y, record->video_zoom);
		}
		result = 1;
		break;
	case DOWN:
		if( !ctrl_down() ) { 
			record->record_gui->set_translation(record->video_x, ++(record->video_y), record->video_zoom);
		}
		else {
			record->video_zoom += 0.1;
			record->record_gui->set_translation(record->video_x, record->video_y, record->video_zoom);
		}
		result = 1;
		break;
	case 'w':
		close_event();
		break;

	default:
		if(canvas) result = canvas->keypress_event(this);
		if(!result && avc1394_transport)
			result = avc1394_transport->keypress_event(get_keypress());
		break;
	}

	return result;
}
예제 #2
0
int FastPlayButton::handle_event() 
{
	unlock_window();
	transport->handle_transport(FAST_FWD, 0, ctrl_down());
	lock_window("FastPlayButton::handle_event");
	return 1;
}
예제 #3
0
int FramePlayButton::handle_event()
{
	unlock_window();
	transport->handle_transport(SINGLE_FRAME_FWD, 0, ctrl_down());
	lock_window("FramePlayButton::handle_event");
	return 1;
}
예제 #4
0
int PlayButton::handle_event()
{
	unlock_window();
	transport->handle_transport(NORMAL_FWD, 0, ctrl_down());
	lock_window("PlayButton::handle_event");
	return 1;
}
예제 #5
0
int ReverseButton::handle_event()
{
	unlock_window();
	transport->handle_transport(NORMAL_REWIND, 0, ctrl_down());
	lock_window("ReverseButton::handle_event");
	return 1;
}
예제 #6
0
int SynthNote::button_press_event()
{
	if(BC_Toggle::button_press_event())
	{
// printf("SynthNote::button_press_event %d %d %d\n", 
// __LINE__, 
// ctrl_down(), 
// window->synth->freq_exists(keyboard_freqs[number]));
		window->starting_notes = 1;
		if((ctrl_down() || shift_down()) &&
			window->synth->freq_exists(keyboard_freqs[number]))
		{
//printf("SynthNote::button_press_event %d\n", __LINE__);
			stop_note();
			window->starting_notes = 0;
		}
		else
		{
//printf("SynthNote::button_press_event %d\n", __LINE__);
			start_note();
			window->starting_notes = 1;
		}
		window->current_note = number;
		return 1;
	}
	return 0;
}
예제 #7
0
int SynthWindow::keypress_event()
{
	if(ctrl_down() && get_keypress() == 'w')
	{
		set_done(1);
		return 1;
	}
	return 0;
}
예제 #8
0
int BC_FileBox::keypress_event()
{
	switch(get_keypress())
	{
		case 'w':
			if(ctrl_down()) set_done(1);
			return 1;
			break;
	}
	return 0;
}
예제 #9
0
int ManualGotoNumber::keypress_event()
{
    int in_textlen = strlen(get_text());
    int key = get_keypress();

    if (key == '+')
    {
        window->signtitle->update("+");
        return 1;
    }
    if (key == '-')
    {
        window->signtitle->update("-");
        return 1;
    }
    if (key == '=')
    {
        window->signtitle->update("=");
        return 1;
    }

    int ok_key = 0;
    if ((key >= '0' && key <='9') ||
            (key == ESC) ||  (key == RETURN) ||
            (key == TAB) ||  (key == LEFTTAB) ||
            (key == '.') ||
            (key == LEFT) || (key == RIGHT) ||
            (key == UP) ||   (key == DOWN) ||
            (key == PGUP) || (key == PGDN) ||
            (key == END) ||  (key == HOME) ||
            (key == BACKSPACE) || (key == DELETE) ||
            (ctrl_down() && (key == 'v' || key == 'V' || key == 'c' || key == 'C' || key == 'x' || key == 'X')))
        ok_key = 1;

    if (in_textlen >= chars && key >= '0' && key <= '9' && !select_whole_text(0))
        ok_key = 0;

    if (!ok_key) return 1;


// treat dot as tab - for use from numerical keypad
    if (key == '.')
    {
        cycle_textboxes(1);
        return 1;
    };

    int result = BC_TextBox::keypress_event();
    int out_textlen = strlen(get_text());
    // automatic cycle when we enter two numbers
    if (key != TAB && out_textlen == chars && get_ibeam_letter() == chars)
        cycle_textboxes(1);
    return result;
}
예제 #10
0
Cube *ctrl_down(Cube *cube) {
    // cleanShape(cube);
    // if(cube->getBottom() + 1 < GRID_HEIGHT) {
    //     if(g_GRID[cube->getX()][cube->getBottom() + 1].show == YES) {
    //         setShape(cube);
    //         free(cube);
    //         COORD ref_coord = {4, 0};
    //         cube = new Cube(ref_coord, (COORD *)SHAPE_I_2);
    //         setShape(cube);
    //         return cube;
    //     }
    //     else {
    //         cube->setCoord(cube->getX(), cube->getY() + 1);
    //     }
    // }
    // setShape(cube);
    cleanShape(cube);
    COORD c;
    for(int i = 0; i < 4; i++) {
        c.X = cube->getCoord().X + cube->getShapes()[cube->cur_type][i].X;
        c.Y = cube->getCoord().Y + cube->getShapes()[cube->cur_type][i].Y + 1;
        if(
            // if reach blocks
            isInCube(c, cube) == false && g_GRID[cube->getCoord().X + cube->getShapes()[cube->cur_type][i].X][cube->getCoord().Y + 1 + cube->getShapes()[cube->cur_type][i].Y].show == 1
            // if reach bottom
            || cube->getCoord().Y + 1 + cube->getShapes()[cube->cur_type][i].Y >= GRID_HEIGHT) {
            setShape(cube);
            // free(cube);
            COORD ref_coord = {4, 2};
            // cube = new Cube(ref_coord, SHAPE_T.shape, SHAPE_T.types);
        
            cube = g_NEXT_CUBE;
            if(isValidShapePos(cube) == false) {
                gameOver();
            }
            Shape *s = createShape();
            g_NEXT_CUBE = new Cube(ref_coord, s->shape, s->types);
            // g_NEXT_CUBE = new Cube(ref_coord, SHAPE_T.shape, SHAPE_T.types);
            // int index = random(0, g_CubeGenerator->getLength());
            // g_NEXT_CUBE = new Cube(ref_coord, g_CubeGenerator->getShapeList()[index].shape, g_CubeGenerator->getShapeList()[index].types);
            checkGrid();
            setShape(cube);
            return cube;
        }        
    }
    cube->setCoord(cube->getX(), cube->getY() + 1);
    checkGrid();
    cube = ctrl_down(cube);
    setShape(cube);
    return cube;
}
예제 #11
0
int GWindowGUI::keypress_event()
{
	switch(get_keypress())
	{
		case 'w':
		case 'W':
			if(ctrl_down())
			{
				close_event();
				return 1;
			}
			break;
	}
	return 0;
}
예제 #12
0
void SynthNote::start_note()
{
	if(window->synth->config.momentary_notes) note_on = 1;

//printf("SynthNote::start_note %d %d\n", __LINE__, ctrl_down());
	if(window->synth->config.momentary_notes || (!ctrl_down() && !shift_down()))
	{
// Kill all frequencies
		window->synth->delete_freqs();
	}

	window->synth->new_freq(keyboard_freqs[number]);
	window->base_freq->update((float)window->synth->config.base_freq[0]);
//printf("SynthNote::start_note %d %f\n", __LINE__, window->synth->config.base_freq[0]);
	window->freqpot->update(window->synth->config.base_freq[0]);
	window->synth->send_configure_change();
	window->update_note_selection();
}
예제 #13
0
int TimeBar::button_press_event()
{
	if(is_event_win() && cursor_inside() && get_buttonpress() == 1)
	{
// Change time format
		if(ctrl_down())
		{
			if(get_buttonpress() == 1)
				mwindow->next_time_format();
			else
			if(get_buttonpress() == 2)
				mwindow->prev_time_format();
			return 1;
		}
		else
// 		if(test_preview(1))
// 		{
// 		}
// 		else
		{
			stop_playback();

// Select region between two labels
			if(get_double_click())
			{
				double position = pixel_to_position(get_cursor_x());
// Test labels
				select_region(position);
				return 1;
			}
			else
// Reposition highlight cursor
			if(is_event_win() && cursor_inside())
			{
				update_cursor();
				current_operation = TIMEBAR_DRAG;
				activate_timeline();
				return 1;
			}
		}
	}
	return 0;
}
예제 #14
0
int SynthNote::keypress_event()
{
	if(number >= FIRST_TITLE && number < LAST_TITLE)
	{
		if(get_keypress() == keyboard_map[number - FIRST_TITLE][0])
		{
			if((ctrl_down() || shift_down()) &&
				window->synth->freq_exists(keyboard_freqs[number]))
			{
				stop_note();
			}
			else
			{
				start_note();
				set_value(1);
			}

// Key releases are repeated, so momentary notes may not work
			return 1;
		}
	}
	return 0;
}
예제 #15
0
/*******************************************************
Function: Play game
Argument: none
Return  : void
*******************************************************/
void playGame() {
    int counter = 0;
    while(true) {
        counter++;
        if(counter >= 30000) {
            autoMoveDown();
            counter = 0;
        }

        if(_kbhit()){
            backupGrid();
            switch(_getch()) {
                case CTRL_UP:
                    ctrl_up(g_CUR_CUBE);
                    break;

                case CTRL_DOWN:
                    g_CUR_CUBE = ctrl_down(g_CUR_CUBE);
                    cleanNEXT(g_CUR_CUBE);
                    drawNEXT(g_NEXT_CUBE);
                    break;

                case CTRL_LEFT:
                    ctrl_left(g_CUR_CUBE);
                    break;

                case CTRL_RIGHT:
                    ctrl_right(g_CUR_CUBE);
                    break;
            }

            // after keyboard event, drawGrid()
            drawGrid();
        }
    }
}