Add NeoUI 240x320 UI SDK, migrate all GUI plugins, add Yabasic FFI wrapper and fix camera rotation

This commit is contained in:
Luxferre committed 2026-10-26 19:11:58 +02:00
1 parent 1f9138f0c6
commit c137feee0e
59 files changed
+5932 -2128

No files matched your search

-101
View File
@@ -2726,107 +2726,6 @@ inline constexpr const char* kMultiTapPunct1 =
inline constexpr const char* kMultiTapStar =
"*#+-=_/\\|~`@$%^&()[]{}<>'\".,!?:;";
inline std::string formatMultiTapBar(const std::string& prefix,
const char* table, int activeIdx,
bool makeUpper,
int maxItems = 7,
size_t maxChars = 21) {
if (!table || !table[0]) return "";
int total = static_cast<int>(std::strlen(table));
if (total <= 0) return "";
activeIdx = std::clamp(activeIdx, 0, total - 1);
std::vector<std::string> labels;
labels.reserve(total);
for (int i = 0; i < total; ++i) {
char c = table[i];
if (c == ' ') {
labels.push_back("SPC");
} else if (c == '\n') {
labels.push_back("NL");
} else if (c == '\t') {
labels.push_back("TAB");
} else {
if (makeUpper && std::isalpha(static_cast<unsigned char>(c))) {
c = static_cast<char>(std::toupper(static_cast<unsigned char>(c)));
}
labels.push_back(std::string(1, c));
}
}
int halfWin = std::max(1, maxItems / 2);
int start = std::max(0, activeIdx - halfWin);
int end = start;
size_t width = 0;
int count = 0;
while (start <= activeIdx) {
width = 0;
count = 0;
end = start;
while (end < total && count < maxItems) {
size_t iw = labels[end].size() + 2;
if (count > 0 && width + iw > maxChars) break;
width += iw;
++end;
++count;
}
if (activeIdx < end) break;
++start;
}
while (start > 0 && count < maxItems) {
size_t iw = labels[start - 1].size() + 2;
if (width + iw > maxChars) break;
--start;
width += iw;
++count;
}
std::string out = prefix;
out += (start > 0) ? "<" : " ";
for (int i = start; i < end; ++i) {
if (i == activeIdx) {
out += "[" + labels[i] + "]";
} else {
out += " " + labels[i] + " ";
}
}
if (end < total) {
out += ">";
}
return out;
}
inline std::string tailFitPangoText(PangoLayout* layout,
const std::string& text,
int maxWidthPx) {
if (!layout || text.empty() || maxWidthPx <= 0) return text;
pango_layout_set_width(layout, -1);
pango_layout_set_ellipsize(layout, PANGO_ELLIPSIZE_NONE);
pango_layout_set_text(layout, text.c_str(), static_cast<int>(text.size()));
int w = 0, h = 0;
pango_layout_get_pixel_size(layout, &w, &h);
if (w <= maxWidthPx) return text;
size_t pos = 0;
while (pos < text.size()) {
pos++;
while (pos < text.size() &&
(static_cast<unsigned char>(text[pos]) & 0xC0) == 0x80) {
pos++;
}
std::string candidate = ".." + text.substr(pos);
pango_layout_set_text(layout, candidate.c_str(),
static_cast<int>(candidate.size()));
pango_layout_get_pixel_size(layout, &w, &h);
if (w <= maxWidthPx) {
return candidate;
}
}
return text;
}
} // namespace bananarchy
#endif // DWM_PLUGINS_PHONE_DATA_H