Resizing working again.
This commit is contained in:
parent
105a8a63a2
commit
74d4e05af9
2 changed files with 24 additions and 22 deletions
|
@ -223,8 +223,6 @@ void widgetAdd(WidgetT *target, int16_t x, int16_t y, WidgetT *widget) {
|
||||||
widget->r.x = x;
|
widget->r.x = x;
|
||||||
widget->r.y = y;
|
widget->r.y = y;
|
||||||
arrput(t->children, widget);
|
arrput(t->children, widget);
|
||||||
|
|
||||||
logWrite("Adding %s to %s\n", widget->reg->widgetName, t->reg->widgetName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -259,7 +257,6 @@ static uint8_t widgetChildrenDirtyPaint(WidgetT *widget, uint8_t paint) {
|
||||||
updated = 1;
|
updated = 1;
|
||||||
// Paint it.
|
// Paint it.
|
||||||
widget->children[x]->reg->paint(widget->children[x]);
|
widget->children[x]->reg->paint(widget->children[x]);
|
||||||
logWrite("Painted %s on %s\n", widget->children[x]->reg->widgetName, widget->children[x]->parent->reg->widgetName);
|
|
||||||
} else {
|
} else {
|
||||||
updated = 1;
|
updated = 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,8 +59,6 @@ static void windowCache(WindowT *w, uint8_t redrawWindow) {
|
||||||
ColorT gadgetColor;
|
ColorT gadgetColor;
|
||||||
SurfaceT *target = surfaceGet();
|
SurfaceT *target = surfaceGet();
|
||||||
|
|
||||||
logWrite("Caching window\n");
|
|
||||||
|
|
||||||
// Move the window to 0,0 to draw it into it's own surface.
|
// Move the window to 0,0 to draw it into it's own surface.
|
||||||
originalX = w->base.r.x;
|
originalX = w->base.r.x;
|
||||||
originalY = w->base.r.y;
|
originalY = w->base.r.y;
|
||||||
|
@ -78,7 +76,6 @@ static void windowCache(WindowT *w, uint8_t redrawWindow) {
|
||||||
// Do we need to create a surface?
|
// Do we need to create a surface?
|
||||||
if (!w->cached) {
|
if (!w->cached) {
|
||||||
w->cached = surfaceCreate(w->base.r.w, w->base.r.h);
|
w->cached = surfaceCreate(w->base.r.w, w->base.r.h);
|
||||||
logWrite("New cache surface\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw into cache.
|
// Draw into cache.
|
||||||
|
@ -557,31 +554,40 @@ RegisterT *windowRegister(uint8_t magic) {
|
||||||
|
|
||||||
void windowResize(WindowT *win, uint16_t width, uint16_t height) {
|
void windowResize(WindowT *win, uint16_t width, uint16_t height) {
|
||||||
|
|
||||||
/*
|
|
||||||
int16_t delta;
|
int16_t delta;
|
||||||
|
int16_t x = 0;
|
||||||
|
int16_t y = 0;
|
||||||
|
int16_t w = 0;
|
||||||
|
|
||||||
// Too small?
|
// Too small?
|
||||||
if (width < (GADGET_SIZE * 4) + 15) width = (GADGET_SIZE * 4) + 15;
|
if (width < (GADGET_SIZE * 4) + 15) width = (GADGET_SIZE * 4) + 15;
|
||||||
if (height < (GADGET_SIZE * 4) + 15) height = (GADGET_SIZE * 4) + 15;
|
if (height < (GADGET_SIZE * 4) + 15) height = (GADGET_SIZE * 4) + 15;
|
||||||
|
|
||||||
// Too big?
|
// Too big?
|
||||||
if (win->bounds.w - win->bounds.x + (width - win->base.r.w) + win->offset.x > surfaceWidthGet(win->content)) {
|
if (win->scroll->scrollh) {
|
||||||
|
x = hscrollValueGet(win->scroll->scrollh);
|
||||||
|
if (win->scroll->scrollv) w = win->scroll->scrollv->base.r.w;
|
||||||
|
if (win->bounds.w - win->bounds.x + (width - win->base.r.w) + x > surfaceWidthGet(win->scroll->area) + w) {
|
||||||
// Do we have room to scroll content into view?
|
// Do we have room to scroll content into view?
|
||||||
if (win->offset.x > 0) {
|
if (x > 0) {
|
||||||
delta = width - win->base.r.w;
|
delta = width - win->base.r.w;
|
||||||
if (delta > win->offset.x) delta = win->offset.x;
|
if (delta > x) delta = x;
|
||||||
win->offset.x -= delta;
|
hscrollValueSet(win->scroll->scrollh, x - delta);
|
||||||
}
|
}
|
||||||
width = (win->base.r.w - (win->bounds.x2 - win->bounds.x) - win->offset.x + surfaceWidthGet(win->content));
|
width = (win->base.r.w - (win->bounds.x2 - win->bounds.x) - x + surfaceWidthGet(win->scroll->area) + w);
|
||||||
}
|
}
|
||||||
if (win->bounds.h - win->bounds.y + (height - win->base.r.h) + win->offset.y > surfaceHeightGet(win->content)) {
|
}
|
||||||
|
if (win->scroll->scrollv) {
|
||||||
|
y = vscrollValueGet(win->scroll->scrollv);
|
||||||
|
if (win->bounds.h - win->bounds.y + (height - win->base.r.h) + y > surfaceHeightGet(win->scroll->area)) {
|
||||||
// Do we have room to scroll content into view?
|
// Do we have room to scroll content into view?
|
||||||
if (win->offset.y > 0) {
|
if (y > 0) {
|
||||||
delta = height - win->base.r.h;
|
delta = height - win->base.r.h;
|
||||||
if (delta > win->offset.y) delta = win->offset.y;
|
if (delta > y) delta = y;
|
||||||
win->offset.y -= delta;
|
vscrollValueSet(win->scroll->scrollv, y - delta);
|
||||||
|
}
|
||||||
|
height = (win->base.r.h - (win->bounds.y2 - win->bounds.y) - y + surfaceHeightGet(win->scroll->area));
|
||||||
}
|
}
|
||||||
height = (win->base.r.h - (win->bounds.y2 - win->bounds.y) - win->offset.y + surfaceHeightGet(win->content));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Did the size change?
|
// Did the size change?
|
||||||
|
@ -594,7 +600,6 @@ void windowResize(WindowT *win, uint16_t width, uint16_t height) {
|
||||||
win->base.r.h =height;
|
win->base.r.h =height;
|
||||||
windowCache(win, 1);
|
windowCache(win, 1);
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue