From 35af224a7e474b5b54c338e3cc70ad509b8f56b2 Mon Sep 17 00:00:00 2001 From: megacz Date: Fri, 30 Jan 2004 06:59:07 +0000 Subject: [PATCH] 2003/04/24 08:00:37 darcs-hash:20040130065907-2ba56-c4914594f018fa04f0a95292331cf6dbd9ff4127.gz --- Makefile | 15 +++++- src/org/xwt/plat/Carbon.cc | 121 ++++++++++++++++++++++++++++++++++++++++++ src/org/xwt/plat/Carbon.java | 101 +++++++++++++++++++++++++++++++++++ 3 files changed, 235 insertions(+), 2 deletions(-) create mode 100644 src/org/xwt/plat/Carbon.cc create mode 100644 src/org/xwt/plat/Carbon.java diff --git a/Makefile b/Makefile index 4e7b850..4676d61 100644 --- a/Makefile +++ b/Makefile @@ -60,7 +60,7 @@ endif compile: $(java_classes) bin/org/xwt/builtin.xwar # platforms -all: Win32 Linux Java2 Darwin +all: Win32 Linux Java2 Darwin Carbon .javac: if \ @@ -177,7 +177,7 @@ src/org/ijg/jmorecfg.h: src/org/ijg/jpegsrc.v6b.tar.gz src/org/ijg/jmorecfg.h.pa cd src/org/ijg; patch -p0 < jmorecfg.h.patch rm -rf src/org/ijg/jpeg-6b -$(cc_objects): bin-$(platform)/%.cc.o: src/%.cc $(java_headers) +$(cc_objects): bin-$(platform)/%.cc.o: src/%.cc $(java_headers) src/org/ijg/jmorecfg.h @echo "compiling .cc -> .o: $<" @mkdir -p `dirname $@` $(g++) -I/usr/X11R6/include/ -I$(gcc_path)/include -Ibin -c $< -o $@ @@ -220,6 +220,17 @@ Darwin: upstream platform_link="upstream/darwin/*.[oa] $(gcc_path)/lib/libgcj.a" \ platform_java_sources="POSIX X11" +Carbon: upstream + echo -e "\\n=== Carbon =========================================" + ranlib upstream/darwin/*.a + ar x /usr/lib/libcc_dynamic.a upstream/darwin/darwin-fpsave.o + make gcj \ + platform=Carbon \ + target=powerpc-apple-darwin \ + target_bin=xwt.carbon \ + platform_link="upstream/darwin/*.[oa] $(gcc_path)/lib/libgcj.a" \ + platform_java_sources="POSIX Carbon" + Java2: $(java_classes) bin/org/xwt/builtin.xwar echo -e "\\n=== Java2 =========================================" echo "archiving .class -> .jar" diff --git a/src/org/xwt/plat/Carbon.cc b/src/org/xwt/plat/Carbon.cc new file mode 100644 index 0000000..326392a --- /dev/null +++ b/src/org/xwt/plat/Carbon.cc @@ -0,0 +1,121 @@ +// Copyright 2002 Adam Megacz, see the COPYING file for licensing [LGPL] +// see below for copyright information on the second portion of this file + +#include "POSIX.cc" +#include +#include +#include +#include +#include +#include +#include + + +// CarbonDoubleBuffer ////////////////////////////////////////////////////////////////////// + +void org::xwt::plat::Carbon$CarbonDoubleBuffer::drawPicture(org::xwt::Picture* s, + jint dx1, jint dy1, jint dx2, jint dy2, jint sx1, jint sy1, jint sx2, jint sy2) { + org::xwt::plat::Carbon$CarbonPicture* source = (org::xwt::plat::Carbon$CarbonPicture*)s; + throw new java::lang::Error(JvNewStringLatin1("FIXME")); +} + +void org::xwt::plat::Carbon$CarbonDoubleBuffer::finalize() { + throw new java::lang::Error(JvNewStringLatin1("FIXME")); +} + +void org::xwt::plat::Carbon$CarbonSurface::blit(org::xwt::DoubleBuffer* db, jint sx, jint sy, jint dx, jint dy, jint dx2, jint dy2) { + org::xwt::plat::Carbon$CarbonDoubleBuffer *xdb = (org::xwt::plat::Carbon$CarbonDoubleBuffer*)db; + throw new java::lang::Error(JvNewStringLatin1("FIXME")); +} + +void org::xwt::plat::Carbon$CarbonDoubleBuffer::fillRect (jint x, jint y, jint x2, jint y2, jint argb) { + throw new java::lang::Error(JvNewStringLatin1("FIXME")); +} + +void org::xwt::plat::Carbon$CarbonDoubleBuffer::drawString(::java::lang::String* font, ::java::lang::String* text, jint x, jint y, jint argb) { + throw new java::lang::Error(JvNewStringLatin1("FIXME")); +} + + +// CarbonSurface ////////////////////////////////////////////////////////////////////// + +void org::xwt::plat::Carbon$CarbonSurface::setIcon(org::xwt::Picture* pic) { + throw new java::lang::Error(JvNewStringLatin1("FIXME")); +} + +void org::xwt::plat::Carbon$CarbonSurface::setTitleBarText(java::lang::String* s) { + throw new java::lang::Error(JvNewStringLatin1("FIXME")); +} + +void org::xwt::plat::Carbon$CarbonSurface::setLimits(jint minw, jint minh, jint maxw, jint maxh) { + throw new java::lang::Error(JvNewStringLatin1("FIXME")); +} + +void org::xwt::plat::Carbon$CarbonSurface::setSize (jint width, jint height) { + throw new java::lang::Error(JvNewStringLatin1("FIXME")); +} + +void org::xwt::plat::Carbon$CarbonSurface::setLocation (jint x, jint y) { + throw new java::lang::Error(JvNewStringLatin1("FIXME")); +} +void org::xwt::plat::Carbon$CarbonSurface::toFront() { + throw new java::lang::Error(JvNewStringLatin1("FIXME")); +} +void org::xwt::plat::Carbon$CarbonSurface::toBack() { + throw new java::lang::Error(JvNewStringLatin1("FIXME")); +} + +void org::xwt::plat::Carbon$CarbonSurface::_dispose() { + throw new java::lang::Error(JvNewStringLatin1("FIXME")); +} + +void org::xwt::plat::Carbon$CarbonSurface::setInvisible(jboolean i) { + throw new java::lang::Error(JvNewStringLatin1("FIXME")); +} + +void org::xwt::plat::Carbon$CarbonSurface::_setMaximized(jboolean b) { + throw new java::lang::Error(JvNewStringLatin1("FIXME")); +} + +void org::xwt::plat::Carbon$CarbonSurface::_setMinimized(jboolean b) { + throw new java::lang::Error(JvNewStringLatin1("FIXME")); +} + + + + +// Carbon /////////////////////////////////////////////////////////////////// + +jint org::xwt::plat::Carbon::_getScreenWidth() { + throw new java::lang::Error(JvNewStringLatin1("FIXME")); +} +jint org::xwt::plat::Carbon::_getScreenHeight() { + throw new java::lang::Error(JvNewStringLatin1("FIXME")); +} + +jstring org::xwt::plat::Carbon::_getClipBoard() { + throw new java::lang::Error(JvNewStringLatin1("FIXME")); +} + +void org::xwt::plat::Carbon::_setClipBoard(jstring s) { + throw new java::lang::Error(JvNewStringLatin1("FIXME")); +} + +JArray* org::xwt::plat::Carbon::listNativeFonts() { + throw new java::lang::Error(JvNewStringLatin1("FIXME")); +} + +gnu::gcj::RawData* org::xwt::plat::Carbon::fontStringToStruct(jstring s) { + throw new java::lang::Error(JvNewStringLatin1("FIXME")); +} + +jint org::xwt::plat::Carbon::_getMaxAscent(::java::lang::String* font) { + throw new java::lang::Error(JvNewStringLatin1("FIXME")); +} +jint org::xwt::plat::Carbon::_getMaxDescent(::java::lang::String* font) { + throw new java::lang::Error(JvNewStringLatin1("FIXME")); +} +jint org::xwt::plat::Carbon::_stringWidth(::java::lang::String* font, ::java::lang::String* text) { + throw new java::lang::Error(JvNewStringLatin1("FIXME")); +} + diff --git a/src/org/xwt/plat/Carbon.java b/src/org/xwt/plat/Carbon.java new file mode 100644 index 0000000..80a0eef --- /dev/null +++ b/src/org/xwt/plat/Carbon.java @@ -0,0 +1,101 @@ +// Copyright 2002 Adam Megacz, see the COPYING file for licensing [LGPL] +package org.xwt.plat; + +import java.awt.*; +import java.awt.image.*; +import gnu.gcj.RawData; +import java.net.*; +import java.lang.reflect.*; +import java.io.*; +import java.util.*; +import java.awt.peer.*; +import org.xwt.util.*; +import org.xwt.*; + +/** Platform implementation for Carbon UI on a POSIX-compliant OS (ie Mac OS X) */ +public class Carbon extends POSIX { + + // General Methods /////////////////////////////////////////////////////// + + protected String _getAltKeyName() { return "option"; } + protected String[] _listFonts() { throw new Error("FIXME"); } + protected Picture _createPicture(int[] data, int w, int h) { return new CarbonPicture(data, w, h); } + protected DoubleBuffer _createDoubleBuffer(int w, int h, Surface owner) { return new CarbonDoubleBuffer(w, h); } + protected Surface _createSurface(Box b, boolean framed) { return new CarbonSurface(b, framed); } + protected boolean _needsAutoClick() { throw new Error("FIXME"); } + protected native int _getScreenWidth(); + protected native int _getScreenHeight(); + protected native String _getClipBoard(); + protected native void _setClipBoard(String s); + protected native int _stringWidth(String font, String text); + protected native int _getMaxAscent(String font); + protected native int _getMaxDescent(String font); + protected boolean _needsAutoDoubleClick() { throw new Error("FIXME"); } + + public Carbon() { } + public void init() { throw new Error("FIXME"); } + + + // CarbonSurface ///////////////////////////////////////////////////// + + /** Implements a Surface as an Carbon Window */ + public static class CarbonSurface extends Surface { + + public native void setInvisible(boolean i); + public native void _setMaximized(boolean m); + public native void setIcon(Picture p); + public native void _setMinimized(boolean b); + public native void setTitleBarText(String s); + public native void setSize(int w, int h); + public native void setLocation(int x, int y); + public native void natInit(); + public native void toFront(); + public native void toBack(); + public native void syncCursor(); + public native void _dispose(); + public native void setLimits(int minw, int minh, int maxw, int maxh); + public native void blit(DoubleBuffer s, int sx, int sy, int dx, int dy, int dx2, int dy2); + + public CarbonSurface(Box root, boolean framed) { throw new Error("FIXME"); } + + } + + + // Our Subclass of Picture /////////////////////////////////////////////// + + /** Implements a Picture */ + public static class CarbonPicture extends Picture { + + int width; + int height; + int[] data = null; + public int getWidth() { return width; } + public int getHeight() { return height; } + + public CarbonPicture(int[] data, int w, int h) { + this.data = data; + this.width = w; + this.height = h; + throw new Error("FIXME"); + } + + } + + /** A Carbon DoubleBuffer */ + public static class CarbonDoubleBuffer extends DoubleBuffer { + + int width; + int height; + public int getWidth() { return width; } + public int getHeight() { return height; } + + public CarbonDoubleBuffer(int w, int h) { this.width = w; this.height = h; throw new Error("FIXME"); } + public void setClip(int x, int y, int x2, int y2) { throw new Error("FIXME"); } + public void drawPicture(Picture source, int x, int y) { throw new Error("FIXME"); } + public void drawPicture(Picture source, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2) { throw new Error("FIXME"); } + public native void fillRect(int x, int y, int x2, int y2, int color); + public native void drawString(String font, String text, int x, int y, int color); + public native void finalize(); + } + +} -- 1.7.10.4