summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ui/documentwidget.c14
-rw-r--r--src/ui/widget.c4
-rw-r--r--src/ui/widget.h1
3 files changed, 16 insertions, 3 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c
index e13f8da9..b6f9298c 100644
--- a/src/ui/documentwidget.c
+++ b/src/ui/documentwidget.c
@@ -503,7 +503,7 @@ static iRect documentBounds_DocumentWidget_(const iDocumentWidget *d) {
503 rect.size.y -= margin; 503 rect.size.y -= margin;
504 } 504 }
505 if (d->flags & centerVertically_DocumentWidgetFlag) { 505 if (d->flags & centerVertically_DocumentWidgetFlag) {
506 const iInt2 docSize = size_GmDocument(d->doc); 506 const iInt2 docSize = addY_I2(size_GmDocument(d->doc), height_Widget(d->footerButtons));
507 if (docSize.y < rect.size.y) { 507 if (docSize.y < rect.size.y) {
508 /* Center vertically if short. There is one empty paragraph line's worth of margin 508 /* Center vertically if short. There is one empty paragraph line's worth of margin
509 between the banner and the page contents. */ 509 between the banner and the page contents. */
@@ -583,7 +583,8 @@ static float normScrollPos_DocumentWidget_(const iDocumentWidget *d) {
583static int scrollMax_DocumentWidget_(const iDocumentWidget *d) { 583static int scrollMax_DocumentWidget_(const iDocumentWidget *d) {
584 const iWidget *w = constAs_Widget(d); 584 const iWidget *w = constAs_Widget(d);
585 int sm = size_GmDocument(d->doc).y - height_Rect(bounds_Widget(w)) + 585 int sm = size_GmDocument(d->doc).y - height_Rect(bounds_Widget(w)) +
586 (hasSiteBanner_GmDocument(d->doc) ? 1 : 2) * d->pageMargin * gap_UI; 586 (hasSiteBanner_GmDocument(d->doc) ? 1 : 2) * d->pageMargin * gap_UI +
587 height_Widget(d->footerButtons);
587 if (d->phoneToolbar) { 588 if (d->phoneToolbar) {
588 sm += size_Root(w->root).y - 589 sm += size_Root(w->root).y -
589 top_Rect(boundsWithoutVisualOffset_Widget(d->phoneToolbar)); 590 top_Rect(boundsWithoutVisualOffset_Widget(d->phoneToolbar));
@@ -1040,10 +1041,12 @@ static void makeFooterButtons_DocumentWidget_(iDocumentWidget *d, const iMenuIte
1040 return; 1041 return;
1041 } 1042 }
1042 d->footerButtons = new_Widget(); 1043 d->footerButtons = new_Widget();
1044 d->footerButtons->animOffsetRef = &d->scrollY.pos;
1043 setFlags_Widget(d->footerButtons, 1045 setFlags_Widget(d->footerButtons,
1044 unhittable_WidgetFlag | arrangeVertical_WidgetFlag | 1046 unhittable_WidgetFlag | arrangeVertical_WidgetFlag |
1045 resizeWidthOfChildren_WidgetFlag | arrangeHeight_WidgetFlag | 1047 resizeWidthOfChildren_WidgetFlag | arrangeHeight_WidgetFlag |
1046 fixedPosition_WidgetFlag | resizeToParentWidth_WidgetFlag, 1048 fixedPosition_WidgetFlag | resizeToParentWidth_WidgetFlag |
1049 moveToParentBottomEdge_WidgetFlag,
1047 iTrue); 1050 iTrue);
1048 setBackgroundColor_Widget(d->footerButtons, tmBannerBackground_ColorId); 1051 setBackgroundColor_Widget(d->footerButtons, tmBannerBackground_ColorId);
1049 const iRect bounds = bounds_Widget(w); 1052 const iRect bounds = bounds_Widget(w);
@@ -1061,6 +1064,7 @@ static void makeFooterButtons_DocumentWidget_(iDocumentWidget *d, const iMenuIte
1061 } 1064 }
1062 addChild_Widget(as_Widget(d), iClob(d->footerButtons)); 1065 addChild_Widget(as_Widget(d), iClob(d->footerButtons));
1063 arrange_Widget(d->footerButtons); 1066 arrange_Widget(d->footerButtons);
1067 arrange_Widget(w);
1064} 1068}
1065 1069
1066static void showErrorPage_DocumentWidget_(iDocumentWidget *d, enum iGmStatusCode code, 1070static void showErrorPage_DocumentWidget_(iDocumentWidget *d, enum iGmStatusCode code,
@@ -1440,6 +1444,8 @@ static void updateFromCachedResponse_DocumentWidget_(iDocumentWidget *d, float n
1440 delete_Gempub(d->sourceGempub); 1444 delete_Gempub(d->sourceGempub);
1441 d->sourceGempub = NULL; 1445 d->sourceGempub = NULL;
1442 reset_GmDocument(d->doc); 1446 reset_GmDocument(d->doc);
1447 destroy_Widget(d->footerButtons);
1448 d->footerButtons = NULL;
1443 resetWideRuns_DocumentWidget_(d); 1449 resetWideRuns_DocumentWidget_(d);
1444 d->state = fetching_RequestState; 1450 d->state = fetching_RequestState;
1445 /* Do the fetch. */ { 1451 /* Do the fetch. */ {
@@ -1718,6 +1724,8 @@ static void checkResponse_DocumentWidget_(iDocumentWidget *d) {
1718 reset_GmDocument(d->doc); /* new content incoming */ 1724 reset_GmDocument(d->doc); /* new content incoming */
1719 delete_Gempub(d->sourceGempub); 1725 delete_Gempub(d->sourceGempub);
1720 d->sourceGempub = NULL; 1726 d->sourceGempub = NULL;
1727 destroy_Widget(d->footerButtons);
1728 d->footerButtons = NULL;
1721 resetWideRuns_DocumentWidget_(d); 1729 resetWideRuns_DocumentWidget_(d);
1722 updateDocument_DocumentWidget_(d, resp, iTrue); 1730 updateDocument_DocumentWidget_(d, resp, iTrue);
1723 break; 1731 break;
diff --git a/src/ui/widget.c b/src/ui/widget.c
index 5502cb8e..8d9c6f3b 100644
--- a/src/ui/widget.c
+++ b/src/ui/widget.c
@@ -59,6 +59,7 @@ void init_Widget(iWidget *d) {
59 d->minSize = zero_I2(); 59 d->minSize = zero_I2();
60 d->sizeRef = NULL; 60 d->sizeRef = NULL;
61 d->offsetRef = NULL; 61 d->offsetRef = NULL;
62 d->animOffsetRef = NULL;
62 d->bgColor = none_ColorId; 63 d->bgColor = none_ColorId;
63 d->frameColor = none_ColorId; 64 d->frameColor = none_ColorId;
64 init_Anim(&d->visualOffset, 0.0f); 65 init_Anim(&d->visualOffset, 0.0f);
@@ -769,6 +770,9 @@ static void applyVisualOffset_Widget_(const iWidget *d, iInt2 *pos) {
769 pos->y += off; 770 pos->y += off;
770 } 771 }
771 } 772 }
773 if (d->animOffsetRef) {
774 pos->y -= value_Anim(d->animOffsetRef);
775 }
772 if (d->flags & refChildrenOffset_WidgetFlag) { 776 if (d->flags & refChildrenOffset_WidgetFlag) {
773 iConstForEach(ObjectList, i, children_Widget(d->offsetRef)) { 777 iConstForEach(ObjectList, i, children_Widget(d->offsetRef)) {
774 const iWidget *child = i.object; 778 const iWidget *child = i.object;
diff --git a/src/ui/widget.h b/src/ui/widget.h
index 79d45f23..8de62b7a 100644
--- a/src/ui/widget.h
+++ b/src/ui/widget.h
@@ -139,6 +139,7 @@ struct Impl_Widget {
139 iInt2 minSize; 139 iInt2 minSize;
140 iWidget * sizeRef; 140 iWidget * sizeRef;
141 iWidget * offsetRef; 141 iWidget * offsetRef;
142 const iAnim *animOffsetRef;
142 int padding[4]; /* left, top, right, bottom */ 143 int padding[4]; /* left, top, right, bottom */
143 iAnim visualOffset; 144 iAnim visualOffset;
144 int bgColor; 145 int bgColor;