Commit b25ced1a authored by twanvl's avatar twanvl

Fixed 'use zoom and rotation settings when exporting';

Fixed: enabled was not used for default symbol in symbol font;
parent a240ba1e
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include <data/format/formats.hpp> #include <data/format/formats.hpp>
#include <data/set.hpp> #include <data/set.hpp>
#include <data/stylesheet.hpp>
#include <data/settings.hpp> #include <data/settings.hpp>
#include <render/card/viewer.hpp> #include <render/card/viewer.hpp>
...@@ -19,17 +20,30 @@ void export_image(const SetP& set, const CardP& card, const String& filename) { ...@@ -19,17 +20,30 @@ void export_image(const SetP& set, const CardP& card, const String& filename) {
// but image.saveFile determines it automagicly // but image.saveFile determines it automagicly
} }
class UnzoomedDataViewer : public DataViewer {
public:
UnzoomedDataViewer(bool use_zoom_settings)
: use_zoom_settings(use_zoom_settings)
{}
virtual Rotation getRotation() const;
private:
bool use_zoom_settings;
};
Rotation UnzoomedDataViewer::getRotation() const {
if (use_zoom_settings) {
return DataViewer::getRotation();
} else {
if (!stylesheet) stylesheet = set->stylesheet;
return Rotation(0, stylesheet->getCardRect(), 1.0, 1.0, true);
}
}
Bitmap export_bitmap(const SetP& set, const CardP& card) { Bitmap export_bitmap(const SetP& set, const CardP& card) {
// create viewer // create viewer
DataViewer viewer; UnzoomedDataViewer viewer(!settings.stylesheetSettingsFor(set->stylesheetFor(card)).card_normal_export());
viewer.setSet(set); viewer.setSet(set);
viewer.setCard(card); viewer.setCard(card);
// size of cards // size of cards
if (settings.stylesheetSettingsFor(set->stylesheetFor(card)).card_normal_export()) {
// TODO
// viewer.rotation.angle = 0;
// viewer.rotation.zoom = 1.0;
}
RealSize size = viewer.getRotation().getExternalSize(); RealSize size = viewer.getRotation().getExternalSize();
// create bitmap & dc // create bitmap & dc
Bitmap bitmap((int) size.width, (int) size.height); Bitmap bitmap((int) size.width, (int) size.height);
......
...@@ -217,7 +217,7 @@ next_symbol:; ...@@ -217,7 +217,7 @@ next_symbol:;
SymbolInFont* SymbolFont::defaultSymbol() const { SymbolInFont* SymbolFont::defaultSymbol() const {
FOR_EACH_CONST(sym, symbols) { FOR_EACH_CONST(sym, symbols) {
if (sym->code.empty()) return sym.get(); if (sym->code.empty() && sym->enabled) return sym.get();
} }
return nullptr; return nullptr;
} }
......
...@@ -115,6 +115,13 @@ void GalleryList::onChar(wxKeyEvent& ev) { ...@@ -115,6 +115,13 @@ void GalleryList::onChar(wxKeyEvent& ev) {
update(); update();
sendEvent(EVENT_GALLERY_SELECT); sendEvent(EVENT_GALLERY_SELECT);
} break; } break;
case WXK_TAB: {
// send a navigation event to our parent, to select another control
// we need this because tabs are not handled on the set window panels
wxNavigationKeyEvent nev;
nev.SetDirection(!ev.ShiftDown());
GetParent()->ProcessEvent(nev);
} break;
} }
} }
......
...@@ -97,7 +97,7 @@ void StatCategoryList::drawItem(DC& dc, int x, int y, size_t item, bool selected ...@@ -97,7 +97,7 @@ void StatCategoryList::drawItem(DC& dc, int x, int y, size_t item, bool selected
// ----------------------------------------------------------------------------- : StatsPanel // ----------------------------------------------------------------------------- : StatsPanel
StatsPanel::StatsPanel(Window* parent, int id) StatsPanel::StatsPanel(Window* parent, int id)
: SetWindowPanel(parent, id) : SetWindowPanel(parent, id, true)
, up_to_date(true), active(false) , up_to_date(true), active(false)
{ {
// init controls // init controls
......
...@@ -29,9 +29,8 @@ DataViewer::~DataViewer() {} ...@@ -29,9 +29,8 @@ DataViewer::~DataViewer() {}
void DataViewer::draw(DC& dc) { void DataViewer::draw(DC& dc) {
StyleSheetSettings& ss = settings.stylesheetSettingsFor(*stylesheet); StyleSheetSettings& ss = settings.stylesheetSettingsFor(*stylesheet);
RotatedDC rdc(dc, ss.card_angle(), stylesheet->getCardRect(), ss.card_zoom(), RotatedDC rdc(dc, getRotation(),
nativeLook() ? QUALITY_LOW : (ss.card_anti_alias() ? QUALITY_AA : QUALITY_SUB_PIXEL), nativeLook() ? QUALITY_LOW : (ss.card_anti_alias() ? QUALITY_AA : QUALITY_SUB_PIXEL));
true);
draw(rdc, stylesheet->card_background); draw(rdc, stylesheet->card_background);
} }
void DataViewer::draw(RotatedDC& dc, const Color& background) { void DataViewer::draw(RotatedDC& dc, const Color& background) {
...@@ -105,7 +104,7 @@ Context& DataViewer::getContext() const { return set->getContext(card); } ...@@ -105,7 +104,7 @@ Context& DataViewer::getContext() const { return set->getContext(card); }
Rotation DataViewer::getRotation() const { Rotation DataViewer::getRotation() const {
if (!stylesheet) stylesheet = set->stylesheet; if (!stylesheet) stylesheet = set->stylesheet;
StyleSheetSettings& ss = settings.stylesheetSettingsFor(*stylesheet); StyleSheetSettings& ss = settings.stylesheetSettingsFor(*stylesheet);
return Rotation(ss.card_angle(), stylesheet->getCardRect(), ss.card_zoom(), true); return Rotation(ss.card_angle(), stylesheet->getCardRect(), ss.card_zoom(), 1.0, true);
} }
// ----------------------------------------------------------------------------- : Setting data // ----------------------------------------------------------------------------- : Setting data
......
...@@ -78,7 +78,7 @@ Context& SetScriptContext::getContext(const CardP& card) { ...@@ -78,7 +78,7 @@ Context& SetScriptContext::getContext(const CardP& card) {
ctx.setVariable(_("card"), to_script(card)); ctx.setVariable(_("card"), to_script(card));
ctx.setVariable(_("styling"), to_script(&set.stylingDataFor(card))); ctx.setVariable(_("styling"), to_script(&set.stylingDataFor(card)));
} else { } else {
ctx.setVariable(_("card"), ScriptValueP()); ctx.setVariable(_("card"), script_nil);
ctx.setVariable(_("styling"), to_script(&set.stylingDataFor(*stylesheet))); ctx.setVariable(_("styling"), to_script(&set.stylingDataFor(*stylesheet)));
} }
return ctx; return ctx;
......
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