mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
Fixed 'use zoom and rotation settings when exporting';
Fixed: enabled was not used for default symbol in symbol font; git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@640 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <data/format/formats.hpp>
|
||||
#include <data/set.hpp>
|
||||
#include <data/stylesheet.hpp>
|
||||
#include <data/settings.hpp>
|
||||
#include <render/card/viewer.hpp>
|
||||
|
||||
@@ -19,17 +20,30 @@ void export_image(const SetP& set, const CardP& card, const String& filename) {
|
||||
// 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) {
|
||||
// create viewer
|
||||
DataViewer viewer;
|
||||
UnzoomedDataViewer viewer(!settings.stylesheetSettingsFor(set->stylesheetFor(card)).card_normal_export());
|
||||
viewer.setSet(set);
|
||||
viewer.setCard(card);
|
||||
// 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();
|
||||
// create bitmap & dc
|
||||
Bitmap bitmap((int) size.width, (int) size.height);
|
||||
|
||||
@@ -217,7 +217,7 @@ next_symbol:;
|
||||
|
||||
SymbolInFont* SymbolFont::defaultSymbol() const {
|
||||
FOR_EACH_CONST(sym, symbols) {
|
||||
if (sym->code.empty()) return sym.get();
|
||||
if (sym->code.empty() && sym->enabled) return sym.get();
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -115,6 +115,13 @@ void GalleryList::onChar(wxKeyEvent& ev) {
|
||||
update();
|
||||
sendEvent(EVENT_GALLERY_SELECT);
|
||||
} 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
|
||||
// ----------------------------------------------------------------------------- : StatsPanel
|
||||
|
||||
StatsPanel::StatsPanel(Window* parent, int id)
|
||||
: SetWindowPanel(parent, id)
|
||||
: SetWindowPanel(parent, id, true)
|
||||
, up_to_date(true), active(false)
|
||||
{
|
||||
// init controls
|
||||
|
||||
@@ -29,9 +29,8 @@ DataViewer::~DataViewer() {}
|
||||
|
||||
void DataViewer::draw(DC& dc) {
|
||||
StyleSheetSettings& ss = settings.stylesheetSettingsFor(*stylesheet);
|
||||
RotatedDC rdc(dc, ss.card_angle(), stylesheet->getCardRect(), ss.card_zoom(),
|
||||
nativeLook() ? QUALITY_LOW : (ss.card_anti_alias() ? QUALITY_AA : QUALITY_SUB_PIXEL),
|
||||
true);
|
||||
RotatedDC rdc(dc, getRotation(),
|
||||
nativeLook() ? QUALITY_LOW : (ss.card_anti_alias() ? QUALITY_AA : QUALITY_SUB_PIXEL));
|
||||
draw(rdc, stylesheet->card_background);
|
||||
}
|
||||
void DataViewer::draw(RotatedDC& dc, const Color& background) {
|
||||
@@ -105,7 +104,7 @@ Context& DataViewer::getContext() const { return set->getContext(card); }
|
||||
Rotation DataViewer::getRotation() const {
|
||||
if (!stylesheet) stylesheet = set->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
|
||||
|
||||
@@ -78,7 +78,7 @@ Context& SetScriptContext::getContext(const CardP& card) {
|
||||
ctx.setVariable(_("card"), to_script(card));
|
||||
ctx.setVariable(_("styling"), to_script(&set.stylingDataFor(card)));
|
||||
} else {
|
||||
ctx.setVariable(_("card"), ScriptValueP());
|
||||
ctx.setVariable(_("card"), script_nil);
|
||||
ctx.setVariable(_("styling"), to_script(&set.stylingDataFor(*stylesheet)));
|
||||
}
|
||||
return ctx;
|
||||
|
||||
Reference in New Issue
Block a user