slowly getting back...also, static linking

This commit is contained in:
2025-09-21 23:57:17 -04:00
parent 8039df667c
commit 7f07eaa128
20 changed files with 4579 additions and 631 deletions

View File

@@ -10,27 +10,27 @@ void clipboard_copy(Clipboard* self) {
switch (self->type) {
case CLIPBOARD_FRAME: {
Anm2Reference* reference = std::get_if<Anm2Reference>(&self->location);
if (!reference)
break;
Anm2Frame* frame = anm2_frame_from_reference(self->anm2, *reference);
if (!frame)
break;
anm2_frame_serialize_to_string(frame, reference->itemType, &clipboardText);
clipboard_text_set();
if (Anm2Reference* reference = std::get_if<Anm2Reference>(&self->destination)) {
if (Anm2Frame* frame = anm2_frame_from_reference(self->anm2, *reference)) {
anm2_frame_serialize_to_string(frame, reference->itemType, &clipboardText);
clipboard_text_set();
}
}
break;
}
case CLIPBOARD_ANIMATION: {
int* id = std::get_if<int>(&self->location);
if (!id)
break;
Anm2Animation* animation = map_find(self->anm2->animations, *id);
if (!animation)
break;
anm2_animation_serialize_to_string(animation, &clipboardText);
clipboard_text_set();
if (std::set<int>* set = std::get_if<std::set<int>>(&self->source)) {
for (auto& i : *set) {
if (Anm2Animation* animation = anm2_animation_from_reference(self->anm2, {i})) {
std::string animationText{};
anm2_animation_serialize_to_string(animation, &animationText);
clipboardText += animationText;
}
}
clipboard_text_set();
}
break;
} break;
}
default:
break;
}
@@ -41,17 +41,13 @@ void clipboard_cut(Clipboard* self) {
switch (self->type) {
case CLIPBOARD_FRAME: {
Anm2Reference* reference = std::get_if<Anm2Reference>(&self->location);
if (!reference)
break;
anm2_frame_remove(self->anm2, *reference);
if (Anm2Reference* reference = std::get_if<Anm2Reference>(&self->destination))
anm2_frame_remove(self->anm2, *reference);
break;
}
case CLIPBOARD_ANIMATION: {
int* id = std::get_if<int>(&self->location);
if (!id)
break;
anm2_animation_remove(self->anm2, *id);
if (std::set<int>* set = std::get_if<std::set<int>>(&self->source))
anm2_animations_remove(self->anm2, *set);
break;
}
default:
@@ -69,25 +65,25 @@ bool clipboard_paste(Clipboard* self) {
switch (self->type) {
case CLIPBOARD_FRAME: {
Anm2Reference* reference = std::get_if<Anm2Reference>(&self->location);
if (!reference)
break;
Anm2Frame frame;
if (anm2_frame_deserialize_from_xml(&frame, clipboard_string()))
if (Anm2Reference* reference = std::get_if<Anm2Reference>(&self->destination)) {
Anm2Frame frame;
if (!anm2_frame_deserialize_from_xml(&frame, clipboard_string()))
return false;
anm2_frame_add(self->anm2, &frame, *reference);
else
return false;
}
break;
}
case CLIPBOARD_ANIMATION: {
int* id = std::get_if<int>(&self->location);
if (!id)
break;
Anm2Animation animation;
if (anm2_animation_deserialize_from_xml(&animation, clipboard_string()))
anm2_animation_add(self->anm2, &animation, *id);
else
return false;
if (int* index = std::get_if<int>(&self->destination)) {
std::vector<Anm2Animation> clipboardAnimations;
if (!anm2_animations_deserialize_from_xml(clipboardAnimations, clipboard_string()))
return false;
int useIndex = std::clamp(*index + 1, 0, (int)self->anm2->animations.size());
for (auto& animation : clipboardAnimations)
anm2_animation_add(self->anm2, &animation, useIndex++);
}
break;
}
default:
@@ -98,5 +94,4 @@ bool clipboard_paste(Clipboard* self) {
}
void clipboard_init(Clipboard* self, Anm2* anm2) { self->anm2 = anm2; }
bool clipboard_is_value(void) { return SDL_HasClipboardText(); }