Mercurial > projects > doodle
comparison doodle/gtk/canvas.d @ 40:1f97022e5c6d
Checkpoint. Development continues...
author | daveb |
---|---|
date | Mon, 12 Apr 2010 14:01:54 +0930 |
parents | 3f6bb0bb22dc |
children | f2e4e1d29b98 |
comparison
equal
deleted
inserted
replaced
39:b6c34f1fc7f3 | 40:1f97022e5c6d |
---|---|
4 import doodle.dia.icanvas; | 4 import doodle.dia.icanvas; |
5 import doodle.tk.events; | 5 import doodle.tk.events; |
6 } | 6 } |
7 | 7 |
8 private { | 8 private { |
9 import doodle.core.logging; | |
9 import doodle.gtk.conversions; | 10 import doodle.gtk.conversions; |
10 import doodle.tk.misc; | 11 import doodle.tk.misc; |
11 import doodle.cairo.routines; | 12 import doodle.cairo.routines; |
12 | 13 |
13 import cairo.Surface; | 14 import cairo.Surface; |
50 writefln("View centre: %s", mViewCentre); | 51 writefln("View centre: %s", mViewCentre); |
51 */ | 52 */ |
52 | 53 |
53 // Create our child widgets and register callbacks | 54 // Create our child widgets and register callbacks |
54 | 55 |
56 info("B1"); | |
55 mHRuler = new HRuler; | 57 mHRuler = new HRuler; |
56 attach(mHRuler, | 58 attach(mHRuler, |
57 1, 2, | 59 1, 2, |
58 0, 1, | 60 0, 1, |
59 AttachOptions.FILL | AttachOptions.EXPAND, AttachOptions.SHRINK, | 61 AttachOptions.FILL | AttachOptions.EXPAND, AttachOptions.SHRINK, |
60 0, 0); | 62 0, 0); |
61 mHRuler.setMetric(MetricType.PIXELS); | 63 mHRuler.setMetric(MetricType.PIXELS); |
62 | 64 |
65 info("B2"); | |
63 mVRuler = new VRuler; | 66 mVRuler = new VRuler; |
64 attach(mVRuler, | 67 attach(mVRuler, |
65 0, 1, | 68 0, 1, |
66 1, 2, | 69 1, 2, |
67 AttachOptions.SHRINK, AttachOptions.FILL | AttachOptions.EXPAND, | 70 AttachOptions.SHRINK, AttachOptions.FILL | AttachOptions.EXPAND, |
68 0, 0); | 71 0, 0); |
72 info("B3"); | |
69 mVRuler.setMetric(MetricType.PIXELS); | 73 mVRuler.setMetric(MetricType.PIXELS); |
74 info("J"); | |
70 | 75 |
71 mDrawingArea = new DrawingArea; | 76 mDrawingArea = new DrawingArea; |
72 mDrawingArea.addOnRealize(&on_realize); | 77 mDrawingArea.addOnRealize(&on_realize); |
73 mDrawingArea.addOnConfigure(&on_configure); | 78 mDrawingArea.addOnConfigure(&on_configure); |
74 mDrawingArea.addOnExpose(&on_expose); | 79 mDrawingArea.addOnExpose(&on_expose); |
90 EventMask.KEY_RELEASE_MASK | | 95 EventMask.KEY_RELEASE_MASK | |
91 EventMask.ENTER_NOTIFY_MASK | | 96 EventMask.ENTER_NOTIFY_MASK | |
92 EventMask.LEAVE_NOTIFY_MASK | | 97 EventMask.LEAVE_NOTIFY_MASK | |
93 EventMask.FOCUS_CHANGE_MASK | | 98 EventMask.FOCUS_CHANGE_MASK | |
94 EventMask.SCROLL_MASK); | 99 EventMask.SCROLL_MASK); |
100 info("M"); | |
95 | 101 |
96 attach(mDrawingArea, | 102 attach(mDrawingArea, |
97 1, 2, | 103 1, 2, |
98 1, 2, | 104 1, 2, |
99 AttachOptions.FILL | AttachOptions.EXPAND, AttachOptions.FILL | AttachOptions.EXPAND, | 105 AttachOptions.FILL | AttachOptions.EXPAND, AttachOptions.FILL | AttachOptions.EXPAND, |
108 attach(mHScrollbar, | 114 attach(mHScrollbar, |
109 1, 2, | 115 1, 2, |
110 2, 3, | 116 2, 3, |
111 AttachOptions.FILL | AttachOptions.EXPAND, AttachOptions.SHRINK, | 117 AttachOptions.FILL | AttachOptions.EXPAND, AttachOptions.SHRINK, |
112 0, 0); | 118 0, 0); |
119 info("Q"); | |
113 | 120 |
114 mVAdjustment = new Adjustment(0.0, 0.0, 1.0, 0.2, 0.5, 0.5); | 121 mVAdjustment = new Adjustment(0.0, 0.0, 1.0, 0.2, 0.5, 0.5); |
115 mVAdjustment.addOnValueChanged(&onValueChanged); | 122 mVAdjustment.addOnValueChanged(&onValueChanged); |
116 mVScrollbar = new VScrollbar(mVAdjustment); | 123 mVScrollbar = new VScrollbar(mVAdjustment); |
117 mVScrollbar.setInverted(true); | 124 mVScrollbar.setInverted(true); |
158 cursor_type = CursorType.HAND1; | 165 cursor_type = CursorType.HAND1; |
159 break; | 166 break; |
160 case Cursor.CROSSHAIR: | 167 case Cursor.CROSSHAIR: |
161 cursor_type = CursorType.CROSSHAIR; | 168 cursor_type = CursorType.CROSSHAIR; |
162 break; | 169 break; |
170 default: | |
171 assert(0); | |
163 } | 172 } |
164 | 173 |
165 mDrawingArea.setCursor(new gdk.Cursor.Cursor(cursor_type)); | 174 mDrawingArea.setCursor(new gdk.Cursor.Cursor(cursor_type)); |
166 } | 175 } |
167 | 176 |