summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--res/about/version.gmi1
-rw-r--r--src/app.c15
-rw-r--r--src/app.h2
-rw-r--r--src/gmdocument.c1
-rw-r--r--src/ui/documentwidget.c21
5 files changed, 23 insertions, 17 deletions
diff --git a/res/about/version.gmi b/res/about/version.gmi
index c2f02074..8523de13 100644
--- a/res/about/version.gmi
+++ b/res/about/version.gmi
@@ -7,6 +7,7 @@
7# Release notes 7# Release notes
8 8
9## 0.3 9## 0.3
10* Added "Open Link in Background Tab" to link context menu.
10* Added tabs in Preferences for better grouping. 11* Added tabs in Preferences for better grouping.
11* Slightly smaller first paragraph font size. 12* Slightly smaller first paragraph font size.
12* Fixed: Centered popups do not remain centered when window is resized. 13* Fixed: Centered popups do not remain centered when window is resized.
diff --git a/src/app.c b/src/app.c
index 8fa16b93..c0c0c47e 100644
--- a/src/app.c
+++ b/src/app.c
@@ -242,7 +242,7 @@ static iBool loadState_App_(iApp *d) {
242 readData_File(f, 4, magic); 242 readData_File(f, 4, magic);
243 if (!memcmp(magic, magicTabDocument_App_, 4)) { 243 if (!memcmp(magic, magicTabDocument_App_, 4)) {
244 if (!doc) { 244 if (!doc) {
245 doc = newTab_App(NULL); 245 doc = newTab_App(NULL, iTrue);
246 } 246 }
247 if (read8_File(f)) { 247 if (read8_File(f)) {
248 current = doc; 248 current = doc;
@@ -711,7 +711,7 @@ iDocumentWidget *document_Command(const char *cmd) {
711 return document_App(); 711 return document_App();
712} 712}
713 713
714iDocumentWidget *newTab_App(const iDocumentWidget *duplicateOf) { 714iDocumentWidget *newTab_App(const iDocumentWidget *duplicateOf, iBool switchToNew) {
715 iApp *d = &app_; 715 iApp *d = &app_;
716 iWidget *tabs = findWidget_App("doctabs"); 716 iWidget *tabs = findWidget_App("doctabs");
717 setFlags_Widget(tabs, hidden_WidgetFlag, iFalse); 717 setFlags_Widget(tabs, hidden_WidgetFlag, iFalse);
@@ -727,7 +727,9 @@ iDocumentWidget *newTab_App(const iDocumentWidget *duplicateOf) {
727 setId_Widget(as_Widget(doc), format_CStr("document%03d", ++d->tabEnum)); 727 setId_Widget(as_Widget(doc), format_CStr("document%03d", ++d->tabEnum));
728 appendTabPage_Widget(tabs, iClob(doc), "", 0, 0); 728 appendTabPage_Widget(tabs, iClob(doc), "", 0, 0);
729 addChild_Widget(findChild_Widget(tabs, "tabs.buttons"), iClob(newTabButton)); 729 addChild_Widget(findChild_Widget(tabs, "tabs.buttons"), iClob(newTabButton));
730 postCommandf_App("tabs.switch page:%p", doc); 730 if (switchToNew) {
731 postCommandf_App("tabs.switch page:%p", doc);
732 }
731 arrange_Widget(tabs); 733 arrange_Widget(tabs);
732 refresh_Widget(tabs); 734 refresh_Widget(tabs);
733 return doc; 735 return doc;
@@ -817,8 +819,9 @@ iBool handleCommand_App(const char *cmd) {
817 return iTrue; 819 return iTrue;
818 } 820 }
819 iDocumentWidget *doc = document_Command(cmd); 821 iDocumentWidget *doc = document_Command(cmd);
820 if (argLabel_Command(cmd, "newtab")) { 822 const int newTab = argLabel_Command(cmd, "newtab");
821 doc = newTab_App(NULL); 823 if (newTab) {
824 doc = newTab_App(NULL, (newTab & 1) != 0); /* newtab:2 to open in background */
822 } 825 }
823 iHistory *history = history_DocumentWidget(doc); 826 iHistory *history = history_DocumentWidget(doc);
824 const iBool isHistory = argLabel_Command(cmd, "history") != 0; 827 const iBool isHistory = argLabel_Command(cmd, "history") != 0;
@@ -853,7 +856,7 @@ iBool handleCommand_App(const char *cmd) {
853 } 856 }
854 else if (equal_Command(cmd, "tabs.new")) { 857 else if (equal_Command(cmd, "tabs.new")) {
855 const iBool isDuplicate = argLabel_Command(cmd, "duplicate") != 0; 858 const iBool isDuplicate = argLabel_Command(cmd, "duplicate") != 0;
856 newTab_App(isDuplicate ? document_App() : NULL); 859 newTab_App(isDuplicate ? document_App() : NULL, iTrue);
857 if (!isDuplicate) { 860 if (!isDuplicate) {
858 postCommand_App("navigate.home"); 861 postCommand_App("navigate.home");
859 } 862 }
diff --git a/src/app.h b/src/app.h
index acc3e952..75d9b48c 100644
--- a/src/app.h
+++ b/src/app.h
@@ -70,7 +70,7 @@ iBookmarks * bookmarks_App (void);
70iDocumentWidget * document_App (void); 70iDocumentWidget * document_App (void);
71iObjectList * listDocuments_App (void); 71iObjectList * listDocuments_App (void);
72iDocumentWidget * document_Command (const char *cmd); 72iDocumentWidget * document_Command (const char *cmd);
73iDocumentWidget * newTab_App (const iDocumentWidget *duplicateOf); 73iDocumentWidget * newTab_App (const iDocumentWidget *duplicateOf, iBool switchToNew);
74 74
75iAny * findWidget_App (const char *id); 75iAny * findWidget_App (const char *id);
76void addTicker_App (void (*ticker)(iAny *), iAny *context); 76void addTicker_App (void (*ticker)(iAny *), iAny *context);
diff --git a/src/gmdocument.c b/src/gmdocument.c
index 4d4ba603..c533a7f4 100644
--- a/src/gmdocument.c
+++ b/src/gmdocument.c
@@ -620,7 +620,6 @@ void init_GmDocument(iGmDocument *d) {
620 init_String(&d->title); 620 init_String(&d->title);
621 init_Array(&d->headings, sizeof(iGmHeading)); 621 init_Array(&d->headings, sizeof(iGmHeading));
622 init_PtrArray(&d->images); 622 init_PtrArray(&d->images);
623 setThemeSeed_GmDocument(d, NULL);
624} 623}
625 624
626void deinit_GmDocument(iGmDocument *d) { 625void deinit_GmDocument(iGmDocument *d) {
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c
index 91b33464..ac37bb01 100644
--- a/src/ui/documentwidget.c
+++ b/src/ui/documentwidget.c
@@ -573,7 +573,9 @@ static void updateDocument_DocumentWidget_(iDocumentWidget *d, const iGmResponse
573 if (category_GmStatusCode(statusCode) != categoryInput_GmStatusCode) { 573 if (category_GmStatusCode(statusCode) != categoryInput_GmStatusCode) {
574 iString str; 574 iString str;
575 invalidate_DocumentWidget_(d); 575 invalidate_DocumentWidget_(d);
576 updateTheme_DocumentWidget_(d); 576 if (document_App() == d) {
577 updateTheme_DocumentWidget_(d);
578 }
577 clear_String(&d->sourceMime); 579 clear_String(&d->sourceMime);
578// set_Block(&d->sourceContent, &response->body); 580// set_Block(&d->sourceContent, &response->body);
579 initBlock_String(&str, &response->body); 581 initBlock_String(&str, &response->body);
@@ -1550,20 +1552,21 @@ static iBool processEvent_DocumentWidget_(iDocumentWidget *d, const SDL_Event *e
1550 iArray items; 1552 iArray items;
1551 init_Array(&items, sizeof(iMenuItem)); 1553 init_Array(&items, sizeof(iMenuItem));
1552 if (d->contextLink) { 1554 if (d->contextLink) {
1555 const iString *linkUrl = linkUrl_GmDocument(d->doc, d->contextLink->linkId);
1553 pushBackN_Array( 1556 pushBackN_Array(
1554 &items, 1557 &items,
1555 (iMenuItem[]){ { "Open Link in New Tab", 1558 (iMenuItem[]){
1559 { "Open Link in New Tab",
1556 0, 1560 0,
1557 0, 1561 0,
1558 format_CStr("!open newtab:1 url:%s", 1562 format_CStr("!open newtab:1 url:%s", cstr_String(linkUrl)) },
1559 cstr_String(linkUrl_GmDocument( 1563 { "Open Link in Background Tab",
1560 d->doc, d->contextLink->linkId))) },
1561 { "---", 0, 0, NULL },
1562 { "Copy Link",
1563 0, 1564 0,
1564 0, 1565 0,
1565 "document.copylink" }}, 1566 format_CStr("!open newtab:2 url:%s", cstr_String(linkUrl)) },
1566 3); 1567 { "---", 0, 0, NULL },
1568 { "Copy Link", 0, 0, "document.copylink" } },
1569 4);
1567 } 1570 }
1568 else { 1571 else {
1569 if (!isEmpty_Range(&d->selectMark)) { 1572 if (!isEmpty_Range(&d->selectMark)) {