4 * Copyright (C) 2012 Adam Williams <broadcast at earthling dot net>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include "bcdisplayinfo.h"
26 #include "edlsession.h"
29 #include "motionscan.h"
30 #include "motionwindow.h"
32 #include "pluginserver.h"
34 MotionWindow::MotionWindow(MotionMain *plugin)
35 : PluginClientWindow(plugin, xS(800), yS(640), xS(800), yS(640), 0)
37 this->plugin = plugin;
40 MotionWindow::~MotionWindow()
44 void MotionWindow::create_objects()
46 int xs5 = xS(5), xs10 = xS(10), xs20 = xS(20), xs50 = xS(50), xs120 = xS(120);
47 int ys10 = yS(10), ys20 = yS(20), ys50 = yS(50), ys30 = yS(30), ys40 = yS(40), ys60 = yS(60);
48 int x = xs10, y = ys10;
49 int x1 = x, x2 = get_w() / 2;
52 add_subwindow(global = new MotionGlobal(plugin, this, x1, y));
53 add_subwindow(rotate = new MotionRotate(plugin, this, x2, y));
56 add_subwindow(title = new BC_Title(x1, y,
57 _("Translation search radius:\n(W/H Percent of image)")));
58 add_subwindow(global_range_w = new GlobalRange(plugin,
59 x1 + title->get_w() + xs10, y,
60 &plugin->config.global_range_w));
61 add_subwindow(global_range_h = new GlobalRange(plugin,
62 x1 + title->get_w() + xs10 + global_range_w->get_w(), y,
63 &plugin->config.global_range_h));
65 add_subwindow(title = new BC_Title(x2, y,
66 _("Rotation search radius:\n(Degrees)")));
67 add_subwindow(rotation_range = new RotationRange(plugin,
68 x2 + title->get_w() + xs10, y));
71 add_subwindow(title = new BC_Title(x1, y,
72 _("Translation block size:\n(W/H Percent of image)")));
73 add_subwindow(global_block_w =
74 new BlockSize(plugin, x1 + title->get_w() + xs10, y,
75 &plugin->config.global_block_w));
76 add_subwindow(global_block_h =
77 new BlockSize(plugin, x1 + title->get_w() + xs10 +
78 global_block_w->get_w(), y,
79 &plugin->config.global_block_h));
81 // add_subwindow(title = new BC_Title(x2,
83 // _("Rotation block size:\n(W/H Percent of image)")));
84 // add_subwindow(rotation_block_w = new BlockSize(plugin,
85 // x2 + title->get_w() + xs10,
87 // &plugin->config.rotation_block_w));
88 // add_subwindow(rotation_block_h = new BlockSize(plugin,
89 // x2 + title->get_w() + xs10 + rotation_block_w->get_w(),
91 // &plugin->config.rotation_block_h));
94 add_subwindow(title = new BC_Title(x1, y, _("Translation search steps:")));
95 add_subwindow(global_search_positions =
96 new GlobalSearchPositions(plugin, x1 + title->get_w() + xs10, y, xs120));
97 global_search_positions->create_objects();
99 add_subwindow(title = new BC_Title(x2, y, _("Rotation search steps:")));
100 add_subwindow(rotation_search_positions =
101 new RotationSearchPositions(plugin, x2 + title->get_w() + xs10, y, xs120));
102 rotation_search_positions->create_objects();
105 add_subwindow(title = new BC_Title(x, y, _("Translation direction:")));
106 add_subwindow(track_direction = new TrackDirection(plugin,
108 x + title->get_w() + xs10,
110 track_direction->create_objects();
113 add_subwindow(title = new BC_Title(x2, y, _("Tracking file:")));
114 add_subwindow(tracking_file = new MotionTrackingFile(plugin,
115 plugin->config.tracking_file, this, x2+title->get_w() + xs20, y));
118 add_subwindow(title = new BC_Title(x, y + ys10, _("Block X:")));
119 add_subwindow(block_x =
120 new MotionBlockX(plugin, this, x + title->get_w() + xs10, y));
121 add_subwindow(block_x_text =
122 new MotionBlockXText(plugin, this,
123 x + title->get_w() + xs10 + block_x->get_w() + xs10, y + ys10));
126 add_subwindow(title = new BC_Title(x2, y, _("Rotation center:")));
127 add_subwindow(rotation_center =
128 new RotationCenter(plugin, x2 + title->get_w() + xs10, y));
131 add_subwindow(title = new BC_Title(x2, y + ys10, _("Maximum angle offset:")));
132 add_subwindow(rotate_magnitude =
133 new MotionRMagnitude(plugin, x2 + title->get_w() + xs10, y));
136 add_subwindow(title = new BC_Title(x2, y + ys10, _("Rotation settling speed:")));
137 add_subwindow(rotate_return_speed =
138 new MotionRReturnSpeed(plugin, x2 + title->get_w() + xs10, y));
140 add_subwindow(vectors = new MotionDrawVectors(plugin, this, x2, y));
143 add_subwindow(title = new BC_Title(x, y + ys10, _("Block Y:")));
144 add_subwindow(block_y =
145 new MotionBlockY(plugin, this, x + title->get_w() + xs10, y));
146 add_subwindow(block_y_text =
147 new MotionBlockYText(plugin, this,
148 x + title->get_w() + xs10 + block_y->get_w() + xs10, y + ys10));
151 add_subwindow(title = new BC_Title(x, y + ys10, _("Maximum absolute offset:")));
152 add_subwindow(magnitude = new MotionMagnitude(plugin,
153 x + title->get_w() + xs10,
157 add_subwindow(title = new BC_Title(x, y + ys10, _("Motion settling speed:")));
158 add_subwindow(return_speed =
159 new MotionReturnSpeed(plugin, x + title->get_w() + xs10, y));
162 add_subwindow(track_single =
163 new TrackSingleFrame(plugin, this, x, y));
165 add_subwindow(track_previous =
166 new TrackPreviousFrame(plugin, this, x, y));
168 add_subwindow(previous_same =
169 new PreviousFrameSameBlock(plugin, this, x, y));
173 add_subwindow(title =
174 new BC_Title(x1=x2, y1, _("Frame number:")));
175 add_subwindow(track_frame_number =
176 new TrackFrameNumber(plugin, this, x1 += title->get_w(), y1));
177 if(plugin->config.tracking_object != MotionScan::TRACK_SINGLE)
178 track_frame_number->disable();
180 add_subwindow(addtrackedframeoffset =
181 new AddTrackedFrameOffset(plugin, this, x1=x2, y1+=track_frame_number->get_h()));
182 int pef = client->server->mwindow->edl->session->video_every_frame;
183 add_subwindow(pef_title = new BC_Title(x1=x2+xs50, y1+=addtrackedframeoffset->get_h() + xs5,
184 !pef ? _("For best results\n"
185 " Set: Play every frame\n"
186 " Preferences-> Playback-> Video Out") :
187 _("Currently using: Play every frame"), MEDIUMFONT,
188 !pef ? RED : GREEN));
190 add_subwindow(title = new BC_Title(x, y, _("Master layer:")));
191 add_subwindow(master_layer = new MasterLayer(plugin,
192 this, x + title->get_w() + xs10, y));
193 master_layer->create_objects();
196 add_subwindow(title = new BC_Title(x, y, _("Action:")));
197 add_subwindow(action_type = new ActionType(plugin,
198 this, x + title->get_w() + xs10, y));
199 action_type->create_objects();
202 add_subwindow(title = new BC_Title(x, y, _("Calculation:")));
203 add_subwindow(tracking_type = new TrackingType(plugin,
204 this, x + title->get_w() + xs10, y));
205 tracking_type->create_objects();
210 void MotionWindow::update_mode()
212 global_range_w->update(plugin->config.global_range_w,
213 MIN_RADIUS, MAX_RADIUS);
214 global_range_h->update(plugin->config.global_range_h,
215 MIN_RADIUS, MAX_RADIUS);
216 rotation_range->update(plugin->config.rotation_range,
217 MIN_ROTATION, MAX_ROTATION);
218 vectors->update(plugin->config.draw_vectors);
219 tracking_file->update(plugin->config.tracking_file);
220 global->update(plugin->config.global);
221 rotate->update(plugin->config.rotate);
222 addtrackedframeoffset->update(plugin->config.addtrackedframeoffset);
225 MotionTrackingFile::MotionTrackingFile(MotionMain *plugin,
226 const char *filename, MotionWindow *gui, int x, int y)
227 : BC_TextBox(x, y, xS(150), 1, filename)
229 this->plugin = plugin;
233 int MotionTrackingFile::handle_event()
235 strcpy(plugin->config.tracking_file, get_text());
236 plugin->send_configure_change();
241 GlobalRange::GlobalRange(MotionMain *plugin,
242 int x, int y, int *value)
243 : BC_IPot(x, y, (int64_t)*value,
244 (int64_t)MIN_RADIUS, (int64_t)MAX_RADIUS)
246 this->plugin = plugin;
251 int GlobalRange::handle_event()
253 *value = (int)get_value();
254 plugin->send_configure_change();
261 RotationRange::RotationRange(MotionMain *plugin, int x, int y)
262 : BC_IPot(x, y, (int64_t)plugin->config.rotation_range,
263 (int64_t)MIN_ROTATION, (int64_t)MAX_ROTATION)
265 this->plugin = plugin;
269 int RotationRange::handle_event()
271 plugin->config.rotation_range = (int)get_value();
272 plugin->send_configure_change();
277 RotationCenter::RotationCenter(MotionMain *plugin, int x, int y)
278 : BC_IPot(x, y, (int64_t)plugin->config.rotation_center,
279 (int64_t)-MAX_ROTATION, (int64_t)MAX_ROTATION)
281 this->plugin = plugin;
285 int RotationCenter::handle_event()
287 plugin->config.rotation_center = (int)get_value();
288 plugin->send_configure_change();
293 BlockSize::BlockSize(MotionMain *plugin,
303 this->plugin = plugin;
308 int BlockSize::handle_event()
310 *value = (int)get_value();
311 plugin->send_configure_change();
316 GlobalSearchPositions::GlobalSearchPositions(MotionMain *plugin,
318 : BC_PopupMenu(x, y, w, "", 1)
320 this->plugin = plugin;
322 void GlobalSearchPositions::create_objects()
324 add_item(new BC_MenuItem("16"));
325 add_item(new BC_MenuItem("32"));
326 add_item(new BC_MenuItem("64"));
327 add_item(new BC_MenuItem("128"));
328 add_item(new BC_MenuItem("256"));
329 add_item(new BC_MenuItem("512"));
330 add_item(new BC_MenuItem("1024"));
331 add_item(new BC_MenuItem("2048"));
332 add_item(new BC_MenuItem("4096"));
333 add_item(new BC_MenuItem("8192"));
334 add_item(new BC_MenuItem("16384"));
335 add_item(new BC_MenuItem("32768"));
336 add_item(new BC_MenuItem("65536"));
337 add_item(new BC_MenuItem("131072"));
338 char string[BCTEXTLEN];
339 sprintf(string, "%d", plugin->config.global_positions);
343 int GlobalSearchPositions::handle_event()
345 plugin->config.global_positions = atoi(get_text());
346 plugin->send_configure_change();
351 RotationSearchPositions::RotationSearchPositions(MotionMain *plugin,
353 : BC_PopupMenu(x, y, w, "", 1)
355 this->plugin = plugin;
357 void RotationSearchPositions::create_objects()
359 add_item(new BC_MenuItem("4"));
360 add_item(new BC_MenuItem("8"));
361 add_item(new BC_MenuItem("16"));
362 add_item(new BC_MenuItem("32"));
363 char string[BCTEXTLEN];
364 sprintf(string, "%d", plugin->config.rotate_positions);
368 int RotationSearchPositions::handle_event()
370 plugin->config.rotate_positions = atoi(get_text());
371 plugin->send_configure_change();
376 MotionMagnitude::MotionMagnitude(MotionMain *plugin, int x, int y)
378 (int64_t)plugin->config.magnitude, (int64_t)0, (int64_t)100)
380 this->plugin = plugin;
383 int MotionMagnitude::handle_event()
385 plugin->config.magnitude = (int)get_value();
386 plugin->send_configure_change();
391 MotionReturnSpeed::MotionReturnSpeed(MotionMain *plugin, int x, int y)
393 (int64_t)plugin->config.return_speed, (int64_t)0, (int64_t)100)
395 this->plugin = plugin;
398 int MotionReturnSpeed::handle_event()
400 plugin->config.return_speed = (int)get_value();
401 plugin->send_configure_change();
407 AddTrackedFrameOffset::AddTrackedFrameOffset(MotionMain *plugin,
408 MotionWindow *gui, int x, int y)
409 : BC_CheckBox(x, y, plugin->config.addtrackedframeoffset,
410 _("Add (loaded) offset from tracked frame"))
412 this->plugin = plugin;
416 int AddTrackedFrameOffset::handle_event()
418 plugin->config.addtrackedframeoffset = get_value();
419 plugin->send_configure_change();
424 MotionRMagnitude::MotionRMagnitude(MotionMain *plugin, int x, int y)
426 (int64_t)plugin->config.rotate_magnitude, (int64_t)0, (int64_t)90)
428 this->plugin = plugin;
431 int MotionRMagnitude::handle_event()
433 plugin->config.rotate_magnitude = (int)get_value();
434 plugin->send_configure_change();
440 MotionRReturnSpeed::MotionRReturnSpeed(MotionMain *plugin, int x, int y)
442 (int64_t)plugin->config.rotate_return_speed, (int64_t)0, (int64_t)100)
444 this->plugin = plugin;
447 int MotionRReturnSpeed::handle_event()
449 plugin->config.rotate_return_speed = (int)get_value();
450 plugin->send_configure_change();
455 MotionGlobal::MotionGlobal(MotionMain *plugin,
456 MotionWindow *gui, int x, int y)
457 : BC_CheckBox(x, y, plugin->config.global, _("Track translation"))
459 this->plugin = plugin;
463 int MotionGlobal::handle_event()
465 plugin->config.global = get_value();
466 plugin->send_configure_change();
470 MotionRotate::MotionRotate(MotionMain *plugin,
471 MotionWindow *gui, int x, int y)
472 : BC_CheckBox(x, y, plugin->config.rotate, _("Track rotation"))
474 this->plugin = plugin;
478 int MotionRotate::handle_event()
480 plugin->config.rotate = get_value();
481 plugin->send_configure_change();
486 MotionBlockX::MotionBlockX(MotionMain *plugin,
487 MotionWindow *gui, int x, int y)
488 : BC_FPot(x, y, plugin->config.block_x, (float)0, (float)100)
490 this->plugin = plugin;
494 int MotionBlockX::handle_event()
496 plugin->config.block_x = get_value();
497 gui->block_x_text->update((float)plugin->config.block_x);
498 plugin->send_configure_change();
503 MotionBlockY::MotionBlockY(MotionMain *plugin,
509 (float)plugin->config.block_y,
513 this->plugin = plugin;
517 int MotionBlockY::handle_event()
519 plugin->config.block_y = get_value();
520 gui->block_y_text->update((float)plugin->config.block_y);
521 plugin->send_configure_change();
525 MotionBlockXText::MotionBlockXText(MotionMain *plugin,
526 MotionWindow *gui, int x, int y)
527 : BC_TextBox(x, y, xS(75), 1, (float)plugin->config.block_x)
529 this->plugin = plugin;
534 int MotionBlockXText::handle_event()
536 plugin->config.block_x = atof(get_text());
537 gui->block_x->update(plugin->config.block_x);
538 plugin->send_configure_change();
545 MotionBlockYText::MotionBlockYText(MotionMain *plugin,
546 MotionWindow *gui, int x, int y)
547 : BC_TextBox(x, y, xS(75), 1, (float)plugin->config.block_y)
549 this->plugin = plugin;
554 int MotionBlockYText::handle_event()
556 plugin->config.block_y = atof(get_text());
557 gui->block_y->update(plugin->config.block_y);
558 plugin->send_configure_change();
563 MotionDrawVectors::MotionDrawVectors(MotionMain *plugin,
564 MotionWindow *gui, int x, int y)
567 plugin->config.draw_vectors,
571 this->plugin = plugin;
574 int MotionDrawVectors::handle_event()
576 plugin->config.draw_vectors = get_value();
577 plugin->send_configure_change();
582 TrackSingleFrame::TrackSingleFrame(MotionMain *plugin,
588 plugin->config.tracking_object == MotionScan::TRACK_SINGLE,
589 _("Track single frame"))
591 this->plugin = plugin;
595 int TrackSingleFrame::handle_event()
597 plugin->config.tracking_object = MotionScan::TRACK_SINGLE;
598 gui->track_previous->update(0);
599 gui->previous_same->update(0);
600 gui->track_frame_number->enable();
601 plugin->send_configure_change();
605 TrackFrameNumber::TrackFrameNumber(MotionMain *plugin,
609 : BC_TextBox(x, y, xS(100), 1, plugin->config.track_frame)
611 this->plugin = plugin;
615 int TrackFrameNumber::handle_event()
617 plugin->config.track_frame = atol(get_text());
618 plugin->send_configure_change();
623 TrackPreviousFrame::TrackPreviousFrame(MotionMain *plugin,
629 plugin->config.tracking_object == MotionScan::TRACK_PREVIOUS,
630 _("Track previous frame"))
632 this->plugin = plugin;
635 int TrackPreviousFrame::handle_event()
637 plugin->config.tracking_object = MotionScan::TRACK_PREVIOUS;
638 gui->track_single->update(0);
639 gui->previous_same->update(0);
640 gui->track_frame_number->disable();
641 plugin->send_configure_change();
646 PreviousFrameSameBlock::PreviousFrameSameBlock(MotionMain *plugin,
652 plugin->config.tracking_object == MotionScan::PREVIOUS_SAME_BLOCK,
653 _("Previous frame same block"))
655 this->plugin = plugin;
658 int PreviousFrameSameBlock::handle_event()
660 plugin->config.tracking_object = MotionScan::PREVIOUS_SAME_BLOCK;
661 gui->track_single->update(0);
662 gui->track_previous->update(0);
663 gui->track_frame_number->disable();
664 plugin->send_configure_change();
669 MasterLayer::MasterLayer(MotionMain *plugin, MotionWindow *gui, int x, int y)
673 to_text(plugin->config.bottom_is_master))
675 this->plugin = plugin;
679 int MasterLayer::handle_event()
681 plugin->config.bottom_is_master = from_text(get_text());
682 plugin->send_configure_change();
686 void MasterLayer::create_objects()
688 add_item(new BC_MenuItem(to_text(0)));
689 add_item(new BC_MenuItem(to_text(1)));
692 int MasterLayer::from_text(char *text)
694 if(!strcmp(text, _("Top"))) return 0;
698 char* MasterLayer::to_text(int mode)
700 return mode ? _("Bottom") : _("Top");
703 int MasterLayer::calculate_w(MotionWindow *gui)
706 result = MAX(result, gui->get_text_width(MEDIUMFONT, to_text(0)));
707 result = MAX(result, gui->get_text_width(MEDIUMFONT, to_text(1)));
708 return result + xS(80);
712 ActionType::ActionType(MotionMain *plugin, MotionWindow *gui, int x, int y)
716 to_text(plugin->config.action_type))
718 this->plugin = plugin;
722 int ActionType::handle_event()
724 plugin->config.action_type = from_text(get_text());
725 plugin->send_configure_change();
729 void ActionType::create_objects()
731 add_item(new BC_MenuItem(to_text(MotionScan::TRACK)));
732 add_item(new BC_MenuItem(to_text(MotionScan::TRACK_PIXEL)));
733 add_item(new BC_MenuItem(to_text(MotionScan::STABILIZE)));
734 add_item(new BC_MenuItem(to_text(MotionScan::STABILIZE_PIXEL)));
735 add_item(new BC_MenuItem(to_text(MotionScan::NOTHING)));
738 int ActionType::from_text(char *text)
740 if(!strcmp(text, _("Track Subpixel"))) return MotionScan::TRACK;
741 if(!strcmp(text, _("Track Pixel"))) return MotionScan::TRACK_PIXEL;
742 if(!strcmp(text, _("Stabilize Subpixel"))) return MotionScan::STABILIZE;
743 if(!strcmp(text, _("Stabilize Pixel"))) return MotionScan::STABILIZE_PIXEL;
744 //if(!strcmp(text, _("Do Nothing"))) return MotionScan::NOTHING;
745 return MotionScan::NOTHING;
748 char* ActionType::to_text(int mode)
752 case MotionScan::TRACK:
753 return _("Track Subpixel");
754 case MotionScan::TRACK_PIXEL:
755 return _("Track Pixel");
756 case MotionScan::STABILIZE:
757 return _("Stabilize Subpixel");
758 case MotionScan::STABILIZE_PIXEL:
759 return _("Stabilize Pixel");
761 case MotionScan::NOTHING:
762 return _("Do Nothing");
766 int ActionType::calculate_w(MotionWindow *gui)
769 result = MAX(result, gui->get_text_width(MEDIUMFONT, to_text(MotionScan::TRACK)));
770 result = MAX(result, gui->get_text_width(MEDIUMFONT, to_text(MotionScan::TRACK_PIXEL)));
771 result = MAX(result, gui->get_text_width(MEDIUMFONT, to_text(MotionScan::STABILIZE)));
772 result = MAX(result, gui->get_text_width(MEDIUMFONT, to_text(MotionScan::STABILIZE_PIXEL)));
773 result = MAX(result, gui->get_text_width(MEDIUMFONT, to_text(MotionScan::NOTHING)));
774 return result + xS(80);
778 TrackingType::TrackingType(MotionMain *plugin, MotionWindow *gui, int x, int y)
782 to_text(plugin->config.tracking_type))
784 this->plugin = plugin;
788 int TrackingType::handle_event()
790 plugin->config.tracking_type = from_text(get_text());
791 plugin->send_configure_change();
795 void TrackingType::create_objects()
797 add_item(new BC_MenuItem(to_text(MotionScan::SAVE)));
798 add_item(new BC_MenuItem(to_text(MotionScan::LOAD)));
799 add_item(new BC_MenuItem(to_text(MotionScan::CALCULATE)));
800 add_item(new BC_MenuItem(to_text(MotionScan::NO_CALCULATE)));
803 int TrackingType::from_text(char *text)
805 if(!strcmp(text, _("Save coords to tracking file"))) return MotionScan::SAVE;
806 if(!strcmp(text, _("Load coords from tracking file"))) return MotionScan::LOAD;
807 if(!strcmp(text, _("Recalculate"))) return MotionScan::CALCULATE;
808 //if(!strcmp(text, _("Don't Calculate"))) return MotionScan::NO_CALCULATE;
809 return MotionScan::NO_CALCULATE;
812 char* TrackingType::to_text(int mode)
816 case MotionScan::SAVE: return _("Save coords to tracking file");
817 case MotionScan::LOAD: return _("Load coords from tracking file");
818 case MotionScan::CALCULATE: return _("Recalculate");
820 case MotionScan::NO_CALCULATE: return _("Don't Calculate");
824 int TrackingType::calculate_w(MotionWindow *gui)
827 result = MAX(result, gui->get_text_width(MEDIUMFONT, to_text(MotionScan::NO_CALCULATE)));
828 result = MAX(result, gui->get_text_width(MEDIUMFONT, to_text(MotionScan::CALCULATE)));
829 result = MAX(result, gui->get_text_width(MEDIUMFONT, to_text(MotionScan::SAVE)));
830 result = MAX(result, gui->get_text_width(MEDIUMFONT, to_text(MotionScan::LOAD)));
831 return result + xS(80);
835 TrackDirection::TrackDirection(MotionMain *plugin, MotionWindow *gui, int x, int y)
839 to_text(plugin->config.horizontal_only, plugin->config.vertical_only))
841 this->plugin = plugin;
845 int TrackDirection::handle_event()
847 from_text(&plugin->config.horizontal_only, &plugin->config.vertical_only, get_text());
848 plugin->send_configure_change();
852 void TrackDirection::create_objects()
854 add_item(new BC_MenuItem(to_text(1, 0)));
855 add_item(new BC_MenuItem(to_text(0, 1)));
856 add_item(new BC_MenuItem(to_text(0, 0)));
859 void TrackDirection::from_text(int *horizontal_only, int *vertical_only, char *text)
861 *horizontal_only = 0;
863 if(!strcmp(text, to_text(1, 0))) *horizontal_only = 1;
864 if(!strcmp(text, to_text(0, 1))) *vertical_only = 1;
867 char* TrackDirection::to_text(int horizontal_only, int vertical_only)
869 if(horizontal_only) return _("Horizontal only");
870 if(vertical_only) return _("Vertical only");
874 int TrackDirection::calculate_w(MotionWindow *gui)
877 result = MAX(result, gui->get_text_width(MEDIUMFONT, to_text(1, 0)));
878 result = MAX(result, gui->get_text_width(MEDIUMFONT, to_text(0, 1)));
879 result = MAX(result, gui->get_text_width(MEDIUMFONT, to_text(0, 0)));
880 return result + xS(80);