Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Yafc.UI/Core/Structs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,9 @@ public enum Icon {
OpenNew,
StarEmpty,
StarFull,

Secondary,
FirstCustom,

}

public enum RectAlignment {
Expand Down
Binary file added Yafc/Data/Icons/Secondary.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions Yafc/Data/locale/en/yafc.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ edit-page-properties=Edit properties
open-secondary-page=Open as secondary
shortcut-ctrl-click=Ctrl+Click
close-secondary-page=Close secondary
remove-page=Remove page
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even if we do want separate strings (Factorio has four "Cancel"s and three "Back"s in English), they should probably have the same content, to avoid questions about the differences between 'remove' and 'delete'.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. We can reuse the delete-page instead.

duplicate-page=Duplicate page

; ObjectTooltip.cs
Expand Down
14 changes: 10 additions & 4 deletions Yafc/Widgets/MainScreenTabBar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,29 +109,35 @@ private void BuildContents(ImGui gui) {
private void PageRightClickDropdown(ImGui gui, ProjectPage page) {
bool isSecondary = screen.secondaryPage == page;
bool isActive = screen.activePage == page;
if (gui.BuildContextMenuButton(LSs.EditPageProperties)) {
if (gui.BuildContextMenuButton(LSs.EditPageProperties, icon:Icon.Edit)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (gui.BuildContextMenuButton(LSs.EditPageProperties, icon:Icon.Edit)) {
if (gui.BuildContextMenuButton(LSs.EditPageProperties, icon: Icon.Edit)) {

Our code style calls for spaces here, and missing spaces will cause problems for those of us who are using the recommended pre-push hook.

_ = gui.CloseDropdown();
ProjectPageSettingsPanel.Show(page);
}
if (!isSecondary && !isActive) {
if (gui.BuildContextMenuButton(LSs.OpenSecondaryPage, LSs.ShortcutCtrlClick)) {
if (gui.BuildContextMenuButton(LSs.OpenSecondaryPage, LSs.ShortcutCtrlClick, Icon.Secondary)) {
_ = gui.CloseDropdown();
screen.SetSecondaryPage(page);
}
}
else if (isSecondary) {
if (gui.BuildContextMenuButton(LSs.CloseSecondaryPage, LSs.ShortcutCtrlClick)) {
if (gui.BuildContextMenuButton(LSs.CloseSecondaryPage, LSs.ShortcutCtrlClick, Icon.Close)) {
_ = gui.CloseDropdown();
screen.SetSecondaryPage(null);
}
}
if (gui.BuildContextMenuButton(LSs.DuplicatePage)) {
if (gui.BuildContextMenuButton(LSs.DuplicatePage, icon:Icon.Copy)) {
_ = gui.CloseDropdown();
if (ProjectPageSettingsPanel.ClonePage(page) is { } copy) {
screen.project.RecordUndo().pages.Add(copy);
MainScreen.Instance.SetActivePage(copy);
}
}
if (gui.BuildContextMenuButton(LSs.RemovePage, icon:Icon.Delete, disabled: !page.canDelete)) {
Copy link
Collaborator

@DaleStan DaleStan Sep 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (gui.BuildContextMenuButton(LSs.RemovePage, icon:Icon.Delete, disabled: !page.canDelete)) {
if (gui.BuildContextMenuButton(LSs.DeletePage, icon: Icon.Delete, disabled: !page.canDelete)) {

For consistency with ProjectPageSettingsPanel, this should probably use the same string.

_ = gui.CloseDropdown();
if (page.canDelete) {
screen.project.RemovePage(page);
}
}
}

public void Build(ImGui gui) {
Expand Down