| 62 | } |
| 63 | |
| 64 | void TextBoxCanvasComponent::load_file(cereal::PortableBinaryInputArchive& a, VersionNumber version) { |
| 65 | if(version >= VersionNumber(0, 3, 0)) { |
| 66 | TextData richText; |
| 67 | a(d.p1, d.p2, richText); |
| 68 | textBox->set_rich_text_data(richText); |
| 69 | } |
| 70 | else { |
| 71 | bool loadedEditing; // Unused |
| 72 | Vector4f textColor; |
| 73 | float textSize; |
| 74 | RichText::TextBox::Cursor loadedCursor; // Unused, Equivalent to old cursor structure, just paragraph index and text index flipped |
| 75 | std::string currentText; |
| 76 | a(loadedEditing, d.p1, d.p2, textColor, textSize, loadedCursor, currentText); |
| 77 | textBox->insert({0, 0}, currentText); |
| 78 | textBox->set_text_style_modifier_between({0, 0}, textBox->move(RichText::TextBox::Movement::END, {0, 0}), std::make_shared<ColorTextStyleModifier>(textColor)); |
| 79 | textBox->set_text_style_modifier_between({0, 0}, textBox->move(RichText::TextBox::Movement::END, {0, 0}), std::make_shared<SizeTextStyleModifier>(textSize)); |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | std::unique_ptr<CanvasComponent> TextBoxCanvasComponent::get_data_copy() const { |
| 84 | auto toRet = std::make_unique<TextBoxCanvasComponent>(); |
nothing calls this directly
no test coverage detected