mirror of
https://github.com/correl/mage.git
synced 2024-11-14 19:19:32 +00:00
Some more changes to GUI to better support high screen resolutions.
This commit is contained in:
parent
e04c82a227
commit
51a0d8a4b2
3 changed files with 15 additions and 15 deletions
|
@ -26,7 +26,7 @@
|
|||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
/*
|
||||
/*
|
||||
* CardGrid.java
|
||||
*
|
||||
* Created on 30-Mar-2010, 9:25:40 PM
|
||||
|
@ -50,8 +50,8 @@ import java.util.UUID;
|
|||
import mage.cards.MageCard;
|
||||
import mage.client.deckeditor.SortSetting;
|
||||
import mage.client.plugins.impl.Plugins;
|
||||
import mage.client.util.Config;
|
||||
import mage.client.util.Event;
|
||||
import mage.client.util.GUISizeHelper;
|
||||
import mage.client.util.Listener;
|
||||
import mage.utils.CardUtil;
|
||||
import mage.view.CardView;
|
||||
|
@ -126,7 +126,7 @@ public class CardGrid extends javax.swing.JLayeredPane implements MouseListener,
|
|||
|
||||
private void addCard(CardView card, BigCard bigCard, UUID gameId, boolean drawImage) {
|
||||
if (cardDimension == null) {
|
||||
cardDimension = new Dimension(Config.dimensions.frameWidth, Config.dimensions.frameHeight);
|
||||
cardDimension = GUISizeHelper.editorCardDimension;
|
||||
}
|
||||
MageCard cardImg = Plugins.getInstance().getMageCard(card, bigCard, cardDimension, gameId, drawImage);
|
||||
cards.put(card.getId(), cardImg);
|
||||
|
@ -139,11 +139,12 @@ public class CardGrid extends javax.swing.JLayeredPane implements MouseListener,
|
|||
@Override
|
||||
public void drawCards(SortSetting sortSetting) {
|
||||
int maxWidth = this.getParent().getWidth();
|
||||
int numColumns = maxWidth / Config.dimensions.frameWidth;
|
||||
int cardVerticalOffset = GUISizeHelper.editorCardOffsetSize;
|
||||
int numColumns = maxWidth / cardDimension.width;
|
||||
int curColumn = 0;
|
||||
int curRow = 0;
|
||||
if (cards.size() > 0) {
|
||||
Rectangle rectangle = new Rectangle(Config.dimensions.frameWidth, Config.dimensions.frameHeight);
|
||||
Rectangle rectangle = new Rectangle(cardDimension.width, cardDimension.height);
|
||||
List<MageCard> sortedCards = new ArrayList<>(cards.values());
|
||||
switch (sortSetting.getSortBy()) {
|
||||
case NAME:
|
||||
|
@ -202,16 +203,16 @@ public class CardGrid extends javax.swing.JLayeredPane implements MouseListener,
|
|||
}
|
||||
break;
|
||||
}
|
||||
rectangle.setLocation(curColumn * Config.dimensions.frameWidth, curRow * 20);
|
||||
rectangle.setLocation(curColumn * cardDimension.width, curRow * cardVerticalOffset);
|
||||
cardImg.setBounds(rectangle);
|
||||
cardImg.setCardBounds(rectangle.x, rectangle.y, Config.dimensions.frameWidth, Config.dimensions.frameHeight);
|
||||
cardImg.setCardBounds(rectangle.x, rectangle.y, cardDimension.width, cardDimension.height);
|
||||
moveToFront(cardImg);
|
||||
curRow++;
|
||||
lastCard = cardImg;
|
||||
} else {
|
||||
rectangle.setLocation(curColumn * Config.dimensions.frameWidth, curRow * 20);
|
||||
rectangle.setLocation(curColumn * cardDimension.width, curRow * cardVerticalOffset);
|
||||
cardImg.setBounds(rectangle);
|
||||
cardImg.setCardBounds(rectangle.x, rectangle.y, Config.dimensions.frameWidth, Config.dimensions.frameHeight);
|
||||
cardImg.setCardBounds(rectangle.x, rectangle.y, cardDimension.width, cardDimension.height);
|
||||
moveToFront(cardImg);
|
||||
curColumn++;
|
||||
if (curColumn == numColumns) {
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<Dimension value="[30, 30]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
|
||||
<Connection code="(!Beans.isDesignTime())?
(new Dimension(Config.dimensions.frameWidth, Config.dimensions.frameHeight))
:(new Dimension(600, 600))" type="code"/>
|
||||
<Connection code="(!Beans.isDesignTime())?
(GUISizeHelper.editorCardDimension)
:(new Dimension(600, 600))" type="code"/>
|
||||
</Property>
|
||||
<Property name="requestFocusEnabled" type="boolean" value="false"/>
|
||||
</Properties>
|
||||
|
@ -261,7 +261,7 @@
|
|||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cbSortByActionPerformed"/>
|
||||
</Events>
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<SortBy>"/>
|
||||
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value=""/>
|
||||
</AuxValues>
|
||||
</Component>
|
||||
<Component class="javax.swing.JToggleButton" name="jToggleListView">
|
||||
|
|
|
@ -70,7 +70,6 @@ import mage.client.util.CardViewColorIdentityComparator;
|
|||
import mage.client.util.CardViewCostComparator;
|
||||
import mage.client.util.CardViewNameComparator;
|
||||
import mage.client.util.CardViewRarityComparator;
|
||||
import mage.client.util.Config;
|
||||
import mage.client.util.Event;
|
||||
import mage.client.util.GUISizeHelper;
|
||||
import mage.client.util.Listener;
|
||||
|
@ -486,7 +485,7 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar
|
|||
lblInstantCount = new javax.swing.JLabel();
|
||||
lblEnchantmentCount = new javax.swing.JLabel();
|
||||
chkPiles = new javax.swing.JCheckBox();
|
||||
cbSortBy = new javax.swing.JComboBox<SortBy>();
|
||||
cbSortBy = new javax.swing.JComboBox();
|
||||
jToggleListView = new javax.swing.JToggleButton();
|
||||
jToggleCardView = new javax.swing.JToggleButton();
|
||||
panelCardArea = new javax.swing.JScrollPane();
|
||||
|
@ -495,7 +494,7 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar
|
|||
setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
|
||||
setMinimumSize(new java.awt.Dimension(30, 30));
|
||||
setPreferredSize((!Beans.isDesignTime())?
|
||||
(new Dimension(Config.dimensions.frameWidth, Config.dimensions.frameHeight))
|
||||
(GUISizeHelper.editorCardDimension)
|
||||
:(new Dimension(600, 600)));
|
||||
setRequestFocusEnabled(false);
|
||||
|
||||
|
@ -717,7 +716,7 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar
|
|||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.ButtonGroup bgView;
|
||||
private javax.swing.JLayeredPane cardArea;
|
||||
private javax.swing.JComboBox<SortBy> cbSortBy;
|
||||
private javax.swing.JComboBox cbSortBy;
|
||||
private javax.swing.JCheckBox chkPiles;
|
||||
private javax.swing.JToggleButton jToggleCardView;
|
||||
private javax.swing.JToggleButton jToggleListView;
|
||||
|
|
Loading…
Reference in a new issue