diff options
Diffstat (limited to 'src/ui/documentwidget.c')
-rw-r--r-- | src/ui/documentwidget.c | 87 |
1 files changed, 49 insertions, 38 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index 40b3d7a4..e7b412a9 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c | |||
@@ -232,15 +232,41 @@ enum iDocumentLinkOrdinalMode { | |||
232 | 232 | ||
233 | struct Impl_DocumentWidget { | 233 | struct Impl_DocumentWidget { |
234 | iWidget widget; | 234 | iWidget widget; |
235 | enum iRequestState state; | ||
236 | iPersistentDocumentState mod; | ||
237 | int flags; | 235 | int flags; |
236 | |||
237 | /* User interface: */ | ||
238 | enum iDocumentLinkOrdinalMode ordinalMode; | 238 | enum iDocumentLinkOrdinalMode ordinalMode; |
239 | size_t ordinalBase; | 239 | size_t ordinalBase; |
240 | iString * titleUser; | 240 | iRangecc selectMark; |
241 | iRangecc initialSelectMark; /* for word/line selection */ | ||
242 | iRangecc foundMark; | ||
243 | const iGmRun * grabbedPlayer; /* currently adjusting volume in a player */ | ||
244 | float grabbedStartVolume; | ||
245 | int mediaTimer; | ||
246 | const iGmRun * hoverPre; /* for clicking */ | ||
247 | const iGmRun * hoverAltPre; /* for drawing alt text */ | ||
248 | const iGmRun * hoverLink; | ||
249 | const iGmRun * contextLink; | ||
250 | iClick click; | ||
251 | iInt2 contextPos; /* coordinates of latest right click */ | ||
252 | int pinchZoomInitial; | ||
253 | int pinchZoomPosted; | ||
254 | iString pendingGotoHeading; | ||
255 | |||
256 | /* Network request: */ | ||
257 | enum iRequestState state; | ||
241 | iGmRequest * request; | 258 | iGmRequest * request; |
242 | iAtomicInt isRequestUpdated; /* request has new content, need to parse it */ | 259 | iAtomicInt isRequestUpdated; /* request has new content, need to parse it */ |
243 | iObjectList * media; | 260 | int certFlags; |
261 | iBlock * certFingerprint; | ||
262 | iDate certExpiry; | ||
263 | iString * certSubject; | ||
264 | int redirectCount; | ||
265 | iObjectList * media; /* inline media requests */ | ||
266 | |||
267 | /* Document: */ | ||
268 | iPersistentDocumentState mod; | ||
269 | iString * titleUser; | ||
244 | enum iGmStatusCode sourceStatus; | 270 | enum iGmStatusCode sourceStatus; |
245 | iString sourceHeader; | 271 | iString sourceHeader; |
246 | iString sourceMime; | 272 | iString sourceMime; |
@@ -248,53 +274,36 @@ struct Impl_DocumentWidget { | |||
248 | iTime sourceTime; | 274 | iTime sourceTime; |
249 | iGempub * sourceGempub; /* NULL unless the page is Gempub content */ | 275 | iGempub * sourceGempub; /* NULL unless the page is Gempub content */ |
250 | iGmDocument * doc; | 276 | iGmDocument * doc; |
251 | int certFlags; | 277 | |
252 | iBlock * certFingerprint; | 278 | /* Rendering: */ |
253 | iDate certExpiry; | ||
254 | iString * certSubject; | ||
255 | int redirectCount; | ||
256 | iRangecc selectMark; | ||
257 | iRangecc initialSelectMark; /* for word/line selection */ | ||
258 | iRangecc foundMark; | ||
259 | int pageMargin; | 279 | int pageMargin; |
280 | float initNormScrollY; | ||
281 | iSmoothScroll scrollY; | ||
282 | iAnim sideOpacity; | ||
283 | iAnim altTextOpacity; | ||
284 | iGmRunRange visibleRuns; | ||
260 | iPtrArray visibleLinks; | 285 | iPtrArray visibleLinks; |
261 | iPtrArray visiblePre; | 286 | iPtrArray visiblePre; |
287 | iPtrArray visibleMedia; /* currently playing audio / ongoing downloads */ | ||
262 | iPtrArray visibleWideRuns; /* scrollable blocks; TODO: merge into `visiblePre` */ | 288 | iPtrArray visibleWideRuns; /* scrollable blocks; TODO: merge into `visiblePre` */ |
263 | iArray wideRunOffsets; | 289 | iArray wideRunOffsets; |
264 | iAnim animWideRunOffset; | 290 | iAnim animWideRunOffset; |
265 | uint16_t animWideRunId; | 291 | uint16_t animWideRunId; |
266 | iGmRunRange animWideRunRange; | 292 | iGmRunRange animWideRunRange; |
267 | iPtrArray visibleMedia; /* currently playing audio / ongoing downloads */ | 293 | iDrawBufs * drawBufs; /* dynamic state for drawing */ |
268 | const iGmRun * grabbedPlayer; /* currently adjusting volume in a player */ | 294 | iVisBuf * visBuf; |
269 | float grabbedStartVolume; | 295 | iVisBufMeta * visBufMeta; |
270 | int mediaTimer; | ||
271 | const iGmRun * hoverPre; /* for clicking */ | ||
272 | const iGmRun * hoverAltPre; /* for drawing alt text */ | ||
273 | const iGmRun * hoverLink; | ||
274 | const iGmRun * contextLink; | ||
275 | iGmRunRange visibleRuns; | ||
276 | iGmRunRange renderRuns; | 296 | iGmRunRange renderRuns; |
277 | iClick click; | 297 | iPtrSet * invalidRuns; |
278 | iInt2 contextPos; /* coordinates of latest right click */ | 298 | |
279 | iString pendingGotoHeading; | 299 | /* Widget structure: */ |
280 | float initNormScrollY; | ||
281 | // iAnim scrollY; | ||
282 | // int overscroll; | ||
283 | iSmoothScroll scrollY; | ||
284 | iAnim sideOpacity; | ||
285 | iAnim altTextOpacity; | ||
286 | iScrollWidget *scroll; | 300 | iScrollWidget *scroll; |
301 | iWidget * footerButtons; | ||
287 | iWidget * menu; | 302 | iWidget * menu; |
288 | iWidget * playerMenu; | 303 | iWidget * playerMenu; |
289 | iWidget * copyMenu; | 304 | iWidget * copyMenu; |
290 | iVisBuf * visBuf; | ||
291 | iVisBufMeta * visBufMeta; | ||
292 | iPtrSet * invalidRuns; | ||
293 | iDrawBufs * drawBufs; /* dynamic state for drawing */ | ||
294 | iTranslation * translation; | 305 | iTranslation * translation; |
295 | iWidget * phoneToolbar; | 306 | iWidget * phoneToolbar; |
296 | int pinchZoomInitial; | ||
297 | int pinchZoomPosted; | ||
298 | }; | 307 | }; |
299 | 308 | ||
300 | iDefineObjectConstruction(DocumentWidget) | 309 | iDefineObjectConstruction(DocumentWidget) |
@@ -3667,6 +3676,7 @@ static void drawRun_DrawContext_(void *context, const iGmRun *run) { | |||
3667 | /* Preformatted runs can be scrolled. */ | 3676 | /* Preformatted runs can be scrolled. */ |
3668 | runOffset_DocumentWidget_(d->widget, run)); | 3677 | runOffset_DocumentWidget_(d->widget, run)); |
3669 | const iRect visRect = { visPos, run->visBounds.size }; | 3678 | const iRect visRect = { visPos, run->visBounds.size }; |
3679 | #if 0 | ||
3670 | if (run->flags & footer_GmRunFlag) { | 3680 | if (run->flags & footer_GmRunFlag) { |
3671 | iRect footerBack = | 3681 | iRect footerBack = |
3672 | (iRect){ visPos, init_I2(width_Rect(d->widgetBounds), run->visBounds.size.y) }; | 3682 | (iRect){ visPos, init_I2(width_Rect(d->widgetBounds), run->visBounds.size.y) }; |
@@ -3674,15 +3684,16 @@ static void drawRun_DrawContext_(void *context, const iGmRun *run) { | |||
3674 | fillRect_Paint(&d->paint, footerBack, tmBackground_ColorId); | 3684 | fillRect_Paint(&d->paint, footerBack, tmBackground_ColorId); |
3675 | return; | 3685 | return; |
3676 | } | 3686 | } |
3687 | #endif | ||
3677 | /* Fill the background. */ { | 3688 | /* Fill the background. */ { |
3678 | if (run->linkId && linkFlags & isOpen_GmLinkFlag) { | 3689 | if (run->linkId && linkFlags & isOpen_GmLinkFlag) { |
3679 | /* Open links get a highlighted background. */ | 3690 | /* Open links get a highlighted background. */ |
3680 | int bg = tmBackgroundOpenLink_ColorId; | 3691 | int bg = tmBackgroundOpenLink_ColorId; |
3681 | const int frame = tmFrameOpenLink_ColorId; | 3692 | const int frame = tmFrameOpenLink_ColorId; |
3682 | iRect wideRect = { init_I2(left_Rect(d->widgetBounds), visPos.y), | 3693 | iRect wideRect = { init_I2(left_Rect(d->widgetBounds), visPos.y), |
3683 | init_I2(width_Rect(d->widgetBounds) + | 3694 | init_I2(width_Rect(d->widgetBounds) + |
3684 | width_Widget(d->widget->scroll), | 3695 | width_Widget(d->widget->scroll), |
3685 | height_Rect(run->visBounds)) }; | 3696 | height_Rect(run->visBounds)) }; |
3686 | /* The first line is composed of two runs that may be drawn in either order, so | 3697 | /* The first line is composed of two runs that may be drawn in either order, so |
3687 | only draw half of the background. */ | 3698 | only draw half of the background. */ |
3688 | if (run->flags & decoration_GmRunFlag) { | 3699 | if (run->flags & decoration_GmRunFlag) { |