summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/app.c2
-rw-r--r--src/ui/documentwidget.c2
-rw-r--r--src/ui/mobile.c13
-rw-r--r--src/ui/mobile.h2
-rw-r--r--src/ui/root.c14
-rw-r--r--src/ui/sidebarwidget.c31
-rw-r--r--src/ui/util.c22
7 files changed, 61 insertions, 25 deletions
diff --git a/src/app.c b/src/app.c
index 160d76f6..8cdb4903 100644
--- a/src/app.c
+++ b/src/app.c
@@ -498,7 +498,7 @@ static iBool loadState_App_(iApp *d) {
498 if (flags & 8) { 498 if (flags & 8) {
499 postCommand_Widget(sidebar2, "feeds.mode arg:%d", unread_FeedsMode); 499 postCommand_Widget(sidebar2, "feeds.mode arg:%d", unread_FeedsMode);
500 } 500 }
501 if (deviceType_App() != phone_AppDeviceType) { 501 if (deviceType_App() == desktop_AppDeviceType) {
502 setWidth_SidebarWidget(sidebar, widths[0]); 502 setWidth_SidebarWidget(sidebar, widths[0]);
503 setWidth_SidebarWidget(sidebar2, widths[1]); 503 setWidth_SidebarWidget(sidebar2, widths[1]);
504 if (flags & 1) postCommand_Root(root, "sidebar.toggle noanim:1"); 504 if (flags & 1) postCommand_Root(root, "sidebar.toggle noanim:1");
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c
index fe2816d2..c8430009 100644
--- a/src/ui/documentwidget.c
+++ b/src/ui/documentwidget.c
@@ -5258,7 +5258,7 @@ static void draw_DocumentWidget_(const iDocumentWidget *d) {
5258 mut->flags &= ~refChildrenOffset_WidgetFlag; 5258 mut->flags &= ~refChildrenOffset_WidgetFlag;
5259 } 5259 }
5260 } 5260 }
5261 drawRect_Paint(&ctx.paint, docBounds, red_ColorId); 5261// drawRect_Paint(&ctx.paint, docBounds, red_ColorId);
5262} 5262}
5263 5263
5264/*----------------------------------------------------------------------------------------------*/ 5264/*----------------------------------------------------------------------------------------------*/
diff --git a/src/ui/mobile.c b/src/ui/mobile.c
index 90dfafde..947c0cbf 100644
--- a/src/ui/mobile.c
+++ b/src/ui/mobile.c
@@ -590,7 +590,8 @@ void makePanelItem_Mobile(iWidget *panel, const iMenuItem *item) {
590 setFlags_Widget(as_Widget(button), fixedWidth_WidgetFlag, iFalse); 590 setFlags_Widget(as_Widget(button), fixedWidth_WidgetFlag, iFalse);
591 } 591 }
592 setId_Widget(as_Widget(button), radId); 592 setId_Widget(as_Widget(button), radId);
593 setFont_LabelWidget(button, isHorizontal ? uiLabelMedium_FontId : uiLabelBig_FontId); 593 setFont_LabelWidget(button, deviceType_App() == phone_AppDeviceType ?
594 (isHorizontal ? uiLabelMedium_FontId : uiLabelBig_FontId) : labelFont_());
594 setCheckMark_LabelWidget(button, !isHorizontal); 595 setCheckMark_LabelWidget(button, !isHorizontal);
595 setPadding_Widget(as_Widget(button), gap_UI, 1 * gap_UI, 0, 1 * gap_UI); 596 setPadding_Widget(as_Widget(button), gap_UI, 1 * gap_UI, 0, 1 * gap_UI);
596 updateSize_LabelWidget(button); 597 updateSize_LabelWidget(button);
@@ -984,3 +985,13 @@ void setupSheetTransition_Mobile(iWidget *sheet, int flags) {
984 } 985 }
985 } 986 }
986} 987}
988
989int bottomSafeInset_Mobile(void) {
990#if defined (iPlatformAppleMobile)
991 float bot;
992 safeAreaInsets_iOS(NULL, NULL, NULL, &bot);
993 return iRound(bot);
994#else
995 return 0;
996#endif
997}
diff --git a/src/ui/mobile.h b/src/ui/mobile.h
index 06955945..54f55fd2 100644
--- a/src/ui/mobile.h
+++ b/src/ui/mobile.h
@@ -56,3 +56,5 @@ enum iTransitionDir {
56 56
57void setupMenuTransition_Mobile (iWidget *menu, iBool isIncoming); 57void setupMenuTransition_Mobile (iWidget *menu, iBool isIncoming);
58void setupSheetTransition_Mobile (iWidget *sheet, int flags); 58void setupSheetTransition_Mobile (iWidget *sheet, int flags);
59
60int bottomSafeInset_Mobile (void);
diff --git a/src/ui/root.c b/src/ui/root.c
index 18a71200..a5dcd46d 100644
--- a/src/ui/root.c
+++ b/src/ui/root.c
@@ -333,6 +333,11 @@ static iBool handleRootCommands_(iWidget *root, const char *cmd) {
333 openMenuFlags_Widget(menu, zero_I2(), postCommands_MenuOpenFlags | center_MenuOpenFlags); 333 openMenuFlags_Widget(menu, zero_I2(), postCommands_MenuOpenFlags | center_MenuOpenFlags);
334 return iTrue; 334 return iTrue;
335 } 335 }
336 else if (deviceType_App() == tablet_AppDeviceType && equal_Command(cmd, "toolbar.showident")) {
337 /* No toolbar on tablet, so we handle this command here. */
338 postCommand_App("preferences idents:1");
339 return iTrue;
340 }
336 else if (equal_Command(cmd, "identmenu.open")) { 341 else if (equal_Command(cmd, "identmenu.open")) {
337 iWidget *toolBar = findWidget_Root("toolbar"); 342 iWidget *toolBar = findWidget_Root("toolbar");
338 iWidget *button = findWidget_Root(toolBar && isPortraitPhone_App() ? "toolbar.ident" : "navbar.ident"); 343 iWidget *button = findWidget_Root(toolBar && isPortraitPhone_App() ? "toolbar.ident" : "navbar.ident");
@@ -486,6 +491,13 @@ static iBool handleRootCommands_(iWidget *root, const char *cmd) {
486 SDL_PushEvent(&(SDL_Event){ .type = SDL_QUIT }); 491 SDL_PushEvent(&(SDL_Event){ .type = SDL_QUIT });
487 return iTrue; 492 return iTrue;
488 } 493 }
494 else if (deviceType_App() == tablet_AppDeviceType && equal_Command(cmd, "window.resized")) {
495 iSidebarWidget *sidebar = findChild_Widget(root, "sidebar");
496 iSidebarWidget *sidebar2 = findChild_Widget(root, "sidebar2");
497 setWidth_SidebarWidget(sidebar, 73.0f);
498 setWidth_SidebarWidget(sidebar2, 73.0f);
499 return iFalse;
500 }
489 else if (deviceType_App() == phone_AppDeviceType && equal_Command(cmd, "window.resized")) { 501 else if (deviceType_App() == phone_AppDeviceType && equal_Command(cmd, "window.resized")) {
490 /* Place the sidebar next to or under doctabs depending on orientation. */ 502 /* Place the sidebar next to or under doctabs depending on orientation. */
491 iSidebarWidget *sidebar = findChild_Widget(root, "sidebar"); 503 iSidebarWidget *sidebar = findChild_Widget(root, "sidebar");
@@ -1056,7 +1068,7 @@ static iBool handleToolBarCommands_(iWidget *toolBar, const char *cmd) {
1056 return iTrue; 1068 return iTrue;
1057 } 1069 }
1058 else if (equal_Command(cmd, "toolbar.showident")) { 1070 else if (equal_Command(cmd, "toolbar.showident")) {
1059 iWidget *sidebar = findWidget_App("sidebar"); 1071 iWidget *sidebar = findWidget_App("sidebar");
1060 if (isVisible_Widget(sidebar)) { 1072 if (isVisible_Widget(sidebar)) {
1061 postCommandf_App("sidebar.toggle"); 1073 postCommandf_App("sidebar.toggle");
1062 } 1074 }
diff --git a/src/ui/sidebarwidget.c b/src/ui/sidebarwidget.c
index d4b1ee20..c7acc0ef 100644
--- a/src/ui/sidebarwidget.c
+++ b/src/ui/sidebarwidget.c
@@ -35,6 +35,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
35#include "inputwidget.h" 35#include "inputwidget.h"
36#include "labelwidget.h" 36#include "labelwidget.h"
37#include "listwidget.h" 37#include "listwidget.h"
38#include "mobile.h"
38#include "keys.h" 39#include "keys.h"
39#include "paint.h" 40#include "paint.h"
40#include "root.h" 41#include "root.h"
@@ -206,6 +207,18 @@ int cmpTree_Bookmark(const iBookmark **a, const iBookmark **b) {
206 return cmpStringCase_String(&bm1->title, &bm2->title); 207 return cmpStringCase_String(&bm1->title, &bm2->title);
207} 208}
208 209
210static enum iFontId actionButtonFont_SidebarWidget_(const iSidebarWidget *d) {
211 switch (deviceType_App()) {
212 default:
213 break;
214 case phone_AppDeviceType:
215 return uiLabelBig_FontId;
216 case tablet_AppDeviceType:
217 return uiLabelMedium_FontId;
218 }
219 return d->buttonFont;
220}
221
209static iLabelWidget *addActionButton_SidebarWidget_(iSidebarWidget *d, const char *label, 222static iLabelWidget *addActionButton_SidebarWidget_(iSidebarWidget *d, const char *label,
210 const char *command, int64_t flags) { 223 const char *command, int64_t flags) {
211 iLabelWidget *btn = addChildFlags_Widget(d->actions, 224 iLabelWidget *btn = addChildFlags_Widget(d->actions,
@@ -213,14 +226,12 @@ static iLabelWidget *addActionButton_SidebarWidget_(iSidebarWidget *d, const cha
213 //(deviceType_App() != desktop_AppDeviceType ? 226 //(deviceType_App() != desktop_AppDeviceType ?
214 // extraPadding_WidgetFlag : 0) | 227 // extraPadding_WidgetFlag : 0) |
215 flags); 228 flags);
216 setFont_LabelWidget(btn, deviceType_App() == desktop_AppDeviceType ? /*deviceType_App() == phone_AppDeviceType && d->side == right_SidebarSide 229 setFont_LabelWidget(btn, actionButtonFont_SidebarWidget_(d));
217 ? uiLabelBig_FontId : */
218 d->buttonFont : uiLabelBig_FontId);
219 checkIcon_LabelWidget(btn); 230 checkIcon_LabelWidget(btn);
220 if (deviceType_App() != desktop_AppDeviceType) { 231 if (deviceType_App() != desktop_AppDeviceType) {
221 setFlags_Widget(as_Widget(btn), frameless_WidgetFlag, iTrue); 232 setFlags_Widget(as_Widget(btn), frameless_WidgetFlag, iTrue);
222 setBackgroundColor_Widget(as_Widget(btn), uiBackground_ColorId);
223 setTextColor_LabelWidget(btn, uiTextAction_ColorId); 233 setTextColor_LabelWidget(btn, uiTextAction_ColorId);
234 setBackgroundColor_Widget(as_Widget(btn), uiBackground_ColorId);
224 } 235 }
225 return btn; 236 return btn;
226} 237}
@@ -886,7 +897,7 @@ void init_SidebarWidget(iSidebarWidget *d, enum iSidebarSide side) {
886 resizeToParentHeight_WidgetFlag | 897 resizeToParentHeight_WidgetFlag |
887 (side == left_SidebarSide ? moveToParentRightEdge_WidgetFlag 898 (side == left_SidebarSide ? moveToParentRightEdge_WidgetFlag
888 : moveToParentLeftEdge_WidgetFlag)); 899 : moveToParentLeftEdge_WidgetFlag));
889 if (deviceType_App() == phone_AppDeviceType) { 900 if (deviceType_App() != desktop_AppDeviceType) {
890 setFlags_Widget(d->resizer, hidden_WidgetFlag | disabled_WidgetFlag, iTrue); 901 setFlags_Widget(d->resizer, hidden_WidgetFlag | disabled_WidgetFlag, iTrue);
891 } 902 }
892 setId_Widget(d->resizer, side == left_SidebarSide ? "sidebar.grab" : "sidebar2.grab"); 903 setId_Widget(d->resizer, side == left_SidebarSide ? "sidebar.grab" : "sidebar2.grab");
@@ -1308,8 +1319,12 @@ static iBool processEvent_SidebarWidget_(iSidebarWidget *d, const SDL_Event *ev)
1308 drawBackgroundToBottom_WidgetFlag, 1319 drawBackgroundToBottom_WidgetFlag,
1309 isPortrait_App()); 1320 isPortrait_App());
1310 setBackgroundColor_Widget(w, isPortrait_App() ? uiBackgroundSidebar_ColorId : none_ColorId); 1321 setBackgroundColor_Widget(w, isPortrait_App() ? uiBackgroundSidebar_ColorId : none_ColorId);
1311 return iFalse;
1312 } 1322 }
1323 if (!isPortraitPhone_App()) {
1324 /* In sliding sheet mode, sidebar is resized to fit in the safe area. */
1325 setPadding_Widget(d->actions, 0, 0, 0, bottomSafeInset_Mobile());
1326 }
1327 return iFalse;
1313 } 1328 }
1314 else if (isMetricsChange_UserEvent(ev)) { 1329 else if (isMetricsChange_UserEvent(ev)) {
1315 if (isVisible_Widget(w)) { 1330 if (isVisible_Widget(w)) {
@@ -1348,10 +1363,6 @@ static iBool processEvent_SidebarWidget_(iSidebarWidget *d, const SDL_Event *ev)
1348 } 1363 }
1349 } 1364 }
1350 } 1365 }
1351// else if (deviceType_App() == tablet_AppDeviceType && equal_Command(cmd, "toolbar.showident")) {
1352// postCommandf_App("sidebar.mode arg:%d toggle:1", identities_SidebarMode);
1353// return iTrue;
1354// }
1355 else if (isPortraitPhone_App() && isVisible_Widget(w) && d->side == left_SidebarSide && 1366 else if (isPortraitPhone_App() && isVisible_Widget(w) && d->side == left_SidebarSide &&
1356 equal_Command(cmd, "swipe.forward")) { 1367 equal_Command(cmd, "swipe.forward")) {
1357 postCommand_App("sidebar.toggle"); 1368 postCommand_App("sidebar.toggle");
diff --git a/src/ui/util.c b/src/ui/util.c
index 8aedef99..9576f5e2 100644
--- a/src/ui/util.c
+++ b/src/ui/util.c
@@ -924,17 +924,17 @@ static void updateMenuItemFonts_Widget_(iWidget *d) {
924 if (isWrapped_LabelWidget(label)) { 924 if (isWrapped_LabelWidget(label)) {
925 continue; 925 continue;
926 } 926 }
927 if (deviceType_App() == desktop_AppDeviceType) { 927 switch (deviceType_App()) {
928 setFont_LabelWidget(label, isCaution ? uiLabelBold_FontId : uiLabel_FontId); 928 case desktop_AppDeviceType:
929 setFont_LabelWidget(label, isCaution ? uiLabelBold_FontId : uiLabel_FontId);
930 break;
931 case tablet_AppDeviceType:
932 setFont_LabelWidget(label, isCaution ? uiLabelMediumBold_FontId : uiLabelMedium_FontId);
933 break;
934 case phone_AppDeviceType:
935 setFont_LabelWidget(label, isCaution ? uiLabelBigBold_FontId : uiLabelBig_FontId);
936 break;
929 } 937 }
930 else { //if (isPortraitPhone) {
931 //if (!isSlidePanel) {
932 setFont_LabelWidget(label, isCaution ? uiLabelBigBold_FontId : uiLabelBig_FontId);
933 // }
934 }
935// else {
936// setFont_LabelWidget(label, isCaution ? uiContentBold_FontId : uiContent_FontId);
937// }
938 } 938 }
939 else if (childCount_Widget(i.object)) { 939 else if (childCount_Widget(i.object)) {
940 updateMenuItemFonts_Widget_(i.object); 940 updateMenuItemFonts_Widget_(i.object);
@@ -1734,7 +1734,7 @@ iWidget *makeDialogButtons_Widget(const iMenuItem *actions, size_t numActions) {
1734 addChildFlags_Widget(div, iClob(new_Widget()), expand_WidgetFlag); 1734 addChildFlags_Widget(div, iClob(new_Widget()), expand_WidgetFlag);
1735 } 1735 }
1736 int fonts[2] = { uiLabel_FontId, uiLabelBold_FontId }; 1736 int fonts[2] = { uiLabel_FontId, uiLabelBold_FontId };
1737 if (deviceType_App() == phone_AppDeviceType) { 1737 if (deviceType_App() != desktop_AppDeviceType) {
1738 fonts[0] = uiLabelBig_FontId; 1738 fonts[0] = uiLabelBig_FontId;
1739 fonts[1] = uiLabelBigBold_FontId; 1739 fonts[1] = uiLabelBigBold_FontId;
1740 } 1740 }