From 8ed2750df16da3a631b8de1a996ac5a23e9f1284 Mon Sep 17 00:00:00 2001 From: nakst <> Date: Sun, 2 Jan 2022 22:25:12 +0000 Subject: [PATCH] layout bugfixes for scroll panes; update design of settings --- desktop/gui.cpp | 90 ++++++++++++++++++++------- desktop/inspector.cpp | 3 +- desktop/os.header | 1 + desktop/settings.cpp | 65 +++++++++---------- help/UI Layout.md | 5 ++ res/Fonts/Bitmap Sans Regular 9.font | Bin 3034 -> 3034 bytes shared/strings.cpp | 2 +- 7 files changed, 106 insertions(+), 60 deletions(-) create mode 100644 help/UI Layout.md diff --git a/desktop/gui.cpp b/desktop/gui.cpp index 2ca8c41..7336523 100644 --- a/desktop/gui.cpp +++ b/desktop/gui.cpp @@ -2293,7 +2293,7 @@ void LayoutStackSecondary(EsPanel *panel, EsMessage *message) { if (panel->state & UI_STATE_INSPECTING) { InspectorNotifyElementEvent(panel, "layout", "Measuring stack on secondary axis with %d children, insets %R; provided primary size is %d.\n", - panel, childCount, insets, primary); + childCount, insets, primary); } if (primary) { @@ -2339,6 +2339,13 @@ void LayoutStackPrimary(EsPanel *panel, EsMessage *message) { int hBase = message->type == ES_MSG_GET_HEIGHT ? message->measure.width : Width(bounds); int vBase = message->type == ES_MSG_GET_WIDTH ? message->measure.height : Height(bounds); + if (message->type == ES_MSG_LAYOUT) { + // If we scroll on a given axis, assume it extends to infinity during layout. + // During measurement, ScrollPane::ReceivedMessage does this for us. + if (panel->scroll.mode[0]) hBase = 0; + if (panel->scroll.mode[1]) vBase = 0; + } + int hSpace = hBase ? (hBase - insets.l - insets.r) : 0; int vSpace = vBase ? (vBase - insets.t - insets.b) : 0; int available = horizontal ? hSpace : vSpace; @@ -2424,11 +2431,10 @@ int EsElement::GetWidth(int height) { else if (style->preferredHeight && style->preferredHeight < height && (~flags & (ES_CELL_V_EXPAND))) height = style->preferredHeight; else if (style->metrics->minimumHeight && style->metrics->minimumHeight > height) height = style->metrics->minimumHeight; else if (style->metrics->maximumHeight && style->metrics->maximumHeight < height) height = style->metrics->maximumHeight; - if (height) height -= internalOffsetTop + internalOffsetBottom; EsMessage m = { ES_MSG_GET_WIDTH }; m.measure.height = height; EsMessageSend(this, &m); - int width = m.measure.width + internalOffsetLeft + internalOffsetRight; + int width = m.measure.width; if (style->metrics->minimumWidth && style->metrics->minimumWidth > width) width = style->metrics->minimumWidth; if (style->metrics->maximumWidth && style->metrics->maximumWidth < width) width = style->metrics->maximumWidth; return width; @@ -2441,11 +2447,10 @@ int EsElement::GetHeight(int width) { else if (style->preferredWidth && style->preferredWidth < width && (~flags & (ES_CELL_H_EXPAND))) width = style->preferredWidth; else if (style->metrics->minimumWidth && style->metrics->minimumWidth > width) width = style->metrics->minimumWidth; else if (style->metrics->maximumWidth && style->metrics->maximumWidth < width) width = style->metrics->maximumWidth; - if (width) width -= internalOffsetLeft + internalOffsetRight; EsMessage m = { ES_MSG_GET_HEIGHT }; m.measure.width = width; EsMessageSend(this, &m); - int height = m.measure.height + internalOffsetTop + internalOffsetBottom; + int height = m.measure.height; if (style->metrics->minimumHeight && style->metrics->minimumHeight > height) height = style->metrics->minimumHeight; if (style->metrics->maximumHeight && style->metrics->maximumHeight < height) height = style->metrics->maximumHeight; return height; @@ -2889,25 +2894,61 @@ int ScrollPane::ReceivedMessage(EsMessage *message) { if (deltaY && (flags & ES_SCROLL_Y_DRAG)) SetY(position[1] + deltaY, true); message->animate.complete = false; } - } else if (message->type == ES_MSG_GET_HEIGHT) { - if (message->measure.width && (mode[0] == ES_SCROLL_MODE_AUTO) && (mode[1] != ES_SCROLL_MODE_AUTO)) { - // To accurately measure the height of the element for this width, - // we need to determine whether the horizontal scrollbar will be present. - // TODO This assumes that the element will be send a LAYOUT message after measurements are complete, - // in order for the scrollbars to be updated. But I think this will always happen..? - EsMessage m = {}; - m.type = ES_MSG_GET_WIDTH; - EsMessageSend(parent, &m); - parent->internalOffsetBottom = (m.measure.width + fixedViewport[0] > message->measure.width) ? bar[0]->style->preferredHeight : 0; + } else if (message->type == ES_MSG_GET_HEIGHT && !message->measure.internalMeasurement) { + int width = message->measure.width; + + // If there is a prescribed internal width, we would need to subtract the width of the vertical scroll bar. + // But we are measuring the external height here, so if this height value gets used then + // the vertical scroll bar can only show if it is in the fixed mode. + if (width && mode[1] == ES_SCROLL_MODE_FIXED) { + width -= bar[1]->style->preferredWidth; } - } else if (message->type == ES_MSG_GET_WIDTH) { - if (message->measure.width && (mode[1] == ES_SCROLL_MODE_AUTO) && (mode[0] != ES_SCROLL_MODE_AUTO)) { - // As above. - EsMessage m = {}; - m.type = ES_MSG_GET_HEIGHT; - EsMessageSend(parent, &m); - parent->internalOffsetRight = (m.measure.height + fixedViewport[1] > message->measure.height) ? bar[1]->style->preferredWidth : 0; + + // Get the internal measurement on this axis. + EsMessage m = {}; + m.type = ES_MSG_GET_HEIGHT; + m.measure.width = mode[0] ? 0 : width; // If the opposite axis is being scrolled, then ignore a prescribed measurement -- that will be an external measurement. + m.measure.internalMeasurement = true; + EsMessageSend(parent, &m); // Send it to ourself for internal measurement. + message->measure.height = m.measure.height; + + bool horizontalScrollBarWillShow = false; + + if (mode[0] == ES_SCROLL_MODE_FIXED) { + horizontalScrollBarWillShow = true; + } else if (mode[0] == ES_SCROLL_MODE_AUTO) { + if (!width) { + // If there is no prescribed external width, + // then we have no way to determine whether the scroll bar will be shown in this case. + } else { + EsMessage m = {}; + m.type = ES_MSG_GET_WIDTH; + EsMessageSend(parent, &m); + horizontalScrollBarWillShow = m.measure.width + fixedViewport[0] > width; + } } + + // Add the height of the horizontal scroll bar, if it will be shown, to calculate the external height. + if (horizontalScrollBarWillShow) message->measure.height += bar[0]->style->preferredHeight; + + return ES_HANDLED; + } else if (message->type == ES_MSG_GET_WIDTH && !message->measure.internalMeasurement) { + // Algorithm copied from above, in the GET_HEIGHT case. + int height = message->measure.height; + if (height && mode[0] == ES_SCROLL_MODE_FIXED) height -= bar[0]->style->preferredHeight; + EsMessage m = { .type = ES_MSG_GET_WIDTH, .measure = { .height = mode[1] ? 0 : height, .internalMeasurement = true } }; + EsMessageSend(parent, &m); + message->measure.width = m.measure.width; + bool verticalScrollBarWillShow = mode[1] == ES_SCROLL_MODE_FIXED; + + if (mode[1] == ES_SCROLL_MODE_AUTO && height) { + EsMessage m = { .type = ES_MSG_GET_HEIGHT }; + EsMessageSend(parent, &m); + verticalScrollBarWillShow = m.measure.height + fixedViewport[1] > height; + } + + if (verticalScrollBarWillShow) message->measure.width += bar[1]->style->preferredWidth; + return ES_HANDLED; } else if (message->type == ES_MSG_SCROLL_WHEEL) { SetPosition(0, position[0] + 60 * message->scrollWheel.dx / ES_SCROLL_WHEEL_NOTCH, true); SetPosition(1, position[1] - 60 * message->scrollWheel.dy / ES_SCROLL_WHEEL_NOTCH, true); @@ -2944,6 +2985,7 @@ bool ScrollPane::RefreshLimit(int axis, int64_t *contentSize) { EsMessage m = {}; m.type = axis ? ES_MSG_GET_HEIGHT : ES_MSG_GET_WIDTH; + m.measure.internalMeasurement = true; if (axis) m.measure.width = bounds.r; else m.measure.height = bounds.b; EsMessageSend(parent, &m); @@ -3365,7 +3407,7 @@ int ProcessPanelMessage(EsElement *element, EsMessage *message) { } if (childCount < 100) { - return 0; + return 0; // Don't bother if there are only a small number of child elements. } message->beforeZOrder.nonClient = childCount; @@ -6358,7 +6400,7 @@ EsElement *UIFindHoverElementRecursively(EsElement *element, int offsetX, int of EsMessage zOrder = { ES_MSG_BEFORE_Z_ORDER }; zOrder.beforeZOrder.nonClient = zOrder.beforeZOrder.end = element->children.Length(); - zOrder.beforeZOrder.clip = Translate(ES_RECT_4(0, element->width, 0, element->height), offsetX, offsetY); + zOrder.beforeZOrder.clip = Translate(ES_RECT_4(0, element->width, 0, element->height), -offsetX, -offsetY); EsMessageSend(element, &zOrder); EsElement *result = nullptr; diff --git a/desktop/inspector.cpp b/desktop/inspector.cpp index 3750c62..bc733c4 100644 --- a/desktop/inspector.cpp +++ b/desktop/inspector.cpp @@ -233,7 +233,8 @@ void InspectorNotifyElementEvent(EsElement *element, const char *cCategory, cons if (cCategory) EsBufferFormat(&buffer, "%z: ", cCategory); EsBufferFormatV(&buffer, cFormat, arguments); va_end(arguments); - EsListViewFixedItemInsert(inspector->listEvents, _buffer, buffer.position); + EsListViewIndex index = EsListViewFixedItemInsert(inspector->listEvents); + EsListViewFixedItemSetString(inspector->listEvents, index, 0, _buffer, buffer.position); EsListViewScrollToEnd(inspector->listEvents); } diff --git a/desktop/os.header b/desktop/os.header index 59e595a..286c533 100644 --- a/desktop/os.header +++ b/desktop/os.header @@ -1600,6 +1600,7 @@ struct EsMessageWindowResized { struct EsMessageMeasure { int width, height; + bool internalMeasurement; // Used by scroll panes; ignore. }; struct EsMessageHitTest { diff --git a/desktop/settings.cpp b/desktop/settings.cpp index 423c996..cce420b 100644 --- a/desktop/settings.cpp +++ b/desktop/settings.cpp @@ -46,12 +46,13 @@ const EsStyle styleAllSettingsGroupContainer = { }, }; -const EsStyle styleSettingsGroupContainer2 = { - .inherit = ES_STYLE_BUTTON_GROUP_CONTAINER, +const EsStyle styleSettingsGroupContainer = { +}; +const EsStyle styleSettingsGroupContainer2 = { .metrics = { .mask = ES_THEME_METRICS_PREFERRED_WIDTH | ES_THEME_METRICS_INSETS | ES_THEME_METRICS_GAP_MAJOR, - .insets = ES_RECT_1(15), + .insets = ES_RECT_1(30), .preferredWidth = 400, .gapMajor = 15, }, @@ -284,11 +285,11 @@ void SettingsAddTitle(EsElement *container, SettingsPage *page) { EsIconDisplayCreate(row, ES_FLAGS_DEFAULT, ES_STYLE_ICON_DISPLAY, page->iconID); EsSpacerCreate(row, ES_FLAGS_DEFAULT, 0, 10, 0); EsTextDisplayCreate(row, ES_CELL_H_FILL, ES_STYLE_TEXT_HEADING2, page->string, page->stringBytes); - EsSpacerCreate(container, ES_CELL_H_FILL, ES_STYLE_BUTTON_GROUP_SEPARATOR); + EsSpacerCreate(container, ES_CELL_H_FILL, ES_STYLE_SEPARATOR_HORIZONTAL); } void SettingsPageUnimplemented(EsElement *element, SettingsPage *page) { - EsPanel *content = EsPanelCreate(element, ES_CELL_FILL | ES_PANEL_V_SCROLL_AUTO, &styleNewTabContent); + EsPanel *content = EsPanelCreate(element, ES_CELL_FILL | ES_PANEL_V_SCROLL_AUTO | ES_PANEL_H_SCROLL_AUTO, &styleSettingsGroupContainer); EsPanel *container = EsPanelCreate(content, ES_PANEL_VERTICAL | ES_CELL_H_SHRINK, &styleSettingsGroupContainer2); SettingsAddTitle(container, page); @@ -404,8 +405,8 @@ void SettingsAddNumberBox(EsElement *table, const char *string, ptrdiff_t string control->dragSpeed = dragSpeed; control->discreteStep = discreteStep; - EsTextDisplayCreate(table, ES_CELL_H_RIGHT | ES_CELL_H_PUSH, 0, string, stringBytes); - EsTextbox *textbox = EsTextboxCreate(table, ES_CELL_H_LEFT | ES_CELL_H_PUSH | ES_TEXTBOX_EDIT_BASED | ES_ELEMENT_FREE_USER_DATA, ES_STYLE_TEXTBOX_BORDERED_SINGLE_MEDIUM); + EsTextDisplayCreate(table, ES_CELL_H_RIGHT, 0, string, stringBytes); + EsTextbox *textbox = EsTextboxCreate(table, ES_CELL_H_LEFT | ES_TEXTBOX_EDIT_BASED | ES_ELEMENT_FREE_USER_DATA, ES_STYLE_TEXTBOX_BORDERED_SINGLE_MEDIUM); EsTextboxUseNumberOverlay(textbox, false); textbox->userData = control; textbox->accessKey = accessKey; @@ -529,7 +530,7 @@ EsListView *SettingsAddChoiceList(EsElement *table, const char *string, ptrdiff_ control->cConfigurationKey = cConfigurationKey; EsTextDisplayCreate(table, ES_CELL_H_RIGHT | ES_CELL_V_TOP, 0, string, stringBytes); - EsListView *list = EsListViewCreate(table, ES_CELL_H_EXPAND | ES_CELL_H_PUSH | ES_LIST_VIEW_CHOICE_SELECT | ES_LIST_VIEW_FIXED_ITEMS, ES_STYLE_LIST_CHOICE_BORDERED); + EsListView *list = EsListViewCreate(table, ES_CELL_H_FILL | ES_LIST_VIEW_CHOICE_SELECT | ES_LIST_VIEW_FIXED_ITEMS, ES_STYLE_LIST_CHOICE_BORDERED); list->accessKey = accessKey; list->userData = control; list->messageUser = SettingsChoiceListMessage; @@ -555,8 +556,8 @@ int SettingsDoubleClickTestMessage(EsElement *element, EsMessage *message) { void SettingsPageMouse(EsElement *element, SettingsPage *page) { EsElementSetHidden(((SettingsInstance *) element->instance)->undoButton, false); - EsPanel *content = EsPanelCreate(element, ES_CELL_FILL | ES_PANEL_V_SCROLL_AUTO, &styleNewTabContent); - EsPanel *container = EsPanelCreate(content, ES_PANEL_VERTICAL | ES_CELL_H_SHRINK, &styleSettingsGroupContainer2); + EsPanel *content = EsPanelCreate(element, ES_CELL_FILL | ES_PANEL_V_SCROLL_AUTO | ES_PANEL_H_SCROLL_AUTO, &styleSettingsGroupContainer); + EsPanel *container = EsPanelCreate(content, ES_PANEL_VERTICAL, &styleSettingsGroupContainer2); SettingsAddTitle(container, page); EsPanel *table; @@ -568,14 +569,12 @@ void SettingsPageMouse(EsElement *element, SettingsPage *page) { SettingsAddCheckbox(table, INTERFACE_STRING(DesktopSettingsMouseUseAcceleration), 'C', "general", "use_cursor_acceleration"); SettingsAddCheckbox(table, INTERFACE_STRING(DesktopSettingsMouseSlowOnAlt), 'O', "general", "use_cursor_alt_slow"); - EsSpacerCreate(container, ES_CELL_H_FILL, ES_STYLE_BUTTON_GROUP_SEPARATOR); + EsSpacerCreate(container, ES_CELL_H_FILL, ES_STYLE_SEPARATOR_HORIZONTAL); SettingsAddSlider(container, INTERFACE_STRING(DesktopSettingsMouseCursorTrails), 'T', "general", "cursor_trails", 0, 7, 8, INTERFACE_STRING(DesktopSettingsMouseCursorTrailsNone), INTERFACE_STRING(DesktopSettingsMouseCursorTrailsMany)); - table = EsPanelCreate(container, ES_CELL_H_FILL | ES_PANEL_TABLE | ES_PANEL_HORIZONTAL, ES_STYLE_PANEL_FORM_TABLE); - EsPanelSetBands(table, 2); - + table = EsPanelCreate(container, ES_CELL_H_CENTER | ES_PANEL_HORIZONTAL, ES_STYLE_PANEL_FORM_TABLE); SettingsAddNumberBox(table, INTERFACE_STRING(DesktopSettingsMouseLinesPerScrollNotch), 'S', "general", "scroll_lines_per_notch", 1, 100, nullptr, 0, 0.04, 1); @@ -584,11 +583,9 @@ void SettingsPageMouse(EsElement *element, SettingsPage *page) { SettingsAddCheckbox(table, INTERFACE_STRING(DesktopSettingsMouseShowShadow), 'W', "general", "show_cursor_shadow"); SettingsAddCheckbox(table, INTERFACE_STRING(DesktopSettingsMouseLocateCursorOnCtrl), 'L', "general", "locate_cursor_on_ctrl"); - EsSpacerCreate(container, ES_CELL_H_FILL, ES_STYLE_BUTTON_GROUP_SEPARATOR); - - table = EsPanelCreate(container, ES_CELL_H_FILL | ES_PANEL_TABLE | ES_PANEL_HORIZONTAL, ES_STYLE_PANEL_FORM_TABLE); - EsPanelSetBands(table, 2); + EsSpacerCreate(container, ES_CELL_H_FILL, ES_STYLE_SEPARATOR_HORIZONTAL); + table = EsPanelCreate(container, ES_CELL_H_CENTER | ES_PANEL_HORIZONTAL, ES_STYLE_PANEL_FORM_TABLE); SettingsAddNumberBox(table, INTERFACE_STRING(DesktopSettingsMouseDoubleClickSpeed), 'D', "general", "click_chain_timeout_ms", 100, 1500, INTERFACE_STRING(CommonUnitMilliseconds), 1.0, 1); @@ -601,8 +598,8 @@ void SettingsPageMouse(EsElement *element, SettingsPage *page) { void SettingsPageKeyboard(EsElement *element, SettingsPage *page) { EsElementSetHidden(((SettingsInstance *) element->instance)->undoButton, false); - EsPanel *content = EsPanelCreate(element, ES_CELL_FILL | ES_PANEL_V_SCROLL_AUTO, &styleNewTabContent); - EsPanel *container = EsPanelCreate(content, ES_PANEL_VERTICAL | ES_CELL_H_SHRINK, &styleSettingsGroupContainer2); + EsPanel *content = EsPanelCreate(element, ES_CELL_FILL | ES_PANEL_V_SCROLL_AUTO | ES_PANEL_H_SCROLL_AUTO, &styleSettingsGroupContainer); + EsPanel *container = EsPanelCreate(content, ES_PANEL_VERTICAL, &styleSettingsGroupContainer2); SettingsAddTitle(container, page); EsPanel *table; @@ -634,29 +631,29 @@ void SettingsPageKeyboard(EsElement *element, SettingsPage *page) { table = EsPanelCreate(container, ES_CELL_H_FILL, &styleSettingsCheckboxGroup); SettingsAddCheckbox(table, INTERFACE_STRING(DesktopSettingsKeyboardUseSmartQuotes), 'Q', "general", "use_smart_quotes"); - EsSpacerCreate(container, ES_CELL_H_FILL, ES_STYLE_BUTTON_GROUP_SEPARATOR); + EsSpacerCreate(container, ES_CELL_H_FILL, ES_STYLE_SEPARATOR_HORIZONTAL); EsPanel *warningRow = EsPanelCreate(container, ES_CELL_H_CENTER | ES_PANEL_HORIZONTAL, ES_STYLE_PANEL_FORM_TABLE); EsIconDisplayCreate(warningRow, ES_FLAGS_DEFAULT, 0, ES_ICON_DIALOG_WARNING); EsTextDisplayCreate(warningRow, ES_FLAGS_DEFAULT, 0, "Work in progress" ELLIPSIS); - table = EsPanelCreate(container, ES_CELL_H_FILL | ES_PANEL_TABLE | ES_PANEL_HORIZONTAL, ES_STYLE_PANEL_FORM_TABLE); + table = EsPanelCreate(container, ES_CELL_H_CENTER | ES_PANEL_TABLE | ES_PANEL_HORIZONTAL, ES_STYLE_PANEL_FORM_TABLE); EsPanelSetBands(table, 2); - EsTextDisplayCreate(table, ES_CELL_H_RIGHT | ES_CELL_H_PUSH, 0, INTERFACE_STRING(DesktopSettingsKeyboardKeyRepeatDelay)); // TODO. - textbox = EsTextboxCreate(table, ES_CELL_H_LEFT | ES_CELL_H_PUSH | ES_TEXTBOX_EDIT_BASED, ES_STYLE_TEXTBOX_BORDERED_SINGLE_MEDIUM); + EsTextDisplayCreate(table, ES_CELL_H_RIGHT, 0, INTERFACE_STRING(DesktopSettingsKeyboardKeyRepeatDelay)); // TODO. + textbox = EsTextboxCreate(table, ES_CELL_H_LEFT | ES_TEXTBOX_EDIT_BASED, ES_STYLE_TEXTBOX_BORDERED_SINGLE_MEDIUM); textbox->accessKey = 'D'; EsTextboxUseNumberOverlay(textbox, false); EsTextboxInsert(textbox, "400 ms"); - EsTextDisplayCreate(table, ES_CELL_H_RIGHT | ES_CELL_H_PUSH, 0, INTERFACE_STRING(DesktopSettingsKeyboardKeyRepeatRate)); // TODO. - textbox = EsTextboxCreate(table, ES_CELL_H_LEFT | ES_CELL_H_PUSH | ES_TEXTBOX_EDIT_BASED, ES_STYLE_TEXTBOX_BORDERED_SINGLE_MEDIUM); + EsTextDisplayCreate(table, ES_CELL_H_RIGHT, 0, INTERFACE_STRING(DesktopSettingsKeyboardKeyRepeatRate)); // TODO. + textbox = EsTextboxCreate(table, ES_CELL_H_LEFT | ES_TEXTBOX_EDIT_BASED, ES_STYLE_TEXTBOX_BORDERED_SINGLE_MEDIUM); textbox->accessKey = 'R'; EsTextboxUseNumberOverlay(textbox, false); EsTextboxInsert(textbox, "40 ms"); - EsTextDisplayCreate(table, ES_CELL_H_RIGHT | ES_CELL_H_PUSH, 0, INTERFACE_STRING(DesktopSettingsKeyboardCaretBlinkRate)); // TODO. - textbox = EsTextboxCreate(table, ES_CELL_H_LEFT | ES_CELL_H_PUSH | ES_TEXTBOX_EDIT_BASED, ES_STYLE_TEXTBOX_BORDERED_SINGLE_MEDIUM); + EsTextDisplayCreate(table, ES_CELL_H_RIGHT, 0, INTERFACE_STRING(DesktopSettingsKeyboardCaretBlinkRate)); // TODO. + textbox = EsTextboxCreate(table, ES_CELL_H_LEFT | ES_TEXTBOX_EDIT_BASED, ES_STYLE_TEXTBOX_BORDERED_SINGLE_MEDIUM); textbox->accessKey = 'B'; EsTextboxUseNumberOverlay(textbox, false); EsTextboxInsert(textbox, "500 ms"); @@ -672,15 +669,15 @@ void SettingsPageDisplay(EsElement *element, SettingsPage *page) { EsElementSetHidden(((SettingsInstance *) element->instance)->undoButton, false); - EsPanel *content = EsPanelCreate(element, ES_CELL_FILL | ES_PANEL_V_SCROLL_AUTO, &styleNewTabContent); - EsPanel *container = EsPanelCreate(content, ES_PANEL_VERTICAL | ES_CELL_H_SHRINK, &styleSettingsGroupContainer2); + EsPanel *content = EsPanelCreate(element, ES_CELL_FILL | ES_PANEL_V_SCROLL_AUTO | ES_PANEL_H_SCROLL_AUTO, &styleSettingsGroupContainer); + EsPanel *container = EsPanelCreate(content, ES_PANEL_VERTICAL, &styleSettingsGroupContainer2); SettingsAddTitle(container, page); EsPanel *warningRow = EsPanelCreate(container, ES_CELL_H_CENTER | ES_PANEL_HORIZONTAL, ES_STYLE_PANEL_FORM_TABLE); EsIconDisplayCreate(warningRow, ES_FLAGS_DEFAULT, 0, ES_ICON_DIALOG_WARNING); EsTextDisplayCreate(warningRow, ES_FLAGS_DEFAULT, 0, "Work in progress" ELLIPSIS); - EsPanel *table = EsPanelCreate(container, ES_CELL_H_FILL | ES_PANEL_TABLE | ES_PANEL_HORIZONTAL, ES_STYLE_PANEL_FORM_TABLE); + EsPanel *table = EsPanelCreate(container, ES_CELL_H_CENTER | ES_PANEL_TABLE | ES_PANEL_HORIZONTAL, ES_STYLE_PANEL_FORM_TABLE); EsPanelSetBands(table, 2); SettingsAddNumberBox(table, INTERFACE_STRING(DesktopSettingsDisplayUIScale), 'S', "general", "ui_scale", 100, 400, INTERFACE_STRING(CommonUnitPercent), 0.05, 5); @@ -747,8 +744,8 @@ void SettingsColorButtonCommand(EsInstance *, EsElement *element, EsCommand *) { void SettingsPageTheme(EsElement *element, SettingsPage *page) { // TODO Fonts, theme file, etc. - EsPanel *content = EsPanelCreate(element, ES_CELL_FILL | ES_PANEL_V_SCROLL_AUTO, &styleNewTabContent); - EsPanel *container = EsPanelCreate(content, ES_PANEL_VERTICAL | ES_CELL_H_SHRINK, &styleSettingsGroupContainer2); + EsPanel *content = EsPanelCreate(element, ES_CELL_FILL | ES_PANEL_V_SCROLL_AUTO | ES_PANEL_H_SCROLL_AUTO, &styleSettingsGroupContainer); + EsPanel *container = EsPanelCreate(content, ES_PANEL_VERTICAL, &styleSettingsGroupContainer2); SettingsAddTitle(container, page); EsPanel *warningRow = EsPanelCreate(container, ES_CELL_H_CENTER | ES_PANEL_HORIZONTAL, ES_STYLE_PANEL_FORM_TABLE); @@ -759,7 +756,7 @@ void SettingsPageTheme(EsElement *element, SettingsPage *page) { EsPanelSetBands(table, 2); EsTextDisplayCreate(table, ES_CELL_H_RIGHT, 0, INTERFACE_STRING(DesktopSettingsThemeWallpaper)); - EsTextbox *textbox = EsTextboxCreate(table, ES_CELL_H_LEFT | ES_CELL_H_PUSH | ES_TEXTBOX_EDIT_BASED | ES_ELEMENT_FREE_USER_DATA, ES_STYLE_TEXTBOX_BORDERED_SINGLE); + EsTextbox *textbox = EsTextboxCreate(table, ES_CELL_H_LEFT | ES_TEXTBOX_EDIT_BASED | ES_ELEMENT_FREE_USER_DATA, ES_STYLE_TEXTBOX_BORDERED_SINGLE); size_t currentWallpaperBytes; char *currentWallpaper = EsSystemConfigurationReadString(EsLiteral("general"), EsLiteral("wallpaper"), ¤tWallpaperBytes); EsTextboxInsert(textbox, currentWallpaper, currentWallpaperBytes); diff --git a/help/UI Layout.md b/help/UI Layout.md new file mode 100644 index 0000000..10d3c1c --- /dev/null +++ b/help/UI Layout.md @@ -0,0 +1,5 @@ +# Debugging + +This file has not been written yet. `Notes from Discord.txt` may contain a few unorganized pointers, though. + +TODO diff --git a/res/Fonts/Bitmap Sans Regular 9.font b/res/Fonts/Bitmap Sans Regular 9.font index 2def566bc0946db5df2e1463ec9afbdd31b8985c..4cc8401357fd0147083e0b8a19b18f12afa49967 100644 GIT binary patch delta 40 ucmca5eoK5q4l64w0|Nug=0esw7WU-i&`?iL$I0I~*Rn7I!RF;$#*6^#jtb@g delta 40 wcmca5eoK5q4l64g0|Nu==0esw7Iw$vs2mk;8 diff --git a/shared/strings.cpp b/shared/strings.cpp index 755a2ea..5865347 100644 --- a/shared/strings.cpp +++ b/shared/strings.cpp @@ -181,7 +181,7 @@ DEFINE_INTERFACE_STRING(DesktopSettingsDisplayUIScale, "Interface scale:"); DEFINE_INTERFACE_STRING(DesktopSettingsThemeWindowColor, "Window color:"); DEFINE_INTERFACE_STRING(DesktopSettingsThemeEnableHoverState, "Highlight the item the cursor is over"); DEFINE_INTERFACE_STRING(DesktopSettingsThemeEnableAnimations, "Animate the user interface"); -DEFINE_INTERFACE_STRING(DesktopSettingsThemeWallpaper, "Wallpaper"); +DEFINE_INTERFACE_STRING(DesktopSettingsThemeWallpaper, "Wallpaper:"); // File operations.