Compare commits

...

4 Commits

7 changed files with 31 additions and 6 deletions

View File

@ -3,12 +3,14 @@
* Add app icon for both window and file
* Closing application will now confirm with user if any files have unsaved
changes.
* Fix selection clearing in TileSheet editor to work when clicking outside
image.
* Fix color number key range in PalettEditor. Previously, pressing A caused the
editor to jump to the last color.
* UUID duplicates will now be reported when opening a project
* PalettEditor: page rename will now take effect upon pressing enter if the
* Deleting a directory now closes files in that directory
* Delete key now initiates deletion of selected directory
* TileSheetEditor: Fix selection clearing in to work when clicking outside
image.
* PaletteEditor: Fix color number key range in. Previously, pressing A caused
the editor to jump to the last color.
* PaletteEditor: page rename will now take effect upon pressing enter if the
text input has focus
# d2025.02.1

Binary file not shown.

View File

@ -478,6 +478,18 @@ ox::Error StudioUI::handleMoveFile(ox::StringViewCR oldPath, ox::StringViewCR ne
return m_projectExplorer.refreshProjectTreeModel();
}
ox::Error StudioUI::handleDeleteDir(ox::StringViewCR path) noexcept {
auto const p = sfmt("{}/", path);
for (auto &e : m_editors) {
if (beginsWith(e->itemPath(), p)) {
oxLogError(closeFile(path));
m_closeActiveTab = true;
break;
}
}
return m_projectExplorer.refreshProjectTreeModel();
}
ox::Error StudioUI::handleDeleteFile(ox::StringViewCR path) noexcept {
for (auto &e : m_editors) {
if (path == e->itemPath()) {
@ -523,6 +535,7 @@ ox::Error StudioUI::openProjectPath(ox::StringParam path) noexcept {
m_newDirDialog.newDir.connect(m_sctx.project, &Project::mkdir);
m_project->dirAdded.connect(&m_projectExplorer, &ProjectExplorer::refreshProjectTreeModel);
m_project->fileAdded.connect(&m_projectExplorer, &ProjectExplorer::refreshProjectTreeModel);
m_project->dirDeleted.connect(this, &StudioUI::handleDeleteDir);
m_project->fileDeleted.connect(this, &StudioUI::handleDeleteFile);
m_project->fileMoved.connect(this, &StudioUI::handleMoveFile);
m_openFiles.clear();

View File

@ -126,6 +126,8 @@ class StudioUI: public ox::SignalHandler {
ox::Error handleMoveFile(ox::StringViewCR oldPath, ox::StringViewCR newPath, ox::UUID const&id) noexcept;
ox::Error handleDeleteDir(ox::StringViewCR path) noexcept;
ox::Error handleDeleteFile(ox::StringViewCR path) noexcept;
ox::Error createOpenProject(ox::StringViewCR path) noexcept;

View File

@ -23,6 +23,7 @@ enum class ProjectEvent {
// FileRecognized is triggered for all matching files upon a new
// subscription to a section of the project and upon the addition of a file.
FileRecognized,
DirDeleted,
FileDeleted,
FileUpdated,
FileMoved,
@ -134,6 +135,7 @@ class Project: public ox::SignalHandler {
// file.
ox::Signal<ox::Error(ox::StringViewCR)> fileRecognized;
ox::Signal<ox::Error(ox::StringViewCR)> fileDeleted;
ox::Signal<ox::Error(ox::StringViewCR)> dirDeleted;
ox::Signal<ox::Error(ox::StringViewCR path, ox::UUID const&id)> fileUpdated;
ox::Signal<ox::Error(ox::StringViewCR oldPath, ox::StringViewCR newPath, ox::UUID const&id)> fileMoved;
@ -201,6 +203,9 @@ ox::Error Project::subscribe(ProjectEvent e, ox::SignalHandler *tgt, Functor &&s
connect(this, &Project::fileRecognized, tgt, slot);
break;
}
case ProjectEvent::DirDeleted:
connect(this, &Project::dirDeleted, tgt, slot);
break;
case ProjectEvent::FileDeleted:
connect(this, &Project::fileDeleted, tgt, slot);
break;

View File

@ -93,6 +93,9 @@ void FileTreeModel::draw(turbine::Context &tctx) const noexcept {
if (ImGui::IsItemActivated() || ImGui::IsItemClicked(1)) {
m_explorer.setSelectedNode(this);
}
if (ImGui::IsItemFocused() && ImGui::IsKeyPressed(ImGuiKey_Delete)) {
m_explorer.fileDeleted(m_fullPath);
}
ig::IDStackItem const idStackItem{m_name};
m_explorer.drawDirContextMenu(m_fullPath);
if (m_explorer.fileDraggable()) {

View File

@ -145,7 +145,7 @@ ox::Error Project::deleteItem(ox::StringViewCR path) noexcept {
}
auto const err = m_fs.remove(path);
if (!err) {
fileDeleted.emit(path);
dirDeleted.emit(path);
}
return err;
} else {