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)"); } }
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); }
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); } } } }