MCPcopy Create free account
hub / github.com/ErrorAtLine0/infinipaint / load_file

Method load_file

src/CanvasComponents/TextBoxCanvasComponent.cpp:64–81  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

62}
63
64void 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
83std::unique_ptr<CanvasComponent> TextBoxCanvasComponent::get_data_copy() const {
84 auto toRet = std::make_unique<TextBoxCanvasComponent>();

Callers

nothing calls this directly

Calls 5

VersionNumberClass · 0.85
set_rich_text_dataMethod · 0.80
moveMethod · 0.80
insertMethod · 0.45

Tested by

no test coverage detected