Commit 0935fcf8 authored by coppro's avatar coppro

Fixed some bugs to make GCC work. I needed to change SimpleValueAction to take...

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.
parent d4914fae
This diff is collapsed.
......@@ -53,6 +53,8 @@ magicseteditor_SOURCES += ./src/gui/control/filtered_card_list.cpp
magicseteditor_SOURCES += ./src/gui/control/package_list.cpp
magicseteditor_SOURCES += ./src/gui/control/gallery_list.cpp
magicseteditor_SOURCES += ./src/gui/control/card_viewer.cpp
magicseteditor_SOURCES += ./src/gui/control/item_list.cpp
magicseteditor_SOURCES += ./src/gui/control/keyword_list.cpp
magicseteditor_SOURCES += ./src/gui/set/style_panel.cpp
magicseteditor_SOURCES += ./src/gui/set/panel.cpp
magicseteditor_SOURCES += ./src/gui/set/set_info_panel.cpp
......@@ -89,17 +91,17 @@ magicseteditor_SOURCES += ./src/gui/drop_down_list.cpp
magicseteditor_SOURCES += ./src/gui/image_slice_window.cpp
magicseteditor_SOURCES += ./src/script/script_manager.cpp
magicseteditor_SOURCES += ./src/script/script.cpp
magicseteditor_SOURCES += ./src/script/functions/basic.cpp
magicseteditor_SOURCES += ./src/script/functions/export.cpp
magicseteditor_SOURCES += ./src/script/functions/image.cpp
magicseteditor_SOURCES += ./src/script/functions/editor.cpp
magicseteditor_SOURCES += ./src/script/functions/english.cpp
magicseteditor_SOURCES += ./src/script/value.cpp
magicseteditor_SOURCES += ./src/script/dependency.cpp
magicseteditor_SOURCES += ./src/script/image.cpp
magicseteditor_SOURCES += ./src/script/context.cpp
magicseteditor_SOURCES += ./src/script/scriptable.cpp
magicseteditor_SOURCES += ./src/script/parser.cpp
magicseteditor_SOURCES += ./src/script/functions/basic.cpp
magicseteditor_SOURCES += ./src/script/functions/image.cpp
magicseteditor_SOURCES += ./src/script/functions/editor.cpp
magicseteditor_SOURCES += ./src/script/functions/export.cpp
magicseteditor_SOURCES += ./src/script/functions/english.cpp
magicseteditor_SOURCES += ./src/data/field/color.cpp
magicseteditor_SOURCES += ./src/data/field/boolean.cpp
magicseteditor_SOURCES += ./src/data/field/image.cpp
......@@ -134,6 +136,7 @@ magicseteditor_SOURCES += ./src/data/stylesheet.cpp
magicseteditor_SOURCES += ./src/data/statistics.cpp
magicseteditor_SOURCES += ./src/data/set.cpp
magicseteditor_SOURCES += ./src/data/symbol_font.cpp
magicseteditor_SOURCES += ./src/data/export_template.cpp
magicseteditor_SOURCES += ./src/util/io/get_member.cpp
magicseteditor_SOURCES += ./src/util/io/reader.cpp
magicseteditor_SOURCES += ./src/util/io/package_manager.cpp
......
......@@ -91,5 +91,5 @@
/* Define to rpl_malloc if the replacement function should be used. */
#undef malloc
/* Define to `unsigned' if <sys/types.h> does not define. */
/* Define to `unsigned int' if <sys/types.h> does not define. */
#undef size_t
......@@ -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
......
......@@ -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);
}
......
......@@ -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);
......
......@@ -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) {
......
......@@ -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) {
......
......@@ -67,8 +67,8 @@ END_EVENT_TABLE ()
HoverButton::HoverButton(Window* parent, int id, const String& name, const Color& background)
: wxControl(parent, id, wxDefaultPosition, wxDefaultSize, wxNO_BORDER )
, hover(false), focus(false), mouse_down(false), key_down(false)
, last_drawn(nullptr)
, background(background)
, last_drawn(nullptr)
{
loadBitmaps(name);
SetSize(DoGetBestSize());
......
......@@ -38,8 +38,8 @@ class GalleryList : public wxScrolledWindow {
static const size_t NO_SELECTION = (size_t)-1;
size_t selection; ///< The selected item, or NO_SELECTION if there is no selection
wxSize item_size; ///< The size of a single item
int scroll_increment; ///< How large are the scroll steps?
int direction; ///< Direction of the list, can be wxHORIZONTAL or wxVERTICAL
int scroll_increment; ///< How large are the scroll steps?
/// Redraw the list after changing the selection or the number of items
void update();
......
......@@ -16,8 +16,8 @@
SymbolBasicShapeEditor::SymbolBasicShapeEditor(SymbolControl* control)
: SymbolEditorBase(control)
, drawing(false)
, mode(ID_SHAPE_CIRCLE)
, drawing(false)
{
control->SetCursor(*wxCROSS_CURSOR);
}
......
......@@ -152,7 +152,7 @@ void SymbolControl::draw(DC& dc) {
wxSize s = dc.GetSize();
int lines = settings.symbol_grid_size;
for (int i = 0 ; i <= lines ; ++i) {
int x = rotation.trS((double)i/lines-0.0001);
int x = (int) rotation.trS(i/lines-0.0001);
//dc.SetPen(Color(0, i%5 == 0 ? 64 : 31, 0));
//dc.SetPen(Color(i%5 == 0 ? 64 : 31, 0, 0));
dc.SetLogicalFunction(wxAND);
......@@ -270,4 +270,4 @@ BEGIN_EVENT_TABLE(SymbolControl, wxControl)
EVT_KEY_UP (SymbolControl::onKeyChange)
EVT_KEY_DOWN (SymbolControl::onKeyChange)
EVT_CHAR (SymbolControl::onChar)
END_EVENT_TABLE ()
\ No newline at end of file
END_EVENT_TABLE ()
......@@ -85,13 +85,13 @@ Image load_resource_image(const String& name) {
char* data = (char *)::LockResource(hData);
if ( !data ) throw InternalError(String::Format(_("Resource cannot be locked: %s"), name));
int len = ::SizeofResource(wxGetInstance(), hResource);
wxMemoryInputStream stream(data, len);
return wxImage(stream);
#elif defined(__linux__)
static String path = wxStandardPaths::Get().GetDataDir() + _("/resource/");
String file = path + name; // if the name is in upper case, fix the call
String file = path + name;
wxImage resource;
if (wxFileExists(file + _(".png"))) resource.LoadFile(file + _(".png"));
else if (wxFileExists(file + _(".bmp"))) resource.LoadFile(file + _(".bmp"));
......
......@@ -186,7 +186,7 @@ void SymbolViewer::drawSymbolPart(const SymbolPart& part, DC* border, DC* interi
// white/black
border->SetBrush(Color(borderCol, borderCol, borderCol));
}
border->SetPen(wxPen(*wxWHITE, rotation.trS(border_radius)));
border->SetPen(wxPen(*wxWHITE, (int) rotation.trS(border_radius)));
border->DrawPolygon((int)points.size(), &points[0]);
}
// draw interior
......
......@@ -133,4 +133,4 @@ RealSize CompoundTextElement::charSize(RotatedDC& dc, double scale, size_t index
return elements.charSize(rot, scale, index);
}
*/
\ No newline at end of file
*/
......@@ -30,7 +30,7 @@ void ChoiceValueViewer::draw(RotatedDC& dc) {
i = img.update(viewer.getContext(), *viewer.stylesheet, 0, 0);
} else {
i = img.update(viewer.getContext(), *viewer.stylesheet,
dc.trS(style().width), dc.trS(style().height),
(int) dc.trS(style().width), (int) dc.trS(style().height),
style().alignment == ALIGN_STRETCH ? ASPECT_STRETCH : ASPECT_FIT
);
}
......
......@@ -70,7 +70,7 @@ void ImageValueViewer::onStyleChange() {
void ImageValueViewer::loadMask(const Rotation& rot) const {
if (style().mask_filename().empty()) return; // no mask
int w = rot.trS(style().width), h = rot.trS(style().height);
int w = (int) rot.trS(style().width), h = (int) rot.trS(style().height);
if (alpha_mask && alpha_mask->size == wxSize(w,h)) return; // mask loaded and right size
// (re) load the mask
Image image;
......
......@@ -30,7 +30,7 @@ void SymbolValueViewer::draw(RotatedDC& dc) {
// render and filter variations
FOR_EACH(variation, style().variations) {
Image img = render_symbol(symbol, *variation->filter, variation->border_radius);
Image resampled(wh, wh, false);
Image resampled((int) wh, (int) wh, false);
resample(img, resampled);
symbols.push_back(Bitmap(resampled));
}
......
......@@ -60,13 +60,13 @@ SCRIPT_FUNCTION(contains) {
SCRIPT_RULE_1(format, String, format) {
String fmt = _("%") + replace_all(format, _("%"), _(""));
// determine type expected by format string
if (format.find_first_of(_("DdIiOoXx")) != String.npos) {
if (format.find_first_of(_("DdIiOoXx")) != String::npos) {
SCRIPT_PARAM(int, input);
SCRIPT_RETURN(String::Format(fmt, input));
} else if (format.find_first_of(_("EeFfGg")) != String.npos) {
} else if (format.find_first_of(_("EeFfGg")) != String::npos) {
SCRIPT_PARAM(double, input);
SCRIPT_RETURN(String::Format(fmt, input));
} else if (format.find_first_of(_("Ss")) != String.npos) {
} else if (format.find_first_of(_("Ss")) != String::npos) {
SCRIPT_PARAM(String, input);
SCRIPT_RETURN(format_string(fmt, input));
} else {
......
......@@ -136,4 +136,4 @@ SCRIPT_FUNCTION_DEPENDENCIES(combined_editor) {
void init_script_editor_functions(Context& ctx) {
ctx.setVariable(_("forward editor"), script_combined_editor); // combatability
ctx.setVariable(_("combined editor"), script_combined_editor);
}
\ No newline at end of file
}
......@@ -33,6 +33,7 @@ String english_number(int i) {
case 18: return _("eighteen");
case 20: return _("twenty");
case 30: return _("thirty");
case 40: return _("forty");
case 50: return _("fifty");
case 80: return _("eighty");
default: {
......@@ -40,7 +41,7 @@ String english_number(int i) {
// number too large, keep as digits
return (String() << i);
} else if (i < 20) {
return english_number(i%10) + english_number(10);
return english_number(i%10) + _("teen");
} else if (i % 10 == 0) {
return english_number(i/10) + _("ty");
} else {
......
......@@ -205,7 +205,7 @@ inline ScriptValueP to_script(long v) { return to_script((int) v); }
ScriptValueP to_script(double v);
ScriptValueP to_script(const String& v);
ScriptValueP to_script(const Color& v);
inline ScriptValueP to_script(bool v) { return v ? script_true : script_false; }
inline ScriptValueP to_script(bool v) { return v ? script_true : script_false; }
template <typename T>
inline ScriptValueP to_script(const vector<T>* v) { return new_intrusive1<ScriptCollection<vector<T> > >(v); }
template <typename K, typename V>
......
......@@ -245,21 +245,21 @@ class ScriptCustomCollectionIterator : public ScriptIterator {
: pos(0), col(col), colP(colP) {}
virtual ScriptValueP next() {
if (pos < col->size()) {
return to_script(col->at(pos++));
return col->at(pos++);
} else {
return ScriptValueP();
}
}
private:
size_t pos;
ScriptValueP colP; // for ownership of the collection
const vector<ScriptValueP>* col;
ScriptValueP colP; // for ownership of the collection
};
ScriptValueP ScriptCustomCollection::getMember(const String& name) const {
long index;
if (name.ToLong(&index) && index >= 0 && (size_t)index < value.size()) {
return to_script(value.at(index));
return value.at(index);
} else {
return ScriptValue::getMember(name);
}
......
......@@ -53,35 +53,35 @@
#define TYPEOF_CREF(Value) TypeOf<typeid(Value)>::const_reference
/// Declare typeof magic for a specific type
#define DECLARE_TYPEOF(T) \
#define DECLARE_TYPEOF(T) \
template<> struct TypeOf<typeid(T)> { \
typedef T type; \
typedef T::iterator iterator; \
typedef T::const_iterator const_iterator; \
typedef T::reverse_iterator reverse_iterator; \
typedef T::const_reverse_iterator const_reverse_iterator; \
typedef T::reference reference; \
typedef T::const_reference const_reference; \
typedef T type; \
typedef T::iterator iterator; \
typedef T::const_iterator const_iterator; \
typedef T::reverse_iterator reverse_iterator; \
typedef T::const_reverse_iterator const_reverse_iterator; \
typedef T::reference reference; \
typedef T::const_reference const_reference; \
}
/// Declare typeof magic for a specific type that doesn't support reverse iterators
#define DECLARE_TYPEOF_NO_REV(T) \
#define DECLARE_TYPEOF_NO_REV(T) \
template<> struct TypeOf<typeid(T)> { \
typedef T type; \
typedef T::iterator iterator; \
typedef T::const_iterator const_iterator; \
typedef T::reference reference; \
typedef T::const_reference const_reference; \
typedef T type; \
typedef T::iterator iterator; \
typedef T::const_iterator const_iterator; \
typedef T::reference reference; \
typedef T::const_reference const_reference; \
}
/// Declare typeof magic for a specific type, using const iterators
#define DECLARE_TYPEOF_CONST(T) \
#define DECLARE_TYPEOF_CONST(T) \
template<> struct TypeOf<typeid(T)> { \
typedef T type; \
typedef T::const_iterator iterator; \
typedef T::const_iterator const_iterator; \
typedef T::const_reverse_iterator reverse_iterator; \
typedef T::const_reverse_iterator const_reverse_iterator; \
typedef T::const_reference reference; \
typedef T::const_reference const_reference; \
typedef T type; \
typedef T::const_iterator iterator; \
typedef T::const_iterator const_iterator; \
typedef T::const_reverse_iterator reverse_iterator; \
typedef T::const_reverse_iterator const_reverse_iterator; \
typedef T::const_reference reference; \
typedef T::const_reference const_reference; \
}
/// Declare typeof magic for a specific std::vector type
......@@ -103,33 +103,33 @@
/// Iterate over a collection, using an iterator it of type Type
/** Usage: FOR_EACH_IT_T(Type,it,collect) { body-of-loop }
*/
#define FOR_EACH_IT_T(Type,Iterator,Collection) \
for(Type Iterator = Collection.begin() ; \
#define FOR_EACH_IT_T(Type,Iterator,Collection) \
for(Type Iterator = Collection.begin() ; \
Iterator != Collection.end() ; \
++Iterator)
/// Iterate over a collection whos type must be declared with DECLARE_TYPEOF
/** Usage: FOR_EACH_IT(it,collect) { body-of-loop }
*/
#define FOR_EACH_IT(Iterator,Collection) \
#define FOR_EACH_IT(Iterator,Collection) \
FOR_EACH_IT_T(TYPEOF_IT(Collection), Iterator, Collection)
/// Iterate over a collection whos type must be declared with DECLARE_TYPEOF
/** Uses a const_iterator
* Usage: FOR_EACH_IT(it,collect) { body-of-loop }
*/
#define FOR_EACH_CONST_IT(Iterator,Collection) \
#define FOR_EACH_CONST_IT(Iterator,Collection) \
FOR_EACH_IT_T(TYPEOF_CIT(Collection), Iterator, Collection)
/// Iterate over a collection in whos type must be declared with DECLARE_TYPEOF
/** Iterates using a reverse_iterator
* Usage: FOR_EACH_REVERSE_IT(it,collect) { body-of-loop }
*/
#define FOR_EACH_REVERSE_IT(Iterator,Collection) \
for(TYPEOF_RIT(Collection) \
Iterator = Collection.rbegin() ; \
Iterator != Collection.rend() ; \
++Iterator)
#define FOR_EACH_REVERSE_IT(Iterator,Collection) \
for(TYPEOF_RIT(Collection) \
Iterator = Collection.rbegin() ; \
Iterator != Collection.rend() ; \
++Iterator)
// ----------------------------------------------------------------------------- : Looping macros
......@@ -140,32 +140,32 @@
* To do this we use a nested for loop that is only executed once, and which is optimized away.
* To terminate this loop we need an extra bool, which we set to false after the first iteration.
*/
#define FOR_EACH_T(TypeIt,TypeElem,Elem,Collection, begin, end) \
for(std::pair<TypeIt,bool> Elem##_IT(Collection.begin(), true) ; \
Elem##_IT.second && Elem##_IT.first != Collection.end() ; \
++Elem##_IT.first, Elem##_IT.second = !Elem##_IT.second) \
for(TypeElem Elem = *Elem##_IT.first ; \
Elem##_IT.second ; \
#define FOR_EACH_T(TypeIt,TypeElem,Elem,Collection, begin, end) \
for(std::pair<TypeIt,bool> Elem##_IT(Collection.begin(), true) ; \
Elem##_IT.second && Elem##_IT.first != Collection.end() ; \
++Elem##_IT.first, Elem##_IT.second = !Elem##_IT.second) \
for(TypeElem Elem = *Elem##_IT.first ; \
Elem##_IT.second ; \
Elem##_IT.second = false)
/// Iterate over a collection whos type must be declared with DECLARE_TYPEOF
/** Usage: FOR_EACH(e,collect) { body-of-loop }
*/
#define FOR_EACH(Elem,Collection) \
#define FOR_EACH(Elem,Collection) \
FOR_EACH_T(TYPEOF_IT(Collection), TYPEOF_REF(Collection), Elem, Collection, begin, end)
/// Iterate over a collection whos type must be declared with DECLARE_TYPEOF
/** Uses a const iterator
* Usage: FOR_EACH_CONST(e,collect) { body-of-loop }
*/
#define FOR_EACH_CONST(Elem,Collection) \
#define FOR_EACH_CONST(Elem,Collection) \
FOR_EACH_T(TYPEOF_CIT(Collection), TYPEOF_CREF(Collection), Elem, Collection, begin, end)
/// Iterate over a collection whos type must be declared with DECLARE_TYPEOF
/** Iterates using a reverse_iterator
* Usage: FOR_EACH_REVERSE(e,collect) { body-of-loop }
*/
#define FOR_EACH_REVERSE(Elem,Collection) \
#define FOR_EACH_REVERSE(Elem,Collection) \
FOR_EACH_T(TYPEOF_RIT(Collection), TYPEOF_REF(Collection), Elem, Collection, rbegin, rend)
/// Iterate over a collection whos type must be declared with DECLARE_TYPEOF
......@@ -181,31 +181,31 @@
* Note: This has got to be one of the craziest pieces of code I have ever written :)
* It is just an extension of the idea of FOR_EACH_T.
*/
#define FOR_EACH_2_T(TypeIt1,TypeElem1,Elem1,Coll1,TypeIt2,TypeElem2,Elem2,Coll2) \
#define FOR_EACH_2_T(TypeIt1,TypeElem1,Elem1,Coll1,TypeIt2,TypeElem2,Elem2,Coll2) \
for(std::pair<std::pair<TypeIt1,TypeIt2>, bool> \
Elem1##_IT(make_pair(Coll1.begin(), Coll2.begin()), true) ; \
Elem1##_IT.first.first != Coll1.end() && \
Elem1##_IT.first.second != Coll2.end() ; \
++Elem1##_IT.first.first, ++Elem1##_IT.first.second, \
Elem1##_IT.second = true) \
Elem1##_IT(make_pair(Coll1.begin(), Coll2.begin()), true) ; \
Elem1##_IT.first.first != Coll1.end() && \
Elem1##_IT.first.second != Coll2.end() ; \
++Elem1##_IT.first.first, ++Elem1##_IT.first.second, \
Elem1##_IT.second = true) \
for(TypeElem1 Elem1 = *Elem1##_IT.first.first ; \
Elem1##_IT.second ; \
Elem1##_IT.second = false) \
Elem1##_IT.second ; \
Elem1##_IT.second = false) \
for(TypeElem2 Elem2 = *Elem1##_IT.first.second ; \
Elem1##_IT.second ; \
Elem1##_IT.second ; \
Elem1##_IT.second = false)
/// Iterate over two collections in parallel, their type must be declared with DECLARE_TYPEOF.
/** Usage: FOR_EACH_2(e1,collect1, e2,collect2) { body-of-loop }
*/
#define FOR_EACH_2(Elem1,Collection1, Elem2,Collection2) \
#define FOR_EACH_2(Elem1,Collection1, Elem2,Collection2) \
FOR_EACH_2_T(TYPEOF_IT(Collection1), TYPEOF_REF(Collection1), Elem1, Collection1, \
TYPEOF_IT(Collection2), TYPEOF_REF(Collection2), Elem2, Collection2)
/// Iterate over two constants collections in parallel, their type must be declared with DECLARE_TYPEOF.
/** Usage: FOR_EACH_2_CONST(e1,collect1, e2,collect2) { body-of-loop }
*/
#define FOR_EACH_2_CONST(Elem1,Collection1, Elem2,Collection2) \
#define FOR_EACH_2_CONST(Elem1,Collection1, Elem2,Collection2) \
FOR_EACH_2_T(TYPEOF_CIT(Collection1), TYPEOF_CREF(Collection1), Elem1, Collection1, \
TYPEOF_CIT(Collection2), TYPEOF_CREF(Collection2), Elem2, Collection2)
......
......@@ -125,7 +125,7 @@ void Package::saveAs(const String& name, bool removeUnused) {
// ----------------------------------------------------------------------------- : Package : inside
/*
#if 0
/// Class that is a wxZipInputStream over a wxFileInput stream
/** Note that wxFileInputStream is also a base class, because it must be constructed first
* This class requires a patch in wxWidgets (2.5.4)
......@@ -136,7 +136,7 @@ void Package::saveAs(const String& name, bool removeUnused) {
* It seems that in 2.6.3 this is no longer necessary (TODO: test)
*
* NOTE: Not used with wx 2.6.3, since it doesn't support seeking
* /
*/
class ZipFileInputStream : private wxFileInputStream, public wxZipInputStream {
public:
ZipFileInputStream(const String& filename, wxZipEntry* entry)
......@@ -146,7 +146,7 @@ class ZipFileInputStream : private wxFileInputStream, public wxZipInputStream {
OpenEntry(*entry);
}
};
*/
#endif
InputStreamP Package::openIn(const String& file) {
if (!file.empty() && file.GetChar(0) == _('/')) {
......
......@@ -115,6 +115,9 @@ inline String format_string(const String& format, const String& a0) {
inline String format_string(const String& format, const String& a0, const String& a1) {
return String::Format(format, a0.c_str(), a1.c_str());
}
inline String format_string(const String& format, const String& a0, const String& a1, const String& a2) {
return String::Format(format, a0.c_str(), a1.c_str(), a2.c_str());
}
// ----------------------------------------------------------------------------- : EOF
#endif
......@@ -131,14 +131,14 @@ void RotatedDC::DrawText (const String& text, const RealPoint& pos) {
draw_resampled_text(dc, r_ext, revX(), revY(), angle, text);
} else {
RealPoint p_ext = tr(pos);
dc.DrawRotatedText(text, p_ext.x, p_ext.y, angle);
dc.DrawRotatedText(text, (int) p_ext.x, (int) p_ext.y, angle);
}
}
void RotatedDC::DrawBitmap(const Bitmap& bitmap, const RealPoint& pos) {
if (angle == 0) {
RealPoint p_ext = tr(pos);
dc.DrawBitmap(bitmap, p_ext.x, p_ext.y, true);
dc.DrawBitmap(bitmap, (int) p_ext.x, (int) p_ext.y, true);
} else {
DrawImage(bitmap.ConvertToImage(), pos);
}
......@@ -175,7 +175,7 @@ void RotatedDC::SetFont(const wxFont& font) {
SetFont(font, font.GetPointSize());
}
void RotatedDC::SetFont(wxFont font, double size) {
font.SetPointSize(trS(size) * (high_quality ? text_scaling : 1));
font.SetPointSize((int) (trS(size) * (high_quality ? text_scaling : 1)));
dc.SetFont(font);
}
......
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