Fixed resizing game window/gui initi'ing newly creating the text editor

This commit is contained in:
bigguy345 committed 2025-12-20 00:31:30 +02:00
1 parent 78fc2bd3fd
commit 1702252629
6 files changed
+137 -108

No files matched your search

@@ -48,6 +48,9 @@ public class GuiScriptEffect extends GuiNPCInterface implements GuiYesNoCallback
private final EffectScript scriptHandler;
boolean loaded = false;
private GuiScriptTextArea textArea;
public GuiScriptEffect(GuiNPCManageEffects parent, CustomEffect effect) {
this.drawDefaultBackground = true;
this.closeOnEsc = true;
@@ -109,10 +112,13 @@ public class GuiScriptEffect extends GuiNPCInterface implements GuiYesNoCallback
hookLabel.color = 11184810;
this.addLabel(hookLabel);
ScriptContainer container = this.scriptHandler.container;
GuiScriptTextArea ta = new GuiScriptTextArea(this, 2, this.guiLeft + 1 + yoffset, this.guiTop + yoffset, this.xSize - 108 - yoffset, (int) ((double) this.ySize * 0.96) - yoffset * 2, container == null ? "" : container.script);
ta.enableCodeHighlighting();
ta.setListener(this);
this.addTextField(ta);
if (textArea == null)
textArea = new GuiScriptTextArea(this, 2, this.guiLeft + 1 + yoffset, this.guiTop + yoffset, this.xSize - 108 - yoffset, (int) ((double) this.ySize * 0.96) - yoffset * 2, container == null ? "" : container.script);
else
textArea.init(this.guiLeft + 1 + yoffset, this.guiTop + yoffset, this.xSize - 108 - yoffset, (int) ((double) this.ySize * 0.96) - yoffset * 2, container == null ? "" : container.script);
textArea.enableCodeHighlighting();
textArea.setListener(this);
this.addTextField(textArea);
int left1 = this.guiLeft + this.xSize - 104;
this.addButton(new GuiNpcButton(102, left1, this.guiTop + yoffset, 60, 20, "gui.clear"));
this.addButton(new GuiNpcButton(101, left1 + 61, this.guiTop + yoffset, 60, 20, "gui.paste"));
@@ -44,6 +44,7 @@ public class GuiScriptInterface extends GuiNPCInterface implements GuiYesNoCallb
public List<String> hookList = new ArrayList<String>();
protected boolean loaded = false;
private GuiScriptTextArea textArea;
public GuiScriptInterface() {
this.drawDefaultBackground = true;
this.closeOnEsc = true;
@@ -108,11 +109,18 @@ public class GuiScriptInterface extends GuiNPCInterface implements GuiYesNoCallb
addLabel(hookLabel);
ScriptContainer container = (ScriptContainer) this.handler.getScripts().get(this.activeTab - 1);
GuiScriptTextArea ta = new GuiScriptTextArea(this, 2, guiLeft + 1 + yoffset, guiTop + yoffset, xSize - 108 - yoffset, (int) (ySize * 0.96) - yoffset * 2, container == null ? "" : container.script);
ta.enableCodeHighlighting();
ta.setListener(this);
if (textArea == null)
textArea = new GuiScriptTextArea(this, 2, guiLeft + 1 + yoffset, guiTop + yoffset,
xSize - 108 - yoffset, (int) (ySize * 0.96) - yoffset * 2,
container == null ? "" : container.script);
else
textArea.init(guiLeft + 1 + yoffset, guiTop + yoffset, xSize - 108 - yoffset,
(int) (ySize * 0.96) - yoffset * 2, container == null ? "" : container.script);
this.addTextField(ta);
textArea.enableCodeHighlighting();
textArea.setListener(this);
this.addTextField(textArea);
int left1 = this.guiLeft + this.xSize - 104;
this.addButton(new GuiNpcButton(102, left1, this.guiTop + yoffset, 60, 20, "gui.clear"));
@@ -49,6 +49,8 @@ public class GuiScriptLinkedItem extends GuiNPCInterface implements GuiYesNoCall
private final LinkedItemScript scriptHandler;
boolean loaded = false;
private GuiScriptTextArea textArea;
public GuiScriptLinkedItem(GuiNPCManageLinked parent, LinkedItem linkedItem) {
this.drawDefaultBackground = true;
this.closeOnEsc = true;
@@ -121,10 +123,13 @@ public class GuiScriptLinkedItem extends GuiNPCInterface implements GuiYesNoCall
hookLabel.color = 11184810;
this.addLabel(hookLabel);
ScriptContainer container = this.scriptHandler.container;
GuiScriptTextArea ta = new GuiScriptTextArea(this, 2, this.guiLeft + 1 + yoffset, this.guiTop + yoffset, this.xSize - 108 - yoffset, (int) ((double) this.ySize * 0.96) - yoffset * 2, container == null ? "" : container.script);
ta.enableCodeHighlighting();
ta.setListener(this);
this.addTextField(ta);
if (textArea == null)
textArea = new GuiScriptTextArea(this, 2, this.guiLeft + 1 + yoffset, this.guiTop + yoffset, this.xSize - 108 - yoffset, (int) ((double) this.ySize * 0.96) - yoffset * 2, container == null ? "" : container.script);
else
textArea.init(this.guiLeft + 1 + yoffset, this.guiTop + yoffset, this.xSize - 108 - yoffset, (int) ((double) this.ySize * 0.96) - yoffset * 2, container == null ? "" : container.script);
textArea.enableCodeHighlighting();
textArea.setListener(this);
this.addTextField(textArea);
int left1 = this.guiLeft + this.xSize - 104;
this.addButton(new GuiNpcButton(102, left1, this.guiTop + yoffset, 60, 20, "gui.clear"));
this.addButton(new GuiNpcButton(101, left1 + 61, this.guiTop + yoffset, 60, 20, "gui.paste"));
@@ -50,6 +50,8 @@ public class GuiScriptRecipe extends GuiNPCInterface implements GuiYesNoCallback
private final RecipeScript scriptHandler;
boolean loaded = false;
private GuiScriptTextArea textArea;
public GuiScriptRecipe(GuiNpcManageRecipes parent, RecipeCarpentry recipe) {
this.drawDefaultBackground = true;
this.closeOnEsc = true;
@@ -129,10 +131,13 @@ public class GuiScriptRecipe extends GuiNPCInterface implements GuiYesNoCallback
hookLabel.color = 11184810;
this.addLabel(hookLabel);
ScriptContainer container = this.scriptHandler.container;
GuiScriptTextArea ta = new GuiScriptTextArea(this, 2, this.guiLeft + 1 + yoffset, this.guiTop + yoffset, this.xSize - 108 - yoffset, (int) ((double) this.ySize * 0.96) - yoffset * 2, container == null ? "" : container.script);
ta.enableCodeHighlighting();
ta.setListener(this);
this.addTextField(ta);
if (textArea == null)
textArea = new GuiScriptTextArea(this, 2, this.guiLeft + 1 + yoffset, this.guiTop + yoffset, this.xSize - 108 - yoffset, (int) ((double) this.ySize * 0.96) - yoffset * 2, container == null ? "" : container.script);
else
textArea.init(this.guiLeft + 1 + yoffset, this.guiTop + yoffset, this.xSize - 108 - yoffset, (int) ((double) this.ySize * 0.96) - yoffset * 2, container == null ? "" : container.script);
textArea.enableCodeHighlighting();
textArea.setListener(this);
this.addTextField(textArea);
int left1 = this.guiLeft + this.xSize - 104;
this.addButton(new GuiNpcButton(102, left1, this.guiTop + yoffset, 60, 20, "gui.clear"));
this.addButton(new GuiNpcButton(101, left1 + 61, this.guiTop + yoffset, 60, 20, "gui.paste"));