summaryrefslogtreecommitdiff
path: root/src/ui/documentwidget.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/documentwidget.c')
-rw-r--r--src/ui/documentwidget.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c
index 13a8dae7..755cec6a 100644
--- a/src/ui/documentwidget.c
+++ b/src/ui/documentwidget.c
@@ -934,7 +934,7 @@ static void updateVisible_DocumentWidget_(iDocumentWidget *d) {
934 updateSideOpacity_DocumentWidget_(d, iTrue); 934 updateSideOpacity_DocumentWidget_(d, iTrue);
935 animateMedia_DocumentWidget_(d); 935 animateMedia_DocumentWidget_(d);
936 setPos_Banner(d->banner, addY_I2(topLeft_Rect(documentBounds_DocumentWidget_(d)), 936 setPos_Banner(d->banner, addY_I2(topLeft_Rect(documentBounds_DocumentWidget_(d)),
937 -pos_SmoothScroll(&d->scrollY))); 937 -pos_SmoothScroll(&d->scrollY)));
938 /*init_I2(documentBounds_DocumentWidget_(d).pos.x, 938 /*init_I2(documentBounds_DocumentWidget_(d).pos.x,
939 viewPos_DocumentWidget_(d) - 939 viewPos_DocumentWidget_(d) -
940 documentTopPad_DocumentWidget_(d)));*/ 940 documentTopPad_DocumentWidget_(d)));*/
@@ -1291,7 +1291,6 @@ static void showErrorPage_DocumentWidget_(iDocumentWidget *d, enum iGmStatusCode
1291 iRelease(errorDoc); 1291 iRelease(errorDoc);
1292 clear_Banner(d->banner); 1292 clear_Banner(d->banner);
1293 add_Banner(d->banner, error_BannerType, code, meta); 1293 add_Banner(d->banner, error_BannerType, code, meta);
1294// translate_Lang(src);
1295 d->state = ready_RequestState; 1294 d->state = ready_RequestState;
1296 setSource_DocumentWidget(d, src); 1295 setSource_DocumentWidget(d, src);
1297 updateTheme_DocumentWidget_(d); 1296 updateTheme_DocumentWidget_(d);
@@ -1798,6 +1797,16 @@ static void cacheDocumentGlyphs_DocumentWidget_(const iDocumentWidget *d) {
1798 } 1797 }
1799} 1798}
1800 1799
1800static void addBannerWarnings_DocumentWidget_(iDocumentWidget *d) {
1801 if (warnings_GmDocument(d->doc) & missingGlyphs_GmDocumentWarning) {
1802 add_Banner(d->banner, warning_BannerType, missingGlyphs_GmStatusCode, NULL);
1803 /* TODO: List one or more of the missing characters and/or their Unicode blocks? */
1804 }
1805 if (warnings_GmDocument(d->doc) & ansiEscapes_GmDocumentWarning) {
1806 add_Banner(d->banner, warning_BannerType, ansiEscapes_GmStatusCode, NULL);
1807 }
1808}
1809
1801static void updateFromCachedResponse_DocumentWidget_(iDocumentWidget *d, float normScrollY, 1810static void updateFromCachedResponse_DocumentWidget_(iDocumentWidget *d, float normScrollY,
1802 const iGmResponse *resp, iGmDocument *cachedDoc) { 1811 const iGmResponse *resp, iGmDocument *cachedDoc) {
1803 setLinkNumberMode_DocumentWidget_(d, iFalse); 1812 setLinkNumberMode_DocumentWidget_(d, iFalse);
@@ -1824,6 +1833,7 @@ static void updateFromCachedResponse_DocumentWidget_(iDocumentWidget *d, float n
1824// (d->flags & openedFromSidebar_DocumentWidgetFlag) != 0); 1833// (d->flags & openedFromSidebar_DocumentWidgetFlag) != 0);
1825 clear_Banner(d->banner); 1834 clear_Banner(d->banner);
1826 updateBanner_DocumentWidget_(d); 1835 updateBanner_DocumentWidget_(d);
1836 addBannerWarnings_DocumentWidget_(d);
1827 } 1837 }
1828 d->state = ready_RequestState; 1838 d->state = ready_RequestState;
1829 postProcessRequestContent_DocumentWidget_(d, iTrue); 1839 postProcessRequestContent_DocumentWidget_(d, iTrue);
@@ -2864,10 +2874,10 @@ static iBool handleCommand_DocumentWidget_(iDocumentWidget *d, const char *cmd)
2864 size_Array(items)); 2874 size_Array(items));
2865 delete_Array(items); 2875 delete_Array(items);
2866 /* Enforce a minimum size. */ 2876 /* Enforce a minimum size. */
2867 iWidget *sizer = new_Widget(); 2877// iWidget *sizer = new_Widget();
2868 setFixedSize_Widget(sizer, init_I2(gap_UI * 65, 1)); 2878// setFixedSize_Widget(sizer, init_I2(gap_UI * 65, 1));
2869 addChildFlags_Widget(dlg, iClob(sizer), frameless_WidgetFlag); 2879// addChildFlags_Widget(dlg, iClob(sizer), frameless_WidgetFlag);
2870 setFlags_Widget(dlg, centerHorizontal_WidgetFlag, iFalse); 2880// setFlags_Widget(dlg, centerHorizontal_WidgetFlag, iFalse);
2871 if (deviceType_App() != phone_AppDeviceType) { 2881 if (deviceType_App() != phone_AppDeviceType) {
2872 const iWidget *lockButton = findWidget_Root("navbar.lock"); 2882 const iWidget *lockButton = findWidget_Root("navbar.lock");
2873 setPos_Widget(dlg, windowToLocal_Widget(dlg, bottomLeft_Rect(bounds_Widget(lockButton)))); 2883 setPos_Widget(dlg, windowToLocal_Widget(dlg, bottomLeft_Rect(bounds_Widget(lockButton))));
@@ -2989,6 +2999,7 @@ static iBool handleCommand_DocumentWidget_(iDocumentWidget *d, const char *cmd)
2989 if (category_GmStatusCode(status_GmRequest(d->request)) == categorySuccess_GmStatusCode) { 2999 if (category_GmStatusCode(status_GmRequest(d->request)) == categorySuccess_GmStatusCode) {
2990 init_Anim(&d->scrollY.pos, d->initNormScrollY * pageHeight_DocumentWidget_(d)); /* TODO: unless user already scrolled! */ 3000 init_Anim(&d->scrollY.pos, d->initNormScrollY * pageHeight_DocumentWidget_(d)); /* TODO: unless user already scrolled! */
2991 } 3001 }
3002 addBannerWarnings_DocumentWidget_(d);
2992 iChangeFlags(d->flags, 3003 iChangeFlags(d->flags,
2993 urlChanged_DocumentWidgetFlag | drawDownloadCounter_DocumentWidgetFlag, 3004 urlChanged_DocumentWidgetFlag | drawDownloadCounter_DocumentWidgetFlag,
2994 iFalse); 3005 iFalse);
@@ -4377,7 +4388,7 @@ static void drawRun_DrawContext_(void *context, const iGmRun *run) {
4377 if (run->flags & altText_GmRunFlag) { 4388 if (run->flags & altText_GmRunFlag) {
4378 const iInt2 margin = preRunMargin_GmDocument(doc, preId_GmRun(run)); 4389 const iInt2 margin = preRunMargin_GmDocument(doc, preId_GmRun(run));
4379 fillRect_Paint(&d->paint, (iRect){ visPos, run->visBounds.size }, tmBackgroundAltText_ColorId); 4390 fillRect_Paint(&d->paint, (iRect){ visPos, run->visBounds.size }, tmBackgroundAltText_ColorId);
4380 drawRect_Paint(&d->paint, (iRect){ visPos, run->visBounds.size }, tmQuoteIcon_ColorId); 4391 drawRect_Paint(&d->paint, (iRect){ visPos, run->visBounds.size }, tmFrameAltText_ColorId);
4381 drawWrapRange_Text(run->font, 4392 drawWrapRange_Text(run->font,
4382 add_I2(visPos, margin), 4393 add_I2(visPos, margin),
4383 run->visBounds.size.x - 2 * margin.x, 4394 run->visBounds.size.x - 2 * margin.x,
@@ -5053,7 +5064,7 @@ static void draw_DocumentWidget_(const iDocumentWidget *d) {
5053 SDL_SetRenderDrawBlendMode(renderer_Window(get_Window()), SDL_BLENDMODE_BLEND); 5064 SDL_SetRenderDrawBlendMode(renderer_Window(get_Window()), SDL_BLENDMODE_BLEND);
5054 } 5065 }
5055 fillRect_Paint(&ctx.paint, altRect, tmBackgroundAltText_ColorId); 5066 fillRect_Paint(&ctx.paint, altRect, tmBackgroundAltText_ColorId);
5056 drawRect_Paint(&ctx.paint, altRect, tmQuoteIcon_ColorId); 5067 drawRect_Paint(&ctx.paint, altRect, tmFrameAltText_ColorId);
5057 setOpacity_Text(altTextOpacity); 5068 setOpacity_Text(altTextOpacity);
5058 drawWrapRange_Text(altFont, addX_I2(pos, margin), wrap, 5069 drawWrapRange_Text(altFont, addX_I2(pos, margin), wrap,
5059 tmQuote_ColorId, meta->altText); 5070 tmQuote_ColorId, meta->altText);