diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-08-11 16:10:42 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-08-11 16:10:42 +0300 |
commit | 1e8b17b775715edfc68157d9be6743109f65a71b (patch) | |
tree | 9680b21fed26866c1717bcf89f8ce38ec6047d52 /src/gmdocument.h | |
parent | a0ddbf089bacfe8b9852e77a3bfcfb452d288053 (diff) |
Document outline; jumping to clicked heading
Diffstat (limited to 'src/gmdocument.h')
-rw-r--r-- | src/gmdocument.h | 27 |
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 | ||
12 | iDeclareType(GmImageInfo) | ||
13 | iDeclareType(GmHeading) | ||
11 | iDeclareType(GmRun) | 14 | iDeclareType(GmRun) |
12 | 15 | ||
13 | typedef uint16_t iGmLinkId; | 16 | typedef 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 | ||
30 | iDeclareType(GmImageInfo) | ||
31 | |||
32 | struct Impl_GmImageInfo { | 33 | struct 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 | ||
39 | struct Impl_GmHeading { | ||
40 | iRangecc text; | ||
41 | int level; /* 0, 1, 2 */ | ||
42 | }; | ||
43 | |||
38 | enum iGmRunFlags { | 44 | enum 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 | ||
44 | struct Impl_GmRun { | 51 | struct Impl_GmRun { |
@@ -74,9 +81,11 @@ void reset_GmDocument (iGmDocument *); /* free images */ | |||
74 | 81 | ||
75 | typedef void (*iGmDocumentRenderFunc)(void *, const iGmRun *); | 82 | typedef void (*iGmDocumentRenderFunc)(void *, const iGmRun *); |
76 | 83 | ||
77 | void render_GmDocument (const iGmDocument *, iRangei visRangeY, iGmDocumentRenderFunc render, void *); | 84 | void render_GmDocument (const iGmDocument *, iRangei visRangeY, |
78 | iInt2 size_GmDocument (const iGmDocument *); | 85 | iGmDocumentRenderFunc render, void *); |
79 | iBool hasSiteBanner_GmDocument(const iGmDocument *); | 86 | iInt2 size_GmDocument (const iGmDocument *); |
87 | iBool hasSiteBanner_GmDocument (const iGmDocument *); | ||
88 | const iArray * headings_GmDocument (const iGmDocument *); | ||
80 | 89 | ||
81 | iRangecc findText_GmDocument (const iGmDocument *, const iString *text, const char *start); | 90 | iRangecc findText_GmDocument (const iGmDocument *, const iString *text, const char *start); |
82 | iRangecc findTextBefore_GmDocument (const iGmDocument *, const iString *text, const char *before); | 91 | iRangecc findTextBefore_GmDocument (const iGmDocument *, const iString *text, const char *before); |