Mercurial > projects > dwt-linux
changeset 269:11015f58425e
Fix: StyledText check for null in clipboard paste
Add: version TANGOSVN
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 06 Jul 2008 15:36:48 +0200 |
parents | 5995c228c72f |
children | 58ef057b3e9d |
files | dwt/custom/DefaultContent.d dwt/custom/StyledText.d dwt/custom/StyledTextRenderer.d |
diffstat | 3 files changed, 39 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/dwt/custom/DefaultContent.d Sun Jul 06 15:35:58 2008 +0200 +++ b/dwt/custom/DefaultContent.d Sun Jul 06 15:36:48 2008 +0200 @@ -23,13 +23,23 @@ import dwt.custom.StyledText; import dwt.dwthelper.utils; -static import tango.io.FileConst; +version(TANGOSVN) + static import tango.io.model.IFile; +} +else{ + static import tango.io.FileConst; +} static import tango.text.Text; alias tango.text.Text.Text!(char) StringBuffer; class DefaultContent : StyledTextContent { +version(TANGOSVN) + private final static String LineDelimiter = tango.io.model.IFile.FileConst.NewlineString; +} +else{ private final static String LineDelimiter = tango.io.FileConst.FileConst.NewlineString; +} StyledTextListener[] textListeners; // stores text listeners for event sending char[] textStore; // stores the actual text @@ -734,7 +744,7 @@ * <p> * * @param listener the listener which should no longer be notified - * + * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT when listener is null</li> * </ul>
--- a/dwt/custom/StyledText.d Sun Jul 06 15:35:58 2008 +0200 +++ b/dwt/custom/StyledText.d Sun Jul 06 15:36:48 2008 +0200 @@ -85,7 +85,12 @@ static import tango.text.Text; static import tango.text.Util; -static import tango.io.FileConst; +version(TANGOSVN) + static import tango.io.model.IFile; +} +else{ + static import tango.io.FileConst; +} static import tango.text.convert.Utf; import tango.util.Convert; import dwt.dwthelper.utils; @@ -152,7 +157,12 @@ alias Canvas.computeSize computeSize; static const char TAB = '\t'; +version(TANGOSVN){ + static const String PlatformLineDelimiter = tango.io.model.IFile.FileConst.NewlineString; +} +else { static const String PlatformLineDelimiter = tango.io.FileConst.FileConst.NewlineString; +} static const int BIDI_CARET_WIDTH = 3; static const int DEFAULT_WIDTH = 64; static const int DEFAULT_HEIGHT = 64; @@ -3824,7 +3834,7 @@ * It means this function can be used to retrieve the bottom pixel of any line. * * @return the top pixel of a given line index - * + * * @since 3.2 */ public int getLinePixel(int lineIndex) { @@ -3851,9 +3861,9 @@ /** * Returns the line index for a y, relative to the client area. * The line index returned is always in the range 0..lineCount - 1. - * + * * @param y the y-coordinate pixel - * + * * @return the line index for a given y-coordinate pixel * * @since 3.2 @@ -6032,7 +6042,10 @@ */ public void paste(){ checkWidget(); - String text = (cast(ArrayWrapperString) getClipboardContent(DND.CLIPBOARD)).array; + String text = null; + if( auto o = cast(ArrayWrapperString) getClipboardContent(DND.CLIPBOARD)){ + text = o.array; + } if (text !is null && text.length > 0) { Event event = new Event(); event.start = selection.x; @@ -6262,7 +6275,7 @@ * Removes the specified bidirectional segment listener. * * @param listener the listener which should no longer be notified - * + * * @exception DWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -6270,7 +6283,7 @@ * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT when listener is null</li> * </ul> - * + * * @since 2.0 */ public void removeBidiSegmentListener(BidiSegmentListener listener) { @@ -6300,7 +6313,7 @@ * Removes the specified line background listener. * * @param listener the listener which should no longer be notified - * + * * @exception DWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -6318,7 +6331,7 @@ * Removes the specified line style listener. * * @param listener the listener which should no longer be notified - * + * * @exception DWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -6336,7 +6349,7 @@ * Removes the specified modify listener. * * @param modifyListener the listener which should no longer be notified - * + * * @exception DWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -6354,7 +6367,7 @@ * Removes the specified listener. * * @param listener the listener which should no longer be notified - * + * * @exception DWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -6395,7 +6408,7 @@ * Removes the specified verify listener. * * @param verifyListener the listener which should no longer be notified - * + * * @exception DWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -6413,7 +6426,7 @@ * Removes the specified key verify listener. * * @param listener the listener which should no longer be notified - * + * * @exception DWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -6430,7 +6443,7 @@ * Removes the specified word movement listener. * * @param listener the listener which should no longer be notified - * + * * @exception DWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
--- a/dwt/custom/StyledTextRenderer.d Sun Jul 06 15:35:58 2008 +0200 +++ b/dwt/custom/StyledTextRenderer.d Sun Jul 06 15:36:48 2008 +0200 @@ -43,7 +43,6 @@ static import tango.text.Text; static import tango.text.Util; -static import tango.io.FileConst; static import tango.text.convert.Utf; import tango.util.Convert;