feat(settings): split Chat & Contacts into Appearance | Messaging columns
Break up the tall, left-heavy Chat & Contacts card internally: Appearance on the left, Messaging on the right when the card is wide (fills the width, ~halves the height). Same Indent technique as the Node & Security card; the row helpers retarget their leftX/rowW per column so controls right-align within each. The narrow chat-settings modal stays single-column. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1859,8 +1859,10 @@ void RenderChatSettingsControls(App* app, float contentWidth)
|
|||||||
// Right-align controls to the row's true right edge. The Settings tab renders us inside a GlassCard
|
// Right-align controls to the row's true right edge. The Settings tab renders us inside a GlassCard
|
||||||
// whose content region isn't narrowed to the card padding, so it passes an explicit contentWidth;
|
// whose content region isn't narrowed to the card padding, so it passes an explicit contentWidth;
|
||||||
// the chat modal's dialog content region is correct, so it passes 0 (auto).
|
// the chat modal's dialog content region is correct, so it passes 0 (auto).
|
||||||
const float leftX = ImGui::GetCursorPosX();
|
// leftX/rowW define the current column the rows lay out in; retargeted below
|
||||||
const float rowW = (contentWidth > 0.0f) ? contentWidth : ImGui::GetContentRegionAvail().x;
|
// to split Appearance | Messaging into two columns when the card is wide.
|
||||||
|
float leftX = ImGui::GetCursorPosX();
|
||||||
|
float rowW = (contentWidth > 0.0f) ? contentWidth : ImGui::GetContentRegionAvail().x;
|
||||||
|
|
||||||
// Label left, control right-aligned within [leftX, leftX+rowW]. Leaves the cursor at the control origin.
|
// Label left, control right-aligned within [leftX, leftX+rowW]. Leaves the cursor at the control origin.
|
||||||
auto beginRow = [&](const char* label) {
|
auto beginRow = [&](const char* label) {
|
||||||
@@ -1925,6 +1927,17 @@ void RenderChatSettingsControls(App* app, float contentWidth)
|
|||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Two internal columns when the card is wide enough: Appearance on the left,
|
||||||
|
// Messaging on the right — fills the width and roughly halves the height.
|
||||||
|
// (Mirrors the Node & Security card.) Narrow (the chat modal) stays single-column.
|
||||||
|
const float chatColGap = 24.0f * dp;
|
||||||
|
const bool chatTwoCol = rowW > 760.0f * dp;
|
||||||
|
const float chatColW = chatTwoCol ? (rowW - chatColGap) * 0.5f : rowW;
|
||||||
|
const float chatBaseLeftX = leftX;
|
||||||
|
const float chatTopY = ImGui::GetCursorPosY();
|
||||||
|
float chatLeftBottomY = 0.0f;
|
||||||
|
if (chatTwoCol) rowW = chatColW; // left column width
|
||||||
|
|
||||||
// ── Appearance ────────────────────────────────────────────────────────────────
|
// ── Appearance ────────────────────────────────────────────────────────────────
|
||||||
section("chat_sec_appearance");
|
section("chat_sec_appearance");
|
||||||
// Emoji style (monochrome / color). Color needs a FreeType build (native + the cross-built Windows
|
// Emoji style (monochrome / color). Color needs a FreeType build (native + the cross-built Windows
|
||||||
@@ -1965,6 +1978,15 @@ void RenderChatSettingsControls(App* app, float contentWidth)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Move Messaging into the right column (float it with Indent so every row's
|
||||||
|
// line-start holds the column; retarget leftX so controls right-align in it).
|
||||||
|
if (chatTwoCol) {
|
||||||
|
chatLeftBottomY = ImGui::GetCursorPosY();
|
||||||
|
ImGui::SetCursorPosY(chatTopY);
|
||||||
|
ImGui::Indent(chatColW + chatColGap);
|
||||||
|
leftX = chatBaseLeftX + chatColW + chatColGap;
|
||||||
|
}
|
||||||
|
|
||||||
// ── Messaging ─────────────────────────────────────────────────────────────────
|
// ── Messaging ─────────────────────────────────────────────────────────────────
|
||||||
section("chat_sec_messaging");
|
section("chat_sec_messaging");
|
||||||
// Message poll rate (full-node 0-conf fast-scan cadence) — slider.
|
// Message poll rate (full-node 0-conf fast-scan cadence) — slider.
|
||||||
@@ -1988,6 +2010,14 @@ void RenderChatSettingsControls(App* app, float contentWidth)
|
|||||||
bool v = st->getChatEnterSends();
|
bool v = st->getChatEnterSends();
|
||||||
if (ImGui::Checkbox(TR("chat_opt_enter_sends"), &v)) { st->setChatEnterSends(v); st->save(); }
|
if (ImGui::Checkbox(TR("chat_opt_enter_sends"), &v)) { st->setChatEnterSends(v); st->save(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Close the two-column band: un-indent and drop below the taller column.
|
||||||
|
if (chatTwoCol) {
|
||||||
|
ImGui::Unindent(chatColW + chatColGap);
|
||||||
|
const float chatRightBottomY = ImGui::GetCursorPosY();
|
||||||
|
ImGui::SetCursorPosX(chatBaseLeftX);
|
||||||
|
ImGui::SetCursorPosY(std::max(chatLeftBottomY, chatRightBottomY));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace ui
|
} // namespace ui
|
||||||
|
|||||||
Reference in New Issue
Block a user