summaryrefslogtreecommitdiff
path: root/src/gmdocument.h
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-10-11 12:22:54 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-10-11 12:22:54 +0300
commit960df03c17091aca37f53eaab8fc27c669d26a5e (patch)
tree18721567f227928c528430daf9d06248a2443598 /src/gmdocument.h
parentbf9158b29df506698e267d4583459ee4ebf20685 (diff)
Media refactoring; working on FontPack management
Media still needs more work to get rid of redundancies and make lookups faster. FontPacks are manipulated as Media items (not unlike images) so they can be previewed on page, and installed via a click. FontPack management is not trivial as it includes such details as versioning and whether individual packs are enabled or disabled.
Diffstat (limited to 'src/gmdocument.h')
-rw-r--r--src/gmdocument.h16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/gmdocument.h b/src/gmdocument.h
index b2c6d9b7..20bc9890 100644
--- a/src/gmdocument.h
+++ b/src/gmdocument.h
@@ -90,6 +90,7 @@ enum iGmLinkFlag {
90 query_GmLinkFlag = iBit(14), /* Gopher query link */ 90 query_GmLinkFlag = iBit(14), /* Gopher query link */
91 iconFromLabel_GmLinkFlag = iBit(15), /* use an Emoji/special character from label */ 91 iconFromLabel_GmLinkFlag = iBit(15), /* use an Emoji/special character from label */
92 isOpen_GmLinkFlag = iBit(16), /* currently open in a tab */ 92 isOpen_GmLinkFlag = iBit(16), /* currently open in a tab */
93 fontpackFileExtension_GmLinkFlag = iBit(17),
93}; 94};
94 95
95iLocalDef enum iGmLinkScheme scheme_GmLinkFlag(int flags) { 96iLocalDef enum iGmLinkScheme scheme_GmLinkFlag(int flags) {
@@ -126,13 +127,6 @@ enum iGmRunFlags {
126 altText_GmRunFlag = iBit(8), 127 altText_GmRunFlag = iBit(8),
127}; 128};
128 129
129enum iGmRunMediaType {
130 none_GmRunMediaType,
131 image_GmRunMediaType,
132 audio_GmRunMediaType,
133 download_GmRunMediaType,
134};
135
136/* This structure is tightly packed because GmDocuments are mostly composed of 130/* This structure is tightly packed because GmDocuments are mostly composed of
137 a large number of GmRuns. */ 131 a large number of GmRuns. */
138struct Impl_GmRun { 132struct Impl_GmRun {
@@ -146,12 +140,16 @@ struct Impl_GmRun {
146 uint32_t color : 7; /* see max_ColorId */ 140 uint32_t color : 7; /* see max_ColorId */
147 141
148 uint32_t font : 10; 142 uint32_t font : 10;
149 uint32_t mediaType : 2; 143 uint32_t mediaType : 3;
150 uint32_t mediaId : 10; /* zero if not an image */ 144 uint32_t mediaId : 9; /* zero if not an image */
151 uint32_t preId : 10; /* preformatted block ID (sequential); merge with mediaId? */ 145 uint32_t preId : 10; /* preformatted block ID (sequential); merge with mediaId? */
152 }; 146 };
153}; 147};
154 148
149iLocalDef iMediaId mediaId_GmRun(const iGmRun *d) {
150 return (iMediaId){ .type = d->mediaType, .id = d->mediaId };
151}
152
155iDeclareType(GmRunRange) 153iDeclareType(GmRunRange)
156 154
157struct Impl_GmRunRange { 155struct Impl_GmRunRange {