mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
Reduce coupling between ValueEditors/Viewers and Set and StyleSheet.
- Adding of actions is done with an addAction function
- Files are read from
- getStylePackage for styling stuff (this is stylesheet)
- getLocalPackage for symbol and image values (this was the set)
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@970 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -9,8 +9,6 @@
|
||||
#include <util/prec.hpp>
|
||||
#include <render/value/image.hpp>
|
||||
#include <render/card/viewer.hpp>
|
||||
#include <data/set.hpp>
|
||||
#include <data/stylesheet.hpp>
|
||||
#include <gui/util.hpp>
|
||||
|
||||
DECLARE_TYPEOF_COLLECTION(wxPoint);
|
||||
@@ -35,7 +33,7 @@ void ImageValueViewer::draw(RotatedDC& dc) {
|
||||
// load from file
|
||||
if (!value().filename.empty()) {
|
||||
try {
|
||||
InputStreamP image_file = getSet().openIn(value().filename);
|
||||
InputStreamP image_file = getLocalPackage().openIn(value().filename);
|
||||
if (image.LoadFile(*image_file)) {
|
||||
image.Rescale(w, h);
|
||||
}
|
||||
@@ -45,7 +43,7 @@ void ImageValueViewer::draw(RotatedDC& dc) {
|
||||
}
|
||||
// nice placeholder
|
||||
if (!image.Ok() && style().default_image.isReady()) {
|
||||
image = style().default_image.generate(GeneratedImage::Options(w, h, viewer.stylesheet.get(), &getSet()));
|
||||
image = style().default_image.generate(GeneratedImage::Options(w, h, &getStylePackage(), &getLocalPackage()));
|
||||
is_default = true;
|
||||
if (viewer.drawEditing()) {
|
||||
bitmap = imagePlaceholder(dc, w, h, image, viewer.drawEditing());
|
||||
@@ -127,7 +125,7 @@ void ImageValueViewer::loadMask(const Rotation& rot) const {
|
||||
if (alpha_mask && alpha_mask->size == wxSize(w,h)) return; // mask loaded and right size
|
||||
// (re) load the mask
|
||||
Image image;
|
||||
InputStreamP image_file = viewer.stylesheet->openIn(style().mask_filename);
|
||||
InputStreamP image_file = getStylePackage().openIn(style().mask_filename);
|
||||
if (image.LoadFile(*image_file)) {
|
||||
alpha_mask = new_intrusive1<AlphaMask>(resample(image,w,h));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user