Page MenuHomeWildfire Games

Add dynamic fitting for COList
Needs RevisionPublic

Authored by vladislavbelov on May 8 2017, 4:15 PM.

Details

Reviewers
elexis
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Summary

We have total width of all list, subtract visible column widths with absolute value. Now, we could distribute width between relative columns width.

Also we have an issue, that relative and absolute widths were independent (i.e. 2 columns: 300px and 70%, if list width is equal to 1000, then we have: empty space or overlapping.

It doesn't affect COList with only relative or only absolute widths, only with mixed. So it doesn't break current tables, just improve widths.

I.e. it'd be useful for D125, instead of hardcoded values.

Test Plan
  1. Run game
  2. Visual tests that all lists looks similar
  3. Add hidden="true" for any column, and look how it's dynamic resized

Diff Detail

Repository
rP 0 A.D. Public Repository
Lint
Lint Skipped
Unit
Unit Tests Skipped
Build Status
Buildable 1584
Build 2502: Vulcan BuildJenkins

Event Timeline

vladislavbelov created this revision.May 8 2017, 4:15 PM
Sandarac added inline comments.
source/gui/COList.cpp
71

const ref? (Though I notice it's not done for the other similar loops already in this file...)

Vulcan added a subscriber: Vulcan.May 9 2017, 5:53 AM

Build is green

Updating workspaces.
Build (release)...
Build (debug)...
Running release tests...
Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK!
Running debug tests...
Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK!

http://jw:8080/job/phabricator/1090/ for more details.

vladislavbelov marked an inline comment as done.

Added const refs.

Vulcan added a comment.May 9 2017, 2:31 PM

Build is green

Updating workspaces.
Build (release)...
Build (debug)...
Running release tests...
Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK!
Running debug tests...
Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK!

http://jw:8080/job/phabricator/1101/ for more details.

elexis edited edge metadata.May 10 2017, 2:24 PM

This will probably work but it has an issue. For the lobby and replay menu, we show the filters right above the columns, so we will need a way to find the column positions.
If we use a setting, then the column widths should also become settable (1. by definition of the word setting and 2. since settings are defacto changeable from JS).

You mentioned that the columns could become separate GUI objects, but to me that sounds like opening a can of worms, since we should only be able to set only very few properties of the columns (hidden, caption, width) and strictly not being able to change other settings (x coordinate, height (since all columns must have the same height)) or change click funcitons of the columns.

source/gui/COList.cpp
409

Afaics this could become a range based loop too, but would have to touch a number of lines, so not here, not now.

vladislavbelov added inline comments.May 10 2017, 2:30 PM
source/gui/COList.cpp
409

Nope, col uses here:

DrawText(col, color, leftTopCorner + CPos(0, 4), bz + 0.1f, rect_head);`

And column doesn't know its order number. So the current loop is ok.

elexis requested changes to this revision.May 24 2017, 6:19 PM

See above.

This revision now requires changes to proceed.May 24 2017, 6:19 PM