Exemple #1
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();
}
void CompressorWindow::draw_scales()
{
	draw_3d_border(canvas->get_x() - 2, 
		canvas->get_y() - 2, 
		canvas->get_w() + 4, 
		canvas->get_h() + 4, 
		get_bg_color(),
		BLACK,
		MDGREY, 
		get_bg_color());


	set_font(SMALLFONT);
	set_color(get_resources()->default_text_color);

#define DIVISIONS 8
	for(int i = 0; i <= DIVISIONS; i++)
	{
		int y = canvas->get_y() + 10 + canvas->get_h() / DIVISIONS * i;
		int x = canvas->get_x() - 30;
		char string[BCTEXTLEN];
		
		sprintf(string, "%.0f", (float)i / DIVISIONS * plugin->config.min_db);
		draw_text(x, y, string);
		
		int y1 = canvas->get_y() + canvas->get_h() / DIVISIONS * i;
		int y2 = canvas->get_y() + canvas->get_h() / DIVISIONS * (i + 1);
		for(int j = 0; j < 10; j++)
		{
			y = y1 + (y2 - y1) * j / 10;
			if(j == 0)
			{
				draw_line(canvas->get_x() - 10, y, canvas->get_x(), y);
			}
			else
			if(i < DIVISIONS)
			{
				draw_line(canvas->get_x() - 5, y, canvas->get_x(), y);
			}
		}
	}


	for(int i = 0; i <= DIVISIONS; i++)
	{
		int y = canvas->get_h() + 30;
		int x = canvas->get_x() + (canvas->get_w() - 10) / DIVISIONS * i;
		char string[BCTEXTLEN];

		sprintf(string, "%.0f", (1.0 - (float)i / DIVISIONS) * plugin->config.min_db);
		draw_text(x, y, string);

		int x1 = canvas->get_x() + canvas->get_w() / DIVISIONS * i;
		int x2 = canvas->get_x() + canvas->get_w() / DIVISIONS * (i + 1);
		for(int j = 0; j < 10; j++)
		{
			x = x1 + (x2 - x1) * j / 10;
			if(j == 0)
			{
				draw_line(x, canvas->get_y() + canvas->get_h(), x, canvas->get_y() + canvas->get_h() + 10);
			}
			else
			if(i < DIVISIONS)
			{
				draw_line(x, canvas->get_y() + canvas->get_h(), x, canvas->get_y() + canvas->get_h() + 5);
			}
		}
	}



	flash();
}