Page MenuHomeWildfire Games

Allow cText to be non-wrapping
Needs ReviewPublic

Authored by bb on Sep 28 2020, 11:32 PM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

cText currently wraps the texts in lines according to the size of the object. However the overlayCounters since rP24075/rP24076, want the text to be non-wrapped, and then set the size themselves. Hence allowing non-wrapping text fields and using it for the overlayCounters

Test Plan

Note that Width == 0 won't work due to newlines
Note that we must redefine the width since it is used for position computations.

Event Timeline

bb created this revision.Sep 28 2020, 11:32 PM
bb added inline comments.
binaries/data/mods/public/gui/common/OverlayCounterManager.js
106

elexis noticed this causes a bug on itself too, due to the out of scope reference below. Accidentally already fixed.

Successful build - Chance fights ever on the side of the prudent.

builderr-release-macos.txt
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/libsimulation2.a(precompiled.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/libatlas.a(precompiled.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/libgui.a(precompiled.o) has no symbols

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/1605/display/redirect

bb requested review of this revision.Sep 28 2020, 11:43 PM
bb updated this revision to Diff 13571.Sep 29 2020, 12:08 AM

Years

Successful build - Chance fights ever on the side of the prudent.

builderr-release-macos.txt
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/libgui.a(precompiled.o) has no symbols

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/1606/display/redirect

Stan added a subscriber: Stan.Sep 29 2020, 7:18 AM

Maybe text_nowrap to match the others? On the web it's actually whitespace: nowrap. But since we have text_* and text* variants of properties I'm not sure.

bb updated this revision to Diff 13576.Sep 29 2020, 10:56 AM

no_text_wrap => text_nowrap
initialize lastTextSize per elexis request
Fix allignment issue

Successful build - Chance fights ever on the side of the prudent.

builderr-release-macos.txt
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/libengine.a(precompiled.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/libgui.a(precompiled.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/liblowlevel.a(dbghelp.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/liblowlevel.a(file_stats.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/liblowlevel.a(vfs_path.o) has no symbols

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/1609/display/redirect

bb updated this revision to Diff 13577.Sep 29 2020, 1:07 PM

Some stylistic fixes

Successful build - Chance fights ever on the side of the prudent.

builderr-release-macos.txt
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/libgui.a(precompiled.o) has no symbols

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/1610/display/redirect

bb updated this revision to Diff 13578.Sep 29 2020, 6:08 PM

Better noWrap handling

Successful build - Chance fights ever on the side of the prudent.

builderr-release-macos.txt
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/libgui.a(precompiled.o) has no symbols

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/1611/display/redirect

bb added a comment.Sep 29 2020, 7:25 PM

These Width == 0 checks are nagging me a bit, they seem to have some undefined behaviour.

Having Width == 0 and text_nowrap both is the code duplicating. Why not to fix Width == 0 with new lines? Or to tie them together by renaming (like text_nowrap and text_wrap_width)?

In D3022#132594, @bb wrote:

These Width == 0 checks are nagging me a bit, they seem to have some undefined behaviour.

The behaviour is defined, when you use predefined constant, but in case Width was calculated it might be different.

source/gui/CGUIText.cpp
87

const bool noWrap.

source/gui/CGUIText.h
241

Different order of bools.

bb added a comment.Oct 12 2020, 8:26 PM

How is the behavior for Width==0 defined? The Width usually refers to the horizontal size of the guiObject. Having Width==0 work as nowrap doesn't work due to L235/L240 in cGUIString.cpp and we have to do something is Width==0.