diff --git a/app/src/main/java/io/xpipe/app/comp/base/ModalOverlayComp.java b/app/src/main/java/io/xpipe/app/comp/base/ModalOverlayComp.java index db525cf9c..6c72b9f0f 100644 --- a/app/src/main/java/io/xpipe/app/comp/base/ModalOverlayComp.java +++ b/app/src/main/java/io/xpipe/app/comp/base/ModalOverlayComp.java @@ -11,7 +11,9 @@ import io.xpipe.core.process.OsType; import javafx.animation.*; import javafx.application.Platform; import javafx.beans.binding.Bindings; +import javafx.beans.property.DoubleProperty; import javafx.beans.property.Property; +import javafx.beans.property.SimpleDoubleProperty; import javafx.beans.value.ObservableDoubleValue; import javafx.geometry.Pos; import javafx.scene.control.Button; @@ -183,19 +185,35 @@ public class ModalOverlayComp extends SimpleComp { } if (newValue.getButtons().size() > 0) { + var max = new SimpleDoubleProperty(); var buttonBar = new HBox(); buttonBar.getStyleClass().add("button-bar"); buttonBar.setSpacing(10); buttonBar.setAlignment(Pos.CENTER_RIGHT); for (var o : newValue.getButtons()) { var node = o instanceof ModalButton mb ? toButton(mb) : ((Comp) o).createRegion(); + if (o instanceof ModalButton) { + node.widthProperty().addListener((observable, oldValue, n) -> { + var d = Math.min(Math.max(n.doubleValue(), 70.0), 200.0); + if (d > max.get()) { + max.set(d); + } + }); + } + node.minWidthProperty().bind(max); buttonBar.getChildren().add(node); if (o instanceof ModalButton) { node.prefHeightProperty().bind(buttonBar.heightProperty()); } } content.getChildren().add(buttonBar); - AppFontSizes.base(buttonBar); + AppFontSizes.apply(buttonBar, sizes -> { + if (sizes.getBase().equals("10.5")) { + return sizes.getBase(); + } else { + return sizes.getSm(); + } + }); } var modalBox = new ModalBox(pane, content) { diff --git a/app/src/main/java/io/xpipe/app/comp/base/SideMenuBarComp.java b/app/src/main/java/io/xpipe/app/comp/base/SideMenuBarComp.java index f6f31e20e..1e5d70d39 100644 --- a/app/src/main/java/io/xpipe/app/comp/base/SideMenuBarComp.java +++ b/app/src/main/java/io/xpipe/app/comp/base/SideMenuBarComp.java @@ -123,7 +123,7 @@ public class SideMenuBarComp extends Comp> { .getAccentColor() .desaturate() .desaturate(); - return new Background(new BackgroundFill(c, new CornerRadii(8), new Insets(14, 1, 14, 2))); + return new Background(new BackgroundFill(c, new CornerRadii(8), new Insets(16, 1, 14, 2))); }, Platform.getPreferences().accentColorProperty()); var hoverBorder = Bindings.createObjectBinding( @@ -133,7 +133,7 @@ public class SideMenuBarComp extends Comp> { .darker() .desaturate() .desaturate(); - return new Background(new BackgroundFill(c, new CornerRadii(8), new Insets(14, 1, 14, 2))); + return new Background(new BackgroundFill(c, new CornerRadii(8), new Insets(16, 1, 14, 2))); }, Platform.getPreferences().accentColorProperty()); var noneBorder = Bindings.createObjectBinding( @@ -147,7 +147,9 @@ public class SideMenuBarComp extends Comp> { new StackComp(List.of(indicator, b)).apply(struc -> struc.get().setAlignment(Pos.CENTER_RIGHT)); stack.apply(struc -> { var indicatorRegion = (Region) struc.get().getChildren().getFirst(); + var buttonRegion = (Region) struc.get().getChildren().get(1); indicatorRegion.setMaxWidth(7); + indicatorRegion.prefHeightProperty().bind(buttonRegion.heightProperty()); indicatorRegion .backgroundProperty() .bind(Bindings.createObjectBinding( diff --git a/app/src/main/java/io/xpipe/app/comp/store/StoreChoiceComp.java b/app/src/main/java/io/xpipe/app/comp/store/StoreChoiceComp.java index 3f31ef163..f09ac654a 100644 --- a/app/src/main/java/io/xpipe/app/comp/store/StoreChoiceComp.java +++ b/app/src/main/java/io/xpipe/app/comp/store/StoreChoiceComp.java @@ -96,6 +96,11 @@ public class StoreChoiceComp extends SimpleComp { && (applicableCheck == null || applicableCheck.test(e.ref())); }; + var applicableMatch = StoreViewState.get().getCurrentTopLevelSection().anyMatches(applicable); + if (!applicableMatch) { + selectedCategory.set(initialCategory); + } + var applicableCount = StoreViewState.get().getAllEntries().getList().stream() .filter(applicable) .count(); diff --git a/app/src/main/java/io/xpipe/app/comp/store/StoreCreationComp.java b/app/src/main/java/io/xpipe/app/comp/store/StoreCreationComp.java index 35eb1b859..0bf040bc6 100644 --- a/app/src/main/java/io/xpipe/app/comp/store/StoreCreationComp.java +++ b/app/src/main/java/io/xpipe/app/comp/store/StoreCreationComp.java @@ -7,8 +7,10 @@ import io.xpipe.app.util.*; import javafx.beans.property.*; import javafx.beans.value.ObservableValue; +import javafx.geometry.Insets; import javafx.scene.control.*; import javafx.scene.layout.BorderPane; +import javafx.scene.layout.Priority; import javafx.scene.layout.Region; import javafx.scene.layout.VBox; @@ -76,7 +78,13 @@ public class StoreCreationComp extends ModalOverlayContentComp { var sp = new ScrollPane(valSp); sp.setFitToWidth(true); - layout.setCenter(sp); + var sep = new Separator(); + sep.setPadding(new Insets(0, 0, 0, 0)); + + var vbox = new VBox(sp, sep); + VBox.setVgrow(sp, Priority.ALWAYS); + + layout.setCenter(vbox); model.getValidator() .setValue(new ChainedValidator(List.of( @@ -89,7 +97,7 @@ public class StoreCreationComp extends ModalOverlayContentComp { }); var sep = new Separator(); - sep.getStyleClass().add("spacer"); + sep.setPadding(new Insets(10, 0, 0, 0)); var top = new VBox(providerChoice.createRegion(), sep); top.getStyleClass().add("top"); if (showProviders) { diff --git a/app/src/main/java/io/xpipe/app/comp/store/StoreCreationMenu.java b/app/src/main/java/io/xpipe/app/comp/store/StoreCreationMenu.java index 952e7c77c..4e40c2b31 100644 --- a/app/src/main/java/io/xpipe/app/comp/store/StoreCreationMenu.java +++ b/app/src/main/java/io/xpipe/app/comp/store/StoreCreationMenu.java @@ -4,8 +4,10 @@ import io.xpipe.app.comp.base.PrettyImageHelper; import io.xpipe.app.core.AppI18n; import io.xpipe.app.ext.DataStoreCreationCategory; import io.xpipe.app.ext.DataStoreProviders; +import io.xpipe.app.util.PlatformThread; import io.xpipe.app.util.ScanDialog; +import javafx.application.Platform; import javafx.scene.control.Menu; import javafx.scene.control.MenuButton; import javafx.scene.control.MenuItem; @@ -85,11 +87,16 @@ public class StoreCreationMenu { return; } - StoreCreationDialog.showCreation( - defaultProvider != null - ? DataStoreProviders.byId(defaultProvider).orElseThrow() - : null, - category); + Platform.runLater(() -> { + StoreCreationDialog.showCreation( + defaultProvider != null + ? DataStoreProviders.byId(defaultProvider).orElseThrow() + : null, + category); + }); + + // Fix weird JavaFX NPE + menu.hide(); event.consume(); }); diff --git a/app/src/main/java/io/xpipe/app/comp/store/StoreSection.java b/app/src/main/java/io/xpipe/app/comp/store/StoreSection.java index 2b669798a..f968101d6 100644 --- a/app/src/main/java/io/xpipe/app/comp/store/StoreSection.java +++ b/app/src/main/java/io/xpipe/app/comp/store/StoreSection.java @@ -279,7 +279,7 @@ public class StoreSection { public boolean anyMatches(Predicate c) { return c == null - || c.test(wrapper) + || (wrapper != null && c.test(wrapper)) || allChildren.getList().stream().anyMatch(storeEntrySection -> storeEntrySection.anyMatches(c)); } } diff --git a/version b/version index a92b489a8..2078aa0d1 100644 --- a/version +++ b/version @@ -1 +1 @@ -16.0-22 +16.0-23