GUI: reworked battlefield panels to use layouts and dynamic settings (no needs in NetBeans to modify it, no needs in size calculations, improved positions and sizes, deleted outdated code);

This commit is contained in:
Oleg Agafonov 2024-08-05 19:00:42 +04:00
parent 546fc1ed9a
commit f105828e1c
9 changed files with 98 additions and 728 deletions

View file

@ -1579,12 +1579,13 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
public void setConnectButtonText(String status) { public void setConnectButtonText(String status) {
this.btnConnect.setText(status); this.btnConnect.setText(status);
// Needed to layout the tooltbar after text length change // Needed to layout the toolbar after text length change
// TODO: need research, is it actual? // TODO: need research, is it actual?
GUISizeHelper.refreshGUIAndCards(false); //GUISizeHelper.refreshGUIAndCards(false);
this.btnConnect.repaint(); this.btnConnect.invalidate();
this.btnConnect.revalidate(); //this.btnConnect.repaint();
//this.btnConnect.revalidate();
} }
public static MageUI getUI() { public static MageUI getUI() {

View file

@ -46,7 +46,6 @@ import java.util.prefs.Preferences;
*/ */
public class PreferencesDialog extends javax.swing.JDialog { public class PreferencesDialog extends javax.swing.JDialog {
// TODO: add chat font changes in real time (current code require to app restart)
// TODO: fix card hand size (hand panel can't show full card on too big values - must use auto-height) // TODO: fix card hand size (hand panel can't show full card on too big values - must use auto-height)
private static final Logger logger = Logger.getLogger(PreferencesDialog.class); private static final Logger logger = Logger.getLogger(PreferencesDialog.class);

View file

@ -1,107 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="cc" green="cc" red="cc" type="rgb"/>
</Property>
</Properties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="btnSpecial" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="31" max="32767" attributes="0"/>
<Component id="btnLeft" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="btnRight" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="jScrollPane1" alignment="0" pref="224" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Component id="jScrollPane1" pref="81" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="btnRight" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="btnLeft" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="btnSpecial" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JButton" name="btnRight">
<Properties>
<Property name="text" type="java.lang.String" value="Cancel"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnRightActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="btnLeft">
<Properties>
<Property name="text" type="java.lang.String" value="OK"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnLeftActionPerformed"/>
</Events>
</Component>
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
<EtchetBorder/>
</Border>
</Property>
<Property name="horizontalScrollBarPolicy" type="int" value="31"/>
</Properties>
<AuxValues>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JTextArea" name="lblMessage">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="cc" green="cc" red="cc" type="rgb"/>
</Property>
<Property name="columns" type="int" value="20"/>
<Property name="editable" type="boolean" value="false"/>
<Property name="lineWrap" type="boolean" value="true"/>
<Property name="rows" type="int" value="2"/>
<Property name="wrapStyleWord" type="boolean" value="true"/>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="null"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JButton" name="btnSpecial">
<Properties>
<Property name="text" type="java.lang.String" value="Special"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnSpecialActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Form>

View file

@ -27,7 +27,11 @@ import java.util.concurrent.TimeUnit;
import static mage.constants.Constants.Option.*; import static mage.constants.Constants.Option.*;
/** /**
* @author BetaSteward_at_googlemail.com * Game GUI: feedback panel (over hand) with current priority and possible actions like done/cancel/special buttons
* <p>
* Warning, it's contains only clickable button, but all other logic done in helper panel
*
* @author BetaSteward_at_googlemail.com, JayDi85
*/ */
public class FeedbackPanel extends javax.swing.JPanel { public class FeedbackPanel extends javax.swing.JPanel {
@ -48,11 +52,7 @@ public class FeedbackPanel extends javax.swing.JPanel {
new XmageThreadFactory(ThreadUtils.THREAD_PREFIX_CLIENT_AUTO_CLOSE_TIMER) new XmageThreadFactory(ThreadUtils.THREAD_PREFIX_CLIENT_AUTO_CLOSE_TIMER)
); );
/**
* Creates new form FeedbackPanel
*/
public FeedbackPanel() { public FeedbackPanel() {
//initComponents();
customInitComponents(); customInitComponents();
} }
@ -134,13 +134,13 @@ public class FeedbackPanel extends javax.swing.JPanel {
requestFocusIfPossible(); requestFocusIfPossible();
updateOptions(options); updateOptions(options);
this.revalidate();
this.repaint();
this.helper.setLinks(btnLeft, btnRight, btnSpecial, btnUndo); this.helper.setLinks(btnLeft, btnRight, btnSpecial, btnUndo);
this.helper.setVisible(true); this.helper.setVisible(true);
this.helper.setGameNeedFeedback(gameNeedUserFeedback, gameTurnPhase); this.helper.setGameNeedFeedback(gameNeedUserFeedback, gameTurnPhase);
this.helper.autoSizeButtonsAndFeedbackState(); this.helper.autoSizeButtonsAndFeedbackState();
this.revalidate();
} }
private void setButtonState(String leftText, String rightText, FeedbackMode mode) { private void setButtonState(String leftText, String rightText, FeedbackMode mode) {

View file

@ -1,412 +0,0 @@
<?xml version="1.1" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<NonVisualComponents>
<Container class="mage.client.game.AbilityPicker" name="abilityPicker">
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout">
<Property name="useNullLayout" type="boolean" value="true"/>
</Layout>
</Container>
</NonVisualComponents>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jSplitPane1" alignment="0" pref="1078" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jSplitPane1" alignment="0" pref="798" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JSplitPane" name="jSplitPane1">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="null"/>
</Property>
<Property name="dividerSize" type="int" value="3"/>
<Property name="resizeWeight" type="double" value="1.0"/>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[26, 48]"/>
</Property>
</Properties>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout"/>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanel3">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
<JSplitPaneConstraints position="left"/>
</Constraint>
</Constraints>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="pnlGameInfo" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="hand" pref="715" max="32767" attributes="0"/>
<Component id="pnlBattlefield" pref="715" max="32767" attributes="0"/>
</Group>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Component id="pnlBattlefield" pref="794" max="32767" attributes="0"/>
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
<Component id="hand" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="pnlGameInfo" alignment="0" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JPanel" name="pnlGameInfo">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
<EtchetBorder/>
</Border>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="lblPriority" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="lblPhase" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="lblStep" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="lblTurn" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="lblActivePlayer" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="txtActivePlayer" alignment="0" pref="159" max="32767" attributes="1"/>
<Component id="txtPriority" alignment="0" pref="159" max="32767" attributes="1"/>
<Component id="txtTurn" alignment="0" pref="159" max="32767" attributes="1"/>
<Component id="txtStep" alignment="0" pref="159" max="32767" attributes="1"/>
<Component id="txtPhase" pref="159" max="32767" attributes="1"/>
</Group>
<EmptySpace min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="10" pref="10" max="10" attributes="0"/>
<Component id="btnConcede" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="btnStopWatching" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="62" max="32767" attributes="0"/>
</Group>
<Component id="bigCard" alignment="0" pref="256" max="32767" attributes="0"/>
<Component id="feedbackPanel" alignment="0" pref="256" max="32767" attributes="0"/>
<Component id="stack" alignment="0" pref="256" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="pnlReplay" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="51" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="3" attributes="0">
<Component id="lblPhase" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="txtPhase" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="3" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="lblStep" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="txtStep" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="3" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="lblTurn" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="txtTurn" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="3" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="lblActivePlayer" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="txtActivePlayer" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="3" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="lblPriority" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="txtPriority" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="feedbackPanel" min="-2" pref="109" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
<Component id="stack" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
<Component id="bigCard" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="164" max="32767" attributes="0"/>
<Component id="pnlReplay" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="btnConcede" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="btnStopWatching" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="lblPhase">
<Properties>
<Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
<ComponentRef name="txtPhase"/>
</Property>
<Property name="text" type="java.lang.String" value="Phase:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="txtPhase">
<Properties>
<Property name="text" type="java.lang.String" value="Phase"/>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.LineBorderInfo">
<LineBorder roundedCorners="true">
<Color PropertyName="color" blue="99" green="99" red="99" type="rgb"/>
</LineBorder>
</Border>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[0, 16]"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="lblStep">
<Properties>
<Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
<ComponentRef name="txtStep"/>
</Property>
<Property name="text" type="java.lang.String" value="Step:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="txtStep">
<Properties>
<Property name="text" type="java.lang.String" value="Step"/>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.LineBorderInfo">
<LineBorder roundedCorners="true">
<Color PropertyName="color" blue="99" green="99" red="99" type="rgb"/>
</LineBorder>
</Border>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[0, 16]"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="lblTurn">
<Properties>
<Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
<ComponentRef name="txtTurn"/>
</Property>
<Property name="text" type="java.lang.String" value="Turn:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="txtTurn">
<Properties>
<Property name="text" type="java.lang.String" value="Turn"/>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.LineBorderInfo">
<LineBorder roundedCorners="true">
<Color PropertyName="color" blue="99" green="99" red="99" type="rgb"/>
</LineBorder>
</Border>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[0, 16]"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="txtActivePlayer">
<Properties>
<Property name="text" type="java.lang.String" value="Active Player"/>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.LineBorderInfo">
<LineBorder roundedCorners="true">
<Color PropertyName="color" blue="99" green="99" red="99" type="rgb"/>
</LineBorder>
</Border>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[0, 16]"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="lblActivePlayer">
<Properties>
<Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
<ComponentRef name="txtActivePlayer"/>
</Property>
<Property name="text" type="java.lang.String" value="Active Player:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="txtPriority">
<Properties>
<Property name="text" type="java.lang.String" value="Priority Player"/>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.LineBorderInfo">
<LineBorder roundedCorners="true">
<Color PropertyName="color" blue="99" green="99" red="99" type="rgb"/>
</LineBorder>
</Border>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[0, 16]"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="lblPriority">
<Properties>
<Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
<ComponentRef name="txtPriority"/>
</Property>
<Property name="text" type="java.lang.String" value="Priority Player:"/>
</Properties>
</Component>
<Component class="mage.client.game.FeedbackPanel" name="feedbackPanel">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.LineBorderInfo">
<LineBorder/>
</Border>
</Property>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[208, 121]"/>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[208, 121]"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="btnConcede">
<Properties>
<Property name="text" type="java.lang.String" value="Concede"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnConcedeActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="btnStopWatching">
<Properties>
<Property name="text" type="java.lang.String" value="Stop Watching"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnStopWatchingActionPerformed"/>
</Events>
</Component>
<Component class="mage.client.cards.BigCard" name="bigCard">
</Component>
<Component class="mage.client.cards.Cards" name="stack">
<Properties>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="new java.awt.Dimension(Config.dimensions.frameWidth, Config.dimensions.frameHeight + 25)" type="code"/>
</Property>
</Properties>
</Component>
<Container class="javax.swing.JPanel" name="pnlReplay">
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="btnStopReplay" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="btnPreviousPlay" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="btnNextPlay" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="103" groupAlignment="3" attributes="0">
<Component id="btnStopReplay" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="btnPreviousPlay" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="btnNextPlay" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JButton" name="btnStopReplay">
<Properties>
<Property name="text" type="java.lang.String" value="Stop"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnStopReplayActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="btnPreviousPlay">
<Properties>
<Property name="text" type="java.lang.String" value="Previous"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnPreviousPlayActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="btnNextPlay">
<Properties>
<Property name="text" type="java.lang.String" value="Next"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnNextPlayActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="pnlBattlefield">
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/>
</Container>
<Component class="mage.client.cards.Cards" name="hand">
<Properties>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="new java.awt.Dimension(Config.dimensions.frameWidth, Config.dimensions.frameHeight + 25)" type="code"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
<Component class="mage.client.chat.ChatPanel" name="chatPanel">
<Properties>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[100, 48]"/>
</Property>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
<JSplitPaneConstraints position="right"/>
</Constraint>
</Constraints>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Form>

View file

@ -13,7 +13,6 @@ import mage.client.components.HoverButton;
import mage.client.components.KeyboundButton; import mage.client.components.KeyboundButton;
import mage.client.components.MageComponents; import mage.client.components.MageComponents;
import mage.client.components.ext.dlg.DialogManager; import mage.client.components.ext.dlg.DialogManager;
import mage.client.components.layout.RelativeLayout;
import mage.client.components.tray.MageTray; import mage.client.components.tray.MageTray;
import mage.client.dialog.*; import mage.client.dialog.*;
import mage.client.dialog.CardInfoWindowDialog.ShowType; import mage.client.dialog.CardInfoWindowDialog.ShowType;
@ -35,9 +34,8 @@ import mage.view.*;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.mage.plugins.card.utils.impl.ImageManagerImpl; import org.mage.plugins.card.utils.impl.ImageManagerImpl;
import javax.swing.*;
import javax.swing.Timer; import javax.swing.Timer;
import javax.swing.GroupLayout.Alignment; import javax.swing.*;
import javax.swing.border.Border; import javax.swing.border.Border;
import javax.swing.border.EmptyBorder; import javax.swing.border.EmptyBorder;
import javax.swing.border.LineBorder; import javax.swing.border.LineBorder;
@ -102,7 +100,7 @@ public final class GamePanel extends javax.swing.JPanel {
private final PickMultiNumberDialog pickMultiNumber; private final PickMultiNumberDialog pickMultiNumber;
private JLayeredPane jLayeredPane; private JLayeredPane jLayeredPane;
private String chosenHandKey = "You"; private String chosenHandKey = "You";
private boolean smallMode = false; private boolean smallMode = false; // TODO: no needs in gui scale, delete it
private boolean initialized = false; private boolean initialized = false;
private final skipButtonsList skipButtons = new skipButtonsList(); private final skipButtonsList skipButtons = new skipButtonsList();
@ -194,10 +192,41 @@ public final class GamePanel extends javax.swing.JPanel {
initComponents = true; initComponents = true;
initComponents(); initComponents();
// prepare command panels (feedback, hand, skip buttons and stack)
if (DebugUtil.GUI_GAME_DRAW_COMMANDS_PANEL_BORDER) {
pnlHelperHandButtonsStackArea.setBorder(BorderFactory.createLineBorder(Color.MAGENTA));
}
// all game panels
pnlHelperHandButtonsStackArea.removeAll();
pnlHelperHandButtonsStackArea.setLayout(new BorderLayout());
// battlefields + phases
JPanel pnlBattlefieldAndPhases = new JPanel(new BorderLayout());
pnlBattlefieldAndPhases.setOpaque(false);
pnlBattlefieldAndPhases.add(pnlBattlefield, BorderLayout.CENTER);
pnlBattlefieldAndPhases.add(phasesContainer, BorderLayout.EAST);
pnlHelperHandButtonsStackArea.add(pnlBattlefieldAndPhases, BorderLayout.CENTER);
// commands (feedback + hand + skip + stack)
JPanel pnlCommandsRoot = new JPanel(new BorderLayout());
pnlCommandsRoot.setOpaque(false);
// ... feedback + hand
JPanel pnlCommandsFeedbackAndHand = new JPanel(new BorderLayout());
pnlCommandsFeedbackAndHand.setOpaque(false);
pnlCommandsFeedbackAndHand.add(feedbackPanel, BorderLayout.NORTH);
pnlCommandsFeedbackAndHand.add(handContainer, BorderLayout.CENTER);
// ... skip + stack
JPanel pnlCommandsSkipAndStack = new JPanel(new BorderLayout());
pnlCommandsSkipAndStack.setOpaque(false);
pnlCommandsSkipAndStack.add(pnlShortCuts, BorderLayout.NORTH);
pnlCommandsSkipAndStack.add(stackObjects, BorderLayout.CENTER);
// ... all
pnlCommandsRoot.add(pnlCommandsFeedbackAndHand, BorderLayout.CENTER);
pnlCommandsRoot.add(pnlCommandsSkipAndStack, BorderLayout.EAST);
pnlHelperHandButtonsStackArea.add(pnlCommandsRoot, BorderLayout.SOUTH);
// prepare commands buttons panel with flow layout (instead custom from IDE) // prepare commands buttons panel with flow layout (instead custom from IDE)
// size changes in helper method at the end // size changes in helper method at the end
// TODO: remove IDE form file (it useless anyway due many custom code in init) if (DebugUtil.GUI_GAME_DRAW_SKIP_BUTTONS_PANEL_BORDER) {
if (DebugUtil.GUI_GAME_DRAW_COMMAND_BUTTONS_PANEL_BORDER) {
pnlShortCuts.setBorder(BorderFactory.createLineBorder(Color.red)); pnlShortCuts.setBorder(BorderFactory.createLineBorder(Color.red));
} }
pnlShortCuts.removeAll(); pnlShortCuts.removeAll();
@ -224,6 +253,7 @@ public final class GamePanel extends javax.swing.JPanel {
this.feedbackPanel.setConnectedChatPanel(this.userChatPanel); this.feedbackPanel.setConnectedChatPanel(this.userChatPanel);
// Override layout (I can't edit generated code) // Override layout (I can't edit generated code)
// TODO: research - why it used all that panels on the root
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
final JLayeredPane jLayeredBackgroundPane = new JLayeredPane(); final JLayeredPane jLayeredBackgroundPane = new JLayeredPane();
jLayeredBackgroundPane.setSize(1024, 768); jLayeredBackgroundPane.setSize(1024, 768);
@ -264,17 +294,21 @@ public final class GamePanel extends javax.swing.JPanel {
ComponentAdapter componentAdapterPlayField = new ComponentAdapter() { ComponentAdapter componentAdapterPlayField = new ComponentAdapter() {
@Override @Override
public void componentResized(ComponentEvent e) { public void componentResized(ComponentEvent e) {
if (!initComponents) { if (initComponents) {
return;
}
if (resizeTimer.isRunning()) { if (resizeTimer.isRunning()) {
resizeTimer.restart(); resizeTimer.restart();
} else { } else {
resizeTimer.start(); resizeTimer.start();
} }
} }
}
}; };
resizeTimer = new Timer(1000, evt -> SwingUtilities.invokeLater(() -> { resizeTimer = new Timer(1000, evt -> SwingUtilities.invokeLater(() -> {
if (initComponents) {
return;
}
resizeTimer.stop(); resizeTimer.stop();
setGUISize(false); setGUISize(false);
feedbackPanel.changeGUISize(); feedbackPanel.changeGUISize();
@ -304,7 +338,8 @@ public final class GamePanel extends javax.swing.JPanel {
public void cleanUp() { public void cleanUp() {
MageFrame.removeGame(gameId); MageFrame.removeGame(gameId);
saveDividerLocations(); saveDividerLocations();
this.gameChatPanel.cleanUp();; this.gameChatPanel.cleanUp();
;
this.userChatPanel.cleanUp(); this.userChatPanel.cleanUp();
this.removeListener(); this.removeListener();
@ -451,27 +486,17 @@ public final class GamePanel extends javax.swing.JPanel {
txtHoldPriority.setFont(new Font(GUISizeHelper.gameFeedbackPanelFont.getFontName(), Font.BOLD, GUISizeHelper.gameFeedbackPanelFont.getSize())); txtHoldPriority.setFont(new Font(GUISizeHelper.gameFeedbackPanelFont.getFontName(), Font.BOLD, GUISizeHelper.gameFeedbackPanelFont.getSize()));
GUISizeHelper.changePopupMenuFont(popupMenuTriggerOrder); GUISizeHelper.changePopupMenuFont(popupMenuTriggerOrder);
// hand + stack panels // commands panel
// the stack takes up a portion of the possible space (GUISizeHelper.stackWidth) // TODO: add scrolls and save sizes instead const
// TODO: research and delete rare used settings // hand <|> stack
int newStackWidth = pnlHelperHandButtonsStackArea.getWidth() * GUISizeHelper.stackWidth / 100; int upperPanelsHeight = getSkipButtonsPanelDefaultHeight();
newStackWidth = Math.max(410, newStackWidth); feedbackPanel.setPreferredSize(new Dimension(Short.MAX_VALUE, upperPanelsHeight));
Dimension newDimension = new Dimension( feedbackPanel.setMaximumSize(new Dimension(Short.MAX_VALUE, upperPanelsHeight));
pnlHelperHandButtonsStackArea.getWidth() - newStackWidth, pnlShortCuts.setPreferredSize(new Dimension(500, upperPanelsHeight));
MageActionCallback.getHandOrStackMargins(Zone.HAND).getHeight() + GUISizeHelper.handCardDimension.height + GUISizeHelper.scrollBarSize pnlShortCuts.setMaximumSize(new Dimension(500, upperPanelsHeight));
);
handContainer.setPreferredSize(newDimension);
handContainer.setMaximumSize(newDimension);
// stack // stack
newDimension = new Dimension(
newStackWidth,
MageActionCallback.getHandOrStackMargins(Zone.STACK).getHeight() + GUISizeHelper.handCardDimension.height + GUISizeHelper.scrollBarSize
);
stackObjects.setCardDimension(GUISizeHelper.handCardDimension); stackObjects.setCardDimension(GUISizeHelper.handCardDimension);
stackObjects.setPreferredSize(newDimension);
stackObjects.setMinimumSize(newDimension);
stackObjects.setMaximumSize(newDimension);
stackObjects.changeGUISize(); // must call to cards fit stackObjects.changeGUISize(); // must call to cards fit
// game logs and chat // game logs and chat
@ -483,11 +508,7 @@ public final class GamePanel extends javax.swing.JPanel {
float guiScale = GUISizeHelper.dialogGuiScale; float guiScale = GUISizeHelper.dialogGuiScale;
int hGap = GUISizeHelper.guiSizeScale(SKIP_BUTTONS_SPACE_H, guiScale); int hGap = GUISizeHelper.guiSizeScale(SKIP_BUTTONS_SPACE_H, guiScale);
int vGap = GUISizeHelper.guiSizeScale(SKIP_BUTTONS_SPACE_V, guiScale); int vGap = GUISizeHelper.guiSizeScale(SKIP_BUTTONS_SPACE_V, guiScale);
newDimension = new Dimension(newStackWidth, (4 * vGap) + (2 * GUISizeHelper.gameCommandButtonHeight));
pnlShortCuts.setLayout(new FlowLayout(FlowLayout.RIGHT, hGap, vGap)); pnlShortCuts.setLayout(new FlowLayout(FlowLayout.RIGHT, hGap, vGap));
pnlShortCuts.setPreferredSize(newDimension);
pnlShortCuts.setMinimumSize(newDimension);
pnlShortCuts.setMaximumSize(newDimension);
// skip buttons - sizes // skip buttons - sizes
Dimension strictSize = new Dimension(2 * GUISizeHelper.gameCommandButtonHeight, GUISizeHelper.gameCommandButtonHeight); Dimension strictSize = new Dimension(2 * GUISizeHelper.gameCommandButtonHeight, GUISizeHelper.gameCommandButtonHeight);
setSkipButtonSize(btnCancelSkip, guiScale, strictSize); setSkipButtonSize(btnCancelSkip, guiScale, strictSize);
@ -526,6 +547,14 @@ public final class GamePanel extends javax.swing.JPanel {
} }
} }
private int getSkipButtonsPanelDefaultHeight() {
// make sure it will get two rows of buttons
float guiScale = GUISizeHelper.dialogGuiScale;
int vGap = GUISizeHelper.guiSizeScale(SKIP_BUTTONS_SPACE_V, guiScale);
int extraSpace = GUISizeHelper.guiSizeScale(30, guiScale); // extra space for messages in feedback
return extraSpace + (4 * vGap) + (2 * GUISizeHelper.gameCommandButtonHeight);
}
private void reloadThemeRelatedGraphic() { private void reloadThemeRelatedGraphic() {
// skip buttons - images // skip buttons - images
int buttonHeight = GUISizeHelper.gameCommandButtonHeight; int buttonHeight = GUISizeHelper.gameCommandButtonHeight;
@ -588,12 +617,6 @@ public final class GamePanel extends javax.swing.JPanel {
if (button instanceof KeyboundButton) { if (button instanceof KeyboundButton) {
((KeyboundButton) button).updateGuiScale(guiScale); ((KeyboundButton) button).updateGuiScale(guiScale);
} }
// no needs in size - it controlled by button's icon
if (true) return;
button.setMinimumSize(size);
button.setPreferredSize(size);
button.setMaximumSize(size);
} }
private void saveDividerLocations() { private void saveDividerLocations() {
@ -631,7 +654,7 @@ public final class GamePanel extends javax.swing.JPanel {
} }
private boolean isSmallMode() { private boolean isSmallMode() {
// TODO: no needs on gui scale? // TODO: no needs on gui scale, delete
return this.getBounds().height < 770; return this.getBounds().height < 770;
} }
@ -2101,7 +2124,12 @@ public final class GamePanel extends javax.swing.JPanel {
lblActivePlayer = new javax.swing.JLabel(); lblActivePlayer = new javax.swing.JLabel();
txtPriority = new javax.swing.JLabel(); txtPriority = new javax.swing.JLabel();
lblPriority = new javax.swing.JLabel(); lblPriority = new javax.swing.JLabel();
feedbackPanel = new mage.client.game.FeedbackPanel(); feedbackPanel = new mage.client.game.FeedbackPanel();
helper = new HelperPanel();
feedbackPanel.setHelperPanel(helper);
feedbackPanel.setLayout(new BorderLayout());
feedbackPanel.add(helper, BorderLayout.CENTER);
Border paddingBorder = BorderFactory.createEmptyBorder(4, 4, 4, 4); Border paddingBorder = BorderFactory.createEmptyBorder(4, 4, 4, 4);
Border border = BorderFactory.createLineBorder(Color.DARK_GRAY, 2); Border border = BorderFactory.createLineBorder(Color.DARK_GRAY, 2);
@ -2149,7 +2177,7 @@ public final class GamePanel extends javax.swing.JPanel {
handCards = new HashMap<>(); handCards = new HashMap<>();
pnlShortCuts.setOpaque(false); pnlShortCuts.setOpaque(false);
pnlShortCuts.setPreferredSize(new Dimension(410, 72)); //pnlShortCuts.setPreferredSize(new Dimension(410, 72));
stackObjects = new mage.client.cards.Cards(); stackObjects = new mage.client.cards.Cards();
@ -2525,88 +2553,6 @@ public final class GamePanel extends javax.swing.JPanel {
initPopupMenuTriggerOrder(); initPopupMenuTriggerOrder();
// Replay panel to control replay of games
javax.swing.GroupLayout gl_pnlReplay = new javax.swing.GroupLayout(pnlReplay);
pnlReplay.setLayout(gl_pnlReplay);
gl_pnlReplay.setHorizontalGroup(
gl_pnlReplay.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(gl_pnlReplay.createSequentialGroup()
.addComponent(btnPreviousPlay, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btnPlay, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(btnStopReplay, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btnNextPlay, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btnSkipForward, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE))
);
gl_pnlReplay.setVerticalGroup(
gl_pnlReplay.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(btnSkipForward, 0, 0, Short.MAX_VALUE)
.addComponent(btnNextPlay, 0, 0, Short.MAX_VALUE)
.addComponent(btnStopReplay, 0, 0, Short.MAX_VALUE)
.addComponent(btnPlay, 0, 0, Short.MAX_VALUE)
.addComponent(btnPreviousPlay, javax.swing.GroupLayout.PREFERRED_SIZE, 31, Short.MAX_VALUE)
);
// Game info panel (buttons on the right panel)
javax.swing.GroupLayout gl_pnlShortCuts = new javax.swing.GroupLayout(pnlShortCuts);
pnlShortCuts.setLayout(gl_pnlShortCuts);
gl_pnlShortCuts.setHorizontalGroup(gl_pnlShortCuts.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(gl_pnlShortCuts.createSequentialGroup()
.addComponent(btnSkipToNextTurn)
.addComponent(btnSkipToEndTurn)
.addComponent(btnSkipToNextMain)
.addComponent(btnSkipToYourTurn)
.addComponent(btnSkipStack)
.addComponent(btnSkipToEndStepBeforeYourTurn)
)
.addGroup(gl_pnlShortCuts.createSequentialGroup()
.addComponent(txtHoldPriority)
/*.addComponent(btnToggleMacro)*/
.addComponent(btnSwitchHands)
.addComponent(btnCancelSkip)
.addComponent(btnConcede)
.addComponent(btnStopWatching)
)
//.addComponent(bigCard, javax.swing.GroupLayout.DEFAULT_SIZE, 256, Short.MAX_VALUE)
//.addComponent(feedbackPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 256, Short.MAX_VALUE)
//.addComponent(stack, javax.swing.GroupLayout.DEFAULT_SIZE, 256, Short.MAX_VALUE)
.addGroup(gl_pnlShortCuts.createSequentialGroup()
.addContainerGap()
.addComponent(pnlReplay, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(51, Short.MAX_VALUE))
);
gl_pnlShortCuts.setVerticalGroup(gl_pnlShortCuts.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(gl_pnlShortCuts.createSequentialGroup()
//.addComponent(bigCard, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
//.addGap(1, 1, 1)
//.addComponent(feedbackPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE)
//.addComponent(stack, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 164, Short.MAX_VALUE)
.addComponent(pnlReplay, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(gl_pnlShortCuts.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(btnSkipToNextTurn)
.addComponent(btnSkipToEndTurn)
.addComponent(btnSkipToNextMain)
.addComponent(btnSkipToYourTurn)
.addComponent(btnSkipStack)
.addComponent(btnSkipToEndStepBeforeYourTurn)
)
.addGroup(gl_pnlShortCuts.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
/*.addComponent(btnToggleMacro)*/
.addComponent(txtHoldPriority)
.addComponent(btnSwitchHands)
.addComponent(btnCancelSkip)
.addComponent(btnConcede)
.addComponent(btnStopWatching)
)
)
);
pnlBattlefield.setLayout(new java.awt.GridBagLayout()); pnlBattlefield.setLayout(new java.awt.GridBagLayout());
jPhases = new JPanel(); jPhases = new JPanel();
@ -2633,73 +2579,22 @@ public final class GamePanel extends javax.swing.JPanel {
pnlReplay.setOpaque(false); pnlReplay.setOpaque(false);
helper = new HelperPanel();
feedbackPanel.setHelperPanel(helper);
jSplitPane2.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT); jSplitPane2.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
jSplitPane2.setResizeWeight(0.5); jSplitPane2.setResizeWeight(0.5);
jSplitPane2.setLeftComponent(userChatPanel); jSplitPane2.setLeftComponent(userChatPanel);
jSplitPane2.setBottomComponent(gameChatPanel); jSplitPane2.setBottomComponent(gameChatPanel);
phasesContainer = new JPanel(); // phases buttons
phasesContainer.setLayout(new RelativeLayout(RelativeLayout.Y_AXIS)); phasesContainer = new JPanel(new FlowLayout(FlowLayout.CENTER));
phasesContainer.setBackground(new Color(0, 0, 0, 0)); phasesContainer.setOpaque(false);
Float ratio = (float) 1;
JPanel empty1 = new JPanel();
empty1.setBackground(new Color(0, 0, 0, 0));
phasesContainer.add(empty1, ratio);
phasesContainer.add(jPhases); phasesContainer.add(jPhases);
javax.swing.GroupLayout gl_helperHandButtonsStackArea = new javax.swing.GroupLayout(pnlHelperHandButtonsStackArea); // split: battlefield <|> chats
gl_helperHandButtonsStackArea.setHorizontalGroup(
gl_helperHandButtonsStackArea.createParallelGroup(Alignment.LEADING)
.addGroup(gl_helperHandButtonsStackArea.createSequentialGroup()
// .addGap(0)
.addGroup(gl_helperHandButtonsStackArea.createParallelGroup(Alignment.LEADING)
.addGroup(gl_helperHandButtonsStackArea.createSequentialGroup()
.addGroup(gl_helperHandButtonsStackArea.createParallelGroup(Alignment.LEADING)
.addComponent(helper, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(handContainer, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
)
.addGroup(gl_helperHandButtonsStackArea.createParallelGroup(Alignment.LEADING)
.addComponent(pnlShortCuts, 410, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)
.addComponent(stackObjects, 410, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)
)
)
.addGap(0)
//.addComponent(jPhases, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(gl_helperHandButtonsStackArea.createSequentialGroup()
.addComponent(pnlBattlefield, GroupLayout.DEFAULT_SIZE, 200, Short.MAX_VALUE)
.addComponent(phasesContainer, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
)))
);
gl_helperHandButtonsStackArea.setVerticalGroup(
gl_helperHandButtonsStackArea.createParallelGroup(Alignment.TRAILING)
.addGroup(gl_helperHandButtonsStackArea.createSequentialGroup()
.addGroup(gl_helperHandButtonsStackArea.createParallelGroup(Alignment.LEADING)
.addComponent(pnlBattlefield, GroupLayout.DEFAULT_SIZE, 200, Short.MAX_VALUE)
.addComponent(phasesContainer, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
)
//.addPreferredGap(ComponentPlacement.RELATED)
.addGroup(gl_helperHandButtonsStackArea.createParallelGroup(Alignment.LEADING)
.addGroup(gl_helperHandButtonsStackArea.createSequentialGroup()
.addGap(2)
.addComponent(pnlShortCuts, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addComponent(stackObjects, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
)
.addGroup(gl_helperHandButtonsStackArea.createSequentialGroup()
.addComponent(helper, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addComponent(handContainer, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
)
)
)
);
pnlHelperHandButtonsStackArea.setLayout(gl_helperHandButtonsStackArea);
jSplitPane1.setLeftComponent(pnlHelperHandButtonsStackArea); jSplitPane1.setLeftComponent(pnlHelperHandButtonsStackArea);
jSplitPane1.setRightComponent(jSplitPane2); jSplitPane1.setRightComponent(jSplitPane2);
// Set individual area sizes of big card pane // Set individual area sizes of big card pane
// TODO: research - is it possible to use border layout without all custom code
GridBagLayout gbl = new GridBagLayout(); GridBagLayout gbl = new GridBagLayout();
jPanel2.setLayout(gbl); jPanel2.setLayout(gbl);
@ -2721,6 +2616,7 @@ public final class GamePanel extends javax.swing.JPanel {
// big card and buttons // big card and buttons
jSplitPane0.setRightComponent(jPanel2); jSplitPane0.setRightComponent(jPanel2);
// TODO: need reseach, possible reason of weird scrolls restore
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout); this.setLayout(layout);
layout.setHorizontalGroup( layout.setHorizontalGroup(

View file

@ -11,7 +11,6 @@ import mage.client.util.audio.AudioManager;
import mage.constants.TurnPhase; import mage.constants.TurnPhase;
import javax.swing.*; import javax.swing.*;
import javax.swing.border.EmptyBorder;
import java.awt.*; import java.awt.*;
import java.awt.event.*; import java.awt.event.*;
import java.util.ArrayList; import java.util.ArrayList;
@ -22,7 +21,7 @@ import static mage.client.game.FeedbackPanel.FeedbackMode.QUESTION;
import static mage.constants.PlayerAction.*; import static mage.constants.PlayerAction.*;
/** /**
* Panel with buttons that copy the state of feedback panel. * Game GUI: helper component for feedback panel - implements all feedback logic here
* *
* @author ayrat, JayDi85 * @author ayrat, JayDi85
*/ */
@ -32,8 +31,7 @@ public class HelperPanel extends JPanel {
private javax.swing.JButton btnRight; private javax.swing.JButton btnRight;
private javax.swing.JButton btnSpecial; private javax.swing.JButton btnSpecial;
private javax.swing.JButton btnUndo; private javax.swing.JButton btnUndo;
//private javax.swing.JButton btnEndTurn;
//private javax.swing.JButton btnStopTimer;
private JScrollPane textAreaScrollPane; private JScrollPane textAreaScrollPane;
private MageTextArea dialogTextArea; private MageTextArea dialogTextArea;
JPanel mainPanel; JPanel mainPanel;
@ -104,11 +102,6 @@ public class HelperPanel extends JPanel {
textAreaScrollPane.setMaximumSize(new Dimension(getParent().getWidth(), GUISizeHelper.gameFeedbackPanelMaxHeight)); textAreaScrollPane.setMaximumSize(new Dimension(getParent().getWidth(), GUISizeHelper.gameFeedbackPanelMaxHeight));
textAreaScrollPane.setPreferredSize(new Dimension(getParent().getWidth(), GUISizeHelper.gameFeedbackPanelMaxHeight)); textAreaScrollPane.setPreferredSize(new Dimension(getParent().getWidth(), GUISizeHelper.gameFeedbackPanelMaxHeight));
// dialogTextArea.setMaximumSize(new Dimension(getParent().getWidth(), Integer.MAX_VALUE));
// dialogTextArea.setPreferredSize(new Dimension(getParent().getWidth(), GUISizeHelper.gameDialogAreaTextHeight));
// buttonContainer.setPreferredSize(new Dimension(getParent().getWidth(), GUISizeHelper.gameDialogButtonHeight + 4));
// buttonContainer.setMinimumSize(new Dimension(160, GUISizeHelper.gameDialogButtonHeight + 20));
// buttonContainer.setMaximumSize(new Dimension(Integer.MAX_VALUE, GUISizeHelper.gameDialogButtonHeight + 4));
btnLeft.setFont(GUISizeHelper.gameFeedbackPanelFont); btnLeft.setFont(GUISizeHelper.gameFeedbackPanelFont);
btnRight.setFont(GUISizeHelper.gameFeedbackPanelFont); btnRight.setFont(GUISizeHelper.gameFeedbackPanelFont);
btnSpecial.setFont(GUISizeHelper.gameFeedbackPanelFont); btnSpecial.setFont(GUISizeHelper.gameFeedbackPanelFont);
@ -127,13 +120,13 @@ public class HelperPanel extends JPanel {
private void initComponents() { private void initComponents() {
initPopupMenuTriggerOrder(); initPopupMenuTriggerOrder();
this.setBorder(new EmptyBorder(5, 5, 5, 5)); this.setLayout(new BorderLayout());
this.setLayout(new GridLayout(0, 1));
this.setOpaque(false); this.setOpaque(false);
mainPanel = new JPanel(); mainPanel = new JPanel();
mainPanel.setLayout(new GridLayout(0, 1)); mainPanel.setLayout(new GridLayout(0, 1));
mainPanel.setOpaque(false); mainPanel.setOpaque(false);
this.add(mainPanel); this.add(mainPanel, BorderLayout.CENTER);
dialogTextArea = new MageTextArea(); dialogTextArea = new MageTextArea();
dialogTextArea.setText("<Empty>"); dialogTextArea.setText("<Empty>");
@ -419,6 +412,7 @@ public class HelperPanel extends JPanel {
int constGridSizeW = buttons.size() * constButtonSizeW + BUTTONS_H_GAP * (buttons.size() - 1); int constGridSizeW = buttons.size() * constButtonSizeW + BUTTONS_H_GAP * (buttons.size() - 1);
int constGridSizeH = Math.round(GUISizeHelper.gameFeedbackPanelButtonHeight * 150 / 100); int constGridSizeH = Math.round(GUISizeHelper.gameFeedbackPanelButtonHeight * 150 / 100);
// TODO: remove due gui scale and user customizable settings?
if (needButtonSizeW < constButtonSizeW) { if (needButtonSizeW < constButtonSizeW) {
// same size mode (grid) // same size mode (grid)
GridLayout gl = new GridLayout(1, buttons.size(), BUTTONS_H_GAP, 0); GridLayout gl = new GridLayout(1, buttons.size(), BUTTONS_H_GAP, 0);

View file

@ -58,7 +58,6 @@ public final class GUISizeHelper {
public static int gameFeedbackPanelButtonWidth; public static int gameFeedbackPanelButtonWidth;
public static Dimension handCardDimension; public static Dimension handCardDimension;
public static int stackWidth; // percent
public static float playerPanelGuiScale; public static float playerPanelGuiScale;
public static float dialogGuiScale; public static float dialogGuiScale;
@ -156,7 +155,6 @@ public final class GUISizeHelper {
// game - hand // game - hand
int handCardSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_CARD_HAND_SIZE, 14); int handCardSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_CARD_HAND_SIZE, 14);
handCardDimension = new Dimension(CARD_IMAGE_WIDTH * handCardSize / 42, CARD_IMAGE_HEIGHT * handCardSize / 42); handCardDimension = new Dimension(CARD_IMAGE_WIDTH * handCardSize / 42, CARD_IMAGE_HEIGHT * handCardSize / 42);
stackWidth = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_STACK_WIDTH, 30);
int otherZonesCardSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_CARD_OTHER_ZONES_SIZE, 14); int otherZonesCardSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_CARD_OTHER_ZONES_SIZE, 14);
otherZonesCardDimension = new Dimension(CARD_IMAGE_WIDTH * otherZonesCardSize / 42, CARD_IMAGE_HEIGHT * otherZonesCardSize / 42); otherZonesCardDimension = new Dimension(CARD_IMAGE_WIDTH * otherZonesCardSize / 42, CARD_IMAGE_HEIGHT * otherZonesCardSize / 42);

View file

@ -35,8 +35,9 @@ public class DebugUtil {
public static boolean GUI_GAME_DRAW_BATTLEFIELD_BORDER = false; public static boolean GUI_GAME_DRAW_BATTLEFIELD_BORDER = false;
public static boolean GUI_GAME_DRAW_HAND_AND_STACK_BORDER = false; public static boolean GUI_GAME_DRAW_HAND_AND_STACK_BORDER = false;
public static boolean GUI_GAME_DRAW_PLAYER_PANEL_BORDER = false; public static boolean GUI_GAME_DRAW_PLAYER_PANEL_BORDER = false;
public static boolean GUI_GAME_DRAW_COMMAND_BUTTONS_PANEL_BORDER = false; public static boolean GUI_GAME_DRAW_SKIP_BUTTONS_PANEL_BORDER = false;
public static boolean GUI_GAME_DRAW_PHASE_BUTTONS_PANEL_BORDER = false; public static boolean GUI_GAME_DRAW_PHASE_BUTTONS_PANEL_BORDER = false;
public static boolean GUI_GAME_DRAW_COMMANDS_PANEL_BORDER = false;
// game dialogs // game dialogs
public static boolean GUI_GAME_DIALOGS_DRAW_CARDS_AREA_BORDER = false; public static boolean GUI_GAME_DIALOGS_DRAW_CARDS_AREA_BORDER = false;