Changeset 58:d43523ed4b62

Show
Ignore:
Timestamp:
06/14/08 12:15:06 (7 months ago)
Author:
Diggory Hardy <diggory.hardy@gmail.com>
branch:
default
Message:

Included a wdim typedef for all variables to do with window position or size instead of just using int.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • codeDoc/jobs.txt

    r57 r58  
    5353 
    5454Done (for mercurial log message): 
    55 Coloured and alpha-blended text is now supported. 
    56 TextWidgets get text colour from argument. 
  • mde/gui/Gui.d

    r47 r58  
    148148        debug scope (failure) 
    149149                logger.warn ("clickEvent: failed!"); 
     150         
    150151        // NOTE: buttons receive the up-event even when drag-callbacks are in place. 
    151152        foreach (dg; clickCallbacks) 
    152             if (dg (cx, cy, b, state)) return;      // See IGui.addClickCallback's documentation 
     153            if (dg (cast(wdabs)cx, cast(wdabs)cy, b, state)) return;      // See IGui.addClickCallback's documentation 
    153154         
    154155        foreach (i,w; windows) { 
    155             IWidget widg = w.getWidget (cx,cy); 
     156            IWidget widg = w.getWidget (cast(wdabs)cx,cast(wdabs)cy); 
    156157            if (widg !is null) { 
    157158                // Bring to front 
    158159                windows = w ~ windows[0..i] ~ windows[i+1..$]; 
    159160                 
    160                 widg.clickEvent (cx,cy,b,state); 
     161                widg.clickEvent (cast(wdabs)cx,cast(wdabs)cy,b,state); 
    161162                return;     // only pass to first window 
    162163            } 
     
    171172                logger.warn ("motionEvent: failed!"); 
    172173        foreach (dg; motionCallbacks) 
    173             dg (cx, cy); 
     174            dg (cast(wdabs)cx, cast(wdabs)cy); 
    174175    } 
    175176     
     
    185186    } 
    186187     
    187     void addClickCallback (bool delegate(ushort, ushort, ubyte, bool) dg) { 
     188    void addClickCallback (bool delegate(wdabs, wdabs, ubyte, bool) dg) { 
    188189        clickCallbacks[dg.ptr] = dg; 
    189190    } 
    190     void addMotionCallback (void delegate(ushort, ushort) dg) { 
     191    void addMotionCallback (void delegate(wdabs, wdabs) dg) { 
    191192        motionCallbacks[dg.ptr] = dg; 
    192193    } 
     
    203204     
    204205    // callbacks indexed by their frame pointers: 
    205     bool delegate(ushort cx, ushort cy, ubyte b, bool state) [void*] clickCallbacks; 
    206     void delegate(ushort cx, ushort cy) [void*] motionCallbacks; 
     206    bool delegate(wdabs cx, wdabs cy, ubyte b, bool state) [void*] clickCallbacks; 
     207    void delegate(wdabs cx, wdabs cy) [void*] motionCallbacks; 
    207208} 
  • mde/gui/IGui.d

    r41 r58  
    1414along with this program.  If not, see <http://www.gnu.org/licenses/>. */ 
    1515 
     16/** Contains the IGui interface and some basic types used by the gui package. */ 
    1617module mde.gui.IGui; 
     18 
     19/** Window coordinate and dimension/size type (int). 
     20 * 
     21 * Used to disambiguate between general integers and coordinates; all widget positions/sizes should 
     22 * use this type (or one of the aliases below). */ 
     23typedef int     wdim; 
     24 
     25/** Aliases of wdim providing extra information about what their contents hold: absolute position, 
     26 * position relative to the containing widget (wdrel should not be used if relative to anything 
     27 * else), or size. Their use instead of wdim is optional (and in some cases wdim values aren't of 
     28 * any of these types). Also don't use these aliases for variables which may also be used to other 
     29 * effects, e.g. if they can have special values with special meanings. */ 
     30alias wdim  wdabs; 
     31alias wdim  wdrel;  /// ditto 
     32alias wdim  wdsize; /// ditto 
     33 
     34/// A pair of wdim variables, and strictly no other data (methods may be added if deemed useful). 
     35struct wdimPair { 
     36    wdim x, y;  /// data 
     37} 
    1738 
    1839/** The Gui interface. 
     
    3758     * Note that this is not a mechanism to prevent unwanted event handling, and in the future may 
    3859     * be removed (so event handling cannot be cut short). */ 
    39     void addClickCallback (bool delegate (ushort cx, ushort cy, ubyte b, bool state) dg); 
     60    void addClickCallback (bool delegate (wdabs cx, wdabs cy, ubyte b, bool state) dg); 
    4061    /** Add a mouse motion callback: delegate will be called for all motion events recieved. */ 
    41     void addMotionCallback (void delegate (ushort cx, ushort cy) dg); 
     62    void addMotionCallback (void delegate (wdabs cx, wdabs cy) dg); 
    4263    /** Remove all event callbacks with _frame pointer frame. */ 
    4364    void removeCallbacks (void* frame); 
  • mde/gui/renderer/IRenderer.d

    r43 r58  
    1717module mde.gui.renderer.IRenderer; 
    1818 
     19public import mde.gui.IGui; // wdim type is used by just about everything including this 
     20 
    1921/** Interface for renderers. 
    2022* 
     
    3032    struct BorderDimensions { 
    3133        /// The dimensions: left, top, right, bottom 
    32         ubyte l, t, r, b; 
     34        wdim l, t, r, b; 
    3335         
    3436        void opAddAssign (BorderDimensions d) { 
     
    6264    *   RESIZE_TYPE = NONE for a move, an or'd combination of L/R/T/B for resizing. 
    6365    */ 
    64     RESIZE_TYPE getResizeType (int cx, int cy, int w, int h); 
     66    RESIZE_TYPE getResizeType (wdim cx, wdim cy, wdim w, wdim h); 
    6567     
    6668    /** Return the renderer's between-widget spacing (for layout widgets). */ 
    67     int layoutSpacing (); 
     69    wdim layoutSpacing (); 
    6870    //END Get dimensions 
    6971     
    7072    //BEGIN draw routines 
    7173    /** Draw a window border plus background. */ 
    72     void drawWindow (int x, int y, int w, int h); 
     74    void drawWindow (wdim x, wdim y, wdim w, wdim h); 
    7375     
    7476    /** Draws a widget background. Usually doesn't do anything since backgrounds are transparent. */ 
    75     void drawWidgetBack (int x, int y, int w, int h); 
     77    void drawWidgetBack (wdim x, wdim y, wdim w, wdim h); 
    7678     
    7779    /** Draws a blank widget (temporary) */ 
    78     void drawBlank (int x, int y, int w, int h); 
     80    void drawBlank (wdim x, wdim y, wdim w, wdim h); 
    7981     
    8082    /** Draws a button frame, in if pushed == true. */ 
    81     void drawButton (int x, int y, int w, int h, bool pushed); 
     83    void drawButton (wdim x, wdim y, wdim w, wdim h, bool pushed); 
    8284    //END draw routines 
    8385} 
  • mde/gui/renderer/SimpleRenderer.d

    r43 r58  
    4444                l = r = 0; 
    4545            if (hSizable) { 
    46                 t = 2; 
    47                 b = 6; 
     46                t = b = 6; 
    4847            } else 
    4948                t = b = 0; 
     
    5352    } 
    5453     
    55     RESIZE_TYPE getResizeType (int cx, int cy, int w, int h) { 
     54    RESIZE_TYPE getResizeType (wdim cx, wdim cy, wdim w, wdim h) { 
    5655        RESIZE_TYPE resizeType = RESIZE_TYPE.NONE; 
    5756        if (cx < resize.l || cx >= w - resize.r || 
     
    7675    } 
    7776     
    78     int layoutSpacing () { 
     77    wdim layoutSpacing () { 
    7978        return 4; 
    8079    } 
    8180     
    8281     
    83     void drawWindow (int x, int y, int w, int h) { 
     82    void drawWindow (wdim x, wdim y, wdim w, wdim h) { 
    8483        gl.setColor (0f, 0f, .7f); 
    8584        gl.drawBox (x,y, w,h); 
     
    9291    } 
    9392 
    94     void drawWidgetBack (int x, int y, int w, int h) {} 
     93    void drawWidgetBack (wdim x, wdim y, wdim w, wdim h) {} 
    9594     
    96     void drawBlank (int x, int y, int w, int h) { 
     95    void drawBlank (wdim x, wdim y, wdim w, wdim h) { 
    9796        gl.setColor (.4f, .4f, .4f); 
    9897        gl.drawBox (x,y, w,h); 
    9998    } 
    10099     
    101     void drawButton (int x, int y, int w, int h, bool pushed) { 
     100    void drawButton (wdim x, wdim y, wdim w, wdim h, bool pushed) { 
    102101        if (pushed) 
    103102            gl.setColor (1f, 0f, 1f); 
  • mde/gui/widget/Ifaces.d

    r48 r58  
    117117    /** Calculate the minimal size the widget could be shrunk to (or its fixed size), taking into 
    118118     * account child-widgets or other contents. */ 
    119     void getMinimalSize (out int w, out int h); 
     119    void getMinimalSize (out wdim w, out wdim h); 
    120120     
    121121    /** Get the current size of the widget. */ 
    122     void getCurrentSize (out int w, out int h); 
     122    void getCurrentSize (out wdim w, out wdim h); 
    123123     
    124124    /** Used to adjust the size. 
     
    140140     * If the actual size is needed, call getCurrentSize afterwards. setPosition must be called 
    141141     * afterwards if the widget might be a layout widget. */ 
    142     void setWidth (int nw, int dir); 
    143     void setHeight (int nh, int dir); /// ditto 
     142    void setWidth (wdim nw, int dir); 
     143    void setHeight (wdim nh, int dir);    /// ditto 
    144144     
    145145    /** Set the current position (i.e. called on init and move). */ 
    146     void setPosition (int x, int y); 
     146    void setPosition (wdim x, wdim y); 
    147147//END Size and position 
    148148     
     
    157157     * 
    158158     * Note: use global coordinates (x,y) not coordinates relative to the widget. */ 
    159     IWidget getWidget (int x, int y); 
     159    IWidget getWidget (wdim x, wdim y); 
    160160     
    161161    /** Receive a mouse click event. 
     
    165165     * 
    166166     * Widget may assume coordinates are on the widget (caller must check). */ 
    167     void clickEvent (ushort cx, ushort cy, ubyte b, bool state); 
     167    void clickEvent (wdabs cx, wdabs cy, ubyte b, bool state); 
    168168//END Events 
    169169     
  • mde/gui/widget/Widget.d

    r46 r58  
    6262     
    6363    /* Return minimal/fixed size. */ 
    64     void getMinimalSize (out int a, out int b) { 
     64    void getMinimalSize (out wdim a, out wdim b) { 
    6565        a = mw; 
    6666        b = mh; 
    6767    } 
    6868     
    69     void getCurrentSize (out int cw, out int ch) { 
     69    void getCurrentSize (out wdim cw, out wdim ch) { 
    7070        cw = w; 
    7171        ch = h; 
     
    7474    /* Set size: minimal size is (mw,mh). Note that both resizable and fixed widgets should allow 
    7575     * enlarging, so in both cases this is a correct implementation. */ 
    76     void setWidth (int nw, int) { 
     76    void setWidth (wdim nw, int) { 
    7777        w = (nw >= mw ? nw : mw); 
    7878    } 
    79     void setHeight (int nh, int) { 
     79    void setHeight (wdim nh, int) { 
    8080        h = (nh >= mh ? nh : mh); 
    8181    } 
    8282     
    83     void setPosition (int nx, int ny) { 
     83    void setPosition (wdim nx, wdim ny) { 
    8484        x = nx; 
    8585        y = ny; 
     
    9090    /* This method is only called when the location is over this widget; hence for all widgets 
    9191     * without children this method is valid. */ 
    92     IWidget getWidget (int,int) { 
     92    IWidget getWidget (wdim,wdim) { 
    9393        return this; 
    9494    } 
    9595     
    9696    /* Dummy event method (suitable for all widgets which don't respond to events). */ 
    97     void clickEvent (ushort cx, ushort cy, ubyte b, bool state) {} 
     97    void clickEvent (wdabs cx, wdabs cy, ubyte b, bool state) {} 
    9898//END Events 
    9999     
     
    106106    final int widgetType;   // the type (stored for saving) 
    107107    IWindow window;     // the enclosing window 
    108     int x, y;         // position 
    109     int w, h;         // size 
    110     int mw = 0, mh = 0;       // minimal or fixed size, depending on whether the widget is 
     108    wdim x, y;            // position 
     109    wdim w, h;            // size 
     110    wdim mw = 0, mh = 0;  // minimal or fixed size, depending on whether the widget is 
    111111                    // resizible; both types of widgets should actually be expandable. 
    112112} 
     
    116116    // Check data.length is at least 3 before calling! 
    117117    this (IWindow wind, int[] data) { 
    118         mw = data[1]; 
    119         mh = data[2]; 
     118        mw = cast(wdim) data[1]; 
     119        mh = cast(wdim) data[2]; 
    120120        super (wind, data); 
    121121        w = mw; 
  • mde/gui/widget/Window.d

    r46 r58  
    7676         
    7777        // Note: this should return an empty array, but we shouldn't make a fuss if it's not empty: 
    78         widget.adjust (mutableData);    // adjust/set size, etc., depends on rend 
     78        if ((widget.adjust (mutableData)).length != 0)  // adjust/set size, etc., depends on rend 
     79            logger.warn ("Local widget position data is invalid!"); 
    7980        mutableData = null;             // no longer needed 
    8081         
     
    108109        } else if (tp == INT) { 
    109110            if (id == X && x == -1) { 
    110                 x = parseTo!(int) (dt); 
     111                x = cast(wdim) parseTo!(int) (dt); 
    111112            } else if (id == Y && y == -1) { 
    112                 y = parseTo!(int) (dt); 
     113                y = cast(wdim) parseTo!(int) (dt); 
    113114            } 
    114115        } 
     
    211212    } 
    212213     
    213     void getMinimalSize (out int wM, out int hM) { 
     214    void getMinimalSize (out wdim wM, out wdim hM) { 
    214215        // mw/mh are calculated by finalise(); 
    215216        wM = mw; 
    216217        hM = mh; 
    217218    } 
    218     void getCurrentSize (out int cw, out int ch) { 
     219    void getCurrentSize (out wdim cw, out wdim ch) { 
    219220        cw = w; 
    220221        ch = h; 
    221222    } 
    222223     
    223     void setWidth (int nw, int dir) { 
     224    void setWidth (wdim nw, int dir) { 
    224225        if (nw < mw) w = mw;    // clamp 
    225226        else w = nw; 
     
    227228        widget.setWidth (w - border.l - border.r, dir); 
    228229    } 
    229     void setHeight (int nh, int dir) { 
     230    void setHeight (wdim nh, int dir) { 
    230231        if (nh < mh) h = mh;    // clamp 
    231232        else h = nh; 
     
    234235    } 
    235236     
    236     void setPosition (int nx, int ny) { 
     237    void setPosition (wdim nx, wdim ny) { 
    237238        x = nx; 
    238239        y = ny; 
     
    249250    } 
    250251     
    251     IWidget getWidget (int cx, int cy) { 
     252    IWidget getWidget (wdim cx, wdim cy) { 
    252253        if (cx < x || cx >= xw || cy < y || cy >= yh)   // not over window 
    253254            return null; 
     
    258259            return this; 
    259260    } 
    260     void clickEvent (ushort cx, ushort cy, ubyte b, bool state) { 
     261    void clickEvent (wdabs cx, wdabs cy, ubyte b, bool state) { 
    261262        if (b == 1 && state == true) { 
    262263            resizeType = rend.getResizeType (cx-x, cy-y, w,h); 
     
    301302     
    302303    //BEGIN Window moving and resizing 
    303     void moveCallback (ushort cx, ushort cy) { 
     304    void moveCallback (wdabs cx, wdabs cy) { 
    304305        setPosition (cx-xDrag, cy-yDrag); 
    305306    } 
    306     void resizeCallback (ushort cx, ushort cy) { 
     307    void resizeCallback (wdabs cx, wdabs cy) { 
    307308        debug scope(failure) 
    308309                logger.trace ("resizeCallback: failure"); 
     
    313314         
    314315        if (resizeType & RESIZE_TYPE.L) { 
    315             int xSize = xDrag - cx; 
     316            wdim xSize = xDrag - cx; 
    316317            if (xSize < mw) xSize = mw; // clamp 
    317318            x += w - xSize; 
     
    322323        } 
    323324        if (resizeType & RESIZE_TYPE.T) { 
    324             int ySize = yDrag - cy; 
     325            wdim ySize = yDrag - cy; 
    325326            if (ySize < mh) ySize = mh; 
    326327            y += h - ySize; 
     
    335336        setPosition (x, y); 
    336337    } 
    337     bool endCallback (ushort cx, ushort cy, ubyte b, bool state) { 
     338    bool endCallback (wdabs cx, wdabs cy, ubyte b, bool state) { 
    338339        if (b == 1 && state == false) { 
    339340            // The mouse shouldn't have moved since the motion callback 
     
    345346        return false;       // we haven't handled it 
    346347    } 
    347     int xDrag, yDrag;               // where a drag starts relative to x and y 
     348    wdim xDrag, yDrag;              // where a drag starts relative to x and y 
    348349    IRenderer.RESIZE_TYPE resizeType;   // Type of current resize 
    349350    //END Window moving and resizing 
     
    362363    IWidget widget;                 // The primary widget in this window. 
    363364     
    364     int x = -1, y = -1;             // Window position 
    365     int w,h;                        // Window size (calculated from Widgets) 
    366     int xw, yh;                     // x+w, y+h (frequent use by clickEvent) 
    367     int widgetX, widgetY;           // Widget position (= window position plus BORDER_WIDTH) 
    368     int mw = -1, mh = -1;           // minimal size (negative means requires calculation) 
     365    wdim x = -1, y = -1;            // Window position 
     366    wdsize w,h;                     // Window size (calculated from Widgets) 
     367    wdim xw, yh;                    // x+w, y+h (frequent use by clickEvent) 
     368    wdim widgetX, widgetY;          // Widget position (= window position plus BORDER_WIDTH) 
     369    wdim mw = -1, mh = -1;          // minimal size (negative means requires calculation) 
    369370     
    370371    BorderDimensions border;        // Total border size (move plus resize) 
  • mde/gui/widget/layout.d

    r46 r58  
    8484        } else {                            // sufficient data 
    8585            lenUsed = rows+cols; 
    86             col.setCheck (data[0..cols]); 
    87             row.setCheck (data[cols..lenUsed]); 
     86            col.setCheck (cast(wdim[])data[0..cols]); 
     87            row.setCheck (cast(wdim[])data[cols..lenUsed]); 
    8888        } 
    8989         
     
    120120            ret ~= widget.getMutableData; 
    121121         
    122         ret ~= col.width ~ row.width; 
    123         return ret; 
     122        return ret ~ cast(int[])col.width ~ cast(int[])row.width; 
    124123    } 
    125124    //END Creation & saving 
     
    134133     
    135134    /* Calculates the minimal size from all rows and columns of widgets. */ 
    136     void getMinimalSize (out int mw, out int mh) { 
     135    void getMinimalSize (out wdim mw, out wdim mh) { 
    137136        mw = this.mw; 
    138137        mh = this.mh; 
    139138    } 
    140139     
    141     void setWidth (int nw, int dir) { 
     140    void setWidth (wdim nw, int dir) { 
    142141        if (nw == w) return; 
    143142         
     
    146145        // Note: setPosition must be called after! 
    147146    } 
    148     void setHeight (int nh, int dir) { 
     147    void setHeight (wdim nh, int dir) { 
    149148        if (nh == h) return; 
    150149         
     
    154153    } 
    155154     
    156     void setPosition (int x, int y) { 
     155    void setPosition (wdim x, wdim y) { 
    157156        this.x = x; 
    158157        this.y = y; 
     
    165164     
    166165    // Find the relevant widget. 
    167     IWidget getWidget (int cx, int cy) { 
     166    IWidget getWidget (wdim cx, wdim cy) { 
    168167        debug scope (failure) 
    169168                logger.warn ("getWidget: failure"); 
     
    179178     
    180179    // Resizing columns & rows 
    181     void clickEvent (ushort cx, ushort cy, ubyte b, bool state) { 
     180    void clickEvent (wdabs cx, wdabs cy, ubyte b, bool state) { 
    182181        debug scope (failure) 
    183182                logger.warn ("clickEvent: failure"); 
     
    217216        // Calculate the minimal column and row sizes: 
    218217        // set length, making sure the arrays are initialised to zero: 
    219         col.minWidth = new int[cols]; 
    220         row.minWidth = new int[rows]; 
    221         int ww, wh;     // sub-widget minimal sizes 
     218        col.minWidth = new wdim[cols]; 
     219        row.minWidth = new wdim[rows]; 
     220        wdim ww, wh;     // sub-widget minimal sizes 
    222221        foreach (i,widget; subWidgets) { 
    223222            widget.getMinimalSize (ww, wh); 
     
    233232        // Calculate the overall minimal size, starting with the spacing: 
    234233        mh = window.renderer.layoutSpacing; // use mh temporarily 
    235         mw = mh * (cols - 1); 
    236         mh *= (rows - 1); 
     234        mw = mh * cast(wdim)(cols - 1); 
     235        mh *= cast(wdim)(rows - 1); 
    237236         
    238237        foreach (x; col.minWidth)       // add the column/row's dimensions 
     
    276275     
    277276     
    278     void setColWidth (myIt i, int w, int dir) { 
     277    void setColWidth (myIt i, wdim w, int dir) { 
    279278        for (myIt j = 0; j < rows; ++j) { 
    280279            subWidgets[i + cols*j].setWidth (w, dir); 
    281280        } 
    282281    } 
    283     void setRowHeight (myIt j, int h, int dir) { 
     282    void setRowHeight (myIt j, wdim h, int dir) { 
    284283        for (myIt i = 0; i < cols; ++i) { 
    285284            subWidgets[i + cols*j].setHeight (h, dir); 
     
    289288     
    290289    //BEGIN Col/row resizing callback 
    291     void resizeCallback (ushort cx, ushort cy) { 
     290    void resizeCallback (wdim cx, wdim cy) { 
    292291        col.resize (cx - dragX); 
    293292        row.resize (cy - dragY); 
     
    302301        window.requestRedraw; 
    303302    } 
    304     bool endCallback (ushort cx, ushort cy, ubyte b, bool state) { 
     303    bool endCallback (wdabs cx, wdabs cy, ubyte b, bool state) { 
    305304        if (b == 1 && state == false) { 
    306305            window.gui.removeCallbacks (cast(void*) this); 
     
    312311protected: 
    313312    // Data for resizing cols/rows: 
    314     int dragX, dragY; // coords where drag starts 
     313    wdim dragX, dragY;    // coords where drag starts 
    315314    //END Col/row resizing callback 
    316315     
     
    329328     * Most notation corresponds to horizontal layout (columns), simply for easy of naming. */ 
    330329    struct CellDimensions { 
    331         int[] pos,    // relative position (cumulative width[i-1] plus spacing) 
     330        wdim[] pos,   // relative position (cumulative width[i-1] plus spacing) 
    332331              width,    // current widths 
    333332              minWidth; // minimal widths (set by genCachedConstructionData) 
     
    337336        myDiff resizeD, // resize down from this index (<0 if not resizing) 
    338337               resizeU; // and up from this index 
    339         int spacing;  // used by genPositions (which cannot access the layout class's data) 
     338        wdim spacing; // used by genPositions (which cannot access the layout class's data) 
    340339        /* This is a delegate to a enclosing class's function, since: 
    341340         * a different implementation is needed for cols or rows 
    342341         * we're unable to access enclosing class members directly */ 
    343         void delegate (myIt,int,int) setColWidth; // set width of a column, with resize direction 
     342        void delegate (myIt,wdim,int) setColWidth;    // set width of a column, with resize direction 
    344343         
    345344        void dupMin () { 
    346345            width = minWidth.dup; 
    347346        } 
    348         void setCheck (int[] data) { 
     347        void setCheck (wdim[] data) { 
    349348            // Set to provided data: 
    350349            width = data; 
     
    357356         
    358357        // Generate position infomation and return total width (i.e. widget width/height) 
    359         int genPositions () { 
     358        wdim genPositions () { 
    360359            pos.length = minWidth.length; 
    361360             
    362             int x = 0; 
     361            wdim x = 0; 
    363362            foreach (i, w; width) { 
    364363                pos[i] = x; 
     
    370369        // Get the row/column a click occured in 
    371370        // Returns -i if in space to left of col i, or i if on col i 
    372         myDiff getCell (int l) { 
     371        myDiff getCell (wdim l) { 
    373372            myDiff i = minWidth.length - 1; // starting from right... 
    374373            while (l < pos[i]) {        // decrement while left of this column 
     
    382381         
    383382        // Calculate resizeU/resizeD, and return true if unable to resize. 
    384         bool findResize (int l) { 
     383        bool findResize (wdim l) { 
    385384            resizeU = -getCell (l);     // potential start for upward-resizes 
    386385            if (resizeU <= 0) return true;  // not on a space between cells 
     
    419418        *  index is passed, this should get increased (if diff > 0) but not decreased. 
    420419        */ 
    421         int adjustCellSizes (int diff, myDiff start, int incr) 
     420        wdim adjustCellSizes (wdim diff, myDiff start, int incr) 
    422421        in { 
    423422            // Could occur if adjust isn't called first, but this would be a code error: 
     
    436435            } 
    437436            else if (diff < 0) {    // decrease 
    438                 int rd = diff;        // running diff 
     437                wdim rd = diff;       // running diff 
    439438                aCSwhile: 
    440439                while (true) { 
     
    469468        } 
    470469         
    471         void resize (int diff) { 
     470        void resize (wdim diff) { 
    472471            if (resizeU <= 0) return; 
    473472             
     
    485484     
    486485    // Index types. Note that in some cases they need to hold negative values. 
    487     // Int is used for resizing direction (although ptrdiff_t would be more appropriate), 
     486    // int is used for resizing direction (although ptrdiff_t would be more appropriate), 
    488487    // since the value must always be -1 or +1 and int is smaller on X86_64. 
    489488    alias size_t myIt; 
  • mde/gui/widget/miscWidgets.d

    r57 r58  
    7272    } 
    7373     
    74     void clickEvent (ushort, ushort, ubyte b, bool state) { 
     74    void clickEvent (wdabs, wdabs, ubyte b, bool state) { 
    7575        if (b == 1 && state == true) { 
    7676            pushed = true; 
     
    8181    } 
    8282    // Called when a mouse motion/click event occurs while (held == true) 
    83     bool clickWhileHeld (ushort cx, ushort cy, ubyte b, bool state) { 
     83    bool clickWhileHeld (wdabs cx, wdabs cy, ubyte b, bool state) { 
    8484        if (b == 1 && state == false) { 
    8585            if (cx >= x && cx < x+w && cy >= y && cy < y+h) // button event 
     
    9494        return false; 
    9595    } 
    96     void motionWhileHeld (ushort cx, ushort cy) { 
     96    void motionWhileHeld (wdabs cx, wdabs cy) { 
    9797        bool oldPushed = pushed; 
    9898        if (cx >= x && cx < x+w && cy >= y && cy < y+h) pushed = true; 
     
    110110        if (font is null) font = FontStyle.get("default"); 
    111111        font.updateBlock (str, textCache); 
    112         mw = textCache.w; 
    113         mh = textCache.h; 
     112        mw = cast(wdim) textCache.w; 
     113        mh = cast(wdim) textCache.h; 
    114114        colour = Colour (cast(ubyte) (data[1] >> 16u), 
    115115                         cast(ubyte) (data[1] >> 8u),