Optimize GUI to work with big font sizes

This commit is contained in:
0xb00bface 2021-08-21 20:16:38 +02:00
parent 1e9867cc88
commit 50d1725e59
6 changed files with 42 additions and 36 deletions

View File

@ -28,12 +28,10 @@ public class ColorSettingsPane extends HBox {
baseColor.setValue(Color.web(config.getSettings().colorBase)); baseColor.setValue(Color.web(config.getSettings().colorBase));
baseColor.setTooltip(new Tooltip("Base Color")); baseColor.setTooltip(new Tooltip("Base Color"));
baseColor.setMaxSize(44, 25); baseColor.setPrefWidth(100);
accentColor.setValue(Color.web(config.getSettings().colorAccent)); accentColor.setValue(Color.web(config.getSettings().colorAccent));
accentColor.setTooltip(new Tooltip("Accent Color")); accentColor.setTooltip(new Tooltip("Accent Color"));
accentColor.setMaxSize(44, 25); accentColor.setPrefWidth(100);
reset.setMinSize(60, 25);
reset.setMaxSize(60, 25);
baseColor.setOnAction(evt -> { baseColor.setOnAction(evt -> {
config.getSettings().colorBase = toWeb(baseColor.getValue()); config.getSettings().colorBase = toWeb(baseColor.getValue());

View File

@ -20,6 +20,7 @@ import ctbrec.ui.controls.Dialogs;
import javafx.collections.FXCollections; import javafx.collections.FXCollections;
import javafx.collections.ListChangeListener; import javafx.collections.ListChangeListener;
import javafx.collections.ObservableList; import javafx.collections.ObservableList;
import javafx.geometry.Insets;
import javafx.scene.control.Button; import javafx.scene.control.Button;
import javafx.scene.control.ChoiceDialog; import javafx.scene.control.ChoiceDialog;
import javafx.scene.control.ListView; import javafx.scene.control.ListView;
@ -82,6 +83,7 @@ public class PostProcessingStepPanel extends GridPane {
}); });
stepListView = new ListView<>(stepList); stepListView = new ListView<>(stepList);
GridPane.setHgrow(stepListView, Priority.ALWAYS); GridPane.setHgrow(stepListView, Priority.ALWAYS);
GridPane.setFillWidth(stepListView, true);
add(stepListView, 0, 0); add(stepListView, 0, 0);
add(buttons, 1, 0); add(buttons, 1, 0);
@ -94,6 +96,8 @@ public class PostProcessingStepPanel extends GridPane {
edit.setDisable(noSelection); edit.setDisable(noSelection);
remove.setDisable(noSelection); remove.setDisable(noSelection);
}); });
setPadding(new Insets(10));
} }
private Button createUpButton() { private Button createUpButton() {

View File

@ -55,7 +55,6 @@ import javafx.geometry.Pos;
import javafx.scene.Node; import javafx.scene.Node;
import javafx.scene.control.Button; import javafx.scene.control.Button;
import javafx.scene.control.Label; import javafx.scene.control.Label;
import javafx.scene.control.ScrollPane;
import javafx.scene.control.Tab; import javafx.scene.control.Tab;
import javafx.scene.control.TextInputDialog; import javafx.scene.control.TextInputDialog;
import javafx.scene.layout.Background; import javafx.scene.layout.Background;
@ -66,7 +65,6 @@ import javafx.scene.layout.BorderStrokeStyle;
import javafx.scene.layout.BorderWidths; import javafx.scene.layout.BorderWidths;
import javafx.scene.layout.CornerRadii; import javafx.scene.layout.CornerRadii;
import javafx.scene.layout.GridPane; import javafx.scene.layout.GridPane;
import javafx.scene.layout.Priority;
import javafx.scene.layout.Region; import javafx.scene.layout.Region;
import javafx.scene.layout.StackPane; import javafx.scene.layout.StackPane;
import javafx.scene.paint.Color; import javafx.scene.paint.Color;
@ -302,18 +300,9 @@ public class SettingsTab extends Tab implements TabSelectionListener {
Region preferencesView = prefs.getView(); Region preferencesView = prefs.getView();
prefs.onRestartRequired(this::showRestartRequired); prefs.onRestartRequired(this::showRestartRequired);
storage.setPreferences(prefs); storage.setPreferences(prefs);
preferencesView.setMinSize(800, 400);
preferencesView.setPrefSize(1280, 960);
var scrollPane = new ScrollPane(preferencesView);
var container = new GridPane();
container.add(scrollPane, 0, 0);
GridPane.setFillWidth(scrollPane, true);
GridPane.setFillHeight(scrollPane, true);
GridPane.setHgrow(scrollPane, Priority.ALWAYS);
GridPane.setVgrow(scrollPane, Priority.ALWAYS);
var stackPane = new StackPane(); var stackPane = new StackPane();
stackPane.getChildren().add(container); stackPane.getChildren().add(preferencesView);
restartNotification = new Label("Restart Required"); restartNotification = new Label("Restart Required");
restartNotification.setVisible(false); restartNotification.setVisible(false);
restartNotification.setOpacity(0); restartNotification.setOpacity(0);

View File

@ -16,6 +16,8 @@ import javafx.geometry.Insets;
import javafx.geometry.VPos; import javafx.geometry.VPos;
import javafx.scene.Node; import javafx.scene.Node;
import javafx.scene.control.Label; import javafx.scene.control.Label;
import javafx.scene.control.ScrollPane;
import javafx.scene.control.ScrollPane.ScrollBarPolicy;
import javafx.scene.control.Tooltip; import javafx.scene.control.Tooltip;
import javafx.scene.control.TreeItem; import javafx.scene.control.TreeItem;
import javafx.scene.control.TreeView; import javafx.scene.control.TreeView;
@ -88,13 +90,16 @@ public class Preferences {
} }
main.setCenter(new Label("Center")); main.setCenter(new Label("Center"));
BorderPane.setMargin(leftSide, new Insets(2)); BorderPane.setMargin(leftSide, new Insets(2));
categoryTree.getSelectionModel().selectedItemProperty().addListener((obs, oldV, newV) -> { categoryTree.getSelectionModel().selectedItemProperty().addListener((obs, oldV, newV) -> {
if (newV != null) { if (newV != null) {
Category cat = newV.getValue(); Category cat = newV.getValue();
Node gui = cat.getGuiOrElse(() -> createGui(cat)); Node gui = cat.getGuiOrElse(() -> createGui(cat));
BorderPane.setMargin(gui, new Insets(10)); ScrollPane scrollPane = new ScrollPane(gui);
main.setCenter(gui); scrollPane.setPadding(new Insets(20));
scrollPane.setHbarPolicy(ScrollBarPolicy.NEVER);
scrollPane.setFitToWidth(true);
scrollPane.setFitToHeight(true);
main.setCenter(scrollPane);
} }
}); });
categoryTree.getSelectionModel().select(0); categoryTree.getSelectionModel().select(0);

View File

@ -1,4 +1,7 @@
.selection-background { .thumbcell-selection-background {
/*-fx-fill: #0096C9;*/
-fx-fill: -fx-accent; -fx-fill: -fx-accent;
} }
.thumbcell-name {
-fx-font: normal bold 1.2em 'sans-serif';
}

View File

@ -97,8 +97,8 @@ public class ThumbCell extends StackPane {
private RecordingIndicator recordingIndicator; private RecordingIndicator recordingIndicator;
private Tooltip recordingIndicatorTooltip; private Tooltip recordingIndicatorTooltip;
private StackPane previewTrigger; private StackPane previewTrigger;
private StackPane groupIndicator;
private Label groupIndicatorTooltipTrigger; private Label groupIndicatorTooltipTrigger;
private ImageView groupIndicator;
private int index = 0; private int index = 0;
ContextMenu popup; ContextMenu popup;
private static final Color colorNormal = Color.BLACK; private static final Color colorNormal = Color.BLACK;
@ -138,7 +138,6 @@ public class ThumbCell extends StackPane {
iv.setPreserveRatio(true); iv.setPreserveRatio(true);
getChildren().add(iv); getChildren().add(iv);
topicBackground = new Rectangle(); topicBackground = new Rectangle();
topicBackground.setFill(Color.BLACK); topicBackground.setFill(Color.BLACK);
topicBackground.setOpacity(0); topicBackground.setOpacity(0);
@ -154,7 +153,6 @@ public class ThumbCell extends StackPane {
StackPane.setMargin(resolutionBackground, new Insets(2)); StackPane.setMargin(resolutionBackground, new Insets(2));
getChildren().add(resolutionBackground); getChildren().add(resolutionBackground);
topic = new Text(); topic = new Text();
String txt = recording ? " " : ""; String txt = recording ? " " : "";
txt += model.getDescription(); txt += model.getDescription();
@ -177,7 +175,7 @@ public class ThumbCell extends StackPane {
name = new Text(model.getDisplayName()); name = new Text(model.getDisplayName());
name.setFill(Color.WHITE); name.setFill(Color.WHITE);
name.setTextAlignment(TextAlignment.CENTER); name.setTextAlignment(TextAlignment.CENTER);
name.prefHeight(25); name.getStyleClass().add("thumbcell-name");
StackPane.setAlignment(name, Pos.BOTTOM_CENTER); StackPane.setAlignment(name, Pos.BOTTOM_CENTER);
getChildren().add(name); getChildren().add(name);
@ -197,20 +195,23 @@ public class ThumbCell extends StackPane {
StackPane.setAlignment(recordingIndicator, Pos.TOP_LEFT); StackPane.setAlignment(recordingIndicator, Pos.TOP_LEFT);
getChildren().add(recordingIndicator); getChildren().add(recordingIndicator);
groupIndicator = new ImageView(imgGroupIndicator); groupIndicator = new StackPane();
groupIndicator.setVisible(false); groupIndicator.setMaxSize(24, 24);
var groupIndicatorImg = new ImageView(imgGroupIndicator);
groupIndicatorImg.setVisible(false);
groupIndicatorImg.visibleProperty().bind(groupIndicator.visibleProperty());
groupIndicatorTooltipTrigger = new Label(); groupIndicatorTooltipTrigger = new Label();
groupIndicatorTooltipTrigger.setPrefSize(16, 16); groupIndicatorTooltipTrigger.setPrefSize(16, 16);
groupIndicatorTooltipTrigger.setMinSize(16, 16); groupIndicatorTooltipTrigger.setMinSize(16, 16);
groupIndicatorTooltipTrigger.visibleProperty().bind(groupIndicator.visibleProperty()); groupIndicatorTooltipTrigger.visibleProperty().bind(groupIndicator.visibleProperty());
groupIndicatorTooltipTrigger.setCursor(Cursor.HAND); groupIndicatorTooltipTrigger.setCursor(Cursor.HAND);
groupIndicatorTooltipTrigger.setOnMouseClicked(e -> new EditGroupAction(this, recorder, model).execute()); groupIndicatorTooltipTrigger.setOnMouseClicked(e -> new EditGroupAction(this, recorder, model).execute());
StackPane.setMargin(groupIndicatorTooltipTrigger, new Insets(0, 3, 23, 0)); var groupIndicatorBackground = new Circle(12, Color.WHITE);
StackPane.setAlignment(groupIndicatorTooltipTrigger, Pos.BOTTOM_RIGHT); groupIndicatorBackground.visibleProperty().bind(groupIndicator.visibleProperty());
StackPane.setMargin(groupIndicator, new Insets(0, 3, 23, 0)); groupIndicatorBackground.setOpacity(0.7);
groupIndicator.getChildren().addAll(groupIndicatorBackground, groupIndicatorImg, groupIndicatorTooltipTrigger);
StackPane.setAlignment(groupIndicator, Pos.BOTTOM_RIGHT); StackPane.setAlignment(groupIndicator, Pos.BOTTOM_RIGHT);
getChildren().add(groupIndicator); getChildren().add(groupIndicator);
getChildren().add(groupIndicatorTooltipTrigger);
if (Config.getInstance().getSettings().livePreviews) { if (Config.getInstance().getSettings().livePreviews) {
getChildren().add(createPreviewTrigger()); getChildren().add(createPreviewTrigger());
@ -267,7 +268,7 @@ public class ThumbCell extends StackPane {
} }
private Node createPreviewTrigger() { private Node createPreviewTrigger() {
var s = 32; var s = 24;
previewTrigger = new StackPane(); previewTrigger = new StackPane();
previewTrigger.setStyle("-fx-background-color: white;"); previewTrigger.setStyle("-fx-background-color: white;");
previewTrigger.setOpacity(.8); previewTrigger.setOpacity(.8);
@ -338,9 +339,9 @@ public class ThumbCell extends StackPane {
selectionProperty.set(selected); selectionProperty.set(selected);
selectionOverlay.setOpacity(selected ? .75 : 0); selectionOverlay.setOpacity(selected ? .75 : 0);
if (selected) { if (selected) {
selectionOverlay.getStyleClass().add("selection-background"); selectionOverlay.getStyleClass().add("thumbcell-selection-background");
} else { } else {
selectionOverlay.getStyleClass().remove("selection-background"); selectionOverlay.getStyleClass().remove("thumbcell-selection-background");
} }
} }
@ -760,8 +761,14 @@ public class ThumbCell extends StackPane {
@Override @Override
protected void layoutChildren() { protected void layoutChildren() {
super.layoutChildren();
nameBackground.setHeight(name.getLayoutBounds().getHeight()); nameBackground.setHeight(name.getLayoutBounds().getHeight());
resolutionBackground.setHeight(resolutionTag.getLayoutBounds().getHeight()); resolutionBackground.setHeight(resolutionTag.getLayoutBounds().getHeight());
topicBackground.setHeight(getHeight() - nameBackground.getHeight());
StackPane.setMargin(groupIndicator, new Insets(0, 3, nameBackground.getHeight() + 4, 0));
if (Config.getInstance().getSettings().livePreviews) {
StackPane.setMargin(previewTrigger, new Insets(0, 0, nameBackground.getHeight() + 4, 4));
}
super.layoutChildren();
} }
} }