From 3e59a11925118fb2715dea07785108827461d16c Mon Sep 17 00:00:00 2001 From: Jamie Mac Date: Tue, 23 Jul 2024 17:26:12 +0100 Subject: [PATCH] Bug fixes to DL Symbol Pane --- src/Acquisition/FileInputSystem.java | 5 +++- src/Acquisition/FolderInputSystem.java | 2 ++ .../fileprocessing/ReprocessManager.java | 2 +- src/dataMap/layoutFX/DataStreamPaneFX.java | 5 +++- src/dataMap/layoutFX/ScrollingDataPaneFX.java | 25 +++++++++++-------- .../acousticScroller/ScrollBarPane.java | 15 +++++++++++ 6 files changed, 40 insertions(+), 14 deletions(-) diff --git a/src/Acquisition/FileInputSystem.java b/src/Acquisition/FileInputSystem.java index f3988d61..6fd76f3e 100644 --- a/src/Acquisition/FileInputSystem.java +++ b/src/Acquisition/FileInputSystem.java @@ -595,7 +595,7 @@ public class FileInputSystem extends DaqSystem implements ActionListener, PamSe System.out.println("The current file was null"); return false; } -// System.out.printf("*********************************** Opening file %s\n", currentFile.getName()); + System.out.printf("*********************************** Opening file %s\n", currentFile.getName()); try { @@ -639,6 +639,9 @@ public class FileInputSystem extends DaqSystem implements ActionListener, PamSe fileInputParameters.bitDepth = audioFormat.getSampleSizeInBits(); loadByteConverter(audioFormat); + +// System.out.println("FileInputSystem - prepareInputFile done"); + } catch (UnsupportedAudioFileException ex) { ex.printStackTrace(); diff --git a/src/Acquisition/FolderInputSystem.java b/src/Acquisition/FolderInputSystem.java index 7f777aa1..db80224f 100644 --- a/src/Acquisition/FolderInputSystem.java +++ b/src/Acquisition/FolderInputSystem.java @@ -933,6 +933,7 @@ public class FolderInputSystem extends FileInputSystem implements PamSettings, D @Override public InputStoreInfo getStoreInfo(boolean detail) { + System.out.println("FolderInputSystem: Get store info start:"); if (allFiles == null || allFiles.size() == 0) { return null; } @@ -962,6 +963,7 @@ public class FolderInputSystem extends FileInputSystem implements PamSettings, D storeInfo.setLastFileEnd(lastFileEnd); // just incase changed storeInfo.setFileStartTimes(allFileStarts); } + System.out.println("FolderInputSystem: Get store info complete:"); return storeInfo; } diff --git a/src/PamController/fileprocessing/ReprocessManager.java b/src/PamController/fileprocessing/ReprocessManager.java index b4e8c395..2541187b 100644 --- a/src/PamController/fileprocessing/ReprocessManager.java +++ b/src/PamController/fileprocessing/ReprocessManager.java @@ -172,7 +172,7 @@ public class ReprocessManager { choiceSummary.addChoice(ReprocessStoreChoice.STARTNORMAL); return choiceSummary; } - + choiceSummary.addChoice(ReprocessStoreChoice.STARTNORMAL); ArrayList outputStores = PamController.getInstance().findControlledUnits(DataOutputStore.class, true); diff --git a/src/dataMap/layoutFX/DataStreamPaneFX.java b/src/dataMap/layoutFX/DataStreamPaneFX.java index 8d923f0b..96a765af 100644 --- a/src/dataMap/layoutFX/DataStreamPaneFX.java +++ b/src/dataMap/layoutFX/DataStreamPaneFX.java @@ -269,7 +269,10 @@ public class DataStreamPaneFX extends PamBorderPane { }); canvasHolder.setOnScroll(e->{ - wheelMoved(e); + //only change colours of the control key is down. + if (e.isControlDown()) { + wheelMoved(e); + } }); } diff --git a/src/dataMap/layoutFX/ScrollingDataPaneFX.java b/src/dataMap/layoutFX/ScrollingDataPaneFX.java index 2faffbdb..edac7e6f 100644 --- a/src/dataMap/layoutFX/ScrollingDataPaneFX.java +++ b/src/dataMap/layoutFX/ScrollingDataPaneFX.java @@ -21,6 +21,7 @@ import pamViewFX.fxNodes.PamColorsFX; import pamViewFX.fxNodes.PamScrollPane; import pamViewFX.fxNodes.PamVBox; import pamViewFX.fxNodes.pamAxis.PamDateAxis; +import pamViewFX.fxNodes.pamScrollers.acousticScroller.ScrollBarPane; public class ScrollingDataPaneFX extends PamBorderPane { @@ -77,7 +78,7 @@ public class ScrollingDataPaneFX extends PamBorderPane { /** * Scroll bar for time (horizontal) */ - private ScrollBar timeScrollBar; + private ScrollBarPane timeScrollBar; /** * Settings strip at top of the display. Shows all sorts of detailed info such cursor position and start and end times. @@ -145,7 +146,7 @@ public class ScrollingDataPaneFX extends PamBorderPane { // ////////// holder.setCenter(mainScrollPane); - holder.setBottom(createScrollBar()); + holder.setTop(createScrollBar()); // PamButton test = new PamButton("Test"); // test.setOnAction((action)->{ @@ -208,13 +209,15 @@ public class ScrollingDataPaneFX extends PamBorderPane { //create the scroll bar and listeners. - timeScrollBar=new ScrollBar(); - timeScrollBar.valueProperty().addListener((obs_val, old_val, new_val)->{ + timeScrollBar=new ScrollBarPane(); + timeScrollBar.addValueListener((obs_val, old_val, new_val)->{ calcStartEndMillis(); updateScrollBarText(); notifyScrollChange(); }); + + timeScrollBar.setPrefHeight(20); holder.setCenter(timeScrollBar); @@ -228,7 +231,7 @@ public class ScrollingDataPaneFX extends PamBorderPane { */ private void calcStartEndMillis(){ screenStartMillis = (long) (dataMapControl.getFirstTime() + - timeScrollBar.getValue() * 1000L); + timeScrollBar.getCurrentValue() * 1000L); screenEndMillis = screenStartMillis + (long) (screenSeconds * 1000); } @@ -347,7 +350,7 @@ public class ScrollingDataPaneFX extends PamBorderPane { * Do scrolling in seconds - will give up to 68 years with a * 32 bit integer control of scroll bar. milliseconds would give < 1 year ! */ - double currentPos = timeScrollBar.getValue(); + double currentPos = timeScrollBar.getCurrentValue(); long dataStart = dataMapControl.getFirstTime(); long dataEnd = dataMapControl.getLastTime(); double dataSeconds = ((dataEnd-dataStart)/1000) + 1; @@ -367,12 +370,12 @@ public class ScrollingDataPaneFX extends PamBorderPane { else { //System.out.println("dataSeconds: "+dataSeconds+ " pixsPerHour: " +pixsPerHour+" screenWidth: "+screenWidth+" screenSeconds "+screenSeconds+" holder width: "+holder.getWidth()); timeScrollBar.setVisible(true); - timeScrollBar.setMax(0); - timeScrollBar.setMax(Math.ceil(dataSeconds)); + timeScrollBar.setMinVal(0); + timeScrollBar.setMaxVal(Math.ceil(dataSeconds)); timeScrollBar.setBlockIncrement(Math.max(1, screenSeconds * 4/5)); - timeScrollBar.setUnitIncrement(Math.max(1, screenSeconds / 20)); +// timeScrollBar.setUnitIncrement(Math.max(1, screenSeconds / 20)); timeScrollBar.setVisibleAmount(screenSeconds); - timeScrollBar.setValue(currentPos); + timeScrollBar.setCurrentValue(currentPos); } } @@ -394,7 +397,7 @@ public class ScrollingDataPaneFX extends PamBorderPane { public void scrollToData(PamDataBlock dataBlock) { long startTime = dataBlock.getCurrentViewDataStart(); int val = (int) ((startTime - getScreenStartMillis())/1000 - getScreenSeconds()/5) ; - timeScrollBar.setValue(val); + timeScrollBar.setCurrentValue(val); } /** diff --git a/src/pamViewFX/fxNodes/pamScrollers/acousticScroller/ScrollBarPane.java b/src/pamViewFX/fxNodes/pamScrollers/acousticScroller/ScrollBarPane.java index 36124e0a..02dcd566 100644 --- a/src/pamViewFX/fxNodes/pamScrollers/acousticScroller/ScrollBarPane.java +++ b/src/pamViewFX/fxNodes/pamScrollers/acousticScroller/ScrollBarPane.java @@ -6,6 +6,8 @@ import javafx.beans.property.BooleanProperty; import javafx.beans.property.DoubleProperty; import javafx.beans.property.SimpleBooleanProperty; import javafx.beans.property.SimpleDoubleProperty; +import javafx.beans.value.ChangeListener; +import javafx.beans.value.ObservableValue; import javafx.geometry.Point2D; import javafx.scene.Cursor; import javafx.scene.Node; @@ -844,5 +846,18 @@ public class ScrollBarPane extends PamBorderPane { this.showMillis = showMillis; } + + /** + * Convenience function which adds a change listener to the current value and visible amount prooperty. + * @param val - the change listener to add. + */ + public void addValueListener(ChangeListener val) { + //add listener to visible amount property. + visibleAmountProperty.addListener(val); + + //add listener to current value amount property. + currentValueProperty.addListener(val); + } + }