Implement 'save as' dialog, tweak open/save API #376
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This gets the 'save as' dialog working in a similar fashion to
the 'open' dialog.
The API isn't great. In druid-shell, open and save_as are exposed
as two different methods on WinCtx. They could be unified, now,
at the cost of a slightly less ergonomic API; the caller would
have to bring the FileDialogType enum into scope and pass it
directly.
In druid, the API is also slightly different. The Event::Open variant
has been removed, and both open and save are now fully Command based.
The basic idea is that there are two 'special' commands,
SHOW_SAVE_PANEL and SHOW_OPEN_PANEL, that are handled by the framework.
When these commands are received, the framework handles showing the
appropriate panel, and getting the input. If this succeeds,
the framework then sends either the SAVE_FILE or OPEN_FILE command,
which is expected to be handled by the framework author.