# HG changeset patch # User Frank Benoit # Date 1200955965 -3600 # Node ID c3880d67f906e3a3d10d61ad615bd8d12d4837fa # Parent 35300367f4d4c622bff6c26c869838a29f7b9508 more tabs diff -r 35300367f4d4 -r c3880d67f906 dwt/accessibility/AccessibleFactory.d --- a/dwt/accessibility/AccessibleFactory.d Mon Jan 21 22:25:26 2008 +0100 +++ b/dwt/accessibility/AccessibleFactory.d Mon Jan 21 23:52:45 2008 +0100 @@ -307,8 +307,7 @@ static void unregisterAccessible (Accessible accessible) { auto controlHandle = accessible.getControlHandle (); auto widgetType = OS.G_OBJECT_TYPE (cast(GTypeInstance*)controlHandle); - AccessibleFactory factory = Factories[widgetType]; - if (factory !is null) { + if ( auto factory = widgetType in Factories ) { factory.removeAccessible (accessible); } } diff -r 35300367f4d4 -r c3880d67f906 dwt/graphics/TextLayout.d --- a/dwt/graphics/TextLayout.d Mon Jan 21 22:25:26 2008 +0100 +++ b/dwt/graphics/TextLayout.d Mon Jan 21 23:52:45 2008 +0100 @@ -119,18 +119,18 @@ if (attrList !is null) return; char[] segmentsText = getSegmentsText(); OS.pango_layout_set_text (layout, toStringz(segmentsText), segmentsText.length); - if (styles.length == 2 && styles[0].style == null && ascent == -1 && descent == -1 && segments == null) return; + if (styles.length is 2 && styles[0].style is null && ascent is -1 && descent is -1 && segments is null) return; auto ptr = OS.pango_layout_get_text(layout); attrList = OS.pango_attr_list_new(); //PangoAttribute* attribute = new PangoAttribute(); wchar[] charsW = null; wchar[] segmentsTextW = toString16( segmentsText ); int segementsWLength = segmentsTextW.length; - if ((ascent != -1 || descent != -1) && segementsWLength > 0) { + if ((ascent !is -1 || descent !is -1) && segementsWLength > 0) { auto iter = OS.pango_layout_get_iter(layout); if (iter is null) DWT.error(DWT.ERROR_NO_HANDLES); PangoRectangle* rect = new PangoRectangle(); - if (ascent != -1) rect.y = -(ascent * OS.PANGO_SCALE); + if (ascent !is -1) rect.y = -(ascent * OS.PANGO_SCALE); rect.height = (Math.max(0, ascent) + Math.max(0, descent)) * OS.PANGO_SCALE; int lineCount = OS.pango_layout_get_line_count(layout); charsW = new wchar[segementsWLength + lineCount * 2]; @@ -169,7 +169,7 @@ int offsetCount = 0; for (int i = 0; i < charsW.length; i++) { wchar c = charsW[i]; - if (c == LTR_MARK || c == RTL_MARK || c == ZWNBS || c == ZWS) { + if (c is LTR_MARK || c is RTL_MARK || c is ZWNBS || c is ZWS) { offsetCount++; } } @@ -177,7 +177,7 @@ offsetCount = 0; for (int i = 0; i < charsW.length; i++) { wchar c = charsW[i]; - if (c == LTR_MARK || c == RTL_MARK || c == ZWNBS || c == ZWS) { + if (c is LTR_MARK || c is RTL_MARK || c is ZWNBS || c is ZWS) { invalidOffsets[offsetCount++] = i; } } @@ -185,7 +185,7 @@ for (int i = 0; i < styles.length - 1; i++) { StyleItem styleItem = styles[i]; TextStyle style = styleItem.style; - if (style == null) continue; + if (style is null) continue; int start = translateOffset(styleItem.start); int end = translateOffset(styles[i+1].start - 1); int byteStart = (OS.g_utf8_offset_to_pointer(ptr, start) - ptr); @@ -193,7 +193,7 @@ byteStart = Math.min(byteStart, slen); byteEnd = Math.min(byteEnd, slen); Font font = style.font; - if (font != null && !font.isDisposed()) { + if (font !is null && !font.isDisposed()) { auto attr = OS.pango_attr_font_desc_new (font.handle); attr.start_index = byteStart; attr.end_index = byteEnd; @@ -212,7 +212,7 @@ OS.pango_attr_list_insert(attrList, attr); } Color foreground = style.foreground; - if (foreground != null && !foreground.isDisposed()) { + if (foreground !is null && !foreground.isDisposed()) { GdkColor* fg = foreground.handle; auto attr = OS.pango_attr_foreground_new(fg.red, fg.green, fg.blue); attr.start_index = byteStart; @@ -220,7 +220,7 @@ OS.pango_attr_list_insert(attrList, attr); } Color background = style.background; - if (background != null && !background.isDisposed()) { + if (background !is null && !background.isDisposed()) { GdkColor* bg = background.handle; auto attr = OS.pango_attr_background_new(bg.red, bg.green, bg.blue); attr.start_index = byteStart; @@ -228,7 +228,7 @@ OS.pango_attr_list_insert(attrList, attr); } GlyphMetrics metrics = style.metrics; - if (metrics != null) { + if (metrics !is null) { PangoRectangle* rect = new PangoRectangle(); rect.y = -(metrics.ascent * OS.PANGO_SCALE); rect.height = (metrics.ascent + metrics.descent) * OS.PANGO_SCALE; @@ -239,7 +239,7 @@ OS.pango_attr_list_insert(attrList, attr); } int rise = style.rise; - if (rise != 0) { + if (rise !is 0) { auto attr = OS.pango_attr_rise_new (rise * OS.PANGO_SCALE); attr.start_index = byteStart; attr.end_index = byteEnd; @@ -345,10 +345,10 @@ if (selectionBackground !is null && selectionBackground.isDisposed()) DWT.error(DWT.ERROR_INVALID_ARGUMENT); gc.checkGC(GC.FOREGROUND); int length = text.length; - bool hasSelection = selectionStart <= selectionEnd && selectionStart != -1 && selectionEnd != -1; + bool hasSelection = selectionStart <= selectionEnd && selectionStart !is -1 && selectionEnd !is -1; GCData data = gc.data; auto cairo = data.cairo; - if (flags != 0 && (hasSelection || (flags & DWT.LAST_LINE_SELECTION) != 0)) { + if (flags !is 0 && (hasSelection || (flags & DWT.LAST_LINE_SELECTION) !is 0)) { PangoLogAttr* attrs; int nAttrs; PangoLogAttr* logAttr = new PangoLogAttr(); @@ -356,7 +356,7 @@ int lineCount = OS.pango_layout_get_line_count(layout); auto ptr = OS.pango_layout_get_text(layout); auto iter = OS.pango_layout_get_iter(layout); - if (selectionBackground == null) selectionBackground = device.getSystemColor(DWT.COLOR_LIST_SELECTION); + if (selectionBackground is null) selectionBackground = device.getSystemColor(DWT.COLOR_LIST_SELECTION); if (cairo !is null && OS.GTK_VERSION >= OS.buildVERSION(2, 8, 0)) { Cairo.cairo_save(cairo); GdkColor* color = selectionBackground.handle; @@ -375,7 +375,7 @@ lineEnd = OS.g_utf8_strlen(ptr, -1); } bool extent = false; - if (lineIndex == lineCount - 1 && (flags & DWT.LAST_LINE_SELECTION) != 0) { + if (lineIndex is lineCount - 1 && (flags & DWT.LAST_LINE_SELECTION) !is 0) { extent = true; } else { if (attrs is null) OS.pango_layout_get_log_attrs(layout, &attrs, &nAttrs); @@ -383,7 +383,7 @@ if (!( logAttr.bitfield0 & 0x01 /* PangoLogAttr.is_line_break is Bit0 */)) { if (selectionStart <= lineEnd && lineEnd <= selectionEnd) extent = true; } else { - if (selectionStart <= lineEnd && lineEnd < selectionEnd && (flags & DWT.FULL_SELECTION) != 0) { + if (selectionStart <= lineEnd && lineEnd < selectionEnd && (flags & DWT.FULL_SELECTION) !is 0) { extent = true; } } @@ -392,10 +392,10 @@ int lineX = x + OS.PANGO_PIXELS(rect.x) + OS.PANGO_PIXELS(rect.width); int lineY = y + OS.PANGO_PIXELS(rect.y); int height = OS.PANGO_PIXELS(rect.height); - if (ascent != -1 && descent != -1) { + if (ascent !is -1 && descent !is -1) { height = Math.max (height, ascent + descent); } - int width = (flags & DWT.FULL_SELECTION) != 0 ? 0x7fffffff : height / 3; + int width = (flags & DWT.FULL_SELECTION) !is 0 ? 0x7fffffff : height / 3; if (cairo !is null && OS.GTK_VERSION >= OS.buildVERSION(2, 8, 0)) { Cairo.cairo_rectangle(cairo, lineX, lineY, width, height); Cairo.cairo_fill(cairo); @@ -413,7 +413,7 @@ OS.gdk_gc_set_foreground(gc.handle, data.foreground); } } - if (length == 0) return; + if (length is 0) return; if (!hasSelection) { if (cairo !is null && OS.GTK_VERSION >= OS.buildVERSION(2, 8, 0)) { Cairo.cairo_move_to(cairo, x, y); @@ -427,9 +427,9 @@ length = OS.g_utf8_strlen(OS.pango_layout_get_text(layout), -1); selectionStart = translateOffset(selectionStart); selectionEnd = translateOffset(selectionEnd); - if (selectionForeground == null) selectionForeground = device.getSystemColor(DWT.COLOR_LIST_SELECTION_TEXT); - if (selectionBackground == null) selectionBackground = device.getSystemColor(DWT.COLOR_LIST_SELECTION); - bool fullSelection = selectionStart == 0 && selectionEnd == length - 1; + if (selectionForeground is null) selectionForeground = device.getSystemColor(DWT.COLOR_LIST_SELECTION_TEXT); + if (selectionBackground is null) selectionBackground = device.getSystemColor(DWT.COLOR_LIST_SELECTION); + bool fullSelection = selectionStart is 0 && selectionEnd is length - 1; if (fullSelection) { if (cairo !is null && OS.GTK_VERSION >= OS.buildVERSION(2, 8, 0)) { auto ptr = OS.pango_layout_get_text(layout); @@ -549,9 +549,9 @@ int w, h; OS.pango_layout_get_size(layout, &w, &h); int wrapWidth = OS.pango_layout_get_width(layout); - int width = OS.PANGO_PIXELS(wrapWidth != -1 ? wrapWidth : w); + int width = OS.PANGO_PIXELS(wrapWidth !is -1 ? wrapWidth : w); int height = OS.PANGO_PIXELS(h); - if (ascent != -1 && descent != -1) { + if (ascent !is -1 && descent !is -1) { height = Math.max (height, ascent + descent); } return new Rectangle(0, 0, width, height); @@ -575,7 +575,7 @@ checkLayout(); computeRuns(); int length = text.length; - if (length == 0) return new Rectangle(0, 0, 0, 0); + if (length is 0) return new Rectangle(0, 0, 0, 0); if (start > end) return new Rectangle(0, 0, 0, 0); start = Math.min(Math.max(0, start), length - 1); end = Math.min(Math.max(0, end), length - 1); @@ -764,7 +764,7 @@ int y = OS.PANGO_PIXELS(rect.y); int width = OS.PANGO_PIXELS(rect.width); int height = OS.PANGO_PIXELS(rect.height); - if (ascent != -1 && descent != -1) { + if (ascent !is -1 && descent !is -1) { height = Math.max (height, ascent + descent); } return new Rectangle(x, y, width, height); @@ -843,7 +843,7 @@ PangoLayoutLine* line = new PangoLayoutLine(); memmove(line, OS.pango_layout_get_line(layout, lineIndex), PangoLayoutLine.sizeof); if (line.runs is null) { - auto font = this.font != null ? this.font.handle : device.systemFont.handle; + auto font = this.font !is null ? this.font.handle : device.systemFont.handle; auto lang = OS.pango_context_get_language(context); auto metrics = OS.pango_context_get_metrics(context, font, lang); ascent = OS.pango_font_metrics_get_ascent(metrics); @@ -952,12 +952,12 @@ int length = text.length; if (!(0 <= offset && offset <= length)) DWT.error(DWT.ERROR_INVALID_RANGE); if (forward) { - if (offset == length) return length; + if (offset is length) return length; } else { - if (offset == 0) return 0; + if (offset is 0) return 0; } int step = forward ? 1 : -1; - if ((movement & DWT.MOVEMENT_CHAR) != 0) return offset + step; + if ((movement & DWT.MOVEMENT_CHAR) !is 0) return offset + step; PangoLogAttr* attrs; int nAttrs; OS.pango_layout_get_log_attrs(layout, &attrs, &nAttrs); @@ -968,18 +968,18 @@ offset = validateOffset(offset, step); while (0 < offset && offset < length) { *logAttr = attrs[ offset ]; - if (((movement & DWT.MOVEMENT_CLUSTER) != 0) && ( logAttr.bitfield0 & (1<<4/*is_cursor_position*/))) break; - if ((movement & DWT.MOVEMENT_WORD) != 0) { + if (((movement & DWT.MOVEMENT_CLUSTER) !is 0) && ( logAttr.bitfield0 & (1<<4/*is_cursor_position*/))) break; + if ((movement & DWT.MOVEMENT_WORD) !is 0) { if (forward) { if (logAttr.bitfield0 & (1<<6/*is_word_end*/)) break; } else { if (logAttr.bitfield0 & (1<<5/*is_word_start*/)) break; } } - if ((movement & DWT.MOVEMENT_WORD_START) != 0) { + if ((movement & DWT.MOVEMENT_WORD_START) !is 0) { if (logAttr.bitfield0 & (1<<5/*is_word_start*/)) break; } - if ((movement & DWT.MOVEMENT_WORD_END) != 0) { + if ((movement & DWT.MOVEMENT_WORD_END) !is 0) { if (logAttr.bitfield0 & (1<<6/*is_word_end*/)) break; } offset = validateOffset(offset, step); @@ -1013,7 +1013,7 @@ */ public int getOffset(Point point, int[] trailing) { checkLayout(); - if (point == null) DWT.error(DWT.ERROR_NULL_ARGUMENT); + if (point is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); return getOffset(point.x, point.y, trailing); } @@ -1043,7 +1043,7 @@ public int getOffset(int x, int y, int[] trailing) { checkLayout(); computeRuns(); - if (trailing != null && trailing.length < 1) DWT.error(DWT.ERROR_INVALID_ARGUMENT); + if (trailing !is null && trailing.length < 1) DWT.error(DWT.ERROR_INVALID_ARGUMENT); /* * Feature in GTK. pango_layout_xy_to_index() returns the @@ -1090,7 +1090,7 @@ public int getOrientation() { checkLayout(); int baseDir = OS.pango_context_get_base_dir(context); - return baseDir == OS.PANGO_DIRECTION_RTL ? DWT.RIGHT_TO_LEFT : DWT.LEFT_TO_RIGHT; + return baseDir is OS.PANGO_DIRECTION_RTL ? DWT.RIGHT_TO_LEFT : DWT.LEFT_TO_RIGHT; } /** @@ -1135,12 +1135,12 @@ int[] result = new int[styles.length * 2]; int count = 0; for (int i=0; i end) return; start = Math.min(Math.max(0, start), length - 1); end = Math.min(Math.max(0, end), length - 1); @@ -1587,11 +1587,11 @@ } if (0 <= high && high < styles.length) { StyleItem item = styles[high]; - if (item.start is start && styles[high + 1].start - 1 == end) { + if (item.start is start && styles[high + 1].start - 1 is end) { if (style is null) { if (item.style is null) return; } else { - if (style==item.style) return; + if (style ==/*eq*/ item.style) return; } } } @@ -1652,18 +1652,18 @@ */ public void setTabs(int[] tabs) { checkLayout(); - if (this.tabs == null && tabs == null) return; - if (this.tabs!= null && tabs != null) { - if (this.tabs.length == tabs.length) { + if (this.tabs is null && tabs is null) return; + if (this.tabs!is null && tabs !is null) { + if (this.tabs.length is tabs.length) { int i; for (i = 0; i