a00c48c418af4c6589a1ea418b2d3ea0de85a04b
[goodguy/cinelerra.git] / cinelerra-5.1 / plugins / crikey / crikeywindow.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 "crikey.h"
25 #include "crikeywindow.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 CriKeyNum::CriKeyNum(CriKeyWindow *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 CriKeyNum::~CriKeyNum()
51 {
52 }
53
54 int CriKeyPointX::handle_event()
55 {
56         if( !CriKeyNum::handle_event() ) return 0;
57         CriKeyPointList *point_list = gui->point_list;
58         int hot_point = point_list->get_selection_number(0, 0);
59         CriKeyPoints &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 CriKeyPointY::handle_event()
71 {
72         if( !CriKeyNum::handle_event() ) return 0;
73         CriKeyPointList *point_list = gui->point_list;
74         int hot_point = point_list->get_selection_number(0, 0);
75         CriKeyPoints &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 int CriKeyDrawModeItem::handle_event()
88 {
89         ((CriKeyDrawMode *)get_popup_menu())->update(id);
90         return 1;
91 }
92 CriKeyDrawMode::CriKeyDrawMode(CriKeyWindow *gui, int x, int y)
93  : BC_PopupMenu(x, y, 100, "", 1)
94 {
95         this->gui = gui;
96         draw_modes[DRAW_ALPHA]     = _("Alpha");
97         draw_modes[DRAW_EDGE]      = _("Edge");
98         draw_modes[DRAW_MASK]      = _("Mask");
99         mode = -1;
100 }
101 void CriKeyDrawMode::create_objects()
102 {
103         for( int i=0; i<DRAW_MODES; ++i )
104                 add_item(new CriKeyDrawModeItem(draw_modes[i], i));
105         update(gui->plugin->config.draw_mode, 0);
106 }
107 void CriKeyDrawMode::update(int mode, int send)
108 {
109         if( this->mode == mode ) return;
110         this->mode = mode;
111         set_text(draw_modes[mode]);
112         gui->plugin->config.draw_mode = mode;
113         if( send ) gui->send_configure_change();
114 }
115
116
117 CriKeyWindow::CriKeyWindow(CriKey *plugin)
118  : PluginClientWindow(plugin, 380, 400, 380, 400, 0)
119 {
120         this->plugin = plugin;
121         this->title_x = 0;    this->point_x = 0;
122         this->title_y = 0;    this->point_y = 0;
123         this->new_point = 0;  this->del_point = 0;
124         this->point_up = 0;   this->point_dn = 0;
125         this->drag = 0;       this->dragging = 0;
126         this->last_x = 0;     this->last_y = 0;
127         this->point_list = 0; this->pending_config = 0;
128 }
129
130 CriKeyWindow::~CriKeyWindow()
131 {
132         delete point_x;
133         delete point_y;
134 }
135
136 void CriKeyWindow::create_objects()
137 {
138         int x = 10, y = 10;
139         int margin = plugin->get_theme()->widget_border;
140         BC_Title *title;
141         add_subwindow(title = new BC_Title(x, y+5, _("Draw mode:")));
142         int x1 = x + title->get_w() + 10 + margin;
143         add_subwindow(draw_mode = new CriKeyDrawMode(this, x1, y));
144         draw_mode->create_objects();
145         y += draw_mode->get_h() + 10 + margin;
146
147         CriKeyPoint *pt = plugin->config.points[plugin->config.selected];
148         add_subwindow(title_x = new BC_Title(x, y, _("X:")));
149         x1 = x + title_x->get_w() + margin;
150         point_x = new CriKeyPointX(this, x1, y, pt->x);
151         point_x->create_objects();
152         x1 += point_x->get_w() + margin;
153         add_subwindow(new_point = new CriKeyNewPoint(this, plugin, x1, y));
154         x1 += new_point->get_w() + margin;
155         add_subwindow(point_up = new CriKeyPointUp(this, x1, y));
156         y += point_x->get_h() + margin;
157         add_subwindow(title_y = new BC_Title(x, y, _("Y:")));
158         x1 = x + title_y->get_w() + margin;
159         point_y = new CriKeyPointY(this, x1, y, pt->y);
160         point_y->create_objects();
161         x1 += point_y->get_w() + margin;
162         add_subwindow(del_point = new CriKeyDelPoint(this, plugin, x1, y));
163         x1 += del_point->get_w() + margin;
164         add_subwindow(point_dn = new CriKeyPointDn(this, x1, y));
165         y += point_y->get_h() + margin + 10;
166         add_subwindow(title = new BC_Title(x, y, _("Threshold:")));
167         y += title->get_h() + margin;
168         add_subwindow(threshold = new CriKeyThreshold(this, x, y, get_w() - x * 2));
169         y += threshold->get_h() + margin;
170
171         add_subwindow(drag = new CriKeyDrag(this, x, y));
172         if( plugin->config.drag ) {
173                 if( !grab(plugin->server->mwindow->cwindow->gui) )
174                         eprintf("drag enabled, but compositor already grabbed\n");
175         }
176         x1 = x + drag->get_w() + margin + 32;
177         add_subwindow(reset = new CriKeyReset(this, plugin, x1, y+3));
178         y += drag->get_h() + margin;
179
180         add_subwindow(point_list = new CriKeyPointList(this, plugin, x, y));
181         point_list->update(plugin->config.selected);
182
183         y += point_list->get_h() + 10;
184         add_subwindow(notes = new BC_Title(x, y,
185                  _("Right click in composer: create new point\n"
186                    "Shift-left click in Enable field:\n"
187                    "  if any off, turns all on\n"
188                    "  if all on, turns rest off.")));
189         show_window(1);
190 }
191
192 void CriKeyWindow::send_configure_change()
193 {
194         pending_config = 0;
195         plugin->send_configure_change();
196 }
197
198 int CriKeyWindow::grab_event(XEvent *event)
199 {
200         int ret = do_grab_event(event);
201         if( pending_config && !grab_event_count() )
202                 send_configure_change();
203         return ret;
204 }
205
206 int CriKeyWindow::do_grab_event(XEvent *event)
207 {
208         switch( event->type ) {
209         case ButtonPress: break;
210         case ButtonRelease: break;
211         case MotionNotify: break;
212         default:
213                 return 0;
214         }
215
216         MWindow *mwindow = plugin->server->mwindow;
217         CWindowGUI *cwindow_gui = mwindow->cwindow->gui;
218         CWindowCanvas *canvas = cwindow_gui->canvas;
219         int cx, cy;  cwindow_gui->get_relative_cursor(cx, cy);
220         cx -= canvas->view_x;
221         cy -= canvas->view_y;
222
223         if( !dragging ) {
224                 if( cx < 0 || cx >= canvas->view_w ||
225                     cy < 0 || cy >= canvas->view_h )
226                         return 0;
227         }
228
229         switch( event->type ) {
230         case ButtonPress:
231                 if( dragging ) return 0;
232                 if( event->xbutton.button == WHEEL_UP )  return threshold->wheel_event(1);
233                 if( event->xbutton.button == WHEEL_DOWN ) return threshold->wheel_event(-1);
234                 dragging = event->xbutton.state & ShiftMask ? -1 : 1;
235                 break;
236         case ButtonRelease:
237                 if( !dragging ) return 0;
238                 dragging = 0;
239                 return 1;
240         case MotionNotify:
241                 if( !dragging ) return 0;
242                 break;
243         default:
244                 return 0;
245         }
246
247         float cursor_x = cx, cursor_y = cy;
248         canvas->canvas_to_output(mwindow->edl, 0, cursor_x, cursor_y);
249         int64_t position = plugin->get_source_position();
250         float projector_x, projector_y, projector_z;
251         Track *track = plugin->server->plugin->track;
252         int track_w = track->track_w, track_h = track->track_h;
253         track->automation->get_projector(
254                 &projector_x, &projector_y, &projector_z,
255                 position, PLAY_FORWARD);
256         projector_x += mwindow->edl->session->output_w / 2;
257         projector_y += mwindow->edl->session->output_h / 2;
258         float output_x = (cursor_x - projector_x) / projector_z + track_w / 2;
259         float output_y = (cursor_y - projector_y) / projector_z + track_h / 2;
260         point_x->update((int64_t)(output_x));
261         point_y->update((int64_t)(output_y));
262         CriKeyPoints &points = plugin->config.points;
263
264         if( dragging > 0 ) {
265                 switch( event->type ) {
266                 case ButtonPress: {
267                         int button_no = event->xbutton.button;
268                         int hot_point = -1;
269                         if( button_no == RIGHT_BUTTON ) {
270                                 hot_point = plugin->new_point();
271                                 CriKeyPoint *pt = points[hot_point];
272                                 pt->x = output_x;  pt->y = output_y;
273                                 point_list->update(hot_point);
274                                 break;
275                         }
276                         int sz = points.size();
277                         if( hot_point < 0 && sz > 0 ) {
278                                 CriKeyPoint *pt = points[hot_point=0];
279                                 double dist = DISTANCE(output_x,output_y, pt->x,pt->y);
280                                 for( int i=1; i<sz; ++i ) {
281                                         pt = points[i];
282                                         double d = DISTANCE(output_x,output_y, pt->x,pt->y);
283                                         if( d >= dist ) continue;
284                                         dist = d;  hot_point = i;
285                                 }
286                                 pt = points[hot_point];
287                                 float px = (pt->x - track_w / 2) * projector_z + projector_x;
288                                 float py = (pt->y - track_h / 2) * projector_z + projector_y;
289                                 dist = DISTANCE(px, py, cursor_x,cursor_y);
290                                 if( dist >= HANDLE_W ) hot_point = -1;
291                         }
292                         if( hot_point >= 0 && sz > 0 ) {
293                                 CriKeyPoint *pt = points[hot_point];
294                                 point_list->set_point(hot_point, PT_X, pt->x = output_x);
295                                 point_list->set_point(hot_point, PT_Y, pt->y = output_y);
296                                 for( int i=0; i<sz; ++i ) {
297                                         pt = points[i];
298                                         pt->e = i==hot_point ? !pt->e : 0;
299                                         point_list->set_point(i, PT_E, pt->e ? "*" : "");
300                                 }
301                                 point_list->update_list(hot_point);
302                         }
303                         break; }
304                 case MotionNotify: {
305                         int hot_point = point_list->get_selection_number(0, 0);
306                         if( hot_point >= 0 && hot_point < points.size() ) {
307                                 CriKeyPoint *pt = points[hot_point];
308                                 if( pt->x == output_x && pt->y == output_y ) break;
309                                 point_list->set_point(hot_point, PT_X, pt->x = output_x);
310                                 point_list->set_point(hot_point, PT_Y, pt->y = output_y);
311                                 point_x->update(pt->x);
312                                 point_y->update(pt->y);
313                                 point_list->update_list(hot_point);
314                         }
315                         break; }
316                 }
317         }
318         else {
319                 switch( event->type ) {
320                 case MotionNotify: {
321                         float dx = output_x - last_x, dy = output_y - last_y;
322                         int sz = points.size();
323                         for( int i=0; i<sz; ++i ) {
324                                 CriKeyPoint *pt = points[i];
325                                 point_list->set_point(i, PT_X, pt->x += dx);
326                                 point_list->set_point(i, PT_Y, pt->y += dy);
327                         }
328                         int hot_point = point_list->get_selection_number(0, 0);
329                         if( hot_point >= 0 && hot_point < sz ) {
330                                 CriKeyPoint *pt = points[hot_point];
331                                 point_x->update(pt->x);
332                                 point_y->update(pt->y);
333                                 point_list->update_list(hot_point);
334                         }
335                         break; }
336                 }
337         }
338
339         last_x = output_x;  last_y = output_y;
340         pending_config = 1;
341         return 1;
342 }
343
344 void CriKeyWindow::done_event(int result)
345 {
346         ungrab(client->server->mwindow->cwindow->gui);
347 }
348
349 CriKeyPointList::CriKeyPointList(CriKeyWindow *gui, CriKey *plugin, int x, int y)
350  : BC_ListBox(x, y, 360, 130, LISTBOX_TEXT)
351 {
352         this->gui = gui;
353         this->plugin = plugin;
354         titles[PT_E] = _("E");    widths[PT_E] = 50;
355         titles[PT_X] = _("X");    widths[PT_X] = 90;
356         titles[PT_Y] = _("Y");    widths[PT_Y] = 90;
357         titles[PT_T] = _("T");    widths[PT_T] = 70;
358         titles[PT_TAG] = _("Tag");  widths[PT_TAG] = 50;
359 }
360 CriKeyPointList::~CriKeyPointList()
361 {
362         clear();
363 }
364 void CriKeyPointList::clear()
365 {
366         for( int i=PT_SZ; --i>=0; )
367                 cols[i].remove_all_objects();
368 }
369
370 int CriKeyPointList::column_resize_event()
371 {
372         for( int i=PT_SZ; --i>=0; )
373                 widths[i] = get_column_width(i);
374         return 1;
375 }
376
377 int CriKeyPointList::handle_event()
378 {
379         int hot_point = get_selection_number(0, 0);
380         const char *x_text = "", *y_text = "";
381         float t = plugin->config.threshold;
382         CriKeyPoints &points = plugin->config.points;
383
384         int sz = points.size();
385         if( hot_point >= 0 && sz > 0 ) {
386                 if( get_cursor_x() < widths[0] ) {
387                         if( shift_down() ) {
388                                 int all_on = points[0]->e;
389                                 for( int i=1; i<sz && all_on; ++i ) all_on = points[i]->e;
390                                 int e = !all_on ? 1 : 0;
391                                 for( int i=0; i<sz; ++i ) points[i]->e = e;
392                                 points[hot_point]->e = 1;
393                         }
394                         else
395                                 points[hot_point]->e = !points[hot_point]->e;
396                 }
397                 x_text = gui->point_list->cols[PT_X].get(hot_point)->get_text();
398                 y_text = gui->point_list->cols[PT_Y].get(hot_point)->get_text();
399                 t = points[hot_point]->t;
400         }
401         gui->point_x->update(x_text);
402         gui->point_y->update(y_text);
403         gui->threshold->update(t);
404         update(hot_point);
405         gui->send_configure_change();
406         return 1;
407 }
408
409 int CriKeyPointList::selection_changed()
410 {
411         handle_event();
412         return 1;
413 }
414
415 void CriKeyPointList::new_point(const char *ep, const char *xp, const char *yp,
416                 const char *tp, const char *tag)
417 {
418         cols[PT_E].append(new BC_ListBoxItem(ep));
419         cols[PT_X].append(new BC_ListBoxItem(xp));
420         cols[PT_Y].append(new BC_ListBoxItem(yp));
421         cols[PT_T].append(new BC_ListBoxItem(tp));
422         cols[PT_TAG].append(new BC_ListBoxItem(tag));
423 }
424
425 void CriKeyPointList::del_point(int i)
426 {
427         for( int sz1=cols[0].size()-1, c=PT_SZ; --c>=0; )
428                 cols[c].remove_object_number(sz1-i);
429 }
430
431 void CriKeyPointList::set_point(int i, int c, float v)
432 {
433         char s[BCSTRLEN]; sprintf(s,"%0.4f",v);
434         set_point(i,c,s);
435 }
436 void CriKeyPointList::set_point(int i, int c, const char *cp)
437 {
438         cols[c].get(i)->set_text(cp);
439 }
440
441 int CriKeyPointList::set_selected(int k)
442 {
443         CriKeyPoints &points = plugin->config.points;
444         int sz = points.size();
445         if( !sz ) return -1;
446         bclamp(k, 0, sz-1);
447         for( int i=0; i<sz; ++i ) points[i]->e = 0;
448         points[k]->e = 1;
449         update_selection(&cols[0], k);
450         return k;
451 }
452 void CriKeyPointList::update_list(int k)
453 {
454         int xpos = get_xposition(), ypos = get_yposition();
455         if( k < 0 ) k = get_selection_number(0, 0);
456         update_selection(&cols[0], k);
457         BC_ListBox::update(&cols[0], &titles[0],&widths[0],PT_SZ, xpos,ypos,k);
458         center_selection();
459 }
460 void CriKeyPointList::update(int k)
461 {
462         clear();
463         CriKeyPoints &points = plugin->config.points;
464         int sz = points.size();
465         for( int i=0; i<sz; ++i ) {
466                 CriKeyPoint *pt = points[i];
467                 char etxt[BCSTRLEN];  sprintf(etxt,"%s", pt->e ? "*" : "");
468                 char xtxt[BCSTRLEN];  sprintf(xtxt,"%0.4f", pt->x);
469                 char ytxt[BCSTRLEN];  sprintf(ytxt,"%0.4f", pt->y);
470                 char ttxt[BCSTRLEN];  sprintf(ttxt,"%0.4f", pt->t);
471                 char ttag[BCSTRLEN];  sprintf(ttag,"%d", pt->tag);
472                 new_point(etxt, xtxt, ytxt, ttxt, ttag);
473         }
474         if( k >= 0 && k < sz ) {
475                 gui->point_x->update(gui->point_list->cols[PT_X].get(k)->get_text());
476                 gui->point_y->update(gui->point_list->cols[PT_Y].get(k)->get_text());
477                 plugin->config.selected = k;
478         }
479
480         update_list(k);
481 }
482
483 void CriKeyWindow::update_gui()
484 {
485         draw_mode->update(plugin->config.draw_mode);
486         threshold->update(plugin->config.threshold);
487         drag->update(plugin->config.drag);
488         point_list->update(-1);
489 }
490
491
492 CriKeyThreshold::CriKeyThreshold(CriKeyWindow *gui, int x, int y, int w)
493  : BC_FSlider(x, y, 0, w, w, 0, 1, gui->plugin->config.threshold, 0)
494 {
495         this->gui = gui;
496         set_precision(0.005);
497         set_pagination(0.01, 0.1);
498 }
499
500 int CriKeyThreshold::wheel_event(int v)
501 {
502         if( v > 0 ) increase_value();
503         else if( v < 0 ) decrease_value();
504         handle_event();
505         enable();
506         return 1;
507 }
508
509 int CriKeyThreshold::handle_event()
510 {
511         float v = get_value();
512         gui->plugin->config.threshold = v;
513         int hot_point = gui->point_list->get_selection_number(0, 0);
514         if( hot_point >= 0 ) {
515                 CriKeyPoints &points = gui->plugin->config.points;
516                 CriKeyPoint *pt = points[hot_point];
517                 pt->t = v;  pt->e = 1;
518                 gui->point_list->update(hot_point);
519         }
520         gui->send_configure_change();
521         return 1;
522 }
523
524
525 CriKeyPointUp::CriKeyPointUp(CriKeyWindow *gui, int x, int y)
526  : BC_GenericButton(x, y, _("Up"))
527 {
528         this->gui = gui;
529 }
530 CriKeyPointUp::~CriKeyPointUp()
531 {
532 }
533
534 int CriKeyPointUp::handle_event()
535 {
536         CriKeyPoints &points = gui->plugin->config.points;
537         int sz = points.size();
538         int hot_point = gui->point_list->get_selection_number(0, 0);
539
540         if( sz > 1 && hot_point > 0 ) {
541                 CriKeyPoint *&pt0 = points[hot_point];
542                 CriKeyPoint *&pt1 = points[--hot_point];
543                 CriKeyPoint *t = pt0;  pt0 = pt1;  pt1 = t;
544                 gui->point_list->update(hot_point);
545         }
546         gui->send_configure_change();
547         return 1;
548 }
549
550 CriKeyPointDn::CriKeyPointDn(CriKeyWindow *gui, int x, int y)
551  : BC_GenericButton(x, y, _("Dn"))
552 {
553         this->gui = gui;
554 }
555 CriKeyPointDn::~CriKeyPointDn()
556 {
557 }
558
559 int CriKeyPointDn::handle_event()
560 {
561         CriKeyPoints &points = gui->plugin->config.points;
562         int sz = points.size();
563         int hot_point = gui->point_list->get_selection_number(0, 0);
564         if( sz > 1 && hot_point < sz-1 ) {
565                 CriKeyPoint *&pt0 = points[hot_point];
566                 CriKeyPoint *&pt1 = points[++hot_point];
567                 CriKeyPoint *t = pt0;  pt0 = pt1;  pt1 = t;
568                 gui->point_list->update(hot_point);
569         }
570         gui->send_configure_change();
571         return 1;
572 }
573
574 CriKeyDrag::CriKeyDrag(CriKeyWindow *gui, int x, int y)
575  : BC_CheckBox(x, y, gui->plugin->config.drag, _("Drag"))
576 {
577         this->gui = gui;
578 }
579 int CriKeyDrag::handle_event()
580 {
581         CWindowGUI *cwindow_gui = gui->plugin->server->mwindow->cwindow->gui;
582         int value = get_value();
583         if( value ) {
584                 if( !gui->grab(cwindow_gui) ) {
585                         update(value = 0);
586                         flicker(10,50);
587                 }
588         }
589         else
590                 gui->ungrab(cwindow_gui);
591         gui->plugin->config.drag = value;
592         gui->send_configure_change();
593         return 1;
594 }
595
596 CriKeyNewPoint::CriKeyNewPoint(CriKeyWindow *gui, CriKey *plugin, int x, int y)
597  : BC_GenericButton(x, y, 80, _("New"))
598 {
599         this->gui = gui;
600         this->plugin = plugin;
601 }
602 CriKeyNewPoint::~CriKeyNewPoint()
603 {
604 }
605 int CriKeyNewPoint::handle_event()
606 {
607         int k = plugin->new_point();
608         gui->point_list->update(k);
609         gui->send_configure_change();
610         return 1;
611 }
612
613 CriKeyDelPoint::CriKeyDelPoint(CriKeyWindow *gui, CriKey *plugin, int x, int y)
614  : BC_GenericButton(x, y, 80, C_("Del"))
615 {
616         this->gui = gui;
617         this->plugin = plugin;
618 }
619 CriKeyDelPoint::~CriKeyDelPoint()
620 {
621 }
622 int CriKeyDelPoint::handle_event()
623 {
624         int hot_point = gui->point_list->get_selection_number(0, 0);
625         CriKeyPoints &points = plugin->config.points;
626         if( hot_point >= 0 && hot_point < points.size() ) {
627                 plugin->config.del_point(hot_point);
628                 if( !points.size() ) plugin->new_point();
629                 int sz = points.size();
630                 if( hot_point >= sz && hot_point > 0 ) --hot_point;
631                 gui->point_list->update(hot_point);
632                 gui->send_configure_change();
633         }
634         return 1;
635 }
636
637 CriKeyReset::CriKeyReset(CriKeyWindow *gui, CriKey *plugin, int x, int y)
638  : BC_GenericButton(x, y, _("Reset"))
639 {
640         this->gui = gui;
641         this->plugin = plugin;
642 }
643 CriKeyReset::~CriKeyReset()
644 {
645 }
646 int CriKeyReset::handle_event()
647 {
648         CriKeyPoints &points = plugin->config.points;
649         points.remove_all_objects();
650         plugin->new_point();
651         gui->point_list->update(0);
652         gui->send_configure_change();
653         return 1;
654 }
655