implement continous zoom and removed zoom level status control
This commit is contained in:
@ -50,6 +50,7 @@ import com.minres.scviewer.database.IWaveformDbFactory;
|
||||
import com.minres.scviewer.database.ui.GotoDirection;
|
||||
import com.minres.scviewer.database.ui.IWaveformView;
|
||||
import com.minres.scviewer.database.ui.TrackEntry;
|
||||
import com.minres.scviewer.database.ui.ZoomKind;
|
||||
import com.minres.scviewer.database.ui.swt.WaveformViewFactory;
|
||||
import com.minres.scviewer.ui.views.TxOutlinePage;
|
||||
|
||||
@ -66,13 +67,6 @@ public class TxEditorPart extends EditorPart implements ITabbedPropertySheetPage
|
||||
waveformDbFactory=null;
|
||||
}
|
||||
|
||||
private final static String[] zoomLevel={
|
||||
"1fs", "10fs", "100fs",
|
||||
"1ps", "10ps", "100ps",
|
||||
"1ns", "10ns", "100ns",
|
||||
"1µs", "10µs", "10µs",
|
||||
"1ms", "10ms", "100ms", "1s"};
|
||||
|
||||
public static final String ID = "com.minres.scviewer.ui.TxEditorPart"; //$NON-NLS-1$
|
||||
|
||||
public static final String WAVE_ACTION_ID = "com.minres.scviewer.ui.action.AddToWave";
|
||||
@ -85,7 +79,6 @@ public class TxEditorPart extends EditorPart implements ITabbedPropertySheetPage
|
||||
private Composite myParent;
|
||||
|
||||
private StatusLineContributionItem cursorStatusLineItem;
|
||||
private StatusLineContributionItem zoomStatusLineItem;
|
||||
|
||||
public TxEditorPart() {
|
||||
}
|
||||
@ -132,7 +125,6 @@ public class TxEditorPart extends EditorPart implements ITabbedPropertySheetPage
|
||||
}
|
||||
}
|
||||
}).run();
|
||||
zoomStatusLineItem.setText("Zoom level: "+zoomLevel[waveformView.getZoomLevel()]);
|
||||
cursorStatusLineItem.setText("Cursor: "+ waveformView.getCursorTime()/1000000+"ns");
|
||||
MenuManager menuMgr = new MenuManager("#PopupMenu");
|
||||
// menuMgr.setRemoveAllWhenShown(true);
|
||||
@ -306,11 +298,9 @@ public class TxEditorPart extends EditorPart implements ITabbedPropertySheetPage
|
||||
// Initialize the editor part
|
||||
setSite(site);
|
||||
setInput(input);
|
||||
zoomStatusLineItem = new StatusLineContributionItem("TxEditorZoomContributionItem");
|
||||
cursorStatusLineItem = new StatusLineContributionItem("TxEditorCursorContributionItem");
|
||||
IActionBars actionBars = getEditorSite().getActionBars();
|
||||
IStatusLineManager manager = actionBars.getStatusLineManager();
|
||||
manager.add(zoomStatusLineItem);
|
||||
manager.add(cursorStatusLineItem);
|
||||
actionBars.updateActionBars();
|
||||
}
|
||||
@ -388,16 +378,8 @@ public class TxEditorPart extends EditorPart implements ITabbedPropertySheetPage
|
||||
waveformView.moveSelection( next);
|
||||
}
|
||||
|
||||
public void setZoomLevel(Integer level) {
|
||||
waveformView.setZoomLevel(level);
|
||||
}
|
||||
|
||||
public void setZoomFit() {
|
||||
waveformView.setZoomLevel(6);
|
||||
}
|
||||
|
||||
public int getZoomLevel() {
|
||||
return waveformView.getZoomLevel();
|
||||
public void setZoom(ZoomKind kind) {
|
||||
waveformView.getWaveformZoom().zoom(kind);
|
||||
}
|
||||
|
||||
public void removeSelected() {
|
||||
|
@ -16,25 +16,30 @@ import org.eclipse.core.commands.ExecutionException;
|
||||
import org.eclipse.ui.IEditorPart;
|
||||
import org.eclipse.ui.handlers.HandlerUtil;
|
||||
|
||||
import com.minres.scviewer.database.ui.ZoomKind;
|
||||
import com.minres.scviewer.ui.TxEditorPart;
|
||||
|
||||
public class Zoom extends AbstractHandler {
|
||||
private static final String PARM_MSG = "com.minres.scviewer.ui.zoom.level";
|
||||
private static final String ZOOMIN_ID = "com.minres.scviewer.ui.zoom.in";
|
||||
private static final String ZOOMOUT_ID = "com.minres.scviewer.ui.zoom.out";
|
||||
private static final String ZOOMFIT_ID = "com.minres.scviewer.ui.zoom.fit";
|
||||
private static final String ZOOMFULL_ID = "com.minres.scviewer.ui.zoom.full";
|
||||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent event) throws ExecutionException {
|
||||
IEditorPart editor = HandlerUtil.getActiveEditor(event);
|
||||
String msg = event.getParameter(PARM_MSG);
|
||||
if (msg == null) {
|
||||
if(editor instanceof TxEditorPart){
|
||||
((TxEditorPart)editor).setZoomFit();
|
||||
}
|
||||
} else {
|
||||
Integer level = Integer.parseInt(msg);
|
||||
if(editor instanceof TxEditorPart){
|
||||
((TxEditorPart)editor).setZoomLevel(level);
|
||||
}
|
||||
}
|
||||
if(editor instanceof TxEditorPart){
|
||||
String id = event.getCommand().getId();
|
||||
TxEditorPart txEditor=(TxEditorPart) editor;
|
||||
if (ZOOMIN_ID.compareTo(id) == 0)
|
||||
txEditor.setZoom(ZoomKind.IN);
|
||||
else if(ZOOMOUT_ID.compareTo(id) == 0)
|
||||
txEditor.setZoom(ZoomKind.OUT);
|
||||
else if(ZOOMFIT_ID.compareTo(id) == 0)
|
||||
txEditor.setZoom(ZoomKind.FIT);
|
||||
else if(ZOOMFULL_ID.compareTo(id) == 0)
|
||||
txEditor.setZoom(ZoomKind.FULL);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -1,39 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* MINRES Technologies GmbH - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package com.minres.scviewer.ui.handler;
|
||||
|
||||
import org.eclipse.core.commands.AbstractHandler;
|
||||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
import org.eclipse.ui.IEditorPart;
|
||||
import org.eclipse.ui.handlers.HandlerUtil;
|
||||
|
||||
import com.minres.scviewer.ui.TxEditorPart;
|
||||
|
||||
public class ZoomInOut extends AbstractHandler {
|
||||
private static final String ZOOMIN_ID = "com.minres.scviewer.ui.zoomin";
|
||||
private static final String ZOOMOUT_ID= "com.minres.scviewer.ui.zoomout";
|
||||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent event) throws ExecutionException {
|
||||
IEditorPart editor = HandlerUtil.getActiveEditor(event);
|
||||
if(editor instanceof TxEditorPart){
|
||||
String id = event.getCommand().getId();
|
||||
TxEditorPart txEditor=(TxEditorPart) editor;
|
||||
if (ZOOMIN_ID.compareTo(id) == 0)
|
||||
txEditor.setZoomLevel(txEditor.getZoomLevel()-1);
|
||||
else if(ZOOMOUT_ID.compareTo(id) == 0)
|
||||
txEditor.setZoomLevel(txEditor.getZoomLevel()+1);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user