diff --git a/src/data/action/symbol.cpp b/src/data/action/symbol.cpp index 0c959df7..705d400f 100644 --- a/src/data/action/symbol.cpp +++ b/src/data/action/symbol.cpp @@ -328,7 +328,7 @@ void CombiningModeAction::perform(bool to_undo) { SymbolPartNameAction::SymbolPartNameAction(const SymbolPartP& part, const String& name, size_t old_cursor, size_t new_cursor) : part(part), part_name(name) - , new_cursor(old_cursor), old_cursor(new_cursor) // will be swapped + , old_cursor(new_cursor), new_cursor(old_cursor) // will be swapped {} String SymbolPartNameAction::getName(bool to_undo) const { diff --git a/src/data/action/value.hpp b/src/data/action/value.hpp index ad623d3e..84e527b3 100644 --- a/src/data/action/value.hpp +++ b/src/data/action/value.hpp @@ -35,7 +35,7 @@ DECLARE_POINTER_TYPE(PackageChoiceValue); /// An Action the changes a Value class ValueAction : public Action { public: - inline ValueAction(const Card* card, const ValueP& value) : card(card), valueP(value) {} + inline ValueAction(const Card* card, const ValueP& value) : valueP(value), card(card) {} virtual String getName(bool to_undo) const; diff --git a/src/data/field.cpp b/src/data/field.cpp index 673c1266..f1723d97 100644 --- a/src/data/field.cpp +++ b/src/data/field.cpp @@ -161,11 +161,11 @@ int Style::update(Context& ctx) { if (automatic_side & AUTO_LEFT) left = right - width; else if (automatic_side & AUTO_WIDTH) width = right - left; else if (automatic_side & AUTO_RIGHT) right = left + width; - else {int lr = left + right; left = (lr - width) / 2; right = (lr + width) / 2; } + else {int lr = int(left + right); left = (lr - width) / 2; right = (lr + width) / 2; } if (automatic_side & AUTO_TOP) top = bottom - height; else if (automatic_side & AUTO_HEIGHT) height = bottom - top; else if (automatic_side & AUTO_BOTTOM) bottom = top + height; - else {int tb = top + bottom; top = (tb - height) / 2; bottom = (tb + height) / 2; } + else {int tb = int(top + bottom); top = (tb - height) / 2; bottom = (tb + height) / 2; } // adjust rotation point if (angle != 0 && (automatic_side & (AUTO_LEFT | AUTO_TOP))) { double s = sin(angle * M_PI / 180), c = cos(angle * M_PI / 180); diff --git a/src/data/field/choice.cpp b/src/data/field/choice.cpp index 8e65fc83..d90c1ad7 100644 --- a/src/data/field/choice.cpp +++ b/src/data/field/choice.cpp @@ -46,12 +46,13 @@ IMPLEMENT_REFLECTION(ChoiceField) { // ----------------------------------------------------------------------------- : ChoiceField::Choice ChoiceField::Choice::Choice() - : first_id(0) - , line_below(false), enabled(true), type(CHOICE_TYPE_CHECK) + : line_below(false), enabled(true), type(CHOICE_TYPE_CHECK) + , first_id(0) {} ChoiceField::Choice::Choice(const String& name) - : name(name), first_id(0) + : name(name) , line_below(false), enabled(true), type(CHOICE_TYPE_CHECK) + , first_id(0) {} diff --git a/src/data/font.cpp b/src/data/font.cpp index 4fcf9c46..088d4867 100644 --- a/src/data/font.cpp +++ b/src/data/font.cpp @@ -88,7 +88,7 @@ wxFont Font::toWxFont(double scale) const { } } else if (name().empty()) { font = *wxNORMAL_FONT; - font.SetPointSize(size > 1 ? size_i : scale * font.GetPointSize()); + font.SetPointSize(size > 1 ? size_i : int(scale * font.GetPointSize())); return font; } else if (flags & FONT_ITALIC && !italic_name().empty()) { font = wxFont(size_i, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, weight_i, underline(), italic_name()); diff --git a/src/data/installer.cpp b/src/data/installer.cpp index cd315603..b0deae15 100644 --- a/src/data/installer.cpp +++ b/src/data/installer.cpp @@ -38,7 +38,7 @@ IMPLEMENT_REFLECTION(Installer) { REFLECT(packages); } -/* +#if 0 // ----------------------------------------------------------------------------- : Installing void Installer::installFrom(const String& filename, bool message_on_success, bool local) { @@ -135,12 +135,14 @@ void Installer::install(bool local, bool check_dependencies) { } os.Write(*is); } - * / + */ } void Installer::install(const String& package) { // TODO -}*/ +} + +#endif // ----------------------------------------------------------------------------- : Creating @@ -255,14 +257,14 @@ DownloadableInstaller::~DownloadableInstaller() { InstallablePackage::InstallablePackage(const PackageVersionP& installed, const PackageDescriptionP& description) : installed(installed) , description(description) - , action(PACKAGE_NOTHING) , status(PACKAGE_INSTALLED) + , action(PACKAGE_NOTHING) {} InstallablePackage::InstallablePackage(const PackageDescriptionP& description , const DownloadableInstallerP& installer) : description(description) , installer(installer) - , action(PACKAGE_NOTHING) , status(PACKAGE_INSTALLABLE) + , action(PACKAGE_NOTHING) {} void InstallablePackage::determineStatus() { diff --git a/src/data/settings.cpp b/src/data/settings.cpp index ce8a5cdc..98f02f62 100644 --- a/src/data/settings.cpp +++ b/src/data/settings.cpp @@ -157,8 +157,8 @@ Settings::Settings() , installer_list_url (_("http://magicseteditor.sourceforge.net/installers")) , check_updates (CHECK_IF_CONNECTED) , check_updates_all (true) - , install_type (INSTALL_DEFAULT) , website_url (_("http://magicseteditor.sourceforge.net/")) + , install_type (INSTALL_DEFAULT) {} void Settings::addRecentFile(const String& filename) { diff --git a/src/gfx/blend_image.cpp b/src/gfx/blend_image.cpp index 47d99b0b..d4d6b2d5 100644 --- a/src/gfx/blend_image.cpp +++ b/src/gfx/blend_image.cpp @@ -107,7 +107,7 @@ void set_alpha(Image& img, Byte* al, const wxSize& alpha_size) { } void set_alpha(Image& img, double alpha) { - Byte b_alpha = alpha * 255; + Byte b_alpha = Byte(alpha * 255); if (!img.HasAlpha()) { img.InitAlpha(); memset(img.GetAlpha(), b_alpha, img.GetWidth() * img.GetHeight()); diff --git a/src/gfx/generated_image.cpp b/src/gfx/generated_image.cpp index 45c98768..4d1f1fce 100644 --- a/src/gfx/generated_image.cpp +++ b/src/gfx/generated_image.cpp @@ -31,7 +31,7 @@ Image conform_image(const Image& img, const GeneratedImage::Options& options) { if ((iw == options.width && ih == options.height) || (options.width == 0 && options.height == 0)) { // zoom? if (options.zoom != 1.0) { - image = resample(image, iw * options.zoom, ih * options.zoom); + image = resample(image, int(iw * options.zoom), int(ih * options.zoom)); } else { // already the right size } diff --git a/src/gfx/image_effects.cpp b/src/gfx/image_effects.cpp index be7a2255..7e43c7c9 100644 --- a/src/gfx/image_effects.cpp +++ b/src/gfx/image_effects.cpp @@ -18,7 +18,7 @@ void saturate(Image& image, double amount) { Byte* end = pix + image.GetWidth() * image.GetHeight() * 3; if (amount > 0) { amount = min(amount,0.99); - int factor = 256 * amount; + int factor = int(256 * amount); int div = 768 - 3 * factor; while (pix != end) { int r = pix[0], g = pix[1], b = pix[2]; @@ -35,7 +35,7 @@ void saturate(Image& image, double amount) { pix += 3; } } else { - int factor1 = 256 * -amount; + int factor1 = int(256 * -amount); int factor2 = 768 - 3*factor1; while (pix != end) { int r = pix[0], g = pix[1], b = pix[2]; diff --git a/src/gfx/resample_text.cpp b/src/gfx/resample_text.cpp index bd623efe..57892fac 100644 --- a/src/gfx/resample_text.cpp +++ b/src/gfx/resample_text.cpp @@ -185,8 +185,8 @@ void draw_resampled_text(DC& dc, const RealPoint& pos, const RealRect& rect, dou // get image mdc.SelectObject(wxNullBitmap); // step 2. sample down - if (!sideways(angle)) w *= stretch; - else h *= stretch; + if (!sideways(angle)) w = int(w * stretch); // GCC makes annoying conversion warnings if *= is used here. + else h = int(h * stretch); Image img_small(w, h, false); fill_image(img_small, dc.GetTextForeground()); downsample_to_alpha(buffer, img_small); diff --git a/src/gui/control/card_viewer.cpp b/src/gui/control/card_viewer.cpp index 7b52c8a4..f33e6f9b 100644 --- a/src/gui/control/card_viewer.cpp +++ b/src/gui/control/card_viewer.cpp @@ -29,7 +29,7 @@ wxSize CardViewer::DoGetBestSize() const { if (set) { if (!stylesheet) stylesheet = set->stylesheet; StyleSheetSettings& ss = settings.stylesheetSettingsFor(*stylesheet); - wxSize size(stylesheet->card_width * ss.card_zoom(), stylesheet->card_height * ss.card_zoom()); + wxSize size(int(stylesheet->card_width * ss.card_zoom()), int(stylesheet->card_height * ss.card_zoom())); if (sideways(ss.card_angle())) swap(size.x, size.y); return size + ws - cs; } diff --git a/src/gui/control/tree_list.cpp b/src/gui/control/tree_list.cpp index de9c2314..1c24fb62 100644 --- a/src/gui/control/tree_list.cpp +++ b/src/gui/control/tree_list.cpp @@ -116,9 +116,9 @@ size_t TreeList::findParent(size_t start) const { TreeList::TreeList(Window* parent, int id, long style) : wxPanel(parent, id, wxDefaultPosition, wxDefaultSize, style | wxWANTS_CHARS | wxVSCROLL) + , selection(NOTHING) , total_lines(0) , first_line(0) - , selection(NOTHING) { // determine item size wxClientDC dc(this); diff --git a/src/gui/print_window.cpp b/src/gui/print_window.cpp index a6848026..2f5a4a21 100644 --- a/src/gui/print_window.cpp +++ b/src/gui/print_window.cpp @@ -55,7 +55,7 @@ class TextBufferDC : public wxMemoryDC { double user_scale_x, user_scale_y; TextDraw(wxFont font, Color color, double user_scale_x, double user_scale_y, int x, int y, String text, double angle = 0) - : font(font), color(color), user_scale_x(user_scale_x), user_scale_y(user_scale_y), x(x), y(y), text(text), angle(angle) + : font(font), color(color), x(x), y(y), text(text), angle(angle), user_scale_x(user_scale_x), user_scale_y(user_scale_y) {} }; public: @@ -127,8 +127,8 @@ PageLayout::PageLayout(const StyleSheet& stylesheet, const RealSize& page_size) card_size.width = stylesheet.card_width * 25.4 / stylesheet.card_dpi; card_size.height = stylesheet.card_height * 25.4 / stylesheet.card_dpi; card_landscape = card_size.width > card_size.height; - cols = floor(page_size.width / card_size.width); - rows = floor(page_size.height / card_size.height); + cols = int(floor(page_size.width / card_size.width)); + rows = int(floor(page_size.height / card_size.height)); // distribute whitespace evenly margin_left = margin_right = card_spacing.width = (page_size.width - (cols * card_size.width )) / (cols + 1); margin_top = margin_bottom = card_spacing.height = (page_size.height - (rows * card_size.height)) / (rows + 1); @@ -228,7 +228,7 @@ void CardsPrintout::drawCard(DC& dc, const CardP& card, int card_nr) { */ // create buffers - int w = stylesheet.card_width, h = stylesheet.card_height; // in pixels + int w = int(stylesheet.card_width), h = int(stylesheet.card_height); // in pixels if (rotation == 90) swap(w,h); // Draw using text buffer //TextBufferDC bufferDC(w,h,true); @@ -241,7 +241,7 @@ void CardsPrintout::drawCard(DC& dc, const CardP& card, int card_nr) { // render buffer to device double px_per_mm = 4 * stylesheet.card_dpi / 25.4; dc.SetUserScale(scale_x / px_per_mm, scale_y / px_per_mm); - dc.SetDeviceOrigin(scale_x * pos.x, scale_y * pos.y); + dc.SetDeviceOrigin(int(scale_x * pos.x), int(scale_y * pos.y)); bufferDC.drawToDevice(dc, 0, 0); // adjust for scaling } diff --git a/src/gui/symbol/symmetry_editor.cpp b/src/gui/symbol/symmetry_editor.cpp index b311a956..584572b0 100644 --- a/src/gui/symbol/symmetry_editor.cpp +++ b/src/gui/symbol/symmetry_editor.cpp @@ -38,16 +38,16 @@ void SymbolSymmetryEditor::draw(DC& dc) { if (symmetry->kind == SYMMETRY_REFLECTION) { // draw line to handle dc.SetPen(wxPen(color,1,wxDOT)); - dc.DrawLine(center.x, center.y, handle.x, handle.y); + dc.DrawLine(int(center.x), int(center.y), int(handle.x), int(handle.y)); // draw handle dc.SetPen(*wxBLACK_PEN); dc.SetBrush(color); - dc.DrawCircle(handle.x, handle.y, hovered == SELECTION_HANDLE ? 7 : 4); + dc.DrawCircle(int(handle.x), int(handle.y), hovered == SELECTION_HANDLE ? 7 : 4); } // draw center dc.SetPen(*wxBLACK_PEN); dc.SetBrush(color); - dc.DrawCircle(center.x, center.y, hovered == SELECTION_CENTER ? 8 : 5); + dc.DrawCircle(int(center.x), int(center.y), hovered == SELECTION_CENTER ? 8 : 5); } } diff --git a/src/gui/value/package_choice.cpp b/src/gui/value/package_choice.cpp index 095b5c77..8f39da89 100644 --- a/src/gui/value/package_choice.cpp +++ b/src/gui/value/package_choice.cpp @@ -117,4 +117,4 @@ void PackageChoiceValueEditor::change(const String& c) { void PackageChoiceValueEditor::initDropDown() { if (drop_down) return; drop_down = new_shared2(&editor(), this); -} \ No newline at end of file +} diff --git a/src/render/symbol/viewer.cpp b/src/render/symbol/viewer.cpp index 49b31cfd..78e04134 100644 --- a/src/render/symbol/viewer.cpp +++ b/src/render/symbol/viewer.cpp @@ -21,9 +21,9 @@ Image render_symbol(const SymbolP& symbol, double border_radius, int width, int double ar = symbol->aspectRatio(); double par = (double)width/height; if (par > ar && (ar > 1 || (allow_smaller && height < width))) { - width = height * ar; + width = int(height * ar); } else if (par < ar && (ar < 1 || (allow_smaller && width < height))) { - height = width / ar; + height = int(width / ar); } if (width > height) { viewer.setZoom(width); @@ -354,12 +354,12 @@ void SymbolViewer::highlightPart(DC& dc, const SymbolSymmetry& sym, HighlightSty double a = angle + (i + 0.5) * 2 * M_PI / copies; Vector2D dir(cos(a), sin(a)); Vector2D dir2 = rotation.tr(sym.center + 2 * dir); - dc.DrawLine(center.x, center.y, dir2.x, dir2.y); + dc.DrawLine(int(center.x), int(center.y), int(dir2.x), int(dir2.y)); } // draw center dc.SetPen(*wxBLACK_PEN); dc.SetBrush(color); - dc.DrawCircle(center.x, center.y, sym.kind == SYMMETRY_ROTATION ? 7 : 5); + dc.DrawCircle(int(center.x), int(center.y), sym.kind == SYMMETRY_ROTATION ? 7 : 5); } void SymbolViewer::highlightPart(DC& dc, const SymbolGroup& group, HighlightStyle style) { diff --git a/src/render/text/viewer.cpp b/src/render/text/viewer.cpp index 8d4c861a..6bf6ab8e 100644 --- a/src/render/text/viewer.cpp +++ b/src/render/text/viewer.cpp @@ -651,7 +651,7 @@ bool TextViewer::prepareLinesScale(RotatedDC& dc, const vector& chars, } } // how many paragraphs would fit? - int n = floor(0.5 + (dc.getInternalSize().height - style.padding_bottom) / style.paragraph_height); + int n = int(floor(0.5 + (dc.getInternalSize().height - style.padding_bottom) / style.paragraph_height)); lines.back().top = max_height * n - lines.back().line_height; } return lines.back().bottom() <= dc.getInternalSize().height - style.padding_bottom; diff --git a/src/render/value/symbol.cpp b/src/render/value/symbol.cpp index df4091ca..63446a02 100644 --- a/src/render/value/symbol.cpp +++ b/src/render/value/symbol.cpp @@ -35,8 +35,8 @@ void SymbolValueViewer::draw(RotatedDC& dc) { ar = min(style().max_aspect_ratio, max(style().min_aspect_ratio, ar)); // render and filter variations FOR_EACH(variation, style().variations) { - Image img = render_symbol(symbol, *variation->filter, variation->border_radius, 200 * ar, 200); - Image resampled((int) (wh * ar), (int) wh, false); + Image img = render_symbol(symbol, *variation->filter, variation->border_radius, int(200 * ar), 200); + Image resampled(int(wh * ar), int(wh), false); resample(img, resampled); symbols.push_back(Bitmap(resampled)); } diff --git a/src/util/io/package.cpp b/src/util/io/package.cpp index e0814f3f..de87292c 100644 --- a/src/util/io/package.cpp +++ b/src/util/io/package.cpp @@ -575,4 +575,4 @@ String IncludePackage::typeName() const { return _("include"); } IMPLEMENT_REFLECTION(IncludePackage) { REFLECT_BASE(Packaged); -} \ No newline at end of file +} diff --git a/src/util/io/reader.cpp b/src/util/io/reader.cpp index 717b4e91..31697adc 100644 --- a/src/util/io/reader.cpp +++ b/src/util/io/reader.cpp @@ -17,8 +17,8 @@ Reader::Reader(const InputStreamP& input, Packaged* package, const String& filename, bool ignore_invalid) : indent(0), expected_indent(0), state(OUTSIDE) - , package(package), filename(filename), line_number(0), previous_line_number(0) , ignore_invalid(ignore_invalid) + , filename(filename), package(package), line_number(0), previous_line_number(0) , input(input) { moveNext(); @@ -27,10 +27,10 @@ Reader::Reader(const InputStreamP& input, Packaged* package, const String& filen Reader::Reader(Packaged* pkg, const String& filename) : indent(0), expected_indent(0), state(OUTSIDE) - , package(pkg), filename(filename), line_number(0), previous_line_number(0) , ignore_invalid(false) + , filename(filename), package(pkg), line_number(0), previous_line_number(0) + , input(packages.openFileFromPackage(package, filename)) { - input = packages.openFileFromPackage(package, filename); moveNext(); handleAppVersion(); } @@ -175,7 +175,7 @@ String read_utf8_line(wxInputStream& input, bool eat_bom, bool until_eof) { // convert to string buffer.push_back('\0'); size_t size = wxConvUTF8.MB2WC(nullptr, buffer.get(), 0); - if (size == -1) { + if (size == size_t(-1)) { throw ParseError(_("Invalid UTF-8 sequence")); } else if (size == 0) { return _(""); diff --git a/src/util/reflect.hpp b/src/util/reflect.hpp index 41adb186..171c9f93 100644 --- a/src/util/reflect.hpp +++ b/src/util/reflect.hpp @@ -163,7 +163,7 @@ * When reading the first value declared is the default value * * Currently creates the methods: - * - Reader::handle(Enum& + * - Reader::handle(Enum&) * - Writer::handle(const Enum&) * - GetDefaultMember::handle(const Enum&) */ diff --git a/src/util/rotation.cpp b/src/util/rotation.cpp index c947bb83..e2160ed2 100644 --- a/src/util/rotation.cpp +++ b/src/util/rotation.cpp @@ -286,7 +286,7 @@ void RotatedDC::DrawRoundedRectangle(const RealRect& r, double radius) { void RotatedDC::DrawCircle(const RealPoint& center, double radius) { wxPoint p = tr(center); - dc.DrawCircle(p.x + 1, p.y + 1, trS(radius)); + dc.DrawCircle(p.x + 1, p.y + 1, int(trS(radius))); } void RotatedDC::DrawEllipticArc(const RealPoint& center, const RealSize& size, double start, double end) {