fix compile

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