mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 13:06:59 -04:00
Cleaned up Set::Styling/Card::Styling by spliting that functionality into a 'DelayedIndexMaps' class;
Added 'right' and 'bottom' properties to style as an alternative way of specifying width/height; Added content_width, content_height and content_lines properties that give feedback on text rendering; Always show warnings when showing errors and vice-versa, this prevents script errors from appearing before the reader/parse error that caused them; Finally some preliminairy work on export templates git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@428 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -8,16 +8,23 @@
|
||||
|
||||
#include <gui/html_export_window.hpp>
|
||||
#include <gui/control/package_list.hpp>
|
||||
#include <data/set.hpp>
|
||||
#include <data/game.hpp>
|
||||
#include <data/settings.hpp>
|
||||
#include <data/export_template.hpp>
|
||||
#include <util/window_id.hpp>
|
||||
#include <util/error.hpp>
|
||||
|
||||
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 | wxFULL_REPAINT_ON_RESIZE)
|
||||
, set(set)
|
||||
{
|
||||
// init controls
|
||||
list = new PackageList (this, wxID_ANY);
|
||||
list = new PackageList(this, ID_EXPORT_LIST);
|
||||
// init sizers
|
||||
wxSizer* s = new wxBoxSizer(wxVERTICAL);
|
||||
s->Add(new wxStaticText(this, wxID_ANY, _LABEL_("html template")), 0, wxALL, 4);
|
||||
@@ -25,6 +32,9 @@ HtmlExportWindow::HtmlExportWindow(Window* parent, const SetP& set)
|
||||
s->Add(CreateButtonSizer(wxOK | wxCANCEL) , 0, wxEXPAND | wxALL, 8);
|
||||
s->SetSizeHints(this);
|
||||
SetSizer(s);
|
||||
// list
|
||||
list->showData<ExportTemplate>(set->game->name() + _("-*"));
|
||||
list->select(settings.gameSettingsFor(*set->game).default_export);
|
||||
}
|
||||
|
||||
void HtmlExportWindow::onOk(wxCommandEvent&) {
|
||||
@@ -43,6 +53,24 @@ void HtmlExportWindow::onOk(wxCommandEvent&) {
|
||||
EndModal(wxID_OK);
|
||||
}
|
||||
|
||||
void HtmlExportWindow::onTemplateSelect(wxCommandEvent&) {
|
||||
wxBusyCursor wait;
|
||||
ExportTemplateP export = list->getSelection<ExportTemplate>();
|
||||
handle_pending_errors();
|
||||
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_BUTTON (wxID_OK, HtmlExportWindow::onOk)
|
||||
EVT_GALLERY_SELECT (ID_EXPORT_LIST, HtmlExportWindow::onTemplateSelect)
|
||||
EVT_BUTTON (wxID_OK, HtmlExportWindow::onOk)
|
||||
EVT_UPDATE_UI (wxID_ANY, HtmlExportWindow::onUpdateUI)
|
||||
END_EVENT_TABLE ()
|
||||
|
||||
Reference in New Issue
Block a user