From a5affd6fe13d971665ed076f1066aca7afff6471 Mon Sep 17 00:00:00 2001 From: Frederic Thevenet Date: Tue, 12 Mar 2019 16:03:10 +0100 Subject: [PATCH] Embedded worksheet buttons in a Toolbar --- UNRELEASED.md | 4 +- .../core/controllers/MainViewController.java | 1 - .../core/controllers/WorksheetController.java | 8 +- .../main/resources/eu/binjr/css/Common.css | 9 + .../src/main/resources/eu/binjr/css/Dark.css | 4 + .../src/main/resources/eu/binjr/css/Light.css | 4 + .../eu/binjr/views/WorksheetView.fxml | 252 +++++++++++------- 7 files changed, 175 insertions(+), 107 deletions(-) diff --git a/UNRELEASED.md b/UNRELEASED.md index 3486bb270..cdfbb1739 100644 --- a/UNRELEASED.md +++ b/UNRELEASED.md @@ -20,10 +20,10 @@ * Icons for buttons that remove sources/worksheets have been changed from a cross to a bin, to emphasise the fact that the action will irreversibly remove something and not simply dismiss a dialog/pane. * Remove source/worksheet buttons are now hidden until the control is set to "edit mode". + * Worksheets buttons can now overflow to a menu pane if there is not enough space to display all of them. * _[New]_ Added support for small numbers unit prefix (m = milli, ยต = micro, n = nano, etc...) for formatting Y axis values. * _[Fixed]_ A memory leak that occurs when adding, moving or changing the type of a chart in an existing worksheet. * _[Fixed]_ Uncaught exception when entering a negative range for a chart's Y axis causes a worksheet to become -* _[Fixed]_ Keyboard shortcuts do no work on detached tab windows. - unresponsive. \ No newline at end of file +* _[Fixed]_ Keyboard shortcuts do no work on detached tab windows. \ No newline at end of file diff --git a/binjr-core/src/main/java/eu/binjr/core/controllers/MainViewController.java b/binjr-core/src/main/java/eu/binjr/core/controllers/MainViewController.java index 6e26df013..aaaac09e0 100644 --- a/binjr-core/src/main/java/eu/binjr/core/controllers/MainViewController.java +++ b/binjr-core/src/main/java/eu/binjr/core/controllers/MainViewController.java @@ -102,7 +102,6 @@ public class MainViewController implements Initializable { private static final int ANIMATION_DURATION = 50; public AnchorPane sourcePane; public MenuItem hideSourcePaneMenu; - public MenuItem toggleTableViewButton; private Workspace workspace; private final Map seriesControllers = new WeakHashMap<>(); diff --git a/binjr-core/src/main/java/eu/binjr/core/controllers/WorksheetController.java b/binjr-core/src/main/java/eu/binjr/core/controllers/WorksheetController.java index af7b5750d..f0eb8c41e 100644 --- a/binjr-core/src/main/java/eu/binjr/core/controllers/WorksheetController.java +++ b/binjr-core/src/main/java/eu/binjr/core/controllers/WorksheetController.java @@ -126,9 +126,9 @@ public class WorksheetController implements Initializable, AutoCloseable { @FXML private Button refreshButton; @FXML - private MenuItem snapshotButton; + private Button snapshotButton; @FXML - private MenuItem toggleTableViewButton; + private Button toggleTableViewButton; @FXML private ToggleButton vCrosshair; @FXML @@ -140,7 +140,7 @@ public class WorksheetController implements Initializable, AutoCloseable { @FXML private ContextMenu seriesListMenu; @FXML - private Menu selectChartLayout; + private MenuButton selectChartLayout; @FXML private TimeRangePicker timeRangePicker; @FXML @@ -311,7 +311,7 @@ private void initChartViewPorts() throws IOException { viewPorts.add(new ChartViewPort(currentChart, viewPort, buildChartPropertiesController(currentChart))); } - bindingManager.bind(selectChartLayout.visibleProperty(), Bindings.createBooleanBinding(() -> worksheet.getCharts().size() > 1, worksheet.getCharts())); + bindingManager.bind(selectChartLayout.disableProperty(), Bindings.createBooleanBinding(() -> worksheet.getCharts().size() > 1, worksheet.getCharts()).not()); selectChartLayout.getItems().setAll(Arrays.stream(ChartLayout.values()).map(chartLayout -> { MenuItem item = new MenuItem(chartLayout.toString()); item.setOnAction(bindingManager.registerHandler(event -> worksheet.setChartLayout(chartLayout))); diff --git a/binjr-core/src/main/resources/eu/binjr/css/Common.css b/binjr-core/src/main/resources/eu/binjr/css/Common.css index 6ae9c6c1b..0f73f7017 100644 --- a/binjr-core/src/main/resources/eu/binjr/css/Common.css +++ b/binjr-core/src/main/resources/eu/binjr/css/Common.css @@ -17,4 +17,13 @@ .context-menu * { -icon-scale-x: 2.5; -icon-scale-y: 2.5; +} + +.tool-bar{ + -fx-padding: 0; + -fx-background-color: none; +} + +.tool-bar-overflow-button { + -fx-padding: 12,0,0,0; } \ No newline at end of file diff --git a/binjr-core/src/main/resources/eu/binjr/css/Dark.css b/binjr-core/src/main/resources/eu/binjr/css/Dark.css index 5cdb4b8ba..9ef6239a4 100644 --- a/binjr-core/src/main/resources/eu/binjr/css/Dark.css +++ b/binjr-core/src/main/resources/eu/binjr/css/Dark.css @@ -1598,4 +1598,8 @@ } .auto-complete-popup > .list-view > .placeholder > .label { -fx-text-fill: derive(-fx-control-inner-background,-30%); +} + +.tool-bar { + -fx-spacing: 0; } \ No newline at end of file diff --git a/binjr-core/src/main/resources/eu/binjr/css/Light.css b/binjr-core/src/main/resources/eu/binjr/css/Light.css index 71d9b69b8..0cffaa0a6 100644 --- a/binjr-core/src/main/resources/eu/binjr/css/Light.css +++ b/binjr-core/src/main/resources/eu/binjr/css/Light.css @@ -1473,3 +1473,7 @@ -fx-font-family: Consolas, Monospace; -fx-fill: DARKRED; } + +.tool-bar { + -fx-spacing: 0; +} diff --git a/binjr-core/src/main/resources/eu/binjr/views/WorksheetView.fxml b/binjr-core/src/main/resources/eu/binjr/views/WorksheetView.fxml index fa8edf884..64a4db85d 100644 --- a/binjr-core/src/main/resources/eu/binjr/views/WorksheetView.fxml +++ b/binjr-core/src/main/resources/eu/binjr/views/WorksheetView.fxml @@ -91,6 +91,7 @@ @@ -106,120 +107,169 @@ + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - + @@ -227,7 +277,8 @@ - @@ -246,7 +297,8 @@ + AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" + minHeight="0.0">