Esempio n. 1
0
static void draw_text_bar(int x, int by1, int by2, int dx)
{
	char buffer[256];
	unsigned i;

	snprintf(buffer, sizeof(buffer), " AdvanceVIDEO Config - " __DATE__);

	draw_text_left(x, by1, dx, buffer, COLOR_BAR);

	sncpy(buffer, sizeof(buffer), "");
	for(i=0;i<video_driver_vector_max();++i) {
		if (video_driver_vector_pos(i) != 0) {
			if (*buffer)
				sncat(buffer, sizeof(buffer), "/");
			sncat(buffer, sizeof(buffer), video_driver_vector_pos(i)->name);
		}
	}

	draw_text_left(x + dx - strlen(buffer), by1, strlen(buffer), buffer, COLOR_BAR);

	snprintf(buffer, sizeof(buffer), " #    x    y pclock hclock vclock name");
	draw_text_left(x, by1+2, dx, buffer, COLOR_TITLE);

	snprintf(buffer, sizeof(buffer), " F1 Help  F2 Save  SPACE Select  TAB Rename  ENTER Test  ESC Exit");
	draw_text_left(x, by2, dx, buffer, COLOR_BAR);
}
Esempio n. 2
0
const char *drawtext(rect r, int alignment, const char *s)
{
    int h;
    int nlines;
    int line_height;
    int u = 0;
    rect clip;
    const char *remains;
    char line[256];

    initapp(0,0);
    if (! s) return (char *) NULL;
    if (! current->fnt)
	current->fnt = SystemFont;

    clip = getcliprect();
    setcliprect(r);

    line_height = getheight(current->fnt);

    if ((alignment & VCenter) == VCenter) {
	h = textheight(r.width, s);
	if (h < r.height)
	    r.y += (r.height-h)/2;
    }
    else if ((alignment & VJustify) == VJustify) {
	h = textheight(r.width, s);
	if (h < r.height) {
	    nlines = h / line_height;
	    if (nlines > 1)
		line_height += ((r.height-h) / (nlines-1));
	}
    }
    else if ((alignment & AlignBottom) == AlignBottom) {
	h = textheight(r.width, s);
	if (h < r.height)
	    r.y += (r.height-h);
    }

    u = (alignment & Underline);

    if ((alignment & Center) == Center)
	remains = draw_text_centered(line, r, line_height, u, s);
    else if ((alignment & Justify) == Justify)
	remains = draw_text_justified(line, r, line_height, u, s);
    else if ((alignment & AlignRight) == AlignRight)
	remains = draw_text_right(line, r, line_height, u, s);
    else
	remains = draw_text_left(line, r, line_height, u, s);

    setcliprect(clip);
    return remains;
}
Esempio n. 3
0
static void draw_text_info(int x, int y, int dx, int dy, int pos)
{
	char buffer[3][256];

	adv_crtc* crtc = menu_pos(pos);

	if (crtc) {
		format_info(buffer[0], buffer[1], buffer[2], 256, crtc);
	} else {
		sncpy(buffer[0], sizeof(buffer[0]), "");
		sncpy(buffer[1], sizeof(buffer[1]), "");
		sncpy(buffer[2], sizeof(buffer[2]), "");
	}

	draw_text_left(x, y+0, dx, buffer[0], COLOR_INFO_TITLE);
	draw_text_left(x, y+1, dx, buffer[1], COLOR_INFO_NORMAL);
	draw_text_left(x, y+2, dx, buffer[2], COLOR_INFO_NORMAL);

	if (crtc) {
		if (crtc_is_fake(crtc)) {
			draw_text_left(x+dx-8, y, 8, " SYSTEM ", COLOR_INFO_NORMAL);
		} else if (!crtc_clock_check(&the_monitor, crtc)) {
			draw_text_left(x+dx-14, y, 14, " OUT OF RANGE ", COLOR_ERROR);
		} else {
			draw_text_left(x+dx-14, y, 14, " PROGRAMMABLE ", COLOR_INFO_NORMAL);
		}
	} else {
		draw_text_fillrect(x, y, ' ', dx, dy, COLOR_INFO_NORMAL);
	}
}
Esempio n. 4
0
static void menu_item_draw(int x, int y, int dx, int pos, adv_bool selected)
{
	char buffer[256];

	adv_crtc* crtc = menu_pos(pos);

	if (crtc) {
		char tag;
		unsigned pos;
		unsigned color;
		unsigned color_n;
		unsigned color_clock;
		char pfreq_buffer[8];
		char vfreq_buffer[8];
		char hfreq_buffer[8];

		if (selected) {
			if (crtc->user_flags & MODE_FLAGS_USER_BIT0) {
				tag = 'þ';
				color = COLOR_SELECTED_MARK;
				color_n = color;
			} else {
				tag = ' ';
				color = COLOR_SELECTED;
				color_n = color;
			}
		} else {
			if (crtc->user_flags & MODE_FLAGS_USER_BIT0) {
				tag = 'þ';
				if (crtc_is_fake(crtc) || crtc_clock_check(&the_monitor, crtc)) {
					color = COLOR_MARK;
					color_n = color;
				} else {
					color = COLOR_MARK;
					color_n = COLOR_MARK_BAD;
				}
			} else {
				tag = ' ';
				if (crtc_is_fake(crtc) || crtc_clock_check(&the_monitor, crtc)) {
					color = COLOR_NORMAL;
					color_n = color;
				} else {
					color = COLOR_NORMAL;
					color_n = COLOR_BAD;
				}
			}
		}

		snprintf(vfreq_buffer, sizeof(vfreq_buffer), "%7.2f", (double)crtc_vclock_get(crtc));

		snprintf(hfreq_buffer, sizeof(hfreq_buffer), "%7.2f", (double)crtc_hclock_get(crtc) / 1E3);

		snprintf(pfreq_buffer, sizeof(pfreq_buffer), "%7.2f", (double)crtc_pclock_get(crtc) / 1E6);

		snprintf(buffer, sizeof(buffer), " %c %4d %4d", tag, crtc->hde, crtc->vde);

		pos = 0;

		pos += draw_text_string(x + pos, y, buffer, color_n);

		pos += draw_text_string(x + pos, y, pfreq_buffer, color_n);
		pos += draw_text_string(x + pos, y, hfreq_buffer, color_n);
		pos += draw_text_string(x + pos, y, vfreq_buffer, color_n);

		snprintf(buffer, sizeof(buffer), " %s", crtc->name);

		draw_text_left(x + pos, y, dx - pos, buffer, color_n);
	} else {
		draw_text_fill(x, y, ' ', dx, COLOR_NORMAL);
	}
}