Beispiel #1
0
void
edit_interface_rep::draw_graphics (renderer ren) {
  if (got_focus || full_screen) {
    cursor cu= get_cursor();
    if (over_graphics(cu->ox, cu->oy) && inside_active_graphics ()) {
      eval ("(graphics-reset-context 'graphics-cursor)");
      draw_graphical_object (ren);
      string tm_curs= as_string (eval ("graphics-texmacs-pointer"));
      if (tm_curs != "none") {
	if (tm_curs == "graphics-cross") {
	  ren->set_line_style (pixel);
	  ren->set_color (red);
	  ren->line (cu->ox, cu->oy-5*pixel, cu->ox, cu->oy+5*pixel);
	  ren->line (cu->ox-5*pixel, cu->oy, cu->ox+5*pixel, cu->oy);
        }
	else if (tm_curs == "graphics-cross-arrows") {
	  static int s= 6*pixel, a= 2*pixel;
	  ren->set_line_style (pixel);
	  ren->set_color (red);
	  ren->line (cu->ox, cu->oy-s, cu->ox, cu->oy+s);
	  ren->line (cu->ox-s, cu->oy, cu->ox+s, cu->oy);
	  ren->line (cu->ox, cu->oy-s,cu->ox-a, cu->oy-s+a);
	  ren->line (cu->ox, cu->oy-s, cu->ox+a, cu->oy-s+a);
	  ren->line (cu->ox, cu->oy+s, cu->ox-a, cu->oy+s-a);
	  ren->line (cu->ox, cu->oy+s, cu->ox+a, cu->oy+s-a);
	  ren->line (cu->ox-s, cu->oy, cu->ox-s+a, cu->oy+a);
	  ren->line (cu->ox-s, cu->oy, cu->ox-s+a, cu->oy-a);
	  ren->line (cu->ox+s, cu->oy, cu->ox+s-a, cu->oy+a);
	  ren->line (cu->ox+s, cu->oy, cu->ox+s-a, cu->oy-a);
        }
      }
    }
    else eval ("(graphics-reset-context 'text-cursor)");
  }
}
Beispiel #2
0
void
edit_interface_rep::draw_selection (renderer ren) {
  if (!is_nil (locus_rects)) {
    ren->set_color (rgb_color (32, 160, 96));
    ren->draw_rectangles (locus_rects);
  }
  if (made_selection && !is_nil (selection_rects)) {
    ren->set_color (table_selection? rgb_color (192, 0, 255): red);
#ifdef QTTEXMACS
    ren->draw_selection (selection_rects);
#else
    ren->draw_rectangles (selection_rects);
#endif
  }
}
Beispiel #3
0
void
edit_interface_rep::draw_env (renderer ren) {
  if (!full_screen) {
    if (!is_nil (env_rects)) {
      ren->set_color (rgb_color (0, 85, 85, 24));
      ren->draw_rectangles (env_rects);
    }
    if (!is_nil (foc_rects)) {
      ren->set_color (rgb_color (0, 255, 255));
      ren->draw_rectangles (foc_rects);
    }
    if (!is_nil (sem_rects)) {
      if (sem_correct) ren->set_color (rgb_color (112, 208, 112));
      else ren->set_color (rgb_color (208, 144, 80));
      ren->draw_rectangles (sem_rects);
    }
  }
}
Beispiel #4
0
void
edit_interface_rep::draw_context (renderer ren, rectangle r) {
  int i;
  ren->set_color (light_grey);
  ren->set_line_style (pixel);
  for (i=1; i<N(eb[0]); i++) {
    SI y= eb->sy(0)+ eb[0]->sy2(i);
    if ((y >= r->y1) && (y < r->y2))
      ren->line (r->x1, y, r->x2, y);
  }
  draw_surround (ren, r);
}
Beispiel #5
0
void
edit_interface_rep::draw_cursor (renderer ren) {
  if (!temp_invalid_cursor && (got_focus || full_screen)) {
    cursor cu= get_cursor();
    if (!inside_active_graphics ()) {
      cu->y1 -= 2*pixel; cu->y2 += 2*pixel;
      SI x1= cu->ox + ((SI) (cu->y1 * cu->slope)), y1= cu->oy + cu->y1;
      SI x2= cu->ox + ((SI) (cu->y2 * cu->slope)), y2= cu->oy + cu->y2;
      ren->set_line_style (pixel);
      string mode= get_env_string (MODE);
      string family, series;
      if ((mode == "text") || (mode == "src")) {
	family= get_env_string (FONT_FAMILY);
	series= get_env_string (FONT_SERIES);
      }
      else if (mode == "math") {
	family= get_env_string (MATH_FONT_FAMILY);
	series= get_env_string (MATH_FONT_SERIES);
      }
      else if (mode == "prog") {
	family= get_env_string (PROG_FONT_FAMILY);
	series= get_env_string (PROG_FONT_SERIES);
      }
      if (cu->valid) {
	if (mode == "math")
	  ren->set_color (rgb_color (192, 0, 255));
	else ren->set_color (red);
      }
      else ren->set_color (green);
      SI lserif= (series=="bold"? 2*pixel: pixel), rserif= pixel;
      if (family == "ss") lserif= rserif= 0;
      ren->line (x1-lserif, y1, x1+rserif, y1);
      if (y1<=y2-pixel) {
	ren->line (x1, y1, x2, y2-pixel);
	if (series == "bold") ren->line (x1-pixel, y1, x2-pixel, y2-pixel);
	ren->line (x2-lserif, y2-pixel, x2+rserif, y2-pixel);
      }
    }
  }
}
Beispiel #6
0
    void render(renderer& r) {
        auto const w = map_.width();
        auto const h = map_.height();

        for (int y = 0; y < h; ++y) {
            for (int x = 0; x < w; ++x) {
                auto const cat = map_.get<map_property::category>(x, y);

                using category = yama::tile_category;

                switch (cat) {
                case category::empty:    r.set_color(0, 0, 0); break;
                case category::wall:     r.set_color(100, 100, 100); break;
                case category::floor:    r.set_color(200, 200, 200); break;
                case category::door:     r.set_color(0, 0, 200); break;
                case category::corridor: r.set_color(0, 100, 0); break;
                case category::stair:    r.set_color(255, 0, 0); break;
                case category::invalid:  r.set_color(100, 100, 200); break;
                default:                 r.set_color(100, 100, 200); break;
                }

                r.fill_rect(x*16, y*16, 16, 16);
            }
        }

        r.set_color(255, 0, 0);
        for (auto const& region : regions_) {
            r.draw_rect(region.left*16, region.top*16, region.width()*16, region.height()*16);
        }
    }