Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

View NewGRF Readme's ingame #4780

Closed
DorpsGek opened this issue Sep 18, 2011 · 8 comments
Closed

View NewGRF Readme's ingame #4780

DorpsGek opened this issue Sep 18, 2011 · 8 comments
Labels
flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) patch from FlySpray This issue is in fact a Patch, but imported from FlySrpay

Comments

@DorpsGek
Copy link
Member

LordAro opened the ticket and wrote:

Hello.

I (and other devs extensively) have been making a patch that allows you to read the readme of a newgrf ingame (as long as it has one)

The only known issue is that the TrimWhitespace() function only checks the beginning and end of the readme char, not each line of it

patch is hg-git style (-p1) and against r22941

Attachments

Reported version: trunk
Operating system: All


This issue was imported from FlySpray: https://bugs.openttd.org/task/4780
@DorpsGek
Copy link
Member Author

planetmaker wrote:

Very nice thing. During testing I found though, that the end of files is a bit truncated (random idea: maybe difference between line heights and actual scroll steps?)

Attachments


This comment was imported from FlySpray: https://bugs.openttd.org/task/4780#comment10377

@DorpsGek
Copy link
Member Author

LordAro wrote:

hmm. i cannot reproduce this.
which version of firs?
i think the os would be good too.

come on, make a proper bug report ;P


This comment was imported from FlySpray: https://bugs.openttd.org/task/4780#comment10394

@DorpsGek
Copy link
Member Author

planetmaker wrote:

What shall I say? It shows the same for every readme (firs, I checked, not just that one. What more info do you need? I don't think it matters as the hardware and OS at this level is quite abstracted away; I tested on OSX 10.6.8 compiled as x86_64 with debugging enabled.

Do you use the default sprite fonts? Did you try both base sets?


This comment was imported from FlySpray: https://bugs.openttd.org/task/4780#comment10396

@DorpsGek
Copy link
Member Author

monoid wrote:

Cool idea.

I've gone through your patch, and added some comments. Look out for lines starting with "# # # ".

Attachments


This comment was imported from FlySpray: https://bugs.openttd.org/task/4780#comment10398

@DorpsGek
Copy link
Member Author

LordAro wrote:

new patch!

most, but not all of monoid's suggestions have been implemented, including the deletion of TrimWhitespace() - too much trouble

also i would like to say that implementing your changes to vscroll->GetCapacityFromWidget() actually caused me to see planetmaker's bug :) i have hopefully fixed that though

Attachments


This comment was imported from FlySpray: https://bugs.openttd.org/task/4780#comment10401

@DorpsGek
Copy link
Member Author

LordAro wrote:

i should probably mention that i have no idea what's wrong with the scrollbars, and if someone else wants a go, by all means post the result :)

i believe the problem to be something to do with the FillDrawPixelInfo() function in drawwidget()


This comment was imported from FlySpray: https://bugs.openttd.org/task/4780#comment10402

@DorpsGek
Copy link
Member Author

Alberth wrote:

It has indeed.

As monoid said: "The dimensions passed to DrawString are relative to the DrawPixelInfo you set in FillDrawPixelInfo above.."
(I should have realized this sooner, sorry).

As you set the top-left to (r.left, r.top), you don't need to add r.left and r.top to left and top any-more (also mentioned by monoid already). That also makes 'top' mostly useless, you can easily eliminate it.
I am quite puzzled why you set the padding-parameter of vscrollbar->getCapacityFromWidget() to this->line_height. I am guessing you were trying to compensate for r.top above, but it should be this->top_spacing + this->bottom_spacing (which you add in UpdateWidgetSize).

Possible further improvements:
- Alignment of text is not so good due to using a proportional font (at least at my screen).
- TAB replacement by space makes indenting and making nice columns pretty much impossible (partially also due to the proportional font).
- Handling of trailing whitespace at a line
- Handling of empty lines at the start and end of the text.
- Check for a readme file in the language of the user first.
- Support for UTF-8 (many non-english readmes have non-ascii characters).


This comment was imported from FlySpray: https://bugs.openttd.org/task/4780#comment10415

@DorpsGek
Copy link
Member Author

peter1138 closed the ticket.

Reason for closing: Implemented

In r23178


This comment was imported from FlySpray: https://bugs.openttd.org/task/4780

@DorpsGek DorpsGek added Core flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) patch from FlySpray This issue is in fact a Patch, but imported from FlySrpay labels Apr 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) patch from FlySpray This issue is in fact a Patch, but imported from FlySrpay
Projects
None yet
Development

No branches or pull requests

1 participant