Commit 6528c3d6 authored by twanvl's avatar twanvl

"Reload data" option

parent 329974b2
...@@ -16,6 +16,7 @@ menu: ...@@ -16,6 +16,7 @@ menu:
export mws: Magic &Workstation... export mws: Magic &Workstation...
print preview: Print Pre&view... print preview: Print Pre&view...
print: &Print... Ctrl+P print: &Print... Ctrl+P
reload data: Reload Data Ctrl+F5
exit: E&xit Alt+F4 exit: E&xit Alt+F4
edit: &Edit edit: &Edit
...@@ -103,6 +104,7 @@ help: ...@@ -103,6 +104,7 @@ help:
export mws: Export the set so it can be played with in Magic Workstation export mws: Export the set so it can be played with in Magic Workstation
print preview: Shows cards as they will be printed print preview: Shows cards as they will be printed
print: Print cards from this set 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 exit: Quits Magic Set Editor; prompts to save the set
edit: edit:
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <gui/images_export_window.hpp> #include <gui/images_export_window.hpp>
#include <gui/icon_menu.hpp> #include <gui/icon_menu.hpp>
#include <gui/util.hpp> #include <gui/util.hpp>
#include <util/io/package_manager.hpp>
#include <util/window_id.hpp> #include <util/window_id.hpp>
#include <data/game.hpp> #include <data/game.hpp>
#include <data/set.hpp> #include <data/set.hpp>
...@@ -63,6 +64,8 @@ SetWindow::SetWindow(Window* parent, const SetP& set) ...@@ -63,6 +64,8 @@ SetWindow::SetWindow(Window* parent, const SetP& set)
menuFile->AppendSeparator(); menuFile->AppendSeparator();
// menuFile->Append(ID_FILE_INSPECT, _("Inspect Internal Data..."), _("Shows a the data in the set using a tree structure")); // menuFile->Append(ID_FILE_INSPECT, _("Inspect Internal Data..."), _("Shows a the data in the set using a tree structure"));
// menuFile->AppendSeparator(); // 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_PREVIEW, _MENU_("print preview"), _HELP_("print preview"));
menuFile->Append(ID_FILE_PRINT, _MENU_("print"), _HELP_("print")); menuFile->Append(ID_FILE_PRINT, _MENU_("print"), _HELP_("print"));
menuFile->AppendSeparator(); menuFile->AppendSeparator();
...@@ -396,7 +399,7 @@ void SetWindow::onFileNew(wxCommandEvent&) { ...@@ -396,7 +399,7 @@ void SetWindow::onFileNew(wxCommandEvent&) {
} }
void SetWindow::onFileOpen(wxCommandEvent&) { void SetWindow::onFileOpen(wxCommandEvent&) {
if (!askSaveAndContinue()) return; if (!askSaveAndContinue()) return;
wxFileDialog dlg(this, _TITLE_("open set"), _(""), _(""), import_formats(), wxOPEN); wxFileDialog dlg(this, _TITLE_("open set"), _(""), _(""), import_formats(), wxOPEN);
if (dlg.ShowModal() == wxID_OK) { if (dlg.ShowModal() == wxID_OK) {
setSet(import_set(dlg.GetPath())); setSet(import_set(dlg.GetPath()));
...@@ -473,6 +476,15 @@ void SetWindow::onFilePrintPreview(wxCommandEvent&) { ...@@ -473,6 +476,15 @@ void SetWindow::onFilePrintPreview(wxCommandEvent&) {
print_preview(this, set); 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) { void SetWindow::onFileRecent(wxCommandEvent& ev) {
setSet(import_set(settings.recent_sets.at(ev.GetId() - ID_FILE_RECENT))); setSet(import_set(settings.recent_sets.at(ev.GetId() - ID_FILE_RECENT)));
} }
...@@ -593,6 +605,7 @@ BEGIN_EVENT_TABLE(SetWindow, wxFrame) ...@@ -593,6 +605,7 @@ BEGIN_EVENT_TABLE(SetWindow, wxFrame)
// EVT_MENU (ID_FILE_INSPECT, SetWindow::onFileInspect) // EVT_MENU (ID_FILE_INSPECT, SetWindow::onFileInspect)
EVT_MENU (ID_FILE_PRINT, SetWindow::onFilePrint) EVT_MENU (ID_FILE_PRINT, SetWindow::onFilePrint)
EVT_MENU (ID_FILE_PRINT_PREVIEW, SetWindow::onFilePrintPreview) 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_RANGE (ID_FILE_RECENT, ID_FILE_RECENT_MAX, SetWindow::onFileRecent)
EVT_MENU (ID_FILE_EXIT, SetWindow::onFileExit) EVT_MENU (ID_FILE_EXIT, SetWindow::onFileExit)
EVT_MENU (ID_EDIT_UNDO, SetWindow::onEditUndo) EVT_MENU (ID_EDIT_UNDO, SetWindow::onEditUndo)
......
...@@ -111,6 +111,7 @@ class SetWindow : public wxFrame, public SetView { ...@@ -111,6 +111,7 @@ class SetWindow : public wxFrame, public SetView {
void onFileExportMWS (wxCommandEvent&); void onFileExportMWS (wxCommandEvent&);
void onFilePrint (wxCommandEvent&); void onFilePrint (wxCommandEvent&);
void onFilePrintPreview (wxCommandEvent&); void onFilePrintPreview (wxCommandEvent&);
void onFileReload (wxCommandEvent&);
void onFileRecent (wxCommandEvent&); void onFileRecent (wxCommandEvent&);
void onFileExit (wxCommandEvent&); void onFileExit (wxCommandEvent&);
......
...@@ -38,6 +38,7 @@ enum MenuID { ...@@ -38,6 +38,7 @@ enum MenuID {
, ID_FILE_PRINT = wxID_PRINT , ID_FILE_PRINT = wxID_PRINT
, ID_FILE_PRINT_PREVIEW = wxID_PREVIEW , ID_FILE_PRINT_PREVIEW = wxID_PREVIEW
, ID_FILE_INSPECT = 8 , ID_FILE_INSPECT = 8
, ID_FILE_RELOAD = 9
, ID_FILE_RECENT = wxID_FILE1 , ID_FILE_RECENT = wxID_FILE1
, ID_FILE_RECENT_MAX = wxID_FILE9 , ID_FILE_RECENT_MAX = wxID_FILE9
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment