mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-11-11 15:57:55 +00:00
fix changing size of the interface terminal switching to a different GUI entirely (#242)
This commit is contained in:
1 parent
8a37e085c1
commit
adc2a1f2fd
4 files changed
+25
-19
No files matched your search
@@ -321,7 +321,7 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
|
||||
|
||||
if (btn == this.terminalStyleBox) {
|
||||
AEConfig.instance.settings.putSetting(iBtn.getSetting(), next);
|
||||
initGui();
|
||||
super.scheduleGuiResize();
|
||||
} else if (btn == searchStringSave) {
|
||||
AEConfig.instance.preserveSearchBar = next == YesNo.YES;
|
||||
}
|
||||
|
||||
@@ -348,8 +348,7 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
|
||||
if (btn == terminalStyleBox) {
|
||||
AEConfig.instance.settings.putSetting(iBtn.getSetting(), next);
|
||||
|
||||
reinitialize();
|
||||
super.scheduleGuiResize();
|
||||
}
|
||||
|
||||
iBtn.set(next);
|
||||
@@ -358,11 +357,6 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
super.actionPerformed(btn);
|
||||
}
|
||||
|
||||
private void reinitialize() {
|
||||
buttonList.clear();
|
||||
initGui();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||
mc.getTextureManager().bindTexture(TEX_BG);
|
||||
|
||||
@@ -137,6 +137,28 @@ public abstract class FCBaseMEGui extends AEBaseMEGui {
|
||||
this.buttonList.addAll(termBtns);
|
||||
}
|
||||
|
||||
private boolean scheduleGuiResize;
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int xCoord, int yCoord, int btn) {
|
||||
super.mouseClicked(xCoord, yCoord, btn);
|
||||
if (scheduleGuiResize) {
|
||||
// in the GuiScreen class, the implementation of super.mouseClicked
|
||||
// ends up looping on the button list and execute the action for any
|
||||
// button below the mouse.
|
||||
// Therefore, if we initGui() the terminal in the actionPerformed method below
|
||||
// it will run the actionPerformed a second time for the new button
|
||||
// that will end up being below the mouse (if any) after the initGui()
|
||||
buttonList.clear();
|
||||
initGui();
|
||||
scheduleGuiResize = false;
|
||||
}
|
||||
}
|
||||
|
||||
protected final void scheduleGuiResize() {
|
||||
scheduleGuiResize = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(final GuiButton btn) {
|
||||
if (btn instanceof GuiFCImgButton) {
|
||||
|
||||
@@ -103,7 +103,6 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
|
||||
protected GuiImgButton searchStringSave;
|
||||
protected GuiImgButton typeFilter;
|
||||
protected boolean hasShiftKeyDown = false;
|
||||
private boolean reInitializationRequested = false;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public FCGuiMonitor(final InventoryPlayer inventoryPlayer, final ITerminalHost te, final FCContainerMonitor<T> c) {
|
||||
@@ -163,17 +162,13 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
|
||||
iBtn.set(next);
|
||||
if (next.getClass() == SearchBoxMode.class || next.getClass() == TerminalStyle.class) {
|
||||
memoryText = this.searchField.getText();
|
||||
this.reInitalize();
|
||||
super.scheduleGuiResize();
|
||||
}
|
||||
}
|
||||
}
|
||||
super.actionPerformed(btn);
|
||||
}
|
||||
|
||||
protected void reInitalize() {
|
||||
reInitializationRequested = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void initGui() {
|
||||
@@ -670,11 +665,6 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
|
||||
|
||||
@Override
|
||||
public void updateScreen() {
|
||||
if (reInitializationRequested) {
|
||||
reInitializationRequested = false;
|
||||
this.buttonList.clear();
|
||||
this.initGui();
|
||||
}
|
||||
this.repo.setPowered(this.monitorableContainer.isPowered());
|
||||
super.updateScreen();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user