mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-15 17:54:50 +00:00
Added keyboard shortcuts to NEI And More... (#271)
* Added keyboard shortcuts to NEI * OptionButton: Add Tooltip to long prefix * fix formatting * Tooltip shown when shift is held
This commit is contained in:
1 parent
529f4374d6
commit
fb9d517f78
30 files changed
+756
-306
No files matched your search
@@ -312,7 +312,7 @@ public class PresetsWidget extends Widget {
|
||||
final int directionState = direction.contains(x + mx, y + my) ? 1 : 2;
|
||||
final int deleteState = delete.contains(x + mx, y + my) ? 1 : 2;
|
||||
|
||||
final String displayName = cropText(tag.displayName, option.w - 6);
|
||||
final String displayName = NEIClientUtils.cropText(fontRenderer, tag.displayName, option.w - 6);
|
||||
final String dirName =
|
||||
tag.whitelist ? translate("presets.whitelist.label") : translate("presets.blacklist.label");
|
||||
|
||||
@@ -416,7 +416,7 @@ public class PresetsWidget extends Widget {
|
||||
|
||||
public MouseSelection(int slotIndex, boolean append) {
|
||||
final ItemsGrid grid = ItemPanels.itemPanel.getGrid();
|
||||
final Rectangle4i rec = grid.getSlotRect(slotIndex - (grid.getPage() - 1) * grid.getPerPage());
|
||||
final Rectangle4i rec = grid.getItemRect(slotIndex);
|
||||
|
||||
this.append = append;
|
||||
endIndex = slotIndex;
|
||||
@@ -456,7 +456,7 @@ public class PresetsWidget extends Widget {
|
||||
|
||||
@Override
|
||||
public void draw(int mousex, int mousey) {
|
||||
final String text = cropText(this.text, w);
|
||||
final String text = NEIClientUtils.cropText(fontRenderer, this.text, w);
|
||||
|
||||
if (text.equals(this.text)) {
|
||||
GuiDraw.drawString(text, x + w - fontRenderer.getStringWidth(text), y + (h - 8) / 2, colour);
|
||||
@@ -535,24 +535,6 @@ public class PresetsWidget extends Widget {
|
||||
}
|
||||
};
|
||||
|
||||
protected static String cropText(String text, int containerWidth) {
|
||||
|
||||
int textWidth = fontRenderer.getStringWidth(text);
|
||||
|
||||
if (textWidth > containerWidth) {
|
||||
textWidth += fontRenderer.getStringWidth("...");
|
||||
|
||||
while (textWidth > containerWidth) {
|
||||
textWidth -= fontRenderer.getCharWidth(text.charAt(text.length() - 1));
|
||||
text = text.substring(0, text.length() - 1);
|
||||
}
|
||||
|
||||
return text + "...";
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
protected static void setEditedTag(final PresetTag tag) {
|
||||
edit = tag;
|
||||
openListBox = false;
|
||||
@@ -832,7 +814,7 @@ public class PresetsWidget extends Widget {
|
||||
mouseSelection.endIndex = slot.slotIndex;
|
||||
mouseSelection.items.clear();
|
||||
|
||||
final Rectangle4i rec = grid.getSlotRect(slot.slotIndex - (grid.getPage() - 1) * grid.getPerPage());
|
||||
final Rectangle4i rec = grid.getItemRect(slot.slotIndex);
|
||||
final Rectangle4i sel = new Rectangle4i(
|
||||
Math.min(rec.x, mouseSelection.startX),
|
||||
Math.min(rec.y, mouseSelection.startY),
|
||||
|
||||
Reference in new issue
Block a user