Added client config to not preserve the search string in terminals

Added tooltip to the search bar, that it may be cleared via right click
This commit is contained in:
repo_alt committed 2021-06-27 14:09:33 +03:00
1 parent 308c855c7a
commit 1fa55f66e0
7 files changed
+77 -34

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
aeversion=rv3
aechannel=beta
aebuild=48-GTNH
aebuild=49-GTNH
#KEEP V6 FOR MOD SUPPORT
aegroup=appeng
aebasename=appliedenergistics2
+20 -16
View File
@@ -146,25 +146,29 @@ public abstract class AEBaseGui extends GuiContainer
{
if( c instanceof ITooltip )
{
final ITooltip tooltip = (ITooltip) c;
final int x = tooltip.xPos(); // ((GuiImgButton) c).xPosition;
int y = tooltip.yPos(); // ((GuiImgButton) c).yPosition;
handleTooltip(mouseX, mouseY, (ITooltip) c);
}
}
}
if( x < mouseX && x + tooltip.getWidth() > mouseX && tooltip.isVisible() )
protected void handleTooltip(int mouseX, int mouseY, ITooltip c) {
final ITooltip tooltip = c;
final int x = tooltip.xPos(); // ((GuiImgButton) c).xPosition;
int y = tooltip.yPos(); // ((GuiImgButton) c).yPosition;
if( x < mouseX && x + tooltip.getWidth() > mouseX && tooltip.isVisible() )
{
if( y < mouseY && y + tooltip.getHeight() > mouseY)
{
if( y < 15 )
{
if( y < mouseY && y + tooltip.getHeight() > mouseY )
{
if( y < 15 )
{
y = 15;
}
y = 15;
}
final String msg = tooltip.getMessage();
if( msg != null )
{
this.drawTooltip( x + 11, y + 4, 0, msg );
}
}
final String msg = tooltip.getMessage();
if( msg != null )
{
this.drawTooltip( x + 11, y + 4, 0, msg );
}
}
}
@@ -39,6 +39,7 @@ import appeng.container.slot.SlotCraftingMatrix;
import appeng.container.slot.SlotFakeCraftingMatrix;
import appeng.core.AEConfig;
import appeng.core.AELog;
import appeng.core.localization.ButtonToolTips;
import appeng.core.localization.GuiText;
import appeng.core.sync.GuiBridge;
import appeng.core.sync.network.NetworkHandler;
@@ -304,6 +305,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
this.searchField.setMaxStringLength( 25 );
this.searchField.setTextColor( 0xFFFFFF );
this.searchField.setVisible( true );
searchField.setMessage(ButtonToolTips.SearchStringTooltip.getLocal());
if( this.viewCell || this instanceof GuiWirelessTerm )
{
@@ -315,8 +317,11 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
final Enum setting = AEConfig.instance.settings.getSetting( Settings.SEARCH_MODE );
this.searchField.setFocused( SearchBoxMode.AUTOSEARCH == setting || SearchBoxMode.NEI_AUTOSEARCH == setting );
this.searchField.setText( memoryText );
this.repo.setSearchString( memoryText );
if (AEConfig.instance.preserveSearchBar || this.isSubGui())
{
this.searchField.setText(memoryText);
this.repo.setSearchString(memoryText);
}
if( this.isSubGui() )
{
this.repo.updateView();
@@ -551,4 +556,10 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
{
this.standardSize = standardSize;
}
@Override
public void drawScreen( final int mouseX, final int mouseY, final float btn ) {
super.drawScreen(mouseX, mouseY, btn);
if (AEConfig.instance.preserveSearchBar)
handleTooltip(mouseX, mouseY, searchField);
}
}
@@ -31,9 +31,9 @@ import net.minecraft.client.gui.GuiTextField;
* <p>
* The rendering does pay attention to the size of the '_' caret.
*/
public class MEGuiTextField extends GuiTextField
{
public class MEGuiTextField extends GuiTextField implements ITooltip {
private static final int PADDING = 2;
private String tooltip;
private final int _xPos;
private final int _yPos;
@@ -50,9 +50,8 @@ public class MEGuiTextField extends GuiTextField
* @param width absolute width
* @param height absolute height
*/
public MEGuiTextField( final FontRenderer fontRenderer, final int xPos, final int yPos, final int width, final int height )
{
super( fontRenderer, xPos + PADDING, yPos + PADDING, width - 2 * PADDING - fontRenderer.getCharWidth( '_' ), height - 2 * PADDING );
public MEGuiTextField(final FontRenderer fontRenderer, final int xPos, final int yPos, final int width, final int height) {
super(fontRenderer, xPos + PADDING, yPos + PADDING, width - 2 * PADDING - fontRenderer.getCharWidth('_'), height - 2 * PADDING);
this._xPos = xPos;
this._yPos = yPos;
@@ -61,13 +60,12 @@ public class MEGuiTextField extends GuiTextField
}
@Override
public void mouseClicked( final int xPos, final int yPos, final int button )
{
super.mouseClicked( xPos, yPos, button );
public void mouseClicked(final int xPos, final int yPos, final int button) {
super.mouseClicked(xPos, yPos, button);
final boolean requiresFocus = this.isMouseIn( xPos, yPos );
final boolean requiresFocus = this.isMouseIn(xPos, yPos);
this.setFocused( requiresFocus );
this.setFocused(requiresFocus);
}
/**
@@ -77,11 +75,40 @@ public class MEGuiTextField extends GuiTextField
* @param yCoord current y coord of the mouse
* @return true if mouse position is within the text field area
*/
public boolean isMouseIn( final int xCoord, final int yCoord )
{
public boolean isMouseIn(final int xCoord, final int yCoord) {
final boolean withinXRange = this._xPos <= xCoord && xCoord < this._xPos + this._width;
final boolean withinYRange = this._yPos <= yCoord && yCoord < this._yPos + this._height;
return withinXRange && withinYRange;
}
@Override
public String getMessage() {
return tooltip;
}
public void setMessage(String tooltip)
{
this.tooltip = tooltip;
}
@Override
public int xPos() {
return this._xPos;
}
@Override
public int yPos() {
return this._yPos;
}
@Override
public int getHeight() {
return 22;
}
@Override
public boolean isVisible() {
return getVisible();
}
}
+2 -1
View File
@@ -79,6 +79,7 @@ public final class AEConfig extends Configuration implements IConfigurableObject
public boolean enableEffects = true;
public boolean useLargeFonts = false;
public boolean useColoredCraftingStatus;
public boolean preserveSearchBar = true;
public int wirelessTerminalBattery = 1600000;
public int entropyManipulatorBattery = 200000;
public int matterCannonBattery = 200000;
@@ -224,7 +225,7 @@ public final class AEConfig extends Configuration implements IConfigurableObject
this.enableEffects = this.get( "Client", "enableEffects", true ).getBoolean( true );
this.useLargeFonts = this.get( "Client", "useTerminalUseLargeFont", false ).getBoolean( false );
this.useColoredCraftingStatus = this.get( "Client", "useColoredCraftingStatus", true ).getBoolean( true );
this.preserveSearchBar = this.get( "Client", "preserveSearchBar", true ).getBoolean( true );
// load buttons..
for( int btnNum = 0; btnNum < 4; btnNum++ )
{
@@ -62,7 +62,7 @@ public enum ButtonToolTips
BlockPlacement, BlockPlacementYes, BlockPlacementNo,
// Used in the tooltips of the items in the terminal, when moused over
ItemsStored, ItemsRequestable, P2PFrequency,
ItemsStored, ItemsRequestable, P2PFrequency, SearchStringTooltip,
SchedulingMode, SchedulingModeDefault, SchedulingModeRoundRobin, SchedulingModeRandom, OreFilter, OreFilterHint;
@@ -333,7 +333,7 @@ gui.tooltips.appliedenergistics2.ItemsRequestable=Items Requestable: %s
gui.tooltips.appliedenergistics2.P2PFrequency=Frequency: %s
gui.tooltips.appliedenergistics2.OreFilterHint=Filter items using ore dictionary names
gui.tooltips.appliedenergistics2.OreFilter=Ore Dictionary Filter
gui.tooltips.appliedenergistics2.SearchStringTooltip=Right click to clear the search bar
# Units
gui.appliedenergistics2.units.appliedenergstics=AE
gui.appliedenergistics2.units.ic2=Energy Units