From 232d2d4275eedbd76960e5dd95874c306dce3fce Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Sat, 27 Nov 2021 14:31:39 +0100 Subject: [PATCH] move zomm/navigate toolbar to view --- .../ui/swt/internal/WaveformCanvas.java | 3 +- .../Application.e4xmi | 70 +++++++++---------- .../application/handlers/NavigateEvent.java | 22 +++--- 3 files changed, 49 insertions(+), 46 deletions(-) diff --git a/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/WaveformCanvas.java b/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/WaveformCanvas.java index 01d9705..b658d4c 100644 --- a/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/WaveformCanvas.java +++ b/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/WaveformCanvas.java @@ -177,8 +177,7 @@ public class WaveformCanvas extends Canvas implements IWaveformZoom{ @Override public void setScale(long factor) { - long tc=cursorPainters.get(0).getTime(); // cursor time - setScalingFactor(factor, tc); + setScalingFactor(factor, (getMaxVisibleTime()+getMinVisibleTime())/2); } @Override diff --git a/plugins/com.minres.scviewer.e4.application/Application.e4xmi b/plugins/com.minres.scviewer.e4.application/Application.e4xmi index c78895c..b2cf22b 100644 --- a/plugins/com.minres.scviewer.e4.application/Application.e4xmi +++ b/plugins/com.minres.scviewer.e4.application/Application.e4xmi @@ -81,41 +81,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -241,6 +206,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/handlers/NavigateEvent.java b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/handlers/NavigateEvent.java index e76b7cb..77602c9 100644 --- a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/handlers/NavigateEvent.java +++ b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/handlers/NavigateEvent.java @@ -29,21 +29,25 @@ import com.minres.scviewer.e4.application.parts.WaveformViewer; public class NavigateEvent { final static String PARAMTER_ID="com.minres.scviewer.e4.application.command.navigateEventCommand.parameter.dir"; //$NON-NLS-1$ - + @CanExecute - public Boolean canExecute(ESelectionService selectionService){ - Object sel = selectionService.getSelection(); - if( sel instanceof IStructuredSelection) { - Object o= ((IStructuredSelection)sel).getFirstElement(); - return o instanceof IWaveform || o instanceof ITx || o instanceof TrackEntry; + public Boolean canExecute(EPartService partService){ + MPart part = partService.getActivePart(); + if(part.getObject() instanceof WaveformViewer){ + Object sel = ((WaveformViewer)part.getObject()).getSelection(); + if( sel instanceof IStructuredSelection) { + if(((IStructuredSelection)sel).isEmpty()) return false; + Object o= ((IStructuredSelection)sel).getFirstElement(); + return o instanceof IWaveform || o instanceof ITx || o instanceof TrackEntry; + } } return false; } - + @Execute public void execute(@Named(PARAMTER_ID) String param, EPartService partService) { -// public void execute(EPartService partService) { -// String param="next"; + // public void execute(EPartService partService) { + // String param="next"; MPart part = partService.getActivePart(); Object obj = part.getObject(); if(obj instanceof WaveformViewer){