mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
Open sets in a new window.
TODO: don't allow the same set file to be opened twice, fork a window for it instead git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1005 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
+16
-5
@@ -368,6 +368,16 @@ bool SetWindow::askSaveAndContinue() {
|
||||
}
|
||||
}
|
||||
|
||||
void SetWindow::switchSet(const SetP& new_set) {
|
||||
if (new_set) {
|
||||
if (settings.open_sets_in_new_window) {
|
||||
(new SetWindow(nullptr, new_set))->Show();
|
||||
} else {
|
||||
setSet(new_set);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------- : Window events - update UI
|
||||
|
||||
void SetWindow::onUpdateUI(wxUpdateUIEvent& ev) {
|
||||
@@ -439,18 +449,19 @@ void SetWindow::updateRecentSets() {
|
||||
|
||||
|
||||
void SetWindow::onFileNew(wxCommandEvent&) {
|
||||
if (isOnlyWithSet() && !askSaveAndContinue()) return;
|
||||
if (!settings.open_sets_in_new_window && isOnlyWithSet() && !askSaveAndContinue()) return;
|
||||
// new set?
|
||||
SetP new_set = new_set_window(this);
|
||||
if (new_set) setSet(new_set);
|
||||
switchSet(new_set);
|
||||
}
|
||||
|
||||
void SetWindow::onFileOpen(wxCommandEvent&) {
|
||||
if (isOnlyWithSet() && !askSaveAndContinue()) return;
|
||||
if (!settings.open_sets_in_new_window && isOnlyWithSet() && !askSaveAndContinue()) return;
|
||||
wxFileDialog dlg(this, _TITLE_("open set"), _(""), _(""), import_formats(), wxOPEN);
|
||||
if (dlg.ShowModal() == wxID_OK) {
|
||||
wxBusyCursor busy;
|
||||
setSet(import_set(dlg.GetPath()));
|
||||
SetP new_set = import_set(dlg.GetPath());
|
||||
switchSet(new_set);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -579,7 +590,7 @@ void SetWindow::onFileReload(wxCommandEvent&) {
|
||||
|
||||
void SetWindow::onFileRecent(wxCommandEvent& ev) {
|
||||
wxBusyCursor busy;
|
||||
setSet(import_set(settings.recent_sets.at(ev.GetId() - ID_FILE_RECENT)));
|
||||
switchSet(import_set(settings.recent_sets.at(ev.GetId() - ID_FILE_RECENT)));
|
||||
}
|
||||
|
||||
void SetWindow::onFileExit(wxCommandEvent&) {
|
||||
|
||||
Reference in New Issue
Block a user