use of mcjty.lib.gui.layout.PositionalLayout in project RFToolsControl by McJty.
the class GuiProgrammer method setupListPanel.
private Panel setupListPanel() {
Panel panel = new Panel(mc, this).setLayout(new PositionalLayout()).setLayoutHint(new PositionalLayout.PositionalHint(2, 2, 78, 232)).addChild(new Label(mc, this).setText("Opcodes:").setLayoutHint(new PositionalLayout.PositionalHint(0, 0, 70, 12)));
makeCategoryToggle(panel, 0, 0, OpcodeCategory.CATEGORY_ITEMS, 8, 5);
makeCategoryToggle(panel, 1, 0, OpcodeCategory.CATEGORY_LIQUIDS, 10, 5);
makeCategoryToggle(panel, 2, 0, OpcodeCategory.CATEGORY_CRAFTING, 6, 5);
makeCategoryToggle(panel, 3, 0, OpcodeCategory.CATEGORY_REDSTONE, 14, 5);
makeCategoryToggle(panel, 0, 1, OpcodeCategory.CATEGORY_ENERGY, 12, 5);
makeCategoryToggle(panel, 1, 1, OpcodeCategory.CATEGORY_NUMBERS, 8, 6);
makeCategoryToggle(panel, 2, 1, OpcodeCategory.CATEGORY_VECTORS, 10, 6);
makeCategoryToggle(panel, 3, 1, OpcodeCategory.CATEGORY_GRAPHICS, 6, 6);
opcodeList = new WidgetList(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(0, 52, 68, 180)).setPropagateEventsToChildren(true).setInvisibleSelection(true).setDrawHorizontalLines(false).setRowheight(ICONSIZE + 2);
Slider slider = new Slider(mc, this).setVertical().setScrollable(opcodeList).setLayoutHint(new PositionalLayout.PositionalHint(68, 52, 8, 180));
fillOpcodes();
return panel.addChild(opcodeList).addChild(slider);
}
use of mcjty.lib.gui.layout.PositionalLayout in project RFToolsControl by McJty.
the class GuiProcessor method setupVariableListPanel.
private Panel setupVariableListPanel() {
fluidList = new WidgetList(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(0, 0, 62, 65)).setPropagateEventsToChildren(true).setInvisibleSelection(true).setDrawHorizontalLines(false).setUserObject("allowed");
fluidList.addSelectionEvent(new SelectionEvent() {
@Override
public void select(Widget parent, int i) {
int setupMode = getSetupMode();
if (setupMode != -1) {
CardInfo cardInfo = tileEntity.getCardInfo(setupMode);
int varAlloc = cardInfo.getVarAllocation();
int itemAlloc = cardInfo.getItemAllocation();
int fluidAlloc = cardInfo.getFluidAllocation();
int idx = fluidListMapping[i];
boolean allocated = ((fluidAlloc >> idx) & 1) != 0;
allocated = !allocated;
if (allocated) {
fluidAlloc = fluidAlloc | (1 << idx);
} else {
fluidAlloc = fluidAlloc & ~(1 << idx);
}
cardInfo.setFluidAllocation(fluidAlloc);
sendServerCommand(RFToolsCtrlMessages.INSTANCE, ProcessorTileEntity.CMD_ALLOCATE, new Argument("card", setupMode), new Argument("items", itemAlloc), new Argument("vars", varAlloc), new Argument("fluids", fluidAlloc));
updateFluidList();
fluidList.setSelected(-1);
}
}
@Override
public void doubleClick(Widget parent, int index) {
}
});
Slider fluidSlider = new Slider(mc, this).setVertical().setScrollable(fluidList).setLayoutHint(new PositionalLayout.PositionalHint(62, 0, 9, 65)).setUserObject("allowed");
updateFluidList();
variableList = new WidgetList(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(0, 67, 62, 161)).setPropagateEventsToChildren(true).setInvisibleSelection(true).setDrawHorizontalLines(false).setUserObject("allowed");
variableList.addSelectionEvent(new SelectionEvent() {
@Override
public void select(Widget parent, int i) {
int setupMode = getSetupMode();
if (setupMode != -1) {
CardInfo cardInfo = tileEntity.getCardInfo(setupMode);
int varAlloc = cardInfo.getVarAllocation();
int itemAlloc = cardInfo.getItemAllocation();
int fluidAlloc = cardInfo.getFluidAllocation();
boolean allocated = ((varAlloc >> i) & 1) != 0;
allocated = !allocated;
if (allocated) {
varAlloc = varAlloc | (1 << i);
} else {
varAlloc = varAlloc & ~(1 << i);
}
cardInfo.setVarAllocation(varAlloc);
sendServerCommand(RFToolsCtrlMessages.INSTANCE, ProcessorTileEntity.CMD_ALLOCATE, new Argument("card", setupMode), new Argument("items", itemAlloc), new Argument("vars", varAlloc), new Argument("fluids", fluidAlloc));
updateVariableList();
variableList.setSelected(-1);
}
}
@Override
public void doubleClick(Widget parent, int index) {
}
});
Slider varSlider = new Slider(mc, this).setVertical().setScrollable(variableList).setLayoutHint(new PositionalLayout.PositionalHint(62, 67, 9, 161)).setUserObject("allowed");
updateVariableList();
return new Panel(mc, this).setLayout(new PositionalLayout()).setLayoutHint(new PositionalLayout.PositionalHint(5, 5, 72, 220)).addChild(variableList).addChild(varSlider).addChild(fluidList).addChild(fluidSlider).setUserObject("allowed");
}
use of mcjty.lib.gui.layout.PositionalLayout in project RFToolsControl by McJty.
the class GuiProcessor method initGui.
@Override
public void initGui() {
super.initGui();
// --- Main window ---
Panel toplevel = new Panel(mc, this).setLayout(new PositionalLayout()).setBackground(mainBackground);
toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
int maxEnergyStored = tileEntity.getMaxEnergyStored();
energyBar = new EnergyBar(mc, this).setVertical().setMaxValue(maxEnergyStored).setLayoutHint(new PositionalLayout.PositionalHint(122, 4, 70, 10)).setShowText(false).setHorizontal();
energyBar.setValue(GenericEnergyStorageTileEntity.getCurrentRF());
toplevel.addChild(energyBar);
exclusive = new ToggleButton(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(122, 16, 40, 15)).setCheckMarker(true).setText("Excl.").setTooltips(TextFormatting.YELLOW + "Exclusive mode", "If pressed then programs on", "card X can only run on core X");
exclusive.setPressed(tileEntity.isExclusive());
exclusive.addButtonEvent(parent -> {
tileEntity.setExclusive(exclusive.isPressed());
sendServerCommand(RFToolsCtrlMessages.INSTANCE, ProcessorTileEntity.CMD_SETEXCLUSIVE, new Argument("v", exclusive.isPressed()));
});
toplevel.addChild(exclusive);
hudMode = new ChoiceLabel(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(122 + 40 + 1, 16, 28, 15)).addChoices("Off", "Log", "Db", "Gfx").setChoiceTooltip("Off", "No overhead log").setChoiceTooltip("Log", "Show the normal log").setChoiceTooltip("Db", "Show a debug display").setChoiceTooltip("Gfx", "Graphics display");
switch(tileEntity.getShowHud()) {
case HUD_OFF:
hudMode.setChoice("Off");
break;
case HUD_LOG:
hudMode.setChoice("Log");
break;
case HUD_DB:
hudMode.setChoice("Db");
break;
case HUD_GFX:
hudMode.setChoice("Gfx");
break;
}
hudMode.addChoiceEvent((parent, newChoice) -> {
String choice = hudMode.getCurrentChoice();
int m = HUD_OFF;
if ("Off".equals(choice)) {
m = HUD_OFF;
} else if ("Log".equals(choice)) {
m = HUD_LOG;
} else if ("Db".equals(choice)) {
m = HUD_DB;
} else {
m = HUD_GFX;
}
sendServerCommand(RFToolsCtrlMessages.INSTANCE, ProcessorTileEntity.CMD_SETHUDMODE, new Argument("v", m));
});
toplevel.addChild(hudMode);
setupLogWindow(toplevel);
for (int i = 0; i < ProcessorTileEntity.CARD_SLOTS; i++) {
setupButtons[i] = new ToggleButton(mc, this).addButtonEvent(this::setupMode).setTooltips(TextFormatting.YELLOW + "Resource allocation", "Setup item and variable", "allocation for this card").setLayoutHint(new PositionalLayout.PositionalHint(11 + i * 18, 6, 15, 7)).setUserObject("allowed");
toplevel.addChild(setupButtons[i]);
}
window = new Window(this, toplevel);
// --- Side window ---
Panel listPanel = setupVariableListPanel();
Panel sidePanel = new Panel(mc, this).setLayout(new PositionalLayout()).setBackground(sideBackground).addChild(listPanel);
sidePanel.setBounds(new Rectangle(guiLeft - SIDEWIDTH, guiTop, SIDEWIDTH, ySize));
sideWindow = new Window(this, sidePanel);
}
use of mcjty.lib.gui.layout.PositionalLayout in project RFToolsControl by McJty.
the class GuiCraftingStation method initGui.
@Override
public void initGui() {
super.initGui();
Panel toplevel = new Panel(mc, this).setLayout(new PositionalLayout()).setBackground(mainBackground);
initRecipeList(toplevel);
initProgressList(toplevel);
initButtons(toplevel);
toplevel.setBounds(new Rectangle(guiLeft, guiTop, WIDTH, HEIGHT));
window = new Window(this, toplevel);
}
use of mcjty.lib.gui.layout.PositionalLayout in project RFTools by McJty.
the class GuiSensor method initGui.
@Override
public void initGui() {
super.initGui();
Panel toplevel = new Panel(mc, this).setBackground(iconLocation).setLayout(new PositionalLayout());
numberField = new TextField(mc, this).setTooltips("Set a number specific to the type of sensor").setLayoutHint(new PositionalLayout.PositionalHint(60, 51, 80, 14)).addTextEvent((parent, newText) -> setNumber());
int number = tileEntity.getNumber();
numberField.setText(String.valueOf(number));
typeLabel = new ChoiceLabel(mc, this);
for (SensorType sensorType : SensorType.values()) {
typeLabel.addChoices(sensorType.getName());
typeLabel.setChoiceTooltip(sensorType.getName(), sensorType.getDescription());
}
typeLabel.setLayoutHint(new PositionalLayout.PositionalHint(60, 3, 80, 14));
typeLabel.setChoice(tileEntity.getSensorType().getName());
typeLabel.addChoiceEvent((parent, newChoice) -> setType());
areaLabel = new ChoiceLabel(mc, this);
for (AreaType areaType : AreaType.values()) {
areaLabel.addChoices(areaType.getName());
areaLabel.setChoiceTooltip(areaType.getName(), areaType.getDescription());
}
areaLabel.setLayoutHint(new PositionalLayout.PositionalHint(60, 19, 80, 14));
areaLabel.setChoice(tileEntity.getAreaType().getName());
areaLabel.addChoiceEvent((parent, newChoice) -> setArea());
groupLabel = new ChoiceLabel(mc, this);
for (GroupType groupType : GroupType.values()) {
groupLabel.addChoices(groupType.getName());
groupLabel.setChoiceTooltip(groupType.getName(), groupType.getDescription());
}
groupLabel.setLayoutHint(new PositionalLayout.PositionalHint(60, 35, 80, 14));
groupLabel.setChoice(tileEntity.getGroupType().getName());
groupLabel.addChoiceEvent((parent, newChoice) -> setGroup());
toplevel.addChild(new Label(mc, this).setText("Type:").setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setLayoutHint(new PositionalLayout.PositionalHint(10, 3, 50, 14))).addChild(areaLabel).addChild(new Label(mc, this).setText("Area:").setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setLayoutHint(new PositionalLayout.PositionalHint(10, 19, 50, 14))).addChild(typeLabel).addChild(new Label(mc, this).setText("Group:").setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setLayoutHint(new PositionalLayout.PositionalHint(10, 35, 50, 14))).addChild(groupLabel).addChild(new Label(mc, this).setText("Number:").setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setLayoutHint(new PositionalLayout.PositionalHint(10, 51, 50, 14))).addChild(numberField);
toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
window = new Window(this, toplevel);
}
Aggregations