mirror of
https://github.com/meshtastic/firmware.git
synced 2025-08-03 12:20:43 +00:00
cleanup, cheers
This commit is contained in:
parent
0b1703a51a
commit
eca240373a
@ -278,7 +278,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(display, cachedLines, emotes, numEmotes);
|
calculateLineHeights(cachedLines, emotes);
|
||||||
cachedKey = currentKey;
|
cachedKey = currentKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -345,7 +345,9 @@ void drawTextMessageFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16
|
|||||||
|
|
||||||
std::vector<std::string> generateLines(OLEDDisplay *display,
|
std::vector<std::string> generateLines(OLEDDisplay *display,
|
||||||
const char *headerStr,
|
const char *headerStr,
|
||||||
const char *messageBuf, int textWidth) {
|
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
|
||||||
|
|
||||||
@ -390,9 +392,9 @@ std::vector<std::string> generateLines(OLEDDisplay *display,
|
|||||||
return lines;
|
return lines;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<int> calculateLineHeights(OLEDDisplay *display,
|
std::vector<int> calculateLineHeights(const std::vector<std::string>& lines,
|
||||||
const std::vector<std::string> &lines,
|
const Emote *emotes)
|
||||||
const Emote *emotes, int emoteCount) {
|
{
|
||||||
std::vector<int> rowHeights;
|
std::vector<int> rowHeights;
|
||||||
|
|
||||||
for (const auto &_line : lines) {
|
for (const auto &_line : lines) {
|
||||||
@ -421,15 +423,16 @@ std::vector<int> calculateLineHeights(OLEDDisplay *display,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void renderMessageContent(OLEDDisplay *display,
|
void renderMessageContent(OLEDDisplay *display,
|
||||||
const std::vector<std::string> &lines,
|
const std::vector<std::string>& lines,
|
||||||
const std::vector<int> &rowHeights,
|
const std::vector<int>& rowHeights,
|
||||||
int x,
|
int x,
|
||||||
int yOffset,
|
int yOffset,
|
||||||
int scrollBottom,
|
int scrollBottom,
|
||||||
const Emote *emotes,
|
const Emote *emotes,
|
||||||
int numEmotes,
|
int numEmotes,
|
||||||
bool isInverted,
|
bool isInverted,
|
||||||
bool isBold) {
|
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;
|
||||||
for (size_t j = 0; j < i; ++j)
|
for (size_t j = 0; j < i; ++j)
|
||||||
|
@ -19,17 +19,17 @@ void drawTextMessageFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16
|
|||||||
// 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 *headerStr,
|
||||||
const char *messageBuf, int textWidth);
|
const char *messageBuf,
|
||||||
|
int textWidth);
|
||||||
|
|
||||||
// Function to calculate heights for each line
|
// Function to calculate heights for each line
|
||||||
std::vector<int> calculateLineHeights(OLEDDisplay *display,
|
std::vector<int> calculateLineHeights(const std::vector<std::string>& lines,
|
||||||
const std::vector<std::string> &lines,
|
const Emote *emotes);
|
||||||
const Emote *emotes, int emoteCount);
|
|
||||||
|
|
||||||
// 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<std::string>& lines,
|
||||||
const std::vector<int> &rowHeights,
|
const std::vector<int>& rowHeights,
|
||||||
int x,
|
int x,
|
||||||
int yOffset,
|
int yOffset,
|
||||||
int scrollBottom,
|
int scrollBottom,
|
||||||
|
Loading…
Reference in New Issue
Block a user