summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2018-07-25 16:59:37 +0100
committerCarl Hetherington <cth@carlh.net>2018-07-25 16:59:37 +0100
commit86ae192dcb097bd9a4afaf7f28e3e41ce178dfec (patch)
treef10f1278daa85914dde6f496e55f57415f961595
parentf80740363455d4c78f4132f9e58006a84034b9d0 (diff)
Make characters red if they are too long in the closed caption view.
-rw-r--r--src/wx/closed_captions_dialog.cc10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/wx/closed_captions_dialog.cc b/src/wx/closed_captions_dialog.cc
index 3e240c6e8..857db66a8 100644
--- a/src/wx/closed_captions_dialog.cc
+++ b/src/wx/closed_captions_dialog.cc
@@ -63,7 +63,15 @@ ClosedCaptionsDialog::paint ()
dc.SetFont (font);
for (int i = 0; i < _num_lines; ++i) {
- dc.DrawText (_lines[i], 8, line_height * i);
+ wxString const good = _lines[i].Left (_num_chars_per_line);
+ dc.DrawText (good, 8, line_height * i);
+ if (_lines[i].Length() > _num_chars_per_line) {
+ wxString const bad = _lines[i].Right (_lines[i].Length() - _num_chars_per_line);
+ wxSize size = dc.GetTextExtent (good);
+ dc.SetTextForeground (*wxRED);
+ dc.DrawText (bad, 8 + size.GetWidth(), line_height * i);
+ dc.SetTextForeground (*wxWHITE);
+ }
}
}