mirror of
https://github.com/meshtastic/firmware.git
synced 2025-08-03 12:20:43 +00:00
Trunk runs
This commit is contained in:
parent
d411fd99f0
commit
a6cc4ab3fe
@ -277,8 +277,7 @@ void drawTextMessageFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16
|
||||
|
||||
// Cache miss - regenerate lines and heights
|
||||
cachedLines = generateLines(display, headerStr, messageBuf, textWidth);
|
||||
cachedHeights =
|
||||
calculateLineHeights(cachedLines, emotes);
|
||||
cachedHeights = calculateLineHeights(cachedLines, emotes);
|
||||
cachedKey = currentKey;
|
||||
}
|
||||
|
||||
@ -335,18 +334,13 @@ void drawTextMessageFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16
|
||||
}
|
||||
|
||||
// === Render visible lines ===
|
||||
renderMessageContent(display, cachedLines, cachedHeights, x, yOffset,
|
||||
scrollBottom, emotes, numEmotes,
|
||||
isInverted, isBold);
|
||||
renderMessageContent(display, cachedLines, cachedHeights, x, yOffset, scrollBottom, emotes, numEmotes, isInverted, isBold);
|
||||
|
||||
// Draw header at the end to sort out overlapping elements
|
||||
graphics::drawCommonHeader(display, x, y, titleStr);
|
||||
}
|
||||
|
||||
std::vector<std::string> generateLines(OLEDDisplay *display,
|
||||
const char *headerStr,
|
||||
const char *messageBuf,
|
||||
int textWidth)
|
||||
std::vector<std::string> generateLines(OLEDDisplay *display, const char *headerStr, const char *messageBuf, int textWidth)
|
||||
{
|
||||
std::vector<std::string> lines;
|
||||
lines.push_back(std::string(headerStr)); // Header line is always first
|
||||
@ -392,8 +386,7 @@ std::vector<std::string> generateLines(OLEDDisplay *display,
|
||||
return lines;
|
||||
}
|
||||
|
||||
std::vector<int> calculateLineHeights(const std::vector<std::string>& lines,
|
||||
const Emote *emotes)
|
||||
std::vector<int> calculateLineHeights(const std::vector<std::string> &lines, const Emote *emotes)
|
||||
{
|
||||
std::vector<int> rowHeights;
|
||||
|
||||
@ -422,16 +415,8 @@ std::vector<int> calculateLineHeights(const std::vector<std::string>& lines,
|
||||
return rowHeights;
|
||||
}
|
||||
|
||||
void renderMessageContent(OLEDDisplay *display,
|
||||
const std::vector<std::string>& lines,
|
||||
const std::vector<int>& rowHeights,
|
||||
int x,
|
||||
int yOffset,
|
||||
int scrollBottom,
|
||||
const Emote *emotes,
|
||||
int numEmotes,
|
||||
bool isInverted,
|
||||
bool isBold)
|
||||
void renderMessageContent(OLEDDisplay *display, const std::vector<std::string> &lines, const std::vector<int> &rowHeights, int x,
|
||||
int yOffset, int scrollBottom, const Emote *emotes, int numEmotes, bool isInverted, bool isBold)
|
||||
{
|
||||
for (size_t i = 0; i < lines.size(); ++i) {
|
||||
int lineY = yOffset;
|
||||
|
@ -17,26 +17,14 @@ void drawStringWithEmotes(OLEDDisplay *display, int x, int y, const std::string
|
||||
void drawTextMessageFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y);
|
||||
|
||||
// Function to generate lines with word wrapping
|
||||
std::vector<std::string> generateLines(OLEDDisplay *display,
|
||||
const char *headerStr,
|
||||
const char *messageBuf,
|
||||
int textWidth);
|
||||
std::vector<std::string> generateLines(OLEDDisplay *display, const char *headerStr, const char *messageBuf, int textWidth);
|
||||
|
||||
// Function to calculate heights for each line
|
||||
std::vector<int> calculateLineHeights(const std::vector<std::string>& lines,
|
||||
const Emote *emotes);
|
||||
std::vector<int> calculateLineHeights(const std::vector<std::string> &lines, const Emote *emotes);
|
||||
|
||||
// Function to render the message content
|
||||
void renderMessageContent(OLEDDisplay *display,
|
||||
const std::vector<std::string>& lines,
|
||||
const std::vector<int>& rowHeights,
|
||||
int x,
|
||||
int yOffset,
|
||||
int scrollBottom,
|
||||
const Emote *emotes,
|
||||
int numEmotes,
|
||||
bool isInverted,
|
||||
bool isBold);
|
||||
void renderMessageContent(OLEDDisplay *display, const std::vector<std::string> &lines, const std::vector<int> &rowHeights, int x,
|
||||
int yOffset, int scrollBottom, const Emote *emotes, int numEmotes, bool isInverted, bool isBold);
|
||||
|
||||
} // namespace MessageRenderer
|
||||
} // namespace graphics
|
||||
|
Loading…
Reference in New Issue
Block a user