mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38:00 +00:00
"Pretty names" for skin names in settings submenu.
This commit is contained in:
@@ -40,6 +40,8 @@ public class ControlSettings {
|
||||
*/
|
||||
public ControlSettings(ViewSettings v0) {
|
||||
this.view = v0;
|
||||
view.updateSkinNames();
|
||||
|
||||
addListeners();
|
||||
prefs = Singletons.getModel().getPreferences();
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ import javax.swing.border.MatteBorder;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.text.WordUtils;
|
||||
|
||||
import forge.PlayerType;
|
||||
import forge.Singletons;
|
||||
@@ -130,6 +131,20 @@ public class ViewSettings extends JPanel {
|
||||
showPrefsTab();
|
||||
}
|
||||
|
||||
/** */
|
||||
public void updateSkinNames() {
|
||||
String[] uglyNames = FSkin.getSkins().toArray(new String[0]);
|
||||
String[] prettyNames = new String[uglyNames.length];
|
||||
|
||||
for (int i = 0; i < uglyNames.length; i++) {
|
||||
prettyNames[i] = WordUtils.capitalize(uglyNames[i].replace('_', ' '));
|
||||
}
|
||||
|
||||
lstChooseSkin.setListData(prettyNames);
|
||||
lstChooseSkin.setSelectedValue(Singletons.getModel().getPreferences().getPref(FPref.UI_SKIN), true);
|
||||
lstChooseSkin.ensureIndexIsVisible(lstChooseSkin.getSelectedIndex());
|
||||
}
|
||||
|
||||
private void populateTabber() {
|
||||
tabPrefs.setToolTipText("Global preference options");
|
||||
tabAvatars.setToolTipText("Human and AI avatar select");
|
||||
@@ -181,10 +196,7 @@ public class ViewSettings extends JPanel {
|
||||
|
||||
pnlPrefs.add(lblTitleSkin, regularConstraints);
|
||||
pnlPrefs.add(new NoteLabel("Various user-created themes for Forge backgrounds, fonts, and colors."), regularConstraints);
|
||||
pnlPrefs.add(new FScrollPane(lstChooseSkin), "h 60px!, w 150px!, gap 10% 0 0 2%, wrap");
|
||||
lstChooseSkin.setListData(FSkin.getSkins().toArray(new String[0]));
|
||||
lstChooseSkin.setSelectedValue(Singletons.getModel().getPreferences().getPref(FPref.UI_SKIN), true);
|
||||
lstChooseSkin.ensureIndexIsVisible(lstChooseSkin.getSelectedIndex());
|
||||
pnlPrefs.add(new FScrollPane(lstChooseSkin), "h 120px!, w 150px!, gap 10% 0 0 2%, wrap");
|
||||
|
||||
pnlPrefs.add(new FLabel.Builder().text("Card Size").fontStyle(Font.BOLD).build(), regularConstraints);
|
||||
pnlPrefs.add(new NoteLabel("Size of cards in hand and playing field, when possible"), regularConstraints);
|
||||
|
||||
@@ -353,7 +353,7 @@ public enum FSkin {
|
||||
GuiUtils.checkEDT("FSkin$constructor", false);
|
||||
|
||||
// Non-default (preferred) skin name and dir.
|
||||
FSkin.preferredName = skinName;
|
||||
FSkin.preferredName = skinName.toLowerCase().replace(' ', '_');
|
||||
FSkin.preferredDir = FILE_SKINS_DIR + preferredName + "/";
|
||||
|
||||
if (FSkin.icons != null) { FSkin.icons.clear(); }
|
||||
@@ -763,6 +763,8 @@ public enum FSkin {
|
||||
h0 = tempCoords[3];
|
||||
|
||||
BufferedImage img = testPreferredSprite(s0);
|
||||
|
||||
if (s0 == Backgrounds.BG_TEXTURE) { System.out.println("asdf found it"); }
|
||||
FSkin.icons.put(s0, new ImageIcon(img.getSubimage(x0, y0, w0, h0)));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user