'initial' property for color fields;

export options stored in settings;
editor for export options.

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@429 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2007-06-23 19:44:50 +00:00
parent e46cbe66b2
commit df9bb78e51
17 changed files with 88 additions and 27 deletions
+1 -1
View File
@@ -19,7 +19,7 @@ DEFINE_EVENT_TYPE(EVENT_SIZE_CHANGE);
// ----------------------------------------------------------------------------- : CardViewer
CardViewer::CardViewer(Window* parent, int id, long style)
: wxControl(parent, id, wxDefaultPosition, wxDefaultSize, style)
: wxControl(parent, id, wxDefaultPosition, wxDefaultSize, style | wxNO_FULL_REPAINT_ON_RESIZE)
, up_to_date(false)
{}
+14
View File
@@ -10,6 +10,8 @@
#include <gui/value/editor.hpp>
#include <gui/util.hpp>
#include <data/stylesheet.hpp>
#include <data/export_template.hpp>
#include <data/settings.hpp>
DECLARE_TYPEOF_COLLECTION(ValueViewerP);
DECLARE_TYPEOF_NO_REV(IndexMap<FieldP COMMA StyleP>);
@@ -199,3 +201,15 @@ void StylingEditor::showStylesheet(const StyleSheetP& stylesheet) {
void StylingEditor::onChangeSet() {
showStylesheet(set->stylesheet);
}
// ----------------------------------------------------------------------------- : ExportOptionsEditor
ExportOptionsEditor::ExportOptionsEditor(Window* parent, int id, long style)
: NativeLookEditor(parent, id, style)
{}
void ExportOptionsEditor::showExport(const ExportTemplateP& export) {
setStyles(set->stylesheet, export->option_style);
setData(settings.exportOptionsFor(*export));
}
-3
View File
@@ -84,9 +84,6 @@ class ExportOptionsEditor : public NativeLookEditor {
/// Show the options for given export template
void showExport(const ExportTemplateP& export);
protected:
virtual void onChangeSet();
};
// ----------------------------------------------------------------------------- : EOF
+10 -2
View File
@@ -8,6 +8,7 @@
#include <gui/html_export_window.hpp>
#include <gui/control/package_list.hpp>
#include <gui/control/native_look_editor.hpp>
#include <data/set.hpp>
#include <data/game.hpp>
#include <data/settings.hpp>
@@ -20,18 +21,24 @@ 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)
: 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);
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<ExportTemplate>(set->game->name() + _("-*"));
list->select(settings.gameSettingsFor(*set->game).default_export);
@@ -57,6 +64,7 @@ void HtmlExportWindow::onTemplateSelect(wxCommandEvent&) {
wxBusyCursor wait;
ExportTemplateP export = list->getSelection<ExportTemplate>();
handle_pending_errors();
options->showExport(export);
settings.gameSettingsFor(*set->game).default_export = export->name();
UpdateWindowUI(wxUPDATE_UI_RECURSE);
}
+4 -2
View File
@@ -12,6 +12,7 @@
#include <util/prec.hpp>
class PackageList;
class ExportOptionsEditor;
DECLARE_POINTER_TYPE(Set);
// ----------------------------------------------------------------------------- : HtmlExportWindow
@@ -21,8 +22,9 @@ class HtmlExportWindow : public wxDialog {
HtmlExportWindow(Window* parent, const SetP& set);
private:
PackageList* list; ///< List of templates
SetP set; ///< Set to export
PackageList* list; ///< List of templates
ExportOptionsEditor* options; ///< Editor for template options
SetP set; ///< Set to export
DECLARE_EVENT_TABLE();
+2 -2
View File
@@ -26,14 +26,14 @@ StylePanel::StylePanel(Window* parent, int id)
preview = new CardViewer (this, wxID_ANY);
editor = new StylingEditor(this, wxID_ANY, wxNO_BORDER);
list = new PackageList (this, wxID_ANY);
use_for_all = new wxButton (this, ID_STYLE_USE_FOR_ALL, _("Use for &all cards"));
use_for_all = new wxButton (this, ID_STYLE_USE_FOR_ALL, _BUTTON_("use for all cards"));
// init sizer
wxSizer* s = new wxBoxSizer(wxHORIZONTAL);
s->Add(preview, 0, wxRIGHT, 2);
wxSizer* s2 = new wxBoxSizer(wxVERTICAL);
s2->Add(list, 0, wxEXPAND | wxBOTTOM, 4);
s2->Add(use_for_all, 0, wxRIGHT | wxBOTTOM | wxALIGN_RIGHT, 4);
wxSizer* s3 = new wxStaticBoxSizer(wxVERTICAL, this, _("Extra styling options"));
wxSizer* s3 = new wxStaticBoxSizer(wxVERTICAL, this, _LABEL_("styling options"));
s3->Add(editor, 2, wxEXPAND, 0);
s2->Add(s3, 1, wxEXPAND | wxALL, 2);
s->Add(s2, 1, wxEXPAND, 8);