r864: Merge 2.1:
[cinelerra_cv/ct.git] / plugins / motion / motionwindow.C
blob9fe1c02a8ee45e310e9ac6472c7de3b325eeffc2
1 #include "bcdisplayinfo.h"
2 #include "clip.h"
3 #include "language.h"
4 #include "motion.h"
5 #include "motionwindow.h"
12 PLUGIN_THREAD_OBJECT(MotionMain, MotionThread, MotionWindow)
16 MotionWindow::MotionWindow(MotionMain *plugin, int x, int y)
17  : BC_Window(plugin->gui_string, 
18         x,
19         y,
20         600, 
21         650, 
22         600,
23         650,
24         0, 
25         1)
27         this->plugin = plugin; 
30 MotionWindow::~MotionWindow()
34 int MotionWindow::create_objects()
36         int x1 = 10, x = 10, y = 10;
37         int x2 = 310;
38         BC_Title *title;
42         add_subwindow(global = new MotionGlobal(plugin,
43                 this,
44                 x1,
45                 y));
47         add_subwindow(rotate = new MotionRotate(plugin,
48                 this,
49                 x2,
50                 y));
51         y += 50;
53         add_subwindow(title = new BC_Title(x1, 
54                 y, 
55                 _("Translation search radius:\n(W/H Percent of image)")));
56         add_subwindow(global_range_w = new GlobalRange(plugin, 
57                 x1 + title->get_w() + 10, 
58                 y,
59                 &plugin->config.global_range_w));
60         add_subwindow(global_range_h = new GlobalRange(plugin, 
61                 x1 + title->get_w() + 10 + global_range_w->get_w(), 
62                 y,
63                 &plugin->config.global_range_h));
65         add_subwindow(title = new BC_Title(x2, 
66                 y, 
67                 _("Rotation search radius:\n(Degrees)")));
68         add_subwindow(rotation_range = new RotationRange(plugin, 
69                 x2 + title->get_w() + 10, 
70                 y));
72         y += 50;
73         add_subwindow(title = new BC_Title(x1, 
74                 y, 
75                 _("Translation block size:\n(W/H Percent of image)")));
76         add_subwindow(global_block_w = new BlockSize(plugin, 
77                 x1 + title->get_w() + 10, 
78                 y,
79                 &plugin->config.global_block_w));
80         add_subwindow(global_block_h = new BlockSize(plugin, 
81                 x1 + title->get_w() + 10 + global_block_w->get_w(), 
82                 y,
83                 &plugin->config.global_block_h));
85         add_subwindow(title = new BC_Title(x2, 
86                 y, 
87                 _("Rotation block size:\n(W/H Percent of image)")));
88         add_subwindow(rotation_block_w = new BlockSize(plugin, 
89                 x2 + title->get_w() + 10, 
90                 y,
91                 &plugin->config.rotation_block_w));
92         add_subwindow(rotation_block_h = new BlockSize(plugin, 
93                 x2 + title->get_w() + 10 + rotation_block_w->get_w(), 
94                 y,
95                 &plugin->config.rotation_block_h));
97         y += 50;
98         add_subwindow(title = new BC_Title(x1, y, _("Translation search steps:")));
99         add_subwindow(global_search_positions = new GlobalSearchPositions(plugin, 
100                 x1 + title->get_w() + 10, 
101                 y, 
102                 80));
103         global_search_positions->create_objects();
105         add_subwindow(title = new BC_Title(x2, y, _("Rotation search steps:")));
106         add_subwindow(rotation_search_positions = new RotationSearchPositions(plugin, 
107                 x2 + title->get_w() + 10, 
108                 y, 
109                 80));
110         rotation_search_positions->create_objects();
112         y += 50;
113         add_subwindow(title = new BC_Title(x, y, _("Translation direction:")));
114         add_subwindow(mode3 = new Mode3(plugin, 
115                 this, 
116                 x + title->get_w() + 10, 
117                 y));
118         mode3->create_objects();
120         y += 40;
121         add_subwindow(title = new BC_Title(x, y + 10, _("Block X:")));
122         add_subwindow(block_x = new MotionBlockX(plugin, 
123                 this, 
124                 x + title->get_w() + 10, 
125                 y));
126         add_subwindow(block_x_text = new MotionBlockXText(plugin, 
127                 this, 
128                 x + title->get_w() + 10 + block_x->get_w() + 10, 
129                 y + 10));
131         y += 40;
132         add_subwindow(title = new BC_Title(x, y + 10, _("Block Y:")));
133         add_subwindow(block_y = new MotionBlockY(plugin, 
134                 this, 
135                 x + title->get_w() + 10, 
136                 y));
137         add_subwindow(block_y_text = new MotionBlockYText(plugin, 
138                 this, 
139                 x + title->get_w() + 10 + block_y->get_w() + 10, 
140                 y + 10));
142         y += 50;
143         add_subwindow(title = new BC_Title(x, y + 10, _("Maximum absolute offset:")));
144         add_subwindow(magnitude = new MotionMagnitude(plugin, 
145                 x + title->get_w() + 10, 
146                 y));
148         y += 40;
149         add_subwindow(title = new BC_Title(x, y + 10, _("Settling speed:")));
150         add_subwindow(return_speed = new MotionReturnSpeed(plugin,
151                 x + title->get_w() + 10, 
152                 y));
156         y += 40;
157         add_subwindow(vectors = new MotionDrawVectors(plugin,
158                 this,
159                 x,
160                 y));
163         y += 40;
164         add_subwindow(track_single = new TrackSingleFrame(plugin, 
165                 this,
166                 x, 
167                 y));
168         add_subwindow(title = new BC_Title(x + track_single->get_w() + 20, 
169                 y, 
170                 _("Frame number:")));
171         add_subwindow(track_frame_number = new TrackFrameNumber(plugin, 
172                 this,
173                 x + track_single->get_w() + title->get_w() + 20, 
174                 y));
176         y += 20;
177         add_subwindow(track_previous = new TrackPreviousFrame(plugin, 
178                 this,
179                 x, 
180                 y));
182         y += 20;
183         add_subwindow(previous_same = new PreviousFrameSameBlock(plugin, 
184                 this,
185                 x, 
186                 y));
188         y += 40;
189         int y1 = y;
190         add_subwindow(title = new BC_Title(x, y, _("Master layer:")));
191         add_subwindow(master_layer = new MasterLayer(plugin, 
192                 this,
193                 x + title->get_w() + 10, 
194                 y));
195         master_layer->create_objects();
196         y += 30;
199         add_subwindow(title = new BC_Title(x, y, _("Action:")));
200         add_subwindow(mode1 = new Mode1(plugin, 
201                 this,
202                 x + title->get_w() + 10, 
203                 y));
204         mode1->create_objects();
205         y += 30;
210         add_subwindow(title = new BC_Title(x, y, _("Calculation:")));
211         add_subwindow(mode2 = new Mode2(plugin, 
212                 this, 
213                 x + title->get_w() + 10, 
214                 y));
215         mode2->create_objects();
219         show_window();
220         flush();
221         return 0;
224 void MotionWindow::update_mode()
226         global_range_w->update(plugin->config.global_range_w,
227                 MIN_RADIUS,
228                 MAX_RADIUS);
229         global_range_h->update(plugin->config.global_range_h,
230                 MIN_RADIUS,
231                 MAX_RADIUS);
232         rotation_range->update(plugin->config.rotation_range,
233                 MIN_ROTATION,
234                 MAX_ROTATION);
235         vectors->update(plugin->config.draw_vectors);
236         global->update(plugin->config.global);
237         rotate->update(plugin->config.rotate);
241 WINDOW_CLOSE_EVENT(MotionWindow)
252 GlobalRange::GlobalRange(MotionMain *plugin, 
253         int x, 
254         int y,
255         int *value)
256  : BC_IPot(x, 
257                 y, 
258                 (int64_t)*value,
259                 (int64_t)MIN_RADIUS,
260                 (int64_t)MAX_RADIUS)
262         this->plugin = plugin;
263         this->value = value;
267 int GlobalRange::handle_event()
269         *value = (int)get_value();
270         plugin->send_configure_change();
271         return 1;
277 RotationRange::RotationRange(MotionMain *plugin, 
278         int x, 
279         int y)
280  : BC_IPot(x, 
281                 y, 
282                 (int64_t)plugin->config.rotation_range,
283                 (int64_t)MIN_ROTATION,
284                 (int64_t)MAX_ROTATION)
286         this->plugin = plugin;
290 int RotationRange::handle_event()
292         plugin->config.rotation_range = (int)get_value();
293         plugin->send_configure_change();
294         return 1;
304 BlockSize::BlockSize(MotionMain *plugin, 
305         int x, 
306         int y,
307         int *value)
308  : BC_IPot(x, 
309                 y, 
310                 (int64_t)*value,
311                 (int64_t)MIN_BLOCK,
312                 (int64_t)MAX_BLOCK)
314         this->plugin = plugin;
315         this->value = value;
319 int BlockSize::handle_event()
321         *value = (int)get_value();
322         plugin->send_configure_change();
323         return 1;
338 GlobalSearchPositions::GlobalSearchPositions(MotionMain *plugin, 
339         int x, 
340         int y,
341         int w)
342  : BC_PopupMenu(x,
343         y,
344         w,
345         "",
346         1)
348         this->plugin = plugin;
350 void GlobalSearchPositions::create_objects()
352         add_item(new BC_MenuItem("64"));
353         add_item(new BC_MenuItem("128"));
354         add_item(new BC_MenuItem("256"));
355         add_item(new BC_MenuItem("512"));
356         add_item(new BC_MenuItem("1024"));
357         add_item(new BC_MenuItem("2048"));
358         add_item(new BC_MenuItem("4096"));
359         add_item(new BC_MenuItem("8192"));
360         add_item(new BC_MenuItem("16384"));
361         add_item(new BC_MenuItem("32768"));
362         add_item(new BC_MenuItem("65536"));
363         add_item(new BC_MenuItem("131072"));
364         char string[BCTEXTLEN];
365         sprintf(string, "%d", plugin->config.global_positions);
366         set_text(string);
369 int GlobalSearchPositions::handle_event()
371         plugin->config.global_positions = atoi(get_text());
372         plugin->send_configure_change();
373         return 1;
382 RotationSearchPositions::RotationSearchPositions(MotionMain *plugin, 
383         int x, 
384         int y,
385         int w)
386  : BC_PopupMenu(x,
387         y,
388         w,
389         "",
390         1)
392         this->plugin = plugin;
394 void RotationSearchPositions::create_objects()
396         add_item(new BC_MenuItem("4"));
397         add_item(new BC_MenuItem("8"));
398         add_item(new BC_MenuItem("16"));
399         add_item(new BC_MenuItem("32"));
400         char string[BCTEXTLEN];
401         sprintf(string, "%d", plugin->config.rotate_positions);
402         set_text(string);
405 int RotationSearchPositions::handle_event()
407         plugin->config.rotate_positions = atoi(get_text());
408         plugin->send_configure_change();
409         return 1;
419 MotionMagnitude::MotionMagnitude(MotionMain *plugin, 
420         int x, 
421         int y)
422  : BC_IPot(x, 
423                 y, 
424                 (int64_t)plugin->config.magnitude,
425                 (int64_t)0,
426                 (int64_t)100)
428         this->plugin = plugin;
431 int MotionMagnitude::handle_event()
433         plugin->config.magnitude = (int)get_value();
434         plugin->send_configure_change();
435         return 1;
439 MotionReturnSpeed::MotionReturnSpeed(MotionMain *plugin, 
440         int x, 
441         int y)
442  : BC_IPot(x, 
443                 y, 
444                 (int64_t)plugin->config.return_speed,
445                 (int64_t)0,
446                 (int64_t)100)
448         this->plugin = plugin;
451 int MotionReturnSpeed::handle_event()
453         plugin->config.return_speed = (int)get_value();
454         plugin->send_configure_change();
455         return 1;
462 MotionGlobal::MotionGlobal(MotionMain *plugin, 
463         MotionWindow *gui,
464         int x, 
465         int y)
466  : BC_CheckBox(x, 
467         y, 
468         plugin->config.global,
469         _("Track translation"))
471         this->plugin = plugin;
472         this->gui = gui;
475 int MotionGlobal::handle_event()
477         plugin->config.global = get_value();
478         plugin->send_configure_change();
479         return 1;
482 MotionRotate::MotionRotate(MotionMain *plugin, 
483         MotionWindow *gui,
484         int x, 
485         int y)
486  : BC_CheckBox(x, 
487         y, 
488         plugin->config.rotate,
489         _("Track rotation"))
491         this->plugin = plugin;
492         this->gui = gui;
495 int MotionRotate::handle_event()
497         plugin->config.rotate = get_value();
498         plugin->send_configure_change();
499         return 1;
506 MotionBlockX::MotionBlockX(MotionMain *plugin, 
507         MotionWindow *gui,
508         int x, 
509         int y)
510  : BC_FPot(x,
511         y,
512         plugin->config.block_x,
513         (float)0, 
514         (float)100)
516         this->plugin = plugin;
517         this->gui = gui;
520 int MotionBlockX::handle_event()
522         plugin->config.block_x = get_value();
523         gui->block_x_text->update((float)plugin->config.block_x);
524         plugin->send_configure_change();
525         return 1;
531 MotionBlockY::MotionBlockY(MotionMain *plugin, 
532         MotionWindow *gui,
533         int x, 
534         int y)
535  : BC_FPot(x,
536         y,
537         (float)plugin->config.block_y,
538         (float)0, 
539         (float)100)
541         this->plugin = plugin;
542         this->gui = gui;
545 int MotionBlockY::handle_event()
547         plugin->config.block_y = get_value();
548         gui->block_y_text->update((float)plugin->config.block_y);
549         plugin->send_configure_change();
550         return 1;
553 MotionBlockXText::MotionBlockXText(MotionMain *plugin, 
554         MotionWindow *gui,
555         int x, 
556         int y)
557  : BC_TextBox(x,
558         y,
559         75,
560         1,
561         (float)plugin->config.block_x)
563         this->plugin = plugin;
564         this->gui = gui;
565         set_precision(4);
568 int MotionBlockXText::handle_event()
570         plugin->config.block_x = atof(get_text());
571         gui->block_x->update(plugin->config.block_x);
572         plugin->send_configure_change();
573         return 1;
579 MotionBlockYText::MotionBlockYText(MotionMain *plugin, 
580         MotionWindow *gui,
581         int x, 
582         int y)
583  : BC_TextBox(x,
584         y,
585         75,
586         1,
587         (float)plugin->config.block_y)
589         this->plugin = plugin;
590         this->gui = gui;
591         set_precision(4);
594 int MotionBlockYText::handle_event()
596         plugin->config.block_y = atof(get_text());
597         gui->block_y->update(plugin->config.block_y);
598         plugin->send_configure_change();
599         return 1;
617 MotionDrawVectors::MotionDrawVectors(MotionMain *plugin, 
618         MotionWindow *gui,
619         int x, 
620         int y)
621  : BC_CheckBox(x,
622         y, 
623         plugin->config.draw_vectors,
624         _("Draw vectors"))
626         this->gui = gui;
627         this->plugin = plugin;
630 int MotionDrawVectors::handle_event()
632         plugin->config.draw_vectors = get_value();
633         plugin->send_configure_change();
634         return 1;
644 TrackSingleFrame::TrackSingleFrame(MotionMain *plugin, 
645         MotionWindow *gui,
646         int x, 
647         int y)
648  : BC_Radial(x, 
649         y, 
650         plugin->config.mode3 == MotionConfig::TRACK_SINGLE, 
651         _("Track single frame"))
653         this->plugin = plugin;
654         this->gui = gui;
657 int TrackSingleFrame::handle_event()
659         plugin->config.mode3 = MotionConfig::TRACK_SINGLE;
660         gui->track_previous->update(0);
661         gui->previous_same->update(0);
662         gui->track_frame_number->enable();
663         plugin->send_configure_change();
664         return 1;
674 TrackFrameNumber::TrackFrameNumber(MotionMain *plugin, 
675         MotionWindow *gui,
676         int x, 
677         int y)
678  : BC_TextBox(x, y, 100, 1, plugin->config.track_frame)
680         this->plugin = plugin;
681         this->gui = gui;
682         if(plugin->config.mode3 != MotionConfig::TRACK_SINGLE) disable();
685 int TrackFrameNumber::handle_event()
687         plugin->config.track_frame = atol(get_text());
688         plugin->send_configure_change();
689         return 1;
698 TrackPreviousFrame::TrackPreviousFrame(MotionMain *plugin, 
699         MotionWindow *gui,
700         int x, 
701         int y)
702  : BC_Radial(x, 
703         y, 
704         plugin->config.mode3 == MotionConfig::TRACK_PREVIOUS, 
705         _("Track previous frame"))
707         this->plugin = plugin;
708         this->gui = gui;
710 int TrackPreviousFrame::handle_event()
712         plugin->config.mode3 = MotionConfig::TRACK_PREVIOUS;
713         gui->track_single->update(0);
714         gui->previous_same->update(0);
715         gui->track_frame_number->disable();
716         plugin->send_configure_change();
717         return 1;
727 PreviousFrameSameBlock::PreviousFrameSameBlock(MotionMain *plugin, 
728         MotionWindow *gui,
729         int x, 
730         int y)
731  : BC_Radial(x, 
732         y, 
733         plugin->config.mode3 == MotionConfig::PREVIOUS_SAME_BLOCK, 
734         _("Previous frame same block"))
736         this->plugin = plugin;
737         this->gui = gui;
739 int PreviousFrameSameBlock::handle_event()
741         plugin->config.mode3 = MotionConfig::PREVIOUS_SAME_BLOCK;
742         gui->track_single->update(0);
743         gui->track_previous->update(0);
744         gui->track_frame_number->disable();
745         plugin->send_configure_change();
746         return 1;
756 MasterLayer::MasterLayer(MotionMain *plugin, MotionWindow *gui, int x, int y)
757  : BC_PopupMenu(x, 
758         y, 
759         calculate_w(gui),
760         to_text(plugin->config.bottom_is_master))
762         this->plugin = plugin;
763         this->gui = gui;
766 int MasterLayer::handle_event()
768         plugin->config.bottom_is_master = from_text(get_text());
769         plugin->send_configure_change();
770         return 1;
773 void MasterLayer::create_objects()
775         add_item(new BC_MenuItem(to_text(0)));
776         add_item(new BC_MenuItem(to_text(1)));
779 int MasterLayer::from_text(char *text)
781         if(!strcmp(text, _("Top"))) return 0;
782         return 1;
785 char* MasterLayer::to_text(int mode)
787         return mode ? _("Bottom") : _("Top");
790 int MasterLayer::calculate_w(MotionWindow *gui)
792         int result = 0;
793         result = MAX(result, gui->get_text_width(MEDIUMFONT, to_text(0)));
794         result = MAX(result, gui->get_text_width(MEDIUMFONT, to_text(1)));
795         return result + 50;
805 Mode1::Mode1(MotionMain *plugin, MotionWindow *gui, int x, int y)
806  : BC_PopupMenu(x, 
807         y, 
808         calculate_w(gui),
809         to_text(plugin->config.mode1))
811         this->plugin = plugin;
812         this->gui = gui;
815 int Mode1::handle_event()
817         plugin->config.mode1 = from_text(get_text());
818         plugin->send_configure_change();
819         return 1;
822 void Mode1::create_objects()
824         add_item(new BC_MenuItem(to_text(MotionConfig::TRACK)));
825         add_item(new BC_MenuItem(to_text(MotionConfig::TRACK_PIXEL)));
826         add_item(new BC_MenuItem(to_text(MotionConfig::STABILIZE)));
827         add_item(new BC_MenuItem(to_text(MotionConfig::STABILIZE_PIXEL)));
828         add_item(new BC_MenuItem(to_text(MotionConfig::NOTHING)));
831 int Mode1::from_text(char *text)
833         if(!strcmp(text, _("Track Subpixel"))) return MotionConfig::TRACK;
834         if(!strcmp(text, _("Track Pixel"))) return MotionConfig::TRACK_PIXEL;
835         if(!strcmp(text, _("Stabilize Subpixel"))) return MotionConfig::STABILIZE;
836         if(!strcmp(text, _("Stabilize Pixel"))) return MotionConfig::STABILIZE_PIXEL;
837         if(!strcmp(text, _("Do Nothing"))) return MotionConfig::NOTHING;
840 char* Mode1::to_text(int mode)
842         switch(mode)
843         {
844                 case MotionConfig::TRACK:
845                         return _("Track Subpixel");
846                         break;
847                 case MotionConfig::TRACK_PIXEL:
848                         return _("Track Pixel");
849                         break;
850                 case MotionConfig::STABILIZE:
851                         return _("Stabilize Subpixel");
852                         break;
853                 case MotionConfig::STABILIZE_PIXEL:
854                         return _("Stabilize Pixel");
855                         break;
856                 case MotionConfig::NOTHING:
857                         return _("Do Nothing");
858                         break;
859         }
862 int Mode1::calculate_w(MotionWindow *gui)
864         int result = 0;
865         result = MAX(result, gui->get_text_width(MEDIUMFONT, to_text(MotionConfig::TRACK)));
866         result = MAX(result, gui->get_text_width(MEDIUMFONT, to_text(MotionConfig::TRACK_PIXEL)));
867         result = MAX(result, gui->get_text_width(MEDIUMFONT, to_text(MotionConfig::STABILIZE)));
868         result = MAX(result, gui->get_text_width(MEDIUMFONT, to_text(MotionConfig::STABILIZE_PIXEL)));
869         result = MAX(result, gui->get_text_width(MEDIUMFONT, to_text(MotionConfig::NOTHING)));
870         return result + 50;
877 Mode2::Mode2(MotionMain *plugin, MotionWindow *gui, int x, int y)
878  : BC_PopupMenu(x, 
879         y, 
880         calculate_w(gui),
881         to_text(plugin->config.mode2))
883         this->plugin = plugin;
884         this->gui = gui;
887 int Mode2::handle_event()
889         plugin->config.mode2 = from_text(get_text());
890         plugin->send_configure_change();
891         return 1;
894 void Mode2::create_objects()
896         add_item(new BC_MenuItem(to_text(MotionConfig::NO_CALCULATE)));
897         add_item(new BC_MenuItem(to_text(MotionConfig::RECALCULATE)));
898         add_item(new BC_MenuItem(to_text(MotionConfig::SAVE)));
899         add_item(new BC_MenuItem(to_text(MotionConfig::LOAD)));
902 int Mode2::from_text(char *text)
904         if(!strcmp(text, _("Don't Calculate"))) return MotionConfig::NO_CALCULATE;
905         if(!strcmp(text, _("Recalculate"))) return MotionConfig::RECALCULATE;
906         if(!strcmp(text, _("Save coords to /tmp"))) return MotionConfig::SAVE;
907         if(!strcmp(text, _("Load coords from /tmp"))) return MotionConfig::LOAD;
910 char* Mode2::to_text(int mode)
912         switch(mode)
913         {
914                 case MotionConfig::NO_CALCULATE:
915                         return _("Don't Calculate");
916                         break;
917                 case MotionConfig::RECALCULATE:
918                         return _("Recalculate");
919                         break;
920                 case MotionConfig::SAVE:
921                         return _("Save coords to /tmp");
922                         break;
923                 case MotionConfig::LOAD:
924                         return _("Load coords from /tmp");
925                         break;
926         }
929 int Mode2::calculate_w(MotionWindow *gui)
931         int result = 0;
932         result = MAX(result, gui->get_text_width(MEDIUMFONT, to_text(MotionConfig::NO_CALCULATE)));
933         result = MAX(result, gui->get_text_width(MEDIUMFONT, to_text(MotionConfig::RECALCULATE)));
934         result = MAX(result, gui->get_text_width(MEDIUMFONT, to_text(MotionConfig::SAVE)));
935         result = MAX(result, gui->get_text_width(MEDIUMFONT, to_text(MotionConfig::LOAD)));
936         return result + 50;
948 Mode3::Mode3(MotionMain *plugin, MotionWindow *gui, int x, int y)
949  : BC_PopupMenu(x, 
950         y, 
951         calculate_w(gui),
952         to_text(plugin->config.horizontal_only, plugin->config.vertical_only))
954         this->plugin = plugin;
955         this->gui = gui;
958 int Mode3::handle_event()
960         from_text(&plugin->config.horizontal_only, &plugin->config.vertical_only, get_text());
961         plugin->send_configure_change();
962         return 1;
965 void Mode3::create_objects()
967         add_item(new BC_MenuItem(to_text(1, 0)));
968         add_item(new BC_MenuItem(to_text(0, 1)));
969         add_item(new BC_MenuItem(to_text(0, 0)));
972 void Mode3::from_text(int *horizontal_only, int *vertical_only, char *text)
974         *horizontal_only = 0;
975         *vertical_only = 0;
976         if(!strcmp(text, to_text(1, 0))) *horizontal_only = 1;
977         if(!strcmp(text, to_text(0, 1))) *vertical_only = 1;
980 char* Mode3::to_text(int horizontal_only, int vertical_only)
982         if(horizontal_only) return _("Horizontal only");
983         if(vertical_only) return _("Vertical only");
984         return _("Both");
987 int Mode3::calculate_w(MotionWindow *gui)
989         int result = 0;
990         result = MAX(result, gui->get_text_width(MEDIUMFONT, to_text(1, 0)));
991         result = MAX(result, gui->get_text_width(MEDIUMFONT, to_text(0, 1)));
992         result = MAX(result, gui->get_text_width(MEDIUMFONT, to_text(0, 0)));
993         return result + 50;