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, 800, 660, 800, 660, 0)
37 this->plugin = plugin;
40 MotionWindow::~MotionWindow()
44 void MotionWindow::create_objects()
47 int x1 = x, x2 = get_w() / 2;
50 add_subwindow(global = new MotionGlobal(plugin, this, x1, y));
51 add_subwindow(rotate = new MotionRotate(plugin, this, x2, y));
54 add_subwindow(title = new BC_Title(x1, 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, y,
58 &plugin->config.global_range_w));
59 add_subwindow(global_range_h = new GlobalRange(plugin,
60 x1 + title->get_w() + 10 + global_range_w->get_w(), y,
61 &plugin->config.global_range_h));
63 add_subwindow(title = new BC_Title(x2, y,
64 _("Rotation search radius:\n(Degrees)")));
65 add_subwindow(rotation_range = new RotationRange(plugin,
66 x2 + title->get_w() + 10, y));
69 add_subwindow(title = new BC_Title(x1, y,
70 _("Translation block size:\n(W/H Percent of image)")));
71 add_subwindow(global_block_w =
72 new BlockSize(plugin, x1 + title->get_w() + 10, y,
73 &plugin->config.global_block_w));
74 add_subwindow(global_block_h =
75 new BlockSize(plugin, x1 + title->get_w() + 10 +
76 global_block_w->get_w(), y,
77 &plugin->config.global_block_h));
79 // add_subwindow(title = new BC_Title(x2,
81 // _("Rotation block size:\n(W/H Percent of image)")));
82 // add_subwindow(rotation_block_w = new BlockSize(plugin,
83 // x2 + title->get_w() + 10,
85 // &plugin->config.rotation_block_w));
86 // add_subwindow(rotation_block_h = new BlockSize(plugin,
87 // x2 + title->get_w() + 10 + rotation_block_w->get_w(),
89 // &plugin->config.rotation_block_h));
92 add_subwindow(title = new BC_Title(x1, y, _("Translation search steps:")));
93 add_subwindow(global_search_positions =
94 new GlobalSearchPositions(plugin, x1 + title->get_w() + 10, y, 80));
95 global_search_positions->create_objects();
97 add_subwindow(title = new BC_Title(x2, y, _("Rotation search steps:")));
98 add_subwindow(rotation_search_positions =
99 new RotationSearchPositions(plugin, x2 + title->get_w() + 10, y, 80));
100 rotation_search_positions->create_objects();
103 add_subwindow(title = new BC_Title(x, y, _("Translation direction:")));
104 add_subwindow(track_direction = new TrackDirection(plugin,
106 x + title->get_w() + 10,
108 track_direction->create_objects();
110 add_subwindow(title = new BC_Title(x2, y, _("Tracking file:")));
111 add_subwindow(tracking_file = new MotionTrackingFile(plugin,
112 plugin->config.tracking_file, this, x2+title->get_w() + 20, y));
115 add_subwindow(title = new BC_Title(x, y + 10, _("Block X:")));
116 add_subwindow(block_x =
117 new MotionBlockX(plugin, this, x + title->get_w() + 10, y));
118 add_subwindow(block_x_text =
119 new MotionBlockXText(plugin, this,
120 x + title->get_w() + 10 + block_x->get_w() + 10, y + 10));
122 add_subwindow(title = new BC_Title(x2, y, _("Rotation center:")));
123 add_subwindow(rotation_center =
124 new RotationCenter(plugin, x2 + title->get_w() + 10, y));
128 add_subwindow(title = new BC_Title(x2, y + 10, _("Maximum angle offset:")));
129 add_subwindow(rotate_magnitude =
130 new MotionRMagnitude(plugin, x2 + title->get_w() + 10, y));
133 add_subwindow(title = new BC_Title(x2, y + 10, _("Rotation settling speed:")));
134 add_subwindow(rotate_return_speed =
135 new MotionRReturnSpeed(plugin, x2 + title->get_w() + 10, y));
137 add_subwindow(vectors = new MotionDrawVectors(plugin, this, x2, y));
140 add_subwindow(title = new BC_Title(x, y + 10, _("Block Y:")));
141 add_subwindow(block_y =
142 new MotionBlockY(plugin, this, x + title->get_w() + 10, y));
143 add_subwindow(block_y_text =
144 new MotionBlockYText(plugin, this,
145 x + title->get_w() + 10 + block_y->get_w() + 10, y + 10));
148 add_subwindow(title = new BC_Title(x, y + 10, _("Maximum absolute offset:")));
149 add_subwindow(magnitude = new MotionMagnitude(plugin,
150 x + title->get_w() + 10,
154 add_subwindow(title = new BC_Title(x, y + 10, _("Motion settling speed:")));
155 add_subwindow(return_speed =
156 new MotionReturnSpeed(plugin, x + title->get_w() + 10, y));
159 add_subwindow(track_single =
160 new TrackSingleFrame(plugin, this, x, y));
162 add_subwindow(track_previous =
163 new TrackPreviousFrame(plugin, this, x, y));
165 add_subwindow(previous_same =
166 new PreviousFrameSameBlock(plugin, this, x, y));
170 add_subwindow(title =
171 new BC_Title(x1=x2, y1, _("Frame number:")));
172 add_subwindow(track_frame_number =
173 new TrackFrameNumber(plugin, this, x1 += title->get_w(), y1));
174 add_subwindow(addtrackedframeoffset =
175 new AddTrackedFrameOffset(plugin, this, x1=x2, y1+=track_frame_number->get_h()));
176 int pef = client->server->mwindow->edl->session->video_every_frame;
177 add_subwindow(pef_title = new BC_Title(x1=x2, y1+=addtrackedframeoffset->get_h() + 5,
178 !pef ? _("For best results\n"
179 " Set: Play every frame\n"
180 " Preferences-> Playback-> Video Out") :
181 _("Currently using: Play every frame"), MEDIUMFONT,
182 !pef ? RED : GREEN));
184 add_subwindow(title = new BC_Title(x, y, _("Master layer:")));
185 add_subwindow(master_layer = new MasterLayer(plugin,
186 this, x + title->get_w() + 10, y));
187 master_layer->create_objects();
190 add_subwindow(title = new BC_Title(x, y, _("Action:")));
191 add_subwindow(action_type = new ActionType(plugin,
192 this, x + title->get_w() + 10, y));
193 action_type->create_objects();
196 add_subwindow(title = new BC_Title(x, y, _("Calculation:")));
197 add_subwindow(tracking_type = new TrackingType(plugin,
198 this, x + title->get_w() + 10, y));
199 tracking_type->create_objects();
204 void MotionWindow::update_mode()
206 global_range_w->update(plugin->config.global_range_w,
207 MIN_RADIUS, MAX_RADIUS);
208 global_range_h->update(plugin->config.global_range_h,
209 MIN_RADIUS, MAX_RADIUS);
210 rotation_range->update(plugin->config.rotation_range,
211 MIN_ROTATION, MAX_ROTATION);
212 vectors->update(plugin->config.draw_vectors);
213 tracking_file->update(plugin->config.tracking_file);
214 global->update(plugin->config.global);
215 rotate->update(plugin->config.rotate);
216 addtrackedframeoffset->update(plugin->config.addtrackedframeoffset);
219 MotionTrackingFile::MotionTrackingFile(MotionMain *plugin,
220 const char *filename, MotionWindow *gui, int x, int y)
221 : BC_TextBox(x, y, 150, 1, filename)
223 this->plugin = plugin;
227 int MotionTrackingFile::handle_event()
229 strcpy(plugin->config.tracking_file, get_text());
230 plugin->send_configure_change();
235 GlobalRange::GlobalRange(MotionMain *plugin,
236 int x, int y, int *value)
237 : BC_IPot(x, y, (int64_t)*value,
238 (int64_t)MIN_RADIUS, (int64_t)MAX_RADIUS)
240 this->plugin = plugin;
245 int GlobalRange::handle_event()
247 *value = (int)get_value();
248 plugin->send_configure_change();
255 RotationRange::RotationRange(MotionMain *plugin, int x, int y)
256 : BC_IPot(x, y, (int64_t)plugin->config.rotation_range,
257 (int64_t)MIN_ROTATION, (int64_t)MAX_ROTATION)
259 this->plugin = plugin;
263 int RotationRange::handle_event()
265 plugin->config.rotation_range = (int)get_value();
266 plugin->send_configure_change();
271 RotationCenter::RotationCenter(MotionMain *plugin, int x, int y)
272 : BC_IPot(x, y, (int64_t)plugin->config.rotation_center,
273 (int64_t)-MAX_ROTATION, (int64_t)MAX_ROTATION)
275 this->plugin = plugin;
279 int RotationCenter::handle_event()
281 plugin->config.rotation_center = (int)get_value();
282 plugin->send_configure_change();
287 BlockSize::BlockSize(MotionMain *plugin,
297 this->plugin = plugin;
302 int BlockSize::handle_event()
304 *value = (int)get_value();
305 plugin->send_configure_change();
310 GlobalSearchPositions::GlobalSearchPositions(MotionMain *plugin,
312 : BC_PopupMenu(x, y, w, "", 1)
314 this->plugin = plugin;
316 void GlobalSearchPositions::create_objects()
318 add_item(new BC_MenuItem("16"));
319 add_item(new BC_MenuItem("32"));
320 add_item(new BC_MenuItem("64"));
321 add_item(new BC_MenuItem("128"));
322 add_item(new BC_MenuItem("256"));
323 add_item(new BC_MenuItem("512"));
324 add_item(new BC_MenuItem("1024"));
325 add_item(new BC_MenuItem("2048"));
326 add_item(new BC_MenuItem("4096"));
327 add_item(new BC_MenuItem("8192"));
328 add_item(new BC_MenuItem("16384"));
329 add_item(new BC_MenuItem("32768"));
330 add_item(new BC_MenuItem("65536"));
331 add_item(new BC_MenuItem("131072"));
332 char string[BCTEXTLEN];
333 sprintf(string, "%d", plugin->config.global_positions);
337 int GlobalSearchPositions::handle_event()
339 plugin->config.global_positions = atoi(get_text());
340 plugin->send_configure_change();
345 RotationSearchPositions::RotationSearchPositions(MotionMain *plugin,
347 : BC_PopupMenu(x, y, w, "", 1)
349 this->plugin = plugin;
351 void RotationSearchPositions::create_objects()
353 add_item(new BC_MenuItem("4"));
354 add_item(new BC_MenuItem("8"));
355 add_item(new BC_MenuItem("16"));
356 add_item(new BC_MenuItem("32"));
357 char string[BCTEXTLEN];
358 sprintf(string, "%d", plugin->config.rotate_positions);
362 int RotationSearchPositions::handle_event()
364 plugin->config.rotate_positions = atoi(get_text());
365 plugin->send_configure_change();
370 MotionMagnitude::MotionMagnitude(MotionMain *plugin, int x, int y)
372 (int64_t)plugin->config.magnitude, (int64_t)0, (int64_t)100)
374 this->plugin = plugin;
377 int MotionMagnitude::handle_event()
379 plugin->config.magnitude = (int)get_value();
380 plugin->send_configure_change();
385 MotionReturnSpeed::MotionReturnSpeed(MotionMain *plugin, int x, int y)
387 (int64_t)plugin->config.return_speed, (int64_t)0, (int64_t)100)
389 this->plugin = plugin;
392 int MotionReturnSpeed::handle_event()
394 plugin->config.return_speed = (int)get_value();
395 plugin->send_configure_change();
401 AddTrackedFrameOffset::AddTrackedFrameOffset(MotionMain *plugin,
402 MotionWindow *gui, int x, int y)
403 : BC_CheckBox(x, y, plugin->config.addtrackedframeoffset,
404 _("Add (loaded) offset from tracked frame"))
406 this->plugin = plugin;
410 int AddTrackedFrameOffset::handle_event()
412 plugin->config.addtrackedframeoffset = get_value();
413 plugin->send_configure_change();
418 MotionRMagnitude::MotionRMagnitude(MotionMain *plugin, int x, int y)
420 (int64_t)plugin->config.rotate_magnitude, (int64_t)0, (int64_t)90)
422 this->plugin = plugin;
425 int MotionRMagnitude::handle_event()
427 plugin->config.rotate_magnitude = (int)get_value();
428 plugin->send_configure_change();
434 MotionRReturnSpeed::MotionRReturnSpeed(MotionMain *plugin, int x, int y)
436 (int64_t)plugin->config.rotate_return_speed, (int64_t)0, (int64_t)100)
438 this->plugin = plugin;
441 int MotionRReturnSpeed::handle_event()
443 plugin->config.rotate_return_speed = (int)get_value();
444 plugin->send_configure_change();
449 MotionGlobal::MotionGlobal(MotionMain *plugin,
450 MotionWindow *gui, int x, int y)
451 : BC_CheckBox(x, y, plugin->config.global, _("Track translation"))
453 this->plugin = plugin;
457 int MotionGlobal::handle_event()
459 plugin->config.global = get_value();
460 plugin->send_configure_change();
464 MotionRotate::MotionRotate(MotionMain *plugin,
465 MotionWindow *gui, int x, int y)
466 : BC_CheckBox(x, y, plugin->config.rotate, _("Track rotation"))
468 this->plugin = plugin;
472 int MotionRotate::handle_event()
474 plugin->config.rotate = get_value();
475 plugin->send_configure_change();
480 MotionBlockX::MotionBlockX(MotionMain *plugin,
481 MotionWindow *gui, int x, int y)
482 : BC_FPot(x, y, plugin->config.block_x, (float)0, (float)100)
484 this->plugin = plugin;
488 int MotionBlockX::handle_event()
490 plugin->config.block_x = get_value();
491 gui->block_x_text->update((float)plugin->config.block_x);
492 plugin->send_configure_change();
497 MotionBlockY::MotionBlockY(MotionMain *plugin,
503 (float)plugin->config.block_y,
507 this->plugin = plugin;
511 int MotionBlockY::handle_event()
513 plugin->config.block_y = get_value();
514 gui->block_y_text->update((float)plugin->config.block_y);
515 plugin->send_configure_change();
519 MotionBlockXText::MotionBlockXText(MotionMain *plugin,
520 MotionWindow *gui, int x, int y)
521 : BC_TextBox(x, y, 75, 1, (float)plugin->config.block_x)
523 this->plugin = plugin;
528 int MotionBlockXText::handle_event()
530 plugin->config.block_x = atof(get_text());
531 gui->block_x->update(plugin->config.block_x);
532 plugin->send_configure_change();
539 MotionBlockYText::MotionBlockYText(MotionMain *plugin,
540 MotionWindow *gui, int x, int y)
541 : BC_TextBox(x, y, 75, 1, (float)plugin->config.block_y)
543 this->plugin = plugin;
548 int MotionBlockYText::handle_event()
550 plugin->config.block_y = atof(get_text());
551 gui->block_y->update(plugin->config.block_y);
552 plugin->send_configure_change();
557 MotionDrawVectors::MotionDrawVectors(MotionMain *plugin,
558 MotionWindow *gui, int x, int y)
561 plugin->config.draw_vectors,
565 this->plugin = plugin;
568 int MotionDrawVectors::handle_event()
570 plugin->config.draw_vectors = get_value();
571 plugin->send_configure_change();
576 TrackSingleFrame::TrackSingleFrame(MotionMain *plugin,
582 plugin->config.tracking_object == MotionScan::TRACK_SINGLE,
583 _("Track single frame"))
585 this->plugin = plugin;
589 int TrackSingleFrame::handle_event()
591 plugin->config.tracking_object = MotionScan::TRACK_SINGLE;
592 gui->track_previous->update(0);
593 gui->previous_same->update(0);
594 gui->track_frame_number->enable();
595 plugin->send_configure_change();
599 TrackFrameNumber::TrackFrameNumber(MotionMain *plugin,
603 : BC_TextBox(x, y, 100, 1, plugin->config.track_frame)
605 this->plugin = plugin;
607 if(plugin->config.tracking_object != MotionScan::TRACK_SINGLE) disable();
610 int TrackFrameNumber::handle_event()
612 plugin->config.track_frame = atol(get_text());
613 plugin->send_configure_change();
618 TrackPreviousFrame::TrackPreviousFrame(MotionMain *plugin,
624 plugin->config.tracking_object == MotionScan::TRACK_PREVIOUS,
625 _("Track previous frame"))
627 this->plugin = plugin;
630 int TrackPreviousFrame::handle_event()
632 plugin->config.tracking_object = MotionScan::TRACK_PREVIOUS;
633 gui->track_single->update(0);
634 gui->previous_same->update(0);
635 gui->track_frame_number->disable();
636 plugin->send_configure_change();
641 PreviousFrameSameBlock::PreviousFrameSameBlock(MotionMain *plugin,
647 plugin->config.tracking_object == MotionScan::PREVIOUS_SAME_BLOCK,
648 _("Previous frame same block"))
650 this->plugin = plugin;
653 int PreviousFrameSameBlock::handle_event()
655 plugin->config.tracking_object = MotionScan::PREVIOUS_SAME_BLOCK;
656 gui->track_single->update(0);
657 gui->track_previous->update(0);
658 gui->track_frame_number->disable();
659 plugin->send_configure_change();
664 MasterLayer::MasterLayer(MotionMain *plugin, MotionWindow *gui, int x, int y)
668 to_text(plugin->config.bottom_is_master))
670 this->plugin = plugin;
674 int MasterLayer::handle_event()
676 plugin->config.bottom_is_master = from_text(get_text());
677 plugin->send_configure_change();
681 void MasterLayer::create_objects()
683 add_item(new BC_MenuItem(to_text(0)));
684 add_item(new BC_MenuItem(to_text(1)));
687 int MasterLayer::from_text(char *text)
689 if(!strcmp(text, _("Top"))) return 0;
693 char* MasterLayer::to_text(int mode)
695 return mode ? _("Bottom") : _("Top");
698 int MasterLayer::calculate_w(MotionWindow *gui)
701 result = MAX(result, gui->get_text_width(MEDIUMFONT, to_text(0)));
702 result = MAX(result, gui->get_text_width(MEDIUMFONT, to_text(1)));
707 ActionType::ActionType(MotionMain *plugin, MotionWindow *gui, int x, int y)
711 to_text(plugin->config.action_type))
713 this->plugin = plugin;
717 int ActionType::handle_event()
719 plugin->config.action_type = from_text(get_text());
720 plugin->send_configure_change();
724 void ActionType::create_objects()
726 add_item(new BC_MenuItem(to_text(MotionScan::TRACK)));
727 add_item(new BC_MenuItem(to_text(MotionScan::TRACK_PIXEL)));
728 add_item(new BC_MenuItem(to_text(MotionScan::STABILIZE)));
729 add_item(new BC_MenuItem(to_text(MotionScan::STABILIZE_PIXEL)));
730 add_item(new BC_MenuItem(to_text(MotionScan::NOTHING)));
733 int ActionType::from_text(char *text)
735 if(!strcmp(text, _("Track Subpixel"))) return MotionScan::TRACK;
736 if(!strcmp(text, _("Track Pixel"))) return MotionScan::TRACK_PIXEL;
737 if(!strcmp(text, _("Stabilize Subpixel"))) return MotionScan::STABILIZE;
738 if(!strcmp(text, _("Stabilize Pixel"))) return MotionScan::STABILIZE_PIXEL;
739 //if(!strcmp(text, _("Do Nothing"))) return MotionScan::NOTHING;
740 return MotionScan::NOTHING;
743 char* ActionType::to_text(int mode)
747 case MotionScan::TRACK:
748 return _("Track Subpixel");
749 case MotionScan::TRACK_PIXEL:
750 return _("Track Pixel");
751 case MotionScan::STABILIZE:
752 return _("Stabilize Subpixel");
753 case MotionScan::STABILIZE_PIXEL:
754 return _("Stabilize Pixel");
756 case MotionScan::NOTHING:
757 return _("Do Nothing");
761 int ActionType::calculate_w(MotionWindow *gui)
764 result = MAX(result, gui->get_text_width(MEDIUMFONT, to_text(MotionScan::TRACK)));
765 result = MAX(result, gui->get_text_width(MEDIUMFONT, to_text(MotionScan::TRACK_PIXEL)));
766 result = MAX(result, gui->get_text_width(MEDIUMFONT, to_text(MotionScan::STABILIZE)));
767 result = MAX(result, gui->get_text_width(MEDIUMFONT, to_text(MotionScan::STABILIZE_PIXEL)));
768 result = MAX(result, gui->get_text_width(MEDIUMFONT, to_text(MotionScan::NOTHING)));
773 TrackingType::TrackingType(MotionMain *plugin, MotionWindow *gui, int x, int y)
777 to_text(plugin->config.tracking_type))
779 this->plugin = plugin;
783 int TrackingType::handle_event()
785 plugin->config.tracking_type = from_text(get_text());
786 plugin->send_configure_change();
790 void TrackingType::create_objects()
792 add_item(new BC_MenuItem(to_text(MotionScan::SAVE)));
793 add_item(new BC_MenuItem(to_text(MotionScan::LOAD)));
794 add_item(new BC_MenuItem(to_text(MotionScan::CALCULATE)));
795 add_item(new BC_MenuItem(to_text(MotionScan::NO_CALCULATE)));
798 int TrackingType::from_text(char *text)
800 if(!strcmp(text, _("Save coords to tracking file"))) return MotionScan::SAVE;
801 if(!strcmp(text, _("Load coords from tracking file"))) return MotionScan::LOAD;
802 if(!strcmp(text, _("Recalculate"))) return MotionScan::CALCULATE;
803 //if(!strcmp(text, _("Don't Calculate"))) return MotionScan::NO_CALCULATE;
804 return MotionScan::NO_CALCULATE;
807 char* TrackingType::to_text(int mode)
811 case MotionScan::SAVE: return _("Save coords to tracking file");
812 case MotionScan::LOAD: return _("Load coords from tracking file");
813 case MotionScan::CALCULATE: return _("Recalculate");
815 case MotionScan::NO_CALCULATE: return _("Don't Calculate");
819 int TrackingType::calculate_w(MotionWindow *gui)
822 result = MAX(result, gui->get_text_width(MEDIUMFONT, to_text(MotionScan::NO_CALCULATE)));
823 result = MAX(result, gui->get_text_width(MEDIUMFONT, to_text(MotionScan::CALCULATE)));
824 result = MAX(result, gui->get_text_width(MEDIUMFONT, to_text(MotionScan::SAVE)));
825 result = MAX(result, gui->get_text_width(MEDIUMFONT, to_text(MotionScan::LOAD)));
830 TrackDirection::TrackDirection(MotionMain *plugin, MotionWindow *gui, int x, int y)
834 to_text(plugin->config.horizontal_only, plugin->config.vertical_only))
836 this->plugin = plugin;
840 int TrackDirection::handle_event()
842 from_text(&plugin->config.horizontal_only, &plugin->config.vertical_only, get_text());
843 plugin->send_configure_change();
847 void TrackDirection::create_objects()
849 add_item(new BC_MenuItem(to_text(1, 0)));
850 add_item(new BC_MenuItem(to_text(0, 1)));
851 add_item(new BC_MenuItem(to_text(0, 0)));
854 void TrackDirection::from_text(int *horizontal_only, int *vertical_only, char *text)
856 *horizontal_only = 0;
858 if(!strcmp(text, to_text(1, 0))) *horizontal_only = 1;
859 if(!strcmp(text, to_text(0, 1))) *vertical_only = 1;
862 char* TrackDirection::to_text(int horizontal_only, int vertical_only)
864 if(horizontal_only) return _("Horizontal only");
865 if(vertical_only) return _("Vertical only");
869 int TrackDirection::calculate_w(MotionWindow *gui)
872 result = MAX(result, gui->get_text_width(MEDIUMFONT, to_text(1, 0)));
873 result = MAX(result, gui->get_text_width(MEDIUMFONT, to_text(0, 1)));
874 result = MAX(result, gui->get_text_width(MEDIUMFONT, to_text(0, 0)));