mirror of https://gitlab.com/nakst/essence
rename EsElement::currentStyle to style
This commit is contained in:
parent
028b3e6ddc
commit
88351dbf9e
|
@ -295,7 +295,7 @@ bool ReorderItemDragged(ReorderItem *item, int mouseX) {
|
|||
list->items.Delete(currentIndex);
|
||||
list->items.Insert(item, draggedIndex);
|
||||
|
||||
for (uintptr_t i = 0, x = list->currentStyle->insets.l; i < childCount; i++) {
|
||||
for (uintptr_t i = 0, x = list->style->insets.l; i < childCount; i++) {
|
||||
ReorderItem *child = (ReorderItem *) list->items[i];
|
||||
|
||||
if ((int) i != draggedIndex) {
|
||||
|
@ -326,7 +326,7 @@ void ReorderItemDragComplete(ReorderItem *item) {
|
|||
|
||||
ReorderList *list = (ReorderList *) item->parent;
|
||||
|
||||
for (uintptr_t i = 0, x = list->currentStyle->insets.l; i < list->items.Length(); i++) {
|
||||
for (uintptr_t i = 0, x = list->style->insets.l; i < list->items.Length(); i++) {
|
||||
if (list->items[i] == item) {
|
||||
int oldPosition = item->offsetX, newPosition = x + item->offsetProgress;
|
||||
|
||||
|
@ -344,8 +344,8 @@ void ReorderItemDragComplete(ReorderItem *item) {
|
|||
|
||||
int ReorderListLayout(ReorderList *list, int additionalRightMargin, bool clampDraggedItem, bool preventTabSizeAnimation) {
|
||||
EsRectangle bounds = list->GetBounds();
|
||||
bounds.l += list->currentStyle->insets.l;
|
||||
bounds.r -= list->currentStyle->insets.r;
|
||||
bounds.l += list->style->insets.l;
|
||||
bounds.r -= list->style->insets.r;
|
||||
bounds.r -= additionalRightMargin;
|
||||
|
||||
size_t childCount = list->items.Length();
|
||||
|
@ -358,7 +358,7 @@ int ReorderListLayout(ReorderList *list, int additionalRightMargin, bool clampDr
|
|||
|
||||
for (uintptr_t i = 0; i < childCount; i++) {
|
||||
ReorderItem *child = list->items[i];
|
||||
totalWidth += child->currentStyle->metrics->maximumWidth + list->currentStyle->metrics->gapMinor;
|
||||
totalWidth += child->style->metrics->maximumWidth + list->style->metrics->gapMinor;
|
||||
}
|
||||
|
||||
bool widthClamped = false;
|
||||
|
@ -395,7 +395,7 @@ int ReorderListLayout(ReorderList *list, int additionalRightMargin, bool clampDr
|
|||
for (uintptr_t i = 0; i < childCount; i++) {
|
||||
ReorderItem *child = list->items[i];
|
||||
int width = (i == childCount - 1 && widthClamped) ? (totalWidth - x) : child->sizeProgress;
|
||||
int gap = list->currentStyle->metrics->gapMinor;
|
||||
int gap = list->style->metrics->gapMinor;
|
||||
|
||||
if (child->dragging) {
|
||||
int p = child->dragPosition;
|
||||
|
@ -730,10 +730,10 @@ int WindowTabMessage(EsElement *element, EsMessage *message) {
|
|||
message->hitTest.inside = (bounds.b - message->hitTest.y) * 14 < (bounds.r - message->hitTest.x) * bounds.b;
|
||||
}
|
||||
} else if (message->type == ES_MSG_LAYOUT) {
|
||||
int closeButtonWidth = tab->closeButton->currentStyle->preferredWidth;
|
||||
Rectangle16 insets = tab->currentStyle->metrics->insets;
|
||||
EsElementSetHidden(tab->closeButton, tab->currentStyle->gapWrap * 2 + closeButtonWidth >= tab->width);
|
||||
EsElementMove(tab->closeButton, tab->width - tab->currentStyle->gapWrap - closeButtonWidth,
|
||||
int closeButtonWidth = tab->closeButton->style->preferredWidth;
|
||||
Rectangle16 insets = tab->style->metrics->insets;
|
||||
EsElementSetHidden(tab->closeButton, tab->style->gapWrap * 2 + closeButtonWidth >= tab->width);
|
||||
EsElementMove(tab->closeButton, tab->width - tab->style->gapWrap - closeButtonWidth,
|
||||
insets.t, closeButtonWidth, tab->height - insets.t - insets.b);
|
||||
} else if (message->type == ES_MSG_PAINT) {
|
||||
EsDrawContent(message->painter, element, ES_RECT_2S(message->painter->width, message->painter->height),
|
||||
|
@ -774,7 +774,7 @@ int WindowTabMessage(EsElement *element, EsMessage *message) {
|
|||
// TODO Sometimes the tab ends up a few pixels off?
|
||||
newTab->window->pressed = newTab;
|
||||
newTab->window->dragged = newTab;
|
||||
newTab->dragOffset = dragOffset + 2 * hoverContainer->tabBand->currentStyle->insets.l;
|
||||
newTab->dragOffset = dragOffset + 2 * hoverContainer->tabBand->style->insets.l;
|
||||
newTab->dragging = true;
|
||||
}
|
||||
} else {
|
||||
|
@ -788,9 +788,9 @@ int WindowTabMessage(EsElement *element, EsMessage *message) {
|
|||
// TODO Moving a tab directly from one container to another.
|
||||
|
||||
// If we dragged the tab off the left or right side of the band, put it at the start of the new tab band.
|
||||
bool putAtStart = tab->dragPosition < band->currentStyle->insets.l
|
||||
|| tab->dragPosition + tab->width > band->width - band->currentStyle->insets.r;
|
||||
int32_t putAtStartClickX = band->currentStyle->insets.l + tab->dragOffset;
|
||||
bool putAtStart = tab->dragPosition < band->style->insets.l
|
||||
|| tab->dragPosition + tab->width > band->width - band->style->insets.r;
|
||||
int32_t putAtStartClickX = band->style->insets.l + tab->dragOffset;
|
||||
|
||||
// End the drag on this container.
|
||||
EsMessage m = { .type = ES_MSG_MOUSE_LEFT_UP };
|
||||
|
@ -803,7 +803,7 @@ int WindowTabMessage(EsElement *element, EsMessage *message) {
|
|||
// Transfer the drag to the new container.
|
||||
EsSyscall(ES_SYSCALL_WINDOW_TRANSFER_PRESS, band->window->handle, newTab->window->handle, 0, 0);
|
||||
ReorderItemDragged(newTab, 0);
|
||||
newTab->dragPosition = putAtStart ? band->currentStyle->insets.l : previousTabOffsetX;
|
||||
newTab->dragPosition = putAtStart ? band->style->insets.l : previousTabOffsetX;
|
||||
newTab->window->pressed = newTab;
|
||||
newTab->window->dragged = newTab;
|
||||
gui.lastClickX = putAtStart ? putAtStartClickX : mousePosition.x;
|
||||
|
@ -910,10 +910,10 @@ int WindowTabBandMessage(EsElement *element, EsMessage *message) {
|
|||
}
|
||||
}
|
||||
|
||||
int x = ReorderListLayout(band, band->GetChild(0)->currentStyle->preferredWidth + 10 * theming.scale,
|
||||
int x = ReorderListLayout(band, band->GetChild(0)->style->preferredWidth + 10 * theming.scale,
|
||||
true, band->preventNextTabSizeAnimation);
|
||||
band->GetChild(0)->InternalMove(band->GetChild(0)->currentStyle->preferredWidth,
|
||||
band->GetChild(0)->currentStyle->preferredHeight, x + 10 * theming.scale, 4 * theming.scale);
|
||||
band->GetChild(0)->InternalMove(band->GetChild(0)->style->preferredWidth,
|
||||
band->GetChild(0)->style->preferredHeight, x + 10 * theming.scale, 4 * theming.scale);
|
||||
band->preventNextTabSizeAnimation = false;
|
||||
} else if (message->type == ES_MSG_MOUSE_LEFT_DOWN) {
|
||||
} else if (message->type == ES_MSG_MOUSE_LEFT_DRAG) {
|
||||
|
|
256
desktop/gui.cpp
256
desktop/gui.cpp
|
@ -136,7 +136,7 @@ struct EsElement : EsElementPublic {
|
|||
uint16_t previousStyleState; // Set by RefreshStyleState.
|
||||
uint16_t transitionDurationMs, transitionTimeMs;
|
||||
uint64_t lastTimeStamp;
|
||||
UIStyle *currentStyle;
|
||||
UIStyle *style;
|
||||
UIStyleKey currentStyleKey;
|
||||
ThemeAnimation animation;
|
||||
EsPaintTarget *previousTransitionFrame;
|
||||
|
@ -372,15 +372,15 @@ struct EsPanel : EsElement {
|
|||
MeasurementCache measurementCache;
|
||||
|
||||
int GetGapMajor() {
|
||||
return currentStyle->gapMajor;
|
||||
return style->gapMajor;
|
||||
}
|
||||
|
||||
int GetGapMinor() {
|
||||
return currentStyle->gapMinor;
|
||||
return style->gapMinor;
|
||||
}
|
||||
|
||||
EsRectangle GetInsets() {
|
||||
return currentStyle->insets;
|
||||
return style->insets;
|
||||
}
|
||||
|
||||
int GetInsetWidth() {
|
||||
|
@ -830,7 +830,7 @@ int ProcessRootMessage(EsElement *element, EsMessage *message) {
|
|||
EsElementMove(toolbar, 0, 0, bounds.r, bounds.b);
|
||||
} else {
|
||||
int toolbarHeight = toolbar->GetChildCount() ? toolbar->GetHeight(bounds.r)
|
||||
: toolbar->currentStyle->metrics->minimumHeight;
|
||||
: toolbar->style->metrics->minimumHeight;
|
||||
EsElementMove(window->GetChild(0), 0, toolbarHeight, bounds.r, bounds.b - toolbarHeight);
|
||||
EsElementMove(toolbar, 0, 0, bounds.r, toolbarHeight);
|
||||
EsElementMove(window->GetChild(2), 0, 0, bounds.r, bounds.b);
|
||||
|
@ -939,7 +939,7 @@ EsWindow *EsWindowCreate(EsInstance *instance, EsWindowStyle style) {
|
|||
|
||||
EsElementStartTransition(window, ES_TRANSITION_FADE_IN);
|
||||
|
||||
EsSyscall(ES_SYSCALL_WINDOW_SET_PROPERTY, window->handle, ES_WINDOW_SOLID_TRUE, (uintptr_t) &panel->currentStyle->insets, ES_WINDOW_PROPERTY_SOLID);
|
||||
EsSyscall(ES_SYSCALL_WINDOW_SET_PROPERTY, window->handle, ES_WINDOW_SOLID_TRUE, (uintptr_t) &panel->style->insets, ES_WINDOW_PROPERTY_SOLID);
|
||||
EsSyscall(ES_SYSCALL_WINDOW_SET_PROPERTY, window->handle, BLEND_WINDOW_MATERIAL_GLASS, 0, ES_WINDOW_PROPERTY_MATERIAL);
|
||||
}
|
||||
|
||||
|
@ -1030,7 +1030,7 @@ void EsMenuShow(EsMenu *menu, int fixedWidth, int fixedHeight) {
|
|||
menu->source->MaybeRefreshStyle();
|
||||
menu->source->window->targetMenu = menu;
|
||||
|
||||
EsRectangle menuInsets = menu->GetChild(0)->currentStyle->insets;
|
||||
EsRectangle menuInsets = menu->GetChild(0)->style->insets;
|
||||
if (fixedWidth) fixedWidth += menuInsets.l + menuInsets.r;
|
||||
if (fixedHeight) fixedHeight += menuInsets.t + menuInsets.b;
|
||||
int width = fixedWidth ?: menu->GetChild(0)->GetWidth(fixedHeight);
|
||||
|
@ -1314,7 +1314,7 @@ void EsElementStartTransition(EsElement *element, EsTransitionType transitionTyp
|
|||
}
|
||||
|
||||
if (~flags & ES_ELEMENT_TRANSITION_ENTRANCE) {
|
||||
EsRectangle paintOutsets = element->currentStyle->paintOutsets;
|
||||
EsRectangle paintOutsets = element->style->paintOutsets;
|
||||
int width = element->width + paintOutsets.l + paintOutsets.r;
|
||||
int height = element->height + paintOutsets.t + paintOutsets.b;
|
||||
|
||||
|
@ -1364,8 +1364,8 @@ void EsElement::Repaint(bool all, EsRectangle region) {
|
|||
// TODO Optimisation: don't paint if overlapped by an opaque child or sibling.
|
||||
|
||||
if (all) {
|
||||
region.l = -currentStyle->paintOutsets.l, region.r = width + currentStyle->paintOutsets.r;
|
||||
region.t = -currentStyle->paintOutsets.t, region.b = height + currentStyle->paintOutsets.b;
|
||||
region.l = -style->paintOutsets.l, region.r = width + style->paintOutsets.r;
|
||||
region.t = -style->paintOutsets.t, region.b = height + style->paintOutsets.b;
|
||||
} else {
|
||||
region = Translate(region, -internalOffsetLeft, -internalOffsetTop);
|
||||
}
|
||||
|
@ -1375,8 +1375,8 @@ void EsElement::Repaint(bool all, EsRectangle region) {
|
|||
|
||||
region = Translate(region, offsetX + parentBounds.l, offsetY + parentBounds.t);
|
||||
|
||||
if (parent->currentStyle->metrics->clipEnabled) {
|
||||
Rectangle16 clipInsets = parent->currentStyle->metrics->clipInsets;
|
||||
if (parent->style->metrics->clipEnabled) {
|
||||
Rectangle16 clipInsets = parent->style->metrics->clipInsets;
|
||||
region = EsRectangleIntersection(region, EsRectangleAddBorder(parentBounds, RECT16_TO_RECT(clipInsets)));
|
||||
}
|
||||
}
|
||||
|
@ -1409,10 +1409,10 @@ void EsElement::InternalPaint(EsPainter *painter, int paintFlags) {
|
|||
|
||||
{
|
||||
EsRectangle area;
|
||||
area.l = pOffsetX - currentStyle->paintOutsets.l;
|
||||
area.r = pOffsetX + width + currentStyle->paintOutsets.r;
|
||||
area.t = pOffsetY - currentStyle->paintOutsets.t;
|
||||
area.b = pOffsetY + height + currentStyle->paintOutsets.b;
|
||||
area.l = pOffsetX - style->paintOutsets.l;
|
||||
area.r = pOffsetX + width + style->paintOutsets.r;
|
||||
area.t = pOffsetY - style->paintOutsets.t;
|
||||
area.b = pOffsetY + height + style->paintOutsets.b;
|
||||
|
||||
if (!THEME_RECT_VALID(EsRectangleIntersection(area, painter->clip))) {
|
||||
return;
|
||||
|
@ -1426,9 +1426,9 @@ void EsElement::InternalPaint(EsPainter *painter, int paintFlags) {
|
|||
|
||||
EsPainter oldPainter = *painter;
|
||||
|
||||
UIStyle *style = ThemeAnimationComplete(&animation) ? currentStyle : ThemeStyleInterpolate(currentStyle, &animation);
|
||||
EsDefer(if (style != currentStyle) EsHeapFree(style));
|
||||
painter->style = style;
|
||||
UIStyle *interpolatedStyle = ThemeAnimationComplete(&animation) ? style : ThemeStyleInterpolate(style, &animation);
|
||||
EsDefer(if (interpolatedStyle != style) EsHeapFree(interpolatedStyle));
|
||||
painter->style = interpolatedStyle;
|
||||
|
||||
painter->offsetX = pOffsetX, painter->offsetY = pOffsetY;
|
||||
painter->width = width, painter->height = height;
|
||||
|
@ -1454,9 +1454,9 @@ void EsElement::InternalPaint(EsPainter *painter, int paintFlags) {
|
|||
}
|
||||
|
||||
if (paintFlags & PAINT_SHADOW) {
|
||||
style->PaintLayers(painter, ES_RECT_2S(painter->width, painter->height), childType, THEME_LAYER_MODE_SHADOW);
|
||||
interpolatedStyle->PaintLayers(painter, ES_RECT_2S(painter->width, painter->height), childType, THEME_LAYER_MODE_SHADOW);
|
||||
} else if (paintFlags & PAINT_OVERLAY) {
|
||||
style->PaintLayers(painter, ES_RECT_2S(painter->width, painter->height), childType, THEME_LAYER_MODE_OVERLAY);
|
||||
interpolatedStyle->PaintLayers(painter, ES_RECT_2S(painter->width, painter->height), childType, THEME_LAYER_MODE_OVERLAY);
|
||||
|
||||
// Paint layout bounds, if active.
|
||||
|
||||
|
@ -1469,7 +1469,7 @@ void EsElement::InternalPaint(EsPainter *painter, int paintFlags) {
|
|||
EsRectangle bounds = EsPainterBoundsClient(painter);
|
||||
EsPaintTarget target;
|
||||
|
||||
EsRectangle paintOutsets = currentStyle->paintOutsets;
|
||||
EsRectangle paintOutsets = style->paintOutsets;
|
||||
int targetWidth = width + paintOutsets.l + paintOutsets.r;
|
||||
int targetHeight = height + paintOutsets.t + paintOutsets.b;
|
||||
bounds.l -= paintOutsets.l, bounds.r += paintOutsets.r;
|
||||
|
@ -1504,15 +1504,15 @@ void EsElement::InternalPaint(EsPainter *painter, int paintFlags) {
|
|||
|
||||
if (!EsMessageSend(this, &m)) {
|
||||
// TODO Optimisation: don't paint if overlapped by an opaque child.
|
||||
style->PaintLayers(painter, ES_RECT_2S(painter->width, painter->height), childType, THEME_LAYER_MODE_BACKGROUND);
|
||||
interpolatedStyle->PaintLayers(painter, ES_RECT_2S(painter->width, painter->height), childType, THEME_LAYER_MODE_BACKGROUND);
|
||||
}
|
||||
|
||||
// Apply the clipping insets.
|
||||
|
||||
EsRectangle oldClip = painter->clip;
|
||||
|
||||
if (currentStyle->metrics->clipEnabled && (~flags & ES_ELEMENT_NO_CLIP)) {
|
||||
Rectangle16 insets = currentStyle->metrics->clipInsets;
|
||||
if (style->metrics->clipEnabled && (~flags & ES_ELEMENT_NO_CLIP)) {
|
||||
Rectangle16 insets = style->metrics->clipInsets;
|
||||
EsRectangle content = ES_RECT_4(painter->offsetX + insets.l, painter->offsetX + width - insets.r,
|
||||
painter->offsetY + insets.t, painter->offsetY + height - insets.b);
|
||||
painter->clip = EsRectangleIntersection(content, painter->clip);
|
||||
|
@ -1741,7 +1741,7 @@ bool EsElement::RefreshStyleState() {
|
|||
|
||||
bool observedBitsChanged = false;
|
||||
|
||||
if (!currentStyle || currentStyle->IsStateChangeObserved(styleStateFlags, previousStyleState)) {
|
||||
if (!style || style->IsStateChangeObserved(styleStateFlags, previousStyleState)) {
|
||||
observedBitsChanged = true;
|
||||
}
|
||||
|
||||
|
@ -1765,19 +1765,19 @@ void EsElement::RefreshStyle(UIStyleKey *_oldStyleKey, bool alreadyRefreshStyleS
|
|||
currentStyleKey.stateFlags = styleStateFlags;
|
||||
currentStyleKey.scale = theming.scale;
|
||||
|
||||
if (!force && 0 == EsMemoryCompare(¤tStyleKey, &oldStyleKey, sizeof(UIStyleKey)) && currentStyle) {
|
||||
if (!force && 0 == EsMemoryCompare(¤tStyleKey, &oldStyleKey, sizeof(UIStyleKey)) && style) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (~state & UI_STATE_ENTERED) {
|
||||
if (currentStyle) currentStyle->CloseReference();
|
||||
if (style) style->CloseReference();
|
||||
oldStyleKey = currentStyleKey;
|
||||
oldStyleKey.stateFlags |= THEME_STATE_BEFORE_ENTER;
|
||||
currentStyle = GetStyle(oldStyleKey, false);
|
||||
style = GetStyle(oldStyleKey, false);
|
||||
}
|
||||
|
||||
UIStyle *oldStyle = currentStyle;
|
||||
currentStyle = GetStyle(currentStyleKey, false); // TODO Forcing new styles if force flag set.
|
||||
UIStyle *oldStyle = style;
|
||||
style = GetStyle(currentStyleKey, false); // TODO Forcing new styles if force flag set.
|
||||
|
||||
state &= ~UI_STATE_USE_MEASUREMENT_CACHE;
|
||||
|
||||
|
@ -1790,7 +1790,7 @@ void EsElement::RefreshStyle(UIStyleKey *_oldStyleKey, bool alreadyRefreshStyleS
|
|||
}
|
||||
|
||||
if (oldStyle) {
|
||||
if (oldStyle->style == currentStyle->style && api.global->animationTimeMultiplier > 0.01f) {
|
||||
if (oldStyle->style == style->style && api.global->animationTimeMultiplier > 0.01f) {
|
||||
ThemeAnimationBuild(&animation, oldStyle, oldStyleKey.stateFlags, currentStyleKey.stateFlags);
|
||||
animate = !ThemeAnimationComplete(&animation);
|
||||
} else {
|
||||
|
@ -1828,10 +1828,10 @@ void EsElement::SetStyle(const EsStyle *part, bool refreshIfChanged) {
|
|||
EsRectangle LayoutCell(EsElement *element, int width, int height) {
|
||||
uint64_t layout = element->flags;
|
||||
|
||||
int maximumWidth = element->currentStyle->metrics->maximumWidth ?: ES_PANEL_BAND_SIZE_DEFAULT;
|
||||
int minimumWidth = element->currentStyle->metrics->minimumWidth ?: ES_PANEL_BAND_SIZE_DEFAULT;
|
||||
int maximumHeight = element->currentStyle->metrics->maximumHeight ?: ES_PANEL_BAND_SIZE_DEFAULT;
|
||||
int minimumHeight = element->currentStyle->metrics->minimumHeight ?: ES_PANEL_BAND_SIZE_DEFAULT;
|
||||
int maximumWidth = element->style->metrics->maximumWidth ?: ES_PANEL_BAND_SIZE_DEFAULT;
|
||||
int minimumWidth = element->style->metrics->minimumWidth ?: ES_PANEL_BAND_SIZE_DEFAULT;
|
||||
int maximumHeight = element->style->metrics->maximumHeight ?: ES_PANEL_BAND_SIZE_DEFAULT;
|
||||
int minimumHeight = element->style->metrics->minimumHeight ?: ES_PANEL_BAND_SIZE_DEFAULT;
|
||||
|
||||
if (layout & ES_CELL_H_EXPAND) maximumWidth = INT_MAX;
|
||||
if (layout & ES_CELL_H_SHRINK) minimumWidth = 0;
|
||||
|
@ -2011,8 +2011,8 @@ void LayoutTable(EsPanel *panel, EsMessage *message) {
|
|||
int totalGapSize = (bandSpan - 1) * gapSize;
|
||||
|
||||
int preferredSizePerBand = (size - totalGapSize) / bandSpan;
|
||||
int maximumSizeValue = axis ? child->currentStyle->metrics->maximumHeight : child->currentStyle->metrics->maximumWidth;
|
||||
int minimumSizeValue = axis ? child->currentStyle->metrics->minimumHeight : child->currentStyle->metrics->minimumWidth;
|
||||
int maximumSizeValue = axis ? child->style->metrics->maximumHeight : child->style->metrics->maximumWidth;
|
||||
int minimumSizeValue = axis ? child->style->metrics->minimumHeight : child->style->metrics->minimumWidth;
|
||||
int maximumSizePerBand = maximumSizeValue ? (((int) maximumSizeValue - totalGapSize) / bandSpan) : ES_PANEL_BAND_SIZE_DEFAULT;
|
||||
int minimumSizePerBand = maximumSizeValue ? (((int) minimumSizeValue - totalGapSize) / bandSpan) : ES_PANEL_BAND_SIZE_DEFAULT;
|
||||
|
||||
|
@ -2385,36 +2385,36 @@ void LayoutStack(EsPanel *panel, EsMessage *message) {
|
|||
}
|
||||
|
||||
int EsElement::GetWidth(int height) {
|
||||
if (currentStyle->preferredWidth) return currentStyle->preferredWidth;
|
||||
if (!height) height = currentStyle->preferredHeight;
|
||||
else if (currentStyle->preferredHeight && currentStyle->preferredHeight > height && (~flags & (ES_CELL_V_SHRINK))) height = currentStyle->preferredHeight;
|
||||
else if (currentStyle->preferredHeight && currentStyle->preferredHeight < height && (~flags & (ES_CELL_V_EXPAND))) height = currentStyle->preferredHeight;
|
||||
else if (currentStyle->metrics->minimumHeight && currentStyle->metrics->minimumHeight > height) height = currentStyle->metrics->minimumHeight;
|
||||
else if (currentStyle->metrics->maximumHeight && currentStyle->metrics->maximumHeight < height) height = currentStyle->metrics->maximumHeight;
|
||||
if (style->preferredWidth) return style->preferredWidth;
|
||||
if (!height) height = style->preferredHeight;
|
||||
else if (style->preferredHeight && style->preferredHeight > height && (~flags & (ES_CELL_V_SHRINK))) height = style->preferredHeight;
|
||||
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;
|
||||
if (currentStyle->metrics->minimumWidth && currentStyle->metrics->minimumWidth > width) width = currentStyle->metrics->minimumWidth;
|
||||
if (currentStyle->metrics->maximumWidth && currentStyle->metrics->maximumWidth < width) width = currentStyle->metrics->maximumWidth;
|
||||
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;
|
||||
}
|
||||
|
||||
int EsElement::GetHeight(int width) {
|
||||
if (currentStyle->preferredHeight) return currentStyle->preferredHeight;
|
||||
if (!width) width = currentStyle->preferredWidth;
|
||||
else if (currentStyle->preferredWidth && currentStyle->preferredWidth > width && (~flags & (ES_CELL_H_SHRINK))) width = currentStyle->preferredWidth;
|
||||
else if (currentStyle->preferredWidth && currentStyle->preferredWidth < width && (~flags & (ES_CELL_H_EXPAND))) width = currentStyle->preferredWidth;
|
||||
else if (currentStyle->metrics->minimumWidth && currentStyle->metrics->minimumWidth > width) width = currentStyle->metrics->minimumWidth;
|
||||
else if (currentStyle->metrics->maximumWidth && currentStyle->metrics->maximumWidth < width) width = currentStyle->metrics->maximumWidth;
|
||||
if (style->preferredHeight) return style->preferredHeight;
|
||||
if (!width) width = style->preferredWidth;
|
||||
else if (style->preferredWidth && style->preferredWidth > width && (~flags & (ES_CELL_H_SHRINK))) width = style->preferredWidth;
|
||||
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;
|
||||
if (currentStyle->metrics->minimumHeight && currentStyle->metrics->minimumHeight > height) height = currentStyle->metrics->minimumHeight;
|
||||
if (currentStyle->metrics->maximumHeight && currentStyle->metrics->maximumHeight < height) height = currentStyle->metrics->maximumHeight;
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -2473,7 +2473,7 @@ void EsElement::InternalMove(int _width, int _height, int _offsetX, int _offsetY
|
|||
// Clear the old position.
|
||||
|
||||
if (parent) {
|
||||
EsRectangle paintOutsets = currentStyle->paintOutsets;
|
||||
EsRectangle paintOutsets = style->paintOutsets;
|
||||
EsRectangle rectangle = ES_RECT_4(oldOffsetX - paintOutsets.l, oldOffsetX + width + paintOutsets.r,
|
||||
oldOffsetY - paintOutsets.t, oldOffsetY + height + paintOutsets.b);
|
||||
parent->Repaint(false, rectangle);
|
||||
|
@ -2517,7 +2517,7 @@ void EsElement::InternalMove(int _width, int _height, int _offsetX, int _offsetY
|
|||
EsRectangle EsElementGetPreferredSize(EsElement *element) {
|
||||
EsMessageMutexCheck();
|
||||
|
||||
return ES_RECT_4(0, element->currentStyle->preferredWidth, 0, element->currentStyle->preferredHeight);
|
||||
return ES_RECT_4(0, element->style->preferredWidth, 0, element->style->preferredHeight);
|
||||
}
|
||||
|
||||
void EsElementRelayout(EsElement *element) {
|
||||
|
@ -2539,11 +2539,11 @@ void EsElementUpdateContentSize(EsElement *element, uint32_t flags) {
|
|||
element->state &= ~UI_STATE_USE_MEASUREMENT_CACHE;
|
||||
EsElementRelayout(element);
|
||||
|
||||
if (element->currentStyle->preferredWidth || ((element->flags & ES_CELL_H_FILL) == ES_CELL_H_FILL)) {
|
||||
if (element->style->preferredWidth || ((element->flags & ES_CELL_H_FILL) == ES_CELL_H_FILL)) {
|
||||
flags &= ~ES_ELEMENT_UPDATE_CONTENT_WIDTH;
|
||||
}
|
||||
|
||||
if (element->currentStyle->preferredHeight || ((element->flags & ES_CELL_V_FILL) == ES_CELL_V_FILL)) {
|
||||
if (element->style->preferredHeight || ((element->flags & ES_CELL_V_FILL) == ES_CELL_V_FILL)) {
|
||||
flags &= ~ES_ELEMENT_UPDATE_CONTENT_HEIGHT;
|
||||
}
|
||||
|
||||
|
@ -2573,8 +2573,8 @@ void ScrollbarLayout(EsScrollbar *scrollbar) {
|
|||
if (scrollbar->horizontal) {
|
||||
scrollbar->thumbSize = scrollbar->viewportSize * (bounds.r - scrollbar->height * 2) / scrollbar->contentSize;
|
||||
|
||||
if (scrollbar->thumbSize < scrollbar->thumb->currentStyle->preferredWidth) {
|
||||
scrollbar->thumbSize = scrollbar->thumb->currentStyle->preferredWidth;
|
||||
if (scrollbar->thumbSize < scrollbar->thumb->style->preferredWidth) {
|
||||
scrollbar->thumbSize = scrollbar->thumb->style->preferredWidth;
|
||||
}
|
||||
|
||||
if (scrollbar->thumbSize > Width(bounds) - scrollbar->height * 2) {
|
||||
|
@ -2584,16 +2584,16 @@ void ScrollbarLayout(EsScrollbar *scrollbar) {
|
|||
scrollbar->thumbPosition = LinearMap(0, scrollbar->contentSize - scrollbar->viewportSize,
|
||||
scrollbar->height, bounds.r - scrollbar->thumbSize - scrollbar->height, scrollbar->smoothScrollTarget);
|
||||
|
||||
EsElementMove(scrollbar->up, 0, 0, (int) scrollbar->thumbPosition + scrollbar->thumbSize / 2, scrollbar->thumb->currentStyle->preferredHeight);
|
||||
EsElementMove(scrollbar->thumb, (int) scrollbar->thumbPosition, 0, scrollbar->thumbSize, scrollbar->thumb->currentStyle->preferredHeight);
|
||||
EsElementMove(scrollbar->up, 0, 0, (int) scrollbar->thumbPosition + scrollbar->thumbSize / 2, scrollbar->thumb->style->preferredHeight);
|
||||
EsElementMove(scrollbar->thumb, (int) scrollbar->thumbPosition, 0, scrollbar->thumbSize, scrollbar->thumb->style->preferredHeight);
|
||||
EsElementMove(scrollbar->down, (int) scrollbar->thumbPosition + scrollbar->thumbSize / 2, 0,
|
||||
bounds.r - scrollbar->thumbSize / 2 - (int) scrollbar->thumbPosition,
|
||||
scrollbar->thumb->currentStyle->preferredHeight);
|
||||
scrollbar->thumb->style->preferredHeight);
|
||||
} else {
|
||||
scrollbar->thumbSize = scrollbar->viewportSize * (bounds.b - scrollbar->width * 2) / scrollbar->contentSize;
|
||||
|
||||
if (scrollbar->thumbSize < scrollbar->thumb->currentStyle->preferredHeight) {
|
||||
scrollbar->thumbSize = scrollbar->thumb->currentStyle->preferredHeight;
|
||||
if (scrollbar->thumbSize < scrollbar->thumb->style->preferredHeight) {
|
||||
scrollbar->thumbSize = scrollbar->thumb->style->preferredHeight;
|
||||
}
|
||||
|
||||
if (scrollbar->thumbSize > Height(bounds) - scrollbar->width * 2) {
|
||||
|
@ -2603,10 +2603,10 @@ void ScrollbarLayout(EsScrollbar *scrollbar) {
|
|||
scrollbar->thumbPosition = LinearMap(0, scrollbar->contentSize - scrollbar->viewportSize,
|
||||
scrollbar->width, bounds.b - scrollbar->thumbSize - scrollbar->width, scrollbar->smoothScrollTarget);
|
||||
|
||||
EsElementMove(scrollbar->up, 0, 0, scrollbar->thumb->currentStyle->preferredWidth, (int) scrollbar->thumbPosition + scrollbar->thumbSize / 2);
|
||||
EsElementMove(scrollbar->thumb, 0, (int) scrollbar->thumbPosition, scrollbar->thumb->currentStyle->preferredWidth, scrollbar->thumbSize);
|
||||
EsElementMove(scrollbar->up, 0, 0, scrollbar->thumb->style->preferredWidth, (int) scrollbar->thumbPosition + scrollbar->thumbSize / 2);
|
||||
EsElementMove(scrollbar->thumb, 0, (int) scrollbar->thumbPosition, scrollbar->thumb->style->preferredWidth, scrollbar->thumbSize);
|
||||
EsElementMove(scrollbar->down, 0, (int) scrollbar->thumbPosition + scrollbar->thumbSize / 2,
|
||||
scrollbar->thumb->currentStyle->preferredWidth,
|
||||
scrollbar->thumb->style->preferredWidth,
|
||||
bounds.b - scrollbar->thumbSize / 2 - (int) scrollbar->thumbPosition);
|
||||
}
|
||||
}
|
||||
|
@ -2873,7 +2873,7 @@ void ScrollPane::ReceivedMessage(EsMessage *message) {
|
|||
EsMessage m = {};
|
||||
m.type = ES_MSG_GET_WIDTH;
|
||||
EsMessageSend(parent, &m);
|
||||
parent->internalOffsetBottom = (m.measure.width + fixedViewport[0] > message->measure.width) ? bar[0]->currentStyle->preferredHeight : 0;
|
||||
parent->internalOffsetBottom = (m.measure.width + fixedViewport[0] > message->measure.width) ? bar[0]->style->preferredHeight : 0;
|
||||
}
|
||||
} else if (message->type == ES_MSG_GET_WIDTH) {
|
||||
if (message->measure.width && (mode[1] == ES_SCROLL_MODE_AUTO) && (mode[0] != ES_SCROLL_MODE_AUTO)) {
|
||||
|
@ -2881,7 +2881,7 @@ void ScrollPane::ReceivedMessage(EsMessage *message) {
|
|||
EsMessage m = {};
|
||||
m.type = ES_MSG_GET_HEIGHT;
|
||||
EsMessageSend(parent, &m);
|
||||
parent->internalOffsetRight = (m.measure.height + fixedViewport[1] > message->measure.height) ? bar[1]->currentStyle->preferredWidth : 0;
|
||||
parent->internalOffsetRight = (m.measure.height + fixedViewport[1] > message->measure.height) ? bar[1]->style->preferredWidth : 0;
|
||||
}
|
||||
} else if (message->type == ES_MSG_SCROLL_WHEEL) {
|
||||
SetPosition(0, position[0] + 60 * message->scrollWheel.dx / ES_SCROLL_WHEEL_NOTCH, true);
|
||||
|
@ -2932,7 +2932,7 @@ bool ScrollPane::RefreshLimit(int axis, int64_t *contentSize) {
|
|||
}
|
||||
|
||||
if (mode[axis] == ES_SCROLL_MODE_AUTO && limit[axis] > 0 && !(*internalOffset)) {
|
||||
*internalOffset = axis ? bar[axis]->currentStyle->preferredWidth : bar[axis]->currentStyle->preferredHeight;
|
||||
*internalOffset = axis ? bar[axis]->style->preferredWidth : bar[axis]->style->preferredHeight;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -2945,8 +2945,8 @@ void ScrollPane::Refresh() {
|
|||
InspectorNotifyElementEvent(parent, "scroll", "Refreshing scroll pane...\n");
|
||||
}
|
||||
|
||||
parent->internalOffsetRight = mode[1] == ES_SCROLL_MODE_FIXED ? bar[1]->currentStyle->preferredWidth : 0;
|
||||
parent->internalOffsetBottom = mode[0] == ES_SCROLL_MODE_FIXED ? bar[0]->currentStyle->preferredHeight : 0;
|
||||
parent->internalOffsetRight = mode[1] == ES_SCROLL_MODE_FIXED ? bar[1]->style->preferredWidth : 0;
|
||||
parent->internalOffsetBottom = mode[0] == ES_SCROLL_MODE_FIXED ? bar[0]->style->preferredHeight : 0;
|
||||
|
||||
int64_t contentWidth = 0, contentHeight = 0;
|
||||
|
||||
|
@ -2968,16 +2968,16 @@ void ScrollPane::Refresh() {
|
|||
SetPosition(1, position[1], true);
|
||||
}
|
||||
|
||||
EsRectangle border = parent->currentStyle->borders;
|
||||
EsRectangle border = parent->style->borders;
|
||||
|
||||
if (bar[0]) {
|
||||
bar[0]->InternalMove(parent->width - parent->internalOffsetRight - border.r - border.l, bar[0]->currentStyle->preferredHeight,
|
||||
bar[0]->InternalMove(parent->width - parent->internalOffsetRight - border.r - border.l, bar[0]->style->preferredHeight,
|
||||
border.l, parent->height - parent->internalOffsetBottom - border.b);
|
||||
enabled[0] = ~bar[0]->flags & ES_ELEMENT_DISABLED;
|
||||
}
|
||||
|
||||
if (bar[1]) {
|
||||
bar[1]->InternalMove(bar[1]->currentStyle->preferredWidth, parent->height - parent->internalOffsetBottom - border.b - border.t,
|
||||
bar[1]->InternalMove(bar[1]->style->preferredWidth, parent->height - parent->internalOffsetBottom - border.b - border.t,
|
||||
parent->width - parent->internalOffsetRight - border.r, border.t);
|
||||
enabled[1] = ~bar[1]->flags & ES_ELEMENT_DISABLED;
|
||||
}
|
||||
|
@ -3345,11 +3345,11 @@ int ProcessPanelMessage(EsElement *element, EsMessage *message) {
|
|||
EsElement *child = panel->children[position];
|
||||
|
||||
if (panel->flags & ES_PANEL_HORIZONTAL) {
|
||||
if (child->offsetX + child->width + child->currentStyle->paintOutsets.r < message->beforeZOrder.clip.l) {
|
||||
if (child->offsetX + child->width + child->style->paintOutsets.r < message->beforeZOrder.clip.l) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (child->offsetY + child->height + child->currentStyle->paintOutsets.b < message->beforeZOrder.clip.t) {
|
||||
if (child->offsetY + child->height + child->style->paintOutsets.b < message->beforeZOrder.clip.t) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -3366,11 +3366,11 @@ int ProcessPanelMessage(EsElement *element, EsMessage *message) {
|
|||
EsElement *child = panel->children[position];
|
||||
|
||||
if (panel->flags & ES_PANEL_HORIZONTAL) {
|
||||
if (child->offsetX - child->currentStyle->paintOutsets.l > message->beforeZOrder.clip.r) {
|
||||
if (child->offsetX - child->style->paintOutsets.l > message->beforeZOrder.clip.r) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (child->offsetY - child->currentStyle->paintOutsets.t > message->beforeZOrder.clip.b) {
|
||||
if (child->offsetY - child->style->paintOutsets.t > message->beforeZOrder.clip.b) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -3415,9 +3415,9 @@ int ProcessSpacerMessage(EsElement *element, EsMessage *message) {
|
|||
EsSpacer *spacer = (EsSpacer *) element;
|
||||
|
||||
if (message->type == ES_MSG_GET_WIDTH) {
|
||||
message->measure.width = spacer->width * spacer->currentStyle->scale;
|
||||
message->measure.width = spacer->width * spacer->style->scale;
|
||||
} else if (message->type == ES_MSG_GET_HEIGHT) {
|
||||
message->measure.height = spacer->height * spacer->currentStyle->scale;
|
||||
message->measure.height = spacer->height * spacer->style->scale;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -3753,7 +3753,7 @@ int ProcessCanvasPaneMessage(EsElement *element, EsMessage *message) {
|
|||
if (!canvas) return 0;
|
||||
|
||||
EsRectangle bounds = element->GetBounds();
|
||||
EsRectangle insets = element->currentStyle->insets;
|
||||
EsRectangle insets = element->style->insets;
|
||||
bounds.l += insets.l, bounds.r -= insets.r;
|
||||
bounds.t += insets.t, bounds.b -= insets.b;
|
||||
|
||||
|
@ -3934,16 +3934,16 @@ int ProcessButtonMessage(EsElement *element, EsMessage *message) {
|
|||
} else if (message->type == ES_MSG_GET_WIDTH) {
|
||||
if (!button->measurementCache.Get(message, &button->state)) {
|
||||
EsTextStyle textStyle;
|
||||
button->currentStyle->GetTextStyle(&textStyle);
|
||||
button->style->GetTextStyle(&textStyle);
|
||||
int stringWidth = TextGetStringWidth(button, &textStyle, button->label, button->labelBytes);
|
||||
int iconWidth = button->iconID ? button->currentStyle->metrics->iconSize : 0;
|
||||
int contentWidth = stringWidth + iconWidth + ((stringWidth && iconWidth) ? button->currentStyle->gapMinor : 0)
|
||||
+ button->currentStyle->insets.l + button->currentStyle->insets.r;
|
||||
int iconWidth = button->iconID ? button->style->metrics->iconSize : 0;
|
||||
int contentWidth = stringWidth + iconWidth + ((stringWidth && iconWidth) ? button->style->gapMinor : 0)
|
||||
+ button->style->insets.l + button->style->insets.r;
|
||||
|
||||
if (button->flags & ES_BUTTON_DROPDOWN) {
|
||||
int64_t width = 0;
|
||||
GetPreferredSizeFromStylePart(ES_STYLE_MARKER_DOWN_ARROW, &width, nullptr);
|
||||
contentWidth += width + button->currentStyle->gapMinor;
|
||||
contentWidth += width + button->style->gapMinor;
|
||||
}
|
||||
|
||||
int minimumReportedWidth = GetConstantNumber("pushButtonMinimumReportedWidth");
|
||||
|
@ -4232,12 +4232,12 @@ int ProcessMenuItemMessage(EsElement *element, EsMessage *message) {
|
|||
MenuItemGetKeyboardShortcutString(button->command, &buffer);
|
||||
|
||||
EsTextStyle textStyle;
|
||||
button->currentStyle->GetTextStyle(&textStyle);
|
||||
button->style->GetTextStyle(&textStyle);
|
||||
|
||||
int stringWidth = TextGetStringWidth(button, &textStyle, button->label, button->labelBytes);
|
||||
int keyboardShortcutWidth = TextGetStringWidth(button, &textStyle, (const char *) _buffer, buffer.position);
|
||||
int contentWidth = stringWidth + button->currentStyle->insets.l + button->currentStyle->insets.r
|
||||
+ (keyboardShortcutWidth ? (keyboardShortcutWidth + button->currentStyle->gapMinor) : 0);
|
||||
int contentWidth = stringWidth + button->style->insets.l + button->style->insets.r
|
||||
+ (keyboardShortcutWidth ? (keyboardShortcutWidth + button->style->gapMinor) : 0);
|
||||
message->measure.width = MaximumInteger(GetConstantNumber("menuItemMinimumReportedWidth"), contentWidth);
|
||||
} else if (message->type == ES_MSG_DESTROY) {
|
||||
EsHeapFree(button->label);
|
||||
|
@ -4958,9 +4958,9 @@ struct SplitBar : EsElement {
|
|||
EsSplitter *splitter = (EsSplitter *) parent;
|
||||
EsElement *panelBefore = nullptr, *panelAfter = nullptr;
|
||||
int barBefore = 0, barAfter;
|
||||
if (splitter->horizontal) barAfter = EsRectangleAddBorder(splitter->GetBounds(), splitter->currentStyle->borders).r - currentStyle->preferredWidth;
|
||||
else barAfter = EsRectangleAddBorder(splitter->GetBounds(), splitter->currentStyle->borders).b - currentStyle->preferredHeight;
|
||||
int preferredSize = splitter->horizontal ? currentStyle->preferredWidth : currentStyle->preferredHeight;
|
||||
if (splitter->horizontal) barAfter = EsRectangleAddBorder(splitter->GetBounds(), splitter->style->borders).r - style->preferredWidth;
|
||||
else barAfter = EsRectangleAddBorder(splitter->GetBounds(), splitter->style->borders).b - style->preferredHeight;
|
||||
int preferredSize = splitter->horizontal ? style->preferredWidth : style->preferredHeight;
|
||||
splitter->resizeStartSizes.Free();
|
||||
|
||||
for (uintptr_t i = 0; i < splitter->GetChildCount(); i++) {
|
||||
|
@ -4983,25 +4983,25 @@ struct SplitBar : EsElement {
|
|||
|
||||
EsAssert(panelBefore && panelAfter); // Could not find split bar in parent.
|
||||
|
||||
barBefore -= splitter->horizontal ? currentStyle->borders.l : currentStyle->borders.t;
|
||||
barAfter += splitter->horizontal ? currentStyle->borders.r : currentStyle->borders.b;
|
||||
barBefore -= splitter->horizontal ? style->borders.l : style->borders.t;
|
||||
barAfter += splitter->horizontal ? style->borders.r : style->borders.b;
|
||||
|
||||
int minimumPosition, maximumPosition, minimumPosition1, maximumPosition1, minimumPosition2, maximumPosition2;
|
||||
|
||||
if (splitter->horizontal) {
|
||||
minimumPosition1 = barBefore + panelBefore->currentStyle->metrics->minimumWidth;
|
||||
maximumPosition1 = barAfter - panelAfter ->currentStyle->metrics->minimumWidth;
|
||||
minimumPosition2 = barAfter - panelAfter ->currentStyle->metrics->maximumWidth;
|
||||
maximumPosition2 = barBefore + panelBefore->currentStyle->metrics->maximumWidth;
|
||||
if (!panelAfter ->currentStyle->metrics->maximumWidth) minimumPosition2 = INT_MIN;
|
||||
if (!panelBefore->currentStyle->metrics->maximumWidth) maximumPosition2 = INT_MAX;
|
||||
minimumPosition1 = barBefore + panelBefore->style->metrics->minimumWidth;
|
||||
maximumPosition1 = barAfter - panelAfter ->style->metrics->minimumWidth;
|
||||
minimumPosition2 = barAfter - panelAfter ->style->metrics->maximumWidth;
|
||||
maximumPosition2 = barBefore + panelBefore->style->metrics->maximumWidth;
|
||||
if (!panelAfter ->style->metrics->maximumWidth) minimumPosition2 = INT_MIN;
|
||||
if (!panelBefore->style->metrics->maximumWidth) maximumPosition2 = INT_MAX;
|
||||
} else {
|
||||
minimumPosition1 = barBefore + panelBefore->currentStyle->metrics->minimumHeight;
|
||||
maximumPosition1 = barAfter - panelAfter ->currentStyle->metrics->minimumHeight;
|
||||
minimumPosition2 = barAfter - panelAfter ->currentStyle->metrics->maximumHeight;
|
||||
maximumPosition2 = barBefore + panelBefore->currentStyle->metrics->maximumHeight;
|
||||
if (!panelAfter ->currentStyle->metrics->maximumHeight) minimumPosition2 = INT_MIN;
|
||||
if (!panelBefore->currentStyle->metrics->maximumHeight) maximumPosition2 = INT_MAX;
|
||||
minimumPosition1 = barBefore + panelBefore->style->metrics->minimumHeight;
|
||||
maximumPosition1 = barAfter - panelAfter ->style->metrics->minimumHeight;
|
||||
minimumPosition2 = barAfter - panelAfter ->style->metrics->maximumHeight;
|
||||
maximumPosition2 = barBefore + panelBefore->style->metrics->maximumHeight;
|
||||
if (!panelAfter ->style->metrics->maximumHeight) minimumPosition2 = INT_MIN;
|
||||
if (!panelBefore->style->metrics->maximumHeight) maximumPosition2 = INT_MAX;
|
||||
}
|
||||
|
||||
minimumPosition = minimumPosition1 > minimumPosition2 ? minimumPosition1 : minimumPosition2;
|
||||
|
@ -5078,7 +5078,7 @@ int ProcessSplitterMessage(EsElement *element, EsMessage *message) {
|
|||
|
||||
if (message->type == ES_MSG_LAYOUT && splitter->GetChildCount()) {
|
||||
EsRectangle client = splitter->GetBounds();
|
||||
EsRectangle bounds = EsRectangleAddBorder(client, splitter->currentStyle->insets);
|
||||
EsRectangle bounds = EsRectangleAddBorder(client, splitter->style->insets);
|
||||
|
||||
size_t childCount = splitter->GetChildCount();
|
||||
EsAssert(childCount & 1); // Expected split bars between each EsSplitter child.
|
||||
|
@ -5103,7 +5103,7 @@ int ProcessSplitterMessage(EsElement *element, EsMessage *message) {
|
|||
if (newSize != splitter->previousSize && childCount > 1) {
|
||||
// Step 1: Make a list of current sizes.
|
||||
|
||||
int64_t barSize = splitter->horizontal ? splitter->GetChild(1)->currentStyle->preferredWidth : splitter->GetChild(1)->currentStyle->preferredHeight;
|
||||
int64_t barSize = splitter->horizontal ? splitter->GetChild(1)->style->preferredWidth : splitter->GetChild(1)->style->preferredHeight;
|
||||
int64_t previousPosition = 0;
|
||||
|
||||
if (!splitter->resizeStartSizes.Length()) {
|
||||
|
@ -5178,12 +5178,12 @@ int ProcessSplitterMessage(EsElement *element, EsMessage *message) {
|
|||
for (uintptr_t i = 1; i < childCount; i += 2) {
|
||||
SplitBar *bar = (SplitBar *) splitter->GetChild(i);
|
||||
bar->position = previousPosition + currentSizes[i >> 1];
|
||||
previousPosition = bar->position + barSize - (splitter->horizontal ? bar->currentStyle->borders.l : bar->currentStyle->borders.t);
|
||||
previousPosition = bar->position + barSize - (splitter->horizontal ? bar->style->borders.l : bar->style->borders.t);
|
||||
|
||||
if (bar->position == 0) {
|
||||
bar->position -= splitter->horizontal ? bar->currentStyle->borders.l : bar->currentStyle->borders.t;
|
||||
bar->position -= splitter->horizontal ? bar->style->borders.l : bar->style->borders.t;
|
||||
} else if (bar->position == newSize - barSize) {
|
||||
bar->position += splitter->horizontal ? bar->currentStyle->borders.r : bar->currentStyle->borders.b;
|
||||
bar->position += splitter->horizontal ? bar->style->borders.r : bar->style->borders.b;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5201,11 +5201,11 @@ int ProcessSplitterMessage(EsElement *element, EsMessage *message) {
|
|||
|
||||
if (i & 1) {
|
||||
if (splitter->horizontal) {
|
||||
int size = child->currentStyle->preferredWidth;
|
||||
int size = child->style->preferredWidth;
|
||||
EsElementMove(child, position, client.t, size, client.b - client.t);
|
||||
position += size;
|
||||
} else {
|
||||
int size = child->currentStyle->preferredHeight;
|
||||
int size = child->style->preferredHeight;
|
||||
EsElementMove(child, client.l, position, client.r - client.l, size);
|
||||
position += size;
|
||||
}
|
||||
|
@ -5458,7 +5458,7 @@ int ProcessSliderPointMessage(EsElement *element, EsMessage *message) {
|
|||
EsSlider *slider = (EsSlider *) EsElementGetLayoutParent(element);
|
||||
|
||||
if (message->type == ES_MSG_MOUSE_LEFT_DRAG) {
|
||||
double range = slider->width - slider->point->currentStyle->preferredWidth;
|
||||
double range = slider->width - slider->point->style->preferredWidth;
|
||||
slider->inDrag = true;
|
||||
EsSliderSetValue(slider, (message->mouseDragged.newPositionX + element->offsetX - slider->dragOffset) / range);
|
||||
} else if (message->type == ES_MSG_MOUSE_LEFT_UP && slider->inDrag) {
|
||||
|
@ -5480,8 +5480,8 @@ int ProcessSliderMessage(EsElement *element, EsMessage *message) {
|
|||
EsSlider *slider = (EsSlider *) element;
|
||||
|
||||
if (message->type == ES_MSG_LAYOUT) {
|
||||
int pointWidth = slider->point->currentStyle->preferredWidth;
|
||||
int pointHeight = slider->point->currentStyle->preferredHeight;
|
||||
int pointWidth = slider->point->style->preferredWidth;
|
||||
int pointHeight = slider->point->style->preferredHeight;
|
||||
slider->point->InternalMove(pointWidth, pointHeight, (slider->width - pointWidth) * slider->value, (slider->height - pointHeight) / 2);
|
||||
} else if (message->type == ES_MSG_FOCUSED_START) {
|
||||
slider->point->customStyleState |= THEME_STATE_FOCUSED_ITEM;
|
||||
|
@ -5857,7 +5857,7 @@ bool EsElement::InternalDestroy() {
|
|||
EsHeapFree(userData.p);
|
||||
}
|
||||
|
||||
if (currentStyle) currentStyle->CloseReference();
|
||||
if (style) style->CloseReference();
|
||||
if (previousTransitionFrame) EsPaintTargetDestroy(previousTransitionFrame);
|
||||
ThemeAnimationDestroy(&animation);
|
||||
if (window == this) UIWindowDestroy(window); // Windows are deallocated after receiving ES_MSG_WINDOW_DESTROYED.
|
||||
|
@ -5912,7 +5912,7 @@ EsRectangle EsWindowGetBounds(EsWindow *window) {
|
|||
|
||||
EsRectangle EsElementGetInsetBounds(EsElement *element) {
|
||||
EsMessageMutexCheck();
|
||||
EsRectangle insets = element->currentStyle->insets;
|
||||
EsRectangle insets = element->style->insets;
|
||||
return ES_RECT_4(insets.l, element->width - insets.r,
|
||||
insets.t, element->height - insets.b);
|
||||
}
|
||||
|
@ -5920,7 +5920,7 @@ EsRectangle EsElementGetInsetBounds(EsElement *element) {
|
|||
EsRectangle EsElementGetInsetSize(EsElement *element) {
|
||||
EsMessageMutexCheck();
|
||||
|
||||
EsRectangle insets = element->currentStyle->insets;
|
||||
EsRectangle insets = element->style->insets;
|
||||
return ES_RECT_4(0, element->width - insets.l - insets.r,
|
||||
0, element->height - insets.t - insets.b);
|
||||
}
|
||||
|
@ -6209,7 +6209,7 @@ void EsElementInsertAfter(EsElement *element) {
|
|||
gui.insertAfter = element;
|
||||
}
|
||||
|
||||
void EsElement::Initialise(EsElement *_parent, uint64_t _flags, EsUICallback _classCallback, const EsStyle *style) {
|
||||
void EsElement::Initialise(EsElement *_parent, uint64_t _flags, EsUICallback _classCallback, const EsStyle *_style) {
|
||||
EsMessageMutexCheck();
|
||||
|
||||
// EsPrint("New element '%z' %x with parent %x.\n", _debugName, this, _parent);
|
||||
|
@ -6271,20 +6271,20 @@ void EsElement::Initialise(EsElement *_parent, uint64_t _flags, EsUICallback _cl
|
|||
EsElementUpdateContentSize(parent);
|
||||
}
|
||||
|
||||
SetStyle(style, false);
|
||||
SetStyle(_style, false);
|
||||
RefreshStyle();
|
||||
InspectorNotifyElementCreated(this);
|
||||
}
|
||||
|
||||
EsRectangle EsElementGetInsets(EsElement *element) {
|
||||
EsMessageMutexCheck();
|
||||
return element->currentStyle->insets;
|
||||
return element->style->insets;
|
||||
}
|
||||
|
||||
EsThemeMetrics EsElementGetMetrics(EsElement *element) {
|
||||
EsMessageMutexCheck();
|
||||
EsThemeMetrics m = {};
|
||||
ThemeMetrics *metrics = element->currentStyle->metrics;
|
||||
ThemeMetrics *metrics = element->style->metrics;
|
||||
#define RECTANGLE_8_TO_ES_RECTANGLE(x) { (int32_t) (x).l, (int32_t) (x).r, (int32_t) (x).t, (int32_t) (x).b }
|
||||
m.insets = RECTANGLE_8_TO_ES_RECTANGLE(metrics->insets);
|
||||
m.clipInsets = RECTANGLE_8_TO_ES_RECTANGLE(metrics->clipInsets);
|
||||
|
@ -6479,7 +6479,7 @@ void EsElementGetSize(EsElement *element, int *width, int *height) {
|
|||
}
|
||||
|
||||
void EsElementGetTextStyle(EsElement *element, EsTextStyle *style) {
|
||||
element->currentStyle->GetTextStyle(style);
|
||||
element->style->GetTextStyle(style);
|
||||
}
|
||||
|
||||
void EsElementRepaint(EsElement *element, const EsRectangle *region) {
|
||||
|
@ -7193,7 +7193,7 @@ bool UISetCursor(EsWindow *window) {
|
|||
if (ES_HANDLED == EsMessageSend(element, &m)) {
|
||||
cursorStyle = m.cursorStyle;
|
||||
} else {
|
||||
cursorStyle = (EsCursorStyle) element->currentStyle->metrics->cursor;
|
||||
cursorStyle = (EsCursorStyle) element->style->metrics->cursor;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7916,7 +7916,7 @@ void InspectorNotifyElementPainted(EsElement *element, EsPainter *painter) {
|
|||
painter->offsetY, painter->offsetY + painter->height);
|
||||
|
||||
if (entry->element == element) {
|
||||
EsDrawRectangle(painter, bounds, 0x607F7FFF, 0x60FFFF7F, element->currentStyle->insets);
|
||||
EsDrawRectangle(painter, bounds, 0x607F7FFF, 0x60FFFF7F, element->style->insets);
|
||||
} else if (entry->element->parent == element) {
|
||||
if ((element->flags & ES_CELL_FILL) != ES_CELL_FILL) {
|
||||
EsRectangle rectangle = entry->givenBounds;
|
||||
|
|
|
@ -102,7 +102,7 @@ struct EsListView : EsElement {
|
|||
EsRectangle bounds = GetBounds();
|
||||
|
||||
if (columnHeader) {
|
||||
bounds.t += columnHeader->currentStyle->preferredHeight;
|
||||
bounds.t += columnHeader->style->preferredHeight;
|
||||
}
|
||||
|
||||
return bounds;
|
||||
|
@ -209,10 +209,10 @@ struct EsListView : EsElement {
|
|||
}
|
||||
|
||||
void GetItemPosition(EsListViewIndex groupIndex, EsListViewIndex index, int64_t *_position, int64_t *_itemSize) {
|
||||
int64_t gapBetweenGroup = currentStyle->gapMajor,
|
||||
gapBetweenItems = (flags & ES_LIST_VIEW_TILED) ? currentStyle->gapWrap : currentStyle->gapMinor,
|
||||
int64_t gapBetweenGroup = style->gapMajor,
|
||||
gapBetweenItems = (flags & ES_LIST_VIEW_TILED) ? style->gapWrap : style->gapMinor,
|
||||
fixedSize = (flags & ES_LIST_VIEW_VARIABLE_SIZE) ? 0 : (flags & ES_LIST_VIEW_HORIZONTAL ? fixedWidth : fixedHeight),
|
||||
startInset = flags & ES_LIST_VIEW_HORIZONTAL ? currentStyle->insets.l : currentStyle->insets.t;
|
||||
startInset = flags & ES_LIST_VIEW_HORIZONTAL ? style->insets.l : style->insets.t;
|
||||
|
||||
int64_t position = (flags & ES_LIST_VIEW_HORIZONTAL ? -scroll.position[0] : -scroll.position[1]) + startInset,
|
||||
itemSize = 0;
|
||||
|
@ -302,8 +302,8 @@ struct EsListView : EsElement {
|
|||
void EnsureItemVisible(EsListViewIndex groupIndex, EsListViewIndex index, bool alignTop) {
|
||||
EsRectangle contentBounds = GetListBounds();
|
||||
|
||||
int64_t startInset = flags & ES_LIST_VIEW_HORIZONTAL ? currentStyle->insets.l : currentStyle->insets.t,
|
||||
endInset = flags & ES_LIST_VIEW_HORIZONTAL ? currentStyle->insets.r : currentStyle->insets.b,
|
||||
int64_t startInset = flags & ES_LIST_VIEW_HORIZONTAL ? style->insets.l : style->insets.t,
|
||||
endInset = flags & ES_LIST_VIEW_HORIZONTAL ? style->insets.r : style->insets.b,
|
||||
contentSize = flags & ES_LIST_VIEW_HORIZONTAL ? Width(contentBounds) : Height(contentBounds);
|
||||
|
||||
int64_t position, itemSize;
|
||||
|
@ -329,8 +329,8 @@ struct EsListView : EsElement {
|
|||
}
|
||||
|
||||
EsMessage FindFirstVisibleItem(int64_t *_position, int64_t position, ListViewItem *reference, bool *noItems) {
|
||||
int64_t gapBetweenGroup = currentStyle->gapMajor,
|
||||
gapBetweenItems = (flags & ES_LIST_VIEW_TILED) ? currentStyle->gapWrap : currentStyle->gapMinor,
|
||||
int64_t gapBetweenGroup = style->gapMajor,
|
||||
gapBetweenItems = (flags & ES_LIST_VIEW_TILED) ? style->gapWrap : style->gapMinor,
|
||||
fixedSize = (flags & ES_LIST_VIEW_VARIABLE_SIZE) ? 0 : (flags & ES_LIST_VIEW_HORIZONTAL ? fixedWidth : fixedHeight);
|
||||
|
||||
// Find the group.
|
||||
|
@ -483,7 +483,7 @@ struct EsListView : EsElement {
|
|||
void Populate() {
|
||||
#if 0
|
||||
EsPrint("--- Before Populate() ---\n");
|
||||
EsPrint("Scroll: %i\n", (int) (scroll.position[1] - currentStyle->insets.t));
|
||||
EsPrint("Scroll: %i\n", (int) (scroll.position[1] - style->insets.t));
|
||||
|
||||
for (uintptr_t i = 0; i < visibleItems.Length(); i++) {
|
||||
EsMessage m = { ES_MSG_LIST_VIEW_GET_CONTENT };
|
||||
|
@ -509,8 +509,8 @@ struct EsListView : EsElement {
|
|||
|
||||
EsRectangle contentBounds = GetListBounds();
|
||||
int64_t contentSize = flags & ES_LIST_VIEW_HORIZONTAL ? Width(contentBounds) : Height(contentBounds);
|
||||
int64_t scroll = EsCRTfloor(flags & ES_LIST_VIEW_HORIZONTAL ? (this->scroll.position[0] - currentStyle->insets.l)
|
||||
: (this->scroll.position[1] - currentStyle->insets.t));
|
||||
int64_t scroll = EsCRTfloor(flags & ES_LIST_VIEW_HORIZONTAL ? (this->scroll.position[0] - style->insets.l)
|
||||
: (this->scroll.position[1] - style->insets.t));
|
||||
|
||||
int64_t position = 0;
|
||||
bool noItems = false;
|
||||
|
@ -521,10 +521,10 @@ struct EsListView : EsElement {
|
|||
int64_t fixedMinorSize = (flags & ES_LIST_VIEW_HORIZONTAL) ? fixedHeight : fixedWidth;
|
||||
intptr_t itemsPerBand = GetItemsPerBand();
|
||||
intptr_t itemInBand = 0;
|
||||
int64_t computedMinorGap = currentStyle->gapMinor;
|
||||
int64_t computedMinorGap = style->gapMinor;
|
||||
int64_t minorPosition = 0;
|
||||
int64_t centerOffset = (flags & ES_LIST_VIEW_CENTER_TILES)
|
||||
? (wrapLimit - itemsPerBand * (fixedMinorSize + currentStyle->gapMinor) + currentStyle->gapMinor) / 2 : 0;
|
||||
? (wrapLimit - itemsPerBand * (fixedMinorSize + style->gapMinor) + style->gapMinor) / 2 : 0;
|
||||
|
||||
while (visibleIndex < visibleItems.Length()) {
|
||||
// Remove visible items no longer visible, before the viewport.
|
||||
|
@ -633,10 +633,10 @@ struct EsListView : EsElement {
|
|||
if ((flags & ES_LIST_VIEW_TILED) && !visibleItem->isHeader && !visibleItem->isFooter) {
|
||||
if (flags & ES_LIST_VIEW_HORIZONTAL) {
|
||||
visibleItem->element->InternalMove(fixedWidth, fixedHeight,
|
||||
position + contentBounds.l, minorPosition + currentStyle->insets.t + contentBounds.t + centerOffset);
|
||||
position + contentBounds.l, minorPosition + style->insets.t + contentBounds.t + centerOffset);
|
||||
} else {
|
||||
visibleItem->element->InternalMove(fixedWidth, fixedHeight,
|
||||
minorPosition + currentStyle->insets.l + contentBounds.l + centerOffset, position + contentBounds.t);
|
||||
minorPosition + style->insets.l + contentBounds.l + centerOffset, position + contentBounds.t);
|
||||
}
|
||||
|
||||
minorPosition += computedMinorGap + fixedMinorSize;
|
||||
|
@ -649,33 +649,33 @@ struct EsListView : EsElement {
|
|||
minorPosition = 0;
|
||||
itemInBand = 0;
|
||||
position += (flags & ES_LIST_VIEW_HORIZONTAL) ? visibleItem->element->width : visibleItem->element->height;
|
||||
if (!endOfGroup || (group->flags & ES_LIST_VIEW_GROUP_HAS_FOOTER)) position += currentStyle->gapWrap;
|
||||
if (!endOfGroup || (group->flags & ES_LIST_VIEW_GROUP_HAS_FOOTER)) position += style->gapWrap;
|
||||
}
|
||||
} else {
|
||||
if (flags & ES_LIST_VIEW_HORIZONTAL) {
|
||||
visibleItem->element->InternalMove(
|
||||
visibleItem->size,
|
||||
Height(contentBounds) - currentStyle->insets.t - currentStyle->insets.b - visibleItem->indent * currentStyle->gapWrap,
|
||||
Height(contentBounds) - style->insets.t - style->insets.b - visibleItem->indent * style->gapWrap,
|
||||
position + contentBounds.l,
|
||||
currentStyle->insets.t - this->scroll.position[1] + visibleItem->indent * currentStyle->gapWrap + contentBounds.t);
|
||||
style->insets.t - this->scroll.position[1] + visibleItem->indent * style->gapWrap + contentBounds.t);
|
||||
position += visibleItem->element->width;
|
||||
} else if ((flags & ES_LIST_VIEW_COLUMNS) && ((~flags & ES_LIST_VIEW_CHOICE_SELECT) || (this->scroll.enabled[0]))) {
|
||||
int indent = visibleItem->indent * currentStyle->gapWrap;
|
||||
int indent = visibleItem->indent * style->gapWrap;
|
||||
int firstColumn = columns[0].width * theming.scale + secondaryCellStyle->gapMajor;
|
||||
visibleItem->startAtSecondColumn = indent > firstColumn;
|
||||
if (indent > firstColumn) indent = firstColumn;
|
||||
visibleItem->element->InternalMove(totalColumnWidth - indent, visibleItem->size,
|
||||
indent - this->scroll.position[0] + contentBounds.l + currentStyle->insets.l, position + contentBounds.t);
|
||||
indent - this->scroll.position[0] + contentBounds.l + style->insets.l, position + contentBounds.t);
|
||||
position += visibleItem->element->height;
|
||||
} else {
|
||||
int indent = visibleItem->indent * currentStyle->gapWrap + currentStyle->insets.l;
|
||||
visibleItem->element->InternalMove(Width(contentBounds) - indent - currentStyle->insets.r, visibleItem->size,
|
||||
int indent = visibleItem->indent * style->gapWrap + style->insets.l;
|
||||
visibleItem->element->InternalMove(Width(contentBounds) - indent - style->insets.r, visibleItem->size,
|
||||
indent + contentBounds.l - this->scroll.position[0], position + contentBounds.t);
|
||||
position += visibleItem->element->height;
|
||||
}
|
||||
|
||||
if ((flags & ES_LIST_VIEW_TILED) && (group->flags & ES_LIST_VIEW_GROUP_HAS_HEADER) && currentItem.iterateIndex.index == 0) {
|
||||
position += currentStyle->gapWrap;
|
||||
position += style->gapWrap;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -684,7 +684,7 @@ struct EsListView : EsElement {
|
|||
visibleIndex++;
|
||||
EsListViewIndex previousGroup = currentItem.iterateIndex.group;
|
||||
if (!IterateForwards(¤tItem)) break;
|
||||
position += previousGroup == currentItem.iterateIndex.group ? (flags & ES_LIST_VIEW_TILED ? 0 : currentStyle->gapMinor) : currentStyle->gapMajor;
|
||||
position += previousGroup == currentItem.iterateIndex.group ? (flags & ES_LIST_VIEW_TILED ? 0 : style->gapMinor) : style->gapMajor;
|
||||
}
|
||||
|
||||
while (visibleIndex < visibleItems.Length()) {
|
||||
|
@ -711,21 +711,21 @@ struct EsListView : EsElement {
|
|||
intptr_t itemCount = group->itemCount;
|
||||
|
||||
if (group->flags & ES_LIST_VIEW_GROUP_HAS_HEADER) {
|
||||
groupSize += fixedHeaderSize + currentStyle->gapWrap;
|
||||
groupSize += fixedHeaderSize + style->gapWrap;
|
||||
itemCount--;
|
||||
}
|
||||
|
||||
if (group->flags & ES_LIST_VIEW_GROUP_HAS_FOOTER) {
|
||||
groupSize += fixedFooterSize + currentStyle->gapWrap;
|
||||
groupSize += fixedFooterSize + style->gapWrap;
|
||||
itemCount--;
|
||||
}
|
||||
|
||||
intptr_t bandsInGroup = (itemCount + itemsPerBand - 1) / itemsPerBand;
|
||||
groupSize += (((flags & ES_LIST_VIEW_HORIZONTAL) ? fixedWidth : fixedHeight) + currentStyle->gapWrap) * bandsInGroup;
|
||||
groupSize -= currentStyle->gapWrap;
|
||||
groupSize += (((flags & ES_LIST_VIEW_HORIZONTAL) ? fixedWidth : fixedHeight) + style->gapWrap) * bandsInGroup;
|
||||
groupSize -= style->gapWrap;
|
||||
group->totalSize = groupSize;
|
||||
|
||||
totalSize += groupSize + (group == &groups.Last() ? 0 : currentStyle->gapMajor);
|
||||
totalSize += groupSize + (group == &groups.Last() ? 0 : style->gapMajor);
|
||||
}
|
||||
|
||||
scroll.Refresh();
|
||||
|
@ -941,8 +941,8 @@ struct EsListView : EsElement {
|
|||
} else {
|
||||
int64_t wrapLimit = GetWrapLimit();
|
||||
int64_t fixedMinorSize = (flags & ES_LIST_VIEW_HORIZONTAL) ? fixedHeight : fixedWidth;
|
||||
intptr_t itemsPerBand = fixedMinorSize && ((fixedMinorSize + currentStyle->gapMinor) < wrapLimit)
|
||||
? (wrapLimit / (fixedMinorSize + currentStyle->gapMinor)) : 1;
|
||||
intptr_t itemsPerBand = fixedMinorSize && ((fixedMinorSize + style->gapMinor) < wrapLimit)
|
||||
? (wrapLimit / (fixedMinorSize + style->gapMinor)) : 1;
|
||||
return MinimumInteger(itemsPerBand, maximumItemsPerBand);
|
||||
}
|
||||
}
|
||||
|
@ -958,15 +958,15 @@ struct EsListView : EsElement {
|
|||
bool noItems = false;
|
||||
|
||||
if (flags & ES_LIST_VIEW_HORIZONTAL) {
|
||||
if (y1 >= contentBounds.b - currentStyle->insets.b || y2 < contentBounds.t + currentStyle->insets.t) {
|
||||
if (y1 >= contentBounds.b - style->insets.b || y2 < contentBounds.t + style->insets.t) {
|
||||
return;
|
||||
}
|
||||
} else if (flags & ES_LIST_VIEW_COLUMNS) {
|
||||
if (x1 >= contentBounds.l + currentStyle->insets.l + totalColumnWidth || x2 < contentBounds.l + currentStyle->insets.l) {
|
||||
if (x1 >= contentBounds.l + style->insets.l + totalColumnWidth || x2 < contentBounds.l + style->insets.l) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (x1 >= contentBounds.r - currentStyle->insets.r || x2 < contentBounds.l + currentStyle->insets.l) {
|
||||
if (x1 >= contentBounds.r - style->insets.r || x2 < contentBounds.l + style->insets.l) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -974,8 +974,8 @@ struct EsListView : EsElement {
|
|||
// TODO Use reference for FindFirstVisibleItem.
|
||||
|
||||
bool adjustStart = false, adjustEnd = false;
|
||||
int r1 = (flags & ES_LIST_VIEW_HORIZONTAL) ? currentStyle->insets.l - x1 : currentStyle->insets.t - y1 + scroll.fixedViewport[1];
|
||||
int r2 = (flags & ES_LIST_VIEW_HORIZONTAL) ? currentStyle->insets.l - x2 : currentStyle->insets.t - y2 + scroll.fixedViewport[1];
|
||||
int r1 = (flags & ES_LIST_VIEW_HORIZONTAL) ? style->insets.l - x1 : style->insets.t - y1 + scroll.fixedViewport[1];
|
||||
int r2 = (flags & ES_LIST_VIEW_HORIZONTAL) ? style->insets.l - x2 : style->insets.t - y2 + scroll.fixedViewport[1];
|
||||
start = FindFirstVisibleItem(&offset, r1, nullptr, &noItems);
|
||||
if (noItems) return;
|
||||
adjustStart = -offset >= MeasureItems(start.iterateIndex.group, start.iterateIndex.index, 1);
|
||||
|
@ -988,7 +988,7 @@ struct EsListView : EsElement {
|
|||
int64_t fixedMinorSize = (flags & ES_LIST_VIEW_HORIZONTAL) ? fixedHeight : fixedWidth;
|
||||
intptr_t itemsPerBand = GetItemsPerBand();
|
||||
int64_t computedMinorGap = (wrapLimit - itemsPerBand * fixedMinorSize) / (itemsPerBand + 1);
|
||||
int64_t minorStartOffset = computedMinorGap + ((flags & ES_LIST_VIEW_HORIZONTAL) ? currentStyle->insets.t : currentStyle->insets.l);
|
||||
int64_t minorStartOffset = computedMinorGap + ((flags & ES_LIST_VIEW_HORIZONTAL) ? style->insets.t : style->insets.l);
|
||||
intptr_t startInBand = (((flags & ES_LIST_VIEW_HORIZONTAL) ? y1 : x1) - minorStartOffset) / (fixedMinorSize + computedMinorGap);
|
||||
intptr_t endInBand = (((flags & ES_LIST_VIEW_HORIZONTAL) ? y2 : x2) - minorStartOffset) / (fixedMinorSize + computedMinorGap);
|
||||
|
||||
|
@ -1130,7 +1130,7 @@ struct EsListView : EsElement {
|
|||
}
|
||||
|
||||
if (flags & ES_LIST_VIEW_COLUMNS) {
|
||||
EsRectangle bounds = EsRectangleAddBorder(element->GetBounds(), element->currentStyle->insets);
|
||||
EsRectangle bounds = EsRectangleAddBorder(element->GetBounds(), element->style->insets);
|
||||
|
||||
for (uintptr_t i = item->startAtSecondColumn ? 1 : 0; i < columnCount; i++) {
|
||||
m.getContent.column = i;
|
||||
|
@ -1138,10 +1138,10 @@ struct EsListView : EsElement {
|
|||
buffer.position = 0;
|
||||
|
||||
bounds.r = bounds.l + columns[i].width * theming.scale
|
||||
- element->currentStyle->insets.r - element->currentStyle->insets.l;
|
||||
- element->style->insets.r - element->style->insets.l;
|
||||
|
||||
if (i == 0) {
|
||||
bounds.r -= item->indent * currentStyle->gapWrap;
|
||||
bounds.r -= item->indent * style->gapWrap;
|
||||
}
|
||||
|
||||
EsRectangle drawBounds = { bounds.l + message->painter->offsetX, bounds.r + message->painter->offsetX,
|
||||
|
@ -1168,7 +1168,7 @@ struct EsListView : EsElement {
|
|||
bounds.l += columns[i].width * theming.scale + secondaryCellStyle->gapMajor;
|
||||
|
||||
if (i == 0) {
|
||||
bounds.l -= item->indent * currentStyle->gapWrap;
|
||||
bounds.l -= item->indent * style->gapWrap;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -1260,8 +1260,8 @@ struct EsListView : EsElement {
|
|||
inline int GetWrapLimit() {
|
||||
EsRectangle bounds = GetListBounds();
|
||||
return (flags & ES_LIST_VIEW_HORIZONTAL)
|
||||
? bounds.b - bounds.t - currentStyle->insets.b - currentStyle->insets.t
|
||||
: bounds.r - bounds.l - currentStyle->insets.r - currentStyle->insets.l;
|
||||
? bounds.b - bounds.t - style->insets.b - style->insets.t
|
||||
: bounds.r - bounds.l - style->insets.r - style->insets.l;
|
||||
}
|
||||
|
||||
ListViewItem *FindVisibleItem(EsListViewIndex group, EsListViewIndex index) {
|
||||
|
@ -1543,26 +1543,26 @@ struct EsListView : EsElement {
|
|||
}
|
||||
|
||||
void MoveInlineTextbox(ListViewItem *item) {
|
||||
UIStyle *style = item->element->currentStyle;
|
||||
UIStyle *style = item->element->style;
|
||||
|
||||
if (flags & ES_LIST_VIEW_COLUMNS) {
|
||||
int offset = primaryCellStyle->metrics->iconSize + primaryCellStyle->gapMinor
|
||||
+ style->insets.l - inlineTextbox->currentStyle->insets.l;
|
||||
+ style->insets.l - inlineTextbox->style->insets.l;
|
||||
inlineTextbox->InternalMove(columns[0].width * theming.scale - offset, item->element->height,
|
||||
item->element->offsetX + offset, item->element->offsetY);
|
||||
} else if (flags & ES_LIST_VIEW_TILED) {
|
||||
if (style->metrics->layoutVertical) {
|
||||
int height = inlineTextbox->currentStyle->preferredHeight;
|
||||
int height = inlineTextbox->style->preferredHeight;
|
||||
int textStart = style->metrics->iconSize + style->gapMinor + style->insets.t;
|
||||
int textEnd = item->element->height - style->insets.b;
|
||||
int offset = (textStart + textEnd - height) / 2;
|
||||
inlineTextbox->InternalMove(item->element->width - style->insets.r - style->insets.l, height,
|
||||
item->element->offsetX + style->insets.l, item->element->offsetY + offset);
|
||||
} else {
|
||||
int textboxInset = inlineTextbox->currentStyle->insets.l;
|
||||
int textboxInset = inlineTextbox->style->insets.l;
|
||||
int offset = style->metrics->iconSize + style->gapMinor
|
||||
+ style->insets.l - textboxInset;
|
||||
int height = inlineTextbox->currentStyle->preferredHeight;
|
||||
int height = inlineTextbox->style->preferredHeight;
|
||||
inlineTextbox->InternalMove(item->element->width - offset - style->insets.r + textboxInset, height,
|
||||
item->element->offsetX + offset,
|
||||
item->element->offsetY + (item->element->height - height) / 2);
|
||||
|
@ -1578,13 +1578,13 @@ struct EsListView : EsElement {
|
|||
|
||||
if (message->type == ES_MSG_GET_WIDTH || message->type == ES_MSG_GET_HEIGHT) {
|
||||
if (flags & ES_LIST_VIEW_HORIZONTAL) {
|
||||
message->measure.width = totalSize + currentStyle->insets.l + currentStyle->insets.r;
|
||||
message->measure.width = totalSize + style->insets.l + style->insets.r;
|
||||
} else {
|
||||
message->measure.height = totalSize + currentStyle->insets.t + currentStyle->insets.b;
|
||||
message->measure.height = totalSize + style->insets.t + style->insets.b;
|
||||
|
||||
if (flags & ES_LIST_VIEW_COLUMNS) {
|
||||
message->measure.width = totalColumnWidth + currentStyle->insets.l + currentStyle->insets.r;
|
||||
message->measure.height += columnHeader->currentStyle->preferredHeight;
|
||||
message->measure.width = totalColumnWidth + style->insets.l + style->insets.r;
|
||||
message->measure.height += columnHeader->style->preferredHeight;
|
||||
}
|
||||
}
|
||||
} else if (message->type == ES_MSG_LAYOUT) {
|
||||
|
@ -1594,7 +1594,7 @@ struct EsListView : EsElement {
|
|||
|
||||
if (columnHeader) {
|
||||
EsRectangle bounds = GetBounds();
|
||||
columnHeader->InternalMove(Width(bounds), columnHeader->currentStyle->preferredHeight, 0, 0);
|
||||
columnHeader->InternalMove(Width(bounds), columnHeader->style->preferredHeight, 0, 0);
|
||||
}
|
||||
|
||||
if (inlineTextbox) {
|
||||
|
@ -1903,14 +1903,14 @@ void EsListViewChangeStyles(EsListView *view, const EsStyle *style, const EsStyl
|
|||
EsListView *view = (EsListView *) element->userData.p;
|
||||
|
||||
if (message->type == ES_MSG_LAYOUT) {
|
||||
int x = view->currentStyle->insets.l - view->scroll.position[0];
|
||||
int x = view->style->insets.l - view->scroll.position[0];
|
||||
|
||||
for (uintptr_t i = 0; i < element->children.Length(); i += 2) {
|
||||
EsElement *item = element->children[i], *splitter = element->children[i + 1];
|
||||
EsListViewColumn *column = view->columns + item->userData.u;
|
||||
int splitterLeft = splitter->currentStyle->preferredWidth - view->secondaryCellStyle->gapMajor;
|
||||
int splitterLeft = splitter->style->preferredWidth - view->secondaryCellStyle->gapMajor;
|
||||
item->InternalMove(column->width * theming.scale - splitterLeft, element->height, x, 0);
|
||||
splitter->InternalMove(splitter->currentStyle->preferredWidth, element->height, x + column->width * theming.scale - splitterLeft, 0);
|
||||
splitter->InternalMove(splitter->style->preferredWidth, element->height, x + column->width * theming.scale - splitterLeft, 0);
|
||||
x += column->width * theming.scale + view->secondaryCellStyle->gapMajor;
|
||||
}
|
||||
}
|
||||
|
@ -1918,7 +1918,7 @@ void EsListViewChangeStyles(EsListView *view, const EsStyle *style, const EsStyl
|
|||
return 0;
|
||||
};
|
||||
|
||||
view->scroll.fixedViewport[1] = view->columnHeader->currentStyle->preferredHeight;
|
||||
view->scroll.fixedViewport[1] = view->columnHeader->style->preferredHeight;
|
||||
} else if ((~view->flags & ES_LIST_VIEW_COLUMNS) && view->columnHeader) {
|
||||
EsElementDestroy(view->columnHeader);
|
||||
view->columnHeader = nullptr;
|
||||
|
@ -2031,7 +2031,7 @@ void EsListViewInsertGroup(EsListView *view, EsListViewIndex group, uint32_t fla
|
|||
|
||||
// Insert gap between groups.
|
||||
|
||||
view->InsertSpace(view->groups.Length() > 1 ? view->currentStyle->gapMajor : 0, firstVisibleItemToMove);
|
||||
view->InsertSpace(view->groups.Length() > 1 ? view->style->gapMajor : 0, firstVisibleItemToMove);
|
||||
|
||||
// Create header and footer items.
|
||||
|
||||
|
@ -2065,7 +2065,7 @@ void EsListViewInsert(EsListView *view, EsListViewIndex groupIndex, EsListViewIn
|
|||
bool addedFirstItemInGroup = !group->itemCount;
|
||||
group->itemCount += count;
|
||||
int64_t totalSizeOfItems = view->MeasureItems(groupIndex, firstIndex, count);
|
||||
int64_t sizeToAdd = (count - (addedFirstItemInGroup ? 1 : 0)) * view->currentStyle->gapMinor + totalSizeOfItems;
|
||||
int64_t sizeToAdd = (count - (addedFirstItemInGroup ? 1 : 0)) * view->style->gapMinor + totalSizeOfItems;
|
||||
group->totalSize += sizeToAdd;
|
||||
view->totalItemCount += count;
|
||||
|
||||
|
@ -2136,7 +2136,7 @@ void EsListViewRemove(EsListView *view, EsListViewIndex groupIndex, EsListViewIn
|
|||
|
||||
int64_t totalSizeOfItems = view->MeasureItems(groupIndex, firstIndex, count);
|
||||
int64_t sizeToRemove = (int64_t) group->itemCount == count ? group->totalSize
|
||||
: (count * view->currentStyle->gapMinor + totalSizeOfItems);
|
||||
: (count * view->style->gapMinor + totalSizeOfItems);
|
||||
group->itemCount -= count;
|
||||
group->totalSize -= sizeToRemove;
|
||||
view->totalItemCount -= count;
|
||||
|
@ -2258,7 +2258,7 @@ void EsListViewSetColumns(EsListView *view, EsListViewColumn *columns, size_t co
|
|||
view->columnResizingOriginalWidth = column->width * theming.scale;
|
||||
} else if (message->type == ES_MSG_MOUSE_LEFT_DRAG) {
|
||||
int width = message->mouseDragged.newPositionX - message->mouseDragged.originalPositionX + view->columnResizingOriginalWidth;
|
||||
int minimumWidth = element->currentStyle->metrics->minimumWidth;
|
||||
int minimumWidth = element->style->metrics->minimumWidth;
|
||||
if (width < minimumWidth) width = minimumWidth;
|
||||
column->width = width / theming.scale;
|
||||
ListViewCalculateTotalColumnWidth(view);
|
||||
|
|
|
@ -4263,14 +4263,14 @@ int ProcessTextboxMarginMessage(EsElement *element, EsMessage *message) {
|
|||
DocumentLine *line = &textbox->lines[i + textbox->firstVisibleLine];
|
||||
|
||||
EsRectangle bounds;
|
||||
bounds.l = painter->offsetX + element->currentStyle->insets.l;
|
||||
bounds.r = painter->offsetX + painter->width - element->currentStyle->insets.r;
|
||||
bounds.l = painter->offsetX + element->style->insets.l;
|
||||
bounds.r = painter->offsetX + painter->width - element->style->insets.r;
|
||||
bounds.t = painter->offsetY + textbox->insets.t + visibleLine->yPosition - textbox->scroll.position[1];
|
||||
bounds.b = bounds.t + line->height;
|
||||
|
||||
char label[64];
|
||||
EsTextRun textRun[2] = {};
|
||||
element->currentStyle->GetTextStyle(&textRun[0].style);
|
||||
element->style->GetTextStyle(&textRun[0].style);
|
||||
textRun[0].style.figures = ES_TEXT_FIGURE_TABULAR;
|
||||
textRun[1].offset = EsStringFormat(label, sizeof(label), "%d", i + textbox->firstVisibleLine + 1);
|
||||
EsTextPlanProperties properties = {};
|
||||
|
@ -4284,13 +4284,13 @@ int ProcessTextboxMarginMessage(EsElement *element, EsMessage *message) {
|
|||
}
|
||||
|
||||
void TextboxStyleChanged(EsTextbox *textbox) {
|
||||
textbox->borders = textbox->currentStyle->borders;
|
||||
textbox->insets = textbox->currentStyle->insets;
|
||||
textbox->borders = textbox->style->borders;
|
||||
textbox->insets = textbox->style->insets;
|
||||
|
||||
if (textbox->flags & ES_TEXTBOX_MARGIN) {
|
||||
int marginWidth = textbox->margin->currentStyle->preferredWidth;
|
||||
int marginWidth = textbox->margin->style->preferredWidth;
|
||||
textbox->borders.l += marginWidth;
|
||||
textbox->insets.l += marginWidth + textbox->margin->currentStyle->gapMajor;
|
||||
textbox->insets.l += marginWidth + textbox->margin->style->gapMajor;
|
||||
}
|
||||
|
||||
int lineHeight = TextGetLineHeight(textbox, &textbox->textStyle);
|
||||
|
@ -4328,8 +4328,8 @@ int ProcessTextboxMessage(EsElement *element, EsMessage *message) {
|
|||
EsTextSelection selectionProperties = {};
|
||||
selectionProperties.hideCaret = (~textbox->state & UI_STATE_FOCUSED) || (textbox->flags & ES_ELEMENT_DISABLED) || !textbox->editing;
|
||||
selectionProperties.snapCaretToInsets = true;
|
||||
selectionProperties.background = textbox->currentStyle->metrics->selectedBackground;
|
||||
selectionProperties.foreground = textbox->currentStyle->metrics->selectedText;
|
||||
selectionProperties.background = textbox->style->metrics->selectedBackground;
|
||||
selectionProperties.foreground = textbox->style->metrics->selectedText;
|
||||
|
||||
EsRectangle clip;
|
||||
EsRectangleClip(painter->clip, ES_RECT_4(painter->offsetX + textbox->borders.l,
|
||||
|
@ -4402,7 +4402,7 @@ int ProcessTextboxMessage(EsElement *element, EsMessage *message) {
|
|||
EsRectangle bounds = textbox->GetBounds();
|
||||
|
||||
if (textbox->margin) {
|
||||
int marginWidth = textbox->margin->currentStyle->preferredWidth;
|
||||
int marginWidth = textbox->margin->style->preferredWidth;
|
||||
textbox->margin->InternalMove(marginWidth, Height(bounds), bounds.l, bounds.t);
|
||||
}
|
||||
|
||||
|
@ -4670,7 +4670,7 @@ int ProcessTextboxMessage(EsElement *element, EsMessage *message) {
|
|||
TextboxSetHorizontalScroll(textbox, message->scrollbarMoved.scroll);
|
||||
} else if (message->type == ES_MSG_SCROLL_Y) {
|
||||
TextboxRefreshVisibleLines(textbox, false);
|
||||
EsElementRepaintForScroll(textbox, message, EsRectangleAdd(element->GetInternalOffset(), element->currentStyle->borders));
|
||||
EsElementRepaintForScroll(textbox, message, EsRectangleAdd(element->GetInternalOffset(), element->style->borders));
|
||||
} else if (message->type == ES_MSG_GET_INSPECTOR_INFORMATION) {
|
||||
DocumentLine *firstLine = &textbox->lines.First();
|
||||
EsBufferFormat(message->getContent.buffer, "'%s'", firstLine->lengthBytes, firstLine->GetBuffer(textbox));
|
||||
|
@ -4680,7 +4680,7 @@ int ProcessTextboxMessage(EsElement *element, EsMessage *message) {
|
|||
textbox->margin->RefreshStyle(nullptr, false, true);
|
||||
}
|
||||
|
||||
textbox->currentStyle->GetTextStyle(&textbox->textStyle);
|
||||
textbox->style->GetTextStyle(&textbox->textStyle);
|
||||
|
||||
if (textbox->overrideTextSize) {
|
||||
textbox->textStyle.size = textbox->overrideTextSize;
|
||||
|
@ -4721,10 +4721,10 @@ EsTextbox *EsTextboxCreate(EsElement *parent, uint64_t flags, const EsStyle *sty
|
|||
textbox->undo = &textbox->localUndo;
|
||||
textbox->undo->instance = textbox->instance;
|
||||
|
||||
textbox->borders = textbox->currentStyle->borders;
|
||||
textbox->insets = textbox->currentStyle->insets;
|
||||
textbox->borders = textbox->style->borders;
|
||||
textbox->insets = textbox->style->insets;
|
||||
|
||||
textbox->currentStyle->GetTextStyle(&textbox->textStyle);
|
||||
textbox->style->GetTextStyle(&textbox->textStyle);
|
||||
|
||||
textbox->smartQuotes = true;
|
||||
|
||||
|
@ -4746,9 +4746,9 @@ EsTextbox *EsTextboxCreate(EsElement *parent, uint64_t flags, const EsStyle *sty
|
|||
textbox->margin->cName = "margin";
|
||||
textbox->margin->messageUser = ProcessTextboxMarginMessage;
|
||||
|
||||
int marginWidth = textbox->margin->currentStyle->preferredWidth;
|
||||
int marginWidth = textbox->margin->style->preferredWidth;
|
||||
textbox->borders.l += marginWidth;
|
||||
textbox->insets.l += marginWidth + textbox->margin->currentStyle->gapMajor;
|
||||
textbox->insets.l += marginWidth + textbox->margin->style->gapMajor;
|
||||
}
|
||||
|
||||
return textbox;
|
||||
|
@ -4994,7 +4994,7 @@ int ProcessTextDisplayMessage(EsElement *element, EsMessage *message) {
|
|||
|
||||
if (!display->plan || display->planWidth != textBounds.r - textBounds.l || display->planHeight != textBounds.b - textBounds.t) {
|
||||
if (display->plan) EsTextPlanDestroy(display->plan);
|
||||
display->properties.flags = display->currentStyle->textAlign;
|
||||
display->properties.flags = display->style->textAlign;
|
||||
if (~display->flags & ES_TEXT_DISPLAY_PREFORMATTED) display->properties.flags |= ES_TEXT_PLAN_TRIM_SPACES;
|
||||
if (display->flags & ES_TEXT_DISPLAY_NO_FONT_SUBSTITUTION) display->properties.flags |= ES_TEXT_PLAN_NO_FONT_SUBSTITUTION;
|
||||
display->plan = EsTextPlanCreate(element, &display->properties, textBounds, display->contents, display->textRuns, display->textRunCount);
|
||||
|
@ -5008,7 +5008,7 @@ int ProcessTextDisplayMessage(EsElement *element, EsMessage *message) {
|
|||
} else if (message->type == ES_MSG_GET_WIDTH || message->type == ES_MSG_GET_HEIGHT) {
|
||||
if (!display->measurementCache.Get(message, &display->state)) {
|
||||
if (display->plan) EsTextPlanDestroy(display->plan);
|
||||
display->properties.flags = display->currentStyle->textAlign | ((display->flags & ES_TEXT_DISPLAY_PREFORMATTED) ? 0 : ES_TEXT_PLAN_TRIM_SPACES);
|
||||
display->properties.flags = display->style->textAlign | ((display->flags & ES_TEXT_DISPLAY_PREFORMATTED) ? 0 : ES_TEXT_PLAN_TRIM_SPACES);
|
||||
EsRectangle insets = EsElementGetInsets(element);
|
||||
display->planWidth = message->type == ES_MSG_GET_HEIGHT && message->measure.width
|
||||
? (message->measure.width - insets.l - insets.r) : 0;
|
||||
|
@ -5078,12 +5078,12 @@ void EsTextDisplaySetContents(EsTextDisplay *display, const char *string, ptrdif
|
|||
if (display->flags & ES_TEXT_DISPLAY_RICH_TEXT) {
|
||||
EsHeapFree(display->contents);
|
||||
EsTextStyle baseStyle = {};
|
||||
display->currentStyle->GetTextStyle(&baseStyle);
|
||||
display->style->GetTextStyle(&baseStyle);
|
||||
EsRichTextParse(string, stringBytes, &display->contents, &display->textRuns, &display->textRunCount, &baseStyle);
|
||||
} else {
|
||||
HeapDuplicate((void **) &display->contents, (size_t *) &stringBytes, string, stringBytes);
|
||||
display->textRuns = (EsTextRun *) EsHeapAllocate(sizeof(EsTextRun) * 2, true);
|
||||
display->currentStyle->GetTextStyle(&display->textRuns[0].style);
|
||||
display->style->GetTextStyle(&display->textRuns[0].style);
|
||||
display->textRuns[1].offset = stringBytes;
|
||||
display->textRunCount = 1;
|
||||
}
|
||||
|
@ -5119,7 +5119,7 @@ void EsTextDisplaySetupSyntaxHighlighting(EsTextDisplay *display, uint32_t langu
|
|||
EsMemoryCopy(colors, customColors, customColorCount * sizeof(uint32_t));
|
||||
|
||||
EsTextStyle textStyle = {};
|
||||
display->currentStyle->GetTextStyle(&textStyle);
|
||||
display->style->GetTextStyle(&textStyle);
|
||||
|
||||
EsTextRun *newRuns = TextApplySyntaxHighlighting(&textStyle, language, colors, {},
|
||||
display->contents, display->textRuns[display->textRunCount].offset).array;
|
||||
|
@ -5142,7 +5142,7 @@ int ProcessListDisplayMessage(EsElement *element, EsMessage *message) {
|
|||
|
||||
if (message->type == ES_MSG_GET_HEIGHT) {
|
||||
int32_t height = 0;
|
||||
int32_t margin = element->currentStyle->insets.l + element->currentStyle->insets.r + element->currentStyle->gapMinor;
|
||||
int32_t margin = element->style->insets.l + element->style->insets.r + element->style->gapMinor;
|
||||
uintptr_t itemCount = 0;
|
||||
|
||||
for (uintptr_t i = 0; i < element->GetChildCount(); i++) {
|
||||
|
@ -5153,21 +5153,21 @@ int ProcessListDisplayMessage(EsElement *element, EsMessage *message) {
|
|||
}
|
||||
|
||||
if (itemCount) {
|
||||
height += (itemCount - 1) * element->currentStyle->gapMajor;
|
||||
height += (itemCount - 1) * element->style->gapMajor;
|
||||
}
|
||||
|
||||
message->measure.height = height + element->currentStyle->insets.t + element->currentStyle->insets.b;
|
||||
message->measure.height = height + element->style->insets.t + element->style->insets.b;
|
||||
} else if (message->type == ES_MSG_LAYOUT) {
|
||||
int32_t position = element->currentStyle->insets.t;
|
||||
int32_t margin = element->currentStyle->insets.l + element->currentStyle->gapMinor;
|
||||
int32_t width = element->width - margin - element->currentStyle->insets.r;
|
||||
int32_t position = element->style->insets.t;
|
||||
int32_t margin = element->style->insets.l + element->style->gapMinor;
|
||||
int32_t width = element->width - margin - element->style->insets.r;
|
||||
|
||||
for (uintptr_t i = 0; i < element->GetChildCount(); i++) {
|
||||
EsElement *child = element->GetChild(i);
|
||||
if (child->flags & ES_ELEMENT_NON_CLIENT) continue;
|
||||
int height = child->GetHeight(width);
|
||||
EsElementMove(child, margin, position, width, height);
|
||||
position += height + element->currentStyle->gapMajor;
|
||||
position += height + element->style->gapMajor;
|
||||
}
|
||||
} else if (message->type == ES_MSG_PAINT) {
|
||||
char buffer[64];
|
||||
|
@ -5176,7 +5176,7 @@ int ProcessListDisplayMessage(EsElement *element, EsMessage *message) {
|
|||
EsTextRun textRun[2] = {};
|
||||
|
||||
EsRectangle bounds = EsPainterBoundsClient(message->painter);
|
||||
bounds.r = bounds.l + element->currentStyle->insets.l;
|
||||
bounds.r = bounds.l + element->style->insets.l;
|
||||
|
||||
uintptr_t counter = display->previous ? display->previous->itemCount : display->startIndex;
|
||||
uint8_t markerType = element->flags & ES_LIST_DISPLAY_MARKER_TYPE_MASK;
|
||||
|
@ -5204,7 +5204,7 @@ int ProcessListDisplayMessage(EsElement *element, EsMessage *message) {
|
|||
EsAssert(false);
|
||||
}
|
||||
|
||||
child->currentStyle->GetTextStyle(&textRun[0].style);
|
||||
child->style->GetTextStyle(&textRun[0].style);
|
||||
textRun[0].style.figures = ES_TEXT_FIGURE_TABULAR;
|
||||
bounds.t += child->offsetY;
|
||||
bounds.b = bounds.t + child->height;
|
||||
|
|
|
@ -140,7 +140,7 @@ File FileOpen(const char *path, char mode) {
|
|||
// Toolchain flags:
|
||||
|
||||
const char *commonCompileFlagsFreestanding = " -ffreestanding -fno-exceptions ";
|
||||
char commonCompileFlags[4096] = " -Wall -Wextra -Wno-missing-field-initializers -Wno-frame-address -Wno-unused-function -Wno-format-truncation -g -I. ";
|
||||
char commonCompileFlags[4096] = " -Wall -Wextra -Wno-missing-field-initializers -Wno-frame-address -Wno-unused-function -Wno-format-truncation -g -I. -fdiagnostics-column-unit=byte ";
|
||||
char commonCompileFlagsWithCStdLib[4096];
|
||||
char cCompileFlags[4096] = "";
|
||||
char cppCompileFlags[4096] = " -std=c++14 -Wno-pmf-conversions -Wno-invalid-offsetof -fno-rtti ";
|
||||
|
|
Loading…
Reference in New Issue