Skip to content

Commit

Permalink
Refactor welcome.d using incFileOpen()
Browse files Browse the repository at this point in the history
* resolves #145
* Allow users to configure exit behavior
* A window pops up when the project is closed, exited, or new.
  * NewProjectAskHandler, CloseAskHandler, ExitAskHandler
* Import pop-up windows is currently not supported. I think `kra.d` and `psd.d` shoud be refactored first.
  * nijigenerate/nijigenerate#30
  * nijigenerate/nijigenerate#29
* Pop-up window when "open" is not currently supported
  • Loading branch information
r888800009 committed Sep 23, 2024
1 parent a75157e commit 56b4095
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
7 changes: 5 additions & 2 deletions source/creator/io/save.d
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,16 @@ import creator;
import tinyfiledialogs;
import i18n;

void incFileOpen() {
bool incFileOpen() {
const TFD_Filter[] filters = [
{ ["*.inx"], "Inochi Creator Project (*.inx)" }
];

string file = incShowOpenDialog(filters, _("Open..."));
if (file) incOpenProject(file);
// FileException should handle in incOpenProject, so we don't write try/catch here
if (file) return incOpenProject(file);

return false;
}

bool incFileSave() {
Expand Down
12 changes: 2 additions & 10 deletions source/creator/windows/welcome.d
Original file line number Diff line number Diff line change
Expand Up @@ -231,16 +231,8 @@ protected:
}

if (incTextLinkWithIcon("", _("Open..."))) {
const TFD_Filter[] filters = [
{ ["*.inx"], "Inochi Creator Project (*.inx)" }
];

string file = incShowOpenDialog(filters, _("Open..."));
if (file) {
// FileException should handle in incOpenProject, so we don't write try/catch here
if (incOpenProject(file))
this.close();
}
if (incFileOpen())
this.close();
}


Expand Down

0 comments on commit 56b4095

Please sign in to comment.