diff --git a/.gitignore b/.gitignore index ca22c64f648..a98234f7405 100644 --- a/.gitignore +++ b/.gitignore @@ -293,6 +293,7 @@ res/pics/ALA res/pics/ALL res/pics/APC res/pics/ARB +res/pics/ARC res/pics/ARN res/pics/ATQ res/pics/AVR @@ -312,6 +313,7 @@ res/pics/FEM res/pics/FUT res/pics/GPT res/pics/HML +res/pics/HOP res/pics/ICE res/pics/INV res/pics/ISD diff --git a/res/preferences/editor.preferences b/res/preferences/editor.preferences index 79190616ccb..5a0c1fdeb64 100644 --- a/res/preferences/editor.preferences +++ b/res/preferences/editor.preferences @@ -1,33 +1,34 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/forge/gui/deckeditor/CDeckEditorUI.java b/src/main/java/forge/gui/deckeditor/CDeckEditorUI.java index d414d108c6d..c3975eb9e2e 100644 --- a/src/main/java/forge/gui/deckeditor/CDeckEditorUI.java +++ b/src/main/java/forge/gui/deckeditor/CDeckEditorUI.java @@ -24,6 +24,7 @@ import java.awt.event.MouseEvent; import forge.Card; import forge.gui.CardContainer; +import forge.gui.deckeditor.SEditorIO.EditorPreference; import forge.gui.deckeditor.controllers.ACEditorBase; import forge.gui.deckeditor.views.VFilters; import forge.gui.match.controllers.CDetail; @@ -84,6 +85,14 @@ public enum CDeckEditorUI implements CardContainer { public void setCurrentEditorController(ACEditorBase editor0) { this.childController = editor0; updateController(); + if (childController != null) { + boolean wantElastic = SEditorIO.getPref(EditorPreference.elastic_columns); + boolean wantUnique = SEditorIO.getPref(EditorPreference.display_unique_only); + childController.getTableCatalog().setWantElasticColumns(wantElastic); + childController.getTableDeck().setWantElasticColumns(wantElastic); + childController.getTableCatalog().setWantUnique(wantUnique); + childController.getTableDeck().setWantUnique(wantUnique); + } VFilters.SINGLETON_INSTANCE.getLayoutControl().buildFilter(); } diff --git a/src/main/java/forge/gui/deckeditor/SEditorIO.java b/src/main/java/forge/gui/deckeditor/SEditorIO.java index 24a70c7a0e1..1ffef3df1ee 100644 --- a/src/main/java/forge/gui/deckeditor/SEditorIO.java +++ b/src/main/java/forge/gui/deckeditor/SEditorIO.java @@ -50,7 +50,8 @@ public class SEditorIO { public enum EditorPreference { /** */ stats_deck, /** */ stats_catalog, - display_unique_only + display_unique_only, + elastic_columns } private static final XMLEventFactory EVENT_FACTORY = XMLEventFactory.newInstance(); diff --git a/src/main/java/forge/gui/deckeditor/controllers/CEditorPreferences.java b/src/main/java/forge/gui/deckeditor/controllers/CEditorPreferences.java index 6cf34be6bfd..23db62b0427 100644 --- a/src/main/java/forge/gui/deckeditor/controllers/CEditorPreferences.java +++ b/src/main/java/forge/gui/deckeditor/controllers/CEditorPreferences.java @@ -88,6 +88,8 @@ public enum CEditorPreferences implements ICDoc { SEditorIO.getPref(EditorPreference.stats_deck)); VEditorPreferences.SINGLETON_INSTANCE.getChbCardDisplayUnique().setSelected( SEditorIO.getPref(EditorPreference.display_unique_only)); + VEditorPreferences.SINGLETON_INSTANCE.getChbElasticColumns().setSelected( + SEditorIO.getPref(EditorPreference.elastic_columns)); if (!SEditorIO.getPref(EditorPreference.stats_deck)) { VCurrentDeck.SINGLETON_INSTANCE.getPnlStats().setVisible(false); @@ -96,9 +98,12 @@ public enum CEditorPreferences implements ICDoc { VCardCatalog.SINGLETON_INSTANCE.getPnlStats().setVisible(false); } + boolean wantElastic = SEditorIO.getPref(EditorPreference.elastic_columns); boolean wantUnique = SEditorIO.getPref(EditorPreference.display_unique_only); ACEditorBase curEditor = CDeckEditorUI.SINGLETON_INSTANCE.getCurrentEditorController(); if (curEditor != null) { + curEditor.getTableCatalog().setWantElasticColumns(wantElastic); + curEditor.getTableDeck().setWantElasticColumns(wantElastic); curEditor.getTableCatalog().setWantUnique(wantUnique); curEditor.getTableCatalog().updateView(true); curEditor.getTableDeck().setWantUnique(wantUnique); @@ -119,6 +124,17 @@ public enum CEditorPreferences implements ICDoc { SEditorIO.setPref(EditorPreference.stats_deck, ((JCheckBox) e.getSource()).isSelected()); SEditorIO.savePreferences(); } }); + VEditorPreferences.SINGLETON_INSTANCE.getChbElasticColumns().addItemListener(new ItemListener() { + @Override public void itemStateChanged(final ItemEvent e) { + ACEditorBase curEditor = CDeckEditorUI.SINGLETON_INSTANCE.getCurrentEditorController(); + boolean wantElastic = ((JCheckBox) e.getSource()).isSelected(); + if (curEditor != null) { + curEditor.getTableCatalog().setWantElasticColumns(wantElastic); + curEditor.getTableDeck().setWantElasticColumns(wantElastic); + } + SEditorIO.setPref(EditorPreference.elastic_columns, wantElastic); + SEditorIO.savePreferences(); } }); + VEditorPreferences.SINGLETON_INSTANCE.getChbCardDisplayUnique().addItemListener(new ItemListener() { @Override public void itemStateChanged(final ItemEvent e) { ACEditorBase curEditor = CDeckEditorUI.SINGLETON_INSTANCE.getCurrentEditorController(); diff --git a/src/main/java/forge/gui/deckeditor/tables/EditorTableView.java b/src/main/java/forge/gui/deckeditor/tables/EditorTableView.java index 7d32eea4708..efaeb633f4b 100644 --- a/src/main/java/forge/gui/deckeditor/tables/EditorTableView.java +++ b/src/main/java/forge/gui/deckeditor/tables/EditorTableView.java @@ -430,4 +430,7 @@ public final class EditorTableView { this.alwaysNonUnique = nonUniqueOnly; } + public void setWantElasticColumns(boolean value) { + table.setAutoResizeMode(value ? JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS : JTable.AUTO_RESIZE_NEXT_COLUMN); + } } diff --git a/src/main/java/forge/gui/deckeditor/views/VEditorPreferences.java b/src/main/java/forge/gui/deckeditor/views/VEditorPreferences.java index e92aea7af2f..a983cd7d8a6 100644 --- a/src/main/java/forge/gui/deckeditor/views/VEditorPreferences.java +++ b/src/main/java/forge/gui/deckeditor/views/VEditorPreferences.java @@ -30,7 +30,7 @@ public enum VEditorPreferences implements IVDoc { private final DragTab tab = new DragTab("Preferences"); private JLabel lblStats = new FLabel.Builder() - .text("Stat Bars").tooltip("Toggle statistics bars") + .text("General").tooltip("Configure high-level UI components") .fontSize(12).build(); private JLabel lblCatalog = new FLabel.Builder() @@ -63,6 +63,7 @@ public enum VEditorPreferences implements IVDoc { private JCheckBox chbDeckStats = new FCheckBox("Show stats in current deck"); private JCheckBox chbCatalogStats = new FCheckBox("Show stats in card catalog"); + private JCheckBox chbElasticColumns = new FCheckBox("Use elastic resizing when changing column widths"); private JCheckBox chbCardDisplayUnique = new FCheckBox("Show unique cards only (only affects Constructed)"); @@ -94,8 +95,10 @@ public enum VEditorPreferences implements IVDoc { chbDeckStats.setFont(FSkin.getFont(12)); chbCatalogStats.setFont(FSkin.getFont(12)); + chbElasticColumns.setFont(FSkin.getFont(12)); chbDeckStats.setSelected(true); chbCatalogStats.setSelected(true); + chbElasticColumns.setSelected(false); chbCardDisplayUnique.setFont(FSkin.getFont(12)); chbCardDisplayUnique.setSelected(false); @@ -103,6 +106,7 @@ public enum VEditorPreferences implements IVDoc { pnl.add(lblStats, "h 25px!, gap 5px 5px 5px 5px, ax center, span 2 1"); pnl.add(chbCatalogStats, "h 25px!, gap 5px 5px 5px 5px, ax center, span 2 1"); pnl.add(chbDeckStats, "h 25px!, gap 5px 5px 5px 5px, ax center, span 2 1"); + pnl.add(chbElasticColumns, "h 25px!, gap 5px 5px 5px 5px, ax center, span 2 1"); final String constraints = "w 75px, h 25px!, gap 5px 5px 5px 5px, ax center"; pnl.add(lblCatalog, constraints + ", span 2 1"); @@ -260,6 +264,11 @@ public enum VEditorPreferences implements IVDoc { return chbDeckStats; } + /** @return {@link javax.swing.JCheckBox} */ + public JCheckBox getChbElasticColumns() { + return chbElasticColumns; + } + /** @return {@link javax.swing.JCheckBox} */ public JCheckBox getChbCatalogStats() { return chbCatalogStats; diff --git a/src/main/java/forge/gui/home/quest/QuestPreferencesHandler.java b/src/main/java/forge/gui/home/quest/QuestPreferencesHandler.java index d8f77badbe3..91e4c428457 100644 --- a/src/main/java/forge/gui/home/quest/QuestPreferencesHandler.java +++ b/src/main/java/forge/gui/home/quest/QuestPreferencesHandler.java @@ -104,7 +104,7 @@ public class QuestPreferencesHandler extends JPanel { pnlDifficulty.setOpaque(false); pnlDifficulty.setLayout(new MigLayout("insets 0, gap 0, wrap 5")); - pnlDifficulty.add(new FLabel.Builder().text("Difficulty Adjustments").icon(new ImageIcon("res/images/icons/NotesIcon.png")), "w 100%!, h 30px!, span 5 1"); + pnlDifficulty.add(new FLabel.Builder().text("Difficulty Adjustments").icon(new ImageIcon("res/images/icons/NotesIcon.png")).build(), "w 100%!, h 30px!, span 5 1"); pnlDifficulty.add(lblErrDifficulty, "w 100%!, h 30px!, span 5 1"); constraints1 = "w 60px!, h 26px!";