Changeset 229:5ff96efb6f4b

Show
Ignore:
Timestamp:
05/24/08 02:37:28 (3 months ago)
Author:
Frank Benoit <benoit@tionex.de>
branch:
default
Message:

Additions for forms

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • dwt/dwthelper/utils.d

    r228 r229  
    121121class Integer : ValueWrapperT!(int) { 
    122122 
    123     public static int MIN_VALUE = 0x80000000; 
    124     public static int MAX_VALUE = 0x7fffffff; 
    125     public static int SIZE = 32; 
     123    public static const int MIN_VALUE = 0x80000000; 
     124    public static const int MAX_VALUE = 0x7fffffff; 
     125    public static const int SIZE = 32; 
    126126 
    127127    public this ( int value ){ 
     
    594594    return tango.text.Unicode.toFold(src) < tango.text.Unicode.toFold(other); 
    595595} 
     596public int compareTo( String src, String other ){ 
     597    return src < other; 
     598} 
    596599 
    597600public bool startsWith( String src, String pattern ){ 
  • dwt/graphics/TextLayout.d

    r227 r229  
    1212 *******************************************************************************/ 
    1313module dwt.graphics.TextLayout; 
     14 
     15import tango.util.log.Trace; 
    1416 
    1517import dwt.DWT; 
     
    5860 
    5961/++ 
    60   DWT doku 
    61   The styles has at minimum 2 member, each with a start. The last element is the end marker. 
    62 ++/ 
    63  
    64     invariant{ 
    65         assert( stylesCount >= 2 ); 
    66         assert( stylesCount <= styles.length ); 
    67         assert( styles[stylesCount-1] ); 
    68         assert( styles[stylesCount-1].start is text.length ); 
    69     } 
     62 +  DWT doku 
     63 +  The styles has at minimum 2 member, each with a start. The last element is the end marker. 
     64 + 
     65 +  invariant{ 
     66 +      assert( stylesCount >= 2 ); 
     67 +      assert( stylesCount <= styles.length ); 
     68 +      assert( styles[stylesCount-1] ); 
     69 +      assert( styles[stylesCount-1].start is text.length ); 
     70 +  } 
     71 +/ 
     72 
    7073 
    7174    Font font; 
     
    22612264    int pcItems; 
    22622265    wchar[] chars = StrToWCHARs( segmentsText ); 
     2266    Trace.formatln( "{} {}: segmentsText='{}' chars='{}'", __FILE__,__LINE__, segmentsText, chars ); 
    22632267    OS.ScriptItemize(chars.ptr, chars.length, MAX_ITEM, &scriptControl, &scriptState, pItems, &pcItems); 
    22642268//  if (hr is E_OUTOFMEMORY) //TODO handle it 
     2269 
     2270    // Translate the utf16 indices to utf8 indices 
     2271    Trace.formatln( "{} {}: pcItems={} chars.length={} segmentsText.length={}", __FILE__,__LINE__,pcItems, chars.length, segmentsText.length ); 
     2272    int utf8idx = 0; 
     2273    SCRIPT_ITEM* si = pItems; 
     2274    foreach( uint utf16idx, char c; chars ){ 
     2275        Trace.formatln( "{} {}: utf8idx={} utf16idx={} si.iCharPos={}", __FILE__,__LINE__,utf8idx, utf16idx, si.iCharPos ); 
     2276        if( si.iCharPos is utf16idx ){ 
     2277            si.iCharPos = utf8idx; 
     2278            si++; 
     2279        } 
     2280        utf8idx++; 
     2281    } 
    22652282 
    22662283    StyleItem[] runs = merge(pItems, pcItems); 
     
    22792296    } 
    22802297    int count = 0, start = 0, end = segmentsText.length, itemIndex = 0, styleIndex = 0; 
     2298Trace.formatln( "{} {}: itemCount={} stylesCount={}", __FILE__,__LINE__,itemCount, stylesCount ); 
    22812299    StyleItem[] runs = new StyleItem[itemCount + stylesCount]; 
    22822300    SCRIPT_ITEM* scriptItem = new SCRIPT_ITEM(); 
    22832301    bool linkBefore = false; 
     2302Trace.formatln( "{} {}: start={} end={}", __FILE__,__LINE__,start, end ); 
    22842303    while (start < end) { 
    22852304        StyleItem item = new StyleItem(); 
    22862305        item.start = start; 
    22872306        item.style = styles[styleIndex].style; 
     2307Trace.formatln( "{} {}: count={}", __FILE__,__LINE__,count ); 
    22882308        runs[count++] = item; 
    22892309        OS.MoveMemory(scriptItem, (cast(void*)items) + itemIndex * SCRIPT_ITEM.sizeof, SCRIPT_ITEM.sizeof); 
     
    23142334        } 
    23152335        item.length = start - item.start; 
     2336Trace.formatln( "{} {}: start={} end={}", __FILE__,__LINE__,start, end ); 
    23162337    } 
    23172338    StyleItem item = new StyleItem(); 
     
    23192340    OS.MoveMemory(scriptItem, (cast(void*)items) + itemCount * SCRIPT_ITEM.sizeof, SCRIPT_ITEM.sizeof); 
    23202341    item.analysis = scriptItem.a; 
     2342Trace.formatln( "{} {}: count={}", __FILE__,__LINE__,count ); 
    23212343    runs[count++] = item; 
    23222344    if (runs.length !is count) { 
     
    27222744public void setText (String text) { 
    27232745    checkLayout(); 
     2746 
    27242747    //PORTING_CHANGE: allow null argument 
    27252748    //if (text is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 
     
    27322755    styles[1].start = text.length; 
    27332756    stylesCount = 2; 
     2757Trace.formatln( "{} {}: text='{}'", __FILE__,__LINE__, text ); 
    27342758} 
    27352759