News:

Do you need help?
Simutrans Wiki Manual can help you to play and extend Simutrans. In 9 languages.

[r8914] Tab header image uses irrelevant player colors

Started by Ranran, March 24, 2022, 12:21:33 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Ranran

Firstly, the images in the "inactive" tabs are painted in the color of the "active" player. (If the player color is used for the image)
This is odd behavior. For example, if you open a line edit dialog for the red player and then change to the blue player, the tab header image changes to blue, even though the dialog is for a line with a red player. The title bar remains red. Here, the tab header image creates confusion.

Secondly, the "selected" tab will change to the color of "player 1". For example, if the image uses the player color, changing the color of the player 1 to red will change the image to red.
So for Player 1, the colors of all tabs are the colors of Player 1. Other players are not.

Since we rarely see examples of the use of player colors for waytype symbols, we can assume that there have been very few instances of this bug being reproduced. The attached image will allow you to test this.

However, as this test shows, it is difficult to make good use of player-colored symbols in the current specifications, so I am wondering if it is worth enabling this. It may work well when used as a flat image or accent that does not use color gradients.
It is almost impossible to draw in three dimensions. There are colors that are too bright and too dark, which is too uncontrollable for designers.

Ranran

There are two solutions I can think of
1. tab header image ignores player color. In other words, for tabbed image display, assign -1 to the image display function's player_nr.
2. The image in the tab header displays colors based on the "owner of the dialog", not the currently active player. To achieve this, gui_tab_panel_t must be modified to be able to hold the number of the owner of the gui_frame in which it is placed.

I think 1 is the easiest, and even if we implement 2, few paksets will take advantage of it.

Roboron

Currently in r10666 tab header images do not seem to apply player colour, so I guess solution 1 was implemented at some point?

Ranran

Quote from: Roboron on June 23, 2022, 04:39:52 PMurrently in r10666 tab header images do not seem to apply player colour, so I guess solution 1 was implemented at some point?
I don't think so...

https://github.com/aburch/simutrans/blob/master/src/simutrans/gui/components/gui_tab_panel.cc

display_base_img(iter.img->get_id(), x, y, world()->get_active_player_nr(), false, true);display_color_img(iter.img->get_id(), x, y, 0, false, true);Those codes have not changed. It uses the color of the active player or player 0.
Try using icons painted in the player's colors.

The strange thing about this player color setting is that there are cases where player 0's player colors are used for all players, as the code shows. Note that pubric player is player 1.

Specifically, the currently selected tab is painted with the player color of player 0. Therefore, for player 0, the color of the currently selected and non-selected tabs are the same. In the case of Player 2, the color of the currently selected tab is Player 0's color, and the otherwise unselected tab is own player's color.

prissi

Unfortunately display_base_img with player color 0 and -1 is exactly the same, it will use the default colors of player 0.

See inside simgraph15.cc
if(player_nr>=0) {
activate_player_color( player_nr, daynight );
}
else {
// no player
activate_player_color( 0, daynight );
}

Ranran

Quote from: prissi on June 24, 2022, 12:27:05 PMUnfortunately display_base_img with player color 0 and -1 is exactly the same, it will use the default colors of player 0.

See inside simgraph15.cc
        if(player_nr>=0) {
            activate_player_color( player_nr, daynight );
        }
        else {
            // no player
            activate_player_color( 0, daynight );
        }
In that case, is the public player's number better?

prissi

Maybe, although one can also alter its colors ...

CHanged in r10674