heromyth
Joined: 26 Nov 2006 Posts: 46
|
Posted: Wed Mar 07, 2012 8:42 pm Post subject: [patch]For building gtkD on Windows 7 |
|
|
Here is the patch. It's just about the demos.
Code: |
Index: demos/gtkD/DemoCustomList/CustomList.d
===================================================================
--- demos/gtkD/DemoCustomList/CustomList.d (revision 946)
+++ demos/gtkD/DemoCustomList/CustomList.d (working copy)
@@ -173,6 +173,9 @@
case CustomListColumn.YearBorn:
value.setUint(record.yearBorn);
break;
+
+ default:
+ break;
}
return value;
Index: demos/cairo/text_image/text_image.d
===================================================================
--- demos/cairo/text_image/text_image.d (revision 946)
+++ demos/cairo/text_image/text_image.d (working copy)
@@ -18,7 +18,7 @@
import gdk.Drawable;
import gtk.DrawingArea;
-class CairoText : public DrawingArea
+class CairoText : DrawingArea
{
public:
this()
Index: demos/cairo/cairo_clock/clock.d
===================================================================
--- demos/cairo/cairo_clock/clock.d (revision 946)
+++ demos/cairo/cairo_clock/clock.d (working copy)
@@ -1,19 +1,19 @@
/**
- * clock.d
- *
- * A gtkD widget that implements a clock face
- *
- * Based on the Gtkmm example by:
- * Jonathon Jongsma
- *
- * and the original GTK+ example by:
- * (c) 2005-2006, Davyd Madeley
- *
- * Authors:
- * Jonas Kivi (D version)
- * Jonathon Jongsma (C++ version)
- * Davyd Madeley (C version)
- */
+* clock.d
+*
+* A gtkD widget that implements a clock face
+*
+* Based on the Gtkmm example by:
+* Jonathon Jongsma
+*
+* and the original GTK+ example by:
+* (c) 2005-2006, Davyd Madeley
+*
+* Authors:
+* Jonas Kivi (D version)
+* Jonathon Jongsma (C++ version)
+* Davyd Madeley (C version)
+*/
module clock;
@@ -27,7 +27,7 @@
import tango.time.Time;
import tangoClock = tango.time.WallClock;
}
-else import std.date;
+else import std.datetime;
import gtk.Timeout;
@@ -41,7 +41,7 @@
import gtk.DrawingArea;
-class Clock : public DrawingArea
+class Clock : DrawingArea
{
public:
this()
@@ -76,7 +76,7 @@
// clip to the area indicated by the expose event so that we only redraw
// the portion of the window that needs to be redrawn
cr.rectangle(event.area.x, event.area.y,
- event.area.width, event.area.height);
+ event.area.width, event.area.height);
cr.clip();
}
@@ -87,22 +87,22 @@
cr.setLineWidth(m_lineWidth);
cr.save();
- cr.setSourceRgba(0.3, 0.6, 0.2, 0.9); // brownish green
- cr.paint();
+ cr.setSourceRgba(0.3, 0.6, 0.2, 0.9); // brownish green
+ cr.paint();
cr.restore();
cr.arc(0, 0, m_radius, 0, 2 * PI);
cr.save();
- cr.setSourceRgba(0.0, 0.0, 0.0, 0.8);
- cr.fillPreserve();
+ cr.setSourceRgba(0.0, 0.0, 0.0, 0.8);
+ cr.fillPreserve();
cr.restore();
cr.save();
- cr.setSourceRgba(1.0, 1.0, 1.0, 1.0);
- cr.setLineWidth( m_lineWidth * 1.7);
- cr.strokePreserve();
- cr.clip();
+ cr.setSourceRgba(1.0, 1.0, 1.0, 1.0);
+ cr.setLineWidth( m_lineWidth * 1.7);
+ cr.strokePreserve();
+ cr.clip();
cr.restore();
@@ -113,23 +113,23 @@
double inset = 0.07;
cr.save();
- cr.setSourceRgba(1.0, 1.0, 1.0, 1.0);
- cr.setLineWidth( m_lineWidth * 0.25);
- cr.setLineCap(cairo_line_cap_t.ROUND);
+ cr.setSourceRgba(1.0, 1.0, 1.0, 1.0);
+ cr.setLineWidth( m_lineWidth * 0.25);
+ cr.setLineCap(cairo_line_cap_t.ROUND);
- if (i % 3 != 0)
- {
- inset *= 1.2;
- cr.setLineWidth( m_lineWidth * 0.5 );
- }
+ if (i % 3 != 0)
+ {
+ inset *= 1.2;
+ cr.setLineWidth( m_lineWidth * 0.5 );
+ }
- cr.moveTo(
- (m_radius - inset) * cos (i * PI / 6),
- (m_radius - inset) * sin (i * PI / 6));
- cr.lineTo (
- m_radius * cos (i * PI / 6),
- m_radius * sin (i * PI / 6));
- cr.stroke();
+ cr.moveTo(
+ (m_radius - inset) * cos (i * PI / 6),
+ (m_radius - inset) * sin (i * PI / 6));
+ cr.lineTo (
+ m_radius * cos (i * PI / 6),
+ m_radius * sin (i * PI / 6));
+ cr.stroke();
cr.restore(); // stack-pen-size
}
@@ -143,52 +143,40 @@
}
else
{
- d_time lNow;
- string lNowString;
-
- // Grab the date and time relative to UTC
- lNow = std.date.getUTCtime();
- // Convert this into the local date and time for display.
- lNowString = std.date.toString(lNow);
-
- Date timeinfo;
- timeinfo.parse(lNowString);
-
+ SysTime lNow = std.datetime.Clock.currTime();
// compute the angles of the indicators of our clock
- double minutes = timeinfo.minute * PI / 30;
- double hours = timeinfo.hour * PI / 6;
- double seconds= timeinfo.second * PI / 30;
+ double minutes = lNow.minute * PI / 30;
+ double hours = lNow.hour * PI / 6;
+ double seconds= lNow.second * PI / 30;
}
- //writefln(timeinfo.hour, ".", timeinfo.minute, ".", timeinfo.second);
+ cr.save();
+ cr.setLineCap(cairo_line_cap_t.ROUND);
+ // draw the seconds hand
cr.save();
- cr.setLineCap(cairo_line_cap_t.ROUND);
+ cr.setLineWidth(m_lineWidth / 3);
+ cr.setSourceRgba(0.7, 0.7, 0.85, 0.8); // blueish gray
+ cr.moveTo(0, 0);
+ cr.lineTo(sin(seconds) * (m_radius * 0.8),
+ -cos(seconds) * (m_radius * 0.8));
+ cr.stroke();
+ cr.restore();
- // draw the seconds hand
- cr.save();
- cr.setLineWidth(m_lineWidth / 3);
- cr.setSourceRgba(0.7, 0.7, 0.85, 0.8); // blueish gray
- cr.moveTo(0, 0);
- cr.lineTo(sin(seconds) * (m_radius * 0.8),
- -cos(seconds) * (m_radius * 0.8));
- cr.stroke();
- cr.restore();
+ // draw the minutes hand
+ //cr.setSourceRgba(0.117, 0.337, 0.612, 0.9); // blue
+ cr.setSourceRgba(0.712, 0.337, 0.117, 0.9); // red
+ cr.moveTo(0, 0);
+ cr.lineTo(sin(minutes + seconds / 60) * (m_radius * 0.7),
+ -cos(minutes + seconds / 60) * (m_radius * 0.7));
+ cr.stroke();
- // draw the minutes hand
- //cr.setSourceRgba(0.117, 0.337, 0.612, 0.9); // blue
- cr.setSourceRgba(0.712, 0.337, 0.117, 0.9); // red
- cr.moveTo(0, 0);
- cr.lineTo(sin(minutes + seconds / 60) * (m_radius * 0.7),
- -cos(minutes + seconds / 60) * (m_radius * 0.7));
- cr.stroke();
-
- // draw the hours hand
- cr.setSourceRgba(0.337, 0.612, 0.117, 0.9); // green
- cr.moveTo(0, 0);
- cr.lineTo(sin(hours + minutes / 12.0) * (m_radius * 0.4),
- -cos(hours + minutes / 12.0) * (m_radius * 0.4));
- cr.stroke();
+ // draw the hours hand
+ cr.setSourceRgba(0.337, 0.612, 0.117, 0.9); // green
+ cr.moveTo(0, 0);
+ cr.lineTo(sin(hours + minutes / 12.0) * (m_radius * 0.4),
+ -cos(hours + minutes / 12.0) * (m_radius * 0.4));
+ cr.stroke();
cr.restore();
// draw a little dot in the middle
|
|
|