diff --git a/megamek/i18n/megamek/client/messages.properties b/megamek/i18n/megamek/client/messages.properties
index ec565b91c68..f63d12f2740 100644
--- a/megamek/i18n/megamek/client/messages.properties
+++ b/megamek/i18n/megamek/client/messages.properties
@@ -112,6 +112,8 @@ Cancel=Cancel
Close=Close
Next=Next
Previous=Previous
+Left=Left
+Right=Right
to=to
Error=Error
FROM=from
@@ -1558,8 +1560,10 @@ FiringDisplay.its_your_turn=It's your turn to fire.
FiringDisplay.fireMode=Mode
FiringDisplay.fireMore=More...
FiringDisplay.fireNextTarg=Next Target
-FiringDisplay.fireNextTarg.tooltip=Selects the next target (regardless of to hit.)
Holding shift when clicking will show next valid target that can be hit.
Holding control when clicking will cause allies to be ignored.
+FiringDisplay.fireNextTarg.tooltip=Selects the next target (regardless of to hit.)
Holding shift when clicking will show next valid target that can be hit.
Holding control when clicking will cause allies to be ignored.
FiringDisplay.fireNext=\ Next Unit
+FiringDisplay.FireNextTarget.tooltip.Valid=Valid
+FiringDisplay.FireNextTarget.tooltip.NoAllies=No Allies
FiringDisplay.fireStrafe=Strafe
FiringDisplay.OverheatNag.title=Allow overheating?
FiringDisplay.OverheatNag.message=Do you really wish to overheat? This will require a control roll.
@@ -2335,6 +2339,8 @@ MovementDisplay.UpToSpeed=Selected unit is up to speed so it can run/flank
MovementDisplay.UnjamRAC.title=Unjam?
MovementDisplay.UnjamRAC.message=Do you really wish to unjam? This will end your movement.
MovementDisplay.Mode=Mode
+MovementDisplay.tooltip.ToggleMode=Toggle Mode
+MovementDisplay.tooltip.ToggleMoveJump=Toggle Move / Jump
#Movement Mode display text
MovementType.None=None
@@ -3171,6 +3177,8 @@ TargetingPhaseDisplay.fireCancel=Cancel
TargetingPhaseDisplay.fireMode=Mode
TargetingPhaseDisplay.fireNextTarg=Next Target
TargetingPhaseDisplay.fireNextTarg.tooltip=Selects the next target (regardless of to hit.) \nHolding Control when clicking will show next valid target that can be hit.
+TargetingPhaseDisplay.FireNextTarget.tooltip.Valid=Valid
+TargetingPhaseDisplay.FireNextTarget.tooltip.NoAllies=No Allies
TargetingPhaseDisplay.fireNext=Next Unit
TargetingPhaseDisplay.fireSkip=Skip
TargetingPhaseDisplay.fireTwist=Twist
diff --git a/megamek/mmconf/defaultKeyBinds.xml b/megamek/mmconf/defaultKeyBinds.xml
index c4fe389f7e5..d9091a123bd 100644
--- a/megamek/mmconf/defaultKeyBinds.xml
+++ b/megamek/mmconf/defaultKeyBinds.xml
@@ -78,15 +78,15 @@
- nextWeapon
- 69
+ nextWeapon
+ 40
0
false
- prevWeapon
- 81
+ prevWeapon
+ 38
0
false
@@ -106,58 +106,58 @@
- nextTarget
- 129
+ nextTarget
+ 39
0
false
- prevTarget
- 129
+ prevTarget
+ 37
0
false
- nextTargetValid
- 129
- 0
+ nextTargetValid
+ 39
+ 64
false
- prevTargetValid
- 129
- 0
+ prevTargetValid
+ 37
+ 64
false
- nextTargetNoAllies
- 129
- 0
+ nextTargetNoAllies
+ 39
+ 128
false
- prevTargetNoAllies
- 129
- 0
+ prevTargetNoAllies
+ 37
+ 128
false
- nextTargetValidNoAllies
- 67
- 0
+ nextTargetValidNoAllies
+ 39
+ 192
false
- prevTargetValidNoAllies
- 90
- 0
+ prevTargetValidNoAllies
+ 37
+ 192
false
@@ -197,8 +197,8 @@
- autoArtyDeployZone
- 32
+ autoArtyDeployZone
+ 90
64
false
@@ -274,15 +274,15 @@
- prevMode
- 9
+ prevMode
+ 225
0
false
- nextMode
- 9
+ nextMode
+ 224
0
false
@@ -302,9 +302,9 @@
- fieldOfFire
- 70
- 128
+ fieldOfFire
+ 82
+ 0
false
diff --git a/megamek/src/megamek/client/ui/swing/AbstractPhaseDisplay.java b/megamek/src/megamek/client/ui/swing/AbstractPhaseDisplay.java
index eeba2eb5f55..1757859bb87 100644
--- a/megamek/src/megamek/client/ui/swing/AbstractPhaseDisplay.java
+++ b/megamek/src/megamek/client/ui/swing/AbstractPhaseDisplay.java
@@ -105,8 +105,9 @@ public void actionPerformed(ActionEvent e) {
@Override
public boolean shouldPerformAction() {
- if ((!clientgui.getClient().isMyTurn() && (clientgui
- .getClient().getGame().getTurn() != null))
+ if (((!clientgui.getClient().isMyTurn()
+ && (clientgui.getClient().getGame().getTurn() != null)
+ && (!clientgui.getClient().getGame().getPhase().isReport())))
|| clientgui.getBoardView().getChatterBoxActive()
|| display.isIgnoringEvents()
|| !display.isVisible()
diff --git a/megamek/src/megamek/client/ui/swing/DeployMinefieldDisplay.java b/megamek/src/megamek/client/ui/swing/DeployMinefieldDisplay.java
index c82a78d2ef8..5affb35c195 100644
--- a/megamek/src/megamek/client/ui/swing/DeployMinefieldDisplay.java
+++ b/megamek/src/megamek/client/ui/swing/DeployMinefieldDisplay.java
@@ -15,8 +15,8 @@
import megamek.client.event.BoardViewEvent;
import megamek.client.ui.Messages;
+import megamek.client.ui.swing.util.KeyCommandBind;
import megamek.client.ui.swing.widget.MegamekButton;
-import megamek.client.ui.swing.widget.SkinSpecification;
import megamek.common.*;
import megamek.common.event.GamePhaseChangeEvent;
import megamek.common.event.GameTurnChangeEvent;
@@ -25,6 +25,9 @@
import java.awt.event.MouseEvent;
import java.util.*;
+import static megamek.client.ui.swing.util.UIUtil.guiScaledFontHTML;
+import static megamek.client.ui.swing.util.UIUtil.uiLightViolet;
+
public class DeployMinefieldDisplay extends StatusBarPhaseDisplay {
private static final long serialVersionUID = -1243277953037374936L;
@@ -35,31 +38,49 @@ public class DeployMinefieldDisplay extends StatusBarPhaseDisplay {
* appropriate for.
* @author arlith
*/
- public enum Command {
+ public static enum DeployMinefieldCommand implements PhaseCommand {
DEPLOY_MINE_CONV("deployMineConv"),
DEPLOY_MINE_COM("deployMineCom"),
DEPLOY_MINE_VIBRA("deployMineVibra"),
DEPLOY_MINE_ACTIVE("deployMineActive"),
DEPLOY_MINE_INFERNO("deployMineInferno"),
REMOVE_MINES("removeMines");
-
+
+ /**
+ * Priority that determines this buttons order
+ */
+ public int priority;
String cmd;
- Command(String c) {
+
+ DeployMinefieldCommand(String c) {
cmd = c;
}
-
+
+ @Override
public String getCmd() {
return cmd;
}
+ @Override
+ public int getPriority() {
+ return priority;
+ }
+ @Override
+ public void setPriority(int p) {
+ priority = p;
+ }
@Override
public String toString() {
- return cmd;
+ return Messages.getString("DeployMinefieldDisplay." + getCmd());
+ }
+
+ public String getHotKeyDesc() {
+ return "";
}
}
// buttons
- protected Map buttons;
+ protected Map buttons;
private boolean deployM = false;
private boolean deployC = false;
@@ -84,33 +105,38 @@ public DeployMinefieldDisplay(ClientGUI clientgui) {
p = clientgui.getClient().getLocalPlayer();
- buttons = new HashMap<>((int) (Command.values().length * 1.25 + 0.5));
- for (Command cmd : Command.values()) {
- String title = Messages.getString("DeployMinefieldDisplay."
- + cmd.getCmd());
- MegamekButton newButton = new MegamekButton(title,
- SkinSpecification.UIComponents.PhaseDisplayButton.getComp());
- String ttKey = "DeployMinefieldDisplay." + cmd.getCmd() + ".tooltip";
- if (Messages.keyExists(ttKey)) {
- newButton.setToolTipText(Messages.getString(ttKey));
- }
- newButton.addActionListener(this);
- newButton.setActionCommand(cmd.getCmd());
- newButton.setEnabled(false);
- buttons.put(cmd, newButton);
- }
- numButtonGroups = (int) Math.ceil((buttons.size()+0.0) / buttonsPerGroup);
-
+ setButtons();
+ setButtonsTooltips();
+
butDone.setText(Messages.getString("DeployMinefieldDisplay.Done"));
+ String f = guiScaledFontHTML(uiLightViolet()) + KeyCommandBind.getDesc(KeyCommandBind.DONE)+ "";
+ butDone.setToolTipText("" + f + "");
butDone.setEnabled(false);
-
+
setupButtonPanel();
}
+ @Override
+ protected void setButtons() {
+ buttons = new HashMap<>((int) (DeployMinefieldCommand.values().length * 1.25 + 0.5));
+ for (DeployMinefieldCommand cmd : DeployMinefieldCommand.values()) {
+ buttons.put(cmd, createButton(cmd.getCmd(), "DeployMinefieldDisplay."));
+ }
+ numButtonGroups = (int) Math.ceil((buttons.size()+0.0) / buttonsPerGroup);
+ }
+
+ @Override
+ protected void setButtonsTooltips() {
+ for (DeployMinefieldCommand cmd : DeployMinefieldCommand.values()) {
+ String tt = createToolTip(cmd.getCmd(), "DeployMinefieldDisplay.", cmd.getHotKeyDesc());
+ buttons.get(cmd).setToolTipText(tt);
+ }
+ }
+
@Override
protected ArrayList getButtonList() {
ArrayList buttonList = new ArrayList<>();
- for (Command cmd : Command.values()) {
+ for (DeployMinefieldCommand cmd : DeployMinefieldCommand.values()) {
buttonList.add(buttons.get(cmd));
}
return buttonList;
@@ -404,42 +430,42 @@ public void actionPerformed(ActionEvent ev) {
if (!clientgui.getClient().isMyTurn()) {
// odd...
return;
- } else if (ev.getActionCommand().equals(Command.DEPLOY_MINE_CONV.getCmd())) {
+ } else if (ev.getActionCommand().equals(DeployMinefieldCommand.DEPLOY_MINE_CONV.getCmd())) {
deployM = true;
deployC = false;
deployV = false;
deployA = false;
deployI = false;
remove = false;
- } else if (ev.getActionCommand().equals(Command.DEPLOY_MINE_COM.getCmd())) {
+ } else if (ev.getActionCommand().equals(DeployMinefieldCommand.DEPLOY_MINE_COM.getCmd())) {
deployM = false;
deployC = true;
deployV = false;
deployA = false;
deployI = false;
remove = false;
- } else if (ev.getActionCommand().equals(Command.DEPLOY_MINE_VIBRA.getCmd())) {
+ } else if (ev.getActionCommand().equals(DeployMinefieldCommand.DEPLOY_MINE_VIBRA.getCmd())) {
deployM = false;
deployC = false;
deployV = true;
deployA = false;
deployI = false;
remove = false;
- } else if (ev.getActionCommand().equals(Command.DEPLOY_MINE_ACTIVE.getCmd())) {
+ } else if (ev.getActionCommand().equals(DeployMinefieldCommand.DEPLOY_MINE_ACTIVE.getCmd())) {
deployM = false;
deployC = false;
deployV = false;
deployA = true;
deployI = false;
remove = false;
- } else if (ev.getActionCommand().equals(Command.DEPLOY_MINE_INFERNO.getCmd())) {
+ } else if (ev.getActionCommand().equals(DeployMinefieldCommand.DEPLOY_MINE_INFERNO.getCmd())) {
deployM = false;
deployC = false;
deployV = false;
deployA = false;
deployI = true;
remove = false;
- } else if (ev.getActionCommand().equals(Command.REMOVE_MINES.getCmd())) {
+ } else if (ev.getActionCommand().equals(DeployMinefieldCommand.REMOVE_MINES.getCmd())) {
deployM = false;
deployC = false;
deployV = false;
@@ -457,37 +483,37 @@ public void ready() {
}
private void setConventionalEnabled(int nbr) {
- buttons.get(Command.DEPLOY_MINE_CONV).setText(Messages.getString(
- "DeployMinefieldDisplay." + Command.DEPLOY_MINE_CONV.getCmd(), nbr));
- buttons.get(Command.DEPLOY_MINE_CONV).setEnabled(nbr > 0);
+ buttons.get(DeployMinefieldCommand.DEPLOY_MINE_CONV).setText(Messages.getString(
+ "DeployMinefieldDisplay." + DeployMinefieldCommand.DEPLOY_MINE_CONV.getCmd(), nbr));
+ buttons.get(DeployMinefieldCommand.DEPLOY_MINE_CONV).setEnabled(nbr > 0);
}
private void setCommandEnabled(int nbr) {
- buttons.get(Command.DEPLOY_MINE_COM).setText(Messages.getString(
- "DeployMinefieldDisplay." + Command.DEPLOY_MINE_COM.getCmd(), nbr));
- buttons.get(Command.DEPLOY_MINE_COM).setEnabled(nbr > 0);
+ buttons.get(DeployMinefieldCommand.DEPLOY_MINE_COM).setText(Messages.getString(
+ "DeployMinefieldDisplay." + DeployMinefieldCommand.DEPLOY_MINE_COM.getCmd(), nbr));
+ buttons.get(DeployMinefieldCommand.DEPLOY_MINE_COM).setEnabled(nbr > 0);
}
private void setVibrabombEnabled(int nbr) {
- buttons.get(Command.DEPLOY_MINE_VIBRA).setText(Messages.getString(
- "DeployMinefieldDisplay." + Command.DEPLOY_MINE_VIBRA.getCmd(), nbr));
- buttons.get(Command.DEPLOY_MINE_VIBRA).setEnabled(nbr > 0);
+ buttons.get(DeployMinefieldCommand.DEPLOY_MINE_VIBRA).setText(Messages.getString(
+ "DeployMinefieldDisplay." + DeployMinefieldCommand.DEPLOY_MINE_VIBRA.getCmd(), nbr));
+ buttons.get(DeployMinefieldCommand.DEPLOY_MINE_VIBRA).setEnabled(nbr > 0);
}
private void setActiveEnabled(int nbr) {
- buttons.get(Command.DEPLOY_MINE_ACTIVE).setText(Messages.getString(
- "DeployMinefieldDisplay." + Command.DEPLOY_MINE_ACTIVE.getCmd(), nbr));
- buttons.get(Command.DEPLOY_MINE_ACTIVE).setEnabled(nbr > 0);
+ buttons.get(DeployMinefieldCommand.DEPLOY_MINE_ACTIVE).setText(Messages.getString(
+ "DeployMinefieldDisplay." + DeployMinefieldCommand.DEPLOY_MINE_ACTIVE.getCmd(), nbr));
+ buttons.get(DeployMinefieldCommand.DEPLOY_MINE_ACTIVE).setEnabled(nbr > 0);
}
private void setInfernoEnabled(int nbr) {
- buttons.get(Command.DEPLOY_MINE_INFERNO).setText(Messages.getString(
- "DeployMinefieldDisplay." + Command.DEPLOY_MINE_INFERNO.getCmd(), nbr));
- buttons.get(Command.DEPLOY_MINE_INFERNO).setEnabled(nbr > 0);
+ buttons.get(DeployMinefieldCommand.DEPLOY_MINE_INFERNO).setText(Messages.getString(
+ "DeployMinefieldDisplay." + DeployMinefieldCommand.DEPLOY_MINE_INFERNO.getCmd(), nbr));
+ buttons.get(DeployMinefieldCommand.DEPLOY_MINE_INFERNO).setEnabled(nbr > 0);
}
private void setRemoveMineEnabled(boolean enable) {
- buttons.get(Command.REMOVE_MINES).setEnabled(enable);
+ buttons.get(DeployMinefieldCommand.REMOVE_MINES).setEnabled(enable);
}
/**
diff --git a/megamek/src/megamek/client/ui/swing/DeploymentDisplay.java b/megamek/src/megamek/client/ui/swing/DeploymentDisplay.java
index c4ae6933937..16ec93de6c8 100644
--- a/megamek/src/megamek/client/ui/swing/DeploymentDisplay.java
+++ b/megamek/src/megamek/client/ui/swing/DeploymentDisplay.java
@@ -23,8 +23,8 @@
import megamek.client.event.BoardViewEvent;
import megamek.client.ui.Messages;
import megamek.client.ui.SharedUtility;
+import megamek.client.ui.swing.util.KeyCommandBind;
import megamek.client.ui.swing.widget.MegamekButton;
-import megamek.client.ui.swing.widget.SkinSpecification;
import megamek.common.*;
import megamek.common.event.GamePhaseChangeEvent;
import megamek.common.event.GameTurnChangeEvent;
@@ -37,6 +37,9 @@
import java.awt.event.MouseEvent;
import java.util.*;
+import static megamek.client.ui.swing.util.UIUtil.guiScaledFontHTML;
+import static megamek.client.ui.swing.util.UIUtil.uiLightViolet;
+
public class DeploymentDisplay extends StatusBarPhaseDisplay {
/**
@@ -84,6 +87,24 @@ public void setPriority(int p) {
public String toString() {
return Messages.getString("DeploymentDisplay." + getCmd());
}
+
+ public String getHotKeyDesc() {
+ String result = "";
+
+ String msg_next= Messages.getString("Next");
+ String msg_previous = Messages.getString("Previous");
+
+ switch (this) {
+ case DEPLOY_NEXT:
+ result += " " + msg_next + ": " + KeyCommandBind.getDesc(KeyCommandBind.NEXT_UNIT);
+ result += " " + msg_previous + ": " + KeyCommandBind.getDesc(KeyCommandBind.PREV_UNIT);
+ break;
+ default:
+ break;
+ }
+
+ return result;
+ }
}
protected Map buttons;
@@ -100,26 +121,32 @@ public DeploymentDisplay(ClientGUI clientgui) {
super(clientgui);
clientgui.getClient().getGame().addGameListener(this);
clientgui.getBoardView().addBoardViewListener(this);
- setupStatusBar(Messages.getString("DeploymentDisplay.waitingForDeploymentPhase"));
-
+ setupStatusBar(Messages.getString("DeploymentDisplay.waitingForDeploymentPhase"));
+
+ setButtons();
+ setButtonsTooltips();
+
+ butDone.setText("" + Messages.getString("DeploymentDisplay.Deploy") + "");
+ String f = guiScaledFontHTML(uiLightViolet()) + KeyCommandBind.getDesc(KeyCommandBind.DONE)+ "";
+ butDone.setToolTipText("" + f + "");
+ butDone.setEnabled(false);
+ setupButtonPanel();
+ }
+
+ @Override
+ protected void setButtons() {
buttons = new HashMap<>((int) (DeployCommand.values().length * 1.25 + 0.5));
for (DeployCommand cmd : DeployCommand.values()) {
- String title = Messages.getString("DeploymentDisplay." + cmd.getCmd());
- MegamekButton newButton = new MegamekButton(title, SkinSpecification.UIComponents.PhaseDisplayButton.getComp());
- String ttKey = "DeploymentDisplay." + cmd.getCmd() + ".tooltip";
- if (Messages.keyExists(ttKey)) {
- newButton.setToolTipText(Messages.getString(ttKey));
- }
- newButton.addActionListener(this);
- newButton.setActionCommand(cmd.getCmd());
- newButton.setEnabled(false);
- buttons.put(cmd, newButton);
- }
+ buttons.put(cmd, createButton(cmd.getCmd(), "DeploymentDisplay."));
+ }
numButtonGroups = (int) Math.ceil((buttons.size() + 0.0) / buttonsPerGroup);
-
- butDone.setText("" + Messages.getString("DeploymentDisplay.Deploy") + "");
- butDone.setEnabled(false);
- setupButtonPanel();
+ }
+ @Override
+ protected void setButtonsTooltips() {
+ for (DeployCommand cmd : DeployCommand.values()) {
+ String tt = createToolTip(cmd.getCmd(), "DeploymentDisplay.", cmd.getHotKeyDesc());
+ buttons.get(cmd).setToolTipText(tt);
+ }
}
@Override
diff --git a/megamek/src/megamek/client/ui/swing/FiringDisplay.java b/megamek/src/megamek/client/ui/swing/FiringDisplay.java
index 0176beac12b..6e9b882ab85 100644
--- a/megamek/src/megamek/client/ui/swing/FiringDisplay.java
+++ b/megamek/src/megamek/client/ui/swing/FiringDisplay.java
@@ -22,7 +22,6 @@
import megamek.client.ui.swing.util.KeyCommandBind;
import megamek.client.ui.swing.util.MegaMekController;
import megamek.client.ui.swing.widget.MegamekButton;
-import megamek.client.ui.swing.widget.SkinSpecification;
import megamek.common.*;
import megamek.common.actions.*;
import megamek.common.enums.AimingMode;
@@ -41,6 +40,9 @@
import java.awt.event.*;
import java.util.*;
+import static megamek.client.ui.swing.util.UIUtil.guiScaledFontHTML;
+import static megamek.client.ui.swing.util.UIUtil.uiLightViolet;
+
public class FiringDisplay extends StatusBarPhaseDisplay implements ItemListener, ListSelectionListener {
private static final long serialVersionUID = -5586388490027013723L;
@@ -102,6 +104,67 @@ public void setPriority(int p) {
public String toString() {
return Messages.getString("FiringDisplay." + getCmd());
}
+
+ public String getHotKeyDesc() {
+ String result = "";
+
+ String msg_left = Messages.getString("Left");
+ String msg_right = Messages.getString("Right");
+ String msg_next= Messages.getString("Next");
+ String msg_previous = Messages.getString("Previous");
+ String msg_valid = Messages.getString("FiringDisplay.FireNextTarget.tooltip.Valid");
+ String msg_noallies = Messages.getString("FiringDisplay.FireNextTarget.tooltip.NoAllies");
+
+
+ switch (this) {
+ case FIRE_NEXT:
+ result = "
";
+ result += " " + msg_next + ": " + KeyCommandBind.getDesc(KeyCommandBind.NEXT_UNIT);
+ result += " " + msg_previous + ": " + KeyCommandBind.getDesc(KeyCommandBind.PREV_UNIT);
+ break;
+ case FIRE_TWIST:
+ result = "
";
+ result += " " + msg_left + ": " + KeyCommandBind.getDesc(KeyCommandBind.TWIST_LEFT);
+ result += " " + msg_right + ": " + KeyCommandBind.getDesc(KeyCommandBind.TWIST_RIGHT);
+ break;
+ case FIRE_FIRE:
+ result = "
";
+ result += " " + KeyCommandBind.getDesc(KeyCommandBind.FIRE);
+ break;
+ case FIRE_NEXT_TARG:
+ result = "
";
+ result += " " + msg_next + ": " + KeyCommandBind.getDesc(KeyCommandBind.NEXT_TARGET);
+ result += " " + msg_previous + ": " + KeyCommandBind.getDesc(KeyCommandBind.PREV_TARGET);
+ result += "
";
+ result += " " + msg_valid + " " + msg_next + ": " + KeyCommandBind.getDesc(KeyCommandBind.NEXT_TARGET_VALID);
+ result += " " + msg_previous + ": " + KeyCommandBind.getDesc(KeyCommandBind.PREV_TARGET_VALID);
+ result += "
";
+ result += " " + msg_noallies + " " + msg_next + ": " + KeyCommandBind.getDesc(KeyCommandBind.NEXT_TARGET_NOALLIES);
+ result += " " + msg_previous + ": " + KeyCommandBind.getDesc(KeyCommandBind.PREV_TARGET_NOALLIES);
+ result += "
";
+ result += " " + msg_valid + " (" + msg_noallies + ") " + msg_next + ": " + KeyCommandBind.getDesc(KeyCommandBind.NEXT_TARGET_VALID_NO_ALLIES);
+ result += " " + msg_previous + ": " + KeyCommandBind.getDesc(KeyCommandBind.PREV_TARGET_VALID_NO_ALLIES);
+ break;
+ case FIRE_SKIP:
+ result = "
";
+ result += " " + msg_next + ": " + KeyCommandBind.getDesc(KeyCommandBind.NEXT_WEAPON);
+ result += " " + msg_previous + ": " + KeyCommandBind.getDesc(KeyCommandBind.PREV_WEAPON);
+ break;
+ case FIRE_MODE:
+ result = "
";
+ result += " " + msg_next + ": " + KeyCommandBind.getDesc(KeyCommandBind.NEXT_MODE);
+ result += " " + msg_previous + ": " + KeyCommandBind.getDesc(KeyCommandBind.PREV_MODE);
+ break;
+ case FIRE_CANCEL:
+ result = "
";
+ result += " " + KeyCommandBind.getDesc(KeyCommandBind.CANCEL);
+ break;
+ default:
+ break;
+ }
+
+ return result;
+ }
}
// buttons
@@ -153,23 +216,12 @@ public FiringDisplay(final ClientGUI clientgui) {
setupStatusBar(Messages.getString("FiringDisplay.waitingForFiringPhase"));
- buttons = new HashMap<>((int) (FiringCommand.values().length * 1.25 + 0.5));
- for (FiringCommand cmd : FiringCommand.values()) {
- String title = Messages.getString("FiringDisplay." + cmd.getCmd());
- MegamekButton newButton = new MegamekButton(title,
- SkinSpecification.UIComponents.PhaseDisplayButton.getComp());
- String ttKey = "FiringDisplay." + cmd.getCmd() + ".tooltip";
- if (Messages.keyExists(ttKey)) {
- newButton.setToolTipText(Messages.getString(ttKey));
- }
- newButton.addActionListener(this);
- newButton.setActionCommand(cmd.getCmd());
- newButton.setEnabled(false);
- buttons.put(cmd, newButton);
- }
- numButtonGroups = (int) Math.ceil((buttons.size() + 0.0) / buttonsPerGroup);
+ setButtons();
+ setButtonsTooltips();
- butDone.setText("" + Messages.getString("FiringDisplay.Done") + "");
+ butDone.setText("" + Messages.getString("FiringDisplay.Done") + "");
+ String f = guiScaledFontHTML(uiLightViolet()) + KeyCommandBind.getDesc(KeyCommandBind.DONE)+ "";
+ butDone.setToolTipText("" + f + "");
butDone.setEnabled(false);
setupButtonPanel();
@@ -185,6 +237,23 @@ public FiringDisplay(final ClientGUI clientgui) {
registerKeyCommands();
}
+ @Override
+ protected void setButtons() {
+ buttons = new HashMap<>((int) (FiringCommand.values().length * 1.25 + 0.5));
+ for (FiringCommand cmd : FiringCommand.values()) {
+ buttons.put(cmd, createButton(cmd.getCmd(), "FiringDisplay."));
+ }
+ numButtonGroups = (int) Math.ceil((buttons.size() + 0.0) / buttonsPerGroup);
+ }
+
+ @Override
+ protected void setButtonsTooltips() {
+ for (FiringCommand cmd : FiringCommand.values()) {
+ String tt = createToolTip(cmd.getCmd(), "FiringDisplay.", cmd.getHotKeyDesc());
+ buttons.get(cmd).setToolTipText(tt);
+ }
+ }
+
/**
* Register all of the CommandAction
s for this panel display.
*/
diff --git a/megamek/src/megamek/client/ui/swing/MovementDisplay.java b/megamek/src/megamek/client/ui/swing/MovementDisplay.java
index cba77fa8fdb..985ca069fb1 100644
--- a/megamek/src/megamek/client/ui/swing/MovementDisplay.java
+++ b/megamek/src/megamek/client/ui/swing/MovementDisplay.java
@@ -26,7 +26,6 @@
import megamek.client.ui.swing.util.KeyCommandBind;
import megamek.client.ui.swing.util.MegaMekController;
import megamek.client.ui.swing.widget.MegamekButton;
-import megamek.client.ui.swing.widget.SkinSpecification.UIComponents;
import megamek.common.*;
import megamek.common.GameTurn.UnloadStrandedTurn;
import megamek.common.MovePath.MoveStepType;
@@ -56,6 +55,9 @@
import java.util.stream.Collectors;
import java.util.stream.Stream;
+import static megamek.client.ui.swing.util.UIUtil.guiScaledFontHTML;
+import static megamek.client.ui.swing.util.UIUtil.uiLightViolet;
+
public class MovementDisplay extends StatusBarPhaseDisplay {
private static final long serialVersionUID = -7246715124042905688L;
@@ -216,6 +218,49 @@ public String toString() {
return Messages.getString("MovementDisplay." + getCmd());
}
+ public String getHotKeyDesc() {
+ String result = "";
+
+ String msg_next= Messages.getString("Next");
+ String msg_previous = Messages.getString("Previous");
+ String msg_left = Messages.getString("Left");
+ String msg_right = Messages.getString("Right");
+ String msg_togglemovejump = Messages.getString("MovementDisplay.tooltip.ToggleMoveJump");
+ String msg_togglemode = Messages.getString("MovementDisplay.tooltip.ToggleMode");
+
+ switch (this) {
+ case MOVE_NEXT:
+ result = "
";
+ result += " " + msg_next + ": " + KeyCommandBind.getDesc(KeyCommandBind.NEXT_UNIT);
+ result += " " + msg_previous + ": " + KeyCommandBind.getDesc(KeyCommandBind.PREV_UNIT);
+ break;
+ case MOVE_WALK:
+ result = "
";
+ result += " " + msg_togglemovejump + ": " + KeyCommandBind.getDesc(KeyCommandBind.TOGGLE_MOVEMODE);
+ break;
+ case MOVE_JUMP:
+ result = "
";
+ result += " " + msg_togglemovejump + ": " + KeyCommandBind.getDesc(KeyCommandBind.TOGGLE_MOVEMODE);
+ break;
+ case MOVE_TURN:
+ result = "
";
+ result += " " + msg_left + ": " + KeyCommandBind.getDesc(KeyCommandBind.TURN_LEFT);
+ result += " " + msg_right + ": " + KeyCommandBind.getDesc(KeyCommandBind.TURN_RIGHT);
+ break;
+ case MOVE_MODE_AIR:
+ case MOVE_MODE_CONVERT:
+ case MOVE_MODE_LEG:
+ case MOVE_MODE_VEE:
+ result = "
";
+ result += " " + msg_togglemode + ": " + KeyCommandBind.getDesc(KeyCommandBind.TOGGLE_CONVERSIONMODE);
+ break;
+ default:
+ break;
+ }
+
+ return result;
+ }
+
/**
* Return a list of valid commands for the given parameters.
*
@@ -311,28 +356,12 @@ public MovementDisplay(final ClientGUI clientgui) {
setupStatusBar(Messages.getString("MovementDisplay.waitingForMovementPhase"));
- // Create all of the buttons
- buttons = new HashMap<>((int) (MoveCommand.values().length * 1.25 + 0.5));
- for (MoveCommand cmd : MoveCommand.values()) {
- String title = Messages.getString("MovementDisplay." + cmd.getCmd());
- if ((clientgui != null) &&
- (cmd == MoveCommand.MOVE_UNJAM) &&
- (clientgui.getClient().getGame().getOptions().booleanOption(OptionsConstants.ADVCOMBAT_UNJAM_UAC))) {
- title += Messages.getString("BoardView1.Tooltip.AndAC");
- }
- MegamekButton newButton = new MegamekButton(title, UIComponents.PhaseDisplayButton.getComp());
- String ttKey = "MovementDisplay." + cmd.getCmd() + ".tooltip";
- if (Messages.keyExists(ttKey)) {
- newButton.setToolTipText(Messages.getString(ttKey));
- }
- newButton.addActionListener(this);
- newButton.setActionCommand(cmd.getCmd());
- newButton.setEnabled(clientgui == null);
- buttons.put(cmd, newButton);
- }
+ setButtons();
+ setButtonsTooltips();
- butDone.setText(""
- + Messages.getString("MovementDisplay.butDone") + "");
+ butDone.setText("" + Messages.getString("MovementDisplay.butDone") + "");
+ String f = guiScaledFontHTML(uiLightViolet()) + KeyCommandBind.getDesc(KeyCommandBind.DONE)+ "";
+ butDone.setToolTipText("" + f + "");
butDone.setEnabled(false);
setupButtonPanel();
@@ -343,6 +372,23 @@ public MovementDisplay(final ClientGUI clientgui) {
registerKeyCommands();
}
+ @Override
+ protected void setButtons() {
+ // Create all of the buttons
+ buttons = new HashMap<>((int) (MoveCommand.values().length * 1.25 + 0.5));
+ for (MoveCommand cmd : MoveCommand.values()) {
+ buttons.put(cmd, createButton(cmd.getCmd(), "MovementDisplay."));
+ }
+ }
+
+ @Override
+ protected void setButtonsTooltips() {
+ for (MoveCommand cmd : MoveCommand.values()) {
+ String tt = createToolTip(cmd.getCmd(), "MovementDisplay.", cmd.getHotKeyDesc());
+ buttons.get(cmd).setToolTipText(tt);
+ }
+ }
+
/**
* Register all of the CommandAction
s for this panel display.
*/
diff --git a/megamek/src/megamek/client/ui/swing/PhysicalDisplay.java b/megamek/src/megamek/client/ui/swing/PhysicalDisplay.java
index f9fbe2fe691..2f6d6ed6417 100644
--- a/megamek/src/megamek/client/ui/swing/PhysicalDisplay.java
+++ b/megamek/src/megamek/client/ui/swing/PhysicalDisplay.java
@@ -16,9 +16,9 @@
import megamek.client.event.BoardViewEvent;
import megamek.client.ui.Messages;
import megamek.client.ui.SharedUtility;
+import megamek.client.ui.swing.util.KeyCommandBind;
import megamek.client.ui.swing.widget.IndexedRadioButton;
import megamek.client.ui.swing.widget.MegamekButton;
-import megamek.client.ui.swing.widget.SkinSpecification;
import megamek.common.*;
import megamek.common.actions.*;
import megamek.common.enums.AimingMode;
@@ -31,6 +31,9 @@
import java.awt.event.*;
import java.util.*;
+import static megamek.client.ui.swing.util.UIUtil.guiScaledFontHTML;
+import static megamek.client.ui.swing.util.UIUtil.uiLightViolet;
+
public class PhysicalDisplay extends StatusBarPhaseDisplay {
private static final long serialVersionUID = -3274750006768636001L;
@@ -91,6 +94,18 @@ public void setPriority(int p) {
public String toString() {
return Messages.getString("PhysicalDisplay." + getCmd());
}
+
+ public String getHotKeyDesc() {
+ String result = "";
+
+ if (this == PHYSICAL_NEXT) {
+ result = "
";
+ result += " " + "Next" + ": " + KeyCommandBind.getDesc(KeyCommandBind.NEXT_UNIT);
+ result += " " + "Previous" + ": " + KeyCommandBind.getDesc(KeyCommandBind.PREV_UNIT);
+ }
+
+ return result;
+ }
}
// buttons
@@ -119,29 +134,35 @@ public PhysicalDisplay(ClientGUI clientgui) {
attacks = new Vector<>();
- buttons = new HashMap<>((int) (PhysicalCommand.values().length * 1.25 + 0.5));
- for (PhysicalCommand cmd : PhysicalCommand.values()) {
- String title = Messages.getString("PhysicalDisplay." + cmd.getCmd());
- MegamekButton newButton = new MegamekButton(title,
- SkinSpecification.UIComponents.PhaseDisplayButton.getComp());
- String ttKey = "PhysicalDisplay." + cmd.getCmd() + ".tooltip";
- if (Messages.keyExists(ttKey)) {
- newButton.setToolTipText(Messages.getString(ttKey));
- }
- newButton.addActionListener(this);
- newButton.setActionCommand(cmd.getCmd());
- newButton.setEnabled(false);
- buttons.put(cmd, newButton);
- }
- numButtonGroups = (int) Math.ceil((buttons.size() + 0.0) / buttonsPerGroup);
+ setButtons();
+ setButtonsTooltips();
- butDone.setText("" + Messages.getString("PhysicalDisplay.Done") + "");
+ butDone.setText("" + Messages.getString("PhysicalDisplay.Done") + "");
+ String f = guiScaledFontHTML(uiLightViolet()) + KeyCommandBind.getDesc(KeyCommandBind.DONE)+ "";
+ butDone.setToolTipText("" + f + "");
butDone.setEnabled(false);
setupButtonPanel();
}
+ @Override
+ protected void setButtons() {
+ buttons = new HashMap<>((int) (PhysicalCommand.values().length * 1.25 + 0.5));
+ for (PhysicalCommand cmd : PhysicalCommand.values()) {
+ buttons.put(cmd, createButton(cmd.getCmd(), "PhysicalDisplay."));
+ }
+ numButtonGroups = (int) Math.ceil((buttons.size() + 0.0) / buttonsPerGroup);
+ }
+
+ @Override
+ protected void setButtonsTooltips() {
+ for (PhysicalCommand cmd : PhysicalCommand.values()) {
+ String tt = createToolTip(cmd.getCmd(), "PhysicalDisplay.", cmd.getHotKeyDesc());
+ buttons.get(cmd).setToolTipText(tt);
+ }
+ }
+
@Override
protected ArrayList getButtonList() {
ArrayList buttonList = new ArrayList<>();
diff --git a/megamek/src/megamek/client/ui/swing/PointblankShotDisplay.java b/megamek/src/megamek/client/ui/swing/PointblankShotDisplay.java
index a67b869979c..cb3439e7a7d 100644
--- a/megamek/src/megamek/client/ui/swing/PointblankShotDisplay.java
+++ b/megamek/src/megamek/client/ui/swing/PointblankShotDisplay.java
@@ -98,6 +98,46 @@ public void setPriority(int p) {
public String toString() {
return Messages.getString("FiringDisplay." + getCmd());
}
+
+ public String getHotKeyDesc() {
+ String result = "";
+
+ String msg_left = Messages.getString("Left");
+ String msg_right = Messages.getString("Right");
+ String msg_next= Messages.getString("Next");
+ String msg_previous = Messages.getString("Previous");
+
+
+ switch (this) {
+ case FIRE_TWIST:
+ result = "
";
+ result += " " + msg_left + ": " + KeyCommandBind.getDesc(KeyCommandBind.TWIST_LEFT);
+ result += " " + msg_right + ": " + KeyCommandBind.getDesc(KeyCommandBind.TWIST_RIGHT);
+ break;
+ case FIRE_FIRE:
+ result = "
";
+ result += " " + KeyCommandBind.getDesc(KeyCommandBind.FIRE);
+ break;
+ case FIRE_SKIP:
+ result = "
";
+ result += " " + msg_next + ": " + KeyCommandBind.getDesc(KeyCommandBind.NEXT_WEAPON);
+ result += " " + msg_previous + ": " + KeyCommandBind.getDesc(KeyCommandBind.PREV_WEAPON);
+ break;
+ case FIRE_MODE:
+ result = "
";
+ result += " " + msg_next + ": " + KeyCommandBind.getDesc(KeyCommandBind.NEXT_MODE);
+ result += " " + msg_previous + ": " + KeyCommandBind.getDesc(KeyCommandBind.PREV_MODE);
+ break;
+ case FIRE_CANCEL:
+ result = "
";
+ result += " " + KeyCommandBind.getDesc(KeyCommandBind.CANCEL);
+ break;
+ default:
+ break;
+ }
+
+ return result;
+ }
}
// buttons
@@ -110,21 +150,8 @@ public String toString() {
public PointblankShotDisplay(final ClientGUI clientgui) {
super(clientgui);
- buttons = new HashMap<>((int) (FiringCommand.values().length * 1.25 + 0.5));
- for (FiringCommand cmd : FiringCommand.values()) {
- String title = Messages.getString("FiringDisplay." + cmd.getCmd());
- MegamekButton newButton = new MegamekButton(title, "PhaseDisplayButton");
- String ttKey = "FiringDisplay." + cmd.getCmd() + ".tooltip";
- if (Messages.keyExists(ttKey)) {
- newButton.setToolTipText(Messages.getString(ttKey));
- }
- newButton.addActionListener(this);
- newButton.setActionCommand(cmd.getCmd());
- newButton.setEnabled(false);
- buttons.put(cmd, newButton);
- }
- numButtonGroups =
- (int) Math.ceil((buttons.size() + 0.0) / buttonsPerGroup);
+ setButtons();
+ setButtonsTooltips();
setupButtonPanel();
@@ -144,7 +171,23 @@ public void actionPerformed(ActionEvent e) {
}
}
});
+ }
+ @Override
+ protected void setButtons() {
+ buttons = new HashMap<>((int) (FiringCommand.values().length * 1.25 + 0.5));
+ for (FiringCommand cmd : FiringCommand.values()) {
+ buttons.put(cmd, createButton(cmd.getCmd(), "FiringDisplay."));
+ }
+ numButtonGroups = (int) Math.ceil((buttons.size() + 0.0) / buttonsPerGroup);
+ }
+
+ @Override
+ protected void setButtonsTooltips() {
+ for (FiringCommand cmd : FiringCommand.values()) {
+ String tt = createToolTip(cmd.getCmd(), "FiringDisplay.", cmd.getHotKeyDesc());
+ buttons.get(cmd).setToolTipText(tt);
+ }
}
/**
diff --git a/megamek/src/megamek/client/ui/swing/PrephaseDisplay.java b/megamek/src/megamek/client/ui/swing/PrephaseDisplay.java
index 7492fa8076c..6cf4a821a95 100644
--- a/megamek/src/megamek/client/ui/swing/PrephaseDisplay.java
+++ b/megamek/src/megamek/client/ui/swing/PrephaseDisplay.java
@@ -39,7 +39,6 @@
import megamek.client.ui.swing.util.KeyCommandBind;
import megamek.client.ui.swing.util.MegaMekController;
import megamek.client.ui.swing.widget.MegamekButton;
-import megamek.client.ui.swing.widget.SkinSpecification;
import megamek.common.*;
import megamek.common.enums.GamePhase;
import megamek.common.event.GameEntityChangeEvent;
@@ -47,6 +46,9 @@
import megamek.common.event.GameTurnChangeEvent;
import org.apache.logging.log4j.LogManager;
+import static megamek.client.ui.swing.util.UIUtil.guiScaledFontHTML;
+import static megamek.client.ui.swing.util.UIUtil.uiLightViolet;
+
/**
* Targeting Phase Display. Breaks naming convention because TargetingDisplay is too easy to confuse
* with something else
@@ -98,6 +100,21 @@ public void setPriority(int p) {
public String toString() {
return Messages.getString("PrephaseDisplay." + getCmd());
}
+
+ public String getHotKeyDesc() {
+ String result = "";
+
+ String msg_next= Messages.getString("Next");
+ String msg_previous = Messages.getString("Previous");
+
+ if (this == PREPHASE_NEXT) {
+ result = "
";
+ result += " " + msg_next + ": " + KeyCommandBind.getDesc(KeyCommandBind.NEXT_UNIT);
+ result += " " + msg_previous + ": " + KeyCommandBind.getDesc(KeyCommandBind.PREV_UNIT);
+ }
+
+ return result;
+ }
}
// buttons
@@ -119,34 +136,42 @@ public PrephaseDisplay(final ClientGUI clientgui, GamePhase phase) {
super(clientgui);
this.phase = phase;
- setupStatusBar(Messages
- .getFormattedString("PrephaseDisplay.waitingForPrephasePhase", phase.toString()));
+ setupStatusBar(Messages.getFormattedString("PrephaseDisplay.waitingForPrephasePhase", phase.toString()));
- buttons = new HashMap<>(
- (int) (PrephaseCommand.values().length * 1.25 + 0.5));
- for (PrephaseCommand cmd : PrephaseCommand.values()) {
- String title = Messages.getString("PrephaseDisplay."
- + cmd.getCmd());
- MegamekButton newButton = new MegamekButton(title,
- SkinSpecification.UIComponents.PhaseDisplayButton.getComp());
- String ttKey = "PrephaseDisplay." + cmd.getCmd() + ".tooltip";
- if (Messages.keyExists(ttKey)) {
- newButton.setToolTipText(Messages.getString(ttKey));
- }
- newButton.addActionListener(this);
- newButton.setActionCommand(cmd.getCmd());
- newButton.setEnabled(false);
-
- buttons.put(cmd, newButton);
- }
- numButtonGroups = (int) Math.ceil((buttons.size() + 0.0)
- / buttonsPerGroup);
+ setButtons();
+ setButtonsTooltips();
butDone.setText(Messages.getString("PrephaseDisplay.Done"));
+ String f = guiScaledFontHTML(uiLightViolet()) + KeyCommandBind.getDesc(KeyCommandBind.DONE)+ "";
+ butDone.setToolTipText("" + f + "");
butDone.setEnabled(false);
setupButtonPanel();
+ registerKeyCommands();
+ }
+
+ @Override
+ protected void setButtons() {
+ buttons = new HashMap<>((int) (PrephaseCommand.values().length * 1.25 + 0.5));
+ for (PrephaseCommand cmd : PrephaseCommand.values()) {
+ buttons.put(cmd, createButton(cmd.getCmd(), "PrephaseDisplay."));
+ }
+ numButtonGroups = (int) Math.ceil((buttons.size() + 0.0) / buttonsPerGroup);
+ }
+
+ @Override
+ protected void setButtonsTooltips() {
+ for (PrephaseCommand cmd : PrephaseCommand.values()) {
+ String tt = createToolTip(cmd.getCmd(), "PrephaseDisplay.", cmd.getHotKeyDesc());
+ buttons.get(cmd).setToolTipText(tt);
+ }
+ }
+
+ /**
+ * Register all of the CommandAction
s for this panel display.
+ */
+ protected void registerKeyCommands() {
MegaMekController controller = clientgui.controller;
final StatusBarPhaseDisplay display = this;
diff --git a/megamek/src/megamek/client/ui/swing/ReportDisplay.java b/megamek/src/megamek/client/ui/swing/ReportDisplay.java
index 3e370e5b012..e1c47dcbdb0 100644
--- a/megamek/src/megamek/client/ui/swing/ReportDisplay.java
+++ b/megamek/src/megamek/client/ui/swing/ReportDisplay.java
@@ -14,8 +14,8 @@
package megamek.client.ui.swing;
import megamek.client.ui.Messages;
+import megamek.client.ui.swing.util.KeyCommandBind;
import megamek.client.ui.swing.widget.MegamekButton;
-import megamek.client.ui.swing.widget.SkinSpecification;
import megamek.common.enums.GamePhase;
import megamek.common.event.GamePhaseChangeEvent;
@@ -25,6 +25,9 @@
import java.util.HashMap;
import java.util.Map;
+import static megamek.client.ui.swing.util.UIUtil.guiScaledFontHTML;
+import static megamek.client.ui.swing.util.UIUtil.uiLightViolet;
+
public class ReportDisplay extends StatusBarPhaseDisplay {
private static final long serialVersionUID = 6185643976857892270L;
@@ -63,6 +66,17 @@ public void setPriority(int p) {
public String toString() {
return Messages.getString("ReportDisplay." + getCmd());
}
+
+ public String getHotKeyDesc() {
+ String result = "";
+
+ if (this ==REPORT_REPORT) {
+ result = "
";
+ result += " " + KeyCommandBind.getDesc(KeyCommandBind.ROUND_REPORT);
+ }
+
+ return result;
+ }
}
// buttons
@@ -85,23 +99,12 @@ public ReportDisplay(ClientGUI clientgui) {
setupStatusBar("");
- buttons = new HashMap<>((int) (ReportCommand.values().length * 1.25 + 0.5));
- for (ReportCommand cmd : ReportCommand.values()) {
- String title = Messages.getString(RD_REPORTDIPLAY + cmd.getCmd());
- MegamekButton newButton = new MegamekButton(title,
- SkinSpecification.UIComponents.PhaseDisplayButton.getComp());
- String ttKey = RD_REPORTDIPLAY + cmd.getCmd() + RD_TOOLTIP;
- if (Messages.keyExists(ttKey)) {
- newButton.setToolTipText(Messages.getString(ttKey));
- }
- newButton.addActionListener(this);
- newButton.setActionCommand(cmd.getCmd());
- newButton.setEnabled(false);
- buttons.put(cmd, newButton);
- }
- numButtonGroups = (int) Math.ceil((buttons.size() + 0.0) / buttonsPerGroup);
+ setButtons();
+ setButtonsTooltips();
butDone.setText(Messages.getString("ReportDisplay.Done"));
+ String f = guiScaledFontHTML(uiLightViolet()) + KeyCommandBind.getDesc(KeyCommandBind.DONE)+ "";
+ butDone.setToolTipText("" + f + "");
butDone.setEnabled(false);
setupButtonPanel();
@@ -111,6 +114,23 @@ public ReportDisplay(ClientGUI clientgui) {
clientgui.getBoardView().addKeyListener(this);
}
+ @Override
+ protected void setButtons() {
+ buttons = new HashMap<>((int) (ReportCommand.values().length * 1.25 + 0.5));
+ for (ReportCommand cmd : ReportCommand.values()) {
+ buttons.put(cmd, createButton(cmd.getCmd(), RD_REPORTDIPLAY));
+ }
+ numButtonGroups = (int) Math.ceil((buttons.size() + 0.0) / buttonsPerGroup);
+ }
+
+ @Override
+ protected void setButtonsTooltips() {
+ for (ReportCommand cmd : ReportCommand.values()) {
+ String tt = createToolTip(cmd.getCmd(), RD_REPORTDIPLAY, cmd.getHotKeyDesc());
+ buttons.get(cmd).setToolTipText(tt);
+ }
+ }
+
@Override
protected ArrayList getButtonList() {
ArrayList buttonList = new ArrayList<>();
diff --git a/megamek/src/megamek/client/ui/swing/SelectArtyAutoHitHexDisplay.java b/megamek/src/megamek/client/ui/swing/SelectArtyAutoHitHexDisplay.java
index a2bb75f4369..f6a42cb9f49 100644
--- a/megamek/src/megamek/client/ui/swing/SelectArtyAutoHitHexDisplay.java
+++ b/megamek/src/megamek/client/ui/swing/SelectArtyAutoHitHexDisplay.java
@@ -33,6 +33,9 @@
import java.util.HashMap;
import java.util.Map;
+import static megamek.client.ui.swing.util.UIUtil.guiScaledFontHTML;
+import static megamek.client.ui.swing.util.UIUtil.uiLightViolet;
+
public class SelectArtyAutoHitHexDisplay extends StatusBarPhaseDisplay {
private static final long serialVersionUID = -4948184589134809323L;
@@ -77,6 +80,10 @@ public void setPriority(int priority) {
public String toString() {
return Messages.getString("SelectArtyAutoHitHexDisplay." + getCmd());
}
+
+ public String getHotKeyDesc() {
+ return "";
+ }
}
// buttons
@@ -103,28 +110,54 @@ public SelectArtyAutoHitHexDisplay(ClientGUI clientgui) {
artyAutoHitHexes.setPlayerID(p.getId());
+ setButtons();
+ setButtonsTooltips();
+
+ butDone.setText(Messages.getString("SelectArtyAutoHitHexDisplay.Done"));
+ String f = guiScaledFontHTML(uiLightViolet()) + KeyCommandBind.getDesc(KeyCommandBind.DONE)+ "";
+ butDone.setToolTipText("" + f + "");
+ butDone.setEnabled(false);
+
+ setupButtonPanel();
+
+ registerKeyCommands();
+ }
+
+ @Override
+ protected void setButtons() {
buttons = new HashMap<>((int) (ArtyAutoHitCommand.values().length * 1.25 + 0.5));
for (ArtyAutoHitCommand cmd : ArtyAutoHitCommand.values()) {
String title = Messages.getString("SelectArtyAutoHitHexDisplay." + cmd.getCmd());
MegamekButton newButton = new MegamekButton(title,
SkinSpecification.UIComponents.PhaseDisplayButton.getComp());
- String ttKey = "SelectArtyAutoHitHexDisplay." + cmd.getCmd() + ".tooltip";
- if (Messages.keyExists(ttKey)) {
- newButton.setToolTipText(Messages.getString(ttKey));
- }
newButton.addActionListener(this);
newButton.setActionCommand(cmd.getCmd());
newButton.setEnabled(false);
buttons.put(cmd, newButton);
}
numButtonGroups = (int) Math.ceil((buttons.size() + 0.0) / buttonsPerGroup);
+ }
- butDone.setText(Messages.getString("SelectArtyAutoHitHexDisplay.Done"));
- butDone.setEnabled(false);
-
- setupButtonPanel();
-
- registerKeyCommands();
+ @Override
+ protected void setButtonsTooltips() {
+ for (ArtyAutoHitCommand cmd : ArtyAutoHitCommand.values()) {
+ String ttKey = "SelectArtyAutoHitHexDisplay." + cmd.getCmd() + ".tooltip";
+ String tt = cmd.getHotKeyDesc();
+ if (!tt.isEmpty()) {
+ String title = Messages.getString("SelectArtyAutoHitHexDisplay." + cmd.getCmd());
+ tt = guiScaledFontHTML(uiLightViolet()) + title + ": " + tt + "";
+ tt += "
";
+ }
+ if (Messages.keyExists(ttKey)) {
+ String msg_key = Messages.getString(ttKey);
+ tt += guiScaledFontHTML() + msg_key + "";
+ }
+ if (!tt.isEmpty()) {
+ String b = "" + tt + "";
+ String h = "" + b + "";
+ buttons.get(cmd).setToolTipText(h);
+ }
+ }
}
@Override
diff --git a/megamek/src/megamek/client/ui/swing/StatusBarPhaseDisplay.java b/megamek/src/megamek/client/ui/swing/StatusBarPhaseDisplay.java
index eb0b35ddf80..99b89edc377 100644
--- a/megamek/src/megamek/client/ui/swing/StatusBarPhaseDisplay.java
+++ b/megamek/src/megamek/client/ui/swing/StatusBarPhaseDisplay.java
@@ -26,11 +26,16 @@
import javax.swing.*;
+import megamek.client.ui.Messages;
import megamek.client.ui.swing.util.TurnTimer;
import megamek.client.ui.swing.util.UIUtil;
import megamek.client.ui.swing.widget.*;
+import megamek.common.KeyBindParser;
import megamek.common.preference.*;
+import static megamek.client.ui.swing.util.UIUtil.guiScaledFontHTML;
+import static megamek.client.ui.swing.util.UIUtil.uiLightViolet;
+
/**
* This is a parent class for the button display for each phase. Every phase
* has a panel of control buttons along with a Done button. Each button
@@ -119,6 +124,7 @@ public void actionPerformed(ActionEvent e) {
add(panStatus);
GUIP.addPreferenceChangeListener(this);
+ KeyBindParser.addPreferenceChangeListener(this);
ToolTipManager.sharedInstance().registerComponent(this);
}
@@ -126,6 +132,41 @@ public void actionPerformed(ActionEvent e) {
/** Returns the list of buttons that should be displayed. */
protected abstract ArrayList getButtonList();
+ /** set button that should be displayed. */
+ protected abstract void setButtons();
+
+ protected MegamekButton createButton(String cmd, String keyPrefix){
+ String title = Messages.getString(keyPrefix + cmd);
+ MegamekButton newButton = new MegamekButton(title, SkinSpecification.UIComponents.PhaseDisplayButton.getComp());
+ newButton.addActionListener(this);
+ newButton.setActionCommand(cmd);
+ newButton.setEnabled(false);
+ return newButton;
+ }
+
+ /** set button tool tips that should be displayed. */
+ protected abstract void setButtonsTooltips();
+
+ protected String createToolTip(String cmd, String keyPrefix, String hotKeyDesc) {
+ String h = "";
+ String ttKey = keyPrefix + cmd + ".tooltip";
+ String tt = hotKeyDesc;
+ if (!tt.isEmpty()) {
+ String title = Messages.getString(keyPrefix + cmd);
+ tt = guiScaledFontHTML(uiLightViolet()) + title + ": " + tt + "";
+ tt += "
";
+ }
+ if (Messages.keyExists(ttKey)) {
+ String msg_key = Messages.getString(ttKey);
+ tt += guiScaledFontHTML() + msg_key + "";
+ }
+ if (!tt.isEmpty()) {
+ String b = "" + tt + "";
+ h = "" + b + "";
+ }
+ return h;
+ }
+
/**
* Adds buttons to the button panel. The buttons to be added are retrieved
* with the getButtonList()
method. The number of buttons to
@@ -209,6 +250,8 @@ public void preferenceChange(PreferenceChangeEvent e) {
setupButtonPanel();
} else if (e.getName().equals(GUIPreferences.GUI_SCALE)) {
adaptToGUIScale();
+ } else if (e.getName().equals(KeyBindParser.KEYBINDS_CHANGED)) {
+ setButtonsTooltips();
}
}
diff --git a/megamek/src/megamek/client/ui/swing/TargetingPhaseDisplay.java b/megamek/src/megamek/client/ui/swing/TargetingPhaseDisplay.java
index 9fd61bec0ed..c7986c01622 100644
--- a/megamek/src/megamek/client/ui/swing/TargetingPhaseDisplay.java
+++ b/megamek/src/megamek/client/ui/swing/TargetingPhaseDisplay.java
@@ -23,7 +23,6 @@
import megamek.client.ui.swing.util.KeyCommandBind;
import megamek.client.ui.swing.util.MegaMekController;
import megamek.client.ui.swing.widget.MegamekButton;
-import megamek.client.ui.swing.widget.SkinSpecification;
import megamek.common.*;
import megamek.common.actions.*;
import megamek.common.enums.AimingMode;
@@ -44,6 +43,9 @@
import java.awt.event.*;
import java.util.*;
+import static megamek.client.ui.swing.util.UIUtil.guiScaledFontHTML;
+import static megamek.client.ui.swing.util.UIUtil.uiLightViolet;
+
/**
* Targeting Phase Display. Breaks naming convention because TargetingDisplay is too easy to confuse
* with something else
@@ -101,6 +103,59 @@ public void setPriority(int p) {
public String toString() {
return Messages.getString("TargetingPhaseDisplay." + getCmd());
}
+
+ public String getHotKeyDesc() {
+ String result = "";
+
+ String msg_next= Messages.getString("Next");
+ String msg_previous = Messages.getString("Previous");
+ String msg_valid = Messages.getString("TargetingPhaseDisplay.FireNextTarget.tooltip.Valid");
+ String msg_noallies = Messages.getString("TargetingPhaseDisplay.FireNextTarget.tooltip.NoAllies");
+
+ switch (this) {
+ case FIRE_NEXT:
+ result = "
";
+ result += " " + msg_next + ": " + KeyCommandBind.getDesc(KeyCommandBind.NEXT_UNIT);
+ result += " " + msg_previous + ": " + KeyCommandBind.getDesc(KeyCommandBind.PREV_UNIT);
+ break;
+ case FIRE_FIRE:
+ result = "
";
+ result += " " + KeyCommandBind.getDesc(KeyCommandBind.FIRE);
+ break;
+ case FIRE_NEXT_TARG:
+ result = "
";
+ result += " " + msg_next + ": " + KeyCommandBind.getDesc(KeyCommandBind.NEXT_TARGET);
+ result += " " + msg_previous + ": " + KeyCommandBind.getDesc(KeyCommandBind.PREV_TARGET);
+ result += "
";
+ result += " " + msg_valid + " " + msg_next + ": " + KeyCommandBind.getDesc(KeyCommandBind.NEXT_TARGET_VALID);
+ result += " " + msg_previous + ": " + KeyCommandBind.getDesc(KeyCommandBind.PREV_TARGET_VALID);
+ result += "
";
+ result += " " + msg_noallies + " " + msg_next + ": " + KeyCommandBind.getDesc(KeyCommandBind.NEXT_TARGET_NOALLIES);
+ result += " " + msg_previous + ": " + KeyCommandBind.getDesc(KeyCommandBind.PREV_TARGET_NOALLIES);
+ result += "
";
+ result += " " + msg_valid + " (" + msg_noallies + ") " + msg_next + ": " + KeyCommandBind.getDesc(KeyCommandBind.NEXT_TARGET_VALID_NO_ALLIES);
+ result += " " + msg_previous + ": " + KeyCommandBind.getDesc(KeyCommandBind.PREV_TARGET_VALID_NO_ALLIES);
+ break;
+ case FIRE_SKIP:
+ result = "
";
+ result += " " + msg_next + ": " + KeyCommandBind.getDesc(KeyCommandBind.NEXT_WEAPON);
+ result += " " + msg_previous + ": " + KeyCommandBind.getDesc(KeyCommandBind.PREV_WEAPON);
+ break;
+ case FIRE_MODE:
+ result = "
";
+ result += " " + msg_next + ": " + KeyCommandBind.getDesc(KeyCommandBind.NEXT_MODE);
+ result += " " + msg_previous + ": " + KeyCommandBind.getDesc(KeyCommandBind.PREV_MODE);
+ break;
+ case FIRE_CANCEL:
+ result = "
";
+ result += " " + KeyCommandBind.getDesc(KeyCommandBind.CANCEL);
+ break;
+ default:
+ break;
+ }
+
+ return result;
+ }
}
// buttons
@@ -137,28 +192,41 @@ public TargetingPhaseDisplay(final ClientGUI clientgui, boolean offboard) {
setupStatusBar(Messages.getString("TargetingPhaseDisplay.waitingForTargetingPhase"));
+ setButtons();
+ setButtonsTooltips();
+
+ butDone.setText(Messages.getString("TargetingPhaseDisplay.Done"));
+ String f = guiScaledFontHTML(uiLightViolet()) + KeyCommandBind.getDesc(KeyCommandBind.DONE)+ "";
+ butDone.setToolTipText("" + f + "");
+ butDone.setEnabled(false);
+
+ setupButtonPanel();
+
+ registerKeyCommands();
+ }
+
+ @Override
+ protected void setButtons() {
buttons = new HashMap<>(
(int) (TargetingCommand.values().length * 1.25 + 0.5));
for (TargetingCommand cmd : TargetingCommand.values()) {
- String title = Messages.getString("TargetingPhaseDisplay." + cmd.getCmd());
- MegamekButton newButton = new MegamekButton(title,
- SkinSpecification.UIComponents.PhaseDisplayButton.getComp());
- String ttKey = "TargetingPhaseDisplay." + cmd.getCmd() + ".tooltip";
- if (Messages.keyExists(ttKey)) {
- newButton.setToolTipText(Messages.getString(ttKey));
- }
- newButton.addActionListener(this);
- newButton.setActionCommand(cmd.getCmd());
- newButton.setEnabled(false);
- buttons.put(cmd, newButton);
+ buttons.put(cmd, createButton(cmd.getCmd(), "TargetingPhaseDisplay." ));
}
numButtonGroups = (int) Math.ceil((buttons.size() + 0.0) / buttonsPerGroup);
+ }
- butDone.setText(Messages.getString("TargetingPhaseDisplay.Done"));
- butDone.setEnabled(false);
+ @Override
+ protected void setButtonsTooltips() {
+ for (TargetingCommand cmd : TargetingCommand.values()) {
+ String tt = createToolTip(cmd.getCmd(), "TargetingPhaseDisplay.", cmd.getHotKeyDesc());
+ buttons.get(cmd).setToolTipText(tt);
+ }
+ }
- setupButtonPanel();
-
+ /**
+ * Register all of the CommandAction
s for this panel display.
+ */
+ protected void registerKeyCommands() {
MegaMekController controller = clientgui.controller;
final StatusBarPhaseDisplay display = this;
// Register the action for UNDO
@@ -403,7 +471,6 @@ public void performAction() {
clear();
}
});
-
}
/**
diff --git a/megamek/src/megamek/client/ui/swing/boardview/BoardView.java b/megamek/src/megamek/client/ui/swing/boardview/BoardView.java
index 32d667306c2..0e0ddceae39 100644
--- a/megamek/src/megamek/client/ui/swing/boardview/BoardView.java
+++ b/megamek/src/megamek/client/ui/swing/boardview/BoardView.java
@@ -5543,11 +5543,7 @@ public String getHexTooltip(MouseEvent e) {
}
// Add a hint with keybind that the zones can be shown graphically
- String keybindText = KeyEvent.getModifiersExText(KeyCommandBind.getBindByCmd("autoArtyDeployZone").modifiers);
- if (!keybindText.isEmpty()) {
- keybindText += "+";
- }
- keybindText += KeyEvent.getKeyText(KeyCommandBind.getBindByCmd("autoArtyDeployZone").key);
+ String keybindText = KeyCommandBind.getDesc(KeyCommandBind.getBindByCmd("autoArtyDeployZone"));
txt.append(Messages.getString("BoardView1.Tooltip.ArtyAutoHint", keybindText));
txt.append("");
diff --git a/megamek/src/megamek/client/ui/swing/boardview/KeyBindingsOverlay.java b/megamek/src/megamek/client/ui/swing/boardview/KeyBindingsOverlay.java
index 0917070cb88..bc2c9dfdf52 100644
--- a/megamek/src/megamek/client/ui/swing/boardview/KeyBindingsOverlay.java
+++ b/megamek/src/megamek/client/ui/swing/boardview/KeyBindingsOverlay.java
@@ -204,11 +204,8 @@ private Rectangle getSize(Graphics graph, List lines, FontMetrics fm) {
/** Returns an ArrayList of all text lines to be shown. */
private List assembleTextLines() {
List result = new ArrayList<>();
-
- KeyCommandBind kcb = KeyCommandBind.KEY_BINDS;
- String mod = KeyEvent.getModifiersExText(kcb.modifiers);
- String key = KeyEvent.getKeyText(kcb.key);
- String toggleKey = (mod.isEmpty() ? "" : mod + "+") + key;
+
+ String toggleKey = KeyCommandBind.getDesc(KeyCommandBind.KEY_BINDS);
result.add(Messages.getString("KeyBindingsDisplay.heading", toggleKey));
if (clientGui != null) {
@@ -248,9 +245,8 @@ private List convertToStrings(List kcbs) {
List result = new ArrayList<>();
for (KeyCommandBind kcb: kcbs) {
String label = Messages.getString("KeyBinds.cmdNames." + kcb.cmd);
- String mod = KeyEvent.getModifiersExText(kcb.modifiers);
- String key = KeyEvent.getKeyText(kcb.key);
- result.add(label + ": " + (mod.isEmpty() ? "" : mod + "+") + key);
+ String d = KeyCommandBind.getDesc(kcb);
+ result.add(label + ": " + d);
}
return result;
}
diff --git a/megamek/src/megamek/client/ui/swing/boardview/PlanetaryConditionsOverlay.java b/megamek/src/megamek/client/ui/swing/boardview/PlanetaryConditionsOverlay.java
index 52f90bd920b..fe105c5b3df 100644
--- a/megamek/src/megamek/client/ui/swing/boardview/PlanetaryConditionsOverlay.java
+++ b/megamek/src/megamek/client/ui/swing/boardview/PlanetaryConditionsOverlay.java
@@ -193,10 +193,7 @@ private List assembleTextLines() {
Color colorHot = GUIP.getPlanetaryConditionsColorHot();
Color colorCold = GUIP.getPlanetaryConditionsColorCold();
- KeyCommandBind kcb = KeyCommandBind.PLANETARY_CONDITIONS;
- String mod = KeyEvent.getModifiersExText(kcb.modifiers);
- String key = KeyEvent.getKeyText(kcb.key);
- String toggleKey = (mod.isEmpty() ? "" : mod + "+") + key;
+ String toggleKey = KeyCommandBind.getDesc(KeyCommandBind.PLANETARY_CONDITIONS);
String tmpStr = "";
Boolean showHeading = GUIP.getAdvancedPlanetaryConditionsShowHeader();
diff --git a/megamek/src/megamek/client/ui/swing/util/KeyCommandBind.java b/megamek/src/megamek/client/ui/swing/util/KeyCommandBind.java
index 212d3670925..f25e2260188 100644
--- a/megamek/src/megamek/client/ui/swing/util/KeyCommandBind.java
+++ b/megamek/src/megamek/client/ui/swing/util/KeyCommandBind.java
@@ -98,7 +98,7 @@ public enum KeyCommandBind {
DRAW_LABELS(true, "toggleDrawLabels", VK_B, CTRL_DOWN_MASK),
HEX_COORDS(true, "toggleHexCoords", VK_G, CTRL_DOWN_MASK),
MINIMAP(true, "toggleMinimap", VK_M, CTRL_DOWN_MASK),
- LOS_SETTING(true, "viewLosSetting", VK_L, CTRL_DOWN_MASK | SHIFT_DOWN_MASK),
+ LOS_SETTING(true, "viewLosSetting", VK_L, CTRL_DOWN_MASK | ALT_DOWN_MASK),
UNIT_DISPLAY(true, "toggleUnitDisplay", VK_D, CTRL_DOWN_MASK),
UNIT_OVERVIEW(true, "toggleUnitOverview", VK_U, CTRL_DOWN_MASK),
KEY_BINDS(true, "toggleKeybinds", VK_K, CTRL_DOWN_MASK),
@@ -202,4 +202,11 @@ public static KeyCommandBind getBindByCmd(String cmd) {
public static KeyStroke keyStroke(KeyCommandBind bind) {
return KeyStroke.getKeyStroke(bind.key, bind.modifiers);
}
+
+ /** returns formatted mod + key for display*/
+ public static String getDesc(KeyCommandBind k) {
+ String mod = getModifiersExText(k.modifiers);
+ String key = getKeyText(k.key);
+ return (mod.isEmpty() ? "" : mod + "+") + key;
+ }
}
\ No newline at end of file