diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-05-18 16:54:15 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-05-18 16:54:15 +0300 |
commit | 4b7d2f8978881b8a01f4b37ce33486dfa6484d1c (patch) | |
tree | 13459d6900d5fdd72c299eeee9ac5b29b9c65954 /src/ui | |
parent | f37308c5b89c24a63af7c0aa1194e10cea305653 (diff) |
Mobile: No view split on phone; layout fixes
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/documentwidget.c | 3 | ||||
-rw-r--r-- | src/ui/mobile.c | 18 | ||||
-rw-r--r-- | src/ui/widget.c | 6 | ||||
-rw-r--r-- | src/ui/window.c | 5 |
4 files changed, 24 insertions, 8 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index 9b8340fb..e227bcef 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c | |||
@@ -3053,6 +3053,9 @@ static iBool processEvent_DocumentWidget_(iDocumentWidget *d, const SDL_Event *e | |||
3053 | 0, | 3053 | 0, |
3054 | format_CStr("!open newtab:5 url:%s", cstr_String(linkUrl)) } }, | 3054 | format_CStr("!open newtab:5 url:%s", cstr_String(linkUrl)) } }, |
3055 | 4); | 3055 | 4); |
3056 | if (deviceType_App() == phone_AppDeviceType) { | ||
3057 | removeN_Array(&items, size_Array(&items) - 2, iInvalidSize); | ||
3058 | } | ||
3056 | } | 3059 | } |
3057 | else if (!willUseProxy_App(scheme)) { | 3060 | else if (!willUseProxy_App(scheme)) { |
3058 | pushBack_Array( | 3061 | pushBack_Array( |
diff --git a/src/ui/mobile.c b/src/ui/mobile.c index 1f5e9758..6c3a0b32 100644 --- a/src/ui/mobile.c +++ b/src/ui/mobile.c | |||
@@ -253,7 +253,9 @@ static iAnyObject *addPanelChild_(iWidget *panel, iAnyObject *child, int64_t fla | |||
253 | } | 253 | } |
254 | } | 254 | } |
255 | if ((elementType == toggle_PrefsElement && precedingElementType != toggle_PrefsElement) || | 255 | if ((elementType == toggle_PrefsElement && precedingElementType != toggle_PrefsElement) || |
256 | (elementType == textInput_PrefsElement && precedingElementType != textInput_PrefsElement)) { | 256 | (elementType == textInput_PrefsElement && precedingElementType != textInput_PrefsElement) || |
257 | (elementType == dropdown_PrefsElement && precedingElementType != dropdown_PrefsElement) || | ||
258 | (elementType == radioButton_PrefsElement && precedingElementType == heading_PrefsElement)) { | ||
257 | flags |= borderTop_WidgetFlag; | 259 | flags |= borderTop_WidgetFlag; |
258 | } | 260 | } |
259 | return addChildFlags_Widget(panel, child, flags); | 261 | return addChildFlags_Widget(panel, child, flags); |
@@ -305,6 +307,7 @@ static iWidget *makeValuePadding_(iWidget *value) { | |||
305 | } | 307 | } |
306 | 308 | ||
307 | static iWidget *makeValuePaddingWithHeading_(iLabelWidget *heading, iWidget *value) { | 309 | static iWidget *makeValuePaddingWithHeading_(iLabelWidget *heading, iWidget *value) { |
310 | const iBool isInput = isInstance_Object(value, &Class_InputWidget); | ||
308 | iWidget *div = new_Widget(); | 311 | iWidget *div = new_Widget(); |
309 | setFlags_Widget(div, | 312 | setFlags_Widget(div, |
310 | borderBottom_WidgetFlag | arrangeHeight_WidgetFlag | | 313 | borderBottom_WidgetFlag | arrangeHeight_WidgetFlag | |
@@ -313,10 +316,11 @@ static iWidget *makeValuePaddingWithHeading_(iLabelWidget *heading, iWidget *val | |||
313 | setBackgroundColor_Widget(div, uiBackgroundSidebar_ColorId); | 316 | setBackgroundColor_Widget(div, uiBackgroundSidebar_ColorId); |
314 | setPadding_Widget(div, gap_UI, gap_UI, 4 * gap_UI, gap_UI); | 317 | setPadding_Widget(div, gap_UI, gap_UI, 4 * gap_UI, gap_UI); |
315 | addChildFlags_Widget(div, iClob(heading), 0); | 318 | addChildFlags_Widget(div, iClob(heading), 0); |
319 | setPadding1_Widget(as_Widget(heading), 0); | ||
316 | //setFixedSize_Widget(as_Widget(heading), init_I2(-1, height_Widget(value))); | 320 | //setFixedSize_Widget(as_Widget(heading), init_I2(-1, height_Widget(value))); |
317 | setFont_LabelWidget(heading, labelFont_()); | 321 | setFont_LabelWidget(heading, labelFont_()); |
318 | setTextColor_LabelWidget(heading, uiTextStrong_ColorId); | 322 | setTextColor_LabelWidget(heading, uiTextStrong_ColorId); |
319 | if (isInstance_Object(value, &Class_InputWidget)) { | 323 | if (isInput) { |
320 | addChildFlags_Widget(div, iClob(value), expand_WidgetFlag); | 324 | addChildFlags_Widget(div, iClob(value), expand_WidgetFlag); |
321 | } | 325 | } |
322 | else if (isInstance_Object(value, &Class_LabelWidget) && | 326 | else if (isInstance_Object(value, &Class_LabelWidget) && |
@@ -332,6 +336,7 @@ static iWidget *makeValuePaddingWithHeading_(iLabelWidget *heading, iWidget *val | |||
332 | addChildFlags_Widget(div, iClob(new_Widget()), expand_WidgetFlag); | 336 | addChildFlags_Widget(div, iClob(new_Widget()), expand_WidgetFlag); |
333 | addChild_Widget(div, iClob(value)); | 337 | addChild_Widget(div, iClob(value)); |
334 | } | 338 | } |
339 | printTree_Widget(div); | ||
335 | return div; | 340 | return div; |
336 | } | 341 | } |
337 | 342 | ||
@@ -374,7 +379,9 @@ void finalizeSheet_Mobile(iWidget *sheet) { | |||
374 | postRefresh_App(); | 379 | postRefresh_App(); |
375 | return; | 380 | return; |
376 | } | 381 | } |
377 | /* Landscape Layout Portrait Layout | 382 | /* TODO: In portrait, top panel and detail stack are all stacked together. |
383 | |||
384 | Landscape Layout Portrait Layout | ||
378 | 385 | ||
379 | ┌─────────┬──────Detail─Stack─────┐ ┌─────────┬ ─ ─ ─ ─ ┐ | 386 | ┌─────────┬──────Detail─Stack─────┐ ┌─────────┬ ─ ─ ─ ─ ┐ |
380 | │ │┌───────────────────┐ │ │ │Detail | 387 | │ │┌───────────────────┐ │ │ │Detail |
@@ -616,10 +623,9 @@ void finalizeSheet_Mobile(iWidget *sheet) { | |||
616 | addChild_Widget(topPanel, iClob(makePadding_Widget(lineHeight_Text(labelFont_())))); | 623 | addChild_Widget(topPanel, iClob(makePadding_Widget(lineHeight_Text(labelFont_())))); |
617 | iLabelWidget *aboutButton = addChildFlags_Widget(topPanel, | 624 | iLabelWidget *aboutButton = addChildFlags_Widget(topPanel, |
618 | iClob(makePanelButton_(planet_Icon " ${menu.about}", "panel.open")), | 625 | iClob(makePanelButton_(planet_Icon " ${menu.about}", "panel.open")), |
619 | chevron_WidgetFlag); | 626 | chevron_WidgetFlag | borderTop_WidgetFlag); |
620 | addChildFlags_Widget(topPanel, | 627 | addChildFlags_Widget(topPanel, |
621 | iClob(makePanelButton_(info_Icon " ${menu.help}", "!open url:about:help")), | 628 | iClob(makePanelButton_(info_Icon " ${menu.help}", "!open url:about:help")), 0); |
622 | borderTop_WidgetFlag); | ||
623 | /* The About panel. */ { | 629 | /* The About panel. */ { |
624 | iWidget *panel = addChildPanel_(detailStack, aboutButton, NULL); | 630 | iWidget *panel = addChildPanel_(detailStack, aboutButton, NULL); |
625 | iString *msg = collectNew_String(); | 631 | iString *msg = collectNew_String(); |
diff --git a/src/ui/widget.c b/src/ui/widget.c index 3439fb1b..3ff2e713 100644 --- a/src/ui/widget.c +++ b/src/ui/widget.c | |||
@@ -726,13 +726,15 @@ static void resetArrangement_Widget_(iWidget *d) { | |||
726 | if (d->flags & arrangeHorizontal_WidgetFlag) { | 726 | if (d->flags & arrangeHorizontal_WidgetFlag) { |
727 | child->rect.pos.x = 0; | 727 | child->rect.pos.x = 0; |
728 | } | 728 | } |
729 | if (d->flags & resizeWidthOfChildren_WidgetFlag && child->flags & expand_WidgetFlag) { | 729 | if (d->flags & resizeWidthOfChildren_WidgetFlag && child->flags & expand_WidgetFlag && |
730 | ~child->flags & fixedWidth_WidgetFlag) { | ||
730 | child->rect.size.x = 0; | 731 | child->rect.size.x = 0; |
731 | } | 732 | } |
732 | if (d->flags & arrangeVertical_WidgetFlag) { | 733 | if (d->flags & arrangeVertical_WidgetFlag) { |
733 | child->rect.pos.y = 0; | 734 | child->rect.pos.y = 0; |
734 | } | 735 | } |
735 | if (d->flags & resizeHeightOfChildren_WidgetFlag && child->flags & expand_WidgetFlag) { | 736 | if (d->flags & resizeHeightOfChildren_WidgetFlag && child->flags & expand_WidgetFlag && |
737 | ~child->flags & fixedHeight_WidgetFlag) { | ||
736 | child->rect.size.y = 0; | 738 | child->rect.size.y = 0; |
737 | } | 739 | } |
738 | } | 740 | } |
diff --git a/src/ui/window.c b/src/ui/window.c index 252b3bdb..87db2f3e 100644 --- a/src/ui/window.c +++ b/src/ui/window.c | |||
@@ -1199,6 +1199,11 @@ void swapRoots_Window(iWindow *d) { | |||
1199 | 1199 | ||
1200 | void setSplitMode_Window(iWindow *d, int splitFlags) { | 1200 | void setSplitMode_Window(iWindow *d, int splitFlags) { |
1201 | const int splitMode = splitFlags & mode_WindowSplit; | 1201 | const int splitMode = splitFlags & mode_WindowSplit; |
1202 | if (deviceType_App() == phone_AppDeviceType) { | ||
1203 | /* There isn't enough room on the phone. */ | ||
1204 | /* TODO: Maybe in landscape only? */ | ||
1205 | return; | ||
1206 | } | ||
1202 | iAssert(current_Root() == NULL); | 1207 | iAssert(current_Root() == NULL); |
1203 | if (d->splitMode != splitMode) { | 1208 | if (d->splitMode != splitMode) { |
1204 | int oldCount = numRoots_Window(d); | 1209 | int oldCount = numRoots_Window(d); |