From 59b90872579d1aabd4a94fccae4aaf6a6ce013a3 Mon Sep 17 00:00:00 2001 From: magenoxx Date: Fri, 20 Jul 2012 17:33:48 +0400 Subject: [PATCH] BigCard component back with toggle option. --- .../main/java/mage/client/game/GamePanel.java | 47 +++++++++++++++---- 1 file changed, 39 insertions(+), 8 deletions(-) diff --git a/Mage.Client/src/main/java/mage/client/game/GamePanel.java b/Mage.Client/src/main/java/mage/client/game/GamePanel.java index eedfda34e9..90c2d15b88 100644 --- a/Mage.Client/src/main/java/mage/client/game/GamePanel.java +++ b/Mage.Client/src/main/java/mage/client/game/GamePanel.java @@ -109,7 +109,7 @@ public class GamePanel extends javax.swing.JPanel { final JLayeredPane j = new JLayeredPane(); j.setSize(1024,768); this.add(j); - j.add(jSplitPane1, JLayeredPane.DEFAULT_LAYER); + j.add(jSplitPane0, JLayeredPane.DEFAULT_LAYER); Map ui = getUIComponents(j); Plugins.getInstance().updateGamePanel(ui); @@ -121,7 +121,7 @@ public class GamePanel extends javax.swing.JPanel { int width = ((JComponent)e.getSource()).getWidth(); int height = ((JComponent)e.getSource()).getHeight(); j.setSize(width, height); - jSplitPane1.setSize(width, height); + jSplitPane0.setSize(width, height); sizeToScreen(); } }); @@ -629,6 +629,8 @@ public class GamePanel extends javax.swing.JPanel { abilityPicker = new mage.client.components.ability.AbilityPicker(); jSplitPane1 = new javax.swing.JSplitPane(); + jSplitPane0 = new javax.swing.JSplitPane(); + jPanel2 = new javax.swing.JPanel(); jPanel3 = new javax.swing.JPanel(); pnlGameInfo = new javax.swing.JPanel(); lblPhase = new javax.swing.JLabel(); @@ -662,6 +664,7 @@ public class GamePanel extends javax.swing.JPanel { userChatPanel.useExtendedView(ChatPanel.VIEW_MODE.CHAT); gameChatPanel.setConnectedChat(userChatPanel); gameChatPanel.disableInput(); + gameChatPanel.setMinimumSize(new java.awt.Dimension(100, 48)); jSplitPane2 = new javax.swing.JSplitPane(); handContainer = new HandPanel(); @@ -672,6 +675,12 @@ public class GamePanel extends javax.swing.JPanel { jSplitPane1.setResizeWeight(1.0); jSplitPane1.setOneTouchExpandable(true); jSplitPane1.setMinimumSize(new java.awt.Dimension(26, 48)); + + jSplitPane0.setBorder(null); + jSplitPane0.setDividerSize(7); + jSplitPane0.setResizeWeight(1.0); + jSplitPane0.setOneTouchExpandable(true); + pnlGameInfo.setOpaque(false); lblPhase.setLabelFor(txtPhase); @@ -757,8 +766,8 @@ public class GamePanel extends javax.swing.JPanel { } }); - KeyStroke ksAltShift = KeyStroke.getKeyStroke(KeyEvent.VK_E, InputEvent.ALT_MASK); - this.getInputMap(c).put(ksAltShift, "ENLARGE"); + KeyStroke ksAltE = KeyStroke.getKeyStroke(KeyEvent.VK_E, InputEvent.ALT_MASK); + this.getInputMap(c).put(ksAltE, "ENLARGE"); this.getActionMap().put("ENLARGE", new AbstractAction() { @Override public void actionPerformed(ActionEvent actionEvent) { @@ -767,6 +776,21 @@ public class GamePanel extends javax.swing.JPanel { } }); + KeyStroke ksAltD = KeyStroke.getKeyStroke(KeyEvent.VK_D, InputEvent.ALT_MASK); + this.getInputMap(c).put(ksAltD, "BIG_IMAGE"); + this.getActionMap().put("BIG_IMAGE", new AbstractAction() { + @Override + public void actionPerformed(ActionEvent actionEvent) { + imagePanelState = !imagePanelState; + if (!imagePanelState) { + jSplitPane0.resetToPreferredSizes(); + jSplitPane0.setDividerLocation(jSplitPane0.getSize().width - jSplitPane0.getInsets().right - jSplitPane0.getDividerSize() - 260); + } else { + jSplitPane0.setDividerLocation(1.0); + } + } + }); + KeyStroke ksAltShiftReleased = KeyStroke.getKeyStroke(KeyEvent.VK_E, InputEvent.ALT_MASK, true); this.getInputMap(c).put(ksAltShiftReleased, "ENLARGE_RELEASE"); this.getActionMap().put("ENLARGE_RELEASE", new AbstractAction() { @@ -996,19 +1020,22 @@ public class GamePanel extends javax.swing.JPanel { //helper.setBorder(BorderFactory.createLineBorder(Color.ORANGE)); jSplitPane1.setLeftComponent(jPanel3); - - gameChatPanel.setMinimumSize(new java.awt.Dimension(100, 48)); jSplitPane1.setRightComponent(jSplitPane2); + jPanel2.add(bigCard); + jPanel2.setOpaque(false); + jSplitPane0.setLeftComponent(jSplitPane1); + jSplitPane0.setRightComponent(jPanel2); + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jSplitPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 1078, Short.MAX_VALUE) + .addComponent(jSplitPane0, javax.swing.GroupLayout.DEFAULT_SIZE, 1078, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jSplitPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 798, Short.MAX_VALUE) + .addComponent(jSplitPane0, javax.swing.GroupLayout.DEFAULT_SIZE, 798, Short.MAX_VALUE) ); } @@ -1102,7 +1129,9 @@ public class GamePanel extends javax.swing.JPanel { private mage.client.chat.ChatPanel gameChatPanel; private mage.client.game.FeedbackPanel feedbackPanel; private mage.client.chat.ChatPanel userChatPanel; + private javax.swing.JPanel jPanel2; private javax.swing.JPanel jPanel3; + private javax.swing.JSplitPane jSplitPane0; private javax.swing.JSplitPane jSplitPane1; private javax.swing.JLabel lblActivePlayer; private javax.swing.JLabel lblPhase; @@ -1139,6 +1168,8 @@ public class GamePanel extends javax.swing.JPanel { private JButton prevStep; private JLabel endButtonTip; + private boolean imagePanelState; + } class ReplayTask extends SwingWorker> {