diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/app.c | 12 | ||||
-rw-r--r-- | src/fontpack.c | 7 | ||||
-rw-r--r-- | src/gmrequest.c | 16 | ||||
-rw-r--r-- | src/lang.c | 56 | ||||
-rw-r--r-- | src/resources.c | 121 | ||||
-rw-r--r-- | src/resources.h | 60 | ||||
-rw-r--r-- | src/ui/root.c | 2 | ||||
-rw-r--r-- | src/ui/text.c | 24 | ||||
-rw-r--r-- | src/ui/window.c | 8 |
9 files changed, 241 insertions, 65 deletions
@@ -23,7 +23,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ | |||
23 | #include "app.h" | 23 | #include "app.h" |
24 | #include "bookmarks.h" | 24 | #include "bookmarks.h" |
25 | #include "defs.h" | 25 | #include "defs.h" |
26 | #include "embedded.h" | 26 | #include "resources.h" |
27 | #include "feeds.h" | 27 | #include "feeds.h" |
28 | #include "mimehooks.h" | 28 | #include "mimehooks.h" |
29 | #include "gmcerts.h" | 29 | #include "gmcerts.h" |
@@ -711,19 +711,17 @@ static void init_App_(iApp *d, int argc, char **argv) { | |||
711 | } | 711 | } |
712 | SDL_free(exec); | 712 | SDL_free(exec); |
713 | } | 713 | } |
714 | #if defined (iHaveLoadEmbed) | ||
715 | /* Load the resources from a file. Check the executable directory first, then a | 714 | /* Load the resources from a file. Check the executable directory first, then a |
716 | system-wide location, and as a final fallback, the current working directory. */ { | 715 | system-wide location, and as a final fallback, the current working directory. */ { |
717 | if (!load_Embed(concatPath_CStr(cstr_String(execPath_App()), EMB_BIN2))) { | 716 | if (!init_Resources(concatPath_CStr(cstr_String(execPath_App()), EMB_BIN2))) { |
718 | if (!load_Embed(concatPath_CStr(cstr_String(execPath_App()), EMB_BIN))) { | 717 | if (!init_Resources(concatPath_CStr(cstr_String(execPath_App()), EMB_BIN))) { |
719 | if (!load_Embed("resources.lgr")) { | 718 | if (!init_Resources("resources.lgr")) { |
720 | fprintf(stderr, "failed to load resources: %s\n", strerror(errno)); | 719 | fprintf(stderr, "failed to load resources: %s\n", strerror(errno)); |
721 | exit(-1); | 720 | exit(-1); |
722 | } | 721 | } |
723 | } | 722 | } |
724 | } | 723 | } |
725 | } | 724 | } |
726 | #endif | ||
727 | init_Lang(); | 725 | init_Lang(); |
728 | /* Configure the valid command line options. */ { | 726 | /* Configure the valid command line options. */ { |
729 | defineValues_CommandLine(&d->args, "close-tab", 0); | 727 | defineValues_CommandLine(&d->args, "close-tab", 0); |
@@ -742,7 +740,7 @@ static void init_App_(iApp *d, int argc, char **argv) { | |||
742 | iStringList *openCmds = new_StringList(); | 740 | iStringList *openCmds = new_StringList(); |
743 | /* Handle command line options. */ { | 741 | /* Handle command line options. */ { |
744 | if (contains_CommandLine(&d->args, "help")) { | 742 | if (contains_CommandLine(&d->args, "help")) { |
745 | puts(cstr_Block(&blobArghelp_Embedded)); | 743 | puts(cstr_Block(&blobArghelp_Resources)); |
746 | terminate_App_(0); | 744 | terminate_App_(0); |
747 | } | 745 | } |
748 | if (contains_CommandLine(&d->args, "version;V")) { | 746 | if (contains_CommandLine(&d->args, "version;V")) { |
diff --git a/src/fontpack.c b/src/fontpack.c index 40e4c96c..78181fd4 100644 --- a/src/fontpack.c +++ b/src/fontpack.c | |||
@@ -21,7 +21,7 @@ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
21 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ | 21 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ |
22 | 22 | ||
23 | #include "fontpack.h" | 23 | #include "fontpack.h" |
24 | #include "embedded.h" | 24 | #include "resources.h" |
25 | #include "ui/window.h" | 25 | #include "ui/window.h" |
26 | #include "app.h" | 26 | #include "app.h" |
27 | 27 | ||
@@ -564,11 +564,8 @@ void init_Fonts(const char *userDir) { | |||
564 | /* Load the required fonts. */ { | 564 | /* Load the required fonts. */ { |
565 | iFontPack *pack = new_FontPack(); | 565 | iFontPack *pack = new_FontPack(); |
566 | setCStr_String(&pack->id, "default"); | 566 | setCStr_String(&pack->id, "default"); |
567 | iArchive *arch = new_Archive(); | ||
568 | setReadOnly_FontPack(pack, iTrue); | 567 | setReadOnly_FontPack(pack, iTrue); |
569 | openData_Archive(arch, &fontpackDefault_Embedded); | 568 | loadArchive_FontPack(pack, archive_Resources()); /* should never fail if we've made it this far */ |
570 | loadArchive_FontPack(pack, arch); /* should never fail if we've made it this far */ | ||
571 | iRelease(arch); | ||
572 | pushBack_PtrArray(&d->packs, pack); | 569 | pushBack_PtrArray(&d->packs, pack); |
573 | } | 570 | } |
574 | /* Find and load .fontpack files in known locations. */ { | 571 | /* Find and load .fontpack files in known locations. */ { |
diff --git a/src/gmrequest.c b/src/gmrequest.c index 03a6d999..23845475 100644 --- a/src/gmrequest.c +++ b/src/gmrequest.c | |||
@@ -29,7 +29,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ | |||
29 | #include "feeds.h" | 29 | #include "feeds.h" |
30 | #include "bookmarks.h" | 30 | #include "bookmarks.h" |
31 | #include "ui/text.h" | 31 | #include "ui/text.h" |
32 | #include "embedded.h" | 32 | #include "resources.h" |
33 | #include "defs.h" | 33 | #include "defs.h" |
34 | 34 | ||
35 | #include <the_Foundation/archive.h> | 35 | #include <the_Foundation/archive.h> |
@@ -344,19 +344,19 @@ static void requestFinished_GmRequest_(iGmRequest *d, iTlsRequest *req) { | |||
344 | static const iBlock *aboutPageSource_(iRangecc path, iRangecc query) { | 344 | static const iBlock *aboutPageSource_(iRangecc path, iRangecc query) { |
345 | const iBlock *src = NULL; | 345 | const iBlock *src = NULL; |
346 | if (equalCase_Rangecc(path, "about")) { | 346 | if (equalCase_Rangecc(path, "about")) { |
347 | return &blobAbout_Embedded; | 347 | return &blobAbout_Resources; |
348 | } | 348 | } |
349 | if (equalCase_Rangecc(path, "lagrange")) { | 349 | if (equalCase_Rangecc(path, "lagrange")) { |
350 | return &blobLagrange_Embedded; | 350 | return &blobLagrange_Resources; |
351 | } | 351 | } |
352 | if (equalCase_Rangecc(path, "help")) { | 352 | if (equalCase_Rangecc(path, "help")) { |
353 | return &blobHelp_Embedded; | 353 | return &blobHelp_Resources; |
354 | } | 354 | } |
355 | if (equalCase_Rangecc(path, "license")) { | 355 | if (equalCase_Rangecc(path, "license")) { |
356 | return &blobLicense_Embedded; | 356 | return &blobLicense_Resources; |
357 | } | 357 | } |
358 | if (equalCase_Rangecc(path, "version")) { | 358 | if (equalCase_Rangecc(path, "version")) { |
359 | return &blobVersion_Embedded; | 359 | return &blobVersion_Resources; |
360 | } | 360 | } |
361 | if (equalCase_Rangecc(path, "debug")) { | 361 | if (equalCase_Rangecc(path, "debug")) { |
362 | return utf8_String(debugInfo_App()); | 362 | return utf8_String(debugInfo_App()); |
@@ -396,7 +396,7 @@ static const iBlock *replaceVariables_(const iBlock *block) { | |||
396 | #if 0 | 396 | #if 0 |
397 | else if (startsWith_Rangecc(name, "BT:")) { /* block text */ | 397 | else if (startsWith_Rangecc(name, "BT:")) { /* block text */ |
398 | repl = range_String(collect_String(renderBlockChars_Text( | 398 | repl = range_String(collect_String(renderBlockChars_Text( |
399 | &fontFiraSansRegular_Embedded, | 399 | &fontFiraSansRegular_Resources, |
400 | 11, /* should be larger if shaded */ | 400 | 11, /* should be larger if shaded */ |
401 | quadrants_TextBlockMode, | 401 | quadrants_TextBlockMode, |
402 | &(iString){ iBlockLiteral( | 402 | &(iString){ iBlockLiteral( |
@@ -404,7 +404,7 @@ static const iBlock *replaceVariables_(const iBlock *block) { | |||
404 | } | 404 | } |
405 | else if (startsWith_Rangecc(name, "ST:")) { /* shaded text */ | 405 | else if (startsWith_Rangecc(name, "ST:")) { /* shaded text */ |
406 | repl = range_String(collect_String(renderBlockChars_Text( | 406 | repl = range_String(collect_String(renderBlockChars_Text( |
407 | &fontSmolEmojiRegular_Embedded, | 407 | &fontSmolEmojiRegular_Resources, |
408 | 20, | 408 | 20, |
409 | shading_TextBlockMode, | 409 | shading_TextBlockMode, |
410 | &(iString){ iBlockLiteral( | 410 | &(iString){ iBlockLiteral( |
@@ -21,7 +21,7 @@ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
21 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ | 21 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ |
22 | 22 | ||
23 | #include "lang.h" | 23 | #include "lang.h" |
24 | #include "embedded.h" | 24 | #include "resources.h" |
25 | 25 | ||
26 | #include <the_Foundation/sortedarray.h> | 26 | #include <the_Foundation/sortedarray.h> |
27 | #include <the_Foundation/string.h> | 27 | #include <the_Foundation/string.h> |
@@ -30,7 +30,7 @@ iDeclareType(Lang) | |||
30 | iDeclareType(MsgStr) | 30 | iDeclareType(MsgStr) |
31 | 31 | ||
32 | struct Impl_MsgStr { | 32 | struct Impl_MsgStr { |
33 | iRangecc id; /* these point to null-terminated strings in embedded data */ | 33 | iRangecc id; /* these point to null-terminated strings in resources */ |
34 | iRangecc str; | 34 | iRangecc str; |
35 | }; | 35 | }; |
36 | 36 | ||
@@ -83,41 +83,41 @@ static void clear_Lang_(iLang *d) { | |||
83 | } | 83 | } |
84 | 84 | ||
85 | static void load_Lang_(iLang *d, const char *id) { | 85 | static void load_Lang_(iLang *d, const char *id) { |
86 | /* Load compiled language strings from an embedded blob. */ | 86 | /* Load compiled language strings from a resource blob. */ |
87 | iUnused(id); | 87 | iUnused(id); |
88 | const iBlock *data = equal_CStr(id, "fi") ? &blobFi_Embedded | 88 | const iBlock *data = equal_CStr(id, "fi") ? &blobFi_Resources |
89 | : equal_CStr(id, "fr") ? &blobFr_Embedded | 89 | : equal_CStr(id, "fr") ? &blobFr_Resources |
90 | : equal_CStr(id, "ru") ? &blobRu_Embedded | 90 | : equal_CStr(id, "ru") ? &blobRu_Resources |
91 | : equal_CStr(id, "eo") ? &blobEo_Embedded | 91 | : equal_CStr(id, "eo") ? &blobEo_Resources |
92 | : equal_CStr(id, "es") ? &blobEs_Embedded | 92 | : equal_CStr(id, "es") ? &blobEs_Resources |
93 | : equal_CStr(id, "es_MX") ? &blobEs_MX_Embedded | 93 | : equal_CStr(id, "es_MX") ? &blobEs_MX_Resources |
94 | : equal_CStr(id, "de") ? &blobDe_Embedded | 94 | : equal_CStr(id, "de") ? &blobDe_Resources |
95 | : equal_CStr(id, "gl") ? &blobGl_Embedded | 95 | : equal_CStr(id, "gl") ? &blobGl_Resources |
96 | : equal_CStr(id, "ia") ? &blobIa_Embedded | 96 | : equal_CStr(id, "ia") ? &blobIa_Resources |
97 | : equal_CStr(id, "ie") ? &blobIe_Embedded | 97 | : equal_CStr(id, "ie") ? &blobIe_Resources |
98 | : equal_CStr(id, "isv") ? &blobIsv_Embedded | 98 | : equal_CStr(id, "isv") ? &blobIsv_Resources |
99 | : equal_CStr(id, "pl") ? &blobPl_Embedded | 99 | : equal_CStr(id, "pl") ? &blobPl_Resources |
100 | : equal_CStr(id, "sk") ? &blobSk_Embedded | 100 | : equal_CStr(id, "sk") ? &blobSk_Resources |
101 | : equal_CStr(id, "sr") ? &blobSr_Embedded | 101 | : equal_CStr(id, "sr") ? &blobSr_Resources |
102 | : equal_CStr(id, "tok") ? &blobTok_Embedded | 102 | : equal_CStr(id, "tok") ? &blobTok_Resources |
103 | : equal_CStr(id, "uk") ? &blobUk_Embedded | 103 | : equal_CStr(id, "uk") ? &blobUk_Resources |
104 | : equal_CStr(id, "zh_Hans") ? &blobZh_Hans_Embedded | 104 | : equal_CStr(id, "zh_Hans") ? &blobZh_Hans_Resources |
105 | : equal_CStr(id, "zh_Hant") ? &blobZh_Hant_Embedded | 105 | : equal_CStr(id, "zh_Hant") ? &blobZh_Hant_Resources |
106 | : &blobEn_Embedded; | 106 | : &blobEn_Resources; |
107 | if (data == &blobRu_Embedded || data == &blobSr_Embedded || data == &blobUk_Embedded) { | 107 | if (data == &blobRu_Resources || data == &blobSr_Resources || data == &blobUk_Resources) { |
108 | d->pluralType = slavic_PluralType; | 108 | d->pluralType = slavic_PluralType; |
109 | } | 109 | } |
110 | else if (data == &blobIsv_Embedded) { | 110 | else if (data == &blobIsv_Resources) { |
111 | d->pluralType = oneTwoMany_PluralType; | 111 | d->pluralType = oneTwoMany_PluralType; |
112 | } | 112 | } |
113 | else if (data == &blobSk_Embedded) { | 113 | else if (data == &blobSk_Resources) { |
114 | d->pluralType = oneFewMany_PluralType; | 114 | d->pluralType = oneFewMany_PluralType; |
115 | } | 115 | } |
116 | else if (data == &blobPl_Embedded) { | 116 | else if (data == &blobPl_Resources) { |
117 | d->pluralType = polish_PluralType; | 117 | d->pluralType = polish_PluralType; |
118 | } | 118 | } |
119 | else if (data == &blobZh_Hans_Embedded || data == &blobZh_Hant_Embedded || | 119 | else if (data == &blobZh_Hans_Resources || data == &blobZh_Hant_Resources || |
120 | data == &blobTok_Embedded) { | 120 | data == &blobTok_Resources) { |
121 | d->pluralType = none_PluralType; | 121 | d->pluralType = none_PluralType; |
122 | } | 122 | } |
123 | else { | 123 | else { |
diff --git a/src/resources.c b/src/resources.c new file mode 100644 index 00000000..da78708a --- /dev/null +++ b/src/resources.c | |||
@@ -0,0 +1,121 @@ | |||
1 | /* Copyright 2021 Jaakko Keränen <jaakko.keranen@iki.fi> | ||
2 | |||
3 | Redistribution and use in source and binary forms, with or without | ||
4 | modification, are permitted provided that the following conditions are met: | ||
5 | |||
6 | 1. Redistributions of source code must retain the above copyright notice, this | ||
7 | list of conditions and the following disclaimer. | ||
8 | 2. Redistributions in binary form must reproduce the above copyright notice, | ||
9 | this list of conditions and the following disclaimer in the documentation | ||
10 | and/or other materials provided with the distribution. | ||
11 | |||
12 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
13 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
14 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
15 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR | ||
16 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
17 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
18 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
19 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
20 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
21 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ | ||
22 | |||
23 | #include "resources.h" | ||
24 | |||
25 | #include <the_Foundation/archive.h> | ||
26 | #include <the_Foundation/version.h> | ||
27 | |||
28 | static iArchive *archive_; | ||
29 | |||
30 | iBlock blobAbout_Resources; | ||
31 | iBlock blobHelp_Resources; | ||
32 | iBlock blobLagrange_Resources; | ||
33 | iBlock blobLicense_Resources; | ||
34 | iBlock blobVersion_Resources; | ||
35 | iBlock blobArghelp_Resources; | ||
36 | iBlock blobDe_Resources; | ||
37 | iBlock blobEn_Resources; | ||
38 | iBlock blobEo_Resources; | ||
39 | iBlock blobEs_Resources; | ||
40 | iBlock blobEs_MX_Resources; | ||
41 | iBlock blobFi_Resources; | ||
42 | iBlock blobFr_Resources; | ||
43 | iBlock blobGl_Resources; | ||
44 | iBlock blobIa_Resources; | ||
45 | iBlock blobIe_Resources; | ||
46 | iBlock blobIsv_Resources; | ||
47 | iBlock blobPl_Resources; | ||
48 | iBlock blobRu_Resources; | ||
49 | iBlock blobSk_Resources; | ||
50 | iBlock blobSr_Resources; | ||
51 | iBlock blobTok_Resources; | ||
52 | iBlock blobUk_Resources; | ||
53 | iBlock blobZh_Hans_Resources; | ||
54 | iBlock blobZh_Hant_Resources; | ||
55 | iBlock imageShadow_Resources; | ||
56 | |||
57 | static struct { | ||
58 | iBlock *data; | ||
59 | const char *archivePath; | ||
60 | } entries_[] = { | ||
61 | { &blobAbout_Resources, "about/about.gmi" }, | ||
62 | { &blobHelp_Resources, "about/help.gmi" }, | ||
63 | { &blobLagrange_Resources, "about/lagrange.gmi" }, | ||
64 | { &blobLicense_Resources, "about/license.gmi" }, | ||
65 | { &blobVersion_Resources, "about/version.gmi" }, | ||
66 | { &blobArghelp_Resources, "arg-help.txt" }, | ||
67 | { &blobDe_Resources, "lang/de.bin" }, | ||
68 | { &blobEn_Resources, "lang/en.bin" }, | ||
69 | { &blobEo_Resources, "lang/eo.bin" }, | ||
70 | { &blobEs_Resources, "lang/es.bin" }, | ||
71 | { &blobEs_MX_Resources, "lang/es_MX.bin" }, | ||
72 | { &blobFi_Resources, "lang/fi.bin" }, | ||
73 | { &blobFr_Resources, "lang/fr.bin" }, | ||
74 | { &blobGl_Resources, "lang/gl.bin" }, | ||
75 | { &blobIa_Resources, "lang/ia.bin" }, | ||
76 | { &blobIe_Resources, "lang/ie.bin" }, | ||
77 | { &blobIsv_Resources, "lang/isv.bin" }, | ||
78 | { &blobPl_Resources, "lang/pl.bin" }, | ||
79 | { &blobRu_Resources, "lang/ru.bin" }, | ||
80 | { &blobSk_Resources, "lang/sk.bin" }, | ||
81 | { &blobSr_Resources, "lang/sr.bin" }, | ||
82 | { &blobTok_Resources, "lang/tok.bin" }, | ||
83 | { &blobUk_Resources, "lang/uk.bin" }, | ||
84 | { &blobZh_Hans_Resources, "lang/zh_Hans.bin" }, | ||
85 | { &blobZh_Hant_Resources, "lang/zh_Hant.bin" }, | ||
86 | { &imageShadow_Resources, "shadow.png" }, | ||
87 | }; | ||
88 | |||
89 | iBool init_Resources(const char *path) { | ||
90 | archive_ = new_Archive(); | ||
91 | if (openFile_Archive(archive_, collectNewCStr_String(path))) { | ||
92 | iVersion appVer; | ||
93 | init_Version(&appVer, range_CStr(LAGRANGE_APP_VERSION)); | ||
94 | iVersion resVer; | ||
95 | init_Version(&resVer, range_Block(dataCStr_Archive(archive_, "VERSION"))); | ||
96 | if (!cmp_Version(&resVer, &appVer)) { | ||
97 | iForIndices(i, entries_) { | ||
98 | const iBlock *data = dataCStr_Archive(archive_, entries_[i].archivePath); | ||
99 | if (data) { | ||
100 | initCopy_Block(entries_[i].data, data); | ||
101 | } | ||
102 | } | ||
103 | return iTrue; | ||
104 | } | ||
105 | fprintf(stderr, "[Resources] %s: version mismatch (%s != " LAGRANGE_APP_VERSION ")\n", | ||
106 | path, cstr_Block(dataCStr_Archive(archive_, "VERSION"))); | ||
107 | } | ||
108 | iRelease(archive_); | ||
109 | return iFalse; | ||
110 | } | ||
111 | |||
112 | void deinit_Resources(void) { | ||
113 | iForIndices(i, entries_) { | ||
114 | deinit_Block(entries_[i].data); | ||
115 | } | ||
116 | iRelease(archive_); | ||
117 | } | ||
118 | |||
119 | const iArchive *archive_Resources(void) { | ||
120 | return archive_; | ||
121 | } | ||
diff --git a/src/resources.h b/src/resources.h new file mode 100644 index 00000000..a9a5c767 --- /dev/null +++ b/src/resources.h | |||
@@ -0,0 +1,60 @@ | |||
1 | /* Copyright 2021 Jaakko Keränen <jaakko.keranen@iki.fi> | ||
2 | |||
3 | Redistribution and use in source and binary forms, with or without | ||
4 | modification, are permitted provided that the following conditions are met: | ||
5 | |||
6 | 1. Redistributions of source code must retain the above copyright notice, this | ||
7 | list of conditions and the following disclaimer. | ||
8 | 2. Redistributions in binary form must reproduce the above copyright notice, | ||
9 | this list of conditions and the following disclaimer in the documentation | ||
10 | and/or other materials provided with the distribution. | ||
11 | |||
12 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
13 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
14 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
15 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR | ||
16 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
17 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
18 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
19 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
20 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
21 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ | ||
22 | |||
23 | #pragma once | ||
24 | |||
25 | #include <the_Foundation/block.h> | ||
26 | |||
27 | iDeclareType(Archive) | ||
28 | |||
29 | iBool init_Resources (const char *path); | ||
30 | void deinit_Resources (void); | ||
31 | |||
32 | const iArchive * archive_Resources (void); | ||
33 | |||
34 | extern iBlock blobAbout_Resources; | ||
35 | extern iBlock blobHelp_Resources; | ||
36 | extern iBlock blobLagrange_Resources; | ||
37 | extern iBlock blobLicense_Resources; | ||
38 | extern iBlock blobVersion_Resources; | ||
39 | extern iBlock blobArghelp_Resources; | ||
40 | extern iBlock blobDe_Resources; | ||
41 | extern iBlock blobEn_Resources; | ||
42 | extern iBlock blobEo_Resources; | ||
43 | extern iBlock blobEs_Resources; | ||
44 | extern iBlock blobEs_MX_Resources; | ||
45 | extern iBlock blobFi_Resources; | ||
46 | extern iBlock blobFr_Resources; | ||
47 | extern iBlock blobGl_Resources; | ||
48 | extern iBlock blobIa_Resources; | ||
49 | extern iBlock blobIe_Resources; | ||
50 | extern iBlock blobIsv_Resources; | ||
51 | extern iBlock blobPl_Resources; | ||
52 | extern iBlock blobRu_Resources; | ||
53 | extern iBlock blobSk_Resources; | ||
54 | extern iBlock blobSr_Resources; | ||
55 | extern iBlock blobTok_Resources; | ||
56 | extern iBlock blobUk_Resources; | ||
57 | extern iBlock blobZh_Hans_Resources; | ||
58 | extern iBlock blobZh_Hant_Resources; | ||
59 | extern iBlock imageShadow_Resources; | ||
60 | extern iBlock fontpackDefault_Resources; | ||
diff --git a/src/ui/root.c b/src/ui/root.c index d847480f..f66e0f29 100644 --- a/src/ui/root.c +++ b/src/ui/root.c | |||
@@ -27,7 +27,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ | |||
27 | #include "command.h" | 27 | #include "command.h" |
28 | #include "defs.h" | 28 | #include "defs.h" |
29 | #include "documentwidget.h" | 29 | #include "documentwidget.h" |
30 | #include "embedded.h" | 30 | #include "resources.h" |
31 | #include "inputwidget.h" | 31 | #include "inputwidget.h" |
32 | #include "keys.h" | 32 | #include "keys.h" |
33 | #include "labelwidget.h" | 33 | #include "labelwidget.h" |
diff --git a/src/ui/text.c b/src/ui/text.c index 09c01d46..e762b891 100644 --- a/src/ui/text.c +++ b/src/ui/text.c | |||
@@ -23,7 +23,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ | |||
23 | #include "text.h" | 23 | #include "text.h" |
24 | #include "color.h" | 24 | #include "color.h" |
25 | #include "metrics.h" | 25 | #include "metrics.h" |
26 | #include "embedded.h" | 26 | #include "resources.h" |
27 | #include "window.h" | 27 | #include "window.h" |
28 | #include "paint.h" | 28 | #include "paint.h" |
29 | #include "app.h" | 29 | #include "app.h" |
@@ -180,21 +180,21 @@ static void init_Font(iFont *d, const iFontSpec *fontSpec, const iFontFile *font | |||
180 | d->data = NULL; | 180 | d->data = NULL; |
181 | d->family = undefined_TextFont; | 181 | d->family = undefined_TextFont; |
182 | /* Note: We only use `family` currently for applying a kerning fix to Nunito. */ | 182 | /* Note: We only use `family` currently for applying a kerning fix to Nunito. */ |
183 | if (data == &fontNunitoRegular_Embedded || | 183 | if (data == &fontNunitoRegular_Resources || |
184 | data == &fontNunitoBold_Embedded || | 184 | data == &fontNunitoBold_Resources || |
185 | data == &fontNunitoExtraBold_Embedded || | 185 | data == &fontNunitoExtraBold_Resources || |
186 | //data == &fontNunitoLightItalic_Embedded || | 186 | //data == &fontNunitoLightItalic_Resources || |
187 | data == &fontNunitoExtraLight_Embedded) { | 187 | data == &fontNunitoExtraLight_Resources) { |
188 | d->family = nunito_TextFont; | 188 | d->family = nunito_TextFont; |
189 | } | 189 | } |
190 | else if (//data == &fontScheherazadeNewRegular_Embedded) { | 190 | else if (//data == &fontScheherazadeNewRegular_Resources) { |
191 | data == &fontNotoSansArabicUIRegular_Embedded) { | 191 | data == &fontNotoSansArabicUIRegular_Resources) { |
192 | d->family = arabic_TextFont; | 192 | d->family = arabic_TextFont; |
193 | } | 193 | } |
194 | else if (data == &fontNotoSansSymbolsRegular_Embedded || | 194 | else if (data == &fontNotoSansSymbolsRegular_Resources || |
195 | data == &fontNotoSansSymbols2Regular_Embedded || | 195 | data == &fontNotoSansSymbols2Regular_Resources || |
196 | data == &fontNotoEmojiRegular_Embedded || | 196 | data == &fontNotoEmojiRegular_Resources || |
197 | data == &fontSmolEmojiRegular_Embedded) { | 197 | data == &fontSmolEmojiRegular_Resources) { |
198 | d->family = emojiAndSymbols_TextFont; | 198 | d->family = emojiAndSymbols_TextFont; |
199 | } | 199 | } |
200 | #endif | 200 | #endif |
diff --git a/src/ui/window.c b/src/ui/window.c index c63ad76a..8016e8ef 100644 --- a/src/ui/window.c +++ b/src/ui/window.c | |||
@@ -26,7 +26,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ | |||
26 | #include "bookmarks.h" | 26 | #include "bookmarks.h" |
27 | #include "command.h" | 27 | #include "command.h" |
28 | #include "defs.h" | 28 | #include "defs.h" |
29 | #include "embedded.h" | 29 | #include "resources.h" |
30 | #include "keys.h" | 30 | #include "keys.h" |
31 | #include "labelwidget.h" | 31 | #include "labelwidget.h" |
32 | #include "documentwidget.h" | 32 | #include "documentwidget.h" |
@@ -583,7 +583,7 @@ void init_MainWindow(iMainWindow *d, iRect rect) { | |||
583 | #if defined (iPlatformLinux) | 583 | #if defined (iPlatformLinux) |
584 | SDL_SetWindowMinimumSize(d->base.win, minSize.x * d->base.pixelRatio, minSize.y * d->base.pixelRatio); | 584 | SDL_SetWindowMinimumSize(d->base.win, minSize.x * d->base.pixelRatio, minSize.y * d->base.pixelRatio); |
585 | /* Load the window icon. */ { | 585 | /* Load the window icon. */ { |
586 | SDL_Surface *surf = loadImage_(&imageLagrange64_Embedded, 0); | 586 | SDL_Surface *surf = loadImage_(&imageLagrange64_Resources, 0); |
587 | SDL_SetWindowIcon(d->base.win, surf); | 587 | SDL_SetWindowIcon(d->base.win, surf); |
588 | free(surf->pixels); | 588 | free(surf->pixels); |
589 | SDL_FreeSurface(surf); | 589 | SDL_FreeSurface(surf); |
@@ -597,7 +597,7 @@ void init_MainWindow(iMainWindow *d, iRect rect) { | |||
597 | setupUserInterface_MainWindow(d); | 597 | setupUserInterface_MainWindow(d); |
598 | postCommand_App("~bindings.changed"); /* update from bindings */ | 598 | postCommand_App("~bindings.changed"); /* update from bindings */ |
599 | /* Load the border shadow texture. */ { | 599 | /* Load the border shadow texture. */ { |
600 | SDL_Surface *surf = loadImage_(&imageShadow_Embedded, 0); | 600 | SDL_Surface *surf = loadImage_(&imageShadow_Resources, 0); |
601 | d->base.borderShadow = SDL_CreateTextureFromSurface(d->base.render, surf); | 601 | d->base.borderShadow = SDL_CreateTextureFromSurface(d->base.render, surf); |
602 | SDL_SetTextureBlendMode(d->base.borderShadow, SDL_BLENDMODE_BLEND); | 602 | SDL_SetTextureBlendMode(d->base.borderShadow, SDL_BLENDMODE_BLEND); |
603 | free(surf->pixels); | 603 | free(surf->pixels); |
@@ -607,7 +607,7 @@ void init_MainWindow(iMainWindow *d, iRect rect) { | |||
607 | #if defined (LAGRANGE_ENABLE_CUSTOM_FRAME) | 607 | #if defined (LAGRANGE_ENABLE_CUSTOM_FRAME) |
608 | /* Load the app icon for drawing in the title bar. */ | 608 | /* Load the app icon for drawing in the title bar. */ |
609 | if (prefs_App()->customFrame) { | 609 | if (prefs_App()->customFrame) { |
610 | SDL_Surface *surf = loadImage_(&imageLagrange64_Embedded, appIconSize_Root()); | 610 | SDL_Surface *surf = loadImage_(&imageLagrange64_Resources, appIconSize_Root()); |
611 | SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "0"); | 611 | SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "0"); |
612 | d->appIcon = SDL_CreateTextureFromSurface(d->base.render, surf); | 612 | d->appIcon = SDL_CreateTextureFromSurface(d->base.render, surf); |
613 | free(surf->pixels); | 613 | free(surf->pixels); |