コード例 #1
0
ファイル: load.c プロジェクト: ericmckean/nesemu
void load_draw(load_t *m)
{
	int x,y;

	x = m->info.x;
	y = m->info.y;
	if(m->isshowing == 0)
		return;
	gui_draw_border(GUI_COLOR_DARKBLUE,x,y,m->info.w,m->info.h);
	gui_draw_border(GUI_COLOR_GREY,x,y,m->info.w,9);
	gui_draw_text(GUI_TEXT,x+2,y+2,"Load ROM");
	button_draw(&m->closebtn);
	button_draw(&m->loadbtn);
	list_draw(&m->romlist);
	list_draw(&m->dirlist);
	edit_draw(&m->edit);
	text_draw(&m->pathtext);
	text_draw(&m->rominfo[0]);
	text_draw(&m->rominfo[1]);
}
コード例 #2
0
ファイル: winio.cpp プロジェクト: pgengler/pinot
/* Just update one line in the edit buffer.  This is basically a wrapper
 * for edit_draw().  The line will be displayed starting with
 * fileptr->data[index].  Likely arguments are current_x or zero.
 * Returns: Number of additiona lines consumed (needed for SOFTWRAP)
 */
int update_line(filestruct *fileptr, size_t index)
{
	int line = 0;
	int extralinesused = 0;
	/* The line in the edit window that we want to update. */
	char *converted;
	/* fileptr->data converted to have tabs and control characters
	 * expanded. */
	size_t page_start;
	filestruct *tmp;

	assert(fileptr != NULL);

	if (ISSET(SOFTWRAP)) {
		for (tmp = openfile->edittop; tmp && tmp != fileptr; tmp = tmp->next) {
			line += 1 + (strlenpt(tmp->data) / COLS);
		}
	} else {
		line = fileptr->lineno - openfile->edittop->lineno;
	}

	if (line < 0 || line >= editwinrows) {
		return 1;
	}

	/* First, blank out the line. */
	blank_line(edit, line, 0, COLS);

	/* Next, convert variables that index the line to their equivalent
	 * positions in the expanded line. */
	if (ISSET(SOFTWRAP)) {
		index = 0;
	} else {
		index = strnlenpt(fileptr->data, index);
	}
	page_start = get_page_start(index);

	/* Expand the line, replacing tabs with spaces, and control
	 * characters with their displayed forms. */
	converted = display_string(fileptr->data, page_start, COLS, !ISSET(SOFTWRAP));

#ifdef DEBUG
	if (ISSET(SOFTWRAP) && strlen(converted) >= COLS - 2) {
		fprintf(stderr, "update_line(): converted(1) line = %s\n", converted);
	}
#endif


	/* Paint the line. */
	edit_draw(fileptr, converted, line, page_start);
	free(converted);

	if (!ISSET(SOFTWRAP)) {
		if (page_start > 0) {
			mvwaddch(edit, line, 0, '$');
		}
		if (strlenpt(fileptr->data) > page_start + COLS) {
			mvwaddch(edit, line, COLS - 1, '$');
		}
	} else {
		int full_length = strlenpt(fileptr->data);
		for (index += COLS; index <= full_length && line < editwinrows; index += COLS) {
			line++;
			DEBUG_LOG("update_line(): Softwrap code, moving to " << line << " index " << index);
			blank_line(edit, line, 0, COLS);

			/* Expand the line, replacing tabs with spaces, and control
			 * characters with their displayed forms. */
			converted = display_string(fileptr->data, index, COLS, !ISSET(SOFTWRAP));
			if (ISSET(SOFTWRAP) && strlen(converted) >= COLS - 2) {
				DEBUG_LOG("update_line(): converted(2) line == " << converted);
			}

			/* Paint the line. */
			edit_draw(fileptr, converted, line, index);
			free(converted);
			extralinesused++;
		}
	}
	return extralinesused;
}