You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by hi...@apache.org on 2001/03/12 16:35:14 UTC
cvs commit: xml-batik/sources/org/apache/batik/apps/svgbrowser JSVGViewerFrame.java
hillion 01/03/12 07:35:14
Modified: resources/org/apache/batik/apps/svgbrowser/resources
GUI.properties
sources/org/apache/batik/apps/svgbrowser
JSVGViewerFrame.java
Log:
Added Zoom in and out.
Revision Changes Path
1.4 +45 -9 xml-batik/resources/org/apache/batik/apps/svgbrowser/resources/GUI.properties
Index: GUI.properties
===================================================================
RCS file: /home/cvs/xml-batik/resources/org/apache/batik/apps/svgbrowser/resources/GUI.properties,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- GUI.properties 2001/03/12 10:45:09 1.3
+++ GUI.properties 2001/03/12 15:35:13 1.4
@@ -9,7 +9,7 @@
# The viewer's GUI resources.
#
# Author: stephane@hillion.org
-# $Id: GUI.properties,v 1.3 2001/03/12 10:45:09 hillion Exp $
+# $Id: GUI.properties,v 1.4 2001/03/12 15:35:13 hillion Exp $
#
#
@@ -29,10 +29,10 @@
# Definition of the menu bar
#
-MenuBar = File Processing Options Tools
+MenuBar = File View Processing Options Tools
# File menu ################
-File = Open - Reload - Close Exit
+File = Open NewWindow - Reload - Close Exit
File.type = MENU
File.text = File
File.mnemonic = F
@@ -44,6 +44,13 @@
Open.action = OpenAction
Open.accelerator = Ctrl+F
+NewWindow.type = ITEM
+NewWindow.text = New Window...
+NewWindow.icon = resources/blank.gif
+NewWindow.mnemonic = N
+NewWindow.action = NewWindowAction
+NewWindow.accelerator = Ctrl+N
+
Close.type = ITEM
Close.text = Close
Close.icon = resources/blank.gif
@@ -66,11 +73,11 @@
Exit.accelerator = Ctrl+Q
-# Processing menu ################
-Processing = ResetTransform - Stop
-Processing.type = MENU
-Processing.text = Processing
-Processing.mnemonic = P
+# View menu ################
+View = ResetTransform ZoomIn ZoomOut
+View.type = MENU
+View.text = View
+View.mnemonic = V
ResetTransform.type = ITEM
ResetTransform.text = Initial View
@@ -79,6 +86,27 @@
ResetTransform.action = ResetTransformAction
ResetTransform.accelerator = Ctrl+T
+ZoomIn.type = ITEM
+ZoomIn.text = Zoom In
+ZoomIn.icon = resources/zoomin.gif
+ZoomIn.mnemonic = I
+ZoomIn.action = ZoomInAction
+ZoomIn.accelerator = Ctrl+I
+
+ZoomOut.type = ITEM
+ZoomOut.text = Zoom Out
+ZoomOut.icon = resources/zoomout.gif
+ZoomOut.mnemonic = O
+ZoomOut.action = ZoomOutAction
+ZoomOut.accelerator = Ctrl+O
+
+
+# Processing menu ################
+Processing = Stop
+Processing.type = MENU
+Processing.text = Processing
+Processing.mnemonic = P
+
Stop.type = ITEM
Stop.text = Stop
Stop.icon = resources/stop.gif
@@ -159,7 +187,7 @@
# Definition of the tool bar
#
-ToolBar = ToolOpen - ToolReload - ToolDOMViewer - ToolStop
+ToolBar = ToolOpen - ToolReload - ToolZoomIn ToolZoomOut - ToolDOMViewer - ToolStop
ToolOpen.icon = resources/open.gif
ToolOpen.action = OpenAction
@@ -168,6 +196,14 @@
ToolReload.icon = resources/reload.gif
ToolReload.action = ReloadAction
ToolReload.tooltip = Reload the current document.
+
+ToolZoomIn.icon = resources/zoomin.gif
+ToolZoomIn.action = ZoomInAction
+ToolZoomIn.tooltip = Zoom in the current document.
+
+ToolZoomOut.icon = resources/zoomout.gif
+ToolZoomOut.action = ZoomOutAction
+ToolZoomOut.tooltip = Zoom out the current document.
ToolDOMViewer.icon = resources/domtree.gif
ToolDOMViewer.action = DOMViewerAction
1.3 +58 -1 xml-batik/sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
Index: JSVGViewerFrame.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- JSVGViewerFrame.java 2001/03/12 10:45:11 1.2
+++ JSVGViewerFrame.java 2001/03/12 15:35:14 1.3
@@ -91,7 +91,7 @@
* This class represents a SVG viewer swing frame.
*
* @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
- * @version $Id: JSVGViewerFrame.java,v 1.2 2001/03/12 10:45:11 hillion Exp $
+ * @version $Id: JSVGViewerFrame.java,v 1.3 2001/03/12 15:35:14 hillion Exp $
*/
public class JSVGViewerFrame
extends JFrame
@@ -108,10 +108,13 @@
// The actions names.
public final static String OPEN_ACTION = "OpenAction";
+ public final static String NEW_WINDOW_ACTION = "NewWindowAction";
public final static String RELOAD_ACTION = "ReloadAction";
public final static String CLOSE_ACTION = "CloseAction";
public final static String EXIT_ACTION = "ExitAction";
public final static String RESET_TRANSFORM_ACTION = "ResetTransformAction";
+ public final static String ZOOM_IN_ACTION = "ZoomInAction";
+ public final static String ZOOM_OUT_ACTION = "ZoomOutAction";
public final static String STOP_ACTION = "StopAction";
//public final static String DOUBLE_BUFFER_ACTION = "DoubleBufferAction";
public final static String AUTO_ADJUST_ACTION = "AutoAdjustAction";
@@ -251,10 +254,13 @@
});
listeners.put(OPEN_ACTION, new OpenAction());
+ listeners.put(NEW_WINDOW_ACTION, new NewWindowAction());
listeners.put(RELOAD_ACTION, new ReloadAction());
listeners.put(CLOSE_ACTION, new CloseAction());
listeners.put(EXIT_ACTION, application.createExitAction(this));
listeners.put(RESET_TRANSFORM_ACTION, new ResetTransformAction());
+ listeners.put(ZOOM_IN_ACTION, new ZoomInAction());
+ listeners.put(ZOOM_OUT_ACTION, new ZoomOutAction());
listeners.put(STOP_ACTION, stopAction);
//listeners.put(DOUBLE_BUFFER_ACTION, new DoubleBufferAction());
listeners.put(AUTO_ADJUST_ACTION, new AutoAdjustAction());
@@ -490,6 +496,16 @@
}
/**
+ * To open a new window.
+ */
+ public class NewWindowAction extends AbstractAction {
+ public NewWindowAction() {}
+ public void actionPerformed(ActionEvent e) {
+ application.createAndShowJSVGViewerFrame();
+ }
+ }
+
+ /**
* To close the last document.
*/
public class CloseAction extends AbstractAction {
@@ -523,6 +539,46 @@
}
/**
+ * To zoom in.
+ */
+ public class ZoomInAction extends AbstractAction {
+ public ZoomInAction() {}
+ public void actionPerformed(ActionEvent e) {
+ AffineTransform at = svgComponent.getRenderingTransform();
+ if (at != null) {
+ Dimension dim = getSize();
+ int x = dim.width / 2;
+ int y = dim.height / 2;
+ AffineTransform t = AffineTransform.getTranslateInstance(x, y);
+ t.scale(2, 2);
+ t.translate(-x, -y);
+ t.concatenate(at);
+ svgComponent.setRenderingTransform(t);
+ }
+ }
+ }
+
+ /**
+ * To zoom out.
+ */
+ public class ZoomOutAction extends AbstractAction {
+ public ZoomOutAction() {}
+ public void actionPerformed(ActionEvent e) {
+ AffineTransform at = svgComponent.getRenderingTransform();
+ if (at != null) {
+ Dimension dim = getSize();
+ int x = dim.width / 2;
+ int y = dim.height / 2;
+ AffineTransform t = AffineTransform.getTranslateInstance(x, y);
+ t.scale(0.5, 0.5);
+ t.translate(-x, -y);
+ t.concatenate(at);
+ svgComponent.setRenderingTransform(t);
+ }
+ }
+ }
+
+ /**
* To stop the current processing.
*/
public class StopAction extends AbstractAction
@@ -574,6 +630,7 @@
public ShowDebugAction() {}
public void actionPerformed(ActionEvent e) {
debug = ((JCheckBoxMenuItem)e.getSource()).isSelected();
+ time = System.currentTimeMillis();
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org