changeset 105:7abaf5c3959f

Merge
author David Bryant <bagnose@gmail.com>
date Sun, 20 Feb 2011 22:27:06 +1030
parents ab745d8b10e5 (current diff) 345fb56d89fc (diff)
children 5677ba065636 3005ec1ba0e2
files doodle/core/backtrace.d doodle/core/logging.d doodle/dia/icanvas.d doodle/tk/events.d nobuild/dot-hgrc
diffstat 9 files changed, 62 insertions(+), 39 deletions(-) [+]
line wrap: on
line diff
--- a/doodle/dia/layer_stack.d	Sun Feb 20 22:24:36 2011 +1030
+++ b/doodle/dia/layer_stack.d	Sun Feb 20 22:27:06 2011 +1030
@@ -11,7 +11,7 @@
 
     Rectangle bounds() const {
         // Take the union of all layer bounds
-        Rectangle bounds = Rectangle.DEFAULT;
+        Rectangle bounds;
         foreach (layer; _layers) { bounds = bounds | layer.bounds; }
         return bounds;
     }
--- a/doodle/dia/page_layer.d	Sun Feb 20 22:24:36 2011 +1030
+++ b/doodle/dia/page_layer.d	Sun Feb 20 22:27:06 2011 +1030
@@ -10,8 +10,8 @@
 class PageLayer : Layer, IPage {
     this(in string name = "Page") {
         super(name);
-        _pageGeometry = Rectangle(Point.DEFAULT, Vector(210.0, 297.0));
-        //_pageGeometry = Rectangle(Point.DEFAULT, Vector(100.0, 100.0));
+        _pageGeometry = Rectangle(Point(), Vector(210.0, 297.0));
+        //_pageGeometry = Rectangle(Point(), Vector(100.0, 100.0));
     }
 
     // Layer overrides:
--- a/doodle/fig/diagram_layer.d	Sun Feb 20 22:24:36 2011 +1030
+++ b/doodle/fig/diagram_layer.d	Sun Feb 20 22:27:06 2011 +1030
@@ -22,10 +22,10 @@
     override Rectangle bounds() const {
         // Take the union of all diagram element bounds
         /*
-        Rectangle bounds = Rectangle.DEFAULT;
+        Rectangle bounds;
         foreach (element; _elements) { bounds = bounds | element.bounds; }
         */
-        return Rectangle.DEFAULT;
+        return Rectangle();
     }
 
     override void draw(in Rectangle screenDamage, scope Renderer screenRenderer,
--- a/doodle/gtk/cairo_canvas.d	Sun Feb 20 22:24:36 2011 +1030
+++ b/doodle/gtk/cairo_canvas.d	Sun Feb 20 22:27:06 2011 +1030
@@ -36,11 +36,18 @@
 }
 
 final class CairoCanvas : Table, private IViewport {
+    static this() {
+        _cursors = [
+            Cursor.DEFAULT   : CursorType.ARROW,
+            Cursor.HAND      : CursorType.HAND1,
+            Cursor.CROSSHAIR : CursorType.CROSSHAIR,
+            Cursor.PENCIL    : CursorType.PENCIL
+            ];
+    }
+
     this(in Layer[] layers, IEventHandler eventHandler, IGrid grid, in double pixelsPerMillimetre) {
         super(3, 3, 0);
 
-        _damageScreen = Rectangle.DEFAULT;
-
         _eventHandler = eventHandler;
         _grid = grid;
         _pixelsPerMillimetre = pixelsPerMillimetre;
@@ -131,13 +138,6 @@
                AttachOptions.SHRINK,
                AttachOptions.FILL | AttachOptions.EXPAND,
                0, 0);
-
-        _cursors = [
-            Cursor.DEFAULT   : CursorType.ARROW,
-            Cursor.HAND      : CursorType.HAND1,
-            Cursor.CROSSHAIR : CursorType.CROSSHAIR,
-            Cursor.PENCIL    : CursorType.PENCIL
-            ];
     }
 
     protected {         // XXX the compiler complains about unimplemented methods if this is private
@@ -410,7 +410,7 @@
                 int x, y, w, h;
                 _damageScreen.getQuantised(x, y, w, h);
                 _drawingArea.queueDrawArea(x, cast(int)_screenModel.viewBoundsScreen.h - (y + h), w, h);
-                _damageScreen = Rectangle.DEFAULT;
+                _damageScreen = Rectangle();
             }
         }
 
@@ -436,6 +436,6 @@
         Rectangle     _damageScreen;
         ScreenModel   _screenModel;
 
-        immutable CursorType[Cursor] _cursors;
+        static immutable CursorType[Cursor] _cursors;
     }
 }
--- a/doodle/gtk/palette.d	Sun Feb 20 22:24:36 2011 +1030
+++ b/doodle/gtk/palette.d	Sun Feb 20 22:27:06 2011 +1030
@@ -45,7 +45,7 @@
             }
 
             auto image = new Image(_iconBase ~ "/" ~ item.iconPath);
-            auto label = new Label(item.tooltipText);
+            auto label = new Label(item.labelText);
             button.setIconWidget(image);
             button.setLabelWidget(label);
             button.setTooltipText(item.tooltipText);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doodle/gtk/ruler.d	Sun Feb 20 22:27:06 2011 +1030
@@ -0,0 +1,35 @@
+module doodle.gtk.ruler;
+
+/+
+public {
+    import gtk.DrawingArea;
+}
+
+private {
+}
+
+//
+// 
+
+class Ruler : DrawingArea {
+    this() {
+        addOnConfigure(&onConfigure);
+    }
+
+    void move(double base) {
+    }
+
+    private {
+        bool onExpose(GdkEventExpose * event, Widget widget) {
+        }
+
+        bool onConfigure(GdkEventConfigure * event, Widget widget) {
+            assert(widget is this);
+        }
+
+        double _min, _max;      // millimetres
+        bool _visible;
+        double _value;
+    }
+}
++/
--- a/doodle/tk/color.d	Sun Feb 20 22:24:36 2011 +1030
+++ b/doodle/tk/color.d	Sun Feb 20 22:27:06 2011 +1030
@@ -1,8 +1,6 @@
 module doodle.tk.color;
 
 struct Color {
-    static immutable Color DEFAULT = Color(0.0, 0.0, 0.0, 1.0);
-
     this(in double r, in double g, in double b, in double a) {
         // XXX how to deal with out of range? Clamp/assert
         _r = r;
@@ -20,6 +18,6 @@
     double a() const { return _a; }
 
     private {
-        double _r, _g, _b, _a;
+        double _r = 0.0, _g = 0.0, _b = 0.0, _a = 1.0;
     }
 }
--- a/doodle/tk/geometry.d	Sun Feb 20 22:24:36 2011 +1030
+++ b/doodle/tk/geometry.d	Sun Feb 20 22:27:06 2011 +1030
@@ -24,8 +24,6 @@
 //
 
 struct Point {
-    static immutable Point DEFAULT = Point(0.0, 0.0);
-
     this(in double x, in double y) {
         _x = x;
         _y = y;
@@ -51,7 +49,7 @@
     double y() const { return _y; }
 
     private {
-        double _x, _y;
+        double _x = 0.0, _y = 0.0;
     }
 }
 
@@ -68,8 +66,6 @@
 //
 
 struct Vector {
-    static Vector DEFAULT = Vector(0.0, 0.0);
-
     this(in double x, in double y) {
         _x = x;
         _y = y;
@@ -109,7 +105,7 @@
     double y() const { return _y; }
 
     private {
-        double _x, _y;
+        double _x = 0.0, _y = 0.0;
     }
 }
 
@@ -135,12 +131,6 @@
 //
 
 struct Rectangle {
-    static Rectangle DEFAULT;
-
-    static this() {
-        DEFAULT = Rectangle(Point.DEFAULT, Vector.DEFAULT);
-    }
-
     /*
        static Rectangle from_arbitrary_corners(in Point corner1, in Point corner) {
        }
@@ -177,14 +167,14 @@
     // Intersection
     Rectangle opAnd(in Rectangle r) const {
         if (invalid() || r.invalid()) {
-            return DEFAULT;
+            return Rectangle();
         }
         else {
             Point max = minExtents(corner1(), r.corner1());
             Point min = maxExtents(corner0(), r.corner0());
 
             if (max.x < min.x || max.y < min.y) {
-                return DEFAULT;
+                return Rectangle();
             }
             else {
                 return Rectangle(min, max);
--- a/doodle/tk/test/test1.d	Sun Feb 20 22:24:36 2011 +1030
+++ b/doodle/tk/test/test1.d	Sun Feb 20 22:27:06 2011 +1030
@@ -6,7 +6,7 @@
 void test1() {
     writefln("*** Test1 ***");
 
-    Point p1 = Point.DEFAULT;
+    Point p1;
     Point p2 = p1;                              // copy construction
     assert(p1 == p2);                           // equality
     assert(!(p1 != p2));                        // inequality
@@ -14,10 +14,10 @@
     assert(p1 == p2);
 
     Point p3 = Point(3.0, 5.0);                 // standard constructor
-    assert(p3 - p3 == Vector.DEFAULT);          // subtraction (point minus point)
+    assert(p3 - p3 == Vector());                // subtraction (point minus point)
 
     Vector v3 = Vector(3.0, 5.0);
-    assert(p3 - v3 == Point.DEFAULT);           // subtraction (point minus vector)
+    assert(p3 - v3 == Point());                 // subtraction (point minus vector)
 
     Point p4 = Point(1.0, 10.0);
     Point p5 = Point(10.0, 1.0);
@@ -30,7 +30,7 @@
 void test2() {
     writefln("*** Test2 ***");
 
-    Vector v1 = Vector.DEFAULT;
+    Vector v1;
     Vector v2 = v1;                             // copy construction
     assert(v1 == v2);                           // equality
     assert(!(v1 != v2));                        // inequality
@@ -38,7 +38,7 @@
 
     Vector v3 = Vector(3.0, 4.0);               // standard construction
     assert(v3 + v3 == Vector(6.0, 8.0));        // addition
-    assert(v3 - v3 == Vector.DEFAULT);          // subtraction
+    assert(v3 - v3 == Vector());                // subtraction
     assert(-v3 == Vector(-3.0, -4.0));          // negation
     assert(v3.length == 5.0);                   // length
     assert(2.0 * v3 == Vector(6.0, 8.0));       // scalar multiplication