mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 20:58:03 +00:00
Make menu items easier to click
Mention context menu ability select in CHANGES.txt
This commit is contained in:
@@ -8,6 +8,12 @@ Forge Beta: 11-##-2013 ver 1.5.5
|
||||
Release Notes
|
||||
-------------
|
||||
|
||||
- Select abilities using context menu -
|
||||
Instead of displaying a dialog to select abilities, you'll now get a context menu when left or right clicking cards with multiple ability choices
|
||||
Each ability will have a keyboard shortcut of 1-9 based on order
|
||||
Unplayable activated abilities will still appear disabled so shortcuts are constant regardless of game state
|
||||
|
||||
|
||||
- Commander 2013 cards -
|
||||
Forge now includes many of the new Commander 2013 cards. It may take a few days/weeks before these new card pictures become available for downloading via the "Download LQ Card Pictures" button. The LQ set pictures tend to take a few more weeks/months to process before they become available for downloading via the "Download LQ Set Pictures" button. Please be patient. The Forge devs are not involved in maintaining the servers that house these pictures.
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
package forge.gui;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.FontFormatException;
|
||||
import java.awt.event.ActionEvent;
|
||||
@@ -100,6 +101,13 @@ public final class GuiUtils {
|
||||
}
|
||||
}
|
||||
|
||||
private static final int minItemWidth = 100;
|
||||
private static final int itemHeight = 25;
|
||||
|
||||
public static void setMenuItemSize(JMenuItem item) {
|
||||
item.setPreferredSize(new Dimension(Math.max(item.getPreferredSize().width, minItemWidth), itemHeight));
|
||||
}
|
||||
|
||||
public static JMenuItem createMenuItem(String label, KeyStroke accelerator, final Runnable onClick, boolean enabled, boolean bold) {
|
||||
JMenuItem item = new JMenuItem(label);
|
||||
item.addActionListener(new ActionListener() {
|
||||
@@ -115,9 +123,10 @@ public final class GuiUtils {
|
||||
if (bold) {
|
||||
item.setFont(item.getFont().deriveFont(Font.BOLD));
|
||||
}
|
||||
setMenuItemSize(item);
|
||||
return item;
|
||||
}
|
||||
|
||||
|
||||
public static void addMenuItem(JPopupMenu parent, String label, KeyStroke accelerator, Runnable onClick) {
|
||||
parent.add(createMenuItem(label, accelerator, onClick, true, false));
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package forge.gui.menus;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.KeyEvent;
|
||||
@@ -16,12 +15,10 @@ import javax.swing.event.PopupMenuListener;
|
||||
|
||||
import forge.Singletons;
|
||||
import forge.control.RestartUtil;
|
||||
import forge.gui.GuiUtils;
|
||||
import forge.util.TypeUtil;
|
||||
|
||||
public final class ForgeMenu {
|
||||
private static final int minItemWidth = 100;
|
||||
private static final int itemHeight = 25;
|
||||
|
||||
private JPopupMenu popupMenu;
|
||||
private IMenuProvider provider;
|
||||
private static HashMap<KeyStroke, JMenuItem> activeShortcuts = new HashMap<KeyStroke, JMenuItem>();
|
||||
@@ -98,8 +95,8 @@ public final class ForgeMenu {
|
||||
private void setupItem(JMenuItem item) {
|
||||
if (item == null) { return; }
|
||||
|
||||
item.setPreferredSize(new Dimension(Math.max(item.getPreferredSize().width, minItemWidth), itemHeight));
|
||||
|
||||
GuiUtils.setMenuItemSize(item);
|
||||
|
||||
KeyStroke shortcut = item.getAccelerator();
|
||||
if (shortcut != null) {
|
||||
activeShortcuts.put(shortcut, item);
|
||||
|
||||
Reference in New Issue
Block a user