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

Codechange: Add widget text colour and alignment property, along with widget parts. #9063

Merged
merged 5 commits into from Apr 22, 2021

Conversation

PeterN
Copy link
Member

@PeterN PeterN commented Apr 19, 2021

Motivation / Problem

Currently widget text that is not intended to be aligned to the default behaviour of the widget, or requires a specific text colour, has to be drawn manually by the DrawWidgets() handler of the window.

Description

This PR adds text_colour and align properties to NWidgetCore, with defaults as current behaviour, and NWidgetParts to allow setting these properties from static nested widgets.

This allows some window designs to be simplified by removing custom drawing techniques.

Three existing windows are updated by this PR:

  • Chat message box.
  • Labels in the advanced face window.
  • Company finance loan values.

Limitations

The existing StringAlignment enum is misnamed for use with images...

Checklist for review

Some things are not automated, and forgotten often. This list is a reminder for the reviewers.

  • The bug fix is important enough to be backported? (label: 'backport requested')
  • This PR affects the save game format? (label 'savegame upgrade')
  • This PR affects the GS/AI API? (label 'needs review: Script API')
    • ai_changelog.hpp, gs_changelog.hpp need updating.
    • The compatibility wrappers (compat_*.nut) need updating.
  • This PR affects the NewGRF API? (label 'needs review: NewGRF')

@PeterN PeterN force-pushed the widget-set-alignment branch 2 times, most recently from ba043a4 to cc81ca4 Compare April 21, 2021 09:57
@PeterN PeterN changed the title Codechange: Add internal widget alignment property, along with widget part. Codechange: Add widget text colour and alignment property, along with widget parts. Apr 21, 2021
@PeterN PeterN marked this pull request as ready for review April 21, 2021 10:13
src/widget_type.h Outdated Show resolved Hide resolved
@PeterN PeterN force-pushed the widget-set-alignment branch 3 times, most recently from ca8616e to 35099dc Compare April 22, 2021 09:08
src/widget_type.h Outdated Show resolved Hide resolved
Copy link
Member

@LordAro LordAro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No further issues

@PeterN PeterN merged commit 994ffaa into OpenTTD:master Apr 22, 2021
@PeterN PeterN deleted the widget-set-alignment branch April 22, 2021 15:42
PeterN added a commit to PeterN/OpenTTD that referenced this pull request May 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants