thumbnails for choice editor

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@159 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2006-12-23 21:12:26 +00:00
parent 3883251961
commit 5bed5892f3
14 changed files with 238 additions and 47 deletions
+6 -1
View File
@@ -166,14 +166,19 @@ ChoiceStyle::ChoiceStyle(const ChoiceFieldP& field)
, combine(COMBINE_NORMAL)
, alignment(ALIGN_STRETCH)
, colors_card_list(false)
, thumbnails(nullptr)
{}
ChoiceStyle::~ChoiceStyle() {
delete thumbnails;
}
// TODO
/*
void ChoiceStyle::invalidate() {
// rebuild choice images
}
}
*/
bool ChoiceStyle::update(Context& ctx) {
// Don't update the choice images, leave that to invalidate()
+3
View File
@@ -115,6 +115,7 @@ class ChoiceStyle : public Style {
public:
ChoiceStyle(const ChoiceFieldP& field);
DECLARE_STYLE_TYPE(Choice);
~ChoiceStyle();
ChoicePopupStyle popup_style; ///< Style of popups/menus
ChoiceRenderStyle render_style; ///< Style of rendering
@@ -126,6 +127,8 @@ class ChoiceStyle : public Style {
ImageCombine combine; ///< Combining mode for drawing the images
Alignment alignment; ///< Alignment of images
Image mask; ///< The actual mask image
wxImageList* thumbnails; ///< Thumbnails for the choices
Age thumbnail_age; ///< Age the thumbnails were generated
/// Load the mask image, if it's not already done
void loadMask(Package& pkg);
+24
View File
@@ -48,15 +48,39 @@ Set::~Set() {}
Context& Set::getContext() {
assert(wxThread::IsMain());
return script_manager->getContext(stylesheet);
}
Context& Set::getContext(const CardP& card) {
assert(wxThread::IsMain());
return script_manager->getContext(card);
}
void Set::updateFor(const CardP& card) {
script_manager->updateStyles(card);
}
Context& Set::getContextForThumbnails() {
assert(!wxThread::IsMain());
if (!thumbnail_script_context) {
thumbnail_script_context.reset(new SetScriptContext(*this));
}
return thumbnail_script_context->getContext(stylesheet);
}
Context& Set::getContextForThumbnails(const CardP& card) {
assert(!wxThread::IsMain());
if (!thumbnail_script_context) {
thumbnail_script_context.reset(new SetScriptContext(*this));
}
return thumbnail_script_context->getContext(card);
}
Context& Set::getContextForThumbnails(const StyleSheetP& stylesheet) {
assert(!wxThread::IsMain());
if (!thumbnail_script_context) {
thumbnail_script_context.reset(new SetScriptContext(*this));
}
return thumbnail_script_context->getContext(stylesheet);
}
StyleSheetP Set::stylesheetFor(const CardP& card) {
if (card && card->stylesheet) return card->stylesheet;
else return stylesheet;
+3
View File
@@ -71,6 +71,9 @@ class Set : public Packaged {
/// A context for performing scripts on a particular card
/** Should only be used from the thumbnail thread! */
Context& getContextForThumbnails(const CardP& card);
/// A context for performing scripts on a particular stylesheet
/** Should only be used from the thumbnail thread! */
Context& getContextForThumbnails(const StyleSheetP& stylesheet);
/// Stylesheet to use for a particular card
/** card may be null */