예제 #1
0
static int
_inp_rl_clear_handler(int count, int key)
{
    ProfWin *win = wins_get_current();
    win_clear(win);
    return 0;
}
예제 #2
0
파일: main.c 프로젝트: NYAMNYAM3/MyKernel
/*
void test(void)
{
	window win;
	char name[10]="window";
	clearscreen();
	win_init(&win,1,1,10,40,name,blightgray|fwhite,blightgray|fblack);
	win_create(&win);

	win_putchar(&win,'n');
	win_putchar(&win,'\n');

	int i;
	for(i=0;i<7;i++)
	win_putstring(&win,"testing win_putstring\n");/
	for(i=0;i<4;i++)//
	win_putstring(&win,"new line\n");

}
*/
int main(struct multiboot *mboot_ptr)
{
	welcome();		

	init_descriptor_tables();

	asm volatile("sti");
	
	init_timer(1);

	wait(1);
	win_clear(&win_boot);

	win_putstring(&win_boot,"\ninitializing timer...\t");
	wait(1);
	win_putstring(&win_boot," done");

	win_putstring(&win_boot,"\ninitializing keyboard...\t");
	init_kbd();
	wait(1);
	win_putstring(&win_boot," done");

	win_putstring(&win_boot,"\npress any key to continue...\n");

	u8int s,a;

	kbd_read(&s,&a);

	clearscreen();
	terminal();	
	
	while(1);	
    return 0;

}
예제 #3
0
파일: ui.c 프로젝트: benhoskings/textmms
void win_delalert()
{
    win_clear(&wins.alert);
    win_display(&wins.alert, false);
    win_stop(&wins.alert);
    
    g_data.bump = true;
}
예제 #4
0
파일: ui.c 프로젝트: benhoskings/textmms
void win_delmsg()
{
    win_clear(&wins.msg);
    win_display(&wins.msg, false);
    win_stop(&wins.msg);
    
    g_data.bump = true;
}
예제 #5
0
static void
view_version_changed(){
	if ( (version_win.flags & WINFLG_VISIBLE)){
		version_win.bg_color = WHITE;
		win_clear(&version_win, 1); 
		version_win.flags &= ~WINFLG_VISIBLE;
		version_win.bg_color = BLACK;
	} else {
		version_win.flags |= WINFLG_VISIBLE;
		win_redraw(&version_win);
	}; 	
};
예제 #6
0
/* 	Clear window (except border) and draw the contents completely (except border) new. Use text in win->txt
	Sets win->fits to 1 if the text fits in window, else sets it to 0.
	Honors WINFLG_CENTER, WINFLG_VISIBLE and WINFLG_HIDE.
*/
void 
win_draw_text(struct Window *win){
	if (! (win->flags & WINFLG_VISIBLE)) return;
	if (win->txt == NULL) return; 	
	win_clear(win, 0);
	if (win->flags & WINFLG_HIDE) return;
	
	set_font(win->font);
	
	if (win->flags & WINFLG_CENTER)
		return win_center_text(win);
	
	win->cur_char = 0;
	win->cur_col = win_txt_col(win);
	win->fits = 1;
	while (win->cur_char < win->text_len){
		if (draw_cur_char(win) == 0) {
			win->fits = 0;
			break;
		};
	};
};
예제 #7
0
END_TEST

START_TEST (test_win_handler_scroll)
{
  int ret;
  Win *w;
  win_properties props = { 0, 0 };

  w = win_create (0, 0, 40, 80, &props);
  fail_unless (w != NULL);
  ret = win_load_file (w, CONFDIR "text_test_long.txt");

  fail_unless (ret == 0);
  ret = win_scroll (w, -1);
  fail_unless (ret < 0);	/* at the first line already. */

  ret = win_scroll (w, 130);
  fail_unless (ret < 0);	/* scroll to far down. */

  ret = win_scroll (w, -15);
  fail_unless (ret == 0);

  ret = win_scroll (w, -1);
  fail_unless (ret == 0);

  ret = win_scroll (w, 5);
  fail_unless (ret == 0);

  ret = win_scroll (w, 1);
  fail_unless (ret == 0);

  win_to_top (w);

  ret = win_go_to_line (w, -2);
  fail_unless (ret < 0);
  ret = win_go_to_line (w, 180);
  fail_unless (ret < 0);

  ret = win_go_to_line (w, 15);
  fail_unless (ret == 0);

  ret = win_move (w, -1);
  fail_unless (ret == 0);
  ret = win_move (w, -4);
  fail_unless (ret == 0);
  ret = win_move (w, 1);
  fail_unless (ret == 0);
  ret = win_move (w, 4);
  fail_unless (ret == 0);

  win_clear (w);

  win_free (w);

  props.properties = WIN_PROP_CURSOR;
  w = win_create (0, 0, 40, 80, &props);
  fail_unless (w != NULL);
  ret = win_load_file (w, CONFDIR "text_test_long.txt");
  ret = win_go_to_line (w, 15);
  fail_unless (ret == 0);
  ret = win_move (w, -1);
  fail_unless (ret == 0);
  ret = win_move (w, -4);
  fail_unless (ret == 0);
  ret = win_move (w, 1);
  fail_unless (ret == 0);
  ret = win_move (w, 4);
  fail_unless (ret == 0);

  win_clear (w);

  win_free (w);
}
예제 #8
0
파일: image.c 프로젝트: paradigm/sxiv
void img_render(img_t *img) {
	win_t *win;
	int sx, sy, sw, sh;
	int dx, dy, dw, dh;

	if (img == NULL || img->im == NULL || img->win == NULL)
		return;

	win = img->win;
	img_fit(img);

	if (!img->re) {
		/* rendered for the first time */
		img->re = true;
		if (img->zoom * img->w <= win->w)
			img->x = (win->w - img->w * img->zoom) / 2;
		else
			img->x = 0;
		if (img->zoom * img->h <= win->h)
			img->y = (win->h - img->h * img->zoom) / 2;
		else
			img->y = 0;
	}
	
	if (img->checkpan) {
		img_check_pan(img, false);
		img->checkpan = false;
	}

	if (!img->dirty)
		return;

	/* calculate source and destination offsets */
	if (img->x < 0) {
		sx = -img->x / img->zoom;
		sw = win->w / img->zoom;
		dx = 0;
		dw = win->w;
	} else {
		sx = 0;
		sw = img->w;
		dx = img->x;
		dw = img->w * img->zoom;
	}
	if (img->y < 0) {
		sy = -img->y / img->zoom;
		sh = win->h / img->zoom;
		dy = 0;
		dh = win->h;
	} else {
		sy = 0;
		sh = img->h;
		dy = img->y;
		dh = img->h * img->zoom;
	}

	win_clear(win);

	imlib_context_set_image(img->im);

	if (!img->alpha && imlib_image_has_alpha())
		win_draw_rect(win, win->pm, dx, dy, dw, dh, True, 0, win->white);
	
	imlib_context_set_drawable(win->pm);
	imlib_render_image_part_on_drawable_at_size(sx, sy, sw, sh, dx, dy, dw, dh);

	win_draw(win);

	img->dirty = false;
}