Commit e4ca68e6 authored by coppro's avatar coppro

Fix warnings

Semi-fix bug #6 (does not work if the zipfile was loaded from a directory)
parent 74215961
......@@ -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"
......
......@@ -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"
......
......@@ -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 {
......
......@@ -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"); }
......
......@@ -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;
......
......@@ -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);
}
......
......@@ -28,14 +28,14 @@ DECLARE_TYPEOF_NO_REV(IndexMap<FieldP COMMA ValueP>);
// ----------------------------------------------------------------------------- : Set
Set::Set()
: script_manager(new SetScriptManager(*this))
, vcs (new_intrusive<VCS>())
: vcs (new_intrusive<VCS>())
, script_manager(new SetScriptManager(*this))
{}
Set::Set(const GameP& game)
: game(game)
, script_manager(new SetScriptManager(*this))
, vcs (new_intrusive<VCS>())
, 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<VCS>())
, 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> (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<String> used;
FOR_EACH(card, cards) {
String filename = normalize_internal_filename(clean_filename(card->identification()));
......@@ -222,8 +225,6 @@ void Set::reflect_cards<Writer> (Writer& tag) {
referenceFile(full_name);
REFLECT_N("include file", full_name);
}
} else {
REFLECT(cards);
}
}
......
......@@ -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) {
......
......@@ -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&) {
......
......@@ -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);
......
......@@ -30,8 +30,8 @@ ExportCardSelectionChoice::ExportCardSelectionChoice(const Set& set)
ExportCardSelectionChoice::ExportCardSelectionChoice(const String& label, const vector<CardP>& cards)
: label(label)
, type(EXPORT_SEL_SUBSET)
, own_cards(cards)
, the_cards(&own_cards)
, own_cards(cards)
{}
ExportCardSelectionChoice::ExportCardSelectionChoice(const String& label, const vector<CardP>* 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);
......
......@@ -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]);
......
......@@ -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);
......
......@@ -237,7 +237,7 @@ void GraphData::crossAxis(size_t axis1, size_t axis2, size_t axis3, vector<UInt>
bool matches(const GraphDataElement* v, const vector<int>& 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;
}
}
......
......@@ -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"));
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
......@@ -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();
......
......@@ -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);
......
......@@ -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<int>(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);
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
......@@ -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();
......
......@@ -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 {
......
......@@ -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;
}
......
......@@ -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!"));
}}
}
......
......@@ -33,12 +33,12 @@
template <typename Key, typename Value>
class IndexMap : private vector<Value> {
public:
using typename vector<Value>::iterator;
using typename vector<Value>::const_iterator;
using typename vector<Value>::reference;
using typename vector<Value>::const_reference;
using vector<Value>::empty;
using vector<Value>::size;
using vector<Value>::iterator;
using vector<Value>::const_iterator;
using vector<Value>::reference;
using vector<Value>::const_reference;
using vector<Value>::begin;
using vector<Value>::end;
using vector<Value>::clear;
......
......@@ -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);
......
......@@ -121,14 +121,8 @@ class Package : public IntrusivePtrVirtualBase {
// --------------------------------------------------- : Managing the inside of the package : Reader/writer
template <typename T>
void readFile(const String& file, T& obj) {
Reader reader(openIn(file), dynamic_cast<Packaged*>(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 <typename T>
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<VCS>(); }
/// 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<T> 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 <typename T>
inline void Package::readFile(const String& file, T& obj)
{
Reader reader(openIn(file), dynamic_cast<Packaged*>(this), absoluteFilename() + _("/") + file);
try {
reader.handle_greedy(obj);
} catch (const ParseError& err) {
throw FileParseError(err.what(), absoluteFilename() + _("/") + file); // more detailed message
}
}
// ----------------------------------------------------------------------------- : EOF
#endif
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