rework proxy scaler, fix crop-gui coord, video_data tweak for proxy_format
[goodguy/cinelerra.git] / cinelerra-5.1 / plugins / tracer / tracerwindow.C
1 /*
2  * CINELERRA
3  * Copyright (C) 2014 Adam Williams <broadcast at earthling dot net>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18  *
19  */
20
21 #include "automation.h"
22 #include "bcdisplayinfo.h"
23 #include "clip.h"
24 #include "tracer.h"
25 #include "tracerwindow.h"
26 #include "cstrdup.h"
27 #include "cwindow.h"
28 #include "cwindowgui.h"
29 #include "edl.h"
30 #include "edlsession.h"
31 #include "language.h"
32 #include "mainerror.h"
33 #include "mwindow.h"
34 #include "plugin.h"
35 #include "pluginserver.h"
36 #include "theme.h"
37 #include "track.h"
38
39 #define COLOR_W 50
40 #define COLOR_H 30
41
42 TracerNum::TracerNum(TracerWindow *gui, int x, int y, float output)
43  : BC_TumbleTextBox(gui, output, -32767.0f, 32767.0f, x, y, 120)
44 {
45         this->gui = gui;
46         set_increment(1);
47         set_precision(1);
48 }
49
50 TracerNum::~TracerNum()
51 {
52 }
53
54 int TracerPointX::handle_event()
55 {
56         if( !TracerNum::handle_event() ) return 0;
57         TracerPointList *point_list = gui->point_list;
58         int hot_point = point_list->get_selection_number(0, 0);
59         TracerPoints &points = gui->plugin->config.points;
60         int sz = points.size();
61         if( hot_point >= 0 && hot_point < sz ) {
62                 float v = atof(get_text());
63                 points[hot_point]->x = v;
64                 point_list->set_point(hot_point, PT_X, v);
65         }
66         point_list->update_list(hot_point);
67         gui->send_configure_change();
68         return 1;
69 }
70 int TracerPointY::handle_event()
71 {
72         if( !TracerNum::handle_event() ) return 0;
73         TracerPointList *point_list = gui->point_list;
74         int hot_point = point_list->get_selection_number(0, 0);
75         TracerPoints &points = gui->plugin->config.points;
76         int sz = points.size();
77         if( hot_point >= 0 && hot_point < sz ) {
78                 float v = atof(get_text());
79                 points[hot_point]->y = v;
80                 point_list->set_point(hot_point, PT_Y, v);
81         }
82         point_list->update_list(hot_point);
83         gui->send_configure_change();
84         return 1;
85 }
86
87 TracerWindow::TracerWindow(Tracer *plugin)
88  : PluginClientWindow(plugin, 400, 420, 400, 420, 0)
89 {
90         this->plugin = plugin;
91         this->title_x = 0;    this->point_x = 0;
92         this->title_y = 0;    this->point_y = 0;
93         this->new_point = 0;  this->del_point = 0;
94         this->point_up = 0;   this->point_dn = 0;
95         this->drag = 0;       this->draw = 0;
96         this->button_no = 0;  this->invert = 0;
97         this->title_r = 0;    this->title_s = 0;
98         this->feather = 0;    this->radius = 0;
99         this->last_x = 0;     this->last_y = 0;
100         this->point_list = 0; this->pending_config = 0;
101 }
102
103 TracerWindow::~TracerWindow()
104 {
105         delete point_x;
106         delete point_y;
107 }
108
109 void TracerWindow::create_objects()
110 {
111         int x = 10, y = 10;
112         int margin = plugin->get_theme()->widget_border;
113         int hot_point = plugin->config.selected;
114         add_subwindow(title_x = new BC_Title(x, y, _("X:")));
115         int x1 = x + title_x->get_w() + margin;
116         TracerPoint *pt = hot_point >= 0 ? plugin->config.points[hot_point] : 0;
117         point_x = new TracerPointX(this, x1, y, !pt ? 0 : pt->x);
118         point_x->create_objects();
119         x1 += point_x->get_w() + margin;
120         add_subwindow(new_point = new TracerNewPoint(this, plugin, x1, y));
121         x1 += new_point->get_w() + margin;
122         add_subwindow(point_up = new TracerPointUp(this, x1, y));
123         y += point_x->get_h() + margin;
124         add_subwindow(title_y = new BC_Title(x, y, _("Y:")));
125         x1 = x + title_y->get_w() + margin;
126         point_y = new TracerPointY(this, x1, y, !pt ? 0 : pt->y);
127         point_y->create_objects();
128         x1 += point_y->get_w() + margin;
129         add_subwindow(del_point = new TracerDelPoint(this, plugin, x1, y));
130         x1 += del_point->get_w() + margin;
131         add_subwindow(point_dn = new TracerPointDn(this, x1, y));
132         y += point_y->get_h() + margin + 10;
133
134         add_subwindow(drag = new TracerDrag(this, x, y));
135         if( plugin->config.drag ) {
136                 if( !grab(plugin->server->mwindow->cwindow->gui) )
137                         eprintf("drag enabled, but compositor already grabbed\n");
138         }
139         x1 = x + drag->get_w() + margin + 20;
140         add_subwindow(draw = new TracerDraw(this, x1, y));
141         x1 += draw->get_w() + margin + 20;
142         add_subwindow(fill = new TracerFill(this, x1, y));
143         x1 += drag->get_w() + margin + 20;
144         int y1 = y + 3;
145         add_subwindow(reset = new TracerReset(this, plugin, x1, y1));
146         y1 += reset->get_h() + margin;
147         add_subwindow(invert = new TracerInvert(this, plugin, x1, y1));
148         y += drag->get_h() + margin + 15;
149
150         x1 = x + 80;
151         add_subwindow(title_r = new BC_Title(x, y, _("Feather:")));
152         add_subwindow(feather = new TracerFeather(this, x1, y, 150));
153         y += feather->get_h() + margin;
154         add_subwindow(title_s = new BC_Title(x, y, _("Radius:")));
155         add_subwindow(radius = new TracerRadius(this, x1, y, 150));
156         y += radius->get_h() + margin + 5;
157
158         add_subwindow(point_list = new TracerPointList(this, plugin, x, y));
159         point_list->update(plugin->config.selected);
160         y += point_list->get_h() + 10;
161
162         add_subwindow(new BC_Title(x, y, _(
163                 "Btn1: select/drag point\n"
164                 "Btn2: drag all points\n"
165                 "Btn3: add point on nearest line\n"
166                 "Btn3: shift: append point to end\n"
167                 "Wheel: rotate, centered on cursor\n"
168                 "Wheel: shift: scale, centered on cursor\n")));
169         show_window(1);
170 }
171
172 void TracerWindow::send_configure_change()
173 {
174         pending_config = 0;
175         plugin->send_configure_change();
176 }
177
178 int TracerWindow::grab_event(XEvent *event)
179 {
180         int ret = do_grab_event(event);
181         if( pending_config && !grab_event_count() )
182                 send_configure_change();
183         return ret;
184 }
185
186 int TracerWindow::do_grab_event(XEvent *event)
187 {
188         switch( event->type ) {
189         case ButtonPress: break;
190         case ButtonRelease: break;
191         case MotionNotify: break;
192         default:
193                 return 0;
194         }
195
196         MWindow *mwindow = plugin->server->mwindow;
197         CWindowGUI *cwindow_gui = mwindow->cwindow->gui;
198         CWindowCanvas *canvas = cwindow_gui->canvas;
199         int cursor_x, cursor_y;
200         cwindow_gui->get_relative_cursor(cursor_x, cursor_y);
201         cursor_x -= canvas->view_x;
202         cursor_y -= canvas->view_y;
203
204         if( !button_no ) {
205                 if( cursor_x < 0 || cursor_x >= canvas->view_w ||
206                     cursor_y < 0 || cursor_y >= canvas->view_h )
207                         return 0;
208         }
209
210         switch( event->type ) {
211         case ButtonPress:
212                 if( button_no ) return 0;
213                 button_no = event->xbutton.button;
214                 break;
215         case ButtonRelease:
216                 if( !button_no ) return 0;
217                 button_no = 0;
218                 return 1;
219         case MotionNotify:
220                 if( !button_no ) return 0;
221                 break;
222         default:
223                 return 0;
224         }
225
226         float output_x = cursor_x, output_y = cursor_y, track_x, track_y;
227         canvas->canvas_to_output(mwindow->edl, 0, output_x, output_y);
228         plugin->output_to_track(output_x, output_y, track_x, track_y);
229         point_x->update((int64_t)track_x);
230         point_y->update((int64_t)track_y);
231         TracerPoints &points = plugin->config.points;
232
233         switch( event->type ) {
234         case ButtonPress: {
235                 float s = 1.02;
236                 float th = M_PI/360.f; // .5 deg per wheel_btn
237                 int shift_down = event->xbutton.state & ShiftMask;
238                 switch( button_no ) {
239                 case WHEEL_DOWN:
240                         s = 0.98;
241                         th = -th;  // fall thru
242                 case WHEEL_UP: {
243                         // shift_down scale, !shift_down rotate
244                         float st = sin(th), ct = cos(th);
245                         int sz = points.size();
246                         for( int i=0; i<sz; ++i ) {
247                                 TracerPoint *pt = points[i];
248                                 float px = pt->x - track_x, py = pt->y - track_y;
249                                 float nx = shift_down ? px*s : px*ct + py*st;
250                                 float ny = shift_down ? py*s : py*ct - px*st;
251                                 point_list->set_point(i, PT_X, pt->x = nx + track_x);
252                                 point_list->set_point(i, PT_Y, pt->y = ny + track_y);
253                         }
254                         point_list->update(-1);
255                         button_no = 0;
256                         break; }
257                 case RIGHT_BUTTON: {
258                         // shift_down adds to end
259                         int sz = !shift_down ? points.size() : 0;
260                         int k = !shift_down ? -1 : points.size()-1;
261                         float mx = FLT_MAX;
262                         for( int i=0; i<sz; ++i ) {
263                                 // pt on line pt[i+0]..pt[i+1] nearest cursor_x,cursor_y
264                                 TracerPoint *pt0 = points[i+0];
265                                 TracerPoint *pt1 = i+1<sz ? points[i+1] : points[0];
266                                 float x0 = pt0->x, y0 = pt0->y;
267                                 float x1 = pt1->x, y1 = pt1->y;
268                                 float dx = x1-x0, dy = y1-y0;
269                                 float rr = dx*dx + dy*dy;
270                                 if( !rr ) continue;
271                                 float u = ((x1-track_x)*dx + (y1-track_y)*dy) / rr;
272                                 if( u < 0 || u > 1 ) continue;  // past endpts
273                                 float x = x0*u + x1*(1-u);
274                                 float y = y0*u + y1*(1-u);
275                                 dx = track_x-x;  dy = track_y-y;
276                                 float dd = dx*dx + dy*dy;       // d**2 closest approach
277                                 if( mx > dd ) { mx = dd;  k = i; }
278                         }
279                         TracerPoint *pt = points[sz=plugin->new_point()];
280                         int hot_point = k+1;
281                         for( int i=sz; i>hot_point; --i ) points[i] = points[i-1];
282                         points[hot_point] = pt;
283                         pt->x = track_x;  pt->y = track_y;
284                         point_list->update(hot_point);
285                         break; }
286                 case LEFT_BUTTON: {
287                         int hot_point = -1, sz = points.size();
288                         if( sz > 0 ) {
289                                 TracerPoint *pt = points[hot_point=0];
290                                 double dist = DISTANCE(track_x,track_y, pt->x,pt->y);
291                                 for( int i=1; i<sz; ++i ) {
292                                         pt = points[i];
293                                         double d = DISTANCE(track_x,track_y, pt->x,pt->y);
294                                         if( d >= dist ) continue;
295                                         dist = d;  hot_point = i;
296                                 }
297                                 pt = points[hot_point];
298                                 float cx, cy;
299                                 plugin->track_to_output(pt->x, pt->y, cx, cy);
300                                 canvas->output_to_canvas(mwindow->edl, 0, cx, cy);
301                                 dist = DISTANCE(cursor_x, cursor_y, cx,cy);
302                                 if( dist >= HANDLE_W ) hot_point = -1;
303                         }
304                         if( hot_point >= 0 && sz > 0 ) {
305                                 TracerPoint *pt = points[hot_point];
306                                 point_list->set_point(hot_point, PT_X, pt->x = track_x);
307                                 point_list->set_point(hot_point, PT_Y, pt->y = track_y);
308                                 point_list->update_list(hot_point);
309                         }
310                         break; }
311                 }
312                 break; }
313         case MotionNotify: {
314                 switch( button_no ) {
315                 case LEFT_BUTTON: {
316                         int hot_point = point_list->get_selection_number(0, 0);
317                         if( hot_point >= 0 && hot_point < points.size() ) {
318                                 TracerPoint *pt = points[hot_point];
319                                 if( pt->x == track_x && pt->y == track_y ) break;
320                                 point_list->set_point(hot_point, PT_X, pt->x = track_x);
321                                 point_list->set_point(hot_point, PT_Y, pt->y = track_y);
322                                 point_x->update(pt->x);
323                                 point_y->update(pt->y);
324                                 point_list->update_list(hot_point);
325                         }
326                         break; }
327                 case MIDDLE_BUTTON: {
328                         float dx = track_x - last_x, dy = track_y - last_y;
329                         int sz = points.size();
330                         for( int i=0; i<sz; ++i ) {
331                                 TracerPoint *pt = points[i];
332                                 point_list->set_point(i, PT_X, pt->x += dx);
333                                 point_list->set_point(i, PT_Y, pt->y += dy);
334                         }
335                         int hot_point = point_list->get_selection_number(0, 0);
336                         if( hot_point >= 0 && hot_point < sz ) {
337                                 TracerPoint *pt = points[hot_point];
338                                 point_x->update(pt->x);
339                                 point_y->update(pt->y);
340                                 point_list->update_list(hot_point);
341                         }
342                         break; }
343                 }
344                 break; }
345         }
346
347         last_x = track_x;  last_y = track_y;
348         pending_config = 1;
349         return 1;
350 }
351
352 void TracerWindow::done_event(int result)
353 {
354         ungrab(client->server->mwindow->cwindow->gui);
355 }
356
357 TracerPointList::TracerPointList(TracerWindow *gui, Tracer *plugin, int x, int y)
358  : BC_ListBox(x, y, 360, 130, LISTBOX_TEXT)
359 {
360         this->gui = gui;
361         this->plugin = plugin;
362         titles[PT_X] = _("X");    widths[PT_X] = 90;
363         titles[PT_Y] = _("Y");    widths[PT_Y] = 90;
364 }
365 TracerPointList::~TracerPointList()
366 {
367         clear();
368 }
369 void TracerPointList::clear()
370 {
371         for( int i=PT_SZ; --i>=0; )
372                 cols[i].remove_all_objects();
373 }
374
375 int TracerPointList::column_resize_event()
376 {
377         for( int i=PT_SZ; --i>=0; )
378                 widths[i] = get_column_width(i);
379         return 1;
380 }
381
382 int TracerPointList::handle_event()
383 {
384         int hot_point = get_selection_number(0, 0);
385         const char *x_text = "", *y_text = "";
386         TracerPoints &points = plugin->config.points;
387
388         int sz = points.size();
389         if( hot_point >= 0 && sz > 0 ) {
390                 x_text = gui->point_list->cols[PT_X].get(hot_point)->get_text();
391                 y_text = gui->point_list->cols[PT_Y].get(hot_point)->get_text();
392         }
393         gui->point_x->update(x_text);
394         gui->point_y->update(y_text);
395         update(hot_point);
396         gui->send_configure_change();
397         return 1;
398 }
399
400 int TracerPointList::selection_changed()
401 {
402         handle_event();
403         return 1;
404 }
405
406 void TracerPointList::new_point(const char *xp, const char *yp)
407 {
408         cols[PT_X].append(new BC_ListBoxItem(xp));
409         cols[PT_Y].append(new BC_ListBoxItem(yp));
410 }
411
412 void TracerPointList::del_point(int i)
413 {
414         for( int sz1=cols[0].size()-1, c=PT_SZ; --c>=0; )
415                 cols[c].remove_object_number(sz1-i);
416 }
417
418 void TracerPointList::set_point(int i, int c, float v)
419 {
420         char s[BCSTRLEN]; sprintf(s,"%0.4f",v);
421         set_point(i,c,s);
422 }
423 void TracerPointList::set_point(int i, int c, const char *cp)
424 {
425         cols[c].get(i)->set_text(cp);
426 }
427
428 int TracerPointList::set_selected(int k)
429 {
430         TracerPoints &points = plugin->config.points;
431         int sz = points.size();
432         if( !sz ) return -1;
433         bclamp(k, 0, sz-1);
434         update_selection(&cols[0], k);
435         return k;
436 }
437 void TracerPointList::update_list(int k)
438 {
439         int sz = plugin->config.points.size();
440         if( k < 0 || k >= sz ) k = -1;
441         plugin->config.selected = k;
442         update_selection(&cols[0], k);
443         int xpos = get_xposition(), ypos = get_yposition();
444         BC_ListBox::update(&cols[0], &titles[0],&widths[0],PT_SZ, xpos,ypos,k);
445         center_selection();
446 }
447 void TracerPointList::update(int k)
448 {
449         clear();
450         TracerPoints &points = plugin->config.points;
451         int sz = points.size();
452         for( int i=0; i<sz; ++i ) {
453                 TracerPoint *pt = points[i];
454                 char xtxt[BCSTRLEN];  sprintf(xtxt,"%0.4f", pt->x);
455                 char ytxt[BCSTRLEN];  sprintf(ytxt,"%0.4f", pt->y);
456                 new_point(xtxt, ytxt);
457         }
458         if( k >= 0 && k < sz ) {
459                 gui->point_x->update(gui->point_list->cols[PT_X].get(k)->get_text());
460                 gui->point_y->update(gui->point_list->cols[PT_Y].get(k)->get_text());
461         }
462         update_list(k);
463 }
464
465 void TracerWindow::update_gui()
466 {
467         TracerConfig &config = plugin->config;
468         drag->update(config.drag);
469         draw->update(config.draw);
470         fill->update(config.fill);
471         feather->update(config.feather);
472         radius->update(config.radius);
473         invert->update(config.invert);
474         point_list->update(-1);
475 }
476
477
478 TracerPointUp::TracerPointUp(TracerWindow *gui, int x, int y)
479  : BC_GenericButton(x, y, _("Up"))
480 {
481         this->gui = gui;
482 }
483 TracerPointUp::~TracerPointUp()
484 {
485 }
486
487 int TracerPointUp::handle_event()
488 {
489         TracerPoints &points = gui->plugin->config.points;
490         int sz = points.size();
491         int hot_point = gui->point_list->get_selection_number(0, 0);
492
493         if( sz > 1 && hot_point > 0 ) {
494                 TracerPoint *&pt0 = points[hot_point];
495                 TracerPoint *&pt1 = points[--hot_point];
496                 TracerPoint *t = pt0;  pt0 = pt1;  pt1 = t;
497                 gui->point_list->update(hot_point);
498         }
499         gui->send_configure_change();
500         return 1;
501 }
502
503 TracerPointDn::TracerPointDn(TracerWindow *gui, int x, int y)
504  : BC_GenericButton(x, y, _("Dn"))
505 {
506         this->gui = gui;
507 }
508 TracerPointDn::~TracerPointDn()
509 {
510 }
511
512 int TracerPointDn::handle_event()
513 {
514         TracerPoints &points = gui->plugin->config.points;
515         int sz = points.size();
516         int hot_point = gui->point_list->get_selection_number(0, 0);
517         if( sz > 1 && hot_point < sz-1 ) {
518                 TracerPoint *&pt0 = points[hot_point];
519                 TracerPoint *&pt1 = points[++hot_point];
520                 TracerPoint *t = pt0;  pt0 = pt1;  pt1 = t;
521                 gui->point_list->update(hot_point);
522         }
523         gui->send_configure_change();
524         return 1;
525 }
526
527 TracerDrag::TracerDrag(TracerWindow *gui, int x, int y)
528  : BC_CheckBox(x, y, gui->plugin->config.drag, _("Drag"))
529 {
530         this->gui = gui;
531 }
532 int TracerDrag::handle_event()
533 {
534         CWindowGUI *cwindow_gui = gui->plugin->server->mwindow->cwindow->gui;
535         int value = get_value();
536         if( value ) {
537                 if( !gui->grab(cwindow_gui) ) {
538                         update(value = 0);
539                         flicker(10,50);
540                 }
541         }
542         else
543                 gui->ungrab(cwindow_gui);
544         gui->plugin->config.drag = value;
545         gui->send_configure_change();
546         return 1;
547 }
548
549 TracerDraw::TracerDraw(TracerWindow *gui, int x, int y)
550  : BC_CheckBox(x, y, gui->plugin->config.draw, _("Draw"))
551 {
552         this->gui = gui;
553 }
554 int TracerDraw::handle_event()
555 {
556         gui->plugin->config.draw = get_value();
557         gui->send_configure_change();
558         return 1;
559 }
560
561 TracerFill::TracerFill(TracerWindow *gui, int x, int y)
562  : BC_CheckBox(x, y, gui->plugin->config.fill, _("Fill"))
563 {
564         this->gui = gui;
565 }
566 int TracerFill::handle_event()
567 {
568         gui->plugin->config.fill = get_value();
569         gui->send_configure_change();
570         return 1;
571 }
572
573 TracerFeather::TracerFeather(TracerWindow *gui, int x, int y, int w)
574  : BC_ISlider(x,y,0,w,w, -50,50, gui->plugin->config.feather)
575 {
576         this->gui = gui;
577 }
578 int TracerFeather::handle_event()
579 {
580         gui->plugin->config.feather = get_value();
581         gui->send_configure_change();
582         return 1;
583 }
584
585 TracerRadius::TracerRadius(TracerWindow *gui, int x, int y, int w)
586  : BC_FSlider(x,y, 0,w,w, -5.f,5.f, gui->plugin->config.radius)
587 {
588         this->gui = gui;
589 }
590 int TracerRadius::handle_event()
591 {
592         gui->plugin->config.radius = get_value();
593         gui->send_configure_change();
594         return 1;
595 }
596
597 TracerNewPoint::TracerNewPoint(TracerWindow *gui, Tracer *plugin, int x, int y)
598  : BC_GenericButton(x, y, 80, _("New"))
599 {
600         this->gui = gui;
601         this->plugin = plugin;
602 }
603 TracerNewPoint::~TracerNewPoint()
604 {
605 }
606 int TracerNewPoint::handle_event()
607 {
608         int k = plugin->new_point();
609         gui->point_list->update(k);
610         gui->send_configure_change();
611         return 1;
612 }
613
614 TracerDelPoint::TracerDelPoint(TracerWindow *gui, Tracer *plugin, int x, int y)
615  : BC_GenericButton(x, y, 80, C_("Del"))
616 {
617         this->gui = gui;
618         this->plugin = plugin;
619 }
620 TracerDelPoint::~TracerDelPoint()
621 {
622 }
623 int TracerDelPoint::handle_event()
624 {
625         int hot_point = gui->point_list->get_selection_number(0, 0);
626         TracerPoints &points = plugin->config.points;
627         if( hot_point >= 0 && hot_point < points.size() ) {
628                 plugin->config.del_point(hot_point);
629                 gui->point_list->update(--hot_point);
630                 gui->send_configure_change();
631         }
632         return 1;
633 }
634
635 TracerReset::TracerReset(TracerWindow *gui, Tracer *plugin, int x, int y)
636  : BC_GenericButton(x, y, _("Reset"))
637 {
638         this->gui = gui;
639         this->plugin = plugin;
640 }
641 TracerReset::~TracerReset()
642 {
643 }
644 int TracerReset::handle_event()
645 {
646         TracerConfig &config = plugin->config;
647         if( !config.drag ) {
648                 MWindow *mwindow = plugin->server->mwindow;
649                 CWindowGUI *cwindow_gui = mwindow->cwindow->gui;
650                 if( gui->grab(cwindow_gui) )
651                         config.drag = 1;
652                 else
653                         gui->drag->flicker(10,50);
654         }
655         config.draw = 1;
656         config.fill = 0;
657         config.invert = 0;
658         config.feather = 0;
659         config.radius = 1;
660         config.selected = -1;
661         TracerPoints &points = plugin->config.points;
662         points.remove_all_objects();
663         gui->point_list->update(-1);
664         gui->update_gui();
665         gui->send_configure_change();
666         return 1;
667 }
668
669 TracerInvert::TracerInvert(TracerWindow *gui, Tracer *plugin, int x, int y)
670  : BC_CheckBox(x, y, gui->plugin->config.invert, _("Invert"))
671 {
672         this->gui = gui;
673         this->plugin = plugin;
674 }
675 TracerInvert::~TracerInvert()
676 {
677 }
678 int TracerInvert::handle_event()
679 {
680         plugin->config.invert = get_value();
681         gui->send_configure_change();
682         return 1;
683 }
684