changeset 169:9a850c264e3b

Add JFace Text example
author Frank Benoit <benoit@tionex.de>
date Sun, 26 Oct 2008 14:00:52 +0100
parents d97169edcd8c
children b5ce05a02738
files .hgignore jface.text/Simple.d jface.text/dsss.conf
diffstat 3 files changed, 99 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Sun Oct 19 02:00:57 2008 +0200
+++ b/.hgignore	Sun Oct 26 14:00:52 2008 +0100
@@ -20,6 +20,10 @@
 ^jface/showfieldprefs$
 ^jface/showprefs$
 
+^jface.text/dsss_objs
+^jface.text/dsss.last
+^jface.text/dsss_imports
+
 ^examples/dsss_objs
 ^examples/dsss.last
 ^examples/dsss_imports
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jface.text/Simple.d	Sun Oct 26 14:00:52 2008 +0100
@@ -0,0 +1,70 @@
+module test;
+
+import dwt.DWT;
+import dwt.layout.FillLayout;
+import dwt.widgets.Composite;
+import dwt.widgets.Control;
+import dwt.widgets.Display;
+import dwt.widgets.Shell;
+import dwtx.jface.text.Document;
+import dwtx.jface.text.source.CompositeRuler;
+import dwtx.jface.text.source.LineNumberRulerColumn;
+import dwtx.jface.text.source.AnnotationRulerColumn;
+import dwtx.jface.text.source.SourceViewer;
+import dwtx.jface.window.ApplicationWindow;
+
+version(JIVE) import jive.stacktrace;
+
+class SourceViewerTest : ApplicationWindow
+{
+    this()
+    {
+        super( null );
+    }
+
+    protected Control createContents( Composite parent )
+    {
+        getShell.setText( "SourceViewerTest" );
+        getShell.setSize( 350, 400 );
+        Display disp = getShell.getDisplay();
+        Composite container = new Composite( parent, DWT.NONE );
+        container.setLayout( new FillLayout() );
+
+        CompositeRuler ruler = new CompositeRuler();
+
+        LineNumberRulerColumn lineCol = new LineNumberRulerColumn();
+        lineCol.setBackground( disp.getSystemColor( DWT.COLOR_GRAY ) );
+        lineCol.setForeground( disp.getSystemColor( DWT.COLOR_BLUE ) );
+        ruler.addDecorator( 0, lineCol );
+
+        Document doc = new Document( `void main()
+{
+    ApplicationWindow w = new SourceViewerTest();
+    w.setBlockOnOpen( true );
+    w.open();
+    Display.getCurrent.dispose();
+}
+` );
+
+        SourceViewer sv = new SourceViewer( container, ruler, DWT.BORDER | DWT.H_SCROLL | DWT.V_SCROLL );
+        sv.setDocument( doc );
+
+        return container;
+    }
+}
+
+void main()
+{
+    ApplicationWindow w = new SourceViewerTest();
+    w.setBlockOnOpen( true );
+    w.open();
+    Display.getCurrent.dispose();
+}
+
+
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jface.text/dsss.conf	Sun Oct 26 14:00:52 2008 +0100
@@ -0,0 +1,25 @@
+[*]
+debugflags+=-g -gc
+buildflags+=-J../res
+buildflags+=-I../../dwt-addons
+buildflags+=-J../../dwt-addons/res
+
+version(Windows) {
+    buildflags+=-I../../dwt-win
+    buildflags+=-J../../dwt-win/res
+
+    # if no console window is wanted/needed use -version=gui
+    version(gui) {
+        buildflags+= -L/SUBSYSTEM:windows:5
+    } else {
+        buildflags+= -L/SUBSYSTEM:console:5
+    }
+    buildflags+= -L/rc:..\dwt
+}
+version(Posix) {
+    buildflags+=-I../../dwt-linux
+    buildflags+=-J../../dwt-linux/res
+}
+
+[Simple.d]
+