summaryrefslogtreecommitdiff
path: root/src/gmdocument.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/gmdocument.h')
-rw-r--r--src/gmdocument.h24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/gmdocument.h b/src/gmdocument.h
index fcbb7e59..943a408c 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,29 +149,29 @@ 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);
172 173
173void reset_GmDocument (iGmDocument *); /* free images */ 174//void reset_GmDocument (iGmDocument *); /* free images */
174 175
175typedef void (*iGmDocumentRenderFunc)(void *, const iGmRun *); 176typedef void (*iGmDocumentRenderFunc)(void *, const iGmRun *);
176 177
@@ -190,6 +191,7 @@ enum iGmDocumentBanner bannerType_GmDocument(const iGmDocument *);
190const iString * bannerText_GmDocument (const iGmDocument *); 191const iString * bannerText_GmDocument (const iGmDocument *);
191const iArray * headings_GmDocument (const iGmDocument *); /* array of GmHeadings */ 192const iArray * headings_GmDocument (const iGmDocument *); /* array of GmHeadings */
192const iString * source_GmDocument (const iGmDocument *); 193const iString * source_GmDocument (const iGmDocument *);
194size_t memorySize_GmDocument (const iGmDocument *); /* bytes */
193 195
194iRangecc findText_GmDocument (const iGmDocument *, const iString *text, const char *start); 196iRangecc findText_GmDocument (const iGmDocument *, const iString *text, const char *start);
195iRangecc findTextBefore_GmDocument (const iGmDocument *, const iString *text, const char *before); 197iRangecc findTextBefore_GmDocument (const iGmDocument *, const iString *text, const char *before);