mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
- add ctrl(cmd)+enter hotkey to auto button in ability chooser dialog
- scroll game log to top on display
This commit is contained in:
@@ -19,6 +19,8 @@ import javax.swing.event.ListDataListener;
|
||||
import javax.swing.event.ListSelectionEvent;
|
||||
import javax.swing.event.ListSelectionListener;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
|
||||
import forge.Card;
|
||||
import forge.card.spellability.SpellAbility;
|
||||
import forge.gui.match.CMatchUI;
|
||||
@@ -306,12 +308,27 @@ public class DualListBox<T> extends FPanel {
|
||||
onRemove.run();
|
||||
}
|
||||
};
|
||||
|
||||
final Function<KeyEvent, Void> onEnter = new Function<KeyEvent, Void>() {
|
||||
@Override
|
||||
public Void apply (KeyEvent e) {
|
||||
if (e.getKeyCode() == 10) {
|
||||
if (e.isControlDown() || e.isMetaDown()) {
|
||||
autoButton.doClick();
|
||||
} else {
|
||||
okButton.doClick();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
sourceList.addKeyListener(new KeyAdapter() {
|
||||
@Override
|
||||
public void keyPressed(final KeyEvent e) {
|
||||
if (e.getKeyChar() == ' ') { onAdd.run(); }
|
||||
else if (e.getKeyCode() == 10) { okButton.doClick(); }
|
||||
else { onEnter.apply(e); }
|
||||
}
|
||||
});
|
||||
|
||||
@@ -319,7 +336,7 @@ public class DualListBox<T> extends FPanel {
|
||||
@Override
|
||||
public void keyPressed(final KeyEvent e) {
|
||||
if (e.getKeyChar() == ' ') { onRemove.run(); }
|
||||
else if (e.getKeyCode() == 10) { okButton.doClick(); }
|
||||
else { onEnter.apply(e); }
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -151,7 +151,6 @@ public class ViewWinLose {
|
||||
|
||||
final JPanel pnlLog = new JPanel(new MigLayout("insets 0, wrap, ax center"));
|
||||
final FScrollPane scrLog = new FScrollPane(txtLog);
|
||||
scrLog.getViewport().setViewPosition(new Point(0, 0));
|
||||
scrLog.setBorder(null);
|
||||
pnlLog.setOpaque(false);
|
||||
|
||||
@@ -168,6 +167,7 @@ public class ViewWinLose {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
scrLog.getViewport().setViewPosition(new Point(0, 0));
|
||||
focusButton.requestFocusInWindow();
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user