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
|
// Cache miss - regenerate lines and heights
|
||||||
cachedLines = generateLines(display, headerStr, messageBuf, textWidth);
|
cachedLines = generateLines(display, headerStr, messageBuf, textWidth);
|
||||||
cachedHeights =
|
cachedHeights = calculateLineHeights(cachedLines, emotes);
|
||||||
calculateLineHeights(cachedLines, emotes);
|
|
||||||
cachedKey = currentKey;
|
cachedKey = currentKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -335,18 +334,13 @@ void drawTextMessageFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16
|
|||||||
}
|
}
|
||||||
|
|
||||||
// === Render visible lines ===
|
// === Render visible lines ===
|
||||||
renderMessageContent(display, cachedLines, cachedHeights, x, yOffset,
|
renderMessageContent(display, cachedLines, cachedHeights, x, yOffset, scrollBottom, emotes, numEmotes, isInverted, isBold);
|
||||||
scrollBottom, emotes, numEmotes,
|
|
||||||
isInverted, isBold);
|
|
||||||
|
|
||||||
// Draw header at the end to sort out overlapping elements
|
// Draw header at the end to sort out overlapping elements
|
||||||
graphics::drawCommonHeader(display, x, y, titleStr);
|
graphics::drawCommonHeader(display, x, y, titleStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> generateLines(OLEDDisplay *display,
|
std::vector<std::string> generateLines(OLEDDisplay *display, const char *headerStr, const char *messageBuf, int textWidth)
|
||||||
const char *headerStr,
|
|
||||||
const char *messageBuf,
|
|
||||||
int textWidth)
|
|
||||||
{
|
{
|
||||||
std::vector<std::string> lines;
|
std::vector<std::string> lines;
|
||||||
lines.push_back(std::string(headerStr)); // Header line is always first
|
lines.push_back(std::string(headerStr)); // Header line is always first
|
||||||
@ -392,8 +386,7 @@ std::vector<std::string> generateLines(OLEDDisplay *display,
|
|||||||
return lines;
|
return lines;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<int> calculateLineHeights(const std::vector<std::string>& lines,
|
std::vector<int> calculateLineHeights(const std::vector<std::string> &lines, const Emote *emotes)
|
||||||
const Emote *emotes)
|
|
||||||
{
|
{
|
||||||
std::vector<int> rowHeights;
|
std::vector<int> rowHeights;
|
||||||
|
|
||||||
@ -422,16 +415,8 @@ std::vector<int> calculateLineHeights(const std::vector<std::string>& lines,
|
|||||||
return rowHeights;
|
return rowHeights;
|
||||||
}
|
}
|
||||||
|
|
||||||
void renderMessageContent(OLEDDisplay *display,
|
void renderMessageContent(OLEDDisplay *display, const std::vector<std::string> &lines, const std::vector<int> &rowHeights, int x,
|
||||||
const std::vector<std::string>& lines,
|
int yOffset, int scrollBottom, const Emote *emotes, int numEmotes, bool isInverted, bool isBold)
|
||||||
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) {
|
for (size_t i = 0; i < lines.size(); ++i) {
|
||||||
int lineY = yOffset;
|
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);
|
void drawTextMessageFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y);
|
||||||
|
|
||||||
// Function to generate lines with word wrapping
|
// Function to generate lines with word wrapping
|
||||||
std::vector<std::string> generateLines(OLEDDisplay *display,
|
std::vector<std::string> generateLines(OLEDDisplay *display, const char *headerStr, const char *messageBuf, int textWidth);
|
||||||
const char *headerStr,
|
|
||||||
const char *messageBuf,
|
|
||||||
int textWidth);
|
|
||||||
|
|
||||||
// Function to calculate heights for each line
|
// Function to calculate heights for each line
|
||||||
std::vector<int> calculateLineHeights(const std::vector<std::string>& lines,
|
std::vector<int> calculateLineHeights(const std::vector<std::string> &lines, const Emote *emotes);
|
||||||
const Emote *emotes);
|
|
||||||
|
|
||||||
// Function to render the message content
|
// Function to render the message content
|
||||||
void renderMessageContent(OLEDDisplay *display,
|
void renderMessageContent(OLEDDisplay *display, const std::vector<std::string> &lines, const std::vector<int> &rowHeights, int x,
|
||||||
const std::vector<std::string>& lines,
|
int yOffset, int scrollBottom, const Emote *emotes, int numEmotes, bool isInverted, bool isBold);
|
||||||
const std::vector<int>& rowHeights,
|
|
||||||
int x,
|
|
||||||
int yOffset,
|
|
||||||
int scrollBottom,
|
|
||||||
const Emote *emotes,
|
|
||||||
int numEmotes,
|
|
||||||
bool isInverted,
|
|
||||||
bool isBold);
|
|
||||||
|
|
||||||
} // namespace MessageRenderer
|
} // namespace MessageRenderer
|
||||||
} // namespace graphics
|
} // namespace graphics
|
||||||
|
Loading…
Reference in New Issue
Block a user