summaryrefslogtreecommitdiff
path: root/src/ui/documentwidget.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/documentwidget.c')
-rw-r--r--src/ui/documentwidget.c80
1 files changed, 77 insertions, 3 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c
index f354623e..c8aad02b 100644
--- a/src/ui/documentwidget.c
+++ b/src/ui/documentwidget.c
@@ -1222,15 +1222,89 @@ static void postProcessRequestContent_DocumentWidget_(iDocumentWidget *d, iBool
1222 } 1222 }
1223 if (d->sourceGempub) { 1223 if (d->sourceGempub) {
1224 if (equal_String(d->mod.url, coverPageUrl_Gempub(d->sourceGempub))) { 1224 if (equal_String(d->mod.url, coverPageUrl_Gempub(d->sourceGempub))) {
1225 makeFooterButtons_DocumentWidget_(d, (iMenuItem[]){ 1225 if (equalCase_Rangecc(urlScheme_String(d->mod.url), "file")) {
1226 { "Gempub Cover Page", 0, 0, NULL } 1226 iArray *items = collectNew_Array(sizeof(iMenuItem));
1227 }, 1); 1227 pushBack_Array(
1228 items,
1229 &(iMenuItem){ book_Icon " ${gempub.cover.view}",
1230 0,
1231 0,
1232 format_CStr("!open url:%s",
1233 cstr_String(indexPageUrl_Gempub(d->sourceGempub))) });
1234 if (navSize_Gempub(d->sourceGempub) > 0) {
1235 pushBack_Array(
1236 items,
1237 &(iMenuItem){
1238 format_CStr(forwardArrow_Icon " %s",
1239 cstr_String(navLinkLabel_Gempub(d->sourceGempub, 0))),
1240 SDLK_RIGHT,
1241 0,
1242 format_CStr("!open url:%s",
1243 cstr_String(navLinkUrl_Gempub(d->sourceGempub, 0))) });
1244 }
1245 makeFooterButtons_DocumentWidget_(d, constData_Array(items), size_Array(items));
1246 }
1228 if (preloadCoverImage_Gempub(d->sourceGempub, d->doc)) { 1247 if (preloadCoverImage_Gempub(d->sourceGempub, d->doc)) {
1229 redoLayout_GmDocument(d->doc); 1248 redoLayout_GmDocument(d->doc);
1230 updateVisible_DocumentWidget_(d); 1249 updateVisible_DocumentWidget_(d);
1231 invalidate_DocumentWidget_(d); 1250 invalidate_DocumentWidget_(d);
1232 } 1251 }
1233 } 1252 }
1253 else if (equal_String(d->mod.url, indexPageUrl_Gempub(d->sourceGempub))) {
1254 makeFooterButtons_DocumentWidget_(
1255 d,
1256 (iMenuItem[]){ { format_CStr(book_Icon " %s",
1257 cstr_String(property_Gempub(d->sourceGempub,
1258 title_GempubProperty))),
1259 SDLK_LEFT,
1260 0,
1261 format_CStr("!open url:%s",
1262 cstr_String(coverPageUrl_Gempub(d->sourceGempub))) } },
1263 1);
1264 }
1265 else {
1266 /* Navigation buttons. */
1267 iArray *items = collectNew_Array(sizeof(iMenuItem));
1268 const size_t navIndex = navIndex_Gempub(d->sourceGempub, d->mod.url);
1269 if (navIndex != iInvalidPos) {
1270 if (navIndex < navSize_Gempub(d->sourceGempub) - 1) {
1271 pushBack_Array(
1272 items,
1273 &(iMenuItem){
1274 format_CStr(forwardArrow_Icon " %s",
1275 cstr_String(navLinkLabel_Gempub(d->sourceGempub, navIndex + 1))),
1276 SDLK_RIGHT,
1277 0,
1278 format_CStr("!open url:%s",
1279 cstr_String(navLinkUrl_Gempub(d->sourceGempub, navIndex + 1))) });
1280 }
1281 if (navIndex > 0) {
1282 pushBack_Array(
1283 items,
1284 &(iMenuItem){
1285 format_CStr(backArrow_Icon " %s",
1286 cstr_String(navLinkLabel_Gempub(d->sourceGempub, navIndex - 1))),
1287 SDLK_LEFT,
1288 0,
1289 format_CStr("!open url:%s",
1290 cstr_String(navLinkUrl_Gempub(d->sourceGempub, navIndex - 1))) });
1291 }
1292 else if (!equalCase_String(d->mod.url, indexPageUrl_Gempub(d->sourceGempub))) {
1293 pushBack_Array(
1294 items,
1295 &(iMenuItem){
1296 format_CStr(book_Icon " %s",
1297 cstr_String(property_Gempub(d->sourceGempub, title_GempubProperty))),
1298 SDLK_LEFT,
1299 0,
1300 format_CStr("!open url:%s",
1301 cstr_String(coverPageUrl_Gempub(d->sourceGempub))) });
1302 }
1303 }
1304 if (!isEmpty_Array(items)) {
1305 makeFooterButtons_DocumentWidget_(d, constData_Array(items), size_Array(items));
1306 }
1307 }
1234 if (!isCached && prefs_App()->pinSplit && 1308 if (!isCached && prefs_App()->pinSplit &&
1235 equal_String(d->mod.url, indexPageUrl_Gempub(d->sourceGempub))) { 1309 equal_String(d->mod.url, indexPageUrl_Gempub(d->sourceGempub))) {
1236 const iString *navStart = navStartLinkUrl_Gempub(d->sourceGempub); 1310 const iString *navStart = navStartLinkUrl_Gempub(d->sourceGempub);