summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-03-18 11:24:25 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-03-18 11:24:25 +0200
commit04da6153af1841effecc83b7e11c4e9ba1fb163a (patch)
tree070ac5837a7ba332b254d324abdd49e29edeefb3 /src
parentb297951d55703c9e4272c57b07325886d4845eef (diff)
GmDocument: Trying out a footer
Currently disabled.
Diffstat (limited to 'src')
-rw-r--r--src/gmdocument.c9
-rw-r--r--src/gmdocument.h1
-rw-r--r--src/ui/documentwidget.c7
3 files changed, 17 insertions, 0 deletions
diff --git a/src/gmdocument.c b/src/gmdocument.c
index 2c01290e..c3f0005c 100644
--- a/src/gmdocument.c
+++ b/src/gmdocument.c
@@ -702,6 +702,15 @@ static void doLayout_GmDocument_(iGmDocument *d) {
702 prevNonBlankType = type; 702 prevNonBlankType = type;
703 followsBlank = iFalse; 703 followsBlank = iFalse;
704 } 704 }
705#if 0
706 /* Footer. */
707 if (siteBanner_GmDocument(d)) {
708 iGmRun footer = { .flags = decoration_GmRunFlag | footer_GmRunFlag };
709 footer.visBounds = (iRect){ pos, init_I2(d->size.x, lineHeight_Text(banner_FontId) * 1) };
710 pushBack_Array(&d->layout, &footer);
711 pos.y += footer.visBounds.size.y;
712 }
713#endif
705 d->size.y = pos.y; 714 d->size.y = pos.y;
706 /* Go over the preformatted blocks and mark them wide if at least one run is wide. */ { 715 /* Go over the preformatted blocks and mark them wide if at least one run is wide. */ {
707 /* TODO: Store the dimensions and ranges for later access. */ 716 /* TODO: Store the dimensions and ranges for later access. */
diff --git a/src/gmdocument.h b/src/gmdocument.h
index 05c6da09..840cf929 100644
--- a/src/gmdocument.h
+++ b/src/gmdocument.h
@@ -96,6 +96,7 @@ enum iGmRunFlags {
96 siteBanner_GmRunFlag = iBit(4), /* area reserved for the site banner */ 96 siteBanner_GmRunFlag = iBit(4), /* area reserved for the site banner */
97 quoteBorder_GmRunFlag = iBit(5), 97 quoteBorder_GmRunFlag = iBit(5),
98 wide_GmRunFlag = iBit(6), /* horizontally scrollable */ 98 wide_GmRunFlag = iBit(6), /* horizontally scrollable */
99 footer_GmRunFlag = iBit(7),
99}; 100};
100 101
101enum iGmRunMediaType { 102enum iGmRunMediaType {
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c
index 83f270bd..72867133 100644
--- a/src/ui/documentwidget.c
+++ b/src/ui/documentwidget.c
@@ -2911,6 +2911,13 @@ static void drawRun_DrawContext_(void *context, const iGmRun *run) {
2911 const iInt2 visPos = addX_I2(add_I2(run->visBounds.pos, origin), 2911 const iInt2 visPos = addX_I2(add_I2(run->visBounds.pos, origin),
2912 /* Preformatted runs can be scrolled. */ 2912 /* Preformatted runs can be scrolled. */
2913 runOffset_DocumentWidget_(d->widget, run)); 2913 runOffset_DocumentWidget_(d->widget, run));
2914 if (run->flags & footer_GmRunFlag) {
2915 iRect footerBack =
2916 (iRect){ visPos, init_I2(width_Rect(d->widgetBounds), run->visBounds.size.y) };
2917 footerBack.pos.x = left_Rect(d->widgetBounds);
2918 fillRect_Paint(&d->paint, footerBack, tmBackground_ColorId);
2919 return;
2920 }
2914 fillRect_Paint(&d->paint, (iRect){ visPos, run->visBounds.size }, tmBackground_ColorId); 2921 fillRect_Paint(&d->paint, (iRect){ visPos, run->visBounds.size }, tmBackground_ColorId);
2915 if (run->linkId && ~run->flags & decoration_GmRunFlag) { 2922 if (run->linkId && ~run->flags & decoration_GmRunFlag) {
2916 fg = linkColor_GmDocument(doc, run->linkId, isHover ? textHover_GmLinkPart : text_GmLinkPart); 2923 fg = linkColor_GmDocument(doc, run->linkId, isHover ? textHover_GmLinkPart : text_GmLinkPart);