mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38:01 +00:00
Reset layout buttons
This commit is contained in:
@@ -20,7 +20,6 @@ package forge.card.mana;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
|
||||
@@ -54,8 +54,8 @@ public final class SLayoutIO {
|
||||
* Gets preferred layout file corresponding to current state of UI.
|
||||
* @return {@link java.lang.String}
|
||||
*/
|
||||
public static String getFilePreferred() {
|
||||
return SLayoutIO.getFileForState(Singletons.getControl().getState()).userPrefLoc;
|
||||
public static String getFilePreferred(Screens mode) {
|
||||
return SLayoutIO.getFileForState(mode).userPrefLoc;
|
||||
}
|
||||
|
||||
/** Publicly-accessible save method, to neatly handle exception handling.
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.awt.event.ItemEvent;
|
||||
import java.awt.event.ItemListener;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.io.File;
|
||||
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.SwingUtilities;
|
||||
@@ -14,9 +15,11 @@ import org.apache.commons.lang3.tuple.Pair;
|
||||
import forge.Command;
|
||||
import forge.Constant.Preferences;
|
||||
import forge.Singletons;
|
||||
import forge.control.FControl.Screens;
|
||||
import forge.control.RestartUtil;
|
||||
import forge.game.ai.AiProfileUtil;
|
||||
import forge.gui.framework.ICDoc;
|
||||
import forge.gui.framework.SLayoutIO;
|
||||
import forge.gui.toolbox.FSkin;
|
||||
import forge.properties.ForgePreferences;
|
||||
import forge.properties.ForgePreferences.FPref;
|
||||
@@ -107,6 +110,24 @@ public enum CSubmenuPreferences implements ICDoc {
|
||||
update();
|
||||
}
|
||||
});
|
||||
|
||||
view.getBtnDeleteEditorUI().setCommand(new Command() {
|
||||
@Override
|
||||
public void run() {
|
||||
String fd = SLayoutIO.getFilePreferred(Screens.DECK_EDITOR_CONSTRUCTED);
|
||||
File f = new File(fd);
|
||||
f.delete();
|
||||
}
|
||||
});
|
||||
|
||||
view.getBtnDeleteMatchUI().setCommand(new Command() {
|
||||
@Override
|
||||
public void run() {
|
||||
String fd = SLayoutIO.getFilePreferred(Screens.MATCH_SCREEN);
|
||||
File f = new File(fd);
|
||||
f.delete();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
||||
@@ -60,8 +60,10 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
|
||||
private final FScrollPane scrContent = new FScrollPane(pnlPrefs,
|
||||
ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
|
||||
|
||||
private final FLabel btnReset = new FLabel.Builder().opaque(true)
|
||||
.hoverable(true).text("Reset to defaults").build();
|
||||
private final FLabel btnReset = new FLabel.Builder().opaque(true).hoverable(true).text("Reset to defaults").build();
|
||||
|
||||
private final FLabel btnDeleteMatchUI = new FLabel.Builder().opaque(true).hoverable(true).text("Reset Match Layout").build();
|
||||
private final FLabel btnDeleteEditorUI = new FLabel.Builder().opaque(true).hoverable(true).text("Reset Editor Layout").build();
|
||||
|
||||
private final FLabel lblTitleSkin = new FLabel.Builder()
|
||||
.text("Choose Skin").fontStyle(Font.BOLD).fontSize(14).build();
|
||||
@@ -148,6 +150,12 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
|
||||
pnlPrefs.add(cbCloneImgSource, regularConstraints);
|
||||
pnlPrefs.add(new NoteLabel("When enabled clones will use their original art instead of the cloned card's art"), regularConstraints);
|
||||
|
||||
// Troubleshooting
|
||||
pnlPrefs.add(new SectionLabel("Troubleshooting"), sectionConstraints);
|
||||
final String twoButtonConstraints = "w 38%!, h 30px!, gap 10% 0 0 10px";
|
||||
pnlPrefs.add(btnDeleteMatchUI, twoButtonConstraints);
|
||||
pnlPrefs.add(btnDeleteEditorUI, "w 38%!, h 30px!, gap 0 0 0 10px");
|
||||
|
||||
// AI Personality Profile Options
|
||||
pnlPrefs.add(new SectionLabel("AI Options"), sectionConstraints);
|
||||
|
||||
@@ -488,6 +496,14 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
|
||||
|
||||
//========== Overridden from IVDoc
|
||||
|
||||
public final FLabel getBtnDeleteMatchUI() {
|
||||
return btnDeleteMatchUI;
|
||||
}
|
||||
|
||||
public final FLabel getBtnDeleteEditorUI() {
|
||||
return btnDeleteEditorUI;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see forge.gui.framework.IVDoc#getDocumentID()
|
||||
*/
|
||||
|
||||
@@ -108,7 +108,7 @@ public enum CDock implements ICDoc {
|
||||
|
||||
private void saveLayout() {
|
||||
final SaveOpenDialog dlgSave = new SaveOpenDialog();
|
||||
final File defFile = new File(SLayoutIO.getFilePreferred());
|
||||
final File defFile = new File(SLayoutIO.getFilePreferred(Singletons.getControl().getState()));
|
||||
final File saveFile = dlgSave.SaveDialog(defFile, Filetypes.LAYOUT);
|
||||
if (saveFile != null) {
|
||||
SLayoutIO.saveLayout(saveFile);
|
||||
@@ -119,7 +119,7 @@ public enum CDock implements ICDoc {
|
||||
SOverlayUtils.genericOverlay();
|
||||
|
||||
final SaveOpenDialog dlgOpen = new SaveOpenDialog();
|
||||
final File defFile = new File(SLayoutIO.getFilePreferred());
|
||||
final File defFile = new File(SLayoutIO.getFilePreferred(Singletons.getControl().getState()));
|
||||
final File loadFile = dlgOpen.OpenDialog(defFile, Filetypes.LAYOUT);
|
||||
|
||||
FView.SINGLETON_INSTANCE.getPnlContent().removeAll();
|
||||
|
||||
Reference in New Issue
Block a user