//+----------------------------------------------------------------------------+ //| Description: Magic Set Editor - Program to make Magic (tm) cards | //| Copyright: (C) 2001 - 2007 Twan van Laarhoven | //| License: GNU General Public License 2 or later (see file COPYING) | //+----------------------------------------------------------------------------+ // ----------------------------------------------------------------------------- : Includes #include #include #include #include #include #include #include #include #include DECLARE_POINTER_TYPE(ExportTemplate); // ----------------------------------------------------------------------------- : HtmlExportWindow HtmlExportWindow::HtmlExportWindow(Window* parent, const SetP& set) : wxDialog(parent,wxID_ANY,_TITLE_("export html"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxCLIP_CHILDREN) , set(set) { // init controls list = new PackageList(this, ID_EXPORT_LIST); options = new ExportOptionsEditor(this, wxID_ANY, wxNO_BORDER); options->setSet(set); // init sizers wxSizer* s = new wxBoxSizer(wxVERTICAL); s->Add(new wxStaticText(this, wxID_ANY, _LABEL_("html template")), 0, wxALL, 4); s->Add(list, 0, wxEXPAND | wxALL & ~wxTOP, 4); wxSizer* s2 = new wxStaticBoxSizer(wxVERTICAL, this, _LABEL_("html export options")); s2->Add(options, 2, wxEXPAND, 0); s->Add(s2, 1, wxEXPAND | wxALL, 4); s->Add(CreateButtonSizer(wxOK | wxCANCEL) , 0, wxEXPAND | wxALL, 8); s->SetSizeHints(this); SetSizer(s); SetSize(700,500); // list list->showData(set->game->name() + _("-*")); list->select(settings.gameSettingsFor(*set->game).default_export); } void HtmlExportWindow::onOk(wxCommandEvent&) { handle_error(Error(_("HTML export is not implemented yet, sorry"))); /*;//%% String name = fileSelector(_("Exort to html"),_(""),_(""),_(""), { _("HTML files (*.html)|*.html"), wxSAVE | wxOVERWRITE_PROMPT); } if (!name.empty()) { HtmlExportWindow wnd(&this, set, name); wnd.showModal(); } */ // Done EndModal(wxID_OK); } void HtmlExportWindow::onTemplateSelect(wxCommandEvent&) { wxBusyCursor wait; ExportTemplateP export = list->getSelection(); handle_pending_errors(); options->showExport(export); settings.gameSettingsFor(*set->game).default_export = export->name(); UpdateWindowUI(wxUPDATE_UI_RECURSE); } void HtmlExportWindow::onUpdateUI(wxUpdateUIEvent& ev) { switch (ev.GetId()) { case wxID_OK: ev.Enable(list->hasSelection()); break; } } BEGIN_EVENT_TABLE(HtmlExportWindow,wxDialog) EVT_GALLERY_SELECT (ID_EXPORT_LIST, HtmlExportWindow::onTemplateSelect) EVT_BUTTON (wxID_OK, HtmlExportWindow::onOk) EVT_UPDATE_UI (wxID_ANY, HtmlExportWindow::onUpdateUI) END_EVENT_TABLE ()