void
separator_widget_rep::handle_repaint (repaint_event ev) {
  renderer ren= ev->win;
  layout_default (ren, ev->x1, ev->y1, ev->x2, ev->y2);
  ren->set_pencil (pencil (layout_dark (ren), PIXEL));
  if (vert) ren->line (pre+PIXEL, ev->y1, pre+PIXEL, ev->y2);
  else ren->line (ev->x1, -pre-PIXEL, ev->x2, -pre-PIXEL);
  ren->set_pencil (pencil (white, PIXEL));
  if (vert) ren->line (pre+2*PIXEL, ev->y1, pre+2*PIXEL, ev->y2);
  else ren->line (ev->x1, -pre-2*PIXEL, ev->x2, -pre-2*PIXEL);
}
Exemple #2
0
void
grid_box_rep::display (renderer ren) {
  int i;
  if (first_time || ren->pixel!=ren_pixel) {
    point p1= f [point (x1, y1)];
    point p2= f [point (x2, y2)];
    point l1= point (min (p1[0], p2[0]), min (p1[1], p2[1]));
    point l2= point (max (p1[0], p2[0]), max (p1[1], p2[1]));
    point e1= l1, e2= point (l1[0], l2[1]);
    point e3= l2, e4= point (l2[0], l1[1]);
    point e1t= f (e1), e2t= f (e2);
    point e3t= f (e3), e4t= f (e4);
    double L1t, L2t, L3t, L4t;
    L1t= norm (e2t - e1t);
    L2t= norm (e3t - e2t);
    L3t= norm (e4t - e3t);
    L4t= norm (e1t - e4t);
    ASSERT (!fnull (L1t, 1e-6) && !fnull (L2t, 1e-6) &&
	    !fnull (L3t, 1e-6) && !fnull (L4t, 1e-6),
	    "one side of the grid has length zero");
    array<grid_curve> grads= g->get_curves (l1, l2);

    for (i=0; i<N(grads); i++) {
      curve c= f (grads[i]->c);
      bs << curve_box (decorate (ip), c,
		       pencil (named_color (grads[i]->col), ren->pixel),
		       array<bool> (0), 0, brush (false), array<box> (0));
    }
    first_time= false;
    ren_pixel= ren->pixel;
  }
  for (i=0; i<N(bs); i++)
    bs[i]->display (ren);
}
Exemple #3
0
void				click_main_loop(t_var *var, t_varloop loop, const t_bunny_position *pos)
{
  if (loop.click[BMB_LEFT] == 1 && pos->x > 0 && pos->y > 0)
    pencil(var, pos->x + loop.sz, pos->y + loop.sz);
  if (loop.click[BMB_RIGHT] == 1 && pos->x > 0 && pos->y > 0)
    trace_circle(var, 10 + loop.sz, pos->x, pos->y);
}
void
balloon_decoration_widget_rep::handle_repaint (repaint_event ev) {
  (void) ev;
  renderer ren= ev->win;
  ren->set_background (rgb_color (255, 255, 160));
  ren->clear (0, 0, w, h);
  ren->set_pencil (pencil (black, PIXEL));
  ren->line (0, 0, w-PIXEL, 0);
  ren->line (0, h-PIXEL, w-PIXEL, h-PIXEL);
  ren->line (0, 0, 0, h);
  ren->line (w-PIXEL, 0, w-PIXEL, h-PIXEL);
}
Exemple #5
0
void
concater_rep::flag_ok (string s, path ip, color col) {
  path dip = decorate_right (ip);
  SI h= 4*env->fn->wfn/5;
  int r, g, b, a;
  get_rgb_color (col, r, g, b, a);
  //r= 255- (255 - r)/6;
  //g= 255- (255 - g)/6;
  //b= 255- (255 - b)/6;
  a= a/6;
  color light= rgb_color (r, g, b, a);
  int info= env->info_level;
  if (info == INFO_MINIMAL || info == INFO_SHORT || info == INFO_SHORT_PAPER) {
    box infob= info_box (dip, h, pencil (col, env->fn->wline), light);
    if (info == INFO_SHORT_PAPER) {
      box b= resize_box (ip, infob, 0, 0, 0, env->fn->yx);
      print (b);
    }
    else {
      box specb= specific_box (ip, infob, "screen", env->fn);
      print (specb);
    }
  }
  else if (info == INFO_DETAILED || info == INFO_PAPER) {
    int sz= script (env->fn_size, env->index_level+2);
    font gfn (tex_font ("ecrm", sz, (int) (env->magn*env->dpi)));
    box textb= text_box (decorate (ip), 0, s, gfn, col);
    box flagb= flag_box (dip, textb, h, pencil (col, env->fn->wline), light);
    if (info == INFO_DETAILED) {
      box specb= specific_box (ip, flagb, "screen", env->fn);
      print (specb);
    }
    else {
      box b= resize_box (ip, flagb, 0, 0, 0, env->fn->yx);
      print (b);
    }
  }
}
Exemple #6
0
box
wide_sqobr_box (path ip, SI x1, SI x2, pencil pen) {
    SI penw= pen->get_width ();
    pencil demipen= pencil (pen->get_color (), penw/2);
    path dip= decorate_middle (ip);
    SI width= max (x2-x1, 6*penw), height= 6*penw;
    array<box> bs (3);
    array<SI>  xs (3);
    array<SI>  ys (3);
    xs[0]= ys[0]= xs[1]= ys[1]= xs[2]= ys[2]= 0;
    bs[0]= line_box (dip, 0, height, width, height, pen);
    bs[1]= line_box (dip, 0, height, 0, 0, demipen);
    bs[2]= line_box (dip, width, height, width, 0, demipen);
    return composite_box (ip, bs, xs, ys);
}
Exemple #7
0
void
tabs_widget_rep::handle_repaint (repaint_event ev) { (void) ev;
  renderer ren= ev->win;
  layout_default (ren, 0, 0, w, h);
  if (h1 == 0 || h2 == 0 || N(xs) == 0) return;

  int l= N(a)-1, focus= 0;
  a[l] << get_integer ("switch", focus);
  color pastel= layout_pastel (ren);
  color dark= layout_dark (ren);
  SI fx1= xs[focus] - PIXEL;
  SI fx2= xs[focus+1] - PIXEL;
  SI top= h1 + h2 + 2*PIXEL;
  SI lim= xs[N(xs)-1];

  ren->set_pencil (pencil (pastel, PIXEL));
  if (focus > 0)
    ren->line (0, h1, fx1, h1);
  ren->line (fx2, h1, w, h1);
  ren->set_pencil (pencil (dark, PIXEL));
  if (focus > 0)
    ren->line (0, h1 + PIXEL, fx1, h1 + PIXEL);
  ren->line (fx2, h1 + PIXEL, w, h1 + PIXEL);
  ren->set_pencil (pencil (dark, PIXEL));
  ren->line (0, top, lim - PIXEL, top);
  for (int i=0; i<l; i++) {
    ren->set_pencil (pencil (pastel, PIXEL));
    ren->line (xs[i], h1+2*PIXEL, xs[i], top - PIXEL);
    ren->set_pencil (pencil (dark, PIXEL));
    ren->line (xs[i+1]-PIXEL, h1+2*PIXEL, xs[i+1]-PIXEL, top - PIXEL);
  }
  ren->set_pencil (pencil (pastel, PIXEL));
  ren->line (0, 0, 0, h1);
  ren->set_pencil (pencil (dark, PIXEL));
  ren->line (0, 0, w, 0);
  ren->line (w-PIXEL, 0, w-PIXEL, h1);
}
Exemple #8
0
void canvas()
{	
	int button,mousex,mousey;	//local mouse variables
	if(cur_panel==0&&canvas_flag!=1)
	{
	top_panel_buttons(tool_but_num,0,5);
	hover_text(cur_tool);
	button_click((2+cur_tool*20),2,(18+cur_tool*20),18);
	canvas_flag=1;
	}
	else if(cur_panel==1&&canvas_flag!=2)
	{
	hover_text(cur_tool);
	top_panel_buttons(buttons_data[cur_tool-1],0,5);
	button_click((2+cur_style*20),2,(18+cur_style*20),18);
	canvas_flag=2;
	}
	hover_text(cur_tool);
	getmousepos(&button,&mousex,&mousey);
	for(;mousey>20;getmousepos(&button,&mousex,&mousey))
	{
		if(button==1)
		{
			restrictmouseptr(0,27,xmax,ymax);
			switch(cur_tool)
			{
				case 4: user_text(mousex,mousey);
						break;
				case 5: pencil();
						break;
				case 6: brush(2);
						break;
				case 7: bfill(mousex,mousey);
						break;
				case 8: brush(1);
						break;
				case 9: user_pickcolor();
						break;
				case 10: user_line();
						break;
				case 11: drawRectangle();
						break;
				case 12: drawEllipse();
						break;
				case 13: drawSpray();
						break;
				case 14: drawSpiral();
						break;
				case 15:user_clip();
						break;
				case 16:user_poly();
						break;
				case 17:drawCircle(cur_style);
						break;

			}

		}
		else
		{
			restrictmouseptr(0,0,xmax,ymax);
			
		}
	}
}
Exemple #9
0
pencil
box_rep::get_leaf_pencil () {
  failed_error << "The box is " << box (this) << "\n";
  FAILED ("this box is not textual");
  return pencil (false);
}