From 97564d40636aafb251644f61a0b990e392afd7a4 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Thu, 22 Oct 2020 21:56:33 +0200 Subject: Matrix: add pinned messages tab --- src/Body.cpp | 46 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) (limited to 'src/Body.cpp') diff --git a/src/Body.cpp b/src/Body.cpp index f1c101f..f9b3edc 100644 --- a/src/Body.cpp +++ b/src/Body.cpp @@ -35,6 +35,50 @@ namespace QuickMedia { set_title(std::move(_title)); } + BodyItem& BodyItem::operator=(BodyItem &other) { + url = other.url; + thumbnail_url = other.thumbnail_url; + attached_content_url = other.attached_content_url; + visible = other.visible; + dirty = other.dirty; + dirty_description = other.dirty_description; + dirty_author = other.dirty_author; + dirty_timestamp = other.dirty_timestamp; + thumbnail_is_local = other.thumbnail_is_local; + if(other.title_text) + title_text = std::make_unique(*other.title_text); + else + title_text = nullptr; + if(other.description_text) + description_text = std::make_unique(*other.description_text); + else + description_text = nullptr; + if(other.author_text) + author_text = std::make_unique(*other.author_text); + else + author_text = nullptr; + if(other.timestamp_text) + timestamp_text = std::make_unique(*other.timestamp_text); + else + timestamp_text = nullptr; + replies = other.replies; + post_number = other.post_number; + userdata = other.userdata; + last_drawn_time = other.last_drawn_time; + embedded_item_status = other.embedded_item_status; + embedded_item = other.embedded_item; + thumbnail_mask_type = other.thumbnail_mask_type; + thumbnail_size = other.thumbnail_size; + title = other.title; + description = other.description; + author = other.author; + timestamp = other.timestamp; + title_color = other.title_color; + author_color = other.author_color; + description_color = other.description_color; + return *this; + } + Body::Body(Program *program, sf::Font *font, sf::Font *bold_font, sf::Font *cjk_font, sf::Texture &loading_icon_texture) : font(font), bold_font(bold_font), @@ -362,7 +406,7 @@ namespace QuickMedia { float item_height = get_item_height(item.get()); prev_pos.y -= (item_height + spacing_y); - if(prev_pos.y + item_height + spacing_y < start_y) + if(prev_pos.y + item_height + spacing_y <= start_y) break; // This is needed here rather than above the loop, since update_dirty_text cant be called inside scissor because it corrupts the text for some reason -- cgit v1.2.3