Fixed some bugs to make GCC work. I needed to change SimpleValueAction to take the function as a variable as opposed to a template parameter - GCC won't accept pointers from a base class in templates.

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@231 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
coppro
2007-03-23 00:57:06 +00:00
parent 0fbd417057
commit 851799d1b6
27 changed files with 215 additions and 129 deletions
+9 -7
View File
@@ -25,11 +25,12 @@ String ValueAction::getName(bool to_undo) const {
// ----------------------------------------------------------------------------- : Simple
/// A ValueAction that swaps between old and new values
template <typename T, typename T::ValueType T::*member, bool ALLOW_MERGE>
template <typename T, bool ALLOW_MERGE>
class SimpleValueAction : public ValueAction {
public:
inline SimpleValueAction(const shared_ptr<T>& value, const typename T::ValueType& new_value)
inline SimpleValueAction(const shared_ptr<T>& value, const typename T::ValueType& new_value, typename T::ValueType T::*member)
: ValueAction(value), new_value(new_value)
, member(member)
{}
virtual void perform(bool to_undo) {
@@ -50,13 +51,14 @@ class SimpleValueAction : public ValueAction {
private:
typename T::ValueType new_value;
typename T::ValueType T::*member;
};
ValueAction* value_action(const ChoiceValueP& value, const Defaultable<String>& new_value) { return new SimpleValueAction<ChoiceValue, &ChoiceValue::value, true> (value, new_value); }
ValueAction* value_action(const MultipleChoiceValueP& value, const Defaultable<String>& new_value) { return new SimpleValueAction<MultipleChoiceValue, &MultipleChoiceValue::value, false>(value, new_value); }
ValueAction* value_action(const ColorValueP& value, const Defaultable<Color>& new_value) { return new SimpleValueAction<ColorValue, &ColorValue::value, true> (value, new_value); }
ValueAction* value_action(const ImageValueP& value, const FileName& new_value) { return new SimpleValueAction<ImageValue, &ImageValue::filename, false>(value, new_value); }
ValueAction* value_action(const SymbolValueP& value, const FileName& new_value) { return new SimpleValueAction<SymbolValue, &SymbolValue::filename, false>(value, new_value); }
ValueAction* value_action(const ChoiceValueP& value, const Defaultable<String>& new_value) { return new SimpleValueAction<ChoiceValue, true> (value, new_value, &ChoiceValue::value); }
ValueAction* value_action(const MultipleChoiceValueP& value, const Defaultable<String>& new_value) { return new SimpleValueAction<MultipleChoiceValue, false>(value, new_value, &MultipleChoiceValue::value); }
ValueAction* value_action(const ColorValueP& value, const Defaultable<Color>& new_value) { return new SimpleValueAction<ColorValue, true> (value, new_value, &ColorValue::value); }
ValueAction* value_action(const ImageValueP& value, const FileName& new_value) { return new SimpleValueAction<ImageValue, false>(value, new_value, &ImageValue::filename); }
ValueAction* value_action(const SymbolValueP& value, const FileName& new_value) { return new SimpleValueAction<SymbolValue, false>(value, new_value, &SymbolValue::filename); }
// ----------------------------------------------------------------------------- : Text
+1 -1
View File
@@ -48,7 +48,7 @@ void reflect_font(Reader& tag, Font& font) {
REFLECT(weight);
REFLECT(style);
if (!name.empty()) font.font.SetFaceName(name);
if (size > 0) font.font.SetPointSize(font.size = size);
if (size > 0) font.font.SetPointSize((int) (font.size = size));
if (!weight.empty()) font.font.SetWeight(weight == _("bold") ? wxBOLD : wxNORMAL);
if (!style.empty()) font.font.SetWeight(style == _("italic") ? wxITALIC : wxNORMAL);
}
+1 -1
View File
@@ -34,7 +34,7 @@ Bitmap export_bitmap(const SetP& set, const CardP& card) {
}
RealSize size = viewer.getRotation().getExternalSize();
// create bitmap & dc
Bitmap bitmap(size.width, size.height);
Bitmap bitmap((int) size.width, (int) size.height);
if (!bitmap.Ok()) throw InternalError(_("Unable to create bitmap"));
wxMemoryDC dc;
dc.SelectObject(bitmap);
+2 -2
View File
@@ -21,8 +21,8 @@ DECLARE_TYPEOF_COLLECTION(StatsDimensionP);
IMPLEMENT_DYNAMIC_ARG(Game*, game_for_reading, nullptr);
Game::Game()
: dependencies_initialized(false)
, has_keywords(false)
: has_keywords(false)
, dependencies_initialized(false)
{}
GameP Game::byName(const String& name) {
+5 -5
View File
@@ -99,8 +99,8 @@ class SymbolInFont {
};
SymbolInFont::SymbolInFont()
: actual_size(0,0)
, enabled(true)
: enabled(true)
, actual_size(0,0)
{
assert(symbol_font_for_reading());
img_size = symbol_font_for_reading()->img_size;
@@ -118,8 +118,8 @@ Bitmap SymbolInFont::getBitmap(Context& ctx, Package& pkg, double size) {
Image img = image.generate(ctx, pkg)->image;
actual_size = wxSize(img.GetWidth(), img.GetHeight());
// scale to match expected size
Image resampled_image(actual_size.GetWidth() * size / img_size,
actual_size.GetHeight() * size / img_size, false);
Image resampled_image((int) (actual_size.GetWidth() * size / img_size),
(int) (actual_size.GetHeight() * size / img_size), false);
if (!resampled_image.Ok()) return Bitmap(1,1);
resample(img, resampled_image);
// convert to bitmap, store for later use
@@ -145,7 +145,7 @@ RealSize SymbolInFont::size(Context& ctx, Package& pkg, double size) {
// we don't know what size the image will be
getBitmap(ctx, pkg, size);
}
return wxSize(actual_size * size / img_size);
return wxSize(actual_size * (int) (size) / (int) (img_size));
}
void SymbolInFont::update(Context& ctx) {