# HG changeset patch # User Frank Benoit # Date 1225026052 -3600 # Node ID 9a850c264e3b3f4cfa2734db8055e5c05013a12f # Parent d97169edcd8ce2620ada486ec63d8a12e8549a2a Add JFace Text example diff -r d97169edcd8c -r 9a850c264e3b .hgignore --- 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 diff -r d97169edcd8c -r 9a850c264e3b jface.text/Simple.d --- /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(); +} + + + + + + + + diff -r d97169edcd8c -r 9a850c264e3b jface.text/dsss.conf --- /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] +