diff --git a/data/en.mse-locale/locale b/data/en.mse-locale/locale index b2ba60fe..0af49a6c 100644 --- a/data/en.mse-locale/locale +++ b/data/en.mse-locale/locale @@ -16,6 +16,7 @@ menu: export mws: Magic &Workstation... print preview: Print Pre&view... print: &Print... Ctrl+P + reload data: Reload Data Ctrl+F5 exit: E&xit Alt+F4 edit: &Edit @@ -103,6 +104,7 @@ help: export mws: Export the set so it can be played with in Magic Workstation print preview: Shows cards as they will be printed print: Print cards from this set + reload data: Reload all template files (game and style) as well as the set. exit: Quits Magic Set Editor; prompts to save the set edit: diff --git a/src/gui/set/window.cpp b/src/gui/set/window.cpp index 5207fd62..b7516f58 100644 --- a/src/gui/set/window.cpp +++ b/src/gui/set/window.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -63,6 +64,8 @@ SetWindow::SetWindow(Window* parent, const SetP& set) menuFile->AppendSeparator(); // menuFile->Append(ID_FILE_INSPECT, _("Inspect Internal Data..."), _("Shows a the data in the set using a tree structure")); // menuFile->AppendSeparator(); + menuFile->Append(ID_FILE_RELOAD, _MENU_("reload data"), _HELP_("reload data")); + menuFile->AppendSeparator(); menuFile->Append(ID_FILE_PRINT_PREVIEW, _MENU_("print preview"), _HELP_("print preview")); menuFile->Append(ID_FILE_PRINT, _MENU_("print"), _HELP_("print")); menuFile->AppendSeparator(); @@ -396,7 +399,7 @@ void SetWindow::onFileNew(wxCommandEvent&) { } void SetWindow::onFileOpen(wxCommandEvent&) { - if (!askSaveAndContinue()) return; + if (!askSaveAndContinue()) return; wxFileDialog dlg(this, _TITLE_("open set"), _(""), _(""), import_formats(), wxOPEN); if (dlg.ShowModal() == wxID_OK) { setSet(import_set(dlg.GetPath())); @@ -473,6 +476,15 @@ void SetWindow::onFilePrintPreview(wxCommandEvent&) { print_preview(this, set); } +void SetWindow::onFileReload(wxCommandEvent&) { + if (!askSaveAndContinue()) return; + String filename = set->absoluteFilename(); + if (filename.empty()) return; + wxBusyCursor busy; + packages.destroy(); // unload all packages + setSet(import_set(filename)); +} + void SetWindow::onFileRecent(wxCommandEvent& ev) { setSet(import_set(settings.recent_sets.at(ev.GetId() - ID_FILE_RECENT))); } @@ -593,6 +605,7 @@ BEGIN_EVENT_TABLE(SetWindow, wxFrame) // EVT_MENU (ID_FILE_INSPECT, SetWindow::onFileInspect) EVT_MENU (ID_FILE_PRINT, SetWindow::onFilePrint) EVT_MENU (ID_FILE_PRINT_PREVIEW, SetWindow::onFilePrintPreview) + EVT_MENU (ID_FILE_RELOAD, SetWindow::onFileReload) EVT_MENU_RANGE (ID_FILE_RECENT, ID_FILE_RECENT_MAX, SetWindow::onFileRecent) EVT_MENU (ID_FILE_EXIT, SetWindow::onFileExit) EVT_MENU (ID_EDIT_UNDO, SetWindow::onEditUndo) diff --git a/src/gui/set/window.hpp b/src/gui/set/window.hpp index 82a78c42..13a9655f 100644 --- a/src/gui/set/window.hpp +++ b/src/gui/set/window.hpp @@ -111,6 +111,7 @@ class SetWindow : public wxFrame, public SetView { void onFileExportMWS (wxCommandEvent&); void onFilePrint (wxCommandEvent&); void onFilePrintPreview (wxCommandEvent&); + void onFileReload (wxCommandEvent&); void onFileRecent (wxCommandEvent&); void onFileExit (wxCommandEvent&); diff --git a/src/util/window_id.hpp b/src/util/window_id.hpp index 23daeebb..e58f2af4 100644 --- a/src/util/window_id.hpp +++ b/src/util/window_id.hpp @@ -38,6 +38,7 @@ enum MenuID { , ID_FILE_PRINT = wxID_PRINT , ID_FILE_PRINT_PREVIEW = wxID_PREVIEW , ID_FILE_INSPECT = 8 +, ID_FILE_RELOAD = 9 , ID_FILE_RECENT = wxID_FILE1 , ID_FILE_RECENT_MAX = wxID_FILE9