GUI: improved gui scale support (part of #969, #6887):

- added GUI scale support for dialog titles;
- added GUI scale support for hints tool;
- fixed broken font in chat and game logs on settings change;
- fixed wrong size of pick choice dialog in some use cases;
This commit is contained in:
Oleg Agafonov 2024-07-28 11:47:12 +04:00
parent 1578ab7946
commit 8186b35dfb
9 changed files with 56 additions and 26 deletions

View file

@ -11,8 +11,6 @@ import mage.view.PlayerView;
import mage.view.UserRequestMessage;
import javax.swing.*;
import javax.swing.GroupLayout.Alignment;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.awt.event.*;
@ -77,10 +75,6 @@ public class PlayAreaPanel extends javax.swing.JPanel {
battlefieldPanel.cleanUp();
playerPanel.cleanUp();
for (ActionListener al : btnCheat.getActionListeners()) {
btnCheat.removeActionListener(al);
}
// Taken form : https://community.oracle.com/thread/2183145
// removed the internal focus of a popupMenu data to allow GC before another popup menu is selected
for (ChangeListener listener : MenuSelectionManager.defaultManager().getChangeListeners()) {
@ -514,7 +508,6 @@ public class PlayAreaPanel extends javax.swing.JPanel {
this.playerId = player.getPlayerId();
this.playerName = player.getName();
this.isMe = player.getControlled();
this.btnCheat.setVisible(SessionHandler.isTestMode());
}
public final void update(GameView game, PlayerView player, Set<UUID> possibleTargets) {
@ -536,17 +529,14 @@ public class PlayAreaPanel extends javax.swing.JPanel {
private void initComponents() {
setBorder(BorderFactory.createLineBorder(new Color(0, 0, 0, 0)));
playerPanel = new PlayerPanelExt(GUISizeHelper.playerPanelGuiScale);
btnCheat = new javax.swing.JButton(); // TODO: not used? Delete
battlefieldPanel = new mage.client.game.BattlefieldPanel();
battlefieldPanel.setTopPanelBattlefield(options.topRow);
battlefieldPanel.setPreferredSize(new Dimension(Short.MAX_VALUE, Short.MAX_VALUE));
btnCheat.setText("Cheat");
btnCheat.addActionListener(evt -> btnCheatActionPerformed(evt));
this.setLayout(new BorderLayout());
this.add(playerPanel, BorderLayout.WEST);
this.add(battlefieldPanel, BorderLayout.CENTER);
this.add(Box.createRigidArea(new Dimension(0, 10)), BorderLayout.SOUTH); // bottom free space
}
private void btnCheatActionPerformed(java.awt.event.ActionEvent evt) {
@ -577,8 +567,6 @@ public class PlayAreaPanel extends javax.swing.JPanel {
}
private mage.client.game.BattlefieldPanel battlefieldPanel;
private javax.swing.JButton btnCheat;
//private javax.swing.JScrollPane jScrollPane1;
private PlayerPanelExt playerPanel;
}