Compare commits
2 Commits
dev-5ac318
...
dev-c887fd
Author | SHA1 | Date | |
---|---|---|---|
c887fdac8a | |||
4b0d9595ac |
2
external/solanaceae_contact
vendored
2
external/solanaceae_contact
vendored
Submodule external/solanaceae_contact updated: 7710da6c89...e8b069c803
2
external/solanaceae_tox
vendored
2
external/solanaceae_tox
vendored
Submodule external/solanaceae_tox updated: 560eab1f6c...2807239dea
@ -46,6 +46,8 @@ static void drawIconDirect(
|
||||
const ImU32 col_back
|
||||
) {
|
||||
// dark background
|
||||
// the circle looks bad in light mode
|
||||
//ImGui::GetWindowDrawList()->AddCircleFilled({p0.x + p1_o.x*0.5f, p0.y + p1_o.y*0.5f}, p1_o.x*0.5f, col_back);
|
||||
drawIconDirectLines(p0, p1_o, col_back, 4.0f);
|
||||
drawIconDirectLines(p0, p1_o, col_main, 1.5f);
|
||||
}
|
||||
@ -78,8 +80,11 @@ static void drawIconCloud(
|
||||
{0.2f, 0.9f},
|
||||
}};
|
||||
for (auto& v : points) {
|
||||
v.y -= 0.1f;
|
||||
v = {p0.x + p1_o.x*v.x, p0.y + p1_o.y*v.y};
|
||||
}
|
||||
// the circle looks bad in light mode
|
||||
//ImGui::GetWindowDrawList()->AddCircleFilled({p0.x + p1_o.x*0.5f, p0.y + p1_o.y*0.5f}, p1_o.x*0.5f, col_back);
|
||||
ImGui::GetWindowDrawList()->AddPolyline(points.data(), points.size(), col_back, ImDrawFlags_None, 4.f);
|
||||
ImGui::GetWindowDrawList()->AddPolyline(points.data(), points.size(), col_main, ImDrawFlags_None, 1.5f);
|
||||
}
|
||||
@ -194,45 +199,44 @@ bool renderContactBig(
|
||||
orig_curser_pos.y + ImGui::GetStyle().FramePadding.y
|
||||
};
|
||||
|
||||
float img_y {
|
||||
//(post_curser_pos.y - orig_curser_pos.y) - ImGui::GetStyle().FramePadding.y*2
|
||||
TEXT_BASE_HEIGHT*line_height - ImGui::GetStyle().FramePadding.y*2
|
||||
};
|
||||
float img_y {TEXT_BASE_HEIGHT*line_height - ImGui::GetStyle().FramePadding.y*2};
|
||||
|
||||
ImGui::SetCursorPos(img_curser);
|
||||
|
||||
{ // avatar stuff
|
||||
|
||||
// icon pos
|
||||
auto p0 = ImGui::GetCursorScreenPos();
|
||||
p0.x += img_y * 0.5f;
|
||||
p0.y += img_y * 0.5f;
|
||||
ImVec2 p1_o = {img_y, img_y};;
|
||||
p1_o.x *= 0.5f;
|
||||
p1_o.y *= 0.5f;
|
||||
|
||||
renderAvatar(th, contact_tc, c, {img_y, img_y});
|
||||
|
||||
if (cstate != nullptr) {
|
||||
if (cstate->state == Contact::Components::ConnectionState::direct) { // direct icon
|
||||
const ImU32 col_back = ImGui::GetColorU32({0.0f, 0.0f, 0.0f, 0.8f});
|
||||
const ImU32 col_main = ImGui::GetColorU32({0.1f, 1.f, 0.1f, 1.0f});
|
||||
|
||||
drawIconDirect(p0, p1_o, col_main, col_back);
|
||||
} else if (cstate->state == Contact::Components::ConnectionState::cloud) { // cloud icon
|
||||
const ImU32 col_back = ImGui::GetColorU32({0.0f, 0.0f, 0.0f, 0.8f});
|
||||
const ImU32 col_main = ImGui::GetColorU32({0.5f, 1.f, 0.1f, 1.0f});
|
||||
|
||||
drawIconCloud(p0, p1_o, col_main, col_back);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
ImGui::BeginGroup();
|
||||
{
|
||||
// line 1
|
||||
{ // line 1
|
||||
if (line_height == 1 && cstate != nullptr) {
|
||||
// icon pos
|
||||
auto p0 = ImGui::GetCursorScreenPos();
|
||||
p0.y += ImGui::GetStyle().FramePadding.y;
|
||||
ImVec2 p1_o = {img_y, img_y}; // img_y is 1 line_height in this case
|
||||
|
||||
const ImU32 col_back = ImGui::GetColorU32(th.getColor<ThemeCol_Contact::icon_backdrop>());
|
||||
if (cstate->state == Contact::Components::ConnectionState::direct) { // direct icon
|
||||
drawIconDirect(
|
||||
p0,
|
||||
p1_o,
|
||||
ImGui::GetColorU32(th.getColor<ThemeCol_Contact::avatar_online_direct>()),
|
||||
col_back
|
||||
);
|
||||
} else if (cstate->state == Contact::Components::ConnectionState::cloud) { // cloud icon
|
||||
drawIconCloud(
|
||||
p0,
|
||||
p1_o,
|
||||
ImGui::GetColorU32(th.getColor<ThemeCol_Contact::avatar_online_cloud>()),
|
||||
col_back
|
||||
);
|
||||
}
|
||||
ImGui::Dummy(p1_o);
|
||||
ImGui::SameLine(0.f, ImGui::GetStyle().ItemSpacing.x*0.5f);
|
||||
}
|
||||
|
||||
ImGui::Text("%s%s", unread?"* ":"", (c.all_of<Contact::Components::Name>() ? c.get<Contact::Components::Name>().name.c_str() : "<unk>"));
|
||||
}
|
||||
|
||||
// line 2
|
||||
if (line_height >= 2) {
|
||||
@ -241,7 +245,46 @@ bool renderContactBig(
|
||||
} else if (request_outgoing) {
|
||||
ImGui::TextUnformatted("Outgoing request/invite");
|
||||
} else {
|
||||
ImGui::TextDisabled("status message...");
|
||||
if (cstate != nullptr) {
|
||||
// icon pos
|
||||
auto p0 = ImGui::GetCursorScreenPos();
|
||||
p0.y += ImGui::GetStyle().FramePadding.y;
|
||||
const float box_hight = TEXT_BASE_HEIGHT - ImGui::GetStyle().FramePadding.y*2;
|
||||
ImVec2 p1_o = {box_hight, box_hight};
|
||||
|
||||
const ImU32 col_back = ImGui::GetColorU32(th.getColor<ThemeCol_Contact::icon_backdrop>());
|
||||
if (cstate->state == Contact::Components::ConnectionState::direct) { // direct icon
|
||||
drawIconDirect(
|
||||
p0,
|
||||
p1_o,
|
||||
ImGui::GetColorU32(th.getColor<ThemeCol_Contact::avatar_online_direct>()),
|
||||
col_back
|
||||
);
|
||||
} else if (cstate->state == Contact::Components::ConnectionState::cloud) { // cloud icon
|
||||
drawIconCloud(
|
||||
p0,
|
||||
p1_o,
|
||||
ImGui::GetColorU32(th.getColor<ThemeCol_Contact::avatar_online_cloud>()),
|
||||
col_back
|
||||
);
|
||||
}
|
||||
ImGui::Dummy(p1_o);
|
||||
ImGui::SameLine(0.f, ImGui::GetStyle().ItemSpacing.x*0.5f);
|
||||
}
|
||||
|
||||
if (
|
||||
const auto* slt = c.try_get<Contact::Components::StatusText>();
|
||||
slt != nullptr &&
|
||||
!slt->text.empty() &&
|
||||
slt->first_line_length > 0 &&
|
||||
slt->first_line_length <= slt->text.size()
|
||||
) {
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, ImGui::GetStyle().Colors[ImGuiCol_TextDisabled]);
|
||||
ImGui::TextUnformatted(slt->text.c_str(), slt->text.c_str() + slt->first_line_length);
|
||||
ImGui::PopStyleColor();
|
||||
} else {
|
||||
ImGui::TextDisabled(""); // or dummy?
|
||||
}
|
||||
}
|
||||
|
||||
// line 3
|
||||
|
@ -13,6 +13,8 @@ enum class ThemeCol_Contact {
|
||||
avatar_online_direct,
|
||||
avatar_online_cloud,
|
||||
avatar_offline,
|
||||
|
||||
icon_backdrop,
|
||||
};
|
||||
|
||||
// returns true if clicked, if selectable, will highlight on hover and respect selected
|
||||
|
@ -44,9 +44,11 @@ Theme getDefaultThemeDark(void) {
|
||||
t.setColor<ThemeCol_Contact::request_incoming >({0.98f, 0.41f, 0.26f, 0.52f});
|
||||
t.setColor<ThemeCol_Contact::request_outgoing >({0.98f, 0.26f, 0.41f, 0.52f});
|
||||
|
||||
t.setColor<ThemeCol_Contact::avatar_online_direct>({0.3, 1, 0, 1});
|
||||
t.setColor<ThemeCol_Contact::avatar_online_cloud>({0, 1, 0.8, 1});
|
||||
t.setColor<ThemeCol_Contact::avatar_offline>({0.4, 0.4, 0.4, 1});
|
||||
t.setColor<ThemeCol_Contact::avatar_online_direct >({0.3f, 1.0f, 0.0f, 1.0f});
|
||||
t.setColor<ThemeCol_Contact::avatar_online_cloud >({0.0f, 1.0f, 0.8f, 1.0f});
|
||||
t.setColor<ThemeCol_Contact::avatar_offline >({0.4f, 0.4f, 0.4f, 1.0f});
|
||||
|
||||
t.setColor<ThemeCol_Contact::icon_backdrop >({0.0f, 0.0f, 0.0f, 0.4f});
|
||||
|
||||
return t;
|
||||
}
|
||||
|
@ -227,12 +227,13 @@ float ChatGui4::render(float time_delta) {
|
||||
|
||||
if (sub_contacts != nullptr && !_cr.all_of<Contact::Components::TagPrivate>(*_selected_contact) && _cr.all_of<Contact::Components::TagGroup>(*_selected_contact)) {
|
||||
if (!sub_contacts->empty()) {
|
||||
if (ImGui::BeginChild("subcontacts", {150, -100}, true)) {
|
||||
if (ImGui::BeginChild("subcontacts", {175, -100}, true)) {
|
||||
ImGui::Text("subs: %zu", sub_contacts->size());
|
||||
ImGui::Separator();
|
||||
for (const auto& c : *sub_contacts) {
|
||||
// TODO: can a sub be selected? no
|
||||
if (renderSubContactListContact(c, _selected_contact.has_value() && *_selected_contact == c)) {
|
||||
//if (renderSubContactListContact(c, _selected_contact.has_value() && *_selected_contact == c)) {
|
||||
if (renderContactBig(_theme, _contact_tc, {_cr, c}, 1)) {
|
||||
_text_input_buffer.insert(0, (_cr.all_of<Contact::Components::Name>(c) ? _cr.get<Contact::Components::Name>(c).name : "<unk>") + ": ");
|
||||
}
|
||||
}
|
||||
@ -325,7 +326,7 @@ float ChatGui4::render(float time_delta) {
|
||||
msg_reg.view<Components::UnreadFade>().each([&to_remove, time_delta](const Message3 e, Components::UnreadFade& fade) {
|
||||
// TODO: configurable
|
||||
const float fade_duration = 7.5f;
|
||||
fade.fade -= 1.f/fade_duration * std::min<float>(time_delta, 1.f/10.f); // fps but not below 10 for smooth fade
|
||||
fade.fade -= 1.f/fade_duration * std::min<float>(time_delta, 1.f/8.f); // fps but not below 8 for smooth-ish fade
|
||||
if (fade.fade <= 0.f) {
|
||||
to_remove.push_back(e);
|
||||
}
|
||||
@ -1115,6 +1116,7 @@ bool ChatGui4::renderContactListContactSmall(const Contact3 c, const bool select
|
||||
return ImGui::Selectable(label.c_str(), selected);
|
||||
}
|
||||
|
||||
#if 0
|
||||
bool ChatGui4::renderSubContactListContact(const Contact3 c, const bool selected) const {
|
||||
std::string label;
|
||||
|
||||
@ -1137,6 +1139,7 @@ bool ChatGui4::renderSubContactListContact(const Contact3 c, const bool selected
|
||||
|
||||
return ImGui::Selectable(label.c_str(), selected);
|
||||
}
|
||||
#endif
|
||||
|
||||
void ChatGui4::pasteFile(const char* mime_type) {
|
||||
size_t data_size = 0;
|
||||
|
@ -79,7 +79,7 @@ class ChatGui4 {
|
||||
|
||||
void renderContactList(void);
|
||||
bool renderContactListContactSmall(const Contact3 c, const bool selected) const;
|
||||
bool renderSubContactListContact(const Contact3 c, const bool selected) const;
|
||||
//bool renderSubContactListContact(const Contact3 c, const bool selected) const;
|
||||
|
||||
void pasteFile(const char* mime_type);
|
||||
};
|
||||
|
Reference in New Issue
Block a user