Example #1
0
void check4col()
{
	int row,colum,cnt,row_temp1,row_temp2,t1,t2;
	for(colum=0;colum<9;colum++)
		for(cnt=1;cnt<10;cnt++)
		{
			colum_count[colum].count[cnt]=0;
			for(row=0;row<9;row++)
				if(node[row][colum].check[cnt]==EMPTY)
				{
					colum_count[colum].count[cnt]++;
					if(colum_count[colum].count[cnt]>1)
						row_temp2=row_temp1;
					row_temp1=row;
				}
			if(colum_count[colum].count[cnt]==1)
				st_node(row_temp1,colum,cnt);

			if(colum_count[colum].count[cnt]==2)
			{
				t1=row_temp1;
				t2=row_temp2;
				if((t1<3&&t2<3)||(t1>5&&t2>5)||((t1>2&&t2>2)&&(t1<6&&t2<6)))
				{
					node[row_temp1][colum].check[cnt]=FULL;
					node[row_temp2][colum].check[cnt]=FULL;
					clear_box(row_temp1,colum,cnt);
					node[row_temp1][colum].check[cnt]=EMPTY;
					node[row_temp2][colum].check[cnt]=EMPTY;
				}
			}
		}
}
Example #2
0
int ScopeGUI::resize_event(int w, int h)
{
	clear_box(0, 0, w, h);
	this->w = w;
	this->h = h;
	calculate_sizes(w, h);
	
	if(waveform)
	{
		waveform->reposition_window(wave_x, wave_y, wave_w, wave_h);
		waveform->clear_box(0, 0, wave_w, wave_h);
	}
	
	if(histogram)
	{
		histogram->reposition_window(hist_x, hist_y, hist_w, hist_h);
		histogram->clear_box(0, 0, hist_w, hist_h);
	}
	
	if(vectorscope)
	{
		vectorscope->reposition_window(vector_x, vector_y, vector_w, vector_h);
		vectorscope->clear_box(0, 0, vector_w, vector_h);
	}

	allocate_bitmaps();


	clear_points(0);
	draw_overlays(1, 1, 1);

	return 1;
}
Example #3
0
int SynthWindow::resize_event(int w, int h)
{
	clear_box(0, 0, w, h);
	osc_subwindow->reposition_window(osc_subwindow->get_x(), 
		osc_subwindow->get_y(), 
		osc_subwindow->get_w(), 
		h - osc_subwindow->get_y());
	osc_subwindow->clear_box(0, 0, osc_subwindow->get_w(), osc_subwindow->get_h());
	osc_scroll->reposition_window(osc_scroll->get_x(), 
		osc_scroll->get_y(), 
		h - osc_scroll->get_y());
	note_subwindow->reposition_window(note_subwindow->get_x(),
		note_subwindow->get_y(),
		w - note_subwindow->get_x(),
		note_subwindow->get_h());
	note_scroll->reposition_window(note_scroll->get_x(),
		note_scroll->get_y(),
		w - note_scroll->get_x());
	note_scroll->update_length(white_key[0]->get_w() * TOTALNOTES * 7 / 12 +
			white_key[0]->get_w(), 
		note_scroll->get_position(), 
		note_subwindow->get_w(),
		0);
	
	update_scrollbar();
	update_notes();
	update_oscillators();
	synth->window_w = w;
	synth->window_h = h;
	return 1;
}
Example #4
0
GameMenu_Widget::GameMenu_Widget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::GameMenu_Widget)
{
    ui->setupUi(this);
    ui->lineEdit->setText("Max");

    connect(ui->lineEdit,SIGNAL(textChanged(QString)),this,SLOT(hide_the_play()));
    connect(ui->Play,SIGNAL(clicked()),this,SLOT(set_play_menu()));
    connect(ui->Score,SIGNAL(clicked()),this,SLOT(clear_box()));
}
Example #5
0
void st_node(int row,int colum,int value)
{
	int k;
	node[row][colum].value=value;
	node[row][colum].status=FULL;total++;
	node[row][colum].possibility=0;
	node[row][colum].number=0;

	for(k=1;k<10;k++)
		node[row][colum].check[k]=FULL;

	clear_all_row(row,value);
	clear_all_colum(colum,value);
	clear_box(row,colum,value);

	node[row][colum].check[0]=FULL;
}
Example #6
0
int PianoWindow::resize_event(int w, int h)
{
	clear_box(0, 0, w, h);
	subwindow->reposition_window(subwindow->get_x(), 
		subwindow->get_y(), 
		subwindow->get_w(), 
		h - subwindow->get_y());
	subwindow->clear_box(0, 0, subwindow->get_w(), subwindow->get_h());
	scroll->reposition_window(scroll->get_x(), 
		scroll->get_y(), 
		h - scroll->get_y());
	update_scrollbar();
	update_oscillators();
	synth->w = w;
	synth->h = h;
	return 1;
}
Example #7
0
void ScopeHistogram::draw(int flash, int flush)
{
	clear_box(0, 0, get_w(), get_h());

	if(gui->use_hist_parade)
	{
		draw_mode(0, 0xff0000, 0, get_h() / 3);
		draw_mode(1, 0x00ff00, get_h() / 3, get_h() / 3);
		draw_mode(2, 0x0000ff, get_h() / 3 * 2, get_h() / 3);
	}
	else
	{
		draw_mode(3, LTGREY, 0, get_h());
	}
	
	if(flash) this->flash(0);
	if(flush) this->flush();
}
Example #8
0
int SynthCanvas::update()
{
	int y1, y2, y = 0;
	
	clear_box(0, 0, get_w(), get_h());
	set_color(RED);

	draw_line(0, get_h() / 2 + y, get_w(), get_h() / 2 + y);

	set_color(GREEN);

	double normalize_constant = (double)1 / synth->get_total_power();
	y1 = (int)(synth->get_point((float)0, normalize_constant) * get_h() / 2);
	
	for(int i = 1; i < get_w(); i++)
	{
		y2 = (int)(synth->get_point((float)i / get_w(), normalize_constant) * get_h() / 2);
		draw_line(i - 1, get_h() / 2 - y1, i, get_h() / 2 - y2);
		y1 = y2;
	}
	flash();
	return 0;
}
Example #9
0
void ScopeGUI::draw_overlays(int overlays, int borders, int flush)
{
	if(overlays && borders)
	{
		clear_box(0, 0, get_w(), get_h());
	}

	if(overlays)
	{
		set_line_dashes(1);
		set_color(GREEN);
		set_font(SMALLFONT);

		if(histogram && (use_hist || use_hist_parade))
		{
			histogram->draw_line(hist_w * -FLOAT_MIN / (FLOAT_MAX - FLOAT_MIN), 
					0, 
					hist_w * -FLOAT_MIN / (FLOAT_MAX - FLOAT_MIN), 
					hist_h);
			histogram->draw_line(hist_w * (1.0 - FLOAT_MIN) / (FLOAT_MAX - FLOAT_MIN), 
					0, 
					hist_w * (1.0 - FLOAT_MIN) / (FLOAT_MAX - FLOAT_MIN), 
					hist_h);
			set_line_dashes(0);
			histogram->draw_point();
			set_line_dashes(1);
			histogram->flash(0);
		}

// Waveform overlay
		if(waveform && (use_wave || use_wave_parade))
		{
			set_color(GREEN);
			for(int i = 0; i <= WAVEFORM_DIVISIONS; i++)
			{
				int y = wave_h * i / WAVEFORM_DIVISIONS;
				int text_y = y + wave_y + get_text_ascent(SMALLFONT) / 2;
				CLAMP(text_y, waveform->get_y() + get_text_ascent(SMALLFONT), waveform->get_y() + waveform->get_h() - 1);
				int x = wave_x - 20;
				char string[BCTEXTLEN];
				sprintf(string, "%d", 
					(int)((FLOAT_MAX - 
					i * (FLOAT_MAX - FLOAT_MIN) / WAVEFORM_DIVISIONS) * 100));
				draw_text(x, text_y, string);

				int y1 = CLAMP(y, 0, waveform->get_h() - 1);
				waveform->draw_line(0, y1, wave_w, y1);
				//waveform->draw_rectangle(0, 0, wave_w, wave_h);
			}
			set_line_dashes(0);
			waveform->draw_point();
			set_line_dashes(1);
			waveform->flash(0);
		}


// Vectorscope overlay
		if(vectorscope && use_vector)
		{
			set_color(GREEN);
			int radius = MIN(vector_w / 2, vector_h / 2);
			for(int i = 1; i <= VECTORSCOPE_DIVISIONS; i += 2)
			{
				int x = vector_w / 2 - radius * i / VECTORSCOPE_DIVISIONS;
				int y = vector_h / 2 - radius * i / VECTORSCOPE_DIVISIONS;
				int text_x = vector_x - 20;
				int text_y = y + vector_y + get_text_ascent(SMALLFONT) / 2;
				int w = radius * i / VECTORSCOPE_DIVISIONS * 2;
				int h = radius * i / VECTORSCOPE_DIVISIONS * 2;
				char string[BCTEXTLEN];

				sprintf(string, "%d", 
					(int)((FLOAT_MAX / VECTORSCOPE_DIVISIONS * i) * 100));
				draw_text(text_x, text_y, string);
//printf("ScopeGUI::draw_overlays %d %d %d %s\n", __LINE__, text_x, text_y, string);
				
				vectorscope->draw_circle(x, y, w, h);
		//vectorscope->draw_rectangle(0, 0, vector_w, vector_h);
			}
		// 	vectorscope->draw_circle(vector_w / 2 - radius, 
		// 		vector_h / 2 - radius, 
		// 		radius * 2, 
		// 		radius * 2);

			set_line_dashes(0);
			vectorscope->draw_point();
			set_line_dashes(1);
			vectorscope->flash(0);
		}

		set_font(MEDIUMFONT);
		set_line_dashes(0);
	}

	if(borders)
	{
		if(use_hist || use_hist_parade)
		{
			draw_3d_border(hist_x - 2, 
				hist_y - 2, 
				hist_w + 4, 
				hist_h + 4, 
				get_bg_color(),
				BLACK,
				MDGREY, 
				get_bg_color());
		}

		if(use_wave || use_wave_parade)
		{
			draw_3d_border(wave_x - 2, 
				wave_y - 2, 
				wave_w + 4, 
				wave_h + 4, 
				get_bg_color(),
				BLACK,
				MDGREY, 
				get_bg_color());
		}

		if(use_vector)
		{
			draw_3d_border(vector_x - 2, 
				vector_y - 2, 
				vector_w + 4, 
				vector_h + 4, 
				get_bg_color(),
				BLACK,
				MDGREY, 
				get_bg_color());
		}
	}

	flash(0);
	if(flush) this->flush();
}
Example #10
0
void ScopePanel::create_objects()
{
	set_cursor(CROSS_CURSOR, 0, 0);
	clear_box(0, 0, get_w(), get_h());
}
int TitleWindow::resize_event(int w, int h)
{
	client->config.window_w = w;
	client->config.window_h = h;

	clear_box(0, 0, w, h);
	font_title->reposition_window(font_title->get_x(), font_title->get_y());
	font->reposition_window(font->get_x(), font->get_y());
	font_tumbler->reposition_window(font_tumbler->get_x(), font_tumbler->get_y());
	x_title->reposition_window(x_title->get_x(), x_title->get_y());
	title_x->reposition_window(title_x->get_x(), title_x->get_y());
	y_title->reposition_window(y_title->get_x(), y_title->get_y());
	title_y->reposition_window(title_y->get_x(), title_y->get_y());
	style_title->reposition_window(style_title->get_x(), style_title->get_y());
	italic->reposition_window(italic->get_x(), italic->get_y());
	bold->reposition_window(bold->get_x(), bold->get_y());
#ifdef USE_OUTLINE
	stroke->reposition_window(stroke->get_x(), stroke->get_y());
#endif
	size_title->reposition_window(size_title->get_x(), size_title->get_y());
	size->reposition_window(size->get_x(), size->get_y());


#ifndef X_HAVE_UTF8_STRING
	encoding_title->reposition_window(encoding_title->get_x(), encoding_title->get_y());
	encoding->reposition_window(encoding->get_x(), encoding->get_y());
#endif

	color_button->reposition_window(color_button->get_x(), color_button->get_y());
#ifdef USE_OUTLINE
	color_stroke_button->reposition_window(color_stroke_button->get_x(), color_stroke_button->get_y());
#endif
	outline_color_button->reposition_window(outline_color_button->get_x(), outline_color_button->get_y());
	motion_title->reposition_window(motion_title->get_x(), motion_title->get_y());
	motion->reposition_window(motion->get_x(), motion->get_y());
	loop->reposition_window(loop->get_x(), loop->get_y());
	dropshadow_title->reposition_window(dropshadow_title->get_x(), dropshadow_title->get_y());
	dropshadow->reposition_window(dropshadow->get_x(), dropshadow->get_y());
	fadein_title->reposition_window(fadein_title->get_x(), fadein_title->get_y());
	fade_in->reposition_window(fade_in->get_x(), fade_in->get_y());
	fadeout_title->reposition_window(fadeout_title->get_x(), fadeout_title->get_y());
	fade_out->reposition_window(fade_out->get_x(), fade_out->get_y());
	text_title->reposition_window(text_title->get_x(), text_title->get_y());
#ifdef USE_OUTLINE
	stroke_width->reposition_window(stroke_width->get_x(), stroke_width->get_y());
	strokewidth_title->reposition_window(strokewidth_title->get_x(), strokewidth_title->get_y());
#endif
	timecode->reposition_window(timecode->get_x(), timecode->get_y());

	text->reposition_window(text->get_x(), 
		text->get_y(), 
		w - text->get_x() - 10,
		BC_TextBox::pixels_to_rows(this, MEDIUMFONT, h - text->get_y() - 10));



	justify_title->reposition_window(justify_title->get_x(), justify_title->get_y());
	left->reposition_window(left->get_x(), left->get_y());
	center->reposition_window(center->get_x(), center->get_y());
	right->reposition_window(right->get_x(), right->get_y());
	top->reposition_window(top->get_x(), top->get_y());
	mid->reposition_window(mid->get_x(), mid->get_y());
	bottom->reposition_window(bottom->get_x(), bottom->get_y());
	speed_title->reposition_window(speed_title->get_x(), speed_title->get_y());
	speed->reposition_window(speed->get_x(), speed->get_y());
	update_color();
	flash();

	return 1;
}
Example #12
0
void GraphicCanvas::process(int buttonpress, int motion, int draw)
{
	int got_button = 0;
	int center_y = get_h() / 2;
	int out_of_order = 0;
	ArrayList<GraphicPoint*> *points;
	double *envelope;
	const int debug = 0;


	if(state == GraphicCanvas::NONE)
	{
		points = &plugin->config.points;
		envelope = plugin->envelope;
	}
	else
	{
		points = &temp_points;
		envelope = temp_envelope;
	}

	plugin->calculate_envelope(points, envelope);


// spectrogram
	if(draw)
	{
		clear_box(0, 0, get_w(), get_h());


		int niquist = plugin->PluginAClient::project_sample_rate / 2;
		int total_frames = plugin->get_gui_update_frames();
		GraphicGUIFrame *frame = (GraphicGUIFrame*)plugin->get_gui_frame();

		if(frame)
		{
			delete plugin->last_frame;
			plugin->last_frame = frame;
		}
		else
		{
			frame = plugin->last_frame;
		}

// Draw most recent frame
		if(frame)
		{
			set_color(MEGREY);
			int y1 = 0;
			int y2 = 0;


			for(int i = 0; i < get_w(); i++)
			{
				int freq = Freq::tofreq(i * TOTALFREQS / get_w());
				int index = (int64_t)freq * (int64_t)frame->window_size / 2 / niquist;
				if(index < frame->window_size / 2)
				{
					double magnitude = frame->data[index] / 
						frame->freq_max * 
						frame->time_max;
					y2 = (int)(get_h() - 
						(DB::todb(magnitude) - INFINITYGAIN) *
						get_h() / 
						-INFINITYGAIN);
					CLAMP(y2, 0, get_h() - 1);
					if(i > 0)
					{
						draw_line(i - 1, y1, i, y2);
//printf(" %.0f", frame->data[index]);
					}
					y1 = y2;
				}
			}
//printf( "\n");

			total_frames--;
		}






// Delete remaining frames
		while(total_frames > 0)
		{
			PluginClientFrame *frame = plugin->get_gui_frame();

			if(frame) delete frame;
			total_frames--;
		}
	}


// Determine if active point is out of order
	if(plugin->active_point_exists())
	{
		GraphicPoint *active_point = points->get(plugin->active_point);
		for(int i = 0; i < points->size(); i++)
		{
			if(i == plugin->active_point)
			{
				if(i < points->size() - 1 &&
					active_point->freq >= points->get(i + 1)->freq ||
					i > 0 &&
					active_point->freq <= points->get(i - 1)->freq)
				{
					out_of_order = 1;
				}
				break;
			}
		}
	}


	if(motion)
	{
		if(state == GraphicCanvas::DRAG_POINT)
		{
			int point_x = get_cursor_x() + x_diff;
			int point_y = get_cursor_y() + y_diff;
			CLAMP(point_x, 0, get_w());
			CLAMP(point_y, 0, get_h());
			
			int frequency = Freq::tofreq(point_x * TOTALFREQS / get_w());
			double magnitude_db = (double)(center_y - point_y) * MAXMAGNITUDE / center_y;
			int minfreq = Freq::tofreq(0);
			int maxfreq = Freq::tofreq(TOTALFREQS - 1);

			CLAMP(frequency, minfreq, maxfreq);
			CLAMP(magnitude_db, -MAXMAGNITUDE, MAXMAGNITUDE);
			if(plugin->active_point >= 0)
			{
				GraphicPoint *active_point = points->get(plugin->active_point);
				active_point->freq = frequency;
				active_point->value = magnitude_db;
			}

// Redraw with new value
			process(0, 0, 1);
			save_temps();
			plugin->send_configure_change();
			gui->update_textboxes();
			return;
		}
	}

// Magnitude bars
	if(draw)
	{
		set_color(GREEN);
		set_line_dashes(1);
		for(int i = 1; i < MAJOR_DIVISIONS; i++)
		{
			int y = i * get_h() / (MAJOR_DIVISIONS - 1);
			draw_line(0, y, get_w(), y);
		}
		set_line_dashes(0);
	}

	int y1 = 0;
	if(draw) set_color(WHITE);

// Control points, cursor change and control point selection
	int new_cursor = CROSS_CURSOR;
	for(int i = 0; i < points->size(); i++)
	{
		GraphicPoint *point = points->get(i);
		int x = Freq::fromfreq(point->freq) * get_w() / TOTALFREQS;
		int y = freq_to_y(point->freq, points, envelope);

		if(draw)
		{
			y1 = y;
// Draw point under cursor if out of order
			if(i == plugin->active_point && out_of_order) 
				y1 = get_cursor_y() + y_diff;

			if(i == plugin->active_point)
				draw_box(x - BOX_SIZE / 2, y1 - BOX_SIZE / 2, BOX_SIZE, BOX_SIZE);
			else
				draw_rectangle(x - BOX_SIZE / 2, y1 - BOX_SIZE / 2, BOX_SIZE, BOX_SIZE);
		}

		if(motion && 
			state == GraphicCanvas::NONE &&
			is_event_win() && 
			cursor_inside())
		{
			if(get_cursor_x() >= x - BOX_SIZE / 2 &&
				get_cursor_y() >= y - BOX_SIZE / 2 &&
				get_cursor_x() < x + BOX_SIZE / 2 &&
				get_cursor_y() < y + BOX_SIZE / 2)
			{
				new_cursor = UPRIGHT_ARROW_CURSOR;
			}
		}
		
		if(buttonpress &&
			state == GraphicCanvas::NONE &&
			is_event_win() && 
			cursor_inside() &&
			!got_button)
		{
			if(get_cursor_x() >= x - BOX_SIZE / 2 &&
				get_cursor_y() >= y - BOX_SIZE / 2 &&
				get_cursor_x() < x + BOX_SIZE / 2 &&
				get_cursor_y() < y + BOX_SIZE / 2)
			{
				plugin->active_point = i;
				state = GraphicCanvas::DRAG_POINT;
				new_temps();
				points = &temp_points;
				envelope = temp_envelope;

				x_diff = x - get_cursor_x();
				y_diff = y - get_cursor_y();
				got_button = 1;
				process(0, 0, 1);
				save_temps();
				plugin->send_configure_change();
				gui->update_textboxes();
			}
		}
	}

	if(motion && new_cursor != get_cursor())
	{
		set_cursor(new_cursor, 0, 1);
	}

// Envelope line;
	y1 = 0;
	set_line_width(2);
	for(int i = 0; i < get_w(); i++)
	{
		int y = freq_to_y(Freq::tofreq(i * TOTALFREQS / get_w()), 
			points, 
			envelope);

		if(draw)
		{
			if(i > 0) draw_line(i - 1, y1, i, y);
		}


		y1 = y;
	}
	set_line_width(1);

	if(buttonpress && !got_button)
	{
		if(is_event_win() && cursor_inside())
		{
			GraphicPoint *new_point = new GraphicPoint;
			new_point->freq = Freq::tofreq(get_cursor_x() * 
				TOTALFREQS / 
				get_w());
			new_point->value = (double)(center_y - get_cursor_y()) * 
				MAXMAGNITUDE / 
				center_y;
			state = GraphicCanvas::DRAG_POINT;
			new_temps();
			points = &temp_points;
			envelope = temp_envelope;

			insert_point(new_point);
			plugin->active_point = points->number_of(new_point);
			x_diff = 0;
			y_diff = 0;

// Redraw with new point
			process(0, 0, 1);
			save_temps();
			plugin->send_configure_change();
			gui->update_textboxes();
		}
	}


	if(draw) 
	{
		flash();
	}
}