10 #include "transform.h"
11 #include "projection.h"
14 #include "statusbar.h"
22 /* #include "track.h" */
28 struct graphics_gc *cursor_gc;
29 struct point cursor_pnt;
34 cursor_draw(struct cursor *this_, struct point *pnt, int dir, int draw_dir, int force)
36 int x=this_->cursor_pnt.x;
37 int y=this_->cursor_pnt.y;
42 struct graphics *gra=this_->gra;
44 if (pnt && x == pnt->x && y == pnt->y && !force)
46 if (!graphics_ready(gra))
48 cpnt[0]=this_->cursor_pnt;
51 graphics_draw_restore(gra, &cpnt[0], (r+lw)*2, (r+lw)*2);
53 graphics_draw_mode(gra, draw_mode_cursor);
54 this_->cursor_pnt=*pnt;
59 graphics_draw_circle(gra, this_->cursor_gc, &cpnt[0], r*2);
61 dx=sin(M_PI*dir/180.0);
62 dy=-cos(M_PI*dir/180.0);
66 cpnt[0].x=x-dx*fac1+dy*fac2;
67 cpnt[0].y=y-dy*fac1-dx*fac2;
70 cpnt[2].x=x-dx*fac1-dy*fac2;
71 cpnt[2].y=y-dy*fac1+dx*fac2;
72 graphics_draw_lines(gra, this_->cursor_gc, cpnt, 3);
75 graphics_draw_lines(gra, this_->cursor_gc, cpnt, 2);
77 graphics_draw_mode(gra, draw_mode_end);
82 cursor_new(struct graphics *gra, struct color *c)
84 dbg(2,"enter gra=%p c=%p\n", gra, c);
85 struct cursor *this=g_new(struct cursor,1);
87 this->cursor_gc=graphics_gc_new(gra);
88 graphics_gc_set_foreground(this->cursor_gc, c);
89 graphics_gc_set_linewidth(this->cursor_gc, 2);
90 dbg(2,"ret=%p\n", this);
95 cursor_destroy(struct cursor *this_)
97 graphics_gc_destroy(this_->cursor_gc);