Changeset 33

Show
Ignore:
Timestamp:
03/19/08 10:10:08 (9 months ago)
Author:
kaarna
Message:

Updated to GDC trunk (0.25ish).RTree doesn't segfault anymore.Almost works.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/pihlaja/src/dsss.conf

    r30 r33  
    3333    buildflags += -debug=Widget 
    3434    buildflags += -debug=Window 
     35    buildflags += -debug=RTree 
    3536    #buildflags += -debug=Animator 
    3637    #buildflags += -debug=Window 
  • trunk/pihlaja/src/helpers/gdkkeysyms.d

    r26 r33  
    11/* Converted to D from ./gdkkeysyms.h by htod */ 
    2 module gdkkeysyms; 
     2module helpers.gdkkeysyms; 
    33//module gdk.Keysyms; 
    44/* GDK - The GIMP Drawing Kit 
  • trunk/pihlaja/src/lqt/colormodels.d

    r26 r33  
    11/* Converted to D from colormodels.h by htod */ 
    2 module colormodels; 
     2module lqt.colormodels; 
    33/******************************************************************************* 
    44 colormodels.h 
  • trunk/pihlaja/src/pihlaja/PihlajaMain.d

    r31 r33  
    771771    } 
    772772     
    773     void mouseHandler( InputState input, Widget wid ) 
     773    void mouseHandler( InputState input, Rectangle wid ) 
    774774    { 
    775775        switch( input.eventType ) 
     
    797797     
    798798     
    799     void rotateAnimatorHandler( InputState input, Widget wid ) 
     799    void rotateAnimatorHandler( InputState input, Rectangle wid ) 
    800800    { 
    801801        //Trace.formatln("mouseHandler."); 
     
    818818    } 
    819819     
    820     void clickHandler3( InputState input, Widget wid  ) 
     820    void clickHandler3( InputState input, Rectangle wid  ) 
    821821    { 
    822822        Trace.formatln("You clicked me {}.", wid.name); 
    823823    } 
    824824     
    825     void exportButtonHandler( InputState input, Widget wid ) 
     825    void exportButtonHandler( InputState input, Rectangle wid ) 
    826826    { 
    827827        Trace.formatln("You clicked the exportButton."); 
     
    933933    } 
    934934     
    935     void playHandler( InputState input, Widget wid ) 
     935    void playHandler( InputState input, Rectangle wid ) 
    936936    { 
    937937        static bool clickcol = false; 
     
    952952    } 
    953953     
    954     void clickHandler( InputState input, Widget wid ) 
     954    void clickHandler( InputState input, Rectangle wid ) 
    955955    { 
    956956        //Trace.formatln("VideoViewer.clickHandler() START!"); 
  • trunk/pihlaja/src/shiraz/av/AudioFileQT.d

    r27 r33  
    2222 */ 
    2323 
    24 module shiraz.av.IAudioFileQT; 
     24module shiraz.av.AudioFileQT; 
    2525 
    2626debug(logging) import tango.util.log.Trace;//Thread safe console output. 
  • trunk/pihlaja/src/shiraz/av/PortAudioPlaybackCore.d

    r27 r33  
    220220    return true; 
    221221error: 
    222     //New Tango: Trace.formatln("Soundoutput failed: ")( stringz.fromStringz(Pa_GetErrorText( err )) ); 
     222    //New Tango:  
     223    Trace.formatln("Soundoutput failed: {}", stringz.fromStringz(Pa_GetErrorText( err )) ); 
    223224    //Old Tango: 
    224     Trace.formatln("Soundoutput failed: {}", stringz.fromUtf8z(Pa_GetErrorText( err )) ); 
     225    //Trace.formatln("Soundoutput failed: {}", stringz.fromUtf8z(Pa_GetErrorText( err )) ); 
    225226    return false; 
    226227} 
     
    243244     
    244245error: 
    245     //New Tango: Trace.formatln("Portaudio Error: ")( stringz.fromStringz(Pa_GetErrorText( err )) ); 
     246    //New Tango:  
     247    Trace.formatln("Portaudio Error: {}", stringz.fromStringz(Pa_GetErrorText( err )) ); 
    246248    //Old Tango: 
    247     Trace.formatln("Portaudio Error: {}", stringz.fromUtf8z(Pa_GetErrorText( err )) ); 
     249    //Trace.formatln("Portaudio Error: {}", stringz.fromUtf8z(Pa_GetErrorText( err )) ); 
    248250    return false; 
    249251} 
  • trunk/pihlaja/src/shiraz/canvas/ICanvasItem.d

    r31 r33  
    1919module shiraz.canvas.ICanvasItem; 
    2020 
     21//Circular import/LinkSeq/GDC bug is the reason 
     22//for this insanity. ICanvasItem and stuff is all 
     23//in Rectangle until that bug is fixed in GDC. 
     24 
     25 
     26 
     27/+ 
     28 
    2129debug(logging) import tango.util.log.Trace;//Thread safe console output. 
     30 
     31import tango.util.collection.LinkSeq; 
    2232 
    2333import shiraz.ui.Animator; 
    2434import shiraz.canvas.Point; 
    25 import shiraz.canvas.rtree.Node; 
     35//import shiraz.canvas.rtree.Node; 
     36import shiraz.canvas.rtree.RTree; 
     37import shiraz.ui.InputState; 
     38 
     39 
     40 
    2641 
    2742/* 
     
    169184 
    170185    void adjustTree(); 
     186     
     187    LinkSeq!(ICanvasItem) enclosureList( double tx, double ty, inout LinkSeq!(ICanvasItem) hit_items = null ); 
     188    LinkSeq!(ICanvasItem) enclosureList( double tx, double ty, double tw, double th, inout LinkSeq!(ICanvasItem) hit_items = null ); 
     189    bool mouseEvent( InputState input, bool bypass_hittest = false ); 
    171190 
    172191//END HyperCube compatibility stuff for RTree: 
    173192//******************************************* 
    174193 
     194    char[] name(); 
     195    char[] name(char[] set); 
     196 
     197    bool isSelected(); 
     198    bool isSelected(bool set); 
     199 
     200    char[] toString(); 
    175201     
    176202    //Returns a newly allocated copy of this object. 
     
    261287     
    262288    void add( Animator set_anim ); 
     289     
     290    //LinkSeq!(ICanvasItem) enclosureList( double tx, double ty, double tw, double th, inout LinkSeq!(ICanvasItem) hit_items = null ); 
    263291} 
    264292 
     293+/ 
     294 
     295 
  • trunk/pihlaja/src/shiraz/canvas/Rectangle.d

    r31 r33  
    2222import Float = tango.text.convert.Float; 
    2323 
     24import tango.core.Signal; 
     25import tango.util.collection.LinkSeq; 
    2426 
    2527version(sdl) 
     
    3840 
    3941import shiraz.canvas.ICanvasItem; 
     42import shiraz.canvas.PlainRectangle; 
    4043import shiraz.canvas.Image; 
     44import shiraz.canvas.Bezier; 
    4145import shiraz.ui.Animator; 
     46import shiraz.ui.InputState; 
    4247import shiraz.canvas.Point; 
    43 import shiraz.canvas.rtree.Node; 
    44 import shiraz.canvas.rtree.AbstractNode; 
    45 import shiraz.canvas.rtree.Index; 
     48import shiraz.canvas.rtree.RTree; 
     49//import shiraz.canvas.rtree.Node; 
     50//import shiraz.canvas.rtree.AbstractNode; 
     51//import shiraz.canvas.rtree.Index; 
     52 
     53/* 
     54    There propably should be two versions of 
     55    Rectangles. PlainRectangle or just Rectangle 
     56    and RRectangle or RTreeRect or RTreeRectangle or 
     57    TreeRectangle. The following is specific to 
     58    RTreeRectangle and should go just there. 
     59    */ 
     60 
     61//I've decided that Widget's should be versatile containers 
     62//so that you can use any widget as a vbox or any other layout 
     63//you want and add child widget's to any other widget. 
     64 
     65enum DefaultAnimator 
     66
     67    ROTATE_180, 
     68    ROTATE_360 
     69
     70 
     71enum ArrangeType 
     72
     73    VBOX, 
     74    HBOX, 
     75    GRID, 
     76    FREE 
     77
     78 
     79/* 
     80//What about anchor points? 
     81enum Anchor 
     82
     83    CENTER, 
     84    TOP, 
     85    BOTTOM, 
     86    LEFT, 
     87    RIGHT, 
     88    TOP_LEFT, 
     89    TOP_RIGHT, 
     90    BOTTOM_LEFT, 
     91    BOTTOM_RIGHT, 
     92    CUSTOM_POINT //And a customAnchorX customAnchorY... 
     93
     94*/ 
     95 
     96//Packing options for adding child widgets to a Widget 
     97enum PackOptions 
     98
     99    SHRINK, //Space is contracted to the child widget size. 
     100    EXPAND_PADDING, //Space is expanded, with extra space filled with padding. 
     101    EXPAND //Space is expanded, with extra space filled by increasing the child widget size. 
     102
     103 
     104 
     105//---------------------------------------------------- 
     106//Circular import/LinkSeq/GDC bug is the reason 
     107//for this insanity. ICanvasItem and stuff is all 
     108//here until that bug is fixed in GDC. 
     109 
     110/* 
     111 
     112 
     113x1-y1                   w-x2-y 
     114------------------------- 
     115|                       | 
     116|                       | 
     117|                       | 
     118|                       | 
     119|                       | 
     120|           +           | 
     121|          cx,cy        | 
     122|                       | 
     123|                       | 
     124|                       | 
     125|                       | 
     126------------------------- 
     127h-x-y2                  w-x2-y2 
     128 
     129w =  
     130h =  
     131 
     132*/ 
     133 
     134interface ICanvasItem 
     135
     136public: 
     137     
     138    //**************************************** 
     139//HyperCube compatibility stuff for RTree: 
     140 
     141 
     142    /*this(Point p1, Point p2) 
     143    { 
     144        super(); 
     145 
     146        if (p1 is null || p2 is null) throw new IllegalArgumentException("Rectangle.this(p1, p2) Error: Points cannot be null."); 
     147 
     148        if (p1.getDimension() != p2.getDimension()) throw new IllegalArgumentException("Rectangle.this(p1, p2) Error: Points must be of the same dimension."); 
     149 
     150        for (int i = 0; i < p1.getDimension(); i++) 
     151        { 
     152            if (p1.getFloatCoordinate(i) > p2.getFloatCoordinate(i)) throw new IllegalArgumentException("Rectangle.this(p1, p2) Error: Give lower left corner first and upper right corner afterwards."); 
     153        } 
     154 
     155        //this.p1 = cast(Point) p1.clone(); 
     156        //this.p2 = cast(Point) p2.clone(); 
     157 
     158        setAlt( p1.x, p1.y, p2.x, p2.y ); 
     159 
     160    }*/ 
     161 
     162    int getDimension(); 
     163 
     164    //This is just stupid, but this is for HyperCube and RTree compatibility. 
     165    //It should be changed. 
     166    protected Point p1(); 
     167    protected Point p2(); 
     168 
     169    Point getP1(); 
     170    Point getP2(); 
     171    bool equals(ICanvasItem h); 
     172 
     173    /** 
     174    * Tests to see whether <B>h</B> has any common points with this Rectangle. If <B>h</B> is inside this 
     175    * object (or vice versa), it returns true. 
     176    * 
     177    * @return True if <B>h</B> and this Rectangle intersect, false otherwise. 
     178    */ 
     179    bool intersection(ICanvasItem h); 
     180 
     181    /** 
     182    * Tests to see whether <B>h</B> is inside this Rectangle. If <B>h</B> is exactly the same shape 
     183    * as this object, it is considered to be inside. 
     184    * 
     185    * @return True if <B>h</B> is inside, false otherwise. 
     186    */ 
     187    bool enclosure(ICanvasItem h); 
     188 
     189    /** 
     190    * Tests to see whether <B>p</B> is inside this Rectangle. If <B>p</B> lies on the boundary 
     191    * of the Rectangle, it is considered to be inside the object. 
     192    * 
     193    * @return True if <B>p</B> is inside, false otherwise. 
     194    */ 
     195    bool enclosure(Point p); 
     196 
     197    /** 
     198    * Returns the area of the intersecting region between this Rectangle and the argument. 
     199    * 
     200    * Below, all possible situations are depicted. 
     201    * 
     202    *     -------   -------      ---------   ---------      ------         ------ 
     203    *    |2      | |2      |    |2        | |1        |    |2     |       |1     | 
     204    *  --|--     | |     --|--  | ------  | | ------  |  --|------|--   --|------|-- 
     205    * |1 |  |    | |    |1 |  | ||1     | | ||2     | | |1 |      |  | |2 |      |  | 
     206    *  --|--     | |     --|--  | ------  | | ------  |  --|------|--   --|------|-- 
     207    *     -------   -------      ---------   ---------      ------         ------ 
     208    * 
     209    * @param h Given Rectangle. 
     210    * @return Area of intersecting region. 
     211    */ 
     212    float intersectingArea(ICanvasItem h); 
     213 
     214    /** 
     215    * Static impementation. Takes an array of Rectangles and calculates the mbb of their 
     216    * union. 
     217    * 
     218    * @param  a The array of Rectangles. 
     219    * @return The mbb of their union. 
     220    */ 
     221    static ICanvasItem getUnionMbb(ICanvasItem[] a); 
     222 
     223    /** 
     224    * Return a new Rectangle representing the mbb of the union of this Rectangle and <B>h</B> 
     225    * 
     226    * @param  h The Rectangle that we want to union with this Rectangle. 
     227    * @return  A Rectangle representing the mbb of their union. 
     228    */ 
     229    public ICanvasItem getUnionMbb(ICanvasItem h); 
     230 
     231    /** 
     232    * Returns the area of this Rectangle. 
     233    * 
     234    * @return The area as a float. 
     235    */ 
     236    float getArea(); 
     237 
     238    /* The MINDIST criterion as described by Roussopoulos. 
     239    FIXME: better description here... 
     240    */ 
     241    float getMinDist(Point p); 
     242 
     243    ///////////CanvasItem clone();//Object clone() 
     244 
     245    /*String toString() 
     246    { 
     247        return "P1" ~ p1.toString() ~ ":P2" ~ p2.toString(); 
     248    }*/ 
     249 
     250    Node rtreeNode();//This is not quaranteed to be up to date at any time. It's only updated on a call to enclosureList(). 
     251    Node rtreeNode( Node set ); 
     252 
     253    void adjustTree(); 
     254     
     255    LinkSeq!(ICanvasItem) enclosureList( double tx, double ty, inout LinkSeq!(ICanvasItem) hit_items = null ); 
     256    LinkSeq!(ICanvasItem) enclosureList( double tx, double ty, double tw, double th, inout LinkSeq!(ICanvasItem) hit_items = null ); 
     257    bool mouseEvent( InputState input, bool bypass_hittest = false ); 
     258 
     259//END HyperCube compatibility stuff for RTree: 
     260//******************************************* 
     261 
     262    char[] name(); 
     263    char[] name(char[] set); 
     264 
     265    bool isSelected(); 
     266    bool isSelected(bool set); 
     267 
     268    char[] toString(); 
     269     
     270    //Returns a newly allocated copy of this object. 
     271    ICanvasItem dup(); 
     272     
     273    void setXYWH( float sx1, float sy1, float sw, float sh); 
     274    void setXYXY( float sx1, float sy1, float sx2, float sy2); 
     275 
     276    //Position 
     277    float xPos(); 
     278    float xPos(float set); 
     279    float yPos(); 
     280    float yPos(float set); 
     281    float zPos(); 
     282    float zPos(float set); 
     283     
     284    //Move pos with a delta value 
     285    void move( float delta_x, float delta_y ); 
     286    //Moves the pos 
     287    void moveTo( float to_x, float to_y ); 
     288     
     289    //ZOrder 
     290    uint zOrder(); 
     291    uint zOrder(uint set); 
     292     
     293    //3D rotations 
     294    float xRot(); 
     295    float xRot(float set); 
     296    float yRot(); 
     297    float yRot(float set); 
     298    float zRot(); 
     299    float zRot(float set); 
     300     
     301    //Parent coordinate wrappers for RectangleMesh: 
     302 
     303    float cx(); 
     304    //float cx(float set); 
     305    float cy(); 
     306    //float cy(float set); 
     307    //x1(left) 
     308    float x1(); 
     309    float x1(float set); 
     310    //y1(top) 
     311    float y1(); 
     312    float y1(float set); 
     313     
     314    float x2(); 
     315    float x2(float set); 
     316     
     317    float y2(); 
     318    float y2(float set); 
     319     
     320    float z(); 
     321    float z(float set); 
     322     
     323    //Width and X2(right) 
     324    float w(); 
     325    float w(float set); 
     326    //Height and Y2(bottom) 
     327    float h(); 
     328    float h(float set); 
     329     
     330    /* 
     331    //move x and y in relation to w and h. (change w and h) rarely used. 
     332    float yh(float set); 
     333    //Change height while the center stays the same. Maybe hc()? 
     334    float hc(float set); 
     335    //move x and y in relation to w and h. (change w and h) rarely used. 
     336    float xw(float set); 
     337    //Change width while the center stays the same. Maybe wc()? 
     338    float wc(float set); 
     339    */ 
     340    void colour( float sr, float sg, float sb, float sa ); 
     341    float r(); 
     342    float r(float set); 
     343    float g(); 
     344    float g(float set); 
     345    float b(); 
     346    float b(float set); 
     347    float a(); 
     348    float a(float set); 
     349     
     350    void render(); 
     351    //is the point (tx,ty) inside the rectangle 
     352    bool enclosure( float tx, float ty );    
     353    //aspect ratio of the rectangle 
     354    float aspect(); 
     355     
     356    void add( Animator set_anim ); 
     357     
     358    //LinkSeq!(ICanvasItem) enclosureList( double tx, double ty, double tw, double th, inout LinkSeq!(ICanvasItem) hit_items = null ); 
     359
     360 
     361 
     362 
     363 
     364//---------------------------------------------------- 
     365 
     366 
     367 
     368 
     369 
     370 
     371 
     372 
     373 
     374 
     375 
     376 
     377 
     378 
     379 
     380 
     381 
     382 
     383 
     384 
     385 
     386 
     387 
     388 
     389 
     390 
     391 
     392 
    46393 
    47394/* 
     
    67414unittest 
    68415{ 
    69     Trace.formatln("unittest Rectangle."); 
    70  
    71     //scope Rectangle rect = new Rectangle(0.0f, 0.0f, -0.0f, 0.0f, 1.0f, 1.0f); 
    72     scope Rectangle rect = new Rectangle(); 
     416    Trace.formatln("unittest PlainRectangle."); 
     417 
     418    //scope PlainRectangle rect = new PlainRectangle(0.0f, 0.0f, -0.0f, 0.0f, 1.0f, 1.0f); 
     419    scope PlainRectangle rect = new PlainRectangle(); 
    73420    Trace.formatln("rect: {}", rect.toString() ); 
    74421    rect.setXYWH( 0.0, 0.0, 1.0, 1.0 ); 
     
    146493 
    147494//class ICanvasItem : public ICanvasItem //TODO 
    148 class Rectangle : public ICanvasItem 
     495class PlainRectangle : public ICanvasItem 
    149496{ 
    150497public: 
     
    156503    this(Point p1, Point p2) 
    157504    { 
    158         debug(Rectangle) Trace.formatln("Rectangle.this(p1,p2) START."); 
    159         debug(Rectangle) scope(exit) Trace.formatln("Rectangle.this(p1,p2) END."); 
     505        debug(PlainRectangle) Trace.formatln("PlainRectangle.this(p1,p2) START."); 
     506        debug(PlainRectangle) scope(exit) Trace.formatln("PlainRectangle.this(p1,p2) END."); 
    160507        //super(); 
    161508 
    162         if (p1 is null || p2 is null) throw new Exception("Rectangle.this(p1, p2) Error: Points cannot be null."); 
    163  
    164         if (p1.getDimension() != p2.getDimension()) throw new Exception("Rectangle.this(p1, p2) Error: Points must be of the same dimension."); 
     509        if (p1 is null || p2 is null) throw new Exception("PlainRectangle.this(p1, p2) Error: Points cannot be null."); 
     510 
     511        if (p1.getDimension() != p2.getDimension()) throw new Exception("PlainRectangle.this(p1, p2) Error: Points must be of the same dimension."); 
    165512 
    166513        for (int i = 0; i < p1.getDimension(); i++) 
    167514        { 
    168             if (p1.getFloatCoordinate(i) > p2.getFloatCoordinate(i)) throw new Exception("Rectangle.this(p1, p2) Error: Give lower left corner first and upper right corner afterwards."); 
     515            if (p1.getFloatCoordinate(i) > p2.getFloatCoordinate(i)) throw new Exception("PlainRectangle.this(p1, p2) Error: Give lower left corner first and upper right corner afterwards."); 
    169516        } 
    170517 
     
    217564 
    218565    /** 
    219     * Tests to see whether <B>h</B> has any common points with this Rectangle. If <B>h</B> is inside this 
     566    * Tests to see whether <B>h</B> has any common points with this PlainRectangle. If <B>h</B> is inside this 
    220567    * object (or vice versa), it returns true. 
    221568    * 
    222     * @return True if <B>h</B> and this Rectangle intersect, false otherwise. 
     569    * @return True if <B>h</B> and this PlainRectangle intersect, false otherwise. 
    223570    */ 
    224571    bool intersection(ICanvasItem rect) 
    225572    { 
    226         if (rect is null) throw new Exception("Rectangle.intersection(..) : Rectangle cannot be null."); 
    227  
    228         //if (h.getDimension() != getDimension()) throw new Exception("Rectangle.intersection(..) : Rectangle dimension is different from current dimension."); 
     573        if (rect is null) throw new Exception("PlainRectangle.intersection(..) : PlainRectangle cannot be null."); 
     574 
     575        //if (h.getDimension() != getDimension()) throw new Exception("PlainRectangle.intersection(..) : PlainRectangle dimension is different from current dimension."); 
    229576        /* 
    230577        bool intersect = true; 
     
    241588        //return isOverlap( h );//I guess this is the same thing as the above??? 
    242589         
    243         debug(Rectangle) Trace.formatln("Rectangle.isOverlap(Rectangle rect) START and END."); 
     590        debug(PlainRectangle) Trace.formatln("PlainRectangle.isOverlap(PlainRectangle rect) START and END."); 
    244591        /* 
    245592        //This version thinks that if they are equal they overlap. 
     
    267614 
    268615    /** 
    269     * Tests to see whether <B>h</B> is inside this Rectangle. If <B>h</B> is exactly the same shape 
     616    * Tests to see whether <B>h</B> is inside this PlainRectangle. If <B>h</B> is exactly the same shape 
    270617    * as this object, it is considered to be inside. 
    271618    * 
     
    275622    { 
    276623        //if (h is null) 
    277         //  throw new Exception("Rectangle.enclosure(..) : Rectangle cannot be null."); 
     624        //  throw new Exception("PlainRectangle.enclosure(..) : PlainRectangle cannot be null."); 
    278625 
    279626        //if (h.getDimension() != getDimension()) throw new 
    280         //Exception("Rectangle.enclosure(..) : Rectangle dimension is different from current dimension."); 
     627        //Exception("PlainRectangle.enclosure(..) : PlainRectangle dimension is different from current dimension."); 
    281628 
    282629        /*bool inside = true; 
     
    365712 
    366713    /** 
    367     * Tests to see whether <B>p</B> is inside this Rectangle. If <B>p</B> lies on the boundary 
    368     * of the Rectangle, it is considered to be inside the object. 
     714    * Tests to see whether <B>p</B> is inside this PlainRectangle. If <B>p</B> lies on the boundary 
     715    * of the PlainRectangle, it is considered to be inside the object. 
    369716    * 
    370717    * @return True if <B>p</B> is inside, false otherwise. 
     
    373720    { 
    374721        if (p is null) throw new 
    375             Exception("Rectangle.enclosure(Point p) Error: Point cannot be null."); 
     722            Exception("PlainRectangle.enclosure(Point p) Error: Point cannot be null."); 
    376723 
    377724        if (p.getDimension() != getDimension()) throw new 
    378             Exception("Rectangle.enclosure(Point p) Error: Point dimension is different from Rectangle dimension."); 
    379  
    380         return enclosure( p.x, p.y );//enclosure(new Rectangle(p, p) ); 
     725            Exception("PlainRectangle.enclosure(Point p) Error: Point dimension is different from PlainRectangle dimension."); 
     726 
     727        return enclosure( p.x, p.y );//enclosure(new PlainRectangle(p, p) ); 
    381728    } 
    382729 
    383730    /** 
    384     * Returns the area of the intersecting region between this Rectangle and the argument. 
     731    * Returns the area of the intersecting region between this PlainRectangle and the argument. 
    385732    * 
    386733    * Below, all possible situations are depicted. 
     
    393740    *     -------   -------      ---------   ---------      ------         ------ 
    394741    * 
    395     * @param h Given Rectangle. 
     742    * @param h Given PlainRectangle. 
    396743    * @return Area of intersecting region. 
    397744    */ 
    398745    float intersectingArea(ICanvasItem h) 
    399746    { 
    400         //This might all be wrong, as it seems that our Rectangle is 
     747        //This might all be wrong, as it seems that our PlainRectangle is 
    401748        //defined differently than the HyperCubes... Let's make a 
    402749        //unittest. 
     
    461808    static ICanvasItem getUnionMbb(ICanvasItem[] a) 
    462809    { 
    463         debug(Rectangle) Trace.formatln("Rectangle.getUnionMbb(Rectangle[] a)...START."); 
    464         debug(Rectangle) scope(exit) Trace.formatln("Rectangle.getUnionMbb(Rectangle[] a)...END."); 
     810        debug(PlainRectangle) Trace.formatln("PlainRectangle.getUnionMbb(PlainRectangle[] a)...START."); 
     811        debug(PlainRectangle) scope(exit) Trace.formatln("PlainRectangle.getUnionMbb(PlainRectangle[] a)...END."); 
    465812         
    466813        if (a is null || a.length == 0) throw new 
    467         Exception("Rectangle.getUnionMbb(Rectangle a[]) : Rectangle array is empty."); 
    468  
    469         //PlainRectangle h = new PlainRectangle( a[0] );//cast(Rectangle) a[0].clone(); 
    470         Rectangle h = new Rectangle( a[0] ); 
    471          
    472         /*debug(Rectangle) 
    473         { 
    474             if( h is null) Trace.formatln("Rectangle.getUnionMbb(Rectangle a[]) : Error: h is null."); 
    475             else if( h is a[0]) Trace.formatln("Rectangle.getUnionMbb(Rectangle a[]) : Error: h is a[0]."); 
    476             else Trace.formatln("Rectangle.getUnionMbb(Rectangle a[]) : h is OK."); 
     814        Exception("PlainRectangle.getUnionMbb(PlainRectangle a[]) : PlainRectangle array is empty."); 
     815 
     816        //PlainRectangle h = new PlainRectangle( a[0] );//cast(PlainRectangle) a[0].clone(); 
     817        PlainRectangle h = new PlainRectangle( a[0] ); 
     818         
     819        /*debug(PlainRectangle) 
     820        { 
     821            if( h is null) Trace.formatln("PlainRectangle.getUnionMbb(PlainRectangle a[]) : Error: h is null."); 
     822            else if( h is a[0]) Trace.formatln("PlainRectangle.getUnionMbb(PlainRectangle a[]) : Error: h is a[0]."); 
     823            else Trace.formatln("PlainRectangle.getUnionMbb(PlainRectangle a[]) : h is OK."); 
    477824        }*/ 
    478825 
     
    481828            if(a[i] is null) Trace.formatln("a[i] is null i:", i); 
    482829            //h = cast(PlainRectangle) h.getUnionMbb(a[i]); 
    483             h = cast(Rectangle) h.getUnionMbb(a[i]); 
     830            h = cast(PlainRectangle) h.getUnionMbb(a[i]); 
    484831        } 
    485832         
     
    488835 
    489836    /** 
    490     * Return a new Rectangle representing the mbb of the union of this Rectangle and <B>h</B> 
     837    * Return a new PlainRectangle representing the mbb of the union of this PlainRectangle and <B>h</B> 
    491838    * 
    492     * @param  h The Rectangle that we want to union with this Rectangle. 
    493     * @return  A Rectangle representing the mbb of their union. 
     839    * @param  h The PlainRectangle that we want to union with this PlainRectangle. 
     840    * @return  A PlainRectangle representing the mbb of their union. 
    494841    */ 
    495842    public ICanvasItem getUnionMbb(ICanvasItem h) 
    496843    { 
    497844        if (h is null) 
    498             throw new Exception("Rectangle.getUnionMbb(Rectangle h) : Rectangle cannot be null."); 
    499  
    500         //debug(Rectangle) Trace.formatln( "this rect: ", toString(), " and test rect: ", h.toString() ); 
     845            throw new Exception("PlainRectangle.getUnionMbb(PlainRectangle h) : PlainRectangle cannot be null."); 
     846 
     847        //debug(PlainRectangle) Trace.formatln( "this rect: ", toString(), " and test rect: ", h.toString() ); 
    501848 
    502849        //if (h.getDimension() != getDimension()) 
    503         //  throw new Exception("Rectangle.getUnionMbb(Rectangle h) : Rectangles must be of the same dimension."); 
     850        //  throw new Exception("PlainRectangle.getUnionMbb(PlainRectangle h) : Rectangles must be of the same dimension."); 
    504851 
    505852        float[2] min;// = new float[2];//getDimension()];//2 
     
    519866 
    520867        //PlainRectangle reslt = new PlainRectangle(); 
    521         Rectangle reslt = new Rectangle(); 
     868        PlainRectangle reslt = new PlainRectangle(); 
    522869        reslt.setXYXY( min[0], min[1], max[0], max[1] ); 
    523870 
    524         return reslt;//new Rectangle(min[0], min[1], max[0], max[1]);//new Point(min), new Point(max)); 
     871        return reslt;//new PlainRectangle(min[0], min[1], max[0], max[1]);//new Point(min), new Point(max)); 
    525872    } 
    526873 
    527874    /** 
    528     * Returns the area of this Rectangle. 
     875    * Returns the area of this PlainRectangle. 
    529876    * 
    530877    * @return The area as a float. 
     
    550897    { 
    551898        if (p is null) throw new 
    552         Exception("Rectangle.getMinDist(Point p) Error: Point cannot be null."); 
     899        Exception("PlainRectangle.getMinDist(Point p) Error: Point cannot be null."); 
    553900 
    554901        if (p.getDimension() != getDimension()) throw new 
    555         Exception("Rectangle.getMinDist(Point p) Error: Point dimension is different from Rectangle dimension."); 
     902        Exception("PlainRectangle.getMinDist(Point p) Error: Point dimension is different from PlainRectangle dimension."); 
    556903 
    557904        float ret = 0; 
     
    575922    //ICanvasItem clone()//Object clone() 
    576923    //{ 
    577     //  return new Rectangle(x, y, w, h);//cast(Point) p1.clone(), cast(Point) p2.clone()); 
     924    //  return new PlainRectangle(x, y, w, h);//cast(Point) p1.clone(), cast(Point) p2.clone()); 
    578925    //} 
    579926 
     
    584931        debug(RTree) 
    585932        { 
    586             Stdout("CanvasItemAbstract.rtreeNode(Node set) This item:", toString() ); 
    587             if( m_rtreeNode !is null ) Stdout(" new rtreeNode: ", m_rtreeNode.toString() ); 
     933            Trace.formatln("CanvasItemAbstract.rtreeNode(Node set) This item:{}", toString() ); 
     934            if( m_rtreeNode !is null ) Trace.formatln(" new rtreeNode: {}", m_rtreeNode.toString() ); 
    588935        } 
    589936        return m_rtreeNode; 
     
    633980        } 
    634981 
    635         if( parent !is null ) 
     982        /*if( parent !is null ) 
    636983        { 
    637984            debug(AdjustTree) Stdout("CanvasItemAbstract.adjustTree() going to call parent.adjustTree()."); 
     
    640987        } 
    641988        else debug(AdjustTree) Stdout("CanvasItemAbstract.adjustTree() Didn't have a parent."); 
     989        */ 
    642990 
    643991        debug(AdjustTree) Stdout("CanvasItemAbstract.adjustTree() END.").newline; 
    644992    } 
     993 
     994 
     995LinkSeq!(ICanvasItem) enclosureList( double tx, double ty, inout LinkSeq!(ICanvasItem) hit_items = null ) 
     996{ 
     997    return enclosureList( tx, ty, 0.0, 0.0, hit_items ); 
     998} 
     999 
     1000LinkSeq!(ICanvasItem) enclosureList( double tx, double ty, double tw, double th, inout LinkSeq!(ICanvasItem) hit_items = null ) 
     1001{ 
     1002    throw new Exception("PlainRectangle.enclosureList(...) is not implemented."); 
     1003    return null; 
     1004} 
     1005 
     1006bool mouseEvent( InputState input, bool bypass_hittest = false ) 
     1007{ 
     1008    throw new Exception("PlainRectangle.mouseEvent(...) is not implemented."); 
     1009    return false; 
     1010} 
    6451011 
    6461012//End hypercube compatibility stuff. 
    6471013//******************************************** 
    6481014 
     1015 
     1016 
    6491017    this() 
    6501018    { 
    651         debug(Rectangle) Trace.formatln("Rectangle.this() START."); 
    652         debug(Rectangle) scope(exit) Trace.formatln("Rectangle.this() END."); 
     1019        debug(PlainRectangle) Trace.formatln("PlainRectangle.this() START."); 
     1020        debug(PlainRectangle) scope(exit) Trace.formatln("PlainRectangle.this() END."); 
    6531021         
    6541022        colour( 1.0f, 1.0f, 1.0f, 1.0f ); 
     
    6581026    this( float sx1, float sy1, float sx2, float sy2 ) 
    6591027    { 
    660         debug(Rectangle) Trace.formatln("Rectangle.this(4) START."); 
    661         debug(Rectangle) scope(exit) Trace.formatln("Rectangle.this(4) END."); 
     1028        debug(PlainRectangle) Trace.formatln("PlainRectangle.this(4) START."); 
     1029        debug(PlainRectangle) scope(exit) Trace.formatln("PlainRectangle.this(4) END."); 
    6621030         
    6631031        /* 
     
    6791047    this( float set_pos_x, float set_pos_y, float six1, float siy1, float six2, float siy2 ) 
    6801048    { 
    681         debug(Rectangle) Trace.formatln("Rectangle.this(6) START."); 
    682         debug(Rectangle) scope(exit) Trace.formatln("Rectangle.this(6) END."); 
     1049        debug(PlainRectangle) Trace.formatln("PlainRectangle.this(6) START."); 
     1050        debug(PlainRectangle) scope(exit) Trace.formatln("PlainRectangle.this(6) END."); 
    6831051         
    6841052        _xPos = set_pos_x; 
     
    7051073    } 
    7061074     
    707     this( Rectangle setme ) 
     1075    this( PlainRectangle setme ) 
    7081076    { 
    7091077        _xPos = setme.xPos; 
     
    7251093    ICanvasItem dup() 
    7261094    { 
    727         return new Rectangle(this); 
     1095        return new PlainRectangle(this); 
    7281096    } 
    7291097     
     
    7571125    //name 
    7581126     
    759     char[] name(){ return m_name; }; 
    760     char[] name(char[] set){ return m_name = set; }; 
    761     char[] m_name = ""; 
     1127    public char[] name(){ return m_name; } 
     1128    public char[] name(char[] set){ return m_name = set; } 
     1129    protected char[] m_name = ""; 
     1130 
     1131    //isSelected or not. 
     1132    public bool isSelected() { return m_isSelected; } 
     1133    public bool isSelected(bool set) 
     1134    { 
     1135        m_isSelected = set; 
     1136        //applyMainColour(); 
     1137        return m_isSelected; 
     1138    } 
     1139    protected bool m_isSelected = false; 
    7621140 
    7631141    //Position 
     
    7911169    //drawn. This is usually 0.0 in Shiraz. It doesn't reflect 
    7921170    //which of the objects is topmost. 
    793     //The z() is a z position for the actual rectangle that 
     1171    //The z() is a z position for the actual PlainRectangle that 
    7941172    //is drawn. It could be different than zPos, but usually 
    7951173    //it's just 0.0. Maybe it is redundant? I don't know yet. 
     
    8231201        else glDisable(GL_TEXTURE_2D); 
    8241202     
    825         //Trace.formatln("  Rectangle.render() START."); 
     1203        //Trace.formatln("  PlainRectangle.render() START."); 
    8261204        glPushMatrix(); 
    8271205            applyPosition(); 
     
    8991277    } 
    9001278     
    901     //Currently Rectangle doesn't keep it's animations... 
     1279    //Currently PlainRectangle doesn't keep it's animations... 
    9021280    void add( Animator a_anim ) 
    9031281    { 
     
    9251303 
    9261304    //LinkSeq!(RectangleMesh) m_mesh; //How about something like this later on... 
    927     //Rectangle should stay simple, but some inherited class 
     1305    //PlainRectangle should stay simple, but some inherited class 
    9281306    //could do something like this. 
    9291307 
     
    9691347    bool enclosure( float tx, float ty ) 
    9701348    { 
    971         debug(Rectangle) Trace.formatln("Rectangle.enclosure( tx: ", tx, " ty: ", ty, " ) START and END.\n"); 
     1349        debug(PlainRectangle) Trace.formatln("PlainRectangle.enclosure( tx: ", tx, " ty: ", ty, " ) START and END.\n"); 
    9721350         
    9731351        /*Trace.formatln("tx: ")(tx); 
     
    9991377        */ 
    10001378         
     1379        //These will translate the incoming coordinates 
     1380        //into this widgets coordinates. It's the same 
     1381        //as xp2i() in the old system. 
    10011382        tx -= xPos; 
    10021383        ty -= yPos; 
     
    12351616    protected float _iz = 0.0f; 
    12361617     
    1237      
    1238      
     1618    /*char[] toString() 
     1619    { 
     1620        char[] ret = "\nSTART "; 
     1621        ret ~= name; 
     1622        ret ~= "\nxPos: "; 
     1623        ret ~= Float.toString(xPos); 
     1624        ret ~= " yPos: "; 
     1625        ret ~= Float.toString(yPos); 
     1626        ret ~= " x: "; 
     1627        ret ~= Float.toString(x1); 
     1628        ret ~= " y: "; 
     1629        ret ~= Float.toString(y1); 
     1630        ret ~= " w: "; 
     1631        ret ~= Float.toString(w); 
     1632        ret ~= " h: "; 
     1633        ret ~= Float.toString(h); 
     1634        ret ~= "\nEND " ~ name; 
     1635         
     1636        return ret; 
     1637    }*/ 
     1638     
     1639    //Ignored in PlainRectangle: 
     1640    /*Huoh... 
     1641    LinkSeq!(ICanvasItem) enclosureList( double tx, double ty, inout LinkSeq!(Rectangle) hit_items = null ) { return null; } 
     1642    LinkSeq!(ICanvasItem) enclosureList( double tx, double ty, double tw, double th, inout LinkSeq!(ICanvasItem) hit_items = null ) { return null; } 
     1643    public Rectangle rootWindow(Rectangle set){ return null; }///Don't use this yourself. 
     1644    public Rectangle rootWindow() { return null; }///Don't use this yourself. 
     1645    public ICanvasItem parent() { return null; } 
     1646    public ICanvasItem parent(ICanvasItem set) { return null; } 
     1647    LinkSeq!(ICanvasItem) itemList() { return null; } 
     1648    RTree itemTree() { return null; } 
     1649    void add( Animator a_anim ){} 
     1650    bool hasAnimators(){ false; } 
     1651    void addDefaultAnimator( DefaultAnimator def_anim ){} 
     1652    void grabInput(){}