Skip to content

Commit

Permalink
Added an option to hide the editor icon.
Browse files Browse the repository at this point in the history
  • Loading branch information
ImCodist committed Jul 2, 2023
1 parent ee27da2 commit e3ff756
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
2 changes: 2 additions & 0 deletions src/main/java/xyz/imcodist/other/ModConfigModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ public enum DisplayRunText {

public boolean closeOnKeyReleased = false;

public boolean hideEditIcon = false;

@SectionHeader("action_buttons")
public boolean closeOnAction = true;
public boolean showActionsInTooltip = true;
Expand Down
22 changes: 12 additions & 10 deletions src/main/java/xyz/imcodist/ui/MainUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,18 @@ protected void build(FlowLayout rootComponent) {
headerLayout.child(headerLabel);

// Header edit button.
ButtonComponent headerEditButton = Components.button(Text.literal("✎"), (buttonComponent) -> {
editMode = !editMode;
updateEditorLayout();
});
headerEditButton
.textShadow(true)
.renderer(ButtonComponent.Renderer.flat(0x000000, 0x000000, 0x000000))
.margins(Insets.of(0, 0, 5, 0))
.horizontalSizing(Sizing.fixed(10));
headerLayout.child(headerEditButton);
if (!QuickMenu.CONFIG.hideEditIcon()) {
ButtonComponent headerEditButton = Components.button(Text.literal("✎"), (buttonComponent) -> {
editMode = !editMode;
updateEditorLayout();
});
headerEditButton
.textShadow(true)
.renderer(ButtonComponent.Renderer.flat(0x000000, 0x000000, 0x000000))
.margins(Insets.of(0, 0, 5, 0))
.horizontalSizing(Sizing.fixed(10));
headerLayout.child(headerEditButton);
}

// Setup action layouts.
FlowLayout actionFlowLayout = Containers.verticalFlow(Sizing.fill(100), Sizing.content());
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/assets/quickmenu/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"text.config.quickmenu.option.menuHeight": "Menu Height",
"text.config.quickmenu.option.closeOnAction": "Close on Action",
"text.config.quickmenu.option.closeOnKeyReleased": "Close on Key Released",
"text.config.quickmenu.option.hideEditIcon": "Hide Edit Icon",
"text.config.quickmenu.option.showActionsInTooltip": "Show Actions in Tooltip",
"text.config.quickmenu.option.displayRunText": "Show Run Text",

Expand Down

0 comments on commit e3ff756

Please sign in to comment.