summaryrefslogtreecommitdiff
path: root/src/gmdocument.h
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2020-08-11 16:10:42 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2020-08-11 16:10:42 +0300
commit1e8b17b775715edfc68157d9be6743109f65a71b (patch)
tree9680b21fed26866c1717bcf89f8ce38ec6047d52 /src/gmdocument.h
parenta0ddbf089bacfe8b9852e77a3bfcfb452d288053 (diff)
Document outline; jumping to clicked heading
Diffstat (limited to 'src/gmdocument.h')
-rw-r--r--src/gmdocument.h27
1 files changed, 18 insertions, 9 deletions
diff --git a/src/gmdocument.h b/src/gmdocument.h
index 0c6dd998..fd5882bf 100644
--- a/src/gmdocument.h
+++ b/src/gmdocument.h
@@ -1,13 +1,16 @@
1#pragma once 1#pragma once
2 2
3#include "gmutil.h" 3#include "gmutil.h"
4
5#include <the_Foundation/array.h>
4#include <the_Foundation/object.h> 6#include <the_Foundation/object.h>
5#include <the_Foundation/rect.h> 7#include <the_Foundation/rect.h>
6#include <the_Foundation/string.h> 8#include <the_Foundation/string.h>
7#include <the_Foundation/time.h> 9#include <the_Foundation/time.h>
8
9#include <SDL_render.h> 10#include <SDL_render.h>
10 11
12iDeclareType(GmImageInfo)
13iDeclareType(GmHeading)
11iDeclareType(GmRun) 14iDeclareType(GmRun)
12 15
13typedef uint16_t iGmLinkId; 16typedef uint16_t iGmLinkId;
@@ -27,18 +30,22 @@ enum iGmLinkFlags {
27 visited_GmLinkFlag = iBit(14), /* in the history */ 30 visited_GmLinkFlag = iBit(14), /* in the history */
28}; 31};
29 32
30iDeclareType(GmImageInfo)
31
32struct Impl_GmImageInfo { 33struct Impl_GmImageInfo {
33 iInt2 size; 34 iInt2 size;
34 size_t numBytes; 35 size_t numBytes;
35 const char *mime; 36 const char *mime;
36}; 37};
37 38
39struct Impl_GmHeading {
40 iRangecc text;
41 int level; /* 0, 1, 2 */
42};
43
38enum iGmRunFlags { 44enum iGmRunFlags {
39 startOfLine_GmRunFlag = iBit(1), 45 decoration_GmRunFlag = iBit(1), /* not part of the source */
40 endOfLine_GmRunFlag = iBit(2), 46 startOfLine_GmRunFlag = iBit(2),
41 siteBanner_GmRunFlag = iBit(3), /* area reserved for the site banner */ 47 endOfLine_GmRunFlag = iBit(3),
48 siteBanner_GmRunFlag = iBit(4), /* area reserved for the site banner */
42}; 49};
43 50
44struct Impl_GmRun { 51struct Impl_GmRun {
@@ -74,9 +81,11 @@ void reset_GmDocument (iGmDocument *); /* free images */
74 81
75typedef void (*iGmDocumentRenderFunc)(void *, const iGmRun *); 82typedef void (*iGmDocumentRenderFunc)(void *, const iGmRun *);
76 83
77void render_GmDocument (const iGmDocument *, iRangei visRangeY, iGmDocumentRenderFunc render, void *); 84void render_GmDocument (const iGmDocument *, iRangei visRangeY,
78iInt2 size_GmDocument (const iGmDocument *); 85 iGmDocumentRenderFunc render, void *);
79iBool hasSiteBanner_GmDocument(const iGmDocument *); 86iInt2 size_GmDocument (const iGmDocument *);
87iBool hasSiteBanner_GmDocument (const iGmDocument *);
88const iArray * headings_GmDocument (const iGmDocument *);
80 89
81iRangecc findText_GmDocument (const iGmDocument *, const iString *text, const char *start); 90iRangecc findText_GmDocument (const iGmDocument *, const iString *text, const char *start);
82iRangecc findTextBefore_GmDocument (const iGmDocument *, const iString *text, const char *before); 91iRangecc findTextBefore_GmDocument (const iGmDocument *, const iString *text, const char *before);