comparison dwt/custom/StyledTextRenderer.d @ 212:ab60f3309436

reverted the char[] to String and use the an alias.
author Frank Benoit <benoit@tionex.de>
date Mon, 05 May 2008 00:12:38 +0200
parents a5afe31f5cdd
children 36f5cb12e1a2
comparison
equal deleted inserted replaced
211:ff59aeb96cac 212:ab60f3309436
357 gc.fillArc(x, paintY + size, size + 1, size + 1, 0, 360); 357 gc.fillArc(x, paintY + size, size + 1, size + 1, 0, 360);
358 return; 358 return;
359 } 359 }
360 Font font = style.font; 360 Font font = style.font;
361 if (font !is null) gc.setFont(font); 361 if (font !is null) gc.setFont(font);
362 char[] string = ""; 362 String string = "";
363 int type = bullet.type & (ST.BULLET_DOT|ST.BULLET_NUMBER|ST.BULLET_LETTER_LOWER|ST.BULLET_LETTER_UPPER); 363 int type = bullet.type & (ST.BULLET_DOT|ST.BULLET_NUMBER|ST.BULLET_LETTER_LOWER|ST.BULLET_LETTER_UPPER);
364 switch (type) { 364 switch (type) {
365 case ST.BULLET_DOT: string = "\u2022"; break; 365 case ST.BULLET_DOT: string = "\u2022"; break;
366 case ST.BULLET_NUMBER: string = to!(char[])(index); break; 366 case ST.BULLET_NUMBER: string = to!(String)(index); break;
367 case ST.BULLET_LETTER_LOWER: string = [cast(char) (index % 26 + 97)]; break; 367 case ST.BULLET_LETTER_LOWER: string = [cast(char) (index % 26 + 97)]; break;
368 case ST.BULLET_LETTER_UPPER: string = [cast(char) (index % 26 + 65)]; break; 368 case ST.BULLET_LETTER_UPPER: string = [cast(char) (index % 26 + 65)]; break;
369 default: 369 default:
370 } 370 }
371 if ((bullet.type & ST.BULLET_TEXT) !is 0) string ~= bullet.text; 371 if ((bullet.type & ST.BULLET_TEXT) !is 0) string ~= bullet.text;
382 layout.draw(gc, x, paintY); 382 layout.draw(gc, x, paintY);
383 layout.dispose(); 383 layout.dispose();
384 } 384 }
385 int drawLine(int lineIndex, int paintX, int paintY, GC gc, Color widgetBackground, Color widgetForeground) { 385 int drawLine(int lineIndex, int paintX, int paintY, GC gc, Color widgetBackground, Color widgetForeground) {
386 TextLayout layout = getTextLayout(lineIndex); 386 TextLayout layout = getTextLayout(lineIndex);
387 char[] line = content.getLine(lineIndex); 387 String line = content.getLine(lineIndex);
388 int lineOffset = content.getOffsetAtLine(lineIndex); 388 int lineOffset = content.getOffsetAtLine(lineIndex);
389 int lineLength = line.length; 389 int lineLength = line.length;
390 Point selection = styledText.getSelection(); 390 Point selection = styledText.getSelection();
391 int selectionStart = selection.x - lineOffset; 391 int selectionStart = selection.x - lineOffset;
392 int selectionEnd = selection.y - lineOffset; 392 int selectionEnd = selection.y - lineOffset;
729 } 729 }
730 } 730 }
731 } 731 }
732 } 732 }
733 if (layout is null) layout = new TextLayout(device); 733 if (layout is null) layout = new TextLayout(device);
734 char[] line = content.getLine(lineIndex); 734 String line = content.getLine(lineIndex);
735 int lineOffset = content.getOffsetAtLine(lineIndex); 735 int lineOffset = content.getOffsetAtLine(lineIndex);
736 int[] segments = null; 736 int[] segments = null;
737 int indent = 0; 737 int indent = 0;
738 int alignment = DWT.LEFT; 738 int alignment = DWT.LEFT;
739 bool justify = false; 739 bool justify = false;