Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions HMCL/src/main/java/com/jfoenix/skins/JFXCheckBoxSkin.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public JFXCheckBoxSkin(JFXCheckBox control) {
this.box.setMinSize(18.0, 18.0);
this.box.setPrefSize(18.0, 18.0);
this.box.setMaxSize(18.0, 18.0);
this.box.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, new CornerRadii(2.0), Insets.EMPTY)));
this.box.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, new CornerRadii(3.0), Insets.EMPTY)));
this.box.setBorder(new Border(new BorderStroke(Themes.getColorScheme().getOnSurfaceVariant(), BorderStrokeStyle.SOLID, new CornerRadii(2.0), new BorderWidths(this.lineThick))));
StackPane boxContainer = new StackPane();
boxContainer.getChildren().add(this.box);
Expand All @@ -65,7 +65,7 @@ public JFXCheckBoxSkin(JFXCheckBox control) {
SVGPath shape = new SVGPath();
shape.setContent("M384 690l452-452 60 60-512 512-238-238 60-60z");
this.mark.setShape(shape);
this.mark.setMaxSize(15.0, 12.0);
this.mark.setMaxSize(14.0, 12.0);
this.mark.setStyle("-fx-background-color:-monet-on-primary; -fx-border-color:-monet-on-primary; -fx-border-width:2px;");
this.mark.setVisible(false);
this.mark.setScaleX(0.0);
Expand Down
4 changes: 2 additions & 2 deletions HMCL/src/main/java/org/jackhuang/hmcl/ui/Controllers.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ public final class Controllers {
public static final String JAVA_INTERPRETED_MODE_TIP = "javaInterpretedMode";
public static final String SOFTWARE_RENDERING = "softwareRendering";

public static final int MIN_WIDTH = 800 + 2 + 16; // bg width + border width*2 + shadow width*2
public static final int MIN_HEIGHT = 450 + 2 + 40 + 16; // bg height + border width*2 + toolbar height + shadow width*2
public static final int MIN_WIDTH = 880 + 2 + 16; // bg width + border width*2 + shadow width*2
public static final int MIN_HEIGHT = 495 + 2 + 40 + 16; // bg height + border width*2 + toolbar height + shadow width*2
public static final Screen SCREEN = Screen.getPrimary();
private static InvalidationListener stageSizeChangeListener;
private static DoubleProperty stageX = new SimpleDoubleProperty();
Expand Down
7 changes: 7 additions & 0 deletions HMCL/src/main/java/org/jackhuang/hmcl/ui/FXUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -1286,6 +1286,13 @@ public static JFXButton newRaisedButton(String text) {
return button;
}

public static JFXButton newRaisedButtonLarge(String text) {
JFXButton button = new JFXButton(text);
button.getStyleClass().add("jfx-button-raised-large");
button.setButtonType(JFXButton.ButtonType.RAISED);
return button;
}

public static JFXButton newBorderButton(String text) {
JFXButton button = new JFXButton(text);
button.getStyleClass().add("jfx-button-border");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@
import javafx.event.Event;
import javafx.event.EventHandler;
import javafx.event.EventType;
import javafx.geometry.Insets;
import javafx.scene.Node;
import javafx.scene.layout.Region;
import javafx.scene.layout.StackPane;
import javafx.util.Duration;
import org.jackhuang.hmcl.ui.FXUtils;
import org.jackhuang.hmcl.ui.animation.ContainerAnimations;
Expand All @@ -47,6 +49,11 @@ public class Navigator extends TransitionPane {
private final Stack<Node> stack = new Stack<>();
private boolean initialized = false;

{
StackPane.setMargin(this, new Insets(6, 8, 8, 8));
getStyleClass().add("radius-6");
}

public void init(Node init) {
stack.push(init);
backable.set(canGoBack());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/
package org.jackhuang.hmcl.ui.decorator;

import javafx.geometry.Insets;
import javafx.scene.Node;
import javafx.scene.control.Control;
import javafx.scene.control.Skin;
Expand All @@ -32,7 +33,7 @@ public class DecoratorAnimatedPage extends Control {
protected final StackPane center = new StackPane();

{
getStyleClass().add("gray-background");
getStyleClass().add("transparent-background");
}

protected void setLeft(Node... children) {
Expand Down Expand Up @@ -62,9 +63,15 @@ protected DecoratorAnimatedPageSkin(T control) {
super(control);

BorderPane pane = new BorderPane();

control.left.getStyleClass().addAll("radius-6", "gray-background");
pane.setLeft(control.left);
BorderPane.setMargin(control.left, new Insets(0, 4, 0, 0));
FXUtils.setLimitWidth(control.left, 200);

control.center.getStyleClass().addAll("radius-6", "gray-background");
pane.setCenter(control.center);
BorderPane.setMargin(control.center, new Insets(0, 0, 0, 4));
getChildren().setAll(pane);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,21 +177,17 @@ public DecoratorSkin(Decorator control) {

titleContainer = new StackPane();
titleContainer.setPickOnBounds(false);
titleContainer.getStyleClass().addAll("jfx-tool-bar");
titleContainer.getStyleClass().addAll("jfx-tool-bar", "radius-6");
BorderPane.setMargin(titleContainer, new Insets(8, 8, 0, 8));

// Maybe, we can automatically identify whether the top part of the picture is light-coloured or dark when the title is transparent,
// and decide whether the whole top bar should be rendered in white or black. TODO
wrapper.backgroundProperty().bind(skinnable.contentBackgroundProperty());
FXUtils.onChangeAndOperate(skinnable.titleTransparentProperty(), titleTransparent -> {
if (titleTransparent) {
wrapper.backgroundProperty().bind(skinnable.contentBackgroundProperty());
container.backgroundProperty().unbind();
container.setBackground(null);
titleContainer.getStyleClass().remove("background");
titleContainer.getStyleClass().add("gray-background");
} else {
container.backgroundProperty().bind(skinnable.contentBackgroundProperty());
wrapper.backgroundProperty().unbind();
wrapper.setBackground(null);
titleContainer.getStyleClass().add("background");
titleContainer.getStyleClass().remove("gray-background");
}
Expand Down Expand Up @@ -254,6 +250,7 @@ public DecoratorSkin(Decorator control) {
AnchorPane layer = new AnchorPane();
layer.setPickOnBounds(false);
layer.getChildren().add(buttonsContainer);
StackPane.setMargin(layer, new Insets(8, 8, 0, 0));
AnchorPane.setTopAnchor(buttonsContainer, 0.0);
AnchorPane.setRightAnchor(buttonsContainer, 0.0);
buttonsContainerPlaceHolder.widthProperty().bind(buttonsContainer.widthProperty());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ public ModpackFileSelectionPage(WizardController controller, Profile profile, St
nextPane.setPadding(new Insets(16, 16, 16, 0));
nextPane.setAlignment(Pos.CENTER_RIGHT);
{
JFXButton btnNext = FXUtils.newRaisedButton(i18n("wizard.next"));
btnNext.setPrefSize(100, 40);
JFXButton btnNext = FXUtils.newRaisedButtonLarge(i18n("wizard.next"));
btnNext.setOnAction(e -> onNext());

nextPane.getChildren().setAll(btnNext);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -419,10 +419,8 @@ public ModpackInfoPageSkin(ModpackInfoPage skinnable) {
hbox.setAlignment(Pos.CENTER_RIGHT);
borderPane.setBottom(hbox);

JFXButton nextButton = FXUtils.newRaisedButton(i18n("wizard.next"));
JFXButton nextButton = FXUtils.newRaisedButtonLarge(i18n("wizard.next"));
nextButton.setOnAction(e -> skinnable.onNext());
nextButton.setPrefWidth(100);
nextButton.setPrefHeight(40);
nextButton.disableProperty().bind(
// Disable nextButton if any text of JFXTextFields in validatingFields does not fulfill
// our requirement.
Expand Down
3 changes: 2 additions & 1 deletion HMCL/src/main/java/org/jackhuang/hmcl/ui/main/MainPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public final class MainPage extends StackPane implements DecoratorPage {
announcementPane = new TransitionPane();
announcementPane.setContent(announcementBox, ContainerAnimations.NONE);

StackPane.setMargin(announcementPane, new Insets(-15));
StackPane.setMargin(announcementPane, new Insets(-35));
getChildren().add(announcementPane);
}

Expand Down Expand Up @@ -199,6 +199,7 @@ public final class MainPage extends StackPane implements DecoratorPage {
}

HBox launchPane = new HBox();
launchPane.setSpacing(3);
launchPane.getStyleClass().add("launch-pane");
FXUtils.onScroll(launchPane, versions, list -> {
String currentId = getCurrentGame();
Expand Down
5 changes: 2 additions & 3 deletions HMCL/src/main/java/org/jackhuang/hmcl/ui/main/RootPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,6 @@ public RootPage() {
Profile profile = Profiles.getSelectedProfile();
if (profile != null && profile.getRepository().isLoaded())
onRefreshedVersions(Profiles.selectedProfileProperty().get().getRepository());

getStyleClass().remove("gray-background");
getLeft().getStyleClass().add("gray-background");
}

@Override
Expand Down Expand Up @@ -247,6 +244,8 @@ else if (Platform.SYSTEM_PLATFORM.equals(OperatingSystem.LINUX, Architecture.LOO
// the root page, with the sidebar in left, navigator in center.
setLeft(sideBar);
setCenter(getSkinnable().getMainPage());

getSkinnable().getCenter().getStyleClass().remove("gray-background");
}

public void showGameListPopupMenu(AdvancedListItem gameListItem) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,19 +203,14 @@ protected ModDownloadPageSkin(DownloadPage control) {
super(control);

VBox pane = new VBox(8);
pane.getStyleClass().add("gray-background");
pane.getStyleClass().addAll("gray-background", "radius-6");
pane.setPadding(new Insets(10));
ScrollPane scrollPane = new ScrollPane(pane);
FXUtils.smoothScrolling(scrollPane);
scrollPane.setFitToWidth(true);
scrollPane.setFitToHeight(true);

HBox descriptionPane = new HBox(8);
descriptionPane.setMinHeight(Region.USE_PREF_SIZE);
descriptionPane.setAlignment(Pos.CENTER);
pane.getChildren().add(descriptionPane);
descriptionPane.getStyleClass().add("card-non-transparent");
BorderPane.setMargin(descriptionPane, new Insets(11, 11, 0, 11));
{
ImageView imageView = new ImageView();
imageView.setFitWidth(40);
Expand Down Expand Up @@ -266,8 +261,12 @@ protected ModDownloadPageSkin(DownloadPage control) {
spinnerPane.setOnFailedAction(e -> getSkinnable().loadModVersions());

ComponentList list = new ComponentList();
StackPane.setAlignment(list, Pos.TOP_CENTER);
spinnerPane.setContent(list);
ScrollPane scrollPane = new ScrollPane(list);
FXUtils.smoothScrolling(scrollPane);
scrollPane.setFitToWidth(true);
scrollPane.setFitToHeight(true);
StackPane.setAlignment(scrollPane, Pos.TOP_CENTER);
spinnerPane.setContent(scrollPane);

FXUtils.onChangeAndOperate(control.loaded, loaded -> {
if (control.versions == null) return;
Expand Down Expand Up @@ -321,7 +320,7 @@ protected ModDownloadPageSkin(DownloadPage control) {
});
}

getChildren().setAll(scrollPane);
getChildren().setAll(pane);
}
}

Expand Down
Loading