Updates GUI code to apply the correct usage of `guiObject.getTextSize()`
and `guiObject.GetPreferedTextSize()`.
- `guiObject.getPreferedTextSize()` is now used when the goal is to compute the
bounding box of a text string to dynamically resize or layout a GUI
object accordingly. It simulates how the text would be rendered,
accounting for markup and layout rules.
- `guiObject.getTextSize()` remains in use when text is being measured
within a fixed-size GUI element (e.g., a button or label). It respects
internal constraints like buffer zone and maxWidth, and is typically
used to align other elements based on its visual appearance.
These changes ensure more accurate text sizing and consistent layout
behavior across GUI components.
It is possible to modify sizes by setting the properties directly.
(Without having to create a copy of it)
This allows to shorten those passages quite a bit without any functional change.
This contains some small layout fixes and improvements for the
civilization overview and structure tree pages. Some of these fixes have
fix regressions introduced with 37065ebc71.
This increases the height StoneButtons and TabButtons, so that a
double-spaced caption does fit on them without significant overflow.
Exempt from that are the StoneButtons resembling lists in the main menu
and the in-game menu, as changing their height didn't feel right and we
don't need double-spaced captions for them anyway, as they're wide
enough.
The height of StoneButtons got increased from 28px to 32px, while the
height of TabButtons got increased from 30px to 34px.
- Left-clicking the portrait of a unit will make the camera follow that
unit (before: no action). A tooltip informs the player of this
possibility.
- Left-clicking the portrait of a structure will make the camera focus on
that structure (before: no action). A tooltip informs the player of
this possibility.
- Double-clicking a hero/treasure icon will make the camera follow that
hero/treasure (before: just focus on that hero/treasure).
- Some minor related changes.
Fixes#6879
They were all set to hidden-by-default as part of b7ff371d00, only there
wasn't anything to tell them to unhide when we actually want them. This
commit
fixes that.
Differential Revision: https://code.wildfiregames.com/D4114
This was SVN commit r25750.
The structTree, in case of errors, could have enough items to draw to
trigger an OOM failure in the Arena allocator.
This fixes that by hiding elements by default and some c++ memory
optimisation (mostly, this should make all platforms take the same
memory footprint for VisibleObject).
Discussed with vladislavbelov and s0600204
Differential Revision: https://code.wildfiregames.com/D4114
This was SVN commit r25746.
Currenlty there is regression in structuretree from b2842e8021, when
upgrade for sentry tower is not in the correct phase row.
Thix is fixing that.
Probably typo in condition.
Differential Revision: D3252
Reviewed by: bb
This was SVN commit r24461.
For those lucky enough to have screens with a high enough resolution to
display
a chosen civilisation's tree in its entirety, the Structure Tree page
now
determines the minimum space necessary to do so, and sizes itself
accordingly.
(e.g. The page no longer scales to fill the entire screen.)
For those on lower resolution screens, the page now takes up slightly
less space
vertically.
This was SVN commit r23813.
This patch corrects occurrences of “building” into “structure”.
Whilst “constructing a building” is proper English, it is important to
refer to one and the same thing with a single term, to avoid potential
misunderstandings (see
https://trac.wildfiregames.com/wiki/EnglishStyleGuide ), thence
“building a structure”, because the unit action is “build” and the
entity is a “structure” (see `simulation/templates/`).
Patch By: Nescio
Reviewed By: Gallaecio
Differential Revision: https://code.wildfiregames.com/D2429
This was SVN commit r23366.
Remove question by brian in single_details_area.xml from b66d1716e7
which is answered by "because the style set it".
Delete BuildNameText style, because it specifies ghost="true" in both
style and sole object using the style.
Don't touch progressbar and structree styles, because there is more to
clean.
Differential Revision: https://code.wildfiregames.com/D2292
This was SVN commit r22957.
Unify the two IGUIObject::LoadStyle functions and remove CGUI argument
that is always identical to the member.
Differential Revision: https://code.wildfiregames.com/D2232
Tested on: gcc 9.1.0., clang 8.0.1, Jenkins
This was SVN commit r22792.
Allows coding the GUI without global functions which break
prototype-oriented coding, refs #5322, fixing the concern in 4b1297b328.
Supports stacked message boxes and removes the according workaround.
Change structree / civinfo switch-dialog code from 760a47335d to perform
the callback for page that actually registered the callback.
Ensure the parent that the callbackhandler is always called if the page
is closed.
Merge PopGuiPage and PopGuiPageCB following that choice, incidentally
leaving cleaner code.
Differential Revision: https://code.wildfiregames.com/D1684
Comments by: Yves, Vladislav, wraitii, leper
This was SVN commit r22676.
Rename close() to closePage() for structree / template viewer / civ info
for global consistency.
Remove a splashscreen proxy and move splashscreen closing from XML to
closePage() in JS.
This was SVN commit r22669.
Further increasing the size for mods was neglected in d6c028923e / D527
and
Delenda Est had a copy of gamesetup.xml to extend the size already.
This was SVN commit r21353.
Right-click on icons of units, structures, technologies, flora, fauna,
etc. and view additional details.
Reviewed By: elexis
Fixes: #3212
Differential Revision: https://code.wildfiregames.com/D297
This was SVN commit r21310.
(Instead of non-phase techs which is what it was using up to now.)
Reviewed/accepted by: mimo
Changes agreed (but not tested/formally proven) by: elexis
Differential Revision: https://code.wildfiregames.com/D1181
This was SVN commit r20749.
This allows mods to add new JS files without introducing a hardly
maintainable copy of the XML file.
Differential Revision: https://code.wildfiregames.com/D619
Proofread By: bb
This was SVN commit r20535.
Unify civ file loading from gui/common/functions_civinfo.js and
rmgen/library.js in globalscripts/Templates.js.
Delete the two forgotton headers in 4275a8a33c.
Refs #4868, #4804, D900.
Differential Revision: https://code.wildfiregames.com/D1062
Discussed with: leper
This was SVN commit r20528.
Mark global consts as variable if mods can legitimately modify them.
Keep global objects const if mods should insert their modifications at a
different place, refs D829.
Mark the few consts inside function scope as let or var for consistency.
Don't touch the AI, simulation test and rmgen folder.
Change some var to let.
Remove an unused variable in the mainmenu and summary screen.
Inline few variables.
This was SVN commit r20047.
Mark g_CivData as const and don't use optional arguments at loadCivData.
Translate the infinity symbol in the summary screen.
Refs D829
Reviewed By: s0600204
This was SVN commit r20043.
so that the object has the same content throughout the entire GUI and
can be marked read-only.
Refs D829
Reviewed by: s0600204
This was SVN commit r20042.
Makes it possible to reuse the more generic parts of the `structree`
codebase in other pages without including `structree`-specific logic.
This sets the stage for further reference/encyclopedia-type pages.
Reviewed By: fatherbushido, elexis
Differential Revision: https://code.wildfiregames.com/D295
This was SVN commit r19940.