diff --git a/configure b/configure index c61d66f6..9272f9e2 100755 --- a/configure +++ b/configure @@ -3444,7 +3444,7 @@ if test "${enable_debug+set}" = set; then : fi if test "x${enable_debug}" = "xyes"; then - DEFAULT_CXXFLAGS="-ggdb -O0 -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC" + DEFAULT_CXXFLAGS="-ggdb -O0" WXCONFIG_FLAGS="--debug" else DEFAULT_CXXFLAGS="-O2" diff --git a/configure.ac b/configure.ac index e60572cf..68301a1c 100644 --- a/configure.ac +++ b/configure.ac @@ -21,7 +21,7 @@ AC_PROG_CXX AC_ARG_ENABLE(debug, [--enable-debug Enable debug build (requires debug versions of wxWidgets and libstdc++.]) if test "x${enable_debug}" = "xyes"; then - DEFAULT_CXXFLAGS="-ggdb -O0 -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC" + DEFAULT_CXXFLAGS="-ggdb -O0" WXCONFIG_FLAGS="--debug" else DEFAULT_CXXFLAGS="-O2" diff --git a/src/data/action/set.cpp b/src/data/action/set.cpp index 49cf56ef..2a79b8a4 100644 --- a/src/data/action/set.cpp +++ b/src/data/action/set.cpp @@ -156,7 +156,7 @@ void AddPackAction::perform(bool to_undo) { ChangePackAction::ChangePackAction(Set& set, size_t pos, const PackTypeP& pack) : PackTypesAction(set) - , pos(pos), pack(pack) + , pack(pack), pos(pos) {} String ChangePackAction::getName(bool to_undo) const { diff --git a/src/data/export_template.cpp b/src/data/export_template.cpp index a6e47091..34b1d5df 100644 --- a/src/data/export_template.cpp +++ b/src/data/export_template.cpp @@ -15,8 +15,8 @@ // ----------------------------------------------------------------------------- : Export template, basics ExportTemplate::ExportTemplate() - : create_directory(false) - , file_type(_("HTML files (*.html)|*.html")) + : file_type(_("HTML files (*.html)|*.html")) + , create_directory(false) {} String ExportTemplate::typeNameStatic() { return _("export-template"); } diff --git a/src/data/font.cpp b/src/data/font.cpp index 722c5645..61f00692 100644 --- a/src/data/font.cpp +++ b/src/data/font.cpp @@ -34,7 +34,7 @@ bool Font::update(Context& ctx) { | underline .update(ctx) | color .update(ctx) | shadow_color.update(ctx); - flags = flags & (~FONT_BOLD & ~FONT_ITALIC) + flags = (flags & ~FONT_BOLD & ~FONT_ITALIC) | (weight() == _("bold") ? FONT_BOLD : FONT_NORMAL) | (style() == _("italic") ? FONT_ITALIC : FONT_NORMAL); return changes; diff --git a/src/data/format/apprentice.cpp b/src/data/format/apprentice.cpp index f052969b..6ebafa68 100644 --- a/src/data/format/apprentice.cpp +++ b/src/data/format/apprentice.cpp @@ -641,14 +641,14 @@ ApprenticeExportWindow::ApprenticeExportWindow(Window* parent, const SetP& set) wxSizer* s2 = new wxBoxSizer(wxHORIZONTAL); s2->Add(apprentice, 1, wxEXPAND | wxRIGHT, 4); s2->Add(browse, 0, wxEXPAND); - s->Add(s2, 0, wxEXPAND | wxALL & ~wxTOP, 4); + s->Add(s2, 0, wxEXPAND | (wxALL & ~wxTOP), 4); s->AddSpacer(8); // Set code s->Add(new wxStaticText(this, -1, _LABEL_("set code")), 0, wxALL, 4); s->Add(set_code, 0, wxEXPAND | wxLEFT | wxRIGHT, 4); s->Add(new wxStaticText(this, -1, _HELP_( "set code")), 0, wxALL, 4); s->AddSpacer(4); - s->Add(CreateButtonSizer(wxOK | wxCANCEL), 0, wxEXPAND | wxALL & ~wxTOP, 8); + s->Add(CreateButtonSizer(wxOK | wxCANCEL), 0, wxEXPAND | (wxALL & ~wxTOP), 8); s->SetSizeHints(this); SetSizer(s); } diff --git a/src/data/set.cpp b/src/data/set.cpp index cbf9740c..5950571a 100644 --- a/src/data/set.cpp +++ b/src/data/set.cpp @@ -28,14 +28,14 @@ DECLARE_TYPEOF_NO_REV(IndexMap); // ----------------------------------------------------------------------------- : Set Set::Set() - : script_manager(new SetScriptManager(*this)) - , vcs (new_intrusive()) + : vcs (new_intrusive()) + , script_manager(new SetScriptManager(*this)) {} Set::Set(const GameP& game) : game(game) - , script_manager(new SetScriptManager(*this)) , vcs (new_intrusive()) + , script_manager(new SetScriptManager(*this)) { data.init(game->set_fields); } @@ -43,8 +43,8 @@ Set::Set(const GameP& game) Set::Set(const StyleSheetP& stylesheet) : game(stylesheet->game) , stylesheet(stylesheet) - , script_manager(new SetScriptManager(*this)) , vcs (new_intrusive()) + , script_manager(new SetScriptManager(*this)) { data.init(game->set_fields); } @@ -201,8 +201,11 @@ void Set::reflect_cards (Tag& tag) { template <> void Set::reflect_cards (Writer& tag) { - // TODO: disable for zipfiles - if (true) { + // When writing to a directory, we write each card in a separate file. + // We don't do this in zipfiles because it leads to bloat. + if (isZipfile()) { + REFLECT(cards); + } else { set used; FOR_EACH(card, cards) { String filename = normalize_internal_filename(clean_filename(card->identification())); @@ -222,8 +225,6 @@ void Set::reflect_cards (Writer& tag) { referenceFile(full_name); REFLECT_N("include file", full_name); } - } else { - REFLECT(cards); } } diff --git a/src/data/settings.cpp b/src/data/settings.cpp index 2f1c94fe..0c0016a4 100644 --- a/src/data/settings.cpp +++ b/src/data/settings.cpp @@ -75,9 +75,9 @@ GameSettings::GameSettings() , images_export_filename(_("{card.name}.jpg")) , images_export_conflicts(CONFLICT_NUMBER_OVERWRITE) , use_auto_replace(true) - , initialized(false) , pack_seed_random(true) , pack_seed(123456) + , initialized(false) {} void GameSettings::initDefaults(const Game& game) { diff --git a/src/gui/about_window.cpp b/src/gui/about_window.cpp index 36522c1a..f6b0bd8e 100644 --- a/src/gui/about_window.cpp +++ b/src/gui/about_window.cpp @@ -64,8 +64,8 @@ END_EVENT_TABLE () HoverButtonBase::HoverButtonBase(Window* parent, int id, bool accepts_focus) : wxControl(parent, id, wxDefaultPosition, wxDefaultSize, wxNO_BORDER ) - , hover(false), focus(false), mouse_down(false), key_down(false) , accepts_focus(accepts_focus) + , hover(false), focus(false), mouse_down(false), key_down(false) {} void HoverButtonBase::onMouseEnter(wxMouseEvent&) { diff --git a/src/gui/auto_replace_window.cpp b/src/gui/auto_replace_window.cpp index b91e44fb..88d2b391 100644 --- a/src/gui/auto_replace_window.cpp +++ b/src/gui/auto_replace_window.cpp @@ -178,12 +178,12 @@ AutoReplaceWindow::AutoReplaceWindow(Window* parent, const Game& game) // enabled? s->Add(use_auto_replace, 0, wxALL & ~wxBOTTOM, 8); // list - s->Add(list, 1, wxEXPAND | wxALL & ~wxBOTTOM, 8); + s->Add(list, 1, wxEXPAND | (wxALL & ~wxBOTTOM), 8); s->AddSpacer(4); wxSizer* s2 = new wxBoxSizer(wxHORIZONTAL); s2->Add(add, 0, wxRIGHT, 4); s2->Add(remove); - s->Add(s2, 0, wxALIGN_RIGHT | wxALL & ~wxTOP & ~wxBOTTOM, 8); + s->Add(s2, 0, wxALIGN_RIGHT | (wxALL & ~wxTOP & ~wxBOTTOM), 8); // values wxFlexGridSizer* s3 = new wxFlexGridSizer(2); s3->AddGrowableCol(1); @@ -191,7 +191,7 @@ AutoReplaceWindow::AutoReplaceWindow(Window* parent, const Game& game) s3->Add(match, 1, wxEXPAND | wxBOTTOM, 2); s3->Add(replaceL, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 4); s3->Add(replace, 1, wxEXPAND | wxBOTTOM, 2); - s->Add(s3, 0, wxEXPAND | wxALL & ~wxBOTTOM, 8); + s->Add(s3, 0, wxEXPAND | (wxALL & ~wxBOTTOM), 8); s->AddSpacer(2); s->Add(whole_word, 0, wxALL & ~wxBOTTOM & ~wxTOP, 8); s->AddSpacer(4); diff --git a/src/gui/card_select_window.cpp b/src/gui/card_select_window.cpp index aeebd8f3..42866f05 100644 --- a/src/gui/card_select_window.cpp +++ b/src/gui/card_select_window.cpp @@ -30,8 +30,8 @@ ExportCardSelectionChoice::ExportCardSelectionChoice(const Set& set) ExportCardSelectionChoice::ExportCardSelectionChoice(const String& label, const vector& cards) : label(label) , type(EXPORT_SEL_SUBSET) - , own_cards(cards) , the_cards(&own_cards) + , own_cards(cards) {} ExportCardSelectionChoice::ExportCardSelectionChoice(const String& label, const vector* cards) : label(label) @@ -142,7 +142,7 @@ CardSelectWindow::CardSelectWindow(Window* parent, const SetP& set, const String s2->Add(sel_all, 0, wxEXPAND | wxRIGHT, 8); s2->Add(sel_none, 0, wxEXPAND | wxRIGHT, 8); s2->Add(CreateButtonSizer(wxOK | wxCANCEL), 1, wxEXPAND, 8); - s->Add(s2, 0, wxEXPAND | wxALL & ~wxTOP, 8); + s->Add(s2, 0, wxEXPAND | (wxALL & ~wxTOP), 8); s->SetSizeHints(this); SetSizer(s); SetSize(600,500); diff --git a/src/gui/control/card_list.cpp b/src/gui/control/card_list.cpp index 84649db7..5d614cd0 100644 --- a/src/gui/control/card_list.cpp +++ b/src/gui/control/card_list.cpp @@ -103,7 +103,7 @@ void CardListBase::onAction(const Action& action, bool undone) { } TYPE_CASE(action, ReorderCardsAction) { if (sort_by_column >= 0) return; // nothing changes for us - if ((long)action.card_id1 < 0 || (long)action.card_id2 >= sorted_list.size()) return; + if ((long)action.card_id1 < 0 || (long)action.card_id2 >= (long)sorted_list.size()) return; if ((long)action.card_id1 == selected_item_pos || (long)action.card_id2 == selected_item_pos) { // Selected card has moved; also move in the sorted card list swap(sorted_list[action.card_id1], sorted_list[action.card_id2]); diff --git a/src/gui/control/card_list_column_select.cpp b/src/gui/control/card_list_column_select.cpp index 9cd639ad..da06ee29 100644 --- a/src/gui/control/card_list_column_select.cpp +++ b/src/gui/control/card_list_column_select.cpp @@ -34,7 +34,7 @@ CardListColumnSelectDialog::CardListColumnSelectDialog(Window* parent, const Gam s3->Add(new wxButton(this, ID_MOVE_DOWN, _BUTTON_("move down")), 0, wxEXPAND | wxTOP, 2); s3->Add(new wxButton(this, ID_SHOW, _BUTTON_("show")), 0, wxEXPAND | wxTOP, 2); s3->Add(new wxButton(this, ID_HIDE, _BUTTON_("hide")), 0, wxEXPAND | wxTOP, 2); - s2->Add(s3, 0, wxEXPAND | wxALL & ~wxTOP, 4); + s2->Add(s3, 0, wxEXPAND | (wxALL & ~wxTOP), 4); s->Add(s2 , 1, wxEXPAND | wxALL, 4); s->Add(CreateButtonSizer(wxOK | wxCANCEL) , 0, wxEXPAND | wxALL, 8); s->SetSizeHints(this); diff --git a/src/gui/control/graph.cpp b/src/gui/control/graph.cpp index a77bf463..205726ae 100644 --- a/src/gui/control/graph.cpp +++ b/src/gui/control/graph.cpp @@ -237,7 +237,7 @@ void GraphData::crossAxis(size_t axis1, size_t axis2, size_t axis3, vector bool matches(const GraphDataElement* v, const vector& match) { for (size_t i = 0 ; i < match.size() ; ++i) { - if (v->group_nrs[i] == -1 || match[i] != -1 && v->group_nrs[i] != match[i]) { + if (v->group_nrs[i] == -1 || (match[i] != -1 && v->group_nrs[i] != match[i])) { return false; } } diff --git a/src/gui/html_export_window.cpp b/src/gui/html_export_window.cpp index 84b8d742..be7f565b 100644 --- a/src/gui/html_export_window.cpp +++ b/src/gui/html_export_window.cpp @@ -36,7 +36,7 @@ HtmlExportWindow::HtmlExportWindow(Window* parent, const SetP& set, const Export // init sizers wxSizer* s = new wxBoxSizer(wxVERTICAL); s->Add(new wxStaticText(this, wxID_ANY, _LABEL_("html template")), 0, wxALL, 4); - s->Add(list, 0, wxEXPAND | wxALL & ~wxTOP, 4); + s->Add(list, 0, wxEXPAND | (wxALL & ~wxTOP), 4); wxSizer* s2 = new wxBoxSizer(wxHORIZONTAL); s2->Add(ExportWindowBase::Create(), 2, wxEXPAND); wxSizer* s3 = new wxStaticBoxSizer(wxVERTICAL, this, _LABEL_("html export options")); diff --git a/src/gui/image_slice_window.cpp b/src/gui/image_slice_window.cpp index 13d3385b..c413176e 100644 --- a/src/gui/image_slice_window.cpp +++ b/src/gui/image_slice_window.cpp @@ -145,7 +145,7 @@ ImageSliceWindow::ImageSliceWindow(Window* parent, const Image& source, const wx s5->Add(s6, 0, wxEXPAND | wxALL, 4); s5->AddStretchSpacer(1); wxSizer* s8 = zoom_sizer = new wxStaticBoxSizer(wxVERTICAL, this, _LABEL_("zoom")); - s8->Add(fix_aspect, 0, wxEXPAND | wxALL & ~wxBOTTOM, 4); + s8->Add(fix_aspect, 0, wxEXPAND | (wxALL & ~wxBOTTOM), 4); wxSizer* s9 = zoom_fixed = new wxFlexGridSizer(0, 3, 4, 5); s9->Add(new wxStaticText(this, wxID_ANY, _LABEL_("zoom amount")), 0, wxALIGN_CENTER_VERTICAL); s9->Add(zoom, 0, wxEXPAND); @@ -162,7 +162,7 @@ ImageSliceWindow::ImageSliceWindow(Window* parent, const Image& source, const wx s5->Add(s8, 0, wxEXPAND | wxALL, 4); s5->AddStretchSpacer(1); wxSizer* sB = new wxStaticBoxSizer(wxVERTICAL, this, _LABEL_("filter")); - sB->Add(sharpen, 0, wxEXPAND | wxALL & ~wxBOTTOM, 4); + sB->Add(sharpen, 0, wxEXPAND | (wxALL & ~wxBOTTOM), 4); sB->Add(sharpen_amount, 0, wxEXPAND | wxALL, 4); s5->Add(sB, 0, wxEXPAND | wxALL, 4); s5->AddStretchSpacer(1); diff --git a/src/gui/images_export_window.cpp b/src/gui/images_export_window.cpp index e1fd85bf..448cdc87 100644 --- a/src/gui/images_export_window.cpp +++ b/src/gui/images_export_window.cpp @@ -37,14 +37,14 @@ ImagesExportWindow::ImagesExportWindow(Window* parent, const SetP& set, const Ex wxSizer* s = new wxBoxSizer(wxVERTICAL); wxSizer* s2 = new wxStaticBoxSizer(wxVERTICAL, this, _LABEL_("export filenames")); s2->Add(new wxStaticText(this, -1, _LABEL_("filename format")), 0, wxALL, 4); - s2->Add(format, 0, wxEXPAND | wxALL & ~wxTOP, 4); + s2->Add(format, 0, wxEXPAND | (wxALL & ~wxTOP), 4); s2->Add(new wxStaticText(this, -1, _HELP_("filename format")), 0, wxALL & ~wxTOP, 4); s2->Add(new wxStaticText(this, -1, _LABEL_("filename conflicts")), 0, wxALL, 4); - s2->Add(conflicts, 0, wxEXPAND | wxALL & ~wxTOP, 4); + s2->Add(conflicts, 0, wxEXPAND | (wxALL & ~wxTOP), 4); s->Add(s2, 0, wxEXPAND | wxALL, 8); wxSizer* s3 = ExportWindowBase::Create(); - s->Add(s3, 1, wxEXPAND | wxALL & ~wxTOP, 8); - s->Add(CreateButtonSizer(wxOK | wxCANCEL), 0, wxEXPAND | wxALL & ~wxTOP, 8); + s->Add(s3, 1, wxEXPAND | (wxALL & ~wxTOP), 8); + s->Add(CreateButtonSizer(wxOK | wxCANCEL), 0, wxEXPAND | (wxALL & ~wxTOP), 8); s->SetSizeHints(this); SetSizer(s); SetSize(500,-1); diff --git a/src/gui/new_window.cpp b/src/gui/new_window.cpp index cb52faa4..1c6fdec2 100644 --- a/src/gui/new_window.cpp +++ b/src/gui/new_window.cpp @@ -37,9 +37,9 @@ NewSetWindow::NewSetWindow(Window* parent) // init sizer wxSizer* s = new wxBoxSizer(wxVERTICAL); s->Add(game_text, 0, wxALL, 4); - s->Add(game_list, 0, wxEXPAND | wxALL & ~wxTOP, 4); + s->Add(game_list, 0, wxEXPAND | (wxALL & ~wxTOP), 4); s->Add(stylesheet_text, 0, wxALL, 4); - s->Add(stylesheet_list, 0, wxEXPAND | wxALL & ~wxTOP, 4); + s->Add(stylesheet_list, 0, wxEXPAND | (wxALL & ~wxTOP), 4); s->Add(CreateButtonSizer(wxOK | wxCANCEL) , 0, wxEXPAND | wxALL, 8); s->SetSizeHints(this); SetSizer(s); @@ -147,7 +147,7 @@ SelectStyleSheetWindow::SelectStyleSheetWindow(Window* parent, const Game& game, wxSizer* s = new wxBoxSizer(wxVERTICAL); s->Add(description, 0, wxALL, 4); s->Add(stylesheet_text, 0, wxALL, 4); - s->Add(stylesheet_list, 0, wxEXPAND | wxALL & ~wxTOP, 4); + s->Add(stylesheet_list, 0, wxEXPAND | (wxALL & ~wxTOP), 4); s->Add(CreateButtonSizer(wxOK | wxCANCEL) , 0, wxEXPAND | wxALL, 8); s->SetSizeHints(this); SetSizer(s); diff --git a/src/gui/package_update_list.cpp b/src/gui/package_update_list.cpp index 44d6b551..8c0c7690 100644 --- a/src/gui/package_update_list.cpp +++ b/src/gui/package_update_list.cpp @@ -192,8 +192,8 @@ class PackageIconRequest : public ThumbnailRequest { PackageUpdateList::PackageUpdateList(Window* parent, const InstallablePackages& packages, bool show_only_installable, int id) : TreeList(parent, id) - , show_only_installable(show_only_installable) , packages(packages) + , show_only_installable(show_only_installable) { item_height = max(item_height,19); rebuild(); diff --git a/src/gui/packages_window.cpp b/src/gui/packages_window.cpp index bb3fa8c8..e90f5f59 100644 --- a/src/gui/packages_window.cpp +++ b/src/gui/packages_window.cpp @@ -255,7 +255,7 @@ void PackagesWindow::init(Window* parent, bool show_only_installable) { // Init sizer wxBoxSizer* v = new wxBoxSizer(wxVERTICAL); - v->Add(package_list, 1, wxEXPAND | wxALL & ~wxBOTTOM, 8); + v->Add(package_list, 1, wxEXPAND | (wxALL & ~wxBOTTOM), 8); v->AddSpacer(4); wxBoxSizer* h = new wxBoxSizer(wxHORIZONTAL); h->Add(package_info, 1, wxRIGHT, 4); @@ -266,8 +266,8 @@ void PackagesWindow::init(Window* parent, bool show_only_installable) { v2->AddStretchSpacer(); v2->Add(remove_button, 0, wxEXPAND | wxBOTTOM, 0); h->Add(v2); - v->Add(h, 0, wxEXPAND | wxALL & ~wxTOP, 8); - v->Add(CreateButtonSizer(wxOK | wxCANCEL), 0, wxEXPAND | wxALL & ~wxTOP, 8); + v->Add(h, 0, wxEXPAND | (wxALL & ~wxTOP), 8); + v->Add(CreateButtonSizer(wxOK | wxCANCEL), 0, wxEXPAND | (wxALL & ~wxTOP), 8); SetSizer(v); wxUpdateUIEvent::SetMode(wxUPDATE_UI_PROCESS_SPECIFIED); diff --git a/src/gui/preferences_window.cpp b/src/gui/preferences_window.cpp index 81a7963c..c20847cd 100644 --- a/src/gui/preferences_window.cpp +++ b/src/gui/preferences_window.cpp @@ -116,9 +116,9 @@ PreferencesWindow::PreferencesWindow(Window* parent) // init sizer wxSizer* s = new wxBoxSizer(wxVERTICAL); - s->Add(nb, 1, wxEXPAND | wxALL & ~wxBOTTOM, 8); + s->Add(nb, 1, wxEXPAND | (wxALL & ~wxBOTTOM), 8); s->AddSpacer(4); - s->Add(CreateButtonSizer(wxOK | wxCANCEL), 0, wxEXPAND | wxALL & ~wxTOP, 8); + s->Add(CreateButtonSizer(wxOK | wxCANCEL), 0, wxEXPAND | (wxALL & ~wxTOP), 8); s->SetSizeHints(this); SetSizer(s); } @@ -168,13 +168,13 @@ GlobalPreferencesPage::GlobalPreferencesPage(Window* parent) wxSizer* s = new wxBoxSizer(wxVERTICAL); s->SetSizeHints(this); wxSizer* s2 = new wxStaticBoxSizer(wxVERTICAL, this, _LABEL_("language")); - s2->Add(new wxStaticText(this, wxID_ANY, _LABEL_("app language")), 0, wxALL, 4); - s2->Add(language, 0, wxEXPAND | wxALL & ~wxTOP, 4); - s2->Add(new wxStaticText(this, wxID_ANY, _HELP_( "app language")), 0, wxALL, 4); - s->Add(s2, 0, wxALL | wxEXPAND, 8); + s2->Add(new wxStaticText(this, wxID_ANY, _LABEL_("app language")), 0, wxALL, 4); + s2->Add(language, 0, wxEXPAND | (wxALL & ~wxTOP), 4); + s2->Add(new wxStaticText(this, wxID_ANY, _HELP_( "app language")), 0, wxALL, 4); + s->Add(s2, 0, wxEXPAND | wxALL, 8); wxSizer* s3 = new wxStaticBoxSizer(wxVERTICAL, this, _LABEL_("windows")); s3->Add(open_sets_in_new_window, 0, wxALL, 4); - s->Add(s3, 0, wxALL & ~wxTOP | wxEXPAND, 8); + s->Add(s3, 0, wxEXPAND | (wxALL & ~wxTOP), 8); SetSizer(s); } @@ -216,7 +216,7 @@ DisplayPreferencesPage::DisplayPreferencesPage(Window* parent) zoom_int = static_cast(settings.default_stylesheet_settings.card_zoom() * 100); zoom->SetValue(String::Format(_("%d%%"),zoom_int)); int choices[] = {50,66,75,100,120,150,200}; - for (int i = 0 ; i < sizeof(choices)/sizeof(choices[0]) ; ++i) { + for (unsigned int i = 0 ; i < sizeof(choices)/sizeof(choices[0]) ; ++i) { zoom->Append(String::Format(_("%d%%"),choices[i])); } #else @@ -309,7 +309,7 @@ DirsPreferencesPage::DirsPreferencesPage(Window* parent) wxSizer* s3 = new wxBoxSizer(wxHORIZONTAL); s3->Add(apprentice, 1, wxEXPAND | wxRIGHT, 4); s3->Add(ab, 0, wxEXPAND); - s2->Add(s3, 0, wxEXPAND | wxALL & ~wxTOP, 4); + s2->Add(s3, 0, wxEXPAND | (wxALL & ~wxTOP), 4); s->Add(s2, 0, wxEXPAND | wxALL, 8); s->SetSizeHints(this); SetSizer(s); diff --git a/src/gui/set/keywords_panel.cpp b/src/gui/set/keywords_panel.cpp index 1d2e1582..42864cfa 100644 --- a/src/gui/set/keywords_panel.cpp +++ b/src/gui/set/keywords_panel.cpp @@ -58,7 +58,7 @@ void KeywordsPanel::initControls() { s0->Add(fixedI, 0, wxALIGN_CENTER | wxRIGHT, 10); s0->Add(fixedL, 0, wxALIGN_CENTER_VERTICAL); fixed->Add(new wxStaticLine(panel), 0, wxEXPAND | wxBOTTOM, 8); - fixed->Add(s0, 0, wxALL & ~wxTOP | wxALIGN_CENTER, 8); + fixed->Add(s0, 0, (wxALL & ~wxTOP) | wxALIGN_CENTER, 8); fixed->Add(new wxStaticLine(panel), 0, wxEXPAND | wxBOTTOM, 8); // init sizer for panel sp = new wxBoxSizer(wxVERTICAL); diff --git a/src/gui/set/random_pack_panel.cpp b/src/gui/set/random_pack_panel.cpp index 0bf4b4d9..48fcad76 100644 --- a/src/gui/set/random_pack_panel.cpp +++ b/src/gui/set/random_pack_panel.cpp @@ -337,12 +337,12 @@ CustomPackDialog::CustomPackDialog(Window* parent, const SetP& set, const PackTy s4->AddSpacer(2); wxFlexGridSizer* packsSizer = new wxFlexGridSizer(0, 2, 4, 4); packsSizer->AddGrowableCol(0); - s4->Add(packsSizer, 1, wxEXPAND | wxALL & ~wxTOP & ~wxLEFT, 4); + s4->Add(packsSizer, 1, wxEXPAND | (wxALL & ~wxTOP & ~wxLEFT), 4); s3->Add(s4, 1, wxEXPAND, 8); wxSizer* s5 = new wxStaticBoxSizer(wxHORIZONTAL, this, _LABEL_("pack totals")); s5->Add(totals, 1, wxEXPAND | wxALL, 4); s3->Add(s5, 1, wxEXPAND | wxLEFT, 8); - s->Add(s3, 0, wxEXPAND | wxALL & ~wxTOP, 8); + s->Add(s3, 0, wxEXPAND | (wxALL & ~wxTOP), 8); wxSizer* s6 = new wxBoxSizer(wxHORIZONTAL); if (can_remove) { s6->Add(remove, 0, wxALL & ~wxTOP & ~wxRIGHT, 8); @@ -467,9 +467,9 @@ void RandomPackPanel::initControls() { wxSizer* s4b = new wxBoxSizer(wxHORIZONTAL); packsSizer = new wxFlexGridSizer(0, 2, 4, 4); packsSizer->AddGrowableCol(0); - s4b->Add(packsSizer, 1, wxEXPAND | wxALL & ~wxTOP & ~wxLEFT, 4); + s4b->Add(packsSizer, 1, wxEXPAND | (wxALL & ~wxTOP & ~wxLEFT), 4); s4->Add(s4b, 1, wxEXPAND | wxLEFT, 2); - s4->Add(new wxButton(this, ID_CUSTOM_PACK, _BUTTON_("add custom pack")), 0, wxEXPAND | wxALIGN_TOP | wxALL & ~wxTOP, 4); + s4->Add(new wxButton(this, ID_CUSTOM_PACK, _BUTTON_("add custom pack")), 0, wxEXPAND | wxALIGN_TOP | (wxALL & ~wxTOP), 4); s3->Add(s4, 1, wxEXPAND, 8); wxSizer* s5 = new wxStaticBoxSizer(wxHORIZONTAL, this, _LABEL_("pack totals")); s5->Add(totals, 1, wxEXPAND | wxALL, 4); @@ -486,7 +486,7 @@ void RandomPackPanel::initControls() { //s6->Add(generate_button, 0, wxTOP | wxALIGN_RIGHT, 8); s6->Add(generate_button, 1, wxTOP | wxEXPAND, 8); s3->Add(s6, 0, wxEXPAND | wxLEFT, 8); - s2->Add(s3, 0, wxEXPAND | wxALL & ~wxTOP, 4); + s2->Add(s3, 0, wxEXPAND | (wxALL & ~wxTOP), 4); s2->Add(card_list, 1, wxEXPAND); s->Add(s2, 1, wxEXPAND, 8); s->SetSizeHints(this); diff --git a/src/gui/set/stats_panel.cpp b/src/gui/set/stats_panel.cpp index ec308b8d..798de64c 100644 --- a/src/gui/set/stats_panel.cpp +++ b/src/gui/set/stats_panel.cpp @@ -109,9 +109,9 @@ class StatDimensionList : public GalleryList { public: StatDimensionList(Window* parent, int id, bool show_empty, int dimension_count = 3) : GalleryList(parent, id, wxVERTICAL, false) - , show_empty(show_empty) , dimension_count(dimension_count) , prefered_dimension_count(dimension_count) + , show_empty(show_empty) { //item_size = wxSize(150, 23); subcolumns[0].size = wxSize(140,23); diff --git a/src/gui/update_checker.cpp b/src/gui/update_checker.cpp index f9588c22..d94001f0 100644 --- a/src/gui/update_checker.cpp +++ b/src/gui/update_checker.cpp @@ -190,7 +190,7 @@ void show_update_dialog(Window* parent) { // layout wxSizer* s = new wxBoxSizer(wxVERTICAL); s->Add(html, 1, wxEXPAND | wxALL, 8); - s->Add(close, 0, wxALIGN_RIGHT | wxALL & ~wxTOP, 8); + s->Add(close, 0, wxALIGN_RIGHT | (wxALL & ~wxTOP), 8); dlg->SetSizer(s); dlg->SetSize(400,400); dlg->Show(); diff --git a/src/gui/value/text.cpp b/src/gui/value/text.cpp index 5fe80655..a8d55752 100644 --- a/src/gui/value/text.cpp +++ b/src/gui/value/text.cpp @@ -111,7 +111,7 @@ struct DropDownWordListItem { DropDownListP submenu; inline bool active() const { return flags & FLAG_ACTIVE; } - inline void setActive(bool a) { flags = flags & ~FLAG_ACTIVE | a * FLAG_ACTIVE; } + inline void setActive(bool a) { flags = (flags & ~FLAG_ACTIVE) | a * FLAG_ACTIVE; } }; class DropDownWordList : public DropDownList { diff --git a/src/main.cpp b/src/main.cpp index 0773a546..89357526 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -211,7 +211,7 @@ int MSE::OnRun() { CLISetInterface cli_interface(set,quiet); return EXIT_SUCCESS; } else if (arg == _("--export")) { - if (argc <= 2 || argc <= 3 && starts_with(argv[2],_("--"))) { + if (argc <= 2 || (argc <= 3 && starts_with(argv[2],_("--")))) { handle_error(Error(_("No input file specified for --export"))); return EXIT_FAILURE; } diff --git a/src/script/context.cpp b/src/script/context.cpp index 2a2c68bc..edfb805b 100644 --- a/src/script/context.cpp +++ b/src/script/context.cpp @@ -515,6 +515,8 @@ void instrBinary (BinaryInstructionType i, ScriptValueP& a, const ScriptValueP& case I_OR_ELSE: if (at == SCRIPT_ERROR) a = b; break; + case I_ITERATOR_R: case I_MEMBER: + throw InternalError(_("ITERATOR_R/MEMBER instruction fell through!")); }} } diff --git a/src/util/index_map.hpp b/src/util/index_map.hpp index 45097aa8..58bb1a7d 100644 --- a/src/util/index_map.hpp +++ b/src/util/index_map.hpp @@ -33,12 +33,12 @@ template class IndexMap : private vector { public: + using typename vector::iterator; + using typename vector::const_iterator; + using typename vector::reference; + using typename vector::const_reference; using vector::empty; using vector::size; - using vector::iterator; - using vector::const_iterator; - using vector::reference; - using vector::const_reference; using vector::begin; using vector::end; using vector::clear; diff --git a/src/util/io/package.cpp b/src/util/io/package.cpp index 5cd031b0..7ff10898 100644 --- a/src/util/io/package.cpp +++ b/src/util/io/package.cpp @@ -340,6 +340,7 @@ void Package::loadZipStream() { } void Package::openDirectory() { + zipfile = false; openSubdir(wxEmptyString); } @@ -367,6 +368,7 @@ void Package::openSubdir(const String& name) { } void Package::openZipfile() { + zipfile = true; // close old streams delete fileStream; fileStream = nullptr; delete zipStream; zipStream = nullptr; @@ -380,6 +382,7 @@ void Package::openZipfile() { } void Package::saveToDirectory(const String& saveAs, bool remove_unused, bool is_copy) { + zipfile = false; // write to a directory VCSP vcs = getVCS(); FOR_EACH(f, files) { @@ -411,6 +414,7 @@ void Package::saveToDirectory(const String& saveAs, bool remove_unused, bool is_ } void Package::saveToZipfile(const String& saveAs, bool remove_unused, bool is_copy) { + zipfile = true; // create a temporary zip file name String tempFile = saveAs + _(".tmp"); wxRemoveFile(tempFile); diff --git a/src/util/io/package.hpp b/src/util/io/package.hpp index 89e9b65c..70cac18d 100644 --- a/src/util/io/package.hpp +++ b/src/util/io/package.hpp @@ -121,14 +121,8 @@ class Package : public IntrusivePtrVirtualBase { // --------------------------------------------------- : Managing the inside of the package : Reader/writer template - void readFile(const String& file, T& obj) { - Reader reader(openIn(file), dynamic_cast(this), absoluteFilename() + _("/") + file); - try { - reader.handle_greedy(obj); - } catch (const ParseError& err) { - throw FileParseError(err.what(), absoluteFilename() + _("/") + file); // more detailed message - } - } + void readFile(const String& file, T& obj); + template T readFile(const String& file) { T obj; @@ -146,6 +140,9 @@ class Package : public IntrusivePtrVirtualBase { // TODO: I dislike putting this here very much. There ought to be a better way. virtual VCSP getVCS() { return new_intrusive(); } + /// true if this is a zip file, false if a directory (updated on open/save) + bool isZipfile() { return zipfile; } + // --------------------------------------------------- : Private stuff private: @@ -165,6 +162,10 @@ class Package : public IntrusivePtrVirtualBase { String filename; /// Last modified time DateTime modified; + + /// Zipfile flag + bool zipfile; + public: /// Information on files in the package /** Note: must be public for DECLARE_TYPEOF to work */ @@ -278,5 +279,19 @@ intrusive_ptr open_package(const String& filename) { return package; } +// ----------------------------------------------------------------------------- : readFile definition + +// This is here because it uses dynamic_cast and must be to a complete type. +template +inline void Package::readFile(const String& file, T& obj) +{ + Reader reader(openIn(file), dynamic_cast(this), absoluteFilename() + _("/") + file); + try { + reader.handle_greedy(obj); + } catch (const ParseError& err) { + throw FileParseError(err.what(), absoluteFilename() + _("/") + file); // more detailed message + } +} + // ----------------------------------------------------------------------------- : EOF #endif