summaryrefslogtreecommitdiff
path: root/src/gmdocument.h
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-06-25 16:26:53 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-06-25 16:26:53 +0300
commit5dbc85eaaa1bd0a0fc11dd76a75ece2efe763df5 (patch)
tree9721fb7aced603adb10b9bb3f3beb3f8d5fba973 /src/gmdocument.h
parent95c527db1484f7758a180c6de051d0182c3b2e81 (diff)
parentf99a9111170f2ff28383fd3172fdaf4b9a1ba069 (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.h27
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
126struct Impl_GmRun { 127struct 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);
148iDeclareClass(GmDocument) 149iDeclareClass(GmDocument)
149iDeclareObjectConstruction(GmDocument) 150iDeclareObjectConstruction(GmDocument)
150 151
151enum iGmDocumentFormat {
152 undefined_GmDocumentFormat = -1,
153 gemini_GmDocumentFormat = 0,
154 plainText_GmDocumentFormat,
155};
156
157enum iGmDocumentBanner { 152enum iGmDocumentBanner {
158 none_GmDocumentBanner, 153 none_GmDocumentBanner,
159 siteDomain_GmDocumentBanner, 154 siteDomain_GmDocumentBanner,
160 certificateWarning_GmDocumentBanner, 155 certificateWarning_GmDocumentBanner,
161}; 156};
162 157
158enum iGmDocumentUpdate {
159 partial_GmDocumentUpdate, /* appending more content */
160 final_GmDocumentUpdate, /* process all lines, including the last one if not terminated */
161};
162
163void setThemeSeed_GmDocument (iGmDocument *, const iBlock *seed); 163void setThemeSeed_GmDocument (iGmDocument *, const iBlock *seed);
164void setFormat_GmDocument (iGmDocument *, enum iGmDocumentFormat format); 164void setFormat_GmDocument (iGmDocument *, enum iSourceFormat format);
165void setBanner_GmDocument (iGmDocument *, enum iGmDocumentBanner type); 165void setBanner_GmDocument (iGmDocument *, enum iGmDocumentBanner type);
166void setWidth_GmDocument (iGmDocument *, int width); 166void setWidth_GmDocument (iGmDocument *, int width);
167void redoLayout_GmDocument (iGmDocument *); 167void redoLayout_GmDocument (iGmDocument *);
168iBool updateOpenURLs_GmDocument(iGmDocument *); 168iBool updateOpenURLs_GmDocument(iGmDocument *);
169void setUrl_GmDocument (iGmDocument *, const iString *url); 169void setUrl_GmDocument (iGmDocument *, const iString *url);
170void setSource_GmDocument (iGmDocument *, const iString *source, int width); 170void setSource_GmDocument (iGmDocument *, const iString *source, int width,
171 enum iGmDocumentUpdate updateType);
171void foldPre_GmDocument (iGmDocument *, uint16_t preId); 172void foldPre_GmDocument (iGmDocument *, uint16_t preId);
173void invalidatePalette_GmDocument(iGmDocument *);
174void makePaletteGlobal_GmDocument(const iGmDocument *); /* copies document colors to the global palette */
172 175
173void reset_GmDocument (iGmDocument *); /* free images */ 176//void reset_GmDocument (iGmDocument *); /* free images */
174 177
175typedef void (*iGmDocumentRenderFunc)(void *, const iGmRun *); 178typedef void (*iGmDocumentRenderFunc)(void *, const iGmRun *);
176 179
177iMedia * media_GmDocument (iGmDocument *); 180iMedia * media_GmDocument (iGmDocument *);
178const iMedia * constMedia_GmDocument (const iGmDocument *); 181const iMedia * constMedia_GmDocument (const iGmDocument *);
182const iString * url_GmDocument (const iGmDocument *);
179 183
180void render_GmDocument (const iGmDocument *, iRangei visRangeY, 184void 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 *);
190const iString * bannerText_GmDocument (const iGmDocument *); 194const iString * bannerText_GmDocument (const iGmDocument *);
191const iArray * headings_GmDocument (const iGmDocument *); /* array of GmHeadings */ 195const iArray * headings_GmDocument (const iGmDocument *); /* array of GmHeadings */
192const iString * source_GmDocument (const iGmDocument *); 196const iString * source_GmDocument (const iGmDocument *);
197size_t memorySize_GmDocument (const iGmDocument *); /* bytes */
193 198
194iRangecc findText_GmDocument (const iGmDocument *, const iString *text, const char *start); 199iRangecc findText_GmDocument (const iGmDocument *, const iString *text, const char *start);
195iRangecc findTextBefore_GmDocument (const iGmDocument *, const iString *text, const char *before); 200iRangecc findTextBefore_GmDocument (const iGmDocument *, const iString *text, const char *before);