GUI, preferences: reworked size settings:

- added size settings for player's panel size (closes #12455, closes #12451, closes #5605);
- size settings can be edit by slider or by text edit;
- size settings for fonts has preview button with real text sample;
- improved some tabs and hints for better UX;
- improved GUI rendering performance;
This commit is contained in:
Oleg Agafonov 2024-07-21 23:35:44 +04:00
parent 921e656e3c
commit 1f3fad6594
15 changed files with 3224 additions and 5913 deletions

View file

@ -7,7 +7,9 @@ import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JViewport;
@SuppressWarnings("serial")
/**
* GUI component: JPanel with background image
*/
public class ImagePanel extends JPanel {
@ -24,6 +26,8 @@ public class ImagePanel extends JPanel {
this.image = image;
this.style = style;
setLayout(new BorderLayout());
setOpaque(true);
}
public void setImageAlignmentX(float alignmentX) {
@ -56,7 +60,6 @@ public class ImagePanel extends JPanel {
super.add(component, constraints);
}
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);

View file

@ -46,7 +46,8 @@ public class PlayerView implements Serializable {
private final List<CommandObjectView> commandList = new ArrayList<>();
private final List<UUID> attachments = new ArrayList<>();
private final int statesSavedSize;
private final int priorityTimeLeft;
private final long priorityTimeSavedTimeMs;
private final int priorityTimeLeftSecs;
private final int bufferTimeLeft;
private final boolean passedTurn; // F4
private final boolean passedUntilEndOfTurn; // F5
@ -71,7 +72,8 @@ public class PlayerView implements Serializable {
this.manaPool = new ManaPoolView(player.getManaPool());
this.isActive = (player.getId().equals(state.getActivePlayerId()));
this.hasPriority = player.getId().equals(state.getPriorityPlayerId());
this.priorityTimeLeft = player.getPriorityTimeLeft();
this.priorityTimeLeftSecs = player.getPriorityTimeLeft();
this.priorityTimeSavedTimeMs = System.currentTimeMillis();
this.bufferTimeLeft = player.getBufferTimeLeft();
this.timerActive = (this.hasPriority && player.isGameUnderControl())
|| (player.getPlayersUnderYourControl().contains(state.getPriorityPlayerId()))
@ -270,8 +272,10 @@ public class PlayerView implements Serializable {
return statesSavedSize;
}
public int getPriorityTimeLeft() {
return priorityTimeLeft;
public int getPriorityTimeLeftSecs() {
// workaround to find real time
int secsAfterUpdate = (int) ((System.currentTimeMillis() - this.priorityTimeSavedTimeMs) / 1000);
return Math.max(0, this.priorityTimeLeftSecs - secsAfterUpdate);
}
public int getBufferTimeLeft() {