diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-03-28 22:04:24 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-03-28 22:04:24 +0300 |
commit | de3463f5d9ac3a8b7c0f3e23ff11ade2b19fdb68 (patch) | |
tree | 195d147125afb9db3a4b9775849aea30017dd876 /src/gmdocument.h | |
parent | 3a881ec009c9c8b6030d2f9bdf404423108e3019 (diff) |
Folding preformatted blocks and showing alt text
The alt text of preformatted blocks is shown on mouse hover.
The blocks can be clicked to toggle folding.
IssueID #180
Diffstat (limited to 'src/gmdocument.h')
-rw-r--r-- | src/gmdocument.h | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/gmdocument.h b/src/gmdocument.h index 57c19e9a..14c5c85d 100644 --- a/src/gmdocument.h +++ b/src/gmdocument.h | |||
@@ -32,6 +32,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ | |||
32 | #include <the_Foundation/time.h> | 32 | #include <the_Foundation/time.h> |
33 | 33 | ||
34 | iDeclareType(GmHeading) | 34 | iDeclareType(GmHeading) |
35 | iDeclareType(GmPreMeta) | ||
35 | iDeclareType(GmRun) | 36 | iDeclareType(GmRun) |
36 | 37 | ||
37 | enum iGmLineType { | 38 | enum iGmLineType { |
@@ -89,6 +90,20 @@ struct Impl_GmHeading { | |||
89 | int level; /* 0, 1, 2 */ | 90 | int level; /* 0, 1, 2 */ |
90 | }; | 91 | }; |
91 | 92 | ||
93 | enum iGmPreMetaFlag { | ||
94 | folded_GmPreMetaFlag = 0x1, | ||
95 | topLeft_GmPreMetaFlag = 0x2, | ||
96 | }; | ||
97 | |||
98 | struct Impl_GmPreMeta { | ||
99 | iRangecc bounds; /* including ``` markers */ | ||
100 | iRangecc altText; /* range in source */ | ||
101 | iRangecc contents; /* just the content lines */ | ||
102 | int flags; | ||
103 | /* TODO: refactor old code to incorporate wide scroll handling here */ | ||
104 | iRect pixelRect; | ||
105 | }; | ||
106 | |||
92 | enum iGmRunFlags { | 107 | enum iGmRunFlags { |
93 | decoration_GmRunFlag = iBit(1), /* not part of the source */ | 108 | decoration_GmRunFlag = iBit(1), /* not part of the source */ |
94 | startOfLine_GmRunFlag = iBit(2), | 109 | startOfLine_GmRunFlag = iBit(2), |
@@ -97,6 +112,7 @@ enum iGmRunFlags { | |||
97 | quoteBorder_GmRunFlag = iBit(5), | 112 | quoteBorder_GmRunFlag = iBit(5), |
98 | wide_GmRunFlag = iBit(6), /* horizontally scrollable */ | 113 | wide_GmRunFlag = iBit(6), /* horizontally scrollable */ |
99 | footer_GmRunFlag = iBit(7), | 114 | footer_GmRunFlag = iBit(7), |
115 | altText_GmRunFlag = iBit(8), | ||
100 | }; | 116 | }; |
101 | 117 | ||
102 | enum iGmRunMediaType { | 118 | enum iGmRunMediaType { |
@@ -150,6 +166,7 @@ void setWidth_GmDocument (iGmDocument *, int width); | |||
150 | void redoLayout_GmDocument (iGmDocument *); | 166 | void redoLayout_GmDocument (iGmDocument *); |
151 | void setUrl_GmDocument (iGmDocument *, const iString *url); | 167 | void setUrl_GmDocument (iGmDocument *, const iString *url); |
152 | void setSource_GmDocument (iGmDocument *, const iString *source, int width); | 168 | void setSource_GmDocument (iGmDocument *, const iString *source, int width); |
169 | void foldPre_GmDocument (iGmDocument *, uint16_t preId); | ||
153 | 170 | ||
154 | void reset_GmDocument (iGmDocument *); /* free images */ | 171 | void reset_GmDocument (iGmDocument *); /* free images */ |
155 | 172 | ||
@@ -194,4 +211,5 @@ const iTime * linkTime_GmDocument (const iGmDocument *, iGmLinkId linkId); | |||
194 | iBool isMediaLink_GmDocument (const iGmDocument *, iGmLinkId linkId); | 211 | iBool isMediaLink_GmDocument (const iGmDocument *, iGmLinkId linkId); |
195 | const iString * title_GmDocument (const iGmDocument *); | 212 | const iString * title_GmDocument (const iGmDocument *); |
196 | iChar siteIcon_GmDocument (const iGmDocument *); | 213 | iChar siteIcon_GmDocument (const iGmDocument *); |
197 | 214 | const iGmPreMeta *preMeta_GmDocument (const iGmDocument *, uint16_t preId); | |
215 | iInt2 preRunMargin_GmDocument (const iGmDocument *, uint16_t preId); | ||