mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
fix compile
This commit is contained in:
@@ -86,7 +86,7 @@ void AddCardAction::perform(bool to_undo) {
|
||||
// Add or remove cards
|
||||
action.perform(set.cards, to_undo);
|
||||
// Update card links
|
||||
for (int i = 0; i < card_link_actions.size(); ++i) {
|
||||
for (size_t i = 0; i < card_link_actions.size(); ++i) {
|
||||
card_link_actions[i]->perform(to_undo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -300,7 +300,7 @@ double ssqrt(double x) {
|
||||
}
|
||||
|
||||
// Remove a single control point
|
||||
class SinglePointRemoveAction : public Action, public IntrusivePtrBase<SinglePointRemoveAction> {
|
||||
class SinglePointRemoveAction : public Action {
|
||||
public:
|
||||
SinglePointRemoveAction(const SymbolShapeP& shape, UInt position);
|
||||
|
||||
@@ -398,7 +398,7 @@ private:
|
||||
};
|
||||
|
||||
ControlPointRemoveAction::ControlPointRemoveAction(const SymbolShapeP& shape, const set<ControlPointP>& to_delete) {
|
||||
int index = 0;
|
||||
UInt index = 0;
|
||||
// find points to remove, in reverse order
|
||||
FOR_EACH(point, shape->points) {
|
||||
if (to_delete.find(point) != to_delete.end()) {
|
||||
|
||||
@@ -113,7 +113,7 @@ unique_ptr<TextValueAction> toggle_format_action(const TextValueP& value, vector
|
||||
size_t untagged_end_i = to_untagged_pos(new_value, end_i);
|
||||
int offset = 0;
|
||||
// Compute the changes
|
||||
for (int i = 0; i < tags.size() ; ++i) {
|
||||
for (size_t i = 0; i < tags.size() ; ++i) {
|
||||
const String& tag = tags[i];
|
||||
new_value = tag.Contains(":") ? compute_new_variable_value(new_value, tag, start_i, end_i):
|
||||
tag == _("li") ? compute_new_bullet_value (new_value, offset, start_i, end_i):
|
||||
@@ -204,7 +204,7 @@ String compute_new_variable_value(const String& str, const String& tag, size_t s
|
||||
if (end_i != String::npos) end_i++;
|
||||
}
|
||||
String prefix(substr(str, 0, start_i));
|
||||
String suffix = end_i == String::npos ? String() : substr(str, end_i);
|
||||
String suffix = end_i == String::npos ? String() : String(substr(str, end_i));
|
||||
String selection(substr(str, start_i, end_i - start_i));
|
||||
|
||||
// tally open tags that are variants of this tag
|
||||
@@ -259,7 +259,7 @@ String compute_new_variable_value(const String& str, const String& tag, size_t s
|
||||
selection = wrap_tag(selection, _("<") + tag + _(">"));
|
||||
|
||||
// add the tallied open and close tags
|
||||
for (int i = 0; i < tag_list.size() ; ++i) {
|
||||
for (size_t i = 0; i < tag_list.size() ; ++i) {
|
||||
String& new_tag = tag_list[i];
|
||||
int count = tag_map[new_tag];
|
||||
if (count > 0) {
|
||||
@@ -287,9 +287,9 @@ String compute_new_bullet_value(const String& str, int& offset, size_t start_i,
|
||||
min(str.find(_("<line"), end_i),
|
||||
str.find(_("<soft-line"), end_i))))));
|
||||
String prefix(substr(str, 0, start_i));
|
||||
String suffix = end_i == String::npos ? String() : substr(str, end_i);
|
||||
String suffix = end_i == String::npos ? String() : String(substr(str, end_i));
|
||||
String selection(substr(str, start_i, end_i - start_i));
|
||||
selection = _("<li><bullet>• </bullet>") + selection + _("</li>");
|
||||
selection = wxString::FromUTF8("<li><bullet>• </bullet>") + selection + _("</li>");
|
||||
offset += 1;
|
||||
return prefix + selection + suffix;
|
||||
}
|
||||
@@ -299,7 +299,7 @@ String compute_new_bullet_value(const String& str, int& offset, size_t start_i,
|
||||
end_i = str.find(_("</li>"), start_tag);
|
||||
if (end_i != String::npos) end_i += 5;
|
||||
String prefix(substr(str, 0, start_i));
|
||||
String suffix = end_i == String::npos ? String() : substr(str, end_i);
|
||||
String suffix = end_i == String::npos ? String() : String(substr(str, end_i));
|
||||
String selection(substr(str, start_i, end_i - start_i));
|
||||
selection = remove_tag(remove_tag_contents(selection, _("<bullet>")), _("<bullet>"));
|
||||
selection = remove_tag(selection, _("<li>"));
|
||||
|
||||
+1
-1
@@ -156,7 +156,7 @@ void Card::updateLinkedUID(const String& old_uid, const String& new_uid) {
|
||||
vector<CardP> Card::getLinkedRelationCards(const vector<CardP>& cards, const String& linked_relation, bool erase_if_no_card) {
|
||||
vector<CardP> other_cards;
|
||||
vector<int> indexes = findRelationLinks(linked_relation);
|
||||
for (int i = 0; i < indexes.size(); ++i) {
|
||||
for (size_t i = 0; i < indexes.size(); ++i) {
|
||||
String& linked_uid = getLinkedUID(indexes[i]);
|
||||
CardP other_card = getUIDCard(cards, linked_uid);
|
||||
if (other_card) other_cards.push_back(other_card);
|
||||
|
||||
@@ -198,7 +198,7 @@ Image export_image(const SetP& set,
|
||||
}
|
||||
// Write metadata
|
||||
String metadata = _("<mse-card-data>[");
|
||||
for (int i = 0; i < cards.size(); ++i) {
|
||||
for (size_t i = 0; i < cards.size(); ++i) {
|
||||
if (i > 0) metadata += _(",");
|
||||
CardP card = cards[i];
|
||||
bool rotated = is_rad90(angles[i]) || is_rad270(angles[i]); // we stored width and height after rotation, but export_metadata expects them before rotation
|
||||
|
||||
@@ -518,7 +518,7 @@ Image CropImage::generate(const Options& opt) {
|
||||
// prune out of bounds cards
|
||||
boost::json::array cardsv = metadata_to_json(metadata);
|
||||
boost::json::array inbounds_cardsv;
|
||||
for (int i = 0; i < cardsv.size(); i++) {
|
||||
for (size_t i = 0; i < cardsv.size(); i++) {
|
||||
boost::json::object cardv = cardsv[i].as_object();
|
||||
if (cardv.contains("bounds")) {
|
||||
String bounds = String(cardv["bounds"].as_string().c_str());
|
||||
|
||||
@@ -148,7 +148,7 @@ void AddJSONWindow::onBrowseFiles(wxCommandEvent&) {
|
||||
return false;
|
||||
}
|
||||
// Get headers
|
||||
for (int i = 0; i < count; ++i) {
|
||||
for (size_t i = 0; i < count; ++i) {
|
||||
const auto& card = card_array[i].as_object();
|
||||
for (auto it = card.begin(); it != card.end(); ++it) {
|
||||
boost::json::string_view jview = it->key();
|
||||
@@ -161,7 +161,7 @@ void AddJSONWindow::onBrowseFiles(wxCommandEvent&) {
|
||||
}
|
||||
}
|
||||
// Parse cards, add to table
|
||||
for (int i = 0; i < count; ++i) {
|
||||
for (size_t i = 0; i < count; ++i) {
|
||||
std::vector<ScriptValueP> row;
|
||||
auto& card = card_array[i].as_object();
|
||||
for (int h = 0; h < headers_out.size(); ++h) {
|
||||
|
||||
@@ -174,7 +174,7 @@ void BulkModificationWindow::onOk(wxCommandEvent&) {
|
||||
vector<CardP> cards;
|
||||
int selection_type = modification_selection->GetSelection();
|
||||
if (selection_type == 0) { // all
|
||||
for (int i = 0; i < set->cards.size(); ++i) {
|
||||
for (size_t i = 0; i < set->cards.size(); ++i) {
|
||||
cards.push_back(set->cards[i]);
|
||||
}
|
||||
} else if (selection_type == 1) { // currently filtered
|
||||
|
||||
@@ -122,7 +122,7 @@ void CardLinkWindow::onOk(wxCommandEvent&) {
|
||||
return;
|
||||
}
|
||||
vector<String> linked_uids;
|
||||
for (int i = 0; i < linked_cards.size(); ++i) {
|
||||
for (size_t i = 0; i < linked_cards.size(); ++i) {
|
||||
linked_uids.push_back(linked_cards[i]->uid);
|
||||
}
|
||||
// Find free links
|
||||
@@ -132,7 +132,7 @@ void CardLinkWindow::onOk(wxCommandEvent&) {
|
||||
}
|
||||
vector<int> free_link_indexes = selected_card->findFreeLinks(linked_uids, all_existing_uids);
|
||||
int free_link_count = 0;
|
||||
for (int i = 0; i < free_link_indexes.size(); ++i) {
|
||||
for (size_t i = 0; i < free_link_indexes.size(); ++i) {
|
||||
if (free_link_indexes[i] >= 0) free_link_count++;
|
||||
}
|
||||
if (free_link_count < linked_cards.size()) {
|
||||
@@ -155,14 +155,14 @@ void CardLinkWindow::onOk(wxCommandEvent&) {
|
||||
}
|
||||
// Make the actions
|
||||
vector<ActionP> actions;
|
||||
for (int i = 0; i < free_link_indexes.size(); ++i) {
|
||||
for (size_t i = 0; i < free_link_indexes.size(); ++i) {
|
||||
if (free_link_indexes[i] >= 0) {
|
||||
actions.push_back(make_intrusive<OneWayLinkCardsAction>(*set, selected_card, linked_uids[i], linked_relation_string, free_link_indexes[i]));
|
||||
}
|
||||
}
|
||||
// Find reciprocal free slots and make actions
|
||||
String& selected_uid = selected_card->uid;
|
||||
for (int i = 0; i < linked_cards.size(); ++i) {
|
||||
for (size_t i = 0; i < linked_cards.size(); ++i) {
|
||||
int free_link_index = linked_cards[i]->findFreeLink(selected_uid, all_existing_uids);
|
||||
if (free_link_index >= 0) {
|
||||
actions.push_back(make_intrusive<OneWayLinkCardsAction>(*set, linked_cards[i], selected_uid, selected_relation_string, free_link_index));
|
||||
|
||||
@@ -148,7 +148,7 @@ void PrintJob::align_cards() {
|
||||
double x = page_layout[j].pos.width;
|
||||
double y = page_layout[j].pos.height;
|
||||
// if another card is almost aligned
|
||||
for (int i = 0; i < page_layout.size(); ++i) {
|
||||
for (size_t i = 0; i < page_layout.size(); ++i) {
|
||||
if (i == j) continue;
|
||||
double difference = page_layout[i].pos.width - x;
|
||||
if (threshold_bottom < difference && difference <= threshold_top) {
|
||||
@@ -190,7 +190,7 @@ void PrintJob::center_cards() {
|
||||
for (int p = 0; p < page_layouts.size(); ++p) {
|
||||
vector<CardLayout>& page_layout = page_layouts[p];
|
||||
RealSize page_margin(0.0, 0.0);
|
||||
for (int i = 0; i < page_layout.size(); ++i) {
|
||||
for (size_t i = 0; i < page_layout.size(); ++i) {
|
||||
double width = page_layout[i].pos.width + page_layout[i].size_mm.width;
|
||||
double height = page_layout[i].pos.height + page_layout[i].size_mm.height;
|
||||
if (page_margin.width < width) page_margin.width = width;
|
||||
@@ -199,7 +199,7 @@ void PrintJob::center_cards() {
|
||||
page_margin.width = (page_size.width - page_margin.width) / 2;
|
||||
page_margin.height = (page_size.height - page_margin.height) / 2;
|
||||
page_margins.push_back(page_margin);
|
||||
for (int i = 0; i < page_layout.size(); ++i) {
|
||||
for (size_t i = 0; i < page_layout.size(); ++i) {
|
||||
page_layout[i].pos.width += page_margin.width;
|
||||
page_layout[i].pos.height += page_margin.height;
|
||||
}
|
||||
@@ -332,7 +332,7 @@ void CardsPrintout::drawCutterLines(DC& dc, PrintJobP& job, int page) {
|
||||
dc.SetPen(pen);
|
||||
// vertical
|
||||
int v_bleed = printer_px_per_mm.width * settings.print_bleed;
|
||||
for (int i = 0; i < page_layouts.size(); ++i) {
|
||||
for (size_t i = 0; i < page_layouts.size(); ++i) {
|
||||
double left_line = page_layouts[i].pos.width;
|
||||
double right_line = left_line + page_layouts[i].size_mm.width;
|
||||
bool draw_left_line = true;
|
||||
@@ -370,7 +370,7 @@ void CardsPrintout::drawCutterLines(DC& dc, PrintJobP& job, int page) {
|
||||
}
|
||||
// horizontal
|
||||
int h_bleed = printer_px_per_mm.height * settings.print_bleed;
|
||||
for (int i = 0; i < page_layouts.size(); ++i) {
|
||||
for (size_t i = 0; i < page_layouts.size(); ++i) {
|
||||
double top_line = page_layouts[i].pos.height;
|
||||
double bottom_line = top_line + page_layouts[i].size_mm.height;
|
||||
bool draw_top_line = true;
|
||||
|
||||
@@ -480,7 +480,7 @@ bool TextValueEditor::onChar(wxKeyEvent& ev) {
|
||||
String suffix;
|
||||
if (is_in_tag(value().value(), _("<li"), selection_start_i, selection_end_i)) {
|
||||
prefix = _("</li>");
|
||||
suffix = _("<li><bullet>• </bullet>");
|
||||
suffix = wxString::FromUTF8("<li><bullet>• </bullet>");
|
||||
}
|
||||
if (ev.ShiftDown()) {
|
||||
// soft line break
|
||||
|
||||
@@ -46,11 +46,11 @@ void FontTextElement::getCharInfo(RotatedDC& dc, double scale, vector<CharInfo>&
|
||||
} else {
|
||||
RealSize s = dc.GetTextExtent(content.substr(line_start - this->start, i - line_start + 1));
|
||||
out.push_back(CharInfo(
|
||||
RealSize(s.width - prev_width, s.height),
|
||||
c == _(' ') ? LineBreak::SPACE : LineBreak::MAYBE,
|
||||
draw_as == DRAW_ACTIVE, // from <soft> tag
|
||||
c == _('•')
|
||||
));
|
||||
RealSize(s.width - prev_width, s.height),
|
||||
c == _(' ') ? LineBreak::SPACE : LineBreak::MAYBE,
|
||||
draw_as == DRAW_ACTIVE, // from <soft> tag
|
||||
c == wxChar(0x2022) //bullet point character
|
||||
));
|
||||
prev_width = s.width;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ PackTypeP json_to_mse_pack_type(boost::json::object& jv) {
|
||||
read(pack_type->select, jv, "select");
|
||||
if (jv.contains("items") && jv["items"].is_array()) {
|
||||
boost::json::array pack_itemsv = jv["items"].as_array();
|
||||
for (int i = 0; i < pack_itemsv.size(); i++) {
|
||||
for (size_t i = 0; i < pack_itemsv.size(); i++) {
|
||||
boost::json::object pack_itemv = pack_itemsv[i].as_object();
|
||||
pack_type->items.emplace_back(json_to_mse_pack_item(pack_itemv));
|
||||
}
|
||||
@@ -280,7 +280,7 @@ SetP json_to_mse_set(boost::json::object& jv) {
|
||||
// cards
|
||||
if (jv.contains("cards") && jv["cards"].is_array()) {
|
||||
boost::json::array cardsv = jv["cards"].as_array();
|
||||
for (int i = 0; i < cardsv.size(); i++) {
|
||||
for (size_t i = 0; i < cardsv.size(); i++) {
|
||||
boost::json::object cardv = cardsv[i].as_object();
|
||||
set->cards.emplace_back(json_to_mse_card(cardv, set.get()));
|
||||
}
|
||||
@@ -288,7 +288,7 @@ SetP json_to_mse_set(boost::json::object& jv) {
|
||||
// keywords
|
||||
if (jv.contains("keywords") && jv["keywords"].is_array()) {
|
||||
boost::json::array keywordsv = jv["keywords"].as_array();
|
||||
for (int i = 0; i < keywordsv.size(); i++) {
|
||||
for (size_t i = 0; i < keywordsv.size(); i++) {
|
||||
boost::json::object keywordv = keywordsv[i].as_object();
|
||||
set->keywords.emplace_back(json_to_mse_keyword(keywordv));
|
||||
}
|
||||
@@ -296,7 +296,7 @@ SetP json_to_mse_set(boost::json::object& jv) {
|
||||
// pack types
|
||||
if (jv.contains("pack_types") && jv["pack_types"].is_array()) {
|
||||
boost::json::array pack_typesv = jv["pack_types"].as_array();
|
||||
for (int i = 0; i < pack_typesv.size(); i++) {
|
||||
for (size_t i = 0; i < pack_typesv.size(); i++) {
|
||||
boost::json::object pack_typev = pack_typesv[i].as_object();
|
||||
set->pack_types.emplace_back(json_to_mse_pack_type(pack_typev));
|
||||
}
|
||||
@@ -333,7 +333,7 @@ ScriptValueP json_to_mse(const boost::json::value& jv, Set* set) {
|
||||
else if (jv.is_array()) {
|
||||
boost::json::array array = jv.get_array();
|
||||
ScriptCustomCollectionP result = make_intrusive<ScriptCustomCollection>();
|
||||
for (int i = 0; i < array.size(); ++i) {
|
||||
for (size_t i = 0; i < array.size(); ++i) {
|
||||
boost::json::value jvalue = array[i];
|
||||
ScriptValueP value = json_to_mse(jvalue, set);
|
||||
result->value.push_back(value);
|
||||
@@ -868,7 +868,7 @@ boost::json::value mse_to_json(const ScriptValueP& sv, Set* set) {
|
||||
if (custom) {
|
||||
if (custom->value.size() > 0) {
|
||||
boost::json::array array;
|
||||
for (int i = 0; i < custom->value.size(); i++) {
|
||||
for (size_t i = 0; i < custom->value.size(); i++) {
|
||||
array.emplace_back(mse_to_json(custom->value[i], set));
|
||||
}
|
||||
return array;
|
||||
@@ -888,7 +888,7 @@ boost::json::value mse_to_json(const ScriptValueP& sv, Set* set) {
|
||||
if (a.is_array() && b.is_array()) {
|
||||
boost::json::array array_a = a.get_array();
|
||||
boost::json::array array_b = b.get_array();
|
||||
for (int i = 0; i < array_b.size(); i++) {
|
||||
for (size_t i = 0; i < array_b.size(); i++) {
|
||||
array_a.emplace_back(array_b[i]);
|
||||
}
|
||||
return array_a;
|
||||
|
||||
Reference in New Issue
Block a user