diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-06-25 16:26:53 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-06-25 16:26:53 +0300 |
commit | 5dbc85eaaa1bd0a0fc11dd76a75ece2efe763df5 (patch) | |
tree | 9721fb7aced603adb10b9bb3f3beb3f8d5fba973 /src/gmdocument.h | |
parent | 95c527db1484f7758a180c6de051d0182c3b2e81 (diff) | |
parent | f99a9111170f2ff28383fd3172fdaf4b9a1ba069 (diff) |
Merge branch 'work/v1.6' into work/serious-unicode
# Conflicts:
# res/fonts/SmolEmoji-Regular.ttf
Diffstat (limited to 'src/gmdocument.h')
-rw-r--r-- | src/gmdocument.h | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/src/gmdocument.h b/src/gmdocument.h index fcbb7e59..831459d8 100644 --- a/src/gmdocument.h +++ b/src/gmdocument.h | |||
@@ -22,6 +22,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ | |||
22 | 22 | ||
23 | #pragma once | 23 | #pragma once |
24 | 24 | ||
25 | #include "defs.h" | ||
25 | #include "gmutil.h" | 26 | #include "gmutil.h" |
26 | #include "media.h" | 27 | #include "media.h" |
27 | 28 | ||
@@ -125,12 +126,12 @@ enum iGmRunMediaType { | |||
125 | 126 | ||
126 | struct Impl_GmRun { | 127 | struct Impl_GmRun { |
127 | iRangecc text; | 128 | iRangecc text; |
129 | iRect bounds; /* used for hit testing, may extend to edges */ | ||
130 | iRect visBounds; /* actual visual bounds */ | ||
128 | uint8_t font; | 131 | uint8_t font; |
129 | uint8_t color; | 132 | uint8_t color; |
130 | uint8_t flags; | 133 | uint8_t flags; |
131 | uint8_t mediaType; | 134 | uint8_t mediaType; |
132 | iRect bounds; /* used for hit testing, may extend to edges */ | ||
133 | iRect visBounds; /* actual visual bounds */ | ||
134 | uint16_t preId; /* preformatted block ID (sequential) */ | 135 | uint16_t preId; /* preformatted block ID (sequential) */ |
135 | iGmLinkId linkId; /* zero for non-links */ | 136 | iGmLinkId linkId; /* zero for non-links */ |
136 | uint16_t mediaId; /* zero if not an image */ | 137 | uint16_t mediaId; /* zero if not an image */ |
@@ -148,34 +149,37 @@ iRangecc findLoc_GmRun (const iGmRun *, iInt2 pos); | |||
148 | iDeclareClass(GmDocument) | 149 | iDeclareClass(GmDocument) |
149 | iDeclareObjectConstruction(GmDocument) | 150 | iDeclareObjectConstruction(GmDocument) |
150 | 151 | ||
151 | enum iGmDocumentFormat { | ||
152 | undefined_GmDocumentFormat = -1, | ||
153 | gemini_GmDocumentFormat = 0, | ||
154 | plainText_GmDocumentFormat, | ||
155 | }; | ||
156 | |||
157 | enum iGmDocumentBanner { | 152 | enum iGmDocumentBanner { |
158 | none_GmDocumentBanner, | 153 | none_GmDocumentBanner, |
159 | siteDomain_GmDocumentBanner, | 154 | siteDomain_GmDocumentBanner, |
160 | certificateWarning_GmDocumentBanner, | 155 | certificateWarning_GmDocumentBanner, |
161 | }; | 156 | }; |
162 | 157 | ||
158 | enum iGmDocumentUpdate { | ||
159 | partial_GmDocumentUpdate, /* appending more content */ | ||
160 | final_GmDocumentUpdate, /* process all lines, including the last one if not terminated */ | ||
161 | }; | ||
162 | |||
163 | void setThemeSeed_GmDocument (iGmDocument *, const iBlock *seed); | 163 | void setThemeSeed_GmDocument (iGmDocument *, const iBlock *seed); |
164 | void setFormat_GmDocument (iGmDocument *, enum iGmDocumentFormat format); | 164 | void setFormat_GmDocument (iGmDocument *, enum iSourceFormat format); |
165 | void setBanner_GmDocument (iGmDocument *, enum iGmDocumentBanner type); | 165 | void setBanner_GmDocument (iGmDocument *, enum iGmDocumentBanner type); |
166 | void setWidth_GmDocument (iGmDocument *, int width); | 166 | void setWidth_GmDocument (iGmDocument *, int width); |
167 | void redoLayout_GmDocument (iGmDocument *); | 167 | void redoLayout_GmDocument (iGmDocument *); |
168 | iBool updateOpenURLs_GmDocument(iGmDocument *); | 168 | iBool updateOpenURLs_GmDocument(iGmDocument *); |
169 | void setUrl_GmDocument (iGmDocument *, const iString *url); | 169 | void setUrl_GmDocument (iGmDocument *, const iString *url); |
170 | void setSource_GmDocument (iGmDocument *, const iString *source, int width); | 170 | void setSource_GmDocument (iGmDocument *, const iString *source, int width, |
171 | enum iGmDocumentUpdate updateType); | ||
171 | void foldPre_GmDocument (iGmDocument *, uint16_t preId); | 172 | void foldPre_GmDocument (iGmDocument *, uint16_t preId); |
173 | void invalidatePalette_GmDocument(iGmDocument *); | ||
174 | void makePaletteGlobal_GmDocument(const iGmDocument *); /* copies document colors to the global palette */ | ||
172 | 175 | ||
173 | void reset_GmDocument (iGmDocument *); /* free images */ | 176 | //void reset_GmDocument (iGmDocument *); /* free images */ |
174 | 177 | ||
175 | typedef void (*iGmDocumentRenderFunc)(void *, const iGmRun *); | 178 | typedef void (*iGmDocumentRenderFunc)(void *, const iGmRun *); |
176 | 179 | ||
177 | iMedia * media_GmDocument (iGmDocument *); | 180 | iMedia * media_GmDocument (iGmDocument *); |
178 | const iMedia * constMedia_GmDocument (const iGmDocument *); | 181 | const iMedia * constMedia_GmDocument (const iGmDocument *); |
182 | const iString * url_GmDocument (const iGmDocument *); | ||
179 | 183 | ||
180 | void render_GmDocument (const iGmDocument *, iRangei visRangeY, | 184 | void render_GmDocument (const iGmDocument *, iRangei visRangeY, |
181 | iGmDocumentRenderFunc render, void *); /* includes partial overlaps */ | 185 | iGmDocumentRenderFunc render, void *); /* includes partial overlaps */ |
@@ -190,6 +194,7 @@ enum iGmDocumentBanner bannerType_GmDocument(const iGmDocument *); | |||
190 | const iString * bannerText_GmDocument (const iGmDocument *); | 194 | const iString * bannerText_GmDocument (const iGmDocument *); |
191 | const iArray * headings_GmDocument (const iGmDocument *); /* array of GmHeadings */ | 195 | const iArray * headings_GmDocument (const iGmDocument *); /* array of GmHeadings */ |
192 | const iString * source_GmDocument (const iGmDocument *); | 196 | const iString * source_GmDocument (const iGmDocument *); |
197 | size_t memorySize_GmDocument (const iGmDocument *); /* bytes */ | ||
193 | 198 | ||
194 | iRangecc findText_GmDocument (const iGmDocument *, const iString *text, const char *start); | 199 | iRangecc findText_GmDocument (const iGmDocument *, const iString *text, const char *start); |
195 | iRangecc findTextBefore_GmDocument (const iGmDocument *, const iString *text, const char *before); | 200 | iRangecc findTextBefore_GmDocument (const iGmDocument *, const iString *text, const char *before); |