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 11:45:13 UTC

cvs commit: xml-batik/sources/org/apache/batik/swing/svg JSVGComponent.java

hillion     01/03/12 02:45:13

  Modified:    resources/org/apache/batik/apps/svgbrowser/resources
                        GUI.properties
               sources/org/apache/batik/apps/svgbrowser
                        JSVGViewerFrame.java
               sources/org/apache/batik/swing/svg JSVGComponent.java
  Log:
  Added an 'Auto Adjust Window' option to the browser.
  
  Revision  Changes    Path
  1.3       +9 -2      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.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- GUI.properties	2001/03/12 09:58:02	1.2
  +++ GUI.properties	2001/03/12 10:45:09	1.3
  @@ -9,7 +9,7 @@
   # The viewer's GUI resources.
   #
   # Author: stephane@hillion.org
  -# $Id: GUI.properties,v 1.2 2001/03/12 09:58:02 tkormann Exp $
  +# $Id: GUI.properties,v 1.3 2001/03/12 10:45:09 hillion Exp $
   #
   
   #
  @@ -88,7 +88,7 @@
   
   
   # Options menu ############
  -Options           = ShowRendering - Language StyleSheet - ShowDebug
  +Options           = ShowRendering AutoAdjust - Language StyleSheet - ShowDebug
   Options.type      = MENU
   Options.text      = Options
   Options.mnemonic  = O
  @@ -99,6 +99,13 @@
   ShowRendering.mnemonic    = S
   ShowRendering.action      = ShowRenderingAction
   ShowRendering.selected    = false
  +
  +AutoAdjust.type        = CHECK
  +AutoAdjust.text        = Auto Adjust Window
  +AutoAdjust.icon        = resources/blank.gif
  +AutoAdjust.mnemonic    = A
  +AutoAdjust.action      = AutoAdjustAction
  +AutoAdjust.selected    = false
   
   DoubleBuffer.type        = CHECK
   DoubleBuffer.text        = Enable/Disable Double Buffering
  
  
  
  1.2       +21 -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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JSVGViewerFrame.java	2001/03/08 01:21:05	1.1
  +++ JSVGViewerFrame.java	2001/03/12 10:45:11	1.2
  @@ -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.1 2001/03/08 01:21:05 hillion Exp $
  + * @version $Id: JSVGViewerFrame.java,v 1.2 2001/03/12 10:45:11 hillion Exp $
    */
   public class JSVGViewerFrame
       extends    JFrame
  @@ -114,6 +114,7 @@
       public final static String RESET_TRANSFORM_ACTION = "ResetTransformAction";
       public final static String STOP_ACTION = "StopAction";
       //public final static String DOUBLE_BUFFER_ACTION = "DoubleBufferAction";
  +    public final static String AUTO_ADJUST_ACTION = "AutoAdjustAction";
       public final static String SHOW_DEBUG_ACTION = "ShowDebugAction";
       public final static String SHOW_RENDERING_ACTION = "ShowRenderingAction";
       public final static String LANGUAGE_ACTION = "LanguageAction";
  @@ -178,6 +179,11 @@
       protected boolean debug;
   
       /**
  +     * The auto adjust flag.
  +     */
  +    protected boolean autoAdjust;
  +
  +    /**
        * The SVG user agent.
        */
       protected SVGUserAgent userAgent = new UserAgent();
  @@ -251,6 +257,7 @@
           listeners.put(RESET_TRANSFORM_ACTION, new ResetTransformAction());
           listeners.put(STOP_ACTION, stopAction);
           //listeners.put(DOUBLE_BUFFER_ACTION, new DoubleBufferAction());
  +        listeners.put(AUTO_ADJUST_ACTION, new AutoAdjustAction());
           listeners.put(SHOW_DEBUG_ACTION, new ShowDebugAction());
           listeners.put(SHOW_RENDERING_ACTION, new ShowRenderingAction());
           listeners.put(LANGUAGE_ACTION, new LanguageAction());
  @@ -551,6 +558,16 @@
       }
   
       /**
  +     * To adjust the window size on load.
  +     */
  +    public class AutoAdjustAction extends AbstractAction {
  +        public AutoAdjustAction() {}
  +        public void actionPerformed(ActionEvent e) {
  +            autoAdjust = ((JCheckBoxMenuItem)e.getSource()).isSelected();
  +        }
  +    }
  +
  +    /**
        * To enable the debug traces.
        */
       public class ShowDebugAction extends AbstractAction {
  @@ -785,6 +802,9 @@
           }
           stopAction.update(false);
           svgComponent.setCursor(DEFAULT_CURSOR);
  +        if (autoAdjust) {
  +            pack();
  +        }
       }
   
       /**
  
  
  
  1.3       +3 -1      xml-batik/sources/org/apache/batik/swing/svg/JSVGComponent.java
  
  Index: JSVGComponent.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/swing/svg/JSVGComponent.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JSVGComponent.java	2001/03/08 12:39:43	1.2
  +++ JSVGComponent.java	2001/03/12 10:45:12	1.3
  @@ -55,7 +55,7 @@
    * This class represents a Swing component which can display SVG.
    *
    * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
  - * @version $Id: JSVGComponent.java,v 1.2 2001/03/08 12:39:43 tkormann Exp $
  + * @version $Id: JSVGComponent.java,v 1.3 2001/03/12 10:45:12 hillion Exp $
    */
   public class JSVGComponent extends JGVTComponent {
   
  @@ -333,6 +333,8 @@
           public void gvtBuildCompleted(GVTTreeBuilderEvent e) {
               gvtTreeBuilder = null;
               setGraphicsNode(e.getGVTRoot(), false);
  +            Dimension2D dim = bridgeContext.getDocumentSize();
  +            setPreferredSize(new Dimension((int)dim.getWidth(), (int)dim.getHeight()));
           }
   
           /**
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org