Commit Graph

9 Commits

Author SHA1 Message Date
PeterN 0b460bf4a1
Fix: 'Cache' top and bottom lines of textfile viewer to avoid overdraw. (#9131)
* Fix: 'Cache' top and bottom lines of textfile viewer to avoid overdraw.

The text file viewer calculated the number of lines required to set the scrollbar, but did not retain this information, so this was recalculated on every draw operation. This includes overdrawing text outside the bounds of the current scroll position.

With this change the top and bottom lines for each line of text are remembered, and reflowing is avoided where possible. Text outside the current scroll bounds is not drawn.
Additionally the scroll interval is now based on text lines instead of pixel lines, which increases the text capacity depending on the font size.

* Fix: Limit text viewer to showing 64k lines.

Text files with more than 64k wrapped lines would exceed the scrollbar capacity and cause an assert. This is harder to reach now that the scrollbar counts lines instead of pixels.
2021-04-29 18:58:26 +01:00
S. D. Cloudt 13cc8a0cee Cleanup: Removed SVN headers 2019-11-10 17:59:20 +00:00
Michael Lutz d2ed426077 Codechange: [Win32] Pass a native GDI font description around when we have one, instead of repeatedly guessing the font. 2019-05-14 11:21:36 +01:00
Henry Wilson c01a2e2a81 Codechange: Removed SmallVector completely 2019-03-26 20:15:57 +00:00
peter1138 b1fb3f4fb8 Codechange: More use of override keyword. 2019-03-24 17:38:42 +00:00
frosch dfa0e61f25 (svn r25816) -Add [FS#5748]: Toggle button for wrapping lines in the textfile GUI (LordAro) 2013-10-06 11:29:14 +00:00
rubidium 6356178a25 (svn r23936) -Feature [FS#5047]: readme/licence/changelog viewer for AI and game scripts (LordAro) 2012-02-12 10:58:18 +00:00
rubidium 58269b7ad2 (svn r23935) -Codechange: generalise GetTextfile 2012-02-12 10:51:43 +00:00
rubidium e8dbcf9043 (svn r23932) -Codechange: split the NewGRF text window into its own source files 2012-02-12 10:32:41 +00:00