[studio,nostalgia] Update tab name when corresponding file's name changes

This commit is contained in:
2025-01-26 00:52:11 -06:00
parent f840240aac
commit 046834c2b9
12 changed files with 34 additions and 12 deletions
@@ -54,7 +54,7 @@ void PaletteEditorImGui::PageRenameDialog::draw(turbine::Context &tctx) noexcept
PaletteEditorImGui::PaletteEditorImGui(studio::StudioContext &sctx, ox::StringParam path):
Editor(std::move(path)),
Editor(sctx, std::move(path)),
m_sctx(sctx),
m_tctx(sctx.tctx),
m_pal(*keel::readObj<Palette>(keelCtx(m_tctx), itemPath()).unwrapThrow()) {
@@ -87,7 +87,7 @@ static ox::Error toPngFile(
}
TileSheetEditorImGui::TileSheetEditorImGui(studio::StudioContext &sctx, ox::StringParam path):
Editor(std::move(path)),
Editor(sctx, std::move(path)),
m_sctx{sctx},
m_tctx{m_sctx.tctx},
m_palPicker{"Palette Chooser", keelCtx(sctx), FileExt_npal},
@@ -329,7 +329,7 @@ void TileSheetEditorModel::pushCommand(studio::UndoCommand *cmd) noexcept {
m_updated = true;
}
ox::Error TileSheetEditorModel::handleFileRename(ox::StringViewCR newPath, ox::UUID const&id) noexcept {
ox::Error TileSheetEditorModel::handleFileRename(ox::StringViewCR, ox::StringViewCR newPath, ox::UUID const&id) noexcept {
if ((beginsWith(m_img.defaultPalette, "uuid://") &&
substr(m_img.defaultPalette, 7) == id.toString()) ||
m_img.defaultPalette == newPath) {
@@ -137,7 +137,7 @@ class TileSheetEditorModel: public ox::SignalHandler {
void pushCommand(studio::UndoCommand *cmd) noexcept;
ox::Error handleFileRename(ox::StringViewCR newPath, ox::UUID const&id) noexcept;
ox::Error handleFileRename(ox::StringViewCR, ox::StringViewCR newPath, ox::UUID const&id) noexcept;
};
@@ -11,7 +11,7 @@
namespace nostalgia::scene {
SceneEditorImGui::SceneEditorImGui(studio::StudioContext &ctx, ox::StringView path):
Editor(path),
Editor(ctx, path),
m_ctx(ctx.tctx),
m_editor(m_ctx, path),
m_view(m_ctx, m_editor.scene()) {