From 80a47a61c8b49d75fde4b2717383c9a80be73d2c Mon Sep 17 00:00:00 2001 From: CrushedPixel Date: Wed, 8 Jul 2015 15:50:12 +0200 Subject: [PATCH] Made GuiDropdown a subclass of GuiAdvancedTextfield, updating the Constructor and removing the now redundant GuiConstants entries --- .../java/eu/crushedpixel/replaymod/gui/GuiConstants.java | 3 --- .../eu/crushedpixel/replaymod/gui/GuiRenderSettings.java | 3 +-- .../eu/crushedpixel/replaymod/gui/elements/GuiDropdown.java | 6 +++--- .../crushedpixel/replaymod/gui/online/GuiReplayCenter.java | 4 ++-- .../replaymod/gui/replayeditor/GuiConnectPart.java | 2 +- .../replaymod/gui/replayeditor/GuiReplayEditor.java | 2 +- 6 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/main/java/eu/crushedpixel/replaymod/gui/GuiConstants.java b/src/main/java/eu/crushedpixel/replaymod/gui/GuiConstants.java index e093ed4b..89f51017 100755 --- a/src/main/java/eu/crushedpixel/replaymod/gui/GuiConstants.java +++ b/src/main/java/eu/crushedpixel/replaymod/gui/GuiConstants.java @@ -17,8 +17,6 @@ public class GuiConstants { public static final int CENTER_SEARCH_ACTION_BUTTON = 2013; public static final int CENTER_SEARCH_GAMETYPE_TOGGLE = 2015; public static final int CENTER_SEARCH_ORDER_TOGGLE = 2016; - public static final int CENTER_SEARCH_CATEGORY_DROPDOWN = 2017; - public static final int CENTER_SEARCH_VERSION_DROPDOWN = 2018; public static final int UPLOAD_START_BUTTON = 3003; public static final int UPLOAD_CANCEL_BUTTON = 3004; @@ -74,7 +72,6 @@ public class GuiConstants { public static final int PLAYER_OVERVIEW_SHOW_ALL = 101; public static final int PLAYER_OVERVIEW_REMEMBER = -10; - public static final int RENDER_SETTINGS_RENDERER_DROPDOWN = 9001; public static final int RENDER_SETTINGS_RENDER_BUTTON = 9002; public static final int RENDER_SETTINGS_CANCEL_BUTTON = 9003; public static final int RENDER_SETTINGS_RESOLUTION_CHECKBOX = 9004; diff --git a/src/main/java/eu/crushedpixel/replaymod/gui/GuiRenderSettings.java b/src/main/java/eu/crushedpixel/replaymod/gui/GuiRenderSettings.java index ecad1d3f..6758c25c 100644 --- a/src/main/java/eu/crushedpixel/replaymod/gui/GuiRenderSettings.java +++ b/src/main/java/eu/crushedpixel/replaymod/gui/GuiRenderSettings.java @@ -54,8 +54,7 @@ public class GuiRenderSettings extends GuiScreen { if(!initialized) { Keyboard.enableRepeatEvents(true); - rendererDropdown = new GuiDropdown(GuiConstants.RENDER_SETTINGS_RENDERER_DROPDOWN, - fontRendererObj, 0, 0, 200, 5); + rendererDropdown = new GuiDropdown(fontRendererObj, 0, 0, 200, 5); rendererDropdown.addSelectionListener(new RendererDropdownListener()); int i = 0; diff --git a/src/main/java/eu/crushedpixel/replaymod/gui/elements/GuiDropdown.java b/src/main/java/eu/crushedpixel/replaymod/gui/elements/GuiDropdown.java index 5e3df233..46d33cff 100755 --- a/src/main/java/eu/crushedpixel/replaymod/gui/elements/GuiDropdown.java +++ b/src/main/java/eu/crushedpixel/replaymod/gui/elements/GuiDropdown.java @@ -14,7 +14,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; -public class GuiDropdown extends GuiTextField { +public class GuiDropdown extends GuiAdvancedTextField { private final int visibleDropout; private final int dropoutElementHeight = 14; @@ -28,9 +28,9 @@ public class GuiDropdown extends GuiTextField { private List elements = new ArrayList(); private HashMap hoverTexts = new HashMap(); - public GuiDropdown(int id, FontRenderer fontRenderer, + public GuiDropdown(FontRenderer fontRenderer, int xPos, int yPos, int width, int visibleDropout) { - super(id, fontRenderer, xPos, yPos, width, 20); + super(fontRenderer, xPos, yPos, width, 20); this.visibleDropout = visibleDropout; this.maxDropoutHeight = dropoutElementHeight * visibleDropout; } diff --git a/src/main/java/eu/crushedpixel/replaymod/gui/online/GuiReplayCenter.java b/src/main/java/eu/crushedpixel/replaymod/gui/online/GuiReplayCenter.java index 7313f340..e3939bec 100755 --- a/src/main/java/eu/crushedpixel/replaymod/gui/online/GuiReplayCenter.java +++ b/src/main/java/eu/crushedpixel/replaymod/gui/online/GuiReplayCenter.java @@ -116,8 +116,8 @@ public class GuiReplayCenter extends GuiScreen implements GuiYesNoCallback { new String[]{I18n.format("options.particles.all"), I18n.format("menu.singleplayer"), I18n.format("menu.multiplayer")}); searchSortToggle = new GuiToggleButton(GuiConstants.CENTER_SEARCH_ORDER_TOGGLE, 0, 0, I18n.format("replaymod.gui.center.search.order")+": ", new String[]{I18n.format("replaymod.gui.center.search.order.best"), I18n.format("replaymod.gui.center.search.order.recent")}); - searchCategoryDropdown = new GuiDropdown(GuiConstants.CENTER_SEARCH_CATEGORY_DROPDOWN, fontRendererObj, 0, 0, 0, Category.values().length+1); - searchVersionDropdown = new GuiDropdown(GuiConstants.CENTER_SEARCH_VERSION_DROPDOWN, fontRendererObj, 0, 0, 0, 5); + searchCategoryDropdown = new GuiDropdown(fontRendererObj, 0, 0, 0, Category.values().length+1); + searchVersionDropdown = new GuiDropdown(fontRendererObj, 0, 0, 0, 5); searchNameInput = new GuiAdvancedTextField(fontRendererObj, 0, 0, 50, 20); searchServerInput = new GuiAdvancedTextField(fontRendererObj, 0, 0, 50, 20); diff --git a/src/main/java/eu/crushedpixel/replaymod/gui/replayeditor/GuiConnectPart.java b/src/main/java/eu/crushedpixel/replaymod/gui/replayeditor/GuiConnectPart.java index ce98b7ef..acbfff74 100755 --- a/src/main/java/eu/crushedpixel/replaymod/gui/replayeditor/GuiConnectPart.java +++ b/src/main/java/eu/crushedpixel/replaymod/gui/replayeditor/GuiConnectPart.java @@ -103,7 +103,7 @@ public class GuiConnectPart extends GuiStudioPart { concatList.setSelectionIndex(0); - replayDropdown = new GuiDropdown(1, fontRendererObj, 250, yPos + 5, 0, 4); + replayDropdown = new GuiDropdown(fontRendererObj, 250, yPos + 5, 0, 4); replayDropdown.clearElements(); replayFiles = ReplayFileIO.getAllReplayFiles(); diff --git a/src/main/java/eu/crushedpixel/replaymod/gui/replayeditor/GuiReplayEditor.java b/src/main/java/eu/crushedpixel/replaymod/gui/replayeditor/GuiReplayEditor.java index 17657554..6aca5f1c 100755 --- a/src/main/java/eu/crushedpixel/replaymod/gui/replayeditor/GuiReplayEditor.java +++ b/src/main/java/eu/crushedpixel/replaymod/gui/replayeditor/GuiReplayEditor.java @@ -81,7 +81,7 @@ public class GuiReplayEditor extends GuiScreen { int modeWidth = tabButtons.get(0).width; if(!initialized) { - replayDropdown = new GuiDropdown(1, fontRendererObj, 15 + 2 + 1 + 80, 60, this.width - 30 - 8 - 80 - modeWidth - 4, 5); + replayDropdown = new GuiDropdown(fontRendererObj, 15 + 2 + 1 + 80, 60, this.width - 30 - 8 - 80 - modeWidth - 4, 5); refreshReplayDropdown(); } else { replayDropdown.width = this.width - 30 - 8 - 80 - modeWidth - 4;