|
From: <ls...@us...> - 2008-07-17 10:12:47
|
Revision: 4304
http://jnode.svn.sourceforge.net/jnode/?rev=4304&view=rev
Author: lsantha
Date: 2008-07-17 10:12:06 +0000 (Thu, 17 Jul 2008)
Log Message:
-----------
New java.awt.Graphics implementation.
Modified Paths:
--------------
trunk/core/src/classpath/vm/java/awt/image/VMImageAPI.java
trunk/gui/src/awt/org/jnode/awt/JNodeGraphicsEnvironment.java
trunk/gui/src/awt/org/jnode/awt/VMImageAPIImpl.java
trunk/gui/src/awt/org/jnode/awt/image/JNodeBufferedImage.java
trunk/gui/src/awt/org/jnode/awt/swingpeers/DesktopFramePeer.java
trunk/gui/src/awt/org/jnode/awt/swingpeers/SwingComponentPeer.java
Added Paths:
-----------
trunk/gui/src/awt/org/jnode/awt/GraphicsFactory.java
trunk/gui/src/awt/org/jnode/awt/JNodeSurfaceGraphics2D.java
trunk/gui/src/awt/org/jnode/awt/image/BufferedImageGraphics2D.java
trunk/gui/src/awt/org/jnode/awt/util/BasicGraphics.java
trunk/gui/src/awt/org/jnode/awt/util/BasicSurfaceGraphics.java
trunk/gui/src/awt/org/jnode/awt/util/SurfaceGraphics2D.java
Modified: trunk/core/src/classpath/vm/java/awt/image/VMImageAPI.java
===================================================================
--- trunk/core/src/classpath/vm/java/awt/image/VMImageAPI.java 2008-07-17 09:55:42 UTC (rev 4303)
+++ trunk/core/src/classpath/vm/java/awt/image/VMImageAPI.java 2008-07-17 10:12:06 UTC (rev 4304)
@@ -23,6 +23,7 @@
import java.awt.Graphics2D;
+//todo: is it useful?
/**
* @author Ewout Prangsma (ep...@us...)
*/
Added: trunk/gui/src/awt/org/jnode/awt/GraphicsFactory.java
===================================================================
--- trunk/gui/src/awt/org/jnode/awt/GraphicsFactory.java (rev 0)
+++ trunk/gui/src/awt/org/jnode/awt/GraphicsFactory.java 2008-07-17 10:12:06 UTC (rev 4304)
@@ -0,0 +1,48 @@
+/*
+ * $
+ */
+package org.jnode.awt;
+
+import java.awt.Graphics2D;
+import java.awt.image.BufferedImage;
+import org.jnode.awt.image.JNodeBufferedImageGraphics;
+import org.jnode.awt.image.BufferedImageGraphics2D;
+
+/**
+ * @author Levente S\u00e1ntha
+ */
+public abstract class GraphicsFactory {
+ public static GraphicsFactory instance;
+
+ public static GraphicsFactory getInstance() {
+ if (instance == null) {
+ instance = new NewGraphicsFactory();
+ }
+ return instance;
+ }
+
+ public abstract Graphics2D createGraphics(BufferedImage image);
+
+ public abstract Graphics2D createGraphics(JNodeGenericPeer<?, ?> peer);
+
+ private static class OldGraphicsFactory extends GraphicsFactory {
+ public Graphics2D createGraphics(BufferedImage image) {
+ return new JNodeBufferedImageGraphics(image);
+ }
+
+ public Graphics2D createGraphics(JNodeGenericPeer<?, ?> peer) {
+ return new JNodeGraphics(peer);
+ }
+
+ }
+
+ private static class NewGraphicsFactory extends GraphicsFactory {
+ public Graphics2D createGraphics(BufferedImage image) {
+ return new BufferedImageGraphics2D(image);
+ }
+
+ public Graphics2D createGraphics(JNodeGenericPeer<?, ?> peer) {
+ return new JNodeSurfaceGraphics2D(peer);
+ }
+ }
+}
Modified: trunk/gui/src/awt/org/jnode/awt/JNodeGraphicsEnvironment.java
===================================================================
--- trunk/gui/src/awt/org/jnode/awt/JNodeGraphicsEnvironment.java 2008-07-17 09:55:42 UTC (rev 4303)
+++ trunk/gui/src/awt/org/jnode/awt/JNodeGraphicsEnvironment.java 2008-07-17 10:12:06 UTC (rev 4304)
@@ -35,7 +35,6 @@
import javax.naming.NamingException;
import org.apache.log4j.Logger;
import org.jnode.awt.font.FontManager;
-import org.jnode.awt.image.JNodeBufferedImageGraphics;
import org.jnode.awt.image.JNodeBufferedImageGraphics2D;
import org.jnode.driver.Device;
import org.jnode.driver.DeviceUtils;
@@ -57,13 +56,13 @@
private GraphicsDevice defaultDevice;
/**
- * @param image
+ * @param image the target image
* @return The graphics
* @see java.awt.GraphicsEnvironment#createGraphics(java.awt.image.BufferedImage)
*/
public Graphics2D createGraphics(BufferedImage image) {
return SystemProperties.getProperty("gnu.javax.swing.noGraphics2D") == null ?
- new JNodeBufferedImageGraphics2D(image) : new JNodeBufferedImageGraphics(image);
+ new JNodeBufferedImageGraphics2D(image) : GraphicsFactory.getInstance().createGraphics(image);
/*
..future transition to SunGraphics2D based buffered image graphics
Copied: trunk/gui/src/awt/org/jnode/awt/JNodeSurfaceGraphics2D.java (from rev 4301, trunk/gui/src/awt/org/jnode/awt/JNodeGraphics.java)
===================================================================
--- trunk/gui/src/awt/org/jnode/awt/JNodeSurfaceGraphics2D.java (rev 0)
+++ trunk/gui/src/awt/org/jnode/awt/JNodeSurfaceGraphics2D.java 2008-07-17 10:12:06 UTC (rev 4304)
@@ -0,0 +1,138 @@
+/*
+ * $Id$
+ *
+ * JNode.org
+ * Copyright (C) 2003-2006 JNode.org
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; If not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+package org.jnode.awt;
+
+import java.awt.Component;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
+import java.awt.GraphicsConfiguration;
+import java.awt.image.BufferedImage;
+import java.awt.image.ColorModel;
+import java.awt.image.Raster;
+import java.awt.image.WritableRaster;
+import org.jnode.awt.util.SurfaceGraphics2D;
+import org.jnode.driver.video.util.AbstractSurface;
+
+/**
+ * @author epr
+ */
+public class JNodeSurfaceGraphics2D extends SurfaceGraphics2D {
+
+ private final JNodeGenericPeer component;
+ private final JNodeToolkit toolkit;
+
+ /**
+ * Initialize a graphics for the given component
+ *
+ * @param component
+ */
+ public JNodeSurfaceGraphics2D(JNodeGenericPeer<?, ?> component) {
+// super(component.getToolkitImpl().getGraphics(), ((Component) component.getTargetComponent()).getWidth(),
+ // ((Component) component.getTargetComponent()).getHeight());
+ super((AbstractSurface) component.getToolkitImpl().getGraphics());
+ this.component = component;
+ this.toolkit = component.getToolkitImpl();
+ }
+
+ /**
+ * Initialize a graphics base on the given source.
+ *
+ * @param src
+ */
+ public JNodeSurfaceGraphics2D(JNodeSurfaceGraphics2D src) {
+ super(src);
+ this.component = src.component;
+ this.toolkit = src.toolkit;
+ }
+
+ /**
+ * @return The graphics
+ * @see java.awt.Graphics#create()
+ */
+ public Graphics create() {
+ return new JNodeSurfaceGraphics2D(this);
+ }
+
+ /**
+ * @param font
+ * @return The metrics
+ * @see java.awt.Graphics#getFontMetrics(java.awt.Font)
+ */
+ public FontMetrics getFontMetrics(Font font) {
+ return toolkit.getFontMetrics(font);
+ }
+
+ /**
+ * @return The configuration
+ * @see java.awt.Graphics2D#getDeviceConfiguration()
+ */
+ public GraphicsConfiguration getDeviceConfiguration() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ //----- preparing Graphics2D
+ /**
+ * Returns the color model of this Graphics object.
+ *
+ * @return the color model of this Graphics object
+ */
+ protected ColorModel getColorModel() {
+ return toolkit.getColorModel();
+ }
+
+ /**
+ * Returns a WritableRaster that is used by this class to perform the
+ * rendering in. It is not necessary that the target surface immediately
+ * reflects changes in the raster. Updates to the raster are notified via
+ * {@link #updateRaster}.
+ *
+ * @return the destination raster
+ */
+ protected WritableRaster getDestinationRaster() {
+ if (image == null)
+ image = new BufferedImage(((Component) component.getTargetComponent()).getWidth(),
+ ((Component) component.getTargetComponent()).getHeight(), BufferedImage.TYPE_INT_ARGB);
+ return image.getRaster();
+ }
+
+ private BufferedImage image;
+
+ /**
+ * Notifies the backend that the raster has changed in the specified
+ * rectangular area. The raster that is provided in this method is always
+ * the same as the one returned in {@link #getDestinationRaster}.
+ * Backends that reflect changes to this raster directly don't need to do
+ * anything here.
+ *
+ * @param raster the updated raster, identical to the raster returned
+ * by {@link #getDestinationRaster()}
+ * @param x the upper left corner of the updated region, X coordinate
+ * @param y the upper lef corner of the updated region, Y coordinate
+ * @param w the width of the updated region
+ * @param h the height of the updated region
+ */
+ protected void updateRaster(Raster raster, int x, int y, int w, int h) {
+ drawImage(image, 0, 0, null);
+ }
+}
Modified: trunk/gui/src/awt/org/jnode/awt/VMImageAPIImpl.java
===================================================================
--- trunk/gui/src/awt/org/jnode/awt/VMImageAPIImpl.java 2008-07-17 09:55:42 UTC (rev 4303)
+++ trunk/gui/src/awt/org/jnode/awt/VMImageAPIImpl.java 2008-07-17 10:12:06 UTC (rev 4304)
@@ -24,7 +24,6 @@
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.awt.image.VMImageAPI;
-import org.jnode.awt.image.JNodeBufferedImageGraphics;
/**
* @author Ewout Prangsma (ep...@us...)
@@ -32,7 +31,7 @@
public class VMImageAPIImpl implements VMImageAPI {
public Graphics2D createGraphics(BufferedImage image) {
- return new JNodeBufferedImageGraphics(image);
+ return GraphicsFactory.getInstance().createGraphics(image);
}
}
Copied: trunk/gui/src/awt/org/jnode/awt/image/BufferedImageGraphics2D.java (from rev 4301, trunk/gui/src/awt/org/jnode/awt/image/JNodeBufferedImageGraphics.java)
===================================================================
--- trunk/gui/src/awt/org/jnode/awt/image/BufferedImageGraphics2D.java (rev 0)
+++ trunk/gui/src/awt/org/jnode/awt/image/BufferedImageGraphics2D.java 2008-07-17 10:12:06 UTC (rev 4304)
@@ -0,0 +1,89 @@
+/*
+ * $Id$
+ *
+ * JNode.org
+ * Copyright (C) 2003-2006 JNode.org
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; If not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+package org.jnode.awt.image;
+
+import java.awt.Graphics;
+import java.awt.GraphicsConfiguration;
+import java.awt.image.BufferedImage;
+import java.awt.image.ColorModel;
+import java.awt.image.WritableRaster;
+import org.jnode.awt.util.SurfaceGraphics2D;
+
+/**
+ * @author epr
+ */
+public class BufferedImageGraphics2D extends SurfaceGraphics2D {
+
+ private final BufferedImage image;
+
+ /**
+ * @param image the target image
+ */
+ public BufferedImageGraphics2D(BufferedImage image) {
+ //super(new BufferedImageSurface(image), image.getWidth(), image.getHeight());
+ super(new BufferedImageSurface(image));
+ this.image = image;
+ }
+
+ /**
+ * @param src
+ */
+ public BufferedImageGraphics2D(BufferedImageGraphics2D src) {
+ super(src);
+ this.image = src.image;
+ }
+
+ /**
+ * @return The graphics
+ * @see java.awt.Graphics#create()
+ */
+ public Graphics create() {
+ return new BufferedImageGraphics2D(this);
+ }
+
+ /**
+ * @return The configuration
+ * @see java.awt.Graphics2D#getDeviceConfiguration()
+ */
+ public GraphicsConfiguration getDeviceConfiguration() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /**
+ * Returns the color model of this Graphics object.
+ *
+ * @return the color model of this Graphics object
+ */
+ protected ColorModel getColorModel() {
+ return image.getColorModel();
+ }
+
+ /**
+ * Returns a WritableRaster that is used by this class to perform the rendering on.
+ *
+ * @return the destination raster
+ */
+ protected WritableRaster getDestinationRaster() {
+ return image.getRaster();
+ }
+}
Modified: trunk/gui/src/awt/org/jnode/awt/image/JNodeBufferedImage.java
===================================================================
--- trunk/gui/src/awt/org/jnode/awt/image/JNodeBufferedImage.java 2008-07-17 09:55:42 UTC (rev 4303)
+++ trunk/gui/src/awt/org/jnode/awt/image/JNodeBufferedImage.java 2008-07-17 10:12:06 UTC (rev 4304)
@@ -28,6 +28,7 @@
import java.awt.image.IndexColorModel;
import java.awt.image.WritableRaster;
import java.util.Hashtable;
+import org.jnode.awt.GraphicsFactory;
/**
* @author epr
@@ -70,6 +71,6 @@
*/
public Graphics2D createGraphics() {
return SystemProperties.getProperty("gnu.javax.swing.noGraphics2D") == null ?
- new JNodeBufferedImageGraphics2D(this) : new JNodeBufferedImageGraphics(this);
+ new JNodeBufferedImageGraphics2D(this) : GraphicsFactory.getInstance().createGraphics(this);
}
}
Modified: trunk/gui/src/awt/org/jnode/awt/swingpeers/DesktopFramePeer.java
===================================================================
--- trunk/gui/src/awt/org/jnode/awt/swingpeers/DesktopFramePeer.java 2008-07-17 09:55:42 UTC (rev 4303)
+++ trunk/gui/src/awt/org/jnode/awt/swingpeers/DesktopFramePeer.java 2008-07-17 10:12:06 UTC (rev 4304)
@@ -51,8 +51,8 @@
import java.awt.peer.FramePeer;
import org.apache.log4j.Logger;
import org.jnode.awt.JNodeGenericPeer;
-import org.jnode.awt.JNodeGraphics;
import org.jnode.awt.JNodeGraphics2D;
+import org.jnode.awt.GraphicsFactory;
import sun.awt.CausedFocusEvent;
/**
@@ -319,7 +319,7 @@
*/
public Graphics getGraphics() {
return SystemProperties.getProperty("gnu.javax.swing.noGraphics2D") == null ?
- new JNodeGraphics2D(this) : new JNodeGraphics(this);
+ new JNodeGraphics2D(this) : GraphicsFactory.getInstance().createGraphics(this);
}
/**
Modified: trunk/gui/src/awt/org/jnode/awt/swingpeers/SwingComponentPeer.java
===================================================================
--- trunk/gui/src/awt/org/jnode/awt/swingpeers/SwingComponentPeer.java 2008-07-17 09:55:42 UTC (rev 4303)
+++ trunk/gui/src/awt/org/jnode/awt/swingpeers/SwingComponentPeer.java 2008-07-17 10:12:06 UTC (rev 4304)
@@ -40,6 +40,7 @@
import java.awt.Rectangle;
import java.awt.event.ComponentEvent;
import java.awt.event.FocusEvent;
+import java.awt.event.MouseEvent;
import java.awt.event.PaintEvent;
import java.awt.image.ColorModel;
import java.awt.image.ImageObserver;
@@ -52,8 +53,8 @@
import java.security.PrivilegedAction;
import org.apache.log4j.Logger;
import org.jnode.awt.JNodeGenericPeer;
-import org.jnode.awt.JNodeGraphics;
import org.jnode.awt.JNodeGraphics2D;
+import org.jnode.awt.GraphicsFactory;
import sun.awt.CausedFocusEvent;
/**
@@ -170,7 +171,7 @@
final int width = peerComponent.getWidth();
final int height = peerComponent.getHeight();
Graphics g = SystemProperties.getProperty("gnu.javax.swing.noGraphics2D") == null ?
- new JNodeGraphics2D(this) : new JNodeGraphics(this);
+ new JNodeGraphics2D(this) : GraphicsFactory.getInstance().createGraphics(this);
g.translate(x, y);
g.clipRect(0, 0, width, height);
@@ -225,8 +226,12 @@
//Point p = component.getLocationOnScreen();
//g.translate(p.x, p.y);
if (event.getID() == PaintEvent.PAINT) {
+ if (!(targetComponent instanceof java.awt.Window))
+ peerComponent.paint(g);
targetComponent.paint(g);
} else {
+ if (!(targetComponent instanceof java.awt.Window))
+ peerComponent.update(g);
targetComponent.update(g);
}
//g.translate(-p.x, -p.y);
@@ -242,13 +247,25 @@
switch (id) {
case PaintEvent.PAINT:
case PaintEvent.UPDATE: {
- //processPaintEvent((PaintEvent)event);
+ processPaintEvent((PaintEvent) event);
break;
}
default: {
if (event.getSource() == targetComponent) {
event.setSource(peerComponent);
}
+ if (event.getID() == MouseEvent.MOUSE_ENTERED) {
+ Object source = event.getSource();
+ if (source instanceof Component) {
+ Component comp = (Component) source;
+ Cursor cur = comp.getCursor();
+ if (cur != null) {
+ comp.setCursor(cur);
+ } else {
+ comp.setCursor(Cursor.getDefaultCursor());
+ }
+ }
+ }
((ISwingPeer<awtT>) peerComponent).processAWTEvent(event);
break;
}
@@ -289,8 +306,11 @@
}
public final void paint(Graphics g) {
- //peerComponent.paint(g);
- toolkit.postEvent(new PaintEvent(targetComponent, PaintEvent.PAINT, targetComponent.getBounds()));
+ if (!(targetComponent instanceof java.awt.Window)) {
+ peerComponent.paint(g);
+ targetComponent.paint(g);
+ } else
+ toolkit.postEvent(new PaintEvent(targetComponent, PaintEvent.PAINT, targetComponent.getBounds()));
}
// Deprecated
@@ -474,7 +494,12 @@
// Cursor
public final void updateCursorImmediately() {
- toolkit.updateCursor(peerComponent.getCursor());
+
+ Cursor cur = targetComponent.getCursor();
+// org.jnode.vm.Unsafe.debug("JNodeToolkit.updateCursor()-2 " + cur + " for " + targetComponent + "\n");
+// org.jnode.vm.Unsafe.debugStackTrace(100);
+ peerComponent.setCursor(cur);
+ toolkit.updateCursor(cur);
}
/**
Added: trunk/gui/src/awt/org/jnode/awt/util/BasicGraphics.java
===================================================================
--- trunk/gui/src/awt/org/jnode/awt/util/BasicGraphics.java (rev 0)
+++ trunk/gui/src/awt/org/jnode/awt/util/BasicGraphics.java 2008-07-17 10:12:06 UTC (rev 4304)
@@ -0,0 +1,332 @@
+/*
+ * $
+ */
+package org.jnode.awt.util;
+
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.Shape;
+import java.awt.Toolkit;
+import java.awt.geom.Rectangle2D;
+
+/**
+ * @author Levente S\u00e1ntha
+ */
+public abstract class BasicGraphics extends Graphics {
+ protected Rectangle clip;
+ protected Point origin = new Point();
+ protected Color color = Color.BLACK;
+ protected Font font = new Font("Luxi Sans", Font.PLAIN, 10);
+
+ protected BasicGraphics() {
+
+ }
+
+ protected BasicGraphics(BasicGraphics g) {
+ this.clip = g.clip.getBounds();
+ this.origin = g.origin.getLocation();
+ this.color = g.color;
+ this.font = g.font;
+ }
+
+ /**
+ * Intersects the current clip with the specified rectangle.
+ * The resulting clipping area is the intersection of the current
+ * clipping area and the specified rectangle. If there is no
+ * current clipping area, either because the clip has never been
+ * set, or the clip has been cleared using <code>setClip(null)</code>,
+ * the specified rectangle becomes the new clip.
+ * This method sets the user clip, which is independent of the
+ * clipping associated with device bounds and window visibility.
+ * This method can only be used to make the current clip smaller.
+ * To set the current clip larger, use any of the setClip methods.
+ * Rendering operations have no effect outside of the clipping area.
+ *
+ * @param x the x coordinate of the rectangle to intersect the clip with
+ * @param y the y coordinate of the rectangle to intersect the clip with
+ * @param width the width of the rectangle to intersect the clip with
+ * @param height the height of the rectangle to intersect the clip with
+ * @see #setClip(int, int, int, int)
+ * @see #setClip(java.awt.Shape)
+ */
+ public void clipRect(int x, int y, int width, int height) {
+ Rectangle r = new Rectangle(x, y, width, height);
+ _transform(r);
+ if (clip == null)
+ clip = r;
+ else
+ clip = clip.intersection(r);
+
+ if (this.clip.width == 0 && this.clip.height == 0) {
+ org.jnode.vm.Unsafe.debug("SimpleSurfaceGraphics: zero clip " + clip + "\n");
+ org.jnode.vm.Unsafe.debugStackTrace();
+ }
+ }
+
+ /**
+ * Disposes of this graphics context and releases
+ * any system resources that it is using.
+ * A <code>Graphics</code> object cannot be used after
+ * <code>dispose</code>has been called.
+ * <p/>
+ * When a Java program runs, a large number of <code>Graphics</code>
+ * objects can be created within a short time frame.
+ * Although the finalization process of the garbage collector
+ * also disposes of the same system resources, it is preferable
+ * to manually free the associated resources by calling this
+ * method rather than to rely on a finalization process which
+ * may not run to completion for a long period of time.
+ * <p/>
+ * Graphics objects which are provided as arguments to the
+ * <code>paint</code> and <code>update</code> methods
+ * of components are automatically released by the system when
+ * those methods return. For efficiency, programmers should
+ * call <code>dispose</code> when finished using
+ * a <code>Graphics</code> object only if it was created
+ * directly from a component or another <code>Graphics</code> object.
+ *
+ * @see java.awt.Graphics#finalize
+ * @see java.awt.Component#paint
+ * @see java.awt.Component#update
+ * @see java.awt.Component#getGraphics
+ * @see java.awt.Graphics#create
+ */
+ public void dispose() {
+
+ }
+
+ /**
+ * Gets the current clipping area.
+ * This method returns the user clip, which is independent of the
+ * clipping associated with device bounds and window visibility.
+ * If no clip has previously been set, or if the clip has been
+ * cleared using <code>setClip(null)</code>, this method returns
+ * <code>null</code>.
+ *
+ * @return a <code>Shape</code> object representing the
+ * current clipping area, or <code>null</code> if
+ * no clip is set.
+ * @see java.awt.Graphics#getClipBounds
+ * @see java.awt.Graphics#clipRect
+ * @see java.awt.Graphics#setClip(int, int, int, int)
+ * @see java.awt.Graphics#setClip(java.awt.Shape)
+ * @since JDK1.1
+ */
+ public Shape getClip() {
+ if (clip == null)
+ return null;
+
+ Rectangle c = new Rectangle(clip);
+ i_transform(c);
+ return c;
+ }
+
+ /**
+ * Returns the bounding rectangle of the current clipping area.
+ * This method refers to the user clip, which is independent of the
+ * clipping associated with device bounds and window visibility.
+ * If no clip has previously been set, or if the clip has been
+ * cleared using <code>setClip(null)</code>, this method returns
+ * <code>null</code>.
+ * The coordinates in the rectangle are relative to the coordinate
+ * system origin of this graphics context.
+ *
+ * @return the bounding rectangle of the current clipping area,
+ * or <code>null</code> if no clip is set.
+ * @see java.awt.Graphics#getClip
+ * @see java.awt.Graphics#clipRect
+ * @see java.awt.Graphics#setClip(int, int, int, int)
+ * @see java.awt.Graphics#setClip(java.awt.Shape)
+ * @since JDK1.1
+ */
+ public Rectangle getClipBounds() {
+ if (clip == null)
+ return null;
+
+ Rectangle c = new Rectangle(clip);
+ i_transform(c);
+ return c;
+ }
+
+ /**
+ * Gets this graphics context's current color.
+ *
+ * @return this graphics context's current color.
+ * @see java.awt.Color
+ * @see java.awt.Graphics#setColor(java.awt.Color)
+ */
+ public Color getColor() {
+ return color;
+ }
+
+ /**
+ * Gets the current font.
+ *
+ * @return this graphics context's current font.
+ * @see java.awt.Font
+ * @see java.awt.Graphics#setFont(java.awt.Font)
+ */
+ public Font getFont() {
+ return font;
+ }
+
+ /**
+ * Gets the font metrics for the specified font.
+ *
+ * @param f the specified font
+ * @return the font metrics for the specified font.
+ * @see java.awt.Graphics#getFont
+ * @see java.awt.FontMetrics
+ * @see java.awt.Graphics#getFontMetrics()
+ */
+ public FontMetrics getFontMetrics(Font f) {
+ return Toolkit.getDefaultToolkit().getFontMetrics(font);
+ }
+
+ /**
+ * Sets the current clipping area to an arbitrary clip shape.
+ * Not all objects that implement the <code>Shape</code>
+ * interface can be used to set the clip. The only
+ * <code>Shape</code> objects that are guaranteed to be
+ * supported are <code>Shape</code> objects that are
+ * obtained via the <code>getClip</code> method and via
+ * <code>Rectangle</code> objects. This method sets the
+ * user clip, which is independent of the clipping associated
+ * with device bounds and window visibility.
+ *
+ * @param clip the <code>Shape</code> to use to set the clip
+ * @see java.awt.Graphics#getClip()
+ * @see java.awt.Graphics#clipRect
+ * @see java.awt.Graphics#setClip(int, int, int, int)
+ * @since JDK1.1
+ */
+ public void setClip(Shape clip) {
+ if (clip instanceof Rectangle) {
+ this.clip = new Rectangle((Rectangle) clip);
+ _transform(this.clip);
+ } else if (clip instanceof Rectangle2D) {
+ this.clip = clip.getBounds();
+ _transform(this.clip);
+ }
+ if (this.clip.width == 0 && this.clip.height == 0) {
+ org.jnode.vm.Unsafe.debug("SimpleSurfaceGraphics: zero clip " + clip + "\n");
+ org.jnode.vm.Unsafe.debugStackTrace();
+ }
+ }
+
+ /**
+ * Sets the current clip to the rectangle specified by the given
+ * coordinates. This method sets the user clip, which is
+ * independent of the clipping associated with device bounds
+ * and window visibility.
+ * Rendering operations have no effect outside of the clipping area.
+ *
+ * @param x the <i>x</i> coordinate of the new clip rectangle.
+ * @param y the <i>y</i> coordinate of the new clip rectangle.
+ * @param width the width of the new clip rectangle.
+ * @param height the height of the new clip rectangle.
+ * @see java.awt.Graphics#getClip
+ * @see java.awt.Graphics#clipRect
+ * @see java.awt.Graphics#setClip(java.awt.Shape)
+ * @since JDK1.1
+ */
+ public void setClip(int x, int y, int width, int height) {
+ this.clip = new Rectangle(x, y, width, height);
+ _transform(this.clip);
+ if (clip.width == 0 && clip.height == 0) {
+ org.jnode.vm.Unsafe.debug("SimpleSurfaceGraphics: zero clip " + clip + "\n");
+ org.jnode.vm.Unsafe.debugStackTrace();
+ }
+ }
+
+ /**
+ * Sets this graphics context's current color to the specified
+ * color. All subsequent graphics operations using this graphics
+ * context use this specified color.
+ *
+ * @param c the new rendering color.
+ * @see java.awt.Color
+ * @see java.awt.Graphics#getColor
+ */
+ public void setColor(Color c) {
+ if (c != null)
+ this.color = c;
+ }
+
+ /**
+ * Sets this graphics context's font to the specified font.
+ * All subsequent text operations using this graphics context
+ * use this font. A null argument is silently ignored.
+ *
+ * @param font the font.
+ * @see java.awt.Graphics#getFont
+ * @see java.awt.Graphics#drawString(String, int, int)
+ * @see java.awt.Graphics#drawBytes(byte[], int, int, int, int)
+ * @see java.awt.Graphics#drawChars(char[], int, int, int, int)
+ */
+ public void setFont(Font font) {
+ if (font != null)
+ this.font = font;
+ }
+
+ /**
+ * Sets the paint mode of this graphics context to overwrite the
+ * destination with this graphics context's current color.
+ * This sets the logical pixel operation function to the paint or
+ * overwrite mode. Al...
[truncated message content] |
|
From: <fd...@us...> - 2008-07-17 18:23:01
|
Revision: 4315
http://jnode.svn.sourceforge.net/jnode/?rev=4315&view=rev
Author: fduminy
Date: 2008-07-17 18:22:59 +0000 (Thu, 17 Jul 2008)
Log Message:
-----------
eclipse setting: set source code level to 1.6 instead of 1.5
Modified Paths:
--------------
trunk/all/.settings/org.eclipse.jdt.core.prefs
trunk/builder/.settings/org.eclipse.jdt.core.prefs
Modified: trunk/all/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/all/.settings/org.eclipse.jdt.core.prefs 2008-07-17 16:56:05 UTC (rev 4314)
+++ trunk/all/.settings/org.eclipse.jdt.core.prefs 2008-07-17 18:22:59 UTC (rev 4315)
@@ -1,12 +1,12 @@
-#Tue Apr 12 20:07:44 CEST 2005
+#Mon Jul 14 11:35:05 CEST 2008
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.source=1.6
Modified: trunk/builder/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/builder/.settings/org.eclipse.jdt.core.prefs 2008-07-17 16:56:05 UTC (rev 4314)
+++ trunk/builder/.settings/org.eclipse.jdt.core.prefs 2008-07-17 18:22:59 UTC (rev 4315)
@@ -1,12 +1,12 @@
-#Tue Apr 12 20:08:18 CEST 2005
+#Mon Jul 14 11:34:38 CEST 2008
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.source=1.6
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fd...@us...> - 2008-07-17 18:25:08
|
Revision: 4316
http://jnode.svn.sourceforge.net/jnode/?rev=4316&view=rev
Author: fduminy
Date: 2008-07-17 18:25:02 +0000 (Thu, 17 Jul 2008)
Log Message:
-----------
eclipse setting: set source code level to 1.6 instead of 1.5
Modified Paths:
--------------
trunk/core/.settings/org.eclipse.jdt.core.prefs
trunk/distr/.settings/org.eclipse.jdt.core.prefs
trunk/fs/.settings/org.eclipse.jdt.core.prefs
trunk/gui/.settings/org.eclipse.jdt.core.prefs
trunk/net/.settings/org.eclipse.jdt.core.prefs
trunk/shell/.settings/org.eclipse.jdt.core.prefs
trunk/textui/.settings/org.eclipse.jdt.core.prefs
Modified: trunk/core/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/core/.settings/org.eclipse.jdt.core.prefs 2008-07-17 18:22:59 UTC (rev 4315)
+++ trunk/core/.settings/org.eclipse.jdt.core.prefs 2008-07-17 18:25:02 UTC (rev 4316)
@@ -1,12 +1,12 @@
-#Tue Apr 12 20:08:32 CEST 2005
+#Sun Jul 13 17:28:21 CEST 2008
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.source=1.6
Modified: trunk/distr/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/distr/.settings/org.eclipse.jdt.core.prefs 2008-07-17 18:22:59 UTC (rev 4315)
+++ trunk/distr/.settings/org.eclipse.jdt.core.prefs 2008-07-17 18:25:02 UTC (rev 4316)
@@ -1,12 +1,12 @@
-#Tue Apr 12 20:12:11 CEST 2005
+#Mon Jul 14 11:34:24 CEST 2008
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.source=1.6
Modified: trunk/fs/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/fs/.settings/org.eclipse.jdt.core.prefs 2008-07-17 18:22:59 UTC (rev 4315)
+++ trunk/fs/.settings/org.eclipse.jdt.core.prefs 2008-07-17 18:25:02 UTC (rev 4316)
@@ -1,12 +1,12 @@
-#Tue Apr 12 20:12:27 CEST 2005
+#Mon Jul 14 11:33:25 CEST 2008
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.source=1.6
Modified: trunk/gui/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/gui/.settings/org.eclipse.jdt.core.prefs 2008-07-17 18:22:59 UTC (rev 4315)
+++ trunk/gui/.settings/org.eclipse.jdt.core.prefs 2008-07-17 18:25:02 UTC (rev 4316)
@@ -1,12 +1,12 @@
-#Tue Apr 12 20:12:42 CEST 2005
+#Mon Jul 14 11:33:36 CEST 2008
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.source=1.6
Modified: trunk/net/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/net/.settings/org.eclipse.jdt.core.prefs 2008-07-17 18:22:59 UTC (rev 4315)
+++ trunk/net/.settings/org.eclipse.jdt.core.prefs 2008-07-17 18:25:02 UTC (rev 4316)
@@ -1,12 +1,12 @@
-#Tue Apr 12 20:12:58 CEST 2005
+#Mon Jul 14 11:33:46 CEST 2008
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.source=1.6
Modified: trunk/shell/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/shell/.settings/org.eclipse.jdt.core.prefs 2008-07-17 18:22:59 UTC (rev 4315)
+++ trunk/shell/.settings/org.eclipse.jdt.core.prefs 2008-07-17 18:25:02 UTC (rev 4316)
@@ -1,12 +1,21 @@
-#Sun Mar 30 11:39:36 EST 2008
+#Mon Jul 14 11:34:04 CEST 2008
eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
org.eclipse.jdt.core.compiler.problem.deprecation=warning
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
@@ -54,3 +63,4 @@
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.6
Modified: trunk/textui/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/textui/.settings/org.eclipse.jdt.core.prefs 2008-07-17 18:22:59 UTC (rev 4315)
+++ trunk/textui/.settings/org.eclipse.jdt.core.prefs 2008-07-17 18:25:02 UTC (rev 4316)
@@ -1,12 +1,12 @@
-#Tue Apr 12 20:13:31 CEST 2005
+#Mon Jul 14 11:34:13 CEST 2008
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.source=1.6
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fd...@us...> - 2008-07-18 21:01:08
|
Revision: 4319
http://jnode.svn.sourceforge.net/jnode/?rev=4319&view=rev
Author: fduminy
Date: 2008-07-18 21:01:05 +0000 (Fri, 18 Jul 2008)
Log Message:
-----------
changes in grub setting for vesa graphic mode :
- multiboot header is now always present in jnode kernel
- jnode.properties and build-x86.xml no longer need a property to specify the wanted video mode : instead the grub menu items will specify it
Modified Paths:
--------------
trunk/all/build-x86.xml
trunk/all/conf/x86/menu-cdrom.lst
trunk/all/conf/x86/menu.lst
trunk/builder/src/builder/org/jnode/ant/taskdefs/Asm.java
trunk/builder/src/builder/org/jnode/build/x86/BootImageBuilder.java
trunk/core/src/native/x86/kernel.asm
trunk/core/src/native/x86/unsafex86.asm
Modified: trunk/all/build-x86.xml
===================================================================
--- trunk/all/build-x86.xml 2008-07-17 18:35:19 UTC (rev 4318)
+++ trunk/all/build-x86.xml 2008-07-18 21:01:05 UTC (rev 4319)
@@ -21,7 +21,6 @@
<property name="grub.stage2.name" value="stage2" />
<property name="grub.menu" value="${my-conf.dir}/menu.lst" />
<property name="grub.menu.cdrom" value="${my-conf.dir}/menu-cdrom.lst" />
- <property name="jnode.vbeMode" value=""/> <!-- define a default value in case none is given in jnode.properties -->
<!-- Properties for building the boot files for windows NT/2K/XP -->
<property name="jnode.install-nt.dir" value="C:\jnode" />
@@ -151,7 +150,6 @@
bits="${jnode.bits}"
listfile="${build.native.dir}/jnodenative.lst"
enablejnasm="${jnode.enable.jnasm}"
- vbeMode="${jnode.vbeMode}"
version="${jnode-ver} ${TODAY}">
<includedir dir="${src.native.dir}/x86" />
<includedir dir="${build.native.dir}/src" />
@@ -176,7 +174,6 @@
version="${jnode-ver}"
jnodeCompiler="${jnode.compiler}"
bits="${jnode.bits}"
- vbeMode="${jnode.vbeMode}"
enableJNasm="${jnode.enable.jnasm}">
<nanokernelsources srcfile="${src.native.dir}/x86/jnode.asm">
Modified: trunk/all/conf/x86/menu.lst
===================================================================
--- trunk/all/conf/x86/menu.lst 2008-07-17 18:35:19 UTC (rev 4318)
+++ trunk/all/conf/x86/menu.lst 2008-07-18 21:01:05 UTC (rev 4319)
@@ -19,6 +19,13 @@
#module /fullgui.jgz
# ---------------------------
+# -- disabled
+#title JNode GUI (all plugins) (VESA mode)
+#kernel /jnode32.gz mp=no
+#vbematch 800 600 32
+#module /fullgui.jgz
+
+# ---------------------------
title JNode (default with MP)
kernel (hd0,0)/jnode32.gz
module (hd0,0)/default.jgz
Modified: trunk/builder/src/builder/org/jnode/ant/taskdefs/Asm.java
===================================================================
--- trunk/builder/src/builder/org/jnode/ant/taskdefs/Asm.java 2008-07-17 18:35:19 UTC (rev 4318)
+++ trunk/builder/src/builder/org/jnode/ant/taskdefs/Asm.java 2008-07-18 21:01:05 UTC (rev 4319)
@@ -98,8 +98,6 @@
private String version;
- private boolean setVbe;
-
/**
* Add an includedir
*
@@ -109,11 +107,6 @@
includeDirs.add(dir);
}
- public void setVbeMode(String vbeMode) {
- System.err.println("setVbeMode");
- this.setVbe = (vbeMode != null) && (vbeMode.trim().length() > 0);
- }
-
/**
* Description of the Method
*
@@ -146,12 +139,6 @@
cmdLine.add("nasm");
}
- if (setVbe) {
- System.err.println("setVbeMode : add property");
- cmdLine.add("-D");
- cmdLine.add("SETUP_VBE");
- }
-
cmdLine.add("-D");
cmdLine.add("BITS" + bits);
Modified: trunk/builder/src/builder/org/jnode/build/x86/BootImageBuilder.java
===================================================================
--- trunk/builder/src/builder/org/jnode/build/x86/BootImageBuilder.java 2008-07-17 18:35:19 UTC (rev 4318)
+++ trunk/builder/src/builder/org/jnode/build/x86/BootImageBuilder.java 2008-07-18 21:01:05 UTC (rev 4319)
@@ -25,12 +25,12 @@
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
-import java.util.StringTokenizer;
+
import org.apache.tools.ant.Project;
import org.jnode.assembler.Label;
import org.jnode.assembler.NativeStream;
-import org.jnode.assembler.NativeStream.ObjectInfo;
import org.jnode.assembler.UnresolvedObjectRefException;
+import org.jnode.assembler.NativeStream.ObjectInfo;
import org.jnode.assembler.x86.X86BinaryAssembler;
import org.jnode.assembler.x86.X86Constants;
import org.jnode.assembler.x86.X86Register;
@@ -95,11 +95,6 @@
private int bits = 32;
- private boolean useVbe = false;
- private int vbeWidth = 0;
- private int vbeHeight = 0;
- private int vbeDepth = 0;
-
/**
* The offset in our (java) image file to the initial jump to our
* main-method
@@ -657,12 +652,6 @@
+ os.getLength());
os.set32(mb_hdr + MB_BSS_END_ADDR, (int) os.getBaseAddr()
+ os.getLength());
-
- // initial wanted video mode (if possible)
- os.set32(mb_hdr + MODE_TYPE, 0);
- os.set32(mb_hdr + WIDTH, vbeWidth);
- os.set32(mb_hdr + HEIGHT, vbeHeight);
- os.set32(mb_hdr + DEPTH, vbeDepth);
}
/**
@@ -737,38 +726,6 @@
this.bits = bits;
}
- public final void setVbeMode(String videoMode) {
- System.out.println("videoMode=" + videoMode);
- if ((videoMode == null) || (videoMode.trim().length() == 0)) {
- useVbe = false;
- vbeWidth = 0;
- vbeHeight = 0;
- vbeDepth = 0;
- } else {
- StringTokenizer stok = new StringTokenizer(videoMode.trim().toLowerCase(), "x", false);
- if (stok.countTokens() != 3) {
- throw new IllegalArgumentException("linearFrameBuffer must be of the form '<width>x<height>x<depth>'");
- }
-
- vbeWidth = Integer.parseInt(stok.nextToken());
- if (vbeWidth <= 0) {
- throw new IllegalArgumentException("vbeWidth must be > 0");
- }
-
- vbeHeight = Integer.parseInt(stok.nextToken());
- if (vbeWidth <= 0) {
- throw new IllegalArgumentException("vbeHeight must be > 0");
- }
-
- vbeDepth = Integer.parseInt(stok.nextToken());
- if (vbeWidth <= 0) {
- throw new IllegalArgumentException("vbeDepth must be > 0");
- }
-
- useVbe = true;
- }
- }
-
/**
* Initialize the statics table.
*
@@ -798,11 +755,6 @@
symbols.put(bits, "");
symbols.put("JNODE_VERSION", "'" + version + "'");
- if (useVbe) {
- symbols.put("SETUP_VBE", "");
- log("Grub will setup linear framebuffer mode " + vbeWidth + "x" + vbeHeight + "x" + vbeDepth);
- }
-
log("Compiling native kernel with JNAsm, Version " + version + ", " + i_bist + " bits");
JNAsm.assembler(os, sourceInfo, symbols);
} catch (Exception e) {
Modified: trunk/core/src/native/x86/kernel.asm
===================================================================
--- trunk/core/src/native/x86/kernel.asm 2008-07-17 18:35:19 UTC (rev 4318)
+++ trunk/core/src/native/x86/kernel.asm 2008-07-18 21:01:05 UTC (rev 4319)
@@ -95,7 +95,7 @@
jb multiboot_mmap_copy
multiboot_mmap_done:
-%ifdef SETUP_VBE
+; setup the vbe infos
; Are vbe informations available ?
test dword [multiboot_info+MBI_FLAGS],MBF_VBE
jz vbe_info_done ; no vbe info, jump to end
@@ -125,8 +125,8 @@
mov ecx,VBEMODEINFO_SIZE
rep movsb
vbe_info_done:
-%endif
+
; Initialize initial jarfile
mov esi,[multiboot_info+MBI_MODSCOUNT]
test esi,esi
@@ -314,7 +314,7 @@
dd 0 ; Entries
times (MBI_MMAP_MAX * MBMMAP_ESIZE) db 0
-%ifdef SETUP_VBE
+; vbe informations
multiboot_vbe:
times (VBE_ESIZE) db 0
@@ -323,4 +323,3 @@
vbe_mode_info:
times (VBEMODEINFO_SIZE) db 0
-%endif
\ No newline at end of file
Modified: trunk/core/src/native/x86/unsafex86.asm
===================================================================
--- trunk/core/src/native/x86/unsafex86.asm 2008-07-17 18:35:19 UTC (rev 4318)
+++ trunk/core/src/native/x86/unsafex86.asm 2008-07-18 21:01:05 UTC (rev 4319)
@@ -84,32 +84,17 @@
; Address getVbeInfos();
GLABEL Q53org5jnode2vm3x869UnsafeX8623getVbeInfos2e2829Lorg2fvmmagic2funboxed2fAddress3b
-%ifdef SETUP_VBE
mov AAX,multiboot_vbe
-%endif
-%ifndef SETUP_VBE
- mov AAX,0
-%endif
ret
; Address getVbeControlInfos();
GLABEL Q53org5jnode2vm3x869UnsafeX8623getVbeControlInfos2e2829Lorg2fvmmagic2funboxed2fAddress3b
-%ifdef SETUP_VBE
mov AAX,vbe_control_info
-%endif
-%ifndef SETUP_VBE
- mov AAX,0
-%endif
ret
; Address getVbeModeInfos();
GLABEL Q53org5jnode2vm3x869UnsafeX8623getVbeModeInfos2e2829Lorg2fvmmagic2funboxed2fAddress3b
-%ifdef SETUP_VBE
mov AAX,vbe_mode_info
-%endif
-%ifndef SETUP_VBE
- mov AAX,0
-%endif
ret
; void setupBootCode(Address memory, int[] gdtBase, int[] tss);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2008-07-19 13:24:56
|
Revision: 4324
http://jnode.svn.sourceforge.net/jnode/?rev=4324&view=rev
Author: lsantha
Date: 2008-07-19 13:24:43 +0000 (Sat, 19 Jul 2008)
Log Message:
-----------
Fixed image scrolling and problems with the visibility of window content.
Modified Paths:
--------------
trunk/all/conf/openjdk-annotations.properties
trunk/gui/src/awt/org/jnode/awt/swingpeers/SwingComponentPeer.java
trunk/gui/src/awt/org/jnode/awt/util/BasicGraphics.java
trunk/gui/src/awt/org/jnode/awt/util/BasicSurfaceGraphics.java
trunk/gui/src/awt/org/jnode/awt/util/SurfaceGraphics2D.java
Modified: trunk/all/conf/openjdk-annotations.properties
===================================================================
--- trunk/all/conf/openjdk-annotations.properties 2008-07-19 02:04:07 UTC (rev 4323)
+++ trunk/all/conf/openjdk-annotations.properties 2008-07-19 13:24:43 UTC (rev 4324)
@@ -8,3 +8,4 @@
java/lang/Throwable.class=MagicPermission
java/util/Currency.class=SharedStatics
sun/misc/SharedSecrets.class=SharedStatics
+java/awt/Toolkit.class=SharedStatics
Modified: trunk/gui/src/awt/org/jnode/awt/swingpeers/SwingComponentPeer.java
===================================================================
--- trunk/gui/src/awt/org/jnode/awt/swingpeers/SwingComponentPeer.java 2008-07-19 02:04:07 UTC (rev 4323)
+++ trunk/gui/src/awt/org/jnode/awt/swingpeers/SwingComponentPeer.java 2008-07-19 13:24:43 UTC (rev 4324)
@@ -221,10 +221,11 @@
* Response on paint events.
*/
private void processPaintEvent(PaintEvent event) {
+ if(!targetComponent.isVisible() || !peerComponent.isVisible())
+ return;
+
final Graphics g = peerComponent.getGraphics();
if (g != null) {
- //Point p = component.getLocationOnScreen();
- //g.translate(p.x, p.y);
if (event.getID() == PaintEvent.PAINT) {
if (!(targetComponent instanceof java.awt.Window))
peerComponent.paint(g);
@@ -234,7 +235,6 @@
peerComponent.update(g);
targetComponent.update(g);
}
- //g.translate(-p.x, -p.y);
g.dispose();
}
}
Modified: trunk/gui/src/awt/org/jnode/awt/util/BasicGraphics.java
===================================================================
--- trunk/gui/src/awt/org/jnode/awt/util/BasicGraphics.java 2008-07-19 02:04:07 UTC (rev 4323)
+++ trunk/gui/src/awt/org/jnode/awt/util/BasicGraphics.java 2008-07-19 13:24:43 UTC (rev 4324)
@@ -212,10 +212,6 @@
this.clip = clip.getBounds();
_transform(this.clip);
}
- if (this.clip.width == 0 && this.clip.height == 0) {
- org.jnode.vm.Unsafe.debug("SimpleSurfaceGraphics: zero clip " + clip + "\n");
- org.jnode.vm.Unsafe.debugStackTrace();
- }
}
/**
@@ -237,10 +233,6 @@
public void setClip(int x, int y, int width, int height) {
this.clip = new Rectangle(x, y, width, height);
_transform(this.clip);
- if (clip.width == 0 && clip.height == 0) {
- org.jnode.vm.Unsafe.debug("SimpleSurfaceGraphics: zero clip " + clip + "\n");
- org.jnode.vm.Unsafe.debugStackTrace();
- }
}
/**
Modified: trunk/gui/src/awt/org/jnode/awt/util/BasicSurfaceGraphics.java
===================================================================
--- trunk/gui/src/awt/org/jnode/awt/util/BasicSurfaceGraphics.java 2008-07-19 02:04:07 UTC (rev 4323)
+++ trunk/gui/src/awt/org/jnode/awt/util/BasicSurfaceGraphics.java 2008-07-19 13:24:43 UTC (rev 4324)
@@ -383,11 +383,14 @@
Raster rast = getCompatibleRaster(img);
Rectangle r = new Rectangle(x, y, rast.getWidth(), rast.getHeight());
_transform(r);
+ final int tx = r.x, ty = r.y;
if (clip != null)
r = clip.intersection(r);
- surface.drawCompatibleRaster(rast, 0, 0, r.x, r.y, r.width, r.height, bgcolor);
- surface.update(r.x, r.y, r.width + 2, r.height + 2);
+ if(!r.isEmpty()){
+ surface.drawCompatibleRaster(rast, r.x - tx, r.y - ty, r.x, r.y, r.width, r.height, bgcolor);
+ surface.update(r.x, r.y, r.width, r.height);
+ }
return true;
} catch (InterruptedException ie) {
return false;
@@ -433,11 +436,14 @@
Raster rast = getCompatibleRaster(img);
Rectangle r = new Rectangle(x, y, rast.getWidth(), rast.getHeight());
_transform(r);
+ final int tx = r.x, ty = r.y;
if (clip != null)
r = clip.intersection(r);
- surface.drawCompatibleRaster(rast, 0, 0, r.x, r.y, r.width, r.height, null);
- surface.update(r.x, r.y, r.width + 2, r.height + 2);
+ if(!r.isEmpty()){
+ surface.drawCompatibleRaster(rast, r.x - tx, r.y - ty, r.x, r.y, r.width, r.height, null);
+ surface.update(r.x, r.y, r.width, r.height);
+ }
return true;
} catch (InterruptedException ie) {
return false;
@@ -966,7 +972,9 @@
// Convert it to a raster
final PixelGrabber grabber =
new PixelGrabber(image, 0, 0, image.getWidth(null), image.getHeight(null), true);
- if (grabber.grabPixels()) {
+ org.jnode.vm.Unsafe.debug("BasicSurfaceGraphics.getCompatibleRaster() " + image + ", " +
+ image.getWidth(null) + ", " + image.getHeight(null) + "\n");
+ if (grabber.grabPixels(10000)) {
final int w = grabber.getWidth();
final int h = grabber.getHeight();
final WritableRaster raster = dstModel.createCompatibleWritableRaster(w, h);
@@ -982,6 +990,7 @@
}
return raster;
} else {
+ org.jnode.vm.Unsafe.debug("SimpleSurfaceGraphics2D.drawImage()-1\n");
throw new IllegalArgumentException("Cannot grab pixels");
}
}
Modified: trunk/gui/src/awt/org/jnode/awt/util/SurfaceGraphics2D.java
===================================================================
--- trunk/gui/src/awt/org/jnode/awt/util/SurfaceGraphics2D.java 2008-07-19 02:04:07 UTC (rev 4323)
+++ trunk/gui/src/awt/org/jnode/awt/util/SurfaceGraphics2D.java 2008-07-19 13:24:43 UTC (rev 4324)
@@ -43,10 +43,10 @@
*/
public abstract class SurfaceGraphics2D extends Graphics2D {
private static final BasicStroke DEFAULT_STROKE = new BasicStroke();
- private static final HashMap DEFAULT_HINTS;
+ private static final HashMap<RenderingHints.Key, ?> DEFAULT_HINTS;
static {
- HashMap hints = new HashMap();
+ HashMap<RenderingHints.Key, Object> hints = new HashMap<RenderingHints.Key, Object>();
hints.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT);
hints.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_DEFAULT);
DEFAULT_HINTS = hints;
@@ -206,7 +206,7 @@
*/
public void drawImage(BufferedImage img, BufferedImageOp op, int x, int y) {
//todo implement it
- org.jnode.vm.Unsafe.debug("SimpleSurfaceGraphics2D.drawImage() not implemented\n");
+ org.jnode.vm.Unsafe.debug("SurfaceGraphics2D.drawImage() - 0 not implemented\n");
}
/**
@@ -238,7 +238,7 @@
*/
public boolean drawImage(Image img, AffineTransform xform, ImageObserver obs) {
//todo implement it
- org.jnode.vm.Unsafe.debug("SimpleSurfaceGraphics2D.drawImage2() not implemented\n");
+ org.jnode.vm.Unsafe.debug("SurfaceGraphics2D.drawImage() - 00 not implemented\n");
return false;
}
@@ -1008,28 +1008,34 @@
}
public boolean drawImage(Image img, int x, int y, ImageObserver observer) {
+// org.jnode.vm.Unsafe.debug("SimpleSurfaceGraphics2D.drawImage()-1\n");
return simpleGraphics.drawImage(img, x, y, observer);
}
public boolean drawImage(Image img, int x, int y, int width, int height, ImageObserver observer) {
+// org.jnode.vm.Unsafe.debug("SimpleSurfaceGraphics2D.drawImage()-2\n");
return simpleGraphics.drawImage(img, x, y, width, height, observer);
}
public boolean drawImage(Image img, int x, int y, Color bgcolor, ImageObserver observer) {
+// org.jnode.vm.Unsafe.debug("SimpleSurfaceGraphics2D.drawImage()-3\n");
return simpleGraphics.drawImage(img, x, y, bgcolor, observer);
}
public boolean drawImage(Image img, int x, int y, int width, int height, Color bgcolor, ImageObserver observer) {
+// org.jnode.vm.Unsafe.debug("SimpleSurfaceGraphics2D.drawImage()-4\n");
return simpleGraphics.drawImage(img, x, y, width, height, bgcolor, observer);
}
public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2,
ImageObserver observer) {
+// org.jnode.vm.Unsafe.debug("SimpleSurfaceGraphics2D.drawImage()-5\n");
return simpleGraphics.drawImage(img, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, observer);
}
public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2,
Color bgcolor, ImageObserver observer) {
+// org.jnode.vm.Unsafe.debug("SimpleSurfaceGraphics2D.drawImage()-6\n");
return simpleGraphics.drawImage(img, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, bgcolor, observer);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2008-07-20 15:00:55
|
Revision: 4329
http://jnode.svn.sourceforge.net/jnode/?rev=4329&view=rev
Author: lsantha
Date: 2008-07-20 14:59:22 +0000 (Sun, 20 Jul 2008)
Log Message:
-----------
Fixed VESA driver discovery and initialization.
Modified Paths:
--------------
trunk/core/src/driver/org/jnode/driver/DeviceToDriverMapper.java
trunk/gui/descriptors/org.jnode.driver.video.vesa.xml
Added Paths:
-----------
trunk/gui/src/driver/org/jnode/driver/video/vesa/VESADeviceToDriverMapper.java
Removed Paths:
-------------
trunk/gui/src/driver/org/jnode/driver/video/vesa/VESAFinder.java
Modified: trunk/core/src/driver/org/jnode/driver/DeviceToDriverMapper.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/DeviceToDriverMapper.java 2008-07-20 14:01:41 UTC (rev 4328)
+++ trunk/core/src/driver/org/jnode/driver/DeviceToDriverMapper.java 2008-07-20 14:59:22 UTC (rev 4329)
@@ -32,6 +32,11 @@
public interface DeviceToDriverMapper {
/**
+ * Match devices in a custom predefined way by the mapper.
+ */
+ public static final int MATCH_DEVICE_PREDEFINED = -1;
+
+ /**
* Match on exact device and exact revision, best possible match.
*/
public static final int MATCH_DEVICE_REVISION = 0;
Modified: trunk/gui/descriptors/org.jnode.driver.video.vesa.xml
===================================================================
--- trunk/gui/descriptors/org.jnode.driver.video.vesa.xml 2008-07-20 14:01:41 UTC (rev 4328)
+++ trunk/gui/descriptors/org.jnode.driver.video.vesa.xml 2008-07-20 14:59:22 UTC (rev 4329)
@@ -23,8 +23,7 @@
</runtime>
<extension point="org.jnode.driver.mappers">
- <!-- laptop Ideo Technologies -->
- <mapper id="03:00:00" driver-class="org.jnode.driver.video.vesa.VESADriver" class="org.jnode.driver.bus.pci.PCIClassToDriverMapper"/>
+ <mapper class="org.jnode.driver.video.vesa.VESADeviceToDriverMapper"/>
</extension>
<extension point="org.jnode.security.permissions">
Added: trunk/gui/src/driver/org/jnode/driver/video/vesa/VESADeviceToDriverMapper.java
===================================================================
--- trunk/gui/src/driver/org/jnode/driver/video/vesa/VESADeviceToDriverMapper.java (rev 0)
+++ trunk/gui/src/driver/org/jnode/driver/video/vesa/VESADeviceToDriverMapper.java 2008-07-20 14:59:22 UTC (rev 4329)
@@ -0,0 +1,47 @@
+package org.jnode.driver.video.vesa;
+
+import org.jnode.driver.bus.pci.PCIDevice;
+import org.jnode.driver.bus.pci.PCIDeviceConfig;
+import org.jnode.driver.DeviceToDriverMapper;
+import org.jnode.driver.Driver;
+import org.jnode.driver.Device;
+import org.jnode.vm.x86.UnsafeX86;
+import org.vmmagic.unboxed.Address;
+
+/**
+ * Custom device Mapper for the VESA driver.
+ *
+ * @author Levente S\u00e1ntha
+ */
+public class VESADeviceToDriverMapper implements DeviceToDriverMapper {
+
+ public Driver findDriver(Device device) {
+ //PCI device needed
+ if (!(device instanceof PCIDevice))
+ return null;
+
+ //checking display controller device class
+ final PCIDevice pciDev = (PCIDevice) device;
+ final PCIDeviceConfig cfg = pciDev.getConfig();
+ if ((cfg.getBaseClass() & 0xFFFFFF) != 0x03)
+ return null;
+
+ //checking the VESA mode set up by GRUB
+ Address vbeControlInfo = UnsafeX86.getVbeControlInfos();
+ VbeInfoBlock vbeInfoBlock = new VbeInfoBlock(vbeControlInfo);
+ if (vbeInfoBlock.isEmpty())
+ return null;
+
+ Address vbeModeInfo = UnsafeX86.getVbeModeInfos();
+ ModeInfoBlock modeInfoBlock = new ModeInfoBlock(vbeModeInfo);
+ if (modeInfoBlock.isEmpty())
+ return null;
+
+ //OK
+ return new VESADriver();
+ }
+
+ public int getMatchLevel() {
+ return DeviceToDriverMapper.MATCH_DEVICE_PREDEFINED;
+ }
+}
Deleted: trunk/gui/src/driver/org/jnode/driver/video/vesa/VESAFinder.java
===================================================================
--- trunk/gui/src/driver/org/jnode/driver/video/vesa/VESAFinder.java 2008-07-20 14:01:41 UTC (rev 4328)
+++ trunk/gui/src/driver/org/jnode/driver/video/vesa/VESAFinder.java 2008-07-20 14:59:22 UTC (rev 4329)
@@ -1,66 +0,0 @@
-/*
- * $Id: VGAFinder.java,v 1.6 2006/01/01 12:40:42 epr Exp $
- *
- * JNode.org
- * Copyright (C) 2003-2006 JNode.org
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; If not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-package org.jnode.driver.video.vesa;
-
-import org.jnode.driver.Bus;
-import org.jnode.driver.Device;
-import org.jnode.driver.DeviceException;
-import org.jnode.driver.DeviceFinder;
-import org.jnode.driver.DeviceManager;
-import org.jnode.driver.DriverException;
-import org.jnode.vm.Unsafe;
-
-/**
- *
- * @author Fabien DUMINY (fduminy at jnode.org)
- *
- */
-public class VESAFinder implements DeviceFinder {
-
- public VESAFinder() {
- Unsafe.debug("created VESAFinder");
- }
-
- /**
- * @see org.jnode.driver.DeviceFinder#findDevices(org.jnode.driver.DeviceManager,
- * org.jnode.driver.Bus)
- */
- public void findDevices(DeviceManager devMan, Bus bus) throws DeviceException {
- try {
- devMan.register(new VESADevice(bus));
- } catch (DriverException ex) {
- Unsafe.debugStackTrace("error in findDevices", ex);
- throw new DeviceException(ex);
- }
- }
-
- public static class VESADevice extends Device {
-
- /**
- * @param bus
- */
- public VESADevice(Bus bus) throws DriverException {
- super(bus, "VESA");
- this.setDriver(new VESADriver());
- }
- }
-}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cr...@us...> - 2008-07-21 13:28:51
|
Revision: 4332
http://jnode.svn.sourceforge.net/jnode/?rev=4332&view=rev
Author: crawley
Date: 2008-07-21 13:28:44 +0000 (Mon, 21 Jul 2008)
Log Message:
-----------
Added support for 'modifiers' in @...@ sequences; see web docs.
Modified Paths:
--------------
trunk/all/conf-source/jnode.properties.defaults
trunk/all/conf-source/jnode.properties.template
trunk/all/conf-source/script.xml
trunk/distr/src/configure/org/jnode/configure/adapter/BasePropertyFileAdapter.java
trunk/distr/src/configure/org/jnode/configure/adapter/DummyValueCodec.java
trunk/distr/src/configure/org/jnode/configure/adapter/JavaStringLiteralCodec.java
trunk/distr/src/configure/org/jnode/configure/adapter/PropertyValueCodec.java
trunk/distr/src/configure/org/jnode/configure/adapter/XMLValueCodec.java
Modified: trunk/all/conf-source/jnode.properties.defaults
===================================================================
--- trunk/all/conf-source/jnode.properties.defaults 2008-07-20 20:11:23 UTC (rev 4331)
+++ trunk/all/conf-source/jnode.properties.defaults 2008-07-21 13:28:44 UTC (rev 4332)
@@ -20,5 +20,7 @@
jnode.debugger.host=
jnode.debugger.port=6789
+jnode.virtual.memsize=512
+
#vmware.vmx.overrides=<some-file-containing-vmx-settings>
Modified: trunk/all/conf-source/jnode.properties.template
===================================================================
--- trunk/all/conf-source/jnode.properties.template 2008-07-20 20:11:23 UTC (rev 4331)
+++ trunk/all/conf-source/jnode.properties.template 2008-07-21 13:28:44 UTC (rev 4332)
@@ -10,20 +10,20 @@
# if you have custom initjars to build.
# custom.plugin-list.dir = ${root.dir}/local/plugin-lists/
-# In non-empty, no default initjars will be built.
-no....@no...@
+# If non-empty, no default initjars will be built.
+@no.default.initjars=#!@
# -----------------------------------------------
# Settings for the bootdisk image
# If non-empty, no bootdisk image will be built.
-no....@no...@
+@no.bootdisk=#!@
# -----------------------------------------------
# Settings for the netboot build
# If non-empty, no netboot directory will be built.
-no....@no...@
+@no.netboot=#!@
# -----------------------------------------------
# Settings for the memory manager
@@ -31,7 +31,7 @@
# Default memory manager: org.jnode.vm.memmgr.def
# MMTk NoGC based memory manager (still very beta): org.jnode.vm.memmgr.mmtk.nogc
# MMTk GenRC based memory manager (still very alpha): org.jnode.vm.memmgr.mmtk.genrc
-jno...@jn...@
+@jnode.memmgr.plugin.id=@
# -----------------------------------------------
# Settings for the document-plugins task
@@ -74,6 +74,10 @@
# Settings for a VMware virtual machine
# -----------------------------------------------
+# -----------------------------------------------
+# The virtual PC's memory size in Mbytes
+@jnode.virtual.memsize=@
+
# Uncomment and edit this line if you want to override the settings
# in the 'jnode-x86-*.vmx' file. For example, you may want to include
# settings to configure a VMware virtual hard drive, or real hard drive.
Modified: trunk/all/conf-source/script.xml
===================================================================
--- trunk/all/conf-source/script.xml 2008-07-20 20:11:23 UTC (rev 4331)
+++ trunk/all/conf-source/script.xml 2008-07-21 13:28:44 UTC (rev 4332)
@@ -32,8 +32,7 @@
<propFile name="../../test.jnode.properties" defaultFile="jnode.properties.defaults"
templateFile="jnode.properties.template">
<property name="jnode.virtual.memsize" type="integer.type"
- description="Enter virtual hardware memory size in Mbytes"
- default="512"/>
+ description="Enter virtual hardware memory size in Mbytes"/>
<property name="jnode.virtual.disk" type="vdisk.type"
description="Select a prebuilt virtual disk"
default="none"/>
Modified: trunk/distr/src/configure/org/jnode/configure/adapter/BasePropertyFileAdapter.java
===================================================================
--- trunk/distr/src/configure/org/jnode/configure/adapter/BasePropertyFileAdapter.java 2008-07-20 20:11:23 UTC (rev 4331)
+++ trunk/distr/src/configure/org/jnode/configure/adapter/BasePropertyFileAdapter.java 2008-07-21 13:28:44 UTC (rev 4332)
@@ -51,9 +51,10 @@
public abstract class BasePropertyFileAdapter implements FileAdapter {
interface ValueCodec {
- public String encodeText(String raw) throws ConfigureException;
+ public String getValidModifiers();
- public String decodeText(String encoded) throws ConfigureException;
+ public String encodeProperty(String propName, String propValue, String modifiers)
+ throws ConfigureException;
}
private final ValueCodec codec;
@@ -218,15 +219,10 @@
if (sb.length() == 0) {
w.write(marker);
} else {
+ String modifiers = removeModifiers(sb);
String propName = sb.toString();
String propValue = props.getProperty(propName);
- if (propValue == null) {
- w.write(marker);
- w.write(propName);
- w.write(marker);
- } else {
- w.write(codec.encodeText(propValue));
- }
+ w.write(codec.encodeProperty(propName, propValue, modifiers));
}
} else {
// FIXME ... make this aware of the host OS newline
@@ -241,4 +237,19 @@
w.flush();
}
}
+
+ private String removeModifiers(StringBuffer sb) {
+ String validModifiers = codec.getValidModifiers();
+ StringBuffer sb2 = new StringBuffer(1);
+ for (int i = sb.length() - 1; i >= 0; i--) {
+ char ch = sb.charAt(i);
+ if (validModifiers.contains(Character.toString(ch))) {
+ sb2.insert(0, ch);
+ sb.setLength(i);
+ } else {
+ break;
+ }
+ }
+ return sb2.toString();
+ }
}
Modified: trunk/distr/src/configure/org/jnode/configure/adapter/DummyValueCodec.java
===================================================================
--- trunk/distr/src/configure/org/jnode/configure/adapter/DummyValueCodec.java 2008-07-20 20:11:23 UTC (rev 4331)
+++ trunk/distr/src/configure/org/jnode/configure/adapter/DummyValueCodec.java 2008-07-21 13:28:44 UTC (rev 4332)
@@ -28,13 +28,12 @@
* @author cr...@jn...
*/
class DummyValueCodec implements BasePropertyFileAdapter.ValueCodec {
-
- public String decodeText(String encoded) throws ConfigureException {
- return encoded;
+
+ public String encodeProperty(String propName, String propValue, String modifiers) {
+ return propValue;
}
- public String encodeText(String raw) throws ConfigureException {
- return raw;
+ public String getValidModifiers() {
+ return "";
}
-
}
Modified: trunk/distr/src/configure/org/jnode/configure/adapter/JavaStringLiteralCodec.java
===================================================================
--- trunk/distr/src/configure/org/jnode/configure/adapter/JavaStringLiteralCodec.java 2008-07-20 20:11:23 UTC (rev 4331)
+++ trunk/distr/src/configure/org/jnode/configure/adapter/JavaStringLiteralCodec.java 2008-07-21 13:28:44 UTC (rev 4332)
@@ -32,11 +32,15 @@
private static char[] HEX_DIGITS = {
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
- public String decodeText(String encoded) throws ConfigureException {
- throw new UnsupportedOperationException("decodeText not supported (or used)");
+ public String encodeProperty(String propName, String propValue, String modifiers) {
+ return propValue == null ? "" : encodeText(propValue);
}
- public String encodeText(String raw) throws ConfigureException {
+ public String getValidModifiers() {
+ return "";
+ }
+
+ private String encodeText(String raw) {
StringBuffer sb = new StringBuffer(raw.length());
for (char ch : raw.toCharArray()) {
switch (ch) {
Modified: trunk/distr/src/configure/org/jnode/configure/adapter/PropertyValueCodec.java
===================================================================
--- trunk/distr/src/configure/org/jnode/configure/adapter/PropertyValueCodec.java 2008-07-20 20:11:23 UTC (rev 4331)
+++ trunk/distr/src/configure/org/jnode/configure/adapter/PropertyValueCodec.java 2008-07-21 13:28:44 UTC (rev 4332)
@@ -10,15 +10,45 @@
* will be used when a property file is written by template expansion. If it is
* read or written using a {@link java.util.Properties} "load" or "save" method,
* the method will take care of encoding / decoding.)
+ * <p>
+ * This codec supports the following modifiers:
+ * <ul>
+ * <li>'=' says to expand as <propName>=<propValue> rather than <propValue>.
+ * Properties that are not set (explicitly or by defaulting) will be suppressed.
+ * <li>'#' (with '=') says to comment out suppressed properties rather than entirely omitting them.
+ * <li>'!' (with '=') says to suppress a property whose value is an empty string.
+ * </ul>
*
* @author cr...@jn...
*/
class PropertyValueCodec implements BasePropertyFileAdapter.ValueCodec {
- public String decodeText(String encoded) throws ConfigureException {
- throw new UnsupportedOperationException("decodeText not supported (or used)");
+
+ public String encodeProperty(String propName, String propValue, String modifiers) {
+ if (modifiers.contains("=")) {
+ if (propValue == null || propValue.equals("") && modifiers.contains("!")) {
+ if (modifiers.contains("#")) {
+ return "#" + encodeText(propName) + "=";
+ } else {
+ return "";
+ }
+ } else {
+ return encodeText(propName) + "=" + encodeText(propValue);
+ }
+ } else {
+ if (propValue == null) {
+ return "";
+ } else {
+ return encodeText(propValue);
+ }
+ }
}
- public String encodeText(String raw) throws ConfigureException {
+ @Override
+ public String getValidModifiers() {
+ return "=!#";
+ }
+
+ private String encodeText(String raw) {
StringBuffer sb = new StringBuffer(raw.length());
for (char ch : raw.toCharArray()) {
switch (ch) {
Modified: trunk/distr/src/configure/org/jnode/configure/adapter/XMLValueCodec.java
===================================================================
--- trunk/distr/src/configure/org/jnode/configure/adapter/XMLValueCodec.java 2008-07-20 20:11:23 UTC (rev 4331)
+++ trunk/distr/src/configure/org/jnode/configure/adapter/XMLValueCodec.java 2008-07-21 13:28:44 UTC (rev 4332)
@@ -28,11 +28,15 @@
* @author cr...@jn...
*/
class XMLValueCodec implements BasePropertyFileAdapter.ValueCodec {
- public String decodeText(String encoded) throws ConfigureException {
- throw new UnsupportedOperationException("decodeText not supported (or used)");
+ public String encodeProperty(String propName, String propValue, String modifiers) {
+ return propValue == null ? "" : encodeText(propValue);
}
- public String encodeText(String raw) throws ConfigureException {
+ public String getValidModifiers() {
+ return "";
+ }
+
+ private String encodeText(String raw) {
StringBuffer sb = new StringBuffer(raw.length());
for (char ch : raw.toCharArray()) {
switch (ch) {
@@ -47,8 +51,7 @@
break;
default:
// Theoretically we should throw exceptions for characters
- // that
- // are 'forbidden' by the XML specification; e.g. most
+ // that are 'forbidden' by the XML specification; e.g. most
// control codes.
sb.append(ch);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cr...@us...> - 2008-07-23 10:21:08
|
Revision: 4333
http://jnode.svn.sourceforge.net/jnode/?rev=4333&view=rev
Author: crawley
Date: 2008-07-23 10:21:05 +0000 (Wed, 23 Jul 2008)
Log Message:
-----------
Revised the syntax for modifiers in @...@ sequences
Modified Paths:
--------------
trunk/all/conf-source/jnode.properties.template
trunk/distr/src/configure/org/jnode/configure/adapter/BasePropertyFileAdapter.java
trunk/distr/src/configure/org/jnode/configure/adapter/PropertyValueCodec.java
Modified: trunk/all/conf-source/jnode.properties.template
===================================================================
--- trunk/all/conf-source/jnode.properties.template 2008-07-21 13:28:44 UTC (rev 4332)
+++ trunk/all/conf-source/jnode.properties.template 2008-07-23 10:21:05 UTC (rev 4333)
@@ -11,19 +11,19 @@
# custom.plugin-list.dir = ${root.dir}/local/plugin-lists/
# If non-empty, no default initjars will be built.
-@no.default.initjars=#!@
+@no.default.initjars/=#@
# -----------------------------------------------
# Settings for the bootdisk image
# If non-empty, no bootdisk image will be built.
-@no.bootdisk=#!@
+@no.bootdisk/=#@
# -----------------------------------------------
# Settings for the netboot build
# If non-empty, no netboot directory will be built.
-@no.netboot=#!@
+@no.netboot/=#@
# -----------------------------------------------
# Settings for the memory manager
@@ -31,7 +31,7 @@
# Default memory manager: org.jnode.vm.memmgr.def
# MMTk NoGC based memory manager (still very beta): org.jnode.vm.memmgr.mmtk.nogc
# MMTk GenRC based memory manager (still very alpha): org.jnode.vm.memmgr.mmtk.genrc
-@jnode.memmgr.plugin.id=@
+@jnode.memmgr.plugin.id/=@
# -----------------------------------------------
# Settings for the document-plugins task
@@ -76,7 +76,7 @@
# -----------------------------------------------
# The virtual PC's memory size in Mbytes
-@jnode.virtual.memsize=@
+@jnode.virtual.memsize/=@
# Uncomment and edit this line if you want to override the settings
# in the 'jnode-x86-*.vmx' file. For example, you may want to include
Modified: trunk/distr/src/configure/org/jnode/configure/adapter/BasePropertyFileAdapter.java
===================================================================
--- trunk/distr/src/configure/org/jnode/configure/adapter/BasePropertyFileAdapter.java 2008-07-21 13:28:44 UTC (rev 4332)
+++ trunk/distr/src/configure/org/jnode/configure/adapter/BasePropertyFileAdapter.java 2008-07-23 10:21:05 UTC (rev 4333)
@@ -239,17 +239,13 @@
}
private String removeModifiers(StringBuffer sb) {
- String validModifiers = codec.getValidModifiers();
- StringBuffer sb2 = new StringBuffer(1);
- for (int i = sb.length() - 1; i >= 0; i--) {
- char ch = sb.charAt(i);
- if (validModifiers.contains(Character.toString(ch))) {
- sb2.insert(0, ch);
- sb.setLength(i);
- } else {
- break;
- }
+ int index = sb.lastIndexOf("/");
+ if (index >= 0) {
+ String modifiers = sb.substring(index + 1);
+ sb.setLength(index);
+ return modifiers;
+ } else {
+ return "";
}
- return sb2.toString();
}
}
Modified: trunk/distr/src/configure/org/jnode/configure/adapter/PropertyValueCodec.java
===================================================================
--- trunk/distr/src/configure/org/jnode/configure/adapter/PropertyValueCodec.java 2008-07-21 13:28:44 UTC (rev 4332)
+++ trunk/distr/src/configure/org/jnode/configure/adapter/PropertyValueCodec.java 2008-07-23 10:21:05 UTC (rev 4333)
@@ -25,15 +25,14 @@
public String encodeProperty(String propName, String propValue, String modifiers) {
if (modifiers.contains("=")) {
- if (propValue == null || propValue.equals("") && modifiers.contains("!")) {
+ if (propValue == null || propValue.equals("")) {
if (modifiers.contains("#")) {
return "#" + encodeText(propName) + "=";
- } else {
+ } else if (modifiers.contains("!")) {
return "";
}
- } else {
- return encodeText(propName) + "=" + encodeText(propValue);
}
+ return encodeText(propName) + "=" + encodeText(propValue);
} else {
if (propValue == null) {
return "";
@@ -64,6 +63,12 @@
case '\f':
sb.append("\\f");
break;
+ case '=':
+ sb.append("\\=");
+ break;
+ case ':':
+ sb.append("\\:");
+ break;
default:
if (ch < ' ' || (ch >= 127 && ch < 160) || ch > 255) {
String digits = Integer.toHexString(ch);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cr...@us...> - 2008-07-23 12:33:43
|
Revision: 4335
http://jnode.svn.sourceforge.net/jnode/?rev=4335&view=rev
Author: crawley
Date: 2008-07-23 12:33:38 +0000 (Wed, 23 Jul 2008)
Log Message:
-----------
Moving 'configure' to the Builder project
Modified Paths:
--------------
trunk/all/build.xml
trunk/configure.sh
Modified: trunk/all/build.xml
===================================================================
--- trunk/all/build.xml 2008-07-23 12:32:19 UTC (rev 4334)
+++ trunk/all/build.xml 2008-07-23 12:33:38 UTC (rev 4335)
@@ -62,6 +62,7 @@
<property name="derby.jar" value="${root.dir}/distr/lib/derby.jar" />
<property name="derbynet.jar" value="${root.dir}/distr/lib/derbynet.jar" />
<property name="derbytools.jar" value="${root.dir}/distr/lib/derbytools.jar" />
+ <property name="nanoxml-java.jar" value="${root.dir}/builder/lib/nanoxml-2.2.3.jar" />
<!-- libraries needed to run tests -->
<property name="jmock-cglib.jar" value="${root.dir}/core/lib/jmock-cglib-1.0.1.jar"/>
@@ -882,13 +883,13 @@
<taskdef resource="checkstyletask.properties" classpath="../core/lib/checkstyle-all-4.4.jar"/>
<checkstyle config="jnode_checks.xml">
<fileset dir="../builder/src/builder" includes="**/*.java"/>
+ <fileset dir="../builder/src/configure" includes="**/*.java"/>
<fileset dir="../core/src/core" includes="**/*.java"/>
<fileset dir="../core/src/driver" includes="**/*.java"/>
<fileset dir="../core/src/test" includes="**/*.java"/>
<fileset dir="../distr/src/apps" includes="**/*.java"/>
<fileset dir="../distr/src/emu" includes="**/*.java"/>
<fileset dir="../distr/src/install" includes="**/*.java"/>
- <fileset dir="../distr/src/configure" includes="**/*.java"/>
<fileset dir="../distr/src/test" includes="**/*.java"/>
<fileset dir="../fs/src/fs" includes="**/*.java"/>
<fileset dir="../fs/src/driver" includes="**/*.java"/>
Modified: trunk/configure.sh
===================================================================
--- trunk/configure.sh 2008-07-23 12:32:19 UTC (rev 4334)
+++ trunk/configure.sh 2008-07-23 12:33:38 UTC (rev 4335)
@@ -4,9 +4,9 @@
# Belt and braces classpath to get the most recent version
# of the 'configure' classes that we can find.
-CP=$DIR/distr/build/classes:\
+CP=$DIR/builder/build/classes:\
$DIR/all/build/descriptors/jnode-configure.jar:\
-$DIR/distr/lib/jnode-configure-dist.jar:\
-$DIR/distr/lib/nanoxml-2.2.3.jar
+$DIR/builder/lib/jnode-configure-dist.jar:\
+$DIR/builder/lib/nanoxml-2.2.3.jar
java -cp $CP org.jnode.configure.Configure "$@"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2008-07-24 19:34:49
|
Revision: 4345
http://jnode.svn.sourceforge.net/jnode/?rev=4345&view=rev
Author: lsantha
Date: 2008-07-24 19:34:46 +0000 (Thu, 24 Jul 2008)
Log Message:
-----------
Added method setPreferredListener() to PointerAPI and its implementations.
Modified Paths:
--------------
trunk/core/src/driver/org/jnode/driver/input/AbstractPointerDriver.java
trunk/core/src/driver/org/jnode/driver/input/PointerAPI.java
trunk/core/src/driver/org/jnode/driver/input/PointerAPIAdapter.java
trunk/gui/src/driver/org/jnode/driver/textscreen/swing/SwingPcTextScreen.java
Modified: trunk/core/src/driver/org/jnode/driver/input/AbstractPointerDriver.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/input/AbstractPointerDriver.java 2008-07-24 18:46:41 UTC (rev 4344)
+++ trunk/core/src/driver/org/jnode/driver/input/AbstractPointerDriver.java 2008-07-24 19:34:46 UTC (rev 4345)
@@ -49,6 +49,14 @@
super.removeListener(l);
}
+ public synchronized void setPreferredListener(PointerListener l) {
+ final SecurityManager sm = System.getSecurityManager();
+ if (sm != null) {
+ sm.checkPermission(SET_PREFERRED_LISTENER_PERMISSION);
+ }
+ super.setPreferredListener(l);
+ }
+
/**
* Start the pointer device.
*/
@@ -117,14 +125,14 @@
}
/**
- * Send a given keyboard event to the given listener.
+ * Send a given pointer event to the given listener.
*
- * @param l
- * @param event
+ * @param listener the pointer listener to recieve the event
+ * @param event the pointer event
*/
@Override
- protected void sendEvent(SystemListener l, PointerEvent event) {
- PointerListener ml = (PointerListener) l;
+ protected void sendEvent(SystemListener listener, PointerEvent event) {
+ PointerListener ml = (PointerListener) listener;
ml.pointerStateChanged(event);
}
Modified: trunk/core/src/driver/org/jnode/driver/input/PointerAPI.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/input/PointerAPI.java 2008-07-24 18:46:41 UTC (rev 4344)
+++ trunk/core/src/driver/org/jnode/driver/input/PointerAPI.java 2008-07-24 19:34:46 UTC (rev 4345)
@@ -22,26 +22,46 @@
package org.jnode.driver.input;
import org.jnode.driver.DeviceAPI;
+import org.jnode.driver.DriverPermission;
/**
* Device API implemented by Pointer devices.
*
* @author qades
* @author Ewout Prangsma (ep...@us...)
+ * @author Levente S\u00e1ntha
*/
public interface PointerAPI extends DeviceAPI {
+ //todo KeboardAPI.SET_PREFERRED_LISTENER_PERMISSION has a similar role
+ //remove duplication
/**
+ * Permission
+ */
+ public static final DriverPermission SET_PREFERRED_LISTENER_PERMISSION =
+ new DriverPermission("setPreferredListener");
+
+ /**
* Add a pointer listener
*
- * @param l
+ * @param listener the pointer listener to be added
*/
- public void addPointerListener(PointerListener l);
+ public void addPointerListener(PointerListener listener);
/**
* Remove a pointer listener
*
- * @param l
+ * @param listener the pointer listener to be removed
*/
- public void removePointerListener(PointerListener l);
+ public void removePointerListener(PointerListener listener);
+
+ /**
+ * Claim to be the preferred listener.
+ * The given listener must have been added by addPointerListener.
+ * If there is a security manager, this method will call
+ * <code>checkPermission(new DriverPermission("setPreferredListener"))</code>.
+ *
+ * @param listener the prefered pointer listener
+ */
+ public abstract void setPreferredListener(PointerListener listener);
}
Modified: trunk/core/src/driver/org/jnode/driver/input/PointerAPIAdapter.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/input/PointerAPIAdapter.java 2008-07-24 18:46:41 UTC (rev 4344)
+++ trunk/core/src/driver/org/jnode/driver/input/PointerAPIAdapter.java 2008-07-24 19:34:46 UTC (rev 4345)
@@ -40,23 +40,33 @@
private final ArrayList<PointerListener> listeners = new ArrayList<PointerListener>();
/**
- * Add a pointer listener
+ * Add a pointer listener.
*
- * @param l
+ * @param listener the pointer listener to be added
*/
- public synchronized void addPointerListener(PointerListener l) {
- listeners.add(l);
+ public synchronized void addPointerListener(PointerListener listener) {
+ listeners.add(listener);
}
/**
- * Remove a pointer listener
+ * Remove a pointer listener.
*
- * @param l
+ * @param listener the pointer listener to be removed
*/
- public synchronized void removePointerListener(PointerListener l) {
- listeners.remove(l);
+ public synchronized void removePointerListener(PointerListener listener) {
+ listeners.remove(listener);
}
+ public synchronized void setPreferredListener(PointerListener l) {
+ final SecurityManager sm = System.getSecurityManager();
+ if (sm != null) {
+ sm.checkPermission(SET_PREFERRED_LISTENER_PERMISSION);
+ }
+ if (listeners.remove(l)) {
+ listeners.add(0, l);
+ }
+ }
+
/**
* Remove all listeners.
*/
@@ -67,7 +77,7 @@
/**
* Fire a given pointer event to all known listeners.
*
- * @param event
+ * @param event the event to be fired
*/
public synchronized void fireEvent(PointerEvent event) {
for (PointerListener l : listeners) {
Modified: trunk/gui/src/driver/org/jnode/driver/textscreen/swing/SwingPcTextScreen.java
===================================================================
--- trunk/gui/src/driver/org/jnode/driver/textscreen/swing/SwingPcTextScreen.java 2008-07-24 18:46:41 UTC (rev 4344)
+++ trunk/gui/src/driver/org/jnode/driver/textscreen/swing/SwingPcTextScreen.java 2008-07-24 19:34:46 UTC (rev 4345)
@@ -349,6 +349,18 @@
public void removePointerListener(PointerListener l) {
listeners.remove(l);
}
+
+ /**
+ * Claim to be the preferred listener.
+ * The given listener must have been added by addPointerListener.
+ * If there is a security manager, this method will call
+ * <code>checkPermission(new DriverPermission("setPreferredListener"))</code>.
+ *
+ * @param listener the prefered pointer listener
+ */
+ public void setPreferredListener(PointerListener listener) {
+
+ }
}
private static class MyKeyboardDriver extends Driver implements KeyboardAPI {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2008-07-24 21:14:00
|
Revision: 4351
http://jnode.svn.sourceforge.net/jnode/?rev=4351&view=rev
Author: lsantha
Date: 2008-07-24 21:13:57 +0000 (Thu, 24 Jul 2008)
Log Message:
-----------
Fixed gradients in metal l&f ocean theme.
Modified Paths:
--------------
trunk/core/src/openjdk/sun/sun/swing/CachedPainter.java
trunk/gui/src/awt/org/jnode/awt/JNodeGraphicsConfiguration.java
Modified: trunk/core/src/openjdk/sun/sun/swing/CachedPainter.java
===================================================================
--- trunk/core/src/openjdk/sun/sun/swing/CachedPainter.java 2008-07-24 20:34:32 UTC (rev 4350)
+++ trunk/core/src/openjdk/sun/sun/swing/CachedPainter.java 2008-07-24 21:13:57 UTC (rev 4351)
@@ -204,10 +204,13 @@
*/
protected Image createImage(Component c, int w, int h,
GraphicsConfiguration config, Object[] args) {
+ return new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
+/* jnode todo we need volatile image support for this
if (config == null) {
return new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
}
return config.createCompatibleVolatileImage(w, h);
+*/
}
/**
Modified: trunk/gui/src/awt/org/jnode/awt/JNodeGraphicsConfiguration.java
===================================================================
--- trunk/gui/src/awt/org/jnode/awt/JNodeGraphicsConfiguration.java 2008-07-24 20:34:32 UTC (rev 4350)
+++ trunk/gui/src/awt/org/jnode/awt/JNodeGraphicsConfiguration.java 2008-07-24 21:13:57 UTC (rev 4351)
@@ -89,8 +89,8 @@
* @see java.awt.GraphicsConfiguration#getColorModel(int)
*/
public ColorModel getColorModel(int transparency) {
- // TODO Auto-generated method stub
- return null;
+ // TODO review this, normally transparency should be respected
+ return colorModel;
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fd...@us...> - 2008-07-24 21:20:11
|
Revision: 4352
http://jnode.svn.sourceforge.net/jnode/?rev=4352&view=rev
Author: fduminy
Date: 2008-07-24 21:20:06 +0000 (Thu, 24 Jul 2008)
Log Message:
-----------
- moved ensureVisible(int) method from TextScreen to new interface ScrollableTextConsole
- all TextScreen implementations that were using a char[] as buffer are now inheriting from AbstractPcBufferTextScreen
- moved method sync(offset, length) method from TextScreen to AbstractPcBufferTextScreen, only place it is really needed
- PcBufferTextScreen class now have a method setDisplayed which allow to render the buffer to a AbstractPcTextScreen or not (new class NoDisplayTextScreen)
- externalized common behavior (get/set a character/color from/to a screen) in new class PcTextScreenUtils
- workaround in GradientBackground in which getClipBounds always returned (0,0,0,0)
Modified Paths:
--------------
trunk/core/src/driver/org/jnode/driver/console/TextConsole.java
trunk/core/src/driver/org/jnode/driver/console/spi/AbstractConsoleManager.java
trunk/core/src/driver/org/jnode/driver/console/textscreen/Line.java
trunk/core/src/driver/org/jnode/driver/console/textscreen/ScrollableTextScreenConsole.java
trunk/core/src/driver/org/jnode/driver/console/textscreen/TextScreenConsole.java
trunk/core/src/driver/org/jnode/driver/textscreen/ScrollableTextScreen.java
trunk/core/src/driver/org/jnode/driver/textscreen/TextScreen.java
trunk/core/src/driver/org/jnode/driver/textscreen/x86/AbstractPcBufferTextScreen.java
trunk/core/src/driver/org/jnode/driver/textscreen/x86/AbstractPcTextScreen.java
trunk/core/src/driver/org/jnode/driver/textscreen/x86/PcBufferTextScreen.java
trunk/core/src/driver/org/jnode/driver/textscreen/x86/PcScrollableTextScreen.java
trunk/core/src/driver/org/jnode/driver/textscreen/x86/PcTextScreen.java
trunk/distr/src/apps/org/jnode/apps/telnetd/RemoteTextScreen.java
trunk/gui/src/driver/org/jnode/driver/console/swing/JTextAreaTextScreen.java
trunk/gui/src/driver/org/jnode/driver/textscreen/fb/FbScreenPainter.java
trunk/gui/src/driver/org/jnode/driver/textscreen/fb/FbTextScreen.java
trunk/gui/src/driver/org/jnode/driver/textscreen/fb/GradientBackground.java
trunk/gui/src/driver/org/jnode/driver/textscreen/swing/SwingPcTextScreen.java
trunk/gui/src/test/org/jnode/test/gui/FBConsole.java
Added Paths:
-----------
trunk/core/src/driver/org/jnode/driver/console/ScrollableTextConsole.java
trunk/core/src/driver/org/jnode/driver/textscreen/x86/NoDisplayTextScreen.java
trunk/core/src/driver/org/jnode/driver/textscreen/x86/PcTextScreenUtils.java
Added: trunk/core/src/driver/org/jnode/driver/console/ScrollableTextConsole.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/console/ScrollableTextConsole.java (rev 0)
+++ trunk/core/src/driver/org/jnode/driver/console/ScrollableTextConsole.java 2008-07-24 21:20:06 UTC (rev 4352)
@@ -0,0 +1,37 @@
+/*
+ * $Id: TextConsole.java 4153 2008-05-30 12:20:45Z lsantha $
+ *
+ * JNode.org
+ * Copyright (C) 2003-2006 JNode.org
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; If not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+package org.jnode.driver.console;
+
+
+/**
+ * @author Ewout Prangsma (ep...@us...)
+ * @author Levente S\u00e1ntha (ls...@us...)
+ */
+public interface ScrollableTextConsole extends TextConsole {
+
+ /**
+ * Ensure that the given row is visible.
+ *
+ * @param row
+ */
+ public void ensureVisible(int row);
+}
Modified: trunk/core/src/driver/org/jnode/driver/console/TextConsole.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/console/TextConsole.java 2008-07-24 21:13:57 UTC (rev 4351)
+++ trunk/core/src/driver/org/jnode/driver/console/TextConsole.java 2008-07-24 21:20:06 UTC (rev 4352)
@@ -155,13 +155,6 @@
public void setTabSize(int tabSize);
/**
- * Ensure that the given row is visible.
- *
- * @param row
- */
- public void ensureVisible(int row);
-
- /**
* Gets the input stream of this console.
*
* @return
Modified: trunk/core/src/driver/org/jnode/driver/console/spi/AbstractConsoleManager.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/console/spi/AbstractConsoleManager.java 2008-07-24 21:13:57 UTC (rev 4351)
+++ trunk/core/src/driver/org/jnode/driver/console/spi/AbstractConsoleManager.java 2008-07-24 21:20:06 UTC (rev 4352)
@@ -35,7 +35,9 @@
import java.util.Map;
import java.util.Set;
import java.util.Stack;
+
import javax.naming.NameNotFoundException;
+
import org.apache.log4j.Logger;
import org.jnode.driver.ApiNotFoundException;
import org.jnode.driver.Device;
@@ -51,6 +53,7 @@
import org.jnode.naming.InitialNaming;
import org.jnode.system.BootLog;
import org.jnode.system.event.FocusEvent;
+import org.jnode.vm.Unsafe;
/**
* @author epr
@@ -207,14 +210,14 @@
* @param console
*/
public synchronized void focus(Console console) {
- log.debug("focus(" + console.getConsoleName() + ")");
+ Unsafe.debug("focus(" + console.getConsoleName() + ")");
if (this.current != null && this.current != console) {
- log.debug("Sending focusLost to " + current.getConsoleName());
+ Unsafe.debug("Sending focusLost to " + current.getConsoleName());
this.current.focusLost(new FocusEvent(FocusEvent.FOCUS_LOST));
}
this.current = console;
if (this.current != null) {
- log.debug("Sending focusGained to " + current.getConsoleName());
+ Unsafe.debug("Sending focusGained to " + current.getConsoleName());
current.focusGained(new FocusEvent(FocusEvent.FOCUS_GAINED));
}
}
Modified: trunk/core/src/driver/org/jnode/driver/console/textscreen/Line.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/console/textscreen/Line.java 2008-07-24 21:13:57 UTC (rev 4351)
+++ trunk/core/src/driver/org/jnode/driver/console/textscreen/Line.java 2008-07-24 21:20:06 UTC (rev 4352)
@@ -25,6 +25,7 @@
import java.util.SortedSet;
import org.jnode.driver.console.CompletionInfo;
import org.jnode.driver.console.InputCompleter;
+import org.jnode.driver.console.ScrollableTextConsole;
import org.jnode.driver.console.TextConsole;
import org.jnode.driver.console.spi.ConsolePrintStream;
@@ -333,7 +334,12 @@
// if the line has not been shortened (delete, backspace...)
if (!shortened) {
// ensure that the location of the input cursor is included.
- console.ensureVisible(inputCursorY);
+ if (console instanceof ScrollableTextConsole) {
+ ((ScrollableTextConsole) console).ensureVisible(inputCursorY);
+ } else {
+ // since the console is not scrollable, we can't do anything
+ // if the row is not visible (the row is completely lost)
+ }
}
console.setCursorVisible(true);
} catch (Exception e) {
Modified: trunk/core/src/driver/org/jnode/driver/console/textscreen/ScrollableTextScreenConsole.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/console/textscreen/ScrollableTextScreenConsole.java 2008-07-24 21:13:57 UTC (rev 4351)
+++ trunk/core/src/driver/org/jnode/driver/console/textscreen/ScrollableTextScreenConsole.java 2008-07-24 21:20:06 UTC (rev 4352)
@@ -25,6 +25,7 @@
import java.awt.event.KeyEvent;
import org.jnode.driver.console.ConsoleManager;
+import org.jnode.driver.console.ScrollableTextConsole;
import org.jnode.driver.input.KeyboardEvent;
import org.jnode.driver.input.PointerEvent;
import org.jnode.driver.textscreen.ScrollableTextScreen;
@@ -32,7 +33,7 @@
/**
* @author Ewout Prangsma (ep...@us...)
*/
-public class ScrollableTextScreenConsole extends TextScreenConsole {
+public class ScrollableTextScreenConsole extends TextScreenConsole implements ScrollableTextConsole {
/**
* @param mgr
@@ -43,34 +44,47 @@
ScrollableTextScreen screen, int options) {
super(mgr, name, screen, options);
}
-
+
/**
- * Scroll a given number of rows up.
- *
- * @param rows
+ * Append characters to the current line.
+ *
+ * @param v
+ * @param offset
+ * @param lenght
+ * @param color
*/
- public void scrollUp(int rows) {
- final ScrollableTextScreen screen = (ScrollableTextScreen) getScreen();
- screen.scrollUp(rows);
-
- final int length = rows * screen.getWidth();
- screen.sync(screen.getHeight() * screen.getWidth() - length, length);
+ @Override
+ public void putChar(char v[], int offset, int lenght, int color) {
+ super.putChar(v, offset, lenght, color);
+ ensureVisible(getCursorY());
}
+
+ /**
+ * Append a character to the current line.
+ *
+ * @param v
+ * @param color
+ */
+ @Override
+ public void putChar(char v, int color) {
+ super.putChar(v, color);
+ ensureVisible(getCursorY());
+ }
/**
- * Scroll a given number of rows down.
- *
- * @param rows
+ * Ensure that the given row is visible.
+ *
+ * @param row
*/
- public void scrollDown(int rows) {
- final ScrollableTextScreen screen = (ScrollableTextScreen) getScreen();
- screen.scrollDown(rows);
- screen.sync(0, rows * screen.getWidth());
+ @Override
+ public void ensureVisible(int row) {
+ getScrollableTextScreen().ensureVisible(row, isFocused());
}
/**
* @see org.jnode.driver.input.KeyboardListener#keyPressed(org.jnode.driver.input.KeyboardEvent)
*/
+ @Override
public void keyPressed(KeyboardEvent event) {
if (isFocused() && !event.isConsumed()) {
final int modifiers = event.getModifiers();
@@ -103,6 +117,7 @@
/**
* @see org.jnode.driver.input.PointerListener#pointerStateChanged(org.jnode.driver.input.PointerEvent)
*/
+ @Override
public void pointerStateChanged(PointerEvent event) {
if (isFocused() && (event.getZ() != 0)) {
final int z = event.getZ();
@@ -117,4 +132,26 @@
super.pointerStateChanged(event);
}
}
+
+ private final ScrollableTextScreen getScrollableTextScreen() {
+ return (ScrollableTextScreen) getScreen();
+ }
+
+ /**
+ * Scroll a given number of rows up.
+ *
+ * @param rows
+ */
+ private void scrollUp(int rows) {
+ getScrollableTextScreen().scrollUp(rows);
+ }
+
+ /**
+ * Scroll a given number of rows down.
+ *
+ * @param rows
+ */
+ private void scrollDown(int rows) {
+ getScrollableTextScreen().scrollDown(rows);
+ }
}
Modified: trunk/core/src/driver/org/jnode/driver/console/textscreen/TextScreenConsole.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/console/textscreen/TextScreenConsole.java 2008-07-24 21:13:57 UTC (rev 4351)
+++ trunk/core/src/driver/org/jnode/driver/console/textscreen/TextScreenConsole.java 2008-07-24 21:20:06 UTC (rev 4352)
@@ -33,8 +33,10 @@
import org.jnode.driver.console.spi.ConsoleOutputStream;
import org.jnode.driver.console.spi.ConsolePrintStream;
import org.jnode.driver.textscreen.TextScreen;
+import org.jnode.driver.textscreen.x86.PcBufferTextScreen;
import org.jnode.system.event.FocusEvent;
import org.jnode.system.event.FocusListener;
+import org.jnode.vm.Unsafe;
import org.jnode.vm.VmSystem;
import org.jnode.vm.isolate.VmIsolate;
@@ -43,7 +45,6 @@
* @author Levente S\u00e1ntha (ls...@us...)
*/
public class TextScreenConsole extends AbstractConsole implements TextConsole {
-
/**
* The screen I'm writing on
*/
@@ -107,6 +108,9 @@
// ConsoleManager.CreateOptions.NO_SYSTEM_OUT_ERR) == 0);
this.claimSystemOutErr = false;
this.myIsolate = VmIsolate.currentIsolate();
+
+ // force initial displayed state
+ updateScreenDisplayedState();
}
/**
@@ -114,20 +118,20 @@
*
* @see org.jnode.driver.console.TextConsole#clear()
*/
+ @Override
public void clear() {
final int size = screen.getWidth() * screen.getHeight();
screen.set(0, ' ', size, 0x07);
- syncScreen(0, size);
}
/**
* Clear a given row
*/
+ @Override
public void clearRow(int row) {
final int size = screen.getWidth();
final int offset = screen.getOffset(0, row);
screen.set(offset, ' ', size, 0x07);
- syncScreen(offset, size);
}
/**
@@ -138,6 +142,7 @@
* @param lenght
* @param color
*/
+ @Override
public void putChar(char v[], int offset, int lenght, int color) {
int mark = 0;
for (int i = 0; i < lenght; i++) {
@@ -156,7 +161,6 @@
doPutChar(c, color);
}
}
- screen.ensureVisible(curY, isFocused()); // synchronize if focused
}
/**
@@ -165,9 +169,9 @@
* @param v
* @param color
*/
+ @Override
public void putChar(char v, int color) {
doPutChar(v, color);
- screen.ensureVisible(curY, isFocused()); // synchronize if focused
}
private void doPutChar(char v, int color) {
@@ -208,6 +212,7 @@
/**
* @return Returns the tabSize.
*/
+ @Override
public int getTabSize() {
return tabSize;
}
@@ -215,6 +220,7 @@
/**
* @param tabSize The tabSize to set.
*/
+ @Override
public void setTabSize(int tabSize) {
this.tabSize = tabSize;
}
@@ -222,6 +228,7 @@
/**
* @see org.jnode.driver.console.TextConsole#getColor(int, int)
*/
+ @Override
public int getColor(int x, int y) {
return screen.getColor(screen.getOffset(x, y));
}
@@ -229,6 +236,7 @@
/**
* @see org.jnode.driver.console.TextConsole#getChar(int, int)
*/
+ @Override
public char getChar(int x, int y) {
return screen.getChar(screen.getOffset(x, y));
}
@@ -236,6 +244,7 @@
/**
* @see org.jnode.driver.console.TextConsole#getCursorX()
*/
+ @Override
public int getCursorX() {
return curX;
}
@@ -243,6 +252,7 @@
/**
* @see org.jnode.driver.console.TextConsole#getCursorY()
*/
+ @Override
public int getCursorY() {
return curY;
}
@@ -250,6 +260,7 @@
/**
* @see org.jnode.driver.console.TextConsole#getHeight()
*/
+ @Override
public int getHeight() {
return screen.getHeight();
}
@@ -257,6 +268,7 @@
/**
* @see org.jnode.driver.console.TextConsole#getWidth()
*/
+ @Override
public int getWidth() {
return screen.getWidth();
}
@@ -264,49 +276,43 @@
/**
* @see org.jnode.driver.console.TextConsole#setChar(int, int, char, int)
*/
+ @Override
public void setChar(int x, int y, char ch, int color) {
int offset = screen.getOffset(x, y);
screen.set(offset, ch, 1, color);
- syncScreen(offset, 1);
}
+ @Override
public void setChar(int x, int y, char[] ch, int color) {
int offset = screen.getOffset(x, y);
screen.set(offset, ch, 0, ch.length, color);
- syncScreen(offset, ch.length);
}
+ @Override
public void setChar(int x, int y, char[] ch, int cOfset, int cLength, int color) {
int offset = screen.getOffset(x, y);
screen.set(offset, ch, cOfset, cLength, color);
- syncScreen(offset, cLength);
}
/**
* @see org.jnode.driver.console.TextConsole#setCursor(int, int)
*/
+ @Override
public void setCursor(int x, int y) {
this.curX = x;
this.curY = y;
int offset = screen.setCursor(x, y);
- syncScreen(offset, 1);
}
- private void syncScreen(int offset, int size) {
- if (isFocused()) {
- screen.sync(offset, size);
+ private void updateScreenDisplayedState() {
+ if (screen instanceof PcBufferTextScreen) {
+ ((PcBufferTextScreen) screen).setDisplayed(isFocused());
+ } else {
+ Unsafe.debug("updateScreenDisplayedState: screen not instanceof PcBufferTextScreen");
}
}
- /**
- * Ensure that the given row is visible.
- *
- * @param row
- */
- public void ensureVisible(int row) {
- screen.ensureVisible(row, isFocused()); // synchronize if focused
- }
-
+ @Override
public InputCompleter getCompleter() {
if (in instanceof KeyboardInputStream) {
return ((KeyboardInputStream) in).getCompleter();
@@ -315,6 +321,7 @@
}
}
+ @Override
public void setCompleter(InputCompleter completer) {
if (in instanceof KeyboardInputStream) {
((KeyboardInputStream) in).setCompleter(completer);
@@ -324,6 +331,7 @@
/**
* @see org.jnode.driver.console.TextConsole#getIn()
*/
+ @Override
public InputStream getIn() {
return in;
}
@@ -335,6 +343,7 @@
/**
* @see org.jnode.driver.console.TextConsole#getErr()
*/
+ @Override
public PrintStream getErr() {
return err;
}
@@ -342,6 +351,7 @@
/**
* @see org.jnode.driver.console.TextConsole#getOut()
*/
+ @Override
public PrintStream getOut() {
return out;
}
@@ -349,6 +359,7 @@
/**
* Is the cursor visible.
*/
+ @Override
public boolean isCursorVisible() {
return cursorVisible;
}
@@ -358,18 +369,19 @@
*
* @param visible
*/
+ @Override
public void setCursorVisible(boolean visible) {
this.cursorVisible = visible;
int offset = screen.setCursorVisible(visible);
- syncScreen(offset, 1);
}
/**
* @see org.jnode.system.event.FocusListener#focusGained(org.jnode.system.event.FocusEvent)
*/
+ @Override
public void focusGained(FocusEvent event) {
super.focusGained(event);
- syncScreen(0, screen.getWidth() * screen.getHeight());
+ updateScreenDisplayedState();
if (in instanceof FocusListener) {
((FocusListener) in).focusGained(event);
}
@@ -391,6 +403,7 @@
/**
* @see org.jnode.system.event.FocusListener#focusLost(org.jnode.system.event.FocusEvent)
*/
+ @Override
public void focusLost(FocusEvent event) {
if (in instanceof FocusListener) {
((FocusListener) in).focusLost(event);
@@ -404,6 +417,7 @@
});
}
super.focusLost(event);
+ updateScreenDisplayedState();
}
/**
Modified: trunk/core/src/driver/org/jnode/driver/textscreen/ScrollableTextScreen.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/textscreen/ScrollableTextScreen.java 2008-07-24 21:13:57 UTC (rev 4351)
+++ trunk/core/src/driver/org/jnode/driver/textscreen/ScrollableTextScreen.java 2008-07-24 21:20:06 UTC (rev 4352)
@@ -31,6 +31,14 @@
public interface ScrollableTextScreen extends TextScreen {
/**
+ * Ensure that the given row is visible.
+ *
+ * @param row
+ * @param sync true if screen should synchronize
+ */
+ public void ensureVisible(int row, boolean sync);
+
+ /**
* Scroll a given number of rows up.
*
* @param rows
Modified: trunk/core/src/driver/org/jnode/driver/textscreen/TextScreen.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/textscreen/TextScreen.java 2008-07-24 21:13:57 UTC (rev 4351)
+++ trunk/core/src/driver/org/jnode/driver/textscreen/TextScreen.java 2008-07-24 21:20:06 UTC (rev 4352)
@@ -23,7 +23,7 @@
/**
* Abstract class that represents different kinds of screens : - physical screen
- * (video memory) - buffered screen (system memory, faster that video memory) -
+ * (video memory) - buffered screen (system memory, faster than video memory) -
* remote screen, shared screen, multiple screens ... - recording screen (movies
* for demos or tutorials)
*
@@ -118,13 +118,6 @@
public int getOffset(int x, int y);
/**
- * Synchronize the state with the actual device.
- * @param offset
- * @param length
- */
- public void sync(int offset, int length);
-
- /**
* Create an in-memory buffer text screen that is compatible
* with this screen.
*
@@ -141,14 +134,6 @@
public ScrollableTextScreen createCompatibleScrollableBufferScreen(int height);
/**
- * Ensure that the given row is visible.
- *
- * @param row
- * @param sync true if screen should synchronize
- */
- public void ensureVisible(int row, boolean sync);
-
- /**
*
* @param x
* @param y
Modified: trunk/core/src/driver/org/jnode/driver/textscreen/x86/AbstractPcBufferTextScreen.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/textscreen/x86/AbstractPcBufferTextScreen.java 2008-07-24 21:13:57 UTC (rev 4351)
+++ trunk/core/src/driver/org/jnode/driver/textscreen/x86/AbstractPcBufferTextScreen.java 2008-07-24 21:20:06 UTC (rev 4352)
@@ -21,6 +21,8 @@
package org.jnode.driver.textscreen.x86;
+import java.util.Arrays;
+
import org.jnode.driver.textscreen.TextScreen;
import org.jnode.vm.Unsafe;
@@ -44,6 +46,8 @@
private int cursorIndex = 0;
private boolean cursorVisible = true;
+ private final boolean ignoreColors;
+
/**
* Initialize this instance.
*
@@ -51,65 +55,95 @@
* @param height
*/
public AbstractPcBufferTextScreen(int width, int height) {
+ this(width, height, false);
+ }
+
+ /**
+ * Initialize this instance.
+ *
+ * @param width
+ * @param height
+ * @param ignoreColors
+ */
+ public AbstractPcBufferTextScreen(int width, int height, boolean ignoreColors) {
super(width, height);
+ this.ignoreColors = ignoreColors;
this.buffer = new char[width * height];
this.screenBuffer = new char[buffer.length];
+
+ Arrays.fill(buffer, ' ');
}
/**
* @see org.jnode.driver.textscreen.TextScreen#copyContent(int, int, int)
*/
- public void copyContent(int srcOffset, int destOffset, int length) {
+ @Override
+ public final void copyContent(int srcOffset, int destOffset, int length) {
System.arraycopy(buffer, srcOffset, buffer, destOffset, length);
+ sync(destOffset, length);
}
/**
* @see org.jnode.driver.textscreen.TextScreen#getChar(int)
*/
- public char getChar(int offset) {
- return (char) (buffer[offset] & 0xFF);
+ @Override
+ public final char getChar(int offset) {
+ return (char) PcTextScreenUtils.decodeCharacter(buffer[offset]);
}
/**
* @see org.jnode.driver.textscreen.TextScreen#getColor(int)
*/
- public int getColor(int offset) {
- return (char) ((buffer[offset] >> 8) & 0xFF);
+ @Override
+ public final int getColor(int offset) {
+ //TODO do we really need to cast that to a char ?
+ return (char) PcTextScreenUtils.decodeColor(buffer[offset]);
}
/**
* @see org.jnode.driver.textscreen.TextScreen#set(int, char, int, int)
*/
+ @Override
public void set(int offset, char ch, int count, int color) {
- final char v = (char) ((ch & 0xFF) | ((color & 0xFF) << 8));
count = Math.min(count, buffer.length - offset);
- for (int i = 0; i < count; i++) {
- buffer[offset + i] = v;
- }
+
+ Arrays.fill(buffer, offset, offset + count, encodeCharacterAndColor(ch, color));
}
/**
* @see org.jnode.driver.textscreen.TextScreen#set(int, char[], int, int,
* int)
*/
- public void set(int offset, char[] ch, int chOfs, int length, int color) {
- color = (color & 0xFF) << 8;
+ @Override
+ public void set(final int offset, final char[] ch, final int chOfs, int length, int color) {
+ color = PcTextScreenUtils.encodeColor(color);
length = Math.min(length, buffer.length - offset);
+
+ int bufOffset = offset;
+ int chOffset = chOfs;
for (int i = 0; i < length; i++) {
- buffer[offset + i] = (char) ((ch[chOfs + i] & 0xFF) | color);
+ buffer[bufOffset++] = (char) (PcTextScreenUtils.encodeCharacter(ch[chOffset++]) | color);
}
+
+ sync(offset, length);
}
/**
* @see org.jnode.driver.textscreen.TextScreen#set(int, char[], int, int,
* int[], int)
*/
- public void set(int offset, char[] ch, int chOfs, int length, int[] colors, int colorsOfs) {
+ @Override
+ public void set(final int offset, char[] ch, final int chOfs, int length, int[] colors, int colorsOfs) {
length = Math.min(length, buffer.length - offset);
+
+ int bufOffset = offset;
+ int chOffset = chOfs;
+ int colorsOffset = colorsOfs;
for (int i = 0; i < length; i++) {
- buffer[offset + i] =
- (char) ((ch[chOfs + i] & 0xFF) | (colors[colorsOfs + i] & 0xFF) << 8);
+ buffer[bufOffset++] = encodeCharacterAndColor(ch[chOffset++], colors[colorsOffset++]);
}
+
+ sync(offset, length);
}
/**
@@ -118,21 +152,14 @@
*
* @param dst
*/
- public void copyTo(TextScreen dst, int offset, int length) {
+ @Override
+ public final void copyTo(TextScreen dst, int offset, int length) {
if (dst instanceof AbstractPcTextScreen) {
char[] toScreen = buffer;
if (cursorVisible && cursorIndex < buffer.length && cursorIndex >= 0) {
System.arraycopy(buffer, 0, screenBuffer, 0, buffer.length);
- char origValue = buffer[cursorIndex];
- // origValue |= 0x7000;//from december 2003 jnode code.
-
- // exchange the background with the foreground
- int color = (origValue >> 8) & 0xFF;
- color = ((color >> 4) & 0xF) | ((color << 4) & 0xF0);
- origValue &= 0x00FF;
- origValue |= (color << 8) & 0xFF00;
-
- screenBuffer[cursorIndex] = origValue;
+
+ screenBuffer[cursorIndex] = PcTextScreenUtils.exchangeColors(buffer[cursorIndex]);
toScreen = screenBuffer;
}
((AbstractPcTextScreen) dst).copyFrom(toScreen, getTopOffset());
@@ -157,28 +184,72 @@
* @param rawData
* @param rawDataOffset
*/
- public final void copyFrom(char[] rawData, int rawDataOffset) {
+ @Override
+ public final void copyFrom(char[] rawData, final int rawDataOffset) {
if (rawDataOffset < 0) {
Unsafe.die("Buffer:rawDataOffset = " + rawDataOffset);
}
- System.arraycopy(rawData, rawDataOffset, buffer, getTopOffset(), getWidth() * getHeight());
+ final int size = getWidth() * getHeight();
+
+ char[] cha = rawData;
+
+ if (ignoreColors) {
+ cha = new char[rawData.length];
+ for (int i = 0; i < cha.length; i++) {
+ cha[i] = (char) PcTextScreenUtils.encodeCharacter(rawData[i]);
+ }
+ }
+
+ System.arraycopy(cha, rawDataOffset, buffer, getTopOffset(), size);
+ sync(0, size);
}
/**
* Synchronize the state with the actual device.
+ * @param offset
+ * @param length
*/
- public abstract void sync(int offset, int length);
+ protected abstract void sync(int offset, int length);
- public int setCursor(int x, int y) {
- this.cursorIndex = getOffset(x, y);
- setParentCursor(x, y);
+ @Override
+ public final int setCursor(int x, int y) {
+ int oldCursorIndex = cursorIndex;
+ cursorIndex = getOffset(x, y);
+
+ if (oldCursorIndex != cursorIndex) {
+ sync(oldCursorIndex, 1);
+ sync(cursorIndex, 1);
+ }
+
return cursorIndex;
}
- protected abstract void setParentCursor(int x, int y);
+ //protected abstract void setParentCursor(int x, int y);
- public int setCursorVisible(boolean visible) {
+ @Override
+ public final int setCursorVisible(boolean visible) {
this.cursorVisible = visible;
+ sync(cursorIndex, 1);
return cursorIndex;
}
+
+ protected final int getCursorOffset() {
+ return cursorIndex;
+ }
+
+ protected final char[] getBuffer() {
+ return buffer;
+ }
+
+ private final char encodeCharacterAndColor(char character, int color) {
+ int c;
+
+ if (ignoreColors) {
+ c = PcTextScreenUtils.encodeCharacter(character);
+ } else {
+ c = PcTextScreenUtils.encodeCharacterAndColor(characte...
[truncated message content] |
|
From: <ls...@us...> - 2008-07-25 18:41:39
|
Revision: 4355
http://jnode.svn.sourceforge.net/jnode/?rev=4355&view=rev
Author: lsantha
Date: 2008-07-25 18:41:34 +0000 (Fri, 25 Jul 2008)
Log Message:
-----------
Reverted console and text screen refacoring of FabienD.
Modified Paths:
--------------
trunk/core/src/driver/org/jnode/driver/console/TextConsole.java
trunk/core/src/driver/org/jnode/driver/console/spi/AbstractConsoleManager.java
trunk/core/src/driver/org/jnode/driver/console/textscreen/Line.java
trunk/core/src/driver/org/jnode/driver/console/textscreen/ScrollableTextScreenConsole.java
trunk/core/src/driver/org/jnode/driver/console/textscreen/TextScreenConsole.java
trunk/core/src/driver/org/jnode/driver/textscreen/ScrollableTextScreen.java
trunk/core/src/driver/org/jnode/driver/textscreen/TextScreen.java
trunk/core/src/driver/org/jnode/driver/textscreen/x86/AbstractPcBufferTextScreen.java
trunk/core/src/driver/org/jnode/driver/textscreen/x86/AbstractPcTextScreen.java
trunk/core/src/driver/org/jnode/driver/textscreen/x86/NoDisplayTextScreen.java
trunk/core/src/driver/org/jnode/driver/textscreen/x86/PcBufferTextScreen.java
trunk/core/src/driver/org/jnode/driver/textscreen/x86/PcScrollableTextScreen.java
trunk/core/src/driver/org/jnode/driver/textscreen/x86/PcTextScreen.java
trunk/distr/src/apps/org/jnode/apps/telnetd/RemoteTextScreen.java
trunk/gui/src/driver/org/jnode/driver/console/swing/JTextAreaTextScreen.java
trunk/gui/src/driver/org/jnode/driver/textscreen/fb/FbScreenPainter.java
trunk/gui/src/driver/org/jnode/driver/textscreen/fb/FbTextScreen.java
trunk/gui/src/driver/org/jnode/driver/textscreen/swing/SwingPcTextScreen.java
trunk/gui/src/test/org/jnode/test/gui/FBConsole.java
Modified: trunk/core/src/driver/org/jnode/driver/console/TextConsole.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/console/TextConsole.java 2008-07-25 14:03:14 UTC (rev 4354)
+++ trunk/core/src/driver/org/jnode/driver/console/TextConsole.java 2008-07-25 18:41:34 UTC (rev 4355)
@@ -9,13 +9,13 @@
* by the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
- * This library is distributed in the hope that it will be useful, but
+ * This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
- * along with this library; If not, write to the Free Software Foundation, Inc.,
+ * along with this library; If not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
@@ -155,6 +155,13 @@
public void setTabSize(int tabSize);
/**
+ * Ensure that the given row is visible.
+ *
+ * @param row
+ */
+ public void ensureVisible(int row);
+
+ /**
* Gets the input stream of this console.
*
* @return
Modified: trunk/core/src/driver/org/jnode/driver/console/spi/AbstractConsoleManager.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/console/spi/AbstractConsoleManager.java 2008-07-25 14:03:14 UTC (rev 4354)
+++ trunk/core/src/driver/org/jnode/driver/console/spi/AbstractConsoleManager.java 2008-07-25 18:41:34 UTC (rev 4355)
@@ -9,13 +9,13 @@
* by the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
- * This library is distributed in the hope that it will be useful, but
+ * This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
- * along with this library; If not, write to the Free Software Foundation, Inc.,
+ * along with this library; If not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
@@ -35,9 +35,7 @@
import java.util.Map;
import java.util.Set;
import java.util.Stack;
-
import javax.naming.NameNotFoundException;
-
import org.apache.log4j.Logger;
import org.jnode.driver.ApiNotFoundException;
import org.jnode.driver.Device;
@@ -53,7 +51,6 @@
import org.jnode.naming.InitialNaming;
import org.jnode.system.BootLog;
import org.jnode.system.event.FocusEvent;
-import org.jnode.vm.Unsafe;
/**
* @author epr
@@ -210,14 +207,14 @@
* @param console
*/
public synchronized void focus(Console console) {
- Unsafe.debug("focus(" + console.getConsoleName() + ")");
+ log.debug("focus(" + console.getConsoleName() + ")");
if (this.current != null && this.current != console) {
- Unsafe.debug("Sending focusLost to " + current.getConsoleName());
+ log.debug("Sending focusLost to " + current.getConsoleName());
this.current.focusLost(new FocusEvent(FocusEvent.FOCUS_LOST));
}
this.current = console;
if (this.current != null) {
- Unsafe.debug("Sending focusGained to " + current.getConsoleName());
+ log.debug("Sending focusGained to " + current.getConsoleName());
current.focusGained(new FocusEvent(FocusEvent.FOCUS_GAINED));
}
}
Modified: trunk/core/src/driver/org/jnode/driver/console/textscreen/Line.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/console/textscreen/Line.java 2008-07-25 14:03:14 UTC (rev 4354)
+++ trunk/core/src/driver/org/jnode/driver/console/textscreen/Line.java 2008-07-25 18:41:34 UTC (rev 4355)
@@ -25,7 +25,6 @@
import java.util.SortedSet;
import org.jnode.driver.console.CompletionInfo;
import org.jnode.driver.console.InputCompleter;
-import org.jnode.driver.console.ScrollableTextConsole;
import org.jnode.driver.console.TextConsole;
import org.jnode.driver.console.spi.ConsolePrintStream;
@@ -203,7 +202,7 @@
for (String item : list) {
// item may actually be a single item or in fact multiple items
if (item.length() % SCREEN_WIDTH == 0) {
- // we are already at the first column of the next line
+ // we are already at the first column of the next line
out.print(item);
} else {
// we aren't at the first column of the next line
@@ -334,12 +333,7 @@
// if the line has not been shortened (delete, backspace...)
if (!shortened) {
// ensure that the location of the input cursor is included.
- if (console instanceof ScrollableTextConsole) {
- ((ScrollableTextConsole) console).ensureVisible(inputCursorY);
- } else {
- // since the console is not scrollable, we can't do anything
- // if the row is not visible (the row is completely lost)
- }
+ console.ensureVisible(inputCursorY);
}
console.setCursorVisible(true);
} catch (Exception e) {
Modified: trunk/core/src/driver/org/jnode/driver/console/textscreen/ScrollableTextScreenConsole.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/console/textscreen/ScrollableTextScreenConsole.java 2008-07-25 14:03:14 UTC (rev 4354)
+++ trunk/core/src/driver/org/jnode/driver/console/textscreen/ScrollableTextScreenConsole.java 2008-07-25 18:41:34 UTC (rev 4355)
@@ -9,23 +9,22 @@
* by the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
- * This library is distributed in the hope that it will be useful, but
+ * This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
- * along with this library; If not, write to the Free Software Foundation, Inc.,
+ * along with this library; If not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-
+
package org.jnode.driver.console.textscreen;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import org.jnode.driver.console.ConsoleManager;
-import org.jnode.driver.console.ScrollableTextConsole;
import org.jnode.driver.input.KeyboardEvent;
import org.jnode.driver.input.PointerEvent;
import org.jnode.driver.textscreen.ScrollableTextScreen;
@@ -33,7 +32,7 @@
/**
* @author Ewout Prangsma (ep...@us...)
*/
-public class ScrollableTextScreenConsole extends TextScreenConsole implements ScrollableTextConsole {
+public class ScrollableTextScreenConsole extends TextScreenConsole {
/**
* @param mgr
@@ -44,47 +43,34 @@
ScrollableTextScreen screen, int options) {
super(mgr, name, screen, options);
}
-
+
/**
- * Append characters to the current line.
- *
- * @param v
- * @param offset
- * @param lenght
- * @param color
+ * Scroll a given number of rows up.
+ *
+ * @param rows
*/
- @Override
- public void putChar(char v[], int offset, int lenght, int color) {
- super.putChar(v, offset, lenght, color);
- ensureVisible(getCursorY());
+ public void scrollUp(int rows) {
+ final ScrollableTextScreen screen = (ScrollableTextScreen) getScreen();
+ screen.scrollUp(rows);
+
+ final int length = rows * screen.getWidth();
+ screen.sync(screen.getHeight() * screen.getWidth() - length, length);
}
/**
- * Append a character to the current line.
- *
- * @param v
- * @param color
+ * Scroll a given number of rows down.
+ *
+ * @param rows
*/
- @Override
- public void putChar(char v, int color) {
- super.putChar(v, color);
- ensureVisible(getCursorY());
+ public void scrollDown(int rows) {
+ final ScrollableTextScreen screen = (ScrollableTextScreen) getScreen();
+ screen.scrollDown(rows);
+ screen.sync(0, rows * screen.getWidth());
}
-
+
/**
- * Ensure that the given row is visible.
- *
- * @param row
- */
- @Override
- public void ensureVisible(int row) {
- getScrollableTextScreen().ensureVisible(row, isFocused());
- }
-
- /**
* @see org.jnode.driver.input.KeyboardListener#keyPressed(org.jnode.driver.input.KeyboardEvent)
*/
- @Override
public void keyPressed(KeyboardEvent event) {
if (isFocused() && !event.isConsumed()) {
final int modifiers = event.getModifiers();
@@ -107,7 +93,7 @@
event.consume();
break;
}
- }
+ }
}
if (!event.isConsumed()) {
super.keyPressed(event);
@@ -117,12 +103,11 @@
/**
* @see org.jnode.driver.input.PointerListener#pointerStateChanged(org.jnode.driver.input.PointerEvent)
*/
- @Override
public void pointerStateChanged(PointerEvent event) {
if (isFocused() && (event.getZ() != 0)) {
final int z = event.getZ();
if (z < 0) {
- scrollUp(Math.abs(z));
+ scrollUp(Math.abs(z));
} else {
scrollDown(Math.abs(z));
}
@@ -132,26 +117,4 @@
super.pointerStateChanged(event);
}
}
-
- private final ScrollableTextScreen getScrollableTextScreen() {
- return (ScrollableTextScreen) getScreen();
- }
-
- /**
- * Scroll a given number of rows up.
- *
- * @param rows
- */
- private void scrollUp(int rows) {
- getScrollableTextScreen().scrollUp(rows);
- }
-
- /**
- * Scroll a given number of rows down.
- *
- * @param rows
- */
- private void scrollDown(int rows) {
- getScrollableTextScreen().scrollDown(rows);
- }
}
Modified: trunk/core/src/driver/org/jnode/driver/console/textscreen/TextScreenConsole.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/console/textscreen/TextScreenConsole.java 2008-07-25 14:03:14 UTC (rev 4354)
+++ trunk/core/src/driver/org/jnode/driver/console/textscreen/TextScreenConsole.java 2008-07-25 18:41:34 UTC (rev 4355)
@@ -9,16 +9,16 @@
* by the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
- * This library is distributed in the hope that it will be useful, but
+ * This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
- * along with this library; If not, write to the Free Software Foundation, Inc.,
+ * along with this library; If not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-
+
package org.jnode.driver.console.textscreen;
import java.io.InputStream;
@@ -33,10 +33,8 @@
import org.jnode.driver.console.spi.ConsoleOutputStream;
import org.jnode.driver.console.spi.ConsolePrintStream;
import org.jnode.driver.textscreen.TextScreen;
-import org.jnode.driver.textscreen.x86.PcBufferTextScreen;
import org.jnode.system.event.FocusEvent;
import org.jnode.system.event.FocusListener;
-import org.jnode.vm.Unsafe;
import org.jnode.vm.VmSystem;
import org.jnode.vm.isolate.VmIsolate;
@@ -45,6 +43,7 @@
* @author Levente S\u00e1ntha (ls...@us...)
*/
public class TextScreenConsole extends AbstractConsole implements TextConsole {
+
/**
* The screen I'm writing on
*/
@@ -108,41 +107,37 @@
// ConsoleManager.CreateOptions.NO_SYSTEM_OUT_ERR) == 0);
this.claimSystemOutErr = false;
this.myIsolate = VmIsolate.currentIsolate();
-
- // force initial displayed state
- updateScreenDisplayedState();
}
/**
* Clear the console
- *
+ *
* @see org.jnode.driver.console.TextConsole#clear()
*/
- @Override
public void clear() {
final int size = screen.getWidth() * screen.getHeight();
screen.set(0, ' ', size, 0x07);
+ syncScreen(0, size);
}
/**
* Clear a given row
*/
- @Override
public void clearRow(int row) {
final int size = screen.getWidth();
final int offset = screen.getOffset(0, row);
screen.set(offset, ' ', size, 0x07);
+ syncScreen(offset, size);
}
/**
* Append characters to the current line.
- *
+ *
* @param v
* @param offset
* @param lenght
* @param color
*/
- @Override
public void putChar(char v[], int offset, int lenght, int color) {
int mark = 0;
for (int i = 0; i < lenght; i++) {
@@ -161,17 +156,18 @@
doPutChar(c, color);
}
}
+ screen.ensureVisible(curY, isFocused()); // synchronize if focused
}
/**
* Append a character to the current line.
- *
+ *
* @param v
* @param color
*/
- @Override
public void putChar(char v, int color) {
doPutChar(v, color);
+ screen.ensureVisible(curY, isFocused()); // synchronize if focused
}
private void doPutChar(char v, int color) {
@@ -212,7 +208,6 @@
/**
* @return Returns the tabSize.
*/
- @Override
public int getTabSize() {
return tabSize;
}
@@ -220,7 +215,6 @@
/**
* @param tabSize The tabSize to set.
*/
- @Override
public void setTabSize(int tabSize) {
this.tabSize = tabSize;
}
@@ -228,7 +222,6 @@
/**
* @see org.jnode.driver.console.TextConsole#getColor(int, int)
*/
- @Override
public int getColor(int x, int y) {
return screen.getColor(screen.getOffset(x, y));
}
@@ -236,7 +229,6 @@
/**
* @see org.jnode.driver.console.TextConsole#getChar(int, int)
*/
- @Override
public char getChar(int x, int y) {
return screen.getChar(screen.getOffset(x, y));
}
@@ -244,7 +236,6 @@
/**
* @see org.jnode.driver.console.TextConsole#getCursorX()
*/
- @Override
public int getCursorX() {
return curX;
}
@@ -252,7 +243,6 @@
/**
* @see org.jnode.driver.console.TextConsole#getCursorY()
*/
- @Override
public int getCursorY() {
return curY;
}
@@ -260,7 +250,6 @@
/**
* @see org.jnode.driver.console.TextConsole#getHeight()
*/
- @Override
public int getHeight() {
return screen.getHeight();
}
@@ -268,7 +257,6 @@
/**
* @see org.jnode.driver.console.TextConsole#getWidth()
*/
- @Override
public int getWidth() {
return screen.getWidth();
}
@@ -276,43 +264,49 @@
/**
* @see org.jnode.driver.console.TextConsole#setChar(int, int, char, int)
*/
- @Override
public void setChar(int x, int y, char ch, int color) {
int offset = screen.getOffset(x, y);
screen.set(offset, ch, 1, color);
+ syncScreen(offset, 1);
}
- @Override
public void setChar(int x, int y, char[] ch, int color) {
int offset = screen.getOffset(x, y);
screen.set(offset, ch, 0, ch.length, color);
+ syncScreen(offset, ch.length);
}
- @Override
public void setChar(int x, int y, char[] ch, int cOfset, int cLength, int color) {
int offset = screen.getOffset(x, y);
screen.set(offset, ch, cOfset, cLength, color);
+ syncScreen(offset, cLength);
}
/**
* @see org.jnode.driver.console.TextConsole#setCursor(int, int)
*/
- @Override
public void setCursor(int x, int y) {
this.curX = x;
this.curY = y;
int offset = screen.setCursor(x, y);
+ syncScreen(offset, 1);
}
- private void updateScreenDisplayedState() {
- if (screen instanceof PcBufferTextScreen) {
- ((PcBufferTextScreen) screen).setDisplayed(isFocused());
- } else {
- Unsafe.debug("updateScreenDisplayedState: screen not instanceof PcBufferTextScreen");
+ private void syncScreen(int offset, int size) {
+ if (isFocused()) {
+ screen.sync(offset, size);
}
}
- @Override
+ /**
+ * Ensure that the given row is visible.
+ *
+ * @param row
+ */
+ public void ensureVisible(int row) {
+ screen.ensureVisible(row, isFocused()); // synchronize if focused
+ }
+
public InputCompleter getCompleter() {
if (in instanceof KeyboardInputStream) {
return ((KeyboardInputStream) in).getCompleter();
@@ -321,7 +315,6 @@
}
}
- @Override
public void setCompleter(InputCompleter completer) {
if (in instanceof KeyboardInputStream) {
((KeyboardInputStream) in).setCompleter(completer);
@@ -331,7 +324,6 @@
/**
* @see org.jnode.driver.console.TextConsole#getIn()
*/
- @Override
public InputStream getIn() {
return in;
}
@@ -343,7 +335,6 @@
/**
* @see org.jnode.driver.console.TextConsole#getErr()
*/
- @Override
public PrintStream getErr() {
return err;
}
@@ -351,7 +342,6 @@
/**
* @see org.jnode.driver.console.TextConsole#getOut()
*/
- @Override
public PrintStream getOut() {
return out;
}
@@ -359,29 +349,27 @@
/**
* Is the cursor visible.
*/
- @Override
public boolean isCursorVisible() {
return cursorVisible;
}
/**
* Make the cursor visible or not visible.
- *
+ *
* @param visible
*/
- @Override
public void setCursorVisible(boolean visible) {
this.cursorVisible = visible;
int offset = screen.setCursorVisible(visible);
+ syncScreen(offset, 1);
}
/**
* @see org.jnode.system.event.FocusListener#focusGained(org.jnode.system.event.FocusEvent)
*/
- @Override
public void focusGained(FocusEvent event) {
super.focusGained(event);
- updateScreenDisplayedState();
+ syncScreen(0, screen.getWidth() * screen.getHeight());
if (in instanceof FocusListener) {
((FocusListener) in).focusGained(event);
}
@@ -403,7 +391,6 @@
/**
* @see org.jnode.system.event.FocusListener#focusLost(org.jnode.system.event.FocusEvent)
*/
- @Override
public void focusLost(FocusEvent event) {
if (in instanceof FocusListener) {
((FocusListener) in).focusLost(event);
@@ -417,7 +404,6 @@
});
}
super.focusLost(event);
- updateScreenDisplayedState();
}
/**
Modified: trunk/core/src/driver/org/jnode/driver/textscreen/ScrollableTextScreen.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/textscreen/ScrollableTextScreen.java 2008-07-25 14:03:14 UTC (rev 4354)
+++ trunk/core/src/driver/org/jnode/driver/textscreen/ScrollableTextScreen.java 2008-07-25 18:41:34 UTC (rev 4355)
@@ -9,13 +9,13 @@
* by the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
- * This library is distributed in the hope that it will be useful, but
+ * This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
- * along with this library; If not, write to the Free Software Foundation, Inc.,
+ * along with this library; If not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
@@ -31,14 +31,6 @@
public interface ScrollableTextScreen extends TextScreen {
/**
- * Ensure that the given row is visible.
- *
- * @param row
- * @param sync true if screen should synchronize
- */
- public void ensureVisible(int row, boolean sync);
-
- /**
* Scroll a given number of rows up.
*
* @param rows
Modified: trunk/core/src/driver/org/jnode/driver/textscreen/TextScreen.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/textscreen/TextScreen.java 2008-07-25 14:03:14 UTC (rev 4354)
+++ trunk/core/src/driver/org/jnode/driver/textscreen/TextScreen.java 2008-07-25 18:41:34 UTC (rev 4355)
@@ -9,24 +9,24 @@
* by the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
- * This library is distributed in the hope that it will be useful, but
+ * This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
- * along with this library; If not, write to the Free Software Foundation, Inc.,
+ * along with this library; If not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-
+
package org.jnode.driver.textscreen;
/**
* Abstract class that represents different kinds of screens : - physical screen
- * (video memory) - buffered screen (system memory, faster than video memory) -
+ * (video memory) - buffered screen (system memory, faster that video memory) -
* remote screen, shared screen, multiple screens ... - recording screen (movies
* for demos or tutorials)
- *
+ *
* @author epr
*/
public interface TextScreen {
@@ -44,7 +44,7 @@
/**
* Set a series of of the same character with a given color at a given
* offset.
- *
+ *
* @param offset
* @param ch
* @param color
@@ -53,7 +53,7 @@
/**
* Set an series of characters with a given color at a given offset.
- *
+ *
* @param offset
* @param ch
* @param color
@@ -64,7 +64,7 @@
/**
* Set an series of characters with a given series of colors at a given
* offset.
- *
+ *
* @param offset
* @param ch
* @param colors
@@ -76,13 +76,13 @@
/**
* Copy the content of the screen from a given source to a given
* destination offset.
- *
+ *
* @param srcOffset
* @param destOffset
* @param length
*/
public abstract void copyContent(int srcOffset, int destOffset, int length);
-
+
/**
* Copies the entire screen to the given destination.
* For this operation to succeed, the screens involved must be
@@ -96,18 +96,18 @@
/**
* Gets the height of the screen in letters.
- *
+ *
* @return Returns the height.
*/
public int getHeight();
/**
* Gets the width of the screen in letters.
- *
+ *
* @return Returns the width.
*/
public int getWidth();
-
+
/**
* Calculate the offset for a given x,y coordinate.
*
@@ -116,15 +116,22 @@
* @return
*/
public int getOffset(int x, int y);
-
+
/**
+ * Synchronize the state with the actual device.
+ * @param offset
+ * @param length
+ */
+ public void sync(int offset, int length);
+
+ /**
* Create an in-memory buffer text screen that is compatible
* with this screen.
*
* @return
*/
public TextScreen createCompatibleBufferScreen();
-
+
/**
* Create an in-memory buffer text screen that is compatible
* with this, but larger and supports scrolling.
@@ -132,8 +139,16 @@
* @return
*/
public ScrollableTextScreen createCompatibleScrollableBufferScreen(int height);
-
+
/**
+ * Ensure that the given row is visible.
+ *
+ * @param row
+ * @param sync true if screen should synchronize
+ */
+ public void ensureVisible(int row, boolean sync);
+
+ /**
*
* @param x
* @param y
Modified: trunk/core/src/driver/org/jnode/driver/textscreen/x86/AbstractPcBufferTextScreen.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/textscreen/x86/AbstractPcBufferTextScreen.java 2008-07-25 14:03:14 UTC (rev 4354)
+++ trunk/core/src/driver/org/jnode/driver/textscreen/x86/AbstractPcBufferTextScreen.java 2008-07-25 18:41:34 UTC (rev 4355)
@@ -21,8 +21,6 @@
package org.jnode.driver.textscreen.x86;
-import java.util.Arrays;
-
import org.jnode.driver.textscreen.TextScreen;
import org.jnode.vm.Unsafe;
@@ -46,8 +44,6 @@
private int cursorIndex = 0;
private boolean cursorVisible = true;
- private final boolean ignoreColors;
-
/**
* Initialize this instance.
*
@@ -55,111 +51,88 @@
* @param height
*/
public AbstractPcBufferTextScreen(int width, int height) {
- this(width, height, false);
- }
-
- /**
- * Initialize this instance.
- *
- * @param width
- * @param height
- * @param ignoreColors
- */
- public AbstractPcBufferTextScreen(int width, int height, boolean ignoreColors) {
super(width, height);
- this.ignoreColors = ignoreColors;
this.buffer = new char[width * height];
this.screenBuffer = new char[buffer.length];
-
- Arrays.fill(buffer, ' ');
}
/**
* @see org.jnode.driver.textscreen.TextScreen#copyContent(int, int, int)
*/
- @Override
- public final void copyContent(int srcOffset, int destOffset, int length) {
+ public void copyContent(int srcOffset, int destOffset, int length) {
System.arraycopy(buffer, srcOffset, buffer, destOffset, length);
- sync(destOffset, length);
}
/**
* @see org.jnode.driver.textscreen.TextScreen#getChar(int)
*/
- @Override
- public final char getChar(int offset) {
- return (char) PcTextScreenUtils.decodeCharacter(buffer[offset]);
+ public char getChar(int offset) {
+ return (char) (buffer[offset] & 0xFF);
}
/**
* @see org.jnode.driver.textscreen.TextScreen#getColor(int)
*/
- @Override
- public final int getColor(int offset) {
- //TODO do we really need to cast that to a char ?
- return (char) PcTextScreenUtils.decodeColor(buffer[offset]);
+ public int getColor(int offset) {
+ return (char) ((buffer[offset] >> 8) & 0xFF);
}
/**
* @see org.jnode.driver.textscreen.TextScreen#set(int, char, int, int)
*/
- @Override
public void set(int offset,...
[truncated message content] |
|
From: <ls...@us...> - 2008-07-25 19:26:46
|
Revision: 4357
http://jnode.svn.sourceforge.net/jnode/?rev=4357&view=rev
Author: lsantha
Date: 2008-07-25 19:26:43 +0000 (Fri, 25 Jul 2008)
Log Message:
-----------
Improved metal ocean slider painting (still not perfect).
Modified Paths:
--------------
trunk/core/src/openjdk/javax/javax/swing/plaf/metal/MetalIconFactory.java
trunk/gui/src/awt/org/jnode/awt/util/SurfaceGraphics2D.java
Modified: trunk/core/src/openjdk/javax/javax/swing/plaf/metal/MetalIconFactory.java
===================================================================
--- trunk/core/src/openjdk/javax/javax/swing/plaf/metal/MetalIconFactory.java 2008-07-25 19:25:22 UTC (rev 4356)
+++ trunk/core/src/openjdk/javax/javax/swing/plaf/metal/MetalIconFactory.java 2008-07-25 19:26:43 UTC (rev 4357)
@@ -2565,11 +2565,14 @@
protected Image createImage(Component c, int w, int h,
GraphicsConfiguration config,
Object[] args) {
+ return new BufferedImage(w, h,BufferedImage.TYPE_INT_ARGB);
+/*jnode
if (config == null) {
return new BufferedImage(w, h,BufferedImage.TYPE_INT_ARGB);
}
return config.createCompatibleImage(
w, h, Transparency.BITMASK);
+*/
}
}
@@ -2601,11 +2604,14 @@
protected Image createImage(Component c, int w, int h,
GraphicsConfiguration config,
Object[] args) {
+ return new BufferedImage(w, h,BufferedImage.TYPE_INT_ARGB);
+/*jnode
if (config == null) {
return new BufferedImage(w, h,BufferedImage.TYPE_INT_ARGB);
}
return config.createCompatibleImage(
w, h, Transparency.BITMASK);
+ */
}
protected void paintToImage(Component c, Image image, Graphics g2,
Modified: trunk/gui/src/awt/org/jnode/awt/util/SurfaceGraphics2D.java
===================================================================
--- trunk/gui/src/awt/org/jnode/awt/util/SurfaceGraphics2D.java 2008-07-25 19:25:22 UTC (rev 4356)
+++ trunk/gui/src/awt/org/jnode/awt/util/SurfaceGraphics2D.java 2008-07-25 19:26:43 UTC (rev 4357)
@@ -64,6 +64,7 @@
private Composite composite = AlphaComposite.SrcOver;
private Stroke stroke = DEFAULT_STROKE;
private Paint paint;
+ private Shape clip2D;
private RenderingHints renderingHints = new RenderingHints(DEFAULT_HINTS);
protected SurfaceGraphics2D(AbstractSurface surface) {
@@ -80,6 +81,7 @@
this.composite = g.composite;
this.stroke = g.stroke;
this.paint = g.paint;
+ this.clip2D = g.clip2D;
this.renderingHints = g.renderingHints;
}
@@ -125,6 +127,29 @@
public void clip(Shape s) {
//todo implement it
org.jnode.vm.Unsafe.debug("SurfaceGraphics2D.clip() not implemented\n");
+/*
+// todo attempt to fix metal ocean slider painting
+ AffineTransform t = new AffineTransform();
+ t.translate(simpleGraphics.origin.x, simpleGraphics.origin.y);
+ s = t.createTransformedShape(s);
+ Shape clip = simpleGraphics.getClip();
+ if(clip != null){
+ Area as = new Area(s);
+ Area ac = new Area(clip);
+ as.intersect(ac);
+ s = as;
+ }
+ org.jnode.vm.Unsafe.debug("SurfaceGraphics2D.clip() 1 "+ s + "\n");
+ if(clip2D != null){
+ Area as = new Area(s);
+ Area ac = new Area(clip2D);
+ as.intersect(ac);
+ s = as;
+ }
+ org.jnode.vm.Unsafe.debug("SurfaceGraphics2D.clip() 2 "+ s + "\n");
+ clip2D = s;
+
+ */
}
/**
@@ -926,6 +951,8 @@
public void setClip(Shape clip) {
simpleGraphics.setClip(clip);
+ //todo improve support for Graphics2D
+ //clip2D = null;
}
public void copyArea(int x, int y, int width, int height, int dx, int dy) {
@@ -937,37 +964,85 @@
}
public void fillRect(int x, int y, int width, int height) {
- if (paint == null) {
- simpleGraphics.fillRect(x, y, width, height);
+// if(clip2D == null){
+ if (paint == null) {
+ simpleGraphics.fillRect(x, y, width, height);
+ } else {
+ x = x + simpleGraphics.origin.x;
+ y = y + simpleGraphics.origin.y;
+
+ BufferedImage img = getFillerImage(x, y, width, height);
+ //org.jnode.vm.Unsafe.debug("SurfaceGraphics2D - 2\n");
+ drawImage(img, x, y, background, null);
+ }
+/*
+todo attempt to fix metal ocean slider painting
+(Graphics2D.clip() is used with non-rectangular shape + fillRect() with gradient paint)
} else {
- ColorModel scm = surface.getColorModel();
- PaintContext pc = paint.createContext(scm, new Rectangle(0, 0, 800, 600),
- new Rectangle(0, 0, 800, 600), new AffineTransform(), renderingHints);
- x = x + simpleGraphics.origin.x;
- y = y + simpleGraphics.origin.y;
- Raster raster = pc.getRaster(x, y, width, height);
+ AffineTransform af = new AffineTransform();
+ af.translate(simpleGraphics.origin.x, simpleGraphics.origin.y);
+ if(paint == null){
+ org.jnode.vm.Unsafe.debug("SurfaceGraphics2D - 3\n");
+ //surface.fill(new Rectangle(x, y, width, height), clip2D, af, simpleGraphics.getColor(), Surface.PAINT_MODE);
+ x = x + simpleGraphics.origin.x;
+ y = y + simpleGraphics.origin.y;
- ColorModel cm = pc.getColorModel();
+ org.jnode.vm.Unsafe.debug("SurfaceGraphics2D - 4\n");
+ int rgb = simpleGraphics.getColor().getRGB();
+ for(int i = 0; i < width; i++){
+ for(int j = 0; j < height; j++){
+ if(clip2D.contains(x + i , y + j)){
+ surface.drawPixel(x + i, y + j, rgb, Surface.PAINT_MODE);
+ }
+ }
+ }
+ } else {
- WritableRaster raster2 = scm.createCompatibleWritableRaster(width, height);
- Object de1 = null;
- Object de2 = null;
- int[] comps = new int[4];
- for (int i = 0; i < width; i++)
- for (int j = 0; j < height; j++) {
- de1 = raster.getDataElements(i, j, de1);
- comps = cm.getComponents(de1, comps, 0);
- comps[3] = 0xFF;
- de2 = scm.getDataElements(comps, 0, de2);
- raster2.setDataElements(i, j, de2);
+ x = x + simpleGraphics.origin.x;
+ y = y + simpleGraphics.origin.y;
+
+ org.jnode.vm.Unsafe.debug("SurfaceGraphics2D - 4\n");
+ BufferedImage img = getFillerImage(x, y, width, height);
+ for(int i = 0; i < width; i++){
+ for(int j = 0; j < height; j++){
+ if(clip2D.contains(x + i , y + j)){
+ int rgb = img.getRGB(i, j);
+ surface.drawPixel(x + i, y + j, rgb, Surface.PAINT_MODE);
+ }
+ }
}
-
- BufferedImage img = new BufferedImage(scm, raster2, cm.isAlphaPremultiplied(), null);
- drawImage(img, x, y, background, null);
+ }
}
+ */
}
+ private BufferedImage getFillerImage(int x, int y, int width, int height) {
+ ColorModel scm = surface.getColorModel();
+ PaintContext pc = paint.createContext(scm, new Rectangle(0, 0, 800, 600),
+ new Rectangle(0, 0, 800, 600), new AffineTransform(), renderingHints);
+
+
+ Raster raster = pc.getRaster(x, y, width, height);
+
+ ColorModel cm = pc.getColorModel();
+
+ WritableRaster raster2 = scm.createCompatibleWritableRaster(width, height);
+ Object de1 = null;
+ Object de2 = null;
+ int[] comps = new int[4];
+ for (int i = 0; i < width; i++)
+ for (int j = 0; j < height; j++) {
+ de1 = raster.getDataElements(i, j, de1);
+ comps = cm.getComponents(de1, comps, 0);
+ comps[3] = 0xFF;
+ de2 = scm.getDataElements(comps, 0, de2);
+ raster2.setDataElements(i, j, de2);
+ }
+
+ return new BufferedImage(scm, raster2, cm.isAlphaPremultiplied(), null);
+ }
+
public void clearRect(int x, int y, int width, int height) {
simpleGraphics.clearRect(x, y, width, height);
/*
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2008-07-25 21:09:34
|
Revision: 4358
http://jnode.svn.sourceforge.net/jnode/?rev=4358&view=rev
Author: lsantha
Date: 2008-07-25 21:09:31 +0000 (Fri, 25 Jul 2008)
Log Message:
-----------
Added MagicPermission.
Modified Paths:
--------------
trunk/core/src/driver/org/jnode/driver/system/acpi/AcpiTable.java
trunk/gui/src/driver/org/jnode/driver/video/vesa/VesaUtils.java
Modified: trunk/core/src/driver/org/jnode/driver/system/acpi/AcpiTable.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/system/acpi/AcpiTable.java 2008-07-25 19:26:43 UTC (rev 4357)
+++ trunk/core/src/driver/org/jnode/driver/system/acpi/AcpiTable.java 2008-07-25 21:09:31 UTC (rev 4358)
@@ -26,6 +26,7 @@
import org.jnode.system.ResourceManager;
import org.jnode.system.ResourceNotFreeException;
import org.jnode.system.ResourceOwner;
+import org.jnode.vm.annotation.MagicPermission;
import org.vmmagic.unboxed.Address;
import org.vmmagic.unboxed.MagicUtils;
import org.vmmagic.unboxed.Offset;
@@ -35,6 +36,7 @@
*
* @author Francois-Frederic Ozog
*/
+@MagicPermission
public abstract class AcpiTable {
protected final Logger log = Logger.getLogger(getClass());
Modified: trunk/gui/src/driver/org/jnode/driver/video/vesa/VesaUtils.java
===================================================================
--- trunk/gui/src/driver/org/jnode/driver/video/vesa/VesaUtils.java 2008-07-25 19:26:43 UTC (rev 4357)
+++ trunk/gui/src/driver/org/jnode/driver/video/vesa/VesaUtils.java 2008-07-25 21:09:31 UTC (rev 4358)
@@ -1,7 +1,9 @@
package org.jnode.driver.video.vesa;
import org.vmmagic.unboxed.Address;
+import org.jnode.vm.annotation.MagicPermission;
+@MagicPermission
public class VesaUtils {
public static boolean isEmpty(Address address, int size) {
boolean empty = true;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2008-07-27 20:19:08
|
Revision: 4361
http://jnode.svn.sourceforge.net/jnode/?rev=4361&view=rev
Author: lsantha
Date: 2008-07-27 20:19:04 +0000 (Sun, 27 Jul 2008)
Log Message:
-----------
Better swingpeer support for JDialog.
Modified Paths:
--------------
trunk/core/src/classpath/vm/java/lang/VMSystem.java
trunk/gui/src/awt/org/jnode/awt/swingpeers/SwingBaseWindow.java
trunk/gui/src/awt/org/jnode/awt/swingpeers/SwingBaseWindowPeer.java
trunk/gui/src/awt/org/jnode/awt/swingpeers/SwingFramePeer.java
trunk/gui/src/awt/org/jnode/awt/swingpeers/SwingToolkit.java
Modified: trunk/core/src/classpath/vm/java/lang/VMSystem.java
===================================================================
--- trunk/core/src/classpath/vm/java/lang/VMSystem.java 2008-07-26 13:04:17 UTC (rev 4360)
+++ trunk/core/src/classpath/vm/java/lang/VMSystem.java 2008-07-27 20:19:04 UTC (rev 4361)
@@ -41,8 +41,8 @@
import java.io.PrintStream;
import java.nio.ByteOrder;
import java.util.List;
+import java.util.ArrayList;
-import org.jnode.util.EmptyInputStream;
import org.jnode.util.SystemInputStream;
import org.jnode.vm.Vm;
import org.jnode.vm.VmSystem;
@@ -196,7 +196,7 @@
*/
public static long nanoTime(){
return VmSystem.nanoTime();
- };
+ }
/**
* Returns a list of 'name=value' pairs representing the current environment
@@ -205,8 +205,8 @@
* @return a list of 'name=value' pairs.
*/
static List environ(){
- //TODO implement it
- throw new UnsupportedOperationException();
+ //todo implement it
+ return new ArrayList();
}
/**
* Helper method which creates the standard input stream. VM implementors
Modified: trunk/gui/src/awt/org/jnode/awt/swingpeers/SwingBaseWindow.java
===================================================================
--- trunk/gui/src/awt/org/jnode/awt/swingpeers/SwingBaseWindow.java 2008-07-26 13:04:17 UTC (rev 4360)
+++ trunk/gui/src/awt/org/jnode/awt/swingpeers/SwingBaseWindow.java 2008-07-27 20:19:04 UTC (rev 4361)
@@ -22,15 +22,23 @@
package org.jnode.awt.swingpeers;
import java.awt.AWTEvent;
+import java.awt.Color;
+import java.awt.Component;
import java.awt.Container;
+import java.awt.Frame;
import java.awt.Graphics;
import java.awt.Insets;
import java.awt.Point;
import java.awt.Window;
+import java.beans.PropertyVetoException;
import javax.swing.JComponent;
+import javax.swing.JDialog;
+import javax.swing.JFrame;
import javax.swing.JInternalFrame;
import javax.swing.JRootPane;
+import javax.swing.RootPaneContainer;
import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
/**
* Base class for peer implementation that subclass {@link java.awt.Window}.
@@ -72,6 +80,29 @@
target.reshape(x, y, width, height);
}
+ @Override
+ public void paint(Graphics g) {
+ super.paint(g);
+ if (target instanceof RootPaneContainer && isVisible()) {
+ target.paint(g.create());
+ }
+ }
+
+ @Override
+ public void setMaximum(boolean b) throws PropertyVetoException {
+ super.setMaximum(b);
+ target.setBounds(this.getBounds());
+ }
+
+ @Override
+ protected void validateTree() {
+ super.validateTree();
+ if (target instanceof JFrame)
+ ((JFrame) target).getRootPane().validate();
+ else if (target instanceof JDialog)
+ ((JDialog) target).getRootPane().validate();
+ }
+
/**
* @see org.jnode.awt.swingpeers.ISwingPeer#getAWTComponent()
*/
@@ -85,8 +116,7 @@
* @see java.awt.Component#processEvent(java.awt.AWTEvent)
*/
protected final void processEvent(AWTEvent event) {
- target.dispatchEvent(SwingToolkit.convertEvent(event,
- target));
+ target.dispatchEvent(SwingToolkit.convertEvent(event, target));
}
/**
@@ -111,7 +141,7 @@
* @see javax.swing.JInternalFrame#createRootPane()
*/
protected JRootPane createRootPane() {
- return new RootPane();
+ return new NoContentRootPane();
}
/**
@@ -166,6 +196,61 @@
SwingUtilities.updateComponentTreeUI(target);
}
+ final class NullContentPane extends JComponent {
+ @Override
+ public void update(Graphics g) {
+ //org.jnode.vm.Unsafe.debug("NullContantPane.update()\n");
+ }
+
+ @Override
+ public void paint(Graphics g) {
+ if (target instanceof Frame && !(target instanceof JFrame)) {
+ SwingBaseWindow sf = SwingBaseWindow.this;
+ Frame f = (Frame) target;
+
+ Color bg = f.getBackground();
+ if (bg == null) bg = UIManager.getColor("window");
+ if (bg == null) bg = UIManager.getColor("control");
+ if (bg == null) bg = Color.GRAY;
+
+ g.setColor(bg);
+ g.fillRect(0, 0, getWidth(), getHeight());
+
+ Point f_loc = sf.getLocationOnScreen();
+ Point p_loc = this.getLocationOnScreen();
+
+ int dx = p_loc.x - f_loc.x;
+ int dy = p_loc.y - f_loc.y;
+
+
+ for (Component c : f.getComponents()) {
+ Graphics cg = g.create(c.getX() - dx, c.getY() - dy, c.getWidth(), c.getHeight());
+ c.paintAll(cg);
+ cg.dispose();
+ }
+ }
+ }
+
+ @Override
+ public void repaint() {
+
+ }
+
+ @Override
+ public void repaint(long tm, int x, int y, int width, int height) {
+
+ }
+ }
+
+ final class NoContentRootPane extends JRootPane {
+ /**
+ * @see javax.swing.JRootPane#createContentPane()
+ */
+ protected Container createContentPane() {
+ return new NullContentPane();
+ }
+ }
+
private final class ContentPane extends JComponent {
private awtT target;
Modified: trunk/gui/src/awt/org/jnode/awt/swingpeers/SwingBaseWindowPeer.java
===================================================================
--- trunk/gui/src/awt/org/jnode/awt/swingpeers/SwingBaseWindowPeer.java 2008-07-26 13:04:17 UTC (rev 4360)
+++ trunk/gui/src/awt/org/jnode/awt/swingpeers/SwingBaseWindowPeer.java 2008-07-27 20:19:04 UTC (rev 4361)
@@ -28,12 +28,14 @@
import java.awt.Insets;
import java.awt.Point;
import java.awt.Window;
+import java.awt.Color;
import java.awt.event.WindowEvent;
import java.awt.peer.WindowPeer;
import java.beans.PropertyVetoException;
import javax.swing.JComponent;
import javax.swing.JDesktopPane;
import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
import javax.swing.event.InternalFrameEvent;
import javax.swing.event.InternalFrameListener;
@@ -55,6 +57,13 @@
this.eventDispatcher = new WindowEventDispatcher();
jComponent.addInternalFrameListener(eventDispatcher);
jComponent.validatePeerOnly();
+ if (!window.isBackgroundSet()) {
+ Color bg = peerComponent.getBackground();
+ if (bg == null) bg = UIManager.getColor("window");
+ if (bg == null) bg = UIManager.getColor("control");
+ if (bg == null) bg = Color.GRAY;
+ window.setBackground(bg);
+ }
}
/**
Modified: trunk/gui/src/awt/org/jnode/awt/swingpeers/SwingFramePeer.java
===================================================================
--- trunk/gui/src/awt/org/jnode/awt/swingpeers/SwingFramePeer.java 2008-07-26 13:04:17 UTC (rev 4360)
+++ trunk/gui/src/awt/org/jnode/awt/swingpeers/SwingFramePeer.java 2008-07-27 20:19:04 UTC (rev 4361)
@@ -21,23 +21,15 @@
package org.jnode.awt.swingpeers;
-import java.awt.Color;
-import java.awt.Component;
-import java.awt.Container;
import java.awt.Cursor;
import java.awt.Frame;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.MenuBar;
-import java.awt.Point;
import java.awt.Rectangle;
import java.awt.peer.FramePeer;
import java.beans.PropertyVetoException;
-import javax.swing.JComponent;
import javax.swing.JFrame;
-import javax.swing.JRootPane;
-import javax.swing.RootPaneContainer;
-import javax.swing.UIManager;
final class SwingFrame extends SwingBaseWindow<Frame, SwingFrame> {
@@ -56,12 +48,6 @@
}
@Override
- public void setMaximum(boolean b) throws PropertyVetoException {
- super.setMaximum(b);
- target.setBounds(this.getBounds());
- }
-
- @Override
public void setIcon(boolean b) throws PropertyVetoException {
super.setIcon(b);
target.setBounds(this.getBounds());
@@ -72,26 +58,12 @@
super.paintAll(g);
}
- @Override
- public void paint(Graphics g) {
- super.paint(g);
- if (target instanceof RootPaneContainer && isVisible()) {
- target.paint(g.create());
- }
- }
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
}
- /**
- * @see javax.swing.JInternalFrame#createRootPane()
- */
- protected JRootPane createRootPane() {
- return new NoContentRootPane();
- }
-
@Override
protected void validateTree() {
super.validateTree();
@@ -166,60 +138,7 @@
}
}
- final class NullContentPane extends JComponent {
- @Override
- public void update(Graphics g) {
- //org.jnode.vm.Unsafe.debug("NullContantPane.update()\n");
- }
- @Override
- public void paint(Graphics g) {
- if (target instanceof Frame && !(target instanceof JFrame)) {
- SwingFrame sf = SwingFrame.this;
- Frame f = target;
-
- Color bg = f.getBackground();
- if (bg == null) bg = UIManager.getColor("window");
- if (bg == null) bg = UIManager.getColor("control");
- if (bg == null) bg = Color.GRAY;
-
- g.setColor(bg);
- g.fillRect(0, 0, getWidth(), getHeight());
-
- Point f_loc = sf.getLocationOnScreen();
- Point p_loc = this.getLocationOnScreen();
-
- int dx = p_loc.x - f_loc.x;
- int dy = p_loc.y - f_loc.y;
-
-
- for (Component c : f.getComponents()) {
- Graphics cg = g.create(c.getX() - dx, c.getY() - dy, c.getWidth(), c.getHeight());
- c.paintAll(cg);
- cg.dispose();
- }
- }
- }
-
- @Override
- public void repaint() {
-
- }
-
- @Override
- public void repaint(long tm, int x, int y, int width, int height) {
-
- }
- }
-
- final class NoContentRootPane extends JRootPane {
- /**
- * @see javax.swing.JRootPane#createContentPane()
- */
- protected Container createContentPane() {
- return new NullContentPane();
- }
- }
}
/**
@@ -254,14 +173,6 @@
setMenuBar(mb);
}
- if (!target.isBackgroundSet()) {
- Color bg = peerComponent.getBackground();
- if (bg == null) bg = UIManager.getColor("window");
- if (bg == null) bg = UIManager.getColor("control");
- if (bg == null) bg = Color.GRAY;
- target.setBackground(bg);
- }
-
addToDesktop();
}
Modified: trunk/gui/src/awt/org/jnode/awt/swingpeers/SwingToolkit.java
===================================================================
--- trunk/gui/src/awt/org/jnode/awt/swingpeers/SwingToolkit.java 2008-07-26 13:04:17 UTC (rev 4360)
+++ trunk/gui/src/awt/org/jnode/awt/swingpeers/SwingToolkit.java 2008-07-27 20:19:04 UTC (rev 4361)
@@ -359,7 +359,7 @@
Point p = new Point(x, y);
SwingUtilities.convertPointFromScreen(p, jmb);
comp = SwingUtilities.getDeepestComponentAt(jmb, p.x, p.y);
- if (comp != null && (comp != jmb || comp == jmb && jmb.contains(p.x, p.y))) {
+ if (comp != null && (comp != jmb || jmb.contains(p.x, p.y))) {
return comp;
}
}
@@ -375,17 +375,16 @@
}
} else {
comp = super.getTopComponentAt(x, y);
- SwingFrame sfp = (SwingFrame) SwingUtilities.getAncestorOfClass(
- SwingFrame.class, comp);
- if (sfp != null) {
- Rectangle r = sfp.getBounds();
- Insets ins = sfp.getSwingPeer().getInsets();
+ SwingBaseWindow window = (SwingBaseWindow) SwingUtilities.getAncestorOfClass(SwingBaseWindow.class, comp);
+ if (window != null) {
+ Rectangle r = window.getBounds();
+ Insets ins = window.getSwingPeer().getInsets();
r.x = r.x + ins.left;
r.y = r.y + ins.top;
r.width = r.width - ins.left - ins.right;
r.height = r.height - ins.top - ins.bottom;
if (r.contains(x, y)) {
- Component c = sfp.getAWTComponent().findComponentAt(x - r.x + ins.left, y - r.y + ins.top);
+ Component c = window.getAWTComponent().findComponentAt(x - r.x + ins.left, y - r.y + ins.top);
if (c != null) {
comp = c;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cr...@us...> - 2008-07-29 13:59:17
|
Revision: 4367
http://jnode.svn.sourceforge.net/jnode/?rev=4367&view=rev
Author: crawley
Date: 2008-07-29 13:59:14 +0000 (Tue, 29 Jul 2008)
Log Message:
-----------
More error message tidyups
Modified Paths:
--------------
trunk/fs/src/fs/org/jnode/partitions/command/IBMPartitionTypeArgument.java
trunk/net/src/net/org/jnode/net/syntax/IPv4AddressArgument.java
trunk/net/src/net/org/jnode/net/syntax/IPv4HostArgument.java
trunk/shell/src/shell/org/jnode/shell/syntax/OptionSetSyntax.java
Modified: trunk/fs/src/fs/org/jnode/partitions/command/IBMPartitionTypeArgument.java
===================================================================
--- trunk/fs/src/fs/org/jnode/partitions/command/IBMPartitionTypeArgument.java 2008-07-29 13:44:58 UTC (rev 4366)
+++ trunk/fs/src/fs/org/jnode/partitions/command/IBMPartitionTypeArgument.java 2008-07-29 13:59:14 UTC (rev 4367)
@@ -43,7 +43,7 @@
int code = Integer.parseInt(value.token, 16);
return IBMPartitionTypes.valueOf(code);
} catch (NumberFormatException ex) {
- throw new CommandSyntaxException("Not a valid hexadecimal number");
+ throw new CommandSyntaxException("not a valid hexadecimal number");
} catch (IllegalArgumentException ex) {
throw new CommandSyntaxException(ex.getMessage());
}
Modified: trunk/net/src/net/org/jnode/net/syntax/IPv4AddressArgument.java
===================================================================
--- trunk/net/src/net/org/jnode/net/syntax/IPv4AddressArgument.java 2008-07-29 13:44:58 UTC (rev 4366)
+++ trunk/net/src/net/org/jnode/net/syntax/IPv4AddressArgument.java 2008-07-29 13:59:14 UTC (rev 4367)
@@ -31,7 +31,7 @@
}
final StringTokenizer tok = new StringTokenizer(value.token, ".");
if (tok.countTokens() != 4) {
- throw new CommandSyntaxException("Wrong number of components for an IPv4 address");
+ throw new CommandSyntaxException("wrong number of components for an IPv4 address");
}
try {
final byte b1 = parseUnsignedByte(tok.nextToken());
@@ -40,7 +40,7 @@
final byte b4 = parseUnsignedByte(tok.nextToken());
return new IPv4Address(new byte[]{b1, b2, b3, b4}, 0);
} catch (NumberFormatException ex) {
- throw new CommandSyntaxException("Invalid component in IPv4 address");
+ throw new CommandSyntaxException("invalid component in IPv4 address");
}
}
Modified: trunk/net/src/net/org/jnode/net/syntax/IPv4HostArgument.java
===================================================================
--- trunk/net/src/net/org/jnode/net/syntax/IPv4HostArgument.java 2008-07-29 13:44:58 UTC (rev 4366)
+++ trunk/net/src/net/org/jnode/net/syntax/IPv4HostArgument.java 2008-07-29 13:59:14 UTC (rev 4367)
@@ -27,7 +27,7 @@
try {
return new IPv4Address(value.token);
} catch (IllegalArgumentException ex) {
- throw new CommandSyntaxException("Inval;id hostname or IPv4 address");
+ throw new CommandSyntaxException("invalid hostname or IPv4 address");
}
}
}
Modified: trunk/shell/src/shell/org/jnode/shell/syntax/OptionSetSyntax.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/syntax/OptionSetSyntax.java 2008-07-29 13:44:58 UTC (rev 4366)
+++ trunk/shell/src/shell/org/jnode/shell/syntax/OptionSetSyntax.java 2008-07-29 13:59:14 UTC (rev 4367)
@@ -58,7 +58,7 @@
String value = token.token;
int len = value.length();
if (len < 2 || value.charAt(0) != '-') {
- throw new CommandSyntaxException("'" + value + "' is not a flag set");
+ throw new CommandSyntaxException("not a flag set");
}
for (int i = 1; i < len; i++) {
char ch = value.charAt(i);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cr...@us...> - 2008-07-30 13:22:58
|
Revision: 4370
http://jnode.svn.sourceforge.net/jnode/?rev=4370&view=rev
Author: crawley
Date: 2008-07-30 13:22:53 +0000 (Wed, 30 Jul 2008)
Log Message:
-----------
1) If called with no args, ./configure.sh now uses a default script file
2) Checked in a copy of the configure JAR file to aid bootstrapping in
a clean checkout.
Modified Paths:
--------------
trunk/configure.sh
Added Paths:
-----------
trunk/builder/lib/jnode-configure-dist.jar
Property changes on: trunk/builder/lib/jnode-configure-dist.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: trunk/configure.sh
===================================================================
--- trunk/configure.sh 2008-07-29 18:38:38 UTC (rev 4369)
+++ trunk/configure.sh 2008-07-30 13:22:53 UTC (rev 4370)
@@ -9,4 +9,9 @@
$DIR/builder/lib/jnode-configure-dist.jar:\
$DIR/builder/lib/nanoxml-2.2.3.jar
-java -cp $CP org.jnode.configure.Configure "$@"
+if [ $# = 0 ] ; then
+ java -cp $CP org.jnode.configure.Configure all/conf-source/script.xml
+else
+ java -cp $CP org.jnode.configure.Configure "$@"
+fi
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fd...@us...> - 2008-08-02 19:25:50
|
Revision: 4386
http://jnode.svn.sourceforge.net/jnode/?rev=4386&view=rev
Author: fduminy
Date: 2008-08-02 19:25:44 +0000 (Sat, 02 Aug 2008)
Log Message:
-----------
fix for following FBConsole bugs :
- impossible to switch to the log4j console
- the main console is loosing some lines at boot time
Modified Paths:
--------------
trunk/core/src/driver/org/jnode/driver/console/Console.java
trunk/core/src/driver/org/jnode/driver/console/ConsoleManager.java
trunk/core/src/driver/org/jnode/driver/console/textscreen/TextScreenConsole.java
trunk/core/src/driver/org/jnode/driver/console/textscreen/TextScreenConsoleManager.java
trunk/gui/src/driver/org/jnode/driver/textscreen/fb/FBConsole.java
Modified: trunk/core/src/driver/org/jnode/driver/console/Console.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/console/Console.java 2008-08-02 18:44:38 UTC (rev 4385)
+++ trunk/core/src/driver/org/jnode/driver/console/Console.java 2008-08-02 19:25:44 UTC (rev 4386)
@@ -23,6 +23,7 @@
import org.jnode.driver.input.KeyboardListener;
import org.jnode.driver.input.PointerListener;
+import org.jnode.driver.textscreen.TextScreen;
import org.jnode.system.event.FocusListener;
/**
@@ -111,4 +112,10 @@
* @return
*/
public ConsoleManager getManager();
+
+ /**
+ * Method called to notify the {@link Console} that the system {@link TextScreen} has changed
+ * @param textScreen the new system {@link TextScreen}
+ */
+ public void systemScreenChanged(TextScreen textScreen);
}
Modified: trunk/core/src/driver/org/jnode/driver/console/ConsoleManager.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/console/ConsoleManager.java 2008-08-02 18:44:38 UTC (rev 4385)
+++ trunk/core/src/driver/org/jnode/driver/console/ConsoleManager.java 2008-08-02 19:25:44 UTC (rev 4386)
@@ -25,6 +25,7 @@
import java.util.Set;
import org.jnode.driver.input.KeyboardListener;
import org.jnode.driver.input.PointerListener;
+import org.jnode.driver.textscreen.TextScreenManager;
/**
* @author epr
@@ -151,4 +152,10 @@
public Console createConsole(String name, int options);
public void printConsoles(PrintStream ps);
+
+ /**
+ * That method is called when the system {@link TextScreenManager} has changed
+ * It's a temporary workaround. FIXME : create and use a listener mechanism in InitialNaming instead
+ */
+ public void textScreenManagerChanged();
}
Modified: trunk/core/src/driver/org/jnode/driver/console/textscreen/TextScreenConsole.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/console/textscreen/TextScreenConsole.java 2008-08-02 18:44:38 UTC (rev 4385)
+++ trunk/core/src/driver/org/jnode/driver/console/textscreen/TextScreenConsole.java 2008-08-02 19:25:44 UTC (rev 4386)
@@ -26,6 +26,7 @@
import java.security.AccessController;
import java.security.PrivilegedAction;
+import org.jnode.driver.console.Console;
import org.jnode.driver.console.ConsoleManager;
import org.jnode.driver.console.InputCompleter;
import org.jnode.driver.console.TextConsole;
@@ -47,7 +48,7 @@
/**
* The screen I'm writing on
*/
- private final TextScreen screen;
+ private TextScreen screen;
/**
* Width of the screen
@@ -89,6 +90,11 @@
private final boolean claimSystemOutErr;
private VmIsolate myIsolate;
+
+ /**
+ * The options used to create this {@link TextScreenConsole}
+ */
+ private final int options;
/**
* @param mgr
@@ -97,6 +103,7 @@
*/
public TextScreenConsole(ConsoleManager mgr, String name, TextScreen screen, int options) {
super(mgr, name);
+ this.options = options;
this.screen = screen;
this.scrWidth = screen.getWidth();
this.scrHeight = screen.getHeight();
@@ -412,4 +419,31 @@
protected final TextScreen getScreen() {
return this.screen;
}
+
+ /**
+ * Get the options used to create this {@link TextScreenConsole}
+ * @return
+ */
+ final int getOptions() {
+ return options;
+ }
+
+ /**
+ * @see Console#systemScreenChanged(TextScreen)
+ */
+ @Override
+ public void systemScreenChanged(TextScreen systemScreen) {
+ // ensure that old and new screens are compatible
+ if ((systemScreen.getWidth() != screen.getWidth()) || (systemScreen.getHeight() != screen.getHeight())) {
+ throw new IllegalArgumentException("old and new screen have different sizes");
+ }
+
+ TextScreen oldScreen = screen;
+ screen = systemScreen;
+
+ final int size = oldScreen.getWidth() * oldScreen.getHeight();
+ oldScreen.ensureVisible(0, isFocused());
+ oldScreen.copyTo(screen, 0, size);
+ syncScreen(0, size);
+ }
}
Modified: trunk/core/src/driver/org/jnode/driver/console/textscreen/TextScreenConsoleManager.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/console/textscreen/TextScreenConsoleManager.java 2008-08-02 18:44:38 UTC (rev 4385)
+++ trunk/core/src/driver/org/jnode/driver/console/textscreen/TextScreenConsoleManager.java 2008-08-02 19:25:44 UTC (rev 4386)
@@ -25,6 +25,7 @@
import javax.naming.NameNotFoundException;
+import org.jnode.driver.console.Console;
import org.jnode.driver.console.ConsoleException;
import org.jnode.driver.console.spi.AbstractConsoleManager;
import org.jnode.driver.textscreen.ScrollableTextScreen;
@@ -54,8 +55,7 @@
*/
public TextScreenConsole createConsole(String name, int options) {
if ((options & CreateOptions.TEXT) != 0) {
- final TextScreenManager tsm;
- tsm = getTextScreenManager();
+ final TextScreenManager tsm = getTextScreenManager();
final TextScreenConsole console;
if (name == null) {
name = autoName();
@@ -122,6 +122,24 @@
}
}
+
+ @Override
+ public void textScreenManagerChanged() {
+ final TextScreen systemScreen = getTextScreenManager().getSystemScreen();
+
+ for (Console c : getConsoles()) {
+ TextScreenConsole console = (TextScreenConsole) c;
+
+ final TextScreen screen;
+ if ((console.getOptions() & CreateOptions.SCROLLABLE) != 0) {
+ screen = systemScreen.createCompatibleScrollableBufferScreen(SCROLLABLE_HEIGHT);
+ } else {
+ screen = systemScreen.createCompatibleBufferScreen();
+ }
+ console.systemScreenChanged(screen);
+ }
+ }
+
/*
protected void setAccelerator(Console console) {
for (int i = 0; i < 12; i++) {
Modified: trunk/gui/src/driver/org/jnode/driver/textscreen/fb/FBConsole.java
===================================================================
--- trunk/gui/src/driver/org/jnode/driver/textscreen/fb/FBConsole.java 2008-08-02 18:44:38 UTC (rev 4385)
+++ trunk/gui/src/driver/org/jnode/driver/textscreen/fb/FBConsole.java 2008-08-02 19:25:44 UTC (rev 4386)
@@ -20,7 +20,6 @@
import org.jnode.shell.CommandShell;
import org.jnode.shell.ShellManager;
import org.jnode.shell.ShellUtils;
-import org.jnode.vm.VmSystem;
/**
* @author Levente S\u00e1ntha
@@ -87,34 +86,21 @@
InitialNaming.unbind(TextScreenManager.NAME);
InitialNaming.bind(TextScreenManager.NAME, fbTsMgr);
- ////
+ //// FIXME we shouldn't be forced to call that : a better (and more generic) solution would be to use a listener on InitialNaming binding changes
ConsoleManager mgr = InitialNaming.lookup(ConsoleManager.NAME);
+ mgr.textScreenManagerChanged();
+ ////
- //
- final int options = ConsoleManager.CreateOptions.TEXT |
- ConsoleManager.CreateOptions.SCROLLABLE;
-
- final TextConsole first = (TextConsole) mgr.createConsole(
- null, options);
-
- mgr.registerConsole(first);
- mgr.focus(first);
- AccessController.doPrivileged(new PrivilegedAction<Object>() {
- public Object run() {
- System.setOut(new PrintStream(first.getOut()));
- System.setErr(new PrintStream(first.getErr()));
- return null;
- }
- });
- System.out.println(VmSystem.getBootLog());
-
- if (first.getIn() == null) {
- throw new Exception("console input is null");
- }
-
+ //// FIXME we shouldn't need that code since command shell is already created elsewhere
+ // but without that code :
+ // - it's impossible to scroll nor to type anything that is displayed in the console
+ // - it's also impossible to switch between consoles
+ // NB : I have checked and the scrollUp/ScrollDown method are called properly
+ final TextConsole first = (TextConsole) mgr.getFocus();
new CommandShell(first).run();
Thread.sleep(60 * 1000);
-
+ //// end of FIXME
+
} catch (Throwable ex) {
log.error("Error in FBConsole", ex);
} finally {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2008-08-04 22:39:40
|
Revision: 4398
http://jnode.svn.sourceforge.net/jnode/?rev=4398&view=rev
Author: lsantha
Date: 2008-08-04 22:39:28 +0000 (Mon, 04 Aug 2008)
Log Message:
-----------
Fixed support for nfs:// and smb:// URLs. This fixes smbmount too.
Modified Paths:
--------------
trunk/fs/descriptors/jcifs.xml
trunk/net/descriptors/org.jnode.protocol.nfs.xml
Modified: trunk/fs/descriptors/jcifs.xml
===================================================================
--- trunk/fs/descriptors/jcifs.xml 2008-08-04 22:19:02 UTC (rev 4397)
+++ trunk/fs/descriptors/jcifs.xml 2008-08-04 22:39:28 UTC (rev 4398)
@@ -10,6 +10,7 @@
<requires>
<import plugin="org.jnode.net"/>
+ <import plugin="org.jnode.protocol" />
</requires>
<runtime>
@@ -23,5 +24,9 @@
<permission class="java.util.PropertyPermission" name="*" actions="read,write"/>
<permission class="java.net.NetPermission" name="specifyStreamHandler"/>
</extension>
-
+
+ <extension point="org.jnode.protocol.handlers">
+ <handler protocol="smb" class="jcifs.smb.Handler" />
+ </extension>
+
</plugin>
\ No newline at end of file
Modified: trunk/net/descriptors/org.jnode.protocol.nfs.xml
===================================================================
--- trunk/net/descriptors/org.jnode.protocol.nfs.xml 2008-08-04 22:19:02 UTC (rev 4397)
+++ trunk/net/descriptors/org.jnode.protocol.nfs.xml 2008-08-04 22:39:28 UTC (rev 4398)
@@ -7,6 +7,7 @@
<requires>
<import plugin="org.jnode.net.ipv4" />
<import plugin="org.jnode.net.nfs" />
+ <import plugin="org.jnode.protocol" />
</requires>
<runtime>
@@ -16,7 +17,11 @@
</library>
</runtime>
- <extension point="org.jnode.security.permissions">
+ <extension point="org.jnode.protocol.handlers">
+ <handler protocol="nfs" class="org.jnode.protocol.nfs.Handler" />
+ </extension>
+
+ <extension point="org.jnode.security.permissions">
<permission class="java.net.SocketPermission" name="*"
actions="connect,resolve" />
</extension>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cr...@us...> - 2008-08-05 10:06:13
|
Revision: 4399
http://jnode.svn.sourceforge.net/jnode/?rev=4399&view=rev
Author: crawley
Date: 2008-08-05 10:06:10 +0000 (Tue, 05 Aug 2008)
Log Message:
-----------
This provides an (interim) way to incorporate overrides into the VMware .vmx
file created by the build.
Modified Paths:
--------------
trunk/all/build-x86.xml
trunk/builder/src/builder/org/jnode/build/VMwareBuilderTask.java
trunk/jnode.properties.dist
Modified: trunk/all/build-x86.xml
===================================================================
--- trunk/all/build-x86.xml 2008-08-04 22:39:28 UTC (rev 4398)
+++ trunk/all/build-x86.xml 2008-08-05 10:06:10 UTC (rev 4399)
@@ -78,6 +78,11 @@
<property name="build.native.dir" value="${my-build.dir}/${jnode.bits}bits/native" />
<property name="build.bootimage.dir" value="${my-build.dir}/${jnode.bits}bits/bootimage" />
+ <condition property="vmware.vmx.overrides" value="">
+ <not>
+ <isset property="vmware.vmx.overrides"/>
+ </not>
+ </condition>
</target>
<!-- Initialize all project directories -->
@@ -276,6 +281,7 @@
isofile="${jnode-x86.iso}"
logFile="${logFile}"
memsize="${jnode.virtual.memsize}"
+ overrideFile="${vmware.vmx.overrides}"
/>
</target>
@@ -284,11 +290,11 @@
<create-cdrom destfile="${jnode-x86-lite.iso}" dir="${my-build.dir}/cdrom-lite" />
<taskdef name="vmware" classname="org.jnode.build.VMwareBuilderTask" classpathref="cp-x86" />
-
<vmware
isofile="${jnode-x86-lite.iso}"
logFile="${logFile}"
memsize="${jnode.virtual.memsize}"
+ overrideFile="${vmware.vmx.overrides}"
/>
</target>
@@ -296,11 +302,11 @@
<create-cdrom destfile="${jnode-x86_64-lite.iso}" dir="${my-build.dir}/cdrom-lite" />
<taskdef name="vmware" classname="org.jnode.build.VMwareBuilderTask" classpathref="cp-x86" />
-
<vmware
isofile="${jnode-x86_64-lite.iso}"
logFile="${logFile}"
memsize="${jnode.virtual.memsize}"
+ overrideFile="${vmware.vmx.overrides}"
/>
</target>
Modified: trunk/builder/src/builder/org/jnode/build/VMwareBuilderTask.java
===================================================================
--- trunk/builder/src/builder/org/jnode/build/VMwareBuilderTask.java 2008-08-04 22:39:28 UTC (rev 4398)
+++ trunk/builder/src/builder/org/jnode/build/VMwareBuilderTask.java 2008-08-05 10:06:10 UTC (rev 4399)
@@ -21,18 +21,33 @@
package org.jnode.build;
+import java.io.BufferedReader;
import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
+import java.util.Properties;
+import java.util.TreeSet;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Task;
+/**
+ * This task builds a VMWare '.vmx' file to allow JNode to be run using VMWare player.
+ *
+ * @author ...
+ * @author cr...@jn...
+ */
public class VMwareBuilderTask extends Task {
private String logFile; // log file use for kernel debugger messages
private String isoFile;
private int memorySize;
+ private String overrideFile;
/**
* @return Returns the memorySize.
@@ -63,71 +78,139 @@
}
/**
+ * The override file is a Java Properties file containing VMX settings
+ * to override the default ones hard-wired into this class.
+ *
+ * @return Returns the override file or <code>null</code>
+ */
+ public String getOverrideFile() {
+ return overrideFile;
+ }
+
+ /**
+ * @param overrideFile The override file to set.
+ */
+ public void setOverrideFile(String overrideFile) {
+ this.overrideFile = overrideFile;
+ }
+
+ /**
* @see org.apache.tools.ant.Task#execute()
*/
@Override
public void execute() throws BuildException {
+ // Build the default properties, based on the supplied memSize and logFile.
+ Properties props = new Properties();
+ buildDefaultProperties(props);
+
+ if (overrideFile != null && overrideFile.length() > 0) {
+ // If VMX overrides are provided, read them and add them to the properties;
+ BufferedReader br = null;
+ try {
+ // Unfortunately, we cannot use java.util.Property#load(...) because
+ // VMX properties can have ':' in the property name.
+ br = new BufferedReader(new FileReader(overrideFile));
+ String line;
+ final Pattern propertyPattern = Pattern.compile("^([a-zA-Z0-9\\.:]+)\\s*=\\s*\"([^\"]*)\"");
+ final Pattern commentPattern = Pattern.compile("^#");
+ while ((line = br.readLine()) != null) {
+ line = line.trim();
+ if (line.isEmpty() || commentPattern.matcher(line).find()) {
+ continue;
+ }
+ Matcher matcher = propertyPattern.matcher(line);
+ if (!matcher.find()) {
+ throw new BuildException(
+ "Cannot parse this VMX override: '" + line + "'");
+ }
+ props.put(matcher.group(1), matcher.group(2));
+ }
+ } catch (FileNotFoundException ex) {
+ throw new BuildException(
+ "Cannot open the VMX override file: " + overrideFile, ex);
+ } catch (IOException ex) {
+ throw new BuildException(
+ "Problem reading the VMX override file: " + overrideFile, ex);
+ } finally {
+ if (br != null) {
+ try {
+ br.close();
+ } catch (IOException ex) {
+ /* ignore it */
+ }
+ }
+ }
+ }
+
+ // Now output the VMX file from the properties, sorted in key order for neatness.
+ File vmxFile = new File(isoFile + ".vmx");
try {
- FileWriter out = new FileWriter(new File(isoFile + ".vmx"));
+ FileWriter out = new FileWriter(vmxFile);
try {
PrintWriter w = new PrintWriter(out);
+ TreeSet<Object> keys = new TreeSet<Object>();
+ keys.addAll(props.keySet());
+ for (Object key : keys) {
+ Object value = props.get(key);
+ w.println(key + " = \"" + value + "\"");
+ }
+ } finally {
+ out.close();
+ }
+ } catch (IOException ex) {
+ throw new BuildException("Problem writing the VMX file: " + vmxFile);
+ }
+ }
- put(w, "config.version", "8");
- put(w, "virtualHW.version", "4");
- put(w, "memsize", String.valueOf(memorySize));
- put(w, "MemAllowAutoScaleDown", "FALSE");
- put(w, "ide0:0.present", "TRUE");
- put(w, "ide0:0.fileName", new File(isoFile).getName());
- put(w, "ide0:0.deviceType", "cdrom-image");
- put(w, "ide1:0.present", "FALSE");
- put(w, "floppy0.present", "FALSE");
- put(w, "usb.present", "TRUE");
- put(w, "sound.present", "FALSE");
- put(w, "sound.virtualDev", "es1371");
- put(w, "displayName", "JNode");
- put(w, "guestOS", "dos");
+ private void buildDefaultProperties(Properties props) {
+ props.put("config.version", "8");
+ props.put("virtualHW.version", "4");
+ props.put("memsize", String.valueOf(memorySize));
+ props.put("MemAllowAutoScaleDown", "FALSE");
- put(w, "nvram", "JNode.nvram");
- put(w, "MemTrimRate", "-1");
- put(w, "ide0:0.redo", "");
+ props.put("ide0:0.present", "TRUE");
+ props.put("ide0:0.startConnected", "TRUE");
+ props.put("ide0:0.fileName", new File(isoFile).getName());
+ props.put("ide0:0.deviceType", "cdrom-image");
+ props.put("ide0:0.redo", "");
- final String osName = System.getProperty("os.name").toLowerCase();
- if (osName.contains("linux") || osName.contains("unix") ||
- osName.contains("bsd")) {
- put(w, "ethernet0.connectionType", "bridged");
- put(w, "ethernet0.vnet", "/dev/vmnet1");
- }
- put(w, "ethernet0.addressType", "generated");
- put(w, "ethernet0.generatedAddress", "00:0c:29:2a:96:30");
- put(w, "ethernet0.generatedAddressOffset", "0");
- put(w, "ethernet0.present", "TRUE");
- put(w, "ethernet0.startConnected", "TRUE");
+ props.put("ide1:0.present", "FALSE");
+ props.put("ide1:0.startConnected", "TRUE");
- put(w, "uuid.location", "56 4d 94 59 c9 96 80 88-6c 3a 37 80 04 68 c9 b2");
- put(w, "uuid.bios", "56 4d 94 59 c9 96 80 88-6c 3a 37 80 04 68 c9 b2");
+ props.put("floppy0.present", "FALSE");
+ props.put("usb.present", "TRUE");
+ props.put("sound.present", "FALSE");
+ props.put("sound.virtualDev", "es1371");
+ props.put("displayName", "JNode");
+ props.put("guestOS", "dos");
+ props.put("nvram", "JNode.nvram");
+ props.put("MemTrimRate", "-1");
- if ((logFile != null) && (logFile.trim().length() != 0)) {
- put(w, "serial0.present", "TRUE");
- put(w, "serial0.fileType", "file");
- put(w, "serial0.fileName", logFile);
- }
+ final String osName = System.getProperty("os.name").toLowerCase();
+ if (osName.contains("linux") || osName.contains("unix") ||
+ osName.contains("bsd")) {
+ props.put("ethernet0.connectionType", "bridged");
+ props.put("ethernet0.vnet", "/dev/vmnet1");
+ }
+ props.put("ethernet0.addressType", "generated");
+ props.put("ethernet0.generatedAddress", "00:0c:29:2a:96:30");
+ props.put("ethernet0.generatedAddressOffset", "0");
+ props.put("ethernet0.present", "TRUE");
+ props.put("ethernet0.startConnected", "TRUE");
- put(w, "tools.syncTime", "TRUE");
- put(w, "ide1:0.startConnected", "TRUE");
- put(w, "uuid.action", "create");
- put(w, "checkpoint.vmState", "");
+ props.put("uuid.location", "56 4d 94 59 c9 96 80 88-6c 3a 37 80 04 68 c9 b2");
+ props.put("uuid.bios", "56 4d 94 59 c9 96 80 88-6c 3a 37 80 04 68 c9 b2");
- } finally {
- out.close();
- }
- } catch (IOException ex) {
- throw new BuildException(ex);
+ if (logFile != null && logFile.trim().length() != 0) {
+ props.put("serial0.present", "TRUE");
+ props.put("serial0.fileType", "file");
+ props.put("serial0.fileName", logFile);
}
- }
- private void put(PrintWriter w, String key, String value) {
- w.println(key + " = \"" + value + "\"");
+ props.put("tools.syncTime", "TRUE");
+ props.put("uuid.action", "create");
+ props.put("checkpoint.vmState", "");
}
/**
@@ -138,7 +221,8 @@
}
/**
- * @param isoFile The isoFile to set.
+ * @param isoFile
+ * The isoFile to set.
*/
public final void setIsoFile(String isoFile) {
this.isoFile = isoFile;
Modified: trunk/jnode.properties.dist
===================================================================
--- trunk/jnode.properties.dist 2008-08-04 22:39:28 UTC (rev 4398)
+++ trunk/jnode.properties.dist 2008-08-05 10:06:10 UTC (rev 4399)
@@ -67,3 +67,21 @@
# This is needed by the hotswap ant target.
jnode.debugger.host=
jnode.debugger.port=6789
+
+# -----------------------------------------------
+# Settings for a VMware virtual machine
+# -----------------------------------------------
+
+# Uncomment and edit this line if you want to override the settings
+# in the 'jnode-x86-*.vmx' file. For example, you may want to include
+# settings to configure a VMware virtual hard drive, or real hard drive.
+# Refer to the maintainers pages on the JNode website for details.
+# Notes:
+# - Settings in the override file should be in standard VMX syntax.
+# - The settings override the default settings, including (if you
+# set them) the memSize and/or logFile parameters set in the
+# ant build.xml files.
+# - Any non-absolute pathnames in the VMX settings are resolved relative
+# to the VMX file's location!
+
+#vmware.vmx.overrides=<some-file-containing-vmx-settings>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2008-08-06 20:28:45
|
Revision: 4403
http://jnode.svn.sourceforge.net/jnode/?rev=4403&view=rev
Author: lsantha
Date: 2008-08-06 20:28:42 +0000 (Wed, 06 Aug 2008)
Log Message:
-----------
Code style fixes.
Modified Paths:
--------------
trunk/builder/src/configure/org/jnode/configure/Configure.java
trunk/gui/src/awt/org/jnode/awt/util/SurfaceGraphics2D.java
trunk/gui/src/test/org/jnode/test/gui/FBTest.java
Modified: trunk/builder/src/configure/org/jnode/configure/Configure.java
===================================================================
--- trunk/builder/src/configure/org/jnode/configure/Configure.java 2008-08-06 20:27:23 UTC (rev 4402)
+++ trunk/builder/src/configure/org/jnode/configure/Configure.java 2008-08-06 20:28:42 UTC (rev 4403)
@@ -27,11 +27,11 @@
/**
* The main class for the JNode configuration tool (command line version).
- * <p>
+ * <p/>
* The command currently does not use the JNode Command / Syntax APIs. This
* should be addressed when we have a compatibility library. A version with a
* GUI-based interface would be a good idea too.
- *
+ *
* @author cr...@jn...
*/
public class Configure {
@@ -49,10 +49,10 @@
private boolean debug;
private boolean verbose;
private boolean help;
-
+
private static String USAGE =
"configure.sh [--debug] [--verbose] [--help] [<script>]";
- private static String[] DESCRIPTION = new String[] {
+ private static String[] DESCRIPTION = new String[]{
"Capture configuration properties based on the supplied <script>.",
" If no arguments or options are provided, defaults are supplied",
" by the wrapper script. A copy of the previous state of each",
@@ -63,7 +63,7 @@
" --help output command help then exit",
" --debug enable debug output"
};
- private static String[] UI_HELP = new String[] {
+ private static String[] UI_HELP = new String[]{
"The program will prompt you for values for a series of properties,",
"showing a list of legal values or a regex. If there is a default",
"value, it will be shown in square brackets. At the prompt, type",
@@ -114,20 +114,20 @@
print(DESCRIPTION, err);
print(UI_HELP, err);
}
-
+
private void print(String line, PrintStream stream) {
format(stream, line, DISPLAY_NORMAL);
}
private void print(String[] lines, PrintStream stream) {
- for (String line: lines) {
+ for (String line : lines) {
format(stream, line, DISPLAY_NORMAL);
}
}
/**
* Parse the command line.
- *
+ *
* @param args
*/
private void parseArguments(String[] args) throws ConfigureException {
Modified: trunk/gui/src/awt/org/jnode/awt/util/SurfaceGraphics2D.java
===================================================================
--- trunk/gui/src/awt/org/jnode/awt/util/SurfaceGraphics2D.java 2008-08-06 20:27:23 UTC (rev 4402)
+++ trunk/gui/src/awt/org/jnode/awt/util/SurfaceGraphics2D.java 2008-08-06 20:28:42 UTC (rev 4403)
@@ -965,16 +965,16 @@
public void fillRect(int x, int y, int width, int height) {
// if(clip2D == null){
- if (paint == null) {
- simpleGraphics.fillRect(x, y, width, height);
- } else {
- x = x + simpleGraphics.origin.x;
- y = y + simpleGraphics.origin.y;
+ if (paint == null) {
+ simpleGraphics.fillRect(x, y, width, height);
+ } else {
+ x = x + simpleGraphics.origin.x;
+ y = y + simpleGraphics.origin.y;
- BufferedImage img = getFillerImage(x, y, width, height);
- //org.jnode.vm.Unsafe.debug("SurfaceGraphics2D - 2\n");
- drawImage(img, x, y, background, null);
- }
+ BufferedImage img = getFillerImage(x, y, width, height);
+ //org.jnode.vm.Unsafe.debug("SurfaceGraphics2D - 2\n");
+ drawImage(img, x, y, background, null);
+ }
/*
todo attempt to fix metal ocean slider painting
(Graphics2D.clip() is used with non-rectangular shape + fillRect() with gradient paint)
@@ -984,7 +984,8 @@
af.translate(simpleGraphics.origin.x, simpleGraphics.origin.y);
if(paint == null){
org.jnode.vm.Unsafe.debug("SurfaceGraphics2D - 3\n");
- //surface.fill(new Rectangle(x, y, width, height), clip2D, af, simpleGraphics.getColor(), Surface.PAINT_MODE);
+ //surface.fill(new Rectangle(x, y, width, height), clip2D, af, simpleGraphics.getColor(),
+ // Surface.PAINT_MODE);
x = x + simpleGraphics.origin.x;
y = y + simpleGraphics.origin.y;
Modified: trunk/gui/src/test/org/jnode/test/gui/FBTest.java
===================================================================
--- trunk/gui/src/test/org/jnode/test/gui/FBTest.java 2008-08-06 20:27:23 UTC (rev 4402)
+++ trunk/gui/src/test/org/jnode/test/gui/FBTest.java 2008-08-06 20:28:42 UTC (rev 4403)
@@ -33,7 +33,6 @@
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Collection;
-
import org.apache.log4j.Logger;
import org.jnode.driver.Device;
import org.jnode.driver.DeviceUtils;
@@ -51,16 +50,16 @@
* @author epr
*/
public class FBTest extends AbstractCommand {
-
+
private final DeviceArgument ARG_DEVICE = new DeviceArgument(
- "device", Argument.OPTIONAL, "the FrameBuffer device to use", FrameBufferAPI.class);
-
+ "device", Argument.OPTIONAL, "the FrameBuffer device to use", FrameBufferAPI.class);
+
private final IntegerArgument ARG_LOOPS = new IntegerArgument(
- "loops", Argument.OPTIONAL, "how many loops each test should perform");
-
+ "loops", Argument.OPTIONAL, "how many loops each test should perform");
+
private final StringArgument ARG_TESTS = new StringArgument(
- "tests", Argument.OPTIONAL, "tests to be perform (lREAQ)");
-
+ "tests", Argument.OPTIONAL, "tests to be perform (lREAQ)");
+
public FBTest() {
super("Performs tests on the FrameBuffer implementation and outputs performance data");
registerArguments(ARG_DEVICE, ARG_LOOPS, ARG_TESTS);
@@ -100,7 +99,7 @@
if (tests.indexOf('Q') >= 0) {
log.info("Shape QuadCurve PAINT " + performTest(new DrawShapeQuadTest(), Surface.PAINT_MODE));
//log.info("Shape Arc XOR " + performTest(new DrawShapeArcTest(), Surface.XOR_MODE));
- }
+ }
if (tests.indexOf('C') >= 0) {
log.info("Colors " + performTest(new ColorsTest(), Surface.PAINT_MODE));
}
@@ -109,10 +108,10 @@
public static void main(String[] args) throws Exception {
new FBTest().execute(args);
}
-
+
public void execute(CommandLine commandLine, InputStream in,
- PrintStream out, PrintStream err) {
-
+ PrintStream out, PrintStream err) {
+
Device dev = ARG_DEVICE.getValue();
count = ARG_LOOPS.isSet() ? ARG_LOOPS.getValue() : 100;
tests = ARG_TESTS.isSet() ? ARG_TESTS.getValue() : "lREAQC";
@@ -134,9 +133,9 @@
g = api.open(conf);
this.width = conf.getScreenWidth();
this.height = conf.getScreenHeight();
-
+
perform();
-
+
Thread.sleep(30000);
} catch (Throwable ex) {
log.error("Error in FBTest", ex);
@@ -228,16 +227,16 @@
public void perform() {
int x = 0;
final int width = 50;
- for(Color color : colors) {
- for(int i = 0 ; i < 10 ; i++) {
- final int w = width - 2 * i;
+ for (Color color : colors) {
+ for (int i = 0; i < 10; i++) {
+ final int w = width - 2 * i;
g.draw(new Rectangle2D.Double(x + i, i, w, w), null, tx, color, paintMode);
- }
+ }
x += width;
}
}
}
-
+
class DrawShapeArcTest implements Test {
public void perform() {
final int x1 = randomX();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fd...@us...> - 2008-08-09 10:36:20
|
Revision: 4415
http://jnode.svn.sourceforge.net/jnode/?rev=4415&view=rev
Author: fduminy
Date: 2008-08-09 10:36:16 +0000 (Sat, 09 Aug 2008)
Log Message:
-----------
added @Override annotations
Modified Paths:
--------------
trunk/core/src/driver/org/jnode/driver/console/textscreen/ScrollableTextScreenConsole.java
trunk/core/src/driver/org/jnode/driver/console/textscreen/TextScreenConsole.java
trunk/core/src/driver/org/jnode/driver/textscreen/x86/PcScrollableTextScreen.java
trunk/core/src/driver/org/jnode/driver/textscreen/x86/PcTextScreen.java
trunk/gui/src/driver/org/jnode/driver/textscreen/swing/SwingPcTextScreen.java
trunk/gui/src/test/org/jnode/test/gui/FBConsole.java
Modified: trunk/core/src/driver/org/jnode/driver/console/textscreen/ScrollableTextScreenConsole.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/console/textscreen/ScrollableTextScreenConsole.java 2008-08-09 02:04:39 UTC (rev 4414)
+++ trunk/core/src/driver/org/jnode/driver/console/textscreen/ScrollableTextScreenConsole.java 2008-08-09 10:36:16 UTC (rev 4415)
@@ -71,6 +71,7 @@
/**
* @see org.jnode.driver.input.KeyboardListener#keyPressed(org.jnode.driver.input.KeyboardEvent)
*/
+ @Override
public void keyPressed(KeyboardEvent event) {
if (isFocused() && !event.isConsumed()) {
final int modifiers = event.getModifiers();
@@ -103,6 +104,7 @@
/**
* @see org.jnode.driver.input.PointerListener#pointerStateChanged(org.jnode.driver.input.PointerEvent)
*/
+ @Override
public void pointerStateChanged(PointerEvent event) {
if (isFocused() && (event.getZ() != 0)) {
final int z = event.getZ();
Modified: trunk/core/src/driver/org/jnode/driver/console/textscreen/TextScreenConsole.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/console/textscreen/TextScreenConsole.java 2008-08-09 02:04:39 UTC (rev 4414)
+++ trunk/core/src/driver/org/jnode/driver/console/textscreen/TextScreenConsole.java 2008-08-09 10:36:16 UTC (rev 4415)
@@ -120,6 +120,7 @@
*
* @see org.jnode.driver.console.TextConsole#clear()
*/
+ @Override
public void clear() {
final int size = screen.getWidth() * screen.getHeight();
screen.set(0, ' ', size, 0x07);
@@ -129,6 +130,7 @@
/**
* Clear a given row
*/
+ @Override
public void clearRow(int row) {
final int size = screen.getWidth();
final int offset = screen.getOffset(0, row);
@@ -144,6 +146,7 @@
* @param lenght
* @param color
*/
+ @Override
public void putChar(char v[], int offset, int lenght, int color) {
int mark = 0;
for (int i = 0; i < lenght; i++) {
@@ -171,6 +174,7 @@
* @param v
* @param color
*/
+ @Override
public void putChar(char v, int color) {
doPutChar(v, color);
screen.ensureVisible(curY, isFocused()); // synchronize if focused
@@ -214,6 +218,7 @@
/**
* @return Returns the tabSize.
*/
+ @Override
public int getTabSize() {
return tabSize;
}
@@ -221,6 +226,7 @@
/**
* @param tabSize The tabSize to set.
*/
+ @Override
public void setTabSize(int tabSize) {
this.tabSize = tabSize;
}
@@ -228,6 +234,7 @@
/**
* @see org.jnode.driver.console.TextConsole#getColor(int, int)
*/
+ @Override
public int getColor(int x, int y) {
return screen.getColor(screen.getOffset(x, y));
}
@@ -235,6 +242,7 @@
/**
* @see org.jnode.driver.console.TextConsole#getChar(int, int)
*/
+ @Override
public char getChar(int x, int y) {
return screen.getChar(screen.getOffset(x, y));
}
@@ -242,6 +250,7 @@
/**
* @see org.jnode.driver.console.TextConsole#getCursorX()
*/
+ @Override
public int getCursorX() {
return curX;
}
@@ -249,6 +258,7 @@
/**
* @see org.jnode.driver.console.TextConsole#getCursorY()
*/
+ @Override
public int getCursorY() {
return curY;
}
@@ -256,6 +266,7 @@
/**
* @see org.jnode.driver.console.TextConsole#getHeight()
*/
+ @Override
public int getHeight() {
return screen.getHeight();
}
@@ -263,6 +274,7 @@
/**
* @see org.jnode.driver.console.TextConsole#getWidth()
*/
+ @Override
public int getWidth() {
return screen.getWidth();
}
@@ -270,18 +282,21 @@
/**
* @see org.jnode.driver.console.TextConsole#setChar(int, int, char, int)
*/
+ @Override
public void setChar(int x, int y, char ch, int color) {
int offset = screen.getOffset(x, y);
screen.set(offset, ch, 1, color);
syncScreen(offset, 1);
}
+ @Override
public void setChar(int x, int y, char[] ch, int color) {
int offset = screen.getOffset(x, y);
screen.set(offset, ch, 0, ch.length, color);
syncScreen(offset, ch.length);
}
+ @Override
public void setChar(int x, int y, char[] ch, int cOfset, int cLength, int color) {
int offset = screen.getOffset(x, y);
screen.set(offset, ch, cOfset, cLength, color);
@@ -291,6 +306,7 @@
/**
* @see org.jnode.driver.console.TextConsole#setCursor(int, int)
*/
+ @Override
public void setCursor(int x, int y) {
this.curX = x;
this.curY = y;
@@ -313,6 +329,7 @@
screen.ensureVisible(row, isFocused()); // synchronize if focused
}
+ @Override
public InputCompleter getCompleter() {
if (in instanceof KeyboardInputStream) {
return ((KeyboardInputStream) in).getCompleter();
@@ -321,6 +338,7 @@
}
}
+ @Override
public void setCompleter(InputCompleter completer) {
if (in instanceof KeyboardInputStream) {
((KeyboardInputStream) in).setCompleter(completer);
@@ -330,6 +348,7 @@
/**
* @see org.jnode.driver.console.TextConsole#getIn()
*/
+ @Override
public InputStream getIn() {
return in;
}
@@ -341,6 +360,7 @@
/**
* @see org.jnode.driver.console.TextConsole#getErr()
*/
+ @Override
public PrintStream getErr() {
return err;
}
@@ -348,6 +368,7 @@
/**
* @see org.jnode.driver.console.TextConsole#getOut()
*/
+ @Override
public PrintStream getOut() {
return out;
}
@@ -355,6 +376,7 @@
/**
* Is the cursor visible.
*/
+ @Override
public boolean isCursorVisible() {
return cursorVisible;
}
@@ -364,6 +386,7 @@
*
* @param visible
*/
+ @Override
public void setCursorVisible(boolean visible) {
this.cursorVisible = visible;
int offset = screen.setCursorVisible(visible);
@@ -373,6 +396,7 @@
/**
* @see org.jnode.system.event.FocusListener#focusGained(org.jnode.system.event.FocusEvent)
*/
+ @Override
public void focusGained(FocusEvent event) {
super.focusGained(event);
syncScreen(0, screen.getWidth() * screen.getHeight());
@@ -397,6 +421,7 @@
/**
* @see org.jnode.system.event.FocusListener#focusLost(org.jnode.system.event.FocusEvent)
*/
+ @Override
public void focusLost(FocusEvent event) {
if (in instanceof FocusListener) {
((FocusListener) in).focusLost(event);
Modified: trunk/core/src/driver/org/jnode/driver/textscreen/x86/PcScrollableTextScreen.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/textscreen/x86/PcScrollableTextScreen.java 2008-08-09 02:04:39 UTC (rev 4414)
+++ trunk/core/src/driver/org/jnode/driver/textscreen/x86/PcScrollableTextScreen.java 2008-08-09 10:36:16 UTC (rev 4415)
@@ -56,6 +56,7 @@
/**
* @see org.jnode.driver.textscreen.ScrollableTextScreen#ensureVisible(int, boolean)
*/
+ @Override
public void ensureVisible(int row, boolean sync) {
if (row < ofsY) {
ofsY = row;
@@ -67,6 +68,7 @@
/**
* @see org.jnode.driver.textscreen.ScrollableTextScreen#scrollDown(int)
*/
+ @Override
public void scrollDown(int rows) {
if (rows < 0) {
throw new IllegalArgumentException("rows < 0");
@@ -87,6 +89,7 @@
/**
* @see org.jnode.driver.textscreen.ScrollableTextScreen#scrollUp(int)
*/
+ @Override
public void scrollUp(int rows) {
if (rows < 0) {
throw new IllegalArgumentException("rows < 0");
@@ -101,6 +104,7 @@
*
* @return
*/
+ @Override
protected int getTopOffset() {
return ofsY * getWidth();
}
@@ -108,6 +112,7 @@
/**
* @see org.jnode.driver.textscreen.TextScreen#set(int, char, int, int)
*/
+ @Override
public void set(int offset, char ch, int count, int color) {
maxValidY = Math.max(maxValidY, offset / getWidth());
super.set(offset, ch, count, color);
@@ -115,6 +120,7 @@
/**
* @see org.jnode.driver.textscreen.TextScreen#set(int, char[], int, int, int)
*/
+ @Override
public void set(int offset, char[] ch, int chOfs, int length, int color) {
maxValidY = Math.max(maxValidY, (offset + length - 1) / getWidth());
super.set(offset, ch, chOfs, length, color);
@@ -122,6 +128,7 @@
/**
* @see org.jnode.driver.textscreen.TextScreen#set(int, char[], int, int, int[], int)
*/
+ @Override
public void set(int offset, char[] ch, int chOfs, int length, int[] colors,
int colorsOfs) {
maxValidY = Math.max(maxValidY, (offset + length - 1) / getWidth());
Modified: trunk/core/src/driver/org/jnode/driver/textscreen/x86/PcTextScreen.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/textscreen/x86/PcTextScreen.java 2008-08-09 02:04:39 UTC (rev 4414)
+++ trunk/core/src/driver/org/jnode/driver/textscreen/x86/PcTextScreen.java 2008-08-09 10:36:16 UTC (rev 4415)
@@ -90,6 +90,7 @@
/**
* @see org.jnode.driver.textscreen.TextScreen#copyContent(int, int, int)
*/
+ @Override
public void copyContent(int srcOffset, int destOffset, int length) {
memory.copy(srcOffset * 2, destOffset * 2, length * 2);
}
@@ -97,6 +98,7 @@
/**
* @see org.jnode.driver.textscreen.TextScreen#getChar(int)
*/
+ @Override
public char getChar(int offset) {
return (char) (memory.getByte(offset * 2) & 0xFF);
}
@@ -104,6 +106,7 @@
/**
* @see org.jnode.driver.textscreen.TextScreen#getColor(int)
*/
+ @Override
public int getColor(int offset) {
return memory.getByte(offset * 2 + 1) & 0xFF;
}
@@ -111,6 +114,7 @@
/**
* @see org.jnode.driver.textscreen.TextScreen#set(int, char, int, int)
*/
+ @Override
public void set(int offset, char ch, int count, int color) {
final char v = (char) ((ch & 0xFF) | ((color & 0xFF) << 8));
memory.setChar(offset * 2, v, count);
@@ -120,6 +124,7 @@
* @see org.jnode.driver.textscreen.TextScreen#set(int, char[], int, int,
* int)
*/
+ @Override
public void set(int offset, char[] ch, int chOfs, int length, int color) {
color = (color & 0xFF) << 8;
for (int i = 0; i < length; i++) {
@@ -132,6 +137,7 @@
* @see org.jnode.driver.textscreen.TextScreen#set(int, char[], int, int,
* int[], int)
*/
+ @Override
public void set(int offset, char[] ch, int chOfs, int length, int[] colors,
int colorsOfs) {
for (int i = 0; i < length; i++) {
@@ -147,6 +153,7 @@
* @param rawData
* @param rawDataOffset
*/
+ @Override
public final void copyFrom(char[] rawData, int rawDataOffset) {
if (rawDataOffset < 0) {
Unsafe.die("Screen:rawDataOffset = " + rawDataOffset);
@@ -160,6 +167,7 @@
*
* @param dst
*/
+ @Override
public void copyTo(TextScreen dst, int offset, int length) {
throw new UnsupportedOperationException();
}
@@ -176,6 +184,7 @@
return 0; // TODO what should we return if we don't call instance.setCursor ?
}
+ @Override
public int setCursorVisible(boolean visible) {
return instance.setCursorVisible(visible);
}
Modified: trunk/gui/src/driver/org/jnode/driver/textscreen/swing/SwingPcTextScreen.java
===================================================================
--- trunk/gui/src/driver/org/jnode/driver/textscreen/swing/SwingPcTextScreen.java 2008-08-09 02:04:39 UTC (rev 4414)
+++ trunk/gui/src/driver/org/jnode/driver/textscreen/swing/SwingPcTextScreen.java 2008-08-09 10:36:16 UTC (rev 4415)
@@ -93,6 +93,7 @@
enableEvents(AWTEvent.KEY_EVENT_MASK);
enableEvents(AWTEvent.FOCUS_EVENT_MASK);
addMouseListener(new MouseAdapter() {
+ @Override
public void mousePressed(MouseEvent e) {
if (SwingUtilities.isLeftMouseButton(e)) {
if (contains(e.getX(), e.getY())) {
@@ -110,6 +111,7 @@
setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, ftk);
}
+ @Override
protected void paintComponent(Graphics g) {
g.setColor(getBackground());
g.fillRect(0, 0, getWidth(), getHeight());
@@ -129,6 +131,7 @@
}
}
+ @Override
public void addNotify() {
super.addNotify();
FontMetrics fm = getGraphics().getFontMetrics();
@@ -137,10 +140,12 @@
screen.setSize(screen.getMaximumSize());
}
+ @Override
public Dimension getPreferredSize() {
return new Dimension(w * SCREEN_WIDTH + 2 * margin, (h + 1) * SCREEN_HEIGHT + 2 * margin);
}
+ @Override
public Dimension getMaximumSize() {
return getPreferredSize();
}
@@ -150,6 +155,7 @@
if (keyboardDevice == null) {
keyboardDriver = new MyKeyboardDriver();
keyListener = new KeyAdapter() {
+ @Override
public void keyPressed(KeyEvent e) {
char c = e.getKeyChar();
if (c == KeyEvent.CHAR_UNDEFINED) c = 0;
@@ -159,6 +165,7 @@
}
+ @Override
public void keyReleased(KeyEvent e) {
char c = e.getKeyChar();
if (c == KeyEvent.CHAR_UNDEFINED) c = 0;
@@ -181,30 +188,35 @@
}
private class MouseHandler extends MouseAdapter implements MouseMotionListener, MouseWheelListener {
+ @Override
public void mousePressed(MouseEvent e) {
// todo complete event parameters
PointerEvent p = new PointerEvent(0, e.getX(), e.getY(), true);
pointerDriver.dispatchEvent(p);
}
+ @Override
public void mouseReleased(MouseEvent e) {
// todo complete event parameters
PointerEvent p = new PointerEvent(0, e.getX(), e.getY(), true);
pointerDriver.dispatchEvent(p);
}
+ @Override
public void mouseDragged(MouseEvent e) {
// todo complete event parameters
PointerEvent p = new PointerEvent(0, e.getX(), e.getY(), true);
pointerDriver.dispatchEvent(p);
}
+ @Override
public void mouseMoved(MouseEvent e) {
// todo complete event parameters
PointerEvent p = new PointerEvent(0, e.getX(), e.getY(), true);
pointerDriver.dispatchEvent(p);
}
+ @Override
public void mouseWheelMoved(MouseWheelEvent e) {
// todo complete event parameters
PointerEvent p = new PointerEvent(0, e.getX(), e.getY(), e.getWheelRotation(), true);
@@ -283,6 +295,7 @@
}
};
+ @Override
public void sync(int offset, int length) {
SwingUtilities.invokeLater(repaintCmd);
}
@@ -318,10 +331,12 @@
private static class MyPointerDriver extends Driver implements PointerAPI {
private final ArrayList<PointerListener> listeners = new ArrayList<PointerListener>();
+ @Override
protected synchronized void startDevice() throws DriverException {
getDevice().registerAPI(PointerAPI.class, this);
}
+ @Override
protected synchronized void stopDevice() throws DriverException {
}
@@ -335,10 +350,12 @@
}
}
+ @Override
public void addPointerListener(PointerListener l) {
listeners.add(l);
}
+ @Override
public void removePointerListener(PointerListener l) {
listeners.remove(l);
}
@@ -351,6 +368,7 @@
*
* @param listener the prefered pointer listener
*/
+ @Override
public void setPreferredListener(PointerListener listener) {
}
@@ -359,10 +377,12 @@
private static class MyKeyboardDriver extends Driver implements KeyboardAPI {
private final ArrayList<KeyboardListener> listeners = new ArrayList<KeyboardListener>();
+ @Override
protected synchronized void startDevice() throws DriverException {
getDevice().registerAPI(KeyboardAPI.class, this);
}
+ @Override
protected synchronized void stopDevice() throws DriverException {
}
@@ -384,22 +404,27 @@
}
}
+ @Override
public void addKeyboardListener(KeyboardListener l) {
listeners.add(l);
}
+ @Override
public KeyboardInterpreter getKbInterpreter() {
return null;
}
+ @Override
public void removeKeyboardListener(KeyboardListener l) {
listeners.remove(l);
}
+ @Override
public void setKbInterpreter(KeyboardInterpreter kbInterpreter) {
}
+ @Override
public void setPreferredListener(KeyboardListener l) {
}
Modified: trunk/gui/src/test/org/jnode/test/gui/FBConsole.java
===================================================================
--- trunk/gui/src/test/org/jnode/test/gui/FBConsole.java 2008-08-09 02:04:39 UTC (rev 4414)
+++ trunk/gui/src/test/org/jnode/test/gui/FBConsole.java 2008-08-09 10:36:16 UTC (rev 4415)
@@ -146,6 +146,7 @@
}
+ @Override
public void sync(int offset, int length) {
screen.repaint();
}
@@ -216,6 +217,7 @@
}
*/
new Thread(new Runnable() {
+ @Override
public void run() {
while (true) {
try {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2008-08-11 08:11:01
|
Revision: 4427
http://jnode.svn.sourceforge.net/jnode/?rev=4427&view=rev
Author: lsantha
Date: 2008-08-11 08:10:54 +0000 (Mon, 11 Aug 2008)
Log Message:
-----------
Created sound project.
Added Paths:
-----------
trunk/sound/
trunk/sound/.cvsignore
trunk/sound/.settings/
trunk/sound/build.xml
trunk/sound/descriptors/
trunk/sound/lib/
trunk/sound/sound.iml
trunk/sound/src/
trunk/sound/src/driver/
trunk/sound/src/sound/
trunk/sound/src/test/
Added: trunk/sound/.cvsignore
===================================================================
--- trunk/sound/.cvsignore (rev 0)
+++ trunk/sound/.cvsignore 2008-08-11 08:10:54 UTC (rev 4427)
@@ -0,0 +1 @@
+build
Added: trunk/sound/build.xml
===================================================================
--- trunk/sound/build.xml (rev 0)
+++ trunk/sound/build.xml 2008-08-11 08:10:54 UTC (rev 4427)
@@ -0,0 +1,46 @@
+<project name="JNode-Sound" default="all" basedir=".">
+
+ <typedef file="${basedir}/../all/lib/jnode.xml"/>
+
+ <property name="my-build.dir" value="${basedir}/build"/>
+ <property name="my-classes.dir" value="${my-build.dir}/classes"/>
+ <property name="my-src.dir" value="${basedir}/src"/>
+ <property name="my.jar" value="${jnode-sound.jar}"/>
+
+<!-- Subproject specific classpath -->
+ <path id="my-cp">
+ <pathelement location="${jnode-core.jar}"/>
+ <path refid="cp"/>
+ </path>
+
+<!-- Initialize all subproject directories -->
+ <target name="prepare">
+ <mkdir dir="${my-classes.dir}"/>
+ <jnode.copy-descriptors/>
+ <copy todir="${my-classes.dir}">
+ <fileset dir="${my-src.dir}/sound" excludes="**/*.java,**/package.html"/>
+ </copy>
+ </target>
+
+<!-- Compile all subproject java files -->
+ <target name="compile" depends="prepare">
+ <jnode.compile>
+ <src path="${my-src.dir}/driver"/>
+ <src path="${my-src.dir}/sound"/>
+ <src path="${my-src.dir}/test"/>
+ <classpath refid="my-cp"/>
+ </jnode.compile>
+ </target>
+
+<!-- Assemble the jarfile -->
+ <target name="assemble" depends="compile"/>
+
+<!-- Do it all -->
+ <target name="all" depends="assemble"/>
+
+<!-- Clean everything -->
+ <target name="clean">
+ <jnode.clean/>
+ </target>
+
+</project>
Added: trunk/sound/sound.iml
===================================================================
--- trunk/sound/sound.iml (rev 0)
+++ trunk/sound/sound.iml 2008-08-11 08:10:54 UTC (rev 4427)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module relativePaths="true" type="JAVA_MODULE" version="4">
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
+ <exclude-output />
+ <content url="file://$MODULE_DIR$">
+ <sourceFolder url="file://$MODULE_DIR$/src/driver" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/src/sound" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/src/test" isTestSource="false" />
+ </content>
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ <orderEntryProperties />
+ </component>
+</module>
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fd...@us...> - 2008-08-15 00:05:25
|
Revision: 4439
http://jnode.svn.sourceforge.net/jnode/?rev=4439&view=rev
Author: fduminy
Date: 2008-08-15 00:05:22 +0000 (Fri, 15 Aug 2008)
Log Message:
-----------
removed method sync(int, int) from TextScreen interface
Modified Paths:
--------------
trunk/core/src/driver/org/jnode/driver/console/textscreen/ScrollableTextScreenConsole.java
trunk/core/src/driver/org/jnode/driver/console/textscreen/TextScreenConsole.java
trunk/core/src/driver/org/jnode/driver/textscreen/TextScreen.java
trunk/core/src/driver/org/jnode/driver/textscreen/x86/PcBufferTextScreen.java
trunk/core/src/driver/org/jnode/driver/textscreen/x86/PcTextScreen.java
trunk/gui/src/driver/org/jnode/driver/textscreen/swing/SwingPcTextScreen.java
trunk/gui/src/test/org/jnode/test/gui/FBConsole.java
Modified: trunk/core/src/driver/org/jnode/driver/console/textscreen/ScrollableTextScreenConsole.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/console/textscreen/ScrollableTextScreenConsole.java 2008-08-14 20:24:25 UTC (rev 4438)
+++ trunk/core/src/driver/org/jnode/driver/console/textscreen/ScrollableTextScreenConsole.java 2008-08-15 00:05:22 UTC (rev 4439)
@@ -29,6 +29,7 @@
import org.jnode.driver.input.KeyboardEvent;
import org.jnode.driver.input.PointerEvent;
import org.jnode.driver.textscreen.ScrollableTextScreen;
+import org.jnode.driver.textscreen.x86.AbstractPcBufferTextScreen;
/**
* @author Ewout Prangsma (ep...@us...)
@@ -54,8 +55,11 @@
final ScrollableTextScreen screen = getScrollableTextScreen();
screen.scrollUp(rows);
- final int length = rows * screen.getWidth();
- screen.sync(screen.getHeight() * screen.getWidth() - length, length);
+ //FIXME : the need to explicitly do the following call will be removed a bit later
+ if(screen instanceof AbstractPcBufferTextScreen) {
+ final int length = rows * screen.getWidth();
+ ((AbstractPcBufferTextScreen) screen).sync(screen.getHeight() * screen.getWidth() - length, length);
+ }
}
/**
@@ -66,7 +70,11 @@
public void scrollDown(int rows) {
final ScrollableTextScreen screen = getScrollableTextScreen();
screen.scrollDown(rows);
- screen.sync(0, rows * screen.getWidth());
+
+ //FIXME : the need to explicitly do the following call will be removed a bit later
+ if(screen instanceof AbstractPcBufferTextScreen) {
+ ((AbstractPcBufferTextScreen) screen).sync(0, rows * screen.getWidth());
+ }
}
/**
Modified: trunk/core/src/driver/org/jnode/driver/console/textscreen/TextScreenConsole.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/console/textscreen/TextScreenConsole.java 2008-08-14 20:24:25 UTC (rev 4438)
+++ trunk/core/src/driver/org/jnode/driver/console/textscreen/TextScreenConsole.java 2008-08-15 00:05:22 UTC (rev 4439)
@@ -34,6 +34,7 @@
import org.jnode.driver.console.spi.ConsolePrintStream;
import org.jnode.driver.textscreen.ScrollableTextScreen;
import org.jnode.driver.textscreen.TextScreen;
+import org.jnode.driver.textscreen.x86.AbstractPcBufferTextScreen;
import org.jnode.system.event.FocusEvent;
import org.jnode.system.event.FocusListener;
import org.jnode.vm.VmSystem;
@@ -317,7 +318,10 @@
private void syncScreen(int offset, int size) {
if (isFocused()) {
- screen.sync(offset, size);
+ //FIXME : the need to explicitly do the following call will be removed a bit later
+ if(screen instanceof AbstractPcBufferTextScreen) {
+ ((AbstractPcBufferTextScreen) screen).sync(offset, size);
+ }
}
}
Modified: trunk/core/src/driver/org/jnode/driver/textscreen/TextScreen.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/textscreen/TextScreen.java 2008-08-14 20:24:25 UTC (rev 4438)
+++ trunk/core/src/driver/org/jnode/driver/textscreen/TextScreen.java 2008-08-15 00:05:22 UTC (rev 4439)
@@ -118,13 +118,6 @@
public int getOffset(int x, int y);
/**
- * Synchronize the state with the actual device.
- * @param offset
- * @param length
- */
- public void sync(int offset, int length);
-
- /**
* Create an in-memory buffer text screen that is compatible
* with this screen.
*
Modified: trunk/core/src/driver/org/jnode/driver/textscreen/x86/PcBufferTextScreen.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/textscreen/x86/PcBufferTextScreen.java 2008-08-14 20:24:25 UTC (rev 4438)
+++ trunk/core/src/driver/org/jnode/driver/textscreen/x86/PcBufferTextScreen.java 2008-08-15 00:05:22 UTC (rev 4439)
@@ -47,7 +47,7 @@
* Synchronize the state with the actual device.
*/
@Override
- public void sync(int offset, int length) {
+ public final void sync(int offset, int length) {
copyTo(parent, offset, length);
}
Modified: trunk/core/src/driver/org/jnode/driver/textscreen/x86/PcTextScreen.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/textscreen/x86/PcTextScreen.java 2008-08-14 20:24:25 UTC (rev 4438)
+++ trunk/core/src/driver/org/jnode/driver/textscreen/x86/PcTextScreen.java 2008-08-15 00:05:22 UTC (rev 4439)
@@ -172,15 +172,7 @@
throw new UnsupportedOperationException();
}
- /**
- * Synchronize the state with the actual device.
- */
@Override
- public void sync(int offset, int length) {
- // Nothing to do here
- }
-
- @Override
public int setCursor(int x, int y) {
return 0; // TODO what should we return if we don't call instance.setCursor ?
}
Modified: trunk/gui/src/driver/org/jnode/driver/textscreen/swing/SwingPcTextScreen.java
===================================================================
--- trunk/gui/src/driver/org/jnode/driver/textscreen/swing/SwingPcTextScreen.java 2008-08-14 20:24:25 UTC (rev 4438)
+++ trunk/gui/src/driver/org/jnode/driver/textscreen/swing/SwingPcTextScreen.java 2008-08-15 00:05:22 UTC (rev 4439)
@@ -295,7 +295,6 @@
}
};
- @Override
public void sync(int offset, int length) {
SwingUtilities.invokeLater(repaintCmd);
}
Modified: trunk/gui/src/test/org/jnode/test/gui/FBConsole.java
===================================================================
--- trunk/gui/src/test/org/jnode/test/gui/FBConsole.java 2008-08-14 20:24:25 UTC (rev 4438)
+++ trunk/gui/src/test/org/jnode/test/gui/FBConsole.java 2008-08-15 00:05:22 UTC (rev 4439)
@@ -145,8 +145,6 @@
}
-
- @Override
public void sync(int offset, int length) {
screen.repaint();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|