added new 'view' menu to set and show text or image mode. magical enter key no longer switches between the modes.
parent
f156ab9f32
commit
dc5ab96e1f
Binary file not shown.
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 20 KiB |
|
@ -47,7 +47,7 @@ public final class GamePanel extends JPanel {
|
|||
|
||||
private static final String ACTION_KEY="action";
|
||||
private static final String UNDO_KEY="undo";
|
||||
private static final String SWITCH_KEY="switch";
|
||||
// private static final String SWITCH_KEY="switch";
|
||||
private static final String LOG_KEY="log";
|
||||
private static final String PASS_KEY="pass";
|
||||
private static final String LEFT_CLICK="lclick";
|
||||
|
@ -179,13 +179,13 @@ public final class GamePanel extends JPanel {
|
|||
}
|
||||
});
|
||||
|
||||
getActionMap().put(SWITCH_KEY, new AbstractAction() {
|
||||
/* getActionMap().put(SWITCH_KEY, new AbstractAction() {
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
switchKeyPressed();
|
||||
}
|
||||
});
|
||||
}); */
|
||||
|
||||
getActionMap().put(LOG_KEY, new AbstractAction() {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
@ -225,7 +225,7 @@ public final class GamePanel extends JPanel {
|
|||
getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0),ACTION_KEY);
|
||||
getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0),UNDO_KEY);
|
||||
getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0),UNDO_KEY);
|
||||
getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0),SWITCH_KEY);
|
||||
// getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0),SWITCH_KEY);
|
||||
getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0),LOG_KEY);
|
||||
getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_M, 0),LOG_KEY);
|
||||
getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, InputEvent.SHIFT_MASK),PASS_KEY);
|
||||
|
@ -272,14 +272,13 @@ public final class GamePanel extends JPanel {
|
|||
return gameTournamentViewer.getGameViewer().isUndoEnabled();
|
||||
}
|
||||
|
||||
private void switchKeyPressed() {
|
||||
/* private void switchKeyPressed() {
|
||||
if (textViewButton.isEnabled()) {
|
||||
final boolean selected=!textViewButton.isSelected();
|
||||
textViewButton.setSelected(selected);
|
||||
GeneralConfig.getInstance().setTextView(selected);
|
||||
updateView();
|
||||
frame.setTextImageMode(selected);
|
||||
}
|
||||
}
|
||||
} */
|
||||
|
||||
private void showLogBook(final boolean visible) {
|
||||
if (visible) {
|
||||
|
@ -342,7 +341,7 @@ public final class GamePanel extends JPanel {
|
|||
}
|
||||
}
|
||||
|
||||
private void updateView() {
|
||||
public void updateView() {
|
||||
if (isTextView()) {
|
||||
backgroundLabel.setImage(false);
|
||||
remove(imageStackViewer);
|
||||
|
|
|
@ -14,13 +14,6 @@ import magic.test.TestGameBuilder;
|
|||
import magic.ui.viewer.DeckStatisticsViewer;
|
||||
import magic.ui.widget.ZoneBackgroundLabel;
|
||||
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JMenu;
|
||||
import javax.swing.JMenuBar;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JPanel;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.event.ActionEvent;
|
||||
|
@ -30,6 +23,15 @@ import java.awt.event.WindowEvent;
|
|||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.LinkedList;
|
||||
import javax.swing.ButtonGroup;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JMenu;
|
||||
import javax.swing.JMenuBar;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JRadioButtonMenuItem;
|
||||
|
||||
public class MagicFrame extends JFrame implements ActionListener {
|
||||
|
||||
|
@ -74,6 +76,8 @@ public class MagicFrame extends JFrame implements ActionListener {
|
|||
private JMenuItem keywordsItem;
|
||||
private JMenuItem readMeItem;
|
||||
private JMenuItem aboutItem;
|
||||
private JRadioButtonMenuItem textModeItem;
|
||||
private JRadioButtonMenuItem imageModeItem;
|
||||
private MagicTournament tournament;
|
||||
private TournamentPanel tournamentPanel;
|
||||
private ExplorerPanel explorerPanel;
|
||||
|
@ -295,6 +299,23 @@ public class MagicFrame extends JFrame implements ActionListener {
|
|||
concedeGameItem.addActionListener(this);
|
||||
duelMenu.add(concedeGameItem);
|
||||
|
||||
// view menu
|
||||
final JMenu viewMenu = new JMenu("View");
|
||||
|
||||
ButtonGroup modeGroup = new ButtonGroup();
|
||||
|
||||
textModeItem = new JRadioButtonMenuItem("Text Mode");
|
||||
textModeItem.setSelected(GeneralConfig.getInstance().getTextView());
|
||||
textModeItem.addActionListener(this);
|
||||
modeGroup.add(textModeItem);
|
||||
viewMenu.add(textModeItem);
|
||||
|
||||
imageModeItem = new JRadioButtonMenuItem("Image Mode");
|
||||
imageModeItem.setSelected(!GeneralConfig.getInstance().getTextView());
|
||||
imageModeItem.addActionListener(this);
|
||||
modeGroup.add(imageModeItem);
|
||||
viewMenu.add(imageModeItem);
|
||||
|
||||
// help menu
|
||||
final JMenu helpMenu=new JMenu("Help");
|
||||
|
||||
|
@ -317,6 +338,7 @@ public class MagicFrame extends JFrame implements ActionListener {
|
|||
final JMenuBar menuBar=new JMenuBar();
|
||||
menuBar.add(tournamentMenu);
|
||||
menuBar.add(duelMenu);
|
||||
menuBar.add(viewMenu);
|
||||
menuBar.add(helpMenu);
|
||||
|
||||
/*
|
||||
|
@ -541,7 +563,14 @@ public class MagicFrame extends JFrame implements ActionListener {
|
|||
closeContent();
|
||||
enableMenuItem(README_ITEM,true);
|
||||
}
|
||||
|
||||
|
||||
public void setTextImageMode(final boolean isTextMode) {
|
||||
GeneralConfig.getInstance().setTextView(isTextMode);
|
||||
if (gamePanel != null) {
|
||||
gamePanel.updateView();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent event) {
|
||||
|
||||
|
@ -586,10 +615,14 @@ public class MagicFrame extends JFrame implements ActionListener {
|
|||
openCardExplorer();
|
||||
} else if (source==keywordsItem) {
|
||||
openKeywords();
|
||||
}else if (source==readMeItem) {
|
||||
} else if (source==readMeItem) {
|
||||
openReadme();
|
||||
}else if (source==aboutItem) {
|
||||
} else if (source==aboutItem) {
|
||||
new AboutDialog(this);
|
||||
} else if (source == textModeItem) {
|
||||
setTextImageMode(true);
|
||||
} else if (source == imageModeItem) {
|
||||
setTextImageMode(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue