# HG changeset patch # User David Bryant # Date 1298203026 -37800 # Node ID 7abaf5c3959fefb20a4350492c8eba1680eac05b # Parent ab745d8b10e547b755fcd23a9bb9fc42e4e805f2# Parent 345fb56d89fc6181b45558ed5dfc4ed937579ee6 Merge diff -r ab745d8b10e5 -r 7abaf5c3959f doodle/core/backtrace.d diff -r ab745d8b10e5 -r 7abaf5c3959f doodle/core/logging.d diff -r ab745d8b10e5 -r 7abaf5c3959f doodle/dia/icanvas.d diff -r ab745d8b10e5 -r 7abaf5c3959f doodle/dia/layer_stack.d --- 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; } diff -r ab745d8b10e5 -r 7abaf5c3959f doodle/dia/page_layer.d --- 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: diff -r ab745d8b10e5 -r 7abaf5c3959f doodle/fig/diagram_layer.d --- 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, diff -r ab745d8b10e5 -r 7abaf5c3959f doodle/gtk/cairo_canvas.d --- 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; } } diff -r ab745d8b10e5 -r 7abaf5c3959f doodle/gtk/palette.d --- 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); diff -r ab745d8b10e5 -r 7abaf5c3959f doodle/gtk/ruler.d --- /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; + } +} ++/ diff -r ab745d8b10e5 -r 7abaf5c3959f doodle/tk/color.d --- 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; } } diff -r ab745d8b10e5 -r 7abaf5c3959f doodle/tk/events.d diff -r ab745d8b10e5 -r 7abaf5c3959f doodle/tk/geometry.d --- 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); diff -r ab745d8b10e5 -r 7abaf5c3959f doodle/tk/test/test1.d --- 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 diff -r ab745d8b10e5 -r 7abaf5c3959f nobuild/dot-hgrc