From 95b1572aa1da0fec8ebf6ff01185e1cbb12bf441 Mon Sep 17 00:00:00 2001 From: AlgorithmX2 Date: Thu, 27 Mar 2014 00:14:34 -0500 Subject: [PATCH] Added Small Vs Tall Terminal Display Setting. --- .../gui/implementations/GuiMEMonitorable.java | 25 ++++++++++++++++--- client/gui/widgets/GuiImgButton.java | 5 ++++ core/AEConfig.java | 12 +++++---- core/localization/ButtonToolTips.java | 2 +- 4 files changed, 35 insertions(+), 9 deletions(-) diff --git a/client/gui/implementations/GuiMEMonitorable.java b/client/gui/implementations/GuiMEMonitorable.java index fdf5c1ac..66a4983f 100644 --- a/client/gui/implementations/GuiMEMonitorable.java +++ b/client/gui/implementations/GuiMEMonitorable.java @@ -11,6 +11,7 @@ import org.lwjgl.input.Mouse; import appeng.api.config.SearchBoxMode; import appeng.api.config.Settings; +import appeng.api.config.TerminalStyle; import appeng.api.implementations.guiobjects.IPortableCell; import appeng.api.implementations.tiles.IMEChest; import appeng.api.implementations.tiles.IViewCellStorage; @@ -55,13 +56,15 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi int rows = 0; int maxRows = Integer.MAX_VALUE; + int standardSize; + IConfigManager configSrc; GuiImgButton ViewBox; GuiImgButton SortByBox; GuiImgButton SortDirBox; - GuiImgButton searchBoxSettings; + GuiImgButton searchBoxSettings, terminalStyleBox; boolean viewCell; ItemStack myCurrentViewCells[] = new ItemStack[5]; @@ -82,6 +85,8 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi if ( te instanceof IViewCellStorage ) xSize += 33; + standardSize = xSize; + configSrc = ((IConfigureableObject) inventorySlots).getConfigManager(); (mecontainer = (ContainerMEMonitorable) inventorySlots).gui = this; @@ -123,6 +128,9 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi @Override public void initGui() { + maxRows = AEConfig.instance.getConfigManager().getSetting( Settings.TERMINAL_STYLE ) == TerminalStyle.SMALL ? 6 : Integer.MAX_VALUE; + perRow = AEConfig.instance.getConfigManager().getSetting( Settings.TERMINAL_STYLE ) != TerminalStyle.FULL ? 9 : 9 + ((width - standardSize) / 18); + int NEI = 0; int top = 4; int magicNumber = 114 + 1; @@ -144,6 +152,11 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi } } + if ( AEConfig.instance.getConfigManager().getSetting( Settings.TERMINAL_STYLE ) != TerminalStyle.FULL ) + this.xSize = standardSize + ((perRow - 9) * 18); + else + this.xSize = standardSize; + super.initGui(); // full size : 204 // extra slots : 72 @@ -165,6 +178,10 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi buttonList.add( searchBoxSettings = new GuiImgButton( this.guiLeft - 18, offset, Settings.SEARCH_MODE, AEConfig.instance.settings .getSetting( Settings.SEARCH_MODE ) ) ); + offset += 20; + + buttonList.add( terminalStyleBox = new GuiImgButton( this.guiLeft - 18, offset, Settings.TERMINAL_STYLE, AEConfig.instance.settings + .getSetting( Settings.TERMINAL_STYLE ) ) ); searchField = new MEGuiTextField( fontRendererObj, this.guiLeft + Math.max( 82, xoffset ), this.guiTop + 6, 89, fontRendererObj.FONT_HEIGHT ); searchField.setEnableBackgroundDrawing( false ); @@ -201,7 +218,9 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi Enum cv = iBtn.getCurrentValue(); Enum next = Platform.rotateEnum( cv, backwards, iBtn.getSetting().getPossibleValues() ); - if ( btn == searchBoxSettings ) + if ( btn == terminalStyleBox ) + AEConfig.instance.settings.putSetting( iBtn.getSetting(), next ); + else if ( btn == searchBoxSettings ) AEConfig.instance.settings.putSetting( iBtn.getSetting(), next ); else { @@ -217,7 +236,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi iBtn.set( next ); - if ( next.getClass() == SearchBoxMode.class ) + if ( next.getClass() == SearchBoxMode.class || next.getClass() == TerminalStyle.class ) re_init(); } } diff --git a/client/gui/widgets/GuiImgButton.java b/client/gui/widgets/GuiImgButton.java index 9ff658e2..24ab6540 100644 --- a/client/gui/widgets/GuiImgButton.java +++ b/client/gui/widgets/GuiImgButton.java @@ -23,6 +23,7 @@ import appeng.api.config.SearchBoxMode; import appeng.api.config.Settings; import appeng.api.config.SortDir; import appeng.api.config.SortOrder; +import appeng.api.config.TerminalStyle; import appeng.api.config.ViewItems; import appeng.api.config.YesNo; import appeng.client.texture.ExtraTextures; @@ -140,6 +141,10 @@ public class GuiImgButton extends GuiButton implements ITooltip registerApp( 16 * 5 + 3, Settings.LEVEL_TYPE, LevelType.ENERGY_LEVEL, ButtonToolTips.LevelType, ButtonToolTips.LevelType_Energy ); registerApp( 16 * 4 + 3, Settings.LEVEL_TYPE, LevelType.ITEM_LEVEL, ButtonToolTips.LevelType, ButtonToolTips.LevelType_Item ); + registerApp( 16 * 13 + 0, Settings.TERMINAL_STYLE, TerminalStyle.TALL, ButtonToolTips.TerminalStyle, ButtonToolTips.TerminalStyle_Tall ); + registerApp( 16 * 13 + 1, Settings.TERMINAL_STYLE, TerminalStyle.SMALL, ButtonToolTips.TerminalStyle, ButtonToolTips.TerminalStyle_Small ); + registerApp( 16 * 13 + 2, Settings.TERMINAL_STYLE, TerminalStyle.FULL, ButtonToolTips.TerminalStyle, ButtonToolTips.TerminalStyle_Full ); + registerApp( 64, Settings.SORT_BY, SortOrder.NAME, ButtonToolTips.SortBy, ButtonToolTips.ItemName ); registerApp( 65, Settings.SORT_BY, SortOrder.AMOUNT, ButtonToolTips.SortBy, ButtonToolTips.NumberOfItems ); registerApp( 68, Settings.SORT_BY, SortOrder.INVTWEAKS, ButtonToolTips.SortBy, ButtonToolTips.InventoryTweaks ); diff --git a/core/AEConfig.java b/core/AEConfig.java index d71e9f8e..3e48dd90 100644 --- a/core/AEConfig.java +++ b/core/AEConfig.java @@ -10,6 +10,7 @@ import appeng.api.config.PowerMultiplier; import appeng.api.config.PowerUnits; import appeng.api.config.SearchBoxMode; import appeng.api.config.Settings; +import appeng.api.config.TerminalStyle; import appeng.api.config.YesNo; import appeng.api.util.IConfigManager; import appeng.api.util.IConfigureableObject; @@ -121,9 +122,10 @@ public class AEConfig extends Configuration implements IConfigureableObject, ICo grinderOres = get( "GrindStone", "grinderOres", grinderOres ).getStringList(); oreDoublePercentage = get( "GrindStone", "oreDoublePercentage", oreDoublePercentage ).getDouble( oreDoublePercentage ); enableEffects = get( "Client", "enableEffects", true ).getBoolean( true ); - useLargeFonts= get( "Client", "useTerminalUseLargeFont", true ).getBoolean( true ); - + useLargeFonts = get( "Client", "useTerminalUseLargeFont", false ).getBoolean( false ); + settings.registerSetting( Settings.SEARCH_TOOLTIPS, YesNo.YES ); + settings.registerSetting( Settings.TERMINAL_STYLE, TerminalStyle.TALL ); settings.registerSetting( Settings.SEARCH_MODE, SearchBoxMode.AUTOSEARCH ); spawnChargedChance = (float) (1.0 - get( "worldGen", "spawnChargedChance", 1.0 - spawnChargedChance ).getDouble( 1.0 - spawnChargedChance )); @@ -176,11 +178,11 @@ public class AEConfig extends Configuration implements IConfigureableObject, ICo selectedPowerUnit = PowerUnits.AE; } - for (TickRates tr: TickRates.values() ) + for (TickRates tr : TickRates.values()) { - tr.Load(this); + tr.Load( this ); } - + if ( isFeatureEnabled( AEFeature.SpatialIO ) ) { storageBiomeID = get( "spatialio", "storageBiomeID", storageBiomeID ).getInt( storageBiomeID ); diff --git a/core/localization/ButtonToolTips.java b/core/localization/ButtonToolTips.java index c0784532..07b9aece 100644 --- a/core/localization/ButtonToolTips.java +++ b/core/localization/ButtonToolTips.java @@ -32,7 +32,7 @@ public enum ButtonToolTips Blocking, NonBlocking, Craft, DontCraft, - LevelType, LevelType_Energy, LevelType_Item, InventoryTweaks; + LevelType, LevelType_Energy, LevelType_Item, InventoryTweaks, TerminalStyle, TerminalStyle_Full, TerminalStyle_Tall, TerminalStyle_Small; String root;