コード例 #1
0
ファイル: view.c プロジェクト: mulianov/vis
/* place the cursor according to the screen coordinates in view->{row,col} and
 * fire user callback. if a selection is active, redraw the view to reflect
 * its changes. */
static size_t view_cursor_update(View *view) {
	Cursor *cursor = &view->cursor;
	if (view->sel.start != EPOS) {
		view->sel.end = cursor->pos;
		view_draw(view);
	} else if (view->ui && view->syntax) {
		size_t pos = cursor->pos;
		size_t pos_match = text_bracket_match_except(view->text, pos, "<>");
		if (pos != pos_match && view->start <= pos_match && pos_match < view->end) {
			if (cursor->highlighted)
				view_draw(view); /* clear active highlighting */
			cursor->pos = pos_match;
			view_cursor_sync(view);
			cursor->line->cells[cursor->col].attr |= A_REVERSE;
			cursor->pos = pos;
			view_cursor_sync(view);
			view->ui->draw_text(view->ui, view->topline);
			cursor->highlighted = true;
		} else if (cursor->highlighted) {
			cursor->highlighted = false;
			view_draw(view);
		}
	}
	if (cursor->pos != cursor->lastpos)
		cursor->lastcol = 0;
	cursor->lastpos = cursor->pos;
	if (view->ui)
		view->ui->cursor_to(view->ui, cursor->col, cursor->row);
	return cursor->pos;
}
コード例 #2
0
ファイル: vis.c プロジェクト: ewqasd200g/vis
static void windows_invalidate(Vis *vis, size_t start, size_t end) {
	for (Win *win = vis->windows; win; win = win->next) {
		if (vis->win != win && vis->win->file == win->file) {
			Filerange view = view_viewport_get(win->view);
			if ((view.start <= start && start <= view.end) ||
			    (view.start <= end && end <= view.end))
				view_draw(win->view);
		}
	}
	view_draw(vis->win->view);
}
コード例 #3
0
ファイル: ui-curses.c プロジェクト: Armavica/vis
static void ui_window_focus(UiWin *w) {
    UiCursesWin *win = (UiCursesWin*)w;
    UiCursesWin *oldsel = win->ui->selwin;
    win->ui->selwin = win;
    if (oldsel) {
        view_draw(oldsel->view);
        ui_window_draw((UiWin*)oldsel);
    }
    view_draw(win->view);
    ui_window_draw(w);
}
コード例 #4
0
ファイル: view.c プロジェクト: mulianov/vis
/* move the cursor to the character at pos bytes from the begining of the file.
 * if pos is not in the current viewport, redraw the view to make it visible */
void view_cursor_to(View *view, size_t pos) {
	size_t max = text_size(view->text);

	if (pos > max)
		pos = max > 0 ? max - 1 : 0;

	if (pos == max && view->end != max) {
		/* do not display an empty screen when shoviewg the end of the file */
		view->start = max - 1;
		view_viewport_up(view, view->height / 2);
	} else {
		/* set the start of the viewable region to the start of the line on which
		 * the cursor should be placed. if this line requires more space than
		 * available in the view then simply start displaying text at the new
		 * cursor position */
		for (int i = 0;  i < 2 && (pos < view->start || pos > view->end); i++) {
			view->start = i == 0 ? text_line_begin(view->text, pos) : pos;
			view_draw(view);
		}
	}

	view->cursor.pos = pos;
	view_cursor_sync(view);
	view_cursor_update(view);
}
コード例 #5
0
ファイル: view.c プロジェクト: mulianov/vis
void view_selection_set(View *view, Filerange *sel) {
	Cursor *cursor = &view->cursor;
	view->sel = *sel;
	view_draw(view);
	if (view->ui)
		view->ui->cursor_to(view->ui, cursor->col, cursor->row);
}
コード例 #6
0
ファイル: view.c プロジェクト: prophile/dim3
void view_loop_draw(int tick)
{
	if (tick<view.time.draw_tick) return;
	view.time.draw_tick=tick+view.time.draw_time;
	
		// texture setup
	
	map_setup_animated_textures(&map,tick);
	map_mesh_poly_run_shifts(&map,tick);

		// start frame
		
	if (!fog_solid_on()) {
		gl_frame_start(NULL);
	}
	else {
		gl_frame_start(&map.fog.col);		// is obscuring fog on, then background = fog color
	}

		// draw frame
		
	view_draw(tick);
	hud_draw(tick);
	radar_draw(tick);
	network_draw(tick);
	
	gl_frame_end();

	view.fps.count++;
}
コード例 #7
0
ファイル: view.c プロジェクト: prophile/dim3
void view_capture_draw(char *path)
{
	int			tick;

	tick=game_time_get();

	gl_frame_start(NULL);
	view_draw(tick);
	
	gl_screen_shot(render_info.view_x,render_info.view_y,setup.screen.x_sz,setup.screen.y_sz,TRUE,path);
}
コード例 #8
0
ファイル: textbuffer-view.c プロジェクト: irssi-import/cuix
static void view_draw_bottom(TEXT_BUFFER_VIEW_REC *view, int lines)
{
	LINE_REC *line;
	int ypos, maxline, subline, linecount;

	maxline = view->height-lines;
	line = view->startline; ypos = -view->subline; subline = 0;
	while (line != NULL && ypos < maxline) {
                linecount = view_get_linecount(view, line);
		ypos += linecount;
		if (ypos > maxline) {
			subline = maxline-(ypos-linecount);
			break;
		}
                line = line->next;
	}

        view_draw(view, line, subline, maxline, lines, TRUE);
}
コード例 #9
0
ファイル: common.c プロジェクト: piotrm0/progs
GLvoid draw_gl(GLvoid) {
  view_draw(view_main);
  glutSwapBuffers();
}
コード例 #10
0
ファイル: view.c プロジェクト: mulianov/vis
void view_selection_clear(View *view) {
	view->sel = text_range_empty();
	view_draw(view);
	view_cursor_update(view);
}
コード例 #11
0
ファイル: view.c プロジェクト: mulianov/vis
void view_tabwidth_set(View *view, int tabwidth) {
	view->tabwidth = tabwidth;
	view_draw(view);
}